about summary refs log tree commit diff homepage
path: root/autoconf/configure.ac
diff options
context:
space:
mode:
authorMartin Nowack <martin@se.inf.tu-dresden.de>2016-02-23 15:29:58 +0100
committerMartin Nowack <martin@se.inf.tu-dresden.de>2016-02-27 10:21:19 +0100
commitc813f1464ce8ad98d45a6a132499247251e15d96 (patch)
tree2f25d008108cdb428eeb919b654b87283f1ff0d6 /autoconf/configure.ac
parent66f53aac10962db150aec07b96f3b0a756eef28b (diff)
downloadklee-c813f1464ce8ad98d45a6a132499247251e15d96.tar.gz
Add support for tcmalloc
Beside improving performance of KLEE,
tcmalloc allows to track used memory correctly.

If available, tcmalloc is automatically used during compile time.

This can be forced to be:
 - disabled using --without-tcmalloc
 - enabled using --with-tcmalloc
In the second case, configure will fail if tcmalloc
is not found or usable.

Both versions of tcmalloc a minimal and normal version.
Diffstat (limited to 'autoconf/configure.ac')
-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 **************************************************************************