about summary refs log tree commit diff homepage
path: root/autoconf
diff options
context:
space:
mode:
authorMartinNowack <martin.nowack@gmail.com>2016-02-29 14:14:43 +0100
committerMartinNowack <martin.nowack@gmail.com>2016-02-29 14:14:43 +0100
commitce1dd5a7f3de7b536a9ff266a9231b44a053fe95 (patch)
tree47dd5e214efaa3a28333a071c30a35895a03b5ed /autoconf
parent0fc86ca9e28cc411cb5e00afa22c32e77aca7e57 (diff)
parent18f01e9f6d5471d176091f24671bef3eac0293ac (diff)
downloadklee-ce1dd5a7f3de7b536a9ff266a9231b44a053fe95.tar.gz
Merge pull request #344 from MartinNowack/feat_malloc
Add support for tcmalloc
Diffstat (limited to 'autoconf')
-rw-r--r--autoconf/configure.ac35
1 files changed, 35 insertions, 0 deletions
diff --git a/autoconf/configure.ac b/autoconf/configure.ac
index 617469e6..bb391329 100644
--- a/autoconf/configure.ac
+++ b/autoconf/configure.ac
@@ -550,6 +550,41 @@ AC_SEARCH_LIBS(mallinfo,malloc,
                AC_DEFINE([HAVE_MALLINFO],[1],[Define if mallinfo() is available on this platform.]))
 
 dnl **************************************************************************
+dnl Test for tcmalloc
+dnl **************************************************************************
+
+AC_ARG_WITH([tcmalloc],
+	    AS_HELP_STRING([--without-tcmalloc], [Ignore presence of tcmalloc and disable it (default=detect)]))
+
+AS_IF([test "x$with_tcmalloc" != "xno"],
+      AC_CHECK_HEADERS([gperftools/malloc_extension.h],
+		       [have_tcmalloc=yes], [have_tcmalloc=no]),
+      [have_tcmalloc=no])
+
+AS_IF([test "x$have_tcmalloc" = "xyes"],
+      [
+	AC_SEARCH_LIBS(tc_malloc,tcmalloc_minimal,
+		     [
+		      AC_SUBST(HAVE_TCMALLOC, 1)
+		      if test "${ac_cv_search_tc_malloc}" != "none required"; then
+			 TCMALLOC_LIB=${ac_cv_search_tc_malloc}
+			 AC_SUBST(TCMALLOC_LIB)
+		      fi
+		     ],
+		     [
+		      AC_MSG_WARN([Could not link with tcmalloc])
+		      AC_SUBST(HAVE_TCMALLOC, 0)
+		     ],)
+
+       ],
+      [AS_IF([test "x$with_tcmalloc" = "xyes"],
+	     [AC_MSG_ERROR([tcmalloc requested but not found])],
+	     [
+	      AC_SUBST(HAVE_TCMALLOC, 0)
+	      ])
+])
+
+dnl **************************************************************************
 dnl Find an install of STP
 dnl **************************************************************************