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
|
2012-03-06 04:15:36 +08:00
|
|
|
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
|
2009-07-01 07:17:05 +08:00
|
|
|
[[
|
|
|
|
]], [[
|
|
|
|
return 0;
|
|
|
|
]])],
|
|
|
|
AC_MSG_RESULT([yes]),
|
|
|
|
AC_MSG_RESULT([no])
|
|
|
|
[CFLAGS="${TCFLAGS}"]
|
|
|
|
)
|
|
|
|
])
|
|
|
|
|
|
|
|
dnl JE_COMPILABLE(label, hcode, mcode, rvar)
|
2012-03-14 02:09:23 +08:00
|
|
|
dnl
|
2012-03-20 00:54:20 +08:00
|
|
|
dnl Use AC_LINK_IFELSE() rather than AC_COMPILE_IFELSE() so that linker errors
|
2012-03-14 02:09:23 +08:00
|
|
|
dnl cause failure.
|
2009-07-01 07:17:05 +08:00
|
|
|
AC_DEFUN([JE_COMPILABLE],
|
|
|
|
[
|
2012-03-06 04:15:36 +08:00
|
|
|
AC_CACHE_CHECK([whether $1 is compilable],
|
|
|
|
[$4],
|
2012-03-20 00:54:20 +08:00
|
|
|
[AC_LINK_IFELSE([AC_LANG_PROGRAM([$2],
|
|
|
|
[$3])],
|
|
|
|
[$4=yes],
|
|
|
|
[$4=no])])
|
2009-07-01 07:17:05 +08:00
|
|
|
])
|
|
|
|
|
|
|
|
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.
|
2013-01-23 02:53:29 +08:00
|
|
|
AC_PATH_PROG([XSLTPROC], [xsltproc], [false], [$PATH])
|
2012-03-20 00:36:44 +08:00
|
|
|
if test -d "/usr/share/xml/docbook/stylesheet/docbook-xsl" ; then
|
|
|
|
DEFAULT_XSLROOT="/usr/share/xml/docbook/stylesheet/docbook-xsl"
|
|
|
|
elif test -d "/usr/share/sgml/docbook/xsl-stylesheets" ; then
|
|
|
|
DEFAULT_XSLROOT="/usr/share/sgml/docbook/xsl-stylesheets"
|
|
|
|
else
|
|
|
|
dnl Documentation building will fail if this default gets used.
|
|
|
|
DEFAULT_XSLROOT=""
|
|
|
|
fi
|
2010-11-25 14:00:02 +08:00
|
|
|
AC_ARG_WITH([xslroot],
|
2012-03-20 00:36:44 +08:00
|
|
|
[AS_HELP_STRING([--with-xslroot=<path>], [XSL stylesheet root path])], [
|
2010-11-25 14:00:02 +08:00
|
|
|
if test "x$with_xslroot" = "xno" ; then
|
2012-03-20 00:36:44 +08:00
|
|
|
XSLROOT="${DEFAULT_XSLROOT}"
|
2010-11-25 14:00:02 +08:00
|
|
|
else
|
|
|
|
XSLROOT="${with_xslroot}"
|
2012-03-20 00:36:44 +08:00
|
|
|
fi
|
|
|
|
],
|
|
|
|
XSLROOT="${DEFAULT_XSLROOT}"
|
2010-11-25 14:00:02 +08:00
|
|
|
)
|
|
|
|
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
|
2012-04-30 18:38:31 +08:00
|
|
|
if test "x$GCC" != "xyes" ; then
|
|
|
|
AC_CACHE_CHECK([whether compiler is MSVC],
|
|
|
|
[je_cv_msvc],
|
|
|
|
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],
|
|
|
|
[
|
|
|
|
#ifndef _MSC_VER
|
|
|
|
int fail[-1];
|
|
|
|
#endif
|
|
|
|
])],
|
|
|
|
[je_cv_msvc=yes],
|
|
|
|
[je_cv_msvc=no])])
|
|
|
|
fi
|
|
|
|
|
2009-06-24 10:01:18 +08:00
|
|
|
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])
|
2012-04-30 18:38:31 +08:00
|
|
|
elif test "x$je_cv_msvc" = "xyes" ; then
|
|
|
|
CC="$CC -nologo"
|
|
|
|
JE_CFLAGS_APPEND([-Zi])
|
|
|
|
JE_CFLAGS_APPEND([-MT])
|
|
|
|
JE_CFLAGS_APPEND([-W3])
|
|
|
|
CPPFLAGS="$CPPFLAGS -I${srcroot}/include/msvc_compat"
|
2010-03-04 07:48:20 +08:00
|
|
|
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])
|
|
|
|
|
2012-03-07 06:57:45 +08:00
|
|
|
AC_CHECK_SIZEOF([intmax_t])
|
|
|
|
if test "x${ac_cv_sizeof_intmax_t}" = "x16" ; then
|
|
|
|
LG_SIZEOF_INTMAX_T=4
|
|
|
|
elif test "x${ac_cv_sizeof_intmax_t}" = "x8" ; then
|
|
|
|
LG_SIZEOF_INTMAX_T=3
|
|
|
|
elif test "x${ac_cv_sizeof_intmax_t}" = "x4" ; then
|
|
|
|
LG_SIZEOF_INTMAX_T=2
|
|
|
|
else
|
2012-04-20 14:38:39 +08:00
|
|
|
AC_MSG_ERROR([Unsupported intmax_t size: ${ac_cv_sizeof_intmax_t}])
|
2012-03-07 06:57:45 +08:00
|
|
|
fi
|
|
|
|
AC_DEFINE_UNQUOTED([LG_SIZEOF_INTMAX_T], [$LG_SIZEOF_INTMAX_T])
|
|
|
|
|
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;]],
|
2012-03-06 04:15:36 +08:00
|
|
|
[je_cv_asm])
|
|
|
|
if test "x${je_cv_asm}" = "xyes" ; then
|
2009-07-01 07:17:05 +08:00
|
|
|
CPU_SPINWAIT='__asm__ volatile("pause")'
|
|
|
|
fi
|
2013-12-10 05:21:08 +08:00
|
|
|
AC_DEFINE_UNQUOTED([HAVE_SSE2], [ ])
|
2009-06-24 10:01:18 +08:00
|
|
|
;;
|
|
|
|
x86_64)
|
2009-07-01 07:17:05 +08:00
|
|
|
JE_COMPILABLE([__asm__ syntax], [],
|
2012-03-06 04:15:36 +08:00
|
|
|
[[__asm__ volatile("pause"); return 0;]], [je_cv_asm])
|
|
|
|
if test "x${je_cv_asm}" = "xyes" ; then
|
2009-07-01 07:17:05 +08:00
|
|
|
CPU_SPINWAIT='__asm__ volatile("pause")'
|
|
|
|
fi
|
2013-12-10 05:21:08 +08:00
|
|
|
AC_DEFINE_UNQUOTED([HAVE_SSE2], [ ])
|
|
|
|
;;
|
|
|
|
powerpc)
|
|
|
|
AC_DEFINE_UNQUOTED([HAVE_ALTIVEC], [ ])
|
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"
|
2012-04-30 18:38:31 +08:00
|
|
|
importlib="${so}"
|
2012-04-30 18:38:27 +08:00
|
|
|
o="$ac_objext"
|
2012-04-16 22:30:24 +08:00
|
|
|
a="a"
|
2012-04-30 18:38:27 +08:00
|
|
|
exe="$ac_exeext"
|
2012-04-22 12:27:46 +08:00
|
|
|
libprefix="lib"
|
2012-04-16 22:30:25 +08:00
|
|
|
DSO_LDFLAGS='-shared -Wl,-soname,$(@F)'
|
|
|
|
RPATH='-Wl,-rpath,$(1)'
|
2012-04-30 18:38:27 +08:00
|
|
|
SOREV="${so}.${rev}"
|
2012-04-19 00:29:41 +08:00
|
|
|
PIC_CFLAGS='-fPIC -DPIC'
|
2012-04-30 18:38:31 +08:00
|
|
|
CTARGET='-o $@'
|
|
|
|
LDTARGET='-o $@'
|
|
|
|
EXTRA_LDFLAGS=
|
2013-08-20 18:48:19 +08:00
|
|
|
ARFLAGS='crus'
|
|
|
|
AROUT=' $@'
|
2012-05-03 03:30:51 +08:00
|
|
|
CC_MM=1
|
2012-02-11 12:22:09 +08:00
|
|
|
|
2013-08-11 22:44:59 +08:00
|
|
|
AN_MAKEVAR([AR], [AC_PROG_AR])
|
|
|
|
AN_PROGRAM([ar], [AC_PROG_AR])
|
|
|
|
AC_DEFUN([AC_PROG_AR], [AC_CHECK_TOOL(AR, ar, :)])
|
|
|
|
AC_PROG_AR
|
|
|
|
|
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.
|
2012-04-17 08:52:27 +08:00
|
|
|
default_munmap="1"
|
2012-10-10 07:20:10 +08:00
|
|
|
JEMALLOC_USABLE_SIZE_CONST="const"
|
2009-06-24 10:01:18 +08:00
|
|
|
case "${host}" in
|
|
|
|
*-*-darwin*)
|
2012-05-03 20:12:49 +08:00
|
|
|
CFLAGS="$CFLAGS"
|
2009-06-24 10:01:18 +08:00
|
|
|
abi="macho"
|
2012-03-20 01:21:17 +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"
|
2012-04-30 18:38:31 +08:00
|
|
|
importlib="${so}"
|
2012-03-24 07:17:43 +08:00
|
|
|
force_tls="0"
|
2012-04-16 22:30:25 +08:00
|
|
|
DSO_LDFLAGS='-shared -Wl,-dylib_install_name,$(@F)'
|
2012-04-30 18:38:27 +08:00
|
|
|
SOREV="${rev}.${so}"
|
2013-12-04 13:49:36 +08:00
|
|
|
sbrk_deprecated="1"
|
2009-06-24 10:01:18 +08:00
|
|
|
;;
|
|
|
|
*-*-freebsd*)
|
|
|
|
CFLAGS="$CFLAGS"
|
|
|
|
abi="elf"
|
2012-03-20 01:21:17 +08:00
|
|
|
AC_DEFINE([JEMALLOC_PURGE_MADVISE_FREE], [ ])
|
2012-03-24 08:40:58 +08:00
|
|
|
force_lazy_lock="1"
|
2009-06-24 10:01:18 +08:00
|
|
|
;;
|
|
|
|
*-*-linux*)
|
|
|
|
CFLAGS="$CFLAGS"
|
|
|
|
CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
|
|
|
|
abi="elf"
|
2012-12-03 09:58:40 +08:00
|
|
|
AC_DEFINE([JEMALLOC_HAS_ALLOCA_H])
|
2012-03-20 01:21:17 +08:00
|
|
|
AC_DEFINE([JEMALLOC_PURGE_MADVISE_DONTNEED], [ ])
|
2012-04-06 02:06:23 +08:00
|
|
|
AC_DEFINE([JEMALLOC_THREADED_INIT], [ ])
|
2012-10-10 07:20:10 +08:00
|
|
|
JEMALLOC_USABLE_SIZE_CONST=""
|
2012-04-17 08:52:27 +08:00
|
|
|
default_munmap="0"
|
2009-06-24 10:01:18 +08:00
|
|
|
;;
|
|
|
|
*-*-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])
|
2012-03-20 01:21:17 +08:00
|
|
|
AC_DEFINE([JEMALLOC_PURGE_MADVISE_FREE], [ ])
|
2009-06-24 10:01:18 +08:00
|
|
|
;;
|
|
|
|
*-*-solaris2*)
|
|
|
|
CFLAGS="$CFLAGS"
|
|
|
|
abi="elf"
|
2012-04-16 22:30:25 +08:00
|
|
|
RPATH='-Wl,-R,$(1)'
|
2009-06-24 10:01:18 +08:00
|
|
|
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"
|
|
|
|
;;
|
2012-04-22 12:27:46 +08:00
|
|
|
*-*-mingw*)
|
|
|
|
abi="pecoff"
|
|
|
|
force_tls="0"
|
|
|
|
RPATH=""
|
|
|
|
so="dll"
|
2012-04-30 18:38:31 +08:00
|
|
|
if test "x$je_cv_msvc" = "xyes" ; then
|
|
|
|
importlib="lib"
|
|
|
|
DSO_LDFLAGS="-LD"
|
|
|
|
EXTRA_LDFLAGS="-link -DEBUG"
|
|
|
|
CTARGET='-Fo$@'
|
|
|
|
LDTARGET='-Fe$@'
|
2013-08-11 22:44:59 +08:00
|
|
|
AR='lib'
|
|
|
|
ARFLAGS='-nologo -out:'
|
2013-08-20 18:48:19 +08:00
|
|
|
AROUT='$@'
|
2012-05-03 03:30:51 +08:00
|
|
|
CC_MM=
|
2012-04-30 18:38:31 +08:00
|
|
|
else
|
|
|
|
importlib="${so}"
|
|
|
|
DSO_LDFLAGS="-shared"
|
|
|
|
fi
|
2012-04-22 12:27:46 +08:00
|
|
|
a="lib"
|
|
|
|
libprefix=""
|
2012-04-30 18:38:27 +08:00
|
|
|
SOREV="${so}"
|
2012-04-22 12:27:46 +08:00
|
|
|
PIC_CFLAGS=""
|
|
|
|
;;
|
2009-06-24 10:01:18 +08:00
|
|
|
*)
|
|
|
|
AC_MSG_RESULT([Unsupported operating system: ${host}])
|
|
|
|
abi="elf"
|
|
|
|
;;
|
|
|
|
esac
|
2012-10-10 07:20:10 +08:00
|
|
|
AC_DEFINE_UNQUOTED([JEMALLOC_USABLE_SIZE_CONST], [$JEMALLOC_USABLE_SIZE_CONST])
|
2009-06-24 10:01:18 +08:00
|
|
|
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])
|
2012-04-30 18:38:31 +08:00
|
|
|
AC_SUBST([importlib])
|
2012-04-16 22:30:24 +08:00
|
|
|
AC_SUBST([o])
|
|
|
|
AC_SUBST([a])
|
|
|
|
AC_SUBST([exe])
|
2012-04-22 12:27:46 +08:00
|
|
|
AC_SUBST([libprefix])
|
2012-04-16 22:30:25 +08:00
|
|
|
AC_SUBST([DSO_LDFLAGS])
|
2012-04-30 18:38:31 +08:00
|
|
|
AC_SUBST([EXTRA_LDFLAGS])
|
2012-04-19 00:29:40 +08:00
|
|
|
AC_SUBST([SOREV])
|
2012-04-19 00:29:41 +08:00
|
|
|
AC_SUBST([PIC_CFLAGS])
|
2012-04-30 18:38:31 +08:00
|
|
|
AC_SUBST([CTARGET])
|
|
|
|
AC_SUBST([LDTARGET])
|
|
|
|
AC_SUBST([MKLIB])
|
2013-08-20 18:48:19 +08:00
|
|
|
AC_SUBST([ARFLAGS])
|
|
|
|
AC_SUBST([AROUT])
|
2012-05-03 03:30:51 +08:00
|
|
|
AC_SUBST([CC_MM])
|
2012-04-30 18:38:31 +08:00
|
|
|
|
2011-03-16 01:25:59 +08:00
|
|
|
JE_COMPILABLE([__attribute__ syntax],
|
|
|
|
[static __attribute__((unused)) void foo(void){}],
|
|
|
|
[],
|
2012-03-06 04:15:36 +08:00
|
|
|
[je_cv_attribute])
|
|
|
|
if test "x${je_cv_attribute}" = "xyes" ; then
|
2011-03-16 01:25:59 +08:00
|
|
|
AC_DEFINE([JEMALLOC_HAVE_ATTR], [ ])
|
|
|
|
if test "x${GCC}" = "xyes" -a "x${abi}" = "xelf"; then
|
|
|
|
JE_CFLAGS_APPEND([-fvisibility=hidden])
|
|
|
|
fi
|
|
|
|
fi
|
2012-04-04 13:30:05 +08:00
|
|
|
dnl Check for tls_model attribute support (clang 3.0 still lacks support).
|
|
|
|
SAVED_CFLAGS="${CFLAGS}"
|
|
|
|
JE_CFLAGS_APPEND([-Werror])
|
|
|
|
JE_COMPILABLE([tls_model attribute], [],
|
|
|
|
[static __thread int
|
|
|
|
__attribute__((tls_model("initial-exec"))) foo;
|
|
|
|
foo = 0;],
|
|
|
|
[je_cv_tls_model])
|
|
|
|
CFLAGS="${SAVED_CFLAGS}"
|
|
|
|
if test "x${je_cv_tls_model}" = "xyes" ; then
|
|
|
|
AC_DEFINE([JEMALLOC_TLS_MODEL],
|
|
|
|
[__attribute__((tls_model("initial-exec")))])
|
|
|
|
else
|
|
|
|
AC_DEFINE([JEMALLOC_TLS_MODEL], [ ])
|
|
|
|
fi
|
2011-03-16 01:25:59 +08:00
|
|
|
|
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
|
2013-01-23 02:53:29 +08:00
|
|
|
AC_PATH_PROG([LD], [ld], [false], [$PATH])
|
|
|
|
AC_PATH_PROG([AUTOCONF], [autoconf], [false], [$PATH])
|
2009-06-24 10:01:18 +08:00
|
|
|
|
Implement the *allocx() API.
Implement the *allocx() API, which is a successor to the *allocm() API.
The *allocx() functions are slightly simpler to use because they have
fewer parameters, they directly return the results of primary interest,
and mallocx()/rallocx() avoid the strict aliasing pitfall that
allocm()/rallocx() share with posix_memalign(). The following code
violates strict aliasing rules:
foo_t *foo;
allocm((void **)&foo, NULL, 42, 0);
whereas the following is safe:
foo_t *foo;
void *p;
allocm(&p, NULL, 42, 0);
foo = (foo_t *)p;
mallocx() does not have this problem:
foo_t *foo = (foo_t *)mallocx(42, 0);
2013-12-13 14:35:52 +08:00
|
|
|
public_syms="malloc_conf malloc_message malloc calloc posix_memalign aligned_alloc realloc free mallocx rallocx xallocx sallocx dallocx nallocx mallctl mallctlnametomib mallctlbymib malloc_stats_print malloc_usable_size"
|
2012-03-03 09:47:37 +08:00
|
|
|
|
|
|
|
dnl Check for allocator-related functions that should be wrapped.
|
|
|
|
AC_CHECK_FUNC([memalign],
|
2012-03-20 01:21:17 +08:00
|
|
|
[AC_DEFINE([JEMALLOC_OVERRIDE_MEMALIGN], [ ])
|
2012-03-03 09:47:37 +08:00
|
|
|
public_syms="${public_syms} memalign"])
|
|
|
|
AC_CHECK_FUNC([valloc],
|
2012-03-20 01:21:17 +08:00
|
|
|
[AC_DEFINE([JEMALLOC_OVERRIDE_VALLOC], [ ])
|
2012-03-03 09:47:37 +08:00
|
|
|
public_syms="${public_syms} valloc"])
|
|
|
|
|
|
|
|
dnl Support the experimental API by default.
|
|
|
|
AC_ARG_ENABLE([experimental],
|
|
|
|
[AS_HELP_STRING([--disable-experimental],
|
|
|
|
[Disable support for the experimental API])],
|
|
|
|
[if test "x$enable_experimental" = "xno" ; then
|
|
|
|
enable_experimental="0"
|
|
|
|
else
|
|
|
|
enable_experimental="1"
|
|
|
|
fi
|
|
|
|
],
|
|
|
|
[enable_experimental="1"]
|
|
|
|
)
|
|
|
|
if test "x$enable_experimental" = "x1" ; then
|
|
|
|
AC_DEFINE([JEMALLOC_EXPERIMENTAL], [ ])
|
|
|
|
public_syms="${public_syms} allocm dallocm nallocm rallocm sallocm"
|
|
|
|
fi
|
|
|
|
AC_SUBST([enable_experimental])
|
|
|
|
|
2013-12-07 10:27:33 +08:00
|
|
|
dnl Do not compute test code coverage by default.
|
|
|
|
GCOV_FLAGS=
|
|
|
|
AC_ARG_ENABLE([code-coverage],
|
|
|
|
[AS_HELP_STRING([--enable-code-coverage],
|
|
|
|
[Enable code coverage])],
|
|
|
|
[if test "x$enable_code_coverage" = "xno" ; then
|
|
|
|
enable_code_coverage="0"
|
|
|
|
else
|
|
|
|
enable_code_coverage="1"
|
|
|
|
fi
|
|
|
|
],
|
|
|
|
[enable_code_coverage="0"]
|
|
|
|
)
|
|
|
|
if test "x$enable_code_coverage" = "x1" ; then
|
|
|
|
deoptimize="no"
|
|
|
|
echo "$CFLAGS $EXTRA_CFLAGS" | grep '\-O' >/dev/null || deoptimize="yes"
|
|
|
|
if test "x${deoptimize}" = "xyes" ; then
|
|
|
|
JE_CFLAGS_APPEND([-O0])
|
|
|
|
fi
|
|
|
|
JE_CFLAGS_APPEND([-fprofile-arcs -ftest-coverage])
|
|
|
|
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -fprofile-arcs -ftest-coverage"
|
|
|
|
AC_DEFINE([JEMALLOC_CODE_COVERAGE], [ ])
|
|
|
|
fi
|
|
|
|
AC_SUBST([enable_code_coverage])
|
|
|
|
|
2012-03-02 09:19:20 +08:00
|
|
|
dnl Perform no name mangling by default.
|
|
|
|
AC_ARG_WITH([mangling],
|
|
|
|
[AS_HELP_STRING([--with-mangling=<map>], [Mangle symbols in <map>])],
|
|
|
|
[mangling_map="$with_mangling"], [mangling_map=""])
|
|
|
|
for nm in `echo ${mangling_map} |tr ',' ' '` ; do
|
2012-03-13 06:07:53 +08:00
|
|
|
k="`echo ${nm} |tr ':' ' ' |awk '{print $1}'`"
|
|
|
|
n="je_${k}"
|
2012-03-02 09:19:20 +08:00
|
|
|
m=`echo ${nm} |tr ':' ' ' |awk '{print $2}'`
|
|
|
|
AC_DEFINE_UNQUOTED([${n}], [${m}])
|
2012-03-13 06:07:53 +08:00
|
|
|
dnl Remove key from public_syms so that it isn't redefined later.
|
|
|
|
public_syms=`for sym in ${public_syms}; do echo "${sym}"; done |grep -v "^${k}\$" |tr '\n' ' '`
|
2012-03-02 09:19:20 +08:00
|
|
|
done
|
|
|
|
|
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"],
|
2012-04-30 18:38:27 +08:00
|
|
|
[if test "x$abi" != "xmacho" -a "x$abi" != "xpecoff"; then
|
2010-09-06 01:35:13 +08:00
|
|
|
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"])
|
2009-12-29 16:09:15 +08:00
|
|
|
fi
|
2012-03-02 09:19:20 +08:00
|
|
|
dnl Generate macros to rename public symbols. All public symbols are prefixed
|
|
|
|
dnl with je_ in the source code, so these macro definitions are needed even if
|
|
|
|
dnl --with-jemalloc-prefix wasn't specified.
|
2012-03-03 09:47:37 +08:00
|
|
|
for stem in ${public_syms}; do
|
2012-03-02 09:19:20 +08:00
|
|
|
n="je_${stem}"
|
|
|
|
m="${JEMALLOC_PREFIX}${stem}"
|
|
|
|
AC_DEFINE_UNQUOTED([${n}], [${m}])
|
|
|
|
done
|
2009-12-29 16:09:15 +08:00
|
|
|
|
2012-11-19 17:55:26 +08:00
|
|
|
AC_ARG_WITH([export],
|
|
|
|
[AS_HELP_STRING([--without-export], [disable exporting jemalloc public APIs])],
|
|
|
|
[if test "x$with_export" = "xno"; then
|
2013-01-23 08:46:27 +08:00
|
|
|
AC_DEFINE([JEMALLOC_EXPORT],[])
|
2012-11-19 17:55:26 +08:00
|
|
|
fi]
|
|
|
|
)
|
|
|
|
|
Refactor to support more varied testing.
Refactor the test harness to support three types of tests:
- unit: White box unit tests. These tests have full access to all
internal jemalloc library symbols. Though in actuality all symbols
are prefixed by jet_, macro-based name mangling abstracts this away
from test code.
- integration: Black box integration tests. These tests link with
the installable shared jemalloc library, and with the exception of
some utility code and configure-generated macro definitions, they have
no access to jemalloc internals.
- stress: Black box stress tests. These tests link with the installable
shared jemalloc library, as well as with an internal allocator with
symbols prefixed by jet_ (same as for unit tests) that can be used to
allocate data structures that are internal to the test code.
Move existing tests into test/{unit,integration}/ as appropriate.
Split out internal parts of jemalloc_defs.h.in and put them in
jemalloc_internal_defs.h.in. This reduces internals exposure to
applications that #include <jemalloc/jemalloc.h>.
Refactor jemalloc.h header generation so that a single header file
results, and the prototypes can be used to generate jet_ prototypes for
tests. Split jemalloc.h.in into multiple parts (jemalloc_defs.h.in,
jemalloc_macros.h.in, jemalloc_protos.h.in, jemalloc_mangle.h.in) and
use a shell script to generate a unified jemalloc.h at configure time.
Change the default private namespace prefix from "" to "je_".
Add missing private namespace mangling.
Remove hard-coded private_namespace.h. Instead generate it and
private_unnamespace.h from private_symbols.txt. Use similar logic for
public symbols, which aids in name mangling for jet_ symbols.
Add test_warn() and test_fail(). Replace existing exit(1) calls with
test_fail() calls.
2013-12-01 07:25:42 +08:00
|
|
|
dnl Mangle library-private APIs.
|
2011-07-31 07:40:52 +08:00
|
|
|
AC_ARG_WITH([private_namespace],
|
|
|
|
[AS_HELP_STRING([--with-private-namespace=<prefix>], [Prefix to prepend to all library-private APIs])],
|
Refactor to support more varied testing.
Refactor the test harness to support three types of tests:
- unit: White box unit tests. These tests have full access to all
internal jemalloc library symbols. Though in actuality all symbols
are prefixed by jet_, macro-based name mangling abstracts this away
from test code.
- integration: Black box integration tests. These tests link with
the installable shared jemalloc library, and with the exception of
some utility code and configure-generated macro definitions, they have
no access to jemalloc internals.
- stress: Black box stress tests. These tests link with the installable
shared jemalloc library, as well as with an internal allocator with
symbols prefixed by jet_ (same as for unit tests) that can be used to
allocate data structures that are internal to the test code.
Move existing tests into test/{unit,integration}/ as appropriate.
Split out internal parts of jemalloc_defs.h.in and put them in
jemalloc_internal_defs.h.in. This reduces internals exposure to
applications that #include <jemalloc/jemalloc.h>.
Refactor jemalloc.h header generation so that a single header file
results, and the prototypes can be used to generate jet_ prototypes for
tests. Split jemalloc.h.in into multiple parts (jemalloc_defs.h.in,
jemalloc_macros.h.in, jemalloc_protos.h.in, jemalloc_mangle.h.in) and
use a shell script to generate a unified jemalloc.h at configure time.
Change the default private namespace prefix from "" to "je_".
Add missing private namespace mangling.
Remove hard-coded private_namespace.h. Instead generate it and
private_unnamespace.h from private_symbols.txt. Use similar logic for
public symbols, which aids in name mangling for jet_ symbols.
Add test_warn() and test_fail(). Replace existing exit(1) calls with
test_fail() calls.
2013-12-01 07:25:42 +08:00
|
|
|
[JEMALLOC_PRIVATE_NAMESPACE="${with_private_namespace}je_"],
|
|
|
|
[JEMALLOC_PRIVATE_NAMESPACE="je_"]
|
2011-07-31 07:40:52 +08:00
|
|
|
)
|
Refactor to support more varied testing.
Refactor the test harness to support three types of tests:
- unit: White box unit tests. These tests have full access to all
internal jemalloc library symbols. Though in actuality all symbols
are prefixed by jet_, macro-based name mangling abstracts this away
from test code.
- integration: Black box integration tests. These tests link with
the installable shared jemalloc library, and with the exception of
some utility code and configure-generated macro definitions, they have
no access to jemalloc internals.
- stress: Black box stress tests. These tests link with the installable
shared jemalloc library, as well as with an internal allocator with
symbols prefixed by jet_ (same as for unit tests) that can be used to
allocate data structures that are internal to the test code.
Move existing tests into test/{unit,integration}/ as appropriate.
Split out internal parts of jemalloc_defs.h.in and put them in
jemalloc_internal_defs.h.in. This reduces internals exposure to
applications that #include <jemalloc/jemalloc.h>.
Refactor jemalloc.h header generation so that a single header file
results, and the prototypes can be used to generate jet_ prototypes for
tests. Split jemalloc.h.in into multiple parts (jemalloc_defs.h.in,
jemalloc_macros.h.in, jemalloc_protos.h.in, jemalloc_mangle.h.in) and
use a shell script to generate a unified jemalloc.h at configure time.
Change the default private namespace prefix from "" to "je_".
Add missing private namespace mangling.
Remove hard-coded private_namespace.h. Instead generate it and
private_unnamespace.h from private_symbols.txt. Use similar logic for
public symbols, which aids in name mangling for jet_ symbols.
Add test_warn() and test_fail(). Replace existing exit(1) calls with
test_fail() calls.
2013-12-01 07:25:42 +08:00
|
|
|
AC_DEFINE_UNQUOTED([JEMALLOC_PRIVATE_NAMESPACE], [$JEMALLOC_PRIVATE_NAMESPACE])
|
|
|
|
private_namespace="$JEMALLOC_PRIVATE_NAMESPACE"
|
|
|
|
AC_SUBST([private_namespace])
|
2011-07-31 07:40:52 +08:00
|
|
|
|
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])
|
|
|
|
|
Refactor to support more varied testing.
Refactor the test harness to support three types of tests:
- unit: White box unit tests. These tests have full access to all
internal jemalloc library symbols. Though in actuality all symbols
are prefixed by jet_, macro-based name mangling abstracts this away
from test code.
- integration: Black box integration tests. These tests link with
the installable shared jemalloc library, and with the exception of
some utility code and configure-generated macro definitions, they have
no access to jemalloc internals.
- stress: Black box stress tests. These tests link with the installable
shared jemalloc library, as well as with an internal allocator with
symbols prefixed by jet_ (same as for unit tests) that can be used to
allocate data structures that are internal to the test code.
Move existing tests into test/{unit,integration}/ as appropriate.
Split out internal parts of jemalloc_defs.h.in and put them in
jemalloc_internal_defs.h.in. This reduces internals exposure to
applications that #include <jemalloc/jemalloc.h>.
Refactor jemalloc.h header generation so that a single header file
results, and the prototypes can be used to generate jet_ prototypes for
tests. Split jemalloc.h.in into multiple parts (jemalloc_defs.h.in,
jemalloc_macros.h.in, jemalloc_protos.h.in, jemalloc_mangle.h.in) and
use a shell script to generate a unified jemalloc.h at configure time.
Change the default private namespace prefix from "" to "je_".
Add missing private namespace mangling.
Remove hard-coded private_namespace.h. Instead generate it and
private_unnamespace.h from private_symbols.txt. Use similar logic for
public symbols, which aids in name mangling for jet_ symbols.
Add test_warn() and test_fail(). Replace existing exit(1) calls with
test_fail() calls.
2013-12-01 07:25:42 +08:00
|
|
|
dnl Substitute @je_@ in jemalloc_protos.h.in, primarily to make generation of
|
|
|
|
dnl jemalloc_protos_jet.h easy.
|
|
|
|
je_="je_"
|
|
|
|
AC_SUBST([je_])
|
|
|
|
|
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"
|
Refactor to support more varied testing.
Refactor the test harness to support three types of tests:
- unit: White box unit tests. These tests have full access to all
internal jemalloc library symbols. Though in actuality all symbols
are prefixed by jet_, macro-based name mangling abstracts this away
from test code.
- integration: Black box integration tests. These tests link with
the installable shared jemalloc library, and with the exception of
some utility code and configure-generated macro definitions, they have
no access to jemalloc internals.
- stress: Black box stress tests. These tests link with the installable
shared jemalloc library, as well as with an internal allocator with
symbols prefixed by jet_ (same as for unit tests) that can be used to
allocate data structures that are internal to the test code.
Move existing tests into test/{unit,integration}/ as appropriate.
Split out internal parts of jemalloc_defs.h.in and put them in
jemalloc_internal_defs.h.in. This reduces internals exposure to
applications that #include <jemalloc/jemalloc.h>.
Refactor jemalloc.h header generation so that a single header file
results, and the prototypes can be used to generate jet_ prototypes for
tests. Split jemalloc.h.in into multiple parts (jemalloc_defs.h.in,
jemalloc_macros.h.in, jemalloc_protos.h.in, jemalloc_mangle.h.in) and
use a shell script to generate a unified jemalloc.h at configure time.
Change the default private namespace prefix from "" to "je_".
Add missing private namespace mangling.
Remove hard-coded private_namespace.h. Instead generate it and
private_unnamespace.h from private_symbols.txt. Use similar logic for
public symbols, which aids in name mangling for jet_ symbols.
Add test_warn() and test_fail(). Replace existing exit(1) calls with
test_fail() calls.
2013-12-01 07:25:42 +08:00
|
|
|
cfgoutputs_in="${cfgoutputs_in} ${srcroot}include/jemalloc/jemalloc_macros.h.in"
|
|
|
|
cfgoutputs_in="${cfgoutputs_in} ${srcroot}include/jemalloc/jemalloc_protos.h.in"
|
|
|
|
cfgoutputs_in="${cfgoutputs_in} ${srcroot}include/jemalloc/jemalloc_mangle.h.in"
|
2010-04-08 14:37:35 +08:00
|
|
|
cfgoutputs_in="${cfgoutputs_in} ${srcroot}include/jemalloc/internal/jemalloc_internal.h.in"
|
Refactor to support more varied testing.
Refactor the test harness to support three types of tests:
- unit: White box unit tests. These tests have full access to all
internal jemalloc library symbols. Though in actuality all symbols
are prefixed by jet_, macro-based name mangling abstracts this away
from test code.
- integration: Black box integration tests. These tests link with
the installable shared jemalloc library, and with the exception of
some utility code and configure-generated macro definitions, they have
no access to jemalloc internals.
- stress: Black box stress tests. These tests link with the installable
shared jemalloc library, as well as with an internal allocator with
symbols prefixed by jet_ (same as for unit tests) that can be used to
allocate data structures that are internal to the test code.
Move existing tests into test/{unit,integration}/ as appropriate.
Split out internal parts of jemalloc_defs.h.in and put them in
jemalloc_internal_defs.h.in. This reduces internals exposure to
applications that #include <jemalloc/jemalloc.h>.
Refactor jemalloc.h header generation so that a single header file
results, and the prototypes can be used to generate jet_ prototypes for
tests. Split jemalloc.h.in into multiple parts (jemalloc_defs.h.in,
jemalloc_macros.h.in, jemalloc_protos.h.in, jemalloc_mangle.h.in) and
use a shell script to generate a unified jemalloc.h at configure time.
Change the default private namespace prefix from "" to "je_".
Add missing private namespace mangling.
Remove hard-coded private_namespace.h. Instead generate it and
private_unnamespace.h from private_symbols.txt. Use similar logic for
public symbols, which aids in name mangling for jet_ symbols.
Add test_warn() and test_fail(). Replace existing exit(1) calls with
test_fail() calls.
2013-12-01 07:25:42 +08:00
|
|
|
cfgoutputs_in="${cfgoutputs_in} ${srcroot}test/test.sh.in"
|
|
|
|
cfgoutputs_in="${cfgoutputs_in} ${srcroot}test/include/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"
|
Refactor to support more varied testing.
Refactor the test harness to support three types of tests:
- unit: White box unit tests. These tests have full access to all
internal jemalloc library symbols. Though in actuality all symbols
are prefixed by jet_, macro-based name mangling abstracts this away
from test code.
- integration: Black box integration tests. These tests link with
the installable shared jemalloc library, and with the exception of
some utility code and configure-generated macro definitions, they have
no access to jemalloc internals.
- stress: Black box stress tests. These tests link with the installable
shared jemalloc library, as well as with an internal allocator with
symbols prefixed by jet_ (same as for unit tests) that can be used to
allocate data structures that are internal to the test code.
Move existing tests into test/{unit,integration}/ as appropriate.
Split out internal parts of jemalloc_defs.h.in and put them in
jemalloc_internal_defs.h.in. This reduces internals exposure to
applications that #include <jemalloc/jemalloc.h>.
Refactor jemalloc.h header generation so that a single header file
results, and the prototypes can be used to generate jet_ prototypes for
tests. Split jemalloc.h.in into multiple parts (jemalloc_defs.h.in,
jemalloc_macros.h.in, jemalloc_protos.h.in, jemalloc_mangle.h.in) and
use a shell script to generate a unified jemalloc.h at configure time.
Change the default private namespace prefix from "" to "je_".
Add missing private namespace mangling.
Remove hard-coded private_namespace.h. Instead generate it and
private_unnamespace.h from private_symbols.txt. Use similar logic for
public symbols, which aids in name mangling for jet_ symbols.
Add test_warn() and test_fail(). Replace existing exit(1) calls with
test_fail() calls.
2013-12-01 07:25:42 +08:00
|
|
|
cfgoutputs_out="${cfgoutputs_out} doc/jemalloc.xml"
|
|
|
|
cfgoutputs_out="${cfgoutputs_out} include/jemalloc/jemalloc_macros.h"
|
|
|
|
cfgoutputs_out="${cfgoutputs_out} include/jemalloc/jemalloc_protos.h"
|
|
|
|
cfgoutputs_out="${cfgoutputs_out} include/jemalloc/jemalloc_mangle.h"
|
2010-02-12 06:45:59 +08:00
|
|
|
cfgoutputs_out="${cfgoutputs_out} include/jemalloc/internal/jemalloc_internal.h"
|
Refactor to support more varied testing.
Refactor the test harness to support three types of tests:
- unit: White box unit tests. These tests have full access to all
internal jemalloc library symbols. Though in actuality all symbols
are prefixed by jet_, macro-based name mangling abstracts this away
from test code.
- integration: Black box integration tests. These tests link with
the installable shared jemalloc library, and with the exception of
some utility code and configure-generated macro definitions, they have
no access to jemalloc internals.
- stress: Black box stress tests. These tests link with the installable
shared jemalloc library, as well as with an internal allocator with
symbols prefixed by jet_ (same as for unit tests) that can be used to
allocate data structures that are internal to the test code.
Move existing tests into test/{unit,integration}/ as appropriate.
Split out internal parts of jemalloc_defs.h.in and put them in
jemalloc_internal_defs.h.in. This reduces internals exposure to
applications that #include <jemalloc/jemalloc.h>.
Refactor jemalloc.h header generation so that a single header file
results, and the prototypes can be used to generate jet_ prototypes for
tests. Split jemalloc.h.in into multiple parts (jemalloc_defs.h.in,
jemalloc_macros.h.in, jemalloc_protos.h.in, jemalloc_mangle.h.in) and
use a shell script to generate a unified jemalloc.h at configure time.
Change the default private namespace prefix from "" to "je_".
Add missing private namespace mangling.
Remove hard-coded private_namespace.h. Instead generate it and
private_unnamespace.h from private_symbols.txt. Use similar logic for
public symbols, which aids in name mangling for jet_ symbols.
Add test_warn() and test_fail(). Replace existing exit(1) calls with
test_fail() calls.
2013-12-01 07:25:42 +08:00
|
|
|
cfgoutputs_out="${cfgoutputs_out} test/test.sh"
|
|
|
|
cfgoutputs_out="${cfgoutputs_out} test/include/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"
|
Refactor to support more varied testing.
Refactor the test harness to support three types of tests:
- unit: White box unit tests. These tests have full access to all
internal jemalloc library symbols. Though in actuality all symbols
are prefixed by jet_, macro-based name mangling abstracts this away
from test code.
- integration: Black box integration tests. These tests link with
the installable shared jemalloc library, and with the exception of
some utility code and configure-generated macro definitions, they have
no access to jemalloc internals.
- stress: Black box stress tests. These tests link with the installable
shared jemalloc library, as well as with an internal allocator with
symbols prefixed by jet_ (same as for unit tests) that can be used to
allocate data structures that are internal to the test code.
Move existing tests into test/{unit,integration}/ as appropriate.
Split out internal parts of jemalloc_defs.h.in and put them in
jemalloc_internal_defs.h.in. This reduces internals exposure to
applications that #include <jemalloc/jemalloc.h>.
Refactor jemalloc.h header generation so that a single header file
results, and the prototypes can be used to generate jet_ prototypes for
tests. Split jemalloc.h.in into multiple parts (jemalloc_defs.h.in,
jemalloc_macros.h.in, jemalloc_protos.h.in, jemalloc_mangle.h.in) and
use a shell script to generate a unified jemalloc.h at configure time.
Change the default private namespace prefix from "" to "je_".
Add missing private namespace mangling.
Remove hard-coded private_namespace.h. Instead generate it and
private_unnamespace.h from private_symbols.txt. Use similar logic for
public symbols, which aids in name mangling for jet_ symbols.
Add test_warn() and test_fail(). Replace existing exit(1) calls with
test_fail() calls.
2013-12-01 07:25:42 +08:00
|
|
|
cfgoutputs_tup="${cfgoutputs_tup} doc/jemalloc.xml:doc/jemalloc.xml.in"
|
|
|
|
cfgoutputs_tup="${cfgoutputs_tup} include/jemalloc/jemalloc_macros.h:include/jemalloc/jemalloc_macros.h.in"
|
|
|
|
cfgoutputs_tup="${cfgoutputs_tup} include/jemalloc/jemalloc_protos.h:include/jemalloc/jemalloc_protos.h.in"
|
|
|
|
cfgoutputs_tup="${cfgoutputs_tup} include/jemalloc/jemalloc_mangle.h:include/jemalloc/jemalloc_mangle.h.in"
|
2010-02-12 06:45:59 +08:00
|
|
|
cfgoutputs_tup="${cfgoutputs_tup} include/jemalloc/internal/jemalloc_internal.h"
|
Refactor to support more varied testing.
Refactor the test harness to support three types of tests:
- unit: White box unit tests. These tests have full access to all
internal jemalloc library symbols. Though in actuality all symbols
are prefixed by jet_, macro-based name mangling abstracts this away
from test code.
- integration: Black box integration tests. These tests link with
the installable shared jemalloc library, and with the exception of
some utility code and configure-generated macro definitions, they have
no access to jemalloc internals.
- stress: Black box stress tests. These tests link with the installable
shared jemalloc library, as well as with an internal allocator with
symbols prefixed by jet_ (same as for unit tests) that can be used to
allocate data structures that are internal to the test code.
Move existing tests into test/{unit,integration}/ as appropriate.
Split out internal parts of jemalloc_defs.h.in and put them in
jemalloc_internal_defs.h.in. This reduces internals exposure to
applications that #include <jemalloc/jemalloc.h>.
Refactor jemalloc.h header generation so that a single header file
results, and the prototypes can be used to generate jet_ prototypes for
tests. Split jemalloc.h.in into multiple parts (jemalloc_defs.h.in,
jemalloc_macros.h.in, jemalloc_protos.h.in, jemalloc_mangle.h.in) and
use a shell script to generate a unified jemalloc.h at configure time.
Change the default private namespace prefix from "" to "je_".
Add missing private namespace mangling.
Remove hard-coded private_namespace.h. Instead generate it and
private_unnamespace.h from private_symbols.txt. Use similar logic for
public symbols, which aids in name mangling for jet_ symbols.
Add test_warn() and test_fail(). Replace existing exit(1) calls with
test_fail() calls.
2013-12-01 07:25:42 +08:00
|
|
|
cfgoutputs_tup="${cfgoutputs_tup} test/test.sh:test/test.sh.in"
|
|
|
|
cfgoutputs_tup="${cfgoutputs_tup} test/include/test/jemalloc_test.h:test/include/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"
|
Refactor to support more varied testing.
Refactor the test harness to support three types of tests:
- unit: White box unit tests. These tests have full access to all
internal jemalloc library symbols. Though in actuality all symbols
are prefixed by jet_, macro-based name mangling abstracts this away
from test code.
- integration: Black box integration tests. These tests link with
the installable shared jemalloc library, and with the exception of
some utility code and configure-generated macro definitions, they have
no access to jemalloc internals.
- stress: Black box stress tests. These tests link with the installable
shared jemalloc library, as well as with an internal allocator with
symbols prefixed by jet_ (same as for unit tests) that can be used to
allocate data structures that are internal to the test code.
Move existing tests into test/{unit,integration}/ as appropriate.
Split out internal parts of jemalloc_defs.h.in and put them in
jemalloc_internal_defs.h.in. This reduces internals exposure to
applications that #include <jemalloc/jemalloc.h>.
Refactor jemalloc.h header generation so that a single header file
results, and the prototypes can be used to generate jet_ prototypes for
tests. Split jemalloc.h.in into multiple parts (jemalloc_defs.h.in,
jemalloc_macros.h.in, jemalloc_protos.h.in, jemalloc_mangle.h.in) and
use a shell script to generate a unified jemalloc.h at configure time.
Change the default private namespace prefix from "" to "je_".
Add missing private namespace mangling.
Remove hard-coded private_namespace.h. Instead generate it and
private_unnamespace.h from private_symbols.txt. Use similar logic for
public symbols, which aids in name mangling for jet_ symbols.
Add test_warn() and test_fail(). Replace existing exit(1) calls with
test_fail() calls.
2013-12-01 07:25:42 +08:00
|
|
|
cfghdrs_in="${cfghdrs_in} ${srcroot}include/jemalloc/internal/jemalloc_internal_defs.h.in"
|
|
|
|
cfghdrs_in="${cfghdrs_in} ${srcroot}include/jemalloc/internal/private_namespace.sh"
|
|
|
|
cfghdrs_in="${cfghdrs_in} ${srcroot}include/jemalloc/internal/private_unnamespace.sh"
|
|
|
|
cfghdrs_in="${cfghdrs_in} ${srcroot}include/jemalloc/internal/public_namespace.sh"
|
|
|
|
cfghdrs_in="${cfghdrs_in} ${srcroot}include/jemalloc/internal/public_unnamespace.sh"
|
2012-02-29 08:50:47 +08:00
|
|
|
cfghdrs_in="${cfghdrs_in} ${srcroot}include/jemalloc/internal/size_classes.sh"
|
2013-12-06 13:43:46 +08:00
|
|
|
cfghdrs_in="${cfghdrs_in} ${srcroot}include/jemalloc/jemalloc.sh"
|
2013-12-10 05:21:08 +08:00
|
|
|
cfghdrs_in="${cfghdrs_in} ${srcroot}test/include/test/jemalloc_test_defs.h.in"
|
2010-01-17 17:49:20 +08:00
|
|
|
|
Refactor to support more varied testing.
Refactor the test harness to support three types of tests:
- unit: White box unit tests. These tests have full access to all
internal jemalloc library symbols. Though in actuality all symbols
are prefixed by jet_, macro-based name mangling abstracts this away
from test code.
- integration: Black box integration tests. These tests link with
the installable shared jemalloc library, and with the exception of
some utility code and configure-generated macro definitions, they have
no access to jemalloc internals.
- stress: Black box stress tests. These tests link with the installable
shared jemalloc library, as well as with an internal allocator with
symbols prefixed by jet_ (same as for unit tests) that can be used to
allocate data structures that are internal to the test code.
Move existing tests into test/{unit,integration}/ as appropriate.
Split out internal parts of jemalloc_defs.h.in and put them in
jemalloc_internal_defs.h.in. This reduces internals exposure to
applications that #include <jemalloc/jemalloc.h>.
Refactor jemalloc.h header generation so that a single header file
results, and the prototypes can be used to generate jet_ prototypes for
tests. Split jemalloc.h.in into multiple parts (jemalloc_defs.h.in,
jemalloc_macros.h.in, jemalloc_protos.h.in, jemalloc_mangle.h.in) and
use a shell script to generate a unified jemalloc.h at configure time.
Change the default private namespace prefix from "" to "je_".
Add missing private namespace mangling.
Remove hard-coded private_namespace.h. Instead generate it and
private_unnamespace.h from private_symbols.txt. Use similar logic for
public symbols, which aids in name mangling for jet_ symbols.
Add test_warn() and test_fail(). Replace existing exit(1) calls with
test_fail() calls.
2013-12-01 07:25:42 +08:00
|
|
|
cfghdrs_out="include/jemalloc/jemalloc_defs.h"
|
|
|
|
cfghdrs_out="${cfghdrs_out} include/jemalloc/jemalloc${install_suffix}.h"
|
|
|
|
cfghdrs_out="${cfghdrs_out} include/jemalloc/jemalloc_protos_jet.h"
|
|
|
|
cfghdrs_out="${cfghdrs_out} include/jemalloc/internal/jemalloc_internal_defs.h"
|
|
|
|
cfghdrs_out="${cfghdrs_out} include/jemalloc/internal/private_namespace.h"
|
|
|
|
cfghdrs_out="${cfghdrs_out} include/jemalloc/internal/private_unnamespace.h"
|
|
|
|
cfghdrs_out="${cfghdrs_out} include/jemalloc/internal/public_namespace.h"
|
|
|
|
cfghdrs_out="${cfghdrs_out} include/jemalloc/internal/public_unnamespace.h"
|
2012-02-29 08:50:47 +08:00
|
|
|
cfghdrs_out="${cfghdrs_out} include/jemalloc/internal/size_classes.h"
|
2013-12-10 05:21:08 +08:00
|
|
|
cfghdrs_out="${cfghdrs_out} test/include/test/jemalloc_test_defs.h"
|
2010-01-17 17:49:20 +08:00
|
|
|
|
Refactor to support more varied testing.
Refactor the test harness to support three types of tests:
- unit: White box unit tests. These tests have full access to all
internal jemalloc library symbols. Though in actuality all symbols
are prefixed by jet_, macro-based name mangling abstracts this away
from test code.
- integration: Black box integration tests. These tests link with
the installable shared jemalloc library, and with the exception of
some utility code and configure-generated macro definitions, they have
no access to jemalloc internals.
- stress: Black box stress tests. These tests link with the installable
shared jemalloc library, as well as with an internal allocator with
symbols prefixed by jet_ (same as for unit tests) that can be used to
allocate data structures that are internal to the test code.
Move existing tests into test/{unit,integration}/ as appropriate.
Split out internal parts of jemalloc_defs.h.in and put them in
jemalloc_internal_defs.h.in. This reduces internals exposure to
applications that #include <jemalloc/jemalloc.h>.
Refactor jemalloc.h header generation so that a single header file
results, and the prototypes can be used to generate jet_ prototypes for
tests. Split jemalloc.h.in into multiple parts (jemalloc_defs.h.in,
jemalloc_macros.h.in, jemalloc_protos.h.in, jemalloc_mangle.h.in) and
use a shell script to generate a unified jemalloc.h at configure time.
Change the default private namespace prefix from "" to "je_".
Add missing private namespace mangling.
Remove hard-coded private_namespace.h. Instead generate it and
private_unnamespace.h from private_symbols.txt. Use similar logic for
public symbols, which aids in name mangling for jet_ symbols.
Add test_warn() and test_fail(). Replace existing exit(1) calls with
test_fail() calls.
2013-12-01 07:25:42 +08:00
|
|
|
cfghdrs_tup="include/jemalloc/jemalloc_defs.h:include/jemalloc/jemalloc_defs.h.in"
|
|
|
|
cfghdrs_tup="${cfghdrs_tup} include/jemalloc/internal/jemalloc_internal_defs.h:${srcroot}include/jemalloc/internal/jemalloc_internal_defs.h.in"
|
2013-12-10 05:21:08 +08:00
|
|
|
cfghdrs_tup="${cfghdrs_tup} test/include/test/jemalloc_test_defs.h:${srcroot}test/include/test/jemalloc_test_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
|
2012-03-20 01:21:17 +08:00
|
|
|
AC_DEFINE([JEMALLOC_CC_SILENCE], [ ])
|
2010-09-21 10:20:48 +08:00
|
|
|
fi
|
|
|
|
|
2009-06-24 10:01:18 +08:00
|
|
|
dnl Do not compile with debugging by default.
|
|
|
|
AC_ARG_ENABLE([debug],
|
2012-12-07 05:16:26 +08:00
|
|
|
[AS_HELP_STRING([--enable-debug], [Build debugging code (implies --enable-ivsalloc)])],
|
2009-06-24 10:01:18 +08:00
|
|
|
[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], [ ])
|
2012-12-07 05:16:26 +08:00
|
|
|
enable_ivsalloc="1"
|
2009-06-24 10:01:18 +08:00
|
|
|
fi
|
|
|
|
AC_SUBST([enable_debug])
|
|
|
|
|
2012-12-07 05:16:26 +08:00
|
|
|
dnl Do not validate pointers by default.
|
|
|
|
AC_ARG_ENABLE([ivsalloc],
|
|
|
|
[AS_HELP_STRING([--enable-ivsalloc], [Validate pointers passed through the public API])],
|
|
|
|
[if test "x$enable_ivsalloc" = "xno" ; then
|
|
|
|
enable_ivsalloc="0"
|
|
|
|
else
|
|
|
|
enable_ivsalloc="1"
|
|
|
|
fi
|
|
|
|
],
|
|
|
|
[enable_ivsalloc="0"]
|
|
|
|
)
|
|
|
|
if test "x$enable_ivsalloc" = "x1" ; then
|
|
|
|
AC_DEFINE([JEMALLOC_IVSALLOC], [ ])
|
|
|
|
fi
|
|
|
|
|
2009-06-24 10:01:18 +08:00
|
|
|
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"
|
2013-12-07 10:27:33 +08:00
|
|
|
echo "$CFLAGS $EXTRA_CFLAGS" | grep '\-O' >/dev/null || optimize="yes"
|
2009-07-01 07:17:05 +08:00
|
|
|
if test "x${optimize}" = "xyes" ; then
|
|
|
|
if test "x$GCC" = "xyes" ; then
|
|
|
|
JE_CFLAGS_APPEND([-O3])
|
|
|
|
JE_CFLAGS_APPEND([-funroll-loops])
|
2012-04-30 18:38:31 +08:00
|
|
|
elif test "x$je_cv_msvc" = "xyes" ; then
|
|
|
|
JE_CFLAGS_APPEND([-O2])
|
2009-07-01 07:17:05 +08:00
|
|
|
else
|
|
|
|
JE_CFLAGS_APPEND([-O])
|
|
|
|
fi
|
2009-06-24 10:01:18 +08:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2012-02-29 12:41:16 +08:00
|
|
|
dnl Enable statistics calculation by default.
|
2009-06-24 10:01:18 +08:00
|
|
|
AC_ARG_ENABLE([stats],
|
2012-02-29 12:49:22 +08:00
|
|
|
[AS_HELP_STRING([--disable-stats],
|
|
|
|
[Disable statistics calculation/reporting])],
|
2009-06-24 10:01:18 +08:00
|
|
|
[if test "x$enable_stats" = "xno" ; then
|
|
|
|
enable_stats="0"
|
|
|
|
else
|
|
|
|
enable_stats="1"
|
|
|
|
fi
|
|
|
|
],
|
2012-02-29 12:41:16 +08:00
|
|
|
[enable_stats="1"]
|
2009-06-24 10:01:18 +08:00
|
|
|
)
|
|
|
|
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
|
2012-04-24 04:04:55 +08:00
|
|
|
if test "x${force_tls}" = "x0" ; then
|
|
|
|
AC_MSG_ERROR([Heap profiling requires TLS]);
|
|
|
|
fi
|
|
|
|
force_tls="1"
|
2013-12-06 15:01:50 +08:00
|
|
|
|
|
|
|
if test "x$abi" != "xpecoff"; then
|
|
|
|
dnl Heap profiling uses the log(3) function.
|
|
|
|
LIBS="$LIBS -lm"
|
|
|
|
fi
|
|
|
|
|
2011-03-16 13:23:12 +08:00
|
|
|
AC_DEFINE([JEMALLOC_PROF], [ ])
|
|
|
|
fi
|
|
|
|
AC_SUBST([enable_prof])
|
|
|
|
|
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
|
|
|
|
2012-05-10 07:12:00 +08:00
|
|
|
dnl Disable mremap() for huge realloc() by default.
|
|
|
|
AC_ARG_ENABLE([mremap],
|
|
|
|
[AS_HELP_STRING([--enable-mremap], [Enable mremap(2) for huge realloc()])],
|
|
|
|
[if test "x$enable_mremap" = "xno" ; then
|
|
|
|
enable_mremap="0"
|
|
|
|
else
|
|
|
|
enable_mremap="1"
|
|
|
|
fi
|
|
|
|
],
|
|
|
|
[enable_mremap="0"]
|
|
|
|
)
|
|
|
|
if test "x$enable_mremap" = "x1" ; then
|
|
|
|
JE_COMPILABLE([mremap(...MREMAP_FIXED...)], [
|
2013-12-09 14:28:27 +08:00
|
|
|
#define _GNU_SOURCE
|
2012-05-10 07:12:00 +08:00
|
|
|
#include <sys/mman.h>
|
|
|
|
], [
|
|
|
|
void *p = mremap((void *)0, 0, 0, MREMAP_MAYMOVE|MREMAP_FIXED, (void *)0);
|
|
|
|
], [je_cv_mremap_fixed])
|
|
|
|
if test "x${je_cv_mremap_fixed}" = "xno" ; then
|
|
|
|
enable_mremap="0"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
if test "x$enable_mremap" = "x1" ; then
|
|
|
|
AC_DEFINE([JEMALLOC_MREMAP], [ ])
|
|
|
|
fi
|
|
|
|
AC_SUBST([enable_mremap])
|
|
|
|
|
2012-04-17 08:52:27 +08:00
|
|
|
dnl Enable VM deallocation via munmap() by default.
|
|
|
|
AC_ARG_ENABLE([munmap],
|
|
|
|
[AS_HELP_STRING([--disable-munmap], [Disable VM deallocation via munmap(2)])],
|
|
|
|
[if test "x$enable_munmap" = "xno" ; then
|
|
|
|
enable_munmap="0"
|
|
|
|
else
|
|
|
|
enable_munmap="1"
|
|
|
|
fi
|
|
|
|
],
|
|
|
|
[enable_munmap="${default_munmap}"]
|
|
|
|
)
|
|
|
|
if test "x$enable_munmap" = "x1" ; then
|
|
|
|
AC_DEFINE([JEMALLOC_MUNMAP], [ ])
|
|
|
|
fi
|
|
|
|
AC_SUBST([enable_munmap])
|
|
|
|
|
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"]
|
|
|
|
)
|
2012-04-12 16:13:03 +08:00
|
|
|
dnl Check whether the BSD/SUSv1 sbrk() exists. If not, disable DSS support.
|
|
|
|
AC_CHECK_FUNC([sbrk], [have_sbrk="1"], [have_sbrk="0"])
|
|
|
|
if test "x$have_sbrk" = "x1" ; then
|
2013-12-04 13:49:36 +08:00
|
|
|
if test "x$sbrk_deprecated" == "x1" ; then
|
|
|
|
AC_MSG_RESULT([Disabling dss allocation because sbrk is deprecated])
|
|
|
|
enable_dss="0"
|
|
|
|
else
|
|
|
|
AC_DEFINE([JEMALLOC_HAVE_SBRK], [ ])
|
|
|
|
fi
|
2012-04-12 16:13:03 +08:00
|
|
|
else
|
|
|
|
enable_dss="0"
|
|
|
|
fi
|
|
|
|
|
2009-06-24 10:01:18 +08:00
|
|
|
if test "x$enable_dss" = "x1" ; then
|
|
|
|
AC_DEFINE([JEMALLOC_DSS], [ ])
|
|
|
|
fi
|
|
|
|
AC_SUBST([enable_dss])
|
|
|
|
|
2012-02-29 12:49:22 +08:00
|
|
|
dnl Support the junk/zero filling option by default.
|
2009-06-24 10:01:18 +08:00
|
|
|
AC_ARG_ENABLE([fill],
|
2012-04-06 15:35:09 +08:00
|
|
|
[AS_HELP_STRING([--disable-fill],
|
|
|
|
[Disable support for junk/zero filling, quarantine, and redzones])],
|
2009-06-24 10:01:18 +08:00
|
|
|
[if test "x$enable_fill" = "xno" ; then
|
|
|
|
enable_fill="0"
|
|
|
|
else
|
|
|
|
enable_fill="1"
|
|
|
|
fi
|
|
|
|
],
|
2012-02-29 12:49:22 +08:00
|
|
|
[enable_fill="1"]
|
2009-06-24 10:01:18 +08:00
|
|
|
)
|
|
|
|
if test "x$enable_fill" = "x1" ; then
|
|
|
|
AC_DEFINE([JEMALLOC_FILL], [ ])
|
|
|
|
fi
|
|
|
|
AC_SUBST([enable_fill])
|
|
|
|
|
2012-04-06 04:36:17 +08:00
|
|
|
dnl Disable utrace(2)-based tracing by default.
|
|
|
|
AC_ARG_ENABLE([utrace],
|
|
|
|
[AS_HELP_STRING([--enable-utrace], [Enable utrace(2)-based tracing])],
|
|
|
|
[if test "x$enable_utrace" = "xno" ; then
|
|
|
|
enable_utrace="0"
|
|
|
|
else
|
|
|
|
enable_utrace="1"
|
|
|
|
fi
|
|
|
|
],
|
|
|
|
[enable_utrace="0"]
|
|
|
|
)
|
|
|
|
JE_COMPILABLE([utrace(2)], [
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/param.h>
|
|
|
|
#include <sys/time.h>
|
|
|
|
#include <sys/uio.h>
|
|
|
|
#include <sys/ktrace.h>
|
|
|
|
], [
|
|
|
|
utrace((void *)0, 0);
|
|
|
|
], [je_cv_utrace])
|
|
|
|
if test "x${je_cv_utrace}" = "xno" ; then
|
|
|
|
enable_utrace="0"
|
|
|
|
fi
|
|
|
|
if test "x$enable_utrace" = "x1" ; then
|
|
|
|
AC_DEFINE([JEMALLOC_UTRACE], [ ])
|
|
|
|
fi
|
|
|
|
AC_SUBST([enable_utrace])
|
|
|
|
|
2012-04-06 15:35:09 +08:00
|
|
|
dnl Support Valgrind by default.
|
|
|
|
AC_ARG_ENABLE([valgrind],
|
|
|
|
[AS_HELP_STRING([--disable-valgrind], [Disable support for Valgrind])],
|
|
|
|
[if test "x$enable_valgrind" = "xno" ; then
|
|
|
|
enable_valgrind="0"
|
|
|
|
else
|
|
|
|
enable_valgrind="1"
|
|
|
|
fi
|
|
|
|
],
|
|
|
|
[enable_valgrind="1"]
|
|
|
|
)
|
|
|
|
if test "x$enable_valgrind" = "x1" ; then
|
|
|
|
JE_COMPILABLE([valgrind], [
|
|
|
|
#include <valgrind/valgrind.h>
|
|
|
|
#include <valgrind/memcheck.h>
|
|
|
|
|
2012-04-30 21:15:15 +08:00
|
|
|
#if !defined(VALGRIND_RESIZEINPLACE_BLOCK)
|
2012-04-06 15:35:09 +08:00
|
|
|
# error "Incompatible Valgrind version"
|
|
|
|
#endif
|
|
|
|
], [], [je_cv_valgrind])
|
|
|
|
if test "x${je_cv_valgrind}" = "xno" ; then
|
|
|
|
enable_valgrind="0"
|
|
|
|
fi
|
|
|
|
if test "x$enable_valgrind" = "x1" ; then
|
|
|
|
AC_DEFINE([JEMALLOC_VALGRIND], [ ])
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
AC_SUBST([enable_valgrind])
|
|
|
|
|
2009-06-24 10:01:18 +08:00
|
|
|
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])
|
|
|
|
|
2012-03-06 04:15:36 +08:00
|
|
|
AC_CACHE_CHECK([STATIC_PAGE_SHIFT],
|
|
|
|
[je_cv_static_page_shift],
|
|
|
|
AC_RUN_IFELSE([AC_LANG_PROGRAM(
|
2012-04-22 12:27:46 +08:00
|
|
|
[[
|
2012-04-30 18:38:31 +08:00
|
|
|
#include <strings.h>
|
2012-04-22 12:27:46 +08:00
|
|
|
#ifdef _WIN32
|
|
|
|
#include <windows.h>
|
|
|
|
#else
|
2009-06-24 10:01:18 +08:00
|
|
|
#include <unistd.h>
|
2012-04-22 12:27:46 +08:00
|
|
|
#endif
|
|
|
|
#include <stdio.h>
|
2012-03-06 04:15:36 +08:00
|
|
|
]],
|
|
|
|
[[
|
2012-12-03 09:57:28 +08:00
|
|
|
int result;
|
2009-06-24 10:01:18 +08:00
|
|
|
FILE *f;
|
|
|
|
|
2012-04-22 12:27:46 +08:00
|
|
|
#ifdef _WIN32
|
|
|
|
SYSTEM_INFO si;
|
|
|
|
GetSystemInfo(&si);
|
|
|
|
result = si.dwPageSize;
|
|
|
|
#else
|
2009-06-24 10:01:18 +08:00
|
|
|
result = sysconf(_SC_PAGESIZE);
|
2012-04-22 12:27:46 +08:00
|
|
|
#endif
|
2009-06-24 10:01:18 +08:00
|
|
|
if (result == -1) {
|
|
|
|
return 1;
|
|
|
|
}
|
2012-04-22 12:27:46 +08:00
|
|
|
result = ffsl(result) - 1;
|
|
|
|
|
2009-06-24 10:01:18 +08:00
|
|
|
f = fopen("conftest.out", "w");
|
|
|
|
if (f == NULL) {
|
|
|
|
return 1;
|
|
|
|
}
|
2012-12-03 09:57:28 +08:00
|
|
|
fprintf(f, "%d\n", result);
|
2012-04-04 13:30:05 +08:00
|
|
|
fclose(f);
|
2009-06-24 10:01:18 +08:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
]])],
|
2012-03-06 04:15:36 +08:00
|
|
|
[je_cv_static_page_shift=`cat conftest.out`],
|
|
|
|
[je_cv_static_page_shift=undefined]))
|
|
|
|
|
|
|
|
if test "x$je_cv_static_page_shift" != "xundefined"; then
|
|
|
|
AC_DEFINE_UNQUOTED([STATIC_PAGE_SHIFT], [$je_cv_static_page_shift])
|
|
|
|
else
|
|
|
|
AC_MSG_ERROR([cannot determine value for STATIC_PAGE_SHIFT])
|
|
|
|
fi
|
2009-06-24 10:01:18 +08:00
|
|
|
|
|
|
|
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.
|
|
|
|
|
2012-04-22 12:27:46 +08:00
|
|
|
if test "x$abi" != "xpecoff" ; then
|
|
|
|
AC_CHECK_HEADERS([pthread.h], , [AC_MSG_ERROR([pthread.h is missing])])
|
|
|
|
dnl Some systems may embed pthreads functionality in libc; check for libpthread
|
|
|
|
dnl first, but try libc too before failing.
|
|
|
|
AC_CHECK_LIB([pthread], [pthread_create], [LIBS="$LIBS -lpthread"],
|
|
|
|
[AC_SEARCH_LIBS([pthread_create], , ,
|
|
|
|
AC_MSG_ERROR([libpthread is missing]))])
|
|
|
|
fi
|
2009-06-24 10:01:18 +08:00
|
|
|
|
|
|
|
CPPFLAGS="$CPPFLAGS -D_REENTRANT"
|
|
|
|
|
2012-03-22 09:33:03 +08:00
|
|
|
dnl Check whether the BSD-specific _malloc_thread_cleanup() exists. If so, use
|
|
|
|
dnl it rather than pthreads TSD cleanup functions to support cleanup during
|
|
|
|
dnl thread exit, in order to avoid pthreads library recursion during
|
|
|
|
dnl bootstrapping.
|
|
|
|
AC_CHECK_FUNC([_malloc_thread_cleanup],
|
|
|
|
[have__malloc_thread_cleanup="1"],
|
|
|
|
[have__malloc_thread_cleanup="0"]
|
|
|
|
)
|
|
|
|
if test "x$have__malloc_thread_cleanup" = "x1" ; then
|
|
|
|
AC_DEFINE([JEMALLOC_MALLOC_THREAD_CLEANUP], [ ])
|
|
|
|
force_tls="1"
|
|
|
|
fi
|
|
|
|
|
2012-02-03 14:04:57 +08:00
|
|
|
dnl Check whether the BSD-specific _pthread_mutex_init_calloc_cb() exists. If
|
|
|
|
dnl so, mutex initialization causes allocation, and we need to implement this
|
|
|
|
dnl callback function in order to prevent recursive allocation.
|
|
|
|
AC_CHECK_FUNC([_pthread_mutex_init_calloc_cb],
|
|
|
|
[have__pthread_mutex_init_calloc_cb="1"],
|
|
|
|
[have__pthread_mutex_init_calloc_cb="0"]
|
|
|
|
)
|
|
|
|
if test "x$have__pthread_mutex_init_calloc_cb" = "x1" ; then
|
|
|
|
AC_DEFINE([JEMALLOC_MUTEX_INIT_CB])
|
|
|
|
fi
|
|
|
|
|
2012-02-14 04:36:11 +08:00
|
|
|
dnl Disable lazy locking by default.
|
2010-01-18 06:06:20 +08:00
|
|
|
AC_ARG_ENABLE([lazy_lock],
|
2012-02-14 04:36:11 +08:00
|
|
|
[AS_HELP_STRING([--enable-lazy-lock],
|
|
|
|
[Enable lazy locking (only lock when multi-threaded)])],
|
2010-01-18 06:06:20 +08:00
|
|
|
[if test "x$enable_lazy_lock" = "xno" ; then
|
|
|
|
enable_lazy_lock="0"
|
|
|
|
else
|
|
|
|
enable_lazy_lock="1"
|
|
|
|
fi
|
|
|
|
],
|
2012-02-14 04:36:11 +08:00
|
|
|
[enable_lazy_lock="0"]
|
2010-01-18 06:06:20 +08:00
|
|
|
)
|
2012-03-24 08:40:58 +08:00
|
|
|
if test "x$enable_lazy_lock" = "x0" -a "x${force_lazy_lock}" = "x1" ; then
|
|
|
|
AC_MSG_RESULT([Forcing lazy-lock to avoid allocator/threading bootstrap issues])
|
|
|
|
enable_lazy_lock="1"
|
|
|
|
fi
|
2010-01-18 06:06:20 +08:00
|
|
|
if test "x$enable_lazy_lock" = "x1" ; then
|
2012-04-22 12:27:46 +08:00
|
|
|
if test "x$abi" != "xpecoff" ; then
|
|
|
|
AC_CHECK_HEADERS([dlfcn.h], , [AC_MSG_ERROR([dlfcn.h is missing])])
|
|
|
|
AC_CHECK_FUNC([dlsym], [],
|
|
|
|
[AC_CHECK_LIB([dl], [dlsym], [LIBS="$LIBS -ldl"],
|
|
|
|
[AC_MSG_ERROR([libdl is missing])])
|
|
|
|
])
|
|
|
|
fi
|
2010-01-18 06:06:20 +08:00
|
|
|
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"
|
|
|
|
)
|
2012-03-22 09:33:03 +08:00
|
|
|
if test "x${enable_tls}" = "x0" -a "x${force_tls}" = "x1" ; then
|
|
|
|
AC_MSG_RESULT([Forcing TLS to avoid allocator/threading bootstrap issues])
|
|
|
|
enable_tls="1"
|
|
|
|
fi
|
2012-03-24 07:17:43 +08:00
|
|
|
if test "x${enable_tls}" = "x1" -a "x${force_tls}" = "x0" ; then
|
|
|
|
AC_MSG_RESULT([Forcing no TLS to avoid allocator/threading bootstrap issues])
|
|
|
|
enable_tls="0"
|
|
|
|
fi
|
2010-01-18 06:06:20 +08:00
|
|
|
if test "x${enable_tls}" = "x1" ; then
|
2009-06-24 10:01:18 +08:00
|
|
|
AC_MSG_CHECKING([for TLS])
|
2012-03-06 04:15:36 +08:00
|
|
|
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
|
2009-06-24 10:01:18 +08:00
|
|
|
[[
|
|
|
|
__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])
|
2012-03-20 01:21:17 +08:00
|
|
|
if test "x${enable_tls}" = "x1" ; then
|
|
|
|
AC_DEFINE_UNQUOTED([JEMALLOC_TLS], [ ])
|
2012-03-22 09:33:03 +08:00
|
|
|
elif test "x${force_tls}" = "x1" ; then
|
|
|
|
AC_MSG_ERROR([Failed to configure TLS, which is mandatory for correct function])
|
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.
|
2012-03-14 02:09:23 +08:00
|
|
|
JE_COMPILABLE([a program using ffsl], [
|
2012-12-03 09:57:28 +08:00
|
|
|
#include <stdio.h>
|
2012-04-05 06:25:43 +08:00
|
|
|
#include <strings.h>
|
2012-03-14 02:09:23 +08:00
|
|
|
#include <string.h>
|
|
|
|
], [
|
|
|
|
{
|
|
|
|
int rv = ffsl(0x08);
|
2012-12-03 09:57:28 +08:00
|
|
|
printf("%d\n", rv);
|
2012-03-14 02:09:23 +08:00
|
|
|
}
|
|
|
|
], [je_cv_function_ffsl])
|
2012-03-06 04:15:36 +08:00
|
|
|
if test "x${je_cv_function_ffsl}" != "xyes" ; then
|
|
|
|
AC_MSG_ERROR([Cannot build without ffsl(3)])
|
|
|
|
fi
|
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
|
|
|
|
2012-04-18 04:17:54 +08:00
|
|
|
dnl ============================================================================
|
|
|
|
dnl Check for atomic(9) operations as provided on FreeBSD.
|
|
|
|
|
|
|
|
JE_COMPILABLE([atomic(9)], [
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <machine/atomic.h>
|
|
|
|
#include <inttypes.h>
|
|
|
|
], [
|
|
|
|
{
|
|
|
|
uint32_t x32 = 0;
|
|
|
|
volatile uint32_t *x32p = &x32;
|
|
|
|
atomic_fetchadd_32(x32p, 1);
|
|
|
|
}
|
|
|
|
{
|
|
|
|
unsigned long xlong = 0;
|
|
|
|
volatile unsigned long *xlongp = &xlong;
|
|
|
|
atomic_fetchadd_long(xlongp, 1);
|
|
|
|
}
|
|
|
|
], [je_cv_atomic9])
|
|
|
|
if test "x${je_cv_atomic9}" = "xyes" ; then
|
|
|
|
AC_DEFINE([JEMALLOC_ATOMIC9])
|
|
|
|
fi
|
|
|
|
|
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);
|
|
|
|
}
|
2012-03-06 04:15:36 +08:00
|
|
|
], [je_cv_osatomic])
|
|
|
|
if test "x${je_cv_osatomic}" = "xyes" ; then
|
2012-03-20 01:21:17 +08:00
|
|
|
AC_DEFINE([JEMALLOC_OSATOMIC], [ ])
|
2011-03-19 10:10:31 +08:00
|
|
|
fi
|
|
|
|
|
2012-03-26 23:03:41 +08:00
|
|
|
dnl ============================================================================
|
|
|
|
dnl Check whether __sync_{add,sub}_and_fetch() are available despite
|
|
|
|
dnl __GCC_HAVE_SYNC_COMPARE_AND_SWAP_n macros being undefined.
|
|
|
|
|
|
|
|
AC_DEFUN([JE_SYNC_COMPARE_AND_SWAP_CHECK],[
|
|
|
|
AC_CACHE_CHECK([whether to force $1-bit __sync_{add,sub}_and_fetch()],
|
|
|
|
[je_cv_sync_compare_and_swap_$2],
|
2012-03-27 21:03:07 +08:00
|
|
|
[AC_LINK_IFELSE([AC_LANG_PROGRAM([
|
|
|
|
#include <stdint.h>
|
|
|
|
],
|
|
|
|
[
|
|
|
|
#ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_$2
|
|
|
|
{
|
|
|
|
uint$1_t x$1 = 0;
|
|
|
|
__sync_add_and_fetch(&x$1, 42);
|
|
|
|
__sync_sub_and_fetch(&x$1, 1);
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
#error __GCC_HAVE_SYNC_COMPARE_AND_SWAP_$2 is defined, no need to force
|
|
|
|
#endif
|
|
|
|
])],
|
2012-03-26 23:03:41 +08:00
|
|
|
[je_cv_sync_compare_and_swap_$2=yes],
|
|
|
|
[je_cv_sync_compare_and_swap_$2=no])])
|
|
|
|
|
|
|
|
if test "x${je_cv_sync_compare_and_swap_$2}" = "xyes" ; then
|
|
|
|
AC_DEFINE([JE_FORCE_SYNC_COMPARE_AND_SWAP_$2], [ ])
|
|
|
|
fi
|
|
|
|
])
|
|
|
|
|
2012-04-18 04:17:54 +08:00
|
|
|
if test "x${je_cv_atomic9}" != "xyes" -a "x${je_cv_osatomic}" != "xyes" ; then
|
2012-03-26 23:03:41 +08:00
|
|
|
JE_SYNC_COMPARE_AND_SWAP_CHECK(32, 4)
|
|
|
|
JE_SYNC_COMPARE_AND_SWAP_CHECK(64, 8)
|
|
|
|
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);
|
2012-03-06 04:15:36 +08:00
|
|
|
], [je_cv_osspin])
|
|
|
|
if test "x${je_cv_osspin}" = "xyes" ; then
|
2012-03-20 01:21:17 +08:00
|
|
|
AC_DEFINE([JEMALLOC_OSSPIN], [ ])
|
2011-03-19 10:30:18 +08:00
|
|
|
fi
|
|
|
|
|
2010-09-21 07:44:23 +08:00
|
|
|
dnl ============================================================================
|
2010-09-06 01:35:13 +08:00
|
|
|
dnl Darwin-related configuration.
|
|
|
|
|
2012-11-27 01:52:41 +08:00
|
|
|
AC_ARG_ENABLE([zone-allocator],
|
|
|
|
[AS_HELP_STRING([--disable-zone-allocator],
|
|
|
|
[Disable zone allocator for Darwin])],
|
|
|
|
[if test "x$enable_zone_allocator" = "xno" ; then
|
|
|
|
enable_zone_allocator="0"
|
|
|
|
else
|
|
|
|
enable_zone_allocator="1"
|
|
|
|
fi
|
|
|
|
],
|
|
|
|
[if test "x${abi}" = "xmacho"; then
|
|
|
|
enable_zone_allocator="1"
|
|
|
|
fi
|
|
|
|
]
|
|
|
|
)
|
|
|
|
AC_SUBST([enable_zone_allocator])
|
|
|
|
|
|
|
|
if test "x${enable_zone_allocator}" = "x1" ; then
|
|
|
|
if test "x${abi}" != "xmacho"; then
|
|
|
|
AC_MSG_ERROR([--enable-zone-allocator is only supported on Darwin])
|
|
|
|
fi
|
2012-03-20 01:21:17 +08:00
|
|
|
AC_DEFINE([JEMALLOC_IVSALLOC], [ ])
|
|
|
|
AC_DEFINE([JEMALLOC_ZONE], [ ])
|
2010-09-06 01:35:13 +08:00
|
|
|
|
|
|
|
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])
|
2012-03-21 01:01:38 +08:00
|
|
|
AC_DEFUN([JE_ZONE_PROGRAM],
|
|
|
|
[AC_LANG_PROGRAM(
|
|
|
|
[#include <malloc/malloc.h>],
|
|
|
|
[static foo[[sizeof($1) $2 sizeof(void *) * $3 ? 1 : -1]]]
|
|
|
|
)])
|
|
|
|
|
|
|
|
AC_COMPILE_IFELSE([JE_ZONE_PROGRAM(malloc_zone_t,==,14)],[JEMALLOC_ZONE_VERSION=3],[
|
|
|
|
AC_COMPILE_IFELSE([JE_ZONE_PROGRAM(malloc_zone_t,==,15)],[JEMALLOC_ZONE_VERSION=5],[
|
|
|
|
AC_COMPILE_IFELSE([JE_ZONE_PROGRAM(malloc_zone_t,==,16)],[
|
|
|
|
AC_COMPILE_IFELSE([JE_ZONE_PROGRAM(malloc_introspection_t,==,9)],[JEMALLOC_ZONE_VERSION=6],[
|
|
|
|
AC_COMPILE_IFELSE([JE_ZONE_PROGRAM(malloc_introspection_t,==,13)],[JEMALLOC_ZONE_VERSION=7],[JEMALLOC_ZONE_VERSION=]
|
|
|
|
)])],[
|
|
|
|
AC_COMPILE_IFELSE([JE_ZONE_PROGRAM(malloc_zone_t,==,17)],[JEMALLOC_ZONE_VERSION=8],[
|
|
|
|
AC_COMPILE_IFELSE([JE_ZONE_PROGRAM(malloc_zone_t,>,17)],[JEMALLOC_ZONE_VERSION=9],[JEMALLOC_ZONE_VERSION=]
|
|
|
|
)])])])])
|
|
|
|
if test "x${JEMALLOC_ZONE_VERSION}" = "x"; then
|
|
|
|
AC_MSG_RESULT([unsupported])
|
|
|
|
AC_MSG_ERROR([Unsupported malloc zone version])
|
|
|
|
fi
|
|
|
|
if test "${JEMALLOC_ZONE_VERSION}" = 9; then
|
|
|
|
JEMALLOC_ZONE_VERSION=8
|
|
|
|
AC_MSG_RESULT([> 8])
|
|
|
|
else
|
|
|
|
AC_MSG_RESULT([$JEMALLOC_ZONE_VERSION])
|
|
|
|
fi
|
|
|
|
AC_DEFINE_UNQUOTED(JEMALLOC_ZONE_VERSION, [$JEMALLOC_ZONE_VERSION])
|
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
|
|
|
|
|
2013-12-07 10:27:33 +08:00
|
|
|
dnl ============================================================================
|
|
|
|
dnl Define commands that generate output files.
|
|
|
|
|
Refactor to support more varied testing.
Refactor the test harness to support three types of tests:
- unit: White box unit tests. These tests have full access to all
internal jemalloc library symbols. Though in actuality all symbols
are prefixed by jet_, macro-based name mangling abstracts this away
from test code.
- integration: Black box integration tests. These tests link with
the installable shared jemalloc library, and with the exception of
some utility code and configure-generated macro definitions, they have
no access to jemalloc internals.
- stress: Black box stress tests. These tests link with the installable
shared jemalloc library, as well as with an internal allocator with
symbols prefixed by jet_ (same as for unit tests) that can be used to
allocate data structures that are internal to the test code.
Move existing tests into test/{unit,integration}/ as appropriate.
Split out internal parts of jemalloc_defs.h.in and put them in
jemalloc_internal_defs.h.in. This reduces internals exposure to
applications that #include <jemalloc/jemalloc.h>.
Refactor jemalloc.h header generation so that a single header file
results, and the prototypes can be used to generate jet_ prototypes for
tests. Split jemalloc.h.in into multiple parts (jemalloc_defs.h.in,
jemalloc_macros.h.in, jemalloc_protos.h.in, jemalloc_mangle.h.in) and
use a shell script to generate a unified jemalloc.h at configure time.
Change the default private namespace prefix from "" to "je_".
Add missing private namespace mangling.
Remove hard-coded private_namespace.h. Instead generate it and
private_unnamespace.h from private_symbols.txt. Use similar logic for
public symbols, which aids in name mangling for jet_ symbols.
Add test_warn() and test_fail(). Replace existing exit(1) calls with
test_fail() calls.
2013-12-01 07:25:42 +08:00
|
|
|
AC_CONFIG_COMMANDS([include/jemalloc/internal/private_namespace.h], [
|
|
|
|
mkdir -p "${objroot}include/jemalloc/internal"
|
|
|
|
"${srcdir}/include/jemalloc/internal/private_namespace.sh" "${srcdir}/include/jemalloc/internal/private_symbols.txt" > "${objroot}include/jemalloc/internal/private_namespace.h"
|
|
|
|
])
|
|
|
|
AC_CONFIG_COMMANDS([include/jemalloc/internal/private_unnamespace.h], [
|
|
|
|
mkdir -p "${objroot}include/jemalloc/internal"
|
|
|
|
"${srcdir}/include/jemalloc/internal/private_unnamespace.sh" "${srcdir}/include/jemalloc/internal/private_symbols.txt" > "${objroot}include/jemalloc/internal/private_unnamespace.h"
|
|
|
|
])
|
|
|
|
AC_CONFIG_COMMANDS([include/jemalloc/internal/public_namespace.h], [
|
|
|
|
mkdir -p "${objroot}include/jemalloc/internal"
|
|
|
|
"${srcdir}/include/jemalloc/internal/public_namespace.sh" "${srcdir}/include/jemalloc/internal/public_symbols.txt" > "${objroot}include/jemalloc/internal/public_namespace.h"
|
|
|
|
])
|
|
|
|
AC_CONFIG_COMMANDS([include/jemalloc/internal/public_unnamespace.h], [
|
|
|
|
mkdir -p "${objroot}include/jemalloc/internal"
|
|
|
|
"${srcdir}/include/jemalloc/internal/public_unnamespace.sh" "${srcdir}/include/jemalloc/internal/public_symbols.txt" > "${objroot}include/jemalloc/internal/public_unnamespace.h"
|
|
|
|
])
|
2012-02-29 08:50:47 +08:00
|
|
|
AC_CONFIG_COMMANDS([include/jemalloc/internal/size_classes.h], [
|
Refactor to support more varied testing.
Refactor the test harness to support three types of tests:
- unit: White box unit tests. These tests have full access to all
internal jemalloc library symbols. Though in actuality all symbols
are prefixed by jet_, macro-based name mangling abstracts this away
from test code.
- integration: Black box integration tests. These tests link with
the installable shared jemalloc library, and with the exception of
some utility code and configure-generated macro definitions, they have
no access to jemalloc internals.
- stress: Black box stress tests. These tests link with the installable
shared jemalloc library, as well as with an internal allocator with
symbols prefixed by jet_ (same as for unit tests) that can be used to
allocate data structures that are internal to the test code.
Move existing tests into test/{unit,integration}/ as appropriate.
Split out internal parts of jemalloc_defs.h.in and put them in
jemalloc_internal_defs.h.in. This reduces internals exposure to
applications that #include <jemalloc/jemalloc.h>.
Refactor jemalloc.h header generation so that a single header file
results, and the prototypes can be used to generate jet_ prototypes for
tests. Split jemalloc.h.in into multiple parts (jemalloc_defs.h.in,
jemalloc_macros.h.in, jemalloc_protos.h.in, jemalloc_mangle.h.in) and
use a shell script to generate a unified jemalloc.h at configure time.
Change the default private namespace prefix from "" to "je_".
Add missing private namespace mangling.
Remove hard-coded private_namespace.h. Instead generate it and
private_unnamespace.h from private_symbols.txt. Use similar logic for
public symbols, which aids in name mangling for jet_ symbols.
Add test_warn() and test_fail(). Replace existing exit(1) calls with
test_fail() calls.
2013-12-01 07:25:42 +08:00
|
|
|
mkdir -p "${objroot}include/jemalloc/internal"
|
2012-02-29 08:50:47 +08:00
|
|
|
"${srcdir}/include/jemalloc/internal/size_classes.sh" > "${objroot}include/jemalloc/internal/size_classes.h"
|
|
|
|
])
|
Refactor to support more varied testing.
Refactor the test harness to support three types of tests:
- unit: White box unit tests. These tests have full access to all
internal jemalloc library symbols. Though in actuality all symbols
are prefixed by jet_, macro-based name mangling abstracts this away
from test code.
- integration: Black box integration tests. These tests link with
the installable shared jemalloc library, and with the exception of
some utility code and configure-generated macro definitions, they have
no access to jemalloc internals.
- stress: Black box stress tests. These tests link with the installable
shared jemalloc library, as well as with an internal allocator with
symbols prefixed by jet_ (same as for unit tests) that can be used to
allocate data structures that are internal to the test code.
Move existing tests into test/{unit,integration}/ as appropriate.
Split out internal parts of jemalloc_defs.h.in and put them in
jemalloc_internal_defs.h.in. This reduces internals exposure to
applications that #include <jemalloc/jemalloc.h>.
Refactor jemalloc.h header generation so that a single header file
results, and the prototypes can be used to generate jet_ prototypes for
tests. Split jemalloc.h.in into multiple parts (jemalloc_defs.h.in,
jemalloc_macros.h.in, jemalloc_protos.h.in, jemalloc_mangle.h.in) and
use a shell script to generate a unified jemalloc.h at configure time.
Change the default private namespace prefix from "" to "je_".
Add missing private namespace mangling.
Remove hard-coded private_namespace.h. Instead generate it and
private_unnamespace.h from private_symbols.txt. Use similar logic for
public symbols, which aids in name mangling for jet_ symbols.
Add test_warn() and test_fail(). Replace existing exit(1) calls with
test_fail() calls.
2013-12-01 07:25:42 +08:00
|
|
|
AC_CONFIG_COMMANDS([include/jemalloc/jemalloc_protos_jet.h], [
|
|
|
|
mkdir -p "${objroot}include/jemalloc"
|
|
|
|
cat "${srcdir}/include/jemalloc/jemalloc_protos.h.in" | sed -e 's/@je_@/jet_/g' > "${objroot}include/jemalloc/jemalloc_protos_jet.h"
|
|
|
|
])
|
|
|
|
AC_CONFIG_COMMANDS([include/jemalloc/jemalloc.h], [
|
|
|
|
mkdir -p "${objroot}include/jemalloc"
|
|
|
|
"${srcdir}/include/jemalloc/jemalloc.sh" "${objroot}" > "${objroot}include/jemalloc/jemalloc${install_suffix}.h"
|
|
|
|
])
|
2012-02-29 08:50:47 +08:00
|
|
|
|
2009-06-24 10:01:18 +08:00
|
|
|
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.
|
2013-12-07 10:27:33 +08:00
|
|
|
|
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}])
|
2013-12-07 10:27:33 +08:00
|
|
|
AC_MSG_RESULT([EXTRA_LDFLAGS : ${EXTRA_LDFLAGS}])
|
2009-06-24 10:01:18 +08:00
|
|
|
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}])
|
2012-03-03 09:47:37 +08:00
|
|
|
AC_MSG_RESULT([experimental : ${enable_experimental}])
|
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}])
|
2013-12-07 10:27:33 +08:00
|
|
|
AC_MSG_RESULT([code-coverage : ${enable_code_coverage}])
|
2009-06-24 10:01:18 +08:00
|
|
|
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-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}])
|
2012-04-06 04:36:17 +08:00
|
|
|
AC_MSG_RESULT([utrace : ${enable_utrace}])
|
2012-04-06 15:35:09 +08:00
|
|
|
AC_MSG_RESULT([valgrind : ${enable_valgrind}])
|
|
|
|
AC_MSG_RESULT([xmalloc : ${enable_xmalloc}])
|
2012-05-10 07:12:00 +08:00
|
|
|
AC_MSG_RESULT([mremap : ${enable_mremap}])
|
2012-04-17 08:52:27 +08:00
|
|
|
AC_MSG_RESULT([munmap : ${enable_munmap}])
|
2009-06-24 10:01:18 +08:00
|
|
|
AC_MSG_RESULT([dss : ${enable_dss}])
|
|
|
|
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([===============================================================================])
|