1 dnl Copyright (C) 2009 Sun Microsystems
2 dnl This file is free software; Sun Microsystems
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_FUNC_MALLOC])
8 AC_REQUIRE([AC_FUNC_REALLOC])
9 AC_REQUIRE([AC_LIB_PREFIX])
12 [AS_HELP_STRING([--enable-umem],
13 [Enable linking with libumem @<:@default=off@:>@])],
14 [ac_enable_umem="$enableval"],
15 [ac_enable_umem="no"])
17 AC_ARG_ENABLE([tcmalloc],
18 [AS_HELP_STRING([--enable-tcmalloc],
19 [Enable linking with tcmalloc @<:@default=off@:>@])],
20 [ac_enable_tcmalloc="$enableval"],
21 [ac_enable_tcmalloc="no"])
23 AC_ARG_ENABLE([mtmalloc],
24 [AS_HELP_STRING([--disable-mtmalloc],
25 [Enable linking with mtmalloc @<:@default=on@:>@])],
26 [ac_enable_mtmalloc="$enableval"],
27 [ac_enable_mtmalloc="yes"])
31 AS_IF([test "x$ac_enable_umem" = "xyes"],[
32 AC_CHECK_LIB(umem,malloc,[],[])
36 AS_IF([test "x$ac_enable_tcmalloc" != "xno"],[
37 AC_CHECK_LIB(tcmalloc-minimal,malloc,[],[])
38 AS_IF([test "x$ac_cv_lib_tcmalloc_minimal_malloc" != "xyes"],[
39 AC_CHECK_LIB(tcmalloc,malloc,[],[])
44 AS_IF([test "x$ac_enable_mtmalloc" != "xno"],[
45 AC_CHECK_LIB(mtmalloc,malloc,[],[])
50 BETTER_MALLOC_LIBS="${LIBS}"
52 AC_SUBST([BETTER_MALLOC_LIBS])