Skip to content

Commit

Permalink
cmake: support new libedit interface
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
micmac1 authored and vaintroub committed Sep 20, 2019
1 parent 2f88bd2 commit d992163
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions cmake/readline.cmake
Expand Up @@ -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()

Expand All @@ -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()
Expand Down

0 comments on commit d992163

Please sign in to comment.