From 91097e3119ed8ad8c63f54915e24abcb2fc1b036 Mon Sep 17 00:00:00 2001 From: c9s Date: Thu, 22 May 2014 11:54:01 +0800 Subject: [PATCH] enable jemalloc only when major version > 2 --- configure.ac | 35 ++++++++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/configure.ac b/configure.ac index 779a4d9..10a4ce2 100644 --- a/configure.ac +++ b/configure.ac @@ -53,12 +53,37 @@ AS_IF([test "x$with_malloc" == "xjemalloc"], [AC_CHECK_HEADERS([jemalloc/jemalloc.h], [ found_jemalloc=yes; break ])]) -AM_CONDITIONAL(USE_JEMALLOC, test "x$found_jemalloc" = "xyes") -AC_DEFINE(USE_JEMALLOC, test "x$found_jemalloc" = "xyes" , "use jemalloc") -AM_CONDITIONAL(ENABLE_DEBUG, test "x$enable_debug" == "xyes") -AM_CONDITIONAL(ENABLE_GRAPHVIZ, test "x$enable_graphviz" == "xyes") -AC_DEFINE(ENABLE_GRAPHVIZ, test "x$enable_graphviz" == "xyes", "whether graphviz is enable") +if test "x$found_jemalloc" == "xyes" ; then + +AC_MSG_CHECKING([Checking jemalloc version]) +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]], + [[ + #ifdef JEMALLOC_VERSION_MAJOR > 2 + return 0; + #endif + return 1; + ]])], + [ + AC_MSG_RESULT([yes]) + AC_DEFINE_UNQUOTED([USE_JEMALLOC], 1, [Define to 1 if you have the PATH_MAX macro.]) + have_jemalloc=yes + ], + [ + AC_MSG_RESULT([no]) + AC_DEFINE_UNQUOTED([USE_JEMALLOC], 0, [Define to 1 if you have the PATH_MAX macro.]) + have_jemalloc=no + ] + ) +fi +AM_CONDITIONAL(USE_JEMALLOC, test "x$have_jemalloc" = "xyes") + +# AM_CONDITIONAL(USE_JEMALLOC, test "x$found_jemalloc" = "xyes") +# AC_DEFINE(USE_JEMALLOC, test "x$found_jemalloc" = "xyes" , "use jemalloc") + +AM_CONDITIONAL(ENABLE_DEBUG, test "x$enable_debug" = "xyes") +AM_CONDITIONAL(ENABLE_GRAPHVIZ, test "x$enable_graphviz" = "xyes") +AC_DEFINE(ENABLE_GRAPHVIZ, test "x$enable_graphviz" = "xyes", "whether graphviz is enable") PKG_CHECK_MODULES(DEPS, [libpcre check])