2009-06-24 10:01:18 +08:00
|
|
|
dnl Process this file with autoconf to produce a configure script.
|
|
|
|
AC_INIT([Makefile.in])
|
|
|
|
|
2009-07-01 07:17:05 +08:00
|
|
|
dnl ============================================================================
|
|
|
|
dnl Custom macro definitions.
|
|
|
|
|
|
|
|
dnl JE_CFLAGS_APPEND(cflag)
|
|
|
|
AC_DEFUN([JE_CFLAGS_APPEND],
|
|
|
|
[
|
|
|
|
AC_MSG_CHECKING([whether compiler supports $1])
|
|
|
|
TCFLAGS="${CFLAGS}"
|
|
|
|
if test "x${CFLAGS}" = "x" ; then
|
|
|
|
CFLAGS="$1"
|
|
|
|
else
|
|
|
|
CFLAGS="${CFLAGS} $1"
|
|
|
|
fi
|
|
|
|
AC_RUN_IFELSE([AC_LANG_PROGRAM(
|
|
|
|
[[
|
|
|
|
]], [[
|
|
|
|
return 0;
|
|
|
|
]])],
|
|
|
|
AC_MSG_RESULT([yes]),
|
|
|
|
AC_MSG_RESULT([no])
|
|
|
|
[CFLAGS="${TCFLAGS}"]
|
|
|
|
)
|
|
|
|
])
|
|
|
|
|
|
|
|
dnl JE_COMPILABLE(label, hcode, mcode, rvar)
|
|
|
|
AC_DEFUN([JE_COMPILABLE],
|
|
|
|
[
|
|
|
|
AC_MSG_CHECKING([whether $1 is compilable])
|
2011-03-23 11:44:40 +08:00
|
|
|
AC_RUN_IFELSE([AC_LANG_PROGRAM(
|
2009-07-01 07:17:05 +08:00
|
|
|
[$2], [$3])],
|
|
|
|
AC_MSG_RESULT([yes])
|
|
|
|
[$4="yes"],
|
|
|
|
AC_MSG_RESULT([no])
|
|
|
|
[$4="no"]
|
|
|
|
)
|
|
|
|
])
|
|
|
|
|
|
|
|
dnl ============================================================================
|
|
|
|
|
2011-11-02 13:27:41 +08:00
|
|
|
dnl Library revision.
|
|
|
|
rev=1
|
|
|
|
AC_SUBST([rev])
|
|
|
|
|
2009-06-24 10:01:18 +08:00
|
|
|
srcroot=$srcdir
|
|
|
|
if test "x${srcroot}" = "x." ; then
|
|
|
|
srcroot=""
|
|
|
|
else
|
|
|
|
srcroot="${srcroot}/"
|
|
|
|
fi
|
|
|
|
AC_SUBST([srcroot])
|
|
|
|
abs_srcroot="`cd \"${srcdir}\"; pwd`/"
|
|
|
|
AC_SUBST([abs_srcroot])
|
|
|
|
|
|
|
|
objroot=""
|
|
|
|
AC_SUBST([objroot])
|
|
|
|
abs_objroot="`pwd`/"
|
|
|
|
AC_SUBST([abs_objroot])
|
|
|
|
|
|
|
|
dnl Munge install path variables.
|
|
|
|
if test "x$prefix" = "xNONE" ; then
|
|
|
|
prefix="/usr/local"
|
|
|
|
fi
|
|
|
|
if test "x$exec_prefix" = "xNONE" ; then
|
|
|
|
exec_prefix=$prefix
|
|
|
|
fi
|
|
|
|
PREFIX=$prefix
|
|
|
|
AC_SUBST([PREFIX])
|
|
|
|
BINDIR=`eval echo $bindir`
|
|
|
|
BINDIR=`eval echo $BINDIR`
|
|
|
|
AC_SUBST([BINDIR])
|
|
|
|
INCLUDEDIR=`eval echo $includedir`
|
|
|
|
INCLUDEDIR=`eval echo $INCLUDEDIR`
|
|
|
|
AC_SUBST([INCLUDEDIR])
|
|
|
|
LIBDIR=`eval echo $libdir`
|
|
|
|
LIBDIR=`eval echo $LIBDIR`
|
|
|
|
AC_SUBST([LIBDIR])
|
|
|
|
DATADIR=`eval echo $datadir`
|
|
|
|
DATADIR=`eval echo $DATADIR`
|
|
|
|
AC_SUBST([DATADIR])
|
|
|
|
MANDIR=`eval echo $mandir`
|
|
|
|
MANDIR=`eval echo $MANDIR`
|
|
|
|
AC_SUBST([MANDIR])
|
|
|
|
|
2010-11-25 14:00:02 +08:00
|
|
|
dnl Support for building documentation.
|
|
|
|
AC_PATH_PROG([XSLTPROC], [xsltproc], , [$PATH])
|
|
|
|
AC_ARG_WITH([xslroot],
|
|
|
|
[AS_HELP_STRING([--with-xslroot=<path>], [XSL stylesheet root path])],
|
|
|
|
if test "x$with_xslroot" = "xno" ; then
|
|
|
|
XSLROOT="/usr/share/xml/docbook/stylesheet/docbook-xsl"
|
|
|
|
else
|
|
|
|
XSLROOT="${with_xslroot}"
|
|
|
|
fi,
|
|
|
|
XSLROOT="/usr/share/xml/docbook/stylesheet/docbook-xsl"
|
|
|
|
)
|
|
|
|
AC_SUBST([XSLROOT])
|
|
|
|
|
2009-07-01 07:17:05 +08:00
|
|
|
dnl If CFLAGS isn't defined, set CFLAGS to something reasonable. Otherwise,
|
|
|
|
dnl just prevent autoconf from molesting CFLAGS.
|
2009-06-24 10:01:18 +08:00
|
|
|
CFLAGS=$CFLAGS
|
|
|
|
AC_PROG_CC
|
|
|
|
if test "x$CFLAGS" = "x" ; then
|
|
|
|
no_CFLAGS="yes"
|
2010-03-04 07:48:20 +08:00
|
|
|
if test "x$GCC" = "xyes" ; then
|
|
|
|
JE_CFLAGS_APPEND([-std=gnu99])
|
|
|
|
JE_CFLAGS_APPEND([-Wall])
|
|
|
|
JE_CFLAGS_APPEND([-pipe])
|
|
|
|
JE_CFLAGS_APPEND([-g3])
|
|
|
|
fi
|
2009-06-24 10:01:18 +08:00
|
|
|
fi
|
|
|
|
dnl Append EXTRA_CFLAGS to CFLAGS, if defined.
|
|
|
|
if test "x$EXTRA_CFLAGS" != "x" ; then
|
2009-07-01 07:17:05 +08:00
|
|
|
JE_CFLAGS_APPEND([$EXTRA_CFLAGS])
|
2009-06-24 10:01:18 +08:00
|
|
|
fi
|
|
|
|
AC_PROG_CPP
|
|
|
|
|
|
|
|
AC_CHECK_SIZEOF([void *])
|
|
|
|
if test "x${ac_cv_sizeof_void_p}" = "x8" ; then
|
2009-12-29 16:09:15 +08:00
|
|
|
LG_SIZEOF_PTR=3
|
2009-06-24 10:01:18 +08:00
|
|
|
elif test "x${ac_cv_sizeof_void_p}" = "x4" ; then
|
2009-12-29 16:09:15 +08:00
|
|
|
LG_SIZEOF_PTR=2
|
2009-06-24 10:01:18 +08:00
|
|
|
else
|
|
|
|
AC_MSG_ERROR([Unsupported pointer size: ${ac_cv_sizeof_void_p}])
|
|
|
|
fi
|
2009-12-29 16:09:15 +08:00
|
|
|
AC_DEFINE_UNQUOTED([LG_SIZEOF_PTR], [$LG_SIZEOF_PTR])
|
|
|
|
|
|
|
|
AC_CHECK_SIZEOF([int])
|
|
|
|
if test "x${ac_cv_sizeof_int}" = "x8" ; then
|
|
|
|
LG_SIZEOF_INT=3
|
|
|
|
elif test "x${ac_cv_sizeof_int}" = "x4" ; then
|
|
|
|
LG_SIZEOF_INT=2
|
|
|
|
else
|
|
|
|
AC_MSG_ERROR([Unsupported int size: ${ac_cv_sizeof_int}])
|
|
|
|
fi
|
|
|
|
AC_DEFINE_UNQUOTED([LG_SIZEOF_INT], [$LG_SIZEOF_INT])
|
2009-06-24 10:01:18 +08:00
|
|
|
|
Use bitmaps to track small regions.
The previous free list implementation, which embedded singly linked
lists in available regions, had the unfortunate side effect of causing
many cache misses during thread cache fills. Fix this in two places:
- arena_run_t: Use a new bitmap implementation to track which regions
are available. Furthermore, revert to preferring the
lowest available region (as jemalloc did with its old
bitmap-based approach).
- tcache_t: Move read-only tcache_bin_t metadata into
tcache_bin_info_t, and add a contiguous array of pointers
to tcache_t in order to track cached objects. This
substantially increases the size of tcache_t, but results
in much higher data locality for common tcache operations.
As a side benefit, it is again possible to efficiently
flush the least recently used cached objects, so this
change changes flushing from MRU to LRU.
The new bitmap implementation uses a multi-level summary approach to
make finding the lowest available region very fast. In practice,
bitmaps only have one or two levels, though the implementation is
general enough to handle extremely large bitmaps, mainly so that large
page sizes can still be entertained.
Fix tcache_bin_flush_large() to always flush statistics, in the same way
that tcache_bin_flush_small() was recently fixed.
Use JEMALLOC_DEBUG rather than NDEBUG.
Add dassert(), and use it for debug-only asserts.
2011-03-17 01:30:13 +08:00
|
|
|
AC_CHECK_SIZEOF([long])
|
|
|
|
if test "x${ac_cv_sizeof_long}" = "x8" ; then
|
|
|
|
LG_SIZEOF_LONG=3
|
|
|
|
elif test "x${ac_cv_sizeof_long}" = "x4" ; then
|
|
|
|
LG_SIZEOF_LONG=2
|
|
|
|
else
|
|
|
|
AC_MSG_ERROR([Unsupported long size: ${ac_cv_sizeof_long}])
|
|
|
|
fi
|
|
|
|
AC_DEFINE_UNQUOTED([LG_SIZEOF_LONG], [$LG_SIZEOF_LONG])
|
|
|
|
|
2009-06-24 10:01:18 +08:00
|
|
|
AC_CANONICAL_HOST
|
|
|
|
dnl CPU-specific settings.
|
|
|
|
CPU_SPINWAIT=""
|
|
|
|
case "${host_cpu}" in
|
|
|
|
i[[345]]86)
|
|
|
|
;;
|
|
|
|
i686)
|
2009-07-01 07:17:05 +08:00
|
|
|
JE_COMPILABLE([__asm__], [], [[__asm__ volatile("pause"); return 0;]],
|
|
|
|
[asm])
|
|
|
|
if test "x${asm}" = "xyes" ; then
|
|
|
|
CPU_SPINWAIT='__asm__ volatile("pause")'
|
|
|
|
fi
|
2009-06-24 10:01:18 +08:00
|
|
|
;;
|
|
|
|
x86_64)
|
2009-07-01 07:17:05 +08:00
|
|
|
JE_COMPILABLE([__asm__ syntax], [],
|
|
|
|
[[__asm__ volatile("pause"); return 0;]], [asm])
|
|
|
|
if test "x${asm}" = "xyes" ; then
|
|
|
|
CPU_SPINWAIT='__asm__ volatile("pause")'
|
|
|
|
fi
|
2009-06-24 10:01:18 +08:00
|
|
|
;;
|
|
|
|
*)
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
AC_DEFINE_UNQUOTED([CPU_SPINWAIT], [$CPU_SPINWAIT])
|
|
|
|
|
2011-10-13 13:33:33 +08:00
|
|
|
LD_PRELOAD_VAR="LD_PRELOAD"
|
2011-11-02 13:27:41 +08:00
|
|
|
so="so"
|
2011-10-13 13:33:33 +08:00
|
|
|
|
2012-02-11 12:22:09 +08:00
|
|
|
dnl Heap profiling uses the log(3) function.
|
|
|
|
LIBS="$LIBS -lm"
|
|
|
|
|
2009-06-24 10:01:18 +08:00
|
|
|
dnl Platform-specific settings. abi and RPATH can probably be determined
|
|
|
|
dnl programmatically, but doing so is error-prone, which makes it generally
|
|
|
|
dnl not worth the trouble.
|
|
|
|
dnl
|
|
|
|
dnl Define cpp macros in CPPFLAGS, rather than doing AC_DEFINE(macro), since the
|
|
|
|
dnl definitions need to be seen before any headers are included, which is a pain
|
|
|
|
dnl to make happen otherwise.
|
|
|
|
case "${host}" in
|
|
|
|
*-*-darwin*)
|
|
|
|
CFLAGS="$CFLAGS -fno-common -no-cpp-precomp"
|
|
|
|
abi="macho"
|
2010-10-25 04:03:07 +08:00
|
|
|
AC_DEFINE([JEMALLOC_PURGE_MADVISE_FREE])
|
2009-06-24 10:01:18 +08:00
|
|
|
RPATH=""
|
2011-10-13 13:33:33 +08:00
|
|
|
LD_PRELOAD_VAR="DYLD_INSERT_LIBRARIES"
|
2011-11-02 13:27:41 +08:00
|
|
|
so="dylib"
|
2009-06-24 10:01:18 +08:00
|
|
|
;;
|
|
|
|
*-*-freebsd*)
|
|
|
|
CFLAGS="$CFLAGS"
|
|
|
|
abi="elf"
|
2010-09-06 01:35:13 +08:00
|
|
|
AC_DEFINE([JEMALLOC_PURGE_MADVISE_FREE])
|
2009-06-24 10:01:18 +08:00
|
|
|
RPATH="-Wl,-rpath,"
|
|
|
|
;;
|
|
|
|
*-*-linux*)
|
|
|
|
CFLAGS="$CFLAGS"
|
|
|
|
CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
|
|
|
|
abi="elf"
|
2010-09-06 01:35:13 +08:00
|
|
|
AC_DEFINE([JEMALLOC_PURGE_MADVISE_DONTNEED])
|
2009-06-24 10:01:18 +08:00
|
|
|
RPATH="-Wl,-rpath,"
|
|
|
|
;;
|
|
|
|
*-*-netbsd*)
|
|
|
|
AC_MSG_CHECKING([ABI])
|
|
|
|
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
|
|
|
|
[[#ifdef __ELF__
|
|
|
|
/* ELF */
|
|
|
|
#else
|
|
|
|
#error aout
|
|
|
|
#endif
|
|
|
|
]])],
|
|
|
|
[CFLAGS="$CFLAGS"; abi="elf"],
|
|
|
|
[abi="aout"])
|
|
|
|
AC_MSG_RESULT([$abi])
|
2010-09-06 01:35:13 +08:00
|
|
|
AC_DEFINE([JEMALLOC_PURGE_MADVISE_FREE])
|
2009-06-24 10:01:18 +08:00
|
|
|
RPATH="-Wl,-rpath,"
|
|
|
|
;;
|
|
|
|
*-*-solaris2*)
|
|
|
|
CFLAGS="$CFLAGS"
|
|
|
|
abi="elf"
|
|
|
|
RPATH="-Wl,-R,"
|
|
|
|
dnl Solaris needs this for sigwait().
|
|
|
|
CPPFLAGS="$CPPFLAGS -D_POSIX_PTHREAD_SEMANTICS"
|
|
|
|
LIBS="$LIBS -lposix4 -lsocket -lnsl"
|
|
|
|
;;
|
2011-10-13 13:33:33 +08:00
|
|
|
*-ibm-aix*)
|
|
|
|
if "$LG_SIZEOF_PTR" = "8"; then
|
|
|
|
dnl 64bit AIX
|
|
|
|
LD_PRELOAD_VAR="LDR_PRELOAD64"
|
|
|
|
else
|
|
|
|
dnl 32bit AIX
|
|
|
|
LD_PRELOAD_VAR="LDR_PRELOAD"
|
|
|
|
fi
|
|
|
|
abi="xcoff"
|
|
|
|
RPATH="-Wl,-rpath,"
|
|
|
|
;;
|
2009-06-24 10:01:18 +08:00
|
|
|
*)
|
|
|
|
AC_MSG_RESULT([Unsupported operating system: ${host}])
|
|
|
|
abi="elf"
|
|
|
|
RPATH="-Wl,-rpath,"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
AC_SUBST([abi])
|
|
|
|
AC_SUBST([RPATH])
|
2011-10-13 13:33:33 +08:00
|
|
|
AC_SUBST([LD_PRELOAD_VAR])
|
2011-11-02 13:27:41 +08:00
|
|
|
AC_SUBST([so])
|
2009-06-24 10:01:18 +08:00
|
|
|
|
2011-03-16 01:25:59 +08:00
|
|
|
JE_COMPILABLE([__attribute__ syntax],
|
|
|
|
[static __attribute__((unused)) void foo(void){}],
|
|
|
|
[],
|
|
|
|
[attribute])
|
|
|
|
if test "x${attribute}" = "xyes" ; then
|
|
|
|
AC_DEFINE([JEMALLOC_HAVE_ATTR], [ ])
|
|
|
|
if test "x${GCC}" = "xyes" -a "x${abi}" = "xelf"; then
|
|
|
|
JE_CFLAGS_APPEND([-fvisibility=hidden])
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2010-12-01 08:50:58 +08:00
|
|
|
JE_COMPILABLE([mremap(...MREMAP_FIXED...)], [
|
|
|
|
#define _GNU_SOURCE
|
|
|
|
#include <sys/mman.h>
|
|
|
|
], [
|
|
|
|
void *p = mremap((void *)0, 0, 0, MREMAP_MAYMOVE|MREMAP_FIXED, (void *)0);
|
|
|
|
], [mremap_fixed])
|
|
|
|
if test "x${mremap_fixed}" = "xyes" ; then
|
|
|
|
AC_DEFINE([JEMALLOC_MREMAP_FIXED])
|
|
|
|
fi
|
|
|
|
|
2009-06-24 10:01:18 +08:00
|
|
|
dnl Support optional additions to rpath.
|
|
|
|
AC_ARG_WITH([rpath],
|
2009-12-29 16:09:15 +08:00
|
|
|
[AS_HELP_STRING([--with-rpath=<rpath>], [Colon-separated rpath (ELF systems only)])],
|
2009-06-24 10:01:18 +08:00
|
|
|
if test "x$with_rpath" = "xno" ; then
|
|
|
|
RPATH_EXTRA=
|
|
|
|
else
|
|
|
|
RPATH_EXTRA="`echo $with_rpath | tr \":\" \" \"`"
|
|
|
|
fi,
|
|
|
|
RPATH_EXTRA=
|
|
|
|
)
|
|
|
|
AC_SUBST([RPATH_EXTRA])
|
|
|
|
|
|
|
|
dnl Disable rules that do automatic regeneration of configure output by default.
|
|
|
|
AC_ARG_ENABLE([autogen],
|
2010-01-18 06:06:20 +08:00
|
|
|
[AS_HELP_STRING([--enable-autogen], [Automatically regenerate configure output])],
|
2009-06-24 10:01:18 +08:00
|
|
|
if test "x$enable_autogen" = "xno" ; then
|
|
|
|
enable_autogen="0"
|
|
|
|
else
|
|
|
|
enable_autogen="1"
|
|
|
|
fi
|
|
|
|
,
|
|
|
|
enable_autogen="0"
|
|
|
|
)
|
|
|
|
AC_SUBST([enable_autogen])
|
|
|
|
|
|
|
|
AC_PROG_INSTALL
|
|
|
|
AC_PROG_RANLIB
|
|
|
|
AC_PATH_PROG([AR], [ar], , [$PATH])
|
|
|
|
AC_PATH_PROG([LD], [ld], , [$PATH])
|
|
|
|
AC_PATH_PROG([AUTOCONF], [autoconf], , [$PATH])
|
|
|
|
|
2009-12-29 16:09:15 +08:00
|
|
|
dnl Do not prefix public APIs by default.
|
|
|
|
AC_ARG_WITH([jemalloc_prefix],
|
|
|
|
[AS_HELP_STRING([--with-jemalloc-prefix=<prefix>], [Prefix to prepend to all public APIs])],
|
2010-01-17 17:49:20 +08:00
|
|
|
[JEMALLOC_PREFIX="$with_jemalloc_prefix"],
|
2010-09-06 01:35:13 +08:00
|
|
|
[if test "x$abi" != "xmacho" ; then
|
|
|
|
JEMALLOC_PREFIX=""
|
|
|
|
else
|
|
|
|
JEMALLOC_PREFIX="je_"
|
|
|
|
fi]
|
2009-12-29 16:09:15 +08:00
|
|
|
)
|
|
|
|
if test "x$JEMALLOC_PREFIX" != "x" ; then
|
2010-10-24 09:37:06 +08:00
|
|
|
JEMALLOC_CPREFIX=`echo ${JEMALLOC_PREFIX} | tr "a-z" "A-Z"`
|
|
|
|
AC_DEFINE_UNQUOTED([JEMALLOC_PREFIX], ["$JEMALLOC_PREFIX"])
|
|
|
|
AC_DEFINE_UNQUOTED([JEMALLOC_CPREFIX], ["$JEMALLOC_CPREFIX"])
|
2010-01-17 01:53:50 +08:00
|
|
|
AC_DEFINE_UNQUOTED([JEMALLOC_P(string_that_no_one_should_want_to_use_as_a_jemalloc_API_prefix)], [${JEMALLOC_PREFIX}##string_that_no_one_should_want_to_use_as_a_jemalloc_API_prefix])
|
2009-12-29 16:09:15 +08:00
|
|
|
fi
|
|
|
|
|
2011-07-31 07:40:52 +08:00
|
|
|
dnl Do not mangle library-private APIs by default.
|
|
|
|
AC_ARG_WITH([private_namespace],
|
|
|
|
[AS_HELP_STRING([--with-private-namespace=<prefix>], [Prefix to prepend to all library-private APIs])],
|
|
|
|
[JEMALLOC_PRIVATE_NAMESPACE="$with_private_namespace"],
|
|
|
|
[JEMALLOC_PRIVATE_NAMESPACE=""]
|
|
|
|
)
|
|
|
|
AC_DEFINE_UNQUOTED([JEMALLOC_PRIVATE_NAMESPACE], ["$JEMALLOC_PRIVATE_NAMESPACE"])
|
|
|
|
if test "x$JEMALLOC_PRIVATE_NAMESPACE" != "x" ; then
|
|
|
|
AC_DEFINE_UNQUOTED([JEMALLOC_N(string_that_no_one_should_want_to_use_as_a_jemalloc_private_namespace_prefix)], [${JEMALLOC_PRIVATE_NAMESPACE}##string_that_no_one_should_want_to_use_as_a_jemalloc_private_namespace_prefix])
|
|
|
|
else
|
|
|
|
AC_DEFINE_UNQUOTED([JEMALLOC_N(string_that_no_one_should_want_to_use_as_a_jemalloc_private_namespace_prefix)], [string_that_no_one_should_want_to_use_as_a_jemalloc_private_namespace_prefix])
|
|
|
|
fi
|
|
|
|
|
2010-01-17 17:49:20 +08:00
|
|
|
dnl Do not add suffix to installed files by default.
|
|
|
|
AC_ARG_WITH([install_suffix],
|
|
|
|
[AS_HELP_STRING([--with-install-suffix=<suffix>], [Suffix to append to all installed files])],
|
|
|
|
[INSTALL_SUFFIX="$with_install_suffix"],
|
|
|
|
[INSTALL_SUFFIX=]
|
|
|
|
)
|
|
|
|
install_suffix="$INSTALL_SUFFIX"
|
|
|
|
AC_SUBST([install_suffix])
|
|
|
|
|
2010-11-25 14:00:02 +08:00
|
|
|
cfgoutputs_in="${srcroot}Makefile.in"
|
|
|
|
cfgoutputs_in="${cfgoutputs_in} ${srcroot}doc/html.xsl.in"
|
|
|
|
cfgoutputs_in="${cfgoutputs_in} ${srcroot}doc/manpages.xsl.in"
|
|
|
|
cfgoutputs_in="${cfgoutputs_in} ${srcroot}doc/jemalloc.xml.in"
|
2010-04-08 14:37:35 +08:00
|
|
|
cfgoutputs_in="${cfgoutputs_in} ${srcroot}include/jemalloc/jemalloc.h.in"
|
|
|
|
cfgoutputs_in="${cfgoutputs_in} ${srcroot}include/jemalloc/internal/jemalloc_internal.h.in"
|
2010-10-08 00:53:26 +08:00
|
|
|
cfgoutputs_in="${cfgoutputs_in} ${srcroot}test/jemalloc_test.h.in"
|
2010-01-17 17:49:20 +08:00
|
|
|
|
2010-11-25 14:00:02 +08:00
|
|
|
cfgoutputs_out="Makefile"
|
|
|
|
cfgoutputs_out="${cfgoutputs_out} doc/html.xsl"
|
|
|
|
cfgoutputs_out="${cfgoutputs_out} doc/manpages.xsl"
|
|
|
|
cfgoutputs_out="${cfgoutputs_out} doc/jemalloc${install_suffix}.xml"
|
2010-02-12 06:45:59 +08:00
|
|
|
cfgoutputs_out="${cfgoutputs_out} include/jemalloc/jemalloc${install_suffix}.h"
|
|
|
|
cfgoutputs_out="${cfgoutputs_out} include/jemalloc/internal/jemalloc_internal.h"
|
2010-10-08 00:53:26 +08:00
|
|
|
cfgoutputs_out="${cfgoutputs_out} test/jemalloc_test.h"
|
2010-01-17 17:49:20 +08:00
|
|
|
|
2010-11-25 14:00:02 +08:00
|
|
|
cfgoutputs_tup="Makefile"
|
|
|
|
cfgoutputs_tup="${cfgoutputs_tup} doc/html.xsl:doc/html.xsl.in"
|
|
|
|
cfgoutputs_tup="${cfgoutputs_tup} doc/manpages.xsl:doc/manpages.xsl.in"
|
|
|
|
cfgoutputs_tup="${cfgoutputs_tup} doc/jemalloc${install_suffix}.xml:doc/jemalloc.xml.in"
|
2010-02-12 06:45:59 +08:00
|
|
|
cfgoutputs_tup="${cfgoutputs_tup} include/jemalloc/jemalloc${install_suffix}.h:include/jemalloc/jemalloc.h.in"
|
|
|
|
cfgoutputs_tup="${cfgoutputs_tup} include/jemalloc/internal/jemalloc_internal.h"
|
2010-10-08 00:53:26 +08:00
|
|
|
cfgoutputs_tup="${cfgoutputs_tup} test/jemalloc_test.h:test/jemalloc_test.h.in"
|
2010-01-17 17:49:20 +08:00
|
|
|
|
2010-04-08 14:37:35 +08:00
|
|
|
cfghdrs_in="${srcroot}include/jemalloc/jemalloc_defs.h.in"
|
2010-01-17 17:49:20 +08:00
|
|
|
|
2010-02-12 06:45:59 +08:00
|
|
|
cfghdrs_out="include/jemalloc/jemalloc_defs${install_suffix}.h"
|
2010-01-17 17:49:20 +08:00
|
|
|
|
2010-02-12 06:45:59 +08:00
|
|
|
cfghdrs_tup="include/jemalloc/jemalloc_defs${install_suffix}.h:include/jemalloc/jemalloc_defs.h.in"
|
2010-01-17 17:49:20 +08:00
|
|
|
|
2010-09-21 10:20:48 +08:00
|
|
|
dnl Do not silence irrelevant compiler warnings by default, since enabling this
|
|
|
|
dnl option incurs a performance penalty.
|
|
|
|
AC_ARG_ENABLE([cc-silence],
|
|
|
|
[AS_HELP_STRING([--enable-cc-silence],
|
|
|
|
[Silence irrelevant compiler warnings])],
|
|
|
|
[if test "x$enable_cc_silence" = "xno" ; then
|
|
|
|
enable_cc_silence="0"
|
|
|
|
else
|
|
|
|
enable_cc_silence="1"
|
|
|
|
fi
|
|
|
|
],
|
|
|
|
[enable_cc_silence="0"]
|
|
|
|
)
|
|
|
|
if test "x$enable_cc_silence" = "x1" ; then
|
|
|
|
AC_DEFINE([JEMALLOC_CC_SILENCE])
|
|
|
|
fi
|
|
|
|
|
2009-06-24 10:01:18 +08:00
|
|
|
dnl Do not compile with debugging by default.
|
|
|
|
AC_ARG_ENABLE([debug],
|
|
|
|
[AS_HELP_STRING([--enable-debug], [Build debugging code])],
|
|
|
|
[if test "x$enable_debug" = "xno" ; then
|
|
|
|
enable_debug="0"
|
|
|
|
else
|
|
|
|
enable_debug="1"
|
|
|
|
fi
|
|
|
|
],
|
|
|
|
[enable_debug="0"]
|
|
|
|
)
|
|
|
|
if test "x$enable_debug" = "x1" ; then
|
|
|
|
AC_DEFINE([JEMALLOC_DEBUG], [ ])
|
2010-09-06 01:35:13 +08:00
|
|
|
AC_DEFINE([JEMALLOC_IVSALLOC], [ ])
|
2009-06-24 10:01:18 +08:00
|
|
|
fi
|
|
|
|
AC_SUBST([enable_debug])
|
|
|
|
|
|
|
|
dnl Only optimize if not debugging.
|
|
|
|
if test "x$enable_debug" = "x0" -a "x$no_CFLAGS" = "xyes" ; then
|
|
|
|
dnl Make sure that an optimization flag was not specified in EXTRA_CFLAGS.
|
2009-07-01 07:17:05 +08:00
|
|
|
optimize="no"
|
|
|
|
echo "$EXTRA_CFLAGS" | grep "\-O" >/dev/null || optimize="yes"
|
|
|
|
if test "x${optimize}" = "xyes" ; then
|
|
|
|
if test "x$GCC" = "xyes" ; then
|
|
|
|
JE_CFLAGS_APPEND([-O3])
|
|
|
|
JE_CFLAGS_APPEND([-funroll-loops])
|
|
|
|
else
|
|
|
|
JE_CFLAGS_APPEND([-O])
|
|
|
|
fi
|
2009-06-24 10:01:18 +08:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
dnl Do not enable statistics calculation by default.
|
|
|
|
AC_ARG_ENABLE([stats],
|
|
|
|
[AS_HELP_STRING([--enable-stats], [Enable statistics calculation/reporting])],
|
|
|
|
[if test "x$enable_stats" = "xno" ; then
|
|
|
|
enable_stats="0"
|
|
|
|
else
|
|
|
|
enable_stats="1"
|
|
|
|
fi
|
|
|
|
],
|
|
|
|
[enable_stats="0"]
|
|
|
|
)
|
|
|
|
if test "x$enable_stats" = "x1" ; then
|
|
|
|
AC_DEFINE([JEMALLOC_STATS], [ ])
|
|
|
|
fi
|
|
|
|
AC_SUBST([enable_stats])
|
|
|
|
|
2010-02-11 02:37:56 +08:00
|
|
|
dnl Do not enable profiling by default.
|
|
|
|
AC_ARG_ENABLE([prof],
|
|
|
|
[AS_HELP_STRING([--enable-prof], [Enable allocation profiling])],
|
|
|
|
[if test "x$enable_prof" = "xno" ; then
|
|
|
|
enable_prof="0"
|
|
|
|
else
|
|
|
|
enable_prof="1"
|
|
|
|
fi
|
|
|
|
],
|
|
|
|
[enable_prof="0"]
|
|
|
|
)
|
2011-03-16 13:23:12 +08:00
|
|
|
if test "x$enable_prof" = "x1" ; then
|
|
|
|
backtrace_method=""
|
2010-02-11 10:15:53 +08:00
|
|
|
else
|
2011-03-16 13:23:12 +08:00
|
|
|
backtrace_method="N/A"
|
2010-02-11 10:15:53 +08:00
|
|
|
fi
|
2011-03-16 13:23:12 +08:00
|
|
|
|
2010-02-11 02:37:56 +08:00
|
|
|
AC_ARG_ENABLE([prof-libunwind],
|
|
|
|
[AS_HELP_STRING([--enable-prof-libunwind], [Use libunwind for backtracing])],
|
|
|
|
[if test "x$enable_prof_libunwind" = "xno" ; then
|
|
|
|
enable_prof_libunwind="0"
|
|
|
|
else
|
|
|
|
enable_prof_libunwind="1"
|
|
|
|
fi
|
|
|
|
],
|
|
|
|
[enable_prof_libunwind="0"]
|
|
|
|
)
|
2010-03-03 06:12:58 +08:00
|
|
|
AC_ARG_WITH([static_libunwind],
|
|
|
|
[AS_HELP_STRING([--with-static-libunwind=<libunwind.a>],
|
|
|
|
[Path to static libunwind library; use rather than dynamically linking])],
|
|
|
|
if test "x$with_static_libunwind" = "xno" ; then
|
|
|
|
LUNWIND="-lunwind"
|
|
|
|
else
|
|
|
|
if test ! -f "$with_static_libunwind" ; then
|
|
|
|
AC_MSG_ERROR([Static libunwind not found: $with_static_libunwind])
|
|
|
|
fi
|
|
|
|
LUNWIND="$with_static_libunwind"
|
|
|
|
fi,
|
|
|
|
LUNWIND="-lunwind"
|
|
|
|
)
|
2011-03-16 13:23:12 +08:00
|
|
|
if test "x$backtrace_method" = "x" -a "x$enable_prof_libunwind" = "x1" ; then
|
|
|
|
AC_CHECK_HEADERS([libunwind.h], , [enable_prof_libunwind="0"])
|
|
|
|
if test "x$LUNWIND" = "x-lunwind" ; then
|
|
|
|
AC_CHECK_LIB([unwind], [backtrace], [LIBS="$LIBS $LUNWIND"],
|
|
|
|
[enable_prof_libunwind="0"])
|
|
|
|
else
|
|
|
|
LIBS="$LIBS $LUNWIND"
|
|
|
|
fi
|
|
|
|
if test "x${enable_prof_libunwind}" = "x1" ; then
|
|
|
|
backtrace_method="libunwind"
|
|
|
|
AC_DEFINE([JEMALLOC_PROF_LIBUNWIND], [ ])
|
2010-09-06 01:35:13 +08:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2011-03-16 13:23:12 +08:00
|
|
|
AC_ARG_ENABLE([prof-libgcc],
|
|
|
|
[AS_HELP_STRING([--disable-prof-libgcc],
|
|
|
|
[Do not use libgcc for backtracing])],
|
|
|
|
[if test "x$enable_prof_libgcc" = "xno" ; then
|
|
|
|
enable_prof_libgcc="0"
|
|
|
|
else
|
|
|
|
enable_prof_libgcc="1"
|
|
|
|
fi
|
|
|
|
],
|
|
|
|
[enable_prof_libgcc="1"]
|
|
|
|
)
|
|
|
|
if test "x$backtrace_method" = "x" -a "x$enable_prof_libgcc" = "x1" \
|
|
|
|
-a "x$GCC" = "xyes" ; then
|
|
|
|
AC_CHECK_HEADERS([unwind.h], , [enable_prof_libgcc="0"])
|
|
|
|
AC_CHECK_LIB([gcc], [_Unwind_Backtrace], [LIBS="$LIBS -lgcc"], [enable_prof_libgcc="0"])
|
|
|
|
dnl The following is conservative, in that it only has entries for CPUs on
|
|
|
|
dnl which jemalloc has been tested.
|
|
|
|
AC_MSG_CHECKING([libgcc-based backtracing reliability on ${host_cpu}])
|
|
|
|
case "${host_cpu}" in
|
|
|
|
i[[3456]]86)
|
|
|
|
AC_MSG_RESULT([unreliable])
|
|
|
|
enable_prof_libgcc="0";
|
|
|
|
;;
|
|
|
|
x86_64)
|
|
|
|
AC_MSG_RESULT([reliable])
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
AC_MSG_RESULT([unreliable])
|
|
|
|
enable_prof_libgcc="0";
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
if test "x${enable_prof_libgcc}" = "x1" ; then
|
|
|
|
backtrace_method="libgcc"
|
|
|
|
AC_DEFINE([JEMALLOC_PROF_LIBGCC], [ ])
|
2010-09-06 01:35:13 +08:00
|
|
|
fi
|
2011-03-16 13:23:12 +08:00
|
|
|
else
|
|
|
|
enable_prof_libgcc="0"
|
|
|
|
fi
|
|
|
|
|
|
|
|
AC_ARG_ENABLE([prof-gcc],
|
|
|
|
[AS_HELP_STRING([--disable-prof-gcc],
|
|
|
|
[Do not use gcc intrinsics for backtracing])],
|
|
|
|
[if test "x$enable_prof_gcc" = "xno" ; then
|
|
|
|
enable_prof_gcc="0"
|
|
|
|
else
|
|
|
|
enable_prof_gcc="1"
|
|
|
|
fi
|
|
|
|
],
|
|
|
|
[enable_prof_gcc="1"]
|
|
|
|
)
|
|
|
|
if test "x$backtrace_method" = "x" -a "x$enable_prof_gcc" = "x1" \
|
|
|
|
-a "x$GCC" = "xyes" ; then
|
|
|
|
backtrace_method="gcc intrinsics"
|
|
|
|
AC_DEFINE([JEMALLOC_PROF_GCC], [ ])
|
|
|
|
else
|
|
|
|
enable_prof_gcc="0"
|
2010-09-06 01:35:13 +08:00
|
|
|
fi
|
2010-02-11 02:37:56 +08:00
|
|
|
|
2011-03-16 13:23:12 +08:00
|
|
|
if test "x$backtrace_method" = "x" ; then
|
|
|
|
backtrace_method="none (disabling profiling)"
|
|
|
|
enable_prof="0"
|
|
|
|
fi
|
|
|
|
AC_MSG_CHECKING([configured backtracing method])
|
|
|
|
AC_MSG_RESULT([$backtrace_method])
|
|
|
|
if test "x$enable_prof" = "x1" ; then
|
|
|
|
AC_DEFINE([JEMALLOC_PROF], [ ])
|
|
|
|
fi
|
|
|
|
AC_SUBST([enable_prof])
|
|
|
|
|
2009-06-24 10:01:18 +08:00
|
|
|
dnl Enable tiny allocations by default.
|
|
|
|
AC_ARG_ENABLE([tiny],
|
|
|
|
[AS_HELP_STRING([--disable-tiny], [Disable tiny (sub-quantum) allocations])],
|
|
|
|
[if test "x$enable_tiny" = "xno" ; then
|
|
|
|
enable_tiny="0"
|
|
|
|
else
|
|
|
|
enable_tiny="1"
|
|
|
|
fi
|
|
|
|
],
|
|
|
|
[enable_tiny="1"]
|
|
|
|
)
|
|
|
|
if test "x$enable_tiny" = "x1" ; then
|
|
|
|
AC_DEFINE([JEMALLOC_TINY], [ ])
|
|
|
|
fi
|
|
|
|
AC_SUBST([enable_tiny])
|
|
|
|
|
2009-12-29 16:09:15 +08:00
|
|
|
dnl Enable thread-specific caching by default.
|
|
|
|
AC_ARG_ENABLE([tcache],
|
|
|
|
[AS_HELP_STRING([--disable-tcache], [Disable per thread caches])],
|
|
|
|
[if test "x$enable_tcache" = "xno" ; then
|
|
|
|
enable_tcache="0"
|
2009-06-24 10:01:18 +08:00
|
|
|
else
|
2009-12-29 16:09:15 +08:00
|
|
|
enable_tcache="1"
|
2009-06-24 10:01:18 +08:00
|
|
|
fi
|
|
|
|
],
|
2009-12-29 16:09:15 +08:00
|
|
|
[enable_tcache="1"]
|
2009-06-24 10:01:18 +08:00
|
|
|
)
|
2010-09-06 01:35:13 +08:00
|
|
|
if test "x$enable_tcache" = "x1" ; then
|
|
|
|
AC_DEFINE([JEMALLOC_TCACHE], [ ])
|
|
|
|
fi
|
|
|
|
AC_SUBST([enable_tcache])
|
2009-06-24 10:01:18 +08:00
|
|
|
|
|
|
|
dnl Do not enable allocation from DSS by default.
|
|
|
|
AC_ARG_ENABLE([dss],
|
|
|
|
[AS_HELP_STRING([--enable-dss], [Enable allocation from DSS])],
|
|
|
|
[if test "x$enable_dss" = "xno" ; then
|
|
|
|
enable_dss="0"
|
|
|
|
else
|
|
|
|
enable_dss="1"
|
|
|
|
fi
|
|
|
|
],
|
|
|
|
[enable_dss="0"]
|
|
|
|
)
|
|
|
|
if test "x$enable_dss" = "x1" ; then
|
|
|
|
AC_DEFINE([JEMALLOC_DSS], [ ])
|
|
|
|
fi
|
|
|
|
AC_SUBST([enable_dss])
|
|
|
|
|
|
|
|
dnl Do not support the junk/zero filling option by default.
|
|
|
|
AC_ARG_ENABLE([fill],
|
|
|
|
[AS_HELP_STRING([--enable-fill], [Support junk/zero filling option])],
|
|
|
|
[if test "x$enable_fill" = "xno" ; then
|
|
|
|
enable_fill="0"
|
|
|
|
else
|
|
|
|
enable_fill="1"
|
|
|
|
fi
|
|
|
|
],
|
|
|
|
[enable_fill="0"]
|
|
|
|
)
|
|
|
|
if test "x$enable_fill" = "x1" ; then
|
|
|
|
AC_DEFINE([JEMALLOC_FILL], [ ])
|
|
|
|
fi
|
|
|
|
AC_SUBST([enable_fill])
|
|
|
|
|
|
|
|
dnl Do not support the xmalloc option by default.
|
|
|
|
AC_ARG_ENABLE([xmalloc],
|
|
|
|
[AS_HELP_STRING([--enable-xmalloc], [Support xmalloc option])],
|
|
|
|
[if test "x$enable_xmalloc" = "xno" ; then
|
|
|
|
enable_xmalloc="0"
|
|
|
|
else
|
|
|
|
enable_xmalloc="1"
|
|
|
|
fi
|
|
|
|
],
|
|
|
|
[enable_xmalloc="0"]
|
|
|
|
)
|
|
|
|
if test "x$enable_xmalloc" = "x1" ; then
|
|
|
|
AC_DEFINE([JEMALLOC_XMALLOC], [ ])
|
|
|
|
fi
|
|
|
|
AC_SUBST([enable_xmalloc])
|
|
|
|
|
|
|
|
dnl Do not support the SYSV option by default.
|
|
|
|
AC_ARG_ENABLE([sysv],
|
|
|
|
[AS_HELP_STRING([--enable-sysv], [Support SYSV semantics option])],
|
|
|
|
[if test "x$enable_sysv" = "xno" ; then
|
|
|
|
enable_sysv="0"
|
|
|
|
else
|
|
|
|
enable_sysv="1"
|
|
|
|
fi
|
|
|
|
],
|
|
|
|
[enable_sysv="0"]
|
|
|
|
)
|
|
|
|
if test "x$enable_sysv" = "x1" ; then
|
|
|
|
AC_DEFINE([JEMALLOC_SYSV], [ ])
|
|
|
|
fi
|
|
|
|
AC_SUBST([enable_sysv])
|
|
|
|
|
|
|
|
dnl Do not determine page shift at run time by default.
|
|
|
|
AC_ARG_ENABLE([dynamic_page_shift],
|
|
|
|
[AS_HELP_STRING([--enable-dynamic-page-shift],
|
|
|
|
[Determine page size at run time (don't trust configure result)])],
|
|
|
|
[if test "x$enable_dynamic_page_shift" = "xno" ; then
|
|
|
|
enable_dynamic_page_shift="0"
|
|
|
|
else
|
|
|
|
enable_dynamic_page_shift="1"
|
|
|
|
fi
|
|
|
|
],
|
|
|
|
[enable_dynamic_page_shift="0"]
|
|
|
|
)
|
|
|
|
if test "x$enable_dynamic_page_shift" = "x1" ; then
|
|
|
|
AC_DEFINE([DYNAMIC_PAGE_SHIFT], [ ])
|
|
|
|
fi
|
|
|
|
AC_SUBST([enable_dynamic_page_shift])
|
|
|
|
|
|
|
|
AC_MSG_CHECKING([STATIC_PAGE_SHIFT])
|
|
|
|
AC_RUN_IFELSE([AC_LANG_PROGRAM(
|
|
|
|
[[#include <stdio.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <strings.h>
|
|
|
|
]], [[
|
|
|
|
long result;
|
|
|
|
FILE *f;
|
|
|
|
|
|
|
|
result = sysconf(_SC_PAGESIZE);
|
|
|
|
if (result == -1) {
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
f = fopen("conftest.out", "w");
|
|
|
|
if (f == NULL) {
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
fprintf(f, "%u\n", ffs((int)result) - 1);
|
|
|
|
close(f);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
]])],
|
|
|
|
[STATIC_PAGE_SHIFT=`cat conftest.out`]
|
|
|
|
AC_MSG_RESULT([$STATIC_PAGE_SHIFT])
|
|
|
|
AC_DEFINE_UNQUOTED([STATIC_PAGE_SHIFT], [$STATIC_PAGE_SHIFT]),
|
|
|
|
AC_MSG_RESULT([error]))
|
|
|
|
|
|
|
|
dnl ============================================================================
|
|
|
|
dnl jemalloc configuration.
|
|
|
|
dnl
|
2010-03-03 05:01:16 +08:00
|
|
|
|
|
|
|
dnl Set VERSION if source directory has an embedded git repository.
|
2011-04-01 13:38:51 +08:00
|
|
|
if test -d "${srcroot}.git" ; then
|
2010-09-18 08:38:24 +08:00
|
|
|
git describe --long --abbrev=40 > ${srcroot}VERSION
|
2010-03-03 05:01:16 +08:00
|
|
|
fi
|
2009-06-24 10:01:18 +08:00
|
|
|
jemalloc_version=`cat ${srcroot}VERSION`
|
2010-03-03 05:01:16 +08:00
|
|
|
jemalloc_version_major=`echo ${jemalloc_version} | tr ".g-" " " | awk '{print [$]1}'`
|
|
|
|
jemalloc_version_minor=`echo ${jemalloc_version} | tr ".g-" " " | awk '{print [$]2}'`
|
|
|
|
jemalloc_version_bugfix=`echo ${jemalloc_version} | tr ".g-" " " | awk '{print [$]3}'`
|
|
|
|
jemalloc_version_nrev=`echo ${jemalloc_version} | tr ".g-" " " | awk '{print [$]4}'`
|
|
|
|
jemalloc_version_gid=`echo ${jemalloc_version} | tr ".g-" " " | awk '{print [$]5}'`
|
2009-06-24 10:01:18 +08:00
|
|
|
AC_SUBST([jemalloc_version])
|
2010-03-03 05:01:16 +08:00
|
|
|
AC_SUBST([jemalloc_version_major])
|
|
|
|
AC_SUBST([jemalloc_version_minor])
|
|
|
|
AC_SUBST([jemalloc_version_bugfix])
|
|
|
|
AC_SUBST([jemalloc_version_nrev])
|
|
|
|
AC_SUBST([jemalloc_version_gid])
|
2009-06-24 10:01:18 +08:00
|
|
|
|
|
|
|
dnl ============================================================================
|
|
|
|
dnl Configure pthreads.
|
|
|
|
|
|
|
|
AC_CHECK_HEADERS([pthread.h], , [AC_MSG_ERROR([pthread.h is missing])])
|
|
|
|
AC_CHECK_LIB([pthread], [pthread_create], [LIBS="$LIBS -lpthread"],
|
|
|
|
[AC_MSG_ERROR([libpthread is missing])])
|
|
|
|
|
|
|
|
CPPFLAGS="$CPPFLAGS -D_REENTRANT"
|
|
|
|
|
2010-01-18 06:06:20 +08:00
|
|
|
dnl Enable lazy locking by default.
|
|
|
|
AC_ARG_ENABLE([lazy_lock],
|
|
|
|
[AS_HELP_STRING([--disable-lazy-lock],
|
|
|
|
[Disable lazy locking (always lock, even when single-threaded)])],
|
|
|
|
[if test "x$enable_lazy_lock" = "xno" ; then
|
|
|
|
enable_lazy_lock="0"
|
|
|
|
else
|
|
|
|
enable_lazy_lock="1"
|
|
|
|
fi
|
|
|
|
],
|
|
|
|
[enable_lazy_lock="1"]
|
|
|
|
)
|
|
|
|
if test "x$enable_lazy_lock" = "x1" ; then
|
|
|
|
AC_CHECK_HEADERS([dlfcn.h], , [AC_MSG_ERROR([dlfcn.h is missing])])
|
|
|
|
AC_CHECK_LIB([dl], [dlopen], [LIBS="$LIBS -ldl"],
|
|
|
|
[AC_MSG_ERROR([libdl is missing])])
|
|
|
|
AC_DEFINE([JEMALLOC_LAZY_LOCK], [ ])
|
|
|
|
fi
|
|
|
|
AC_SUBST([enable_lazy_lock])
|
|
|
|
|
|
|
|
AC_ARG_ENABLE([tls],
|
|
|
|
[AS_HELP_STRING([--disable-tls], [Disable thread-local storage (__thread keyword)])],
|
|
|
|
if test "x$enable_tls" = "xno" ; then
|
|
|
|
enable_tls="0"
|
|
|
|
else
|
|
|
|
enable_tls="1"
|
|
|
|
fi
|
|
|
|
,
|
|
|
|
enable_tls="1"
|
|
|
|
)
|
|
|
|
if test "x${enable_tls}" = "x1" ; then
|
2009-06-24 10:01:18 +08:00
|
|
|
AC_MSG_CHECKING([for TLS])
|
|
|
|
AC_RUN_IFELSE([AC_LANG_PROGRAM(
|
|
|
|
[[
|
|
|
|
__thread int x;
|
|
|
|
]], [[
|
|
|
|
x = 42;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
]])],
|
2010-01-18 06:06:20 +08:00
|
|
|
AC_MSG_RESULT([yes]),
|
2009-06-24 10:01:18 +08:00
|
|
|
AC_MSG_RESULT([no])
|
2010-01-18 06:06:20 +08:00
|
|
|
enable_tls="0")
|
|
|
|
fi
|
2010-08-14 06:42:29 +08:00
|
|
|
AC_SUBST([enable_tls])
|
2010-01-18 06:06:20 +08:00
|
|
|
if test "x${enable_tls}" = "x0" ; then
|
|
|
|
AC_DEFINE_UNQUOTED([NO_TLS], [ ])
|
2009-12-29 16:09:15 +08:00
|
|
|
fi
|
2009-06-24 10:01:18 +08:00
|
|
|
|
Use bitmaps to track small regions.
The previous free list implementation, which embedded singly linked
lists in available regions, had the unfortunate side effect of causing
many cache misses during thread cache fills. Fix this in two places:
- arena_run_t: Use a new bitmap implementation to track which regions
are available. Furthermore, revert to preferring the
lowest available region (as jemalloc did with its old
bitmap-based approach).
- tcache_t: Move read-only tcache_bin_t metadata into
tcache_bin_info_t, and add a contiguous array of pointers
to tcache_t in order to track cached objects. This
substantially increases the size of tcache_t, but results
in much higher data locality for common tcache operations.
As a side benefit, it is again possible to efficiently
flush the least recently used cached objects, so this
change changes flushing from MRU to LRU.
The new bitmap implementation uses a multi-level summary approach to
make finding the lowest available region very fast. In practice,
bitmaps only have one or two levels, though the implementation is
general enough to handle extremely large bitmaps, mainly so that large
page sizes can still be entertained.
Fix tcache_bin_flush_large() to always flush statistics, in the same way
that tcache_bin_flush_small() was recently fixed.
Use JEMALLOC_DEBUG rather than NDEBUG.
Add dassert(), and use it for debug-only asserts.
2011-03-17 01:30:13 +08:00
|
|
|
dnl ============================================================================
|
|
|
|
dnl Check for ffsl(3), and fail if not found. This function exists on all
|
|
|
|
dnl platforms that jemalloc currently has a chance of functioning on without
|
|
|
|
dnl modification.
|
|
|
|
|
|
|
|
AC_CHECK_FUNC([ffsl], [],
|
|
|
|
[AC_MSG_ERROR([Cannot build without ffsl(3)])])
|
|
|
|
|
2011-03-19 10:10:31 +08:00
|
|
|
dnl ============================================================================
|
|
|
|
dnl Check for atomic(3) operations as provided on Darwin.
|
|
|
|
|
|
|
|
JE_COMPILABLE([Darwin OSAtomic*()], [
|
|
|
|
#include <libkern/OSAtomic.h>
|
|
|
|
#include <inttypes.h>
|
|
|
|
], [
|
|
|
|
{
|
|
|
|
int32_t x32 = 0;
|
|
|
|
volatile int32_t *x32p = &x32;
|
|
|
|
OSAtomicAdd32(1, x32p);
|
|
|
|
}
|
|
|
|
{
|
|
|
|
int64_t x64 = 0;
|
|
|
|
volatile int64_t *x64p = &x64;
|
|
|
|
OSAtomicAdd64(1, x64p);
|
|
|
|
}
|
|
|
|
], [osatomic])
|
|
|
|
if test "x${osatomic}" = "xyes" ; then
|
|
|
|
AC_DEFINE([JEMALLOC_OSATOMIC])
|
|
|
|
fi
|
|
|
|
|
2011-03-19 10:30:18 +08:00
|
|
|
dnl ============================================================================
|
|
|
|
dnl Check for spinlock(3) operations as provided on Darwin.
|
|
|
|
|
|
|
|
JE_COMPILABLE([Darwin OSSpin*()], [
|
|
|
|
#include <libkern/OSAtomic.h>
|
|
|
|
#include <inttypes.h>
|
|
|
|
], [
|
|
|
|
OSSpinLock lock = 0;
|
|
|
|
OSSpinLockLock(&lock);
|
|
|
|
OSSpinLockUnlock(&lock);
|
|
|
|
], [osspin])
|
|
|
|
if test "x${osspin}" = "xyes" ; then
|
|
|
|
AC_DEFINE([JEMALLOC_OSSPIN])
|
|
|
|
fi
|
|
|
|
|
2010-09-06 01:35:13 +08:00
|
|
|
dnl ============================================================================
|
2010-09-21 07:44:23 +08:00
|
|
|
dnl Check for allocator-related functions that should be wrapped.
|
|
|
|
|
|
|
|
AC_CHECK_FUNC([memalign],
|
|
|
|
[AC_DEFINE([JEMALLOC_OVERRIDE_MEMALIGN])])
|
|
|
|
AC_CHECK_FUNC([valloc],
|
|
|
|
[AC_DEFINE([JEMALLOC_OVERRIDE_VALLOC])])
|
|
|
|
|
|
|
|
dnl ============================================================================
|
2010-09-06 01:35:13 +08:00
|
|
|
dnl Darwin-related configuration.
|
|
|
|
|
|
|
|
if test "x${abi}" = "xmacho" ; then
|
|
|
|
AC_DEFINE([JEMALLOC_IVSALLOC])
|
|
|
|
AC_DEFINE([JEMALLOC_ZONE])
|
|
|
|
|
|
|
|
dnl The szone version jumped from 3 to 6 between the OS X 10.5.x and 10.6
|
|
|
|
dnl releases. malloc_zone_t and malloc_introspection_t have new fields in
|
|
|
|
dnl 10.6, which is the only source-level indication of the change.
|
|
|
|
AC_MSG_CHECKING([malloc zone version])
|
|
|
|
AC_TRY_COMPILE([#include <stdlib.h>
|
|
|
|
#include <malloc/malloc.h>], [
|
|
|
|
static malloc_zone_t zone;
|
|
|
|
static struct malloc_introspection_t zone_introspect;
|
|
|
|
|
|
|
|
zone.size = NULL;
|
|
|
|
zone.malloc = NULL;
|
|
|
|
zone.calloc = NULL;
|
|
|
|
zone.valloc = NULL;
|
|
|
|
zone.free = NULL;
|
|
|
|
zone.realloc = NULL;
|
|
|
|
zone.destroy = NULL;
|
|
|
|
zone.zone_name = "jemalloc_zone";
|
|
|
|
zone.batch_malloc = NULL;
|
|
|
|
zone.batch_free = NULL;
|
|
|
|
zone.introspect = &zone_introspect;
|
|
|
|
zone.version = 6;
|
|
|
|
zone.memalign = NULL;
|
|
|
|
zone.free_definite_size = NULL;
|
|
|
|
|
|
|
|
zone_introspect.enumerator = NULL;
|
|
|
|
zone_introspect.good_size = NULL;
|
|
|
|
zone_introspect.check = NULL;
|
|
|
|
zone_introspect.print = NULL;
|
|
|
|
zone_introspect.log = NULL;
|
|
|
|
zone_introspect.force_lock = NULL;
|
|
|
|
zone_introspect.force_unlock = NULL;
|
|
|
|
zone_introspect.statistics = NULL;
|
|
|
|
zone_introspect.zone_locked = NULL;
|
|
|
|
], [AC_DEFINE_UNQUOTED([JEMALLOC_ZONE_VERSION], [6])
|
|
|
|
AC_MSG_RESULT([6])],
|
|
|
|
[AC_DEFINE_UNQUOTED([JEMALLOC_ZONE_VERSION], [3])
|
|
|
|
AC_MSG_RESULT([3])])
|
2010-02-11 10:15:53 +08:00
|
|
|
fi
|
|
|
|
|
2009-06-24 10:01:18 +08:00
|
|
|
dnl ============================================================================
|
|
|
|
dnl Check for typedefs, structures, and compiler characteristics.
|
|
|
|
AC_HEADER_STDBOOL
|
|
|
|
|
|
|
|
dnl Process .in files.
|
2010-01-17 17:49:20 +08:00
|
|
|
AC_SUBST([cfghdrs_in])
|
|
|
|
AC_SUBST([cfghdrs_out])
|
2010-04-08 14:37:35 +08:00
|
|
|
AC_CONFIG_HEADERS([$cfghdrs_tup])
|
2009-06-24 10:01:18 +08:00
|
|
|
|
|
|
|
dnl ============================================================================
|
|
|
|
dnl Generate outputs.
|
2011-10-13 13:33:33 +08:00
|
|
|
AC_CONFIG_FILES([$cfgoutputs_tup config.stamp bin/jemalloc.sh])
|
2010-01-17 17:49:20 +08:00
|
|
|
AC_SUBST([cfgoutputs_in])
|
|
|
|
AC_SUBST([cfgoutputs_out])
|
2009-06-24 10:01:18 +08:00
|
|
|
AC_OUTPUT
|
|
|
|
|
|
|
|
dnl ============================================================================
|
|
|
|
dnl Print out the results of configuration.
|
|
|
|
AC_MSG_RESULT([===============================================================================])
|
2011-11-02 13:27:41 +08:00
|
|
|
AC_MSG_RESULT([jemalloc version : ${jemalloc_version}])
|
|
|
|
AC_MSG_RESULT([library revision : ${rev}])
|
2009-06-24 10:01:18 +08:00
|
|
|
AC_MSG_RESULT([])
|
|
|
|
AC_MSG_RESULT([CC : ${CC}])
|
|
|
|
AC_MSG_RESULT([CPPFLAGS : ${CPPFLAGS}])
|
|
|
|
AC_MSG_RESULT([CFLAGS : ${CFLAGS}])
|
|
|
|
AC_MSG_RESULT([LDFLAGS : ${LDFLAGS}])
|
|
|
|
AC_MSG_RESULT([LIBS : ${LIBS}])
|
|
|
|
AC_MSG_RESULT([RPATH_EXTRA : ${RPATH_EXTRA}])
|
|
|
|
AC_MSG_RESULT([])
|
2010-11-25 14:00:02 +08:00
|
|
|
AC_MSG_RESULT([XSLTPROC : ${XSLTPROC}])
|
|
|
|
AC_MSG_RESULT([XSLROOT : ${XSLROOT}])
|
|
|
|
AC_MSG_RESULT([])
|
2009-06-24 10:01:18 +08:00
|
|
|
AC_MSG_RESULT([PREFIX : ${PREFIX}])
|
|
|
|
AC_MSG_RESULT([BINDIR : ${BINDIR}])
|
2009-07-02 10:24:31 +08:00
|
|
|
AC_MSG_RESULT([INCLUDEDIR : ${INCLUDEDIR}])
|
|
|
|
AC_MSG_RESULT([LIBDIR : ${LIBDIR}])
|
2009-06-24 10:01:18 +08:00
|
|
|
AC_MSG_RESULT([DATADIR : ${DATADIR}])
|
|
|
|
AC_MSG_RESULT([MANDIR : ${MANDIR}])
|
|
|
|
AC_MSG_RESULT([])
|
|
|
|
AC_MSG_RESULT([srcroot : ${srcroot}])
|
|
|
|
AC_MSG_RESULT([abs_srcroot : ${abs_srcroot}])
|
|
|
|
AC_MSG_RESULT([objroot : ${objroot}])
|
|
|
|
AC_MSG_RESULT([abs_objroot : ${abs_objroot}])
|
|
|
|
AC_MSG_RESULT([])
|
2009-12-29 16:09:15 +08:00
|
|
|
AC_MSG_RESULT([JEMALLOC_PREFIX : ${JEMALLOC_PREFIX}])
|
2011-07-31 07:40:52 +08:00
|
|
|
AC_MSG_RESULT([JEMALLOC_PRIVATE_NAMESPACE])
|
|
|
|
AC_MSG_RESULT([ : ${JEMALLOC_PRIVATE_NAMESPACE}])
|
2010-01-17 17:49:20 +08:00
|
|
|
AC_MSG_RESULT([install_suffix : ${install_suffix}])
|
2009-06-24 10:01:18 +08:00
|
|
|
AC_MSG_RESULT([autogen : ${enable_autogen}])
|
2010-09-21 10:20:48 +08:00
|
|
|
AC_MSG_RESULT([cc-silence : ${enable_cc_silence}])
|
2009-06-24 10:01:18 +08:00
|
|
|
AC_MSG_RESULT([debug : ${enable_debug}])
|
|
|
|
AC_MSG_RESULT([stats : ${enable_stats}])
|
2010-02-11 02:37:56 +08:00
|
|
|
AC_MSG_RESULT([prof : ${enable_prof}])
|
|
|
|
AC_MSG_RESULT([prof-libunwind : ${enable_prof_libunwind}])
|
2011-03-16 13:23:12 +08:00
|
|
|
AC_MSG_RESULT([prof-libgcc : ${enable_prof_libgcc}])
|
|
|
|
AC_MSG_RESULT([prof-gcc : ${enable_prof_gcc}])
|
2009-06-24 10:01:18 +08:00
|
|
|
AC_MSG_RESULT([tiny : ${enable_tiny}])
|
2009-12-29 16:09:15 +08:00
|
|
|
AC_MSG_RESULT([tcache : ${enable_tcache}])
|
2009-06-24 10:01:18 +08:00
|
|
|
AC_MSG_RESULT([fill : ${enable_fill}])
|
|
|
|
AC_MSG_RESULT([xmalloc : ${enable_xmalloc}])
|
|
|
|
AC_MSG_RESULT([sysv : ${enable_sysv}])
|
|
|
|
AC_MSG_RESULT([dss : ${enable_dss}])
|
|
|
|
AC_MSG_RESULT([dynamic_page_shift : ${enable_dynamic_page_shift}])
|
|
|
|
AC_MSG_RESULT([lazy_lock : ${enable_lazy_lock}])
|
2010-09-06 01:35:13 +08:00
|
|
|
AC_MSG_RESULT([tls : ${enable_tls}])
|
2009-06-24 10:01:18 +08:00
|
|
|
AC_MSG_RESULT([===============================================================================])
|