2009-06-24 10:01:18 +08:00
|
|
|
dnl Process this file with autoconf to produce a configure script.
|
2017-06-30 04:56:22 +08:00
|
|
|
AC_PREREQ(2.68)
|
2009-06-24 10:01:18 +08:00
|
|
|
AC_INIT([Makefile.in])
|
|
|
|
|
2015-11-13 03:23:39 +08:00
|
|
|
AC_CONFIG_AUX_DIR([build-aux])
|
|
|
|
|
2009-07-01 07:17:05 +08:00
|
|
|
dnl ============================================================================
|
|
|
|
dnl Custom macro definitions.
|
|
|
|
|
2016-12-16 23:18:55 +08:00
|
|
|
dnl JE_CONCAT_VVV(r, a, b)
|
2017-07-07 02:50:55 +08:00
|
|
|
dnl
|
2016-12-16 23:18:55 +08:00
|
|
|
dnl Set $r to the concatenation of $a and $b, with a space separating them iff
|
2018-04-12 01:21:13 +08:00
|
|
|
dnl both $a and $b are non-empty.
|
2016-12-16 23:18:55 +08:00
|
|
|
AC_DEFUN([JE_CONCAT_VVV],
|
|
|
|
if test "x[$]{$2}" = "x" -o "x[$]{$3}" = "x" ; then
|
|
|
|
$1="[$]{$2}[$]{$3}"
|
2009-07-01 07:17:05 +08:00
|
|
|
else
|
2016-12-16 23:18:55 +08:00
|
|
|
$1="[$]{$2} [$]{$3}"
|
2009-07-01 07:17:05 +08:00
|
|
|
fi
|
2016-12-16 23:18:55 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
dnl JE_APPEND_VS(a, b)
|
2017-07-07 02:50:55 +08:00
|
|
|
dnl
|
2016-12-16 23:18:55 +08:00
|
|
|
dnl Set $a to the concatenation of $a and b, with a space separating them iff
|
|
|
|
dnl both $a and b are non-empty.
|
|
|
|
AC_DEFUN([JE_APPEND_VS],
|
|
|
|
T_APPEND_V=$2
|
|
|
|
JE_CONCAT_VVV($1, $1, T_APPEND_V)
|
|
|
|
)
|
|
|
|
|
|
|
|
CONFIGURE_CFLAGS=
|
|
|
|
SPECIFIED_CFLAGS="${CFLAGS}"
|
|
|
|
dnl JE_CFLAGS_ADD(cflag)
|
2017-07-07 02:50:55 +08:00
|
|
|
dnl
|
2016-12-16 23:18:55 +08:00
|
|
|
dnl CFLAGS is the concatenation of CONFIGURE_CFLAGS and SPECIFIED_CFLAGS
|
|
|
|
dnl (ignoring EXTRA_CFLAGS, which does not impact configure tests. This macro
|
|
|
|
dnl appends to CONFIGURE_CFLAGS and regenerates CFLAGS.
|
|
|
|
AC_DEFUN([JE_CFLAGS_ADD],
|
|
|
|
[
|
|
|
|
AC_MSG_CHECKING([whether compiler supports $1])
|
|
|
|
T_CONFIGURE_CFLAGS="${CONFIGURE_CFLAGS}"
|
|
|
|
JE_APPEND_VS(CONFIGURE_CFLAGS, $1)
|
|
|
|
JE_CONCAT_VVV(CFLAGS, CONFIGURE_CFLAGS, SPECIFIED_CFLAGS)
|
2012-03-06 04:15:36 +08:00
|
|
|
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
|
2009-07-01 07:17:05 +08:00
|
|
|
[[
|
|
|
|
]], [[
|
|
|
|
return 0;
|
|
|
|
]])],
|
2016-12-16 23:18:55 +08:00
|
|
|
[je_cv_cflags_added=$1]
|
2009-07-01 07:17:05 +08:00
|
|
|
AC_MSG_RESULT([yes]),
|
2016-12-16 23:18:55 +08:00
|
|
|
[je_cv_cflags_added=]
|
2009-07-01 07:17:05 +08:00
|
|
|
AC_MSG_RESULT([no])
|
2016-12-16 23:18:55 +08:00
|
|
|
[CONFIGURE_CFLAGS="${T_CONFIGURE_CFLAGS}"]
|
2009-07-01 07:17:05 +08:00
|
|
|
)
|
2016-12-16 23:18:55 +08:00
|
|
|
JE_CONCAT_VVV(CFLAGS, CONFIGURE_CFLAGS, SPECIFIED_CFLAGS)
|
2009-07-01 07:17:05 +08:00
|
|
|
])
|
|
|
|
|
2016-12-16 23:18:55 +08:00
|
|
|
dnl JE_CFLAGS_SAVE()
|
|
|
|
dnl JE_CFLAGS_RESTORE()
|
2017-07-07 02:50:55 +08:00
|
|
|
dnl
|
2016-12-16 23:18:55 +08:00
|
|
|
dnl Save/restore CFLAGS. Nesting is not supported.
|
|
|
|
AC_DEFUN([JE_CFLAGS_SAVE],
|
|
|
|
SAVED_CONFIGURE_CFLAGS="${CONFIGURE_CFLAGS}"
|
|
|
|
)
|
|
|
|
AC_DEFUN([JE_CFLAGS_RESTORE],
|
|
|
|
CONFIGURE_CFLAGS="${SAVED_CONFIGURE_CFLAGS}"
|
|
|
|
JE_CONCAT_VVV(CFLAGS, CONFIGURE_CFLAGS, SPECIFIED_CFLAGS)
|
|
|
|
)
|
|
|
|
|
|
|
|
CONFIGURE_CXXFLAGS=
|
|
|
|
SPECIFIED_CXXFLAGS="${CXXFLAGS}"
|
|
|
|
dnl JE_CXXFLAGS_ADD(cxxflag)
|
|
|
|
AC_DEFUN([JE_CXXFLAGS_ADD],
|
jemalloc cpp new/delete bindings
Adds cpp bindings for jemalloc, along with necessary autoconf settings.
This is mostly to add sized deallocation support, which can't be added
from C directly. Sized deallocation is ~10% microbench improvement.
* Import ax_cxx_compile_stdcxx.m4 from the autoconf repo, seems like the
easiest way to get c++14 detection.
* Adds various other changes, like CXXFLAGS, to configure.ac.
* Adds new rules to Makefile.in for src/jemalloc-cpp.cpp, and a basic
unittest.
* Both new and delete are overridden, to ensure jemalloc is used for
both.
* TODO future enhancement of avoiding extra PLT thunks for new and
delete - sdallocx and malloc are publicly exported jemalloc symbols,
using an alias would link them directly. Unfortunately, was having
trouble getting it to play nice with jemalloc's namespace support.
Testing:
Tested gcc 4.8, gcc 5, gcc 5.2, clang 4.0. Only gcc >= 5 has sized
deallocation support, verified that the rest build correctly.
Tested mac osx and Centos.
Tested --with-jemalloc-prefix and --without-export.
This resolves #202.
2016-10-24 06:56:30 +08:00
|
|
|
[
|
|
|
|
AC_MSG_CHECKING([whether compiler supports $1])
|
2016-12-16 23:18:55 +08:00
|
|
|
T_CONFIGURE_CXXFLAGS="${CONFIGURE_CXXFLAGS}"
|
|
|
|
JE_APPEND_VS(CONFIGURE_CXXFLAGS, $1)
|
|
|
|
JE_CONCAT_VVV(CXXFLAGS, CONFIGURE_CXXFLAGS, SPECIFIED_CXXFLAGS)
|
2017-12-31 20:52:33 +08:00
|
|
|
AC_LANG_PUSH([C++])
|
jemalloc cpp new/delete bindings
Adds cpp bindings for jemalloc, along with necessary autoconf settings.
This is mostly to add sized deallocation support, which can't be added
from C directly. Sized deallocation is ~10% microbench improvement.
* Import ax_cxx_compile_stdcxx.m4 from the autoconf repo, seems like the
easiest way to get c++14 detection.
* Adds various other changes, like CXXFLAGS, to configure.ac.
* Adds new rules to Makefile.in for src/jemalloc-cpp.cpp, and a basic
unittest.
* Both new and delete are overridden, to ensure jemalloc is used for
both.
* TODO future enhancement of avoiding extra PLT thunks for new and
delete - sdallocx and malloc are publicly exported jemalloc symbols,
using an alias would link them directly. Unfortunately, was having
trouble getting it to play nice with jemalloc's namespace support.
Testing:
Tested gcc 4.8, gcc 5, gcc 5.2, clang 4.0. Only gcc >= 5 has sized
deallocation support, verified that the rest build correctly.
Tested mac osx and Centos.
Tested --with-jemalloc-prefix and --without-export.
This resolves #202.
2016-10-24 06:56:30 +08:00
|
|
|
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
|
|
|
|
[[
|
|
|
|
]], [[
|
|
|
|
return 0;
|
|
|
|
]])],
|
2016-12-16 23:18:55 +08:00
|
|
|
[je_cv_cxxflags_added=$1]
|
jemalloc cpp new/delete bindings
Adds cpp bindings for jemalloc, along with necessary autoconf settings.
This is mostly to add sized deallocation support, which can't be added
from C directly. Sized deallocation is ~10% microbench improvement.
* Import ax_cxx_compile_stdcxx.m4 from the autoconf repo, seems like the
easiest way to get c++14 detection.
* Adds various other changes, like CXXFLAGS, to configure.ac.
* Adds new rules to Makefile.in for src/jemalloc-cpp.cpp, and a basic
unittest.
* Both new and delete are overridden, to ensure jemalloc is used for
both.
* TODO future enhancement of avoiding extra PLT thunks for new and
delete - sdallocx and malloc are publicly exported jemalloc symbols,
using an alias would link them directly. Unfortunately, was having
trouble getting it to play nice with jemalloc's namespace support.
Testing:
Tested gcc 4.8, gcc 5, gcc 5.2, clang 4.0. Only gcc >= 5 has sized
deallocation support, verified that the rest build correctly.
Tested mac osx and Centos.
Tested --with-jemalloc-prefix and --without-export.
This resolves #202.
2016-10-24 06:56:30 +08:00
|
|
|
AC_MSG_RESULT([yes]),
|
2016-12-16 23:18:55 +08:00
|
|
|
[je_cv_cxxflags_added=]
|
jemalloc cpp new/delete bindings
Adds cpp bindings for jemalloc, along with necessary autoconf settings.
This is mostly to add sized deallocation support, which can't be added
from C directly. Sized deallocation is ~10% microbench improvement.
* Import ax_cxx_compile_stdcxx.m4 from the autoconf repo, seems like the
easiest way to get c++14 detection.
* Adds various other changes, like CXXFLAGS, to configure.ac.
* Adds new rules to Makefile.in for src/jemalloc-cpp.cpp, and a basic
unittest.
* Both new and delete are overridden, to ensure jemalloc is used for
both.
* TODO future enhancement of avoiding extra PLT thunks for new and
delete - sdallocx and malloc are publicly exported jemalloc symbols,
using an alias would link them directly. Unfortunately, was having
trouble getting it to play nice with jemalloc's namespace support.
Testing:
Tested gcc 4.8, gcc 5, gcc 5.2, clang 4.0. Only gcc >= 5 has sized
deallocation support, verified that the rest build correctly.
Tested mac osx and Centos.
Tested --with-jemalloc-prefix and --without-export.
This resolves #202.
2016-10-24 06:56:30 +08:00
|
|
|
AC_MSG_RESULT([no])
|
2016-12-16 23:18:55 +08:00
|
|
|
[CONFIGURE_CXXFLAGS="${T_CONFIGURE_CXXFLAGS}"]
|
jemalloc cpp new/delete bindings
Adds cpp bindings for jemalloc, along with necessary autoconf settings.
This is mostly to add sized deallocation support, which can't be added
from C directly. Sized deallocation is ~10% microbench improvement.
* Import ax_cxx_compile_stdcxx.m4 from the autoconf repo, seems like the
easiest way to get c++14 detection.
* Adds various other changes, like CXXFLAGS, to configure.ac.
* Adds new rules to Makefile.in for src/jemalloc-cpp.cpp, and a basic
unittest.
* Both new and delete are overridden, to ensure jemalloc is used for
both.
* TODO future enhancement of avoiding extra PLT thunks for new and
delete - sdallocx and malloc are publicly exported jemalloc symbols,
using an alias would link them directly. Unfortunately, was having
trouble getting it to play nice with jemalloc's namespace support.
Testing:
Tested gcc 4.8, gcc 5, gcc 5.2, clang 4.0. Only gcc >= 5 has sized
deallocation support, verified that the rest build correctly.
Tested mac osx and Centos.
Tested --with-jemalloc-prefix and --without-export.
This resolves #202.
2016-10-24 06:56:30 +08:00
|
|
|
)
|
2017-12-31 20:52:33 +08:00
|
|
|
AC_LANG_POP([C++])
|
2016-12-16 23:18:55 +08:00
|
|
|
JE_CONCAT_VVV(CXXFLAGS, CONFIGURE_CXXFLAGS, SPECIFIED_CXXFLAGS)
|
jemalloc cpp new/delete bindings
Adds cpp bindings for jemalloc, along with necessary autoconf settings.
This is mostly to add sized deallocation support, which can't be added
from C directly. Sized deallocation is ~10% microbench improvement.
* Import ax_cxx_compile_stdcxx.m4 from the autoconf repo, seems like the
easiest way to get c++14 detection.
* Adds various other changes, like CXXFLAGS, to configure.ac.
* Adds new rules to Makefile.in for src/jemalloc-cpp.cpp, and a basic
unittest.
* Both new and delete are overridden, to ensure jemalloc is used for
both.
* TODO future enhancement of avoiding extra PLT thunks for new and
delete - sdallocx and malloc are publicly exported jemalloc symbols,
using an alias would link them directly. Unfortunately, was having
trouble getting it to play nice with jemalloc's namespace support.
Testing:
Tested gcc 4.8, gcc 5, gcc 5.2, clang 4.0. Only gcc >= 5 has sized
deallocation support, verified that the rest build correctly.
Tested mac osx and Centos.
Tested --with-jemalloc-prefix and --without-export.
This resolves #202.
2016-10-24 06:56:30 +08:00
|
|
|
])
|
|
|
|
|
2009-07-01 07:17:05 +08:00
|
|
|
dnl JE_COMPILABLE(label, hcode, mcode, rvar)
|
2017-07-07 02:50:55 +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 ============================================================================
|
|
|
|
|
2015-01-26 12:15:13 +08:00
|
|
|
CONFIG=`echo ${ac_configure_args} | sed -e 's#'"'"'\([^ ]*\)'"'"'#\1#g'`
|
2015-01-23 09:55:58 +08:00
|
|
|
AC_SUBST([CONFIG])
|
|
|
|
|
2011-11-02 13:27:41 +08:00
|
|
|
dnl Library revision.
|
2014-04-15 13:32:31 +08:00
|
|
|
rev=2
|
2011-11-02 13:27:41 +08:00
|
|
|
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
|
|
|
)
|
2019-02-08 10:47:49 +08:00
|
|
|
if test "x$XSLTPROC" = "xfalse" ; then
|
|
|
|
XSLROOT=""
|
|
|
|
fi
|
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
|
2016-06-15 06:26:07 +08:00
|
|
|
|
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
|
|
|
|
|
2016-06-15 04:18:08 +08:00
|
|
|
dnl check if a cray prgenv wrapper compiler is being used
|
|
|
|
je_cv_cray_prgenv_wrapper=""
|
|
|
|
if test "x${PE_ENV}" != "x" ; then
|
|
|
|
case "${CC}" in
|
|
|
|
CC|cc)
|
|
|
|
je_cv_cray_prgenv_wrapper="yes"
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
fi
|
|
|
|
|
2016-06-15 06:26:07 +08:00
|
|
|
AC_CACHE_CHECK([whether compiler is cray],
|
|
|
|
[je_cv_cray],
|
|
|
|
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],
|
|
|
|
[
|
|
|
|
#ifndef _CRAYC
|
|
|
|
int fail[-1];
|
|
|
|
#endif
|
|
|
|
])],
|
|
|
|
[je_cv_cray=yes],
|
|
|
|
[je_cv_cray=no])])
|
|
|
|
|
|
|
|
if test "x${je_cv_cray}" = "xyes" ; then
|
|
|
|
AC_CACHE_CHECK([whether cray compiler version is 8.4],
|
|
|
|
[je_cv_cray_84],
|
|
|
|
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],
|
|
|
|
[
|
|
|
|
#if !(_RELEASE_MAJOR == 8 && _RELEASE_MINOR == 4)
|
|
|
|
int fail[-1];
|
|
|
|
#endif
|
|
|
|
])],
|
|
|
|
[je_cv_cray_84=yes],
|
|
|
|
[je_cv_cray_84=no])])
|
|
|
|
fi
|
|
|
|
|
2016-12-16 23:18:55 +08:00
|
|
|
if test "x$GCC" = "xyes" ; then
|
|
|
|
JE_CFLAGS_ADD([-std=gnu11])
|
|
|
|
if test "x$je_cv_cflags_added" = "x-std=gnu11" ; then
|
|
|
|
AC_DEFINE_UNQUOTED([JEMALLOC_HAS_RESTRICT])
|
|
|
|
else
|
|
|
|
JE_CFLAGS_ADD([-std=gnu99])
|
|
|
|
if test "x$je_cv_cflags_added" = "x-std=gnu99" ; then
|
2014-02-25 08:08:38 +08:00
|
|
|
AC_DEFINE_UNQUOTED([JEMALLOC_HAS_RESTRICT])
|
|
|
|
fi
|
2010-03-04 07:48:20 +08:00
|
|
|
fi
|
2016-12-16 23:18:55 +08:00
|
|
|
JE_CFLAGS_ADD([-Wall])
|
2018-05-03 17:40:53 +08:00
|
|
|
JE_CFLAGS_ADD([-Wextra])
|
2016-12-16 23:18:55 +08:00
|
|
|
JE_CFLAGS_ADD([-Wshorten-64-to-32])
|
|
|
|
JE_CFLAGS_ADD([-Wsign-compare])
|
2017-04-22 04:47:49 +08:00
|
|
|
JE_CFLAGS_ADD([-Wundef])
|
2017-07-22 04:34:45 +08:00
|
|
|
JE_CFLAGS_ADD([-Wno-format-zero-length])
|
2016-12-16 23:18:55 +08:00
|
|
|
JE_CFLAGS_ADD([-pipe])
|
|
|
|
JE_CFLAGS_ADD([-g3])
|
|
|
|
elif test "x$je_cv_msvc" = "xyes" ; then
|
|
|
|
CC="$CC -nologo"
|
|
|
|
JE_CFLAGS_ADD([-Zi])
|
|
|
|
JE_CFLAGS_ADD([-MT])
|
|
|
|
JE_CFLAGS_ADD([-W3])
|
|
|
|
JE_CFLAGS_ADD([-FS])
|
|
|
|
JE_APPEND_VS(CPPFLAGS, -I${srcdir}/include/msvc_compat)
|
|
|
|
fi
|
|
|
|
if test "x$je_cv_cray" = "xyes" ; then
|
|
|
|
dnl cray compiler 8.4 has an inlining bug
|
|
|
|
if test "x$je_cv_cray_84" = "xyes" ; then
|
|
|
|
JE_CFLAGS_ADD([-hipa2])
|
|
|
|
JE_CFLAGS_ADD([-hnognu])
|
|
|
|
fi
|
2017-04-25 02:47:10 +08:00
|
|
|
dnl ignore unreachable code warning
|
|
|
|
JE_CFLAGS_ADD([-hnomessage=128])
|
|
|
|
dnl ignore redefinition of "malloc", "free", etc warning
|
|
|
|
JE_CFLAGS_ADD([-hnomessage=1357])
|
2009-06-24 10:01:18 +08:00
|
|
|
fi
|
2016-12-16 23:18:55 +08:00
|
|
|
AC_SUBST([CONFIGURE_CFLAGS])
|
|
|
|
AC_SUBST([SPECIFIED_CFLAGS])
|
2016-10-30 13:14:55 +08:00
|
|
|
AC_SUBST([EXTRA_CFLAGS])
|
2009-06-24 10:01:18 +08:00
|
|
|
AC_PROG_CPP
|
|
|
|
|
jemalloc cpp new/delete bindings
Adds cpp bindings for jemalloc, along with necessary autoconf settings.
This is mostly to add sized deallocation support, which can't be added
from C directly. Sized deallocation is ~10% microbench improvement.
* Import ax_cxx_compile_stdcxx.m4 from the autoconf repo, seems like the
easiest way to get c++14 detection.
* Adds various other changes, like CXXFLAGS, to configure.ac.
* Adds new rules to Makefile.in for src/jemalloc-cpp.cpp, and a basic
unittest.
* Both new and delete are overridden, to ensure jemalloc is used for
both.
* TODO future enhancement of avoiding extra PLT thunks for new and
delete - sdallocx and malloc are publicly exported jemalloc symbols,
using an alias would link them directly. Unfortunately, was having
trouble getting it to play nice with jemalloc's namespace support.
Testing:
Tested gcc 4.8, gcc 5, gcc 5.2, clang 4.0. Only gcc >= 5 has sized
deallocation support, verified that the rest build correctly.
Tested mac osx and Centos.
Tested --with-jemalloc-prefix and --without-export.
This resolves #202.
2016-10-24 06:56:30 +08:00
|
|
|
AC_ARG_ENABLE([cxx],
|
|
|
|
[AS_HELP_STRING([--disable-cxx], [Disable C++ integration])],
|
|
|
|
if test "x$enable_cxx" = "xno" ; then
|
|
|
|
enable_cxx="0"
|
|
|
|
else
|
|
|
|
enable_cxx="1"
|
|
|
|
fi
|
|
|
|
,
|
|
|
|
enable_cxx="1"
|
|
|
|
)
|
|
|
|
if test "x$enable_cxx" = "x1" ; then
|
|
|
|
dnl Require at least c++14, which is the first version to support sized
|
|
|
|
dnl deallocation. C++ support is not compiled otherwise.
|
|
|
|
m4_include([m4/ax_cxx_compile_stdcxx.m4])
|
|
|
|
AX_CXX_COMPILE_STDCXX([14], [noext], [optional])
|
|
|
|
if test "x${HAVE_CXX14}" = "x1" ; then
|
2016-12-16 23:18:55 +08:00
|
|
|
JE_CXXFLAGS_ADD([-Wall])
|
2018-05-03 17:40:53 +08:00
|
|
|
JE_CXXFLAGS_ADD([-Wextra])
|
2016-12-16 23:18:55 +08:00
|
|
|
JE_CXXFLAGS_ADD([-g3])
|
jemalloc cpp new/delete bindings
Adds cpp bindings for jemalloc, along with necessary autoconf settings.
This is mostly to add sized deallocation support, which can't be added
from C directly. Sized deallocation is ~10% microbench improvement.
* Import ax_cxx_compile_stdcxx.m4 from the autoconf repo, seems like the
easiest way to get c++14 detection.
* Adds various other changes, like CXXFLAGS, to configure.ac.
* Adds new rules to Makefile.in for src/jemalloc-cpp.cpp, and a basic
unittest.
* Both new and delete are overridden, to ensure jemalloc is used for
both.
* TODO future enhancement of avoiding extra PLT thunks for new and
delete - sdallocx and malloc are publicly exported jemalloc symbols,
using an alias would link them directly. Unfortunately, was having
trouble getting it to play nice with jemalloc's namespace support.
Testing:
Tested gcc 4.8, gcc 5, gcc 5.2, clang 4.0. Only gcc >= 5 has sized
deallocation support, verified that the rest build correctly.
Tested mac osx and Centos.
Tested --with-jemalloc-prefix and --without-export.
This resolves #202.
2016-10-24 06:56:30 +08:00
|
|
|
|
|
|
|
SAVED_LIBS="${LIBS}"
|
2016-12-16 23:18:55 +08:00
|
|
|
JE_APPEND_VS(LIBS, -lstdc++)
|
jemalloc cpp new/delete bindings
Adds cpp bindings for jemalloc, along with necessary autoconf settings.
This is mostly to add sized deallocation support, which can't be added
from C directly. Sized deallocation is ~10% microbench improvement.
* Import ax_cxx_compile_stdcxx.m4 from the autoconf repo, seems like the
easiest way to get c++14 detection.
* Adds various other changes, like CXXFLAGS, to configure.ac.
* Adds new rules to Makefile.in for src/jemalloc-cpp.cpp, and a basic
unittest.
* Both new and delete are overridden, to ensure jemalloc is used for
both.
* TODO future enhancement of avoiding extra PLT thunks for new and
delete - sdallocx and malloc are publicly exported jemalloc symbols,
using an alias would link them directly. Unfortunately, was having
trouble getting it to play nice with jemalloc's namespace support.
Testing:
Tested gcc 4.8, gcc 5, gcc 5.2, clang 4.0. Only gcc >= 5 has sized
deallocation support, verified that the rest build correctly.
Tested mac osx and Centos.
Tested --with-jemalloc-prefix and --without-export.
This resolves #202.
2016-10-24 06:56:30 +08:00
|
|
|
JE_COMPILABLE([libstdc++ linkage], [
|
|
|
|
#include <stdlib.h>
|
|
|
|
], [[
|
|
|
|
int *arr = (int *)malloc(sizeof(int) * 42);
|
|
|
|
if (arr == NULL)
|
2017-01-20 10:15:45 +08:00
|
|
|
return 1;
|
jemalloc cpp new/delete bindings
Adds cpp bindings for jemalloc, along with necessary autoconf settings.
This is mostly to add sized deallocation support, which can't be added
from C directly. Sized deallocation is ~10% microbench improvement.
* Import ax_cxx_compile_stdcxx.m4 from the autoconf repo, seems like the
easiest way to get c++14 detection.
* Adds various other changes, like CXXFLAGS, to configure.ac.
* Adds new rules to Makefile.in for src/jemalloc-cpp.cpp, and a basic
unittest.
* Both new and delete are overridden, to ensure jemalloc is used for
both.
* TODO future enhancement of avoiding extra PLT thunks for new and
delete - sdallocx and malloc are publicly exported jemalloc symbols,
using an alias would link them directly. Unfortunately, was having
trouble getting it to play nice with jemalloc's namespace support.
Testing:
Tested gcc 4.8, gcc 5, gcc 5.2, clang 4.0. Only gcc >= 5 has sized
deallocation support, verified that the rest build correctly.
Tested mac osx and Centos.
Tested --with-jemalloc-prefix and --without-export.
This resolves #202.
2016-10-24 06:56:30 +08:00
|
|
|
]], [je_cv_libstdcxx])
|
|
|
|
if test "x${je_cv_libstdcxx}" = "xno" ; then
|
|
|
|
LIBS="${SAVED_LIBS}"
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
enable_cxx="0"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
AC_SUBST([enable_cxx])
|
2016-12-16 23:18:55 +08:00
|
|
|
AC_SUBST([CONFIGURE_CXXFLAGS])
|
|
|
|
AC_SUBST([SPECIFIED_CXXFLAGS])
|
jemalloc cpp new/delete bindings
Adds cpp bindings for jemalloc, along with necessary autoconf settings.
This is mostly to add sized deallocation support, which can't be added
from C directly. Sized deallocation is ~10% microbench improvement.
* Import ax_cxx_compile_stdcxx.m4 from the autoconf repo, seems like the
easiest way to get c++14 detection.
* Adds various other changes, like CXXFLAGS, to configure.ac.
* Adds new rules to Makefile.in for src/jemalloc-cpp.cpp, and a basic
unittest.
* Both new and delete are overridden, to ensure jemalloc is used for
both.
* TODO future enhancement of avoiding extra PLT thunks for new and
delete - sdallocx and malloc are publicly exported jemalloc symbols,
using an alias would link them directly. Unfortunately, was having
trouble getting it to play nice with jemalloc's namespace support.
Testing:
Tested gcc 4.8, gcc 5, gcc 5.2, clang 4.0. Only gcc >= 5 has sized
deallocation support, verified that the rest build correctly.
Tested mac osx and Centos.
Tested --with-jemalloc-prefix and --without-export.
This resolves #202.
2016-10-24 06:56:30 +08:00
|
|
|
AC_SUBST([EXTRA_CXXFLAGS])
|
|
|
|
|
2014-03-31 07:27:08 +08:00
|
|
|
AC_C_BIGENDIAN([ac_cv_big_endian=1], [ac_cv_big_endian=0])
|
|
|
|
if test "x${ac_cv_big_endian}" = "x1" ; then
|
|
|
|
AC_DEFINE_UNQUOTED([JEMALLOC_BIG_ENDIAN], [ ])
|
|
|
|
fi
|
|
|
|
|
2014-05-29 15:33:02 +08:00
|
|
|
if test "x${je_cv_msvc}" = "xyes" -a "x${ac_cv_header_inttypes_h}" = "xno"; then
|
2016-12-16 23:18:55 +08:00
|
|
|
JE_APPEND_VS(CPPFLAGS, -I${srcdir}/include/msvc_compat/C99)
|
2014-05-29 15:33:02 +08:00
|
|
|
fi
|
|
|
|
|
2016-01-30 20:37:26 +08:00
|
|
|
if test "x${je_cv_msvc}" = "xyes" ; then
|
|
|
|
LG_SIZEOF_PTR=LG_SIZEOF_PTR_WIN
|
|
|
|
AC_MSG_RESULT([Using a predefined value for sizeof(void *): 4 for 32-bit, 8 for 64-bit])
|
2009-06-24 10:01:18 +08:00
|
|
|
else
|
2016-01-30 20:37:26 +08:00
|
|
|
AC_CHECK_SIZEOF([void *])
|
|
|
|
if test "x${ac_cv_sizeof_void_p}" = "x8" ; then
|
|
|
|
LG_SIZEOF_PTR=3
|
|
|
|
elif test "x${ac_cv_sizeof_void_p}" = "x4" ; then
|
|
|
|
LG_SIZEOF_PTR=2
|
|
|
|
else
|
|
|
|
AC_MSG_ERROR([Unsupported pointer size: ${ac_cv_sizeof_void_p}])
|
|
|
|
fi
|
2009-06-24 10:01:18 +08:00
|
|
|
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])
|
|
|
|
|
2016-02-21 15:41:33 +08:00
|
|
|
AC_CHECK_SIZEOF([long long])
|
|
|
|
if test "x${ac_cv_sizeof_long_long}" = "x8" ; then
|
|
|
|
LG_SIZEOF_LONG_LONG=3
|
|
|
|
elif test "x${ac_cv_sizeof_long_long}" = "x4" ; then
|
|
|
|
LG_SIZEOF_LONG_LONG=2
|
|
|
|
else
|
|
|
|
AC_MSG_ERROR([Unsupported long long size: ${ac_cv_sizeof_long_long}])
|
|
|
|
fi
|
|
|
|
AC_DEFINE_UNQUOTED([LG_SIZEOF_LONG_LONG], [$LG_SIZEOF_LONG_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
|
Add configure test to verify SSE2 code compiles.
Make sure that emmintrin.h can be #include'd without causing a
compilation error, rather than blindly defining HAVE_SSE2 based on
architecture. Attempts to force SSE2 compilation on a 32-bit Ubuntu
13.10 system running as a VMware guest resulted in a no-win choice
without any obvious explanation besides toolchain misconfiguration/bug:
- Suffer compilation failure due to __MMX__, __SSE__, and __SSE2__ not
being defined, even if -mmmx, -msse, and -msse2 are manually
specified (note that they appear to be enabled by default).
- Manually define __MMX__, __SSE__, and __SSE2__, and suffer compiler
warnings that they are already automatically defined. This results in
successful compilation and execution, but the noise is intolerable.
2014-02-26 03:21:41 +08:00
|
|
|
i686|x86_64)
|
2017-10-04 09:03:02 +08:00
|
|
|
HAVE_CPU_SPINWAIT=1
|
2016-01-30 20:41:09 +08:00
|
|
|
if test "x${je_cv_msvc}" = "xyes" ; then
|
|
|
|
AC_CACHE_VAL([je_cv_pause_msvc],
|
|
|
|
[JE_COMPILABLE([pause instruction MSVC], [],
|
|
|
|
[[_mm_pause(); return 0;]],
|
|
|
|
[je_cv_pause_msvc])])
|
|
|
|
if test "x${je_cv_pause_msvc}" = "xyes" ; then
|
|
|
|
CPU_SPINWAIT='_mm_pause()'
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
AC_CACHE_VAL([je_cv_pause],
|
|
|
|
[JE_COMPILABLE([pause instruction], [],
|
|
|
|
[[__asm__ volatile("pause"); return 0;]],
|
|
|
|
[je_cv_pause])])
|
|
|
|
if test "x${je_cv_pause}" = "xyes" ; then
|
|
|
|
CPU_SPINWAIT='__asm__ volatile("pause")'
|
|
|
|
fi
|
2009-07-01 07:17:05 +08:00
|
|
|
fi
|
2013-12-10 05:21:08 +08:00
|
|
|
;;
|
2009-06-24 10:01:18 +08:00
|
|
|
*)
|
2017-10-04 09:03:02 +08:00
|
|
|
HAVE_CPU_SPINWAIT=0
|
2009-06-24 10:01:18 +08:00
|
|
|
;;
|
|
|
|
esac
|
2017-10-04 09:03:02 +08:00
|
|
|
AC_DEFINE_UNQUOTED([HAVE_CPU_SPINWAIT], [$HAVE_CPU_SPINWAIT])
|
2009-06-24 10:01:18 +08:00
|
|
|
AC_DEFINE_UNQUOTED([CPU_SPINWAIT], [$CPU_SPINWAIT])
|
|
|
|
|
2018-05-03 22:52:03 +08:00
|
|
|
AC_ARG_WITH([lg_vaddr],
|
|
|
|
[AS_HELP_STRING([--with-lg-vaddr=<lg-vaddr>], [Number of significant virtual address bits])],
|
|
|
|
[LG_VADDR="$with_lg_vaddr"], [LG_VADDR="detect"])
|
|
|
|
|
2017-02-07 05:17:12 +08:00
|
|
|
case "${host_cpu}" in
|
|
|
|
aarch64)
|
2018-05-03 22:52:03 +08:00
|
|
|
if test "x$LG_VADDR" = "xdetect"; then
|
|
|
|
AC_MSG_CHECKING([number of significant virtual address bits])
|
|
|
|
if test "x${LG_SIZEOF_PTR}" = "x2" ; then
|
|
|
|
#aarch64 ILP32
|
|
|
|
LG_VADDR=32
|
|
|
|
else
|
|
|
|
#aarch64 LP64
|
|
|
|
LG_VADDR=48
|
|
|
|
fi
|
|
|
|
AC_MSG_RESULT([$LG_VADDR])
|
2018-04-29 02:47:45 +08:00
|
|
|
fi
|
2017-02-07 05:17:12 +08:00
|
|
|
;;
|
|
|
|
x86_64)
|
2018-05-03 22:52:03 +08:00
|
|
|
if test "x$LG_VADDR" = "xdetect"; then
|
|
|
|
AC_CACHE_CHECK([number of significant virtual address bits],
|
|
|
|
[je_cv_lg_vaddr],
|
|
|
|
AC_RUN_IFELSE([AC_LANG_PROGRAM(
|
2017-02-07 05:17:12 +08:00
|
|
|
[[
|
|
|
|
#include <stdio.h>
|
|
|
|
#ifdef _WIN32
|
|
|
|
#include <limits.h>
|
|
|
|
#include <intrin.h>
|
|
|
|
typedef unsigned __int32 uint32_t;
|
|
|
|
#else
|
|
|
|
#include <stdint.h>
|
|
|
|
#endif
|
|
|
|
]], [[
|
|
|
|
uint32_t r[[4]];
|
|
|
|
uint32_t eax_in = 0x80000008U;
|
|
|
|
#ifdef _WIN32
|
|
|
|
__cpuid((int *)r, (int)eax_in);
|
|
|
|
#else
|
|
|
|
asm volatile ("cpuid"
|
|
|
|
: "=a" (r[[0]]), "=b" (r[[1]]), "=c" (r[[2]]), "=d" (r[[3]])
|
|
|
|
: "a" (eax_in), "c" (0)
|
|
|
|
);
|
|
|
|
#endif
|
|
|
|
uint32_t eax_out = r[[0]];
|
|
|
|
uint32_t vaddr = ((eax_out & 0x0000ff00U) >> 8);
|
|
|
|
FILE *f = fopen("conftest.out", "w");
|
|
|
|
if (f == NULL) {
|
|
|
|
return 1;
|
|
|
|
}
|
2017-03-21 08:37:02 +08:00
|
|
|
if (vaddr > (sizeof(void *) << 3)) {
|
|
|
|
vaddr = sizeof(void *) << 3;
|
|
|
|
}
|
2017-02-07 05:17:12 +08:00
|
|
|
fprintf(f, "%u", vaddr);
|
|
|
|
fclose(f);
|
|
|
|
return 0;
|
|
|
|
]])],
|
|
|
|
[je_cv_lg_vaddr=`cat conftest.out`],
|
|
|
|
[je_cv_lg_vaddr=error],
|
|
|
|
[je_cv_lg_vaddr=57]))
|
2018-05-03 22:52:03 +08:00
|
|
|
if test "x${je_cv_lg_vaddr}" != "x" ; then
|
|
|
|
LG_VADDR="${je_cv_lg_vaddr}"
|
|
|
|
fi
|
|
|
|
if test "x${LG_VADDR}" != "xerror" ; then
|
|
|
|
AC_DEFINE_UNQUOTED([LG_VADDR], [$LG_VADDR])
|
|
|
|
else
|
|
|
|
AC_MSG_ERROR([cannot determine number of significant virtual address bits])
|
|
|
|
fi
|
2017-02-07 05:17:12 +08:00
|
|
|
fi
|
|
|
|
;;
|
|
|
|
*)
|
2018-05-03 22:52:03 +08:00
|
|
|
if test "x$LG_VADDR" = "xdetect"; then
|
|
|
|
AC_MSG_CHECKING([number of significant virtual address bits])
|
|
|
|
if test "x${LG_SIZEOF_PTR}" = "x3" ; then
|
|
|
|
LG_VADDR=64
|
|
|
|
elif test "x${LG_SIZEOF_PTR}" = "x2" ; then
|
|
|
|
LG_VADDR=32
|
|
|
|
elif test "x${LG_SIZEOF_PTR}" = "xLG_SIZEOF_PTR_WIN" ; then
|
|
|
|
LG_VADDR="(1U << (LG_SIZEOF_PTR_WIN+3))"
|
|
|
|
else
|
|
|
|
AC_MSG_ERROR([Unsupported lg(pointer size): ${LG_SIZEOF_PTR}])
|
|
|
|
fi
|
|
|
|
AC_MSG_RESULT([$LG_VADDR])
|
2017-02-07 05:17:12 +08:00
|
|
|
fi
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
AC_DEFINE_UNQUOTED([LG_VADDR], [$LG_VADDR])
|
|
|
|
|
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"
|
2016-10-28 08:10:56 +08:00
|
|
|
link_whole_archive="0"
|
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 $@'
|
2016-06-15 04:18:08 +08:00
|
|
|
TEST_LD_MODE=
|
2012-04-30 18:38:31 +08:00
|
|
|
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
|
|
|
|
2016-06-15 04:18:08 +08:00
|
|
|
if test "x$je_cv_cray_prgenv_wrapper" = "xyes" ; then
|
|
|
|
TEST_LD_MODE='-dynamic'
|
|
|
|
fi
|
|
|
|
|
2016-06-15 06:26:29 +08:00
|
|
|
if test "x${je_cv_cray}" = "xyes" ; then
|
|
|
|
CC_MM=
|
|
|
|
fi
|
|
|
|
|
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
|
|
|
|
|
2017-07-07 03:04:17 +08:00
|
|
|
AN_MAKEVAR([NM], [AC_PROG_NM])
|
|
|
|
AN_PROGRAM([nm], [AC_PROG_NM])
|
|
|
|
AC_DEFUN([AC_PROG_NM], [AC_CHECK_TOOL(NM, nm, :)])
|
|
|
|
AC_PROG_NM
|
|
|
|
|
2017-05-05 02:20:43 +08:00
|
|
|
AC_PROG_AWK
|
|
|
|
|
2018-10-05 19:11:21 +08:00
|
|
|
dnl ============================================================================
|
|
|
|
dnl jemalloc version.
|
|
|
|
dnl
|
|
|
|
|
|
|
|
AC_ARG_WITH([version],
|
|
|
|
[AS_HELP_STRING([--with-version=<major>.<minor>.<bugfix>-<nrev>-g<gid>],
|
|
|
|
[Version string])],
|
|
|
|
[
|
|
|
|
echo "${with_version}" | grep ['^[0-9]\+\.[0-9]\+\.[0-9]\+-[0-9]\+-g[0-9a-f]\+$'] 2>&1 1>/dev/null
|
|
|
|
if test $? -eq 0 ; then
|
|
|
|
echo "$with_version" > "${objroot}VERSION"
|
|
|
|
else
|
|
|
|
echo "${with_version}" | grep ['^VERSION$'] 2>&1 1>/dev/null
|
|
|
|
if test $? -ne 0 ; then
|
|
|
|
AC_MSG_ERROR([${with_version} does not match <major>.<minor>.<bugfix>-<nrev>-g<gid> or VERSION])
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
], [
|
|
|
|
dnl Set VERSION if source directory is inside a git repository.
|
|
|
|
if test "x`test ! \"${srcroot}\" && cd \"${srcroot}\"; git rev-parse --is-inside-work-tree 2>/dev/null`" = "xtrue" ; then
|
|
|
|
dnl Pattern globs aren't powerful enough to match both single- and
|
|
|
|
dnl double-digit version numbers, so iterate over patterns to support up
|
|
|
|
dnl to version 99.99.99 without any accidental matches.
|
|
|
|
for pattern in ['[0-9].[0-9].[0-9]' '[0-9].[0-9].[0-9][0-9]' \
|
|
|
|
'[0-9].[0-9][0-9].[0-9]' '[0-9].[0-9][0-9].[0-9][0-9]' \
|
|
|
|
'[0-9][0-9].[0-9].[0-9]' '[0-9][0-9].[0-9].[0-9][0-9]' \
|
|
|
|
'[0-9][0-9].[0-9][0-9].[0-9]' \
|
|
|
|
'[0-9][0-9].[0-9][0-9].[0-9][0-9]']; do
|
|
|
|
(test ! "${srcroot}" && cd "${srcroot}"; git describe --long --abbrev=40 --match="${pattern}") > "${objroot}VERSION.tmp" 2>/dev/null
|
|
|
|
if test $? -eq 0 ; then
|
|
|
|
mv "${objroot}VERSION.tmp" "${objroot}VERSION"
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
rm -f "${objroot}VERSION.tmp"
|
|
|
|
])
|
|
|
|
|
|
|
|
if test ! -e "${objroot}VERSION" ; then
|
|
|
|
if test ! -e "${srcroot}VERSION" ; then
|
|
|
|
AC_MSG_RESULT(
|
|
|
|
[Missing VERSION file, and unable to generate it; creating bogus VERSION])
|
|
|
|
echo "0.0.0-0-g0000000000000000000000000000000000000000" > "${objroot}VERSION"
|
|
|
|
else
|
|
|
|
cp ${srcroot}VERSION ${objroot}VERSION
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
jemalloc_version=`cat "${objroot}VERSION"`
|
|
|
|
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}'`
|
|
|
|
AC_SUBST([jemalloc_version])
|
|
|
|
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 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.
|
2017-07-07 02:50:55 +08:00
|
|
|
dnl
|
2009-06-24 10:01:18 +08:00
|
|
|
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.
|
2017-04-27 07:26:12 +08:00
|
|
|
default_retain="0"
|
2015-07-25 09:21:42 +08:00
|
|
|
maps_coalesce="1"
|
2017-07-07 03:04:17 +08:00
|
|
|
DUMP_SYMS="${NM} -a"
|
2017-05-05 02:20:43 +08:00
|
|
|
SYM_PREFIX=""
|
2009-06-24 10:01:18 +08:00
|
|
|
case "${host}" in
|
2014-05-16 21:28:20 +08:00
|
|
|
*-*-darwin* | *-*-ios*)
|
2009-06-24 10:01:18 +08:00
|
|
|
abi="macho"
|
|
|
|
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"
|
2015-05-01 23:57:41 +08:00
|
|
|
DSO_LDFLAGS='-shared -Wl,-install_name,$(LIBDIR)/$(@F)'
|
2012-04-30 18:38:27 +08:00
|
|
|
SOREV="${rev}.${so}"
|
2013-12-04 13:49:36 +08:00
|
|
|
sbrk_deprecated="1"
|
2017-05-05 02:20:43 +08:00
|
|
|
SYM_PREFIX="_"
|
2009-06-24 10:01:18 +08:00
|
|
|
;;
|
|
|
|
*-*-freebsd*)
|
|
|
|
abi="elf"
|
2016-05-06 08:45:02 +08:00
|
|
|
AC_DEFINE([JEMALLOC_SYSCTL_VM_OVERCOMMIT], [ ])
|
2012-03-24 08:40:58 +08:00
|
|
|
force_lazy_lock="1"
|
2009-06-24 10:01:18 +08:00
|
|
|
;;
|
2014-08-05 09:06:02 +08:00
|
|
|
*-*-dragonfly*)
|
|
|
|
abi="elf"
|
|
|
|
;;
|
2015-04-07 18:21:19 +08:00
|
|
|
*-*-openbsd*)
|
|
|
|
abi="elf"
|
|
|
|
force_tls="0"
|
|
|
|
;;
|
|
|
|
*-*-bitrig*)
|
2015-01-25 17:18:32 +08:00
|
|
|
abi="elf"
|
|
|
|
;;
|
2016-11-11 07:35:29 +08:00
|
|
|
*-*-linux-android)
|
|
|
|
dnl syscall(2) and secure_getenv(3) are exposed by _GNU_SOURCE.
|
2016-12-16 23:18:55 +08:00
|
|
|
JE_APPEND_VS(CPPFLAGS, -D_GNU_SOURCE)
|
2016-11-11 07:35:29 +08:00
|
|
|
abi="elf"
|
2017-10-06 07:32:28 +08:00
|
|
|
AC_DEFINE([JEMALLOC_PURGE_MADVISE_DONTNEED_ZEROS], [ ])
|
2016-11-11 07:35:29 +08:00
|
|
|
AC_DEFINE([JEMALLOC_HAS_ALLOCA_H])
|
|
|
|
AC_DEFINE([JEMALLOC_PROC_SYS_VM_OVERCOMMIT_MEMORY], [ ])
|
|
|
|
AC_DEFINE([JEMALLOC_THREADED_INIT], [ ])
|
Introduce a backport of C11 atomics
This introduces a backport of C11 atomics. It has four implementations; ranked
in order of preference, they are:
- GCC/Clang __atomic builtins
- GCC/Clang __sync builtins
- MSVC _Interlocked builtins
- C11 atomics, from <stdatomic.h>
The primary advantages are:
- Close adherence to the standard API gives us a defined memory model.
- Type safety: atomic objects are now separate types from non-atomic ones, so
that it's impossible to mix up atomic and non-atomic updates (which is
undefined behavior that compilers are starting to take advantage of).
- Efficiency: we can specify ordering for operations, avoiding fences and
atomic operations on strongly ordered architectures (example:
`atomic_write_u32(ptr, val);` involves a CAS loop, whereas
`atomic_store(ptr, val, ATOMIC_RELEASE);` is a plain store.
This diff leaves in the current atomics API (implementing them in terms of the
backport). This lets us transition uses over piecemeal.
Testing:
This is by nature hard to test. I've manually tested the first three options on
Linux on gcc by futzing with the #defines manually, on freebsd with gcc and
clang, on MSVC, and on OS X with clang. All of these were x86 machines though,
and we don't have any test infrastructure set up for non-x86 platforms.
2017-01-26 01:54:27 +08:00
|
|
|
AC_DEFINE([JEMALLOC_C11_ATOMICS])
|
2016-11-11 07:35:29 +08:00
|
|
|
force_tls="0"
|
2017-04-25 00:14:31 +08:00
|
|
|
if test "${LG_SIZEOF_PTR}" = "3"; then
|
2017-04-27 07:26:12 +08:00
|
|
|
default_retain="1"
|
2017-04-18 06:54:53 +08:00
|
|
|
fi
|
2016-11-11 07:35:29 +08:00
|
|
|
;;
|
2017-08-08 02:51:09 +08:00
|
|
|
*-*-linux*)
|
2016-11-03 10:50:44 +08:00
|
|
|
dnl syscall(2) and secure_getenv(3) are exposed by _GNU_SOURCE.
|
2016-12-16 23:18:55 +08:00
|
|
|
JE_APPEND_VS(CPPFLAGS, -D_GNU_SOURCE)
|
2009-06-24 10:01:18 +08:00
|
|
|
abi="elf"
|
2017-10-06 07:32:28 +08:00
|
|
|
AC_DEFINE([JEMALLOC_PURGE_MADVISE_DONTNEED_ZEROS], [ ])
|
2012-12-03 09:58:40 +08:00
|
|
|
AC_DEFINE([JEMALLOC_HAS_ALLOCA_H])
|
2016-05-06 08:45:02 +08:00
|
|
|
AC_DEFINE([JEMALLOC_PROC_SYS_VM_OVERCOMMIT_MEMORY], [ ])
|
2012-04-06 02:06:23 +08:00
|
|
|
AC_DEFINE([JEMALLOC_THREADED_INIT], [ ])
|
2015-07-11 05:33:00 +08:00
|
|
|
AC_DEFINE([JEMALLOC_USE_CXX_THROW], [ ])
|
2017-04-25 00:14:31 +08:00
|
|
|
if test "${LG_SIZEOF_PTR}" = "3"; then
|
2017-04-27 07:26:12 +08:00
|
|
|
default_retain="1"
|
2017-04-18 06:54:53 +08:00
|
|
|
fi
|
2009-06-24 10:01:18 +08:00
|
|
|
;;
|
2017-08-08 02:51:09 +08:00
|
|
|
*-*-kfreebsd*)
|
|
|
|
dnl syscall(2) and secure_getenv(3) are exposed by _GNU_SOURCE.
|
|
|
|
JE_APPEND_VS(CPPFLAGS, -D_GNU_SOURCE)
|
|
|
|
abi="elf"
|
|
|
|
AC_DEFINE([JEMALLOC_HAS_ALLOCA_H])
|
|
|
|
AC_DEFINE([JEMALLOC_SYSCTL_VM_OVERCOMMIT], [ ])
|
|
|
|
AC_DEFINE([JEMALLOC_THREADED_INIT], [ ])
|
|
|
|
AC_DEFINE([JEMALLOC_USE_CXX_THROW], [ ])
|
|
|
|
;;
|
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
|
|
|
|
]])],
|
2016-10-07 23:47:16 +08:00
|
|
|
[abi="elf"],
|
2009-06-24 10:01:18 +08:00
|
|
|
[abi="aout"])
|
|
|
|
AC_MSG_RESULT([$abi])
|
|
|
|
;;
|
|
|
|
*-*-solaris2*)
|
|
|
|
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().
|
2016-12-16 23:18:55 +08:00
|
|
|
JE_APPEND_VS(CPPFLAGS, -D_POSIX_PTHREAD_SEMANTICS)
|
|
|
|
JE_APPEND_VS(LIBS, -lposix4 -lsocket -lnsl)
|
2009-06-24 10:01:18 +08:00
|
|
|
;;
|
2011-10-13 13:33:33 +08:00
|
|
|
*-ibm-aix*)
|
2017-04-25 00:14:31 +08:00
|
|
|
if test "${LG_SIZEOF_PTR}" = "3"; then
|
2011-10-13 13:33:33 +08:00
|
|
|
dnl 64bit AIX
|
|
|
|
LD_PRELOAD_VAR="LDR_PRELOAD64"
|
|
|
|
else
|
|
|
|
dnl 32bit AIX
|
|
|
|
LD_PRELOAD_VAR="LDR_PRELOAD"
|
|
|
|
fi
|
|
|
|
abi="xcoff"
|
|
|
|
;;
|
2014-09-22 22:53:16 +08:00
|
|
|
*-*-mingw* | *-*-cygwin*)
|
2012-04-22 12:27:46 +08:00
|
|
|
abi="pecoff"
|
|
|
|
force_tls="0"
|
2015-07-25 09:21:42 +08:00
|
|
|
maps_coalesce="0"
|
2012-04-22 12:27:46 +08:00
|
|
|
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"
|
2016-10-28 08:10:56 +08:00
|
|
|
link_whole_archive="1"
|
2012-04-30 18:38:31 +08:00
|
|
|
fi
|
2017-07-07 03:14:48 +08:00
|
|
|
case "${host}" in
|
|
|
|
*-*-cygwin*)
|
|
|
|
DUMP_SYMS="dumpbin /SYMBOLS"
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
;;
|
|
|
|
esac
|
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
|
2014-05-28 07:10:12 +08:00
|
|
|
|
|
|
|
JEMALLOC_USABLE_SIZE_CONST=const
|
|
|
|
AC_CHECK_HEADERS([malloc.h], [
|
|
|
|
AC_MSG_CHECKING([whether malloc_usable_size definition can use const argument])
|
|
|
|
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
|
|
|
|
[#include <malloc.h>
|
|
|
|
#include <stddef.h>
|
|
|
|
size_t malloc_usable_size(const void *ptr);
|
|
|
|
],
|
|
|
|
[])],[
|
|
|
|
AC_MSG_RESULT([yes])
|
|
|
|
],[
|
|
|
|
JEMALLOC_USABLE_SIZE_CONST=
|
|
|
|
AC_MSG_RESULT([no])
|
|
|
|
])
|
|
|
|
])
|
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])
|
2016-10-28 08:10:56 +08:00
|
|
|
AC_SUBST([link_whole_archive])
|
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])
|
2016-06-15 04:18:08 +08:00
|
|
|
AC_SUBST([TEST_LD_MODE])
|
2012-04-30 18:38:31 +08:00
|
|
|
AC_SUBST([MKLIB])
|
2013-08-20 18:48:19 +08:00
|
|
|
AC_SUBST([ARFLAGS])
|
|
|
|
AC_SUBST([AROUT])
|
2017-05-05 02:20:43 +08:00
|
|
|
AC_SUBST([DUMP_SYMS])
|
2012-05-03 03:30:51 +08:00
|
|
|
AC_SUBST([CC_MM])
|
2012-04-30 18:38:31 +08:00
|
|
|
|
2016-10-28 12:23:48 +08:00
|
|
|
dnl Determine whether libm must be linked to use e.g. log(3).
|
|
|
|
AC_SEARCH_LIBS([log], [m], , [AC_MSG_ERROR([Missing math functions])])
|
|
|
|
if test "x$ac_cv_search_log" != "xnone required" ; then
|
|
|
|
LM="$ac_cv_search_log"
|
|
|
|
else
|
|
|
|
LM=
|
|
|
|
fi
|
|
|
|
AC_SUBST(LM)
|
|
|
|
|
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
|
2016-12-16 23:18:55 +08:00
|
|
|
JE_CFLAGS_ADD([-fvisibility=hidden])
|
|
|
|
JE_CXXFLAGS_ADD([-fvisibility=hidden])
|
2011-03-16 01:25:59 +08:00
|
|
|
fi
|
|
|
|
fi
|
2012-04-04 13:30:05 +08:00
|
|
|
dnl Check for tls_model attribute support (clang 3.0 still lacks support).
|
2016-12-16 23:18:55 +08:00
|
|
|
JE_CFLAGS_SAVE()
|
|
|
|
JE_CFLAGS_ADD([-Werror])
|
|
|
|
JE_CFLAGS_ADD([-herror_on_warning])
|
2012-04-04 13:30:05 +08:00
|
|
|
JE_COMPILABLE([tls_model attribute], [],
|
|
|
|
[static __thread int
|
2014-09-16 16:42:33 +08:00
|
|
|
__attribute__((tls_model("initial-exec"), unused)) foo;
|
2012-04-04 13:30:05 +08:00
|
|
|
foo = 0;],
|
|
|
|
[je_cv_tls_model])
|
2016-12-16 23:18:55 +08:00
|
|
|
JE_CFLAGS_RESTORE()
|
2018-04-18 03:52:22 +08:00
|
|
|
dnl (Setting of JEMALLOC_TLS_MODEL is done later, after we've checked for
|
|
|
|
dnl --disable-initial-exec-tls)
|
|
|
|
|
2015-07-11 07:41:12 +08:00
|
|
|
dnl Check for alloc_size attribute support.
|
2016-12-16 23:18:55 +08:00
|
|
|
JE_CFLAGS_SAVE()
|
|
|
|
JE_CFLAGS_ADD([-Werror])
|
|
|
|
JE_CFLAGS_ADD([-herror_on_warning])
|
2015-07-11 07:45:32 +08:00
|
|
|
JE_COMPILABLE([alloc_size attribute], [#include <stdlib.h>],
|
|
|
|
[void *foo(size_t size) __attribute__((alloc_size(1)));],
|
2015-07-11 07:41:12 +08:00
|
|
|
[je_cv_alloc_size])
|
2016-12-16 23:18:55 +08:00
|
|
|
JE_CFLAGS_RESTORE()
|
2015-07-11 07:41:12 +08:00
|
|
|
if test "x${je_cv_alloc_size}" = "xyes" ; then
|
|
|
|
AC_DEFINE([JEMALLOC_HAVE_ATTR_ALLOC_SIZE], [ ])
|
|
|
|
fi
|
2015-07-23 06:44:47 +08:00
|
|
|
dnl Check for format(gnu_printf, ...) attribute support.
|
2016-12-16 23:18:55 +08:00
|
|
|
JE_CFLAGS_SAVE()
|
|
|
|
JE_CFLAGS_ADD([-Werror])
|
|
|
|
JE_CFLAGS_ADD([-herror_on_warning])
|
2015-07-23 06:44:47 +08:00
|
|
|
JE_COMPILABLE([format(gnu_printf, ...) attribute], [#include <stdlib.h>],
|
|
|
|
[void *foo(const char *format, ...) __attribute__((format(gnu_printf, 1, 2)));],
|
|
|
|
[je_cv_format_gnu_printf])
|
2016-12-16 23:18:55 +08:00
|
|
|
JE_CFLAGS_RESTORE()
|
2015-07-23 06:44:47 +08:00
|
|
|
if test "x${je_cv_format_gnu_printf}" = "xyes" ; then
|
|
|
|
AC_DEFINE([JEMALLOC_HAVE_ATTR_FORMAT_GNU_PRINTF], [ ])
|
|
|
|
fi
|
|
|
|
dnl Check for format(printf, ...) attribute support.
|
2016-12-16 23:18:55 +08:00
|
|
|
JE_CFLAGS_SAVE()
|
|
|
|
JE_CFLAGS_ADD([-Werror])
|
|
|
|
JE_CFLAGS_ADD([-herror_on_warning])
|
2015-07-23 06:44:47 +08:00
|
|
|
JE_COMPILABLE([format(printf, ...) attribute], [#include <stdlib.h>],
|
|
|
|
[void *foo(const char *format, ...) __attribute__((format(printf, 1, 2)));],
|
|
|
|
[je_cv_format_printf])
|
2016-12-16 23:18:55 +08:00
|
|
|
JE_CFLAGS_RESTORE()
|
2015-07-23 06:44:47 +08:00
|
|
|
if test "x${je_cv_format_printf}" = "xyes" ; then
|
|
|
|
AC_DEFINE([JEMALLOC_HAVE_ATTR_FORMAT_PRINTF], [ ])
|
|
|
|
fi
|
2011-03-16 01:25:59 +08:00
|
|
|
|
2019-03-16 08:19:16 +08:00
|
|
|
dnl Check for format_arg(...) attribute support.
|
|
|
|
JE_CFLAGS_SAVE()
|
|
|
|
JE_CFLAGS_ADD([-Werror])
|
|
|
|
JE_CFLAGS_ADD([-herror_on_warning])
|
|
|
|
JE_COMPILABLE([format(printf, ...) attribute], [#include <stdlib.h>],
|
|
|
|
[const char * __attribute__((__format_arg__(1))) foo(const char *format);],
|
|
|
|
[je_cv_format_arg])
|
|
|
|
JE_CFLAGS_RESTORE()
|
|
|
|
if test "x${je_cv_format_arg}" = "xyes" ; then
|
|
|
|
AC_DEFINE([JEMALLOC_HAVE_ATTR_FORMAT_ARG], [ ])
|
|
|
|
fi
|
|
|
|
|
2009-06-24 10:01:18 +08:00
|
|
|
dnl Support optional additions to rpath.
|
|
|
|
AC_ARG_WITH([rpath],
|
2009-12-29 16:09:15 +08:00
|
|
|
[AS_HELP_STRING([--with-rpath=<rpath>], [Colon-separated rpath (ELF systems only)])],
|
2009-06-24 10:01:18 +08:00
|
|
|
if test "x$with_rpath" = "xno" ; then
|
|
|
|
RPATH_EXTRA=
|
|
|
|
else
|
|
|
|
RPATH_EXTRA="`echo $with_rpath | tr \":\" \" \"`"
|
|
|
|
fi,
|
|
|
|
RPATH_EXTRA=
|
|
|
|
)
|
|
|
|
AC_SUBST([RPATH_EXTRA])
|
|
|
|
|
|
|
|
dnl Disable rules that do automatic regeneration of configure output by default.
|
|
|
|
AC_ARG_ENABLE([autogen],
|
2010-01-18 06:06:20 +08:00
|
|
|
[AS_HELP_STRING([--enable-autogen], [Automatically regenerate configure output])],
|
2009-06-24 10:01:18 +08:00
|
|
|
if test "x$enable_autogen" = "xno" ; then
|
|
|
|
enable_autogen="0"
|
|
|
|
else
|
|
|
|
enable_autogen="1"
|
|
|
|
fi
|
|
|
|
,
|
|
|
|
enable_autogen="0"
|
|
|
|
)
|
|
|
|
AC_SUBST([enable_autogen])
|
|
|
|
|
|
|
|
AC_PROG_INSTALL
|
|
|
|
AC_PROG_RANLIB
|
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
|
|
|
|
2019-04-19 19:44:18 +08:00
|
|
|
dnl Enable documentation
|
|
|
|
AC_ARG_ENABLE([doc],
|
|
|
|
[AS_HELP_STRING([--enable-documentation], [Build documentation])],
|
|
|
|
if test "x$enable_doc" = "xno" ; then
|
|
|
|
enable_doc="0"
|
|
|
|
else
|
|
|
|
enable_doc="1"
|
|
|
|
fi
|
|
|
|
,
|
|
|
|
enable_doc="1"
|
|
|
|
)
|
|
|
|
AC_SUBST([enable_doc])
|
|
|
|
|
2018-12-15 04:28:34 +08:00
|
|
|
dnl Enable shared libs
|
|
|
|
AC_ARG_ENABLE([shared],
|
|
|
|
[AS_HELP_STRING([--enable-shared], [Build shared libaries])],
|
|
|
|
if test "x$enable_shared" = "xno" ; then
|
|
|
|
enable_shared="0"
|
|
|
|
else
|
|
|
|
enable_shared="1"
|
|
|
|
fi
|
|
|
|
,
|
|
|
|
enable_shared="1"
|
|
|
|
)
|
|
|
|
AC_SUBST([enable_shared])
|
|
|
|
|
|
|
|
dnl Enable static libs
|
|
|
|
AC_ARG_ENABLE([static],
|
|
|
|
[AS_HELP_STRING([--enable-static], [Build static libaries])],
|
|
|
|
if test "x$enable_static" = "xno" ; then
|
|
|
|
enable_static="0"
|
|
|
|
else
|
|
|
|
enable_static="1"
|
|
|
|
fi
|
|
|
|
,
|
|
|
|
enable_static="1"
|
|
|
|
)
|
|
|
|
AC_SUBST([enable_static])
|
|
|
|
|
|
|
|
if test "$enable_shared$enable_static" = "00" ; then
|
|
|
|
AC_MSG_ERROR([Please enable one of shared or static builds])
|
|
|
|
fi
|
|
|
|
|
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=""])
|
|
|
|
|
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
|
|
|
)
|
2017-04-22 04:47:49 +08:00
|
|
|
if test "x$JEMALLOC_PREFIX" = "x" ; then
|
|
|
|
AC_DEFINE([JEMALLOC_IS_MALLOC])
|
|
|
|
else
|
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
|
2017-05-31 05:26:02 +08:00
|
|
|
AC_SUBST([JEMALLOC_PREFIX])
|
2015-06-24 09:47:07 +08:00
|
|
|
AC_SUBST([JEMALLOC_CPREFIX])
|
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]
|
|
|
|
)
|
|
|
|
|
2018-10-05 19:11:21 +08:00
|
|
|
public_syms="aligned_alloc calloc dallocx free mallctl mallctlbymib mallctlnametomib malloc malloc_conf malloc_message malloc_stats_print malloc_usable_size mallocx smallocx_${jemalloc_version_gid} nallocx posix_memalign rallocx realloc sallocx sdallocx xallocx"
|
2017-05-05 02:20:43 +08:00
|
|
|
dnl Check for additional platform-specific public API functions.
|
|
|
|
AC_CHECK_FUNC([memalign],
|
|
|
|
[AC_DEFINE([JEMALLOC_OVERRIDE_MEMALIGN], [ ])
|
|
|
|
public_syms="${public_syms} memalign"])
|
|
|
|
AC_CHECK_FUNC([valloc],
|
|
|
|
[AC_DEFINE([JEMALLOC_OVERRIDE_VALLOC], [ ])
|
|
|
|
public_syms="${public_syms} valloc"])
|
|
|
|
|
|
|
|
dnl Check for allocator-related functions that should be wrapped.
|
|
|
|
wrap_syms=
|
|
|
|
if test "x${JEMALLOC_PREFIX}" = "x" ; then
|
|
|
|
AC_CHECK_FUNC([__libc_calloc],
|
|
|
|
[AC_DEFINE([JEMALLOC_OVERRIDE___LIBC_CALLOC], [ ])
|
|
|
|
wrap_syms="${wrap_syms} __libc_calloc"])
|
|
|
|
AC_CHECK_FUNC([__libc_free],
|
|
|
|
[AC_DEFINE([JEMALLOC_OVERRIDE___LIBC_FREE], [ ])
|
|
|
|
wrap_syms="${wrap_syms} __libc_free"])
|
|
|
|
AC_CHECK_FUNC([__libc_malloc],
|
|
|
|
[AC_DEFINE([JEMALLOC_OVERRIDE___LIBC_MALLOC], [ ])
|
|
|
|
wrap_syms="${wrap_syms} __libc_malloc"])
|
|
|
|
AC_CHECK_FUNC([__libc_memalign],
|
|
|
|
[AC_DEFINE([JEMALLOC_OVERRIDE___LIBC_MEMALIGN], [ ])
|
|
|
|
wrap_syms="${wrap_syms} __libc_memalign"])
|
|
|
|
AC_CHECK_FUNC([__libc_realloc],
|
|
|
|
[AC_DEFINE([JEMALLOC_OVERRIDE___LIBC_REALLOC], [ ])
|
|
|
|
wrap_syms="${wrap_syms} __libc_realloc"])
|
|
|
|
AC_CHECK_FUNC([__libc_valloc],
|
|
|
|
[AC_DEFINE([JEMALLOC_OVERRIDE___LIBC_VALLOC], [ ])
|
|
|
|
wrap_syms="${wrap_syms} __libc_valloc"])
|
|
|
|
AC_CHECK_FUNC([__posix_memalign],
|
|
|
|
[AC_DEFINE([JEMALLOC_OVERRIDE___POSIX_MEMALIGN], [ ])
|
|
|
|
wrap_syms="${wrap_syms} __posix_memalign"])
|
|
|
|
fi
|
|
|
|
|
|
|
|
case "${host}" in
|
|
|
|
*-*-mingw* | *-*-cygwin*)
|
|
|
|
wrap_syms="${wrap_syms} tls_callback"
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
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])
|
|
|
|
|
2016-02-08 06:23:22 +08:00
|
|
|
dnl Specify default malloc_conf.
|
|
|
|
AC_ARG_WITH([malloc_conf],
|
|
|
|
[AS_HELP_STRING([--with-malloc-conf=<malloc_conf>], [config.malloc_conf options string])],
|
|
|
|
[JEMALLOC_CONFIG_MALLOC_CONF="$with_malloc_conf"],
|
|
|
|
[JEMALLOC_CONFIG_MALLOC_CONF=""]
|
|
|
|
)
|
|
|
|
config_malloc_conf="$JEMALLOC_CONFIG_MALLOC_CONF"
|
|
|
|
AC_DEFINE_UNQUOTED([JEMALLOC_CONFIG_MALLOC_CONF], ["$config_malloc_conf"])
|
|
|
|
|
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_])
|
|
|
|
|
2014-07-30 17:16:13 +08:00
|
|
|
cfgoutputs_in="Makefile.in"
|
2014-09-20 05:01:23 +08:00
|
|
|
cfgoutputs_in="${cfgoutputs_in} jemalloc.pc.in"
|
2014-07-30 17:16:13 +08:00
|
|
|
cfgoutputs_in="${cfgoutputs_in} doc/html.xsl.in"
|
|
|
|
cfgoutputs_in="${cfgoutputs_in} doc/manpages.xsl.in"
|
|
|
|
cfgoutputs_in="${cfgoutputs_in} doc/jemalloc.xml.in"
|
|
|
|
cfgoutputs_in="${cfgoutputs_in} include/jemalloc/jemalloc_macros.h.in"
|
|
|
|
cfgoutputs_in="${cfgoutputs_in} include/jemalloc/jemalloc_protos.h.in"
|
2014-09-08 10:55:03 +08:00
|
|
|
cfgoutputs_in="${cfgoutputs_in} include/jemalloc/jemalloc_typedefs.h.in"
|
2017-04-11 09:17:55 +08:00
|
|
|
cfgoutputs_in="${cfgoutputs_in} include/jemalloc/internal/jemalloc_preamble.h.in"
|
2014-07-30 17:16:13 +08:00
|
|
|
cfgoutputs_in="${cfgoutputs_in} test/test.sh.in"
|
|
|
|
cfgoutputs_in="${cfgoutputs_in} 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"
|
2014-09-20 05:01:23 +08:00
|
|
|
cfgoutputs_out="${cfgoutputs_out} jemalloc.pc"
|
2010-11-25 14:00:02 +08:00
|
|
|
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"
|
2014-09-08 10:55:03 +08:00
|
|
|
cfgoutputs_out="${cfgoutputs_out} include/jemalloc/jemalloc_typedefs.h"
|
2017-04-11 09:17:55 +08:00
|
|
|
cfgoutputs_out="${cfgoutputs_out} include/jemalloc/internal/jemalloc_preamble.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"
|
2014-09-20 05:01:23 +08:00
|
|
|
cfgoutputs_tup="${cfgoutputs_tup} jemalloc.pc:jemalloc.pc.in"
|
2010-11-25 14:00:02 +08:00
|
|
|
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"
|
2014-09-08 10:55:03 +08:00
|
|
|
cfgoutputs_tup="${cfgoutputs_tup} include/jemalloc/jemalloc_typedefs.h:include/jemalloc/jemalloc_typedefs.h.in"
|
2017-04-11 09:17:55 +08:00
|
|
|
cfgoutputs_tup="${cfgoutputs_tup} include/jemalloc/internal/jemalloc_preamble.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
|
|
|
|
2014-07-30 17:16:13 +08:00
|
|
|
cfghdrs_in="include/jemalloc/jemalloc_defs.h.in"
|
|
|
|
cfghdrs_in="${cfghdrs_in} include/jemalloc/internal/jemalloc_internal_defs.h.in"
|
2017-05-05 02:20:43 +08:00
|
|
|
cfghdrs_in="${cfghdrs_in} include/jemalloc/internal/private_symbols.sh"
|
2014-07-30 17:16:13 +08:00
|
|
|
cfghdrs_in="${cfghdrs_in} include/jemalloc/internal/private_namespace.sh"
|
|
|
|
cfghdrs_in="${cfghdrs_in} include/jemalloc/internal/public_namespace.sh"
|
|
|
|
cfghdrs_in="${cfghdrs_in} include/jemalloc/internal/public_unnamespace.sh"
|
|
|
|
cfghdrs_in="${cfghdrs_in} include/jemalloc/jemalloc_rename.sh"
|
|
|
|
cfghdrs_in="${cfghdrs_in} include/jemalloc/jemalloc_mangle.sh"
|
|
|
|
cfghdrs_in="${cfghdrs_in} include/jemalloc/jemalloc.sh"
|
|
|
|
cfghdrs_in="${cfghdrs_in} 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"
|
2017-05-05 02:20:43 +08:00
|
|
|
cfghdrs_out="${cfghdrs_out} include/jemalloc/internal/private_symbols.awk"
|
|
|
|
cfghdrs_out="${cfghdrs_out} include/jemalloc/internal/private_symbols_jet.awk"
|
2014-01-17 09:38:01 +08:00
|
|
|
cfghdrs_out="${cfghdrs_out} include/jemalloc/internal/public_symbols.txt"
|
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="${cfghdrs_out} include/jemalloc/internal/public_namespace.h"
|
|
|
|
cfghdrs_out="${cfghdrs_out} include/jemalloc/internal/public_unnamespace.h"
|
2014-01-17 09:38:01 +08:00
|
|
|
cfghdrs_out="${cfghdrs_out} include/jemalloc/jemalloc_protos_jet.h"
|
|
|
|
cfghdrs_out="${cfghdrs_out} include/jemalloc/jemalloc_rename.h"
|
|
|
|
cfghdrs_out="${cfghdrs_out} include/jemalloc/jemalloc_mangle.h"
|
|
|
|
cfghdrs_out="${cfghdrs_out} include/jemalloc/jemalloc_mangle_jet.h"
|
|
|
|
cfghdrs_out="${cfghdrs_out} include/jemalloc/internal/jemalloc_internal_defs.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"
|
2014-07-30 17:16:13 +08:00
|
|
|
cfghdrs_tup="${cfghdrs_tup} include/jemalloc/internal/jemalloc_internal_defs.h:include/jemalloc/internal/jemalloc_internal_defs.h.in"
|
|
|
|
cfghdrs_tup="${cfghdrs_tup} test/include/test/jemalloc_test_defs.h:test/include/test/jemalloc_test_defs.h.in"
|
2010-01-17 17:49:20 +08:00
|
|
|
|
2018-10-05 19:11:21 +08:00
|
|
|
dnl ============================================================================
|
|
|
|
dnl jemalloc build options.
|
|
|
|
dnl
|
|
|
|
|
2009-06-24 10:01:18 +08:00
|
|
|
dnl Do not compile with debugging by default.
|
|
|
|
AC_ARG_ENABLE([debug],
|
2015-03-19 12:06:58 +08:00
|
|
|
[AS_HELP_STRING([--enable-debug],
|
2017-04-22 02:00:36 +08:00
|
|
|
[Build debugging code])],
|
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"]
|
|
|
|
)
|
2015-02-16 12:12:06 +08:00
|
|
|
if test "x$enable_debug" = "x1" ; then
|
|
|
|
AC_DEFINE([JEMALLOC_DEBUG], [ ])
|
|
|
|
fi
|
2015-03-19 12:06:58 +08:00
|
|
|
if test "x$enable_debug" = "x1" ; then
|
|
|
|
AC_DEFINE([JEMALLOC_DEBUG], [ ])
|
|
|
|
fi
|
2009-06-24 10:01:18 +08:00
|
|
|
AC_SUBST([enable_debug])
|
|
|
|
|
|
|
|
dnl Only optimize if not debugging.
|
2016-12-16 23:18:55 +08:00
|
|
|
if test "x$enable_debug" = "x0" ; then
|
|
|
|
if test "x$GCC" = "xyes" ; then
|
|
|
|
JE_CFLAGS_ADD([-O3])
|
|
|
|
JE_CXXFLAGS_ADD([-O3])
|
|
|
|
JE_CFLAGS_ADD([-funroll-loops])
|
|
|
|
elif test "x$je_cv_msvc" = "xyes" ; then
|
|
|
|
JE_CFLAGS_ADD([-O2])
|
|
|
|
JE_CXXFLAGS_ADD([-O2])
|
|
|
|
else
|
|
|
|
JE_CFLAGS_ADD([-O])
|
|
|
|
JE_CXXFLAGS_ADD([-O])
|
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])
|
|
|
|
|
2017-11-16 01:26:49 +08:00
|
|
|
dnl Do not enable smallocx by default.
|
|
|
|
AC_ARG_ENABLE([experimental_smallocx],
|
|
|
|
[AS_HELP_STRING([--enable-experimental-smallocx], [Enable experimental smallocx API])],
|
|
|
|
[if test "x$enable_experimental_smallocx" = "xno" ; then
|
|
|
|
enable_experimental_smallocx="0"
|
|
|
|
else
|
|
|
|
enable_experimental_smallocx="1"
|
|
|
|
fi
|
|
|
|
],
|
|
|
|
[enable_experimental_smallocx="0"]
|
|
|
|
)
|
|
|
|
if test "x$enable_experimental_smallocx" = "x1" ; then
|
|
|
|
AC_DEFINE([JEMALLOC_EXPERIMENTAL_SMALLOCX_API])
|
|
|
|
fi
|
|
|
|
AC_SUBST([enable_experimental_smallocx])
|
|
|
|
|
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
|
2016-12-16 23:18:55 +08:00
|
|
|
AC_CHECK_LIB([unwind], [unw_backtrace], [JE_APPEND_VS(LIBS, $LUNWIND)],
|
2011-03-16 13:23:12 +08:00
|
|
|
[enable_prof_libunwind="0"])
|
|
|
|
else
|
2016-12-16 23:18:55 +08:00
|
|
|
JE_APPEND_VS(LIBS, $LUNWIND)
|
2011-03-16 13:23:12 +08:00
|
|
|
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"])
|
2017-02-18 16:02:23 +08:00
|
|
|
if test "x${enable_prof_libgcc}" = "x1" ; then
|
|
|
|
AC_CHECK_LIB([gcc], [_Unwind_Backtrace], [JE_APPEND_VS(LIBS, -lgcc)], [enable_prof_libgcc="0"])
|
|
|
|
fi
|
2011-03-16 13:23:12 +08:00
|
|
|
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
|
2016-12-16 23:18:55 +08:00
|
|
|
JE_CFLAGS_ADD([-fno-omit-frame-pointer])
|
2011-03-16 13:23:12 +08:00
|
|
|
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
|
2016-10-28 12:23:48 +08:00
|
|
|
dnl Heap profiling uses the log(3) function.
|
2016-12-16 23:18:55 +08:00
|
|
|
JE_APPEND_VS(LIBS, $LM)
|
2013-12-06 15:01:50 +08:00
|
|
|
|
2011-03-16 13:23:12 +08:00
|
|
|
AC_DEFINE([JEMALLOC_PROF], [ ])
|
|
|
|
fi
|
|
|
|
AC_SUBST([enable_prof])
|
|
|
|
|
2015-07-25 09:21:42 +08:00
|
|
|
dnl Indicate whether adjacent virtual memory mappings automatically coalesce
|
|
|
|
dnl (and fragment on demand).
|
|
|
|
if test "x${maps_coalesce}" = "x1" ; then
|
|
|
|
AC_DEFINE([JEMALLOC_MAPS_COALESCE], [ ])
|
|
|
|
fi
|
|
|
|
|
2017-04-28 06:51:35 +08:00
|
|
|
dnl Indicate whether to retain memory (rather than using munmap()) by default.
|
2017-04-27 07:26:12 +08:00
|
|
|
if test "x$default_retain" = "x1" ; then
|
|
|
|
AC_DEFINE([JEMALLOC_RETAIN], [ ])
|
2012-04-17 08:52:27 +08:00
|
|
|
fi
|
|
|
|
|
2014-04-16 03:09:48 +08:00
|
|
|
dnl Enable allocation from DSS if supported by the OS.
|
|
|
|
have_dss="1"
|
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
|
2014-06-20 07:11:43 +08:00
|
|
|
if test "x$sbrk_deprecated" = "x1" ; then
|
2013-12-04 13:49:36 +08:00
|
|
|
AC_MSG_RESULT([Disabling dss allocation because sbrk is deprecated])
|
2014-04-16 03:09:48 +08:00
|
|
|
have_dss="0"
|
2013-12-04 13:49:36 +08:00
|
|
|
fi
|
2012-04-12 16:13:03 +08:00
|
|
|
else
|
2014-04-16 03:09:48 +08:00
|
|
|
have_dss="0"
|
2012-04-12 16:13:03 +08:00
|
|
|
fi
|
|
|
|
|
2014-04-16 03:09:48 +08:00
|
|
|
if test "x$have_dss" = "x1" ; then
|
2009-06-24 10:01:18 +08:00
|
|
|
AC_DEFINE([JEMALLOC_DSS], [ ])
|
|
|
|
fi
|
|
|
|
|
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],
|
2016-04-06 09:18:15 +08:00
|
|
|
[AS_HELP_STRING([--disable-fill], [Disable support for junk/zero filling])],
|
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])
|
|
|
|
|
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])
|
|
|
|
|
2015-05-05 00:58:36 +08:00
|
|
|
dnl Support cache-oblivious allocation alignment by default.
|
|
|
|
AC_ARG_ENABLE([cache-oblivious],
|
|
|
|
[AS_HELP_STRING([--disable-cache-oblivious],
|
|
|
|
[Disable support for cache-oblivious allocation alignment])],
|
|
|
|
[if test "x$enable_cache_oblivious" = "xno" ; then
|
|
|
|
enable_cache_oblivious="0"
|
|
|
|
else
|
|
|
|
enable_cache_oblivious="1"
|
|
|
|
fi
|
|
|
|
],
|
|
|
|
[enable_cache_oblivious="1"]
|
|
|
|
)
|
|
|
|
if test "x$enable_cache_oblivious" = "x1" ; then
|
|
|
|
AC_DEFINE([JEMALLOC_CACHE_OBLIVIOUS], [ ])
|
|
|
|
fi
|
|
|
|
AC_SUBST([enable_cache_oblivious])
|
|
|
|
|
2017-07-20 07:36:46 +08:00
|
|
|
dnl Do not log by default.
|
|
|
|
AC_ARG_ENABLE([log],
|
|
|
|
[AS_HELP_STRING([--enable-log], [Support debug logging])],
|
|
|
|
[if test "x$enable_log" = "xno" ; then
|
|
|
|
enable_log="0"
|
|
|
|
else
|
|
|
|
enable_log="1"
|
|
|
|
fi
|
|
|
|
],
|
|
|
|
[enable_log="0"]
|
|
|
|
)
|
|
|
|
if test "x$enable_log" = "x1" ; then
|
|
|
|
AC_DEFINE([JEMALLOC_LOG], [ ])
|
|
|
|
fi
|
|
|
|
AC_SUBST([enable_log])
|
2016-06-18 04:28:39 +08:00
|
|
|
|
2018-08-04 03:47:40 +08:00
|
|
|
dnl Do not use readlinkat by default
|
|
|
|
AC_ARG_ENABLE([readlinkat],
|
|
|
|
[AS_HELP_STRING([--enable-readlinkat], [Use readlinkat over readlink])],
|
|
|
|
[if test "x$enable_readlinkat" = "xno" ; then
|
|
|
|
enable_readlinkat="0"
|
|
|
|
else
|
|
|
|
enable_readlinkat="1"
|
|
|
|
fi
|
|
|
|
],
|
|
|
|
[enable_readlinkat="0"]
|
|
|
|
)
|
|
|
|
if test "x$enable_readlinkat" = "x1" ; then
|
|
|
|
AC_DEFINE([JEMALLOC_READLINKAT], [ ])
|
|
|
|
fi
|
|
|
|
AC_SUBST([enable_readlinkat])
|
|
|
|
|
2019-03-20 07:04:35 +08:00
|
|
|
dnl Avoid extra safety checks by default
|
|
|
|
AC_ARG_ENABLE([opt-safety-checks],
|
|
|
|
[AS_HELP_STRING([--enable-opt-safety-checks],
|
|
|
|
[Perform certain low-overhead checks, even in opt mode])],
|
|
|
|
[if test "x$enable_opt_safety_checks" = "xno" ; then
|
|
|
|
enable_opt_safety_checks="0"
|
2019-01-23 05:59:23 +08:00
|
|
|
else
|
2019-03-20 07:04:35 +08:00
|
|
|
enable_opt_safety_checks="1"
|
2019-01-23 05:59:23 +08:00
|
|
|
fi
|
|
|
|
],
|
2019-03-20 07:04:35 +08:00
|
|
|
[enable_opt_safety_checks="0"]
|
2019-01-23 05:59:23 +08:00
|
|
|
)
|
2019-03-20 07:04:35 +08:00
|
|
|
if test "x$enable_opt_safety_checks" = "x1" ; then
|
|
|
|
AC_DEFINE([JEMALLOC_OPT_SAFETY_CHECKS], [ ])
|
2019-01-23 05:59:23 +08:00
|
|
|
fi
|
2019-03-20 07:04:35 +08:00
|
|
|
AC_SUBST([enable_opt_safety_checks])
|
2016-06-18 04:28:39 +08:00
|
|
|
|
|
|
|
JE_COMPILABLE([a program using __builtin_unreachable], [
|
|
|
|
void foo (void) {
|
|
|
|
__builtin_unreachable();
|
|
|
|
}
|
|
|
|
], [
|
|
|
|
{
|
|
|
|
foo();
|
|
|
|
}
|
|
|
|
], [je_cv_gcc_builtin_unreachable])
|
2016-07-13 06:52:18 +08:00
|
|
|
if test "x${je_cv_gcc_builtin_unreachable}" = "xyes" ; then
|
2016-06-18 04:28:39 +08:00
|
|
|
AC_DEFINE([JEMALLOC_INTERNAL_UNREACHABLE], [__builtin_unreachable])
|
|
|
|
else
|
|
|
|
AC_DEFINE([JEMALLOC_INTERNAL_UNREACHABLE], [abort])
|
|
|
|
fi
|
|
|
|
|
2014-06-04 11:12:55 +08:00
|
|
|
dnl ============================================================================
|
|
|
|
dnl Check for __builtin_ffsl(), then ffsl(3), and fail if neither are found.
|
|
|
|
dnl One of those two functions should (theoretically) exist on all platforms
|
|
|
|
dnl that jemalloc currently has a chance of functioning on without modification.
|
2016-02-21 15:41:33 +08:00
|
|
|
dnl We additionally assume ffs[ll]() or __builtin_ffs[ll]() are defined if
|
2014-06-04 11:12:55 +08:00
|
|
|
dnl ffsl() or __builtin_ffsl() are defined, respectively.
|
|
|
|
JE_COMPILABLE([a program using __builtin_ffsl], [
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <strings.h>
|
|
|
|
#include <string.h>
|
|
|
|
], [
|
|
|
|
{
|
|
|
|
int rv = __builtin_ffsl(0x08);
|
|
|
|
printf("%d\n", rv);
|
|
|
|
}
|
|
|
|
], [je_cv_gcc_builtin_ffsl])
|
2014-06-20 07:11:43 +08:00
|
|
|
if test "x${je_cv_gcc_builtin_ffsl}" = "xyes" ; then
|
2016-02-21 15:41:33 +08:00
|
|
|
AC_DEFINE([JEMALLOC_INTERNAL_FFSLL], [__builtin_ffsll])
|
2014-06-04 11:12:55 +08:00
|
|
|
AC_DEFINE([JEMALLOC_INTERNAL_FFSL], [__builtin_ffsl])
|
|
|
|
AC_DEFINE([JEMALLOC_INTERNAL_FFS], [__builtin_ffs])
|
|
|
|
else
|
|
|
|
JE_COMPILABLE([a program using ffsl], [
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <strings.h>
|
|
|
|
#include <string.h>
|
|
|
|
], [
|
|
|
|
{
|
|
|
|
int rv = ffsl(0x08);
|
|
|
|
printf("%d\n", rv);
|
|
|
|
}
|
|
|
|
], [je_cv_function_ffsl])
|
2014-06-20 07:11:43 +08:00
|
|
|
if test "x${je_cv_function_ffsl}" = "xyes" ; then
|
2016-02-21 15:41:33 +08:00
|
|
|
AC_DEFINE([JEMALLOC_INTERNAL_FFSLL], [ffsll])
|
2014-06-04 11:12:55 +08:00
|
|
|
AC_DEFINE([JEMALLOC_INTERNAL_FFSL], [ffsl])
|
|
|
|
AC_DEFINE([JEMALLOC_INTERNAL_FFS], [ffs])
|
|
|
|
else
|
|
|
|
AC_MSG_ERROR([Cannot build without ffsl(3) or __builtin_ffsl()])
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2018-10-30 07:01:09 +08:00
|
|
|
JE_COMPILABLE([a program using __builtin_popcountl], [
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <strings.h>
|
|
|
|
#include <string.h>
|
|
|
|
], [
|
|
|
|
{
|
|
|
|
int rv = __builtin_popcountl(0x08);
|
|
|
|
printf("%d\n", rv);
|
|
|
|
}
|
|
|
|
], [je_cv_gcc_builtin_popcountl])
|
|
|
|
if test "x${je_cv_gcc_builtin_popcountl}" = "xyes" ; then
|
|
|
|
AC_DEFINE([JEMALLOC_INTERNAL_POPCOUNT], [__builtin_popcount])
|
|
|
|
AC_DEFINE([JEMALLOC_INTERNAL_POPCOUNTL], [__builtin_popcountl])
|
|
|
|
fi
|
|
|
|
|
2014-10-10 08:54:06 +08:00
|
|
|
AC_ARG_WITH([lg_quantum],
|
|
|
|
[AS_HELP_STRING([--with-lg-quantum=<lg-quantum>],
|
|
|
|
[Base 2 log of minimum allocation alignment])],
|
2014-10-11 13:34:25 +08:00
|
|
|
[LG_QUANTA="$with_lg_quantum"],
|
|
|
|
[LG_QUANTA="3 4"])
|
|
|
|
if test "x$with_lg_quantum" != "x" ; then
|
|
|
|
AC_DEFINE_UNQUOTED([LG_QUANTUM], [$with_lg_quantum])
|
|
|
|
fi
|
2014-10-10 08:54:06 +08:00
|
|
|
|
|
|
|
AC_ARG_WITH([lg_page],
|
|
|
|
[AS_HELP_STRING([--with-lg-page=<lg-page>], [Base 2 log of system page size])],
|
|
|
|
[LG_PAGE="$with_lg_page"], [LG_PAGE="detect"])
|
2015-02-04 04:39:31 +08:00
|
|
|
if test "x$LG_PAGE" = "xdetect"; then
|
2014-10-10 08:54:06 +08:00
|
|
|
AC_CACHE_CHECK([LG_PAGE],
|
|
|
|
[je_cv_lg_page],
|
2012-03-06 04:15:36 +08:00
|
|
|
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;
|
|
|
|
}
|
2014-06-04 11:12:55 +08:00
|
|
|
result = JEMALLOC_INTERNAL_FFSL(result) - 1;
|
2012-04-22 12:27:46 +08:00
|
|
|
|
2009-06-24 10:01:18 +08:00
|
|
|
f = fopen("conftest.out", "w");
|
|
|
|
if (f == NULL) {
|
|
|
|
return 1;
|
|
|
|
}
|
2016-01-30 20:38:33 +08:00
|
|
|
fprintf(f, "%d", result);
|
2012-04-04 13:30:05 +08:00
|
|
|
fclose(f);
|
2009-06-24 10:01:18 +08:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
]])],
|
2014-10-10 08:54:06 +08:00
|
|
|
[je_cv_lg_page=`cat conftest.out`],
|
|
|
|
[je_cv_lg_page=undefined],
|
|
|
|
[je_cv_lg_page=12]))
|
|
|
|
fi
|
|
|
|
if test "x${je_cv_lg_page}" != "x" ; then
|
|
|
|
LG_PAGE="${je_cv_lg_page}"
|
|
|
|
fi
|
|
|
|
if test "x${LG_PAGE}" != "xundefined" ; then
|
|
|
|
AC_DEFINE_UNQUOTED([LG_PAGE], [$LG_PAGE])
|
2012-03-06 04:15:36 +08:00
|
|
|
else
|
2014-10-10 08:54:06 +08:00
|
|
|
AC_MSG_ERROR([cannot determine value for LG_PAGE])
|
2012-03-06 04:15:36 +08:00
|
|
|
fi
|
2009-06-24 10:01:18 +08:00
|
|
|
|
2016-11-18 05:36:17 +08:00
|
|
|
AC_ARG_WITH([lg_hugepage],
|
|
|
|
[AS_HELP_STRING([--with-lg-hugepage=<lg-hugepage>],
|
2017-03-01 19:58:38 +08:00
|
|
|
[Base 2 log of system huge page size])],
|
2016-11-18 05:36:17 +08:00
|
|
|
[je_cv_lg_hugepage="${with_lg_hugepage}"],
|
|
|
|
[je_cv_lg_hugepage=""])
|
|
|
|
if test "x${je_cv_lg_hugepage}" = "x" ; then
|
|
|
|
dnl Look in /proc/meminfo (Linux-specific) for information on the default huge
|
|
|
|
dnl page size, if any. The relevant line looks like:
|
|
|
|
dnl
|
|
|
|
dnl Hugepagesize: 2048 kB
|
|
|
|
if test -e "/proc/meminfo" ; then
|
|
|
|
hpsk=[`cat /proc/meminfo 2>/dev/null | \
|
|
|
|
grep -e '^Hugepagesize:[[:space:]]\+[0-9]\+[[:space:]]kB$' | \
|
|
|
|
awk '{print $2}'`]
|
|
|
|
if test "x${hpsk}" != "x" ; then
|
|
|
|
je_cv_lg_hugepage=10
|
|
|
|
while test "${hpsk}" -gt 1 ; do
|
|
|
|
hpsk="$((hpsk / 2))"
|
|
|
|
je_cv_lg_hugepage="$((je_cv_lg_hugepage + 1))"
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
dnl Set default if unable to automatically configure.
|
|
|
|
if test "x${je_cv_lg_hugepage}" = "x" ; then
|
|
|
|
je_cv_lg_hugepage=21
|
|
|
|
fi
|
|
|
|
fi
|
2017-06-24 03:35:17 +08:00
|
|
|
if test "x${LG_PAGE}" != "xundefined" -a \
|
|
|
|
"${je_cv_lg_hugepage}" -lt "${LG_PAGE}" ; then
|
|
|
|
AC_MSG_ERROR([Huge page size (2^${je_cv_lg_hugepage}) must be at least page size (2^${LG_PAGE})])
|
|
|
|
fi
|
2016-11-18 05:36:17 +08:00
|
|
|
AC_DEFINE_UNQUOTED([LG_HUGEPAGE], [${je_cv_lg_hugepage}])
|
|
|
|
|
2018-06-08 03:27:19 +08:00
|
|
|
dnl ============================================================================
|
|
|
|
dnl Enable libdl by default.
|
|
|
|
AC_ARG_ENABLE([libdl],
|
|
|
|
[AS_HELP_STRING([--disable-libdl],
|
|
|
|
[Do not use libdl])],
|
|
|
|
[if test "x$enable_libdl" = "xno" ; then
|
|
|
|
enable_libdl="0"
|
|
|
|
else
|
|
|
|
enable_libdl="1"
|
|
|
|
fi
|
|
|
|
],
|
|
|
|
[enable_libdl="1"]
|
|
|
|
)
|
|
|
|
AC_SUBST([libdl])
|
|
|
|
|
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
|
2017-03-18 03:42:33 +08:00
|
|
|
AC_DEFINE([JEMALLOC_HAVE_PTHREAD], [ ])
|
2012-04-22 12:27:46 +08:00
|
|
|
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.
|
2019-01-08 09:31:53 +08:00
|
|
|
AC_CHECK_LIB([pthread], [pthread_create], [JE_APPEND_VS(LIBS, -pthread)],
|
2012-04-22 12:27:46 +08:00
|
|
|
[AC_SEARCH_LIBS([pthread_create], , ,
|
|
|
|
AC_MSG_ERROR([libpthread is missing]))])
|
2017-03-18 03:42:33 +08:00
|
|
|
wrap_syms="${wrap_syms} pthread_create"
|
2017-06-09 13:07:21 +08:00
|
|
|
have_pthread="1"
|
2018-06-08 03:27:19 +08:00
|
|
|
|
|
|
|
dnl Check if we have dlsym support.
|
|
|
|
if test "x$enable_libdl" = "x1" ; then
|
|
|
|
have_dlsym="1"
|
|
|
|
AC_CHECK_HEADERS([dlfcn.h],
|
|
|
|
AC_CHECK_FUNC([dlsym], [],
|
|
|
|
[AC_CHECK_LIB([dl], [dlsym], [LIBS="$LIBS -ldl"], [have_dlsym="0"])]),
|
|
|
|
[have_dlsym="0"])
|
|
|
|
if test "x$have_dlsym" = "x1" ; then
|
|
|
|
AC_DEFINE([JEMALLOC_HAVE_DLSYM], [ ])
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
have_dlsym="0"
|
2017-03-18 03:42:33 +08:00
|
|
|
fi
|
2018-06-08 03:27:19 +08:00
|
|
|
|
2016-11-18 07:14:57 +08:00
|
|
|
JE_COMPILABLE([pthread_atfork(3)], [
|
|
|
|
#include <pthread.h>
|
|
|
|
], [
|
|
|
|
pthread_atfork((void *)0, (void *)0, (void *)0);
|
|
|
|
], [je_cv_pthread_atfork])
|
|
|
|
if test "x${je_cv_pthread_atfork}" = "xyes" ; then
|
|
|
|
AC_DEFINE([JEMALLOC_HAVE_PTHREAD_ATFORK], [ ])
|
|
|
|
fi
|
2017-06-24 00:58:35 +08:00
|
|
|
dnl Check if pthread_setname_np is available with the expected API.
|
|
|
|
JE_COMPILABLE([pthread_setname_np(3)], [
|
|
|
|
#include <pthread.h>
|
|
|
|
], [
|
|
|
|
pthread_setname_np(pthread_self(), "setname_test");
|
|
|
|
], [je_cv_pthread_setname_np])
|
|
|
|
if test "x${je_cv_pthread_setname_np}" = "xyes" ; then
|
|
|
|
AC_DEFINE([JEMALLOC_HAVE_PTHREAD_SETNAME_NP], [ ])
|
|
|
|
fi
|
2012-04-22 12:27:46 +08:00
|
|
|
fi
|
2009-06-24 10:01:18 +08:00
|
|
|
|
2017-02-28 09:35:19 +08:00
|
|
|
JE_APPEND_VS(CPPFLAGS, -D_REENTRANT)
|
2009-06-24 10:01:18 +08:00
|
|
|
|
2016-05-04 12:28:20 +08:00
|
|
|
dnl Check whether clock_gettime(2) is in libc or librt.
|
|
|
|
AC_SEARCH_LIBS([clock_gettime], [rt])
|
2015-09-16 05:59:56 +08:00
|
|
|
|
2016-06-15 05:20:28 +08:00
|
|
|
dnl Cray wrapper compiler often adds `-lrt` when using `-static`. Check with
|
|
|
|
dnl `-dynamic` as well in case a user tries to dynamically link in jemalloc
|
|
|
|
if test "x$je_cv_cray_prgenv_wrapper" = "xyes" ; then
|
|
|
|
if test "$ac_cv_search_clock_gettime" != "-lrt"; then
|
2016-12-16 23:18:55 +08:00
|
|
|
JE_CFLAGS_SAVE()
|
2016-06-15 05:20:28 +08:00
|
|
|
|
|
|
|
unset ac_cv_search_clock_gettime
|
2016-12-16 23:18:55 +08:00
|
|
|
JE_CFLAGS_ADD([-dynamic])
|
2016-06-15 05:20:28 +08:00
|
|
|
AC_SEARCH_LIBS([clock_gettime], [rt])
|
|
|
|
|
2016-12-16 23:18:55 +08:00
|
|
|
JE_CFLAGS_RESTORE()
|
2016-06-15 05:20:28 +08:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2016-10-30 13:55:08 +08:00
|
|
|
dnl check for CLOCK_MONOTONIC_COARSE (Linux-specific).
|
|
|
|
JE_COMPILABLE([clock_gettime(CLOCK_MONOTONIC_COARSE, ...)], [
|
2016-10-07 23:47:16 +08:00
|
|
|
#include <time.h>
|
|
|
|
], [
|
|
|
|
struct timespec ts;
|
|
|
|
|
2016-10-30 13:55:08 +08:00
|
|
|
clock_gettime(CLOCK_MONOTONIC_COARSE, &ts);
|
|
|
|
], [je_cv_clock_monotonic_coarse])
|
|
|
|
if test "x${je_cv_clock_monotonic_coarse}" = "xyes" ; then
|
|
|
|
AC_DEFINE([JEMALLOC_HAVE_CLOCK_MONOTONIC_COARSE])
|
2016-10-07 23:47:16 +08:00
|
|
|
fi
|
|
|
|
|
|
|
|
dnl check for CLOCK_MONOTONIC.
|
|
|
|
JE_COMPILABLE([clock_gettime(CLOCK_MONOTONIC, ...)], [
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <time.h>
|
|
|
|
], [
|
|
|
|
struct timespec ts;
|
|
|
|
|
|
|
|
clock_gettime(CLOCK_MONOTONIC, &ts);
|
|
|
|
#if !defined(_POSIX_MONOTONIC_CLOCK) || _POSIX_MONOTONIC_CLOCK < 0
|
|
|
|
# error _POSIX_MONOTONIC_CLOCK missing/invalid
|
|
|
|
#endif
|
|
|
|
], [je_cv_clock_monotonic])
|
|
|
|
if test "x${je_cv_clock_monotonic}" = "xyes" ; then
|
|
|
|
AC_DEFINE([JEMALLOC_HAVE_CLOCK_MONOTONIC])
|
|
|
|
fi
|
|
|
|
|
|
|
|
dnl Check for mach_absolute_time().
|
|
|
|
JE_COMPILABLE([mach_absolute_time()], [
|
|
|
|
#include <mach/mach_time.h>
|
|
|
|
], [
|
|
|
|
mach_absolute_time();
|
|
|
|
], [je_cv_mach_absolute_time])
|
|
|
|
if test "x${je_cv_mach_absolute_time}" = "xyes" ; then
|
|
|
|
AC_DEFINE([JEMALLOC_HAVE_MACH_ABSOLUTE_TIME])
|
|
|
|
fi
|
|
|
|
|
2016-12-04 08:47:36 +08:00
|
|
|
dnl Use syscall(2) (if available) by default.
|
|
|
|
AC_ARG_ENABLE([syscall],
|
|
|
|
[AS_HELP_STRING([--disable-syscall], [Disable use of syscall(2)])],
|
|
|
|
[if test "x$enable_syscall" = "xno" ; then
|
|
|
|
enable_syscall="0"
|
|
|
|
else
|
|
|
|
enable_syscall="1"
|
|
|
|
fi
|
|
|
|
],
|
|
|
|
[enable_syscall="1"]
|
|
|
|
)
|
|
|
|
if test "x$enable_syscall" = "x1" ; then
|
|
|
|
dnl Check if syscall(2) is usable. Treat warnings as errors, so that e.g. OS
|
|
|
|
dnl X 10.12's deprecation warning prevents use.
|
2016-12-16 23:18:55 +08:00
|
|
|
JE_CFLAGS_SAVE()
|
|
|
|
JE_CFLAGS_ADD([-Werror])
|
2016-12-04 08:47:36 +08:00
|
|
|
JE_COMPILABLE([syscall(2)], [
|
2016-11-03 10:18:33 +08:00
|
|
|
#include <sys/syscall.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
], [
|
|
|
|
syscall(SYS_write, 2, "hello", 5);
|
|
|
|
],
|
2016-12-04 08:47:36 +08:00
|
|
|
[je_cv_syscall])
|
2016-12-16 23:18:55 +08:00
|
|
|
JE_CFLAGS_RESTORE()
|
2016-12-04 08:47:36 +08:00
|
|
|
if test "x$je_cv_syscall" = "xyes" ; then
|
|
|
|
AC_DEFINE([JEMALLOC_USE_SYSCALL], [ ])
|
|
|
|
fi
|
2016-11-03 10:18:33 +08:00
|
|
|
fi
|
|
|
|
|
2014-12-10 06:41:34 +08:00
|
|
|
dnl Check if the GNU-specific secure_getenv function exists.
|
|
|
|
AC_CHECK_FUNC([secure_getenv],
|
|
|
|
[have_secure_getenv="1"],
|
|
|
|
[have_secure_getenv="0"]
|
|
|
|
)
|
|
|
|
if test "x$have_secure_getenv" = "x1" ; then
|
|
|
|
AC_DEFINE([JEMALLOC_HAVE_SECURE_GETENV], [ ])
|
|
|
|
fi
|
|
|
|
|
Implement per-CPU arena.
The new feature, opt.percpu_arena, determines thread-arena association
dynamically based CPU id. Three modes are supported: "percpu", "phycpu"
and disabled.
"percpu" uses the current core id (with help from sched_getcpu())
directly as the arena index, while "phycpu" will assign threads on the
same physical CPU to the same arena. In other words, "percpu" means # of
arenas == # of CPUs, while "phycpu" has # of arenas == 1/2 * (# of
CPUs). Note that no runtime check on whether hyper threading is enabled
is added yet.
When enabled, threads will be migrated between arenas when a CPU change
is detected. In the current design, to reduce overhead from reading CPU
id, each arena tracks the thread accessed most recently. When a new
thread comes in, we will read CPU id and update arena if necessary.
2017-02-03 09:02:05 +08:00
|
|
|
dnl Check if the GNU-specific sched_getcpu function exists.
|
|
|
|
AC_CHECK_FUNC([sched_getcpu],
|
|
|
|
[have_sched_getcpu="1"],
|
|
|
|
[have_sched_getcpu="0"]
|
|
|
|
)
|
|
|
|
if test "x$have_sched_getcpu" = "x1" ; then
|
|
|
|
AC_DEFINE([JEMALLOC_HAVE_SCHED_GETCPU], [ ])
|
|
|
|
fi
|
|
|
|
|
2017-03-18 03:42:33 +08:00
|
|
|
dnl Check if the GNU-specific sched_setaffinity function exists.
|
|
|
|
AC_CHECK_FUNC([sched_setaffinity],
|
|
|
|
[have_sched_setaffinity="1"],
|
|
|
|
[have_sched_setaffinity="0"]
|
|
|
|
)
|
|
|
|
if test "x$have_sched_setaffinity" = "x1" ; then
|
|
|
|
AC_DEFINE([JEMALLOC_HAVE_SCHED_SETAFFINITY], [ ])
|
|
|
|
fi
|
|
|
|
|
2014-12-10 06:41:34 +08:00
|
|
|
dnl Check if the Solaris/BSD issetugid function exists.
|
|
|
|
AC_CHECK_FUNC([issetugid],
|
|
|
|
[have_issetugid="1"],
|
|
|
|
[have_issetugid="0"]
|
|
|
|
)
|
|
|
|
if test "x$have_issetugid" = "x1" ; then
|
|
|
|
AC_DEFINE([JEMALLOC_HAVE_ISSETUGID], [ ])
|
|
|
|
fi
|
|
|
|
|
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], [ ])
|
2017-05-05 02:20:43 +08:00
|
|
|
wrap_syms="${wrap_syms} _malloc_thread_cleanup"
|
2012-03-22 09:33:03 +08:00
|
|
|
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])
|
2017-05-05 02:20:43 +08:00
|
|
|
wrap_syms="${wrap_syms} _malloc_prefork _malloc_postfork"
|
2012-02-03 14:04:57 +08:00
|
|
|
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
|
|
|
|
],
|
2015-08-11 13:01:59 +08:00
|
|
|
[enable_lazy_lock=""]
|
2010-01-18 06:06:20 +08:00
|
|
|
)
|
2016-11-02 23:54:07 +08:00
|
|
|
if test "x${enable_lazy_lock}" = "x" ; then
|
|
|
|
if test "x${force_lazy_lock}" = "x1" ; then
|
|
|
|
AC_MSG_RESULT([Forcing lazy-lock to avoid allocator/threading bootstrap issues])
|
|
|
|
enable_lazy_lock="1"
|
|
|
|
else
|
|
|
|
enable_lazy_lock="0"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
if test "x${enable_lazy_lock}" = "x1" -a "x${abi}" = "xpecoff" ; then
|
|
|
|
AC_MSG_RESULT([Forcing no lazy-lock because thread creation monitoring is unimplemented])
|
|
|
|
enable_lazy_lock="0"
|
2012-03-24 08:40:58 +08:00
|
|
|
fi
|
2010-01-18 06:06:20 +08:00
|
|
|
if test "x$enable_lazy_lock" = "x1" ; then
|
2017-03-18 03:42:33 +08:00
|
|
|
if test "x$have_dlsym" = "x1" ; then
|
|
|
|
AC_DEFINE([JEMALLOC_LAZY_LOCK], [ ])
|
|
|
|
else
|
|
|
|
AC_MSG_ERROR([Missing dlsym support: lazy-lock cannot be enabled.])
|
2012-04-22 12:27:46 +08:00
|
|
|
fi
|
2010-01-18 06:06:20 +08:00
|
|
|
fi
|
|
|
|
AC_SUBST([enable_lazy_lock])
|
|
|
|
|
2017-04-22 01:07:01 +08:00
|
|
|
dnl Automatically configure TLS.
|
|
|
|
if test "x${force_tls}" = "x1" ; then
|
|
|
|
enable_tls="1"
|
|
|
|
elif test "x${force_tls}" = "x0" ; then
|
2010-01-18 06:06:20 +08:00
|
|
|
enable_tls="0"
|
|
|
|
else
|
|
|
|
enable_tls="1"
|
|
|
|
fi
|
|
|
|
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")
|
2015-08-11 13:01:59 +08:00
|
|
|
else
|
|
|
|
enable_tls="0"
|
2010-01-18 06:06:20 +08:00
|
|
|
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], [ ])
|
2009-12-29 16:09:15 +08:00
|
|
|
fi
|
2009-06-24 10:01:18 +08:00
|
|
|
|
2014-12-06 09:42:41 +08:00
|
|
|
dnl ============================================================================
|
|
|
|
dnl Check for C11 atomics.
|
|
|
|
|
|
|
|
JE_COMPILABLE([C11 atomics], [
|
|
|
|
#include <stdint.h>
|
|
|
|
#if (__STDC_VERSION__ >= 201112L) && !defined(__STDC_NO_ATOMICS__)
|
|
|
|
#include <stdatomic.h>
|
|
|
|
#else
|
|
|
|
#error Atomics not available
|
|
|
|
#endif
|
|
|
|
], [
|
|
|
|
uint64_t *p = (uint64_t *)0;
|
|
|
|
uint64_t x = 1;
|
|
|
|
volatile atomic_uint_least64_t *a = (volatile atomic_uint_least64_t *)p;
|
|
|
|
uint64_t r = atomic_fetch_add(a, x) + x;
|
2017-01-20 10:15:45 +08:00
|
|
|
return r == 0;
|
Introduce a backport of C11 atomics
This introduces a backport of C11 atomics. It has four implementations; ranked
in order of preference, they are:
- GCC/Clang __atomic builtins
- GCC/Clang __sync builtins
- MSVC _Interlocked builtins
- C11 atomics, from <stdatomic.h>
The primary advantages are:
- Close adherence to the standard API gives us a defined memory model.
- Type safety: atomic objects are now separate types from non-atomic ones, so
that it's impossible to mix up atomic and non-atomic updates (which is
undefined behavior that compilers are starting to take advantage of).
- Efficiency: we can specify ordering for operations, avoiding fences and
atomic operations on strongly ordered architectures (example:
`atomic_write_u32(ptr, val);` involves a CAS loop, whereas
`atomic_store(ptr, val, ATOMIC_RELEASE);` is a plain store.
This diff leaves in the current atomics API (implementing them in terms of the
backport). This lets us transition uses over piecemeal.
Testing:
This is by nature hard to test. I've manually tested the first three options on
Linux on gcc by futzing with the #defines manually, on freebsd with gcc and
clang, on MSVC, and on OS X with clang. All of these were x86 machines though,
and we don't have any test infrastructure set up for non-x86 platforms.
2017-01-26 01:54:27 +08:00
|
|
|
], [je_cv_c11_atomics])
|
|
|
|
if test "x${je_cv_c11_atomics}" = "xyes" ; then
|
|
|
|
AC_DEFINE([JEMALLOC_C11_ATOMICS])
|
2014-12-06 09:42:41 +08:00
|
|
|
fi
|
|
|
|
|
2012-04-18 04:17:54 +08:00
|
|
|
dnl ============================================================================
|
Introduce a backport of C11 atomics
This introduces a backport of C11 atomics. It has four implementations; ranked
in order of preference, they are:
- GCC/Clang __atomic builtins
- GCC/Clang __sync builtins
- MSVC _Interlocked builtins
- C11 atomics, from <stdatomic.h>
The primary advantages are:
- Close adherence to the standard API gives us a defined memory model.
- Type safety: atomic objects are now separate types from non-atomic ones, so
that it's impossible to mix up atomic and non-atomic updates (which is
undefined behavior that compilers are starting to take advantage of).
- Efficiency: we can specify ordering for operations, avoiding fences and
atomic operations on strongly ordered architectures (example:
`atomic_write_u32(ptr, val);` involves a CAS loop, whereas
`atomic_store(ptr, val, ATOMIC_RELEASE);` is a plain store.
This diff leaves in the current atomics API (implementing them in terms of the
backport). This lets us transition uses over piecemeal.
Testing:
This is by nature hard to test. I've manually tested the first three options on
Linux on gcc by futzing with the #defines manually, on freebsd with gcc and
clang, on MSVC, and on OS X with clang. All of these were x86 machines though,
and we don't have any test infrastructure set up for non-x86 platforms.
2017-01-26 01:54:27 +08:00
|
|
|
dnl Check for GCC-style __atomic atomics.
|
2012-04-18 04:17:54 +08:00
|
|
|
|
Introduce a backport of C11 atomics
This introduces a backport of C11 atomics. It has four implementations; ranked
in order of preference, they are:
- GCC/Clang __atomic builtins
- GCC/Clang __sync builtins
- MSVC _Interlocked builtins
- C11 atomics, from <stdatomic.h>
The primary advantages are:
- Close adherence to the standard API gives us a defined memory model.
- Type safety: atomic objects are now separate types from non-atomic ones, so
that it's impossible to mix up atomic and non-atomic updates (which is
undefined behavior that compilers are starting to take advantage of).
- Efficiency: we can specify ordering for operations, avoiding fences and
atomic operations on strongly ordered architectures (example:
`atomic_write_u32(ptr, val);` involves a CAS loop, whereas
`atomic_store(ptr, val, ATOMIC_RELEASE);` is a plain store.
This diff leaves in the current atomics API (implementing them in terms of the
backport). This lets us transition uses over piecemeal.
Testing:
This is by nature hard to test. I've manually tested the first three options on
Linux on gcc by futzing with the #defines manually, on freebsd with gcc and
clang, on MSVC, and on OS X with clang. All of these were x86 machines though,
and we don't have any test infrastructure set up for non-x86 platforms.
2017-01-26 01:54:27 +08:00
|
|
|
JE_COMPILABLE([GCC __atomic atomics], [
|
2012-04-18 04:17:54 +08:00
|
|
|
], [
|
Introduce a backport of C11 atomics
This introduces a backport of C11 atomics. It has four implementations; ranked
in order of preference, they are:
- GCC/Clang __atomic builtins
- GCC/Clang __sync builtins
- MSVC _Interlocked builtins
- C11 atomics, from <stdatomic.h>
The primary advantages are:
- Close adherence to the standard API gives us a defined memory model.
- Type safety: atomic objects are now separate types from non-atomic ones, so
that it's impossible to mix up atomic and non-atomic updates (which is
undefined behavior that compilers are starting to take advantage of).
- Efficiency: we can specify ordering for operations, avoiding fences and
atomic operations on strongly ordered architectures (example:
`atomic_write_u32(ptr, val);` involves a CAS loop, whereas
`atomic_store(ptr, val, ATOMIC_RELEASE);` is a plain store.
This diff leaves in the current atomics API (implementing them in terms of the
backport). This lets us transition uses over piecemeal.
Testing:
This is by nature hard to test. I've manually tested the first three options on
Linux on gcc by futzing with the #defines manually, on freebsd with gcc and
clang, on MSVC, and on OS X with clang. All of these were x86 machines though,
and we don't have any test infrastructure set up for non-x86 platforms.
2017-01-26 01:54:27 +08:00
|
|
|
int x = 0;
|
|
|
|
int val = 1;
|
|
|
|
int y = __atomic_fetch_add(&x, val, __ATOMIC_RELAXED);
|
|
|
|
int after_add = x;
|
|
|
|
return after_add == 1;
|
|
|
|
], [je_cv_gcc_atomic_atomics])
|
|
|
|
if test "x${je_cv_gcc_atomic_atomics}" = "xyes" ; then
|
|
|
|
AC_DEFINE([JEMALLOC_GCC_ATOMIC_ATOMICS])
|
2019-03-08 07:58:26 +08:00
|
|
|
|
|
|
|
dnl check for 8-bit atomic support
|
|
|
|
JE_COMPILABLE([GCC 8-bit __atomic atomics], [
|
|
|
|
], [
|
|
|
|
unsigned char x = 0;
|
|
|
|
int val = 1;
|
|
|
|
int y = __atomic_fetch_add(&x, val, __ATOMIC_RELAXED);
|
|
|
|
int after_add = (int)x;
|
|
|
|
return after_add == 1;
|
|
|
|
], [je_cv_gcc_u8_atomic_atomics])
|
|
|
|
if test "x${je_cv_gcc_u8_atomic_atomics}" = "xyes" ; then
|
|
|
|
AC_DEFINE([JEMALLOC_GCC_U8_ATOMIC_ATOMICS])
|
|
|
|
fi
|
Introduce a backport of C11 atomics
This introduces a backport of C11 atomics. It has four implementations; ranked
in order of preference, they are:
- GCC/Clang __atomic builtins
- GCC/Clang __sync builtins
- MSVC _Interlocked builtins
- C11 atomics, from <stdatomic.h>
The primary advantages are:
- Close adherence to the standard API gives us a defined memory model.
- Type safety: atomic objects are now separate types from non-atomic ones, so
that it's impossible to mix up atomic and non-atomic updates (which is
undefined behavior that compilers are starting to take advantage of).
- Efficiency: we can specify ordering for operations, avoiding fences and
atomic operations on strongly ordered architectures (example:
`atomic_write_u32(ptr, val);` involves a CAS loop, whereas
`atomic_store(ptr, val, ATOMIC_RELEASE);` is a plain store.
This diff leaves in the current atomics API (implementing them in terms of the
backport). This lets us transition uses over piecemeal.
Testing:
This is by nature hard to test. I've manually tested the first three options on
Linux on gcc by futzing with the #defines manually, on freebsd with gcc and
clang, on MSVC, and on OS X with clang. All of these were x86 machines though,
and we don't have any test infrastructure set up for non-x86 platforms.
2017-01-26 01:54:27 +08:00
|
|
|
fi
|
|
|
|
|
|
|
|
dnl ============================================================================
|
|
|
|
dnl Check for GCC-style __sync atomics.
|
|
|
|
|
|
|
|
JE_COMPILABLE([GCC __sync atomics], [
|
|
|
|
], [
|
|
|
|
int x = 0;
|
|
|
|
int before_add = __sync_fetch_and_add(&x, 1);
|
|
|
|
int after_add = x;
|
|
|
|
return (before_add == 0) && (after_add == 1);
|
|
|
|
], [je_cv_gcc_sync_atomics])
|
|
|
|
if test "x${je_cv_gcc_sync_atomics}" = "xyes" ; then
|
|
|
|
AC_DEFINE([JEMALLOC_GCC_SYNC_ATOMICS])
|
2019-03-08 07:58:26 +08:00
|
|
|
|
|
|
|
dnl check for 8-bit atomic support
|
|
|
|
JE_COMPILABLE([GCC 8-bit __sync atomics], [
|
|
|
|
], [
|
|
|
|
unsigned char x = 0;
|
|
|
|
int before_add = __sync_fetch_and_add(&x, 1);
|
|
|
|
int after_add = (int)x;
|
|
|
|
return (before_add == 0) && (after_add == 1);
|
|
|
|
], [je_cv_gcc_u8_sync_atomics])
|
|
|
|
if test "x${je_cv_gcc_u8_sync_atomics}" = "xyes" ; then
|
|
|
|
AC_DEFINE([JEMALLOC_GCC_U8_SYNC_ATOMICS])
|
|
|
|
fi
|
2012-04-18 04:17:54 +08:00
|
|
|
fi
|
|
|
|
|
2011-03-19 10:10:31 +08:00
|
|
|
dnl ============================================================================
|
|
|
|
dnl Check for atomic(3) operations as provided on Darwin.
|
Introduce a backport of C11 atomics
This introduces a backport of C11 atomics. It has four implementations; ranked
in order of preference, they are:
- GCC/Clang __atomic builtins
- GCC/Clang __sync builtins
- MSVC _Interlocked builtins
- C11 atomics, from <stdatomic.h>
The primary advantages are:
- Close adherence to the standard API gives us a defined memory model.
- Type safety: atomic objects are now separate types from non-atomic ones, so
that it's impossible to mix up atomic and non-atomic updates (which is
undefined behavior that compilers are starting to take advantage of).
- Efficiency: we can specify ordering for operations, avoiding fences and
atomic operations on strongly ordered architectures (example:
`atomic_write_u32(ptr, val);` involves a CAS loop, whereas
`atomic_store(ptr, val, ATOMIC_RELEASE);` is a plain store.
This diff leaves in the current atomics API (implementing them in terms of the
backport). This lets us transition uses over piecemeal.
Testing:
This is by nature hard to test. I've manually tested the first three options on
Linux on gcc by futzing with the #defines manually, on freebsd with gcc and
clang, on MSVC, and on OS X with clang. All of these were x86 machines though,
and we don't have any test infrastructure set up for non-x86 platforms.
2017-01-26 01:54:27 +08:00
|
|
|
dnl We need this not for the atomic operations (which are provided above), but
|
2018-11-09 07:43:09 +08:00
|
|
|
dnl rather for the OS_unfair_lock type it exposes.
|
2011-03-19 10:10:31 +08:00
|
|
|
|
|
|
|
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
|
|
|
|
|
2014-06-03 15:39:18 +08:00
|
|
|
dnl ============================================================================
|
|
|
|
dnl Check for madvise(2).
|
|
|
|
|
|
|
|
JE_COMPILABLE([madvise(2)], [
|
|
|
|
#include <sys/mman.h>
|
|
|
|
], [
|
2016-11-18 02:24:51 +08:00
|
|
|
madvise((void *)0, 0, 0);
|
2014-06-03 15:39:18 +08:00
|
|
|
], [je_cv_madvise])
|
|
|
|
if test "x${je_cv_madvise}" = "xyes" ; then
|
2016-11-18 05:36:17 +08:00
|
|
|
AC_DEFINE([JEMALLOC_HAVE_MADVISE], [ ])
|
|
|
|
|
2016-11-18 02:24:51 +08:00
|
|
|
dnl Check for madvise(..., MADV_FREE).
|
|
|
|
JE_COMPILABLE([madvise(..., MADV_FREE)], [
|
|
|
|
#include <sys/mman.h>
|
|
|
|
], [
|
|
|
|
madvise((void *)0, 0, MADV_FREE);
|
|
|
|
], [je_cv_madv_free])
|
|
|
|
if test "x${je_cv_madv_free}" = "xyes" ; then
|
|
|
|
AC_DEFINE([JEMALLOC_PURGE_MADVISE_FREE], [ ])
|
2017-10-06 07:28:55 +08:00
|
|
|
elif test "x${je_cv_madvise}" = "xyes" ; then
|
|
|
|
case "${host_cpu}" in i686|x86_64)
|
|
|
|
case "${host}" in *-*-linux*)
|
|
|
|
AC_DEFINE([JEMALLOC_PURGE_MADVISE_FREE], [ ])
|
|
|
|
AC_DEFINE([JEMALLOC_DEFINE_MADVISE_FREE], [ ])
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
;;
|
|
|
|
esac
|
2016-11-18 02:24:51 +08:00
|
|
|
fi
|
|
|
|
|
|
|
|
dnl Check for madvise(..., MADV_DONTNEED).
|
|
|
|
JE_COMPILABLE([madvise(..., MADV_DONTNEED)], [
|
|
|
|
#include <sys/mman.h>
|
|
|
|
], [
|
|
|
|
madvise((void *)0, 0, MADV_DONTNEED);
|
|
|
|
], [je_cv_madv_dontneed])
|
|
|
|
if test "x${je_cv_madv_dontneed}" = "xyes" ; then
|
|
|
|
AC_DEFINE([JEMALLOC_PURGE_MADVISE_DONTNEED], [ ])
|
|
|
|
fi
|
|
|
|
|
2017-09-19 06:03:52 +08:00
|
|
|
dnl Check for madvise(..., MADV_DO[NT]DUMP).
|
|
|
|
JE_COMPILABLE([madvise(..., MADV_DO[[NT]]DUMP)], [
|
|
|
|
#include <sys/mman.h>
|
|
|
|
], [
|
|
|
|
madvise((void *)0, 0, MADV_DONTDUMP);
|
|
|
|
madvise((void *)0, 0, MADV_DODUMP);
|
|
|
|
], [je_cv_madv_dontdump])
|
|
|
|
if test "x${je_cv_madv_dontdump}" = "xyes" ; then
|
|
|
|
AC_DEFINE([JEMALLOC_MADVISE_DONTDUMP], [ ])
|
|
|
|
fi
|
2018-10-30 07:01:09 +08:00
|
|
|
|
2016-11-18 05:36:17 +08:00
|
|
|
dnl Check for madvise(..., MADV_[NO]HUGEPAGE).
|
|
|
|
JE_COMPILABLE([madvise(..., MADV_[[NO]]HUGEPAGE)], [
|
|
|
|
#include <sys/mman.h>
|
|
|
|
], [
|
|
|
|
madvise((void *)0, 0, MADV_HUGEPAGE);
|
|
|
|
madvise((void *)0, 0, MADV_NOHUGEPAGE);
|
|
|
|
], [je_cv_thp])
|
2018-01-02 17:29:19 +08:00
|
|
|
case "${host_cpu}" in
|
|
|
|
arm*)
|
|
|
|
;;
|
|
|
|
*)
|
2017-08-11 04:14:26 +08:00
|
|
|
if test "x${je_cv_thp}" = "xyes" ; then
|
|
|
|
AC_DEFINE([JEMALLOC_HAVE_MADVISE_HUGE], [ ])
|
|
|
|
fi
|
2018-01-02 17:29:19 +08:00
|
|
|
;;
|
|
|
|
esac
|
2014-06-03 15:39:18 +08:00
|
|
|
fi
|
|
|
|
|
2014-05-29 07:11:55 +08:00
|
|
|
dnl ============================================================================
|
|
|
|
dnl Check for __builtin_clz() and __builtin_clzl().
|
|
|
|
|
|
|
|
AC_CACHE_CHECK([for __builtin_clz],
|
|
|
|
[je_cv_builtin_clz],
|
|
|
|
[AC_LINK_IFELSE([AC_LANG_PROGRAM([],
|
|
|
|
[
|
|
|
|
{
|
|
|
|
unsigned x = 0;
|
|
|
|
int y = __builtin_clz(x);
|
|
|
|
}
|
|
|
|
{
|
|
|
|
unsigned long x = 0;
|
|
|
|
int y = __builtin_clzl(x);
|
|
|
|
}
|
|
|
|
])],
|
|
|
|
[je_cv_builtin_clz=yes],
|
|
|
|
[je_cv_builtin_clz=no])])
|
|
|
|
|
|
|
|
if test "x${je_cv_builtin_clz}" = "xyes" ; then
|
|
|
|
AC_DEFINE([JEMALLOC_HAVE_BUILTIN_CLZ], [ ])
|
|
|
|
fi
|
|
|
|
|
2016-11-03 09:09:45 +08:00
|
|
|
dnl ============================================================================
|
|
|
|
dnl Check for os_unfair_lock operations as provided on Darwin.
|
|
|
|
|
2016-11-17 02:40:00 +08:00
|
|
|
JE_COMPILABLE([Darwin os_unfair_lock_*()], [
|
2016-11-03 09:09:45 +08:00
|
|
|
#include <os/lock.h>
|
2016-11-24 04:32:35 +08:00
|
|
|
#include <AvailabilityMacros.h>
|
2016-11-03 09:09:45 +08:00
|
|
|
], [
|
2016-11-24 04:32:35 +08:00
|
|
|
#if MAC_OS_X_VERSION_MIN_REQUIRED < 101200
|
|
|
|
#error "os_unfair_lock is not supported"
|
|
|
|
#else
|
2016-11-03 09:09:45 +08:00
|
|
|
os_unfair_lock lock = OS_UNFAIR_LOCK_INIT;
|
|
|
|
os_unfair_lock_lock(&lock);
|
|
|
|
os_unfair_lock_unlock(&lock);
|
2016-11-24 04:32:35 +08:00
|
|
|
#endif
|
2016-11-03 09:09:45 +08:00
|
|
|
], [je_cv_os_unfair_lock])
|
|
|
|
if test "x${je_cv_os_unfair_lock}" = "xyes" ; then
|
|
|
|
AC_DEFINE([JEMALLOC_OS_UNFAIR_LOCK], [ ])
|
|
|
|
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_ZONE], [ ])
|
2010-02-11 10:15:53 +08:00
|
|
|
fi
|
|
|
|
|
2018-04-18 03:52:22 +08:00
|
|
|
dnl ============================================================================
|
|
|
|
dnl Use initial-exec TLS by default.
|
|
|
|
AC_ARG_ENABLE([initial-exec-tls],
|
|
|
|
[AS_HELP_STRING([--disable-initial-exec-tls],
|
|
|
|
[Disable the initial-exec tls model])],
|
|
|
|
[if test "x$enable_initial_exec_tls" = "xno" ; then
|
|
|
|
enable_initial_exec_tls="0"
|
|
|
|
else
|
|
|
|
enable_initial_exec_tls="1"
|
|
|
|
fi
|
|
|
|
],
|
|
|
|
[enable_initial_exec_tls="1"]
|
|
|
|
)
|
|
|
|
AC_SUBST([enable_initial_exec_tls])
|
|
|
|
|
|
|
|
if test "x${je_cv_tls_model}" = "xyes" -a \
|
|
|
|
"x${enable_initial_exec_tls}" = "x1" ; then
|
|
|
|
AC_DEFINE([JEMALLOC_TLS_MODEL],
|
|
|
|
[__attribute__((tls_model("initial-exec")))])
|
|
|
|
else
|
|
|
|
AC_DEFINE([JEMALLOC_TLS_MODEL], [ ])
|
|
|
|
fi
|
|
|
|
|
2017-06-09 13:07:21 +08:00
|
|
|
dnl ============================================================================
|
|
|
|
dnl Enable background threads if possible.
|
|
|
|
|
2018-06-08 03:28:40 +08:00
|
|
|
if test "x${have_pthread}" = "x1" -a "x${je_cv_os_unfair_lock}" != "xyes" ; then
|
2017-06-09 13:07:21 +08:00
|
|
|
AC_DEFINE([JEMALLOC_BACKGROUND_THREAD])
|
|
|
|
fi
|
|
|
|
|
2014-08-19 04:06:39 +08:00
|
|
|
dnl ============================================================================
|
|
|
|
dnl Check for glibc malloc hooks
|
|
|
|
|
|
|
|
JE_COMPILABLE([glibc malloc hook], [
|
|
|
|
#include <stddef.h>
|
|
|
|
|
|
|
|
extern void (* __free_hook)(void *ptr);
|
|
|
|
extern void *(* __malloc_hook)(size_t size);
|
|
|
|
extern void *(* __realloc_hook)(void *ptr, size_t size);
|
|
|
|
], [
|
|
|
|
void *ptr = 0L;
|
|
|
|
if (__malloc_hook) ptr = __malloc_hook(1);
|
|
|
|
if (__realloc_hook) ptr = __realloc_hook(ptr, 2);
|
|
|
|
if (__free_hook && ptr) __free_hook(ptr);
|
|
|
|
], [je_cv_glibc_malloc_hook])
|
|
|
|
if test "x${je_cv_glibc_malloc_hook}" = "xyes" ; then
|
2017-05-05 02:20:43 +08:00
|
|
|
if test "x${JEMALLOC_PREFIX}" = "x" ; then
|
|
|
|
AC_DEFINE([JEMALLOC_GLIBC_MALLOC_HOOK], [ ])
|
|
|
|
wrap_syms="${wrap_syms} __free_hook __malloc_hook __realloc_hook"
|
|
|
|
fi
|
2014-08-19 04:06:39 +08:00
|
|
|
fi
|
|
|
|
|
|
|
|
JE_COMPILABLE([glibc memalign hook], [
|
|
|
|
#include <stddef.h>
|
|
|
|
|
|
|
|
extern void *(* __memalign_hook)(size_t alignment, size_t size);
|
|
|
|
], [
|
|
|
|
void *ptr = 0L;
|
|
|
|
if (__memalign_hook) ptr = __memalign_hook(16, 7);
|
|
|
|
], [je_cv_glibc_memalign_hook])
|
|
|
|
if test "x${je_cv_glibc_memalign_hook}" = "xyes" ; then
|
2017-05-05 02:20:43 +08:00
|
|
|
if test "x${JEMALLOC_PREFIX}" = "x" ; then
|
|
|
|
AC_DEFINE([JEMALLOC_GLIBC_MEMALIGN_HOOK], [ ])
|
|
|
|
wrap_syms="${wrap_syms} __memalign_hook"
|
|
|
|
fi
|
2014-08-19 04:06:39 +08:00
|
|
|
fi
|
|
|
|
|
2014-08-31 11:57:06 +08:00
|
|
|
JE_COMPILABLE([pthreads adaptive mutexes], [
|
|
|
|
#include <pthread.h>
|
|
|
|
], [
|
|
|
|
pthread_mutexattr_t attr;
|
|
|
|
pthread_mutexattr_init(&attr);
|
|
|
|
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ADAPTIVE_NP);
|
|
|
|
pthread_mutexattr_destroy(&attr);
|
|
|
|
], [je_cv_pthread_mutex_adaptive_np])
|
|
|
|
if test "x${je_cv_pthread_mutex_adaptive_np}" = "xyes" ; then
|
|
|
|
AC_DEFINE([JEMALLOC_HAVE_PTHREAD_MUTEX_ADAPTIVE_NP], [ ])
|
|
|
|
fi
|
|
|
|
|
2017-09-23 03:24:50 +08:00
|
|
|
JE_CFLAGS_SAVE()
|
|
|
|
JE_CFLAGS_ADD([-D_GNU_SOURCE])
|
|
|
|
JE_CFLAGS_ADD([-Werror])
|
|
|
|
JE_CFLAGS_ADD([-herror_on_warning])
|
|
|
|
JE_COMPILABLE([strerror_r returns char with gnu source], [
|
|
|
|
#include <errno.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
], [
|
|
|
|
char *buffer = (char *) malloc(100);
|
|
|
|
char *error = strerror_r(EINVAL, buffer, 100);
|
|
|
|
printf("%s\n", error);
|
|
|
|
], [je_cv_strerror_r_returns_char_with_gnu_source])
|
|
|
|
JE_CFLAGS_RESTORE()
|
|
|
|
if test "x${je_cv_strerror_r_returns_char_with_gnu_source}" = "xyes" ; then
|
|
|
|
AC_DEFINE([JEMALLOC_STRERROR_R_RETURNS_CHAR_WITH_GNU_SOURCE], [ ])
|
|
|
|
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.
|
|
|
|
|
2014-01-17 09:38:01 +08:00
|
|
|
AC_CONFIG_COMMANDS([include/jemalloc/internal/public_symbols.txt], [
|
|
|
|
f="${objroot}include/jemalloc/internal/public_symbols.txt"
|
|
|
|
mkdir -p "${objroot}include/jemalloc/internal"
|
|
|
|
cp /dev/null "${f}"
|
|
|
|
for nm in `echo ${mangling_map} |tr ',' ' '` ; do
|
|
|
|
n=`echo ${nm} |tr ':' ' ' |awk '{print $[]1}'`
|
|
|
|
m=`echo ${nm} |tr ':' ' ' |awk '{print $[]2}'`
|
|
|
|
echo "${n}:${m}" >> "${f}"
|
|
|
|
dnl Remove name from public_syms so that it isn't redefined later.
|
|
|
|
public_syms=`for sym in ${public_syms}; do echo "${sym}"; done |grep -v "^${n}\$" |tr '\n' ' '`
|
|
|
|
done
|
|
|
|
for sym in ${public_syms} ; do
|
|
|
|
n="${sym}"
|
|
|
|
m="${JEMALLOC_PREFIX}${sym}"
|
|
|
|
echo "${n}:${m}" >> "${f}"
|
|
|
|
done
|
|
|
|
], [
|
|
|
|
srcdir="${srcdir}"
|
|
|
|
objroot="${objroot}"
|
|
|
|
mangling_map="${mangling_map}"
|
|
|
|
public_syms="${public_syms}"
|
|
|
|
JEMALLOC_PREFIX="${JEMALLOC_PREFIX}"
|
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
|
|
|
])
|
2017-05-05 02:20:43 +08:00
|
|
|
AC_CONFIG_COMMANDS([include/jemalloc/internal/private_symbols.awk], [
|
|
|
|
f="${objroot}include/jemalloc/internal/private_symbols.awk"
|
|
|
|
mkdir -p "${objroot}include/jemalloc/internal"
|
|
|
|
export_syms=`for sym in ${public_syms}; do echo "${JEMALLOC_PREFIX}${sym}"; done; for sym in ${wrap_syms}; do echo "${sym}"; done;`
|
|
|
|
"${srcdir}/include/jemalloc/internal/private_symbols.sh" "${SYM_PREFIX}" ${export_syms} > "${objroot}include/jemalloc/internal/private_symbols.awk"
|
|
|
|
], [
|
|
|
|
srcdir="${srcdir}"
|
|
|
|
objroot="${objroot}"
|
|
|
|
public_syms="${public_syms}"
|
|
|
|
wrap_syms="${wrap_syms}"
|
|
|
|
SYM_PREFIX="${SYM_PREFIX}"
|
|
|
|
JEMALLOC_PREFIX="${JEMALLOC_PREFIX}"
|
|
|
|
])
|
|
|
|
AC_CONFIG_COMMANDS([include/jemalloc/internal/private_symbols_jet.awk], [
|
|
|
|
f="${objroot}include/jemalloc/internal/private_symbols_jet.awk"
|
|
|
|
mkdir -p "${objroot}include/jemalloc/internal"
|
|
|
|
export_syms=`for sym in ${public_syms}; do echo "jet_${sym}"; done; for sym in ${wrap_syms}; do echo "${sym}"; done;`
|
|
|
|
"${srcdir}/include/jemalloc/internal/private_symbols.sh" "${SYM_PREFIX}" ${export_syms} > "${objroot}include/jemalloc/internal/private_symbols_jet.awk"
|
|
|
|
], [
|
|
|
|
srcdir="${srcdir}"
|
|
|
|
objroot="${objroot}"
|
|
|
|
public_syms="${public_syms}"
|
|
|
|
wrap_syms="${wrap_syms}"
|
|
|
|
SYM_PREFIX="${SYM_PREFIX}"
|
|
|
|
])
|
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/public_namespace.h], [
|
|
|
|
mkdir -p "${objroot}include/jemalloc/internal"
|
2014-01-17 09:38:01 +08:00
|
|
|
"${srcdir}/include/jemalloc/internal/public_namespace.sh" "${objroot}include/jemalloc/internal/public_symbols.txt" > "${objroot}include/jemalloc/internal/public_namespace.h"
|
|
|
|
], [
|
|
|
|
srcdir="${srcdir}"
|
|
|
|
objroot="${objroot}"
|
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/public_unnamespace.h], [
|
|
|
|
mkdir -p "${objroot}include/jemalloc/internal"
|
2014-01-17 09:38:01 +08:00
|
|
|
"${srcdir}/include/jemalloc/internal/public_unnamespace.sh" "${objroot}include/jemalloc/internal/public_symbols.txt" > "${objroot}include/jemalloc/internal/public_unnamespace.h"
|
|
|
|
], [
|
|
|
|
srcdir="${srcdir}"
|
|
|
|
objroot="${objroot}"
|
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"
|
2014-01-17 09:38:01 +08:00
|
|
|
], [
|
|
|
|
srcdir="${srcdir}"
|
|
|
|
objroot="${objroot}"
|
|
|
|
])
|
|
|
|
AC_CONFIG_COMMANDS([include/jemalloc/jemalloc_rename.h], [
|
|
|
|
mkdir -p "${objroot}include/jemalloc"
|
|
|
|
"${srcdir}/include/jemalloc/jemalloc_rename.sh" "${objroot}include/jemalloc/internal/public_symbols.txt" > "${objroot}include/jemalloc/jemalloc_rename.h"
|
|
|
|
], [
|
|
|
|
srcdir="${srcdir}"
|
|
|
|
objroot="${objroot}"
|
|
|
|
])
|
|
|
|
AC_CONFIG_COMMANDS([include/jemalloc/jemalloc_mangle.h], [
|
|
|
|
mkdir -p "${objroot}include/jemalloc"
|
|
|
|
"${srcdir}/include/jemalloc/jemalloc_mangle.sh" "${objroot}include/jemalloc/internal/public_symbols.txt" je_ > "${objroot}include/jemalloc/jemalloc_mangle.h"
|
|
|
|
], [
|
|
|
|
srcdir="${srcdir}"
|
|
|
|
objroot="${objroot}"
|
|
|
|
])
|
|
|
|
AC_CONFIG_COMMANDS([include/jemalloc/jemalloc_mangle_jet.h], [
|
|
|
|
mkdir -p "${objroot}include/jemalloc"
|
|
|
|
"${srcdir}/include/jemalloc/jemalloc_mangle.sh" "${objroot}include/jemalloc/internal/public_symbols.txt" jet_ > "${objroot}include/jemalloc/jemalloc_mangle_jet.h"
|
|
|
|
], [
|
|
|
|
srcdir="${srcdir}"
|
|
|
|
objroot="${objroot}"
|
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.h], [
|
|
|
|
mkdir -p "${objroot}include/jemalloc"
|
|
|
|
"${srcdir}/include/jemalloc/jemalloc.sh" "${objroot}" > "${objroot}include/jemalloc/jemalloc${install_suffix}.h"
|
2014-01-17 09:38:01 +08:00
|
|
|
], [
|
|
|
|
srcdir="${srcdir}"
|
|
|
|
objroot="${objroot}"
|
|
|
|
install_suffix="${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
|
|
|
])
|
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
|
|
|
|
2015-05-02 03:31:12 +08:00
|
|
|
AC_CONFIG_FILES([$cfgoutputs_tup config.stamp bin/jemalloc-config bin/jemalloc.sh bin/jeprof])
|
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([])
|
2015-01-23 09:55:58 +08:00
|
|
|
AC_MSG_RESULT([CONFIG : ${CONFIG}])
|
2009-06-24 10:01:18 +08:00
|
|
|
AC_MSG_RESULT([CC : ${CC}])
|
2016-12-16 23:18:55 +08:00
|
|
|
AC_MSG_RESULT([CONFIGURE_CFLAGS : ${CONFIGURE_CFLAGS}])
|
|
|
|
AC_MSG_RESULT([SPECIFIED_CFLAGS : ${SPECIFIED_CFLAGS}])
|
2016-10-30 13:14:55 +08:00
|
|
|
AC_MSG_RESULT([EXTRA_CFLAGS : ${EXTRA_CFLAGS}])
|
2015-01-23 09:55:58 +08:00
|
|
|
AC_MSG_RESULT([CPPFLAGS : ${CPPFLAGS}])
|
jemalloc cpp new/delete bindings
Adds cpp bindings for jemalloc, along with necessary autoconf settings.
This is mostly to add sized deallocation support, which can't be added
from C directly. Sized deallocation is ~10% microbench improvement.
* Import ax_cxx_compile_stdcxx.m4 from the autoconf repo, seems like the
easiest way to get c++14 detection.
* Adds various other changes, like CXXFLAGS, to configure.ac.
* Adds new rules to Makefile.in for src/jemalloc-cpp.cpp, and a basic
unittest.
* Both new and delete are overridden, to ensure jemalloc is used for
both.
* TODO future enhancement of avoiding extra PLT thunks for new and
delete - sdallocx and malloc are publicly exported jemalloc symbols,
using an alias would link them directly. Unfortunately, was having
trouble getting it to play nice with jemalloc's namespace support.
Testing:
Tested gcc 4.8, gcc 5, gcc 5.2, clang 4.0. Only gcc >= 5 has sized
deallocation support, verified that the rest build correctly.
Tested mac osx and Centos.
Tested --with-jemalloc-prefix and --without-export.
This resolves #202.
2016-10-24 06:56:30 +08:00
|
|
|
AC_MSG_RESULT([CXX : ${CXX}])
|
2016-12-16 23:18:55 +08:00
|
|
|
AC_MSG_RESULT([CONFIGURE_CXXFLAGS : ${CONFIGURE_CXXFLAGS}])
|
|
|
|
AC_MSG_RESULT([SPECIFIED_CXXFLAGS : ${SPECIFIED_CXXFLAGS}])
|
jemalloc cpp new/delete bindings
Adds cpp bindings for jemalloc, along with necessary autoconf settings.
This is mostly to add sized deallocation support, which can't be added
from C directly. Sized deallocation is ~10% microbench improvement.
* Import ax_cxx_compile_stdcxx.m4 from the autoconf repo, seems like the
easiest way to get c++14 detection.
* Adds various other changes, like CXXFLAGS, to configure.ac.
* Adds new rules to Makefile.in for src/jemalloc-cpp.cpp, and a basic
unittest.
* Both new and delete are overridden, to ensure jemalloc is used for
both.
* TODO future enhancement of avoiding extra PLT thunks for new and
delete - sdallocx and malloc are publicly exported jemalloc symbols,
using an alias would link them directly. Unfortunately, was having
trouble getting it to play nice with jemalloc's namespace support.
Testing:
Tested gcc 4.8, gcc 5, gcc 5.2, clang 4.0. Only gcc >= 5 has sized
deallocation support, verified that the rest build correctly.
Tested mac osx and Centos.
Tested --with-jemalloc-prefix and --without-export.
This resolves #202.
2016-10-24 06:56:30 +08:00
|
|
|
AC_MSG_RESULT([EXTRA_CXXFLAGS : ${EXTRA_CXXFLAGS}])
|
2009-06-24 10:01:18 +08:00
|
|
|
AC_MSG_RESULT([LDFLAGS : ${LDFLAGS}])
|
2013-12-07 10:27:33 +08:00
|
|
|
AC_MSG_RESULT([EXTRA_LDFLAGS : ${EXTRA_LDFLAGS}])
|
jemalloc cpp new/delete bindings
Adds cpp bindings for jemalloc, along with necessary autoconf settings.
This is mostly to add sized deallocation support, which can't be added
from C directly. Sized deallocation is ~10% microbench improvement.
* Import ax_cxx_compile_stdcxx.m4 from the autoconf repo, seems like the
easiest way to get c++14 detection.
* Adds various other changes, like CXXFLAGS, to configure.ac.
* Adds new rules to Makefile.in for src/jemalloc-cpp.cpp, and a basic
unittest.
* Both new and delete are overridden, to ensure jemalloc is used for
both.
* TODO future enhancement of avoiding extra PLT thunks for new and
delete - sdallocx and malloc are publicly exported jemalloc symbols,
using an alias would link them directly. Unfortunately, was having
trouble getting it to play nice with jemalloc's namespace support.
Testing:
Tested gcc 4.8, gcc 5, gcc 5.2, clang 4.0. Only gcc >= 5 has sized
deallocation support, verified that the rest build correctly.
Tested mac osx and Centos.
Tested --with-jemalloc-prefix and --without-export.
This resolves #202.
2016-10-24 06:56:30 +08:00
|
|
|
AC_MSG_RESULT([DSO_LDFLAGS : ${DSO_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}])
|
2015-01-23 09:55:58 +08:00
|
|
|
AC_MSG_RESULT([DATADIR : ${DATADIR}])
|
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([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}])
|
2016-02-08 06:23:22 +08:00
|
|
|
AC_MSG_RESULT([malloc_conf : ${config_malloc_conf}])
|
2019-04-19 19:44:18 +08:00
|
|
|
AC_MSG_RESULT([documentation : ${enable_doc}])
|
2018-12-15 04:28:34 +08:00
|
|
|
AC_MSG_RESULT([shared libs : ${enable_shared}])
|
|
|
|
AC_MSG_RESULT([static libs : ${enable_static}])
|
2009-06-24 10:01:18 +08:00
|
|
|
AC_MSG_RESULT([autogen : ${enable_autogen}])
|
|
|
|
AC_MSG_RESULT([debug : ${enable_debug}])
|
|
|
|
AC_MSG_RESULT([stats : ${enable_stats}])
|
2017-11-16 01:26:49 +08:00
|
|
|
AC_MSG_RESULT([experimetal_smallocx : ${enable_experimental_smallocx}])
|
2010-02-11 02:37:56 +08:00
|
|
|
AC_MSG_RESULT([prof : ${enable_prof}])
|
|
|
|
AC_MSG_RESULT([prof-libunwind : ${enable_prof_libunwind}])
|
2011-03-16 13:23:12 +08:00
|
|
|
AC_MSG_RESULT([prof-libgcc : ${enable_prof_libgcc}])
|
|
|
|
AC_MSG_RESULT([prof-gcc : ${enable_prof_gcc}])
|
2009-06-24 10:01:18 +08:00
|
|
|
AC_MSG_RESULT([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([xmalloc : ${enable_xmalloc}])
|
2017-07-20 07:36:46 +08:00
|
|
|
AC_MSG_RESULT([log : ${enable_log}])
|
2009-06-24 10:01:18 +08:00
|
|
|
AC_MSG_RESULT([lazy_lock : ${enable_lazy_lock}])
|
2015-05-05 00:58:36 +08:00
|
|
|
AC_MSG_RESULT([cache-oblivious : ${enable_cache_oblivious}])
|
jemalloc cpp new/delete bindings
Adds cpp bindings for jemalloc, along with necessary autoconf settings.
This is mostly to add sized deallocation support, which can't be added
from C directly. Sized deallocation is ~10% microbench improvement.
* Import ax_cxx_compile_stdcxx.m4 from the autoconf repo, seems like the
easiest way to get c++14 detection.
* Adds various other changes, like CXXFLAGS, to configure.ac.
* Adds new rules to Makefile.in for src/jemalloc-cpp.cpp, and a basic
unittest.
* Both new and delete are overridden, to ensure jemalloc is used for
both.
* TODO future enhancement of avoiding extra PLT thunks for new and
delete - sdallocx and malloc are publicly exported jemalloc symbols,
using an alias would link them directly. Unfortunately, was having
trouble getting it to play nice with jemalloc's namespace support.
Testing:
Tested gcc 4.8, gcc 5, gcc 5.2, clang 4.0. Only gcc >= 5 has sized
deallocation support, verified that the rest build correctly.
Tested mac osx and Centos.
Tested --with-jemalloc-prefix and --without-export.
This resolves #202.
2016-10-24 06:56:30 +08:00
|
|
|
AC_MSG_RESULT([cxx : ${enable_cxx}])
|
2009-06-24 10:01:18 +08:00
|
|
|
AC_MSG_RESULT([===============================================================================])
|