1dnl Process this file with autoconf to produce a configure script. 2AC_PREREQ(2.68) 3AC_INIT([Makefile.in]) 4 5AC_CONFIG_AUX_DIR([build-aux]) 6 7dnl ============================================================================ 8dnl Custom macro definitions. 9 10dnl JE_CONCAT_VVV(r, a, b) 11dnl 12dnl Set $r to the concatenation of $a and $b, with a space separating them iff 13dnl both $a and $b are non-empty. 14AC_DEFUN([JE_CONCAT_VVV], 15if test "x[$]{$2}" = "x" -o "x[$]{$3}" = "x" ; then 16 $1="[$]{$2}[$]{$3}" 17else 18 $1="[$]{$2} [$]{$3}" 19fi 20) 21 22dnl JE_APPEND_VS(a, b) 23dnl 24dnl Set $a to the concatenation of $a and b, with a space separating them iff 25dnl both $a and b are non-empty. 26AC_DEFUN([JE_APPEND_VS], 27 T_APPEND_V=$2 28 JE_CONCAT_VVV($1, $1, T_APPEND_V) 29) 30 31CONFIGURE_CFLAGS= 32SPECIFIED_CFLAGS="${CFLAGS}" 33dnl JE_CFLAGS_ADD(cflag) 34dnl 35dnl CFLAGS is the concatenation of CONFIGURE_CFLAGS and SPECIFIED_CFLAGS 36dnl (ignoring EXTRA_CFLAGS, which does not impact configure tests. This macro 37dnl appends to CONFIGURE_CFLAGS and regenerates CFLAGS. 38AC_DEFUN([JE_CFLAGS_ADD], 39[ 40AC_MSG_CHECKING([whether compiler supports $1]) 41T_CONFIGURE_CFLAGS="${CONFIGURE_CFLAGS}" 42JE_APPEND_VS(CONFIGURE_CFLAGS, $1) 43JE_CONCAT_VVV(CFLAGS, CONFIGURE_CFLAGS, SPECIFIED_CFLAGS) 44AC_COMPILE_IFELSE([AC_LANG_PROGRAM( 45[[ 46]], [[ 47 return 0; 48]])], 49 [je_cv_cflags_added=$1] 50 AC_MSG_RESULT([yes]), 51 [je_cv_cflags_added=] 52 AC_MSG_RESULT([no]) 53 [CONFIGURE_CFLAGS="${T_CONFIGURE_CFLAGS}"] 54) 55JE_CONCAT_VVV(CFLAGS, CONFIGURE_CFLAGS, SPECIFIED_CFLAGS) 56]) 57 58dnl JE_CFLAGS_SAVE() 59dnl JE_CFLAGS_RESTORE() 60dnl 61dnl Save/restore CFLAGS. Nesting is not supported. 62AC_DEFUN([JE_CFLAGS_SAVE], 63SAVED_CONFIGURE_CFLAGS="${CONFIGURE_CFLAGS}" 64) 65AC_DEFUN([JE_CFLAGS_RESTORE], 66CONFIGURE_CFLAGS="${SAVED_CONFIGURE_CFLAGS}" 67JE_CONCAT_VVV(CFLAGS, CONFIGURE_CFLAGS, SPECIFIED_CFLAGS) 68) 69 70CONFIGURE_CXXFLAGS= 71SPECIFIED_CXXFLAGS="${CXXFLAGS}" 72dnl JE_CXXFLAGS_ADD(cxxflag) 73AC_DEFUN([JE_CXXFLAGS_ADD], 74[ 75AC_MSG_CHECKING([whether compiler supports $1]) 76T_CONFIGURE_CXXFLAGS="${CONFIGURE_CXXFLAGS}" 77JE_APPEND_VS(CONFIGURE_CXXFLAGS, $1) 78JE_CONCAT_VVV(CXXFLAGS, CONFIGURE_CXXFLAGS, SPECIFIED_CXXFLAGS) 79AC_LANG_PUSH([C++]) 80AC_COMPILE_IFELSE([AC_LANG_PROGRAM( 81[[ 82]], [[ 83 return 0; 84]])], 85 [je_cv_cxxflags_added=$1] 86 AC_MSG_RESULT([yes]), 87 [je_cv_cxxflags_added=] 88 AC_MSG_RESULT([no]) 89 [CONFIGURE_CXXFLAGS="${T_CONFIGURE_CXXFLAGS}"] 90) 91AC_LANG_POP([C++]) 92JE_CONCAT_VVV(CXXFLAGS, CONFIGURE_CXXFLAGS, SPECIFIED_CXXFLAGS) 93]) 94 95dnl JE_COMPILABLE(label, hcode, mcode, rvar) 96dnl 97dnl Use AC_LINK_IFELSE() rather than AC_COMPILE_IFELSE() so that linker errors 98dnl cause failure. 99AC_DEFUN([JE_COMPILABLE], 100[ 101AC_CACHE_CHECK([whether $1 is compilable], 102 [$4], 103 [AC_LINK_IFELSE([AC_LANG_PROGRAM([$2], 104 [$3])], 105 [$4=yes], 106 [$4=no])]) 107]) 108 109dnl ============================================================================ 110 111CONFIG=`echo ${ac_configure_args} | sed -e 's#'"'"'\([^ ]*\)'"'"'#\1#g'` 112AC_SUBST([CONFIG]) 113 114dnl Library revision. 115rev=2 116AC_SUBST([rev]) 117 118srcroot=$srcdir 119if test "x${srcroot}" = "x." ; then 120 srcroot="" 121else 122 srcroot="${srcroot}/" 123fi 124AC_SUBST([srcroot]) 125abs_srcroot="`cd \"${srcdir}\"; pwd`/" 126AC_SUBST([abs_srcroot]) 127 128objroot="" 129AC_SUBST([objroot]) 130abs_objroot="`pwd`/" 131AC_SUBST([abs_objroot]) 132 133dnl Munge install path variables. 134case "$prefix" in 135 *\ * ) AC_MSG_ERROR([Prefix should not contain spaces]) ;; 136 "NONE" ) prefix="/usr/local" ;; 137esac 138case "$exec_prefix" in 139 *\ * ) AC_MSG_ERROR([Exec prefix should not contain spaces]) ;; 140 "NONE" ) exec_prefix=$prefix ;; 141esac 142PREFIX=$prefix 143AC_SUBST([PREFIX]) 144BINDIR=`eval echo $bindir` 145BINDIR=`eval echo $BINDIR` 146AC_SUBST([BINDIR]) 147INCLUDEDIR=`eval echo $includedir` 148INCLUDEDIR=`eval echo $INCLUDEDIR` 149AC_SUBST([INCLUDEDIR]) 150LIBDIR=`eval echo $libdir` 151LIBDIR=`eval echo $LIBDIR` 152AC_SUBST([LIBDIR]) 153DATADIR=`eval echo $datadir` 154DATADIR=`eval echo $DATADIR` 155AC_SUBST([DATADIR]) 156MANDIR=`eval echo $mandir` 157MANDIR=`eval echo $MANDIR` 158AC_SUBST([MANDIR]) 159 160dnl Support for building documentation. 161AC_PATH_PROG([XSLTPROC], [xsltproc], [false], [$PATH]) 162if test -d "/usr/share/xml/docbook/stylesheet/docbook-xsl" ; then 163 DEFAULT_XSLROOT="/usr/share/xml/docbook/stylesheet/docbook-xsl" 164elif test -d "/usr/share/sgml/docbook/xsl-stylesheets" ; then 165 DEFAULT_XSLROOT="/usr/share/sgml/docbook/xsl-stylesheets" 166else 167 dnl Documentation building will fail if this default gets used. 168 DEFAULT_XSLROOT="" 169fi 170AC_ARG_WITH([xslroot], 171 [AS_HELP_STRING([--with-xslroot=<path>], [XSL stylesheet root path])], [ 172if test "x$with_xslroot" = "xno" ; then 173 XSLROOT="${DEFAULT_XSLROOT}" 174else 175 XSLROOT="${with_xslroot}" 176fi 177], 178 XSLROOT="${DEFAULT_XSLROOT}" 179) 180if test "x$XSLTPROC" = "xfalse" ; then 181 XSLROOT="" 182fi 183AC_SUBST([XSLROOT]) 184 185dnl If CFLAGS isn't defined, set CFLAGS to something reasonable. Otherwise, 186dnl just prevent autoconf from molesting CFLAGS. 187CFLAGS=$CFLAGS 188AC_PROG_CC 189 190if test "x$GCC" != "xyes" ; then 191 AC_CACHE_CHECK([whether compiler is MSVC], 192 [je_cv_msvc], 193 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], 194 [ 195#ifndef _MSC_VER 196 int fail[-1]; 197#endif 198])], 199 [je_cv_msvc=yes], 200 [je_cv_msvc=no])]) 201fi 202 203dnl check if a cray prgenv wrapper compiler is being used 204je_cv_cray_prgenv_wrapper="" 205if test "x${PE_ENV}" != "x" ; then 206 case "${CC}" in 207 CC|cc) 208 je_cv_cray_prgenv_wrapper="yes" 209 ;; 210 *) 211 ;; 212 esac 213fi 214 215AC_CACHE_CHECK([whether compiler is cray], 216 [je_cv_cray], 217 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], 218 [ 219#ifndef _CRAYC 220 int fail[-1]; 221#endif 222])], 223 [je_cv_cray=yes], 224 [je_cv_cray=no])]) 225 226if test "x${je_cv_cray}" = "xyes" ; then 227 AC_CACHE_CHECK([whether cray compiler version is 8.4], 228 [je_cv_cray_84], 229 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], 230 [ 231#if !(_RELEASE_MAJOR == 8 && _RELEASE_MINOR == 4) 232 int fail[-1]; 233#endif 234])], 235 [je_cv_cray_84=yes], 236 [je_cv_cray_84=no])]) 237fi 238 239if test "x$GCC" = "xyes" ; then 240 JE_CFLAGS_ADD([-std=gnu11]) 241 if test "x$je_cv_cflags_added" = "x-std=gnu11" ; then 242 AC_DEFINE_UNQUOTED([JEMALLOC_HAS_RESTRICT], [ ], [ ]) 243 else 244 JE_CFLAGS_ADD([-std=gnu99]) 245 if test "x$je_cv_cflags_added" = "x-std=gnu99" ; then 246 AC_DEFINE_UNQUOTED([JEMALLOC_HAS_RESTRICT], [ ], [ ]) 247 fi 248 fi 249 JE_CFLAGS_ADD([-Werror=unknown-warning-option]) 250 JE_CFLAGS_ADD([-Wall]) 251 JE_CFLAGS_ADD([-Wextra]) 252 JE_CFLAGS_ADD([-Wshorten-64-to-32]) 253 JE_CFLAGS_ADD([-Wsign-compare]) 254 JE_CFLAGS_ADD([-Wundef]) 255 JE_CFLAGS_ADD([-Wno-format-zero-length]) 256 JE_CFLAGS_ADD([-Wpointer-arith]) 257 dnl This warning triggers on the use of the universal zero initializer, which 258 dnl is a very handy idiom for things like the tcache static initializer (which 259 dnl has lots of nested structs). See the discussion at. 260 dnl https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53119 261 JE_CFLAGS_ADD([-Wno-missing-braces]) 262 dnl This one too. 263 JE_CFLAGS_ADD([-Wno-missing-field-initializers]) 264 JE_CFLAGS_ADD([-Wno-missing-attributes]) 265 JE_CFLAGS_ADD([-pipe]) 266 JE_CFLAGS_ADD([-g3]) 267elif test "x$je_cv_msvc" = "xyes" ; then 268 CC="$CC -nologo" 269 JE_CFLAGS_ADD([-Zi]) 270 JE_CFLAGS_ADD([-MT]) 271 JE_CFLAGS_ADD([-W3]) 272 JE_CFLAGS_ADD([-FS]) 273 JE_APPEND_VS(CPPFLAGS, -I${srcdir}/include/msvc_compat) 274fi 275if test "x$je_cv_cray" = "xyes" ; then 276 dnl cray compiler 8.4 has an inlining bug 277 if test "x$je_cv_cray_84" = "xyes" ; then 278 JE_CFLAGS_ADD([-hipa2]) 279 JE_CFLAGS_ADD([-hnognu]) 280 fi 281 dnl ignore unreachable code warning 282 JE_CFLAGS_ADD([-hnomessage=128]) 283 dnl ignore redefinition of "malloc", "free", etc warning 284 JE_CFLAGS_ADD([-hnomessage=1357]) 285fi 286AC_SUBST([CONFIGURE_CFLAGS]) 287AC_SUBST([SPECIFIED_CFLAGS]) 288AC_SUBST([EXTRA_CFLAGS]) 289AC_PROG_CPP 290 291AC_ARG_ENABLE([cxx], 292 [AS_HELP_STRING([--disable-cxx], [Disable C++ integration])], 293if test "x$enable_cxx" = "xno" ; then 294 enable_cxx="0" 295else 296 enable_cxx="1" 297fi 298, 299enable_cxx="1" 300) 301if test "x$enable_cxx" = "x1" ; then 302 dnl Require at least c++14, which is the first version to support sized 303 dnl deallocation. C++ support is not compiled otherwise. 304 m4_include([m4/ax_cxx_compile_stdcxx.m4]) 305 AX_CXX_COMPILE_STDCXX([17], [noext], [optional]) 306 if test "x${HAVE_CXX17}" != "x1"; then 307 AX_CXX_COMPILE_STDCXX([14], [noext], [optional]) 308 fi 309 if test "x${HAVE_CXX14}" = "x1" -o "x${HAVE_CXX17}" = "x1"; then 310 JE_CXXFLAGS_ADD([-Wall]) 311 JE_CXXFLAGS_ADD([-Wextra]) 312 JE_CXXFLAGS_ADD([-g3]) 313 314 SAVED_LIBS="${LIBS}" 315 JE_APPEND_VS(LIBS, -lstdc++) 316 JE_COMPILABLE([libstdc++ linkage], [ 317#include <stdlib.h> 318], [[ 319 int *arr = (int *)malloc(sizeof(int) * 42); 320 if (arr == NULL) 321 return 1; 322]], [je_cv_libstdcxx]) 323 if test "x${je_cv_libstdcxx}" = "xno" ; then 324 LIBS="${SAVED_LIBS}" 325 fi 326 else 327 enable_cxx="0" 328 fi 329fi 330if test "x$enable_cxx" = "x1"; then 331 AC_DEFINE([JEMALLOC_ENABLE_CXX], [ ], [ ]) 332fi 333AC_SUBST([enable_cxx]) 334AC_SUBST([CONFIGURE_CXXFLAGS]) 335AC_SUBST([SPECIFIED_CXXFLAGS]) 336AC_SUBST([EXTRA_CXXFLAGS]) 337 338AC_C_BIGENDIAN([ac_cv_big_endian=1], [ac_cv_big_endian=0]) 339if test "x${ac_cv_big_endian}" = "x1" ; then 340 AC_DEFINE_UNQUOTED([JEMALLOC_BIG_ENDIAN], [ ], [ ]) 341fi 342 343if test "x${je_cv_msvc}" = "xyes" -a "x${ac_cv_header_inttypes_h}" = "xno"; then 344 JE_APPEND_VS(CPPFLAGS, -I${srcdir}/include/msvc_compat/C99) 345fi 346 347if test "x${je_cv_msvc}" = "xyes" ; then 348 LG_SIZEOF_PTR=LG_SIZEOF_PTR_WIN 349 AC_MSG_RESULT([Using a predefined value for sizeof(void *): 4 for 32-bit, 8 for 64-bit]) 350else 351 AC_CHECK_SIZEOF([void *]) 352 if test "x${ac_cv_sizeof_void_p}" = "x8" ; then 353 LG_SIZEOF_PTR=3 354 elif test "x${ac_cv_sizeof_void_p}" = "x4" ; then 355 LG_SIZEOF_PTR=2 356 else 357 AC_MSG_ERROR([Unsupported pointer size: ${ac_cv_sizeof_void_p}]) 358 fi 359fi 360AC_DEFINE_UNQUOTED([LG_SIZEOF_PTR], [$LG_SIZEOF_PTR], [ ]) 361 362AC_CHECK_SIZEOF([int]) 363if test "x${ac_cv_sizeof_int}" = "x8" ; then 364 LG_SIZEOF_INT=3 365elif test "x${ac_cv_sizeof_int}" = "x4" ; then 366 LG_SIZEOF_INT=2 367else 368 AC_MSG_ERROR([Unsupported int size: ${ac_cv_sizeof_int}]) 369fi 370AC_DEFINE_UNQUOTED([LG_SIZEOF_INT], [$LG_SIZEOF_INT], [ ]) 371 372AC_CHECK_SIZEOF([long]) 373if test "x${ac_cv_sizeof_long}" = "x8" ; then 374 LG_SIZEOF_LONG=3 375elif test "x${ac_cv_sizeof_long}" = "x4" ; then 376 LG_SIZEOF_LONG=2 377else 378 AC_MSG_ERROR([Unsupported long size: ${ac_cv_sizeof_long}]) 379fi 380AC_DEFINE_UNQUOTED([LG_SIZEOF_LONG], [$LG_SIZEOF_LONG], [ ]) 381 382AC_CHECK_SIZEOF([long long]) 383if test "x${ac_cv_sizeof_long_long}" = "x8" ; then 384 LG_SIZEOF_LONG_LONG=3 385elif test "x${ac_cv_sizeof_long_long}" = "x4" ; then 386 LG_SIZEOF_LONG_LONG=2 387else 388 AC_MSG_ERROR([Unsupported long long size: ${ac_cv_sizeof_long_long}]) 389fi 390AC_DEFINE_UNQUOTED([LG_SIZEOF_LONG_LONG], [$LG_SIZEOF_LONG_LONG], [ ]) 391 392AC_CHECK_SIZEOF([intmax_t]) 393if test "x${ac_cv_sizeof_intmax_t}" = "x16" ; then 394 LG_SIZEOF_INTMAX_T=4 395elif test "x${ac_cv_sizeof_intmax_t}" = "x8" ; then 396 LG_SIZEOF_INTMAX_T=3 397elif test "x${ac_cv_sizeof_intmax_t}" = "x4" ; then 398 LG_SIZEOF_INTMAX_T=2 399else 400 AC_MSG_ERROR([Unsupported intmax_t size: ${ac_cv_sizeof_intmax_t}]) 401fi 402AC_DEFINE_UNQUOTED([LG_SIZEOF_INTMAX_T], [$LG_SIZEOF_INTMAX_T], [ ]) 403 404AC_CANONICAL_HOST 405dnl CPU-specific settings. 406CPU_SPINWAIT="" 407case "${host_cpu}" in 408 i686|x86_64) 409 HAVE_CPU_SPINWAIT=1 410 if test "x${je_cv_msvc}" = "xyes" ; then 411 AC_CACHE_VAL([je_cv_pause_msvc], 412 [JE_COMPILABLE([pause instruction MSVC], [], 413 [[_mm_pause(); return 0;]], 414 [je_cv_pause_msvc])]) 415 if test "x${je_cv_pause_msvc}" = "xyes" ; then 416 CPU_SPINWAIT='_mm_pause()' 417 fi 418 else 419 AC_CACHE_VAL([je_cv_pause], 420 [JE_COMPILABLE([pause instruction], [], 421 [[__asm__ volatile("pause"); return 0;]], 422 [je_cv_pause])]) 423 if test "x${je_cv_pause}" = "xyes" ; then 424 CPU_SPINWAIT='__asm__ volatile("pause")' 425 fi 426 fi 427 ;; 428 aarch64|arm*) 429 HAVE_CPU_SPINWAIT=1 430 dnl isb is a better equivalent to the pause instruction on x86. 431 AC_CACHE_VAL([je_cv_isb], 432 [JE_COMPILABLE([isb instruction], [], 433 [[__asm__ volatile("isb"); return 0;]], 434 [je_cv_isb])]) 435 if test "x${je_cv_isb}" = "xyes" ; then 436 CPU_SPINWAIT='__asm__ volatile("isb")' 437 fi 438 ;; 439 *) 440 HAVE_CPU_SPINWAIT=0 441 ;; 442esac 443AC_DEFINE_UNQUOTED([HAVE_CPU_SPINWAIT], [$HAVE_CPU_SPINWAIT], [ ]) 444AC_DEFINE_UNQUOTED([CPU_SPINWAIT], [$CPU_SPINWAIT], [ ]) 445 446AC_ARG_WITH([lg_vaddr], 447 [AS_HELP_STRING([--with-lg-vaddr=<lg-vaddr>], [Number of significant virtual address bits])], 448 [LG_VADDR="$with_lg_vaddr"], [LG_VADDR="detect"]) 449 450case "${host_cpu}" in 451 aarch64) 452 if test "x$LG_VADDR" = "xdetect"; then 453 AC_MSG_CHECKING([number of significant virtual address bits]) 454 if test "x${LG_SIZEOF_PTR}" = "x2" ; then 455 #aarch64 ILP32 456 LG_VADDR=32 457 else 458 #aarch64 LP64 459 LG_VADDR=48 460 fi 461 AC_MSG_RESULT([$LG_VADDR]) 462 fi 463 ;; 464 x86_64) 465 if test "x$LG_VADDR" = "xdetect"; then 466 AC_CACHE_CHECK([number of significant virtual address bits], 467 [je_cv_lg_vaddr], 468 AC_RUN_IFELSE([AC_LANG_PROGRAM( 469[[ 470#include <stdio.h> 471#ifdef _WIN32 472#include <limits.h> 473#include <intrin.h> 474typedef unsigned __int32 uint32_t; 475#else 476#include <stdint.h> 477#endif 478]], [[ 479 uint32_t r[[4]]; 480 uint32_t eax_in = 0x80000008U; 481#ifdef _WIN32 482 __cpuid((int *)r, (int)eax_in); 483#else 484 asm volatile ("cpuid" 485 : "=a" (r[[0]]), "=b" (r[[1]]), "=c" (r[[2]]), "=d" (r[[3]]) 486 : "a" (eax_in), "c" (0) 487 ); 488#endif 489 uint32_t eax_out = r[[0]]; 490 uint32_t vaddr = ((eax_out & 0x0000ff00U) >> 8); 491 FILE *f = fopen("conftest.out", "w"); 492 if (f == NULL) { 493 return 1; 494 } 495 if (vaddr > (sizeof(void *) << 3)) { 496 vaddr = sizeof(void *) << 3; 497 } 498 fprintf(f, "%u", vaddr); 499 fclose(f); 500 return 0; 501]])], 502 [je_cv_lg_vaddr=`cat conftest.out`], 503 [je_cv_lg_vaddr=error], 504 [je_cv_lg_vaddr=57])) 505 if test "x${je_cv_lg_vaddr}" != "x" ; then 506 LG_VADDR="${je_cv_lg_vaddr}" 507 fi 508 if test "x${LG_VADDR}" != "xerror" ; then 509 AC_DEFINE_UNQUOTED([LG_VADDR], [$LG_VADDR], [ ]) 510 else 511 AC_MSG_ERROR([cannot determine number of significant virtual address bits]) 512 fi 513 fi 514 ;; 515 *) 516 if test "x$LG_VADDR" = "xdetect"; then 517 AC_MSG_CHECKING([number of significant virtual address bits]) 518 if test "x${LG_SIZEOF_PTR}" = "x3" ; then 519 LG_VADDR=64 520 elif test "x${LG_SIZEOF_PTR}" = "x2" ; then 521 LG_VADDR=32 522 elif test "x${LG_SIZEOF_PTR}" = "xLG_SIZEOF_PTR_WIN" ; then 523 LG_VADDR="(1U << (LG_SIZEOF_PTR_WIN+3))" 524 else 525 AC_MSG_ERROR([Unsupported lg(pointer size): ${LG_SIZEOF_PTR}]) 526 fi 527 AC_MSG_RESULT([$LG_VADDR]) 528 fi 529 ;; 530esac 531AC_DEFINE_UNQUOTED([LG_VADDR], [$LG_VADDR], [ ]) 532 533LD_PRELOAD_VAR="LD_PRELOAD" 534so="so" 535importlib="${so}" 536o="$ac_objext" 537a="a" 538exe="$ac_exeext" 539libprefix="lib" 540link_whole_archive="0" 541DSO_LDFLAGS='-shared -Wl,-soname,$(@F)' 542RPATH='-Wl,-rpath,$(1)' 543SOREV="${so}.${rev}" 544PIC_CFLAGS='-fPIC -DPIC' 545CTARGET='-o $@' 546LDTARGET='-o $@' 547TEST_LD_MODE= 548EXTRA_LDFLAGS= 549ARFLAGS='crus' 550AROUT=' $@' 551CC_MM=1 552 553if test "x$je_cv_cray_prgenv_wrapper" = "xyes" ; then 554 TEST_LD_MODE='-dynamic' 555fi 556 557if test "x${je_cv_cray}" = "xyes" ; then 558 CC_MM= 559fi 560 561AN_MAKEVAR([AR], [AC_PROG_AR]) 562AN_PROGRAM([ar], [AC_PROG_AR]) 563AC_DEFUN([AC_PROG_AR], [AC_CHECK_TOOL(AR, ar, :)]) 564AC_PROG_AR 565 566AN_MAKEVAR([NM], [AC_PROG_NM]) 567AN_PROGRAM([nm], [AC_PROG_NM]) 568AC_DEFUN([AC_PROG_NM], [AC_CHECK_TOOL(NM, nm, :)]) 569AC_PROG_NM 570 571AC_PROG_AWK 572 573dnl ============================================================================ 574dnl jemalloc version. 575dnl 576 577AC_ARG_WITH([version], 578 [AS_HELP_STRING([--with-version=<major>.<minor>.<bugfix>-<nrev>-g<gid>], 579 [Version string])], 580 [ 581 echo "${with_version}" | grep ['^[0-9]\+\.[0-9]\+\.[0-9]\+-[0-9]\+-g[0-9a-f]\+$'] 2>&1 1>/dev/null 582 if test $? -eq 0 ; then 583 echo "$with_version" > "${objroot}VERSION" 584 else 585 echo "${with_version}" | grep ['^VERSION$'] 2>&1 1>/dev/null 586 if test $? -ne 0 ; then 587 AC_MSG_ERROR([${with_version} does not match <major>.<minor>.<bugfix>-<nrev>-g<gid> or VERSION]) 588 fi 589 fi 590 ], [ 591 dnl Set VERSION if source directory is inside a git repository. 592 if test "x`test ! \"${srcroot}\" && cd \"${srcroot}\"; git rev-parse --is-inside-work-tree 2>/dev/null`" = "xtrue" ; then 593 dnl Pattern globs aren't powerful enough to match both single- and 594 dnl double-digit version numbers, so iterate over patterns to support up 595 dnl to version 99.99.99 without any accidental matches. 596 for pattern in ['[0-9].[0-9].[0-9]' '[0-9].[0-9].[0-9][0-9]' \ 597 '[0-9].[0-9][0-9].[0-9]' '[0-9].[0-9][0-9].[0-9][0-9]' \ 598 '[0-9][0-9].[0-9].[0-9]' '[0-9][0-9].[0-9].[0-9][0-9]' \ 599 '[0-9][0-9].[0-9][0-9].[0-9]' \ 600 '[0-9][0-9].[0-9][0-9].[0-9][0-9]']; do 601 (test ! "${srcroot}" && cd "${srcroot}"; git describe --long --abbrev=40 --match="${pattern}") > "${objroot}VERSION.tmp" 2>/dev/null 602 if test $? -eq 0 ; then 603 mv "${objroot}VERSION.tmp" "${objroot}VERSION" 604 break 605 fi 606 done 607 fi 608 rm -f "${objroot}VERSION.tmp" 609 ]) 610 611if test ! -e "${objroot}VERSION" ; then 612 if test ! -e "${srcroot}VERSION" ; then 613 AC_MSG_RESULT( 614 [Missing VERSION file, and unable to generate it; creating bogus VERSION]) 615 echo "0.0.0-0-g000000missing_version_try_git_fetch_tags" > "${objroot}VERSION" 616 else 617 cp ${srcroot}VERSION ${objroot}VERSION 618 fi 619fi 620jemalloc_version=`cat "${objroot}VERSION"` 621jemalloc_version_major=`echo ${jemalloc_version} | tr ".g-" " " | awk '{print [$]1}'` 622jemalloc_version_minor=`echo ${jemalloc_version} | tr ".g-" " " | awk '{print [$]2}'` 623jemalloc_version_bugfix=`echo ${jemalloc_version} | tr ".g-" " " | awk '{print [$]3}'` 624jemalloc_version_nrev=`echo ${jemalloc_version} | tr ".g-" " " | awk '{print [$]4}'` 625jemalloc_version_gid=`echo ${jemalloc_version} | tr ".g-" " " | awk '{print [$]5}'` 626AC_SUBST([jemalloc_version]) 627AC_SUBST([jemalloc_version_major]) 628AC_SUBST([jemalloc_version_minor]) 629AC_SUBST([jemalloc_version_bugfix]) 630AC_SUBST([jemalloc_version_nrev]) 631AC_SUBST([jemalloc_version_gid]) 632 633dnl Platform-specific settings. abi and RPATH can probably be determined 634dnl programmatically, but doing so is error-prone, which makes it generally 635dnl not worth the trouble. 636dnl 637dnl Define cpp macros in CPPFLAGS, rather than doing AC_DEFINE(macro), since the 638dnl definitions need to be seen before any headers are included, which is a pain 639dnl to make happen otherwise. 640default_retain="0" 641zero_realloc_default_free="0" 642maps_coalesce="1" 643DUMP_SYMS="${NM} -a" 644SYM_PREFIX="" 645case "${host}" in 646 *-*-darwin* | *-*-ios*) 647 abi="macho" 648 RPATH="" 649 LD_PRELOAD_VAR="DYLD_INSERT_LIBRARIES" 650 so="dylib" 651 importlib="${so}" 652 force_tls="0" 653 DSO_LDFLAGS='-shared -Wl,-install_name,$(LIBDIR)/$(@F)' 654 SOREV="${rev}.${so}" 655 sbrk_deprecated="1" 656 SYM_PREFIX="_" 657 ;; 658 *-*-freebsd*) 659 JE_APPEND_VS(CPPFLAGS, -D_BSD_SOURCE) 660 abi="elf" 661 AC_DEFINE([JEMALLOC_SYSCTL_VM_OVERCOMMIT], [ ], [ ]) 662 force_lazy_lock="1" 663 ;; 664 *-*-dragonfly*) 665 abi="elf" 666 ;; 667 *-*-openbsd*) 668 abi="elf" 669 force_tls="0" 670 ;; 671 *-*-bitrig*) 672 abi="elf" 673 ;; 674 *-*-linux-android*) 675 dnl syscall(2) and secure_getenv(3) are exposed by _GNU_SOURCE. 676 JE_APPEND_VS(CPPFLAGS, -D_GNU_SOURCE) 677 abi="elf" 678 glibc="0" 679 AC_DEFINE([JEMALLOC_PURGE_MADVISE_DONTNEED_ZEROS], [ ], [ ]) 680 AC_DEFINE([JEMALLOC_HAS_ALLOCA_H], [ ], [ ]) 681 AC_DEFINE([JEMALLOC_PROC_SYS_VM_OVERCOMMIT_MEMORY], [ ], [ ]) 682 AC_DEFINE([JEMALLOC_THREADED_INIT], [ ], [ ]) 683 AC_DEFINE([JEMALLOC_C11_ATOMICS], [ ], [ ]) 684 force_tls="0" 685 if test "${LG_SIZEOF_PTR}" = "3"; then 686 default_retain="1" 687 fi 688 zero_realloc_default_free="1" 689 ;; 690 *-*-linux*) 691 dnl syscall(2) and secure_getenv(3) are exposed by _GNU_SOURCE. 692 JE_APPEND_VS(CPPFLAGS, -D_GNU_SOURCE) 693 abi="elf" 694 glibc="1" 695 AC_DEFINE([JEMALLOC_PURGE_MADVISE_DONTNEED_ZEROS], [ ], [ ]) 696 AC_DEFINE([JEMALLOC_HAS_ALLOCA_H], [ ], [ ]) 697 AC_DEFINE([JEMALLOC_PROC_SYS_VM_OVERCOMMIT_MEMORY], [ ], [ ]) 698 AC_DEFINE([JEMALLOC_THREADED_INIT], [ ], [ ]) 699 AC_DEFINE([JEMALLOC_USE_CXX_THROW], [ ], [ ]) 700 if test "${LG_SIZEOF_PTR}" = "3"; then 701 default_retain="1" 702 fi 703 zero_realloc_default_free="1" 704 ;; 705 *-*-kfreebsd*) 706 dnl syscall(2) and secure_getenv(3) are exposed by _GNU_SOURCE. 707 JE_APPEND_VS(CPPFLAGS, -D_GNU_SOURCE) 708 abi="elf" 709 AC_DEFINE([JEMALLOC_HAS_ALLOCA_H], [ ], [ ]) 710 AC_DEFINE([JEMALLOC_SYSCTL_VM_OVERCOMMIT], [ ], [ ]) 711 AC_DEFINE([JEMALLOC_THREADED_INIT], [ ], [ ]) 712 AC_DEFINE([JEMALLOC_USE_CXX_THROW], [ ], [ ]) 713 ;; 714 *-*-netbsd*) 715 AC_MSG_CHECKING([ABI]) 716 AC_COMPILE_IFELSE([AC_LANG_PROGRAM( 717[[#ifdef __ELF__ 718/* ELF */ 719#else 720#error aout 721#endif 722]])], 723 [abi="elf"], 724 [abi="aout"]) 725 AC_MSG_RESULT([$abi]) 726 ;; 727 *-*-solaris2*) 728 abi="elf" 729 RPATH='-Wl,-R,$(1)' 730 dnl Solaris needs this for sigwait(). 731 JE_APPEND_VS(CPPFLAGS, -D_POSIX_PTHREAD_SEMANTICS) 732 JE_APPEND_VS(LIBS, -lposix4 -lsocket -lnsl) 733 ;; 734 *-ibm-aix*) 735 if test "${LG_SIZEOF_PTR}" = "3"; then 736 dnl 64bit AIX 737 LD_PRELOAD_VAR="LDR_PRELOAD64" 738 else 739 dnl 32bit AIX 740 LD_PRELOAD_VAR="LDR_PRELOAD" 741 fi 742 abi="xcoff" 743 ;; 744 *-*-mingw* | *-*-cygwin*) 745 abi="pecoff" 746 force_tls="0" 747 maps_coalesce="0" 748 RPATH="" 749 so="dll" 750 if test "x$je_cv_msvc" = "xyes" ; then 751 importlib="lib" 752 DSO_LDFLAGS="-LD" 753 EXTRA_LDFLAGS="-link -DEBUG" 754 CTARGET='-Fo$@' 755 LDTARGET='-Fe$@' 756 AR='lib' 757 ARFLAGS='-nologo -out:' 758 AROUT='$@' 759 CC_MM= 760 else 761 importlib="${so}" 762 DSO_LDFLAGS="-shared" 763 link_whole_archive="1" 764 fi 765 case "${host}" in 766 *-*-cygwin*) 767 DUMP_SYMS="dumpbin /SYMBOLS" 768 ;; 769 *) 770 ;; 771 esac 772 a="lib" 773 libprefix="" 774 SOREV="${so}" 775 PIC_CFLAGS="" 776 if test "${LG_SIZEOF_PTR}" = "3"; then 777 default_retain="1" 778 fi 779 zero_realloc_default_free="1" 780 ;; 781 *-*-nto-qnx) 782 abi="elf" 783 force_tls="0" 784 AC_DEFINE([JEMALLOC_HAS_ALLOCA_H], [ ], [ ]) 785 ;; 786 *) 787 AC_MSG_RESULT([Unsupported operating system: ${host}]) 788 abi="elf" 789 ;; 790esac 791 792JEMALLOC_USABLE_SIZE_CONST=const 793AC_CHECK_HEADERS([malloc.h], [ 794 AC_MSG_CHECKING([whether malloc_usable_size definition can use const argument]) 795 AC_COMPILE_IFELSE([AC_LANG_PROGRAM( 796 [#include <malloc.h> 797 #include <stddef.h> 798 size_t malloc_usable_size(const void *ptr); 799 ], 800 [])],[ 801 AC_MSG_RESULT([yes]) 802 ],[ 803 JEMALLOC_USABLE_SIZE_CONST= 804 AC_MSG_RESULT([no]) 805 ]) 806]) 807AC_DEFINE_UNQUOTED([JEMALLOC_USABLE_SIZE_CONST], [$JEMALLOC_USABLE_SIZE_CONST], [ ]) 808AC_SUBST([abi]) 809AC_SUBST([RPATH]) 810AC_SUBST([LD_PRELOAD_VAR]) 811AC_SUBST([so]) 812AC_SUBST([importlib]) 813AC_SUBST([o]) 814AC_SUBST([a]) 815AC_SUBST([exe]) 816AC_SUBST([libprefix]) 817AC_SUBST([link_whole_archive]) 818AC_SUBST([DSO_LDFLAGS]) 819AC_SUBST([EXTRA_LDFLAGS]) 820AC_SUBST([SOREV]) 821AC_SUBST([PIC_CFLAGS]) 822AC_SUBST([CTARGET]) 823AC_SUBST([LDTARGET]) 824AC_SUBST([TEST_LD_MODE]) 825AC_SUBST([MKLIB]) 826AC_SUBST([ARFLAGS]) 827AC_SUBST([AROUT]) 828AC_SUBST([DUMP_SYMS]) 829AC_SUBST([CC_MM]) 830 831dnl Determine whether libm must be linked to use e.g. log(3). 832AC_SEARCH_LIBS([log], [m], , [AC_MSG_ERROR([Missing math functions])]) 833if test "x$ac_cv_search_log" != "xnone required" ; then 834 LM="$ac_cv_search_log" 835else 836 LM= 837fi 838AC_SUBST(LM) 839 840JE_COMPILABLE([__attribute__ syntax], 841 [static __attribute__((unused)) void foo(void){}], 842 [], 843 [je_cv_attribute]) 844if test "x${je_cv_attribute}" = "xyes" ; then 845 AC_DEFINE([JEMALLOC_HAVE_ATTR], [ ], [ ]) 846 if test "x${GCC}" = "xyes" -a "x${abi}" = "xelf"; then 847 JE_CFLAGS_ADD([-fvisibility=hidden]) 848 JE_CXXFLAGS_ADD([-fvisibility=hidden]) 849 fi 850fi 851dnl Check for tls_model attribute support (clang 3.0 still lacks support). 852JE_CFLAGS_SAVE() 853JE_CFLAGS_ADD([-Werror]) 854JE_CFLAGS_ADD([-herror_on_warning]) 855JE_COMPILABLE([tls_model attribute], [], 856 [static __thread int 857 __attribute__((tls_model("initial-exec"), unused)) foo; 858 foo = 0;], 859 [je_cv_tls_model]) 860JE_CFLAGS_RESTORE() 861dnl (Setting of JEMALLOC_TLS_MODEL is done later, after we've checked for 862dnl --disable-initial-exec-tls) 863 864dnl Check for alloc_size attribute support. 865JE_CFLAGS_SAVE() 866JE_CFLAGS_ADD([-Werror]) 867JE_CFLAGS_ADD([-herror_on_warning]) 868JE_COMPILABLE([alloc_size attribute], [#include <stdlib.h>], 869 [void *foo(size_t size) __attribute__((alloc_size(1)));], 870 [je_cv_alloc_size]) 871JE_CFLAGS_RESTORE() 872if test "x${je_cv_alloc_size}" = "xyes" ; then 873 AC_DEFINE([JEMALLOC_HAVE_ATTR_ALLOC_SIZE], [ ], [ ]) 874fi 875dnl Check for format(gnu_printf, ...) attribute support. 876JE_CFLAGS_SAVE() 877JE_CFLAGS_ADD([-Werror]) 878JE_CFLAGS_ADD([-herror_on_warning]) 879JE_COMPILABLE([format(gnu_printf, ...) attribute], [#include <stdlib.h>], 880 [void *foo(const char *format, ...) __attribute__((format(gnu_printf, 1, 2)));], 881 [je_cv_format_gnu_printf]) 882JE_CFLAGS_RESTORE() 883if test "x${je_cv_format_gnu_printf}" = "xyes" ; then 884 AC_DEFINE([JEMALLOC_HAVE_ATTR_FORMAT_GNU_PRINTF], [ ], [ ]) 885fi 886dnl Check for format(printf, ...) attribute support. 887JE_CFLAGS_SAVE() 888JE_CFLAGS_ADD([-Werror]) 889JE_CFLAGS_ADD([-herror_on_warning]) 890JE_COMPILABLE([format(printf, ...) attribute], [#include <stdlib.h>], 891 [void *foo(const char *format, ...) __attribute__((format(printf, 1, 2)));], 892 [je_cv_format_printf]) 893JE_CFLAGS_RESTORE() 894if test "x${je_cv_format_printf}" = "xyes" ; then 895 AC_DEFINE([JEMALLOC_HAVE_ATTR_FORMAT_PRINTF], [ ], [ ]) 896fi 897 898dnl Check for format_arg(...) attribute support. 899JE_CFLAGS_SAVE() 900JE_CFLAGS_ADD([-Werror]) 901JE_CFLAGS_ADD([-herror_on_warning]) 902JE_COMPILABLE([format(printf, ...) attribute], [#include <stdlib.h>], 903 [const char * __attribute__((__format_arg__(1))) foo(const char *format);], 904 [je_cv_format_arg]) 905JE_CFLAGS_RESTORE() 906if test "x${je_cv_format_arg}" = "xyes" ; then 907 AC_DEFINE([JEMALLOC_HAVE_ATTR_FORMAT_ARG], [ ], [ ]) 908fi 909 910dnl Check for fallthrough attribute support. 911JE_CFLAGS_SAVE() 912JE_CFLAGS_ADD([-Wimplicit-fallthrough]) 913JE_COMPILABLE([fallthrough attribute], 914 [#if !__has_attribute(fallthrough) 915 #error "foo" 916 #endif], 917 [int x = 0; 918 switch (x) { 919 case 0: __attribute__((__fallthrough__)); 920 case 1: return 1; 921 }], 922 [je_cv_fallthrough]) 923JE_CFLAGS_RESTORE() 924if test "x${je_cv_fallthrough}" = "xyes" ; then 925 AC_DEFINE([JEMALLOC_HAVE_ATTR_FALLTHROUGH], [ ], [ ]) 926 JE_CFLAGS_ADD([-Wimplicit-fallthrough]) 927 JE_CXXFLAGS_ADD([-Wimplicit-fallthrough]) 928fi 929 930dnl Check for cold attribute support. 931JE_CFLAGS_SAVE() 932JE_CFLAGS_ADD([-Werror]) 933JE_CFLAGS_ADD([-herror_on_warning]) 934JE_COMPILABLE([cold attribute], [], 935 [__attribute__((__cold__)) void foo();], 936 [je_cv_cold]) 937JE_CFLAGS_RESTORE() 938if test "x${je_cv_cold}" = "xyes" ; then 939 AC_DEFINE([JEMALLOC_HAVE_ATTR_COLD], [ ], [ ]) 940fi 941 942dnl Check for VM_MAKE_TAG for mmap support. 943JE_COMPILABLE([vm_make_tag], 944 [#include <sys/mman.h> 945 #include <mach/vm_statistics.h>], 946 [void *p; 947 p = mmap(0, 16, PROT_READ, MAP_ANON|MAP_PRIVATE, VM_MAKE_TAG(1), 0); 948 munmap(p, 16);], 949 [je_cv_vm_make_tag]) 950if test "x${je_cv_vm_make_tag}" = "xyes" ; then 951 AC_DEFINE([JEMALLOC_HAVE_VM_MAKE_TAG], [ ], [ ]) 952fi 953 954dnl Support optional additions to rpath. 955AC_ARG_WITH([rpath], 956 [AS_HELP_STRING([--with-rpath=<rpath>], [Colon-separated rpath (ELF systems only)])], 957if test "x$with_rpath" = "xno" ; then 958 RPATH_EXTRA= 959else 960 RPATH_EXTRA="`echo $with_rpath | tr \":\" \" \"`" 961fi, 962 RPATH_EXTRA= 963) 964AC_SUBST([RPATH_EXTRA]) 965 966dnl Disable rules that do automatic regeneration of configure output by default. 967AC_ARG_ENABLE([autogen], 968 [AS_HELP_STRING([--enable-autogen], [Automatically regenerate configure output])], 969if test "x$enable_autogen" = "xno" ; then 970 enable_autogen="0" 971else 972 enable_autogen="1" 973fi 974, 975enable_autogen="0" 976) 977AC_SUBST([enable_autogen]) 978 979AC_PROG_INSTALL 980AC_PROG_RANLIB 981AC_PATH_PROG([LD], [ld], [false], [$PATH]) 982AC_PATH_PROG([AUTOCONF], [autoconf], [false], [$PATH]) 983 984dnl Enable documentation 985AC_ARG_ENABLE([doc], 986 [AS_HELP_STRING([--enable-doc], [Build documentation])], 987if test "x$enable_doc" = "xno" ; then 988 enable_doc="0" 989else 990 enable_doc="1" 991fi 992, 993enable_doc="1" 994) 995AC_SUBST([enable_doc]) 996 997dnl Enable shared libs 998AC_ARG_ENABLE([shared], 999 [AS_HELP_STRING([--enable-shared], [Build shared libaries])], 1000if test "x$enable_shared" = "xno" ; then 1001 enable_shared="0" 1002else 1003 enable_shared="1" 1004fi 1005, 1006enable_shared="1" 1007) 1008AC_SUBST([enable_shared]) 1009 1010dnl Enable static libs 1011AC_ARG_ENABLE([static], 1012 [AS_HELP_STRING([--enable-static], [Build static libaries])], 1013if test "x$enable_static" = "xno" ; then 1014 enable_static="0" 1015else 1016 enable_static="1" 1017fi 1018, 1019enable_static="1" 1020) 1021AC_SUBST([enable_static]) 1022 1023if test "$enable_shared$enable_static" = "00" ; then 1024 AC_MSG_ERROR([Please enable one of shared or static builds]) 1025fi 1026 1027dnl Perform no name mangling by default. 1028AC_ARG_WITH([mangling], 1029 [AS_HELP_STRING([--with-mangling=<map>], [Mangle symbols in <map>])], 1030 [mangling_map="$with_mangling"], [mangling_map=""]) 1031 1032dnl Do not prefix public APIs by default. 1033AC_ARG_WITH([jemalloc_prefix], 1034 [AS_HELP_STRING([--with-jemalloc-prefix=<prefix>], [Prefix to prepend to all public APIs])], 1035 [JEMALLOC_PREFIX="$with_jemalloc_prefix"], 1036 [if test "x$abi" != "xmacho" -a "x$abi" != "xpecoff"; then 1037 JEMALLOC_PREFIX="" 1038else 1039 JEMALLOC_PREFIX="je_" 1040fi] 1041) 1042if test "x$JEMALLOC_PREFIX" = "x" ; then 1043 AC_DEFINE([JEMALLOC_IS_MALLOC], [ ], [ ]) 1044else 1045 JEMALLOC_CPREFIX=`echo ${JEMALLOC_PREFIX} | tr "a-z" "A-Z"` 1046 AC_DEFINE_UNQUOTED([JEMALLOC_PREFIX], ["$JEMALLOC_PREFIX"], [ ]) 1047 AC_DEFINE_UNQUOTED([JEMALLOC_CPREFIX], ["$JEMALLOC_CPREFIX"], [ ]) 1048fi 1049AC_SUBST([JEMALLOC_PREFIX]) 1050AC_SUBST([JEMALLOC_CPREFIX]) 1051 1052AC_ARG_WITH([export], 1053 [AS_HELP_STRING([--without-export], [disable exporting jemalloc public APIs])], 1054 [if test "x$with_export" = "xno"; then 1055 AC_DEFINE([JEMALLOC_EXPORT],[], [ ]) 1056fi] 1057) 1058 1059public_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" 1060dnl Check for additional platform-specific public API functions. 1061AC_CHECK_FUNC([memalign], 1062 [AC_DEFINE([JEMALLOC_OVERRIDE_MEMALIGN], [ ], [ ]) 1063 public_syms="${public_syms} memalign"]) 1064AC_CHECK_FUNC([valloc], 1065 [AC_DEFINE([JEMALLOC_OVERRIDE_VALLOC], [ ], [ ]) 1066 public_syms="${public_syms} valloc"]) 1067AC_CHECK_FUNC([malloc_size], 1068 [AC_DEFINE([JEMALLOC_HAVE_MALLOC_SIZE], [ ], [ ]) 1069 public_syms="${public_syms} malloc_size"]) 1070 1071dnl Check for allocator-related functions that should be wrapped. 1072wrap_syms= 1073if test "x${JEMALLOC_PREFIX}" = "x" ; then 1074 AC_CHECK_FUNC([__libc_calloc], 1075 [AC_DEFINE([JEMALLOC_OVERRIDE___LIBC_CALLOC], [ ], [ ]) 1076 wrap_syms="${wrap_syms} __libc_calloc"]) 1077 AC_CHECK_FUNC([__libc_free], 1078 [AC_DEFINE([JEMALLOC_OVERRIDE___LIBC_FREE], [ ], [ ]) 1079 wrap_syms="${wrap_syms} __libc_free"]) 1080 AC_CHECK_FUNC([__libc_malloc], 1081 [AC_DEFINE([JEMALLOC_OVERRIDE___LIBC_MALLOC], [ ], [ ]) 1082 wrap_syms="${wrap_syms} __libc_malloc"]) 1083 AC_CHECK_FUNC([__libc_memalign], 1084 [AC_DEFINE([JEMALLOC_OVERRIDE___LIBC_MEMALIGN], [ ], [ ]) 1085 wrap_syms="${wrap_syms} __libc_memalign"]) 1086 AC_CHECK_FUNC([__libc_realloc], 1087 [AC_DEFINE([JEMALLOC_OVERRIDE___LIBC_REALLOC], [ ], [ ]) 1088 wrap_syms="${wrap_syms} __libc_realloc"]) 1089 AC_CHECK_FUNC([__libc_valloc], 1090 [AC_DEFINE([JEMALLOC_OVERRIDE___LIBC_VALLOC], [ ], [ ]) 1091 wrap_syms="${wrap_syms} __libc_valloc"]) 1092 AC_CHECK_FUNC([__posix_memalign], 1093 [AC_DEFINE([JEMALLOC_OVERRIDE___POSIX_MEMALIGN], [ ], [ ]) 1094 wrap_syms="${wrap_syms} __posix_memalign"]) 1095fi 1096 1097case "${host}" in 1098 *-*-mingw* | *-*-cygwin*) 1099 wrap_syms="${wrap_syms} tls_callback" 1100 ;; 1101 *) 1102 ;; 1103esac 1104 1105dnl Mangle library-private APIs. 1106AC_ARG_WITH([private_namespace], 1107 [AS_HELP_STRING([--with-private-namespace=<prefix>], [Prefix to prepend to all library-private APIs])], 1108 [JEMALLOC_PRIVATE_NAMESPACE="${with_private_namespace}je_"], 1109 [JEMALLOC_PRIVATE_NAMESPACE="je_"] 1110) 1111AC_DEFINE_UNQUOTED([JEMALLOC_PRIVATE_NAMESPACE], [$JEMALLOC_PRIVATE_NAMESPACE], [ ]) 1112private_namespace="$JEMALLOC_PRIVATE_NAMESPACE" 1113AC_SUBST([private_namespace]) 1114 1115dnl Do not add suffix to installed files by default. 1116AC_ARG_WITH([install_suffix], 1117 [AS_HELP_STRING([--with-install-suffix=<suffix>], [Suffix to append to all installed files])], 1118 [case "$with_install_suffix" in 1119 *\ * ) AC_MSG_ERROR([Install suffix should not contain spaces]) ;; 1120 * ) INSTALL_SUFFIX="$with_install_suffix" ;; 1121esac], 1122 [INSTALL_SUFFIX=] 1123) 1124install_suffix="$INSTALL_SUFFIX" 1125AC_SUBST([install_suffix]) 1126 1127dnl Specify default malloc_conf. 1128AC_ARG_WITH([malloc_conf], 1129 [AS_HELP_STRING([--with-malloc-conf=<malloc_conf>], [config.malloc_conf options string])], 1130 [JEMALLOC_CONFIG_MALLOC_CONF="$with_malloc_conf"], 1131 [JEMALLOC_CONFIG_MALLOC_CONF=""] 1132) 1133config_malloc_conf="$JEMALLOC_CONFIG_MALLOC_CONF" 1134AC_DEFINE_UNQUOTED([JEMALLOC_CONFIG_MALLOC_CONF], ["$config_malloc_conf"], [ ]) 1135 1136dnl Substitute @je_@ in jemalloc_protos.h.in, primarily to make generation of 1137dnl jemalloc_protos_jet.h easy. 1138je_="je_" 1139AC_SUBST([je_]) 1140 1141cfgoutputs_in="Makefile.in" 1142cfgoutputs_in="${cfgoutputs_in} jemalloc.pc.in" 1143cfgoutputs_in="${cfgoutputs_in} doc/html.xsl.in" 1144cfgoutputs_in="${cfgoutputs_in} doc/manpages.xsl.in" 1145cfgoutputs_in="${cfgoutputs_in} doc/jemalloc.xml.in" 1146cfgoutputs_in="${cfgoutputs_in} include/jemalloc/jemalloc_macros.h.in" 1147cfgoutputs_in="${cfgoutputs_in} include/jemalloc/jemalloc_protos.h.in" 1148cfgoutputs_in="${cfgoutputs_in} include/jemalloc/jemalloc_typedefs.h.in" 1149cfgoutputs_in="${cfgoutputs_in} include/jemalloc/internal/jemalloc_preamble.h.in" 1150cfgoutputs_in="${cfgoutputs_in} test/test.sh.in" 1151cfgoutputs_in="${cfgoutputs_in} test/include/test/jemalloc_test.h.in" 1152 1153cfgoutputs_out="Makefile" 1154cfgoutputs_out="${cfgoutputs_out} jemalloc.pc" 1155cfgoutputs_out="${cfgoutputs_out} doc/html.xsl" 1156cfgoutputs_out="${cfgoutputs_out} doc/manpages.xsl" 1157cfgoutputs_out="${cfgoutputs_out} doc/jemalloc.xml" 1158cfgoutputs_out="${cfgoutputs_out} include/jemalloc/jemalloc_macros.h" 1159cfgoutputs_out="${cfgoutputs_out} include/jemalloc/jemalloc_protos.h" 1160cfgoutputs_out="${cfgoutputs_out} include/jemalloc/jemalloc_typedefs.h" 1161cfgoutputs_out="${cfgoutputs_out} include/jemalloc/internal/jemalloc_preamble.h" 1162cfgoutputs_out="${cfgoutputs_out} test/test.sh" 1163cfgoutputs_out="${cfgoutputs_out} test/include/test/jemalloc_test.h" 1164 1165cfgoutputs_tup="Makefile" 1166cfgoutputs_tup="${cfgoutputs_tup} jemalloc.pc:jemalloc.pc.in" 1167cfgoutputs_tup="${cfgoutputs_tup} doc/html.xsl:doc/html.xsl.in" 1168cfgoutputs_tup="${cfgoutputs_tup} doc/manpages.xsl:doc/manpages.xsl.in" 1169cfgoutputs_tup="${cfgoutputs_tup} doc/jemalloc.xml:doc/jemalloc.xml.in" 1170cfgoutputs_tup="${cfgoutputs_tup} include/jemalloc/jemalloc_macros.h:include/jemalloc/jemalloc_macros.h.in" 1171cfgoutputs_tup="${cfgoutputs_tup} include/jemalloc/jemalloc_protos.h:include/jemalloc/jemalloc_protos.h.in" 1172cfgoutputs_tup="${cfgoutputs_tup} include/jemalloc/jemalloc_typedefs.h:include/jemalloc/jemalloc_typedefs.h.in" 1173cfgoutputs_tup="${cfgoutputs_tup} include/jemalloc/internal/jemalloc_preamble.h" 1174cfgoutputs_tup="${cfgoutputs_tup} test/test.sh:test/test.sh.in" 1175cfgoutputs_tup="${cfgoutputs_tup} test/include/test/jemalloc_test.h:test/include/test/jemalloc_test.h.in" 1176 1177cfghdrs_in="include/jemalloc/jemalloc_defs.h.in" 1178cfghdrs_in="${cfghdrs_in} include/jemalloc/internal/jemalloc_internal_defs.h.in" 1179cfghdrs_in="${cfghdrs_in} include/jemalloc/internal/private_symbols.sh" 1180cfghdrs_in="${cfghdrs_in} include/jemalloc/internal/private_namespace.sh" 1181cfghdrs_in="${cfghdrs_in} include/jemalloc/internal/public_namespace.sh" 1182cfghdrs_in="${cfghdrs_in} include/jemalloc/internal/public_unnamespace.sh" 1183cfghdrs_in="${cfghdrs_in} include/jemalloc/jemalloc_rename.sh" 1184cfghdrs_in="${cfghdrs_in} include/jemalloc/jemalloc_mangle.sh" 1185cfghdrs_in="${cfghdrs_in} include/jemalloc/jemalloc.sh" 1186cfghdrs_in="${cfghdrs_in} test/include/test/jemalloc_test_defs.h.in" 1187 1188cfghdrs_out="include/jemalloc/jemalloc_defs.h" 1189cfghdrs_out="${cfghdrs_out} include/jemalloc/jemalloc${install_suffix}.h" 1190cfghdrs_out="${cfghdrs_out} include/jemalloc/internal/private_symbols.awk" 1191cfghdrs_out="${cfghdrs_out} include/jemalloc/internal/private_symbols_jet.awk" 1192cfghdrs_out="${cfghdrs_out} include/jemalloc/internal/public_symbols.txt" 1193cfghdrs_out="${cfghdrs_out} include/jemalloc/internal/public_namespace.h" 1194cfghdrs_out="${cfghdrs_out} include/jemalloc/internal/public_unnamespace.h" 1195cfghdrs_out="${cfghdrs_out} include/jemalloc/jemalloc_protos_jet.h" 1196cfghdrs_out="${cfghdrs_out} include/jemalloc/jemalloc_rename.h" 1197cfghdrs_out="${cfghdrs_out} include/jemalloc/jemalloc_mangle.h" 1198cfghdrs_out="${cfghdrs_out} include/jemalloc/jemalloc_mangle_jet.h" 1199cfghdrs_out="${cfghdrs_out} include/jemalloc/internal/jemalloc_internal_defs.h" 1200cfghdrs_out="${cfghdrs_out} test/include/test/jemalloc_test_defs.h" 1201 1202cfghdrs_tup="include/jemalloc/jemalloc_defs.h:include/jemalloc/jemalloc_defs.h.in" 1203cfghdrs_tup="${cfghdrs_tup} include/jemalloc/internal/jemalloc_internal_defs.h:include/jemalloc/internal/jemalloc_internal_defs.h.in" 1204cfghdrs_tup="${cfghdrs_tup} test/include/test/jemalloc_test_defs.h:test/include/test/jemalloc_test_defs.h.in" 1205 1206dnl ============================================================================ 1207dnl jemalloc build options. 1208dnl 1209 1210dnl Do not compile with debugging by default. 1211AC_ARG_ENABLE([debug], 1212 [AS_HELP_STRING([--enable-debug], 1213 [Build debugging code])], 1214[if test "x$enable_debug" = "xno" ; then 1215 enable_debug="0" 1216else 1217 enable_debug="1" 1218fi 1219], 1220[enable_debug="0"] 1221) 1222if test "x$enable_debug" = "x1" ; then 1223 AC_DEFINE([JEMALLOC_DEBUG], [ ], [ ]) 1224fi 1225AC_SUBST([enable_debug]) 1226 1227dnl Only optimize if not debugging. 1228if test "x$enable_debug" = "x0" ; then 1229 if test "x$GCC" = "xyes" ; then 1230 JE_CFLAGS_ADD([-O3]) 1231 JE_CXXFLAGS_ADD([-O3]) 1232 JE_CFLAGS_ADD([-funroll-loops]) 1233 elif test "x$je_cv_msvc" = "xyes" ; then 1234 JE_CFLAGS_ADD([-O2]) 1235 JE_CXXFLAGS_ADD([-O2]) 1236 else 1237 JE_CFLAGS_ADD([-O]) 1238 JE_CXXFLAGS_ADD([-O]) 1239 fi 1240fi 1241 1242dnl Enable statistics calculation by default. 1243AC_ARG_ENABLE([stats], 1244 [AS_HELP_STRING([--disable-stats], 1245 [Disable statistics calculation/reporting])], 1246[if test "x$enable_stats" = "xno" ; then 1247 enable_stats="0" 1248else 1249 enable_stats="1" 1250fi 1251], 1252[enable_stats="1"] 1253) 1254if test "x$enable_stats" = "x1" ; then 1255 AC_DEFINE([JEMALLOC_STATS], [ ], [ ]) 1256fi 1257AC_SUBST([enable_stats]) 1258 1259dnl Do not enable smallocx by default. 1260AC_ARG_ENABLE([experimental_smallocx], 1261 [AS_HELP_STRING([--enable-experimental-smallocx], [Enable experimental smallocx API])], 1262[if test "x$enable_experimental_smallocx" = "xno" ; then 1263enable_experimental_smallocx="0" 1264else 1265enable_experimental_smallocx="1" 1266fi 1267], 1268[enable_experimental_smallocx="0"] 1269) 1270if test "x$enable_experimental_smallocx" = "x1" ; then 1271 AC_DEFINE([JEMALLOC_EXPERIMENTAL_SMALLOCX_API], [ ], [ ]) 1272fi 1273AC_SUBST([enable_experimental_smallocx]) 1274 1275dnl Do not enable profiling by default. 1276AC_ARG_ENABLE([prof], 1277 [AS_HELP_STRING([--enable-prof], [Enable allocation profiling])], 1278[if test "x$enable_prof" = "xno" ; then 1279 enable_prof="0" 1280else 1281 enable_prof="1" 1282fi 1283], 1284[enable_prof="0"] 1285) 1286if test "x$enable_prof" = "x1" ; then 1287 backtrace_method="" 1288else 1289 backtrace_method="N/A" 1290fi 1291 1292AC_ARG_ENABLE([prof-libunwind], 1293 [AS_HELP_STRING([--enable-prof-libunwind], [Use libunwind for backtracing])], 1294[if test "x$enable_prof_libunwind" = "xno" ; then 1295 enable_prof_libunwind="0" 1296else 1297 enable_prof_libunwind="1" 1298 if test "x$enable_prof" = "x0" ; then 1299 AC_MSG_ERROR([--enable-prof-libunwind should only be used with --enable-prof]) 1300 fi 1301fi 1302], 1303[enable_prof_libunwind="0"] 1304) 1305AC_ARG_WITH([static_libunwind], 1306 [AS_HELP_STRING([--with-static-libunwind=<libunwind.a>], 1307 [Path to static libunwind library; use rather than dynamically linking])], 1308if test "x$with_static_libunwind" = "xno" ; then 1309 LUNWIND="-lunwind" 1310else 1311 if test ! -f "$with_static_libunwind" ; then 1312 AC_MSG_ERROR([Static libunwind not found: $with_static_libunwind]) 1313 fi 1314 LUNWIND="$with_static_libunwind" 1315fi, 1316 LUNWIND="-lunwind" 1317) 1318if test "x$backtrace_method" = "x" -a "x$enable_prof_libunwind" = "x1" ; then 1319 AC_CHECK_HEADERS([libunwind.h], , [enable_prof_libunwind="0"]) 1320 if test "x$LUNWIND" = "x-lunwind" ; then 1321 AC_CHECK_LIB([unwind], [unw_backtrace], [JE_APPEND_VS(LIBS, $LUNWIND)], 1322 [enable_prof_libunwind="0"]) 1323 else 1324 JE_APPEND_VS(LIBS, $LUNWIND) 1325 fi 1326 if test "x${enable_prof_libunwind}" = "x1" ; then 1327 backtrace_method="libunwind" 1328 AC_DEFINE([JEMALLOC_PROF_LIBUNWIND], [ ], [ ]) 1329 fi 1330fi 1331 1332AC_ARG_ENABLE([prof-libgcc], 1333 [AS_HELP_STRING([--disable-prof-libgcc], 1334 [Do not use libgcc for backtracing])], 1335[if test "x$enable_prof_libgcc" = "xno" ; then 1336 enable_prof_libgcc="0" 1337else 1338 enable_prof_libgcc="1" 1339fi 1340], 1341[enable_prof_libgcc="1"] 1342) 1343if test "x$backtrace_method" = "x" -a "x$enable_prof_libgcc" = "x1" \ 1344 -a "x$GCC" = "xyes" ; then 1345 AC_CHECK_HEADERS([unwind.h], , [enable_prof_libgcc="0"]) 1346 if test "x${enable_prof_libgcc}" = "x1" ; then 1347 AC_CHECK_LIB([gcc], [_Unwind_Backtrace], [JE_APPEND_VS(LIBS, -lgcc)], [enable_prof_libgcc="0"]) 1348 fi 1349 if test "x${enable_prof_libgcc}" = "x1" ; then 1350 backtrace_method="libgcc" 1351 AC_DEFINE([JEMALLOC_PROF_LIBGCC], [ ], [ ]) 1352 fi 1353else 1354 enable_prof_libgcc="0" 1355fi 1356 1357AC_ARG_ENABLE([prof-gcc], 1358 [AS_HELP_STRING([--disable-prof-gcc], 1359 [Do not use gcc intrinsics for backtracing])], 1360[if test "x$enable_prof_gcc" = "xno" ; then 1361 enable_prof_gcc="0" 1362else 1363 enable_prof_gcc="1" 1364fi 1365], 1366[enable_prof_gcc="1"] 1367) 1368if test "x$backtrace_method" = "x" -a "x$enable_prof_gcc" = "x1" \ 1369 -a "x$GCC" = "xyes" ; then 1370 JE_CFLAGS_ADD([-fno-omit-frame-pointer]) 1371 backtrace_method="gcc intrinsics" 1372 AC_DEFINE([JEMALLOC_PROF_GCC], [ ], [ ]) 1373else 1374 enable_prof_gcc="0" 1375fi 1376 1377if test "x$backtrace_method" = "x" ; then 1378 backtrace_method="none (disabling profiling)" 1379 enable_prof="0" 1380fi 1381AC_MSG_CHECKING([configured backtracing method]) 1382AC_MSG_RESULT([$backtrace_method]) 1383if test "x$enable_prof" = "x1" ; then 1384 dnl Heap profiling uses the log(3) function. 1385 JE_APPEND_VS(LIBS, $LM) 1386 1387 AC_DEFINE([JEMALLOC_PROF], [ ], [ ]) 1388fi 1389AC_SUBST([enable_prof]) 1390 1391dnl Indicate whether adjacent virtual memory mappings automatically coalesce 1392dnl (and fragment on demand). 1393if test "x${maps_coalesce}" = "x1" ; then 1394 AC_DEFINE([JEMALLOC_MAPS_COALESCE], [ ], [ ]) 1395fi 1396 1397dnl Indicate whether to retain memory (rather than using munmap()) by default. 1398if test "x$default_retain" = "x1" ; then 1399 AC_DEFINE([JEMALLOC_RETAIN], [ ], [ ]) 1400fi 1401 1402dnl Indicate whether realloc(ptr, 0) defaults to the "alloc" behavior. 1403if test "x$zero_realloc_default_free" = "x1" ; then 1404 AC_DEFINE([JEMALLOC_ZERO_REALLOC_DEFAULT_FREE], [ ], [ ]) 1405fi 1406 1407dnl Enable allocation from DSS if supported by the OS. 1408have_dss="1" 1409dnl Check whether the BSD/SUSv1 sbrk() exists. If not, disable DSS support. 1410AC_CHECK_FUNC([sbrk], [have_sbrk="1"], [have_sbrk="0"]) 1411if test "x$have_sbrk" = "x1" ; then 1412 if test "x$sbrk_deprecated" = "x1" ; then 1413 AC_MSG_RESULT([Disabling dss allocation because sbrk is deprecated]) 1414 have_dss="0" 1415 fi 1416else 1417 have_dss="0" 1418fi 1419 1420if test "x$have_dss" = "x1" ; then 1421 AC_DEFINE([JEMALLOC_DSS], [ ], [ ]) 1422fi 1423 1424dnl Support the junk/zero filling option by default. 1425AC_ARG_ENABLE([fill], 1426 [AS_HELP_STRING([--disable-fill], [Disable support for junk/zero filling])], 1427[if test "x$enable_fill" = "xno" ; then 1428 enable_fill="0" 1429else 1430 enable_fill="1" 1431fi 1432], 1433[enable_fill="1"] 1434) 1435if test "x$enable_fill" = "x1" ; then 1436 AC_DEFINE([JEMALLOC_FILL], [ ], [ ]) 1437fi 1438AC_SUBST([enable_fill]) 1439 1440dnl Disable utrace(2)-based tracing by default. 1441AC_ARG_ENABLE([utrace], 1442 [AS_HELP_STRING([--enable-utrace], [Enable utrace(2)-based tracing])], 1443[if test "x$enable_utrace" = "xno" ; then 1444 enable_utrace="0" 1445else 1446 enable_utrace="1" 1447fi 1448], 1449[enable_utrace="0"] 1450) 1451JE_COMPILABLE([utrace(2)], [ 1452#include <sys/types.h> 1453#include <sys/param.h> 1454#include <sys/time.h> 1455#include <sys/uio.h> 1456#include <sys/ktrace.h> 1457], [ 1458 utrace((void *)0, 0); 1459], [je_cv_utrace]) 1460if test "x${je_cv_utrace}" = "xno" ; then 1461 JE_COMPILABLE([utrace(2) with label], [ 1462 #include <sys/types.h> 1463 #include <sys/param.h> 1464 #include <sys/time.h> 1465 #include <sys/uio.h> 1466 #include <sys/ktrace.h> 1467 ], [ 1468 utrace((void *)0, (void *)0, 0); 1469 ], [je_cv_utrace_label]) 1470 if test "x${je_cv_utrace_label}" = "xno"; then 1471 enable_utrace="0" 1472 fi 1473 if test "x$enable_utrace" = "x1" ; then 1474 AC_DEFINE([JEMALLOC_UTRACE_LABEL], [ ], [ ]) 1475 fi 1476else 1477 if test "x$enable_utrace" = "x1" ; then 1478 AC_DEFINE([JEMALLOC_UTRACE], [ ], [ ]) 1479 fi 1480fi 1481AC_SUBST([enable_utrace]) 1482 1483dnl Do not support the xmalloc option by default. 1484AC_ARG_ENABLE([xmalloc], 1485 [AS_HELP_STRING([--enable-xmalloc], [Support xmalloc option])], 1486[if test "x$enable_xmalloc" = "xno" ; then 1487 enable_xmalloc="0" 1488else 1489 enable_xmalloc="1" 1490fi 1491], 1492[enable_xmalloc="0"] 1493) 1494if test "x$enable_xmalloc" = "x1" ; then 1495 AC_DEFINE([JEMALLOC_XMALLOC], [ ], [ ]) 1496fi 1497AC_SUBST([enable_xmalloc]) 1498 1499dnl Support cache-oblivious allocation alignment by default. 1500AC_ARG_ENABLE([cache-oblivious], 1501 [AS_HELP_STRING([--disable-cache-oblivious], 1502 [Disable support for cache-oblivious allocation alignment])], 1503[if test "x$enable_cache_oblivious" = "xno" ; then 1504 enable_cache_oblivious="0" 1505else 1506 enable_cache_oblivious="1" 1507fi 1508], 1509[enable_cache_oblivious="1"] 1510) 1511if test "x$enable_cache_oblivious" = "x1" ; then 1512 AC_DEFINE([JEMALLOC_CACHE_OBLIVIOUS], [ ], [ ]) 1513fi 1514AC_SUBST([enable_cache_oblivious]) 1515 1516dnl Do not log by default. 1517AC_ARG_ENABLE([log], 1518 [AS_HELP_STRING([--enable-log], [Support debug logging])], 1519[if test "x$enable_log" = "xno" ; then 1520 enable_log="0" 1521else 1522 enable_log="1" 1523fi 1524], 1525[enable_log="0"] 1526) 1527if test "x$enable_log" = "x1" ; then 1528 AC_DEFINE([JEMALLOC_LOG], [ ], [ ]) 1529fi 1530AC_SUBST([enable_log]) 1531 1532dnl Do not use readlinkat by default 1533AC_ARG_ENABLE([readlinkat], 1534 [AS_HELP_STRING([--enable-readlinkat], [Use readlinkat over readlink])], 1535[if test "x$enable_readlinkat" = "xno" ; then 1536 enable_readlinkat="0" 1537else 1538 enable_readlinkat="1" 1539fi 1540], 1541[enable_readlinkat="0"] 1542) 1543if test "x$enable_readlinkat" = "x1" ; then 1544 AC_DEFINE([JEMALLOC_READLINKAT], [ ], [ ]) 1545fi 1546AC_SUBST([enable_readlinkat]) 1547 1548dnl Avoid extra safety checks by default 1549AC_ARG_ENABLE([opt-safety-checks], 1550 [AS_HELP_STRING([--enable-opt-safety-checks], 1551 [Perform certain low-overhead checks, even in opt mode])], 1552[if test "x$enable_opt_safety_checks" = "xno" ; then 1553 enable_opt_safety_checks="0" 1554else 1555 enable_opt_safety_checks="1" 1556fi 1557], 1558[enable_opt_safety_checks="0"] 1559) 1560if test "x$enable_opt_safety_checks" = "x1" ; then 1561 AC_DEFINE([JEMALLOC_OPT_SAFETY_CHECKS], [ ], [ ]) 1562fi 1563AC_SUBST([enable_opt_safety_checks]) 1564 1565dnl Look for sized-deallocation bugs while otherwise being in opt mode. 1566AC_ARG_ENABLE([opt-size-checks], 1567 [AS_HELP_STRING([--enable-opt-size-checks], 1568 [Perform sized-deallocation argument checks, even in opt mode])], 1569[if test "x$enable_opt_size_checks" = "xno" ; then 1570 enable_opt_size_checks="0" 1571else 1572 enable_opt_size_checks="1" 1573fi 1574], 1575[enable_opt_size_checks="0"] 1576) 1577if test "x$enable_opt_size_checks" = "x1" ; then 1578 AC_DEFINE([JEMALLOC_OPT_SIZE_CHECKS], [ ], [ ]) 1579fi 1580AC_SUBST([enable_opt_size_checks]) 1581 1582dnl Do not check for use-after-free by default. 1583AC_ARG_ENABLE([uaf-detection], 1584 [AS_HELP_STRING([--enable-uaf-detection], 1585 [Allow sampled junk-filling on deallocation to detect use-after-free])], 1586[if test "x$enable_uaf_detection" = "xno" ; then 1587 enable_uaf_detection="0" 1588else 1589 enable_uaf_detection="1" 1590fi 1591], 1592[enable_uaf_detection="0"] 1593) 1594if test "x$enable_uaf_detection" = "x1" ; then 1595 AC_DEFINE([JEMALLOC_UAF_DETECTION], [ ]) 1596fi 1597AC_SUBST([enable_uaf_detection]) 1598 1599JE_COMPILABLE([a program using __builtin_unreachable], [ 1600void foo (void) { 1601 __builtin_unreachable(); 1602} 1603], [ 1604 { 1605 foo(); 1606 } 1607], [je_cv_gcc_builtin_unreachable]) 1608if test "x${je_cv_gcc_builtin_unreachable}" = "xyes" ; then 1609 AC_DEFINE([JEMALLOC_INTERNAL_UNREACHABLE], [__builtin_unreachable], [ ]) 1610else 1611 AC_DEFINE([JEMALLOC_INTERNAL_UNREACHABLE], [abort], [ ]) 1612fi 1613 1614dnl ============================================================================ 1615dnl Check for __builtin_ffsl(), then ffsl(3), and fail if neither are found. 1616dnl One of those two functions should (theoretically) exist on all platforms 1617dnl that jemalloc currently has a chance of functioning on without modification. 1618dnl We additionally assume ffs[ll]() or __builtin_ffs[ll]() are defined if 1619dnl ffsl() or __builtin_ffsl() are defined, respectively. 1620JE_COMPILABLE([a program using __builtin_ffsl], [ 1621#include <stdio.h> 1622#include <strings.h> 1623#include <string.h> 1624], [ 1625 { 1626 int rv = __builtin_ffsl(0x08); 1627 printf("%d\n", rv); 1628 } 1629], [je_cv_gcc_builtin_ffsl]) 1630if test "x${je_cv_gcc_builtin_ffsl}" = "xyes" ; then 1631 AC_DEFINE([JEMALLOC_INTERNAL_FFSLL], [__builtin_ffsll], [ ]) 1632 AC_DEFINE([JEMALLOC_INTERNAL_FFSL], [__builtin_ffsl], [ ]) 1633 AC_DEFINE([JEMALLOC_INTERNAL_FFS], [__builtin_ffs], [ ]) 1634else 1635 JE_COMPILABLE([a program using ffsl], [ 1636 #include <stdio.h> 1637 #include <strings.h> 1638 #include <string.h> 1639 ], [ 1640 { 1641 int rv = ffsl(0x08); 1642 printf("%d\n", rv); 1643 } 1644 ], [je_cv_function_ffsl]) 1645 if test "x${je_cv_function_ffsl}" = "xyes" ; then 1646 AC_DEFINE([JEMALLOC_INTERNAL_FFSLL], [ffsll], [ ]) 1647 AC_DEFINE([JEMALLOC_INTERNAL_FFSL], [ffsl], [ ]) 1648 AC_DEFINE([JEMALLOC_INTERNAL_FFS], [ffs], [ ]) 1649 else 1650 AC_MSG_ERROR([Cannot build without ffsl(3) or __builtin_ffsl()]) 1651 fi 1652fi 1653 1654JE_COMPILABLE([a program using __builtin_popcountl], [ 1655#include <stdio.h> 1656#include <strings.h> 1657#include <string.h> 1658], [ 1659 { 1660 int rv = __builtin_popcountl(0x08); 1661 printf("%d\n", rv); 1662 } 1663], [je_cv_gcc_builtin_popcountl]) 1664if test "x${je_cv_gcc_builtin_popcountl}" = "xyes" ; then 1665 AC_DEFINE([JEMALLOC_INTERNAL_POPCOUNT], [__builtin_popcount], [ ]) 1666 AC_DEFINE([JEMALLOC_INTERNAL_POPCOUNTL], [__builtin_popcountl], [ ]) 1667 AC_DEFINE([JEMALLOC_INTERNAL_POPCOUNTLL], [__builtin_popcountll], [ ]) 1668fi 1669 1670AC_ARG_WITH([lg_quantum], 1671 [AS_HELP_STRING([--with-lg-quantum=<lg-quantum>], 1672 [Base 2 log of minimum allocation alignment])]) 1673if test "x$with_lg_quantum" != "x" ; then 1674 AC_DEFINE_UNQUOTED([LG_QUANTUM], [$with_lg_quantum], [ ]) 1675fi 1676 1677AC_ARG_WITH([lg_slab_maxregs], 1678 [AS_HELP_STRING([--with-lg-slab-maxregs=<lg-slab-maxregs>], 1679 [Base 2 log of maximum number of regions in a slab (used with malloc_conf slab_sizes)])], 1680 [CONFIG_LG_SLAB_MAXREGS="with_lg_slab_maxregs"], 1681 [CONFIG_LG_SLAB_MAXREGS=""]) 1682if test "x$with_lg_slab_maxregs" != "x" ; then 1683 AC_DEFINE_UNQUOTED([CONFIG_LG_SLAB_MAXREGS], [$with_lg_slab_maxregs], [ ]) 1684fi 1685 1686AC_ARG_WITH([lg_page], 1687 [AS_HELP_STRING([--with-lg-page=<lg-page>], [Base 2 log of system page size])], 1688 [LG_PAGE="$with_lg_page"], [LG_PAGE="detect"]) 1689case "${host}" in 1690 aarch64-apple-darwin*) 1691 dnl When cross-compile for Apple M1 and no page size specified, use the 1692 dnl default and skip detecting the page size (which is likely incorrect). 1693 if test "x${host}" != "x${build}" -a "x$LG_PAGE" = "xdetect"; then 1694 LG_PAGE=14 1695 fi 1696 ;; 1697esac 1698if test "x$LG_PAGE" = "xdetect"; then 1699 AC_CACHE_CHECK([LG_PAGE], 1700 [je_cv_lg_page], 1701 AC_RUN_IFELSE([AC_LANG_PROGRAM( 1702[[ 1703#include <strings.h> 1704#ifdef _WIN32 1705#include <windows.h> 1706#else 1707#include <unistd.h> 1708#endif 1709#include <stdio.h> 1710]], 1711[[ 1712 int result; 1713 FILE *f; 1714 1715#ifdef _WIN32 1716 SYSTEM_INFO si; 1717 GetSystemInfo(&si); 1718 result = si.dwPageSize; 1719#else 1720 result = sysconf(_SC_PAGESIZE); 1721#endif 1722 if (result == -1) { 1723 return 1; 1724 } 1725 result = JEMALLOC_INTERNAL_FFSL(result) - 1; 1726 1727 f = fopen("conftest.out", "w"); 1728 if (f == NULL) { 1729 return 1; 1730 } 1731 fprintf(f, "%d", result); 1732 fclose(f); 1733 1734 return 0; 1735]])], 1736 [je_cv_lg_page=`cat conftest.out`], 1737 [je_cv_lg_page=undefined], 1738 [je_cv_lg_page=12])) 1739fi 1740if test "x${je_cv_lg_page}" != "x" ; then 1741 LG_PAGE="${je_cv_lg_page}" 1742fi 1743if test "x${LG_PAGE}" != "xundefined" ; then 1744 AC_DEFINE_UNQUOTED([LG_PAGE], [$LG_PAGE], [ ]) 1745else 1746 AC_MSG_ERROR([cannot determine value for LG_PAGE]) 1747fi 1748 1749AC_ARG_WITH([lg_hugepage], 1750 [AS_HELP_STRING([--with-lg-hugepage=<lg-hugepage>], 1751 [Base 2 log of system huge page size])], 1752 [je_cv_lg_hugepage="${with_lg_hugepage}"], 1753 [je_cv_lg_hugepage=""]) 1754if test "x${je_cv_lg_hugepage}" = "x" ; then 1755 dnl Look in /proc/meminfo (Linux-specific) for information on the default huge 1756 dnl page size, if any. The relevant line looks like: 1757 dnl 1758 dnl Hugepagesize: 2048 kB 1759 if test -e "/proc/meminfo" ; then 1760 hpsk=[`cat /proc/meminfo 2>/dev/null | \ 1761 grep -e '^Hugepagesize:[[:space:]]\+[0-9]\+[[:space:]]kB$' | \ 1762 awk '{print $2}'`] 1763 if test "x${hpsk}" != "x" ; then 1764 je_cv_lg_hugepage=10 1765 while test "${hpsk}" -gt 1 ; do 1766 hpsk="$((hpsk / 2))" 1767 je_cv_lg_hugepage="$((je_cv_lg_hugepage + 1))" 1768 done 1769 fi 1770 fi 1771 1772 dnl Set default if unable to automatically configure. 1773 if test "x${je_cv_lg_hugepage}" = "x" ; then 1774 je_cv_lg_hugepage=21 1775 fi 1776fi 1777if test "x${LG_PAGE}" != "xundefined" -a \ 1778 "${je_cv_lg_hugepage}" -lt "${LG_PAGE}" ; then 1779 AC_MSG_ERROR([Huge page size (2^${je_cv_lg_hugepage}) must be at least page size (2^${LG_PAGE})]) 1780fi 1781AC_DEFINE_UNQUOTED([LG_HUGEPAGE], [${je_cv_lg_hugepage}], [ ]) 1782 1783dnl ============================================================================ 1784dnl Enable libdl by default. 1785AC_ARG_ENABLE([libdl], 1786 [AS_HELP_STRING([--disable-libdl], 1787 [Do not use libdl])], 1788[if test "x$enable_libdl" = "xno" ; then 1789 enable_libdl="0" 1790else 1791 enable_libdl="1" 1792fi 1793], 1794[enable_libdl="1"] 1795) 1796AC_SUBST([libdl]) 1797 1798dnl ============================================================================ 1799dnl Configure pthreads. 1800 1801if test "x$abi" != "xpecoff" ; then 1802 AC_DEFINE([JEMALLOC_HAVE_PTHREAD], [ ], [ ]) 1803 AC_CHECK_HEADERS([pthread.h], , [AC_MSG_ERROR([pthread.h is missing])]) 1804 dnl Some systems may embed pthreads functionality in libc; check for libpthread 1805 dnl first, but try libc too before failing. 1806 AC_CHECK_LIB([pthread], [pthread_create], [JE_APPEND_VS(LIBS, -pthread)], 1807 [AC_SEARCH_LIBS([pthread_create], , , 1808 AC_MSG_ERROR([libpthread is missing]))]) 1809 wrap_syms="${wrap_syms} pthread_create" 1810 have_pthread="1" 1811 1812dnl Check if we have dlsym support. 1813 if test "x$enable_libdl" = "x1" ; then 1814 have_dlsym="1" 1815 AC_CHECK_HEADERS([dlfcn.h], 1816 AC_CHECK_FUNC([dlsym], [], 1817 [AC_CHECK_LIB([dl], [dlsym], [LIBS="$LIBS -ldl"], [have_dlsym="0"])]), 1818 [have_dlsym="0"]) 1819 if test "x$have_dlsym" = "x1" ; then 1820 AC_DEFINE([JEMALLOC_HAVE_DLSYM], [ ], [ ]) 1821 fi 1822 else 1823 have_dlsym="0" 1824 fi 1825 1826 JE_COMPILABLE([pthread_atfork(3)], [ 1827#include <pthread.h> 1828], [ 1829 pthread_atfork((void *)0, (void *)0, (void *)0); 1830], [je_cv_pthread_atfork]) 1831 if test "x${je_cv_pthread_atfork}" = "xyes" ; then 1832 AC_DEFINE([JEMALLOC_HAVE_PTHREAD_ATFORK], [ ], [ ]) 1833 fi 1834 dnl Check if pthread_setname_np is available with the expected API. 1835 JE_COMPILABLE([pthread_setname_np(3)], [ 1836#include <pthread.h> 1837], [ 1838 pthread_setname_np(pthread_self(), "setname_test"); 1839], [je_cv_pthread_setname_np]) 1840 if test "x${je_cv_pthread_setname_np}" = "xyes" ; then 1841 AC_DEFINE([JEMALLOC_HAVE_PTHREAD_SETNAME_NP], [ ], [ ]) 1842 fi 1843 dnl Check if pthread_getname_np is not necessarily present despite 1844 dnl the pthread_setname_np counterpart 1845 JE_COMPILABLE([pthread_getname_np(3)], [ 1846#include <pthread.h> 1847#include <stdlib.h> 1848], [ 1849 { 1850 char *name = malloc(16); 1851 pthread_getname_np(pthread_self(), name, 16); 1852 free(name); 1853 } 1854], [je_cv_pthread_getname_np]) 1855 if test "x${je_cv_pthread_getname_np}" = "xyes" ; then 1856 AC_DEFINE([JEMALLOC_HAVE_PTHREAD_GETNAME_NP], [ ], [ ]) 1857 fi 1858 dnl Check if pthread_get_name_np is not necessarily present despite 1859 dnl the pthread_set_name_np counterpart 1860 JE_COMPILABLE([pthread_get_name_np(3)], [ 1861#include <pthread.h> 1862#include <pthread_np.h> 1863#include <stdlib.h> 1864], [ 1865 { 1866 char *name = malloc(16); 1867 pthread_get_name_np(pthread_self(), name, 16); 1868 free(name); 1869 } 1870], [je_cv_pthread_get_name_np]) 1871 if test "x${je_cv_pthread_get_name_np}" = "xyes" ; then 1872 AC_DEFINE([JEMALLOC_HAVE_PTHREAD_GET_NAME_NP], [ ], [ ]) 1873 fi 1874fi 1875 1876JE_APPEND_VS(CPPFLAGS, -D_REENTRANT) 1877 1878dnl Check whether clock_gettime(2) is in libc or librt. 1879AC_SEARCH_LIBS([clock_gettime], [rt]) 1880 1881dnl Cray wrapper compiler often adds `-lrt` when using `-static`. Check with 1882dnl `-dynamic` as well in case a user tries to dynamically link in jemalloc 1883if test "x$je_cv_cray_prgenv_wrapper" = "xyes" ; then 1884 if test "$ac_cv_search_clock_gettime" != "-lrt"; then 1885 JE_CFLAGS_SAVE() 1886 1887 unset ac_cv_search_clock_gettime 1888 JE_CFLAGS_ADD([-dynamic]) 1889 AC_SEARCH_LIBS([clock_gettime], [rt]) 1890 1891 JE_CFLAGS_RESTORE() 1892 fi 1893fi 1894 1895dnl check for CLOCK_MONOTONIC_COARSE (Linux-specific). 1896JE_COMPILABLE([clock_gettime(CLOCK_MONOTONIC_COARSE, ...)], [ 1897#include <time.h> 1898], [ 1899 struct timespec ts; 1900 1901 clock_gettime(CLOCK_MONOTONIC_COARSE, &ts); 1902], [je_cv_clock_monotonic_coarse]) 1903if test "x${je_cv_clock_monotonic_coarse}" = "xyes" ; then 1904 AC_DEFINE([JEMALLOC_HAVE_CLOCK_MONOTONIC_COARSE], [ ], [ ]) 1905fi 1906 1907dnl check for CLOCK_MONOTONIC. 1908JE_COMPILABLE([clock_gettime(CLOCK_MONOTONIC, ...)], [ 1909#include <unistd.h> 1910#include <time.h> 1911], [ 1912 struct timespec ts; 1913 1914 clock_gettime(CLOCK_MONOTONIC, &ts); 1915#if !defined(_POSIX_MONOTONIC_CLOCK) || _POSIX_MONOTONIC_CLOCK < 0 1916# error _POSIX_MONOTONIC_CLOCK missing/invalid 1917#endif 1918], [je_cv_clock_monotonic]) 1919if test "x${je_cv_clock_monotonic}" = "xyes" ; then 1920 AC_DEFINE([JEMALLOC_HAVE_CLOCK_MONOTONIC], [ ], [ ]) 1921fi 1922 1923dnl Check for mach_absolute_time(). 1924JE_COMPILABLE([mach_absolute_time()], [ 1925#include <mach/mach_time.h> 1926], [ 1927 mach_absolute_time(); 1928], [je_cv_mach_absolute_time]) 1929if test "x${je_cv_mach_absolute_time}" = "xyes" ; then 1930 AC_DEFINE([JEMALLOC_HAVE_MACH_ABSOLUTE_TIME], [ ], [ ]) 1931fi 1932 1933dnl check for CLOCK_REALTIME (always should be available on Linux) 1934JE_COMPILABLE([clock_gettime(CLOCK_REALTIME, ...)], [ 1935#include <time.h> 1936], [ 1937 struct timespec ts; 1938 1939 clock_gettime(CLOCK_REALTIME, &ts); 1940], [je_cv_clock_realtime]) 1941if test "x${je_cv_clock_realtime}" = "xyes" ; then 1942 AC_DEFINE([JEMALLOC_HAVE_CLOCK_REALTIME], [ ], [ ]) 1943fi 1944 1945dnl Use syscall(2) (if available) by default. 1946AC_ARG_ENABLE([syscall], 1947 [AS_HELP_STRING([--disable-syscall], [Disable use of syscall(2)])], 1948[if test "x$enable_syscall" = "xno" ; then 1949 enable_syscall="0" 1950else 1951 enable_syscall="1" 1952fi 1953], 1954[enable_syscall="1"] 1955) 1956if test "x$enable_syscall" = "x1" ; then 1957 dnl Check if syscall(2) is usable. Treat warnings as errors, so that e.g. OS 1958 dnl X 10.12's deprecation warning prevents use. 1959 JE_CFLAGS_SAVE() 1960 JE_CFLAGS_ADD([-Werror]) 1961 JE_COMPILABLE([syscall(2)], [ 1962#include <sys/syscall.h> 1963#include <unistd.h> 1964], [ 1965 syscall(SYS_write, 2, "hello", 5); 1966], 1967 [je_cv_syscall]) 1968 JE_CFLAGS_RESTORE() 1969 if test "x$je_cv_syscall" = "xyes" ; then 1970 AC_DEFINE([JEMALLOC_USE_SYSCALL], [ ], [ ]) 1971 fi 1972fi 1973 1974dnl Check if the GNU-specific secure_getenv function exists. 1975AC_CHECK_FUNC([secure_getenv], 1976 [have_secure_getenv="1"], 1977 [have_secure_getenv="0"] 1978 ) 1979if test "x$have_secure_getenv" = "x1" ; then 1980 AC_DEFINE([JEMALLOC_HAVE_SECURE_GETENV], [ ], [ ]) 1981fi 1982 1983dnl Check if the GNU-specific sched_getcpu function exists. 1984AC_CHECK_FUNC([sched_getcpu], 1985 [have_sched_getcpu="1"], 1986 [have_sched_getcpu="0"] 1987 ) 1988if test "x$have_sched_getcpu" = "x1" ; then 1989 AC_DEFINE([JEMALLOC_HAVE_SCHED_GETCPU], [ ], [ ]) 1990fi 1991 1992dnl Check if the GNU-specific sched_setaffinity function exists. 1993AC_CHECK_FUNC([sched_setaffinity], 1994 [have_sched_setaffinity="1"], 1995 [have_sched_setaffinity="0"] 1996 ) 1997if test "x$have_sched_setaffinity" = "x1" ; then 1998 AC_DEFINE([JEMALLOC_HAVE_SCHED_SETAFFINITY], [ ], [ ]) 1999fi 2000 2001dnl Check if the Solaris/BSD issetugid function exists. 2002AC_CHECK_FUNC([issetugid], 2003 [have_issetugid="1"], 2004 [have_issetugid="0"] 2005 ) 2006if test "x$have_issetugid" = "x1" ; then 2007 AC_DEFINE([JEMALLOC_HAVE_ISSETUGID], [ ], [ ]) 2008fi 2009 2010dnl Check whether the BSD-specific _malloc_thread_cleanup() exists. If so, use 2011dnl it rather than pthreads TSD cleanup functions to support cleanup during 2012dnl thread exit, in order to avoid pthreads library recursion during 2013dnl bootstrapping. 2014AC_CHECK_FUNC([_malloc_thread_cleanup], 2015 [have__malloc_thread_cleanup="1"], 2016 [have__malloc_thread_cleanup="0"] 2017 ) 2018if test "x$have__malloc_thread_cleanup" = "x1" ; then 2019 AC_DEFINE([JEMALLOC_MALLOC_THREAD_CLEANUP], [ ], [ ]) 2020 wrap_syms="${wrap_syms} _malloc_thread_cleanup _malloc_tsd_cleanup_register" 2021 force_tls="1" 2022fi 2023 2024dnl Check whether the BSD-specific _pthread_mutex_init_calloc_cb() exists. If 2025dnl so, mutex initialization causes allocation, and we need to implement this 2026dnl callback function in order to prevent recursive allocation. 2027AC_CHECK_FUNC([_pthread_mutex_init_calloc_cb], 2028 [have__pthread_mutex_init_calloc_cb="1"], 2029 [have__pthread_mutex_init_calloc_cb="0"] 2030 ) 2031if test "x$have__pthread_mutex_init_calloc_cb" = "x1" ; then 2032 AC_DEFINE([JEMALLOC_MUTEX_INIT_CB], [ ], [ ]) 2033 wrap_syms="${wrap_syms} _malloc_prefork _malloc_postfork" 2034fi 2035 2036AC_CHECK_FUNC([memcntl], 2037 [have_memcntl="1"], 2038 [have_memcntl="0"], 2039 ) 2040if test "x$have_memcntl" = "x1" ; then 2041 AC_DEFINE([JEMALLOC_HAVE_MEMCNTL], [ ], [ ]) 2042fi 2043 2044dnl Disable lazy locking by default. 2045AC_ARG_ENABLE([lazy_lock], 2046 [AS_HELP_STRING([--enable-lazy-lock], 2047 [Enable lazy locking (only lock when multi-threaded)])], 2048[if test "x$enable_lazy_lock" = "xno" ; then 2049 enable_lazy_lock="0" 2050else 2051 enable_lazy_lock="1" 2052fi 2053], 2054[enable_lazy_lock=""] 2055) 2056if test "x${enable_lazy_lock}" = "x" ; then 2057 if test "x${force_lazy_lock}" = "x1" ; then 2058 AC_MSG_RESULT([Forcing lazy-lock to avoid allocator/threading bootstrap issues]) 2059 enable_lazy_lock="1" 2060 else 2061 enable_lazy_lock="0" 2062 fi 2063fi 2064if test "x${enable_lazy_lock}" = "x1" -a "x${abi}" = "xpecoff" ; then 2065 AC_MSG_RESULT([Forcing no lazy-lock because thread creation monitoring is unimplemented]) 2066 enable_lazy_lock="0" 2067fi 2068if test "x$enable_lazy_lock" = "x1" ; then 2069 if test "x$have_dlsym" = "x1" ; then 2070 AC_DEFINE([JEMALLOC_LAZY_LOCK], [ ], [ ]) 2071 else 2072 AC_MSG_ERROR([Missing dlsym support: lazy-lock cannot be enabled.]) 2073 fi 2074fi 2075AC_SUBST([enable_lazy_lock]) 2076 2077dnl Automatically configure TLS. 2078if test "x${force_tls}" = "x1" ; then 2079 enable_tls="1" 2080elif test "x${force_tls}" = "x0" ; then 2081 enable_tls="0" 2082else 2083 enable_tls="1" 2084fi 2085if test "x${enable_tls}" = "x1" ; then 2086AC_MSG_CHECKING([for TLS]) 2087AC_COMPILE_IFELSE([AC_LANG_PROGRAM( 2088[[ 2089 __thread int x; 2090]], [[ 2091 x = 42; 2092 2093 return 0; 2094]])], 2095 AC_MSG_RESULT([yes]), 2096 AC_MSG_RESULT([no]) 2097 enable_tls="0") 2098else 2099 enable_tls="0" 2100fi 2101AC_SUBST([enable_tls]) 2102if test "x${enable_tls}" = "x1" ; then 2103 AC_DEFINE_UNQUOTED([JEMALLOC_TLS], [ ], [ ]) 2104fi 2105 2106dnl ============================================================================ 2107dnl Check for C11 atomics. 2108 2109JE_COMPILABLE([C11 atomics], [ 2110#include <stdint.h> 2111#if (__STDC_VERSION__ >= 201112L) && !defined(__STDC_NO_ATOMICS__) 2112#include <stdatomic.h> 2113#else 2114#error Atomics not available 2115#endif 2116], [ 2117 uint64_t *p = (uint64_t *)0; 2118 uint64_t x = 1; 2119 volatile atomic_uint_least64_t *a = (volatile atomic_uint_least64_t *)p; 2120 uint64_t r = atomic_fetch_add(a, x) + x; 2121 return r == 0; 2122], [je_cv_c11_atomics]) 2123if test "x${je_cv_c11_atomics}" = "xyes" ; then 2124 AC_DEFINE([JEMALLOC_C11_ATOMICS], [ ], [ ]) 2125fi 2126 2127dnl ============================================================================ 2128dnl Check for GCC-style __atomic atomics. 2129 2130JE_COMPILABLE([GCC __atomic atomics], [ 2131], [ 2132 int x = 0; 2133 int val = 1; 2134 int y = __atomic_fetch_add(&x, val, __ATOMIC_RELAXED); 2135 int after_add = x; 2136 return after_add == 1; 2137], [je_cv_gcc_atomic_atomics]) 2138if test "x${je_cv_gcc_atomic_atomics}" = "xyes" ; then 2139 AC_DEFINE([JEMALLOC_GCC_ATOMIC_ATOMICS], [ ], [ ]) 2140 2141 dnl check for 8-bit atomic support 2142 JE_COMPILABLE([GCC 8-bit __atomic atomics], [ 2143 ], [ 2144 unsigned char x = 0; 2145 int val = 1; 2146 int y = __atomic_fetch_add(&x, val, __ATOMIC_RELAXED); 2147 int after_add = (int)x; 2148 return after_add == 1; 2149 ], [je_cv_gcc_u8_atomic_atomics]) 2150 if test "x${je_cv_gcc_u8_atomic_atomics}" = "xyes" ; then 2151 AC_DEFINE([JEMALLOC_GCC_U8_ATOMIC_ATOMICS], [ ], [ ]) 2152 fi 2153fi 2154 2155dnl ============================================================================ 2156dnl Check for GCC-style __sync atomics. 2157 2158JE_COMPILABLE([GCC __sync atomics], [ 2159], [ 2160 int x = 0; 2161 int before_add = __sync_fetch_and_add(&x, 1); 2162 int after_add = x; 2163 return (before_add == 0) && (after_add == 1); 2164], [je_cv_gcc_sync_atomics]) 2165if test "x${je_cv_gcc_sync_atomics}" = "xyes" ; then 2166 AC_DEFINE([JEMALLOC_GCC_SYNC_ATOMICS], [ ], [ ]) 2167 2168 dnl check for 8-bit atomic support 2169 JE_COMPILABLE([GCC 8-bit __sync atomics], [ 2170 ], [ 2171 unsigned char x = 0; 2172 int before_add = __sync_fetch_and_add(&x, 1); 2173 int after_add = (int)x; 2174 return (before_add == 0) && (after_add == 1); 2175 ], [je_cv_gcc_u8_sync_atomics]) 2176 if test "x${je_cv_gcc_u8_sync_atomics}" = "xyes" ; then 2177 AC_DEFINE([JEMALLOC_GCC_U8_SYNC_ATOMICS], [ ], [ ]) 2178 fi 2179fi 2180 2181dnl ============================================================================ 2182dnl Check for atomic(3) operations as provided on Darwin. 2183dnl We need this not for the atomic operations (which are provided above), but 2184dnl rather for the OS_unfair_lock type it exposes. 2185 2186JE_COMPILABLE([Darwin OSAtomic*()], [ 2187#include <libkern/OSAtomic.h> 2188#include <inttypes.h> 2189], [ 2190 { 2191 int32_t x32 = 0; 2192 volatile int32_t *x32p = &x32; 2193 OSAtomicAdd32(1, x32p); 2194 } 2195 { 2196 int64_t x64 = 0; 2197 volatile int64_t *x64p = &x64; 2198 OSAtomicAdd64(1, x64p); 2199 } 2200], [je_cv_osatomic]) 2201if test "x${je_cv_osatomic}" = "xyes" ; then 2202 AC_DEFINE([JEMALLOC_OSATOMIC], [ ], [ ]) 2203fi 2204 2205dnl ============================================================================ 2206dnl Check for madvise(2). 2207 2208JE_COMPILABLE([madvise(2)], [ 2209#include <sys/mman.h> 2210], [ 2211 madvise((void *)0, 0, 0); 2212], [je_cv_madvise]) 2213if test "x${je_cv_madvise}" = "xyes" ; then 2214 AC_DEFINE([JEMALLOC_HAVE_MADVISE], [ ], [ ]) 2215 2216 dnl Check for madvise(..., MADV_FREE). 2217 JE_COMPILABLE([madvise(..., MADV_FREE)], [ 2218#include <sys/mman.h> 2219], [ 2220 madvise((void *)0, 0, MADV_FREE); 2221], [je_cv_madv_free]) 2222 if test "x${je_cv_madv_free}" = "xyes" ; then 2223 AC_DEFINE([JEMALLOC_PURGE_MADVISE_FREE], [ ], [ ]) 2224 elif test "x${je_cv_madvise}" = "xyes" ; then 2225 case "${host_cpu}" in i686|x86_64) 2226 case "${host}" in *-*-linux*) 2227 AC_DEFINE([JEMALLOC_PURGE_MADVISE_FREE], [ ], [ ]) 2228 AC_DEFINE([JEMALLOC_DEFINE_MADVISE_FREE], [ ], [ ]) 2229 ;; 2230 esac 2231 ;; 2232 esac 2233 fi 2234 2235 dnl Check for madvise(..., MADV_DONTNEED). 2236 JE_COMPILABLE([madvise(..., MADV_DONTNEED)], [ 2237#include <sys/mman.h> 2238], [ 2239 madvise((void *)0, 0, MADV_DONTNEED); 2240], [je_cv_madv_dontneed]) 2241 if test "x${je_cv_madv_dontneed}" = "xyes" ; then 2242 AC_DEFINE([JEMALLOC_PURGE_MADVISE_DONTNEED], [ ], [ ]) 2243 fi 2244 2245 dnl Check for madvise(..., MADV_DO[NT]DUMP). 2246 JE_COMPILABLE([madvise(..., MADV_DO[[NT]]DUMP)], [ 2247#include <sys/mman.h> 2248], [ 2249 madvise((void *)0, 0, MADV_DONTDUMP); 2250 madvise((void *)0, 0, MADV_DODUMP); 2251], [je_cv_madv_dontdump]) 2252 if test "x${je_cv_madv_dontdump}" = "xyes" ; then 2253 AC_DEFINE([JEMALLOC_MADVISE_DONTDUMP], [ ], [ ]) 2254 fi 2255 2256 dnl Check for madvise(..., MADV_[NO]HUGEPAGE). 2257 JE_COMPILABLE([madvise(..., MADV_[[NO]]HUGEPAGE)], [ 2258#include <sys/mman.h> 2259], [ 2260 madvise((void *)0, 0, MADV_HUGEPAGE); 2261 madvise((void *)0, 0, MADV_NOHUGEPAGE); 2262], [je_cv_thp]) 2263 dnl Check for madvise(..., MADV_[NO]CORE). 2264 JE_COMPILABLE([madvise(..., MADV_[[NO]]CORE)], [ 2265#include <sys/mman.h> 2266], [ 2267 madvise((void *)0, 0, MADV_NOCORE); 2268 madvise((void *)0, 0, MADV_CORE); 2269], [je_cv_madv_nocore]) 2270 if test "x${je_cv_madv_nocore}" = "xyes" ; then 2271 AC_DEFINE([JEMALLOC_MADVISE_NOCORE], [ ], [ ]) 2272 fi 2273case "${host_cpu}" in 2274 arm*) 2275 ;; 2276 *) 2277 if test "x${je_cv_thp}" = "xyes" ; then 2278 AC_DEFINE([JEMALLOC_HAVE_MADVISE_HUGE], [ ], [ ]) 2279 fi 2280 ;; 2281esac 2282else 2283 dnl Check for posix_madvise. 2284 JE_COMPILABLE([posix_madvise], [ 2285 #include <sys/mman.h> 2286 ], [ 2287 posix_madvise((void *)0, 0, 0); 2288 ], [je_cv_posix_madvise]) 2289 if test "x${je_cv_posix_madvise}" = "xyes" ; then 2290 AC_DEFINE([JEMALLOC_HAVE_POSIX_MADVISE], [ ], [ ]) 2291 2292 dnl Check for posix_madvise(..., POSIX_MADV_DONTNEED). 2293 JE_COMPILABLE([posix_madvise(..., POSIX_MADV_DONTNEED)], [ 2294 #include <sys/mman.h> 2295 ], [ 2296 posix_madvise((void *)0, 0, POSIX_MADV_DONTNEED); 2297 ], [je_cv_posix_madv_dontneed]) 2298 if test "x${je_cv_posix_madv_dontneed}" = "xyes" ; then 2299 AC_DEFINE([JEMALLOC_PURGE_POSIX_MADVISE_DONTNEED], [ ], [ ]) 2300 fi 2301 fi 2302fi 2303 2304dnl ============================================================================ 2305dnl Check for mprotect(2). 2306 2307JE_COMPILABLE([mprotect(2)], [ 2308#include <sys/mman.h> 2309], [ 2310 mprotect((void *)0, 0, PROT_NONE); 2311], [je_cv_mprotect]) 2312if test "x${je_cv_mprotect}" = "xyes" ; then 2313 AC_DEFINE([JEMALLOC_HAVE_MPROTECT], [ ], [ ]) 2314fi 2315 2316dnl ============================================================================ 2317dnl Check for __builtin_clz(), __builtin_clzl(), and __builtin_clzll(). 2318 2319AC_CACHE_CHECK([for __builtin_clz], 2320 [je_cv_builtin_clz], 2321 [AC_LINK_IFELSE([AC_LANG_PROGRAM([], 2322 [ 2323 { 2324 unsigned x = 0; 2325 int y = __builtin_clz(x); 2326 } 2327 { 2328 unsigned long x = 0; 2329 int y = __builtin_clzl(x); 2330 } 2331 { 2332 unsigned long long x = 0; 2333 int y = __builtin_clzll(x); 2334 } 2335 ])], 2336 [je_cv_builtin_clz=yes], 2337 [je_cv_builtin_clz=no])]) 2338 2339if test "x${je_cv_builtin_clz}" = "xyes" ; then 2340 AC_DEFINE([JEMALLOC_HAVE_BUILTIN_CLZ], [ ], [ ]) 2341fi 2342 2343dnl ============================================================================ 2344dnl Check for os_unfair_lock operations as provided on Darwin. 2345 2346JE_COMPILABLE([Darwin os_unfair_lock_*()], [ 2347#include <os/lock.h> 2348#include <AvailabilityMacros.h> 2349], [ 2350 #if MAC_OS_X_VERSION_MIN_REQUIRED < 101200 2351 #error "os_unfair_lock is not supported" 2352 #else 2353 os_unfair_lock lock = OS_UNFAIR_LOCK_INIT; 2354 os_unfair_lock_lock(&lock); 2355 os_unfair_lock_unlock(&lock); 2356 #endif 2357], [je_cv_os_unfair_lock]) 2358if test "x${je_cv_os_unfair_lock}" = "xyes" ; then 2359 AC_DEFINE([JEMALLOC_OS_UNFAIR_LOCK], [ ], [ ]) 2360fi 2361 2362dnl ============================================================================ 2363dnl Darwin-related configuration. 2364 2365AC_ARG_ENABLE([zone-allocator], 2366 [AS_HELP_STRING([--disable-zone-allocator], 2367 [Disable zone allocator for Darwin])], 2368[if test "x$enable_zone_allocator" = "xno" ; then 2369 enable_zone_allocator="0" 2370else 2371 enable_zone_allocator="1" 2372fi 2373], 2374[if test "x${abi}" = "xmacho"; then 2375 enable_zone_allocator="1" 2376fi 2377] 2378) 2379AC_SUBST([enable_zone_allocator]) 2380 2381if test "x${enable_zone_allocator}" = "x1" ; then 2382 if test "x${abi}" != "xmacho"; then 2383 AC_MSG_ERROR([--enable-zone-allocator is only supported on Darwin]) 2384 fi 2385 AC_DEFINE([JEMALLOC_ZONE], [ ], [ ]) 2386fi 2387 2388dnl ============================================================================ 2389dnl Use initial-exec TLS by default. 2390AC_ARG_ENABLE([initial-exec-tls], 2391 [AS_HELP_STRING([--disable-initial-exec-tls], 2392 [Disable the initial-exec tls model])], 2393[if test "x$enable_initial_exec_tls" = "xno" ; then 2394 enable_initial_exec_tls="0" 2395else 2396 enable_initial_exec_tls="1" 2397fi 2398], 2399[enable_initial_exec_tls="1"] 2400) 2401AC_SUBST([enable_initial_exec_tls]) 2402 2403if test "x${je_cv_tls_model}" = "xyes" -a \ 2404 "x${enable_initial_exec_tls}" = "x1" ; then 2405 AC_DEFINE([JEMALLOC_TLS_MODEL], 2406 [__attribute__((tls_model("initial-exec")))], 2407 [ ]) 2408else 2409 AC_DEFINE([JEMALLOC_TLS_MODEL], [ ], [ ]) 2410fi 2411 2412dnl ============================================================================ 2413dnl Enable background threads if possible. 2414 2415if test "x${have_pthread}" = "x1" -a "x${je_cv_os_unfair_lock}" != "xyes" -a \ 2416 "x${abi}" != "xmacho" ; then 2417 AC_DEFINE([JEMALLOC_BACKGROUND_THREAD], [ ], [ ]) 2418fi 2419 2420dnl ============================================================================ 2421dnl Check for glibc malloc hooks 2422 2423if test "x$glibc" = "x1" ; then 2424 JE_COMPILABLE([glibc malloc hook], [ 2425 #include <stddef.h> 2426 2427 extern void (* __free_hook)(void *ptr); 2428 extern void *(* __malloc_hook)(size_t size); 2429 extern void *(* __realloc_hook)(void *ptr, size_t size); 2430], [ 2431 void *ptr = 0L; 2432 if (__malloc_hook) ptr = __malloc_hook(1); 2433 if (__realloc_hook) ptr = __realloc_hook(ptr, 2); 2434 if (__free_hook && ptr) __free_hook(ptr); 2435], [je_cv_glibc_malloc_hook]) 2436 if test "x${je_cv_glibc_malloc_hook}" = "xyes" ; then 2437 if test "x${JEMALLOC_PREFIX}" = "x" ; then 2438 AC_DEFINE([JEMALLOC_GLIBC_MALLOC_HOOK], [ ], [ ]) 2439 wrap_syms="${wrap_syms} __free_hook __malloc_hook __realloc_hook" 2440 fi 2441 fi 2442 2443 JE_COMPILABLE([glibc memalign hook], [ 2444 #include <stddef.h> 2445 2446 extern void *(* __memalign_hook)(size_t alignment, size_t size); 2447], [ 2448 void *ptr = 0L; 2449 if (__memalign_hook) ptr = __memalign_hook(16, 7); 2450], [je_cv_glibc_memalign_hook]) 2451 if test "x${je_cv_glibc_memalign_hook}" = "xyes" ; then 2452 if test "x${JEMALLOC_PREFIX}" = "x" ; then 2453 AC_DEFINE([JEMALLOC_GLIBC_MEMALIGN_HOOK], [ ], [ ]) 2454 wrap_syms="${wrap_syms} __memalign_hook" 2455 fi 2456 fi 2457fi 2458 2459JE_COMPILABLE([pthreads adaptive mutexes], [ 2460#include <pthread.h> 2461], [ 2462 pthread_mutexattr_t attr; 2463 pthread_mutexattr_init(&attr); 2464 pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ADAPTIVE_NP); 2465 pthread_mutexattr_destroy(&attr); 2466], [je_cv_pthread_mutex_adaptive_np]) 2467if test "x${je_cv_pthread_mutex_adaptive_np}" = "xyes" ; then 2468 AC_DEFINE([JEMALLOC_HAVE_PTHREAD_MUTEX_ADAPTIVE_NP], [ ], [ ]) 2469fi 2470 2471JE_CFLAGS_SAVE() 2472JE_CFLAGS_ADD([-D_GNU_SOURCE]) 2473JE_CFLAGS_ADD([-Werror]) 2474JE_CFLAGS_ADD([-herror_on_warning]) 2475JE_COMPILABLE([strerror_r returns char with gnu source], [ 2476#include <errno.h> 2477#include <stdio.h> 2478#include <stdlib.h> 2479#include <string.h> 2480], [ 2481 char *buffer = (char *) malloc(100); 2482 char *error = strerror_r(EINVAL, buffer, 100); 2483 printf("%s\n", error); 2484], [je_cv_strerror_r_returns_char_with_gnu_source]) 2485JE_CFLAGS_RESTORE() 2486if test "x${je_cv_strerror_r_returns_char_with_gnu_source}" = "xyes" ; then 2487 AC_DEFINE([JEMALLOC_STRERROR_R_RETURNS_CHAR_WITH_GNU_SOURCE], [ ], [ ]) 2488fi 2489 2490dnl ============================================================================ 2491dnl Check for typedefs, structures, and compiler characteristics. 2492AC_HEADER_STDBOOL 2493 2494dnl ============================================================================ 2495dnl Define commands that generate output files. 2496 2497AC_CONFIG_COMMANDS([include/jemalloc/internal/public_symbols.txt], [ 2498 f="${objroot}include/jemalloc/internal/public_symbols.txt" 2499 mkdir -p "${objroot}include/jemalloc/internal" 2500 cp /dev/null "${f}" 2501 for nm in `echo ${mangling_map} |tr ',' ' '` ; do 2502 n=`echo ${nm} |tr ':' ' ' |awk '{print $[]1}'` 2503 m=`echo ${nm} |tr ':' ' ' |awk '{print $[]2}'` 2504 echo "${n}:${m}" >> "${f}" 2505 dnl Remove name from public_syms so that it isn't redefined later. 2506 public_syms=`for sym in ${public_syms}; do echo "${sym}"; done |grep -v "^${n}\$" |tr '\n' ' '` 2507 done 2508 for sym in ${public_syms} ; do 2509 n="${sym}" 2510 m="${JEMALLOC_PREFIX}${sym}" 2511 echo "${n}:${m}" >> "${f}" 2512 done 2513], [ 2514 srcdir="${srcdir}" 2515 objroot="${objroot}" 2516 mangling_map="${mangling_map}" 2517 public_syms="${public_syms}" 2518 JEMALLOC_PREFIX="${JEMALLOC_PREFIX}" 2519]) 2520AC_CONFIG_COMMANDS([include/jemalloc/internal/private_symbols.awk], [ 2521 f="${objroot}include/jemalloc/internal/private_symbols.awk" 2522 mkdir -p "${objroot}include/jemalloc/internal" 2523 export_syms=`for sym in ${public_syms}; do echo "${JEMALLOC_PREFIX}${sym}"; done; for sym in ${wrap_syms}; do echo "${sym}"; done;` 2524 "${srcdir}/include/jemalloc/internal/private_symbols.sh" "${SYM_PREFIX}" ${export_syms} > "${objroot}include/jemalloc/internal/private_symbols.awk" 2525], [ 2526 srcdir="${srcdir}" 2527 objroot="${objroot}" 2528 public_syms="${public_syms}" 2529 wrap_syms="${wrap_syms}" 2530 SYM_PREFIX="${SYM_PREFIX}" 2531 JEMALLOC_PREFIX="${JEMALLOC_PREFIX}" 2532]) 2533AC_CONFIG_COMMANDS([include/jemalloc/internal/private_symbols_jet.awk], [ 2534 f="${objroot}include/jemalloc/internal/private_symbols_jet.awk" 2535 mkdir -p "${objroot}include/jemalloc/internal" 2536 export_syms=`for sym in ${public_syms}; do echo "jet_${sym}"; done; for sym in ${wrap_syms}; do echo "${sym}"; done;` 2537 "${srcdir}/include/jemalloc/internal/private_symbols.sh" "${SYM_PREFIX}" ${export_syms} > "${objroot}include/jemalloc/internal/private_symbols_jet.awk" 2538], [ 2539 srcdir="${srcdir}" 2540 objroot="${objroot}" 2541 public_syms="${public_syms}" 2542 wrap_syms="${wrap_syms}" 2543 SYM_PREFIX="${SYM_PREFIX}" 2544]) 2545AC_CONFIG_COMMANDS([include/jemalloc/internal/public_namespace.h], [ 2546 mkdir -p "${objroot}include/jemalloc/internal" 2547 "${srcdir}/include/jemalloc/internal/public_namespace.sh" "${objroot}include/jemalloc/internal/public_symbols.txt" > "${objroot}include/jemalloc/internal/public_namespace.h" 2548], [ 2549 srcdir="${srcdir}" 2550 objroot="${objroot}" 2551]) 2552AC_CONFIG_COMMANDS([include/jemalloc/internal/public_unnamespace.h], [ 2553 mkdir -p "${objroot}include/jemalloc/internal" 2554 "${srcdir}/include/jemalloc/internal/public_unnamespace.sh" "${objroot}include/jemalloc/internal/public_symbols.txt" > "${objroot}include/jemalloc/internal/public_unnamespace.h" 2555], [ 2556 srcdir="${srcdir}" 2557 objroot="${objroot}" 2558]) 2559AC_CONFIG_COMMANDS([include/jemalloc/jemalloc_protos_jet.h], [ 2560 mkdir -p "${objroot}include/jemalloc" 2561 cat "${srcdir}/include/jemalloc/jemalloc_protos.h.in" | sed -e 's/@je_@/jet_/g' > "${objroot}include/jemalloc/jemalloc_protos_jet.h" 2562], [ 2563 srcdir="${srcdir}" 2564 objroot="${objroot}" 2565]) 2566AC_CONFIG_COMMANDS([include/jemalloc/jemalloc_rename.h], [ 2567 mkdir -p "${objroot}include/jemalloc" 2568 "${srcdir}/include/jemalloc/jemalloc_rename.sh" "${objroot}include/jemalloc/internal/public_symbols.txt" > "${objroot}include/jemalloc/jemalloc_rename.h" 2569], [ 2570 srcdir="${srcdir}" 2571 objroot="${objroot}" 2572]) 2573AC_CONFIG_COMMANDS([include/jemalloc/jemalloc_mangle.h], [ 2574 mkdir -p "${objroot}include/jemalloc" 2575 "${srcdir}/include/jemalloc/jemalloc_mangle.sh" "${objroot}include/jemalloc/internal/public_symbols.txt" je_ > "${objroot}include/jemalloc/jemalloc_mangle.h" 2576], [ 2577 srcdir="${srcdir}" 2578 objroot="${objroot}" 2579]) 2580AC_CONFIG_COMMANDS([include/jemalloc/jemalloc_mangle_jet.h], [ 2581 mkdir -p "${objroot}include/jemalloc" 2582 "${srcdir}/include/jemalloc/jemalloc_mangle.sh" "${objroot}include/jemalloc/internal/public_symbols.txt" jet_ > "${objroot}include/jemalloc/jemalloc_mangle_jet.h" 2583], [ 2584 srcdir="${srcdir}" 2585 objroot="${objroot}" 2586]) 2587AC_CONFIG_COMMANDS([include/jemalloc/jemalloc.h], [ 2588 mkdir -p "${objroot}include/jemalloc" 2589 "${srcdir}/include/jemalloc/jemalloc.sh" "${objroot}" > "${objroot}include/jemalloc/jemalloc${install_suffix}.h" 2590], [ 2591 srcdir="${srcdir}" 2592 objroot="${objroot}" 2593 install_suffix="${install_suffix}" 2594]) 2595 2596dnl Process .in files. 2597AC_SUBST([cfghdrs_in]) 2598AC_SUBST([cfghdrs_out]) 2599AC_CONFIG_HEADERS([$cfghdrs_tup]) 2600 2601dnl ============================================================================ 2602dnl Generate outputs. 2603 2604AC_CONFIG_FILES([$cfgoutputs_tup config.stamp bin/jemalloc-config bin/jemalloc.sh bin/jeprof]) 2605AC_SUBST([cfgoutputs_in]) 2606AC_SUBST([cfgoutputs_out]) 2607AC_OUTPUT 2608 2609dnl ============================================================================ 2610dnl Print out the results of configuration. 2611AC_MSG_RESULT([===============================================================================]) 2612AC_MSG_RESULT([jemalloc version : ${jemalloc_version}]) 2613AC_MSG_RESULT([library revision : ${rev}]) 2614AC_MSG_RESULT([]) 2615AC_MSG_RESULT([CONFIG : ${CONFIG}]) 2616AC_MSG_RESULT([CC : ${CC}]) 2617AC_MSG_RESULT([CONFIGURE_CFLAGS : ${CONFIGURE_CFLAGS}]) 2618AC_MSG_RESULT([SPECIFIED_CFLAGS : ${SPECIFIED_CFLAGS}]) 2619AC_MSG_RESULT([EXTRA_CFLAGS : ${EXTRA_CFLAGS}]) 2620AC_MSG_RESULT([CPPFLAGS : ${CPPFLAGS}]) 2621AC_MSG_RESULT([CXX : ${CXX}]) 2622AC_MSG_RESULT([CONFIGURE_CXXFLAGS : ${CONFIGURE_CXXFLAGS}]) 2623AC_MSG_RESULT([SPECIFIED_CXXFLAGS : ${SPECIFIED_CXXFLAGS}]) 2624AC_MSG_RESULT([EXTRA_CXXFLAGS : ${EXTRA_CXXFLAGS}]) 2625AC_MSG_RESULT([LDFLAGS : ${LDFLAGS}]) 2626AC_MSG_RESULT([EXTRA_LDFLAGS : ${EXTRA_LDFLAGS}]) 2627AC_MSG_RESULT([DSO_LDFLAGS : ${DSO_LDFLAGS}]) 2628AC_MSG_RESULT([LIBS : ${LIBS}]) 2629AC_MSG_RESULT([RPATH_EXTRA : ${RPATH_EXTRA}]) 2630AC_MSG_RESULT([]) 2631AC_MSG_RESULT([XSLTPROC : ${XSLTPROC}]) 2632AC_MSG_RESULT([XSLROOT : ${XSLROOT}]) 2633AC_MSG_RESULT([]) 2634AC_MSG_RESULT([PREFIX : ${PREFIX}]) 2635AC_MSG_RESULT([BINDIR : ${BINDIR}]) 2636AC_MSG_RESULT([DATADIR : ${DATADIR}]) 2637AC_MSG_RESULT([INCLUDEDIR : ${INCLUDEDIR}]) 2638AC_MSG_RESULT([LIBDIR : ${LIBDIR}]) 2639AC_MSG_RESULT([MANDIR : ${MANDIR}]) 2640AC_MSG_RESULT([]) 2641AC_MSG_RESULT([srcroot : ${srcroot}]) 2642AC_MSG_RESULT([abs_srcroot : ${abs_srcroot}]) 2643AC_MSG_RESULT([objroot : ${objroot}]) 2644AC_MSG_RESULT([abs_objroot : ${abs_objroot}]) 2645AC_MSG_RESULT([]) 2646AC_MSG_RESULT([JEMALLOC_PREFIX : ${JEMALLOC_PREFIX}]) 2647AC_MSG_RESULT([JEMALLOC_PRIVATE_NAMESPACE]) 2648AC_MSG_RESULT([ : ${JEMALLOC_PRIVATE_NAMESPACE}]) 2649AC_MSG_RESULT([install_suffix : ${install_suffix}]) 2650AC_MSG_RESULT([malloc_conf : ${config_malloc_conf}]) 2651AC_MSG_RESULT([documentation : ${enable_doc}]) 2652AC_MSG_RESULT([shared libs : ${enable_shared}]) 2653AC_MSG_RESULT([static libs : ${enable_static}]) 2654AC_MSG_RESULT([autogen : ${enable_autogen}]) 2655AC_MSG_RESULT([debug : ${enable_debug}]) 2656AC_MSG_RESULT([stats : ${enable_stats}]) 2657AC_MSG_RESULT([experimental_smallocx : ${enable_experimental_smallocx}]) 2658AC_MSG_RESULT([prof : ${enable_prof}]) 2659AC_MSG_RESULT([prof-libunwind : ${enable_prof_libunwind}]) 2660AC_MSG_RESULT([prof-libgcc : ${enable_prof_libgcc}]) 2661AC_MSG_RESULT([prof-gcc : ${enable_prof_gcc}]) 2662AC_MSG_RESULT([fill : ${enable_fill}]) 2663AC_MSG_RESULT([utrace : ${enable_utrace}]) 2664AC_MSG_RESULT([xmalloc : ${enable_xmalloc}]) 2665AC_MSG_RESULT([log : ${enable_log}]) 2666AC_MSG_RESULT([lazy_lock : ${enable_lazy_lock}]) 2667AC_MSG_RESULT([cache-oblivious : ${enable_cache_oblivious}]) 2668AC_MSG_RESULT([cxx : ${enable_cxx}]) 2669AC_MSG_RESULT([===============================================================================]) 2670