diff options
author | Sergei Golubchik <sergii@pisem.net> | 2011-12-14 10:53:32 +0100 |
---|---|---|
committer | Sergei Golubchik <sergii@pisem.net> | 2011-12-14 10:53:32 +0100 |
commit | db8f698c8a03bcc920b9453f8822fbbd8ec7ea66 (patch) | |
tree | 3c12c81dfdf1ea5d2af805fb5f93daa0b45e408a /cmake/readline.cmake | |
parent | 44d335b828440603353d8f1f4dfc6db2cf72ca8c (diff) | |
download | mariadb-git-db8f698c8a03bcc920b9453f8822fbbd8ec7ea66.tar.gz |
new configure option: NOT_FOR_DISTRIBUTION
fix safemalloc to compile w/o libbfd.
CMakeLists.txt:
NOT_FOR_DISTRIBUTION option
cmake/readline.cmake:
simplify libedit/readline detection.
never use bundled libedit.
use system readline v6 only if NOT_FOR_DISTRIBUTION=1
configure.cmake:
use libbfd only if NOT_FOR_DISTRIBUTION=1
include/my_stacktrace.h:
link with libbfd even w/o safemalloc.
Diffstat (limited to 'cmake/readline.cmake')
-rw-r--r-- | cmake/readline.cmake | 131 |
1 files changed, 62 insertions, 69 deletions
diff --git a/cmake/readline.cmake b/cmake/readline.cmake index 4840229a82e..24a411e3f1d 100644 --- a/cmake/readline.cmake +++ b/cmake/readline.cmake @@ -14,6 +14,8 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +INCLUDE(CheckCXXSourceCompiles) + MACRO (MYSQL_CHECK_MULTIBYTE) CHECK_INCLUDE_FILE(wctype.h HAVE_WCTYPE_H) CHECK_INCLUDE_FILE(wchar.h HAVE_WCHAR_H) @@ -112,35 +114,32 @@ ENDMACRO() MACRO (MYSQL_USE_BUNDLED_READLINE) SET(USE_NEW_READLINE_INTERFACE 1) SET(HAVE_HIST_ENTRY) - SET(USE_LIBEDIT_INTERFACE) SET(READLINE_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/cmd-line-utils) SET(READLINE_LIBRARY readline) FIND_CURSES() ADD_SUBDIRECTORY(${CMAKE_SOURCE_DIR}/cmd-line-utils/readline) ENDMACRO() -MACRO (MYSQL_USE_BUNDLED_LIBEDIT) - SET(USE_LIBEDIT_INTERFACE 1) - SET(HAVE_HIST_ENTRY 1) - SET(READLINE_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/cmd-line-utils/libedit) - SET(READLINE_LIBRARY edit) - FIND_CURSES() - ADD_SUBDIRECTORY(${CMAKE_SOURCE_DIR}/cmd-line-utils/libedit) -ENDMACRO() - - -MACRO (MYSQL_FIND_SYSTEM_READLINE name) +MACRO (MYSQL_FIND_SYSTEM_READLINE) - FIND_PATH(${name}_INCLUDE_DIR readline/readline.h ) - FIND_LIBRARY(${name}_LIBRARY NAMES ${name}) - MARK_AS_ADVANCED(${name}_INCLUDE_DIR ${name}_LIBRARY) + FIND_PATH(READLINE_INCLUDE_DIR readline/readline.h ) + FIND_LIBRARY(READLINE_LIBRARY NAMES readline) + MARK_AS_ADVANCED(READLINE_INCLUDE_DIR READLINE_LIBRARY) - INCLUDE(CheckCXXSourceCompiles) - SET(CMAKE_REQUIRES_LIBRARIES ${${name}_LIBRARY}) + SET(CMAKE_REQUIRES_LIBRARIES ${READLINE_LIBRARY}) + + IF(READLINE_LIBRARY AND READLINE_INCLUDE_DIR) + SET(CMAKE_REQUIRED_LIBRARIES ${READLINE_LIBRARY}) + CHECK_CXX_SOURCE_COMPILES(" + #include <stdio.h> + #include <readline/readline.h> + int main(int argc, char **argv) + { + rl_completion_func_t *func1= (rl_completion_func_t*)0; + rl_compentry_func_t *func2= (rl_compentry_func_t*)0; + }" + NEW_READLINE_INTERFACE) - IF(${name}_LIBRARY AND ${name}_INCLUDE_DIR) - SET(SYSTEM_READLINE_FOUND 1) - SET(CMAKE_REQUIRED_LIBRARIES ${${name}_LIBRARY}) CHECK_CXX_SOURCE_COMPILES(" #include <stdio.h> #include <readline/readline.h> @@ -149,37 +148,54 @@ MACRO (MYSQL_FIND_SYSTEM_READLINE name) HIST_ENTRY entry; return 0; }" - ${name}_HAVE_HIST_ENTRY) + HAVE_HIST_ENTRY) - CHECK_CXX_SOURCE_COMPILES(" + CHECK_C_SOURCE_COMPILES(" #include <stdio.h> #include <readline/readline.h> + #if RL_VERSION_MAJOR > 5 + #error + #endif int main(int argc, char **argv) { - char res= *(*rl_completion_entry_function)(0,0); - completion_matches(0,0); + return 0; }" - ${name}_USE_LIBEDIT_INTERFACE) + READLINE_V5) + + IF(NEW_READLINE_INTERFACE) + IF (READLINE_V5) + SET(USE_NEW_READLINE_INTERFACE 1) + ELSE() + IF(NOT_FOR_DISTRIBUTION) + SET(NON_DISTRIBUTABLE_WARNING 1) + SET(USE_NEW_READLINE_INTERFACE 1) + ELSE() + SET(USE_NEW_READLINE_INTERFACE 0) + ENDIF(NOT_FOR_DISTRIBUTION) + ENDIF(READLINE_V5) + ENDIF(NEW_READLINE_INTERFACE) + ENDIF() +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}) + + IF(READLINE_LIBRARY AND READLINE_INCLUDE_DIR) CHECK_CXX_SOURCE_COMPILES(" #include <stdio.h> #include <readline/readline.h> int main(int argc, char **argv) { - rl_completion_func_t *func1= (rl_completion_func_t*)0; - rl_compentry_func_t *func2= (rl_compentry_func_t*)0; + char res= *(*rl_completion_entry_function)(0,0); + completion_matches(0,0); }" - ${name}_USE_NEW_READLINE_INTERFACE) - - IF(${name}_USE_LIBEDIT_INTERFACE OR ${name}_USE_NEW_READLINE_INTERFACE) - SET(READLINE_LIBRARY ${${name}_LIBRARY}) - SET(READLINE_INCLUDE_DIR ${${name}_INCLUDE_DIR}) - SET(HAVE_HIST_ENTRY ${${name}_HAVE_HIST_ENTRY}) - SET(USE_LIBEDIT_INTERFACE ${${name}_USE_LIBEDIT_INTERFACE}) - SET(USE_NEW_READLINE_INTERFACE ${${name}_USE_NEW_READLINE_INTERFACE}) - SET(READLINE_FOUND 1) - ENDIF() + LIBEDIT_INTERFACE) + SET(USE_LIBEDIT_INTERFACE ${LIBEDIT_INTERFACE}) ENDIF() ENDMACRO() @@ -187,44 +203,21 @@ ENDMACRO() MACRO (MYSQL_CHECK_READLINE) IF (NOT WIN32) MYSQL_CHECK_MULTIBYTE() - IF(NOT CYGWIN) - SET(WITH_LIBEDIT ON CACHE BOOL "Use bundled libedit") - SET(WITH_READLINE OFF CACHE BOOL "Use bundled readline") - ELSE() - # Bundled libedit does not compile on cygwin, only readline - SET(WITH_READLINE OFF CACHE BOOL "Use bundled readline") - ENDIF() - - # Handle mutual exclusion of WITH_READLINE/WITH_LIBEDIT variables - # We save current setting to recognize when user switched between - # WITH_READLINE and WITH_LIBEDIT - IF(WITH_READLINE) - IF(NOT SAVE_READLINE_SETTING OR SAVE_READLINE_SETTING MATCHES - "WITH_LIBEDIT") - SET(WITH_LIBEDIT OFF CACHE BOOL "Use bundled libedit" FORCE) - ENDIF() - ELSEIF(WITH_LIBEDIT) - IF(NOT SAVE_READLINE_SETTING OR SAVE_READLINE_SETTING MATCHES - "WITH_READLINE") - SET(WITH_READLINE OFF CACHE BOOL "Use bundled readline" FORCE) - ENDIF() - ENDIF() + SET(WITH_READLINE OFF CACHE BOOL "Use bundled readline") IF(WITH_READLINE) - MYSQL_USE_BUNDLED_READLINE() - SET(SAVE_READLINE_SETTING WITH_READLINE CACHE INTERNAL "" FORCE) - ELSEIF(WITH_LIBEDIT) - MYSQL_USE_BUNDLED_LIBEDIT() - SET(SAVE_READLINE_SETTING WITH_LIBEDIT CACHE INTERNAL "" FORCE) + MYSQL_USE_BUNDLED_READLINE() ELSE() - MYSQL_FIND_SYSTEM_READLINE(readline) - IF(NOT READLINE_FOUND) - MYSQL_FIND_SYSTEM_READLINE(edit) - IF(NOT READLINE_FOUND) - MESSAGE(FATAL_ERROR "Cannot find system readline or libedit libraries.Use WITH_READLINE or WITH_LIBEDIT") + MYSQL_FIND_SYSTEM_READLINE() + IF(NOT USE_NEW_READLINE_INTERFACE) + MYSQL_FIND_SYSTEM_LIBEDIT() + IF(NOT USE_LIBEDIT_INTERFACE) + MYSQL_USE_BUNDLED_READLINE() ENDIF() ENDIF() ENDIF() + SET(MY_READLINE_INCLUDE_DIR ${READLINE_INCLUDE_DIR}) + SET(MY_READLINE_LIBRARY ${READLINE_LIBRARY}) ENDIF(NOT WIN32) ENDMACRO() |