summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2014-11-28 22:39:22 +0100
committerSergei Golubchik <serg@mariadb.org>2014-12-04 10:41:52 +0100
commit1bd1c29ea0ec51d2efefcadbc1ca217aff9f7610 (patch)
tree9f3032f80d75e7705f36a9963b322c7151e3a645
parent0438f1254090f65290b3d58a7c2722d1c5311afd (diff)
downloadmariadb-git-1bd1c29ea0ec51d2efefcadbc1ca217aff9f7610.tar.gz
MDEV-6895 switch to dynamic libjemalloc.so
-rw-r--r--cmake/build_configurations/mysql_release.cmake2
-rw-r--r--cmake/jemalloc.cmake39
2 files changed, 24 insertions, 17 deletions
diff --git a/cmake/build_configurations/mysql_release.cmake b/cmake/build_configurations/mysql_release.cmake
index 434e1cfda0e..a3845d99b43 100644
--- a/cmake/build_configurations/mysql_release.cmake
+++ b/cmake/build_configurations/mysql_release.cmake
@@ -111,8 +111,6 @@ IF(UNIX)
SET(WITH_EXTRA_CHARSETS all CACHE STRING "")
IF(CMAKE_SYSTEM_NAME STREQUAL "Linux")
- SET(WITH_JEMALLOC "static" CACHE STRING "")
-
IF(NOT IGNORE_AIO_CHECK)
# Ensure aio is available on Linux (required by InnoDB)
CHECK_INCLUDE_FILES(libaio.h HAVE_LIBAIO_H)
diff --git a/cmake/jemalloc.cmake b/cmake/jemalloc.cmake
index 876688f02f6..05402668c7d 100644
--- a/cmake/jemalloc.cmake
+++ b/cmake/jemalloc.cmake
@@ -1,7 +1,21 @@
INCLUDE (CheckLibraryExists)
SET(WITH_JEMALLOC auto CACHE STRING
- "Build with jemalloc. Possible values are 'yes', 'no', 'auto'")
+ "Build with jemalloc. Possible values are 'yes', 'no', 'static', 'auto'")
+
+MACRO(JEMALLOC_TRY_STATIC)
+ SET(libname jemalloc_pic)
+ SET(CMAKE_REQUIRED_LIBRARIES pthread dl m)
+ SET(what bundled)
+ CHECK_LIBRARY_EXISTS(${libname} malloc_stats_print "" HAVE_STATIC_JEMALLOC)
+ SET(CMAKE_REQUIRED_LIBRARIES)
+ENDMACRO()
+
+MACRO(JEMALLOC_TRY_DYNAMIC)
+ SET(libname jemalloc)
+ SET(what system)
+ CHECK_LIBRARY_EXISTS(${libname} malloc_stats_print "" HAVE_DYNAMIC_JEMALLOC)
+ENDMACRO()
MACRO (CHECK_JEMALLOC)
# compatibility with old WITH_JEMALLOC values
@@ -12,22 +26,17 @@ MACRO (CHECK_JEMALLOC)
SET(WITH_JEMALLOC "yes")
ENDIF()
- IF(WITH_JEMALLOC STREQUAL "yes" OR WITH_JEMALLOC STREQUAL "auto" OR
- WITH_JEMALLOC STREQUAL "static")
-
- IF(WITH_JEMALLOC STREQUAL "static")
- SET(libname jemalloc_pic)
- SET(CMAKE_REQUIRED_LIBRARIES pthread dl m)
- SET(what bundled)
- ELSE()
- SET(libname jemalloc)
- SET(what system)
- ENDIF()
+ IF (WITH_JEMALLOC STREQUAL "yes" OR WITH_JEMALLOC STREQUAL "auto")
+ JEMALLOC_TRY_DYNAMIC()
+ ENDIF()
- CHECK_LIBRARY_EXISTS(${libname} malloc_stats_print "" HAVE_JEMALLOC)
- SET(CMAKE_REQUIRED_LIBRARIES)
+ IF (WITH_JEMALLOC STREQUAL "static" OR WITH_JEMALLOC STREQUAL "auto"
+ AND NOT HAVE_DYNAMIC_JEMALLOC)
+ JEMALLOC_TRY_STATIC()
+ ENDIF()
- IF (HAVE_JEMALLOC)
+ IF (libname)
+ IF (HAVE_DYNAMIC_JEMALLOC OR HAVE_STATIC_JEMALLOC)
SET(LIBJEMALLOC ${libname})
SET(MALLOC_LIBRARY "${what} jemalloc")
ELSEIF (NOT WITH_JEMALLOC STREQUAL "auto")