diff options
Diffstat (limited to 'cmake/readline.cmake')
-rw-r--r-- | cmake/readline.cmake | 68 |
1 files changed, 36 insertions, 32 deletions
diff --git a/cmake/readline.cmake b/cmake/readline.cmake index ad6a7382e2a..f570c91c1b5 100644 --- a/cmake/readline.cmake +++ b/cmake/readline.cmake @@ -116,24 +116,23 @@ ENDMACRO() MACRO (MYSQL_USE_BUNDLED_READLINE) SET(USE_NEW_READLINE_INTERFACE 1) SET(HAVE_HIST_ENTRY 0 CACHE INTERNAL "" FORCE) - SET(READLINE_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/extra) - SET(READLINE_LIBRARY readline) + SET(MY_READLINE_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/extra/readline) + SET(MY_READLINE_LIBRARY readline) ADD_SUBDIRECTORY(${CMAKE_SOURCE_DIR}/extra/readline) ENDMACRO() MACRO (MYSQL_FIND_SYSTEM_READLINE) - FIND_PATH(READLINE_INCLUDE_DIR readline/readline.h ) + FIND_PATH(READLINE_INCLUDE_DIR readline.h PATH_SUFFIXES readline) FIND_LIBRARY(READLINE_LIBRARY NAMES readline) MARK_AS_ADVANCED(READLINE_INCLUDE_DIR READLINE_LIBRARY) - SET(CMAKE_REQUIRES_LIBRARIES ${READLINE_LIBRARY} ${CURSES_LIBRARY}) - IF(READLINE_LIBRARY AND READLINE_INCLUDE_DIR) SET(CMAKE_REQUIRED_LIBRARIES ${READLINE_LIBRARY} ${CURSES_LIBRARY}) + SET(CMAKE_REQUIRED_INCLUDES ${READLINE_INCLUDE_DIR}) CHECK_CXX_SOURCE_COMPILES(" #include <stdio.h> - #include <readline/readline.h> + #include <readline.h> int main(int argc, char **argv) { rl_completion_func_t *func1= (rl_completion_func_t*)0; @@ -141,19 +140,9 @@ MACRO (MYSQL_FIND_SYSTEM_READLINE) }" NEW_READLINE_INTERFACE) - CHECK_CXX_SOURCE_COMPILES(" - #include <stdio.h> - #include <readline/readline.h> - int main(int argc, char **argv) - { - HIST_ENTRY entry; - return 0; - }" - HAVE_HIST_ENTRY) - CHECK_C_SOURCE_COMPILES(" #include <stdio.h> - #include <readline/readline.h> + #include <readline.h> #if RL_VERSION_MAJOR > 5 #error #endif @@ -176,30 +165,27 @@ MACRO (MYSQL_FIND_SYSTEM_READLINE) ENDIF(READLINE_V5) ENDIF(NEW_READLINE_INTERFACE) ENDIF() - SET(CMAKE_REQUIRES_LIBRARIES ) ENDMACRO() MACRO (MYSQL_FIND_SYSTEM_LIBEDIT) - - FIND_PATH(READLINE_INCLUDE_DIR readline/readline.h ) - FIND_LIBRARY(READLINE_LIBRARY NAMES readline) - MARK_AS_ADVANCED(READLINE_INCLUDE_DIR READLINE_LIBRARY) - - SET(CMAKE_REQUIRES_LIBRARIES ${READLINE_LIBRARY}) + FIND_PATH(LIBEDIT_INCLUDE_DIR readline.h PATH_SUFFIXES editline edit/readline) + FIND_LIBRARY(LIBEDIT_LIBRARY edit) + MARK_AS_ADVANCED(LIBEDIT_INCLUDE_DIR LIBEDIT_LIBRARY) - IF(READLINE_LIBRARY AND READLINE_INCLUDE_DIR) + IF(LIBEDIT_LIBRARY AND LIBEDIT_INCLUDE_DIR) + SET(CMAKE_REQUIRED_LIBRARIES ${LIBEDIT_LIBRARY}) + SET(CMAKE_REQUIRED_INCLUDES ${LIBEDIT_INCLUDE_DIR}) CHECK_CXX_SOURCE_COMPILES(" #include <stdio.h> - #include <readline/readline.h> + #include <readline.h> int main(int argc, char **argv) { - char res= *(*rl_completion_entry_function)(0,0); + int res= (*rl_completion_entry_function)(0,0); completion_matches(0,0); }" LIBEDIT_INTERFACE) SET(USE_LIBEDIT_INTERFACE ${LIBEDIT_INTERFACE}) ENDIF() - SET(CMAKE_REQUIRES_LIBRARIES) ENDMACRO() @@ -216,15 +202,33 @@ MACRO (MYSQL_CHECK_READLINE) IF (NOT APPLE) MYSQL_FIND_SYSTEM_READLINE() ENDIF() - IF(NOT USE_NEW_READLINE_INTERFACE) + IF(USE_NEW_READLINE_INTERFACE) + SET(MY_READLINE_INCLUDE_DIR ${READLINE_INCLUDE_DIR}) + SET(MY_READLINE_LIBRARY ${READLINE_LIBRARY} ${CURSES_LIBRARY}) + ELSE() MYSQL_FIND_SYSTEM_LIBEDIT() - IF(NOT USE_LIBEDIT_INTERFACE) + IF(USE_LIBEDIT_INTERFACE) + SET(MY_READLINE_INCLUDE_DIR ${LIBEDIT_INCLUDE_DIR}) + SET(MY_READLINE_LIBRARY ${LIBEDIT_LIBRARY} ${CURSES_LIBRARY}) + ELSE() MYSQL_USE_BUNDLED_READLINE() ENDIF() ENDIF() ENDIF() - SET(MY_READLINE_INCLUDE_DIR ${READLINE_INCLUDE_DIR}) - SET(MY_READLINE_LIBRARY ${READLINE_LIBRARY} ${CURSES_LIBRARY}) + + SET(CMAKE_REQUIRED_LIBRARIES ${MY_READLINE_LIBRARY}) + SET(CMAKE_REQUIRED_INCLUDES ${MY_READLINE_INCLUDE_DIR}) + CHECK_CXX_SOURCE_COMPILES(" + #include <stdio.h> + #include <readline.h> + int main(int argc, char **argv) + { + HIST_ENTRY entry; + return 0; + }" + HAVE_HIST_ENTRY) + SET(CMAKE_REQUIRED_LIBRARIES) + SET(CMAKE_REQUIRED_INCLUDES) ENDIF(NOT WIN32) ENDMACRO() |