summaryrefslogtreecommitdiff
path: root/user/mariadb/libedit.patch
blob: 14dc9db491506f82f3ce5b6a0eb27c6ba4fab8cd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
From d9342e88289fa588ea2f1a094dbfc32f0693e23d Mon Sep 17 00:00:00 2001
From: Sebastian Kemper <sebastian_ml@gmx.net>
Date: Tue, 9 Apr 2019 22:28:10 +0200
Subject: [PATCH] cmake: support new libedit interface

libedit changed it's interface a while ago. MariaDB's cmake file doesn't
recognize the new interface, the compile test fails:

/mariadb-10.2.19/CMakeFiles/CMakeTmp/src.cxx: In function 'int main(int, char**)':
/mariadb-10.2.19/CMakeFiles/CMakeTmp/src.cxx:6:47: error: invalid conversion from 'char*' to 'int' [-fpermissive]
  int res= (*rl_completion_entry_function)(0,0);
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~

Fix this by adding a detection for the new interface as well.

Run-tested on a MIPS machine.

Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
---
 cmake/readline.cmake | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/cmake/readline.cmake b/cmake/readline.cmake
index 12a8980b6a90..a2b2cc4c241f 100644
--- a/cmake/readline.cmake
+++ b/cmake/readline.cmake
@@ -160,8 +160,20 @@ MACRO (MYSQL_FIND_SYSTEM_LIBEDIT)
       int res= (*rl_completion_entry_function)(0,0);
       completion_matches(0,0);
     }"
-    LIBEDIT_INTERFACE)
-    SET(USE_LIBEDIT_INTERFACE ${LIBEDIT_INTERFACE})
+    LIBEDIT_HAVE_COMPLETION_INT)
+
+    CHECK_CXX_SOURCE_COMPILES("
+    #include <stdio.h>
+    #include <readline.h>
+    int main(int argc, char **argv)
+    {
+      char res= *(*rl_completion_entry_function)(0,0);
+      completion_matches(0,0);
+    }"
+    LIBEDIT_HAVE_COMPLETION_CHAR)
+    IF(LIBEDIT_HAVE_COMPLETION_INT OR LIBEDIT_HAVE_COMPLETION_CHAR)
+      SET(USE_LIBEDIT_INTERFACE 1)
+    ENDIF()
   ENDIF()
 ENDMACRO()
 
@@ -187,6 +199,7 @@ MACRO (MYSQL_CHECK_READLINE)
         IF(USE_LIBEDIT_INTERFACE)
           SET(MY_READLINE_INCLUDE_DIR ${LIBEDIT_INCLUDE_DIR})
           SET(MY_READLINE_LIBRARY ${LIBEDIT_LIBRARY} ${CURSES_LIBRARY})
+          SET(USE_NEW_READLINE_INTERFACE ${LIBEDIT_HAVE_COMPLETION_CHAR})
         ELSE()
           MYSQL_USE_BUNDLED_READLINE()
         ENDIF()