Commit 1bd1c29e authored by Sergei Golubchik's avatar Sergei Golubchik

MDEV-6895 switch to dynamic libjemalloc.so

parent 0438f125
......@@ -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)
......
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")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment