summaryrefslogtreecommitdiff
path: root/cmake/jemalloc.cmake
diff options
context:
space:
mode:
authorSergei Golubchik <sergii@pisem.net>2014-09-18 21:54:45 +0200
committerSergei Golubchik <sergii@pisem.net>2014-09-18 21:54:45 +0200
commit989dd4d9ec09450ff7b25987b14ee9fdfd21ad4e (patch)
tree581c5521affaf7c8e7dd8b717fc1eaba73f5244a /cmake/jemalloc.cmake
parent152f1cd086de3ad01817c7bdf0c61278eca4f971 (diff)
parente41bca0066ddcda39b5a3eef17deae066cd113d9 (diff)
downloadmariadb-git-989dd4d9ec09450ff7b25987b14ee9fdfd21ad4e.tar.gz
5.5 merge
Diffstat (limited to 'cmake/jemalloc.cmake')
-rw-r--r--cmake/jemalloc.cmake25
1 files changed, 19 insertions, 6 deletions
diff --git a/cmake/jemalloc.cmake b/cmake/jemalloc.cmake
index f22499cd843..876688f02f6 100644
--- a/cmake/jemalloc.cmake
+++ b/cmake/jemalloc.cmake
@@ -12,13 +12,26 @@ MACRO (CHECK_JEMALLOC)
SET(WITH_JEMALLOC "yes")
ENDIF()
- IF(WITH_JEMALLOC STREQUAL "yes" OR WITH_JEMALLOC STREQUAL "auto")
- CHECK_LIBRARY_EXISTS(jemalloc malloc_stats_print "" HAVE_JEMALLOC)
+ 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()
+
+ CHECK_LIBRARY_EXISTS(${libname} malloc_stats_print "" HAVE_JEMALLOC)
+ SET(CMAKE_REQUIRED_LIBRARIES)
+
IF (HAVE_JEMALLOC)
- SET(LIBJEMALLOC jemalloc)
- SET(MALLOC_LIBRARY "system jemalloc")
- ELSEIF (WITH_JEMALLOC STREQUAL "yes")
- MESSAGE(FATAL_ERROR "jemalloc is not found")
+ SET(LIBJEMALLOC ${libname})
+ SET(MALLOC_LIBRARY "${what} jemalloc")
+ ELSEIF (NOT WITH_JEMALLOC STREQUAL "auto")
+ MESSAGE(FATAL_ERROR "${libname} is not found")
ENDIF()
ENDIF()
ENDMACRO()