1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
dnl Copyright (C) 2009 Sun Microsystems, Inc.
dnl This file is free software; Sun Microsystems, Inc.
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
AC_DEFUN([PANDORA_HAVE_BETTER_MALLOC],[
AC_REQUIRE([AC_LIB_PREFIX])
AC_ARG_ENABLE([umem],
[AS_HELP_STRING([--enable-umem],
[Enable linking with libumem @<:@default=off@:>@])],
[ac_enable_umem="$enableval"],[
case "$target_os" in
*solaris*)
ac_enable_umem="yes"
;;
*)
ac_enable_umem="no"
;;
esac
])
AC_ARG_ENABLE([tcmalloc],
[AS_HELP_STRING([--enable-tcmalloc],
[Enable linking with tcmalloc @<:@default=off@:>@])],
[ac_enable_tcmalloc="$enableval"],
[ac_enable_tcmalloc="no"])
AC_ARG_ENABLE([mtmalloc],
[AS_HELP_STRING([--disable-mtmalloc],
[Enable linking with mtmalloc @<:@default=on@:>@])],
[ac_enable_mtmalloc="$enableval"],
[ac_enable_mtmalloc="yes"])
save_LIBS="${LIBS}"
LIBS=
AS_IF([test "x$ac_enable_umem" = "xyes"],[
AC_CHECK_LIB(umem,malloc,[],[])
],[
case "$target_os" in
*linux*)
AS_IF([test "x$ac_enable_tcmalloc" != "xno"],[
AC_CHECK_LIB(tcmalloc-minimal,malloc,[],[])
AS_IF([test "x$ac_cv_lib_tcmalloc_minimal_malloc" != "xyes"],[
AC_CHECK_LIB(tcmalloc,malloc,[],[])
])
])
;;
*solaris*)
AS_IF([test "x$ac_enable_mtmalloc" != "xno"],[
AC_CHECK_LIB(mtmalloc,malloc,[],[])
])
;;
esac
])
BETTER_MALLOC_LIBS="${LIBS}"
LIBS="${save_LIBS}"
AC_SUBST([BETTER_MALLOC_LIBS])
])
AC_DEFUN([PANDORA_USE_BETTER_MALLOC],[
AC_REQUIRE([PANDORA_HAVE_BETTER_MALLOC])
LIBS="${LIBS} ${BETTER_MALLOC_LIBS}"
])
|