1*c43cad87SWarner Losh<<<<<<< HEAD 2*c43cad87SWarner Loshdnl Process this file with autoconf to produce a configure script. 3*c43cad87SWarner LoshAC_PREREQ(2.68) 4*c43cad87SWarner LoshAC_INIT([Makefile.in]) 5*c43cad87SWarner Losh 6*c43cad87SWarner LoshAC_CONFIG_AUX_DIR([build-aux]) 7*c43cad87SWarner Losh 8*c43cad87SWarner Loshdnl ============================================================================ 9*c43cad87SWarner Loshdnl Custom macro definitions. 10*c43cad87SWarner Losh 11*c43cad87SWarner Loshdnl JE_CONCAT_VVV(r, a, b) 12*c43cad87SWarner Loshdnl 13*c43cad87SWarner Loshdnl Set $r to the concatenation of $a and $b, with a space separating them iff 14*c43cad87SWarner Loshdnl both $a and $b are non-empty. 15*c43cad87SWarner LoshAC_DEFUN([JE_CONCAT_VVV], 16*c43cad87SWarner Loshif test "x[$]{$2}" = "x" -o "x[$]{$3}" = "x" ; then 17*c43cad87SWarner Losh $1="[$]{$2}[$]{$3}" 18*c43cad87SWarner Loshelse 19*c43cad87SWarner Losh $1="[$]{$2} [$]{$3}" 20*c43cad87SWarner Loshfi 21*c43cad87SWarner Losh) 22*c43cad87SWarner Losh 23*c43cad87SWarner Loshdnl JE_APPEND_VS(a, b) 24*c43cad87SWarner Loshdnl 25*c43cad87SWarner Loshdnl Set $a to the concatenation of $a and b, with a space separating them iff 26*c43cad87SWarner Loshdnl both $a and b are non-empty. 27*c43cad87SWarner LoshAC_DEFUN([JE_APPEND_VS], 28*c43cad87SWarner Losh T_APPEND_V=$2 29*c43cad87SWarner Losh JE_CONCAT_VVV($1, $1, T_APPEND_V) 30*c43cad87SWarner Losh) 31*c43cad87SWarner Losh 32*c43cad87SWarner LoshCONFIGURE_CFLAGS= 33*c43cad87SWarner LoshSPECIFIED_CFLAGS="${CFLAGS}" 34*c43cad87SWarner Loshdnl JE_CFLAGS_ADD(cflag) 35*c43cad87SWarner Loshdnl 36*c43cad87SWarner Loshdnl CFLAGS is the concatenation of CONFIGURE_CFLAGS and SPECIFIED_CFLAGS 37*c43cad87SWarner Loshdnl (ignoring EXTRA_CFLAGS, which does not impact configure tests. This macro 38*c43cad87SWarner Loshdnl appends to CONFIGURE_CFLAGS and regenerates CFLAGS. 39*c43cad87SWarner LoshAC_DEFUN([JE_CFLAGS_ADD], 40*c43cad87SWarner Losh[ 41*c43cad87SWarner LoshAC_MSG_CHECKING([whether compiler supports $1]) 42*c43cad87SWarner LoshT_CONFIGURE_CFLAGS="${CONFIGURE_CFLAGS}" 43*c43cad87SWarner LoshJE_APPEND_VS(CONFIGURE_CFLAGS, $1) 44*c43cad87SWarner LoshJE_CONCAT_VVV(CFLAGS, CONFIGURE_CFLAGS, SPECIFIED_CFLAGS) 45*c43cad87SWarner LoshAC_COMPILE_IFELSE([AC_LANG_PROGRAM( 46*c43cad87SWarner Losh[[ 47*c43cad87SWarner Losh]], [[ 48*c43cad87SWarner Losh return 0; 49*c43cad87SWarner Losh]])], 50*c43cad87SWarner Losh [je_cv_cflags_added=$1] 51*c43cad87SWarner Losh AC_MSG_RESULT([yes]), 52*c43cad87SWarner Losh [je_cv_cflags_added=] 53*c43cad87SWarner Losh AC_MSG_RESULT([no]) 54*c43cad87SWarner Losh [CONFIGURE_CFLAGS="${T_CONFIGURE_CFLAGS}"] 55*c43cad87SWarner Losh) 56*c43cad87SWarner LoshJE_CONCAT_VVV(CFLAGS, CONFIGURE_CFLAGS, SPECIFIED_CFLAGS) 57*c43cad87SWarner Losh]) 58*c43cad87SWarner Losh 59*c43cad87SWarner Loshdnl JE_CFLAGS_SAVE() 60*c43cad87SWarner Loshdnl JE_CFLAGS_RESTORE() 61*c43cad87SWarner Loshdnl 62*c43cad87SWarner Loshdnl Save/restore CFLAGS. Nesting is not supported. 63*c43cad87SWarner LoshAC_DEFUN([JE_CFLAGS_SAVE], 64*c43cad87SWarner LoshSAVED_CONFIGURE_CFLAGS="${CONFIGURE_CFLAGS}" 65*c43cad87SWarner Losh) 66*c43cad87SWarner LoshAC_DEFUN([JE_CFLAGS_RESTORE], 67*c43cad87SWarner LoshCONFIGURE_CFLAGS="${SAVED_CONFIGURE_CFLAGS}" 68*c43cad87SWarner LoshJE_CONCAT_VVV(CFLAGS, CONFIGURE_CFLAGS, SPECIFIED_CFLAGS) 69*c43cad87SWarner Losh) 70*c43cad87SWarner Losh 71*c43cad87SWarner LoshCONFIGURE_CXXFLAGS= 72*c43cad87SWarner LoshSPECIFIED_CXXFLAGS="${CXXFLAGS}" 73*c43cad87SWarner Loshdnl JE_CXXFLAGS_ADD(cxxflag) 74*c43cad87SWarner LoshAC_DEFUN([JE_CXXFLAGS_ADD], 75*c43cad87SWarner Losh[ 76*c43cad87SWarner LoshAC_MSG_CHECKING([whether compiler supports $1]) 77*c43cad87SWarner LoshT_CONFIGURE_CXXFLAGS="${CONFIGURE_CXXFLAGS}" 78*c43cad87SWarner LoshJE_APPEND_VS(CONFIGURE_CXXFLAGS, $1) 79*c43cad87SWarner LoshJE_CONCAT_VVV(CXXFLAGS, CONFIGURE_CXXFLAGS, SPECIFIED_CXXFLAGS) 80*c43cad87SWarner LoshAC_LANG_PUSH([C++]) 81*c43cad87SWarner LoshAC_COMPILE_IFELSE([AC_LANG_PROGRAM( 82*c43cad87SWarner Losh[[ 83*c43cad87SWarner Losh]], [[ 84*c43cad87SWarner Losh return 0; 85*c43cad87SWarner Losh]])], 86*c43cad87SWarner Losh [je_cv_cxxflags_added=$1] 87*c43cad87SWarner Losh AC_MSG_RESULT([yes]), 88*c43cad87SWarner Losh [je_cv_cxxflags_added=] 89*c43cad87SWarner Losh AC_MSG_RESULT([no]) 90*c43cad87SWarner Losh [CONFIGURE_CXXFLAGS="${T_CONFIGURE_CXXFLAGS}"] 91*c43cad87SWarner Losh) 92*c43cad87SWarner LoshAC_LANG_POP([C++]) 93*c43cad87SWarner LoshJE_CONCAT_VVV(CXXFLAGS, CONFIGURE_CXXFLAGS, SPECIFIED_CXXFLAGS) 94*c43cad87SWarner Losh]) 95*c43cad87SWarner Losh 96*c43cad87SWarner Loshdnl JE_COMPILABLE(label, hcode, mcode, rvar) 97*c43cad87SWarner Loshdnl 98*c43cad87SWarner Loshdnl Use AC_LINK_IFELSE() rather than AC_COMPILE_IFELSE() so that linker errors 99*c43cad87SWarner Loshdnl cause failure. 100*c43cad87SWarner LoshAC_DEFUN([JE_COMPILABLE], 101*c43cad87SWarner Losh[ 102*c43cad87SWarner LoshAC_CACHE_CHECK([whether $1 is compilable], 103*c43cad87SWarner Losh [$4], 104*c43cad87SWarner Losh [AC_LINK_IFELSE([AC_LANG_PROGRAM([$2], 105*c43cad87SWarner Losh [$3])], 106*c43cad87SWarner Losh [$4=yes], 107*c43cad87SWarner Losh [$4=no])]) 108*c43cad87SWarner Losh]) 109*c43cad87SWarner Losh 110*c43cad87SWarner Loshdnl ============================================================================ 111*c43cad87SWarner Losh 112*c43cad87SWarner LoshCONFIG=`echo ${ac_configure_args} | sed -e 's#'"'"'\([^ ]*\)'"'"'#\1#g'` 113*c43cad87SWarner LoshAC_SUBST([CONFIG]) 114*c43cad87SWarner Losh 115*c43cad87SWarner Loshdnl Library revision. 116*c43cad87SWarner Loshrev=2 117*c43cad87SWarner LoshAC_SUBST([rev]) 118*c43cad87SWarner Losh 119*c43cad87SWarner Loshsrcroot=$srcdir 120*c43cad87SWarner Loshif test "x${srcroot}" = "x." ; then 121*c43cad87SWarner Losh srcroot="" 122*c43cad87SWarner Loshelse 123*c43cad87SWarner Losh srcroot="${srcroot}/" 124*c43cad87SWarner Loshfi 125*c43cad87SWarner LoshAC_SUBST([srcroot]) 126*c43cad87SWarner Loshabs_srcroot="`cd \"${srcdir}\"; pwd`/" 127*c43cad87SWarner LoshAC_SUBST([abs_srcroot]) 128*c43cad87SWarner Losh 129*c43cad87SWarner Loshobjroot="" 130*c43cad87SWarner LoshAC_SUBST([objroot]) 131*c43cad87SWarner Loshabs_objroot="`pwd`/" 132*c43cad87SWarner LoshAC_SUBST([abs_objroot]) 133*c43cad87SWarner Losh 134*c43cad87SWarner Loshdnl Munge install path variables. 135*c43cad87SWarner Loshcase "$prefix" in 136*c43cad87SWarner Losh *\ * ) AC_MSG_ERROR([Prefix should not contain spaces]) ;; 137*c43cad87SWarner Losh "NONE" ) prefix="/usr/local" ;; 138*c43cad87SWarner Loshesac 139*c43cad87SWarner Loshcase "$exec_prefix" in 140*c43cad87SWarner Losh *\ * ) AC_MSG_ERROR([Exec prefix should not contain spaces]) ;; 141*c43cad87SWarner Losh "NONE" ) exec_prefix=$prefix ;; 142*c43cad87SWarner Loshesac 143*c43cad87SWarner LoshPREFIX=$prefix 144*c43cad87SWarner LoshAC_SUBST([PREFIX]) 145*c43cad87SWarner LoshBINDIR=`eval echo $bindir` 146*c43cad87SWarner LoshBINDIR=`eval echo $BINDIR` 147*c43cad87SWarner LoshAC_SUBST([BINDIR]) 148*c43cad87SWarner LoshINCLUDEDIR=`eval echo $includedir` 149*c43cad87SWarner LoshINCLUDEDIR=`eval echo $INCLUDEDIR` 150*c43cad87SWarner LoshAC_SUBST([INCLUDEDIR]) 151*c43cad87SWarner LoshLIBDIR=`eval echo $libdir` 152*c43cad87SWarner LoshLIBDIR=`eval echo $LIBDIR` 153*c43cad87SWarner LoshAC_SUBST([LIBDIR]) 154*c43cad87SWarner LoshDATADIR=`eval echo $datadir` 155*c43cad87SWarner LoshDATADIR=`eval echo $DATADIR` 156*c43cad87SWarner LoshAC_SUBST([DATADIR]) 157*c43cad87SWarner LoshMANDIR=`eval echo $mandir` 158*c43cad87SWarner LoshMANDIR=`eval echo $MANDIR` 159*c43cad87SWarner LoshAC_SUBST([MANDIR]) 160*c43cad87SWarner Losh 161*c43cad87SWarner Loshdnl Support for building documentation. 162*c43cad87SWarner LoshAC_PATH_PROG([XSLTPROC], [xsltproc], [false], [$PATH]) 163*c43cad87SWarner Loshif test -d "/usr/share/xml/docbook/stylesheet/docbook-xsl" ; then 164*c43cad87SWarner Losh DEFAULT_XSLROOT="/usr/share/xml/docbook/stylesheet/docbook-xsl" 165*c43cad87SWarner Loshelif test -d "/usr/share/sgml/docbook/xsl-stylesheets" ; then 166*c43cad87SWarner Losh DEFAULT_XSLROOT="/usr/share/sgml/docbook/xsl-stylesheets" 167*c43cad87SWarner Loshelse 168*c43cad87SWarner Losh dnl Documentation building will fail if this default gets used. 169*c43cad87SWarner Losh DEFAULT_XSLROOT="" 170*c43cad87SWarner Loshfi 171*c43cad87SWarner LoshAC_ARG_WITH([xslroot], 172*c43cad87SWarner Losh [AS_HELP_STRING([--with-xslroot=<path>], [XSL stylesheet root path])], [ 173*c43cad87SWarner Loshif test "x$with_xslroot" = "xno" ; then 174*c43cad87SWarner Losh XSLROOT="${DEFAULT_XSLROOT}" 175*c43cad87SWarner Loshelse 176*c43cad87SWarner Losh XSLROOT="${with_xslroot}" 177*c43cad87SWarner Loshfi 178*c43cad87SWarner Losh], 179*c43cad87SWarner Losh XSLROOT="${DEFAULT_XSLROOT}" 180*c43cad87SWarner Losh) 181*c43cad87SWarner Loshif test "x$XSLTPROC" = "xfalse" ; then 182*c43cad87SWarner Losh XSLROOT="" 183*c43cad87SWarner Loshfi 184*c43cad87SWarner LoshAC_SUBST([XSLROOT]) 185*c43cad87SWarner Losh 186*c43cad87SWarner Loshdnl If CFLAGS isn't defined, set CFLAGS to something reasonable. Otherwise, 187*c43cad87SWarner Loshdnl just prevent autoconf from molesting CFLAGS. 188*c43cad87SWarner LoshCFLAGS=$CFLAGS 189*c43cad87SWarner LoshAC_PROG_CC 190*c43cad87SWarner Losh 191*c43cad87SWarner Loshif test "x$GCC" != "xyes" ; then 192*c43cad87SWarner Losh AC_CACHE_CHECK([whether compiler is MSVC], 193*c43cad87SWarner Losh [je_cv_msvc], 194*c43cad87SWarner Losh [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], 195*c43cad87SWarner Losh [ 196*c43cad87SWarner Losh#ifndef _MSC_VER 197*c43cad87SWarner Losh int fail[-1]; 198*c43cad87SWarner Losh#endif 199*c43cad87SWarner Losh])], 200*c43cad87SWarner Losh [je_cv_msvc=yes], 201*c43cad87SWarner Losh [je_cv_msvc=no])]) 202*c43cad87SWarner Loshfi 203*c43cad87SWarner Losh 204*c43cad87SWarner Loshdnl check if a cray prgenv wrapper compiler is being used 205*c43cad87SWarner Loshje_cv_cray_prgenv_wrapper="" 206*c43cad87SWarner Loshif test "x${PE_ENV}" != "x" ; then 207*c43cad87SWarner Losh case "${CC}" in 208*c43cad87SWarner Losh CC|cc) 209*c43cad87SWarner Losh je_cv_cray_prgenv_wrapper="yes" 210*c43cad87SWarner Losh ;; 211*c43cad87SWarner Losh *) 212*c43cad87SWarner Losh ;; 213*c43cad87SWarner Losh esac 214*c43cad87SWarner Loshfi 215*c43cad87SWarner Losh 216*c43cad87SWarner LoshAC_CACHE_CHECK([whether compiler is cray], 217*c43cad87SWarner Losh [je_cv_cray], 218*c43cad87SWarner Losh [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], 219*c43cad87SWarner Losh [ 220*c43cad87SWarner Losh#ifndef _CRAYC 221*c43cad87SWarner Losh int fail[-1]; 222*c43cad87SWarner Losh#endif 223*c43cad87SWarner Losh])], 224*c43cad87SWarner Losh [je_cv_cray=yes], 225*c43cad87SWarner Losh [je_cv_cray=no])]) 226*c43cad87SWarner Losh 227*c43cad87SWarner Loshif test "x${je_cv_cray}" = "xyes" ; then 228*c43cad87SWarner Losh AC_CACHE_CHECK([whether cray compiler version is 8.4], 229*c43cad87SWarner Losh [je_cv_cray_84], 230*c43cad87SWarner Losh [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], 231*c43cad87SWarner Losh [ 232*c43cad87SWarner Losh#if !(_RELEASE_MAJOR == 8 && _RELEASE_MINOR == 4) 233*c43cad87SWarner Losh int fail[-1]; 234*c43cad87SWarner Losh#endif 235*c43cad87SWarner Losh])], 236*c43cad87SWarner Losh [je_cv_cray_84=yes], 237*c43cad87SWarner Losh [je_cv_cray_84=no])]) 238*c43cad87SWarner Loshfi 239*c43cad87SWarner Losh 240*c43cad87SWarner Loshif test "x$GCC" = "xyes" ; then 241*c43cad87SWarner Losh JE_CFLAGS_ADD([-std=gnu11]) 242*c43cad87SWarner Losh if test "x$je_cv_cflags_added" = "x-std=gnu11" ; then 243*c43cad87SWarner Losh AC_DEFINE_UNQUOTED([JEMALLOC_HAS_RESTRICT], [ ], [ ]) 244*c43cad87SWarner Losh else 245*c43cad87SWarner Losh JE_CFLAGS_ADD([-std=gnu99]) 246*c43cad87SWarner Losh if test "x$je_cv_cflags_added" = "x-std=gnu99" ; then 247*c43cad87SWarner Losh AC_DEFINE_UNQUOTED([JEMALLOC_HAS_RESTRICT], [ ], [ ]) 248*c43cad87SWarner Losh fi 249*c43cad87SWarner Losh fi 250*c43cad87SWarner Losh JE_CFLAGS_ADD([-Werror=unknown-warning-option]) 251*c43cad87SWarner Losh JE_CFLAGS_ADD([-Wall]) 252*c43cad87SWarner Losh JE_CFLAGS_ADD([-Wextra]) 253*c43cad87SWarner Losh JE_CFLAGS_ADD([-Wshorten-64-to-32]) 254*c43cad87SWarner Losh JE_CFLAGS_ADD([-Wsign-compare]) 255*c43cad87SWarner Losh JE_CFLAGS_ADD([-Wundef]) 256*c43cad87SWarner Losh JE_CFLAGS_ADD([-Wno-format-zero-length]) 257*c43cad87SWarner Losh JE_CFLAGS_ADD([-Wpointer-arith]) 258*c43cad87SWarner Losh dnl This warning triggers on the use of the universal zero initializer, which 259*c43cad87SWarner Losh dnl is a very handy idiom for things like the tcache static initializer (which 260*c43cad87SWarner Losh dnl has lots of nested structs). See the discussion at. 261*c43cad87SWarner Losh dnl https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53119 262*c43cad87SWarner Losh JE_CFLAGS_ADD([-Wno-missing-braces]) 263*c43cad87SWarner Losh dnl This one too. 264*c43cad87SWarner Losh JE_CFLAGS_ADD([-Wno-missing-field-initializers]) 265*c43cad87SWarner Losh JE_CFLAGS_ADD([-Wno-missing-attributes]) 266*c43cad87SWarner Losh JE_CFLAGS_ADD([-pipe]) 267*c43cad87SWarner Losh JE_CFLAGS_ADD([-g3]) 268*c43cad87SWarner Loshelif test "x$je_cv_msvc" = "xyes" ; then 269*c43cad87SWarner Losh CC="$CC -nologo" 270*c43cad87SWarner Losh JE_CFLAGS_ADD([-Zi]) 271*c43cad87SWarner Losh JE_CFLAGS_ADD([-MT]) 272*c43cad87SWarner Losh JE_CFLAGS_ADD([-W3]) 273*c43cad87SWarner Losh JE_CFLAGS_ADD([-FS]) 274*c43cad87SWarner Losh JE_APPEND_VS(CPPFLAGS, -I${srcdir}/include/msvc_compat) 275*c43cad87SWarner Loshfi 276*c43cad87SWarner Loshif test "x$je_cv_cray" = "xyes" ; then 277*c43cad87SWarner Losh dnl cray compiler 8.4 has an inlining bug 278*c43cad87SWarner Losh if test "x$je_cv_cray_84" = "xyes" ; then 279*c43cad87SWarner Losh JE_CFLAGS_ADD([-hipa2]) 280*c43cad87SWarner Losh JE_CFLAGS_ADD([-hnognu]) 281*c43cad87SWarner Losh fi 282*c43cad87SWarner Losh dnl ignore unreachable code warning 283*c43cad87SWarner Losh JE_CFLAGS_ADD([-hnomessage=128]) 284*c43cad87SWarner Losh dnl ignore redefinition of "malloc", "free", etc warning 285*c43cad87SWarner Losh JE_CFLAGS_ADD([-hnomessage=1357]) 286*c43cad87SWarner Loshfi 287*c43cad87SWarner LoshAC_SUBST([CONFIGURE_CFLAGS]) 288*c43cad87SWarner LoshAC_SUBST([SPECIFIED_CFLAGS]) 289*c43cad87SWarner LoshAC_SUBST([EXTRA_CFLAGS]) 290*c43cad87SWarner LoshAC_PROG_CPP 291*c43cad87SWarner Losh 292*c43cad87SWarner LoshAC_ARG_ENABLE([cxx], 293*c43cad87SWarner Losh [AS_HELP_STRING([--disable-cxx], [Disable C++ integration])], 294*c43cad87SWarner Loshif test "x$enable_cxx" = "xno" ; then 295*c43cad87SWarner Losh enable_cxx="0" 296*c43cad87SWarner Loshelse 297*c43cad87SWarner Losh enable_cxx="1" 298*c43cad87SWarner Loshfi 299*c43cad87SWarner Losh, 300*c43cad87SWarner Loshenable_cxx="1" 301*c43cad87SWarner Losh) 302*c43cad87SWarner Loshif test "x$enable_cxx" = "x1" ; then 303*c43cad87SWarner Losh dnl Require at least c++14, which is the first version to support sized 304*c43cad87SWarner Losh dnl deallocation. C++ support is not compiled otherwise. 305*c43cad87SWarner Losh m4_include([m4/ax_cxx_compile_stdcxx.m4]) 306*c43cad87SWarner Losh AX_CXX_COMPILE_STDCXX([17], [noext], [optional]) 307*c43cad87SWarner Losh if test "x${HAVE_CXX17}" != "x1"; then 308*c43cad87SWarner Losh AX_CXX_COMPILE_STDCXX([14], [noext], [optional]) 309*c43cad87SWarner Losh fi 310*c43cad87SWarner Losh if test "x${HAVE_CXX14}" = "x1" -o "x${HAVE_CXX17}" = "x1"; then 311*c43cad87SWarner Losh JE_CXXFLAGS_ADD([-Wall]) 312*c43cad87SWarner Losh JE_CXXFLAGS_ADD([-Wextra]) 313*c43cad87SWarner Losh JE_CXXFLAGS_ADD([-g3]) 314*c43cad87SWarner Losh 315*c43cad87SWarner Losh SAVED_LIBS="${LIBS}" 316*c43cad87SWarner Losh JE_APPEND_VS(LIBS, -lstdc++) 317*c43cad87SWarner Losh JE_COMPILABLE([libstdc++ linkage], [ 318*c43cad87SWarner Losh#include <stdlib.h> 319*c43cad87SWarner Losh], [[ 320*c43cad87SWarner Losh int *arr = (int *)malloc(sizeof(int) * 42); 321*c43cad87SWarner Losh if (arr == NULL) 322*c43cad87SWarner Losh return 1; 323*c43cad87SWarner Losh]], [je_cv_libstdcxx]) 324*c43cad87SWarner Losh if test "x${je_cv_libstdcxx}" = "xno" ; then 325*c43cad87SWarner Losh LIBS="${SAVED_LIBS}" 326*c43cad87SWarner Losh fi 327*c43cad87SWarner Losh else 328*c43cad87SWarner Losh enable_cxx="0" 329*c43cad87SWarner Losh fi 330*c43cad87SWarner Loshfi 331*c43cad87SWarner Loshif test "x$enable_cxx" = "x1"; then 332*c43cad87SWarner Losh AC_DEFINE([JEMALLOC_ENABLE_CXX], [ ], [ ]) 333*c43cad87SWarner Loshfi 334*c43cad87SWarner LoshAC_SUBST([enable_cxx]) 335*c43cad87SWarner LoshAC_SUBST([CONFIGURE_CXXFLAGS]) 336*c43cad87SWarner LoshAC_SUBST([SPECIFIED_CXXFLAGS]) 337*c43cad87SWarner LoshAC_SUBST([EXTRA_CXXFLAGS]) 338*c43cad87SWarner Losh 339*c43cad87SWarner LoshAC_C_BIGENDIAN([ac_cv_big_endian=1], [ac_cv_big_endian=0]) 340*c43cad87SWarner Loshif test "x${ac_cv_big_endian}" = "x1" ; then 341*c43cad87SWarner Losh AC_DEFINE_UNQUOTED([JEMALLOC_BIG_ENDIAN], [ ], [ ]) 342*c43cad87SWarner Loshfi 343*c43cad87SWarner Losh 344*c43cad87SWarner Loshif test "x${je_cv_msvc}" = "xyes" -a "x${ac_cv_header_inttypes_h}" = "xno"; then 345*c43cad87SWarner Losh JE_APPEND_VS(CPPFLAGS, -I${srcdir}/include/msvc_compat/C99) 346*c43cad87SWarner Loshfi 347*c43cad87SWarner Losh 348*c43cad87SWarner Loshif test "x${je_cv_msvc}" = "xyes" ; then 349*c43cad87SWarner Losh LG_SIZEOF_PTR=LG_SIZEOF_PTR_WIN 350*c43cad87SWarner Losh AC_MSG_RESULT([Using a predefined value for sizeof(void *): 4 for 32-bit, 8 for 64-bit]) 351*c43cad87SWarner Loshelse 352*c43cad87SWarner Losh AC_CHECK_SIZEOF([void *]) 353*c43cad87SWarner Losh if test "x${ac_cv_sizeof_void_p}" = "x8" ; then 354*c43cad87SWarner Losh LG_SIZEOF_PTR=3 355*c43cad87SWarner Losh elif test "x${ac_cv_sizeof_void_p}" = "x4" ; then 356*c43cad87SWarner Losh LG_SIZEOF_PTR=2 357*c43cad87SWarner Losh else 358*c43cad87SWarner Losh AC_MSG_ERROR([Unsupported pointer size: ${ac_cv_sizeof_void_p}]) 359*c43cad87SWarner Losh fi 360*c43cad87SWarner Loshfi 361*c43cad87SWarner LoshAC_DEFINE_UNQUOTED([LG_SIZEOF_PTR], [$LG_SIZEOF_PTR], [ ]) 362*c43cad87SWarner Losh 363*c43cad87SWarner LoshAC_CHECK_SIZEOF([int]) 364*c43cad87SWarner Loshif test "x${ac_cv_sizeof_int}" = "x8" ; then 365*c43cad87SWarner Losh LG_SIZEOF_INT=3 366*c43cad87SWarner Loshelif test "x${ac_cv_sizeof_int}" = "x4" ; then 367*c43cad87SWarner Losh LG_SIZEOF_INT=2 368*c43cad87SWarner Loshelse 369*c43cad87SWarner Losh AC_MSG_ERROR([Unsupported int size: ${ac_cv_sizeof_int}]) 370*c43cad87SWarner Loshfi 371*c43cad87SWarner LoshAC_DEFINE_UNQUOTED([LG_SIZEOF_INT], [$LG_SIZEOF_INT], [ ]) 372*c43cad87SWarner Losh 373*c43cad87SWarner LoshAC_CHECK_SIZEOF([long]) 374*c43cad87SWarner Loshif test "x${ac_cv_sizeof_long}" = "x8" ; then 375*c43cad87SWarner Losh LG_SIZEOF_LONG=3 376*c43cad87SWarner Loshelif test "x${ac_cv_sizeof_long}" = "x4" ; then 377*c43cad87SWarner Losh LG_SIZEOF_LONG=2 378*c43cad87SWarner Loshelse 379*c43cad87SWarner Losh AC_MSG_ERROR([Unsupported long size: ${ac_cv_sizeof_long}]) 380*c43cad87SWarner Loshfi 381*c43cad87SWarner LoshAC_DEFINE_UNQUOTED([LG_SIZEOF_LONG], [$LG_SIZEOF_LONG], [ ]) 382*c43cad87SWarner Losh 383*c43cad87SWarner LoshAC_CHECK_SIZEOF([long long]) 384*c43cad87SWarner Loshif test "x${ac_cv_sizeof_long_long}" = "x8" ; then 385*c43cad87SWarner Losh LG_SIZEOF_LONG_LONG=3 386*c43cad87SWarner Loshelif test "x${ac_cv_sizeof_long_long}" = "x4" ; then 387*c43cad87SWarner Losh LG_SIZEOF_LONG_LONG=2 388*c43cad87SWarner Loshelse 389*c43cad87SWarner Losh AC_MSG_ERROR([Unsupported long long size: ${ac_cv_sizeof_long_long}]) 390*c43cad87SWarner Loshfi 391*c43cad87SWarner LoshAC_DEFINE_UNQUOTED([LG_SIZEOF_LONG_LONG], [$LG_SIZEOF_LONG_LONG], [ ]) 392*c43cad87SWarner Losh 393*c43cad87SWarner LoshAC_CHECK_SIZEOF([intmax_t]) 394*c43cad87SWarner Loshif test "x${ac_cv_sizeof_intmax_t}" = "x16" ; then 395*c43cad87SWarner Losh LG_SIZEOF_INTMAX_T=4 396*c43cad87SWarner Loshelif test "x${ac_cv_sizeof_intmax_t}" = "x8" ; then 397*c43cad87SWarner Losh LG_SIZEOF_INTMAX_T=3 398*c43cad87SWarner Loshelif test "x${ac_cv_sizeof_intmax_t}" = "x4" ; then 399*c43cad87SWarner Losh LG_SIZEOF_INTMAX_T=2 400*c43cad87SWarner Loshelse 401*c43cad87SWarner Losh AC_MSG_ERROR([Unsupported intmax_t size: ${ac_cv_sizeof_intmax_t}]) 402*c43cad87SWarner Loshfi 403*c43cad87SWarner LoshAC_DEFINE_UNQUOTED([LG_SIZEOF_INTMAX_T], [$LG_SIZEOF_INTMAX_T], [ ]) 404*c43cad87SWarner Losh 405*c43cad87SWarner LoshAC_CANONICAL_HOST 406*c43cad87SWarner Loshdnl CPU-specific settings. 407*c43cad87SWarner LoshCPU_SPINWAIT="" 408*c43cad87SWarner Loshcase "${host_cpu}" in 409*c43cad87SWarner Losh i686|x86_64) 410*c43cad87SWarner Losh HAVE_CPU_SPINWAIT=1 411*c43cad87SWarner Losh if test "x${je_cv_msvc}" = "xyes" ; then 412*c43cad87SWarner Losh AC_CACHE_VAL([je_cv_pause_msvc], 413*c43cad87SWarner Losh [JE_COMPILABLE([pause instruction MSVC], [], 414*c43cad87SWarner Losh [[_mm_pause(); return 0;]], 415*c43cad87SWarner Losh [je_cv_pause_msvc])]) 416*c43cad87SWarner Losh if test "x${je_cv_pause_msvc}" = "xyes" ; then 417*c43cad87SWarner Losh CPU_SPINWAIT='_mm_pause()' 418*c43cad87SWarner Losh fi 419*c43cad87SWarner Losh else 420*c43cad87SWarner Losh AC_CACHE_VAL([je_cv_pause], 421*c43cad87SWarner Losh [JE_COMPILABLE([pause instruction], [], 422*c43cad87SWarner Losh [[__asm__ volatile("pause"); return 0;]], 423*c43cad87SWarner Losh [je_cv_pause])]) 424*c43cad87SWarner Losh if test "x${je_cv_pause}" = "xyes" ; then 425*c43cad87SWarner Losh CPU_SPINWAIT='__asm__ volatile("pause")' 426*c43cad87SWarner Losh fi 427*c43cad87SWarner Losh fi 428*c43cad87SWarner Losh ;; 429*c43cad87SWarner Losh aarch64|arm*) 430*c43cad87SWarner Losh HAVE_CPU_SPINWAIT=1 431*c43cad87SWarner Losh dnl isb is a better equivalent to the pause instruction on x86. 432*c43cad87SWarner Losh AC_CACHE_VAL([je_cv_isb], 433*c43cad87SWarner Losh [JE_COMPILABLE([isb instruction], [], 434*c43cad87SWarner Losh [[__asm__ volatile("isb"); return 0;]], 435*c43cad87SWarner Losh [je_cv_isb])]) 436*c43cad87SWarner Losh if test "x${je_cv_isb}" = "xyes" ; then 437*c43cad87SWarner Losh CPU_SPINWAIT='__asm__ volatile("isb")' 438*c43cad87SWarner Losh fi 439*c43cad87SWarner Losh ;; 440*c43cad87SWarner Losh *) 441*c43cad87SWarner Losh HAVE_CPU_SPINWAIT=0 442*c43cad87SWarner Losh ;; 443*c43cad87SWarner Loshesac 444*c43cad87SWarner LoshAC_DEFINE_UNQUOTED([HAVE_CPU_SPINWAIT], [$HAVE_CPU_SPINWAIT], [ ]) 445*c43cad87SWarner LoshAC_DEFINE_UNQUOTED([CPU_SPINWAIT], [$CPU_SPINWAIT], [ ]) 446*c43cad87SWarner Losh 447*c43cad87SWarner LoshAC_ARG_WITH([lg_vaddr], 448*c43cad87SWarner Losh [AS_HELP_STRING([--with-lg-vaddr=<lg-vaddr>], [Number of significant virtual address bits])], 449*c43cad87SWarner Losh [LG_VADDR="$with_lg_vaddr"], [LG_VADDR="detect"]) 450*c43cad87SWarner Losh 451*c43cad87SWarner Loshcase "${host_cpu}" in 452*c43cad87SWarner Losh aarch64) 453*c43cad87SWarner Losh if test "x$LG_VADDR" = "xdetect"; then 454*c43cad87SWarner Losh AC_MSG_CHECKING([number of significant virtual address bits]) 455*c43cad87SWarner Losh if test "x${LG_SIZEOF_PTR}" = "x2" ; then 456*c43cad87SWarner Losh #aarch64 ILP32 457*c43cad87SWarner Losh LG_VADDR=32 458*c43cad87SWarner Losh else 459*c43cad87SWarner Losh #aarch64 LP64 460*c43cad87SWarner Losh LG_VADDR=48 461*c43cad87SWarner Losh fi 462*c43cad87SWarner Losh AC_MSG_RESULT([$LG_VADDR]) 463*c43cad87SWarner Losh fi 464*c43cad87SWarner Losh ;; 465*c43cad87SWarner Losh x86_64) 466*c43cad87SWarner Losh if test "x$LG_VADDR" = "xdetect"; then 467*c43cad87SWarner Losh AC_CACHE_CHECK([number of significant virtual address bits], 468*c43cad87SWarner Losh [je_cv_lg_vaddr], 469*c43cad87SWarner Losh AC_RUN_IFELSE([AC_LANG_PROGRAM( 470*c43cad87SWarner Losh[[ 471*c43cad87SWarner Losh#include <stdio.h> 472*c43cad87SWarner Losh#ifdef _WIN32 473*c43cad87SWarner Losh#include <limits.h> 474*c43cad87SWarner Losh#include <intrin.h> 475*c43cad87SWarner Loshtypedef unsigned __int32 uint32_t; 476*c43cad87SWarner Losh#else 477*c43cad87SWarner Losh#include <stdint.h> 478*c43cad87SWarner Losh#endif 479*c43cad87SWarner Losh]], [[ 480*c43cad87SWarner Losh uint32_t r[[4]]; 481*c43cad87SWarner Losh uint32_t eax_in = 0x80000008U; 482*c43cad87SWarner Losh#ifdef _WIN32 483*c43cad87SWarner Losh __cpuid((int *)r, (int)eax_in); 484*c43cad87SWarner Losh#else 485*c43cad87SWarner Losh asm volatile ("cpuid" 486*c43cad87SWarner Losh : "=a" (r[[0]]), "=b" (r[[1]]), "=c" (r[[2]]), "=d" (r[[3]]) 487*c43cad87SWarner Losh : "a" (eax_in), "c" (0) 488*c43cad87SWarner Losh ); 489*c43cad87SWarner Losh#endif 490*c43cad87SWarner Losh uint32_t eax_out = r[[0]]; 491*c43cad87SWarner Losh uint32_t vaddr = ((eax_out & 0x0000ff00U) >> 8); 492*c43cad87SWarner Losh FILE *f = fopen("conftest.out", "w"); 493*c43cad87SWarner Losh if (f == NULL) { 494*c43cad87SWarner Losh return 1; 495*c43cad87SWarner Losh } 496*c43cad87SWarner Losh if (vaddr > (sizeof(void *) << 3)) { 497*c43cad87SWarner Losh vaddr = sizeof(void *) << 3; 498*c43cad87SWarner Losh } 499*c43cad87SWarner Losh fprintf(f, "%u", vaddr); 500*c43cad87SWarner Losh fclose(f); 501*c43cad87SWarner Losh return 0; 502*c43cad87SWarner Losh]])], 503*c43cad87SWarner Losh [je_cv_lg_vaddr=`cat conftest.out`], 504*c43cad87SWarner Losh [je_cv_lg_vaddr=error], 505*c43cad87SWarner Losh [je_cv_lg_vaddr=57])) 506*c43cad87SWarner Losh if test "x${je_cv_lg_vaddr}" != "x" ; then 507*c43cad87SWarner Losh LG_VADDR="${je_cv_lg_vaddr}" 508*c43cad87SWarner Losh fi 509*c43cad87SWarner Losh if test "x${LG_VADDR}" != "xerror" ; then 510*c43cad87SWarner Losh AC_DEFINE_UNQUOTED([LG_VADDR], [$LG_VADDR], [ ]) 511*c43cad87SWarner Losh else 512*c43cad87SWarner Losh AC_MSG_ERROR([cannot determine number of significant virtual address bits]) 513*c43cad87SWarner Losh fi 514*c43cad87SWarner Losh fi 515*c43cad87SWarner Losh ;; 516*c43cad87SWarner Losh *) 517*c43cad87SWarner Losh if test "x$LG_VADDR" = "xdetect"; then 518*c43cad87SWarner Losh AC_MSG_CHECKING([number of significant virtual address bits]) 519*c43cad87SWarner Losh if test "x${LG_SIZEOF_PTR}" = "x3" ; then 520*c43cad87SWarner Losh LG_VADDR=64 521*c43cad87SWarner Losh elif test "x${LG_SIZEOF_PTR}" = "x2" ; then 522*c43cad87SWarner Losh LG_VADDR=32 523*c43cad87SWarner Losh elif test "x${LG_SIZEOF_PTR}" = "xLG_SIZEOF_PTR_WIN" ; then 524*c43cad87SWarner Losh LG_VADDR="(1U << (LG_SIZEOF_PTR_WIN+3))" 525*c43cad87SWarner Losh else 526*c43cad87SWarner Losh AC_MSG_ERROR([Unsupported lg(pointer size): ${LG_SIZEOF_PTR}]) 527*c43cad87SWarner Losh fi 528*c43cad87SWarner Losh AC_MSG_RESULT([$LG_VADDR]) 529*c43cad87SWarner Losh fi 530*c43cad87SWarner Losh ;; 531*c43cad87SWarner Loshesac 532*c43cad87SWarner LoshAC_DEFINE_UNQUOTED([LG_VADDR], [$LG_VADDR], [ ]) 533*c43cad87SWarner Losh 534*c43cad87SWarner LoshLD_PRELOAD_VAR="LD_PRELOAD" 535*c43cad87SWarner Loshso="so" 536*c43cad87SWarner Loshimportlib="${so}" 537*c43cad87SWarner Losho="$ac_objext" 538*c43cad87SWarner Losha="a" 539*c43cad87SWarner Loshexe="$ac_exeext" 540*c43cad87SWarner Loshlibprefix="lib" 541*c43cad87SWarner Loshlink_whole_archive="0" 542*c43cad87SWarner LoshDSO_LDFLAGS='-shared -Wl,-soname,$(@F)' 543*c43cad87SWarner LoshRPATH='-Wl,-rpath,$(1)' 544*c43cad87SWarner LoshSOREV="${so}.${rev}" 545*c43cad87SWarner LoshPIC_CFLAGS='-fPIC -DPIC' 546*c43cad87SWarner LoshCTARGET='-o $@' 547*c43cad87SWarner LoshLDTARGET='-o $@' 548*c43cad87SWarner LoshTEST_LD_MODE= 549*c43cad87SWarner LoshEXTRA_LDFLAGS= 550*c43cad87SWarner LoshARFLAGS='crus' 551*c43cad87SWarner LoshAROUT=' $@' 552*c43cad87SWarner LoshCC_MM=1 553*c43cad87SWarner Losh 554*c43cad87SWarner Loshif test "x$je_cv_cray_prgenv_wrapper" = "xyes" ; then 555*c43cad87SWarner Losh TEST_LD_MODE='-dynamic' 556*c43cad87SWarner Loshfi 557*c43cad87SWarner Losh 558*c43cad87SWarner Loshif test "x${je_cv_cray}" = "xyes" ; then 559*c43cad87SWarner Losh CC_MM= 560*c43cad87SWarner Loshfi 561*c43cad87SWarner Losh 562*c43cad87SWarner LoshAN_MAKEVAR([AR], [AC_PROG_AR]) 563*c43cad87SWarner LoshAN_PROGRAM([ar], [AC_PROG_AR]) 564*c43cad87SWarner LoshAC_DEFUN([AC_PROG_AR], [AC_CHECK_TOOL(AR, ar, :)]) 565*c43cad87SWarner LoshAC_PROG_AR 566*c43cad87SWarner Losh 567*c43cad87SWarner LoshAN_MAKEVAR([NM], [AC_PROG_NM]) 568*c43cad87SWarner LoshAN_PROGRAM([nm], [AC_PROG_NM]) 569*c43cad87SWarner LoshAC_DEFUN([AC_PROG_NM], [AC_CHECK_TOOL(NM, nm, :)]) 570*c43cad87SWarner LoshAC_PROG_NM 571*c43cad87SWarner Losh 572*c43cad87SWarner LoshAC_PROG_AWK 573*c43cad87SWarner Losh 574*c43cad87SWarner Loshdnl ============================================================================ 575*c43cad87SWarner Loshdnl jemalloc version. 576*c43cad87SWarner Loshdnl 577*c43cad87SWarner Losh 578*c43cad87SWarner LoshAC_ARG_WITH([version], 579*c43cad87SWarner Losh [AS_HELP_STRING([--with-version=<major>.<minor>.<bugfix>-<nrev>-g<gid>], 580*c43cad87SWarner Losh [Version string])], 581*c43cad87SWarner Losh [ 582*c43cad87SWarner Losh echo "${with_version}" | grep ['^[0-9]\+\.[0-9]\+\.[0-9]\+-[0-9]\+-g[0-9a-f]\+$'] 2>&1 1>/dev/null 583*c43cad87SWarner Losh if test $? -eq 0 ; then 584*c43cad87SWarner Losh echo "$with_version" > "${objroot}VERSION" 585*c43cad87SWarner Losh else 586*c43cad87SWarner Losh echo "${with_version}" | grep ['^VERSION$'] 2>&1 1>/dev/null 587*c43cad87SWarner Losh if test $? -ne 0 ; then 588*c43cad87SWarner Losh AC_MSG_ERROR([${with_version} does not match <major>.<minor>.<bugfix>-<nrev>-g<gid> or VERSION]) 589*c43cad87SWarner Losh fi 590*c43cad87SWarner Losh fi 591*c43cad87SWarner Losh ], [ 592*c43cad87SWarner Losh dnl Set VERSION if source directory is inside a git repository. 593*c43cad87SWarner Losh if test "x`test ! \"${srcroot}\" && cd \"${srcroot}\"; git rev-parse --is-inside-work-tree 2>/dev/null`" = "xtrue" ; then 594*c43cad87SWarner Losh dnl Pattern globs aren't powerful enough to match both single- and 595*c43cad87SWarner Losh dnl double-digit version numbers, so iterate over patterns to support up 596*c43cad87SWarner Losh dnl to version 99.99.99 without any accidental matches. 597*c43cad87SWarner Losh for pattern in ['[0-9].[0-9].[0-9]' '[0-9].[0-9].[0-9][0-9]' \ 598*c43cad87SWarner Losh '[0-9].[0-9][0-9].[0-9]' '[0-9].[0-9][0-9].[0-9][0-9]' \ 599*c43cad87SWarner Losh '[0-9][0-9].[0-9].[0-9]' '[0-9][0-9].[0-9].[0-9][0-9]' \ 600*c43cad87SWarner Losh '[0-9][0-9].[0-9][0-9].[0-9]' \ 601*c43cad87SWarner Losh '[0-9][0-9].[0-9][0-9].[0-9][0-9]']; do 602*c43cad87SWarner Losh (test ! "${srcroot}" && cd "${srcroot}"; git describe --long --abbrev=40 --match="${pattern}") > "${objroot}VERSION.tmp" 2>/dev/null 603*c43cad87SWarner Losh if test $? -eq 0 ; then 604*c43cad87SWarner Losh mv "${objroot}VERSION.tmp" "${objroot}VERSION" 605*c43cad87SWarner Losh break 606*c43cad87SWarner Losh fi 607*c43cad87SWarner Losh done 608*c43cad87SWarner Losh fi 609*c43cad87SWarner Losh rm -f "${objroot}VERSION.tmp" 610*c43cad87SWarner Losh ]) 611*c43cad87SWarner Losh 612*c43cad87SWarner Loshif test ! -e "${objroot}VERSION" ; then 613*c43cad87SWarner Losh if test ! -e "${srcroot}VERSION" ; then 614*c43cad87SWarner Losh AC_MSG_RESULT( 615*c43cad87SWarner Losh [Missing VERSION file, and unable to generate it; creating bogus VERSION]) 616*c43cad87SWarner Losh echo "0.0.0-0-g000000missing_version_try_git_fetch_tags" > "${objroot}VERSION" 617*c43cad87SWarner Losh else 618*c43cad87SWarner Losh cp ${srcroot}VERSION ${objroot}VERSION 619*c43cad87SWarner Losh fi 620*c43cad87SWarner Loshfi 621*c43cad87SWarner Loshjemalloc_version=`cat "${objroot}VERSION"` 622*c43cad87SWarner Loshjemalloc_version_major=`echo ${jemalloc_version} | tr ".g-" " " | awk '{print [$]1}'` 623*c43cad87SWarner Loshjemalloc_version_minor=`echo ${jemalloc_version} | tr ".g-" " " | awk '{print [$]2}'` 624*c43cad87SWarner Loshjemalloc_version_bugfix=`echo ${jemalloc_version} | tr ".g-" " " | awk '{print [$]3}'` 625*c43cad87SWarner Loshjemalloc_version_nrev=`echo ${jemalloc_version} | tr ".g-" " " | awk '{print [$]4}'` 626*c43cad87SWarner Loshjemalloc_version_gid=`echo ${jemalloc_version} | tr ".g-" " " | awk '{print [$]5}'` 627*c43cad87SWarner LoshAC_SUBST([jemalloc_version]) 628*c43cad87SWarner LoshAC_SUBST([jemalloc_version_major]) 629*c43cad87SWarner LoshAC_SUBST([jemalloc_version_minor]) 630*c43cad87SWarner LoshAC_SUBST([jemalloc_version_bugfix]) 631*c43cad87SWarner LoshAC_SUBST([jemalloc_version_nrev]) 632*c43cad87SWarner LoshAC_SUBST([jemalloc_version_gid]) 633*c43cad87SWarner Losh 634*c43cad87SWarner Loshdnl Platform-specific settings. abi and RPATH can probably be determined 635*c43cad87SWarner Loshdnl programmatically, but doing so is error-prone, which makes it generally 636*c43cad87SWarner Loshdnl not worth the trouble. 637*c43cad87SWarner Loshdnl 638*c43cad87SWarner Loshdnl Define cpp macros in CPPFLAGS, rather than doing AC_DEFINE(macro), since the 639*c43cad87SWarner Loshdnl definitions need to be seen before any headers are included, which is a pain 640*c43cad87SWarner Loshdnl to make happen otherwise. 641*c43cad87SWarner Loshdefault_retain="0" 642*c43cad87SWarner Loshzero_realloc_default_free="0" 643*c43cad87SWarner Loshmaps_coalesce="1" 644*c43cad87SWarner LoshDUMP_SYMS="${NM} -a" 645*c43cad87SWarner LoshSYM_PREFIX="" 646*c43cad87SWarner Loshcase "${host}" in 647*c43cad87SWarner Losh *-*-darwin* | *-*-ios*) 648*c43cad87SWarner Losh abi="macho" 649*c43cad87SWarner Losh RPATH="" 650*c43cad87SWarner Losh LD_PRELOAD_VAR="DYLD_INSERT_LIBRARIES" 651*c43cad87SWarner Losh so="dylib" 652*c43cad87SWarner Losh importlib="${so}" 653*c43cad87SWarner Losh force_tls="0" 654*c43cad87SWarner Losh DSO_LDFLAGS='-shared -Wl,-install_name,$(LIBDIR)/$(@F)' 655*c43cad87SWarner Losh SOREV="${rev}.${so}" 656*c43cad87SWarner Losh sbrk_deprecated="1" 657*c43cad87SWarner Losh SYM_PREFIX="_" 658*c43cad87SWarner Losh ;; 659*c43cad87SWarner Losh *-*-freebsd*) 660*c43cad87SWarner Losh JE_APPEND_VS(CPPFLAGS, -D_BSD_SOURCE) 661*c43cad87SWarner Losh abi="elf" 662*c43cad87SWarner Losh AC_DEFINE([JEMALLOC_SYSCTL_VM_OVERCOMMIT], [ ], [ ]) 663*c43cad87SWarner Losh force_lazy_lock="1" 664*c43cad87SWarner Losh ;; 665*c43cad87SWarner Losh *-*-dragonfly*) 666*c43cad87SWarner Losh abi="elf" 667*c43cad87SWarner Losh ;; 668*c43cad87SWarner Losh *-*-openbsd*) 669*c43cad87SWarner Losh abi="elf" 670*c43cad87SWarner Losh force_tls="0" 671*c43cad87SWarner Losh ;; 672*c43cad87SWarner Losh *-*-bitrig*) 673*c43cad87SWarner Losh abi="elf" 674*c43cad87SWarner Losh ;; 675*c43cad87SWarner Losh *-*-linux-android*) 676*c43cad87SWarner Losh dnl syscall(2) and secure_getenv(3) are exposed by _GNU_SOURCE. 677*c43cad87SWarner Losh JE_APPEND_VS(CPPFLAGS, -D_GNU_SOURCE) 678*c43cad87SWarner Losh abi="elf" 679*c43cad87SWarner Losh glibc="0" 680*c43cad87SWarner Losh AC_DEFINE([JEMALLOC_PURGE_MADVISE_DONTNEED_ZEROS], [ ], [ ]) 681*c43cad87SWarner Losh AC_DEFINE([JEMALLOC_HAS_ALLOCA_H], [ ], [ ]) 682*c43cad87SWarner Losh AC_DEFINE([JEMALLOC_PROC_SYS_VM_OVERCOMMIT_MEMORY], [ ], [ ]) 683*c43cad87SWarner Losh AC_DEFINE([JEMALLOC_THREADED_INIT], [ ], [ ]) 684*c43cad87SWarner Losh AC_DEFINE([JEMALLOC_C11_ATOMICS], [ ], [ ]) 685*c43cad87SWarner Losh force_tls="0" 686*c43cad87SWarner Losh if test "${LG_SIZEOF_PTR}" = "3"; then 687*c43cad87SWarner Losh default_retain="1" 688*c43cad87SWarner Losh fi 689*c43cad87SWarner Losh zero_realloc_default_free="1" 690*c43cad87SWarner Losh ;; 691*c43cad87SWarner Losh *-*-linux*) 692*c43cad87SWarner Losh dnl syscall(2) and secure_getenv(3) are exposed by _GNU_SOURCE. 693*c43cad87SWarner Losh JE_APPEND_VS(CPPFLAGS, -D_GNU_SOURCE) 694*c43cad87SWarner Losh abi="elf" 695*c43cad87SWarner Losh glibc="1" 696*c43cad87SWarner Losh AC_DEFINE([JEMALLOC_PURGE_MADVISE_DONTNEED_ZEROS], [ ], [ ]) 697*c43cad87SWarner Losh AC_DEFINE([JEMALLOC_HAS_ALLOCA_H], [ ], [ ]) 698*c43cad87SWarner Losh AC_DEFINE([JEMALLOC_PROC_SYS_VM_OVERCOMMIT_MEMORY], [ ], [ ]) 699*c43cad87SWarner Losh AC_DEFINE([JEMALLOC_THREADED_INIT], [ ], [ ]) 700*c43cad87SWarner Losh AC_DEFINE([JEMALLOC_USE_CXX_THROW], [ ], [ ]) 701*c43cad87SWarner Losh if test "${LG_SIZEOF_PTR}" = "3"; then 702*c43cad87SWarner Losh default_retain="1" 703*c43cad87SWarner Losh fi 704*c43cad87SWarner Losh zero_realloc_default_free="1" 705*c43cad87SWarner Losh ;; 706*c43cad87SWarner Losh *-*-kfreebsd*) 707*c43cad87SWarner Losh dnl syscall(2) and secure_getenv(3) are exposed by _GNU_SOURCE. 708*c43cad87SWarner Losh JE_APPEND_VS(CPPFLAGS, -D_GNU_SOURCE) 709*c43cad87SWarner Losh abi="elf" 710*c43cad87SWarner Losh AC_DEFINE([JEMALLOC_HAS_ALLOCA_H], [ ], [ ]) 711*c43cad87SWarner Losh AC_DEFINE([JEMALLOC_SYSCTL_VM_OVERCOMMIT], [ ], [ ]) 712*c43cad87SWarner Losh AC_DEFINE([JEMALLOC_THREADED_INIT], [ ], [ ]) 713*c43cad87SWarner Losh AC_DEFINE([JEMALLOC_USE_CXX_THROW], [ ], [ ]) 714*c43cad87SWarner Losh ;; 715*c43cad87SWarner Losh *-*-netbsd*) 716*c43cad87SWarner Losh AC_MSG_CHECKING([ABI]) 717*c43cad87SWarner Losh AC_COMPILE_IFELSE([AC_LANG_PROGRAM( 718*c43cad87SWarner Losh[[#ifdef __ELF__ 719*c43cad87SWarner Losh/* ELF */ 720*c43cad87SWarner Losh#else 721*c43cad87SWarner Losh#error aout 722*c43cad87SWarner Losh#endif 723*c43cad87SWarner Losh]])], 724*c43cad87SWarner Losh [abi="elf"], 725*c43cad87SWarner Losh [abi="aout"]) 726*c43cad87SWarner Losh AC_MSG_RESULT([$abi]) 727*c43cad87SWarner Losh ;; 728*c43cad87SWarner Losh *-*-solaris2*) 729*c43cad87SWarner Losh abi="elf" 730*c43cad87SWarner Losh RPATH='-Wl,-R,$(1)' 731*c43cad87SWarner Losh dnl Solaris needs this for sigwait(). 732*c43cad87SWarner Losh JE_APPEND_VS(CPPFLAGS, -D_POSIX_PTHREAD_SEMANTICS) 733*c43cad87SWarner Losh JE_APPEND_VS(LIBS, -lposix4 -lsocket -lnsl) 734*c43cad87SWarner Losh ;; 735*c43cad87SWarner Losh *-ibm-aix*) 736*c43cad87SWarner Losh if test "${LG_SIZEOF_PTR}" = "3"; then 737*c43cad87SWarner Losh dnl 64bit AIX 738*c43cad87SWarner Losh LD_PRELOAD_VAR="LDR_PRELOAD64" 739*c43cad87SWarner Losh else 740*c43cad87SWarner Losh dnl 32bit AIX 741*c43cad87SWarner Losh LD_PRELOAD_VAR="LDR_PRELOAD" 742*c43cad87SWarner Losh fi 743*c43cad87SWarner Losh abi="xcoff" 744*c43cad87SWarner Losh ;; 745*c43cad87SWarner Losh *-*-mingw* | *-*-cygwin*) 746*c43cad87SWarner Losh abi="pecoff" 747*c43cad87SWarner Losh force_tls="0" 748*c43cad87SWarner Losh maps_coalesce="0" 749*c43cad87SWarner Losh RPATH="" 750*c43cad87SWarner Losh so="dll" 751*c43cad87SWarner Losh if test "x$je_cv_msvc" = "xyes" ; then 752*c43cad87SWarner Losh importlib="lib" 753*c43cad87SWarner Losh DSO_LDFLAGS="-LD" 754*c43cad87SWarner Losh EXTRA_LDFLAGS="-link -DEBUG" 755*c43cad87SWarner Losh CTARGET='-Fo$@' 756*c43cad87SWarner Losh LDTARGET='-Fe$@' 757*c43cad87SWarner Losh AR='lib' 758*c43cad87SWarner Losh ARFLAGS='-nologo -out:' 759*c43cad87SWarner Losh AROUT='$@' 760*c43cad87SWarner Losh CC_MM= 761*c43cad87SWarner Losh else 762*c43cad87SWarner Losh importlib="${so}" 763*c43cad87SWarner Losh DSO_LDFLAGS="-shared" 764*c43cad87SWarner Losh link_whole_archive="1" 765*c43cad87SWarner Losh fi 766*c43cad87SWarner Losh case "${host}" in 767*c43cad87SWarner Losh *-*-cygwin*) 768*c43cad87SWarner Losh DUMP_SYMS="dumpbin /SYMBOLS" 769*c43cad87SWarner Losh ;; 770*c43cad87SWarner Losh *) 771*c43cad87SWarner Losh ;; 772*c43cad87SWarner Losh esac 773*c43cad87SWarner Losh a="lib" 774*c43cad87SWarner Losh libprefix="" 775*c43cad87SWarner Losh SOREV="${so}" 776*c43cad87SWarner Losh PIC_CFLAGS="" 777*c43cad87SWarner Losh if test "${LG_SIZEOF_PTR}" = "3"; then 778*c43cad87SWarner Losh default_retain="1" 779*c43cad87SWarner Losh fi 780*c43cad87SWarner Losh zero_realloc_default_free="1" 781*c43cad87SWarner Losh ;; 782*c43cad87SWarner Losh *-*-nto-qnx) 783*c43cad87SWarner Losh abi="elf" 784*c43cad87SWarner Losh force_tls="0" 785*c43cad87SWarner Losh AC_DEFINE([JEMALLOC_HAS_ALLOCA_H], [ ], [ ]) 786*c43cad87SWarner Losh ;; 787*c43cad87SWarner Losh *) 788*c43cad87SWarner Losh AC_MSG_RESULT([Unsupported operating system: ${host}]) 789*c43cad87SWarner Losh abi="elf" 790*c43cad87SWarner Losh ;; 791*c43cad87SWarner Loshesac 792*c43cad87SWarner Losh 793*c43cad87SWarner LoshJEMALLOC_USABLE_SIZE_CONST=const 794*c43cad87SWarner LoshAC_CHECK_HEADERS([malloc.h], [ 795*c43cad87SWarner Losh AC_MSG_CHECKING([whether malloc_usable_size definition can use const argument]) 796*c43cad87SWarner Losh AC_COMPILE_IFELSE([AC_LANG_PROGRAM( 797*c43cad87SWarner Losh [#include <malloc.h> 798*c43cad87SWarner Losh #include <stddef.h> 799*c43cad87SWarner Losh size_t malloc_usable_size(const void *ptr); 800*c43cad87SWarner Losh ], 801*c43cad87SWarner Losh [])],[ 802*c43cad87SWarner Losh AC_MSG_RESULT([yes]) 803*c43cad87SWarner Losh ],[ 804*c43cad87SWarner Losh JEMALLOC_USABLE_SIZE_CONST= 805*c43cad87SWarner Losh AC_MSG_RESULT([no]) 806*c43cad87SWarner Losh ]) 807*c43cad87SWarner Losh]) 808*c43cad87SWarner LoshAC_DEFINE_UNQUOTED([JEMALLOC_USABLE_SIZE_CONST], [$JEMALLOC_USABLE_SIZE_CONST], [ ]) 809*c43cad87SWarner LoshAC_SUBST([abi]) 810*c43cad87SWarner LoshAC_SUBST([RPATH]) 811*c43cad87SWarner LoshAC_SUBST([LD_PRELOAD_VAR]) 812*c43cad87SWarner LoshAC_SUBST([so]) 813*c43cad87SWarner LoshAC_SUBST([importlib]) 814*c43cad87SWarner LoshAC_SUBST([o]) 815*c43cad87SWarner LoshAC_SUBST([a]) 816*c43cad87SWarner LoshAC_SUBST([exe]) 817*c43cad87SWarner LoshAC_SUBST([libprefix]) 818*c43cad87SWarner LoshAC_SUBST([link_whole_archive]) 819*c43cad87SWarner LoshAC_SUBST([DSO_LDFLAGS]) 820*c43cad87SWarner LoshAC_SUBST([EXTRA_LDFLAGS]) 821*c43cad87SWarner LoshAC_SUBST([SOREV]) 822*c43cad87SWarner LoshAC_SUBST([PIC_CFLAGS]) 823*c43cad87SWarner LoshAC_SUBST([CTARGET]) 824*c43cad87SWarner LoshAC_SUBST([LDTARGET]) 825*c43cad87SWarner LoshAC_SUBST([TEST_LD_MODE]) 826*c43cad87SWarner LoshAC_SUBST([MKLIB]) 827*c43cad87SWarner LoshAC_SUBST([ARFLAGS]) 828*c43cad87SWarner LoshAC_SUBST([AROUT]) 829*c43cad87SWarner LoshAC_SUBST([DUMP_SYMS]) 830*c43cad87SWarner LoshAC_SUBST([CC_MM]) 831*c43cad87SWarner Losh 832*c43cad87SWarner Loshdnl Determine whether libm must be linked to use e.g. log(3). 833*c43cad87SWarner LoshAC_SEARCH_LIBS([log], [m], , [AC_MSG_ERROR([Missing math functions])]) 834*c43cad87SWarner Loshif test "x$ac_cv_search_log" != "xnone required" ; then 835*c43cad87SWarner Losh LM="$ac_cv_search_log" 836*c43cad87SWarner Loshelse 837*c43cad87SWarner Losh LM= 838*c43cad87SWarner Loshfi 839*c43cad87SWarner LoshAC_SUBST(LM) 840*c43cad87SWarner Losh 841*c43cad87SWarner LoshJE_COMPILABLE([__attribute__ syntax], 842*c43cad87SWarner Losh [static __attribute__((unused)) void foo(void){}], 843*c43cad87SWarner Losh [], 844*c43cad87SWarner Losh [je_cv_attribute]) 845*c43cad87SWarner Loshif test "x${je_cv_attribute}" = "xyes" ; then 846*c43cad87SWarner Losh AC_DEFINE([JEMALLOC_HAVE_ATTR], [ ], [ ]) 847*c43cad87SWarner Losh if test "x${GCC}" = "xyes" -a "x${abi}" = "xelf"; then 848*c43cad87SWarner Losh JE_CFLAGS_ADD([-fvisibility=hidden]) 849*c43cad87SWarner Losh JE_CXXFLAGS_ADD([-fvisibility=hidden]) 850*c43cad87SWarner Losh fi 851*c43cad87SWarner Loshfi 852*c43cad87SWarner Loshdnl Check for tls_model attribute support (clang 3.0 still lacks support). 853*c43cad87SWarner LoshJE_CFLAGS_SAVE() 854*c43cad87SWarner LoshJE_CFLAGS_ADD([-Werror]) 855*c43cad87SWarner LoshJE_CFLAGS_ADD([-herror_on_warning]) 856*c43cad87SWarner LoshJE_COMPILABLE([tls_model attribute], [], 857*c43cad87SWarner Losh [static __thread int 858*c43cad87SWarner Losh __attribute__((tls_model("initial-exec"), unused)) foo; 859*c43cad87SWarner Losh foo = 0;], 860*c43cad87SWarner Losh [je_cv_tls_model]) 861*c43cad87SWarner LoshJE_CFLAGS_RESTORE() 862*c43cad87SWarner Loshdnl (Setting of JEMALLOC_TLS_MODEL is done later, after we've checked for 863*c43cad87SWarner Loshdnl --disable-initial-exec-tls) 864*c43cad87SWarner Losh 865*c43cad87SWarner Loshdnl Check for alloc_size attribute support. 866*c43cad87SWarner LoshJE_CFLAGS_SAVE() 867*c43cad87SWarner LoshJE_CFLAGS_ADD([-Werror]) 868*c43cad87SWarner LoshJE_CFLAGS_ADD([-herror_on_warning]) 869*c43cad87SWarner LoshJE_COMPILABLE([alloc_size attribute], [#include <stdlib.h>], 870*c43cad87SWarner Losh [void *foo(size_t size) __attribute__((alloc_size(1)));], 871*c43cad87SWarner Losh [je_cv_alloc_size]) 872*c43cad87SWarner LoshJE_CFLAGS_RESTORE() 873*c43cad87SWarner Loshif test "x${je_cv_alloc_size}" = "xyes" ; then 874*c43cad87SWarner Losh AC_DEFINE([JEMALLOC_HAVE_ATTR_ALLOC_SIZE], [ ], [ ]) 875*c43cad87SWarner Loshfi 876*c43cad87SWarner Loshdnl Check for format(gnu_printf, ...) attribute support. 877*c43cad87SWarner LoshJE_CFLAGS_SAVE() 878*c43cad87SWarner LoshJE_CFLAGS_ADD([-Werror]) 879*c43cad87SWarner LoshJE_CFLAGS_ADD([-herror_on_warning]) 880*c43cad87SWarner LoshJE_COMPILABLE([format(gnu_printf, ...) attribute], [#include <stdlib.h>], 881*c43cad87SWarner Losh [void *foo(const char *format, ...) __attribute__((format(gnu_printf, 1, 2)));], 882*c43cad87SWarner Losh [je_cv_format_gnu_printf]) 883*c43cad87SWarner LoshJE_CFLAGS_RESTORE() 884*c43cad87SWarner Loshif test "x${je_cv_format_gnu_printf}" = "xyes" ; then 885*c43cad87SWarner Losh AC_DEFINE([JEMALLOC_HAVE_ATTR_FORMAT_GNU_PRINTF], [ ], [ ]) 886*c43cad87SWarner Loshfi 887*c43cad87SWarner Loshdnl Check for format(printf, ...) attribute support. 888*c43cad87SWarner LoshJE_CFLAGS_SAVE() 889*c43cad87SWarner LoshJE_CFLAGS_ADD([-Werror]) 890*c43cad87SWarner LoshJE_CFLAGS_ADD([-herror_on_warning]) 891*c43cad87SWarner LoshJE_COMPILABLE([format(printf, ...) attribute], [#include <stdlib.h>], 892*c43cad87SWarner Losh [void *foo(const char *format, ...) __attribute__((format(printf, 1, 2)));], 893*c43cad87SWarner Losh [je_cv_format_printf]) 894*c43cad87SWarner LoshJE_CFLAGS_RESTORE() 895*c43cad87SWarner Loshif test "x${je_cv_format_printf}" = "xyes" ; then 896*c43cad87SWarner Losh AC_DEFINE([JEMALLOC_HAVE_ATTR_FORMAT_PRINTF], [ ], [ ]) 897*c43cad87SWarner Loshfi 898*c43cad87SWarner Losh 899*c43cad87SWarner Loshdnl Check for format_arg(...) attribute support. 900*c43cad87SWarner LoshJE_CFLAGS_SAVE() 901*c43cad87SWarner LoshJE_CFLAGS_ADD([-Werror]) 902*c43cad87SWarner LoshJE_CFLAGS_ADD([-herror_on_warning]) 903*c43cad87SWarner LoshJE_COMPILABLE([format(printf, ...) attribute], [#include <stdlib.h>], 904*c43cad87SWarner Losh [const char * __attribute__((__format_arg__(1))) foo(const char *format);], 905*c43cad87SWarner Losh [je_cv_format_arg]) 906*c43cad87SWarner LoshJE_CFLAGS_RESTORE() 907*c43cad87SWarner Loshif test "x${je_cv_format_arg}" = "xyes" ; then 908*c43cad87SWarner Losh AC_DEFINE([JEMALLOC_HAVE_ATTR_FORMAT_ARG], [ ], [ ]) 909*c43cad87SWarner Loshfi 910*c43cad87SWarner Losh 911*c43cad87SWarner Loshdnl Check for fallthrough attribute support. 912*c43cad87SWarner LoshJE_CFLAGS_SAVE() 913*c43cad87SWarner LoshJE_CFLAGS_ADD([-Wimplicit-fallthrough]) 914*c43cad87SWarner LoshJE_COMPILABLE([fallthrough attribute], 915*c43cad87SWarner Losh [#if !__has_attribute(fallthrough) 916*c43cad87SWarner Losh #error "foo" 917*c43cad87SWarner Losh #endif], 918*c43cad87SWarner Losh [int x = 0; 919*c43cad87SWarner Losh switch (x) { 920*c43cad87SWarner Losh case 0: __attribute__((__fallthrough__)); 921*c43cad87SWarner Losh case 1: return 1; 922*c43cad87SWarner Losh }], 923*c43cad87SWarner Losh [je_cv_fallthrough]) 924*c43cad87SWarner LoshJE_CFLAGS_RESTORE() 925*c43cad87SWarner Loshif test "x${je_cv_fallthrough}" = "xyes" ; then 926*c43cad87SWarner Losh AC_DEFINE([JEMALLOC_HAVE_ATTR_FALLTHROUGH], [ ], [ ]) 927*c43cad87SWarner Losh JE_CFLAGS_ADD([-Wimplicit-fallthrough]) 928*c43cad87SWarner Losh JE_CXXFLAGS_ADD([-Wimplicit-fallthrough]) 929*c43cad87SWarner Loshfi 930*c43cad87SWarner Losh 931*c43cad87SWarner Loshdnl Check for cold attribute support. 932*c43cad87SWarner LoshJE_CFLAGS_SAVE() 933*c43cad87SWarner LoshJE_CFLAGS_ADD([-Werror]) 934*c43cad87SWarner LoshJE_CFLAGS_ADD([-herror_on_warning]) 935*c43cad87SWarner LoshJE_COMPILABLE([cold attribute], [], 936*c43cad87SWarner Losh [__attribute__((__cold__)) void foo();], 937*c43cad87SWarner Losh [je_cv_cold]) 938*c43cad87SWarner LoshJE_CFLAGS_RESTORE() 939*c43cad87SWarner Loshif test "x${je_cv_cold}" = "xyes" ; then 940*c43cad87SWarner Losh AC_DEFINE([JEMALLOC_HAVE_ATTR_COLD], [ ], [ ]) 941*c43cad87SWarner Loshfi 942*c43cad87SWarner Losh 943*c43cad87SWarner Loshdnl Check for VM_MAKE_TAG for mmap support. 944*c43cad87SWarner LoshJE_COMPILABLE([vm_make_tag], 945*c43cad87SWarner Losh [#include <sys/mman.h> 946*c43cad87SWarner Losh #include <mach/vm_statistics.h>], 947*c43cad87SWarner Losh [void *p; 948*c43cad87SWarner Losh p = mmap(0, 16, PROT_READ, MAP_ANON|MAP_PRIVATE, VM_MAKE_TAG(1), 0); 949*c43cad87SWarner Losh munmap(p, 16);], 950*c43cad87SWarner Losh [je_cv_vm_make_tag]) 951*c43cad87SWarner Loshif test "x${je_cv_vm_make_tag}" = "xyes" ; then 952*c43cad87SWarner Losh AC_DEFINE([JEMALLOC_HAVE_VM_MAKE_TAG], [ ], [ ]) 953*c43cad87SWarner Loshfi 954*c43cad87SWarner Losh 955*c43cad87SWarner Loshdnl Support optional additions to rpath. 956*c43cad87SWarner LoshAC_ARG_WITH([rpath], 957*c43cad87SWarner Losh [AS_HELP_STRING([--with-rpath=<rpath>], [Colon-separated rpath (ELF systems only)])], 958*c43cad87SWarner Loshif test "x$with_rpath" = "xno" ; then 959*c43cad87SWarner Losh RPATH_EXTRA= 960*c43cad87SWarner Loshelse 961*c43cad87SWarner Losh RPATH_EXTRA="`echo $with_rpath | tr \":\" \" \"`" 962*c43cad87SWarner Loshfi, 963*c43cad87SWarner Losh RPATH_EXTRA= 964*c43cad87SWarner Losh) 965*c43cad87SWarner LoshAC_SUBST([RPATH_EXTRA]) 966*c43cad87SWarner Losh 967*c43cad87SWarner Loshdnl Disable rules that do automatic regeneration of configure output by default. 968*c43cad87SWarner LoshAC_ARG_ENABLE([autogen], 969*c43cad87SWarner Losh [AS_HELP_STRING([--enable-autogen], [Automatically regenerate configure output])], 970*c43cad87SWarner Loshif test "x$enable_autogen" = "xno" ; then 971*c43cad87SWarner Losh enable_autogen="0" 972*c43cad87SWarner Loshelse 973*c43cad87SWarner Losh enable_autogen="1" 974*c43cad87SWarner Loshfi 975*c43cad87SWarner Losh, 976*c43cad87SWarner Loshenable_autogen="0" 977*c43cad87SWarner Losh) 978*c43cad87SWarner LoshAC_SUBST([enable_autogen]) 979*c43cad87SWarner Losh 980*c43cad87SWarner LoshAC_PROG_INSTALL 981*c43cad87SWarner LoshAC_PROG_RANLIB 982*c43cad87SWarner LoshAC_PATH_PROG([LD], [ld], [false], [$PATH]) 983*c43cad87SWarner LoshAC_PATH_PROG([AUTOCONF], [autoconf], [false], [$PATH]) 984*c43cad87SWarner Losh 985*c43cad87SWarner Loshdnl Enable documentation 986*c43cad87SWarner LoshAC_ARG_ENABLE([doc], 987*c43cad87SWarner Losh [AS_HELP_STRING([--enable-doc], [Build documentation])], 988*c43cad87SWarner Loshif test "x$enable_doc" = "xno" ; then 989*c43cad87SWarner Losh enable_doc="0" 990*c43cad87SWarner Loshelse 991*c43cad87SWarner Losh enable_doc="1" 992*c43cad87SWarner Loshfi 993*c43cad87SWarner Losh, 994*c43cad87SWarner Loshenable_doc="1" 995*c43cad87SWarner Losh) 996*c43cad87SWarner LoshAC_SUBST([enable_doc]) 997*c43cad87SWarner Losh 998*c43cad87SWarner Loshdnl Enable shared libs 999*c43cad87SWarner LoshAC_ARG_ENABLE([shared], 1000*c43cad87SWarner Losh [AS_HELP_STRING([--enable-shared], [Build shared libaries])], 1001*c43cad87SWarner Loshif test "x$enable_shared" = "xno" ; then 1002*c43cad87SWarner Losh enable_shared="0" 1003*c43cad87SWarner Loshelse 1004*c43cad87SWarner Losh enable_shared="1" 1005*c43cad87SWarner Loshfi 1006*c43cad87SWarner Losh, 1007*c43cad87SWarner Loshenable_shared="1" 1008*c43cad87SWarner Losh) 1009*c43cad87SWarner LoshAC_SUBST([enable_shared]) 1010*c43cad87SWarner Losh 1011*c43cad87SWarner Loshdnl Enable static libs 1012*c43cad87SWarner LoshAC_ARG_ENABLE([static], 1013*c43cad87SWarner Losh [AS_HELP_STRING([--enable-static], [Build static libaries])], 1014*c43cad87SWarner Loshif test "x$enable_static" = "xno" ; then 1015*c43cad87SWarner Losh enable_static="0" 1016*c43cad87SWarner Loshelse 1017*c43cad87SWarner Losh enable_static="1" 1018*c43cad87SWarner Loshfi 1019*c43cad87SWarner Losh, 1020*c43cad87SWarner Loshenable_static="1" 1021*c43cad87SWarner Losh) 1022*c43cad87SWarner LoshAC_SUBST([enable_static]) 1023*c43cad87SWarner Losh 1024*c43cad87SWarner Loshif test "$enable_shared$enable_static" = "00" ; then 1025*c43cad87SWarner Losh AC_MSG_ERROR([Please enable one of shared or static builds]) 1026*c43cad87SWarner Loshfi 1027*c43cad87SWarner Losh 1028*c43cad87SWarner Loshdnl Perform no name mangling by default. 1029*c43cad87SWarner LoshAC_ARG_WITH([mangling], 1030*c43cad87SWarner Losh [AS_HELP_STRING([--with-mangling=<map>], [Mangle symbols in <map>])], 1031*c43cad87SWarner Losh [mangling_map="$with_mangling"], [mangling_map=""]) 1032*c43cad87SWarner Losh 1033*c43cad87SWarner Loshdnl Do not prefix public APIs by default. 1034*c43cad87SWarner LoshAC_ARG_WITH([jemalloc_prefix], 1035*c43cad87SWarner Losh [AS_HELP_STRING([--with-jemalloc-prefix=<prefix>], [Prefix to prepend to all public APIs])], 1036*c43cad87SWarner Losh [JEMALLOC_PREFIX="$with_jemalloc_prefix"], 1037*c43cad87SWarner Losh [if test "x$abi" != "xmacho" -a "x$abi" != "xpecoff"; then 1038*c43cad87SWarner Losh JEMALLOC_PREFIX="" 1039*c43cad87SWarner Loshelse 1040*c43cad87SWarner Losh JEMALLOC_PREFIX="je_" 1041*c43cad87SWarner Loshfi] 1042*c43cad87SWarner Losh) 1043*c43cad87SWarner Loshif test "x$JEMALLOC_PREFIX" = "x" ; then 1044*c43cad87SWarner Losh AC_DEFINE([JEMALLOC_IS_MALLOC], [ ], [ ]) 1045*c43cad87SWarner Loshelse 1046*c43cad87SWarner Losh JEMALLOC_CPREFIX=`echo ${JEMALLOC_PREFIX} | tr "a-z" "A-Z"` 1047*c43cad87SWarner Losh AC_DEFINE_UNQUOTED([JEMALLOC_PREFIX], ["$JEMALLOC_PREFIX"], [ ]) 1048*c43cad87SWarner Losh AC_DEFINE_UNQUOTED([JEMALLOC_CPREFIX], ["$JEMALLOC_CPREFIX"], [ ]) 1049*c43cad87SWarner Loshfi 1050*c43cad87SWarner LoshAC_SUBST([JEMALLOC_PREFIX]) 1051*c43cad87SWarner LoshAC_SUBST([JEMALLOC_CPREFIX]) 1052*c43cad87SWarner Losh 1053*c43cad87SWarner LoshAC_ARG_WITH([export], 1054*c43cad87SWarner Losh [AS_HELP_STRING([--without-export], [disable exporting jemalloc public APIs])], 1055*c43cad87SWarner Losh [if test "x$with_export" = "xno"; then 1056*c43cad87SWarner Losh AC_DEFINE([JEMALLOC_EXPORT],[], [ ]) 1057*c43cad87SWarner Loshfi] 1058*c43cad87SWarner Losh) 1059*c43cad87SWarner Losh 1060*c43cad87SWarner Loshpublic_syms="aligned_alloc calloc dallocx free mallctl mallctlbymib mallctlnametomib malloc malloc_conf malloc_conf_2_conf_harder malloc_message malloc_stats_print malloc_usable_size mallocx smallocx_${jemalloc_version_gid} nallocx posix_memalign rallocx realloc sallocx sdallocx xallocx" 1061*c43cad87SWarner Loshdnl Check for additional platform-specific public API functions. 1062*c43cad87SWarner LoshAC_CHECK_FUNC([memalign], 1063*c43cad87SWarner Losh [AC_DEFINE([JEMALLOC_OVERRIDE_MEMALIGN], [ ], [ ]) 1064*c43cad87SWarner Losh public_syms="${public_syms} memalign"]) 1065*c43cad87SWarner LoshAC_CHECK_FUNC([valloc], 1066*c43cad87SWarner Losh [AC_DEFINE([JEMALLOC_OVERRIDE_VALLOC], [ ], [ ]) 1067*c43cad87SWarner Losh public_syms="${public_syms} valloc"]) 1068*c43cad87SWarner LoshAC_CHECK_FUNC([malloc_size], 1069*c43cad87SWarner Losh [AC_DEFINE([JEMALLOC_HAVE_MALLOC_SIZE], [ ], [ ]) 1070*c43cad87SWarner Losh public_syms="${public_syms} malloc_size"]) 1071*c43cad87SWarner Losh 1072*c43cad87SWarner Loshdnl Check for allocator-related functions that should be wrapped. 1073*c43cad87SWarner Loshwrap_syms= 1074*c43cad87SWarner Loshif test "x${JEMALLOC_PREFIX}" = "x" ; then 1075*c43cad87SWarner Losh AC_CHECK_FUNC([__libc_calloc], 1076*c43cad87SWarner Losh [AC_DEFINE([JEMALLOC_OVERRIDE___LIBC_CALLOC], [ ], [ ]) 1077*c43cad87SWarner Losh wrap_syms="${wrap_syms} __libc_calloc"]) 1078*c43cad87SWarner Losh AC_CHECK_FUNC([__libc_free], 1079*c43cad87SWarner Losh [AC_DEFINE([JEMALLOC_OVERRIDE___LIBC_FREE], [ ], [ ]) 1080*c43cad87SWarner Losh wrap_syms="${wrap_syms} __libc_free"]) 1081*c43cad87SWarner Losh AC_CHECK_FUNC([__libc_malloc], 1082*c43cad87SWarner Losh [AC_DEFINE([JEMALLOC_OVERRIDE___LIBC_MALLOC], [ ], [ ]) 1083*c43cad87SWarner Losh wrap_syms="${wrap_syms} __libc_malloc"]) 1084*c43cad87SWarner Losh AC_CHECK_FUNC([__libc_memalign], 1085*c43cad87SWarner Losh [AC_DEFINE([JEMALLOC_OVERRIDE___LIBC_MEMALIGN], [ ], [ ]) 1086*c43cad87SWarner Losh wrap_syms="${wrap_syms} __libc_memalign"]) 1087*c43cad87SWarner Losh AC_CHECK_FUNC([__libc_realloc], 1088*c43cad87SWarner Losh [AC_DEFINE([JEMALLOC_OVERRIDE___LIBC_REALLOC], [ ], [ ]) 1089*c43cad87SWarner Losh wrap_syms="${wrap_syms} __libc_realloc"]) 1090*c43cad87SWarner Losh AC_CHECK_FUNC([__libc_valloc], 1091*c43cad87SWarner Losh [AC_DEFINE([JEMALLOC_OVERRIDE___LIBC_VALLOC], [ ], [ ]) 1092*c43cad87SWarner Losh wrap_syms="${wrap_syms} __libc_valloc"]) 1093*c43cad87SWarner Losh AC_CHECK_FUNC([__posix_memalign], 1094*c43cad87SWarner Losh [AC_DEFINE([JEMALLOC_OVERRIDE___POSIX_MEMALIGN], [ ], [ ]) 1095*c43cad87SWarner Losh wrap_syms="${wrap_syms} __posix_memalign"]) 1096*c43cad87SWarner Loshfi 1097*c43cad87SWarner Losh 1098*c43cad87SWarner Loshcase "${host}" in 1099*c43cad87SWarner Losh *-*-mingw* | *-*-cygwin*) 1100*c43cad87SWarner Losh wrap_syms="${wrap_syms} tls_callback" 1101*c43cad87SWarner Losh ;; 1102*c43cad87SWarner Losh *) 1103*c43cad87SWarner Losh ;; 1104*c43cad87SWarner Loshesac 1105*c43cad87SWarner Losh 1106*c43cad87SWarner Loshdnl Mangle library-private APIs. 1107*c43cad87SWarner LoshAC_ARG_WITH([private_namespace], 1108*c43cad87SWarner Losh [AS_HELP_STRING([--with-private-namespace=<prefix>], [Prefix to prepend to all library-private APIs])], 1109*c43cad87SWarner Losh [JEMALLOC_PRIVATE_NAMESPACE="${with_private_namespace}je_"], 1110*c43cad87SWarner Losh [JEMALLOC_PRIVATE_NAMESPACE="je_"] 1111*c43cad87SWarner Losh) 1112*c43cad87SWarner LoshAC_DEFINE_UNQUOTED([JEMALLOC_PRIVATE_NAMESPACE], [$JEMALLOC_PRIVATE_NAMESPACE], [ ]) 1113*c43cad87SWarner Loshprivate_namespace="$JEMALLOC_PRIVATE_NAMESPACE" 1114*c43cad87SWarner LoshAC_SUBST([private_namespace]) 1115*c43cad87SWarner Losh 1116*c43cad87SWarner Loshdnl Do not add suffix to installed files by default. 1117*c43cad87SWarner LoshAC_ARG_WITH([install_suffix], 1118*c43cad87SWarner Losh [AS_HELP_STRING([--with-install-suffix=<suffix>], [Suffix to append to all installed files])], 1119*c43cad87SWarner Losh [case "$with_install_suffix" in 1120*c43cad87SWarner Losh *\ * ) AC_MSG_ERROR([Install suffix should not contain spaces]) ;; 1121*c43cad87SWarner Losh * ) INSTALL_SUFFIX="$with_install_suffix" ;; 1122*c43cad87SWarner Loshesac], 1123*c43cad87SWarner Losh [INSTALL_SUFFIX=] 1124*c43cad87SWarner Losh) 1125*c43cad87SWarner Loshinstall_suffix="$INSTALL_SUFFIX" 1126*c43cad87SWarner LoshAC_SUBST([install_suffix]) 1127*c43cad87SWarner Losh 1128*c43cad87SWarner Loshdnl Specify default malloc_conf. 1129*c43cad87SWarner LoshAC_ARG_WITH([malloc_conf], 1130*c43cad87SWarner Losh [AS_HELP_STRING([--with-malloc-conf=<malloc_conf>], [config.malloc_conf options string])], 1131*c43cad87SWarner Losh [JEMALLOC_CONFIG_MALLOC_CONF="$with_malloc_conf"], 1132*c43cad87SWarner Losh [JEMALLOC_CONFIG_MALLOC_CONF=""] 1133*c43cad87SWarner Losh) 1134*c43cad87SWarner Loshconfig_malloc_conf="$JEMALLOC_CONFIG_MALLOC_CONF" 1135*c43cad87SWarner LoshAC_DEFINE_UNQUOTED([JEMALLOC_CONFIG_MALLOC_CONF], ["$config_malloc_conf"], [ ]) 1136*c43cad87SWarner Losh 1137*c43cad87SWarner Loshdnl Substitute @je_@ in jemalloc_protos.h.in, primarily to make generation of 1138*c43cad87SWarner Loshdnl jemalloc_protos_jet.h easy. 1139*c43cad87SWarner Loshje_="je_" 1140*c43cad87SWarner LoshAC_SUBST([je_]) 1141*c43cad87SWarner Losh 1142*c43cad87SWarner Loshcfgoutputs_in="Makefile.in" 1143*c43cad87SWarner Loshcfgoutputs_in="${cfgoutputs_in} jemalloc.pc.in" 1144*c43cad87SWarner Loshcfgoutputs_in="${cfgoutputs_in} doc/html.xsl.in" 1145*c43cad87SWarner Loshcfgoutputs_in="${cfgoutputs_in} doc/manpages.xsl.in" 1146*c43cad87SWarner Loshcfgoutputs_in="${cfgoutputs_in} doc/jemalloc.xml.in" 1147*c43cad87SWarner Loshcfgoutputs_in="${cfgoutputs_in} include/jemalloc/jemalloc_macros.h.in" 1148*c43cad87SWarner Loshcfgoutputs_in="${cfgoutputs_in} include/jemalloc/jemalloc_protos.h.in" 1149*c43cad87SWarner Loshcfgoutputs_in="${cfgoutputs_in} include/jemalloc/jemalloc_typedefs.h.in" 1150*c43cad87SWarner Loshcfgoutputs_in="${cfgoutputs_in} include/jemalloc/internal/jemalloc_preamble.h.in" 1151*c43cad87SWarner Loshcfgoutputs_in="${cfgoutputs_in} test/test.sh.in" 1152*c43cad87SWarner Loshcfgoutputs_in="${cfgoutputs_in} test/include/test/jemalloc_test.h.in" 1153*c43cad87SWarner Losh 1154*c43cad87SWarner Loshcfgoutputs_out="Makefile" 1155*c43cad87SWarner Loshcfgoutputs_out="${cfgoutputs_out} jemalloc.pc" 1156*c43cad87SWarner Loshcfgoutputs_out="${cfgoutputs_out} doc/html.xsl" 1157*c43cad87SWarner Loshcfgoutputs_out="${cfgoutputs_out} doc/manpages.xsl" 1158*c43cad87SWarner Loshcfgoutputs_out="${cfgoutputs_out} doc/jemalloc.xml" 1159*c43cad87SWarner Loshcfgoutputs_out="${cfgoutputs_out} include/jemalloc/jemalloc_macros.h" 1160*c43cad87SWarner Loshcfgoutputs_out="${cfgoutputs_out} include/jemalloc/jemalloc_protos.h" 1161*c43cad87SWarner Loshcfgoutputs_out="${cfgoutputs_out} include/jemalloc/jemalloc_typedefs.h" 1162*c43cad87SWarner Loshcfgoutputs_out="${cfgoutputs_out} include/jemalloc/internal/jemalloc_preamble.h" 1163*c43cad87SWarner Loshcfgoutputs_out="${cfgoutputs_out} test/test.sh" 1164*c43cad87SWarner Loshcfgoutputs_out="${cfgoutputs_out} test/include/test/jemalloc_test.h" 1165*c43cad87SWarner Losh 1166*c43cad87SWarner Loshcfgoutputs_tup="Makefile" 1167*c43cad87SWarner Loshcfgoutputs_tup="${cfgoutputs_tup} jemalloc.pc:jemalloc.pc.in" 1168*c43cad87SWarner Loshcfgoutputs_tup="${cfgoutputs_tup} doc/html.xsl:doc/html.xsl.in" 1169*c43cad87SWarner Loshcfgoutputs_tup="${cfgoutputs_tup} doc/manpages.xsl:doc/manpages.xsl.in" 1170*c43cad87SWarner Loshcfgoutputs_tup="${cfgoutputs_tup} doc/jemalloc.xml:doc/jemalloc.xml.in" 1171*c43cad87SWarner Loshcfgoutputs_tup="${cfgoutputs_tup} include/jemalloc/jemalloc_macros.h:include/jemalloc/jemalloc_macros.h.in" 1172*c43cad87SWarner Loshcfgoutputs_tup="${cfgoutputs_tup} include/jemalloc/jemalloc_protos.h:include/jemalloc/jemalloc_protos.h.in" 1173*c43cad87SWarner Loshcfgoutputs_tup="${cfgoutputs_tup} include/jemalloc/jemalloc_typedefs.h:include/jemalloc/jemalloc_typedefs.h.in" 1174*c43cad87SWarner Loshcfgoutputs_tup="${cfgoutputs_tup} include/jemalloc/internal/jemalloc_preamble.h" 1175*c43cad87SWarner Loshcfgoutputs_tup="${cfgoutputs_tup} test/test.sh:test/test.sh.in" 1176*c43cad87SWarner Loshcfgoutputs_tup="${cfgoutputs_tup} test/include/test/jemalloc_test.h:test/include/test/jemalloc_test.h.in" 1177*c43cad87SWarner Losh 1178*c43cad87SWarner Loshcfghdrs_in="include/jemalloc/jemalloc_defs.h.in" 1179*c43cad87SWarner Loshcfghdrs_in="${cfghdrs_in} include/jemalloc/internal/jemalloc_internal_defs.h.in" 1180*c43cad87SWarner Loshcfghdrs_in="${cfghdrs_in} include/jemalloc/internal/private_symbols.sh" 1181*c43cad87SWarner Loshcfghdrs_in="${cfghdrs_in} include/jemalloc/internal/private_namespace.sh" 1182*c43cad87SWarner Loshcfghdrs_in="${cfghdrs_in} include/jemalloc/internal/public_namespace.sh" 1183*c43cad87SWarner Loshcfghdrs_in="${cfghdrs_in} include/jemalloc/internal/public_unnamespace.sh" 1184*c43cad87SWarner Loshcfghdrs_in="${cfghdrs_in} include/jemalloc/jemalloc_rename.sh" 1185*c43cad87SWarner Loshcfghdrs_in="${cfghdrs_in} include/jemalloc/jemalloc_mangle.sh" 1186*c43cad87SWarner Loshcfghdrs_in="${cfghdrs_in} include/jemalloc/jemalloc.sh" 1187*c43cad87SWarner Loshcfghdrs_in="${cfghdrs_in} test/include/test/jemalloc_test_defs.h.in" 1188*c43cad87SWarner Losh 1189*c43cad87SWarner Loshcfghdrs_out="include/jemalloc/jemalloc_defs.h" 1190*c43cad87SWarner Loshcfghdrs_out="${cfghdrs_out} include/jemalloc/jemalloc${install_suffix}.h" 1191*c43cad87SWarner Loshcfghdrs_out="${cfghdrs_out} include/jemalloc/internal/private_symbols.awk" 1192*c43cad87SWarner Loshcfghdrs_out="${cfghdrs_out} include/jemalloc/internal/private_symbols_jet.awk" 1193*c43cad87SWarner Loshcfghdrs_out="${cfghdrs_out} include/jemalloc/internal/public_symbols.txt" 1194*c43cad87SWarner Loshcfghdrs_out="${cfghdrs_out} include/jemalloc/internal/public_namespace.h" 1195*c43cad87SWarner Loshcfghdrs_out="${cfghdrs_out} include/jemalloc/internal/public_unnamespace.h" 1196*c43cad87SWarner Loshcfghdrs_out="${cfghdrs_out} include/jemalloc/jemalloc_protos_jet.h" 1197*c43cad87SWarner Loshcfghdrs_out="${cfghdrs_out} include/jemalloc/jemalloc_rename.h" 1198*c43cad87SWarner Loshcfghdrs_out="${cfghdrs_out} include/jemalloc/jemalloc_mangle.h" 1199*c43cad87SWarner Loshcfghdrs_out="${cfghdrs_out} include/jemalloc/jemalloc_mangle_jet.h" 1200*c43cad87SWarner Loshcfghdrs_out="${cfghdrs_out} include/jemalloc/internal/jemalloc_internal_defs.h" 1201*c43cad87SWarner Loshcfghdrs_out="${cfghdrs_out} test/include/test/jemalloc_test_defs.h" 1202*c43cad87SWarner Losh 1203*c43cad87SWarner Loshcfghdrs_tup="include/jemalloc/jemalloc_defs.h:include/jemalloc/jemalloc_defs.h.in" 1204*c43cad87SWarner Loshcfghdrs_tup="${cfghdrs_tup} include/jemalloc/internal/jemalloc_internal_defs.h:include/jemalloc/internal/jemalloc_internal_defs.h.in" 1205*c43cad87SWarner Loshcfghdrs_tup="${cfghdrs_tup} test/include/test/jemalloc_test_defs.h:test/include/test/jemalloc_test_defs.h.in" 1206*c43cad87SWarner Losh 1207*c43cad87SWarner Loshdnl ============================================================================ 1208*c43cad87SWarner Loshdnl jemalloc build options. 1209*c43cad87SWarner Loshdnl 1210*c43cad87SWarner Losh 1211*c43cad87SWarner Loshdnl Do not compile with debugging by default. 1212*c43cad87SWarner LoshAC_ARG_ENABLE([debug], 1213*c43cad87SWarner Losh [AS_HELP_STRING([--enable-debug], 1214*c43cad87SWarner Losh [Build debugging code])], 1215*c43cad87SWarner Losh[if test "x$enable_debug" = "xno" ; then 1216*c43cad87SWarner Losh enable_debug="0" 1217*c43cad87SWarner Loshelse 1218*c43cad87SWarner Losh enable_debug="1" 1219*c43cad87SWarner Loshfi 1220*c43cad87SWarner Losh], 1221*c43cad87SWarner Losh[enable_debug="0"] 1222*c43cad87SWarner Losh) 1223*c43cad87SWarner Loshif test "x$enable_debug" = "x1" ; then 1224*c43cad87SWarner Losh AC_DEFINE([JEMALLOC_DEBUG], [ ], [ ]) 1225*c43cad87SWarner Loshfi 1226*c43cad87SWarner LoshAC_SUBST([enable_debug]) 1227*c43cad87SWarner Losh 1228*c43cad87SWarner Loshdnl Only optimize if not debugging. 1229*c43cad87SWarner Loshif test "x$enable_debug" = "x0" ; then 1230*c43cad87SWarner Losh if test "x$GCC" = "xyes" ; then 1231*c43cad87SWarner Losh JE_CFLAGS_ADD([-O3]) 1232*c43cad87SWarner Losh JE_CXXFLAGS_ADD([-O3]) 1233*c43cad87SWarner Losh JE_CFLAGS_ADD([-funroll-loops]) 1234*c43cad87SWarner Losh elif test "x$je_cv_msvc" = "xyes" ; then 1235*c43cad87SWarner Losh JE_CFLAGS_ADD([-O2]) 1236*c43cad87SWarner Losh JE_CXXFLAGS_ADD([-O2]) 1237*c43cad87SWarner Losh else 1238*c43cad87SWarner Losh JE_CFLAGS_ADD([-O]) 1239*c43cad87SWarner Losh JE_CXXFLAGS_ADD([-O]) 1240*c43cad87SWarner Losh fi 1241*c43cad87SWarner Loshfi 1242*c43cad87SWarner Losh 1243*c43cad87SWarner Loshdnl Enable statistics calculation by default. 1244*c43cad87SWarner LoshAC_ARG_ENABLE([stats], 1245*c43cad87SWarner Losh [AS_HELP_STRING([--disable-stats], 1246*c43cad87SWarner Losh [Disable statistics calculation/reporting])], 1247*c43cad87SWarner Losh[if test "x$enable_stats" = "xno" ; then 1248*c43cad87SWarner Losh enable_stats="0" 1249*c43cad87SWarner Loshelse 1250*c43cad87SWarner Losh enable_stats="1" 1251*c43cad87SWarner Loshfi 1252*c43cad87SWarner Losh], 1253*c43cad87SWarner Losh[enable_stats="1"] 1254*c43cad87SWarner Losh) 1255*c43cad87SWarner Loshif test "x$enable_stats" = "x1" ; then 1256*c43cad87SWarner Losh AC_DEFINE([JEMALLOC_STATS], [ ], [ ]) 1257*c43cad87SWarner Loshfi 1258*c43cad87SWarner LoshAC_SUBST([enable_stats]) 1259*c43cad87SWarner Losh 1260*c43cad87SWarner Loshdnl Do not enable smallocx by default. 1261*c43cad87SWarner LoshAC_ARG_ENABLE([experimental_smallocx], 1262*c43cad87SWarner Losh [AS_HELP_STRING([--enable-experimental-smallocx], [Enable experimental smallocx API])], 1263*c43cad87SWarner Losh[if test "x$enable_experimental_smallocx" = "xno" ; then 1264*c43cad87SWarner Loshenable_experimental_smallocx="0" 1265*c43cad87SWarner Loshelse 1266*c43cad87SWarner Loshenable_experimental_smallocx="1" 1267*c43cad87SWarner Loshfi 1268*c43cad87SWarner Losh], 1269*c43cad87SWarner Losh[enable_experimental_smallocx="0"] 1270*c43cad87SWarner Losh) 1271*c43cad87SWarner Loshif test "x$enable_experimental_smallocx" = "x1" ; then 1272*c43cad87SWarner Losh AC_DEFINE([JEMALLOC_EXPERIMENTAL_SMALLOCX_API], [ ], [ ]) 1273*c43cad87SWarner Loshfi 1274*c43cad87SWarner LoshAC_SUBST([enable_experimental_smallocx]) 1275*c43cad87SWarner Losh 1276*c43cad87SWarner Loshdnl Do not enable profiling by default. 1277*c43cad87SWarner LoshAC_ARG_ENABLE([prof], 1278*c43cad87SWarner Losh [AS_HELP_STRING([--enable-prof], [Enable allocation profiling])], 1279*c43cad87SWarner Losh[if test "x$enable_prof" = "xno" ; then 1280*c43cad87SWarner Losh enable_prof="0" 1281*c43cad87SWarner Loshelse 1282*c43cad87SWarner Losh enable_prof="1" 1283*c43cad87SWarner Loshfi 1284*c43cad87SWarner Losh], 1285*c43cad87SWarner Losh[enable_prof="0"] 1286*c43cad87SWarner Losh) 1287*c43cad87SWarner Loshif test "x$enable_prof" = "x1" ; then 1288*c43cad87SWarner Losh backtrace_method="" 1289*c43cad87SWarner Loshelse 1290*c43cad87SWarner Losh backtrace_method="N/A" 1291*c43cad87SWarner Loshfi 1292*c43cad87SWarner Losh 1293*c43cad87SWarner LoshAC_ARG_ENABLE([prof-libunwind], 1294*c43cad87SWarner Losh [AS_HELP_STRING([--enable-prof-libunwind], [Use libunwind for backtracing])], 1295*c43cad87SWarner Losh[if test "x$enable_prof_libunwind" = "xno" ; then 1296*c43cad87SWarner Losh enable_prof_libunwind="0" 1297*c43cad87SWarner Loshelse 1298*c43cad87SWarner Losh enable_prof_libunwind="1" 1299*c43cad87SWarner Losh if test "x$enable_prof" = "x0" ; then 1300*c43cad87SWarner Losh AC_MSG_ERROR([--enable-prof-libunwind should only be used with --enable-prof]) 1301*c43cad87SWarner Losh fi 1302*c43cad87SWarner Loshfi 1303*c43cad87SWarner Losh], 1304*c43cad87SWarner Losh[enable_prof_libunwind="0"] 1305*c43cad87SWarner Losh) 1306*c43cad87SWarner LoshAC_ARG_WITH([static_libunwind], 1307*c43cad87SWarner Losh [AS_HELP_STRING([--with-static-libunwind=<libunwind.a>], 1308*c43cad87SWarner Losh [Path to static libunwind library; use rather than dynamically linking])], 1309*c43cad87SWarner Loshif test "x$with_static_libunwind" = "xno" ; then 1310*c43cad87SWarner Losh LUNWIND="-lunwind" 1311*c43cad87SWarner Loshelse 1312*c43cad87SWarner Losh if test ! -f "$with_static_libunwind" ; then 1313*c43cad87SWarner Losh AC_MSG_ERROR([Static libunwind not found: $with_static_libunwind]) 1314*c43cad87SWarner Losh fi 1315*c43cad87SWarner Losh LUNWIND="$with_static_libunwind" 1316*c43cad87SWarner Loshfi, 1317*c43cad87SWarner Losh LUNWIND="-lunwind" 1318*c43cad87SWarner Losh) 1319*c43cad87SWarner Loshif test "x$backtrace_method" = "x" -a "x$enable_prof_libunwind" = "x1" ; then 1320*c43cad87SWarner Losh AC_CHECK_HEADERS([libunwind.h], , [enable_prof_libunwind="0"]) 1321*c43cad87SWarner Losh if test "x$LUNWIND" = "x-lunwind" ; then 1322*c43cad87SWarner Losh AC_CHECK_LIB([unwind], [unw_backtrace], [JE_APPEND_VS(LIBS, $LUNWIND)], 1323*c43cad87SWarner Losh [enable_prof_libunwind="0"]) 1324*c43cad87SWarner Losh else 1325*c43cad87SWarner Losh JE_APPEND_VS(LIBS, $LUNWIND) 1326*c43cad87SWarner Losh fi 1327*c43cad87SWarner Losh if test "x${enable_prof_libunwind}" = "x1" ; then 1328*c43cad87SWarner Losh backtrace_method="libunwind" 1329*c43cad87SWarner Losh AC_DEFINE([JEMALLOC_PROF_LIBUNWIND], [ ], [ ]) 1330*c43cad87SWarner Losh fi 1331*c43cad87SWarner Loshfi 1332*c43cad87SWarner Losh 1333*c43cad87SWarner LoshAC_ARG_ENABLE([prof-libgcc], 1334*c43cad87SWarner Losh [AS_HELP_STRING([--disable-prof-libgcc], 1335*c43cad87SWarner Losh [Do not use libgcc for backtracing])], 1336*c43cad87SWarner Losh[if test "x$enable_prof_libgcc" = "xno" ; then 1337*c43cad87SWarner Losh enable_prof_libgcc="0" 1338*c43cad87SWarner Loshelse 1339*c43cad87SWarner Losh enable_prof_libgcc="1" 1340*c43cad87SWarner Loshfi 1341*c43cad87SWarner Losh], 1342*c43cad87SWarner Losh[enable_prof_libgcc="1"] 1343*c43cad87SWarner Losh) 1344*c43cad87SWarner Loshif test "x$backtrace_method" = "x" -a "x$enable_prof_libgcc" = "x1" \ 1345*c43cad87SWarner Losh -a "x$GCC" = "xyes" ; then 1346*c43cad87SWarner Losh AC_CHECK_HEADERS([unwind.h], , [enable_prof_libgcc="0"]) 1347*c43cad87SWarner Losh if test "x${enable_prof_libgcc}" = "x1" ; then 1348*c43cad87SWarner Losh AC_CHECK_LIB([gcc], [_Unwind_Backtrace], [JE_APPEND_VS(LIBS, -lgcc)], [enable_prof_libgcc="0"]) 1349*c43cad87SWarner Losh fi 1350*c43cad87SWarner Losh if test "x${enable_prof_libgcc}" = "x1" ; then 1351*c43cad87SWarner Losh backtrace_method="libgcc" 1352*c43cad87SWarner Losh AC_DEFINE([JEMALLOC_PROF_LIBGCC], [ ], [ ]) 1353*c43cad87SWarner Losh fi 1354*c43cad87SWarner Loshelse 1355*c43cad87SWarner Losh enable_prof_libgcc="0" 1356*c43cad87SWarner Loshfi 1357*c43cad87SWarner Losh 1358*c43cad87SWarner LoshAC_ARG_ENABLE([prof-gcc], 1359*c43cad87SWarner Losh [AS_HELP_STRING([--disable-prof-gcc], 1360*c43cad87SWarner Losh [Do not use gcc intrinsics for backtracing])], 1361*c43cad87SWarner Losh[if test "x$enable_prof_gcc" = "xno" ; then 1362*c43cad87SWarner Losh enable_prof_gcc="0" 1363*c43cad87SWarner Loshelse 1364*c43cad87SWarner Losh enable_prof_gcc="1" 1365*c43cad87SWarner Loshfi 1366*c43cad87SWarner Losh], 1367*c43cad87SWarner Losh[enable_prof_gcc="1"] 1368*c43cad87SWarner Losh) 1369*c43cad87SWarner Loshif test "x$backtrace_method" = "x" -a "x$enable_prof_gcc" = "x1" \ 1370*c43cad87SWarner Losh -a "x$GCC" = "xyes" ; then 1371*c43cad87SWarner Losh JE_CFLAGS_ADD([-fno-omit-frame-pointer]) 1372*c43cad87SWarner Losh backtrace_method="gcc intrinsics" 1373*c43cad87SWarner Losh AC_DEFINE([JEMALLOC_PROF_GCC], [ ], [ ]) 1374*c43cad87SWarner Loshelse 1375*c43cad87SWarner Losh enable_prof_gcc="0" 1376*c43cad87SWarner Loshfi 1377*c43cad87SWarner Losh 1378*c43cad87SWarner Loshif test "x$backtrace_method" = "x" ; then 1379*c43cad87SWarner Losh backtrace_method="none (disabling profiling)" 1380*c43cad87SWarner Losh enable_prof="0" 1381*c43cad87SWarner Loshfi 1382*c43cad87SWarner LoshAC_MSG_CHECKING([configured backtracing method]) 1383*c43cad87SWarner LoshAC_MSG_RESULT([$backtrace_method]) 1384*c43cad87SWarner Loshif test "x$enable_prof" = "x1" ; then 1385*c43cad87SWarner Losh dnl Heap profiling uses the log(3) function. 1386*c43cad87SWarner Losh JE_APPEND_VS(LIBS, $LM) 1387*c43cad87SWarner Losh 1388*c43cad87SWarner Losh AC_DEFINE([JEMALLOC_PROF], [ ], [ ]) 1389*c43cad87SWarner Loshfi 1390*c43cad87SWarner LoshAC_SUBST([enable_prof]) 1391*c43cad87SWarner Losh 1392*c43cad87SWarner Loshdnl Indicate whether adjacent virtual memory mappings automatically coalesce 1393*c43cad87SWarner Loshdnl (and fragment on demand). 1394*c43cad87SWarner Loshif test "x${maps_coalesce}" = "x1" ; then 1395*c43cad87SWarner Losh AC_DEFINE([JEMALLOC_MAPS_COALESCE], [ ], [ ]) 1396*c43cad87SWarner Loshfi 1397*c43cad87SWarner Losh 1398*c43cad87SWarner Loshdnl Indicate whether to retain memory (rather than using munmap()) by default. 1399*c43cad87SWarner Loshif test "x$default_retain" = "x1" ; then 1400*c43cad87SWarner Losh AC_DEFINE([JEMALLOC_RETAIN], [ ], [ ]) 1401*c43cad87SWarner Loshfi 1402*c43cad87SWarner Losh 1403*c43cad87SWarner Loshdnl Indicate whether realloc(ptr, 0) defaults to the "alloc" behavior. 1404*c43cad87SWarner Loshif test "x$zero_realloc_default_free" = "x1" ; then 1405*c43cad87SWarner Losh AC_DEFINE([JEMALLOC_ZERO_REALLOC_DEFAULT_FREE], [ ], [ ]) 1406*c43cad87SWarner Loshfi 1407*c43cad87SWarner Losh 1408*c43cad87SWarner Loshdnl Enable allocation from DSS if supported by the OS. 1409*c43cad87SWarner Loshhave_dss="1" 1410*c43cad87SWarner Loshdnl Check whether the BSD/SUSv1 sbrk() exists. If not, disable DSS support. 1411*c43cad87SWarner LoshAC_CHECK_FUNC([sbrk], [have_sbrk="1"], [have_sbrk="0"]) 1412*c43cad87SWarner Loshif test "x$have_sbrk" = "x1" ; then 1413*c43cad87SWarner Losh if test "x$sbrk_deprecated" = "x1" ; then 1414*c43cad87SWarner Losh AC_MSG_RESULT([Disabling dss allocation because sbrk is deprecated]) 1415*c43cad87SWarner Losh have_dss="0" 1416*c43cad87SWarner Losh fi 1417*c43cad87SWarner Loshelse 1418*c43cad87SWarner Losh have_dss="0" 1419*c43cad87SWarner Loshfi 1420*c43cad87SWarner Losh 1421*c43cad87SWarner Loshif test "x$have_dss" = "x1" ; then 1422*c43cad87SWarner Losh AC_DEFINE([JEMALLOC_DSS], [ ], [ ]) 1423*c43cad87SWarner Loshfi 1424*c43cad87SWarner Losh 1425*c43cad87SWarner Loshdnl Support the junk/zero filling option by default. 1426*c43cad87SWarner LoshAC_ARG_ENABLE([fill], 1427*c43cad87SWarner Losh [AS_HELP_STRING([--disable-fill], [Disable support for junk/zero filling])], 1428*c43cad87SWarner Losh[if test "x$enable_fill" = "xno" ; then 1429*c43cad87SWarner Losh enable_fill="0" 1430*c43cad87SWarner Loshelse 1431*c43cad87SWarner Losh enable_fill="1" 1432*c43cad87SWarner Loshfi 1433*c43cad87SWarner Losh], 1434*c43cad87SWarner Losh[enable_fill="1"] 1435*c43cad87SWarner Losh) 1436*c43cad87SWarner Loshif test "x$enable_fill" = "x1" ; then 1437*c43cad87SWarner Losh AC_DEFINE([JEMALLOC_FILL], [ ], [ ]) 1438*c43cad87SWarner Loshfi 1439*c43cad87SWarner LoshAC_SUBST([enable_fill]) 1440*c43cad87SWarner Losh 1441*c43cad87SWarner Loshdnl Disable utrace(2)-based tracing by default. 1442*c43cad87SWarner LoshAC_ARG_ENABLE([utrace], 1443*c43cad87SWarner Losh [AS_HELP_STRING([--enable-utrace], [Enable utrace(2)-based tracing])], 1444*c43cad87SWarner Losh[if test "x$enable_utrace" = "xno" ; then 1445*c43cad87SWarner Losh enable_utrace="0" 1446*c43cad87SWarner Loshelse 1447*c43cad87SWarner Losh enable_utrace="1" 1448*c43cad87SWarner Loshfi 1449*c43cad87SWarner Losh], 1450*c43cad87SWarner Losh[enable_utrace="0"] 1451*c43cad87SWarner Losh) 1452*c43cad87SWarner LoshJE_COMPILABLE([utrace(2)], [ 1453*c43cad87SWarner Losh#include <sys/types.h> 1454*c43cad87SWarner Losh#include <sys/param.h> 1455*c43cad87SWarner Losh#include <sys/time.h> 1456*c43cad87SWarner Losh#include <sys/uio.h> 1457*c43cad87SWarner Losh#include <sys/ktrace.h> 1458*c43cad87SWarner Losh], [ 1459*c43cad87SWarner Losh utrace((void *)0, 0); 1460*c43cad87SWarner Losh], [je_cv_utrace]) 1461*c43cad87SWarner Loshif test "x${je_cv_utrace}" = "xno" ; then 1462*c43cad87SWarner Losh JE_COMPILABLE([utrace(2) with label], [ 1463*c43cad87SWarner Losh #include <sys/types.h> 1464*c43cad87SWarner Losh #include <sys/param.h> 1465*c43cad87SWarner Losh #include <sys/time.h> 1466*c43cad87SWarner Losh #include <sys/uio.h> 1467*c43cad87SWarner Losh #include <sys/ktrace.h> 1468*c43cad87SWarner Losh ], [ 1469*c43cad87SWarner Losh utrace((void *)0, (void *)0, 0); 1470*c43cad87SWarner Losh ], [je_cv_utrace_label]) 1471*c43cad87SWarner Losh if test "x${je_cv_utrace_label}" = "xno"; then 1472*c43cad87SWarner Losh enable_utrace="0" 1473*c43cad87SWarner Losh fi 1474*c43cad87SWarner Losh if test "x$enable_utrace" = "x1" ; then 1475*c43cad87SWarner Losh AC_DEFINE([JEMALLOC_UTRACE_LABEL], [ ], [ ]) 1476*c43cad87SWarner Losh fi 1477*c43cad87SWarner Loshelse 1478*c43cad87SWarner Losh if test "x$enable_utrace" = "x1" ; then 1479*c43cad87SWarner Losh AC_DEFINE([JEMALLOC_UTRACE], [ ], [ ]) 1480*c43cad87SWarner Losh fi 1481*c43cad87SWarner Loshfi 1482*c43cad87SWarner LoshAC_SUBST([enable_utrace]) 1483*c43cad87SWarner Losh 1484*c43cad87SWarner Loshdnl Do not support the xmalloc option by default. 1485*c43cad87SWarner LoshAC_ARG_ENABLE([xmalloc], 1486*c43cad87SWarner Losh [AS_HELP_STRING([--enable-xmalloc], [Support xmalloc option])], 1487*c43cad87SWarner Losh[if test "x$enable_xmalloc" = "xno" ; then 1488*c43cad87SWarner Losh enable_xmalloc="0" 1489*c43cad87SWarner Loshelse 1490*c43cad87SWarner Losh enable_xmalloc="1" 1491*c43cad87SWarner Loshfi 1492*c43cad87SWarner Losh], 1493*c43cad87SWarner Losh[enable_xmalloc="0"] 1494*c43cad87SWarner Losh) 1495*c43cad87SWarner Loshif test "x$enable_xmalloc" = "x1" ; then 1496*c43cad87SWarner Losh AC_DEFINE([JEMALLOC_XMALLOC], [ ], [ ]) 1497*c43cad87SWarner Loshfi 1498*c43cad87SWarner LoshAC_SUBST([enable_xmalloc]) 1499*c43cad87SWarner Losh 1500*c43cad87SWarner Loshdnl Support cache-oblivious allocation alignment by default. 1501*c43cad87SWarner LoshAC_ARG_ENABLE([cache-oblivious], 1502*c43cad87SWarner Losh [AS_HELP_STRING([--disable-cache-oblivious], 1503*c43cad87SWarner Losh [Disable support for cache-oblivious allocation alignment])], 1504*c43cad87SWarner Losh[if test "x$enable_cache_oblivious" = "xno" ; then 1505*c43cad87SWarner Losh enable_cache_oblivious="0" 1506*c43cad87SWarner Loshelse 1507*c43cad87SWarner Losh enable_cache_oblivious="1" 1508*c43cad87SWarner Loshfi 1509*c43cad87SWarner Losh], 1510*c43cad87SWarner Losh[enable_cache_oblivious="1"] 1511*c43cad87SWarner Losh) 1512*c43cad87SWarner Loshif test "x$enable_cache_oblivious" = "x1" ; then 1513*c43cad87SWarner Losh AC_DEFINE([JEMALLOC_CACHE_OBLIVIOUS], [ ], [ ]) 1514*c43cad87SWarner Loshfi 1515*c43cad87SWarner LoshAC_SUBST([enable_cache_oblivious]) 1516*c43cad87SWarner Losh 1517*c43cad87SWarner Loshdnl Do not log by default. 1518*c43cad87SWarner LoshAC_ARG_ENABLE([log], 1519*c43cad87SWarner Losh [AS_HELP_STRING([--enable-log], [Support debug logging])], 1520*c43cad87SWarner Losh[if test "x$enable_log" = "xno" ; then 1521*c43cad87SWarner Losh enable_log="0" 1522*c43cad87SWarner Loshelse 1523*c43cad87SWarner Losh enable_log="1" 1524*c43cad87SWarner Loshfi 1525*c43cad87SWarner Losh], 1526*c43cad87SWarner Losh[enable_log="0"] 1527*c43cad87SWarner Losh) 1528*c43cad87SWarner Loshif test "x$enable_log" = "x1" ; then 1529*c43cad87SWarner Losh AC_DEFINE([JEMALLOC_LOG], [ ], [ ]) 1530*c43cad87SWarner Loshfi 1531*c43cad87SWarner LoshAC_SUBST([enable_log]) 1532*c43cad87SWarner Losh 1533*c43cad87SWarner Loshdnl Do not use readlinkat by default 1534*c43cad87SWarner LoshAC_ARG_ENABLE([readlinkat], 1535*c43cad87SWarner Losh [AS_HELP_STRING([--enable-readlinkat], [Use readlinkat over readlink])], 1536*c43cad87SWarner Losh[if test "x$enable_readlinkat" = "xno" ; then 1537*c43cad87SWarner Losh enable_readlinkat="0" 1538*c43cad87SWarner Loshelse 1539*c43cad87SWarner Losh enable_readlinkat="1" 1540*c43cad87SWarner Loshfi 1541*c43cad87SWarner Losh], 1542*c43cad87SWarner Losh[enable_readlinkat="0"] 1543*c43cad87SWarner Losh) 1544*c43cad87SWarner Loshif test "x$enable_readlinkat" = "x1" ; then 1545*c43cad87SWarner Losh AC_DEFINE([JEMALLOC_READLINKAT], [ ], [ ]) 1546*c43cad87SWarner Loshfi 1547*c43cad87SWarner LoshAC_SUBST([enable_readlinkat]) 1548*c43cad87SWarner Losh 1549*c43cad87SWarner Loshdnl Avoid extra safety checks by default 1550*c43cad87SWarner LoshAC_ARG_ENABLE([opt-safety-checks], 1551*c43cad87SWarner Losh [AS_HELP_STRING([--enable-opt-safety-checks], 1552*c43cad87SWarner Losh [Perform certain low-overhead checks, even in opt mode])], 1553*c43cad87SWarner Losh[if test "x$enable_opt_safety_checks" = "xno" ; then 1554*c43cad87SWarner Losh enable_opt_safety_checks="0" 1555*c43cad87SWarner Loshelse 1556*c43cad87SWarner Losh enable_opt_safety_checks="1" 1557*c43cad87SWarner Loshfi 1558*c43cad87SWarner Losh], 1559*c43cad87SWarner Losh[enable_opt_safety_checks="0"] 1560*c43cad87SWarner Losh) 1561*c43cad87SWarner Loshif test "x$enable_opt_safety_checks" = "x1" ; then 1562*c43cad87SWarner Losh AC_DEFINE([JEMALLOC_OPT_SAFETY_CHECKS], [ ], [ ]) 1563*c43cad87SWarner Loshfi 1564*c43cad87SWarner LoshAC_SUBST([enable_opt_safety_checks]) 1565*c43cad87SWarner Losh 1566*c43cad87SWarner Loshdnl Look for sized-deallocation bugs while otherwise being in opt mode. 1567*c43cad87SWarner LoshAC_ARG_ENABLE([opt-size-checks], 1568*c43cad87SWarner Losh [AS_HELP_STRING([--enable-opt-size-checks], 1569*c43cad87SWarner Losh [Perform sized-deallocation argument checks, even in opt mode])], 1570*c43cad87SWarner Losh[if test "x$enable_opt_size_checks" = "xno" ; then 1571*c43cad87SWarner Losh enable_opt_size_checks="0" 1572*c43cad87SWarner Loshelse 1573*c43cad87SWarner Losh enable_opt_size_checks="1" 1574*c43cad87SWarner Loshfi 1575*c43cad87SWarner Losh], 1576*c43cad87SWarner Losh[enable_opt_size_checks="0"] 1577*c43cad87SWarner Losh) 1578*c43cad87SWarner Loshif test "x$enable_opt_size_checks" = "x1" ; then 1579*c43cad87SWarner Losh AC_DEFINE([JEMALLOC_OPT_SIZE_CHECKS], [ ], [ ]) 1580*c43cad87SWarner Loshfi 1581*c43cad87SWarner LoshAC_SUBST([enable_opt_size_checks]) 1582*c43cad87SWarner Losh 1583*c43cad87SWarner Loshdnl Do not check for use-after-free by default. 1584*c43cad87SWarner LoshAC_ARG_ENABLE([uaf-detection], 1585*c43cad87SWarner Losh [AS_HELP_STRING([--enable-uaf-detection], 1586*c43cad87SWarner Losh [Allow sampled junk-filling on deallocation to detect use-after-free])], 1587*c43cad87SWarner Losh[if test "x$enable_uaf_detection" = "xno" ; then 1588*c43cad87SWarner Losh enable_uaf_detection="0" 1589*c43cad87SWarner Loshelse 1590*c43cad87SWarner Losh enable_uaf_detection="1" 1591*c43cad87SWarner Loshfi 1592*c43cad87SWarner Losh], 1593*c43cad87SWarner Losh[enable_uaf_detection="0"] 1594*c43cad87SWarner Losh) 1595*c43cad87SWarner Loshif test "x$enable_uaf_detection" = "x1" ; then 1596*c43cad87SWarner Losh AC_DEFINE([JEMALLOC_UAF_DETECTION], [ ]) 1597*c43cad87SWarner Loshfi 1598*c43cad87SWarner LoshAC_SUBST([enable_uaf_detection]) 1599*c43cad87SWarner Losh 1600*c43cad87SWarner LoshJE_COMPILABLE([a program using __builtin_unreachable], [ 1601*c43cad87SWarner Loshvoid foo (void) { 1602*c43cad87SWarner Losh __builtin_unreachable(); 1603*c43cad87SWarner Losh} 1604*c43cad87SWarner Losh], [ 1605*c43cad87SWarner Losh { 1606*c43cad87SWarner Losh foo(); 1607*c43cad87SWarner Losh } 1608*c43cad87SWarner Losh], [je_cv_gcc_builtin_unreachable]) 1609*c43cad87SWarner Loshif test "x${je_cv_gcc_builtin_unreachable}" = "xyes" ; then 1610*c43cad87SWarner Losh AC_DEFINE([JEMALLOC_INTERNAL_UNREACHABLE], [__builtin_unreachable], [ ]) 1611*c43cad87SWarner Loshelse 1612*c43cad87SWarner Losh AC_DEFINE([JEMALLOC_INTERNAL_UNREACHABLE], [abort], [ ]) 1613*c43cad87SWarner Loshfi 1614*c43cad87SWarner Losh 1615*c43cad87SWarner Loshdnl ============================================================================ 1616*c43cad87SWarner Loshdnl Check for __builtin_ffsl(), then ffsl(3), and fail if neither are found. 1617*c43cad87SWarner Loshdnl One of those two functions should (theoretically) exist on all platforms 1618*c43cad87SWarner Loshdnl that jemalloc currently has a chance of functioning on without modification. 1619*c43cad87SWarner Loshdnl We additionally assume ffs[ll]() or __builtin_ffs[ll]() are defined if 1620*c43cad87SWarner Loshdnl ffsl() or __builtin_ffsl() are defined, respectively. 1621*c43cad87SWarner LoshJE_COMPILABLE([a program using __builtin_ffsl], [ 1622*c43cad87SWarner Losh#include <stdio.h> 1623*c43cad87SWarner Losh#include <strings.h> 1624*c43cad87SWarner Losh#include <string.h> 1625*c43cad87SWarner Losh], [ 1626*c43cad87SWarner Losh { 1627*c43cad87SWarner Losh int rv = __builtin_ffsl(0x08); 1628*c43cad87SWarner Losh printf("%d\n", rv); 1629*c43cad87SWarner Losh } 1630*c43cad87SWarner Losh], [je_cv_gcc_builtin_ffsl]) 1631*c43cad87SWarner Loshif test "x${je_cv_gcc_builtin_ffsl}" = "xyes" ; then 1632*c43cad87SWarner Losh AC_DEFINE([JEMALLOC_INTERNAL_FFSLL], [__builtin_ffsll], [ ]) 1633*c43cad87SWarner Losh AC_DEFINE([JEMALLOC_INTERNAL_FFSL], [__builtin_ffsl], [ ]) 1634*c43cad87SWarner Losh AC_DEFINE([JEMALLOC_INTERNAL_FFS], [__builtin_ffs], [ ]) 1635*c43cad87SWarner Loshelse 1636*c43cad87SWarner Losh JE_COMPILABLE([a program using ffsl], [ 1637*c43cad87SWarner Losh #include <stdio.h> 1638*c43cad87SWarner Losh #include <strings.h> 1639*c43cad87SWarner Losh #include <string.h> 1640*c43cad87SWarner Losh ], [ 1641*c43cad87SWarner Losh { 1642*c43cad87SWarner Losh int rv = ffsl(0x08); 1643*c43cad87SWarner Losh printf("%d\n", rv); 1644*c43cad87SWarner Losh } 1645*c43cad87SWarner Losh ], [je_cv_function_ffsl]) 1646*c43cad87SWarner Losh if test "x${je_cv_function_ffsl}" = "xyes" ; then 1647*c43cad87SWarner Losh AC_DEFINE([JEMALLOC_INTERNAL_FFSLL], [ffsll], [ ]) 1648*c43cad87SWarner Losh AC_DEFINE([JEMALLOC_INTERNAL_FFSL], [ffsl], [ ]) 1649*c43cad87SWarner Losh AC_DEFINE([JEMALLOC_INTERNAL_FFS], [ffs], [ ]) 1650*c43cad87SWarner Losh else 1651*c43cad87SWarner Losh AC_MSG_ERROR([Cannot build without ffsl(3) or __builtin_ffsl()]) 1652*c43cad87SWarner Losh fi 1653*c43cad87SWarner Loshfi 1654*c43cad87SWarner Losh 1655*c43cad87SWarner LoshJE_COMPILABLE([a program using __builtin_popcountl], [ 1656*c43cad87SWarner Losh#include <stdio.h> 1657*c43cad87SWarner Losh#include <strings.h> 1658*c43cad87SWarner Losh#include <string.h> 1659*c43cad87SWarner Losh], [ 1660*c43cad87SWarner Losh { 1661*c43cad87SWarner Losh int rv = __builtin_popcountl(0x08); 1662*c43cad87SWarner Losh printf("%d\n", rv); 1663*c43cad87SWarner Losh } 1664*c43cad87SWarner Losh], [je_cv_gcc_builtin_popcountl]) 1665*c43cad87SWarner Loshif test "x${je_cv_gcc_builtin_popcountl}" = "xyes" ; then 1666*c43cad87SWarner Losh AC_DEFINE([JEMALLOC_INTERNAL_POPCOUNT], [__builtin_popcount], [ ]) 1667*c43cad87SWarner Losh AC_DEFINE([JEMALLOC_INTERNAL_POPCOUNTL], [__builtin_popcountl], [ ]) 1668*c43cad87SWarner Losh AC_DEFINE([JEMALLOC_INTERNAL_POPCOUNTLL], [__builtin_popcountll], [ ]) 1669*c43cad87SWarner Loshfi 1670*c43cad87SWarner Losh 1671*c43cad87SWarner LoshAC_ARG_WITH([lg_quantum], 1672*c43cad87SWarner Losh [AS_HELP_STRING([--with-lg-quantum=<lg-quantum>], 1673*c43cad87SWarner Losh [Base 2 log of minimum allocation alignment])]) 1674*c43cad87SWarner Loshif test "x$with_lg_quantum" != "x" ; then 1675*c43cad87SWarner Losh AC_DEFINE_UNQUOTED([LG_QUANTUM], [$with_lg_quantum], [ ]) 1676*c43cad87SWarner Loshfi 1677*c43cad87SWarner Losh 1678*c43cad87SWarner LoshAC_ARG_WITH([lg_slab_maxregs], 1679*c43cad87SWarner Losh [AS_HELP_STRING([--with-lg-slab-maxregs=<lg-slab-maxregs>], 1680*c43cad87SWarner Losh [Base 2 log of maximum number of regions in a slab (used with malloc_conf slab_sizes)])], 1681*c43cad87SWarner Losh [CONFIG_LG_SLAB_MAXREGS="with_lg_slab_maxregs"], 1682*c43cad87SWarner Losh [CONFIG_LG_SLAB_MAXREGS=""]) 1683*c43cad87SWarner Loshif test "x$with_lg_slab_maxregs" != "x" ; then 1684*c43cad87SWarner Losh AC_DEFINE_UNQUOTED([CONFIG_LG_SLAB_MAXREGS], [$with_lg_slab_maxregs], [ ]) 1685*c43cad87SWarner Loshfi 1686*c43cad87SWarner Losh 1687*c43cad87SWarner LoshAC_ARG_WITH([lg_page], 1688*c43cad87SWarner Losh [AS_HELP_STRING([--with-lg-page=<lg-page>], [Base 2 log of system page size])], 1689*c43cad87SWarner Losh [LG_PAGE="$with_lg_page"], [LG_PAGE="detect"]) 1690*c43cad87SWarner Loshcase "${host}" in 1691*c43cad87SWarner Losh aarch64-apple-darwin*) 1692*c43cad87SWarner Losh dnl When cross-compile for Apple M1 and no page size specified, use the 1693*c43cad87SWarner Losh dnl default and skip detecting the page size (which is likely incorrect). 1694*c43cad87SWarner Losh if test "x${host}" != "x${build}" -a "x$LG_PAGE" = "xdetect"; then 1695*c43cad87SWarner Losh LG_PAGE=14 1696*c43cad87SWarner Losh fi 1697*c43cad87SWarner Losh ;; 1698*c43cad87SWarner Loshesac 1699*c43cad87SWarner Loshif test "x$LG_PAGE" = "xdetect"; then 1700*c43cad87SWarner Losh AC_CACHE_CHECK([LG_PAGE], 1701*c43cad87SWarner Losh [je_cv_lg_page], 1702*c43cad87SWarner Losh AC_RUN_IFELSE([AC_LANG_PROGRAM( 1703*c43cad87SWarner Losh[[ 1704*c43cad87SWarner Losh#include <strings.h> 1705*c43cad87SWarner Losh#ifdef _WIN32 1706*c43cad87SWarner Losh#include <windows.h> 1707*c43cad87SWarner Losh#else 1708*c43cad87SWarner Losh#include <unistd.h> 1709*c43cad87SWarner Losh#endif 1710*c43cad87SWarner Losh#include <stdio.h> 1711*c43cad87SWarner Losh]], 1712*c43cad87SWarner Losh[[ 1713*c43cad87SWarner Losh int result; 1714*c43cad87SWarner Losh FILE *f; 1715*c43cad87SWarner Losh 1716*c43cad87SWarner Losh#ifdef _WIN32 1717*c43cad87SWarner Losh SYSTEM_INFO si; 1718*c43cad87SWarner Losh GetSystemInfo(&si); 1719*c43cad87SWarner Losh result = si.dwPageSize; 1720*c43cad87SWarner Losh#else 1721*c43cad87SWarner Losh result = sysconf(_SC_PAGESIZE); 1722*c43cad87SWarner Losh#endif 1723*c43cad87SWarner Losh if (result == -1) { 1724*c43cad87SWarner Losh return 1; 1725*c43cad87SWarner Losh } 1726*c43cad87SWarner Losh result = JEMALLOC_INTERNAL_FFSL(result) - 1; 1727*c43cad87SWarner Losh 1728*c43cad87SWarner Losh f = fopen("conftest.out", "w"); 1729*c43cad87SWarner Losh if (f == NULL) { 1730*c43cad87SWarner Losh return 1; 1731*c43cad87SWarner Losh } 1732*c43cad87SWarner Losh fprintf(f, "%d", result); 1733*c43cad87SWarner Losh fclose(f); 1734*c43cad87SWarner Losh 1735*c43cad87SWarner Losh return 0; 1736*c43cad87SWarner Losh]])], 1737*c43cad87SWarner Losh [je_cv_lg_page=`cat conftest.out`], 1738*c43cad87SWarner Losh [je_cv_lg_page=undefined], 1739*c43cad87SWarner Losh [je_cv_lg_page=12])) 1740*c43cad87SWarner Loshfi 1741*c43cad87SWarner Loshif test "x${je_cv_lg_page}" != "x" ; then 1742*c43cad87SWarner Losh LG_PAGE="${je_cv_lg_page}" 1743*c43cad87SWarner Loshfi 1744*c43cad87SWarner Loshif test "x${LG_PAGE}" != "xundefined" ; then 1745*c43cad87SWarner Losh AC_DEFINE_UNQUOTED([LG_PAGE], [$LG_PAGE], [ ]) 1746*c43cad87SWarner Loshelse 1747*c43cad87SWarner Losh AC_MSG_ERROR([cannot determine value for LG_PAGE]) 1748*c43cad87SWarner Loshfi 1749*c43cad87SWarner Losh 1750*c43cad87SWarner LoshAC_ARG_WITH([lg_hugepage], 1751*c43cad87SWarner Losh [AS_HELP_STRING([--with-lg-hugepage=<lg-hugepage>], 1752*c43cad87SWarner Losh [Base 2 log of system huge page size])], 1753*c43cad87SWarner Losh [je_cv_lg_hugepage="${with_lg_hugepage}"], 1754*c43cad87SWarner Losh [je_cv_lg_hugepage=""]) 1755*c43cad87SWarner Loshif test "x${je_cv_lg_hugepage}" = "x" ; then 1756*c43cad87SWarner Losh dnl Look in /proc/meminfo (Linux-specific) for information on the default huge 1757*c43cad87SWarner Losh dnl page size, if any. The relevant line looks like: 1758*c43cad87SWarner Losh dnl 1759*c43cad87SWarner Losh dnl Hugepagesize: 2048 kB 1760*c43cad87SWarner Losh if test -e "/proc/meminfo" ; then 1761*c43cad87SWarner Losh hpsk=[`cat /proc/meminfo 2>/dev/null | \ 1762*c43cad87SWarner Losh grep -e '^Hugepagesize:[[:space:]]\+[0-9]\+[[:space:]]kB$' | \ 1763*c43cad87SWarner Losh awk '{print $2}'`] 1764*c43cad87SWarner Losh if test "x${hpsk}" != "x" ; then 1765*c43cad87SWarner Losh je_cv_lg_hugepage=10 1766*c43cad87SWarner Losh while test "${hpsk}" -gt 1 ; do 1767*c43cad87SWarner Losh hpsk="$((hpsk / 2))" 1768*c43cad87SWarner Losh je_cv_lg_hugepage="$((je_cv_lg_hugepage + 1))" 1769*c43cad87SWarner Losh done 1770*c43cad87SWarner Losh fi 1771*c43cad87SWarner Losh fi 1772*c43cad87SWarner Losh 1773*c43cad87SWarner Losh dnl Set default if unable to automatically configure. 1774*c43cad87SWarner Losh if test "x${je_cv_lg_hugepage}" = "x" ; then 1775*c43cad87SWarner Losh je_cv_lg_hugepage=21 1776*c43cad87SWarner Losh fi 1777*c43cad87SWarner Loshfi 1778*c43cad87SWarner Loshif test "x${LG_PAGE}" != "xundefined" -a \ 1779*c43cad87SWarner Losh "${je_cv_lg_hugepage}" -lt "${LG_PAGE}" ; then 1780*c43cad87SWarner Losh AC_MSG_ERROR([Huge page size (2^${je_cv_lg_hugepage}) must be at least page size (2^${LG_PAGE})]) 1781*c43cad87SWarner Loshfi 1782*c43cad87SWarner LoshAC_DEFINE_UNQUOTED([LG_HUGEPAGE], [${je_cv_lg_hugepage}], [ ]) 1783*c43cad87SWarner Losh 1784*c43cad87SWarner Loshdnl ============================================================================ 1785*c43cad87SWarner Loshdnl Enable libdl by default. 1786*c43cad87SWarner LoshAC_ARG_ENABLE([libdl], 1787*c43cad87SWarner Losh [AS_HELP_STRING([--disable-libdl], 1788*c43cad87SWarner Losh [Do not use libdl])], 1789*c43cad87SWarner Losh[if test "x$enable_libdl" = "xno" ; then 1790*c43cad87SWarner Losh enable_libdl="0" 1791*c43cad87SWarner Loshelse 1792*c43cad87SWarner Losh enable_libdl="1" 1793*c43cad87SWarner Loshfi 1794*c43cad87SWarner Losh], 1795*c43cad87SWarner Losh[enable_libdl="1"] 1796*c43cad87SWarner Losh) 1797*c43cad87SWarner LoshAC_SUBST([libdl]) 1798*c43cad87SWarner Losh 1799*c43cad87SWarner Loshdnl ============================================================================ 1800*c43cad87SWarner Loshdnl Configure pthreads. 1801*c43cad87SWarner Losh 1802*c43cad87SWarner Loshif test "x$abi" != "xpecoff" ; then 1803*c43cad87SWarner Losh AC_DEFINE([JEMALLOC_HAVE_PTHREAD], [ ], [ ]) 1804*c43cad87SWarner Losh AC_CHECK_HEADERS([pthread.h], , [AC_MSG_ERROR([pthread.h is missing])]) 1805*c43cad87SWarner Losh dnl Some systems may embed pthreads functionality in libc; check for libpthread 1806*c43cad87SWarner Losh dnl first, but try libc too before failing. 1807*c43cad87SWarner Losh AC_CHECK_LIB([pthread], [pthread_create], [JE_APPEND_VS(LIBS, -pthread)], 1808*c43cad87SWarner Losh [AC_SEARCH_LIBS([pthread_create], , , 1809*c43cad87SWarner Losh AC_MSG_ERROR([libpthread is missing]))]) 1810*c43cad87SWarner Losh wrap_syms="${wrap_syms} pthread_create" 1811*c43cad87SWarner Losh have_pthread="1" 1812*c43cad87SWarner Losh 1813*c43cad87SWarner Loshdnl Check if we have dlsym support. 1814*c43cad87SWarner Losh if test "x$enable_libdl" = "x1" ; then 1815*c43cad87SWarner Losh have_dlsym="1" 1816*c43cad87SWarner Losh AC_CHECK_HEADERS([dlfcn.h], 1817*c43cad87SWarner Losh AC_CHECK_FUNC([dlsym], [], 1818*c43cad87SWarner Losh [AC_CHECK_LIB([dl], [dlsym], [LIBS="$LIBS -ldl"], [have_dlsym="0"])]), 1819*c43cad87SWarner Losh [have_dlsym="0"]) 1820*c43cad87SWarner Losh if test "x$have_dlsym" = "x1" ; then 1821*c43cad87SWarner Losh AC_DEFINE([JEMALLOC_HAVE_DLSYM], [ ], [ ]) 1822*c43cad87SWarner Losh fi 1823*c43cad87SWarner Losh else 1824*c43cad87SWarner Losh have_dlsym="0" 1825*c43cad87SWarner Losh fi 1826*c43cad87SWarner Losh 1827*c43cad87SWarner Losh JE_COMPILABLE([pthread_atfork(3)], [ 1828*c43cad87SWarner Losh#include <pthread.h> 1829*c43cad87SWarner Losh], [ 1830*c43cad87SWarner Losh pthread_atfork((void *)0, (void *)0, (void *)0); 1831*c43cad87SWarner Losh], [je_cv_pthread_atfork]) 1832*c43cad87SWarner Losh if test "x${je_cv_pthread_atfork}" = "xyes" ; then 1833*c43cad87SWarner Losh AC_DEFINE([JEMALLOC_HAVE_PTHREAD_ATFORK], [ ], [ ]) 1834*c43cad87SWarner Losh fi 1835*c43cad87SWarner Losh dnl Check if pthread_setname_np is available with the expected API. 1836*c43cad87SWarner Losh JE_COMPILABLE([pthread_setname_np(3)], [ 1837*c43cad87SWarner Losh#include <pthread.h> 1838*c43cad87SWarner Losh], [ 1839*c43cad87SWarner Losh pthread_setname_np(pthread_self(), "setname_test"); 1840*c43cad87SWarner Losh], [je_cv_pthread_setname_np]) 1841*c43cad87SWarner Losh if test "x${je_cv_pthread_setname_np}" = "xyes" ; then 1842*c43cad87SWarner Losh AC_DEFINE([JEMALLOC_HAVE_PTHREAD_SETNAME_NP], [ ], [ ]) 1843*c43cad87SWarner Losh fi 1844*c43cad87SWarner Losh dnl Check if pthread_getname_np is not necessarily present despite 1845*c43cad87SWarner Losh dnl the pthread_setname_np counterpart 1846*c43cad87SWarner Losh JE_COMPILABLE([pthread_getname_np(3)], [ 1847*c43cad87SWarner Losh#include <pthread.h> 1848*c43cad87SWarner Losh#include <stdlib.h> 1849*c43cad87SWarner Losh], [ 1850*c43cad87SWarner Losh { 1851*c43cad87SWarner Losh char *name = malloc(16); 1852*c43cad87SWarner Losh pthread_getname_np(pthread_self(), name, 16); 1853*c43cad87SWarner Losh free(name); 1854*c43cad87SWarner Losh } 1855*c43cad87SWarner Losh], [je_cv_pthread_getname_np]) 1856*c43cad87SWarner Losh if test "x${je_cv_pthread_getname_np}" = "xyes" ; then 1857*c43cad87SWarner Losh AC_DEFINE([JEMALLOC_HAVE_PTHREAD_GETNAME_NP], [ ], [ ]) 1858*c43cad87SWarner Losh fi 1859*c43cad87SWarner Losh dnl Check if pthread_get_name_np is not necessarily present despite 1860*c43cad87SWarner Losh dnl the pthread_set_name_np counterpart 1861*c43cad87SWarner Losh JE_COMPILABLE([pthread_get_name_np(3)], [ 1862*c43cad87SWarner Losh#include <pthread.h> 1863*c43cad87SWarner Losh#include <pthread_np.h> 1864*c43cad87SWarner Losh#include <stdlib.h> 1865*c43cad87SWarner Losh], [ 1866*c43cad87SWarner Losh { 1867*c43cad87SWarner Losh char *name = malloc(16); 1868*c43cad87SWarner Losh pthread_get_name_np(pthread_self(), name, 16); 1869*c43cad87SWarner Losh free(name); 1870*c43cad87SWarner Losh } 1871*c43cad87SWarner Losh], [je_cv_pthread_get_name_np]) 1872*c43cad87SWarner Losh if test "x${je_cv_pthread_get_name_np}" = "xyes" ; then 1873*c43cad87SWarner Losh AC_DEFINE([JEMALLOC_HAVE_PTHREAD_GET_NAME_NP], [ ], [ ]) 1874*c43cad87SWarner Losh fi 1875*c43cad87SWarner Loshfi 1876*c43cad87SWarner Losh 1877*c43cad87SWarner LoshJE_APPEND_VS(CPPFLAGS, -D_REENTRANT) 1878*c43cad87SWarner Losh 1879*c43cad87SWarner Loshdnl Check whether clock_gettime(2) is in libc or librt. 1880*c43cad87SWarner LoshAC_SEARCH_LIBS([clock_gettime], [rt]) 1881*c43cad87SWarner Losh 1882*c43cad87SWarner Loshdnl Cray wrapper compiler often adds `-lrt` when using `-static`. Check with 1883*c43cad87SWarner Loshdnl `-dynamic` as well in case a user tries to dynamically link in jemalloc 1884*c43cad87SWarner Loshif test "x$je_cv_cray_prgenv_wrapper" = "xyes" ; then 1885*c43cad87SWarner Losh if test "$ac_cv_search_clock_gettime" != "-lrt"; then 1886*c43cad87SWarner Losh JE_CFLAGS_SAVE() 1887*c43cad87SWarner Losh 1888*c43cad87SWarner Losh unset ac_cv_search_clock_gettime 1889*c43cad87SWarner Losh JE_CFLAGS_ADD([-dynamic]) 1890*c43cad87SWarner Losh AC_SEARCH_LIBS([clock_gettime], [rt]) 1891*c43cad87SWarner Losh 1892*c43cad87SWarner Losh JE_CFLAGS_RESTORE() 1893*c43cad87SWarner Losh fi 1894*c43cad87SWarner Loshfi 1895*c43cad87SWarner Losh 1896*c43cad87SWarner Loshdnl check for CLOCK_MONOTONIC_COARSE (Linux-specific). 1897*c43cad87SWarner LoshJE_COMPILABLE([clock_gettime(CLOCK_MONOTONIC_COARSE, ...)], [ 1898*c43cad87SWarner Losh#include <time.h> 1899*c43cad87SWarner Losh], [ 1900*c43cad87SWarner Losh struct timespec ts; 1901*c43cad87SWarner Losh 1902*c43cad87SWarner Losh clock_gettime(CLOCK_MONOTONIC_COARSE, &ts); 1903*c43cad87SWarner Losh], [je_cv_clock_monotonic_coarse]) 1904*c43cad87SWarner Loshif test "x${je_cv_clock_monotonic_coarse}" = "xyes" ; then 1905*c43cad87SWarner Losh AC_DEFINE([JEMALLOC_HAVE_CLOCK_MONOTONIC_COARSE], [ ], [ ]) 1906*c43cad87SWarner Loshfi 1907*c43cad87SWarner Losh 1908*c43cad87SWarner Loshdnl check for CLOCK_MONOTONIC. 1909*c43cad87SWarner LoshJE_COMPILABLE([clock_gettime(CLOCK_MONOTONIC, ...)], [ 1910*c43cad87SWarner Losh#include <unistd.h> 1911*c43cad87SWarner Losh#include <time.h> 1912*c43cad87SWarner Losh], [ 1913*c43cad87SWarner Losh struct timespec ts; 1914*c43cad87SWarner Losh 1915*c43cad87SWarner Losh clock_gettime(CLOCK_MONOTONIC, &ts); 1916*c43cad87SWarner Losh#if !defined(_POSIX_MONOTONIC_CLOCK) || _POSIX_MONOTONIC_CLOCK < 0 1917*c43cad87SWarner Losh# error _POSIX_MONOTONIC_CLOCK missing/invalid 1918*c43cad87SWarner Losh#endif 1919*c43cad87SWarner Losh], [je_cv_clock_monotonic]) 1920*c43cad87SWarner Loshif test "x${je_cv_clock_monotonic}" = "xyes" ; then 1921*c43cad87SWarner Losh AC_DEFINE([JEMALLOC_HAVE_CLOCK_MONOTONIC], [ ], [ ]) 1922*c43cad87SWarner Loshfi 1923*c43cad87SWarner Losh 1924*c43cad87SWarner Loshdnl Check for mach_absolute_time(). 1925*c43cad87SWarner LoshJE_COMPILABLE([mach_absolute_time()], [ 1926*c43cad87SWarner Losh#include <mach/mach_time.h> 1927*c43cad87SWarner Losh], [ 1928*c43cad87SWarner Losh mach_absolute_time(); 1929*c43cad87SWarner Losh], [je_cv_mach_absolute_time]) 1930*c43cad87SWarner Loshif test "x${je_cv_mach_absolute_time}" = "xyes" ; then 1931*c43cad87SWarner Losh AC_DEFINE([JEMALLOC_HAVE_MACH_ABSOLUTE_TIME], [ ], [ ]) 1932*c43cad87SWarner Loshfi 1933*c43cad87SWarner Losh 1934*c43cad87SWarner Loshdnl check for CLOCK_REALTIME (always should be available on Linux) 1935*c43cad87SWarner LoshJE_COMPILABLE([clock_gettime(CLOCK_REALTIME, ...)], [ 1936*c43cad87SWarner Losh#include <time.h> 1937*c43cad87SWarner Losh], [ 1938*c43cad87SWarner Losh struct timespec ts; 1939*c43cad87SWarner Losh 1940*c43cad87SWarner Losh clock_gettime(CLOCK_REALTIME, &ts); 1941*c43cad87SWarner Losh], [je_cv_clock_realtime]) 1942*c43cad87SWarner Loshif test "x${je_cv_clock_realtime}" = "xyes" ; then 1943*c43cad87SWarner Losh AC_DEFINE([JEMALLOC_HAVE_CLOCK_REALTIME], [ ], [ ]) 1944*c43cad87SWarner Loshfi 1945*c43cad87SWarner Losh 1946*c43cad87SWarner Loshdnl Use syscall(2) (if available) by default. 1947*c43cad87SWarner LoshAC_ARG_ENABLE([syscall], 1948*c43cad87SWarner Losh [AS_HELP_STRING([--disable-syscall], [Disable use of syscall(2)])], 1949*c43cad87SWarner Losh[if test "x$enable_syscall" = "xno" ; then 1950*c43cad87SWarner Losh enable_syscall="0" 1951*c43cad87SWarner Loshelse 1952*c43cad87SWarner Losh enable_syscall="1" 1953*c43cad87SWarner Loshfi 1954*c43cad87SWarner Losh], 1955*c43cad87SWarner Losh[enable_syscall="1"] 1956*c43cad87SWarner Losh) 1957*c43cad87SWarner Loshif test "x$enable_syscall" = "x1" ; then 1958*c43cad87SWarner Losh dnl Check if syscall(2) is usable. Treat warnings as errors, so that e.g. OS 1959*c43cad87SWarner Losh dnl X 10.12's deprecation warning prevents use. 1960*c43cad87SWarner Losh JE_CFLAGS_SAVE() 1961*c43cad87SWarner Losh JE_CFLAGS_ADD([-Werror]) 1962*c43cad87SWarner Losh JE_COMPILABLE([syscall(2)], [ 1963*c43cad87SWarner Losh#include <sys/syscall.h> 1964*c43cad87SWarner Losh#include <unistd.h> 1965*c43cad87SWarner Losh], [ 1966*c43cad87SWarner Losh syscall(SYS_write, 2, "hello", 5); 1967*c43cad87SWarner Losh], 1968*c43cad87SWarner Losh [je_cv_syscall]) 1969*c43cad87SWarner Losh JE_CFLAGS_RESTORE() 1970*c43cad87SWarner Losh if test "x$je_cv_syscall" = "xyes" ; then 1971*c43cad87SWarner Losh AC_DEFINE([JEMALLOC_USE_SYSCALL], [ ], [ ]) 1972*c43cad87SWarner Losh fi 1973*c43cad87SWarner Loshfi 1974*c43cad87SWarner Losh 1975*c43cad87SWarner Loshdnl Check if the GNU-specific secure_getenv function exists. 1976*c43cad87SWarner LoshAC_CHECK_FUNC([secure_getenv], 1977*c43cad87SWarner Losh [have_secure_getenv="1"], 1978*c43cad87SWarner Losh [have_secure_getenv="0"] 1979*c43cad87SWarner Losh ) 1980*c43cad87SWarner Loshif test "x$have_secure_getenv" = "x1" ; then 1981*c43cad87SWarner Losh AC_DEFINE([JEMALLOC_HAVE_SECURE_GETENV], [ ], [ ]) 1982*c43cad87SWarner Loshfi 1983*c43cad87SWarner Losh 1984*c43cad87SWarner Loshdnl Check if the GNU-specific sched_getcpu function exists. 1985*c43cad87SWarner LoshAC_CHECK_FUNC([sched_getcpu], 1986*c43cad87SWarner Losh [have_sched_getcpu="1"], 1987*c43cad87SWarner Losh [have_sched_getcpu="0"] 1988*c43cad87SWarner Losh ) 1989*c43cad87SWarner Loshif test "x$have_sched_getcpu" = "x1" ; then 1990*c43cad87SWarner Losh AC_DEFINE([JEMALLOC_HAVE_SCHED_GETCPU], [ ], [ ]) 1991*c43cad87SWarner Loshfi 1992*c43cad87SWarner Losh 1993*c43cad87SWarner Loshdnl Check if the GNU-specific sched_setaffinity function exists. 1994*c43cad87SWarner LoshAC_CHECK_FUNC([sched_setaffinity], 1995*c43cad87SWarner Losh [have_sched_setaffinity="1"], 1996*c43cad87SWarner Losh [have_sched_setaffinity="0"] 1997*c43cad87SWarner Losh ) 1998*c43cad87SWarner Loshif test "x$have_sched_setaffinity" = "x1" ; then 1999*c43cad87SWarner Losh AC_DEFINE([JEMALLOC_HAVE_SCHED_SETAFFINITY], [ ], [ ]) 2000*c43cad87SWarner Loshfi 2001*c43cad87SWarner Losh 2002*c43cad87SWarner Loshdnl Check if the Solaris/BSD issetugid function exists. 2003*c43cad87SWarner LoshAC_CHECK_FUNC([issetugid], 2004*c43cad87SWarner Losh [have_issetugid="1"], 2005*c43cad87SWarner Losh [have_issetugid="0"] 2006*c43cad87SWarner Losh ) 2007*c43cad87SWarner Loshif test "x$have_issetugid" = "x1" ; then 2008*c43cad87SWarner Losh AC_DEFINE([JEMALLOC_HAVE_ISSETUGID], [ ], [ ]) 2009*c43cad87SWarner Loshfi 2010*c43cad87SWarner Losh 2011*c43cad87SWarner Loshdnl Check whether the BSD-specific _malloc_thread_cleanup() exists. If so, use 2012*c43cad87SWarner Loshdnl it rather than pthreads TSD cleanup functions to support cleanup during 2013*c43cad87SWarner Loshdnl thread exit, in order to avoid pthreads library recursion during 2014*c43cad87SWarner Loshdnl bootstrapping. 2015*c43cad87SWarner LoshAC_CHECK_FUNC([_malloc_thread_cleanup], 2016*c43cad87SWarner Losh [have__malloc_thread_cleanup="1"], 2017*c43cad87SWarner Losh [have__malloc_thread_cleanup="0"] 2018*c43cad87SWarner Losh ) 2019*c43cad87SWarner Loshif test "x$have__malloc_thread_cleanup" = "x1" ; then 2020*c43cad87SWarner Losh AC_DEFINE([JEMALLOC_MALLOC_THREAD_CLEANUP], [ ], [ ]) 2021*c43cad87SWarner Losh wrap_syms="${wrap_syms} _malloc_thread_cleanup _malloc_tsd_cleanup_register" 2022*c43cad87SWarner Losh force_tls="1" 2023*c43cad87SWarner Loshfi 2024*c43cad87SWarner Losh 2025*c43cad87SWarner Loshdnl Check whether the BSD-specific _pthread_mutex_init_calloc_cb() exists. If 2026*c43cad87SWarner Loshdnl so, mutex initialization causes allocation, and we need to implement this 2027*c43cad87SWarner Loshdnl callback function in order to prevent recursive allocation. 2028*c43cad87SWarner LoshAC_CHECK_FUNC([_pthread_mutex_init_calloc_cb], 2029*c43cad87SWarner Losh [have__pthread_mutex_init_calloc_cb="1"], 2030*c43cad87SWarner Losh [have__pthread_mutex_init_calloc_cb="0"] 2031*c43cad87SWarner Losh ) 2032*c43cad87SWarner Loshif test "x$have__pthread_mutex_init_calloc_cb" = "x1" ; then 2033*c43cad87SWarner Losh AC_DEFINE([JEMALLOC_MUTEX_INIT_CB], [ ], [ ]) 2034*c43cad87SWarner Losh wrap_syms="${wrap_syms} _malloc_prefork _malloc_postfork" 2035*c43cad87SWarner Loshfi 2036*c43cad87SWarner Losh 2037*c43cad87SWarner LoshAC_CHECK_FUNC([memcntl], 2038*c43cad87SWarner Losh [have_memcntl="1"], 2039*c43cad87SWarner Losh [have_memcntl="0"], 2040*c43cad87SWarner Losh ) 2041*c43cad87SWarner Loshif test "x$have_memcntl" = "x1" ; then 2042*c43cad87SWarner Losh AC_DEFINE([JEMALLOC_HAVE_MEMCNTL], [ ], [ ]) 2043*c43cad87SWarner Loshfi 2044*c43cad87SWarner Losh 2045*c43cad87SWarner Loshdnl Disable lazy locking by default. 2046*c43cad87SWarner LoshAC_ARG_ENABLE([lazy_lock], 2047*c43cad87SWarner Losh [AS_HELP_STRING([--enable-lazy-lock], 2048*c43cad87SWarner Losh [Enable lazy locking (only lock when multi-threaded)])], 2049*c43cad87SWarner Losh[if test "x$enable_lazy_lock" = "xno" ; then 2050*c43cad87SWarner Losh enable_lazy_lock="0" 2051*c43cad87SWarner Loshelse 2052*c43cad87SWarner Losh enable_lazy_lock="1" 2053*c43cad87SWarner Loshfi 2054*c43cad87SWarner Losh], 2055*c43cad87SWarner Losh[enable_lazy_lock=""] 2056*c43cad87SWarner Losh) 2057*c43cad87SWarner Loshif test "x${enable_lazy_lock}" = "x" ; then 2058*c43cad87SWarner Losh if test "x${force_lazy_lock}" = "x1" ; then 2059*c43cad87SWarner Losh AC_MSG_RESULT([Forcing lazy-lock to avoid allocator/threading bootstrap issues]) 2060*c43cad87SWarner Losh enable_lazy_lock="1" 2061*c43cad87SWarner Losh else 2062*c43cad87SWarner Losh enable_lazy_lock="0" 2063*c43cad87SWarner Losh fi 2064*c43cad87SWarner Loshfi 2065*c43cad87SWarner Loshif test "x${enable_lazy_lock}" = "x1" -a "x${abi}" = "xpecoff" ; then 2066*c43cad87SWarner Losh AC_MSG_RESULT([Forcing no lazy-lock because thread creation monitoring is unimplemented]) 2067*c43cad87SWarner Losh enable_lazy_lock="0" 2068*c43cad87SWarner Loshfi 2069*c43cad87SWarner Loshif test "x$enable_lazy_lock" = "x1" ; then 2070*c43cad87SWarner Losh if test "x$have_dlsym" = "x1" ; then 2071*c43cad87SWarner Losh AC_DEFINE([JEMALLOC_LAZY_LOCK], [ ], [ ]) 2072*c43cad87SWarner Losh else 2073*c43cad87SWarner Losh AC_MSG_ERROR([Missing dlsym support: lazy-lock cannot be enabled.]) 2074*c43cad87SWarner Losh fi 2075*c43cad87SWarner Loshfi 2076*c43cad87SWarner LoshAC_SUBST([enable_lazy_lock]) 2077*c43cad87SWarner Losh 2078*c43cad87SWarner Loshdnl Automatically configure TLS. 2079*c43cad87SWarner Loshif test "x${force_tls}" = "x1" ; then 2080*c43cad87SWarner Losh enable_tls="1" 2081*c43cad87SWarner Loshelif test "x${force_tls}" = "x0" ; then 2082*c43cad87SWarner Losh enable_tls="0" 2083*c43cad87SWarner Loshelse 2084*c43cad87SWarner Losh enable_tls="1" 2085*c43cad87SWarner Loshfi 2086*c43cad87SWarner Loshif test "x${enable_tls}" = "x1" ; then 2087*c43cad87SWarner LoshAC_MSG_CHECKING([for TLS]) 2088*c43cad87SWarner LoshAC_COMPILE_IFELSE([AC_LANG_PROGRAM( 2089*c43cad87SWarner Losh[[ 2090*c43cad87SWarner Losh __thread int x; 2091*c43cad87SWarner Losh]], [[ 2092*c43cad87SWarner Losh x = 42; 2093*c43cad87SWarner Losh 2094*c43cad87SWarner Losh return 0; 2095*c43cad87SWarner Losh]])], 2096*c43cad87SWarner Losh AC_MSG_RESULT([yes]), 2097*c43cad87SWarner Losh AC_MSG_RESULT([no]) 2098*c43cad87SWarner Losh enable_tls="0") 2099*c43cad87SWarner Loshelse 2100*c43cad87SWarner Losh enable_tls="0" 2101*c43cad87SWarner Loshfi 2102*c43cad87SWarner LoshAC_SUBST([enable_tls]) 2103*c43cad87SWarner Loshif test "x${enable_tls}" = "x1" ; then 2104*c43cad87SWarner Losh AC_DEFINE_UNQUOTED([JEMALLOC_TLS], [ ], [ ]) 2105*c43cad87SWarner Loshfi 2106*c43cad87SWarner Losh 2107*c43cad87SWarner Loshdnl ============================================================================ 2108*c43cad87SWarner Loshdnl Check for C11 atomics. 2109*c43cad87SWarner Losh 2110*c43cad87SWarner LoshJE_COMPILABLE([C11 atomics], [ 2111*c43cad87SWarner Losh#include <stdint.h> 2112*c43cad87SWarner Losh#if (__STDC_VERSION__ >= 201112L) && !defined(__STDC_NO_ATOMICS__) 2113*c43cad87SWarner Losh#include <stdatomic.h> 2114*c43cad87SWarner Losh#else 2115*c43cad87SWarner Losh#error Atomics not available 2116*c43cad87SWarner Losh#endif 2117*c43cad87SWarner Losh], [ 2118*c43cad87SWarner Losh uint64_t *p = (uint64_t *)0; 2119*c43cad87SWarner Losh uint64_t x = 1; 2120*c43cad87SWarner Losh volatile atomic_uint_least64_t *a = (volatile atomic_uint_least64_t *)p; 2121*c43cad87SWarner Losh uint64_t r = atomic_fetch_add(a, x) + x; 2122*c43cad87SWarner Losh return r == 0; 2123*c43cad87SWarner Losh], [je_cv_c11_atomics]) 2124*c43cad87SWarner Loshif test "x${je_cv_c11_atomics}" = "xyes" ; then 2125*c43cad87SWarner Losh AC_DEFINE([JEMALLOC_C11_ATOMICS], [ ], [ ]) 2126*c43cad87SWarner Loshfi 2127*c43cad87SWarner Losh 2128*c43cad87SWarner Loshdnl ============================================================================ 2129*c43cad87SWarner Loshdnl Check for GCC-style __atomic atomics. 2130*c43cad87SWarner Losh 2131*c43cad87SWarner LoshJE_COMPILABLE([GCC __atomic atomics], [ 2132*c43cad87SWarner Losh], [ 2133*c43cad87SWarner Losh int x = 0; 2134*c43cad87SWarner Losh int val = 1; 2135*c43cad87SWarner Losh int y = __atomic_fetch_add(&x, val, __ATOMIC_RELAXED); 2136*c43cad87SWarner Losh int after_add = x; 2137*c43cad87SWarner Losh return after_add == 1; 2138*c43cad87SWarner Losh], [je_cv_gcc_atomic_atomics]) 2139*c43cad87SWarner Loshif test "x${je_cv_gcc_atomic_atomics}" = "xyes" ; then 2140*c43cad87SWarner Losh AC_DEFINE([JEMALLOC_GCC_ATOMIC_ATOMICS], [ ], [ ]) 2141*c43cad87SWarner Losh 2142*c43cad87SWarner Losh dnl check for 8-bit atomic support 2143*c43cad87SWarner Losh JE_COMPILABLE([GCC 8-bit __atomic atomics], [ 2144*c43cad87SWarner Losh ], [ 2145*c43cad87SWarner Losh unsigned char x = 0; 2146*c43cad87SWarner Losh int val = 1; 2147*c43cad87SWarner Losh int y = __atomic_fetch_add(&x, val, __ATOMIC_RELAXED); 2148*c43cad87SWarner Losh int after_add = (int)x; 2149*c43cad87SWarner Losh return after_add == 1; 2150*c43cad87SWarner Losh ], [je_cv_gcc_u8_atomic_atomics]) 2151*c43cad87SWarner Losh if test "x${je_cv_gcc_u8_atomic_atomics}" = "xyes" ; then 2152*c43cad87SWarner Losh AC_DEFINE([JEMALLOC_GCC_U8_ATOMIC_ATOMICS], [ ], [ ]) 2153*c43cad87SWarner Losh fi 2154*c43cad87SWarner Loshfi 2155*c43cad87SWarner Losh 2156*c43cad87SWarner Loshdnl ============================================================================ 2157*c43cad87SWarner Loshdnl Check for GCC-style __sync atomics. 2158*c43cad87SWarner Losh 2159*c43cad87SWarner LoshJE_COMPILABLE([GCC __sync atomics], [ 2160*c43cad87SWarner Losh], [ 2161*c43cad87SWarner Losh int x = 0; 2162*c43cad87SWarner Losh int before_add = __sync_fetch_and_add(&x, 1); 2163*c43cad87SWarner Losh int after_add = x; 2164*c43cad87SWarner Losh return (before_add == 0) && (after_add == 1); 2165*c43cad87SWarner Losh], [je_cv_gcc_sync_atomics]) 2166*c43cad87SWarner Loshif test "x${je_cv_gcc_sync_atomics}" = "xyes" ; then 2167*c43cad87SWarner Losh AC_DEFINE([JEMALLOC_GCC_SYNC_ATOMICS], [ ], [ ]) 2168*c43cad87SWarner Losh 2169*c43cad87SWarner Losh dnl check for 8-bit atomic support 2170*c43cad87SWarner Losh JE_COMPILABLE([GCC 8-bit __sync atomics], [ 2171*c43cad87SWarner Losh ], [ 2172*c43cad87SWarner Losh unsigned char x = 0; 2173*c43cad87SWarner Losh int before_add = __sync_fetch_and_add(&x, 1); 2174*c43cad87SWarner Losh int after_add = (int)x; 2175*c43cad87SWarner Losh return (before_add == 0) && (after_add == 1); 2176*c43cad87SWarner Losh ], [je_cv_gcc_u8_sync_atomics]) 2177*c43cad87SWarner Losh if test "x${je_cv_gcc_u8_sync_atomics}" = "xyes" ; then 2178*c43cad87SWarner Losh AC_DEFINE([JEMALLOC_GCC_U8_SYNC_ATOMICS], [ ], [ ]) 2179*c43cad87SWarner Losh fi 2180*c43cad87SWarner Loshfi 2181*c43cad87SWarner Losh 2182*c43cad87SWarner Loshdnl ============================================================================ 2183*c43cad87SWarner Loshdnl Check for atomic(3) operations as provided on Darwin. 2184*c43cad87SWarner Loshdnl We need this not for the atomic operations (which are provided above), but 2185*c43cad87SWarner Loshdnl rather for the OS_unfair_lock type it exposes. 2186*c43cad87SWarner Losh 2187*c43cad87SWarner LoshJE_COMPILABLE([Darwin OSAtomic*()], [ 2188*c43cad87SWarner Losh#include <libkern/OSAtomic.h> 2189*c43cad87SWarner Losh#include <inttypes.h> 2190*c43cad87SWarner Losh], [ 2191*c43cad87SWarner Losh { 2192*c43cad87SWarner Losh int32_t x32 = 0; 2193*c43cad87SWarner Losh volatile int32_t *x32p = &x32; 2194*c43cad87SWarner Losh OSAtomicAdd32(1, x32p); 2195*c43cad87SWarner Losh } 2196*c43cad87SWarner Losh { 2197*c43cad87SWarner Losh int64_t x64 = 0; 2198*c43cad87SWarner Losh volatile int64_t *x64p = &x64; 2199*c43cad87SWarner Losh OSAtomicAdd64(1, x64p); 2200*c43cad87SWarner Losh } 2201*c43cad87SWarner Losh], [je_cv_osatomic]) 2202*c43cad87SWarner Loshif test "x${je_cv_osatomic}" = "xyes" ; then 2203*c43cad87SWarner Losh AC_DEFINE([JEMALLOC_OSATOMIC], [ ], [ ]) 2204*c43cad87SWarner Loshfi 2205*c43cad87SWarner Losh 2206*c43cad87SWarner Loshdnl ============================================================================ 2207*c43cad87SWarner Loshdnl Check for madvise(2). 2208*c43cad87SWarner Losh 2209*c43cad87SWarner LoshJE_COMPILABLE([madvise(2)], [ 2210*c43cad87SWarner Losh#include <sys/mman.h> 2211*c43cad87SWarner Losh], [ 2212*c43cad87SWarner Losh madvise((void *)0, 0, 0); 2213*c43cad87SWarner Losh], [je_cv_madvise]) 2214*c43cad87SWarner Loshif test "x${je_cv_madvise}" = "xyes" ; then 2215*c43cad87SWarner Losh AC_DEFINE([JEMALLOC_HAVE_MADVISE], [ ], [ ]) 2216*c43cad87SWarner Losh 2217*c43cad87SWarner Losh dnl Check for madvise(..., MADV_FREE). 2218*c43cad87SWarner Losh JE_COMPILABLE([madvise(..., MADV_FREE)], [ 2219*c43cad87SWarner Losh#include <sys/mman.h> 2220*c43cad87SWarner Losh], [ 2221*c43cad87SWarner Losh madvise((void *)0, 0, MADV_FREE); 2222*c43cad87SWarner Losh], [je_cv_madv_free]) 2223*c43cad87SWarner Losh if test "x${je_cv_madv_free}" = "xyes" ; then 2224*c43cad87SWarner Losh AC_DEFINE([JEMALLOC_PURGE_MADVISE_FREE], [ ], [ ]) 2225*c43cad87SWarner Losh elif test "x${je_cv_madvise}" = "xyes" ; then 2226*c43cad87SWarner Losh case "${host_cpu}" in i686|x86_64) 2227*c43cad87SWarner Losh case "${host}" in *-*-linux*) 2228*c43cad87SWarner Losh AC_DEFINE([JEMALLOC_PURGE_MADVISE_FREE], [ ], [ ]) 2229*c43cad87SWarner Losh AC_DEFINE([JEMALLOC_DEFINE_MADVISE_FREE], [ ], [ ]) 2230*c43cad87SWarner Losh ;; 2231*c43cad87SWarner Losh esac 2232*c43cad87SWarner Losh ;; 2233*c43cad87SWarner Losh esac 2234*c43cad87SWarner Losh fi 2235*c43cad87SWarner Losh 2236*c43cad87SWarner Losh dnl Check for madvise(..., MADV_DONTNEED). 2237*c43cad87SWarner Losh JE_COMPILABLE([madvise(..., MADV_DONTNEED)], [ 2238*c43cad87SWarner Losh#include <sys/mman.h> 2239*c43cad87SWarner Losh], [ 2240*c43cad87SWarner Losh madvise((void *)0, 0, MADV_DONTNEED); 2241*c43cad87SWarner Losh], [je_cv_madv_dontneed]) 2242*c43cad87SWarner Losh if test "x${je_cv_madv_dontneed}" = "xyes" ; then 2243*c43cad87SWarner Losh AC_DEFINE([JEMALLOC_PURGE_MADVISE_DONTNEED], [ ], [ ]) 2244*c43cad87SWarner Losh fi 2245*c43cad87SWarner Losh 2246*c43cad87SWarner Losh dnl Check for madvise(..., MADV_DO[NT]DUMP). 2247*c43cad87SWarner Losh JE_COMPILABLE([madvise(..., MADV_DO[[NT]]DUMP)], [ 2248*c43cad87SWarner Losh#include <sys/mman.h> 2249*c43cad87SWarner Losh], [ 2250*c43cad87SWarner Losh madvise((void *)0, 0, MADV_DONTDUMP); 2251*c43cad87SWarner Losh madvise((void *)0, 0, MADV_DODUMP); 2252*c43cad87SWarner Losh], [je_cv_madv_dontdump]) 2253*c43cad87SWarner Losh if test "x${je_cv_madv_dontdump}" = "xyes" ; then 2254*c43cad87SWarner Losh AC_DEFINE([JEMALLOC_MADVISE_DONTDUMP], [ ], [ ]) 2255*c43cad87SWarner Losh fi 2256*c43cad87SWarner Losh 2257*c43cad87SWarner Losh dnl Check for madvise(..., MADV_[NO]HUGEPAGE). 2258*c43cad87SWarner Losh JE_COMPILABLE([madvise(..., MADV_[[NO]]HUGEPAGE)], [ 2259*c43cad87SWarner Losh#include <sys/mman.h> 2260*c43cad87SWarner Losh], [ 2261*c43cad87SWarner Losh madvise((void *)0, 0, MADV_HUGEPAGE); 2262*c43cad87SWarner Losh madvise((void *)0, 0, MADV_NOHUGEPAGE); 2263*c43cad87SWarner Losh], [je_cv_thp]) 2264*c43cad87SWarner Losh dnl Check for madvise(..., MADV_[NO]CORE). 2265*c43cad87SWarner Losh JE_COMPILABLE([madvise(..., MADV_[[NO]]CORE)], [ 2266*c43cad87SWarner Losh#include <sys/mman.h> 2267*c43cad87SWarner Losh], [ 2268*c43cad87SWarner Losh madvise((void *)0, 0, MADV_NOCORE); 2269*c43cad87SWarner Losh madvise((void *)0, 0, MADV_CORE); 2270*c43cad87SWarner Losh], [je_cv_madv_nocore]) 2271*c43cad87SWarner Losh if test "x${je_cv_madv_nocore}" = "xyes" ; then 2272*c43cad87SWarner Losh AC_DEFINE([JEMALLOC_MADVISE_NOCORE], [ ], [ ]) 2273*c43cad87SWarner Losh fi 2274*c43cad87SWarner Loshcase "${host_cpu}" in 2275*c43cad87SWarner Losh arm*) 2276*c43cad87SWarner Losh ;; 2277*c43cad87SWarner Losh *) 2278*c43cad87SWarner Losh if test "x${je_cv_thp}" = "xyes" ; then 2279*c43cad87SWarner Losh AC_DEFINE([JEMALLOC_HAVE_MADVISE_HUGE], [ ], [ ]) 2280*c43cad87SWarner Losh fi 2281*c43cad87SWarner Losh ;; 2282*c43cad87SWarner Loshesac 2283*c43cad87SWarner Loshelse 2284*c43cad87SWarner Losh dnl Check for posix_madvise. 2285*c43cad87SWarner Losh JE_COMPILABLE([posix_madvise], [ 2286*c43cad87SWarner Losh #include <sys/mman.h> 2287*c43cad87SWarner Losh ], [ 2288*c43cad87SWarner Losh posix_madvise((void *)0, 0, 0); 2289*c43cad87SWarner Losh ], [je_cv_posix_madvise]) 2290*c43cad87SWarner Losh if test "x${je_cv_posix_madvise}" = "xyes" ; then 2291*c43cad87SWarner Losh AC_DEFINE([JEMALLOC_HAVE_POSIX_MADVISE], [ ], [ ]) 2292*c43cad87SWarner Losh 2293*c43cad87SWarner Losh dnl Check for posix_madvise(..., POSIX_MADV_DONTNEED). 2294*c43cad87SWarner Losh JE_COMPILABLE([posix_madvise(..., POSIX_MADV_DONTNEED)], [ 2295*c43cad87SWarner Losh #include <sys/mman.h> 2296*c43cad87SWarner Losh ], [ 2297*c43cad87SWarner Losh posix_madvise((void *)0, 0, POSIX_MADV_DONTNEED); 2298*c43cad87SWarner Losh ], [je_cv_posix_madv_dontneed]) 2299*c43cad87SWarner Losh if test "x${je_cv_posix_madv_dontneed}" = "xyes" ; then 2300*c43cad87SWarner Losh AC_DEFINE([JEMALLOC_PURGE_POSIX_MADVISE_DONTNEED], [ ], [ ]) 2301*c43cad87SWarner Losh fi 2302*c43cad87SWarner Losh fi 2303*c43cad87SWarner Loshfi 2304*c43cad87SWarner Losh 2305*c43cad87SWarner Loshdnl ============================================================================ 2306*c43cad87SWarner Loshdnl Check for mprotect(2). 2307*c43cad87SWarner Losh 2308*c43cad87SWarner LoshJE_COMPILABLE([mprotect(2)], [ 2309*c43cad87SWarner Losh#include <sys/mman.h> 2310*c43cad87SWarner Losh], [ 2311*c43cad87SWarner Losh mprotect((void *)0, 0, PROT_NONE); 2312*c43cad87SWarner Losh], [je_cv_mprotect]) 2313*c43cad87SWarner Loshif test "x${je_cv_mprotect}" = "xyes" ; then 2314*c43cad87SWarner Losh AC_DEFINE([JEMALLOC_HAVE_MPROTECT], [ ], [ ]) 2315*c43cad87SWarner Loshfi 2316*c43cad87SWarner Losh 2317*c43cad87SWarner Loshdnl ============================================================================ 2318*c43cad87SWarner Loshdnl Check for __builtin_clz(), __builtin_clzl(), and __builtin_clzll(). 2319*c43cad87SWarner Losh 2320*c43cad87SWarner LoshAC_CACHE_CHECK([for __builtin_clz], 2321*c43cad87SWarner Losh [je_cv_builtin_clz], 2322*c43cad87SWarner Losh [AC_LINK_IFELSE([AC_LANG_PROGRAM([], 2323*c43cad87SWarner Losh [ 2324*c43cad87SWarner Losh { 2325*c43cad87SWarner Losh unsigned x = 0; 2326*c43cad87SWarner Losh int y = __builtin_clz(x); 2327*c43cad87SWarner Losh } 2328*c43cad87SWarner Losh { 2329*c43cad87SWarner Losh unsigned long x = 0; 2330*c43cad87SWarner Losh int y = __builtin_clzl(x); 2331*c43cad87SWarner Losh } 2332*c43cad87SWarner Losh { 2333*c43cad87SWarner Losh unsigned long long x = 0; 2334*c43cad87SWarner Losh int y = __builtin_clzll(x); 2335*c43cad87SWarner Losh } 2336*c43cad87SWarner Losh ])], 2337*c43cad87SWarner Losh [je_cv_builtin_clz=yes], 2338*c43cad87SWarner Losh [je_cv_builtin_clz=no])]) 2339*c43cad87SWarner Losh 2340*c43cad87SWarner Loshif test "x${je_cv_builtin_clz}" = "xyes" ; then 2341*c43cad87SWarner Losh AC_DEFINE([JEMALLOC_HAVE_BUILTIN_CLZ], [ ], [ ]) 2342*c43cad87SWarner Loshfi 2343*c43cad87SWarner Losh 2344*c43cad87SWarner Loshdnl ============================================================================ 2345*c43cad87SWarner Loshdnl Check for os_unfair_lock operations as provided on Darwin. 2346*c43cad87SWarner Losh 2347*c43cad87SWarner LoshJE_COMPILABLE([Darwin os_unfair_lock_*()], [ 2348*c43cad87SWarner Losh#include <os/lock.h> 2349*c43cad87SWarner Losh#include <AvailabilityMacros.h> 2350*c43cad87SWarner Losh], [ 2351*c43cad87SWarner Losh #if MAC_OS_X_VERSION_MIN_REQUIRED < 101200 2352*c43cad87SWarner Losh #error "os_unfair_lock is not supported" 2353*c43cad87SWarner Losh #else 2354*c43cad87SWarner Losh os_unfair_lock lock = OS_UNFAIR_LOCK_INIT; 2355*c43cad87SWarner Losh os_unfair_lock_lock(&lock); 2356*c43cad87SWarner Losh os_unfair_lock_unlock(&lock); 2357*c43cad87SWarner Losh #endif 2358*c43cad87SWarner Losh], [je_cv_os_unfair_lock]) 2359*c43cad87SWarner Loshif test "x${je_cv_os_unfair_lock}" = "xyes" ; then 2360*c43cad87SWarner Losh AC_DEFINE([JEMALLOC_OS_UNFAIR_LOCK], [ ], [ ]) 2361*c43cad87SWarner Loshfi 2362*c43cad87SWarner Losh 2363*c43cad87SWarner Loshdnl ============================================================================ 2364*c43cad87SWarner Loshdnl Darwin-related configuration. 2365*c43cad87SWarner Losh 2366*c43cad87SWarner LoshAC_ARG_ENABLE([zone-allocator], 2367*c43cad87SWarner Losh [AS_HELP_STRING([--disable-zone-allocator], 2368*c43cad87SWarner Losh [Disable zone allocator for Darwin])], 2369*c43cad87SWarner Losh[if test "x$enable_zone_allocator" = "xno" ; then 2370*c43cad87SWarner Losh enable_zone_allocator="0" 2371*c43cad87SWarner Loshelse 2372*c43cad87SWarner Losh enable_zone_allocator="1" 2373*c43cad87SWarner Loshfi 2374*c43cad87SWarner Losh], 2375*c43cad87SWarner Losh[if test "x${abi}" = "xmacho"; then 2376*c43cad87SWarner Losh enable_zone_allocator="1" 2377*c43cad87SWarner Loshfi 2378*c43cad87SWarner Losh] 2379*c43cad87SWarner Losh) 2380*c43cad87SWarner LoshAC_SUBST([enable_zone_allocator]) 2381*c43cad87SWarner Losh 2382*c43cad87SWarner Loshif test "x${enable_zone_allocator}" = "x1" ; then 2383*c43cad87SWarner Losh if test "x${abi}" != "xmacho"; then 2384*c43cad87SWarner Losh AC_MSG_ERROR([--enable-zone-allocator is only supported on Darwin]) 2385*c43cad87SWarner Losh fi 2386*c43cad87SWarner Losh AC_DEFINE([JEMALLOC_ZONE], [ ], [ ]) 2387*c43cad87SWarner Loshfi 2388*c43cad87SWarner Losh 2389*c43cad87SWarner Loshdnl ============================================================================ 2390*c43cad87SWarner Loshdnl Use initial-exec TLS by default. 2391*c43cad87SWarner LoshAC_ARG_ENABLE([initial-exec-tls], 2392*c43cad87SWarner Losh [AS_HELP_STRING([--disable-initial-exec-tls], 2393*c43cad87SWarner Losh [Disable the initial-exec tls model])], 2394*c43cad87SWarner Losh[if test "x$enable_initial_exec_tls" = "xno" ; then 2395*c43cad87SWarner Losh enable_initial_exec_tls="0" 2396*c43cad87SWarner Loshelse 2397*c43cad87SWarner Losh enable_initial_exec_tls="1" 2398*c43cad87SWarner Loshfi 2399*c43cad87SWarner Losh], 2400*c43cad87SWarner Losh[enable_initial_exec_tls="1"] 2401*c43cad87SWarner Losh) 2402*c43cad87SWarner LoshAC_SUBST([enable_initial_exec_tls]) 2403*c43cad87SWarner Losh 2404*c43cad87SWarner Loshif test "x${je_cv_tls_model}" = "xyes" -a \ 2405*c43cad87SWarner Losh "x${enable_initial_exec_tls}" = "x1" ; then 2406*c43cad87SWarner Losh AC_DEFINE([JEMALLOC_TLS_MODEL], 2407*c43cad87SWarner Losh [__attribute__((tls_model("initial-exec")))], 2408*c43cad87SWarner Losh [ ]) 2409*c43cad87SWarner Loshelse 2410*c43cad87SWarner Losh AC_DEFINE([JEMALLOC_TLS_MODEL], [ ], [ ]) 2411*c43cad87SWarner Loshfi 2412*c43cad87SWarner Losh 2413*c43cad87SWarner Loshdnl ============================================================================ 2414*c43cad87SWarner Loshdnl Enable background threads if possible. 2415*c43cad87SWarner Losh 2416*c43cad87SWarner Loshif test "x${have_pthread}" = "x1" -a "x${je_cv_os_unfair_lock}" != "xyes" -a \ 2417*c43cad87SWarner Losh "x${abi}" != "xmacho" ; then 2418*c43cad87SWarner Losh AC_DEFINE([JEMALLOC_BACKGROUND_THREAD], [ ], [ ]) 2419*c43cad87SWarner Loshfi 2420*c43cad87SWarner Losh 2421*c43cad87SWarner Loshdnl ============================================================================ 2422*c43cad87SWarner Loshdnl Check for glibc malloc hooks 2423*c43cad87SWarner Losh 2424*c43cad87SWarner Loshif test "x$glibc" = "x1" ; then 2425*c43cad87SWarner Losh JE_COMPILABLE([glibc malloc hook], [ 2426*c43cad87SWarner Losh #include <stddef.h> 2427*c43cad87SWarner Losh 2428*c43cad87SWarner Losh extern void (* __free_hook)(void *ptr); 2429*c43cad87SWarner Losh extern void *(* __malloc_hook)(size_t size); 2430*c43cad87SWarner Losh extern void *(* __realloc_hook)(void *ptr, size_t size); 2431*c43cad87SWarner Losh], [ 2432*c43cad87SWarner Losh void *ptr = 0L; 2433*c43cad87SWarner Losh if (__malloc_hook) ptr = __malloc_hook(1); 2434*c43cad87SWarner Losh if (__realloc_hook) ptr = __realloc_hook(ptr, 2); 2435*c43cad87SWarner Losh if (__free_hook && ptr) __free_hook(ptr); 2436*c43cad87SWarner Losh], [je_cv_glibc_malloc_hook]) 2437*c43cad87SWarner Losh if test "x${je_cv_glibc_malloc_hook}" = "xyes" ; then 2438*c43cad87SWarner Losh if test "x${JEMALLOC_PREFIX}" = "x" ; then 2439*c43cad87SWarner Losh AC_DEFINE([JEMALLOC_GLIBC_MALLOC_HOOK], [ ], [ ]) 2440*c43cad87SWarner Losh wrap_syms="${wrap_syms} __free_hook __malloc_hook __realloc_hook" 2441*c43cad87SWarner Losh fi 2442*c43cad87SWarner Losh fi 2443*c43cad87SWarner Losh 2444*c43cad87SWarner Losh JE_COMPILABLE([glibc memalign hook], [ 2445*c43cad87SWarner Losh #include <stddef.h> 2446*c43cad87SWarner Losh 2447*c43cad87SWarner Losh extern void *(* __memalign_hook)(size_t alignment, size_t size); 2448*c43cad87SWarner Losh], [ 2449*c43cad87SWarner Losh void *ptr = 0L; 2450*c43cad87SWarner Losh if (__memalign_hook) ptr = __memalign_hook(16, 7); 2451*c43cad87SWarner Losh], [je_cv_glibc_memalign_hook]) 2452*c43cad87SWarner Losh if test "x${je_cv_glibc_memalign_hook}" = "xyes" ; then 2453*c43cad87SWarner Losh if test "x${JEMALLOC_PREFIX}" = "x" ; then 2454*c43cad87SWarner Losh AC_DEFINE([JEMALLOC_GLIBC_MEMALIGN_HOOK], [ ], [ ]) 2455*c43cad87SWarner Losh wrap_syms="${wrap_syms} __memalign_hook" 2456*c43cad87SWarner Losh fi 2457*c43cad87SWarner Losh fi 2458*c43cad87SWarner Loshfi 2459*c43cad87SWarner Losh 2460*c43cad87SWarner LoshJE_COMPILABLE([pthreads adaptive mutexes], [ 2461*c43cad87SWarner Losh#include <pthread.h> 2462*c43cad87SWarner Losh], [ 2463*c43cad87SWarner Losh pthread_mutexattr_t attr; 2464*c43cad87SWarner Losh pthread_mutexattr_init(&attr); 2465*c43cad87SWarner Losh pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ADAPTIVE_NP); 2466*c43cad87SWarner Losh pthread_mutexattr_destroy(&attr); 2467*c43cad87SWarner Losh], [je_cv_pthread_mutex_adaptive_np]) 2468*c43cad87SWarner Loshif test "x${je_cv_pthread_mutex_adaptive_np}" = "xyes" ; then 2469*c43cad87SWarner Losh AC_DEFINE([JEMALLOC_HAVE_PTHREAD_MUTEX_ADAPTIVE_NP], [ ], [ ]) 2470*c43cad87SWarner Loshfi 2471*c43cad87SWarner Losh 2472*c43cad87SWarner LoshJE_CFLAGS_SAVE() 2473*c43cad87SWarner LoshJE_CFLAGS_ADD([-D_GNU_SOURCE]) 2474*c43cad87SWarner LoshJE_CFLAGS_ADD([-Werror]) 2475*c43cad87SWarner LoshJE_CFLAGS_ADD([-herror_on_warning]) 2476*c43cad87SWarner LoshJE_COMPILABLE([strerror_r returns char with gnu source], [ 2477*c43cad87SWarner Losh#include <errno.h> 2478*c43cad87SWarner Losh#include <stdio.h> 2479*c43cad87SWarner Losh#include <stdlib.h> 2480*c43cad87SWarner Losh#include <string.h> 2481*c43cad87SWarner Losh], [ 2482*c43cad87SWarner Losh char *buffer = (char *) malloc(100); 2483*c43cad87SWarner Losh char *error = strerror_r(EINVAL, buffer, 100); 2484*c43cad87SWarner Losh printf("%s\n", error); 2485*c43cad87SWarner Losh], [je_cv_strerror_r_returns_char_with_gnu_source]) 2486*c43cad87SWarner LoshJE_CFLAGS_RESTORE() 2487*c43cad87SWarner Loshif test "x${je_cv_strerror_r_returns_char_with_gnu_source}" = "xyes" ; then 2488*c43cad87SWarner Losh AC_DEFINE([JEMALLOC_STRERROR_R_RETURNS_CHAR_WITH_GNU_SOURCE], [ ], [ ]) 2489*c43cad87SWarner Loshfi 2490*c43cad87SWarner Losh 2491*c43cad87SWarner Loshdnl ============================================================================ 2492*c43cad87SWarner Loshdnl Check for typedefs, structures, and compiler characteristics. 2493*c43cad87SWarner LoshAC_HEADER_STDBOOL 2494*c43cad87SWarner Losh 2495*c43cad87SWarner Loshdnl ============================================================================ 2496*c43cad87SWarner Loshdnl Define commands that generate output files. 2497*c43cad87SWarner Losh 2498*c43cad87SWarner LoshAC_CONFIG_COMMANDS([include/jemalloc/internal/public_symbols.txt], [ 2499*c43cad87SWarner Losh f="${objroot}include/jemalloc/internal/public_symbols.txt" 2500*c43cad87SWarner Losh mkdir -p "${objroot}include/jemalloc/internal" 2501*c43cad87SWarner Losh cp /dev/null "${f}" 2502*c43cad87SWarner Losh for nm in `echo ${mangling_map} |tr ',' ' '` ; do 2503*c43cad87SWarner Losh n=`echo ${nm} |tr ':' ' ' |awk '{print $[]1}'` 2504*c43cad87SWarner Losh m=`echo ${nm} |tr ':' ' ' |awk '{print $[]2}'` 2505*c43cad87SWarner Losh echo "${n}:${m}" >> "${f}" 2506*c43cad87SWarner Losh dnl Remove name from public_syms so that it isn't redefined later. 2507*c43cad87SWarner Losh public_syms=`for sym in ${public_syms}; do echo "${sym}"; done |grep -v "^${n}\$" |tr '\n' ' '` 2508*c43cad87SWarner Losh done 2509*c43cad87SWarner Losh for sym in ${public_syms} ; do 2510*c43cad87SWarner Losh n="${sym}" 2511*c43cad87SWarner Losh m="${JEMALLOC_PREFIX}${sym}" 2512*c43cad87SWarner Losh echo "${n}:${m}" >> "${f}" 2513*c43cad87SWarner Losh done 2514*c43cad87SWarner Losh], [ 2515*c43cad87SWarner Losh srcdir="${srcdir}" 2516*c43cad87SWarner Losh objroot="${objroot}" 2517*c43cad87SWarner Losh mangling_map="${mangling_map}" 2518*c43cad87SWarner Losh public_syms="${public_syms}" 2519*c43cad87SWarner Losh JEMALLOC_PREFIX="${JEMALLOC_PREFIX}" 2520*c43cad87SWarner Losh]) 2521*c43cad87SWarner LoshAC_CONFIG_COMMANDS([include/jemalloc/internal/private_symbols.awk], [ 2522*c43cad87SWarner Losh f="${objroot}include/jemalloc/internal/private_symbols.awk" 2523*c43cad87SWarner Losh mkdir -p "${objroot}include/jemalloc/internal" 2524*c43cad87SWarner Losh export_syms=`for sym in ${public_syms}; do echo "${JEMALLOC_PREFIX}${sym}"; done; for sym in ${wrap_syms}; do echo "${sym}"; done;` 2525*c43cad87SWarner Losh "${srcdir}/include/jemalloc/internal/private_symbols.sh" "${SYM_PREFIX}" ${export_syms} > "${objroot}include/jemalloc/internal/private_symbols.awk" 2526*c43cad87SWarner Losh], [ 2527*c43cad87SWarner Losh srcdir="${srcdir}" 2528*c43cad87SWarner Losh objroot="${objroot}" 2529*c43cad87SWarner Losh public_syms="${public_syms}" 2530*c43cad87SWarner Losh wrap_syms="${wrap_syms}" 2531*c43cad87SWarner Losh SYM_PREFIX="${SYM_PREFIX}" 2532*c43cad87SWarner Losh JEMALLOC_PREFIX="${JEMALLOC_PREFIX}" 2533*c43cad87SWarner Losh]) 2534*c43cad87SWarner LoshAC_CONFIG_COMMANDS([include/jemalloc/internal/private_symbols_jet.awk], [ 2535*c43cad87SWarner Losh f="${objroot}include/jemalloc/internal/private_symbols_jet.awk" 2536*c43cad87SWarner Losh mkdir -p "${objroot}include/jemalloc/internal" 2537*c43cad87SWarner Losh export_syms=`for sym in ${public_syms}; do echo "jet_${sym}"; done; for sym in ${wrap_syms}; do echo "${sym}"; done;` 2538*c43cad87SWarner Losh "${srcdir}/include/jemalloc/internal/private_symbols.sh" "${SYM_PREFIX}" ${export_syms} > "${objroot}include/jemalloc/internal/private_symbols_jet.awk" 2539*c43cad87SWarner Losh], [ 2540*c43cad87SWarner Losh srcdir="${srcdir}" 2541*c43cad87SWarner Losh objroot="${objroot}" 2542*c43cad87SWarner Losh public_syms="${public_syms}" 2543*c43cad87SWarner Losh wrap_syms="${wrap_syms}" 2544*c43cad87SWarner Losh SYM_PREFIX="${SYM_PREFIX}" 2545*c43cad87SWarner Losh]) 2546*c43cad87SWarner LoshAC_CONFIG_COMMANDS([include/jemalloc/internal/public_namespace.h], [ 2547*c43cad87SWarner Losh mkdir -p "${objroot}include/jemalloc/internal" 2548*c43cad87SWarner Losh "${srcdir}/include/jemalloc/internal/public_namespace.sh" "${objroot}include/jemalloc/internal/public_symbols.txt" > "${objroot}include/jemalloc/internal/public_namespace.h" 2549*c43cad87SWarner Losh], [ 2550*c43cad87SWarner Losh srcdir="${srcdir}" 2551*c43cad87SWarner Losh objroot="${objroot}" 2552*c43cad87SWarner Losh]) 2553*c43cad87SWarner LoshAC_CONFIG_COMMANDS([include/jemalloc/internal/public_unnamespace.h], [ 2554*c43cad87SWarner Losh mkdir -p "${objroot}include/jemalloc/internal" 2555*c43cad87SWarner Losh "${srcdir}/include/jemalloc/internal/public_unnamespace.sh" "${objroot}include/jemalloc/internal/public_symbols.txt" > "${objroot}include/jemalloc/internal/public_unnamespace.h" 2556*c43cad87SWarner Losh], [ 2557*c43cad87SWarner Losh srcdir="${srcdir}" 2558*c43cad87SWarner Losh objroot="${objroot}" 2559*c43cad87SWarner Losh]) 2560*c43cad87SWarner LoshAC_CONFIG_COMMANDS([include/jemalloc/jemalloc_protos_jet.h], [ 2561*c43cad87SWarner Losh mkdir -p "${objroot}include/jemalloc" 2562*c43cad87SWarner Losh cat "${srcdir}/include/jemalloc/jemalloc_protos.h.in" | sed -e 's/@je_@/jet_/g' > "${objroot}include/jemalloc/jemalloc_protos_jet.h" 2563*c43cad87SWarner Losh], [ 2564*c43cad87SWarner Losh srcdir="${srcdir}" 2565*c43cad87SWarner Losh objroot="${objroot}" 2566*c43cad87SWarner Losh]) 2567*c43cad87SWarner LoshAC_CONFIG_COMMANDS([include/jemalloc/jemalloc_rename.h], [ 2568*c43cad87SWarner Losh mkdir -p "${objroot}include/jemalloc" 2569*c43cad87SWarner Losh "${srcdir}/include/jemalloc/jemalloc_rename.sh" "${objroot}include/jemalloc/internal/public_symbols.txt" > "${objroot}include/jemalloc/jemalloc_rename.h" 2570*c43cad87SWarner Losh], [ 2571*c43cad87SWarner Losh srcdir="${srcdir}" 2572*c43cad87SWarner Losh objroot="${objroot}" 2573*c43cad87SWarner Losh]) 2574*c43cad87SWarner LoshAC_CONFIG_COMMANDS([include/jemalloc/jemalloc_mangle.h], [ 2575*c43cad87SWarner Losh mkdir -p "${objroot}include/jemalloc" 2576*c43cad87SWarner Losh "${srcdir}/include/jemalloc/jemalloc_mangle.sh" "${objroot}include/jemalloc/internal/public_symbols.txt" je_ > "${objroot}include/jemalloc/jemalloc_mangle.h" 2577*c43cad87SWarner Losh], [ 2578*c43cad87SWarner Losh srcdir="${srcdir}" 2579*c43cad87SWarner Losh objroot="${objroot}" 2580*c43cad87SWarner Losh]) 2581*c43cad87SWarner LoshAC_CONFIG_COMMANDS([include/jemalloc/jemalloc_mangle_jet.h], [ 2582*c43cad87SWarner Losh mkdir -p "${objroot}include/jemalloc" 2583*c43cad87SWarner Losh "${srcdir}/include/jemalloc/jemalloc_mangle.sh" "${objroot}include/jemalloc/internal/public_symbols.txt" jet_ > "${objroot}include/jemalloc/jemalloc_mangle_jet.h" 2584*c43cad87SWarner Losh], [ 2585*c43cad87SWarner Losh srcdir="${srcdir}" 2586*c43cad87SWarner Losh objroot="${objroot}" 2587*c43cad87SWarner Losh]) 2588*c43cad87SWarner LoshAC_CONFIG_COMMANDS([include/jemalloc/jemalloc.h], [ 2589*c43cad87SWarner Losh mkdir -p "${objroot}include/jemalloc" 2590*c43cad87SWarner Losh "${srcdir}/include/jemalloc/jemalloc.sh" "${objroot}" > "${objroot}include/jemalloc/jemalloc${install_suffix}.h" 2591*c43cad87SWarner Losh], [ 2592*c43cad87SWarner Losh srcdir="${srcdir}" 2593*c43cad87SWarner Losh objroot="${objroot}" 2594*c43cad87SWarner Losh install_suffix="${install_suffix}" 2595*c43cad87SWarner Losh]) 2596*c43cad87SWarner Losh 2597*c43cad87SWarner Loshdnl Process .in files. 2598*c43cad87SWarner LoshAC_SUBST([cfghdrs_in]) 2599*c43cad87SWarner LoshAC_SUBST([cfghdrs_out]) 2600*c43cad87SWarner LoshAC_CONFIG_HEADERS([$cfghdrs_tup]) 2601*c43cad87SWarner Losh 2602*c43cad87SWarner Loshdnl ============================================================================ 2603*c43cad87SWarner Loshdnl Generate outputs. 2604*c43cad87SWarner Losh 2605*c43cad87SWarner LoshAC_CONFIG_FILES([$cfgoutputs_tup config.stamp bin/jemalloc-config bin/jemalloc.sh bin/jeprof]) 2606*c43cad87SWarner LoshAC_SUBST([cfgoutputs_in]) 2607*c43cad87SWarner LoshAC_SUBST([cfgoutputs_out]) 2608*c43cad87SWarner LoshAC_OUTPUT 2609*c43cad87SWarner Losh 2610*c43cad87SWarner Loshdnl ============================================================================ 2611*c43cad87SWarner Loshdnl Print out the results of configuration. 2612*c43cad87SWarner LoshAC_MSG_RESULT([===============================================================================]) 2613*c43cad87SWarner LoshAC_MSG_RESULT([jemalloc version : ${jemalloc_version}]) 2614*c43cad87SWarner LoshAC_MSG_RESULT([library revision : ${rev}]) 2615*c43cad87SWarner LoshAC_MSG_RESULT([]) 2616*c43cad87SWarner LoshAC_MSG_RESULT([CONFIG : ${CONFIG}]) 2617*c43cad87SWarner LoshAC_MSG_RESULT([CC : ${CC}]) 2618*c43cad87SWarner LoshAC_MSG_RESULT([CONFIGURE_CFLAGS : ${CONFIGURE_CFLAGS}]) 2619*c43cad87SWarner LoshAC_MSG_RESULT([SPECIFIED_CFLAGS : ${SPECIFIED_CFLAGS}]) 2620*c43cad87SWarner LoshAC_MSG_RESULT([EXTRA_CFLAGS : ${EXTRA_CFLAGS}]) 2621*c43cad87SWarner LoshAC_MSG_RESULT([CPPFLAGS : ${CPPFLAGS}]) 2622*c43cad87SWarner LoshAC_MSG_RESULT([CXX : ${CXX}]) 2623*c43cad87SWarner LoshAC_MSG_RESULT([CONFIGURE_CXXFLAGS : ${CONFIGURE_CXXFLAGS}]) 2624*c43cad87SWarner LoshAC_MSG_RESULT([SPECIFIED_CXXFLAGS : ${SPECIFIED_CXXFLAGS}]) 2625*c43cad87SWarner LoshAC_MSG_RESULT([EXTRA_CXXFLAGS : ${EXTRA_CXXFLAGS}]) 2626*c43cad87SWarner LoshAC_MSG_RESULT([LDFLAGS : ${LDFLAGS}]) 2627*c43cad87SWarner LoshAC_MSG_RESULT([EXTRA_LDFLAGS : ${EXTRA_LDFLAGS}]) 2628*c43cad87SWarner LoshAC_MSG_RESULT([DSO_LDFLAGS : ${DSO_LDFLAGS}]) 2629*c43cad87SWarner LoshAC_MSG_RESULT([LIBS : ${LIBS}]) 2630*c43cad87SWarner LoshAC_MSG_RESULT([RPATH_EXTRA : ${RPATH_EXTRA}]) 2631*c43cad87SWarner LoshAC_MSG_RESULT([]) 2632*c43cad87SWarner LoshAC_MSG_RESULT([XSLTPROC : ${XSLTPROC}]) 2633*c43cad87SWarner LoshAC_MSG_RESULT([XSLROOT : ${XSLROOT}]) 2634*c43cad87SWarner LoshAC_MSG_RESULT([]) 2635*c43cad87SWarner LoshAC_MSG_RESULT([PREFIX : ${PREFIX}]) 2636*c43cad87SWarner LoshAC_MSG_RESULT([BINDIR : ${BINDIR}]) 2637*c43cad87SWarner LoshAC_MSG_RESULT([DATADIR : ${DATADIR}]) 2638*c43cad87SWarner LoshAC_MSG_RESULT([INCLUDEDIR : ${INCLUDEDIR}]) 2639*c43cad87SWarner LoshAC_MSG_RESULT([LIBDIR : ${LIBDIR}]) 2640*c43cad87SWarner LoshAC_MSG_RESULT([MANDIR : ${MANDIR}]) 2641*c43cad87SWarner LoshAC_MSG_RESULT([]) 2642*c43cad87SWarner LoshAC_MSG_RESULT([srcroot : ${srcroot}]) 2643*c43cad87SWarner LoshAC_MSG_RESULT([abs_srcroot : ${abs_srcroot}]) 2644*c43cad87SWarner LoshAC_MSG_RESULT([objroot : ${objroot}]) 2645*c43cad87SWarner LoshAC_MSG_RESULT([abs_objroot : ${abs_objroot}]) 2646*c43cad87SWarner LoshAC_MSG_RESULT([]) 2647*c43cad87SWarner LoshAC_MSG_RESULT([JEMALLOC_PREFIX : ${JEMALLOC_PREFIX}]) 2648*c43cad87SWarner LoshAC_MSG_RESULT([JEMALLOC_PRIVATE_NAMESPACE]) 2649*c43cad87SWarner LoshAC_MSG_RESULT([ : ${JEMALLOC_PRIVATE_NAMESPACE}]) 2650*c43cad87SWarner LoshAC_MSG_RESULT([install_suffix : ${install_suffix}]) 2651*c43cad87SWarner LoshAC_MSG_RESULT([malloc_conf : ${config_malloc_conf}]) 2652*c43cad87SWarner LoshAC_MSG_RESULT([documentation : ${enable_doc}]) 2653*c43cad87SWarner LoshAC_MSG_RESULT([shared libs : ${enable_shared}]) 2654*c43cad87SWarner LoshAC_MSG_RESULT([static libs : ${enable_static}]) 2655*c43cad87SWarner LoshAC_MSG_RESULT([autogen : ${enable_autogen}]) 2656*c43cad87SWarner LoshAC_MSG_RESULT([debug : ${enable_debug}]) 2657*c43cad87SWarner LoshAC_MSG_RESULT([stats : ${enable_stats}]) 2658*c43cad87SWarner LoshAC_MSG_RESULT([experimental_smallocx : ${enable_experimental_smallocx}]) 2659*c43cad87SWarner LoshAC_MSG_RESULT([prof : ${enable_prof}]) 2660*c43cad87SWarner LoshAC_MSG_RESULT([prof-libunwind : ${enable_prof_libunwind}]) 2661*c43cad87SWarner LoshAC_MSG_RESULT([prof-libgcc : ${enable_prof_libgcc}]) 2662*c43cad87SWarner LoshAC_MSG_RESULT([prof-gcc : ${enable_prof_gcc}]) 2663*c43cad87SWarner LoshAC_MSG_RESULT([fill : ${enable_fill}]) 2664*c43cad87SWarner LoshAC_MSG_RESULT([utrace : ${enable_utrace}]) 2665*c43cad87SWarner LoshAC_MSG_RESULT([xmalloc : ${enable_xmalloc}]) 2666*c43cad87SWarner LoshAC_MSG_RESULT([log : ${enable_log}]) 2667*c43cad87SWarner LoshAC_MSG_RESULT([lazy_lock : ${enable_lazy_lock}]) 2668*c43cad87SWarner LoshAC_MSG_RESULT([cache-oblivious : ${enable_cache_oblivious}]) 2669*c43cad87SWarner LoshAC_MSG_RESULT([cxx : ${enable_cxx}]) 2670*c43cad87SWarner LoshAC_MSG_RESULT([===============================================================================]) 2671*c43cad87SWarner Losh||||||| dec341af7695 2672*c43cad87SWarner Losh======= 2673bf6039f0SWarner Loshdnl Process this file with autoconf to produce a configure script. 2674bf6039f0SWarner LoshAC_PREREQ(2.68) 2675bf6039f0SWarner LoshAC_INIT([Makefile.in]) 2676bf6039f0SWarner Losh 2677bf6039f0SWarner LoshAC_CONFIG_AUX_DIR([build-aux]) 2678bf6039f0SWarner Losh 2679bf6039f0SWarner Loshdnl ============================================================================ 2680bf6039f0SWarner Loshdnl Custom macro definitions. 2681bf6039f0SWarner Losh 2682bf6039f0SWarner Loshdnl JE_CONCAT_VVV(r, a, b) 2683bf6039f0SWarner Loshdnl 2684bf6039f0SWarner Loshdnl Set $r to the concatenation of $a and $b, with a space separating them iff 2685bf6039f0SWarner Loshdnl both $a and $b are non-empty. 2686bf6039f0SWarner LoshAC_DEFUN([JE_CONCAT_VVV], 2687bf6039f0SWarner Loshif test "x[$]{$2}" = "x" -o "x[$]{$3}" = "x" ; then 2688bf6039f0SWarner Losh $1="[$]{$2}[$]{$3}" 2689bf6039f0SWarner Loshelse 2690bf6039f0SWarner Losh $1="[$]{$2} [$]{$3}" 2691bf6039f0SWarner Loshfi 2692bf6039f0SWarner Losh) 2693bf6039f0SWarner Losh 2694bf6039f0SWarner Loshdnl JE_APPEND_VS(a, b) 2695bf6039f0SWarner Loshdnl 2696bf6039f0SWarner Loshdnl Set $a to the concatenation of $a and b, with a space separating them iff 2697bf6039f0SWarner Loshdnl both $a and b are non-empty. 2698bf6039f0SWarner LoshAC_DEFUN([JE_APPEND_VS], 2699bf6039f0SWarner Losh T_APPEND_V=$2 2700bf6039f0SWarner Losh JE_CONCAT_VVV($1, $1, T_APPEND_V) 2701bf6039f0SWarner Losh) 2702bf6039f0SWarner Losh 2703bf6039f0SWarner LoshCONFIGURE_CFLAGS= 2704bf6039f0SWarner LoshSPECIFIED_CFLAGS="${CFLAGS}" 2705bf6039f0SWarner Loshdnl JE_CFLAGS_ADD(cflag) 2706bf6039f0SWarner Loshdnl 2707bf6039f0SWarner Loshdnl CFLAGS is the concatenation of CONFIGURE_CFLAGS and SPECIFIED_CFLAGS 2708bf6039f0SWarner Loshdnl (ignoring EXTRA_CFLAGS, which does not impact configure tests. This macro 2709bf6039f0SWarner Loshdnl appends to CONFIGURE_CFLAGS and regenerates CFLAGS. 2710bf6039f0SWarner LoshAC_DEFUN([JE_CFLAGS_ADD], 2711bf6039f0SWarner Losh[ 2712bf6039f0SWarner LoshAC_MSG_CHECKING([whether compiler supports $1]) 2713bf6039f0SWarner LoshT_CONFIGURE_CFLAGS="${CONFIGURE_CFLAGS}" 2714bf6039f0SWarner LoshJE_APPEND_VS(CONFIGURE_CFLAGS, $1) 2715bf6039f0SWarner LoshJE_CONCAT_VVV(CFLAGS, CONFIGURE_CFLAGS, SPECIFIED_CFLAGS) 2716bf6039f0SWarner LoshAC_COMPILE_IFELSE([AC_LANG_PROGRAM( 2717bf6039f0SWarner Losh[[ 2718bf6039f0SWarner Losh]], [[ 2719bf6039f0SWarner Losh return 0; 2720bf6039f0SWarner Losh]])], 2721bf6039f0SWarner Losh [je_cv_cflags_added=$1] 2722bf6039f0SWarner Losh AC_MSG_RESULT([yes]), 2723bf6039f0SWarner Losh [je_cv_cflags_added=] 2724bf6039f0SWarner Losh AC_MSG_RESULT([no]) 2725bf6039f0SWarner Losh [CONFIGURE_CFLAGS="${T_CONFIGURE_CFLAGS}"] 2726bf6039f0SWarner Losh) 2727bf6039f0SWarner LoshJE_CONCAT_VVV(CFLAGS, CONFIGURE_CFLAGS, SPECIFIED_CFLAGS) 2728bf6039f0SWarner Losh]) 2729bf6039f0SWarner Losh 2730bf6039f0SWarner Loshdnl JE_CFLAGS_SAVE() 2731bf6039f0SWarner Loshdnl JE_CFLAGS_RESTORE() 2732bf6039f0SWarner Loshdnl 2733bf6039f0SWarner Loshdnl Save/restore CFLAGS. Nesting is not supported. 2734bf6039f0SWarner LoshAC_DEFUN([JE_CFLAGS_SAVE], 2735bf6039f0SWarner LoshSAVED_CONFIGURE_CFLAGS="${CONFIGURE_CFLAGS}" 2736bf6039f0SWarner Losh) 2737bf6039f0SWarner LoshAC_DEFUN([JE_CFLAGS_RESTORE], 2738bf6039f0SWarner LoshCONFIGURE_CFLAGS="${SAVED_CONFIGURE_CFLAGS}" 2739bf6039f0SWarner LoshJE_CONCAT_VVV(CFLAGS, CONFIGURE_CFLAGS, SPECIFIED_CFLAGS) 2740bf6039f0SWarner Losh) 2741bf6039f0SWarner Losh 2742bf6039f0SWarner LoshCONFIGURE_CXXFLAGS= 2743bf6039f0SWarner LoshSPECIFIED_CXXFLAGS="${CXXFLAGS}" 2744bf6039f0SWarner Loshdnl JE_CXXFLAGS_ADD(cxxflag) 2745bf6039f0SWarner LoshAC_DEFUN([JE_CXXFLAGS_ADD], 2746bf6039f0SWarner Losh[ 2747bf6039f0SWarner LoshAC_MSG_CHECKING([whether compiler supports $1]) 2748bf6039f0SWarner LoshT_CONFIGURE_CXXFLAGS="${CONFIGURE_CXXFLAGS}" 2749bf6039f0SWarner LoshJE_APPEND_VS(CONFIGURE_CXXFLAGS, $1) 2750bf6039f0SWarner LoshJE_CONCAT_VVV(CXXFLAGS, CONFIGURE_CXXFLAGS, SPECIFIED_CXXFLAGS) 2751bf6039f0SWarner LoshAC_LANG_PUSH([C++]) 2752bf6039f0SWarner LoshAC_COMPILE_IFELSE([AC_LANG_PROGRAM( 2753bf6039f0SWarner Losh[[ 2754bf6039f0SWarner Losh]], [[ 2755bf6039f0SWarner Losh return 0; 2756bf6039f0SWarner Losh]])], 2757bf6039f0SWarner Losh [je_cv_cxxflags_added=$1] 2758bf6039f0SWarner Losh AC_MSG_RESULT([yes]), 2759bf6039f0SWarner Losh [je_cv_cxxflags_added=] 2760bf6039f0SWarner Losh AC_MSG_RESULT([no]) 2761bf6039f0SWarner Losh [CONFIGURE_CXXFLAGS="${T_CONFIGURE_CXXFLAGS}"] 2762bf6039f0SWarner Losh) 2763bf6039f0SWarner LoshAC_LANG_POP([C++]) 2764bf6039f0SWarner LoshJE_CONCAT_VVV(CXXFLAGS, CONFIGURE_CXXFLAGS, SPECIFIED_CXXFLAGS) 2765bf6039f0SWarner Losh]) 2766bf6039f0SWarner Losh 2767bf6039f0SWarner Loshdnl JE_COMPILABLE(label, hcode, mcode, rvar) 2768bf6039f0SWarner Loshdnl 2769bf6039f0SWarner Loshdnl Use AC_LINK_IFELSE() rather than AC_COMPILE_IFELSE() so that linker errors 2770bf6039f0SWarner Loshdnl cause failure. 2771bf6039f0SWarner LoshAC_DEFUN([JE_COMPILABLE], 2772bf6039f0SWarner Losh[ 2773bf6039f0SWarner LoshAC_CACHE_CHECK([whether $1 is compilable], 2774bf6039f0SWarner Losh [$4], 2775bf6039f0SWarner Losh [AC_LINK_IFELSE([AC_LANG_PROGRAM([$2], 2776bf6039f0SWarner Losh [$3])], 2777bf6039f0SWarner Losh [$4=yes], 2778bf6039f0SWarner Losh [$4=no])]) 2779bf6039f0SWarner Losh]) 2780bf6039f0SWarner Losh 2781bf6039f0SWarner Loshdnl ============================================================================ 2782bf6039f0SWarner Losh 2783bf6039f0SWarner LoshCONFIG=`echo ${ac_configure_args} | sed -e 's#'"'"'\([^ ]*\)'"'"'#\1#g'` 2784bf6039f0SWarner LoshAC_SUBST([CONFIG]) 2785bf6039f0SWarner Losh 2786bf6039f0SWarner Loshdnl Library revision. 2787bf6039f0SWarner Loshrev=2 2788bf6039f0SWarner LoshAC_SUBST([rev]) 2789bf6039f0SWarner Losh 2790bf6039f0SWarner Loshsrcroot=$srcdir 2791bf6039f0SWarner Loshif test "x${srcroot}" = "x." ; then 2792bf6039f0SWarner Losh srcroot="" 2793bf6039f0SWarner Loshelse 2794bf6039f0SWarner Losh srcroot="${srcroot}/" 2795bf6039f0SWarner Loshfi 2796bf6039f0SWarner LoshAC_SUBST([srcroot]) 2797bf6039f0SWarner Loshabs_srcroot="`cd \"${srcdir}\"; pwd`/" 2798bf6039f0SWarner LoshAC_SUBST([abs_srcroot]) 2799bf6039f0SWarner Losh 2800bf6039f0SWarner Loshobjroot="" 2801bf6039f0SWarner LoshAC_SUBST([objroot]) 2802bf6039f0SWarner Loshabs_objroot="`pwd`/" 2803bf6039f0SWarner LoshAC_SUBST([abs_objroot]) 2804bf6039f0SWarner Losh 2805bf6039f0SWarner Loshdnl Munge install path variables. 2806bf6039f0SWarner Loshif test "x$prefix" = "xNONE" ; then 2807bf6039f0SWarner Losh prefix="/usr/local" 2808bf6039f0SWarner Loshfi 2809bf6039f0SWarner Loshif test "x$exec_prefix" = "xNONE" ; then 2810bf6039f0SWarner Losh exec_prefix=$prefix 2811bf6039f0SWarner Loshfi 2812bf6039f0SWarner LoshPREFIX=$prefix 2813bf6039f0SWarner LoshAC_SUBST([PREFIX]) 2814bf6039f0SWarner LoshBINDIR=`eval echo $bindir` 2815bf6039f0SWarner LoshBINDIR=`eval echo $BINDIR` 2816bf6039f0SWarner LoshAC_SUBST([BINDIR]) 2817bf6039f0SWarner LoshINCLUDEDIR=`eval echo $includedir` 2818bf6039f0SWarner LoshINCLUDEDIR=`eval echo $INCLUDEDIR` 2819bf6039f0SWarner LoshAC_SUBST([INCLUDEDIR]) 2820bf6039f0SWarner LoshLIBDIR=`eval echo $libdir` 2821bf6039f0SWarner LoshLIBDIR=`eval echo $LIBDIR` 2822bf6039f0SWarner LoshAC_SUBST([LIBDIR]) 2823bf6039f0SWarner LoshDATADIR=`eval echo $datadir` 2824bf6039f0SWarner LoshDATADIR=`eval echo $DATADIR` 2825bf6039f0SWarner LoshAC_SUBST([DATADIR]) 2826bf6039f0SWarner LoshMANDIR=`eval echo $mandir` 2827bf6039f0SWarner LoshMANDIR=`eval echo $MANDIR` 2828bf6039f0SWarner LoshAC_SUBST([MANDIR]) 2829bf6039f0SWarner Losh 2830bf6039f0SWarner Loshdnl Support for building documentation. 2831bf6039f0SWarner LoshAC_PATH_PROG([XSLTPROC], [xsltproc], [false], [$PATH]) 2832bf6039f0SWarner Loshif test -d "/usr/share/xml/docbook/stylesheet/docbook-xsl" ; then 2833bf6039f0SWarner Losh DEFAULT_XSLROOT="/usr/share/xml/docbook/stylesheet/docbook-xsl" 2834bf6039f0SWarner Loshelif test -d "/usr/share/sgml/docbook/xsl-stylesheets" ; then 2835bf6039f0SWarner Losh DEFAULT_XSLROOT="/usr/share/sgml/docbook/xsl-stylesheets" 2836bf6039f0SWarner Loshelse 2837bf6039f0SWarner Losh dnl Documentation building will fail if this default gets used. 2838bf6039f0SWarner Losh DEFAULT_XSLROOT="" 2839bf6039f0SWarner Loshfi 2840bf6039f0SWarner LoshAC_ARG_WITH([xslroot], 2841bf6039f0SWarner Losh [AS_HELP_STRING([--with-xslroot=<path>], [XSL stylesheet root path])], [ 2842bf6039f0SWarner Loshif test "x$with_xslroot" = "xno" ; then 2843bf6039f0SWarner Losh XSLROOT="${DEFAULT_XSLROOT}" 2844bf6039f0SWarner Loshelse 2845bf6039f0SWarner Losh XSLROOT="${with_xslroot}" 2846bf6039f0SWarner Loshfi 2847bf6039f0SWarner Losh], 2848bf6039f0SWarner Losh XSLROOT="${DEFAULT_XSLROOT}" 2849bf6039f0SWarner Losh) 2850bf6039f0SWarner Loshif test "x$XSLTPROC" = "xfalse" ; then 2851bf6039f0SWarner Losh XSLROOT="" 2852bf6039f0SWarner Loshfi 2853bf6039f0SWarner LoshAC_SUBST([XSLROOT]) 2854bf6039f0SWarner Losh 2855bf6039f0SWarner Loshdnl If CFLAGS isn't defined, set CFLAGS to something reasonable. Otherwise, 2856bf6039f0SWarner Loshdnl just prevent autoconf from molesting CFLAGS. 2857bf6039f0SWarner LoshCFLAGS=$CFLAGS 2858bf6039f0SWarner LoshAC_PROG_CC 2859bf6039f0SWarner Losh 2860bf6039f0SWarner Loshif test "x$GCC" != "xyes" ; then 2861bf6039f0SWarner Losh AC_CACHE_CHECK([whether compiler is MSVC], 2862bf6039f0SWarner Losh [je_cv_msvc], 2863bf6039f0SWarner Losh [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], 2864bf6039f0SWarner Losh [ 2865bf6039f0SWarner Losh#ifndef _MSC_VER 2866bf6039f0SWarner Losh int fail[-1]; 2867bf6039f0SWarner Losh#endif 2868bf6039f0SWarner Losh])], 2869bf6039f0SWarner Losh [je_cv_msvc=yes], 2870bf6039f0SWarner Losh [je_cv_msvc=no])]) 2871bf6039f0SWarner Loshfi 2872bf6039f0SWarner Losh 2873bf6039f0SWarner Loshdnl check if a cray prgenv wrapper compiler is being used 2874bf6039f0SWarner Loshje_cv_cray_prgenv_wrapper="" 2875bf6039f0SWarner Loshif test "x${PE_ENV}" != "x" ; then 2876bf6039f0SWarner Losh case "${CC}" in 2877bf6039f0SWarner Losh CC|cc) 2878bf6039f0SWarner Losh je_cv_cray_prgenv_wrapper="yes" 2879bf6039f0SWarner Losh ;; 2880bf6039f0SWarner Losh *) 2881bf6039f0SWarner Losh ;; 2882bf6039f0SWarner Losh esac 2883bf6039f0SWarner Loshfi 2884bf6039f0SWarner Losh 2885bf6039f0SWarner LoshAC_CACHE_CHECK([whether compiler is cray], 2886bf6039f0SWarner Losh [je_cv_cray], 2887bf6039f0SWarner Losh [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], 2888bf6039f0SWarner Losh [ 2889bf6039f0SWarner Losh#ifndef _CRAYC 2890bf6039f0SWarner Losh int fail[-1]; 2891bf6039f0SWarner Losh#endif 2892bf6039f0SWarner Losh])], 2893bf6039f0SWarner Losh [je_cv_cray=yes], 2894bf6039f0SWarner Losh [je_cv_cray=no])]) 2895bf6039f0SWarner Losh 2896bf6039f0SWarner Loshif test "x${je_cv_cray}" = "xyes" ; then 2897bf6039f0SWarner Losh AC_CACHE_CHECK([whether cray compiler version is 8.4], 2898bf6039f0SWarner Losh [je_cv_cray_84], 2899bf6039f0SWarner Losh [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], 2900bf6039f0SWarner Losh [ 2901bf6039f0SWarner Losh#if !(_RELEASE_MAJOR == 8 && _RELEASE_MINOR == 4) 2902bf6039f0SWarner Losh int fail[-1]; 2903bf6039f0SWarner Losh#endif 2904bf6039f0SWarner Losh])], 2905bf6039f0SWarner Losh [je_cv_cray_84=yes], 2906bf6039f0SWarner Losh [je_cv_cray_84=no])]) 2907bf6039f0SWarner Loshfi 2908bf6039f0SWarner Losh 2909bf6039f0SWarner Loshif test "x$GCC" = "xyes" ; then 2910bf6039f0SWarner Losh JE_CFLAGS_ADD([-std=gnu11]) 2911bf6039f0SWarner Losh if test "x$je_cv_cflags_added" = "x-std=gnu11" ; then 2912bf6039f0SWarner Losh AC_DEFINE_UNQUOTED([JEMALLOC_HAS_RESTRICT]) 2913bf6039f0SWarner Losh else 2914bf6039f0SWarner Losh JE_CFLAGS_ADD([-std=gnu99]) 2915bf6039f0SWarner Losh if test "x$je_cv_cflags_added" = "x-std=gnu99" ; then 2916bf6039f0SWarner Losh AC_DEFINE_UNQUOTED([JEMALLOC_HAS_RESTRICT]) 2917bf6039f0SWarner Losh fi 2918bf6039f0SWarner Losh fi 2919bf6039f0SWarner Losh JE_CFLAGS_ADD([-Wall]) 2920bf6039f0SWarner Losh JE_CFLAGS_ADD([-Wextra]) 2921bf6039f0SWarner Losh JE_CFLAGS_ADD([-Wshorten-64-to-32]) 2922bf6039f0SWarner Losh JE_CFLAGS_ADD([-Wsign-compare]) 2923bf6039f0SWarner Losh JE_CFLAGS_ADD([-Wundef]) 2924bf6039f0SWarner Losh JE_CFLAGS_ADD([-Wno-format-zero-length]) 2925bf6039f0SWarner Losh JE_CFLAGS_ADD([-pipe]) 2926bf6039f0SWarner Losh JE_CFLAGS_ADD([-g3]) 2927bf6039f0SWarner Loshelif test "x$je_cv_msvc" = "xyes" ; then 2928bf6039f0SWarner Losh CC="$CC -nologo" 2929bf6039f0SWarner Losh JE_CFLAGS_ADD([-Zi]) 2930bf6039f0SWarner Losh JE_CFLAGS_ADD([-MT]) 2931bf6039f0SWarner Losh JE_CFLAGS_ADD([-W3]) 2932bf6039f0SWarner Losh JE_CFLAGS_ADD([-FS]) 2933bf6039f0SWarner Losh JE_APPEND_VS(CPPFLAGS, -I${srcdir}/include/msvc_compat) 2934bf6039f0SWarner Loshfi 2935bf6039f0SWarner Loshif test "x$je_cv_cray" = "xyes" ; then 2936bf6039f0SWarner Losh dnl cray compiler 8.4 has an inlining bug 2937bf6039f0SWarner Losh if test "x$je_cv_cray_84" = "xyes" ; then 2938bf6039f0SWarner Losh JE_CFLAGS_ADD([-hipa2]) 2939bf6039f0SWarner Losh JE_CFLAGS_ADD([-hnognu]) 2940bf6039f0SWarner Losh fi 2941bf6039f0SWarner Losh dnl ignore unreachable code warning 2942bf6039f0SWarner Losh JE_CFLAGS_ADD([-hnomessage=128]) 2943bf6039f0SWarner Losh dnl ignore redefinition of "malloc", "free", etc warning 2944bf6039f0SWarner Losh JE_CFLAGS_ADD([-hnomessage=1357]) 2945bf6039f0SWarner Loshfi 2946bf6039f0SWarner LoshAC_SUBST([CONFIGURE_CFLAGS]) 2947bf6039f0SWarner LoshAC_SUBST([SPECIFIED_CFLAGS]) 2948bf6039f0SWarner LoshAC_SUBST([EXTRA_CFLAGS]) 2949bf6039f0SWarner LoshAC_PROG_CPP 2950bf6039f0SWarner Losh 2951bf6039f0SWarner LoshAC_ARG_ENABLE([cxx], 2952bf6039f0SWarner Losh [AS_HELP_STRING([--disable-cxx], [Disable C++ integration])], 2953bf6039f0SWarner Loshif test "x$enable_cxx" = "xno" ; then 2954bf6039f0SWarner Losh enable_cxx="0" 2955bf6039f0SWarner Loshelse 2956bf6039f0SWarner Losh enable_cxx="1" 2957bf6039f0SWarner Loshfi 2958bf6039f0SWarner Losh, 2959bf6039f0SWarner Loshenable_cxx="1" 2960bf6039f0SWarner Losh) 2961bf6039f0SWarner Loshif test "x$enable_cxx" = "x1" ; then 2962bf6039f0SWarner Losh dnl Require at least c++14, which is the first version to support sized 2963bf6039f0SWarner Losh dnl deallocation. C++ support is not compiled otherwise. 2964bf6039f0SWarner Losh m4_include([m4/ax_cxx_compile_stdcxx.m4]) 2965bf6039f0SWarner Losh AX_CXX_COMPILE_STDCXX([14], [noext], [optional]) 2966bf6039f0SWarner Losh if test "x${HAVE_CXX14}" = "x1" ; then 2967bf6039f0SWarner Losh JE_CXXFLAGS_ADD([-Wall]) 2968bf6039f0SWarner Losh JE_CXXFLAGS_ADD([-Wextra]) 2969bf6039f0SWarner Losh JE_CXXFLAGS_ADD([-g3]) 2970bf6039f0SWarner Losh 2971bf6039f0SWarner Losh SAVED_LIBS="${LIBS}" 2972bf6039f0SWarner Losh JE_APPEND_VS(LIBS, -lstdc++) 2973bf6039f0SWarner Losh JE_COMPILABLE([libstdc++ linkage], [ 2974bf6039f0SWarner Losh#include <stdlib.h> 2975bf6039f0SWarner Losh], [[ 2976bf6039f0SWarner Losh int *arr = (int *)malloc(sizeof(int) * 42); 2977bf6039f0SWarner Losh if (arr == NULL) 2978bf6039f0SWarner Losh return 1; 2979bf6039f0SWarner Losh]], [je_cv_libstdcxx]) 2980bf6039f0SWarner Losh if test "x${je_cv_libstdcxx}" = "xno" ; then 2981bf6039f0SWarner Losh LIBS="${SAVED_LIBS}" 2982bf6039f0SWarner Losh fi 2983bf6039f0SWarner Losh else 2984bf6039f0SWarner Losh enable_cxx="0" 2985bf6039f0SWarner Losh fi 2986bf6039f0SWarner Loshfi 2987bf6039f0SWarner LoshAC_SUBST([enable_cxx]) 2988bf6039f0SWarner LoshAC_SUBST([CONFIGURE_CXXFLAGS]) 2989bf6039f0SWarner LoshAC_SUBST([SPECIFIED_CXXFLAGS]) 2990bf6039f0SWarner LoshAC_SUBST([EXTRA_CXXFLAGS]) 2991bf6039f0SWarner Losh 2992bf6039f0SWarner LoshAC_C_BIGENDIAN([ac_cv_big_endian=1], [ac_cv_big_endian=0]) 2993bf6039f0SWarner Loshif test "x${ac_cv_big_endian}" = "x1" ; then 2994bf6039f0SWarner Losh AC_DEFINE_UNQUOTED([JEMALLOC_BIG_ENDIAN], [ ]) 2995bf6039f0SWarner Loshfi 2996bf6039f0SWarner Losh 2997bf6039f0SWarner Loshif test "x${je_cv_msvc}" = "xyes" -a "x${ac_cv_header_inttypes_h}" = "xno"; then 2998bf6039f0SWarner Losh JE_APPEND_VS(CPPFLAGS, -I${srcdir}/include/msvc_compat/C99) 2999bf6039f0SWarner Loshfi 3000bf6039f0SWarner Losh 3001bf6039f0SWarner Loshif test "x${je_cv_msvc}" = "xyes" ; then 3002bf6039f0SWarner Losh LG_SIZEOF_PTR=LG_SIZEOF_PTR_WIN 3003bf6039f0SWarner Losh AC_MSG_RESULT([Using a predefined value for sizeof(void *): 4 for 32-bit, 8 for 64-bit]) 3004bf6039f0SWarner Loshelse 3005bf6039f0SWarner Losh AC_CHECK_SIZEOF([void *]) 3006bf6039f0SWarner Losh if test "x${ac_cv_sizeof_void_p}" = "x8" ; then 3007bf6039f0SWarner Losh LG_SIZEOF_PTR=3 3008bf6039f0SWarner Losh elif test "x${ac_cv_sizeof_void_p}" = "x4" ; then 3009bf6039f0SWarner Losh LG_SIZEOF_PTR=2 3010bf6039f0SWarner Losh else 3011bf6039f0SWarner Losh AC_MSG_ERROR([Unsupported pointer size: ${ac_cv_sizeof_void_p}]) 3012bf6039f0SWarner Losh fi 3013bf6039f0SWarner Loshfi 3014bf6039f0SWarner LoshAC_DEFINE_UNQUOTED([LG_SIZEOF_PTR], [$LG_SIZEOF_PTR]) 3015bf6039f0SWarner Losh 3016bf6039f0SWarner LoshAC_CHECK_SIZEOF([int]) 3017bf6039f0SWarner Loshif test "x${ac_cv_sizeof_int}" = "x8" ; then 3018bf6039f0SWarner Losh LG_SIZEOF_INT=3 3019bf6039f0SWarner Loshelif test "x${ac_cv_sizeof_int}" = "x4" ; then 3020bf6039f0SWarner Losh LG_SIZEOF_INT=2 3021bf6039f0SWarner Loshelse 3022bf6039f0SWarner Losh AC_MSG_ERROR([Unsupported int size: ${ac_cv_sizeof_int}]) 3023bf6039f0SWarner Loshfi 3024bf6039f0SWarner LoshAC_DEFINE_UNQUOTED([LG_SIZEOF_INT], [$LG_SIZEOF_INT]) 3025bf6039f0SWarner Losh 3026bf6039f0SWarner LoshAC_CHECK_SIZEOF([long]) 3027bf6039f0SWarner Loshif test "x${ac_cv_sizeof_long}" = "x8" ; then 3028bf6039f0SWarner Losh LG_SIZEOF_LONG=3 3029bf6039f0SWarner Loshelif test "x${ac_cv_sizeof_long}" = "x4" ; then 3030bf6039f0SWarner Losh LG_SIZEOF_LONG=2 3031bf6039f0SWarner Loshelse 3032bf6039f0SWarner Losh AC_MSG_ERROR([Unsupported long size: ${ac_cv_sizeof_long}]) 3033bf6039f0SWarner Loshfi 3034bf6039f0SWarner LoshAC_DEFINE_UNQUOTED([LG_SIZEOF_LONG], [$LG_SIZEOF_LONG]) 3035bf6039f0SWarner Losh 3036bf6039f0SWarner LoshAC_CHECK_SIZEOF([long long]) 3037bf6039f0SWarner Loshif test "x${ac_cv_sizeof_long_long}" = "x8" ; then 3038bf6039f0SWarner Losh LG_SIZEOF_LONG_LONG=3 3039bf6039f0SWarner Loshelif test "x${ac_cv_sizeof_long_long}" = "x4" ; then 3040bf6039f0SWarner Losh LG_SIZEOF_LONG_LONG=2 3041bf6039f0SWarner Loshelse 3042bf6039f0SWarner Losh AC_MSG_ERROR([Unsupported long long size: ${ac_cv_sizeof_long_long}]) 3043bf6039f0SWarner Loshfi 3044bf6039f0SWarner LoshAC_DEFINE_UNQUOTED([LG_SIZEOF_LONG_LONG], [$LG_SIZEOF_LONG_LONG]) 3045bf6039f0SWarner Losh 3046bf6039f0SWarner LoshAC_CHECK_SIZEOF([intmax_t]) 3047bf6039f0SWarner Loshif test "x${ac_cv_sizeof_intmax_t}" = "x16" ; then 3048bf6039f0SWarner Losh LG_SIZEOF_INTMAX_T=4 3049bf6039f0SWarner Loshelif test "x${ac_cv_sizeof_intmax_t}" = "x8" ; then 3050bf6039f0SWarner Losh LG_SIZEOF_INTMAX_T=3 3051bf6039f0SWarner Loshelif test "x${ac_cv_sizeof_intmax_t}" = "x4" ; then 3052bf6039f0SWarner Losh LG_SIZEOF_INTMAX_T=2 3053bf6039f0SWarner Loshelse 3054bf6039f0SWarner Losh AC_MSG_ERROR([Unsupported intmax_t size: ${ac_cv_sizeof_intmax_t}]) 3055bf6039f0SWarner Loshfi 3056bf6039f0SWarner LoshAC_DEFINE_UNQUOTED([LG_SIZEOF_INTMAX_T], [$LG_SIZEOF_INTMAX_T]) 3057bf6039f0SWarner Losh 3058bf6039f0SWarner LoshAC_CANONICAL_HOST 3059bf6039f0SWarner Loshdnl CPU-specific settings. 3060bf6039f0SWarner LoshCPU_SPINWAIT="" 3061bf6039f0SWarner Loshcase "${host_cpu}" in 3062bf6039f0SWarner Losh i686|x86_64) 3063bf6039f0SWarner Losh HAVE_CPU_SPINWAIT=1 3064bf6039f0SWarner Losh if test "x${je_cv_msvc}" = "xyes" ; then 3065bf6039f0SWarner Losh AC_CACHE_VAL([je_cv_pause_msvc], 3066bf6039f0SWarner Losh [JE_COMPILABLE([pause instruction MSVC], [], 3067bf6039f0SWarner Losh [[_mm_pause(); return 0;]], 3068bf6039f0SWarner Losh [je_cv_pause_msvc])]) 3069bf6039f0SWarner Losh if test "x${je_cv_pause_msvc}" = "xyes" ; then 3070bf6039f0SWarner Losh CPU_SPINWAIT='_mm_pause()' 3071bf6039f0SWarner Losh fi 3072bf6039f0SWarner Losh else 3073bf6039f0SWarner Losh AC_CACHE_VAL([je_cv_pause], 3074bf6039f0SWarner Losh [JE_COMPILABLE([pause instruction], [], 3075bf6039f0SWarner Losh [[__asm__ volatile("pause"); return 0;]], 3076bf6039f0SWarner Losh [je_cv_pause])]) 3077bf6039f0SWarner Losh if test "x${je_cv_pause}" = "xyes" ; then 3078bf6039f0SWarner Losh CPU_SPINWAIT='__asm__ volatile("pause")' 3079bf6039f0SWarner Losh fi 3080bf6039f0SWarner Losh fi 3081bf6039f0SWarner Losh ;; 3082bf6039f0SWarner Losh *) 3083bf6039f0SWarner Losh HAVE_CPU_SPINWAIT=0 3084bf6039f0SWarner Losh ;; 3085bf6039f0SWarner Loshesac 3086bf6039f0SWarner LoshAC_DEFINE_UNQUOTED([HAVE_CPU_SPINWAIT], [$HAVE_CPU_SPINWAIT]) 3087bf6039f0SWarner LoshAC_DEFINE_UNQUOTED([CPU_SPINWAIT], [$CPU_SPINWAIT]) 3088bf6039f0SWarner Losh 3089bf6039f0SWarner LoshAC_ARG_WITH([lg_vaddr], 3090bf6039f0SWarner Losh [AS_HELP_STRING([--with-lg-vaddr=<lg-vaddr>], [Number of significant virtual address bits])], 3091bf6039f0SWarner Losh [LG_VADDR="$with_lg_vaddr"], [LG_VADDR="detect"]) 3092bf6039f0SWarner Losh 3093bf6039f0SWarner Loshcase "${host_cpu}" in 3094bf6039f0SWarner Losh aarch64) 3095bf6039f0SWarner Losh if test "x$LG_VADDR" = "xdetect"; then 3096bf6039f0SWarner Losh AC_MSG_CHECKING([number of significant virtual address bits]) 3097bf6039f0SWarner Losh if test "x${LG_SIZEOF_PTR}" = "x2" ; then 3098bf6039f0SWarner Losh #aarch64 ILP32 3099bf6039f0SWarner Losh LG_VADDR=32 3100bf6039f0SWarner Losh else 3101bf6039f0SWarner Losh #aarch64 LP64 3102bf6039f0SWarner Losh LG_VADDR=48 3103bf6039f0SWarner Losh fi 3104bf6039f0SWarner Losh AC_MSG_RESULT([$LG_VADDR]) 3105bf6039f0SWarner Losh fi 3106bf6039f0SWarner Losh ;; 3107bf6039f0SWarner Losh x86_64) 3108bf6039f0SWarner Losh if test "x$LG_VADDR" = "xdetect"; then 3109bf6039f0SWarner Losh AC_CACHE_CHECK([number of significant virtual address bits], 3110bf6039f0SWarner Losh [je_cv_lg_vaddr], 3111bf6039f0SWarner Losh AC_RUN_IFELSE([AC_LANG_PROGRAM( 3112bf6039f0SWarner Losh[[ 3113bf6039f0SWarner Losh#include <stdio.h> 3114bf6039f0SWarner Losh#ifdef _WIN32 3115bf6039f0SWarner Losh#include <limits.h> 3116bf6039f0SWarner Losh#include <intrin.h> 3117bf6039f0SWarner Loshtypedef unsigned __int32 uint32_t; 3118bf6039f0SWarner Losh#else 3119bf6039f0SWarner Losh#include <stdint.h> 3120bf6039f0SWarner Losh#endif 3121bf6039f0SWarner Losh]], [[ 3122bf6039f0SWarner Losh uint32_t r[[4]]; 3123bf6039f0SWarner Losh uint32_t eax_in = 0x80000008U; 3124bf6039f0SWarner Losh#ifdef _WIN32 3125bf6039f0SWarner Losh __cpuid((int *)r, (int)eax_in); 3126bf6039f0SWarner Losh#else 3127bf6039f0SWarner Losh asm volatile ("cpuid" 3128bf6039f0SWarner Losh : "=a" (r[[0]]), "=b" (r[[1]]), "=c" (r[[2]]), "=d" (r[[3]]) 3129bf6039f0SWarner Losh : "a" (eax_in), "c" (0) 3130bf6039f0SWarner Losh ); 3131bf6039f0SWarner Losh#endif 3132bf6039f0SWarner Losh uint32_t eax_out = r[[0]]; 3133bf6039f0SWarner Losh uint32_t vaddr = ((eax_out & 0x0000ff00U) >> 8); 3134bf6039f0SWarner Losh FILE *f = fopen("conftest.out", "w"); 3135bf6039f0SWarner Losh if (f == NULL) { 3136bf6039f0SWarner Losh return 1; 3137bf6039f0SWarner Losh } 3138bf6039f0SWarner Losh if (vaddr > (sizeof(void *) << 3)) { 3139bf6039f0SWarner Losh vaddr = sizeof(void *) << 3; 3140bf6039f0SWarner Losh } 3141bf6039f0SWarner Losh fprintf(f, "%u", vaddr); 3142bf6039f0SWarner Losh fclose(f); 3143bf6039f0SWarner Losh return 0; 3144bf6039f0SWarner Losh]])], 3145bf6039f0SWarner Losh [je_cv_lg_vaddr=`cat conftest.out`], 3146bf6039f0SWarner Losh [je_cv_lg_vaddr=error], 3147bf6039f0SWarner Losh [je_cv_lg_vaddr=57])) 3148bf6039f0SWarner Losh if test "x${je_cv_lg_vaddr}" != "x" ; then 3149bf6039f0SWarner Losh LG_VADDR="${je_cv_lg_vaddr}" 3150bf6039f0SWarner Losh fi 3151bf6039f0SWarner Losh if test "x${LG_VADDR}" != "xerror" ; then 3152bf6039f0SWarner Losh AC_DEFINE_UNQUOTED([LG_VADDR], [$LG_VADDR]) 3153bf6039f0SWarner Losh else 3154bf6039f0SWarner Losh AC_MSG_ERROR([cannot determine number of significant virtual address bits]) 3155bf6039f0SWarner Losh fi 3156bf6039f0SWarner Losh fi 3157bf6039f0SWarner Losh ;; 3158bf6039f0SWarner Losh *) 3159bf6039f0SWarner Losh if test "x$LG_VADDR" = "xdetect"; then 3160bf6039f0SWarner Losh AC_MSG_CHECKING([number of significant virtual address bits]) 3161bf6039f0SWarner Losh if test "x${LG_SIZEOF_PTR}" = "x3" ; then 3162bf6039f0SWarner Losh LG_VADDR=64 3163bf6039f0SWarner Losh elif test "x${LG_SIZEOF_PTR}" = "x2" ; then 3164bf6039f0SWarner Losh LG_VADDR=32 3165bf6039f0SWarner Losh elif test "x${LG_SIZEOF_PTR}" = "xLG_SIZEOF_PTR_WIN" ; then 3166bf6039f0SWarner Losh LG_VADDR="(1U << (LG_SIZEOF_PTR_WIN+3))" 3167bf6039f0SWarner Losh else 3168bf6039f0SWarner Losh AC_MSG_ERROR([Unsupported lg(pointer size): ${LG_SIZEOF_PTR}]) 3169bf6039f0SWarner Losh fi 3170bf6039f0SWarner Losh AC_MSG_RESULT([$LG_VADDR]) 3171bf6039f0SWarner Losh fi 3172bf6039f0SWarner Losh ;; 3173bf6039f0SWarner Loshesac 3174bf6039f0SWarner LoshAC_DEFINE_UNQUOTED([LG_VADDR], [$LG_VADDR]) 3175bf6039f0SWarner Losh 3176bf6039f0SWarner LoshLD_PRELOAD_VAR="LD_PRELOAD" 3177bf6039f0SWarner Loshso="so" 3178bf6039f0SWarner Loshimportlib="${so}" 3179bf6039f0SWarner Losho="$ac_objext" 3180bf6039f0SWarner Losha="a" 3181bf6039f0SWarner Loshexe="$ac_exeext" 3182bf6039f0SWarner Loshlibprefix="lib" 3183bf6039f0SWarner Loshlink_whole_archive="0" 3184bf6039f0SWarner LoshDSO_LDFLAGS='-shared -Wl,-soname,$(@F)' 3185bf6039f0SWarner LoshRPATH='-Wl,-rpath,$(1)' 3186bf6039f0SWarner LoshSOREV="${so}.${rev}" 3187bf6039f0SWarner LoshPIC_CFLAGS='-fPIC -DPIC' 3188bf6039f0SWarner LoshCTARGET='-o $@' 3189bf6039f0SWarner LoshLDTARGET='-o $@' 3190bf6039f0SWarner LoshTEST_LD_MODE= 3191bf6039f0SWarner LoshEXTRA_LDFLAGS= 3192bf6039f0SWarner LoshARFLAGS='crus' 3193bf6039f0SWarner LoshAROUT=' $@' 3194bf6039f0SWarner LoshCC_MM=1 3195bf6039f0SWarner Losh 3196bf6039f0SWarner Loshif test "x$je_cv_cray_prgenv_wrapper" = "xyes" ; then 3197bf6039f0SWarner Losh TEST_LD_MODE='-dynamic' 3198bf6039f0SWarner Loshfi 3199bf6039f0SWarner Losh 3200bf6039f0SWarner Loshif test "x${je_cv_cray}" = "xyes" ; then 3201bf6039f0SWarner Losh CC_MM= 3202bf6039f0SWarner Loshfi 3203bf6039f0SWarner Losh 3204bf6039f0SWarner LoshAN_MAKEVAR([AR], [AC_PROG_AR]) 3205bf6039f0SWarner LoshAN_PROGRAM([ar], [AC_PROG_AR]) 3206bf6039f0SWarner LoshAC_DEFUN([AC_PROG_AR], [AC_CHECK_TOOL(AR, ar, :)]) 3207bf6039f0SWarner LoshAC_PROG_AR 3208bf6039f0SWarner Losh 3209bf6039f0SWarner LoshAN_MAKEVAR([NM], [AC_PROG_NM]) 3210bf6039f0SWarner LoshAN_PROGRAM([nm], [AC_PROG_NM]) 3211bf6039f0SWarner LoshAC_DEFUN([AC_PROG_NM], [AC_CHECK_TOOL(NM, nm, :)]) 3212bf6039f0SWarner LoshAC_PROG_NM 3213bf6039f0SWarner Losh 3214bf6039f0SWarner LoshAC_PROG_AWK 3215bf6039f0SWarner Losh 3216bf6039f0SWarner Loshdnl ============================================================================ 3217bf6039f0SWarner Loshdnl jemalloc version. 3218bf6039f0SWarner Loshdnl 3219bf6039f0SWarner Losh 3220bf6039f0SWarner LoshAC_ARG_WITH([version], 3221bf6039f0SWarner Losh [AS_HELP_STRING([--with-version=<major>.<minor>.<bugfix>-<nrev>-g<gid>], 3222bf6039f0SWarner Losh [Version string])], 3223bf6039f0SWarner Losh [ 3224bf6039f0SWarner Losh echo "${with_version}" | grep ['^[0-9]\+\.[0-9]\+\.[0-9]\+-[0-9]\+-g[0-9a-f]\+$'] 2>&1 1>/dev/null 3225bf6039f0SWarner Losh if test $? -eq 0 ; then 3226bf6039f0SWarner Losh echo "$with_version" > "${objroot}VERSION" 3227bf6039f0SWarner Losh else 3228bf6039f0SWarner Losh echo "${with_version}" | grep ['^VERSION$'] 2>&1 1>/dev/null 3229bf6039f0SWarner Losh if test $? -ne 0 ; then 3230bf6039f0SWarner Losh AC_MSG_ERROR([${with_version} does not match <major>.<minor>.<bugfix>-<nrev>-g<gid> or VERSION]) 3231bf6039f0SWarner Losh fi 3232bf6039f0SWarner Losh fi 3233bf6039f0SWarner Losh ], [ 3234bf6039f0SWarner Losh dnl Set VERSION if source directory is inside a git repository. 3235bf6039f0SWarner Losh if test "x`test ! \"${srcroot}\" && cd \"${srcroot}\"; git rev-parse --is-inside-work-tree 2>/dev/null`" = "xtrue" ; then 3236bf6039f0SWarner Losh dnl Pattern globs aren't powerful enough to match both single- and 3237bf6039f0SWarner Losh dnl double-digit version numbers, so iterate over patterns to support up 3238bf6039f0SWarner Losh dnl to version 99.99.99 without any accidental matches. 3239bf6039f0SWarner Losh for pattern in ['[0-9].[0-9].[0-9]' '[0-9].[0-9].[0-9][0-9]' \ 3240bf6039f0SWarner Losh '[0-9].[0-9][0-9].[0-9]' '[0-9].[0-9][0-9].[0-9][0-9]' \ 3241bf6039f0SWarner Losh '[0-9][0-9].[0-9].[0-9]' '[0-9][0-9].[0-9].[0-9][0-9]' \ 3242bf6039f0SWarner Losh '[0-9][0-9].[0-9][0-9].[0-9]' \ 3243bf6039f0SWarner Losh '[0-9][0-9].[0-9][0-9].[0-9][0-9]']; do 3244bf6039f0SWarner Losh (test ! "${srcroot}" && cd "${srcroot}"; git describe --long --abbrev=40 --match="${pattern}") > "${objroot}VERSION.tmp" 2>/dev/null 3245bf6039f0SWarner Losh if test $? -eq 0 ; then 3246bf6039f0SWarner Losh mv "${objroot}VERSION.tmp" "${objroot}VERSION" 3247bf6039f0SWarner Losh break 3248bf6039f0SWarner Losh fi 3249bf6039f0SWarner Losh done 3250bf6039f0SWarner Losh fi 3251bf6039f0SWarner Losh rm -f "${objroot}VERSION.tmp" 3252bf6039f0SWarner Losh ]) 3253bf6039f0SWarner Losh 3254bf6039f0SWarner Loshif test ! -e "${objroot}VERSION" ; then 3255bf6039f0SWarner Losh if test ! -e "${srcroot}VERSION" ; then 3256bf6039f0SWarner Losh AC_MSG_RESULT( 3257bf6039f0SWarner Losh [Missing VERSION file, and unable to generate it; creating bogus VERSION]) 3258bf6039f0SWarner Losh echo "0.0.0-0-g0000000000000000000000000000000000000000" > "${objroot}VERSION" 3259bf6039f0SWarner Losh else 3260bf6039f0SWarner Losh cp ${srcroot}VERSION ${objroot}VERSION 3261bf6039f0SWarner Losh fi 3262bf6039f0SWarner Loshfi 3263bf6039f0SWarner Loshjemalloc_version=`cat "${objroot}VERSION"` 3264bf6039f0SWarner Loshjemalloc_version_major=`echo ${jemalloc_version} | tr ".g-" " " | awk '{print [$]1}'` 3265bf6039f0SWarner Loshjemalloc_version_minor=`echo ${jemalloc_version} | tr ".g-" " " | awk '{print [$]2}'` 3266bf6039f0SWarner Loshjemalloc_version_bugfix=`echo ${jemalloc_version} | tr ".g-" " " | awk '{print [$]3}'` 3267bf6039f0SWarner Loshjemalloc_version_nrev=`echo ${jemalloc_version} | tr ".g-" " " | awk '{print [$]4}'` 3268bf6039f0SWarner Loshjemalloc_version_gid=`echo ${jemalloc_version} | tr ".g-" " " | awk '{print [$]5}'` 3269bf6039f0SWarner LoshAC_SUBST([jemalloc_version]) 3270bf6039f0SWarner LoshAC_SUBST([jemalloc_version_major]) 3271bf6039f0SWarner LoshAC_SUBST([jemalloc_version_minor]) 3272bf6039f0SWarner LoshAC_SUBST([jemalloc_version_bugfix]) 3273bf6039f0SWarner LoshAC_SUBST([jemalloc_version_nrev]) 3274bf6039f0SWarner LoshAC_SUBST([jemalloc_version_gid]) 3275bf6039f0SWarner Losh 3276bf6039f0SWarner Loshdnl Platform-specific settings. abi and RPATH can probably be determined 3277bf6039f0SWarner Loshdnl programmatically, but doing so is error-prone, which makes it generally 3278bf6039f0SWarner Loshdnl not worth the trouble. 3279bf6039f0SWarner Loshdnl 3280bf6039f0SWarner Loshdnl Define cpp macros in CPPFLAGS, rather than doing AC_DEFINE(macro), since the 3281bf6039f0SWarner Loshdnl definitions need to be seen before any headers are included, which is a pain 3282bf6039f0SWarner Loshdnl to make happen otherwise. 3283bf6039f0SWarner Loshdefault_retain="0" 3284bf6039f0SWarner Loshmaps_coalesce="1" 3285bf6039f0SWarner LoshDUMP_SYMS="${NM} -a" 3286bf6039f0SWarner LoshSYM_PREFIX="" 3287bf6039f0SWarner Loshcase "${host}" in 3288bf6039f0SWarner Losh *-*-darwin* | *-*-ios*) 3289bf6039f0SWarner Losh abi="macho" 3290bf6039f0SWarner Losh RPATH="" 3291bf6039f0SWarner Losh LD_PRELOAD_VAR="DYLD_INSERT_LIBRARIES" 3292bf6039f0SWarner Losh so="dylib" 3293bf6039f0SWarner Losh importlib="${so}" 3294bf6039f0SWarner Losh force_tls="0" 3295bf6039f0SWarner Losh DSO_LDFLAGS='-shared -Wl,-install_name,$(LIBDIR)/$(@F)' 3296bf6039f0SWarner Losh SOREV="${rev}.${so}" 3297bf6039f0SWarner Losh sbrk_deprecated="1" 3298bf6039f0SWarner Losh SYM_PREFIX="_" 3299bf6039f0SWarner Losh ;; 3300bf6039f0SWarner Losh *-*-freebsd*) 3301bf6039f0SWarner Losh abi="elf" 3302bf6039f0SWarner Losh AC_DEFINE([JEMALLOC_SYSCTL_VM_OVERCOMMIT], [ ]) 3303bf6039f0SWarner Losh force_lazy_lock="1" 3304bf6039f0SWarner Losh ;; 3305bf6039f0SWarner Losh *-*-dragonfly*) 3306bf6039f0SWarner Losh abi="elf" 3307bf6039f0SWarner Losh ;; 3308bf6039f0SWarner Losh *-*-openbsd*) 3309bf6039f0SWarner Losh abi="elf" 3310bf6039f0SWarner Losh force_tls="0" 3311bf6039f0SWarner Losh ;; 3312bf6039f0SWarner Losh *-*-bitrig*) 3313bf6039f0SWarner Losh abi="elf" 3314bf6039f0SWarner Losh ;; 3315bf6039f0SWarner Losh *-*-linux-android) 3316bf6039f0SWarner Losh dnl syscall(2) and secure_getenv(3) are exposed by _GNU_SOURCE. 3317bf6039f0SWarner Losh JE_APPEND_VS(CPPFLAGS, -D_GNU_SOURCE) 3318bf6039f0SWarner Losh abi="elf" 3319bf6039f0SWarner Losh AC_DEFINE([JEMALLOC_PURGE_MADVISE_DONTNEED_ZEROS], [ ]) 3320bf6039f0SWarner Losh AC_DEFINE([JEMALLOC_HAS_ALLOCA_H]) 3321bf6039f0SWarner Losh AC_DEFINE([JEMALLOC_PROC_SYS_VM_OVERCOMMIT_MEMORY], [ ]) 3322bf6039f0SWarner Losh AC_DEFINE([JEMALLOC_THREADED_INIT], [ ]) 3323bf6039f0SWarner Losh AC_DEFINE([JEMALLOC_C11_ATOMICS]) 3324bf6039f0SWarner Losh force_tls="0" 3325bf6039f0SWarner Losh if test "${LG_SIZEOF_PTR}" = "3"; then 3326bf6039f0SWarner Losh default_retain="1" 3327bf6039f0SWarner Losh fi 3328bf6039f0SWarner Losh ;; 3329bf6039f0SWarner Losh *-*-linux*) 3330bf6039f0SWarner Losh dnl syscall(2) and secure_getenv(3) are exposed by _GNU_SOURCE. 3331bf6039f0SWarner Losh JE_APPEND_VS(CPPFLAGS, -D_GNU_SOURCE) 3332bf6039f0SWarner Losh abi="elf" 3333bf6039f0SWarner Losh AC_DEFINE([JEMALLOC_PURGE_MADVISE_DONTNEED_ZEROS], [ ]) 3334bf6039f0SWarner Losh AC_DEFINE([JEMALLOC_HAS_ALLOCA_H]) 3335bf6039f0SWarner Losh AC_DEFINE([JEMALLOC_PROC_SYS_VM_OVERCOMMIT_MEMORY], [ ]) 3336bf6039f0SWarner Losh AC_DEFINE([JEMALLOC_THREADED_INIT], [ ]) 3337bf6039f0SWarner Losh AC_DEFINE([JEMALLOC_USE_CXX_THROW], [ ]) 3338bf6039f0SWarner Losh if test "${LG_SIZEOF_PTR}" = "3"; then 3339bf6039f0SWarner Losh default_retain="1" 3340bf6039f0SWarner Losh fi 3341bf6039f0SWarner Losh ;; 3342bf6039f0SWarner Losh *-*-kfreebsd*) 3343bf6039f0SWarner Losh dnl syscall(2) and secure_getenv(3) are exposed by _GNU_SOURCE. 3344bf6039f0SWarner Losh JE_APPEND_VS(CPPFLAGS, -D_GNU_SOURCE) 3345bf6039f0SWarner Losh abi="elf" 3346bf6039f0SWarner Losh AC_DEFINE([JEMALLOC_HAS_ALLOCA_H]) 3347bf6039f0SWarner Losh AC_DEFINE([JEMALLOC_SYSCTL_VM_OVERCOMMIT], [ ]) 3348bf6039f0SWarner Losh AC_DEFINE([JEMALLOC_THREADED_INIT], [ ]) 3349bf6039f0SWarner Losh AC_DEFINE([JEMALLOC_USE_CXX_THROW], [ ]) 3350bf6039f0SWarner Losh ;; 3351bf6039f0SWarner Losh *-*-netbsd*) 3352bf6039f0SWarner Losh AC_MSG_CHECKING([ABI]) 3353bf6039f0SWarner Losh AC_COMPILE_IFELSE([AC_LANG_PROGRAM( 3354bf6039f0SWarner Losh[[#ifdef __ELF__ 3355bf6039f0SWarner Losh/* ELF */ 3356bf6039f0SWarner Losh#else 3357bf6039f0SWarner Losh#error aout 3358bf6039f0SWarner Losh#endif 3359bf6039f0SWarner Losh]])], 3360bf6039f0SWarner Losh [abi="elf"], 3361bf6039f0SWarner Losh [abi="aout"]) 3362bf6039f0SWarner Losh AC_MSG_RESULT([$abi]) 3363bf6039f0SWarner Losh ;; 3364bf6039f0SWarner Losh *-*-solaris2*) 3365bf6039f0SWarner Losh abi="elf" 3366bf6039f0SWarner Losh RPATH='-Wl,-R,$(1)' 3367bf6039f0SWarner Losh dnl Solaris needs this for sigwait(). 3368bf6039f0SWarner Losh JE_APPEND_VS(CPPFLAGS, -D_POSIX_PTHREAD_SEMANTICS) 3369bf6039f0SWarner Losh JE_APPEND_VS(LIBS, -lposix4 -lsocket -lnsl) 3370bf6039f0SWarner Losh ;; 3371bf6039f0SWarner Losh *-ibm-aix*) 3372bf6039f0SWarner Losh if test "${LG_SIZEOF_PTR}" = "3"; then 3373bf6039f0SWarner Losh dnl 64bit AIX 3374bf6039f0SWarner Losh LD_PRELOAD_VAR="LDR_PRELOAD64" 3375bf6039f0SWarner Losh else 3376bf6039f0SWarner Losh dnl 32bit AIX 3377bf6039f0SWarner Losh LD_PRELOAD_VAR="LDR_PRELOAD" 3378bf6039f0SWarner Losh fi 3379bf6039f0SWarner Losh abi="xcoff" 3380bf6039f0SWarner Losh ;; 3381bf6039f0SWarner Losh *-*-mingw* | *-*-cygwin*) 3382bf6039f0SWarner Losh abi="pecoff" 3383bf6039f0SWarner Losh force_tls="0" 3384bf6039f0SWarner Losh maps_coalesce="0" 3385bf6039f0SWarner Losh RPATH="" 3386bf6039f0SWarner Losh so="dll" 3387bf6039f0SWarner Losh if test "x$je_cv_msvc" = "xyes" ; then 3388bf6039f0SWarner Losh importlib="lib" 3389bf6039f0SWarner Losh DSO_LDFLAGS="-LD" 3390bf6039f0SWarner Losh EXTRA_LDFLAGS="-link -DEBUG" 3391bf6039f0SWarner Losh CTARGET='-Fo$@' 3392bf6039f0SWarner Losh LDTARGET='-Fe$@' 3393bf6039f0SWarner Losh AR='lib' 3394bf6039f0SWarner Losh ARFLAGS='-nologo -out:' 3395bf6039f0SWarner Losh AROUT='$@' 3396bf6039f0SWarner Losh CC_MM= 3397bf6039f0SWarner Losh else 3398bf6039f0SWarner Losh importlib="${so}" 3399bf6039f0SWarner Losh DSO_LDFLAGS="-shared" 3400bf6039f0SWarner Losh link_whole_archive="1" 3401bf6039f0SWarner Losh fi 3402bf6039f0SWarner Losh case "${host}" in 3403bf6039f0SWarner Losh *-*-cygwin*) 3404bf6039f0SWarner Losh DUMP_SYMS="dumpbin /SYMBOLS" 3405bf6039f0SWarner Losh ;; 3406bf6039f0SWarner Losh *) 3407bf6039f0SWarner Losh ;; 3408bf6039f0SWarner Losh esac 3409bf6039f0SWarner Losh a="lib" 3410bf6039f0SWarner Losh libprefix="" 3411bf6039f0SWarner Losh SOREV="${so}" 3412bf6039f0SWarner Losh PIC_CFLAGS="" 3413bf6039f0SWarner Losh if test "${LG_SIZEOF_PTR}" = "3"; then 3414bf6039f0SWarner Losh default_retain="1" 3415bf6039f0SWarner Losh fi 3416bf6039f0SWarner Losh ;; 3417bf6039f0SWarner Losh *) 3418bf6039f0SWarner Losh AC_MSG_RESULT([Unsupported operating system: ${host}]) 3419bf6039f0SWarner Losh abi="elf" 3420bf6039f0SWarner Losh ;; 3421bf6039f0SWarner Loshesac 3422bf6039f0SWarner Losh 3423bf6039f0SWarner LoshJEMALLOC_USABLE_SIZE_CONST=const 3424bf6039f0SWarner LoshAC_CHECK_HEADERS([malloc.h], [ 3425bf6039f0SWarner Losh AC_MSG_CHECKING([whether malloc_usable_size definition can use const argument]) 3426bf6039f0SWarner Losh AC_COMPILE_IFELSE([AC_LANG_PROGRAM( 3427bf6039f0SWarner Losh [#include <malloc.h> 3428bf6039f0SWarner Losh #include <stddef.h> 3429bf6039f0SWarner Losh size_t malloc_usable_size(const void *ptr); 3430bf6039f0SWarner Losh ], 3431bf6039f0SWarner Losh [])],[ 3432bf6039f0SWarner Losh AC_MSG_RESULT([yes]) 3433bf6039f0SWarner Losh ],[ 3434bf6039f0SWarner Losh JEMALLOC_USABLE_SIZE_CONST= 3435bf6039f0SWarner Losh AC_MSG_RESULT([no]) 3436bf6039f0SWarner Losh ]) 3437bf6039f0SWarner Losh]) 3438bf6039f0SWarner LoshAC_DEFINE_UNQUOTED([JEMALLOC_USABLE_SIZE_CONST], [$JEMALLOC_USABLE_SIZE_CONST]) 3439bf6039f0SWarner LoshAC_SUBST([abi]) 3440bf6039f0SWarner LoshAC_SUBST([RPATH]) 3441bf6039f0SWarner LoshAC_SUBST([LD_PRELOAD_VAR]) 3442bf6039f0SWarner LoshAC_SUBST([so]) 3443bf6039f0SWarner LoshAC_SUBST([importlib]) 3444bf6039f0SWarner LoshAC_SUBST([o]) 3445bf6039f0SWarner LoshAC_SUBST([a]) 3446bf6039f0SWarner LoshAC_SUBST([exe]) 3447bf6039f0SWarner LoshAC_SUBST([libprefix]) 3448bf6039f0SWarner LoshAC_SUBST([link_whole_archive]) 3449bf6039f0SWarner LoshAC_SUBST([DSO_LDFLAGS]) 3450bf6039f0SWarner LoshAC_SUBST([EXTRA_LDFLAGS]) 3451bf6039f0SWarner LoshAC_SUBST([SOREV]) 3452bf6039f0SWarner LoshAC_SUBST([PIC_CFLAGS]) 3453bf6039f0SWarner LoshAC_SUBST([CTARGET]) 3454bf6039f0SWarner LoshAC_SUBST([LDTARGET]) 3455bf6039f0SWarner LoshAC_SUBST([TEST_LD_MODE]) 3456bf6039f0SWarner LoshAC_SUBST([MKLIB]) 3457bf6039f0SWarner LoshAC_SUBST([ARFLAGS]) 3458bf6039f0SWarner LoshAC_SUBST([AROUT]) 3459bf6039f0SWarner LoshAC_SUBST([DUMP_SYMS]) 3460bf6039f0SWarner LoshAC_SUBST([CC_MM]) 3461bf6039f0SWarner Losh 3462bf6039f0SWarner Loshdnl Determine whether libm must be linked to use e.g. log(3). 3463bf6039f0SWarner LoshAC_SEARCH_LIBS([log], [m], , [AC_MSG_ERROR([Missing math functions])]) 3464bf6039f0SWarner Loshif test "x$ac_cv_search_log" != "xnone required" ; then 3465bf6039f0SWarner Losh LM="$ac_cv_search_log" 3466bf6039f0SWarner Loshelse 3467bf6039f0SWarner Losh LM= 3468bf6039f0SWarner Loshfi 3469bf6039f0SWarner LoshAC_SUBST(LM) 3470bf6039f0SWarner Losh 3471bf6039f0SWarner LoshJE_COMPILABLE([__attribute__ syntax], 3472bf6039f0SWarner Losh [static __attribute__((unused)) void foo(void){}], 3473bf6039f0SWarner Losh [], 3474bf6039f0SWarner Losh [je_cv_attribute]) 3475bf6039f0SWarner Loshif test "x${je_cv_attribute}" = "xyes" ; then 3476bf6039f0SWarner Losh AC_DEFINE([JEMALLOC_HAVE_ATTR], [ ]) 3477bf6039f0SWarner Losh if test "x${GCC}" = "xyes" -a "x${abi}" = "xelf"; then 3478bf6039f0SWarner Losh JE_CFLAGS_ADD([-fvisibility=hidden]) 3479bf6039f0SWarner Losh JE_CXXFLAGS_ADD([-fvisibility=hidden]) 3480bf6039f0SWarner Losh fi 3481bf6039f0SWarner Loshfi 3482bf6039f0SWarner Loshdnl Check for tls_model attribute support (clang 3.0 still lacks support). 3483bf6039f0SWarner LoshJE_CFLAGS_SAVE() 3484bf6039f0SWarner LoshJE_CFLAGS_ADD([-Werror]) 3485bf6039f0SWarner LoshJE_CFLAGS_ADD([-herror_on_warning]) 3486bf6039f0SWarner LoshJE_COMPILABLE([tls_model attribute], [], 3487bf6039f0SWarner Losh [static __thread int 3488bf6039f0SWarner Losh __attribute__((tls_model("initial-exec"), unused)) foo; 3489bf6039f0SWarner Losh foo = 0;], 3490bf6039f0SWarner Losh [je_cv_tls_model]) 3491bf6039f0SWarner LoshJE_CFLAGS_RESTORE() 3492bf6039f0SWarner Loshdnl (Setting of JEMALLOC_TLS_MODEL is done later, after we've checked for 3493bf6039f0SWarner Loshdnl --disable-initial-exec-tls) 3494bf6039f0SWarner Losh 3495bf6039f0SWarner Loshdnl Check for alloc_size attribute support. 3496bf6039f0SWarner LoshJE_CFLAGS_SAVE() 3497bf6039f0SWarner LoshJE_CFLAGS_ADD([-Werror]) 3498bf6039f0SWarner LoshJE_CFLAGS_ADD([-herror_on_warning]) 3499bf6039f0SWarner LoshJE_COMPILABLE([alloc_size attribute], [#include <stdlib.h>], 3500bf6039f0SWarner Losh [void *foo(size_t size) __attribute__((alloc_size(1)));], 3501bf6039f0SWarner Losh [je_cv_alloc_size]) 3502bf6039f0SWarner LoshJE_CFLAGS_RESTORE() 3503bf6039f0SWarner Loshif test "x${je_cv_alloc_size}" = "xyes" ; then 3504bf6039f0SWarner Losh AC_DEFINE([JEMALLOC_HAVE_ATTR_ALLOC_SIZE], [ ]) 3505bf6039f0SWarner Loshfi 3506bf6039f0SWarner Loshdnl Check for format(gnu_printf, ...) attribute support. 3507bf6039f0SWarner LoshJE_CFLAGS_SAVE() 3508bf6039f0SWarner LoshJE_CFLAGS_ADD([-Werror]) 3509bf6039f0SWarner LoshJE_CFLAGS_ADD([-herror_on_warning]) 3510bf6039f0SWarner LoshJE_COMPILABLE([format(gnu_printf, ...) attribute], [#include <stdlib.h>], 3511bf6039f0SWarner Losh [void *foo(const char *format, ...) __attribute__((format(gnu_printf, 1, 2)));], 3512bf6039f0SWarner Losh [je_cv_format_gnu_printf]) 3513bf6039f0SWarner LoshJE_CFLAGS_RESTORE() 3514bf6039f0SWarner Loshif test "x${je_cv_format_gnu_printf}" = "xyes" ; then 3515bf6039f0SWarner Losh AC_DEFINE([JEMALLOC_HAVE_ATTR_FORMAT_GNU_PRINTF], [ ]) 3516bf6039f0SWarner Loshfi 3517bf6039f0SWarner Loshdnl Check for format(printf, ...) attribute support. 3518bf6039f0SWarner LoshJE_CFLAGS_SAVE() 3519bf6039f0SWarner LoshJE_CFLAGS_ADD([-Werror]) 3520bf6039f0SWarner LoshJE_CFLAGS_ADD([-herror_on_warning]) 3521bf6039f0SWarner LoshJE_COMPILABLE([format(printf, ...) attribute], [#include <stdlib.h>], 3522bf6039f0SWarner Losh [void *foo(const char *format, ...) __attribute__((format(printf, 1, 2)));], 3523bf6039f0SWarner Losh [je_cv_format_printf]) 3524bf6039f0SWarner LoshJE_CFLAGS_RESTORE() 3525bf6039f0SWarner Loshif test "x${je_cv_format_printf}" = "xyes" ; then 3526bf6039f0SWarner Losh AC_DEFINE([JEMALLOC_HAVE_ATTR_FORMAT_PRINTF], [ ]) 3527bf6039f0SWarner Loshfi 3528bf6039f0SWarner Losh 3529bf6039f0SWarner Loshdnl Check for format_arg(...) attribute support. 3530bf6039f0SWarner LoshJE_CFLAGS_SAVE() 3531bf6039f0SWarner LoshJE_CFLAGS_ADD([-Werror]) 3532bf6039f0SWarner LoshJE_CFLAGS_ADD([-herror_on_warning]) 3533bf6039f0SWarner LoshJE_COMPILABLE([format(printf, ...) attribute], [#include <stdlib.h>], 3534bf6039f0SWarner Losh [const char * __attribute__((__format_arg__(1))) foo(const char *format);], 3535bf6039f0SWarner Losh [je_cv_format_arg]) 3536bf6039f0SWarner LoshJE_CFLAGS_RESTORE() 3537bf6039f0SWarner Loshif test "x${je_cv_format_arg}" = "xyes" ; then 3538bf6039f0SWarner Losh AC_DEFINE([JEMALLOC_HAVE_ATTR_FORMAT_ARG], [ ]) 3539bf6039f0SWarner Loshfi 3540bf6039f0SWarner Losh 3541bf6039f0SWarner Loshdnl Support optional additions to rpath. 3542bf6039f0SWarner LoshAC_ARG_WITH([rpath], 3543bf6039f0SWarner Losh [AS_HELP_STRING([--with-rpath=<rpath>], [Colon-separated rpath (ELF systems only)])], 3544bf6039f0SWarner Loshif test "x$with_rpath" = "xno" ; then 3545bf6039f0SWarner Losh RPATH_EXTRA= 3546bf6039f0SWarner Loshelse 3547bf6039f0SWarner Losh RPATH_EXTRA="`echo $with_rpath | tr \":\" \" \"`" 3548bf6039f0SWarner Loshfi, 3549bf6039f0SWarner Losh RPATH_EXTRA= 3550bf6039f0SWarner Losh) 3551bf6039f0SWarner LoshAC_SUBST([RPATH_EXTRA]) 3552bf6039f0SWarner Losh 3553bf6039f0SWarner Loshdnl Disable rules that do automatic regeneration of configure output by default. 3554bf6039f0SWarner LoshAC_ARG_ENABLE([autogen], 3555bf6039f0SWarner Losh [AS_HELP_STRING([--enable-autogen], [Automatically regenerate configure output])], 3556bf6039f0SWarner Loshif test "x$enable_autogen" = "xno" ; then 3557bf6039f0SWarner Losh enable_autogen="0" 3558bf6039f0SWarner Loshelse 3559bf6039f0SWarner Losh enable_autogen="1" 3560bf6039f0SWarner Loshfi 3561bf6039f0SWarner Losh, 3562bf6039f0SWarner Loshenable_autogen="0" 3563bf6039f0SWarner Losh) 3564bf6039f0SWarner LoshAC_SUBST([enable_autogen]) 3565bf6039f0SWarner Losh 3566bf6039f0SWarner LoshAC_PROG_INSTALL 3567bf6039f0SWarner LoshAC_PROG_RANLIB 3568bf6039f0SWarner LoshAC_PATH_PROG([LD], [ld], [false], [$PATH]) 3569bf6039f0SWarner LoshAC_PATH_PROG([AUTOCONF], [autoconf], [false], [$PATH]) 3570bf6039f0SWarner Losh 3571bf6039f0SWarner Loshdnl Enable documentation 3572bf6039f0SWarner LoshAC_ARG_ENABLE([doc], 3573bf6039f0SWarner Losh [AS_HELP_STRING([--enable-documentation], [Build documentation])], 3574bf6039f0SWarner Loshif test "x$enable_doc" = "xno" ; then 3575bf6039f0SWarner Losh enable_doc="0" 3576bf6039f0SWarner Loshelse 3577bf6039f0SWarner Losh enable_doc="1" 3578bf6039f0SWarner Loshfi 3579bf6039f0SWarner Losh, 3580bf6039f0SWarner Loshenable_doc="1" 3581bf6039f0SWarner Losh) 3582bf6039f0SWarner LoshAC_SUBST([enable_doc]) 3583bf6039f0SWarner Losh 3584bf6039f0SWarner Loshdnl Enable shared libs 3585bf6039f0SWarner LoshAC_ARG_ENABLE([shared], 3586bf6039f0SWarner Losh [AS_HELP_STRING([--enable-shared], [Build shared libaries])], 3587bf6039f0SWarner Loshif test "x$enable_shared" = "xno" ; then 3588bf6039f0SWarner Losh enable_shared="0" 3589bf6039f0SWarner Loshelse 3590bf6039f0SWarner Losh enable_shared="1" 3591bf6039f0SWarner Loshfi 3592bf6039f0SWarner Losh, 3593bf6039f0SWarner Loshenable_shared="1" 3594bf6039f0SWarner Losh) 3595bf6039f0SWarner LoshAC_SUBST([enable_shared]) 3596bf6039f0SWarner Losh 3597bf6039f0SWarner Loshdnl Enable static libs 3598bf6039f0SWarner LoshAC_ARG_ENABLE([static], 3599bf6039f0SWarner Losh [AS_HELP_STRING([--enable-static], [Build static libaries])], 3600bf6039f0SWarner Loshif test "x$enable_static" = "xno" ; then 3601bf6039f0SWarner Losh enable_static="0" 3602bf6039f0SWarner Loshelse 3603bf6039f0SWarner Losh enable_static="1" 3604bf6039f0SWarner Loshfi 3605bf6039f0SWarner Losh, 3606bf6039f0SWarner Loshenable_static="1" 3607bf6039f0SWarner Losh) 3608bf6039f0SWarner LoshAC_SUBST([enable_static]) 3609bf6039f0SWarner Losh 3610bf6039f0SWarner Loshif test "$enable_shared$enable_static" = "00" ; then 3611bf6039f0SWarner Losh AC_MSG_ERROR([Please enable one of shared or static builds]) 3612bf6039f0SWarner Loshfi 3613bf6039f0SWarner Losh 3614bf6039f0SWarner Loshdnl Perform no name mangling by default. 3615bf6039f0SWarner LoshAC_ARG_WITH([mangling], 3616bf6039f0SWarner Losh [AS_HELP_STRING([--with-mangling=<map>], [Mangle symbols in <map>])], 3617bf6039f0SWarner Losh [mangling_map="$with_mangling"], [mangling_map=""]) 3618bf6039f0SWarner Losh 3619bf6039f0SWarner Loshdnl Do not prefix public APIs by default. 3620bf6039f0SWarner LoshAC_ARG_WITH([jemalloc_prefix], 3621bf6039f0SWarner Losh [AS_HELP_STRING([--with-jemalloc-prefix=<prefix>], [Prefix to prepend to all public APIs])], 3622bf6039f0SWarner Losh [JEMALLOC_PREFIX="$with_jemalloc_prefix"], 3623bf6039f0SWarner Losh [if test "x$abi" != "xmacho" -a "x$abi" != "xpecoff"; then 3624bf6039f0SWarner Losh JEMALLOC_PREFIX="" 3625bf6039f0SWarner Loshelse 3626bf6039f0SWarner Losh JEMALLOC_PREFIX="je_" 3627bf6039f0SWarner Loshfi] 3628bf6039f0SWarner Losh) 3629bf6039f0SWarner Loshif test "x$JEMALLOC_PREFIX" = "x" ; then 3630bf6039f0SWarner Losh AC_DEFINE([JEMALLOC_IS_MALLOC]) 3631bf6039f0SWarner Loshelse 3632bf6039f0SWarner Losh JEMALLOC_CPREFIX=`echo ${JEMALLOC_PREFIX} | tr "a-z" "A-Z"` 3633bf6039f0SWarner Losh AC_DEFINE_UNQUOTED([JEMALLOC_PREFIX], ["$JEMALLOC_PREFIX"]) 3634bf6039f0SWarner Losh AC_DEFINE_UNQUOTED([JEMALLOC_CPREFIX], ["$JEMALLOC_CPREFIX"]) 3635bf6039f0SWarner Loshfi 3636bf6039f0SWarner LoshAC_SUBST([JEMALLOC_PREFIX]) 3637bf6039f0SWarner LoshAC_SUBST([JEMALLOC_CPREFIX]) 3638bf6039f0SWarner Losh 3639bf6039f0SWarner LoshAC_ARG_WITH([export], 3640bf6039f0SWarner Losh [AS_HELP_STRING([--without-export], [disable exporting jemalloc public APIs])], 3641bf6039f0SWarner Losh [if test "x$with_export" = "xno"; then 3642bf6039f0SWarner Losh AC_DEFINE([JEMALLOC_EXPORT],[]) 3643bf6039f0SWarner Loshfi] 3644bf6039f0SWarner Losh) 3645bf6039f0SWarner Losh 3646bf6039f0SWarner Loshpublic_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" 3647bf6039f0SWarner Loshdnl Check for additional platform-specific public API functions. 3648bf6039f0SWarner LoshAC_CHECK_FUNC([memalign], 3649bf6039f0SWarner Losh [AC_DEFINE([JEMALLOC_OVERRIDE_MEMALIGN], [ ]) 3650bf6039f0SWarner Losh public_syms="${public_syms} memalign"]) 3651bf6039f0SWarner LoshAC_CHECK_FUNC([valloc], 3652bf6039f0SWarner Losh [AC_DEFINE([JEMALLOC_OVERRIDE_VALLOC], [ ]) 3653bf6039f0SWarner Losh public_syms="${public_syms} valloc"]) 3654bf6039f0SWarner Losh 3655bf6039f0SWarner Loshdnl Check for allocator-related functions that should be wrapped. 3656bf6039f0SWarner Loshwrap_syms= 3657bf6039f0SWarner Loshif test "x${JEMALLOC_PREFIX}" = "x" ; then 3658bf6039f0SWarner Losh AC_CHECK_FUNC([__libc_calloc], 3659bf6039f0SWarner Losh [AC_DEFINE([JEMALLOC_OVERRIDE___LIBC_CALLOC], [ ]) 3660bf6039f0SWarner Losh wrap_syms="${wrap_syms} __libc_calloc"]) 3661bf6039f0SWarner Losh AC_CHECK_FUNC([__libc_free], 3662bf6039f0SWarner Losh [AC_DEFINE([JEMALLOC_OVERRIDE___LIBC_FREE], [ ]) 3663bf6039f0SWarner Losh wrap_syms="${wrap_syms} __libc_free"]) 3664bf6039f0SWarner Losh AC_CHECK_FUNC([__libc_malloc], 3665bf6039f0SWarner Losh [AC_DEFINE([JEMALLOC_OVERRIDE___LIBC_MALLOC], [ ]) 3666bf6039f0SWarner Losh wrap_syms="${wrap_syms} __libc_malloc"]) 3667bf6039f0SWarner Losh AC_CHECK_FUNC([__libc_memalign], 3668bf6039f0SWarner Losh [AC_DEFINE([JEMALLOC_OVERRIDE___LIBC_MEMALIGN], [ ]) 3669bf6039f0SWarner Losh wrap_syms="${wrap_syms} __libc_memalign"]) 3670bf6039f0SWarner Losh AC_CHECK_FUNC([__libc_realloc], 3671bf6039f0SWarner Losh [AC_DEFINE([JEMALLOC_OVERRIDE___LIBC_REALLOC], [ ]) 3672bf6039f0SWarner Losh wrap_syms="${wrap_syms} __libc_realloc"]) 3673bf6039f0SWarner Losh AC_CHECK_FUNC([__libc_valloc], 3674bf6039f0SWarner Losh [AC_DEFINE([JEMALLOC_OVERRIDE___LIBC_VALLOC], [ ]) 3675bf6039f0SWarner Losh wrap_syms="${wrap_syms} __libc_valloc"]) 3676bf6039f0SWarner Losh AC_CHECK_FUNC([__posix_memalign], 3677bf6039f0SWarner Losh [AC_DEFINE([JEMALLOC_OVERRIDE___POSIX_MEMALIGN], [ ]) 3678bf6039f0SWarner Losh wrap_syms="${wrap_syms} __posix_memalign"]) 3679bf6039f0SWarner Loshfi 3680bf6039f0SWarner Losh 3681bf6039f0SWarner Loshcase "${host}" in 3682bf6039f0SWarner Losh *-*-mingw* | *-*-cygwin*) 3683bf6039f0SWarner Losh wrap_syms="${wrap_syms} tls_callback" 3684bf6039f0SWarner Losh ;; 3685bf6039f0SWarner Losh *) 3686bf6039f0SWarner Losh ;; 3687bf6039f0SWarner Loshesac 3688bf6039f0SWarner Losh 3689bf6039f0SWarner Loshdnl Mangle library-private APIs. 3690bf6039f0SWarner LoshAC_ARG_WITH([private_namespace], 3691bf6039f0SWarner Losh [AS_HELP_STRING([--with-private-namespace=<prefix>], [Prefix to prepend to all library-private APIs])], 3692bf6039f0SWarner Losh [JEMALLOC_PRIVATE_NAMESPACE="${with_private_namespace}je_"], 3693bf6039f0SWarner Losh [JEMALLOC_PRIVATE_NAMESPACE="je_"] 3694bf6039f0SWarner Losh) 3695bf6039f0SWarner LoshAC_DEFINE_UNQUOTED([JEMALLOC_PRIVATE_NAMESPACE], [$JEMALLOC_PRIVATE_NAMESPACE]) 3696bf6039f0SWarner Loshprivate_namespace="$JEMALLOC_PRIVATE_NAMESPACE" 3697bf6039f0SWarner LoshAC_SUBST([private_namespace]) 3698bf6039f0SWarner Losh 3699bf6039f0SWarner Loshdnl Do not add suffix to installed files by default. 3700bf6039f0SWarner LoshAC_ARG_WITH([install_suffix], 3701bf6039f0SWarner Losh [AS_HELP_STRING([--with-install-suffix=<suffix>], [Suffix to append to all installed files])], 3702bf6039f0SWarner Losh [INSTALL_SUFFIX="$with_install_suffix"], 3703bf6039f0SWarner Losh [INSTALL_SUFFIX=] 3704bf6039f0SWarner Losh) 3705bf6039f0SWarner Loshinstall_suffix="$INSTALL_SUFFIX" 3706bf6039f0SWarner LoshAC_SUBST([install_suffix]) 3707bf6039f0SWarner Losh 3708bf6039f0SWarner Loshdnl Specify default malloc_conf. 3709bf6039f0SWarner LoshAC_ARG_WITH([malloc_conf], 3710bf6039f0SWarner Losh [AS_HELP_STRING([--with-malloc-conf=<malloc_conf>], [config.malloc_conf options string])], 3711bf6039f0SWarner Losh [JEMALLOC_CONFIG_MALLOC_CONF="$with_malloc_conf"], 3712bf6039f0SWarner Losh [JEMALLOC_CONFIG_MALLOC_CONF=""] 3713bf6039f0SWarner Losh) 3714bf6039f0SWarner Loshconfig_malloc_conf="$JEMALLOC_CONFIG_MALLOC_CONF" 3715bf6039f0SWarner LoshAC_DEFINE_UNQUOTED([JEMALLOC_CONFIG_MALLOC_CONF], ["$config_malloc_conf"]) 3716bf6039f0SWarner Losh 3717bf6039f0SWarner Loshdnl Substitute @je_@ in jemalloc_protos.h.in, primarily to make generation of 3718bf6039f0SWarner Loshdnl jemalloc_protos_jet.h easy. 3719bf6039f0SWarner Loshje_="je_" 3720bf6039f0SWarner LoshAC_SUBST([je_]) 3721bf6039f0SWarner Losh 3722bf6039f0SWarner Loshcfgoutputs_in="Makefile.in" 3723bf6039f0SWarner Loshcfgoutputs_in="${cfgoutputs_in} jemalloc.pc.in" 3724bf6039f0SWarner Loshcfgoutputs_in="${cfgoutputs_in} doc/html.xsl.in" 3725bf6039f0SWarner Loshcfgoutputs_in="${cfgoutputs_in} doc/manpages.xsl.in" 3726bf6039f0SWarner Loshcfgoutputs_in="${cfgoutputs_in} doc/jemalloc.xml.in" 3727bf6039f0SWarner Loshcfgoutputs_in="${cfgoutputs_in} include/jemalloc/jemalloc_macros.h.in" 3728bf6039f0SWarner Loshcfgoutputs_in="${cfgoutputs_in} include/jemalloc/jemalloc_protos.h.in" 3729bf6039f0SWarner Loshcfgoutputs_in="${cfgoutputs_in} include/jemalloc/jemalloc_typedefs.h.in" 3730bf6039f0SWarner Loshcfgoutputs_in="${cfgoutputs_in} include/jemalloc/internal/jemalloc_preamble.h.in" 3731bf6039f0SWarner Loshcfgoutputs_in="${cfgoutputs_in} test/test.sh.in" 3732bf6039f0SWarner Loshcfgoutputs_in="${cfgoutputs_in} test/include/test/jemalloc_test.h.in" 3733bf6039f0SWarner Losh 3734bf6039f0SWarner Loshcfgoutputs_out="Makefile" 3735bf6039f0SWarner Loshcfgoutputs_out="${cfgoutputs_out} jemalloc.pc" 3736bf6039f0SWarner Loshcfgoutputs_out="${cfgoutputs_out} doc/html.xsl" 3737bf6039f0SWarner Loshcfgoutputs_out="${cfgoutputs_out} doc/manpages.xsl" 3738bf6039f0SWarner Loshcfgoutputs_out="${cfgoutputs_out} doc/jemalloc.xml" 3739bf6039f0SWarner Loshcfgoutputs_out="${cfgoutputs_out} include/jemalloc/jemalloc_macros.h" 3740bf6039f0SWarner Loshcfgoutputs_out="${cfgoutputs_out} include/jemalloc/jemalloc_protos.h" 3741bf6039f0SWarner Loshcfgoutputs_out="${cfgoutputs_out} include/jemalloc/jemalloc_typedefs.h" 3742bf6039f0SWarner Loshcfgoutputs_out="${cfgoutputs_out} include/jemalloc/internal/jemalloc_preamble.h" 3743bf6039f0SWarner Loshcfgoutputs_out="${cfgoutputs_out} test/test.sh" 3744bf6039f0SWarner Loshcfgoutputs_out="${cfgoutputs_out} test/include/test/jemalloc_test.h" 3745bf6039f0SWarner Losh 3746bf6039f0SWarner Loshcfgoutputs_tup="Makefile" 3747bf6039f0SWarner Loshcfgoutputs_tup="${cfgoutputs_tup} jemalloc.pc:jemalloc.pc.in" 3748bf6039f0SWarner Loshcfgoutputs_tup="${cfgoutputs_tup} doc/html.xsl:doc/html.xsl.in" 3749bf6039f0SWarner Loshcfgoutputs_tup="${cfgoutputs_tup} doc/manpages.xsl:doc/manpages.xsl.in" 3750bf6039f0SWarner Loshcfgoutputs_tup="${cfgoutputs_tup} doc/jemalloc.xml:doc/jemalloc.xml.in" 3751bf6039f0SWarner Loshcfgoutputs_tup="${cfgoutputs_tup} include/jemalloc/jemalloc_macros.h:include/jemalloc/jemalloc_macros.h.in" 3752bf6039f0SWarner Loshcfgoutputs_tup="${cfgoutputs_tup} include/jemalloc/jemalloc_protos.h:include/jemalloc/jemalloc_protos.h.in" 3753bf6039f0SWarner Loshcfgoutputs_tup="${cfgoutputs_tup} include/jemalloc/jemalloc_typedefs.h:include/jemalloc/jemalloc_typedefs.h.in" 3754bf6039f0SWarner Loshcfgoutputs_tup="${cfgoutputs_tup} include/jemalloc/internal/jemalloc_preamble.h" 3755bf6039f0SWarner Loshcfgoutputs_tup="${cfgoutputs_tup} test/test.sh:test/test.sh.in" 3756bf6039f0SWarner Loshcfgoutputs_tup="${cfgoutputs_tup} test/include/test/jemalloc_test.h:test/include/test/jemalloc_test.h.in" 3757bf6039f0SWarner Losh 3758bf6039f0SWarner Loshcfghdrs_in="include/jemalloc/jemalloc_defs.h.in" 3759bf6039f0SWarner Loshcfghdrs_in="${cfghdrs_in} include/jemalloc/internal/jemalloc_internal_defs.h.in" 3760bf6039f0SWarner Loshcfghdrs_in="${cfghdrs_in} include/jemalloc/internal/private_symbols.sh" 3761bf6039f0SWarner Loshcfghdrs_in="${cfghdrs_in} include/jemalloc/internal/private_namespace.sh" 3762bf6039f0SWarner Loshcfghdrs_in="${cfghdrs_in} include/jemalloc/internal/public_namespace.sh" 3763bf6039f0SWarner Loshcfghdrs_in="${cfghdrs_in} include/jemalloc/internal/public_unnamespace.sh" 3764bf6039f0SWarner Loshcfghdrs_in="${cfghdrs_in} include/jemalloc/jemalloc_rename.sh" 3765bf6039f0SWarner Loshcfghdrs_in="${cfghdrs_in} include/jemalloc/jemalloc_mangle.sh" 3766bf6039f0SWarner Loshcfghdrs_in="${cfghdrs_in} include/jemalloc/jemalloc.sh" 3767bf6039f0SWarner Loshcfghdrs_in="${cfghdrs_in} test/include/test/jemalloc_test_defs.h.in" 3768bf6039f0SWarner Losh 3769bf6039f0SWarner Loshcfghdrs_out="include/jemalloc/jemalloc_defs.h" 3770bf6039f0SWarner Loshcfghdrs_out="${cfghdrs_out} include/jemalloc/jemalloc${install_suffix}.h" 3771bf6039f0SWarner Loshcfghdrs_out="${cfghdrs_out} include/jemalloc/internal/private_symbols.awk" 3772bf6039f0SWarner Loshcfghdrs_out="${cfghdrs_out} include/jemalloc/internal/private_symbols_jet.awk" 3773bf6039f0SWarner Loshcfghdrs_out="${cfghdrs_out} include/jemalloc/internal/public_symbols.txt" 3774bf6039f0SWarner Loshcfghdrs_out="${cfghdrs_out} include/jemalloc/internal/public_namespace.h" 3775bf6039f0SWarner Loshcfghdrs_out="${cfghdrs_out} include/jemalloc/internal/public_unnamespace.h" 3776bf6039f0SWarner Loshcfghdrs_out="${cfghdrs_out} include/jemalloc/jemalloc_protos_jet.h" 3777bf6039f0SWarner Loshcfghdrs_out="${cfghdrs_out} include/jemalloc/jemalloc_rename.h" 3778bf6039f0SWarner Loshcfghdrs_out="${cfghdrs_out} include/jemalloc/jemalloc_mangle.h" 3779bf6039f0SWarner Loshcfghdrs_out="${cfghdrs_out} include/jemalloc/jemalloc_mangle_jet.h" 3780bf6039f0SWarner Loshcfghdrs_out="${cfghdrs_out} include/jemalloc/internal/jemalloc_internal_defs.h" 3781bf6039f0SWarner Loshcfghdrs_out="${cfghdrs_out} test/include/test/jemalloc_test_defs.h" 3782bf6039f0SWarner Losh 3783bf6039f0SWarner Loshcfghdrs_tup="include/jemalloc/jemalloc_defs.h:include/jemalloc/jemalloc_defs.h.in" 3784bf6039f0SWarner Loshcfghdrs_tup="${cfghdrs_tup} include/jemalloc/internal/jemalloc_internal_defs.h:include/jemalloc/internal/jemalloc_internal_defs.h.in" 3785bf6039f0SWarner Loshcfghdrs_tup="${cfghdrs_tup} test/include/test/jemalloc_test_defs.h:test/include/test/jemalloc_test_defs.h.in" 3786bf6039f0SWarner Losh 3787bf6039f0SWarner Loshdnl ============================================================================ 3788bf6039f0SWarner Loshdnl jemalloc build options. 3789bf6039f0SWarner Loshdnl 3790bf6039f0SWarner Losh 3791bf6039f0SWarner Loshdnl Do not compile with debugging by default. 3792bf6039f0SWarner LoshAC_ARG_ENABLE([debug], 3793bf6039f0SWarner Losh [AS_HELP_STRING([--enable-debug], 3794bf6039f0SWarner Losh [Build debugging code])], 3795bf6039f0SWarner Losh[if test "x$enable_debug" = "xno" ; then 3796bf6039f0SWarner Losh enable_debug="0" 3797bf6039f0SWarner Loshelse 3798bf6039f0SWarner Losh enable_debug="1" 3799bf6039f0SWarner Loshfi 3800bf6039f0SWarner Losh], 3801bf6039f0SWarner Losh[enable_debug="0"] 3802bf6039f0SWarner Losh) 3803bf6039f0SWarner Loshif test "x$enable_debug" = "x1" ; then 3804bf6039f0SWarner Losh AC_DEFINE([JEMALLOC_DEBUG], [ ]) 3805bf6039f0SWarner Loshfi 3806bf6039f0SWarner Loshif test "x$enable_debug" = "x1" ; then 3807bf6039f0SWarner Losh AC_DEFINE([JEMALLOC_DEBUG], [ ]) 3808bf6039f0SWarner Loshfi 3809bf6039f0SWarner LoshAC_SUBST([enable_debug]) 3810bf6039f0SWarner Losh 3811bf6039f0SWarner Loshdnl Only optimize if not debugging. 3812bf6039f0SWarner Loshif test "x$enable_debug" = "x0" ; then 3813bf6039f0SWarner Losh if test "x$GCC" = "xyes" ; then 3814bf6039f0SWarner Losh JE_CFLAGS_ADD([-O3]) 3815bf6039f0SWarner Losh JE_CXXFLAGS_ADD([-O3]) 3816bf6039f0SWarner Losh JE_CFLAGS_ADD([-funroll-loops]) 3817bf6039f0SWarner Losh elif test "x$je_cv_msvc" = "xyes" ; then 3818bf6039f0SWarner Losh JE_CFLAGS_ADD([-O2]) 3819bf6039f0SWarner Losh JE_CXXFLAGS_ADD([-O2]) 3820bf6039f0SWarner Losh else 3821bf6039f0SWarner Losh JE_CFLAGS_ADD([-O]) 3822bf6039f0SWarner Losh JE_CXXFLAGS_ADD([-O]) 3823bf6039f0SWarner Losh fi 3824bf6039f0SWarner Loshfi 3825bf6039f0SWarner Losh 3826bf6039f0SWarner Loshdnl Enable statistics calculation by default. 3827bf6039f0SWarner LoshAC_ARG_ENABLE([stats], 3828bf6039f0SWarner Losh [AS_HELP_STRING([--disable-stats], 3829bf6039f0SWarner Losh [Disable statistics calculation/reporting])], 3830bf6039f0SWarner Losh[if test "x$enable_stats" = "xno" ; then 3831bf6039f0SWarner Losh enable_stats="0" 3832bf6039f0SWarner Loshelse 3833bf6039f0SWarner Losh enable_stats="1" 3834bf6039f0SWarner Loshfi 3835bf6039f0SWarner Losh], 3836bf6039f0SWarner Losh[enable_stats="1"] 3837bf6039f0SWarner Losh) 3838bf6039f0SWarner Loshif test "x$enable_stats" = "x1" ; then 3839bf6039f0SWarner Losh AC_DEFINE([JEMALLOC_STATS], [ ]) 3840bf6039f0SWarner Loshfi 3841bf6039f0SWarner LoshAC_SUBST([enable_stats]) 3842bf6039f0SWarner Losh 3843bf6039f0SWarner Loshdnl Do not enable smallocx by default. 3844bf6039f0SWarner LoshAC_ARG_ENABLE([experimental_smallocx], 3845bf6039f0SWarner Losh [AS_HELP_STRING([--enable-experimental-smallocx], [Enable experimental smallocx API])], 3846bf6039f0SWarner Losh[if test "x$enable_experimental_smallocx" = "xno" ; then 3847bf6039f0SWarner Loshenable_experimental_smallocx="0" 3848bf6039f0SWarner Loshelse 3849bf6039f0SWarner Loshenable_experimental_smallocx="1" 3850bf6039f0SWarner Loshfi 3851bf6039f0SWarner Losh], 3852bf6039f0SWarner Losh[enable_experimental_smallocx="0"] 3853bf6039f0SWarner Losh) 3854bf6039f0SWarner Loshif test "x$enable_experimental_smallocx" = "x1" ; then 3855bf6039f0SWarner Losh AC_DEFINE([JEMALLOC_EXPERIMENTAL_SMALLOCX_API]) 3856bf6039f0SWarner Loshfi 3857bf6039f0SWarner LoshAC_SUBST([enable_experimental_smallocx]) 3858bf6039f0SWarner Losh 3859bf6039f0SWarner Loshdnl Do not enable profiling by default. 3860bf6039f0SWarner LoshAC_ARG_ENABLE([prof], 3861bf6039f0SWarner Losh [AS_HELP_STRING([--enable-prof], [Enable allocation profiling])], 3862bf6039f0SWarner Losh[if test "x$enable_prof" = "xno" ; then 3863bf6039f0SWarner Losh enable_prof="0" 3864bf6039f0SWarner Loshelse 3865bf6039f0SWarner Losh enable_prof="1" 3866bf6039f0SWarner Loshfi 3867bf6039f0SWarner Losh], 3868bf6039f0SWarner Losh[enable_prof="0"] 3869bf6039f0SWarner Losh) 3870bf6039f0SWarner Loshif test "x$enable_prof" = "x1" ; then 3871bf6039f0SWarner Losh backtrace_method="" 3872bf6039f0SWarner Loshelse 3873bf6039f0SWarner Losh backtrace_method="N/A" 3874bf6039f0SWarner Loshfi 3875bf6039f0SWarner Losh 3876bf6039f0SWarner LoshAC_ARG_ENABLE([prof-libunwind], 3877bf6039f0SWarner Losh [AS_HELP_STRING([--enable-prof-libunwind], [Use libunwind for backtracing])], 3878bf6039f0SWarner Losh[if test "x$enable_prof_libunwind" = "xno" ; then 3879bf6039f0SWarner Losh enable_prof_libunwind="0" 3880bf6039f0SWarner Loshelse 3881bf6039f0SWarner Losh enable_prof_libunwind="1" 3882bf6039f0SWarner Loshfi 3883bf6039f0SWarner Losh], 3884bf6039f0SWarner Losh[enable_prof_libunwind="0"] 3885bf6039f0SWarner Losh) 3886bf6039f0SWarner LoshAC_ARG_WITH([static_libunwind], 3887bf6039f0SWarner Losh [AS_HELP_STRING([--with-static-libunwind=<libunwind.a>], 3888bf6039f0SWarner Losh [Path to static libunwind library; use rather than dynamically linking])], 3889bf6039f0SWarner Loshif test "x$with_static_libunwind" = "xno" ; then 3890bf6039f0SWarner Losh LUNWIND="-lunwind" 3891bf6039f0SWarner Loshelse 3892bf6039f0SWarner Losh if test ! -f "$with_static_libunwind" ; then 3893bf6039f0SWarner Losh AC_MSG_ERROR([Static libunwind not found: $with_static_libunwind]) 3894bf6039f0SWarner Losh fi 3895bf6039f0SWarner Losh LUNWIND="$with_static_libunwind" 3896bf6039f0SWarner Loshfi, 3897bf6039f0SWarner Losh LUNWIND="-lunwind" 3898bf6039f0SWarner Losh) 3899bf6039f0SWarner Loshif test "x$backtrace_method" = "x" -a "x$enable_prof_libunwind" = "x1" ; then 3900bf6039f0SWarner Losh AC_CHECK_HEADERS([libunwind.h], , [enable_prof_libunwind="0"]) 3901bf6039f0SWarner Losh if test "x$LUNWIND" = "x-lunwind" ; then 3902bf6039f0SWarner Losh AC_CHECK_LIB([unwind], [unw_backtrace], [JE_APPEND_VS(LIBS, $LUNWIND)], 3903bf6039f0SWarner Losh [enable_prof_libunwind="0"]) 3904bf6039f0SWarner Losh else 3905bf6039f0SWarner Losh JE_APPEND_VS(LIBS, $LUNWIND) 3906bf6039f0SWarner Losh fi 3907bf6039f0SWarner Losh if test "x${enable_prof_libunwind}" = "x1" ; then 3908bf6039f0SWarner Losh backtrace_method="libunwind" 3909bf6039f0SWarner Losh AC_DEFINE([JEMALLOC_PROF_LIBUNWIND], [ ]) 3910bf6039f0SWarner Losh fi 3911bf6039f0SWarner Loshfi 3912bf6039f0SWarner Losh 3913bf6039f0SWarner LoshAC_ARG_ENABLE([prof-libgcc], 3914bf6039f0SWarner Losh [AS_HELP_STRING([--disable-prof-libgcc], 3915bf6039f0SWarner Losh [Do not use libgcc for backtracing])], 3916bf6039f0SWarner Losh[if test "x$enable_prof_libgcc" = "xno" ; then 3917bf6039f0SWarner Losh enable_prof_libgcc="0" 3918bf6039f0SWarner Loshelse 3919bf6039f0SWarner Losh enable_prof_libgcc="1" 3920bf6039f0SWarner Loshfi 3921bf6039f0SWarner Losh], 3922bf6039f0SWarner Losh[enable_prof_libgcc="1"] 3923bf6039f0SWarner Losh) 3924bf6039f0SWarner Loshif test "x$backtrace_method" = "x" -a "x$enable_prof_libgcc" = "x1" \ 3925bf6039f0SWarner Losh -a "x$GCC" = "xyes" ; then 3926bf6039f0SWarner Losh AC_CHECK_HEADERS([unwind.h], , [enable_prof_libgcc="0"]) 3927bf6039f0SWarner Losh if test "x${enable_prof_libgcc}" = "x1" ; then 3928bf6039f0SWarner Losh AC_CHECK_LIB([gcc], [_Unwind_Backtrace], [JE_APPEND_VS(LIBS, -lgcc)], [enable_prof_libgcc="0"]) 3929bf6039f0SWarner Losh fi 3930bf6039f0SWarner Losh if test "x${enable_prof_libgcc}" = "x1" ; then 3931bf6039f0SWarner Losh backtrace_method="libgcc" 3932bf6039f0SWarner Losh AC_DEFINE([JEMALLOC_PROF_LIBGCC], [ ]) 3933bf6039f0SWarner Losh fi 3934bf6039f0SWarner Loshelse 3935bf6039f0SWarner Losh enable_prof_libgcc="0" 3936bf6039f0SWarner Loshfi 3937bf6039f0SWarner Losh 3938bf6039f0SWarner LoshAC_ARG_ENABLE([prof-gcc], 3939bf6039f0SWarner Losh [AS_HELP_STRING([--disable-prof-gcc], 3940bf6039f0SWarner Losh [Do not use gcc intrinsics for backtracing])], 3941bf6039f0SWarner Losh[if test "x$enable_prof_gcc" = "xno" ; then 3942bf6039f0SWarner Losh enable_prof_gcc="0" 3943bf6039f0SWarner Loshelse 3944bf6039f0SWarner Losh enable_prof_gcc="1" 3945bf6039f0SWarner Loshfi 3946bf6039f0SWarner Losh], 3947bf6039f0SWarner Losh[enable_prof_gcc="1"] 3948bf6039f0SWarner Losh) 3949bf6039f0SWarner Loshif test "x$backtrace_method" = "x" -a "x$enable_prof_gcc" = "x1" \ 3950bf6039f0SWarner Losh -a "x$GCC" = "xyes" ; then 3951bf6039f0SWarner Losh JE_CFLAGS_ADD([-fno-omit-frame-pointer]) 3952bf6039f0SWarner Losh backtrace_method="gcc intrinsics" 3953bf6039f0SWarner Losh AC_DEFINE([JEMALLOC_PROF_GCC], [ ]) 3954bf6039f0SWarner Loshelse 3955bf6039f0SWarner Losh enable_prof_gcc="0" 3956bf6039f0SWarner Loshfi 3957bf6039f0SWarner Losh 3958bf6039f0SWarner Loshif test "x$backtrace_method" = "x" ; then 3959bf6039f0SWarner Losh backtrace_method="none (disabling profiling)" 3960bf6039f0SWarner Losh enable_prof="0" 3961bf6039f0SWarner Loshfi 3962bf6039f0SWarner LoshAC_MSG_CHECKING([configured backtracing method]) 3963bf6039f0SWarner LoshAC_MSG_RESULT([$backtrace_method]) 3964bf6039f0SWarner Loshif test "x$enable_prof" = "x1" ; then 3965bf6039f0SWarner Losh dnl Heap profiling uses the log(3) function. 3966bf6039f0SWarner Losh JE_APPEND_VS(LIBS, $LM) 3967bf6039f0SWarner Losh 3968bf6039f0SWarner Losh AC_DEFINE([JEMALLOC_PROF], [ ]) 3969bf6039f0SWarner Loshfi 3970bf6039f0SWarner LoshAC_SUBST([enable_prof]) 3971bf6039f0SWarner Losh 3972bf6039f0SWarner Loshdnl Indicate whether adjacent virtual memory mappings automatically coalesce 3973bf6039f0SWarner Loshdnl (and fragment on demand). 3974bf6039f0SWarner Loshif test "x${maps_coalesce}" = "x1" ; then 3975bf6039f0SWarner Losh AC_DEFINE([JEMALLOC_MAPS_COALESCE], [ ]) 3976bf6039f0SWarner Loshfi 3977bf6039f0SWarner Losh 3978bf6039f0SWarner Loshdnl Indicate whether to retain memory (rather than using munmap()) by default. 3979bf6039f0SWarner Loshif test "x$default_retain" = "x1" ; then 3980bf6039f0SWarner Losh AC_DEFINE([JEMALLOC_RETAIN], [ ]) 3981bf6039f0SWarner Loshfi 3982bf6039f0SWarner Losh 3983bf6039f0SWarner Loshdnl Enable allocation from DSS if supported by the OS. 3984bf6039f0SWarner Loshhave_dss="1" 3985bf6039f0SWarner Loshdnl Check whether the BSD/SUSv1 sbrk() exists. If not, disable DSS support. 3986bf6039f0SWarner LoshAC_CHECK_FUNC([sbrk], [have_sbrk="1"], [have_sbrk="0"]) 3987bf6039f0SWarner Loshif test "x$have_sbrk" = "x1" ; then 3988bf6039f0SWarner Losh if test "x$sbrk_deprecated" = "x1" ; then 3989bf6039f0SWarner Losh AC_MSG_RESULT([Disabling dss allocation because sbrk is deprecated]) 3990bf6039f0SWarner Losh have_dss="0" 3991bf6039f0SWarner Losh fi 3992bf6039f0SWarner Loshelse 3993bf6039f0SWarner Losh have_dss="0" 3994bf6039f0SWarner Loshfi 3995bf6039f0SWarner Losh 3996bf6039f0SWarner Loshif test "x$have_dss" = "x1" ; then 3997bf6039f0SWarner Losh AC_DEFINE([JEMALLOC_DSS], [ ]) 3998bf6039f0SWarner Loshfi 3999bf6039f0SWarner Losh 4000bf6039f0SWarner Loshdnl Support the junk/zero filling option by default. 4001bf6039f0SWarner LoshAC_ARG_ENABLE([fill], 4002bf6039f0SWarner Losh [AS_HELP_STRING([--disable-fill], [Disable support for junk/zero filling])], 4003bf6039f0SWarner Losh[if test "x$enable_fill" = "xno" ; then 4004bf6039f0SWarner Losh enable_fill="0" 4005bf6039f0SWarner Loshelse 4006bf6039f0SWarner Losh enable_fill="1" 4007bf6039f0SWarner Loshfi 4008bf6039f0SWarner Losh], 4009bf6039f0SWarner Losh[enable_fill="1"] 4010bf6039f0SWarner Losh) 4011bf6039f0SWarner Loshif test "x$enable_fill" = "x1" ; then 4012bf6039f0SWarner Losh AC_DEFINE([JEMALLOC_FILL], [ ]) 4013bf6039f0SWarner Loshfi 4014bf6039f0SWarner LoshAC_SUBST([enable_fill]) 4015bf6039f0SWarner Losh 4016bf6039f0SWarner Loshdnl Disable utrace(2)-based tracing by default. 4017bf6039f0SWarner LoshAC_ARG_ENABLE([utrace], 4018bf6039f0SWarner Losh [AS_HELP_STRING([--enable-utrace], [Enable utrace(2)-based tracing])], 4019bf6039f0SWarner Losh[if test "x$enable_utrace" = "xno" ; then 4020bf6039f0SWarner Losh enable_utrace="0" 4021bf6039f0SWarner Loshelse 4022bf6039f0SWarner Losh enable_utrace="1" 4023bf6039f0SWarner Loshfi 4024bf6039f0SWarner Losh], 4025bf6039f0SWarner Losh[enable_utrace="0"] 4026bf6039f0SWarner Losh) 4027bf6039f0SWarner LoshJE_COMPILABLE([utrace(2)], [ 4028bf6039f0SWarner Losh#include <sys/types.h> 4029bf6039f0SWarner Losh#include <sys/param.h> 4030bf6039f0SWarner Losh#include <sys/time.h> 4031bf6039f0SWarner Losh#include <sys/uio.h> 4032bf6039f0SWarner Losh#include <sys/ktrace.h> 4033bf6039f0SWarner Losh], [ 4034bf6039f0SWarner Losh utrace((void *)0, 0); 4035bf6039f0SWarner Losh], [je_cv_utrace]) 4036bf6039f0SWarner Loshif test "x${je_cv_utrace}" = "xno" ; then 4037bf6039f0SWarner Losh enable_utrace="0" 4038bf6039f0SWarner Loshfi 4039bf6039f0SWarner Loshif test "x$enable_utrace" = "x1" ; then 4040bf6039f0SWarner Losh AC_DEFINE([JEMALLOC_UTRACE], [ ]) 4041bf6039f0SWarner Loshfi 4042bf6039f0SWarner LoshAC_SUBST([enable_utrace]) 4043bf6039f0SWarner Losh 4044bf6039f0SWarner Loshdnl Do not support the xmalloc option by default. 4045bf6039f0SWarner LoshAC_ARG_ENABLE([xmalloc], 4046bf6039f0SWarner Losh [AS_HELP_STRING([--enable-xmalloc], [Support xmalloc option])], 4047bf6039f0SWarner Losh[if test "x$enable_xmalloc" = "xno" ; then 4048bf6039f0SWarner Losh enable_xmalloc="0" 4049bf6039f0SWarner Loshelse 4050bf6039f0SWarner Losh enable_xmalloc="1" 4051bf6039f0SWarner Loshfi 4052bf6039f0SWarner Losh], 4053bf6039f0SWarner Losh[enable_xmalloc="0"] 4054bf6039f0SWarner Losh) 4055bf6039f0SWarner Loshif test "x$enable_xmalloc" = "x1" ; then 4056bf6039f0SWarner Losh AC_DEFINE([JEMALLOC_XMALLOC], [ ]) 4057bf6039f0SWarner Loshfi 4058bf6039f0SWarner LoshAC_SUBST([enable_xmalloc]) 4059bf6039f0SWarner Losh 4060bf6039f0SWarner Loshdnl Support cache-oblivious allocation alignment by default. 4061bf6039f0SWarner LoshAC_ARG_ENABLE([cache-oblivious], 4062bf6039f0SWarner Losh [AS_HELP_STRING([--disable-cache-oblivious], 4063bf6039f0SWarner Losh [Disable support for cache-oblivious allocation alignment])], 4064bf6039f0SWarner Losh[if test "x$enable_cache_oblivious" = "xno" ; then 4065bf6039f0SWarner Losh enable_cache_oblivious="0" 4066bf6039f0SWarner Loshelse 4067bf6039f0SWarner Losh enable_cache_oblivious="1" 4068bf6039f0SWarner Loshfi 4069bf6039f0SWarner Losh], 4070bf6039f0SWarner Losh[enable_cache_oblivious="1"] 4071bf6039f0SWarner Losh) 4072bf6039f0SWarner Loshif test "x$enable_cache_oblivious" = "x1" ; then 4073bf6039f0SWarner Losh AC_DEFINE([JEMALLOC_CACHE_OBLIVIOUS], [ ]) 4074bf6039f0SWarner Loshfi 4075bf6039f0SWarner LoshAC_SUBST([enable_cache_oblivious]) 4076bf6039f0SWarner Losh 4077bf6039f0SWarner Loshdnl Do not log by default. 4078bf6039f0SWarner LoshAC_ARG_ENABLE([log], 4079bf6039f0SWarner Losh [AS_HELP_STRING([--enable-log], [Support debug logging])], 4080bf6039f0SWarner Losh[if test "x$enable_log" = "xno" ; then 4081bf6039f0SWarner Losh enable_log="0" 4082bf6039f0SWarner Loshelse 4083bf6039f0SWarner Losh enable_log="1" 4084bf6039f0SWarner Loshfi 4085bf6039f0SWarner Losh], 4086bf6039f0SWarner Losh[enable_log="0"] 4087bf6039f0SWarner Losh) 4088bf6039f0SWarner Loshif test "x$enable_log" = "x1" ; then 4089bf6039f0SWarner Losh AC_DEFINE([JEMALLOC_LOG], [ ]) 4090bf6039f0SWarner Loshfi 4091bf6039f0SWarner LoshAC_SUBST([enable_log]) 4092bf6039f0SWarner Losh 4093bf6039f0SWarner Loshdnl Do not use readlinkat by default 4094bf6039f0SWarner LoshAC_ARG_ENABLE([readlinkat], 4095bf6039f0SWarner Losh [AS_HELP_STRING([--enable-readlinkat], [Use readlinkat over readlink])], 4096bf6039f0SWarner Losh[if test "x$enable_readlinkat" = "xno" ; then 4097bf6039f0SWarner Losh enable_readlinkat="0" 4098bf6039f0SWarner Loshelse 4099bf6039f0SWarner Losh enable_readlinkat="1" 4100bf6039f0SWarner Loshfi 4101bf6039f0SWarner Losh], 4102bf6039f0SWarner Losh[enable_readlinkat="0"] 4103bf6039f0SWarner Losh) 4104bf6039f0SWarner Loshif test "x$enable_readlinkat" = "x1" ; then 4105bf6039f0SWarner Losh AC_DEFINE([JEMALLOC_READLINKAT], [ ]) 4106bf6039f0SWarner Loshfi 4107bf6039f0SWarner LoshAC_SUBST([enable_readlinkat]) 4108bf6039f0SWarner Losh 4109bf6039f0SWarner Loshdnl Avoid extra safety checks by default 4110bf6039f0SWarner LoshAC_ARG_ENABLE([opt-safety-checks], 4111bf6039f0SWarner Losh [AS_HELP_STRING([--enable-opt-safety-checks], 4112bf6039f0SWarner Losh [Perform certain low-overhead checks, even in opt mode])], 4113bf6039f0SWarner Losh[if test "x$enable_opt_safety_checks" = "xno" ; then 4114bf6039f0SWarner Losh enable_opt_safety_checks="0" 4115bf6039f0SWarner Loshelse 4116bf6039f0SWarner Losh enable_opt_safety_checks="1" 4117bf6039f0SWarner Loshfi 4118bf6039f0SWarner Losh], 4119bf6039f0SWarner Losh[enable_opt_safety_checks="0"] 4120bf6039f0SWarner Losh) 4121bf6039f0SWarner Loshif test "x$enable_opt_safety_checks" = "x1" ; then 4122bf6039f0SWarner Losh AC_DEFINE([JEMALLOC_OPT_SAFETY_CHECKS], [ ]) 4123bf6039f0SWarner Loshfi 4124bf6039f0SWarner LoshAC_SUBST([enable_opt_safety_checks]) 4125bf6039f0SWarner Losh 4126bf6039f0SWarner LoshJE_COMPILABLE([a program using __builtin_unreachable], [ 4127bf6039f0SWarner Loshvoid foo (void) { 4128bf6039f0SWarner Losh __builtin_unreachable(); 4129bf6039f0SWarner Losh} 4130bf6039f0SWarner Losh], [ 4131bf6039f0SWarner Losh { 4132bf6039f0SWarner Losh foo(); 4133bf6039f0SWarner Losh } 4134bf6039f0SWarner Losh], [je_cv_gcc_builtin_unreachable]) 4135bf6039f0SWarner Loshif test "x${je_cv_gcc_builtin_unreachable}" = "xyes" ; then 4136bf6039f0SWarner Losh AC_DEFINE([JEMALLOC_INTERNAL_UNREACHABLE], [__builtin_unreachable]) 4137bf6039f0SWarner Loshelse 4138bf6039f0SWarner Losh AC_DEFINE([JEMALLOC_INTERNAL_UNREACHABLE], [abort]) 4139bf6039f0SWarner Loshfi 4140bf6039f0SWarner Losh 4141bf6039f0SWarner Loshdnl ============================================================================ 4142bf6039f0SWarner Loshdnl Check for __builtin_ffsl(), then ffsl(3), and fail if neither are found. 4143bf6039f0SWarner Loshdnl One of those two functions should (theoretically) exist on all platforms 4144bf6039f0SWarner Loshdnl that jemalloc currently has a chance of functioning on without modification. 4145bf6039f0SWarner Loshdnl We additionally assume ffs[ll]() or __builtin_ffs[ll]() are defined if 4146bf6039f0SWarner Loshdnl ffsl() or __builtin_ffsl() are defined, respectively. 4147bf6039f0SWarner LoshJE_COMPILABLE([a program using __builtin_ffsl], [ 4148bf6039f0SWarner Losh#include <stdio.h> 4149bf6039f0SWarner Losh#include <strings.h> 4150bf6039f0SWarner Losh#include <string.h> 4151bf6039f0SWarner Losh], [ 4152bf6039f0SWarner Losh { 4153bf6039f0SWarner Losh int rv = __builtin_ffsl(0x08); 4154bf6039f0SWarner Losh printf("%d\n", rv); 4155bf6039f0SWarner Losh } 4156bf6039f0SWarner Losh], [je_cv_gcc_builtin_ffsl]) 4157bf6039f0SWarner Loshif test "x${je_cv_gcc_builtin_ffsl}" = "xyes" ; then 4158bf6039f0SWarner Losh AC_DEFINE([JEMALLOC_INTERNAL_FFSLL], [__builtin_ffsll]) 4159bf6039f0SWarner Losh AC_DEFINE([JEMALLOC_INTERNAL_FFSL], [__builtin_ffsl]) 4160bf6039f0SWarner Losh AC_DEFINE([JEMALLOC_INTERNAL_FFS], [__builtin_ffs]) 4161bf6039f0SWarner Loshelse 4162bf6039f0SWarner Losh JE_COMPILABLE([a program using ffsl], [ 4163bf6039f0SWarner Losh #include <stdio.h> 4164bf6039f0SWarner Losh #include <strings.h> 4165bf6039f0SWarner Losh #include <string.h> 4166bf6039f0SWarner Losh ], [ 4167bf6039f0SWarner Losh { 4168bf6039f0SWarner Losh int rv = ffsl(0x08); 4169bf6039f0SWarner Losh printf("%d\n", rv); 4170bf6039f0SWarner Losh } 4171bf6039f0SWarner Losh ], [je_cv_function_ffsl]) 4172bf6039f0SWarner Losh if test "x${je_cv_function_ffsl}" = "xyes" ; then 4173bf6039f0SWarner Losh AC_DEFINE([JEMALLOC_INTERNAL_FFSLL], [ffsll]) 4174bf6039f0SWarner Losh AC_DEFINE([JEMALLOC_INTERNAL_FFSL], [ffsl]) 4175bf6039f0SWarner Losh AC_DEFINE([JEMALLOC_INTERNAL_FFS], [ffs]) 4176bf6039f0SWarner Losh else 4177bf6039f0SWarner Losh AC_MSG_ERROR([Cannot build without ffsl(3) or __builtin_ffsl()]) 4178bf6039f0SWarner Losh fi 4179bf6039f0SWarner Loshfi 4180bf6039f0SWarner Losh 4181bf6039f0SWarner LoshJE_COMPILABLE([a program using __builtin_popcountl], [ 4182bf6039f0SWarner Losh#include <stdio.h> 4183bf6039f0SWarner Losh#include <strings.h> 4184bf6039f0SWarner Losh#include <string.h> 4185bf6039f0SWarner Losh], [ 4186bf6039f0SWarner Losh { 4187bf6039f0SWarner Losh int rv = __builtin_popcountl(0x08); 4188bf6039f0SWarner Losh printf("%d\n", rv); 4189bf6039f0SWarner Losh } 4190bf6039f0SWarner Losh], [je_cv_gcc_builtin_popcountl]) 4191bf6039f0SWarner Loshif test "x${je_cv_gcc_builtin_popcountl}" = "xyes" ; then 4192bf6039f0SWarner Losh AC_DEFINE([JEMALLOC_INTERNAL_POPCOUNT], [__builtin_popcount]) 4193bf6039f0SWarner Losh AC_DEFINE([JEMALLOC_INTERNAL_POPCOUNTL], [__builtin_popcountl]) 4194bf6039f0SWarner Loshfi 4195bf6039f0SWarner Losh 4196bf6039f0SWarner LoshAC_ARG_WITH([lg_quantum], 4197bf6039f0SWarner Losh [AS_HELP_STRING([--with-lg-quantum=<lg-quantum>], 4198bf6039f0SWarner Losh [Base 2 log of minimum allocation alignment])], 4199bf6039f0SWarner Losh [LG_QUANTA="$with_lg_quantum"], 4200bf6039f0SWarner Losh [LG_QUANTA="3 4"]) 4201bf6039f0SWarner Loshif test "x$with_lg_quantum" != "x" ; then 4202bf6039f0SWarner Losh AC_DEFINE_UNQUOTED([LG_QUANTUM], [$with_lg_quantum]) 4203bf6039f0SWarner Loshfi 4204bf6039f0SWarner Losh 4205bf6039f0SWarner LoshAC_ARG_WITH([lg_page], 4206bf6039f0SWarner Losh [AS_HELP_STRING([--with-lg-page=<lg-page>], [Base 2 log of system page size])], 4207bf6039f0SWarner Losh [LG_PAGE="$with_lg_page"], [LG_PAGE="detect"]) 4208bf6039f0SWarner Loshif test "x$LG_PAGE" = "xdetect"; then 4209bf6039f0SWarner Losh AC_CACHE_CHECK([LG_PAGE], 4210bf6039f0SWarner Losh [je_cv_lg_page], 4211bf6039f0SWarner Losh AC_RUN_IFELSE([AC_LANG_PROGRAM( 4212bf6039f0SWarner Losh[[ 4213bf6039f0SWarner Losh#include <strings.h> 4214bf6039f0SWarner Losh#ifdef _WIN32 4215bf6039f0SWarner Losh#include <windows.h> 4216bf6039f0SWarner Losh#else 4217bf6039f0SWarner Losh#include <unistd.h> 4218bf6039f0SWarner Losh#endif 4219bf6039f0SWarner Losh#include <stdio.h> 4220bf6039f0SWarner Losh]], 4221bf6039f0SWarner Losh[[ 4222bf6039f0SWarner Losh int result; 4223bf6039f0SWarner Losh FILE *f; 4224bf6039f0SWarner Losh 4225bf6039f0SWarner Losh#ifdef _WIN32 4226bf6039f0SWarner Losh SYSTEM_INFO si; 4227bf6039f0SWarner Losh GetSystemInfo(&si); 4228bf6039f0SWarner Losh result = si.dwPageSize; 4229bf6039f0SWarner Losh#else 4230bf6039f0SWarner Losh result = sysconf(_SC_PAGESIZE); 4231bf6039f0SWarner Losh#endif 4232bf6039f0SWarner Losh if (result == -1) { 4233bf6039f0SWarner Losh return 1; 4234bf6039f0SWarner Losh } 4235bf6039f0SWarner Losh result = JEMALLOC_INTERNAL_FFSL(result) - 1; 4236bf6039f0SWarner Losh 4237bf6039f0SWarner Losh f = fopen("conftest.out", "w"); 4238bf6039f0SWarner Losh if (f == NULL) { 4239bf6039f0SWarner Losh return 1; 4240bf6039f0SWarner Losh } 4241bf6039f0SWarner Losh fprintf(f, "%d", result); 4242bf6039f0SWarner Losh fclose(f); 4243bf6039f0SWarner Losh 4244bf6039f0SWarner Losh return 0; 4245bf6039f0SWarner Losh]])], 4246bf6039f0SWarner Losh [je_cv_lg_page=`cat conftest.out`], 4247bf6039f0SWarner Losh [je_cv_lg_page=undefined], 4248bf6039f0SWarner Losh [je_cv_lg_page=12])) 4249bf6039f0SWarner Loshfi 4250bf6039f0SWarner Loshif test "x${je_cv_lg_page}" != "x" ; then 4251bf6039f0SWarner Losh LG_PAGE="${je_cv_lg_page}" 4252bf6039f0SWarner Loshfi 4253bf6039f0SWarner Loshif test "x${LG_PAGE}" != "xundefined" ; then 4254bf6039f0SWarner Losh AC_DEFINE_UNQUOTED([LG_PAGE], [$LG_PAGE]) 4255bf6039f0SWarner Loshelse 4256bf6039f0SWarner Losh AC_MSG_ERROR([cannot determine value for LG_PAGE]) 4257bf6039f0SWarner Loshfi 4258bf6039f0SWarner Losh 4259bf6039f0SWarner LoshAC_ARG_WITH([lg_hugepage], 4260bf6039f0SWarner Losh [AS_HELP_STRING([--with-lg-hugepage=<lg-hugepage>], 4261bf6039f0SWarner Losh [Base 2 log of system huge page size])], 4262bf6039f0SWarner Losh [je_cv_lg_hugepage="${with_lg_hugepage}"], 4263bf6039f0SWarner Losh [je_cv_lg_hugepage=""]) 4264bf6039f0SWarner Loshif test "x${je_cv_lg_hugepage}" = "x" ; then 4265bf6039f0SWarner Losh dnl Look in /proc/meminfo (Linux-specific) for information on the default huge 4266bf6039f0SWarner Losh dnl page size, if any. The relevant line looks like: 4267bf6039f0SWarner Losh dnl 4268bf6039f0SWarner Losh dnl Hugepagesize: 2048 kB 4269bf6039f0SWarner Losh if test -e "/proc/meminfo" ; then 4270bf6039f0SWarner Losh hpsk=[`cat /proc/meminfo 2>/dev/null | \ 4271bf6039f0SWarner Losh grep -e '^Hugepagesize:[[:space:]]\+[0-9]\+[[:space:]]kB$' | \ 4272bf6039f0SWarner Losh awk '{print $2}'`] 4273bf6039f0SWarner Losh if test "x${hpsk}" != "x" ; then 4274bf6039f0SWarner Losh je_cv_lg_hugepage=10 4275bf6039f0SWarner Losh while test "${hpsk}" -gt 1 ; do 4276bf6039f0SWarner Losh hpsk="$((hpsk / 2))" 4277bf6039f0SWarner Losh je_cv_lg_hugepage="$((je_cv_lg_hugepage + 1))" 4278bf6039f0SWarner Losh done 4279bf6039f0SWarner Losh fi 4280bf6039f0SWarner Losh fi 4281bf6039f0SWarner Losh 4282bf6039f0SWarner Losh dnl Set default if unable to automatically configure. 4283bf6039f0SWarner Losh if test "x${je_cv_lg_hugepage}" = "x" ; then 4284bf6039f0SWarner Losh je_cv_lg_hugepage=21 4285bf6039f0SWarner Losh fi 4286bf6039f0SWarner Loshfi 4287bf6039f0SWarner Loshif test "x${LG_PAGE}" != "xundefined" -a \ 4288bf6039f0SWarner Losh "${je_cv_lg_hugepage}" -lt "${LG_PAGE}" ; then 4289bf6039f0SWarner Losh AC_MSG_ERROR([Huge page size (2^${je_cv_lg_hugepage}) must be at least page size (2^${LG_PAGE})]) 4290bf6039f0SWarner Loshfi 4291bf6039f0SWarner LoshAC_DEFINE_UNQUOTED([LG_HUGEPAGE], [${je_cv_lg_hugepage}]) 4292bf6039f0SWarner Losh 4293bf6039f0SWarner Loshdnl ============================================================================ 4294bf6039f0SWarner Loshdnl Enable libdl by default. 4295bf6039f0SWarner LoshAC_ARG_ENABLE([libdl], 4296bf6039f0SWarner Losh [AS_HELP_STRING([--disable-libdl], 4297bf6039f0SWarner Losh [Do not use libdl])], 4298bf6039f0SWarner Losh[if test "x$enable_libdl" = "xno" ; then 4299bf6039f0SWarner Losh enable_libdl="0" 4300bf6039f0SWarner Loshelse 4301bf6039f0SWarner Losh enable_libdl="1" 4302bf6039f0SWarner Loshfi 4303bf6039f0SWarner Losh], 4304bf6039f0SWarner Losh[enable_libdl="1"] 4305bf6039f0SWarner Losh) 4306bf6039f0SWarner LoshAC_SUBST([libdl]) 4307bf6039f0SWarner Losh 4308bf6039f0SWarner Loshdnl ============================================================================ 4309bf6039f0SWarner Loshdnl Configure pthreads. 4310bf6039f0SWarner Losh 4311bf6039f0SWarner Loshif test "x$abi" != "xpecoff" ; then 4312bf6039f0SWarner Losh AC_DEFINE([JEMALLOC_HAVE_PTHREAD], [ ]) 4313bf6039f0SWarner Losh AC_CHECK_HEADERS([pthread.h], , [AC_MSG_ERROR([pthread.h is missing])]) 4314bf6039f0SWarner Losh dnl Some systems may embed pthreads functionality in libc; check for libpthread 4315bf6039f0SWarner Losh dnl first, but try libc too before failing. 4316bf6039f0SWarner Losh AC_CHECK_LIB([pthread], [pthread_create], [JE_APPEND_VS(LIBS, -pthread)], 4317bf6039f0SWarner Losh [AC_SEARCH_LIBS([pthread_create], , , 4318bf6039f0SWarner Losh AC_MSG_ERROR([libpthread is missing]))]) 4319bf6039f0SWarner Losh wrap_syms="${wrap_syms} pthread_create" 4320bf6039f0SWarner Losh have_pthread="1" 4321bf6039f0SWarner Losh 4322bf6039f0SWarner Loshdnl Check if we have dlsym support. 4323bf6039f0SWarner Losh if test "x$enable_libdl" = "x1" ; then 4324bf6039f0SWarner Losh have_dlsym="1" 4325bf6039f0SWarner Losh AC_CHECK_HEADERS([dlfcn.h], 4326bf6039f0SWarner Losh AC_CHECK_FUNC([dlsym], [], 4327bf6039f0SWarner Losh [AC_CHECK_LIB([dl], [dlsym], [LIBS="$LIBS -ldl"], [have_dlsym="0"])]), 4328bf6039f0SWarner Losh [have_dlsym="0"]) 4329bf6039f0SWarner Losh if test "x$have_dlsym" = "x1" ; then 4330bf6039f0SWarner Losh AC_DEFINE([JEMALLOC_HAVE_DLSYM], [ ]) 4331bf6039f0SWarner Losh fi 4332bf6039f0SWarner Losh else 4333bf6039f0SWarner Losh have_dlsym="0" 4334bf6039f0SWarner Losh fi 4335bf6039f0SWarner Losh 4336bf6039f0SWarner Losh JE_COMPILABLE([pthread_atfork(3)], [ 4337bf6039f0SWarner Losh#include <pthread.h> 4338bf6039f0SWarner Losh], [ 4339bf6039f0SWarner Losh pthread_atfork((void *)0, (void *)0, (void *)0); 4340bf6039f0SWarner Losh], [je_cv_pthread_atfork]) 4341bf6039f0SWarner Losh if test "x${je_cv_pthread_atfork}" = "xyes" ; then 4342bf6039f0SWarner Losh AC_DEFINE([JEMALLOC_HAVE_PTHREAD_ATFORK], [ ]) 4343bf6039f0SWarner Losh fi 4344bf6039f0SWarner Losh dnl Check if pthread_setname_np is available with the expected API. 4345bf6039f0SWarner Losh JE_COMPILABLE([pthread_setname_np(3)], [ 4346bf6039f0SWarner Losh#include <pthread.h> 4347bf6039f0SWarner Losh], [ 4348bf6039f0SWarner Losh pthread_setname_np(pthread_self(), "setname_test"); 4349bf6039f0SWarner Losh], [je_cv_pthread_setname_np]) 4350bf6039f0SWarner Losh if test "x${je_cv_pthread_setname_np}" = "xyes" ; then 4351bf6039f0SWarner Losh AC_DEFINE([JEMALLOC_HAVE_PTHREAD_SETNAME_NP], [ ]) 4352bf6039f0SWarner Losh fi 4353bf6039f0SWarner Loshfi 4354bf6039f0SWarner Losh 4355bf6039f0SWarner LoshJE_APPEND_VS(CPPFLAGS, -D_REENTRANT) 4356bf6039f0SWarner Losh 4357bf6039f0SWarner Loshdnl Check whether clock_gettime(2) is in libc or librt. 4358bf6039f0SWarner LoshAC_SEARCH_LIBS([clock_gettime], [rt]) 4359bf6039f0SWarner Losh 4360bf6039f0SWarner Loshdnl Cray wrapper compiler often adds `-lrt` when using `-static`. Check with 4361bf6039f0SWarner Loshdnl `-dynamic` as well in case a user tries to dynamically link in jemalloc 4362bf6039f0SWarner Loshif test "x$je_cv_cray_prgenv_wrapper" = "xyes" ; then 4363bf6039f0SWarner Losh if test "$ac_cv_search_clock_gettime" != "-lrt"; then 4364bf6039f0SWarner Losh JE_CFLAGS_SAVE() 4365bf6039f0SWarner Losh 4366bf6039f0SWarner Losh unset ac_cv_search_clock_gettime 4367bf6039f0SWarner Losh JE_CFLAGS_ADD([-dynamic]) 4368bf6039f0SWarner Losh AC_SEARCH_LIBS([clock_gettime], [rt]) 4369bf6039f0SWarner Losh 4370bf6039f0SWarner Losh JE_CFLAGS_RESTORE() 4371bf6039f0SWarner Losh fi 4372bf6039f0SWarner Loshfi 4373bf6039f0SWarner Losh 4374bf6039f0SWarner Loshdnl check for CLOCK_MONOTONIC_COARSE (Linux-specific). 4375bf6039f0SWarner LoshJE_COMPILABLE([clock_gettime(CLOCK_MONOTONIC_COARSE, ...)], [ 4376bf6039f0SWarner Losh#include <time.h> 4377bf6039f0SWarner Losh], [ 4378bf6039f0SWarner Losh struct timespec ts; 4379bf6039f0SWarner Losh 4380bf6039f0SWarner Losh clock_gettime(CLOCK_MONOTONIC_COARSE, &ts); 4381bf6039f0SWarner Losh], [je_cv_clock_monotonic_coarse]) 4382bf6039f0SWarner Loshif test "x${je_cv_clock_monotonic_coarse}" = "xyes" ; then 4383bf6039f0SWarner Losh AC_DEFINE([JEMALLOC_HAVE_CLOCK_MONOTONIC_COARSE]) 4384bf6039f0SWarner Loshfi 4385bf6039f0SWarner Losh 4386bf6039f0SWarner Loshdnl check for CLOCK_MONOTONIC. 4387bf6039f0SWarner LoshJE_COMPILABLE([clock_gettime(CLOCK_MONOTONIC, ...)], [ 4388bf6039f0SWarner Losh#include <unistd.h> 4389bf6039f0SWarner Losh#include <time.h> 4390bf6039f0SWarner Losh], [ 4391bf6039f0SWarner Losh struct timespec ts; 4392bf6039f0SWarner Losh 4393bf6039f0SWarner Losh clock_gettime(CLOCK_MONOTONIC, &ts); 4394bf6039f0SWarner Losh#if !defined(_POSIX_MONOTONIC_CLOCK) || _POSIX_MONOTONIC_CLOCK < 0 4395bf6039f0SWarner Losh# error _POSIX_MONOTONIC_CLOCK missing/invalid 4396bf6039f0SWarner Losh#endif 4397bf6039f0SWarner Losh], [je_cv_clock_monotonic]) 4398bf6039f0SWarner Loshif test "x${je_cv_clock_monotonic}" = "xyes" ; then 4399bf6039f0SWarner Losh AC_DEFINE([JEMALLOC_HAVE_CLOCK_MONOTONIC]) 4400bf6039f0SWarner Loshfi 4401bf6039f0SWarner Losh 4402bf6039f0SWarner Loshdnl Check for mach_absolute_time(). 4403bf6039f0SWarner LoshJE_COMPILABLE([mach_absolute_time()], [ 4404bf6039f0SWarner Losh#include <mach/mach_time.h> 4405bf6039f0SWarner Losh], [ 4406bf6039f0SWarner Losh mach_absolute_time(); 4407bf6039f0SWarner Losh], [je_cv_mach_absolute_time]) 4408bf6039f0SWarner Loshif test "x${je_cv_mach_absolute_time}" = "xyes" ; then 4409bf6039f0SWarner Losh AC_DEFINE([JEMALLOC_HAVE_MACH_ABSOLUTE_TIME]) 4410bf6039f0SWarner Loshfi 4411bf6039f0SWarner Losh 4412bf6039f0SWarner Loshdnl Use syscall(2) (if available) by default. 4413bf6039f0SWarner LoshAC_ARG_ENABLE([syscall], 4414bf6039f0SWarner Losh [AS_HELP_STRING([--disable-syscall], [Disable use of syscall(2)])], 4415bf6039f0SWarner Losh[if test "x$enable_syscall" = "xno" ; then 4416bf6039f0SWarner Losh enable_syscall="0" 4417bf6039f0SWarner Loshelse 4418bf6039f0SWarner Losh enable_syscall="1" 4419bf6039f0SWarner Loshfi 4420bf6039f0SWarner Losh], 4421bf6039f0SWarner Losh[enable_syscall="1"] 4422bf6039f0SWarner Losh) 4423bf6039f0SWarner Loshif test "x$enable_syscall" = "x1" ; then 4424bf6039f0SWarner Losh dnl Check if syscall(2) is usable. Treat warnings as errors, so that e.g. OS 4425bf6039f0SWarner Losh dnl X 10.12's deprecation warning prevents use. 4426bf6039f0SWarner Losh JE_CFLAGS_SAVE() 4427bf6039f0SWarner Losh JE_CFLAGS_ADD([-Werror]) 4428bf6039f0SWarner Losh JE_COMPILABLE([syscall(2)], [ 4429bf6039f0SWarner Losh#include <sys/syscall.h> 4430bf6039f0SWarner Losh#include <unistd.h> 4431bf6039f0SWarner Losh], [ 4432bf6039f0SWarner Losh syscall(SYS_write, 2, "hello", 5); 4433bf6039f0SWarner Losh], 4434bf6039f0SWarner Losh [je_cv_syscall]) 4435bf6039f0SWarner Losh JE_CFLAGS_RESTORE() 4436bf6039f0SWarner Losh if test "x$je_cv_syscall" = "xyes" ; then 4437bf6039f0SWarner Losh AC_DEFINE([JEMALLOC_USE_SYSCALL], [ ]) 4438bf6039f0SWarner Losh fi 4439bf6039f0SWarner Loshfi 4440bf6039f0SWarner Losh 4441bf6039f0SWarner Loshdnl Check if the GNU-specific secure_getenv function exists. 4442bf6039f0SWarner LoshAC_CHECK_FUNC([secure_getenv], 4443bf6039f0SWarner Losh [have_secure_getenv="1"], 4444bf6039f0SWarner Losh [have_secure_getenv="0"] 4445bf6039f0SWarner Losh ) 4446bf6039f0SWarner Loshif test "x$have_secure_getenv" = "x1" ; then 4447bf6039f0SWarner Losh AC_DEFINE([JEMALLOC_HAVE_SECURE_GETENV], [ ]) 4448bf6039f0SWarner Loshfi 4449bf6039f0SWarner Losh 4450bf6039f0SWarner Loshdnl Check if the GNU-specific sched_getcpu function exists. 4451bf6039f0SWarner LoshAC_CHECK_FUNC([sched_getcpu], 4452bf6039f0SWarner Losh [have_sched_getcpu="1"], 4453bf6039f0SWarner Losh [have_sched_getcpu="0"] 4454bf6039f0SWarner Losh ) 4455bf6039f0SWarner Loshif test "x$have_sched_getcpu" = "x1" ; then 4456bf6039f0SWarner Losh AC_DEFINE([JEMALLOC_HAVE_SCHED_GETCPU], [ ]) 4457bf6039f0SWarner Loshfi 4458bf6039f0SWarner Losh 4459bf6039f0SWarner Loshdnl Check if the GNU-specific sched_setaffinity function exists. 4460bf6039f0SWarner LoshAC_CHECK_FUNC([sched_setaffinity], 4461bf6039f0SWarner Losh [have_sched_setaffinity="1"], 4462bf6039f0SWarner Losh [have_sched_setaffinity="0"] 4463bf6039f0SWarner Losh ) 4464bf6039f0SWarner Loshif test "x$have_sched_setaffinity" = "x1" ; then 4465bf6039f0SWarner Losh AC_DEFINE([JEMALLOC_HAVE_SCHED_SETAFFINITY], [ ]) 4466bf6039f0SWarner Loshfi 4467bf6039f0SWarner Losh 4468bf6039f0SWarner Loshdnl Check if the Solaris/BSD issetugid function exists. 4469bf6039f0SWarner LoshAC_CHECK_FUNC([issetugid], 4470bf6039f0SWarner Losh [have_issetugid="1"], 4471bf6039f0SWarner Losh [have_issetugid="0"] 4472bf6039f0SWarner Losh ) 4473bf6039f0SWarner Loshif test "x$have_issetugid" = "x1" ; then 4474bf6039f0SWarner Losh AC_DEFINE([JEMALLOC_HAVE_ISSETUGID], [ ]) 4475bf6039f0SWarner Loshfi 4476bf6039f0SWarner Losh 4477bf6039f0SWarner Loshdnl Check whether the BSD-specific _malloc_thread_cleanup() exists. If so, use 4478bf6039f0SWarner Loshdnl it rather than pthreads TSD cleanup functions to support cleanup during 4479bf6039f0SWarner Loshdnl thread exit, in order to avoid pthreads library recursion during 4480bf6039f0SWarner Loshdnl bootstrapping. 4481bf6039f0SWarner LoshAC_CHECK_FUNC([_malloc_thread_cleanup], 4482bf6039f0SWarner Losh [have__malloc_thread_cleanup="1"], 4483bf6039f0SWarner Losh [have__malloc_thread_cleanup="0"] 4484bf6039f0SWarner Losh ) 4485bf6039f0SWarner Loshif test "x$have__malloc_thread_cleanup" = "x1" ; then 4486bf6039f0SWarner Losh AC_DEFINE([JEMALLOC_MALLOC_THREAD_CLEANUP], [ ]) 4487bf6039f0SWarner Losh wrap_syms="${wrap_syms} _malloc_thread_cleanup" 4488bf6039f0SWarner Losh force_tls="1" 4489bf6039f0SWarner Loshfi 4490bf6039f0SWarner Losh 4491bf6039f0SWarner Loshdnl Check whether the BSD-specific _pthread_mutex_init_calloc_cb() exists. If 4492bf6039f0SWarner Loshdnl so, mutex initialization causes allocation, and we need to implement this 4493bf6039f0SWarner Loshdnl callback function in order to prevent recursive allocation. 4494bf6039f0SWarner LoshAC_CHECK_FUNC([_pthread_mutex_init_calloc_cb], 4495bf6039f0SWarner Losh [have__pthread_mutex_init_calloc_cb="1"], 4496bf6039f0SWarner Losh [have__pthread_mutex_init_calloc_cb="0"] 4497bf6039f0SWarner Losh ) 4498bf6039f0SWarner Loshif test "x$have__pthread_mutex_init_calloc_cb" = "x1" ; then 4499bf6039f0SWarner Losh AC_DEFINE([JEMALLOC_MUTEX_INIT_CB]) 4500bf6039f0SWarner Losh wrap_syms="${wrap_syms} _malloc_prefork _malloc_postfork" 4501bf6039f0SWarner Loshfi 4502bf6039f0SWarner Losh 4503bf6039f0SWarner Loshdnl Disable lazy locking by default. 4504bf6039f0SWarner LoshAC_ARG_ENABLE([lazy_lock], 4505bf6039f0SWarner Losh [AS_HELP_STRING([--enable-lazy-lock], 4506bf6039f0SWarner Losh [Enable lazy locking (only lock when multi-threaded)])], 4507bf6039f0SWarner Losh[if test "x$enable_lazy_lock" = "xno" ; then 4508bf6039f0SWarner Losh enable_lazy_lock="0" 4509bf6039f0SWarner Loshelse 4510bf6039f0SWarner Losh enable_lazy_lock="1" 4511bf6039f0SWarner Loshfi 4512bf6039f0SWarner Losh], 4513bf6039f0SWarner Losh[enable_lazy_lock=""] 4514bf6039f0SWarner Losh) 4515bf6039f0SWarner Loshif test "x${enable_lazy_lock}" = "x" ; then 4516bf6039f0SWarner Losh if test "x${force_lazy_lock}" = "x1" ; then 4517bf6039f0SWarner Losh AC_MSG_RESULT([Forcing lazy-lock to avoid allocator/threading bootstrap issues]) 4518bf6039f0SWarner Losh enable_lazy_lock="1" 4519bf6039f0SWarner Losh else 4520bf6039f0SWarner Losh enable_lazy_lock="0" 4521bf6039f0SWarner Losh fi 4522bf6039f0SWarner Loshfi 4523bf6039f0SWarner Loshif test "x${enable_lazy_lock}" = "x1" -a "x${abi}" = "xpecoff" ; then 4524bf6039f0SWarner Losh AC_MSG_RESULT([Forcing no lazy-lock because thread creation monitoring is unimplemented]) 4525bf6039f0SWarner Losh enable_lazy_lock="0" 4526bf6039f0SWarner Loshfi 4527bf6039f0SWarner Loshif test "x$enable_lazy_lock" = "x1" ; then 4528bf6039f0SWarner Losh if test "x$have_dlsym" = "x1" ; then 4529bf6039f0SWarner Losh AC_DEFINE([JEMALLOC_LAZY_LOCK], [ ]) 4530bf6039f0SWarner Losh else 4531bf6039f0SWarner Losh AC_MSG_ERROR([Missing dlsym support: lazy-lock cannot be enabled.]) 4532bf6039f0SWarner Losh fi 4533bf6039f0SWarner Loshfi 4534bf6039f0SWarner LoshAC_SUBST([enable_lazy_lock]) 4535bf6039f0SWarner Losh 4536bf6039f0SWarner Loshdnl Automatically configure TLS. 4537bf6039f0SWarner Loshif test "x${force_tls}" = "x1" ; then 4538bf6039f0SWarner Losh enable_tls="1" 4539bf6039f0SWarner Loshelif test "x${force_tls}" = "x0" ; then 4540bf6039f0SWarner Losh enable_tls="0" 4541bf6039f0SWarner Loshelse 4542bf6039f0SWarner Losh enable_tls="1" 4543bf6039f0SWarner Loshfi 4544bf6039f0SWarner Loshif test "x${enable_tls}" = "x1" ; then 4545bf6039f0SWarner LoshAC_MSG_CHECKING([for TLS]) 4546bf6039f0SWarner LoshAC_COMPILE_IFELSE([AC_LANG_PROGRAM( 4547bf6039f0SWarner Losh[[ 4548bf6039f0SWarner Losh __thread int x; 4549bf6039f0SWarner Losh]], [[ 4550bf6039f0SWarner Losh x = 42; 4551bf6039f0SWarner Losh 4552bf6039f0SWarner Losh return 0; 4553bf6039f0SWarner Losh]])], 4554bf6039f0SWarner Losh AC_MSG_RESULT([yes]), 4555bf6039f0SWarner Losh AC_MSG_RESULT([no]) 4556bf6039f0SWarner Losh enable_tls="0") 4557bf6039f0SWarner Loshelse 4558bf6039f0SWarner Losh enable_tls="0" 4559bf6039f0SWarner Loshfi 4560bf6039f0SWarner LoshAC_SUBST([enable_tls]) 4561bf6039f0SWarner Loshif test "x${enable_tls}" = "x1" ; then 4562bf6039f0SWarner Losh AC_DEFINE_UNQUOTED([JEMALLOC_TLS], [ ]) 4563bf6039f0SWarner Loshfi 4564bf6039f0SWarner Losh 4565bf6039f0SWarner Loshdnl ============================================================================ 4566bf6039f0SWarner Loshdnl Check for C11 atomics. 4567bf6039f0SWarner Losh 4568bf6039f0SWarner LoshJE_COMPILABLE([C11 atomics], [ 4569bf6039f0SWarner Losh#include <stdint.h> 4570bf6039f0SWarner Losh#if (__STDC_VERSION__ >= 201112L) && !defined(__STDC_NO_ATOMICS__) 4571bf6039f0SWarner Losh#include <stdatomic.h> 4572bf6039f0SWarner Losh#else 4573bf6039f0SWarner Losh#error Atomics not available 4574bf6039f0SWarner Losh#endif 4575bf6039f0SWarner Losh], [ 4576bf6039f0SWarner Losh uint64_t *p = (uint64_t *)0; 4577bf6039f0SWarner Losh uint64_t x = 1; 4578bf6039f0SWarner Losh volatile atomic_uint_least64_t *a = (volatile atomic_uint_least64_t *)p; 4579bf6039f0SWarner Losh uint64_t r = atomic_fetch_add(a, x) + x; 4580bf6039f0SWarner Losh return r == 0; 4581bf6039f0SWarner Losh], [je_cv_c11_atomics]) 4582bf6039f0SWarner Loshif test "x${je_cv_c11_atomics}" = "xyes" ; then 4583bf6039f0SWarner Losh AC_DEFINE([JEMALLOC_C11_ATOMICS]) 4584bf6039f0SWarner Loshfi 4585bf6039f0SWarner Losh 4586bf6039f0SWarner Loshdnl ============================================================================ 4587bf6039f0SWarner Loshdnl Check for GCC-style __atomic atomics. 4588bf6039f0SWarner Losh 4589bf6039f0SWarner LoshJE_COMPILABLE([GCC __atomic atomics], [ 4590bf6039f0SWarner Losh], [ 4591bf6039f0SWarner Losh int x = 0; 4592bf6039f0SWarner Losh int val = 1; 4593bf6039f0SWarner Losh int y = __atomic_fetch_add(&x, val, __ATOMIC_RELAXED); 4594bf6039f0SWarner Losh int after_add = x; 4595bf6039f0SWarner Losh return after_add == 1; 4596bf6039f0SWarner Losh], [je_cv_gcc_atomic_atomics]) 4597bf6039f0SWarner Loshif test "x${je_cv_gcc_atomic_atomics}" = "xyes" ; then 4598bf6039f0SWarner Losh AC_DEFINE([JEMALLOC_GCC_ATOMIC_ATOMICS]) 4599bf6039f0SWarner Losh 4600bf6039f0SWarner Losh dnl check for 8-bit atomic support 4601bf6039f0SWarner Losh JE_COMPILABLE([GCC 8-bit __atomic atomics], [ 4602bf6039f0SWarner Losh ], [ 4603bf6039f0SWarner Losh unsigned char x = 0; 4604bf6039f0SWarner Losh int val = 1; 4605bf6039f0SWarner Losh int y = __atomic_fetch_add(&x, val, __ATOMIC_RELAXED); 4606bf6039f0SWarner Losh int after_add = (int)x; 4607bf6039f0SWarner Losh return after_add == 1; 4608bf6039f0SWarner Losh ], [je_cv_gcc_u8_atomic_atomics]) 4609bf6039f0SWarner Losh if test "x${je_cv_gcc_u8_atomic_atomics}" = "xyes" ; then 4610bf6039f0SWarner Losh AC_DEFINE([JEMALLOC_GCC_U8_ATOMIC_ATOMICS]) 4611bf6039f0SWarner Losh fi 4612bf6039f0SWarner Loshfi 4613bf6039f0SWarner Losh 4614bf6039f0SWarner Loshdnl ============================================================================ 4615bf6039f0SWarner Loshdnl Check for GCC-style __sync atomics. 4616bf6039f0SWarner Losh 4617bf6039f0SWarner LoshJE_COMPILABLE([GCC __sync atomics], [ 4618bf6039f0SWarner Losh], [ 4619bf6039f0SWarner Losh int x = 0; 4620bf6039f0SWarner Losh int before_add = __sync_fetch_and_add(&x, 1); 4621bf6039f0SWarner Losh int after_add = x; 4622bf6039f0SWarner Losh return (before_add == 0) && (after_add == 1); 4623bf6039f0SWarner Losh], [je_cv_gcc_sync_atomics]) 4624bf6039f0SWarner Loshif test "x${je_cv_gcc_sync_atomics}" = "xyes" ; then 4625bf6039f0SWarner Losh AC_DEFINE([JEMALLOC_GCC_SYNC_ATOMICS]) 4626bf6039f0SWarner Losh 4627bf6039f0SWarner Losh dnl check for 8-bit atomic support 4628bf6039f0SWarner Losh JE_COMPILABLE([GCC 8-bit __sync atomics], [ 4629bf6039f0SWarner Losh ], [ 4630bf6039f0SWarner Losh unsigned char x = 0; 4631bf6039f0SWarner Losh int before_add = __sync_fetch_and_add(&x, 1); 4632bf6039f0SWarner Losh int after_add = (int)x; 4633bf6039f0SWarner Losh return (before_add == 0) && (after_add == 1); 4634bf6039f0SWarner Losh ], [je_cv_gcc_u8_sync_atomics]) 4635bf6039f0SWarner Losh if test "x${je_cv_gcc_u8_sync_atomics}" = "xyes" ; then 4636bf6039f0SWarner Losh AC_DEFINE([JEMALLOC_GCC_U8_SYNC_ATOMICS]) 4637bf6039f0SWarner Losh fi 4638bf6039f0SWarner Loshfi 4639bf6039f0SWarner Losh 4640bf6039f0SWarner Loshdnl ============================================================================ 4641bf6039f0SWarner Loshdnl Check for atomic(3) operations as provided on Darwin. 4642bf6039f0SWarner Loshdnl We need this not for the atomic operations (which are provided above), but 4643bf6039f0SWarner Loshdnl rather for the OS_unfair_lock type it exposes. 4644bf6039f0SWarner Losh 4645bf6039f0SWarner LoshJE_COMPILABLE([Darwin OSAtomic*()], [ 4646bf6039f0SWarner Losh#include <libkern/OSAtomic.h> 4647bf6039f0SWarner Losh#include <inttypes.h> 4648bf6039f0SWarner Losh], [ 4649bf6039f0SWarner Losh { 4650bf6039f0SWarner Losh int32_t x32 = 0; 4651bf6039f0SWarner Losh volatile int32_t *x32p = &x32; 4652bf6039f0SWarner Losh OSAtomicAdd32(1, x32p); 4653bf6039f0SWarner Losh } 4654bf6039f0SWarner Losh { 4655bf6039f0SWarner Losh int64_t x64 = 0; 4656bf6039f0SWarner Losh volatile int64_t *x64p = &x64; 4657bf6039f0SWarner Losh OSAtomicAdd64(1, x64p); 4658bf6039f0SWarner Losh } 4659bf6039f0SWarner Losh], [je_cv_osatomic]) 4660bf6039f0SWarner Loshif test "x${je_cv_osatomic}" = "xyes" ; then 4661bf6039f0SWarner Losh AC_DEFINE([JEMALLOC_OSATOMIC], [ ]) 4662bf6039f0SWarner Loshfi 4663bf6039f0SWarner Losh 4664bf6039f0SWarner Loshdnl ============================================================================ 4665bf6039f0SWarner Loshdnl Check for madvise(2). 4666bf6039f0SWarner Losh 4667bf6039f0SWarner LoshJE_COMPILABLE([madvise(2)], [ 4668bf6039f0SWarner Losh#include <sys/mman.h> 4669bf6039f0SWarner Losh], [ 4670bf6039f0SWarner Losh madvise((void *)0, 0, 0); 4671bf6039f0SWarner Losh], [je_cv_madvise]) 4672bf6039f0SWarner Loshif test "x${je_cv_madvise}" = "xyes" ; then 4673bf6039f0SWarner Losh AC_DEFINE([JEMALLOC_HAVE_MADVISE], [ ]) 4674bf6039f0SWarner Losh 4675bf6039f0SWarner Losh dnl Check for madvise(..., MADV_FREE). 4676bf6039f0SWarner Losh JE_COMPILABLE([madvise(..., MADV_FREE)], [ 4677bf6039f0SWarner Losh#include <sys/mman.h> 4678bf6039f0SWarner Losh], [ 4679bf6039f0SWarner Losh madvise((void *)0, 0, MADV_FREE); 4680bf6039f0SWarner Losh], [je_cv_madv_free]) 4681bf6039f0SWarner Losh if test "x${je_cv_madv_free}" = "xyes" ; then 4682bf6039f0SWarner Losh AC_DEFINE([JEMALLOC_PURGE_MADVISE_FREE], [ ]) 4683bf6039f0SWarner Losh elif test "x${je_cv_madvise}" = "xyes" ; then 4684bf6039f0SWarner Losh case "${host_cpu}" in i686|x86_64) 4685bf6039f0SWarner Losh case "${host}" in *-*-linux*) 4686bf6039f0SWarner Losh AC_DEFINE([JEMALLOC_PURGE_MADVISE_FREE], [ ]) 4687bf6039f0SWarner Losh AC_DEFINE([JEMALLOC_DEFINE_MADVISE_FREE], [ ]) 4688bf6039f0SWarner Losh ;; 4689bf6039f0SWarner Losh esac 4690bf6039f0SWarner Losh ;; 4691bf6039f0SWarner Losh esac 4692bf6039f0SWarner Losh fi 4693bf6039f0SWarner Losh 4694bf6039f0SWarner Losh dnl Check for madvise(..., MADV_DONTNEED). 4695bf6039f0SWarner Losh JE_COMPILABLE([madvise(..., MADV_DONTNEED)], [ 4696bf6039f0SWarner Losh#include <sys/mman.h> 4697bf6039f0SWarner Losh], [ 4698bf6039f0SWarner Losh madvise((void *)0, 0, MADV_DONTNEED); 4699bf6039f0SWarner Losh], [je_cv_madv_dontneed]) 4700bf6039f0SWarner Losh if test "x${je_cv_madv_dontneed}" = "xyes" ; then 4701bf6039f0SWarner Losh AC_DEFINE([JEMALLOC_PURGE_MADVISE_DONTNEED], [ ]) 4702bf6039f0SWarner Losh fi 4703bf6039f0SWarner Losh 4704bf6039f0SWarner Losh dnl Check for madvise(..., MADV_DO[NT]DUMP). 4705bf6039f0SWarner Losh JE_COMPILABLE([madvise(..., MADV_DO[[NT]]DUMP)], [ 4706bf6039f0SWarner Losh#include <sys/mman.h> 4707bf6039f0SWarner Losh], [ 4708bf6039f0SWarner Losh madvise((void *)0, 0, MADV_DONTDUMP); 4709bf6039f0SWarner Losh madvise((void *)0, 0, MADV_DODUMP); 4710bf6039f0SWarner Losh], [je_cv_madv_dontdump]) 4711bf6039f0SWarner Losh if test "x${je_cv_madv_dontdump}" = "xyes" ; then 4712bf6039f0SWarner Losh AC_DEFINE([JEMALLOC_MADVISE_DONTDUMP], [ ]) 4713bf6039f0SWarner Losh fi 4714bf6039f0SWarner Losh 4715bf6039f0SWarner Losh dnl Check for madvise(..., MADV_[NO]HUGEPAGE). 4716bf6039f0SWarner Losh JE_COMPILABLE([madvise(..., MADV_[[NO]]HUGEPAGE)], [ 4717bf6039f0SWarner Losh#include <sys/mman.h> 4718bf6039f0SWarner Losh], [ 4719bf6039f0SWarner Losh madvise((void *)0, 0, MADV_HUGEPAGE); 4720bf6039f0SWarner Losh madvise((void *)0, 0, MADV_NOHUGEPAGE); 4721bf6039f0SWarner Losh], [je_cv_thp]) 4722bf6039f0SWarner Loshcase "${host_cpu}" in 4723bf6039f0SWarner Losh arm*) 4724bf6039f0SWarner Losh ;; 4725bf6039f0SWarner Losh *) 4726bf6039f0SWarner Losh if test "x${je_cv_thp}" = "xyes" ; then 4727bf6039f0SWarner Losh AC_DEFINE([JEMALLOC_HAVE_MADVISE_HUGE], [ ]) 4728bf6039f0SWarner Losh fi 4729bf6039f0SWarner Losh ;; 4730bf6039f0SWarner Loshesac 4731bf6039f0SWarner Loshfi 4732bf6039f0SWarner Losh 4733bf6039f0SWarner Loshdnl ============================================================================ 4734bf6039f0SWarner Loshdnl Check for __builtin_clz() and __builtin_clzl(). 4735bf6039f0SWarner Losh 4736bf6039f0SWarner LoshAC_CACHE_CHECK([for __builtin_clz], 4737bf6039f0SWarner Losh [je_cv_builtin_clz], 4738bf6039f0SWarner Losh [AC_LINK_IFELSE([AC_LANG_PROGRAM([], 4739bf6039f0SWarner Losh [ 4740bf6039f0SWarner Losh { 4741bf6039f0SWarner Losh unsigned x = 0; 4742bf6039f0SWarner Losh int y = __builtin_clz(x); 4743bf6039f0SWarner Losh } 4744bf6039f0SWarner Losh { 4745bf6039f0SWarner Losh unsigned long x = 0; 4746bf6039f0SWarner Losh int y = __builtin_clzl(x); 4747bf6039f0SWarner Losh } 4748bf6039f0SWarner Losh ])], 4749bf6039f0SWarner Losh [je_cv_builtin_clz=yes], 4750bf6039f0SWarner Losh [je_cv_builtin_clz=no])]) 4751bf6039f0SWarner Losh 4752bf6039f0SWarner Loshif test "x${je_cv_builtin_clz}" = "xyes" ; then 4753bf6039f0SWarner Losh AC_DEFINE([JEMALLOC_HAVE_BUILTIN_CLZ], [ ]) 4754bf6039f0SWarner Loshfi 4755bf6039f0SWarner Losh 4756bf6039f0SWarner Loshdnl ============================================================================ 4757bf6039f0SWarner Loshdnl Check for os_unfair_lock operations as provided on Darwin. 4758bf6039f0SWarner Losh 4759bf6039f0SWarner LoshJE_COMPILABLE([Darwin os_unfair_lock_*()], [ 4760bf6039f0SWarner Losh#include <os/lock.h> 4761bf6039f0SWarner Losh#include <AvailabilityMacros.h> 4762bf6039f0SWarner Losh], [ 4763bf6039f0SWarner Losh #if MAC_OS_X_VERSION_MIN_REQUIRED < 101200 4764bf6039f0SWarner Losh #error "os_unfair_lock is not supported" 4765bf6039f0SWarner Losh #else 4766bf6039f0SWarner Losh os_unfair_lock lock = OS_UNFAIR_LOCK_INIT; 4767bf6039f0SWarner Losh os_unfair_lock_lock(&lock); 4768bf6039f0SWarner Losh os_unfair_lock_unlock(&lock); 4769bf6039f0SWarner Losh #endif 4770bf6039f0SWarner Losh], [je_cv_os_unfair_lock]) 4771bf6039f0SWarner Loshif test "x${je_cv_os_unfair_lock}" = "xyes" ; then 4772bf6039f0SWarner Losh AC_DEFINE([JEMALLOC_OS_UNFAIR_LOCK], [ ]) 4773bf6039f0SWarner Loshfi 4774bf6039f0SWarner Losh 4775bf6039f0SWarner Loshdnl ============================================================================ 4776bf6039f0SWarner Loshdnl Darwin-related configuration. 4777bf6039f0SWarner Losh 4778bf6039f0SWarner LoshAC_ARG_ENABLE([zone-allocator], 4779bf6039f0SWarner Losh [AS_HELP_STRING([--disable-zone-allocator], 4780bf6039f0SWarner Losh [Disable zone allocator for Darwin])], 4781bf6039f0SWarner Losh[if test "x$enable_zone_allocator" = "xno" ; then 4782bf6039f0SWarner Losh enable_zone_allocator="0" 4783bf6039f0SWarner Loshelse 4784bf6039f0SWarner Losh enable_zone_allocator="1" 4785bf6039f0SWarner Loshfi 4786bf6039f0SWarner Losh], 4787bf6039f0SWarner Losh[if test "x${abi}" = "xmacho"; then 4788bf6039f0SWarner Losh enable_zone_allocator="1" 4789bf6039f0SWarner Loshfi 4790bf6039f0SWarner Losh] 4791bf6039f0SWarner Losh) 4792bf6039f0SWarner LoshAC_SUBST([enable_zone_allocator]) 4793bf6039f0SWarner Losh 4794bf6039f0SWarner Loshif test "x${enable_zone_allocator}" = "x1" ; then 4795bf6039f0SWarner Losh if test "x${abi}" != "xmacho"; then 4796bf6039f0SWarner Losh AC_MSG_ERROR([--enable-zone-allocator is only supported on Darwin]) 4797bf6039f0SWarner Losh fi 4798bf6039f0SWarner Losh AC_DEFINE([JEMALLOC_ZONE], [ ]) 4799bf6039f0SWarner Loshfi 4800bf6039f0SWarner Losh 4801bf6039f0SWarner Loshdnl ============================================================================ 4802bf6039f0SWarner Loshdnl Use initial-exec TLS by default. 4803bf6039f0SWarner LoshAC_ARG_ENABLE([initial-exec-tls], 4804bf6039f0SWarner Losh [AS_HELP_STRING([--disable-initial-exec-tls], 4805bf6039f0SWarner Losh [Disable the initial-exec tls model])], 4806bf6039f0SWarner Losh[if test "x$enable_initial_exec_tls" = "xno" ; then 4807bf6039f0SWarner Losh enable_initial_exec_tls="0" 4808bf6039f0SWarner Loshelse 4809bf6039f0SWarner Losh enable_initial_exec_tls="1" 4810bf6039f0SWarner Loshfi 4811bf6039f0SWarner Losh], 4812bf6039f0SWarner Losh[enable_initial_exec_tls="1"] 4813bf6039f0SWarner Losh) 4814bf6039f0SWarner LoshAC_SUBST([enable_initial_exec_tls]) 4815bf6039f0SWarner Losh 4816bf6039f0SWarner Loshif test "x${je_cv_tls_model}" = "xyes" -a \ 4817bf6039f0SWarner Losh "x${enable_initial_exec_tls}" = "x1" ; then 4818bf6039f0SWarner Losh AC_DEFINE([JEMALLOC_TLS_MODEL], 4819bf6039f0SWarner Losh [__attribute__((tls_model("initial-exec")))]) 4820bf6039f0SWarner Loshelse 4821bf6039f0SWarner Losh AC_DEFINE([JEMALLOC_TLS_MODEL], [ ]) 4822bf6039f0SWarner Loshfi 4823bf6039f0SWarner Losh 4824bf6039f0SWarner Loshdnl ============================================================================ 4825bf6039f0SWarner Loshdnl Enable background threads if possible. 4826bf6039f0SWarner Losh 4827bf6039f0SWarner Loshif test "x${have_pthread}" = "x1" -a "x${je_cv_os_unfair_lock}" != "xyes" ; then 4828bf6039f0SWarner Losh AC_DEFINE([JEMALLOC_BACKGROUND_THREAD]) 4829bf6039f0SWarner Loshfi 4830bf6039f0SWarner Losh 4831bf6039f0SWarner Loshdnl ============================================================================ 4832bf6039f0SWarner Loshdnl Check for glibc malloc hooks 4833bf6039f0SWarner Losh 4834bf6039f0SWarner LoshJE_COMPILABLE([glibc malloc hook], [ 4835bf6039f0SWarner Losh#include <stddef.h> 4836bf6039f0SWarner Losh 4837bf6039f0SWarner Loshextern void (* __free_hook)(void *ptr); 4838bf6039f0SWarner Loshextern void *(* __malloc_hook)(size_t size); 4839bf6039f0SWarner Loshextern void *(* __realloc_hook)(void *ptr, size_t size); 4840bf6039f0SWarner Losh], [ 4841bf6039f0SWarner Losh void *ptr = 0L; 4842bf6039f0SWarner Losh if (__malloc_hook) ptr = __malloc_hook(1); 4843bf6039f0SWarner Losh if (__realloc_hook) ptr = __realloc_hook(ptr, 2); 4844bf6039f0SWarner Losh if (__free_hook && ptr) __free_hook(ptr); 4845bf6039f0SWarner Losh], [je_cv_glibc_malloc_hook]) 4846bf6039f0SWarner Loshif test "x${je_cv_glibc_malloc_hook}" = "xyes" ; then 4847bf6039f0SWarner Losh if test "x${JEMALLOC_PREFIX}" = "x" ; then 4848bf6039f0SWarner Losh AC_DEFINE([JEMALLOC_GLIBC_MALLOC_HOOK], [ ]) 4849bf6039f0SWarner Losh wrap_syms="${wrap_syms} __free_hook __malloc_hook __realloc_hook" 4850bf6039f0SWarner Losh fi 4851bf6039f0SWarner Loshfi 4852bf6039f0SWarner Losh 4853bf6039f0SWarner LoshJE_COMPILABLE([glibc memalign hook], [ 4854bf6039f0SWarner Losh#include <stddef.h> 4855bf6039f0SWarner Losh 4856bf6039f0SWarner Loshextern void *(* __memalign_hook)(size_t alignment, size_t size); 4857bf6039f0SWarner Losh], [ 4858bf6039f0SWarner Losh void *ptr = 0L; 4859bf6039f0SWarner Losh if (__memalign_hook) ptr = __memalign_hook(16, 7); 4860bf6039f0SWarner Losh], [je_cv_glibc_memalign_hook]) 4861bf6039f0SWarner Loshif test "x${je_cv_glibc_memalign_hook}" = "xyes" ; then 4862bf6039f0SWarner Losh if test "x${JEMALLOC_PREFIX}" = "x" ; then 4863bf6039f0SWarner Losh AC_DEFINE([JEMALLOC_GLIBC_MEMALIGN_HOOK], [ ]) 4864bf6039f0SWarner Losh wrap_syms="${wrap_syms} __memalign_hook" 4865bf6039f0SWarner Losh fi 4866bf6039f0SWarner Loshfi 4867bf6039f0SWarner Losh 4868bf6039f0SWarner LoshJE_COMPILABLE([pthreads adaptive mutexes], [ 4869bf6039f0SWarner Losh#include <pthread.h> 4870bf6039f0SWarner Losh], [ 4871bf6039f0SWarner Losh pthread_mutexattr_t attr; 4872bf6039f0SWarner Losh pthread_mutexattr_init(&attr); 4873bf6039f0SWarner Losh pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ADAPTIVE_NP); 4874bf6039f0SWarner Losh pthread_mutexattr_destroy(&attr); 4875bf6039f0SWarner Losh], [je_cv_pthread_mutex_adaptive_np]) 4876bf6039f0SWarner Loshif test "x${je_cv_pthread_mutex_adaptive_np}" = "xyes" ; then 4877bf6039f0SWarner Losh AC_DEFINE([JEMALLOC_HAVE_PTHREAD_MUTEX_ADAPTIVE_NP], [ ]) 4878bf6039f0SWarner Loshfi 4879bf6039f0SWarner Losh 4880bf6039f0SWarner LoshJE_CFLAGS_SAVE() 4881bf6039f0SWarner LoshJE_CFLAGS_ADD([-D_GNU_SOURCE]) 4882bf6039f0SWarner LoshJE_CFLAGS_ADD([-Werror]) 4883bf6039f0SWarner LoshJE_CFLAGS_ADD([-herror_on_warning]) 4884bf6039f0SWarner LoshJE_COMPILABLE([strerror_r returns char with gnu source], [ 4885bf6039f0SWarner Losh#include <errno.h> 4886bf6039f0SWarner Losh#include <stdio.h> 4887bf6039f0SWarner Losh#include <stdlib.h> 4888bf6039f0SWarner Losh#include <string.h> 4889bf6039f0SWarner Losh], [ 4890bf6039f0SWarner Losh char *buffer = (char *) malloc(100); 4891bf6039f0SWarner Losh char *error = strerror_r(EINVAL, buffer, 100); 4892bf6039f0SWarner Losh printf("%s\n", error); 4893bf6039f0SWarner Losh], [je_cv_strerror_r_returns_char_with_gnu_source]) 4894bf6039f0SWarner LoshJE_CFLAGS_RESTORE() 4895bf6039f0SWarner Loshif test "x${je_cv_strerror_r_returns_char_with_gnu_source}" = "xyes" ; then 4896bf6039f0SWarner Losh AC_DEFINE([JEMALLOC_STRERROR_R_RETURNS_CHAR_WITH_GNU_SOURCE], [ ]) 4897bf6039f0SWarner Loshfi 4898bf6039f0SWarner Losh 4899bf6039f0SWarner Loshdnl ============================================================================ 4900bf6039f0SWarner Loshdnl Check for typedefs, structures, and compiler characteristics. 4901bf6039f0SWarner LoshAC_HEADER_STDBOOL 4902bf6039f0SWarner Losh 4903bf6039f0SWarner Loshdnl ============================================================================ 4904bf6039f0SWarner Loshdnl Define commands that generate output files. 4905bf6039f0SWarner Losh 4906bf6039f0SWarner LoshAC_CONFIG_COMMANDS([include/jemalloc/internal/public_symbols.txt], [ 4907bf6039f0SWarner Losh f="${objroot}include/jemalloc/internal/public_symbols.txt" 4908bf6039f0SWarner Losh mkdir -p "${objroot}include/jemalloc/internal" 4909bf6039f0SWarner Losh cp /dev/null "${f}" 4910bf6039f0SWarner Losh for nm in `echo ${mangling_map} |tr ',' ' '` ; do 4911bf6039f0SWarner Losh n=`echo ${nm} |tr ':' ' ' |awk '{print $[]1}'` 4912bf6039f0SWarner Losh m=`echo ${nm} |tr ':' ' ' |awk '{print $[]2}'` 4913bf6039f0SWarner Losh echo "${n}:${m}" >> "${f}" 4914bf6039f0SWarner Losh dnl Remove name from public_syms so that it isn't redefined later. 4915bf6039f0SWarner Losh public_syms=`for sym in ${public_syms}; do echo "${sym}"; done |grep -v "^${n}\$" |tr '\n' ' '` 4916bf6039f0SWarner Losh done 4917bf6039f0SWarner Losh for sym in ${public_syms} ; do 4918bf6039f0SWarner Losh n="${sym}" 4919bf6039f0SWarner Losh m="${JEMALLOC_PREFIX}${sym}" 4920bf6039f0SWarner Losh echo "${n}:${m}" >> "${f}" 4921bf6039f0SWarner Losh done 4922bf6039f0SWarner Losh], [ 4923bf6039f0SWarner Losh srcdir="${srcdir}" 4924bf6039f0SWarner Losh objroot="${objroot}" 4925bf6039f0SWarner Losh mangling_map="${mangling_map}" 4926bf6039f0SWarner Losh public_syms="${public_syms}" 4927bf6039f0SWarner Losh JEMALLOC_PREFIX="${JEMALLOC_PREFIX}" 4928bf6039f0SWarner Losh]) 4929bf6039f0SWarner LoshAC_CONFIG_COMMANDS([include/jemalloc/internal/private_symbols.awk], [ 4930bf6039f0SWarner Losh f="${objroot}include/jemalloc/internal/private_symbols.awk" 4931bf6039f0SWarner Losh mkdir -p "${objroot}include/jemalloc/internal" 4932bf6039f0SWarner Losh export_syms=`for sym in ${public_syms}; do echo "${JEMALLOC_PREFIX}${sym}"; done; for sym in ${wrap_syms}; do echo "${sym}"; done;` 4933bf6039f0SWarner Losh "${srcdir}/include/jemalloc/internal/private_symbols.sh" "${SYM_PREFIX}" ${export_syms} > "${objroot}include/jemalloc/internal/private_symbols.awk" 4934bf6039f0SWarner Losh], [ 4935bf6039f0SWarner Losh srcdir="${srcdir}" 4936bf6039f0SWarner Losh objroot="${objroot}" 4937bf6039f0SWarner Losh public_syms="${public_syms}" 4938bf6039f0SWarner Losh wrap_syms="${wrap_syms}" 4939bf6039f0SWarner Losh SYM_PREFIX="${SYM_PREFIX}" 4940bf6039f0SWarner Losh JEMALLOC_PREFIX="${JEMALLOC_PREFIX}" 4941bf6039f0SWarner Losh]) 4942bf6039f0SWarner LoshAC_CONFIG_COMMANDS([include/jemalloc/internal/private_symbols_jet.awk], [ 4943bf6039f0SWarner Losh f="${objroot}include/jemalloc/internal/private_symbols_jet.awk" 4944bf6039f0SWarner Losh mkdir -p "${objroot}include/jemalloc/internal" 4945bf6039f0SWarner Losh export_syms=`for sym in ${public_syms}; do echo "jet_${sym}"; done; for sym in ${wrap_syms}; do echo "${sym}"; done;` 4946bf6039f0SWarner Losh "${srcdir}/include/jemalloc/internal/private_symbols.sh" "${SYM_PREFIX}" ${export_syms} > "${objroot}include/jemalloc/internal/private_symbols_jet.awk" 4947bf6039f0SWarner Losh], [ 4948bf6039f0SWarner Losh srcdir="${srcdir}" 4949bf6039f0SWarner Losh objroot="${objroot}" 4950bf6039f0SWarner Losh public_syms="${public_syms}" 4951bf6039f0SWarner Losh wrap_syms="${wrap_syms}" 4952bf6039f0SWarner Losh SYM_PREFIX="${SYM_PREFIX}" 4953bf6039f0SWarner Losh]) 4954bf6039f0SWarner LoshAC_CONFIG_COMMANDS([include/jemalloc/internal/public_namespace.h], [ 4955bf6039f0SWarner Losh mkdir -p "${objroot}include/jemalloc/internal" 4956bf6039f0SWarner Losh "${srcdir}/include/jemalloc/internal/public_namespace.sh" "${objroot}include/jemalloc/internal/public_symbols.txt" > "${objroot}include/jemalloc/internal/public_namespace.h" 4957bf6039f0SWarner Losh], [ 4958bf6039f0SWarner Losh srcdir="${srcdir}" 4959bf6039f0SWarner Losh objroot="${objroot}" 4960bf6039f0SWarner Losh]) 4961bf6039f0SWarner LoshAC_CONFIG_COMMANDS([include/jemalloc/internal/public_unnamespace.h], [ 4962bf6039f0SWarner Losh mkdir -p "${objroot}include/jemalloc/internal" 4963bf6039f0SWarner Losh "${srcdir}/include/jemalloc/internal/public_unnamespace.sh" "${objroot}include/jemalloc/internal/public_symbols.txt" > "${objroot}include/jemalloc/internal/public_unnamespace.h" 4964bf6039f0SWarner Losh], [ 4965bf6039f0SWarner Losh srcdir="${srcdir}" 4966bf6039f0SWarner Losh objroot="${objroot}" 4967bf6039f0SWarner Losh]) 4968bf6039f0SWarner LoshAC_CONFIG_COMMANDS([include/jemalloc/jemalloc_protos_jet.h], [ 4969bf6039f0SWarner Losh mkdir -p "${objroot}include/jemalloc" 4970bf6039f0SWarner Losh cat "${srcdir}/include/jemalloc/jemalloc_protos.h.in" | sed -e 's/@je_@/jet_/g' > "${objroot}include/jemalloc/jemalloc_protos_jet.h" 4971bf6039f0SWarner Losh], [ 4972bf6039f0SWarner Losh srcdir="${srcdir}" 4973bf6039f0SWarner Losh objroot="${objroot}" 4974bf6039f0SWarner Losh]) 4975bf6039f0SWarner LoshAC_CONFIG_COMMANDS([include/jemalloc/jemalloc_rename.h], [ 4976bf6039f0SWarner Losh mkdir -p "${objroot}include/jemalloc" 4977bf6039f0SWarner Losh "${srcdir}/include/jemalloc/jemalloc_rename.sh" "${objroot}include/jemalloc/internal/public_symbols.txt" > "${objroot}include/jemalloc/jemalloc_rename.h" 4978bf6039f0SWarner Losh], [ 4979bf6039f0SWarner Losh srcdir="${srcdir}" 4980bf6039f0SWarner Losh objroot="${objroot}" 4981bf6039f0SWarner Losh]) 4982bf6039f0SWarner LoshAC_CONFIG_COMMANDS([include/jemalloc/jemalloc_mangle.h], [ 4983bf6039f0SWarner Losh mkdir -p "${objroot}include/jemalloc" 4984bf6039f0SWarner Losh "${srcdir}/include/jemalloc/jemalloc_mangle.sh" "${objroot}include/jemalloc/internal/public_symbols.txt" je_ > "${objroot}include/jemalloc/jemalloc_mangle.h" 4985bf6039f0SWarner Losh], [ 4986bf6039f0SWarner Losh srcdir="${srcdir}" 4987bf6039f0SWarner Losh objroot="${objroot}" 4988bf6039f0SWarner Losh]) 4989bf6039f0SWarner LoshAC_CONFIG_COMMANDS([include/jemalloc/jemalloc_mangle_jet.h], [ 4990bf6039f0SWarner Losh mkdir -p "${objroot}include/jemalloc" 4991bf6039f0SWarner Losh "${srcdir}/include/jemalloc/jemalloc_mangle.sh" "${objroot}include/jemalloc/internal/public_symbols.txt" jet_ > "${objroot}include/jemalloc/jemalloc_mangle_jet.h" 4992bf6039f0SWarner Losh], [ 4993bf6039f0SWarner Losh srcdir="${srcdir}" 4994bf6039f0SWarner Losh objroot="${objroot}" 4995bf6039f0SWarner Losh]) 4996bf6039f0SWarner LoshAC_CONFIG_COMMANDS([include/jemalloc/jemalloc.h], [ 4997bf6039f0SWarner Losh mkdir -p "${objroot}include/jemalloc" 4998bf6039f0SWarner Losh "${srcdir}/include/jemalloc/jemalloc.sh" "${objroot}" > "${objroot}include/jemalloc/jemalloc${install_suffix}.h" 4999bf6039f0SWarner Losh], [ 5000bf6039f0SWarner Losh srcdir="${srcdir}" 5001bf6039f0SWarner Losh objroot="${objroot}" 5002bf6039f0SWarner Losh install_suffix="${install_suffix}" 5003bf6039f0SWarner Losh]) 5004bf6039f0SWarner Losh 5005bf6039f0SWarner Loshdnl Process .in files. 5006bf6039f0SWarner LoshAC_SUBST([cfghdrs_in]) 5007bf6039f0SWarner LoshAC_SUBST([cfghdrs_out]) 5008bf6039f0SWarner LoshAC_CONFIG_HEADERS([$cfghdrs_tup]) 5009bf6039f0SWarner Losh 5010bf6039f0SWarner Loshdnl ============================================================================ 5011bf6039f0SWarner Loshdnl Generate outputs. 5012bf6039f0SWarner Losh 5013bf6039f0SWarner LoshAC_CONFIG_FILES([$cfgoutputs_tup config.stamp bin/jemalloc-config bin/jemalloc.sh bin/jeprof]) 5014bf6039f0SWarner LoshAC_SUBST([cfgoutputs_in]) 5015bf6039f0SWarner LoshAC_SUBST([cfgoutputs_out]) 5016bf6039f0SWarner LoshAC_OUTPUT 5017bf6039f0SWarner Losh 5018bf6039f0SWarner Loshdnl ============================================================================ 5019bf6039f0SWarner Loshdnl Print out the results of configuration. 5020bf6039f0SWarner LoshAC_MSG_RESULT([===============================================================================]) 5021bf6039f0SWarner LoshAC_MSG_RESULT([jemalloc version : ${jemalloc_version}]) 5022bf6039f0SWarner LoshAC_MSG_RESULT([library revision : ${rev}]) 5023bf6039f0SWarner LoshAC_MSG_RESULT([]) 5024bf6039f0SWarner LoshAC_MSG_RESULT([CONFIG : ${CONFIG}]) 5025bf6039f0SWarner LoshAC_MSG_RESULT([CC : ${CC}]) 5026bf6039f0SWarner LoshAC_MSG_RESULT([CONFIGURE_CFLAGS : ${CONFIGURE_CFLAGS}]) 5027bf6039f0SWarner LoshAC_MSG_RESULT([SPECIFIED_CFLAGS : ${SPECIFIED_CFLAGS}]) 5028bf6039f0SWarner LoshAC_MSG_RESULT([EXTRA_CFLAGS : ${EXTRA_CFLAGS}]) 5029bf6039f0SWarner LoshAC_MSG_RESULT([CPPFLAGS : ${CPPFLAGS}]) 5030bf6039f0SWarner LoshAC_MSG_RESULT([CXX : ${CXX}]) 5031bf6039f0SWarner LoshAC_MSG_RESULT([CONFIGURE_CXXFLAGS : ${CONFIGURE_CXXFLAGS}]) 5032bf6039f0SWarner LoshAC_MSG_RESULT([SPECIFIED_CXXFLAGS : ${SPECIFIED_CXXFLAGS}]) 5033bf6039f0SWarner LoshAC_MSG_RESULT([EXTRA_CXXFLAGS : ${EXTRA_CXXFLAGS}]) 5034bf6039f0SWarner LoshAC_MSG_RESULT([LDFLAGS : ${LDFLAGS}]) 5035bf6039f0SWarner LoshAC_MSG_RESULT([EXTRA_LDFLAGS : ${EXTRA_LDFLAGS}]) 5036bf6039f0SWarner LoshAC_MSG_RESULT([DSO_LDFLAGS : ${DSO_LDFLAGS}]) 5037bf6039f0SWarner LoshAC_MSG_RESULT([LIBS : ${LIBS}]) 5038bf6039f0SWarner LoshAC_MSG_RESULT([RPATH_EXTRA : ${RPATH_EXTRA}]) 5039bf6039f0SWarner LoshAC_MSG_RESULT([]) 5040bf6039f0SWarner LoshAC_MSG_RESULT([XSLTPROC : ${XSLTPROC}]) 5041bf6039f0SWarner LoshAC_MSG_RESULT([XSLROOT : ${XSLROOT}]) 5042bf6039f0SWarner LoshAC_MSG_RESULT([]) 5043bf6039f0SWarner LoshAC_MSG_RESULT([PREFIX : ${PREFIX}]) 5044bf6039f0SWarner LoshAC_MSG_RESULT([BINDIR : ${BINDIR}]) 5045bf6039f0SWarner LoshAC_MSG_RESULT([DATADIR : ${DATADIR}]) 5046bf6039f0SWarner LoshAC_MSG_RESULT([INCLUDEDIR : ${INCLUDEDIR}]) 5047bf6039f0SWarner LoshAC_MSG_RESULT([LIBDIR : ${LIBDIR}]) 5048bf6039f0SWarner LoshAC_MSG_RESULT([MANDIR : ${MANDIR}]) 5049bf6039f0SWarner LoshAC_MSG_RESULT([]) 5050bf6039f0SWarner LoshAC_MSG_RESULT([srcroot : ${srcroot}]) 5051bf6039f0SWarner LoshAC_MSG_RESULT([abs_srcroot : ${abs_srcroot}]) 5052bf6039f0SWarner LoshAC_MSG_RESULT([objroot : ${objroot}]) 5053bf6039f0SWarner LoshAC_MSG_RESULT([abs_objroot : ${abs_objroot}]) 5054bf6039f0SWarner LoshAC_MSG_RESULT([]) 5055bf6039f0SWarner LoshAC_MSG_RESULT([JEMALLOC_PREFIX : ${JEMALLOC_PREFIX}]) 5056bf6039f0SWarner LoshAC_MSG_RESULT([JEMALLOC_PRIVATE_NAMESPACE]) 5057bf6039f0SWarner LoshAC_MSG_RESULT([ : ${JEMALLOC_PRIVATE_NAMESPACE}]) 5058bf6039f0SWarner LoshAC_MSG_RESULT([install_suffix : ${install_suffix}]) 5059bf6039f0SWarner LoshAC_MSG_RESULT([malloc_conf : ${config_malloc_conf}]) 5060bf6039f0SWarner LoshAC_MSG_RESULT([documentation : ${enable_doc}]) 5061bf6039f0SWarner LoshAC_MSG_RESULT([shared libs : ${enable_shared}]) 5062bf6039f0SWarner LoshAC_MSG_RESULT([static libs : ${enable_static}]) 5063bf6039f0SWarner LoshAC_MSG_RESULT([autogen : ${enable_autogen}]) 5064bf6039f0SWarner LoshAC_MSG_RESULT([debug : ${enable_debug}]) 5065bf6039f0SWarner LoshAC_MSG_RESULT([stats : ${enable_stats}]) 5066bf6039f0SWarner LoshAC_MSG_RESULT([experimetal_smallocx : ${enable_experimental_smallocx}]) 5067bf6039f0SWarner LoshAC_MSG_RESULT([prof : ${enable_prof}]) 5068bf6039f0SWarner LoshAC_MSG_RESULT([prof-libunwind : ${enable_prof_libunwind}]) 5069bf6039f0SWarner LoshAC_MSG_RESULT([prof-libgcc : ${enable_prof_libgcc}]) 5070bf6039f0SWarner LoshAC_MSG_RESULT([prof-gcc : ${enable_prof_gcc}]) 5071bf6039f0SWarner LoshAC_MSG_RESULT([fill : ${enable_fill}]) 5072bf6039f0SWarner LoshAC_MSG_RESULT([utrace : ${enable_utrace}]) 5073bf6039f0SWarner LoshAC_MSG_RESULT([xmalloc : ${enable_xmalloc}]) 5074bf6039f0SWarner LoshAC_MSG_RESULT([log : ${enable_log}]) 5075bf6039f0SWarner LoshAC_MSG_RESULT([lazy_lock : ${enable_lazy_lock}]) 5076bf6039f0SWarner LoshAC_MSG_RESULT([cache-oblivious : ${enable_cache_oblivious}]) 5077bf6039f0SWarner LoshAC_MSG_RESULT([cxx : ${enable_cxx}]) 5078bf6039f0SWarner LoshAC_MSG_RESULT([===============================================================================]) 5079*c43cad87SWarner Losh>>>>>>> main 5080