summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt11
-rw-r--r--client/CMakeLists.txt5
-rw-r--r--cmake/readline.cmake131
-rw-r--r--configure.cmake9
-rw-r--r--include/my_stacktrace.h11
-rw-r--r--libmysqld/examples/CMakeLists.txt5
-rw-r--r--mysys/my_addr_resolve.c1
-rw-r--r--mysys/safemalloc.c2
8 files changed, 90 insertions, 85 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d6cfd7fc288..b6f771544a7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -166,6 +166,7 @@ ENDIF()
OPTION (WITH_UNIT_TESTS "Compile MySQL with unit tests" ON)
MARK_AS_ADVANCED(CYBOZU BACKUP_TEST WITHOUT_SERVER DISABLE_SHARED)
+OPTION(NOT_FOR_DISTRIBUTION "Allow linking with GPLv2-incompatible system libraries. Only set it you never plan to distribute the resulting binaries" OFF)
OPTION(ENABLE_DEBUG_SYNC "Enable debug sync (debug builds only)" ON)
IF(ENABLE_DEBUG_SYNC)
@@ -264,9 +265,9 @@ MYSQL_CHECK_READLINE()
#
IF(MYSQL_MAINTAINER_MODE)
# Set compiler flags required under maintainer mode.
- MESSAGE(STATUS "C warning options: ${MY_MAINTAINER_C_WARNINGS}")
+ #MESSAGE(STATUS "C warning options: ${MY_MAINTAINER_C_WARNINGS}")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${MY_MAINTAINER_C_WARNINGS}")
- MESSAGE(STATUS "C++ warning options: ${MY_MAINTAINER_CXX_WARNINGS}")
+ #MESSAGE(STATUS "C++ warning options: ${MY_MAINTAINER_CXX_WARNINGS}")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${MY_MAINTAINER_CXX_WARNINGS}")
ENDIF()
@@ -392,3 +393,9 @@ IF(NOT INSTALL_LAYOUT MATCHES "RPM")
PATTERN "sp-imp-spec.txt" EXCLUDE
)
ENDIF()
+
+IF(NON_DISTRIBUTABLE_WARNING)
+ MESSAGE(WARNING "
+You have linked MariaDB with GPLv3 libraries! You may not distribute the resulting binary. If you do, you will put yourself into a legal problem with Free Software Foundation.")
+ENDIF()
+
diff --git a/client/CMakeLists.txt b/client/CMakeLists.txt
index 5ddaff67692..18ecf2de03d 100644
--- a/client/CMakeLists.txt
+++ b/client/CMakeLists.txt
@@ -21,16 +21,15 @@ INCLUDE_DIRECTORIES(
${CMAKE_SOURCE_DIR}/regex
${CMAKE_SOURCE_DIR}/sql
${CMAKE_SOURCE_DIR}/strings
- ${READLINE_INCLUDE_DIR}
+ ${MY_READLINE_INCLUDE_DIR}
${CMAKE_CURRENT_BINARY_DIR}
)
-ADD_DEFINITIONS(${READLINE_DEFINES})
ADD_DEFINITIONS(${SSL_DEFINES})
MYSQL_ADD_EXECUTABLE(mysql completion_hash.cc mysql.cc readline.cc sql_string.cc)
TARGET_LINK_LIBRARIES(mysql mysqlclient)
IF(UNIX)
- TARGET_LINK_LIBRARIES(mysql ${READLINE_LIBRARY})
+ TARGET_LINK_LIBRARIES(mysql ${MY_READLINE_LIBRARY})
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -rdynamic")
ENDIF(UNIX)
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()
diff --git a/configure.cmake b/configure.cmake
index 2356d64336b..35c2027b4e0 100644
--- a/configure.cmake
+++ b/configure.cmake
@@ -187,7 +187,7 @@ CHECK_INCLUDE_FILES (aio.h HAVE_AIO_H)
CHECK_INCLUDE_FILES (arpa/inet.h HAVE_ARPA_INET_H)
CHECK_INCLUDE_FILES (crypt.h HAVE_CRYPT_H)
CHECK_INCLUDE_FILE_CXX (cxxabi.h HAVE_CXXABI_H)
-CHECK_INCLUDE_FILES (bfd.h HAVE_BFD_H)
+CHECK_INCLUDE_FILES (bfd.h BFD_H_EXISTS)
CHECK_INCLUDE_FILES (dirent.h HAVE_DIRENT_H)
CHECK_INCLUDE_FILES (dlfcn.h HAVE_DLFCN_H)
CHECK_INCLUDE_FILES (execinfo.h HAVE_EXECINFO_H)
@@ -261,6 +261,13 @@ CHECK_INCLUDE_FILES (wchar.h HAVE_WCHAR_H)
CHECK_INCLUDE_FILES (wctype.h HAVE_WCTYPE_H)
CHECK_INCLUDE_FILES (sys/sockio.h HAVE_SYS_SOCKIO_H)
+IF(BFD_H_EXISTS)
+ IF(NOT_FOR_DISTRIBUTION)
+ SET(NON_DISTRIBUTABLE_WARNING 1)
+ SET(HAVE_BFD_H 1)
+ ENDIF()
+ENDIF()
+
IF(HAVE_SYS_STREAM_H)
# Needs sys/stream.h on Solaris
CHECK_INCLUDE_FILES ("sys/stream.h;sys/ptem.h" HAVE_SYS_PTEM_H)
diff --git a/include/my_stacktrace.h b/include/my_stacktrace.h
index 30f0203a43e..a9590a76368 100644
--- a/include/my_stacktrace.h
+++ b/include/my_stacktrace.h
@@ -55,23 +55,22 @@ void my_set_exception_pointers(EXCEPTION_POINTERS *ep);
#endif
#endif
-/* at the moment, safemalloc is the main user of libbfd */
-#ifndef SAFEMALLOC
-#undef HAVE_BFD_H
-#endif
-
#ifdef HAVE_BFD_H
#define HAVE_MY_ADDR_RESOLVE 1
#endif
-#ifdef HAVE_MY_ADDR_RESOLVE
typedef struct {
const char *file;
const char *func;
uint line;
} my_addr_loc;
+
+#ifdef HAVE_MY_ADDR_RESOLVE
int my_addr_resolve(void *ptr, my_addr_loc *loc);
const char *my_addr_resolve_init();
+#else
+#define my_addr_resolve_init() (0)
+#define my_addr_resolve(A,B) (1)
#endif
#ifdef HAVE_WRITE_CORE
diff --git a/libmysqld/examples/CMakeLists.txt b/libmysqld/examples/CMakeLists.txt
index 8d76698117a..209e27c7870 100644
--- a/libmysqld/examples/CMakeLists.txt
+++ b/libmysqld/examples/CMakeLists.txt
@@ -16,7 +16,7 @@
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include
${CMAKE_SOURCE_DIR}/libmysqld/include
${CMAKE_SOURCE_DIR}/regex
- ${READLINE_INCLUDE_DIR}
+ ${MY_READLINE_INCLUDE_DIR}
)
@@ -27,8 +27,7 @@ MYSQL_ADD_EXECUTABLE(mysql_embedded ../../client/completion_hash.cc
../../client/mysql.cc ../../client/readline.cc)
TARGET_LINK_LIBRARIES(mysql_embedded mysqlserver)
IF(UNIX)
- ADD_DEFINITIONS(${READLINE_DEFINES})
- TARGET_LINK_LIBRARIES(mysql_embedded ${READLINE_LIBRARY})
+ TARGET_LINK_LIBRARIES(mysql_embedded ${MY_READLINE_LIBRARY})
ENDIF(UNIX)
MYSQL_ADD_EXECUTABLE(mysqltest_embedded ../../client/mysqltest.cc)
diff --git a/mysys/my_addr_resolve.c b/mysys/my_addr_resolve.c
index c9c9212eb7d..514f825750a 100644
--- a/mysys/my_addr_resolve.c
+++ b/mysys/my_addr_resolve.c
@@ -21,6 +21,7 @@
/**
strip the path, leave the file name and the last dirname
*/
+static const char *strip_path(const char *s) __attribute__((unused));
static const char *strip_path(const char *s)
{
const char *prev, *last;
diff --git a/mysys/safemalloc.c b/mysys/safemalloc.c
index 61ad9af0631..5206a759740 100644
--- a/mysys/safemalloc.c
+++ b/mysys/safemalloc.c
@@ -225,7 +225,7 @@ static void print_stack(void **frame)
fprintf(stderr, ", ");
if (my_addr_resolve(frame[i], &loc))
- fprintf(stderr, "...");
+ fprintf(stderr, "%p", frame[i]);
else
fprintf(stderr, "%s:%u", loc.file, loc.line);
}