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"],[
25
AC_ARG_ENABLE([tcmalloc],
26
[AS_HELP_STRING([--enable-tcmalloc],
27
[Enable linking with tcmalloc @<:@default=off@:>@])],
28
[ac_enable_tcmalloc="$enableval"],
29
[ac_enable_tcmalloc="no"])
31
AC_ARG_ENABLE([mtmalloc],
32
[AS_HELP_STRING([--disable-mtmalloc],
33
[Enable linking with mtmalloc @<:@default=on@:>@])],
34
[ac_enable_mtmalloc="$enableval"],
35
[ac_enable_mtmalloc="yes"])
39
AS_IF([test "x$ac_enable_umem" = "xyes"],[
40
AC_CHECK_LIB(umem,malloc,[],[])
44
AS_IF([test "x$ac_enable_tcmalloc" != "xno"],[
45
AC_CHECK_LIB(tcmalloc-minimal,malloc,[],[])
46
AS_IF([test "x$ac_cv_lib_tcmalloc_minimal_malloc" != "xyes"],[
47
AC_CHECK_LIB(tcmalloc,malloc,[],[])
52
AS_IF([test "x$ac_enable_mtmalloc" != "xno"],[
53
AC_CHECK_LIB(mtmalloc,malloc,[],[])
58
BETTER_MALLOC_LIBS="${LIBS}"
60
AC_SUBST([BETTER_MALLOC_LIBS])
64
AC_DEFUN([PANDORA_USE_BETTER_MALLOC],[
65
AC_REQUIRE([PANDORA_HAVE_BETTER_MALLOC])
66
LIBS="${LIBS} ${BETTER_MALLOC_LIBS}"