1 dnl Copyright (C) 2009 Sun Microsystems, Inc.
2 dnl This file is free software; Sun Microsystems, Inc.
3 dnl gives unlimited permission to copy and/or distribute it,
4 dnl with or without modifications, as long as this notice is preserved.
6 AC_DEFUN([PANDORA_HAVE_BETTER_MALLOC],[
7 AC_REQUIRE([AC_LIB_PREFIX])
10 [AS_HELP_STRING([--enable-umem],
11 [Enable linking with libumem @<:@default=off@:>@])],
12 [ac_enable_umem="$enableval"],[
23 AC_ARG_ENABLE([tcmalloc],
24 [AS_HELP_STRING([--enable-tcmalloc],
25 [Enable linking with tcmalloc @<:@default=off@:>@])],
26 [ac_enable_tcmalloc="$enableval"],
27 [ac_enable_tcmalloc="no"])
29 AC_ARG_ENABLE([mtmalloc],
30 [AS_HELP_STRING([--disable-mtmalloc],
31 [Enable linking with mtmalloc @<:@default=on@:>@])],
32 [ac_enable_mtmalloc="$enableval"],
33 [ac_enable_mtmalloc="yes"])
37 AS_IF([test "x$ac_enable_umem" = "xyes"],[
38 AC_CHECK_LIB(umem,malloc,[],[])
42 AS_IF([test "x$ac_enable_tcmalloc" != "xno"],[
43 AC_CHECK_LIB(tcmalloc-minimal,malloc,[],[])
44 AS_IF([test "x$ac_cv_lib_tcmalloc_minimal_malloc" != "xyes"],[
45 AC_CHECK_LIB(tcmalloc,malloc,[],[])
50 AS_IF([test "x$ac_enable_mtmalloc" != "xno"],[
51 AC_CHECK_LIB(mtmalloc,malloc,[],[])
56 BETTER_MALLOC_LIBS="${LIBS}"
58 AC_SUBST([BETTER_MALLOC_LIBS])
62 AC_DEFUN([PANDORA_USE_BETTER_MALLOC],[
63 AC_REQUIRE([PANDORA_HAVE_BETTER_MALLOC])
64 LIBS="${LIBS} ${BETTER_MALLOC_LIBS}"