1dnl Process this file with autoconf to produce a configure script. 2AC_INIT([Makefile.in]) 3 4dnl ============================================================================ 5dnl Custom macro definitions. 6 7dnl JE_CFLAGS_APPEND(cflag) 8AC_DEFUN([JE_CFLAGS_APPEND], 9[ 10AC_MSG_CHECKING([whether compiler supports $1]) 11TCFLAGS="${CFLAGS}" 12if test "x${CFLAGS}" = "x" ; then 13 CFLAGS="$1" 14else 15 CFLAGS="${CFLAGS} $1" 16fi 17AC_COMPILE_IFELSE([AC_LANG_PROGRAM( 18[[ 19]], [[ 20 return 0; 21]])], 22 [je_cv_cflags_appended=$1] 23 AC_MSG_RESULT([yes]), 24 [je_cv_cflags_appended=] 25 AC_MSG_RESULT([no]) 26 [CFLAGS="${TCFLAGS}"] 27) 28]) 29 30dnl JE_COMPILABLE(label, hcode, mcode, rvar) 31dnl 32dnl Use AC_LINK_IFELSE() rather than AC_COMPILE_IFELSE() so that linker errors 33dnl cause failure. 34AC_DEFUN([JE_COMPILABLE], 35[ 36AC_CACHE_CHECK([whether $1 is compilable], 37 [$4], 38 [AC_LINK_IFELSE([AC_LANG_PROGRAM([$2], 39 [$3])], 40 [$4=yes], 41 [$4=no])]) 42]) 43 44dnl ============================================================================ 45 46CONFIG=`echo ${ac_configure_args} | sed -e 's#'"'"'\([^ ]*\)'"'"'#\1#g'` 47AC_SUBST([CONFIG]) 48 49dnl Library revision. 50rev=2 51AC_SUBST([rev]) 52 53srcroot=$srcdir 54if test "x${srcroot}" = "x." ; then 55 srcroot="" 56else 57 srcroot="${srcroot}/" 58fi 59AC_SUBST([srcroot]) 60abs_srcroot="`cd \"${srcdir}\"; pwd`/" 61AC_SUBST([abs_srcroot]) 62 63objroot="" 64AC_SUBST([objroot]) 65abs_objroot="`pwd`/" 66AC_SUBST([abs_objroot]) 67 68dnl Munge install path variables. 69if test "x$prefix" = "xNONE" ; then 70 prefix="/usr/local" 71fi 72if test "x$exec_prefix" = "xNONE" ; then 73 exec_prefix=$prefix 74fi 75PREFIX=$prefix 76AC_SUBST([PREFIX]) 77BINDIR=`eval echo $bindir` 78BINDIR=`eval echo $BINDIR` 79AC_SUBST([BINDIR]) 80INCLUDEDIR=`eval echo $includedir` 81INCLUDEDIR=`eval echo $INCLUDEDIR` 82AC_SUBST([INCLUDEDIR]) 83LIBDIR=`eval echo $libdir` 84LIBDIR=`eval echo $LIBDIR` 85AC_SUBST([LIBDIR]) 86DATADIR=`eval echo $datadir` 87DATADIR=`eval echo $DATADIR` 88AC_SUBST([DATADIR]) 89MANDIR=`eval echo $mandir` 90MANDIR=`eval echo $MANDIR` 91AC_SUBST([MANDIR]) 92 93dnl Support for building documentation. 94AC_PATH_PROG([XSLTPROC], [xsltproc], [false], [$PATH]) 95if test -d "/usr/share/xml/docbook/stylesheet/docbook-xsl" ; then 96 DEFAULT_XSLROOT="/usr/share/xml/docbook/stylesheet/docbook-xsl" 97elif test -d "/usr/share/sgml/docbook/xsl-stylesheets" ; then 98 DEFAULT_XSLROOT="/usr/share/sgml/docbook/xsl-stylesheets" 99else 100 dnl Documentation building will fail if this default gets used. 101 DEFAULT_XSLROOT="" 102fi 103AC_ARG_WITH([xslroot], 104 [AS_HELP_STRING([--with-xslroot=<path>], [XSL stylesheet root path])], [ 105if test "x$with_xslroot" = "xno" ; then 106 XSLROOT="${DEFAULT_XSLROOT}" 107else 108 XSLROOT="${with_xslroot}" 109fi 110], 111 XSLROOT="${DEFAULT_XSLROOT}" 112) 113AC_SUBST([XSLROOT]) 114 115dnl If CFLAGS isn't defined, set CFLAGS to something reasonable. Otherwise, 116dnl just prevent autoconf from molesting CFLAGS. 117CFLAGS=$CFLAGS 118AC_PROG_CC 119if test "x$GCC" != "xyes" ; then 120 AC_CACHE_CHECK([whether compiler is MSVC], 121 [je_cv_msvc], 122 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], 123 [ 124#ifndef _MSC_VER 125 int fail[-1]; 126#endif 127])], 128 [je_cv_msvc=yes], 129 [je_cv_msvc=no])]) 130fi 131 132if test "x$CFLAGS" = "x" ; then 133 no_CFLAGS="yes" 134 if test "x$GCC" = "xyes" ; then 135 JE_CFLAGS_APPEND([-std=gnu99]) 136 if test "x$je_cv_cflags_appended" = "x-std=gnu99" ; then 137 AC_DEFINE_UNQUOTED([JEMALLOC_HAS_RESTRICT]) 138 fi 139 JE_CFLAGS_APPEND([-Wall]) 140 JE_CFLAGS_APPEND([-Werror=declaration-after-statement]) 141 JE_CFLAGS_APPEND([-pipe]) 142 JE_CFLAGS_APPEND([-g3]) 143 elif test "x$je_cv_msvc" = "xyes" ; then 144 CC="$CC -nologo" 145 JE_CFLAGS_APPEND([-Zi]) 146 JE_CFLAGS_APPEND([-MT]) 147 JE_CFLAGS_APPEND([-W3]) 148 JE_CFLAGS_APPEND([-FS]) 149 CPPFLAGS="$CPPFLAGS -I${srcdir}/include/msvc_compat" 150 fi 151fi 152dnl Append EXTRA_CFLAGS to CFLAGS, if defined. 153if test "x$EXTRA_CFLAGS" != "x" ; then 154 JE_CFLAGS_APPEND([$EXTRA_CFLAGS]) 155fi 156AC_PROG_CPP 157 158AC_C_BIGENDIAN([ac_cv_big_endian=1], [ac_cv_big_endian=0]) 159if test "x${ac_cv_big_endian}" = "x1" ; then 160 AC_DEFINE_UNQUOTED([JEMALLOC_BIG_ENDIAN], [ ]) 161fi 162 163if test "x${je_cv_msvc}" = "xyes" -a "x${ac_cv_header_inttypes_h}" = "xno"; then 164 CPPFLAGS="$CPPFLAGS -I${srcdir}/include/msvc_compat/C99" 165fi 166 167AC_CHECK_SIZEOF([void *]) 168if test "x${ac_cv_sizeof_void_p}" = "x8" ; then 169 LG_SIZEOF_PTR=3 170elif test "x${ac_cv_sizeof_void_p}" = "x4" ; then 171 LG_SIZEOF_PTR=2 172else 173 AC_MSG_ERROR([Unsupported pointer size: ${ac_cv_sizeof_void_p}]) 174fi 175AC_DEFINE_UNQUOTED([LG_SIZEOF_PTR], [$LG_SIZEOF_PTR]) 176 177AC_CHECK_SIZEOF([int]) 178if test "x${ac_cv_sizeof_int}" = "x8" ; then 179 LG_SIZEOF_INT=3 180elif test "x${ac_cv_sizeof_int}" = "x4" ; then 181 LG_SIZEOF_INT=2 182else 183 AC_MSG_ERROR([Unsupported int size: ${ac_cv_sizeof_int}]) 184fi 185AC_DEFINE_UNQUOTED([LG_SIZEOF_INT], [$LG_SIZEOF_INT]) 186 187AC_CHECK_SIZEOF([long]) 188if test "x${ac_cv_sizeof_long}" = "x8" ; then 189 LG_SIZEOF_LONG=3 190elif test "x${ac_cv_sizeof_long}" = "x4" ; then 191 LG_SIZEOF_LONG=2 192else 193 AC_MSG_ERROR([Unsupported long size: ${ac_cv_sizeof_long}]) 194fi 195AC_DEFINE_UNQUOTED([LG_SIZEOF_LONG], [$LG_SIZEOF_LONG]) 196 197AC_CHECK_SIZEOF([intmax_t]) 198if test "x${ac_cv_sizeof_intmax_t}" = "x16" ; then 199 LG_SIZEOF_INTMAX_T=4 200elif test "x${ac_cv_sizeof_intmax_t}" = "x8" ; then 201 LG_SIZEOF_INTMAX_T=3 202elif test "x${ac_cv_sizeof_intmax_t}" = "x4" ; then 203 LG_SIZEOF_INTMAX_T=2 204else 205 AC_MSG_ERROR([Unsupported intmax_t size: ${ac_cv_sizeof_intmax_t}]) 206fi 207AC_DEFINE_UNQUOTED([LG_SIZEOF_INTMAX_T], [$LG_SIZEOF_INTMAX_T]) 208 209AC_CANONICAL_HOST 210dnl CPU-specific settings. 211CPU_SPINWAIT="" 212case "${host_cpu}" in 213 i686|x86_64) 214 AC_CACHE_VAL([je_cv_pause], 215 [JE_COMPILABLE([pause instruction], [], 216 [[__asm__ volatile("pause"); return 0;]], 217 [je_cv_pause])]) 218 if test "x${je_cv_pause}" = "xyes" ; then 219 CPU_SPINWAIT='__asm__ volatile("pause")' 220 fi 221 ;; 222 powerpc) 223 AC_DEFINE_UNQUOTED([HAVE_ALTIVEC], [ ]) 224 ;; 225 *) 226 ;; 227esac 228AC_DEFINE_UNQUOTED([CPU_SPINWAIT], [$CPU_SPINWAIT]) 229 230LD_PRELOAD_VAR="LD_PRELOAD" 231so="so" 232importlib="${so}" 233o="$ac_objext" 234a="a" 235exe="$ac_exeext" 236libprefix="lib" 237DSO_LDFLAGS='-shared -Wl,-soname,$(@F)' 238RPATH='-Wl,-rpath,$(1)' 239SOREV="${so}.${rev}" 240PIC_CFLAGS='-fPIC -DPIC' 241CTARGET='-o $@' 242LDTARGET='-o $@' 243EXTRA_LDFLAGS= 244ARFLAGS='crus' 245AROUT=' $@' 246CC_MM=1 247 248AN_MAKEVAR([AR], [AC_PROG_AR]) 249AN_PROGRAM([ar], [AC_PROG_AR]) 250AC_DEFUN([AC_PROG_AR], [AC_CHECK_TOOL(AR, ar, :)]) 251AC_PROG_AR 252 253dnl Platform-specific settings. abi and RPATH can probably be determined 254dnl programmatically, but doing so is error-prone, which makes it generally 255dnl not worth the trouble. 256dnl 257dnl Define cpp macros in CPPFLAGS, rather than doing AC_DEFINE(macro), since the 258dnl definitions need to be seen before any headers are included, which is a pain 259dnl to make happen otherwise. 260default_munmap="1" 261maps_coalesce="1" 262case "${host}" in 263 *-*-darwin* | *-*-ios*) 264 CFLAGS="$CFLAGS" 265 abi="macho" 266 AC_DEFINE([JEMALLOC_PURGE_MADVISE_FREE], [ ]) 267 RPATH="" 268 LD_PRELOAD_VAR="DYLD_INSERT_LIBRARIES" 269 so="dylib" 270 importlib="${so}" 271 force_tls="0" 272 DSO_LDFLAGS='-shared -Wl,-install_name,$(LIBDIR)/$(@F)' 273 SOREV="${rev}.${so}" 274 sbrk_deprecated="1" 275 ;; 276 *-*-freebsd*) 277 CFLAGS="$CFLAGS" 278 abi="elf" 279 AC_DEFINE([JEMALLOC_PURGE_MADVISE_FREE], [ ]) 280 force_lazy_lock="1" 281 ;; 282 *-*-dragonfly*) 283 CFLAGS="$CFLAGS" 284 abi="elf" 285 AC_DEFINE([JEMALLOC_PURGE_MADVISE_FREE], [ ]) 286 ;; 287 *-*-openbsd*) 288 CFLAGS="$CFLAGS" 289 abi="elf" 290 AC_DEFINE([JEMALLOC_PURGE_MADVISE_FREE], [ ]) 291 force_tls="0" 292 ;; 293 *-*-bitrig*) 294 CFLAGS="$CFLAGS" 295 abi="elf" 296 AC_DEFINE([JEMALLOC_PURGE_MADVISE_FREE], [ ]) 297 ;; 298 *-*-linux*) 299 CFLAGS="$CFLAGS" 300 CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE" 301 abi="elf" 302 AC_DEFINE([JEMALLOC_HAS_ALLOCA_H]) 303 AC_DEFINE([JEMALLOC_PURGE_MADVISE_DONTNEED], [ ]) 304 AC_DEFINE([JEMALLOC_THREADED_INIT], [ ]) 305 AC_DEFINE([JEMALLOC_USE_CXX_THROW], [ ]) 306 default_munmap="0" 307 ;; 308 *-*-netbsd*) 309 AC_MSG_CHECKING([ABI]) 310 AC_COMPILE_IFELSE([AC_LANG_PROGRAM( 311[[#ifdef __ELF__ 312/* ELF */ 313#else 314#error aout 315#endif 316]])], 317 [CFLAGS="$CFLAGS"; abi="elf"], 318 [abi="aout"]) 319 AC_MSG_RESULT([$abi]) 320 AC_DEFINE([JEMALLOC_PURGE_MADVISE_FREE], [ ]) 321 ;; 322 *-*-solaris2*) 323 CFLAGS="$CFLAGS" 324 abi="elf" 325 AC_DEFINE([JEMALLOC_PURGE_MADVISE_FREE], [ ]) 326 RPATH='-Wl,-R,$(1)' 327 dnl Solaris needs this for sigwait(). 328 CPPFLAGS="$CPPFLAGS -D_POSIX_PTHREAD_SEMANTICS" 329 LIBS="$LIBS -lposix4 -lsocket -lnsl" 330 ;; 331 *-ibm-aix*) 332 if "$LG_SIZEOF_PTR" = "8"; then 333 dnl 64bit AIX 334 LD_PRELOAD_VAR="LDR_PRELOAD64" 335 else 336 dnl 32bit AIX 337 LD_PRELOAD_VAR="LDR_PRELOAD" 338 fi 339 abi="xcoff" 340 ;; 341 *-*-mingw* | *-*-cygwin*) 342 abi="pecoff" 343 force_tls="0" 344 force_lazy_lock="1" 345 maps_coalesce="0" 346 RPATH="" 347 so="dll" 348 if test "x$je_cv_msvc" = "xyes" ; then 349 importlib="lib" 350 DSO_LDFLAGS="-LD" 351 EXTRA_LDFLAGS="-link -DEBUG" 352 CTARGET='-Fo$@' 353 LDTARGET='-Fe$@' 354 AR='lib' 355 ARFLAGS='-nologo -out:' 356 AROUT='$@' 357 CC_MM= 358 else 359 importlib="${so}" 360 DSO_LDFLAGS="-shared" 361 fi 362 a="lib" 363 libprefix="" 364 SOREV="${so}" 365 PIC_CFLAGS="" 366 ;; 367 *) 368 AC_MSG_RESULT([Unsupported operating system: ${host}]) 369 abi="elf" 370 ;; 371esac 372 373JEMALLOC_USABLE_SIZE_CONST=const 374AC_CHECK_HEADERS([malloc.h], [ 375 AC_MSG_CHECKING([whether malloc_usable_size definition can use const argument]) 376 AC_COMPILE_IFELSE([AC_LANG_PROGRAM( 377 [#include <malloc.h> 378 #include <stddef.h> 379 size_t malloc_usable_size(const void *ptr); 380 ], 381 [])],[ 382 AC_MSG_RESULT([yes]) 383 ],[ 384 JEMALLOC_USABLE_SIZE_CONST= 385 AC_MSG_RESULT([no]) 386 ]) 387]) 388AC_DEFINE_UNQUOTED([JEMALLOC_USABLE_SIZE_CONST], [$JEMALLOC_USABLE_SIZE_CONST]) 389AC_SUBST([abi]) 390AC_SUBST([RPATH]) 391AC_SUBST([LD_PRELOAD_VAR]) 392AC_SUBST([so]) 393AC_SUBST([importlib]) 394AC_SUBST([o]) 395AC_SUBST([a]) 396AC_SUBST([exe]) 397AC_SUBST([libprefix]) 398AC_SUBST([DSO_LDFLAGS]) 399AC_SUBST([EXTRA_LDFLAGS]) 400AC_SUBST([SOREV]) 401AC_SUBST([PIC_CFLAGS]) 402AC_SUBST([CTARGET]) 403AC_SUBST([LDTARGET]) 404AC_SUBST([MKLIB]) 405AC_SUBST([ARFLAGS]) 406AC_SUBST([AROUT]) 407AC_SUBST([CC_MM]) 408 409JE_COMPILABLE([__attribute__ syntax], 410 [static __attribute__((unused)) void foo(void){}], 411 [], 412 [je_cv_attribute]) 413if test "x${je_cv_attribute}" = "xyes" ; then 414 AC_DEFINE([JEMALLOC_HAVE_ATTR], [ ]) 415 if test "x${GCC}" = "xyes" -a "x${abi}" = "xelf"; then 416 JE_CFLAGS_APPEND([-fvisibility=hidden]) 417 fi 418fi 419dnl Check for tls_model attribute support (clang 3.0 still lacks support). 420SAVED_CFLAGS="${CFLAGS}" 421JE_CFLAGS_APPEND([-Werror]) 422JE_COMPILABLE([tls_model attribute], [], 423 [static __thread int 424 __attribute__((tls_model("initial-exec"), unused)) foo; 425 foo = 0;], 426 [je_cv_tls_model]) 427CFLAGS="${SAVED_CFLAGS}" 428if test "x${je_cv_tls_model}" = "xyes" ; then 429 AC_DEFINE([JEMALLOC_TLS_MODEL], 430 [__attribute__((tls_model("initial-exec")))]) 431else 432 AC_DEFINE([JEMALLOC_TLS_MODEL], [ ]) 433fi 434dnl Check for alloc_size attribute support. 435SAVED_CFLAGS="${CFLAGS}" 436JE_CFLAGS_APPEND([-Werror]) 437JE_COMPILABLE([alloc_size attribute], [#include <stdlib.h>], 438 [void *foo(size_t size) __attribute__((alloc_size(1)));], 439 [je_cv_alloc_size]) 440CFLAGS="${SAVED_CFLAGS}" 441if test "x${je_cv_alloc_size}" = "xyes" ; then 442 AC_DEFINE([JEMALLOC_HAVE_ATTR_ALLOC_SIZE], [ ]) 443fi 444dnl Check for format(gnu_printf, ...) attribute support. 445SAVED_CFLAGS="${CFLAGS}" 446JE_CFLAGS_APPEND([-Werror]) 447JE_COMPILABLE([format(gnu_printf, ...) attribute], [#include <stdlib.h>], 448 [void *foo(const char *format, ...) __attribute__((format(gnu_printf, 1, 2)));], 449 [je_cv_format_gnu_printf]) 450CFLAGS="${SAVED_CFLAGS}" 451if test "x${je_cv_format_gnu_printf}" = "xyes" ; then 452 AC_DEFINE([JEMALLOC_HAVE_ATTR_FORMAT_GNU_PRINTF], [ ]) 453fi 454dnl Check for format(printf, ...) attribute support. 455SAVED_CFLAGS="${CFLAGS}" 456JE_CFLAGS_APPEND([-Werror]) 457JE_COMPILABLE([format(printf, ...) attribute], [#include <stdlib.h>], 458 [void *foo(const char *format, ...) __attribute__((format(printf, 1, 2)));], 459 [je_cv_format_printf]) 460CFLAGS="${SAVED_CFLAGS}" 461if test "x${je_cv_format_printf}" = "xyes" ; then 462 AC_DEFINE([JEMALLOC_HAVE_ATTR_FORMAT_PRINTF], [ ]) 463fi 464 465dnl Support optional additions to rpath. 466AC_ARG_WITH([rpath], 467 [AS_HELP_STRING([--with-rpath=<rpath>], [Colon-separated rpath (ELF systems only)])], 468if test "x$with_rpath" = "xno" ; then 469 RPATH_EXTRA= 470else 471 RPATH_EXTRA="`echo $with_rpath | tr \":\" \" \"`" 472fi, 473 RPATH_EXTRA= 474) 475AC_SUBST([RPATH_EXTRA]) 476 477dnl Disable rules that do automatic regeneration of configure output by default. 478AC_ARG_ENABLE([autogen], 479 [AS_HELP_STRING([--enable-autogen], [Automatically regenerate configure output])], 480if test "x$enable_autogen" = "xno" ; then 481 enable_autogen="0" 482else 483 enable_autogen="1" 484fi 485, 486enable_autogen="0" 487) 488AC_SUBST([enable_autogen]) 489 490AC_PROG_INSTALL 491AC_PROG_RANLIB 492AC_PATH_PROG([LD], [ld], [false], [$PATH]) 493AC_PATH_PROG([AUTOCONF], [autoconf], [false], [$PATH]) 494 495public_syms="malloc_conf malloc_message malloc calloc posix_memalign aligned_alloc realloc free mallocx rallocx xallocx sallocx dallocx sdallocx nallocx mallctl mallctlnametomib mallctlbymib malloc_stats_print malloc_usable_size" 496 497dnl Check for allocator-related functions that should be wrapped. 498AC_CHECK_FUNC([memalign], 499 [AC_DEFINE([JEMALLOC_OVERRIDE_MEMALIGN], [ ]) 500 public_syms="${public_syms} memalign"]) 501AC_CHECK_FUNC([valloc], 502 [AC_DEFINE([JEMALLOC_OVERRIDE_VALLOC], [ ]) 503 public_syms="${public_syms} valloc"]) 504 505dnl Do not compute test code coverage by default. 506GCOV_FLAGS= 507AC_ARG_ENABLE([code-coverage], 508 [AS_HELP_STRING([--enable-code-coverage], 509 [Enable code coverage])], 510[if test "x$enable_code_coverage" = "xno" ; then 511 enable_code_coverage="0" 512else 513 enable_code_coverage="1" 514fi 515], 516[enable_code_coverage="0"] 517) 518if test "x$enable_code_coverage" = "x1" ; then 519 deoptimize="no" 520 echo "$CFLAGS $EXTRA_CFLAGS" | grep '\-O' >/dev/null || deoptimize="yes" 521 if test "x${deoptimize}" = "xyes" ; then 522 JE_CFLAGS_APPEND([-O0]) 523 fi 524 JE_CFLAGS_APPEND([-fprofile-arcs -ftest-coverage]) 525 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -fprofile-arcs -ftest-coverage" 526 AC_DEFINE([JEMALLOC_CODE_COVERAGE], [ ]) 527fi 528AC_SUBST([enable_code_coverage]) 529 530dnl Perform no name mangling by default. 531AC_ARG_WITH([mangling], 532 [AS_HELP_STRING([--with-mangling=<map>], [Mangle symbols in <map>])], 533 [mangling_map="$with_mangling"], [mangling_map=""]) 534 535dnl Do not prefix public APIs by default. 536AC_ARG_WITH([jemalloc_prefix], 537 [AS_HELP_STRING([--with-jemalloc-prefix=<prefix>], [Prefix to prepend to all public APIs])], 538 [JEMALLOC_PREFIX="$with_jemalloc_prefix"], 539 [if test "x$abi" != "xmacho" -a "x$abi" != "xpecoff"; then 540 JEMALLOC_PREFIX="" 541else 542 JEMALLOC_PREFIX="je_" 543fi] 544) 545if test "x$JEMALLOC_PREFIX" != "x" ; then 546 JEMALLOC_CPREFIX=`echo ${JEMALLOC_PREFIX} | tr "a-z" "A-Z"` 547 AC_DEFINE_UNQUOTED([JEMALLOC_PREFIX], ["$JEMALLOC_PREFIX"]) 548 AC_DEFINE_UNQUOTED([JEMALLOC_CPREFIX], ["$JEMALLOC_CPREFIX"]) 549fi 550AC_SUBST([JEMALLOC_CPREFIX]) 551 552AC_ARG_WITH([export], 553 [AS_HELP_STRING([--without-export], [disable exporting jemalloc public APIs])], 554 [if test "x$with_export" = "xno"; then 555 AC_DEFINE([JEMALLOC_EXPORT],[]) 556fi] 557) 558 559dnl Mangle library-private APIs. 560AC_ARG_WITH([private_namespace], 561 [AS_HELP_STRING([--with-private-namespace=<prefix>], [Prefix to prepend to all library-private APIs])], 562 [JEMALLOC_PRIVATE_NAMESPACE="${with_private_namespace}je_"], 563 [JEMALLOC_PRIVATE_NAMESPACE="je_"] 564) 565AC_DEFINE_UNQUOTED([JEMALLOC_PRIVATE_NAMESPACE], [$JEMALLOC_PRIVATE_NAMESPACE]) 566private_namespace="$JEMALLOC_PRIVATE_NAMESPACE" 567AC_SUBST([private_namespace]) 568 569dnl Do not add suffix to installed files by default. 570AC_ARG_WITH([install_suffix], 571 [AS_HELP_STRING([--with-install-suffix=<suffix>], [Suffix to append to all installed files])], 572 [INSTALL_SUFFIX="$with_install_suffix"], 573 [INSTALL_SUFFIX=] 574) 575install_suffix="$INSTALL_SUFFIX" 576AC_SUBST([install_suffix]) 577 578dnl Substitute @je_@ in jemalloc_protos.h.in, primarily to make generation of 579dnl jemalloc_protos_jet.h easy. 580je_="je_" 581AC_SUBST([je_]) 582 583cfgoutputs_in="Makefile.in" 584cfgoutputs_in="${cfgoutputs_in} jemalloc.pc.in" 585cfgoutputs_in="${cfgoutputs_in} doc/html.xsl.in" 586cfgoutputs_in="${cfgoutputs_in} doc/manpages.xsl.in" 587cfgoutputs_in="${cfgoutputs_in} doc/jemalloc.xml.in" 588cfgoutputs_in="${cfgoutputs_in} include/jemalloc/jemalloc_macros.h.in" 589cfgoutputs_in="${cfgoutputs_in} include/jemalloc/jemalloc_protos.h.in" 590cfgoutputs_in="${cfgoutputs_in} include/jemalloc/jemalloc_typedefs.h.in" 591cfgoutputs_in="${cfgoutputs_in} include/jemalloc/internal/jemalloc_internal.h.in" 592cfgoutputs_in="${cfgoutputs_in} test/test.sh.in" 593cfgoutputs_in="${cfgoutputs_in} test/include/test/jemalloc_test.h.in" 594 595cfgoutputs_out="Makefile" 596cfgoutputs_out="${cfgoutputs_out} jemalloc.pc" 597cfgoutputs_out="${cfgoutputs_out} doc/html.xsl" 598cfgoutputs_out="${cfgoutputs_out} doc/manpages.xsl" 599cfgoutputs_out="${cfgoutputs_out} doc/jemalloc.xml" 600cfgoutputs_out="${cfgoutputs_out} include/jemalloc/jemalloc_macros.h" 601cfgoutputs_out="${cfgoutputs_out} include/jemalloc/jemalloc_protos.h" 602cfgoutputs_out="${cfgoutputs_out} include/jemalloc/jemalloc_typedefs.h" 603cfgoutputs_out="${cfgoutputs_out} include/jemalloc/internal/jemalloc_internal.h" 604cfgoutputs_out="${cfgoutputs_out} test/test.sh" 605cfgoutputs_out="${cfgoutputs_out} test/include/test/jemalloc_test.h" 606 607cfgoutputs_tup="Makefile" 608cfgoutputs_tup="${cfgoutputs_tup} jemalloc.pc:jemalloc.pc.in" 609cfgoutputs_tup="${cfgoutputs_tup} doc/html.xsl:doc/html.xsl.in" 610cfgoutputs_tup="${cfgoutputs_tup} doc/manpages.xsl:doc/manpages.xsl.in" 611cfgoutputs_tup="${cfgoutputs_tup} doc/jemalloc.xml:doc/jemalloc.xml.in" 612cfgoutputs_tup="${cfgoutputs_tup} include/jemalloc/jemalloc_macros.h:include/jemalloc/jemalloc_macros.h.in" 613cfgoutputs_tup="${cfgoutputs_tup} include/jemalloc/jemalloc_protos.h:include/jemalloc/jemalloc_protos.h.in" 614cfgoutputs_tup="${cfgoutputs_tup} include/jemalloc/jemalloc_typedefs.h:include/jemalloc/jemalloc_typedefs.h.in" 615cfgoutputs_tup="${cfgoutputs_tup} include/jemalloc/internal/jemalloc_internal.h" 616cfgoutputs_tup="${cfgoutputs_tup} test/test.sh:test/test.sh.in" 617cfgoutputs_tup="${cfgoutputs_tup} test/include/test/jemalloc_test.h:test/include/test/jemalloc_test.h.in" 618 619cfghdrs_in="include/jemalloc/jemalloc_defs.h.in" 620cfghdrs_in="${cfghdrs_in} include/jemalloc/internal/jemalloc_internal_defs.h.in" 621cfghdrs_in="${cfghdrs_in} include/jemalloc/internal/private_namespace.sh" 622cfghdrs_in="${cfghdrs_in} include/jemalloc/internal/private_unnamespace.sh" 623cfghdrs_in="${cfghdrs_in} include/jemalloc/internal/private_symbols.txt" 624cfghdrs_in="${cfghdrs_in} include/jemalloc/internal/public_namespace.sh" 625cfghdrs_in="${cfghdrs_in} include/jemalloc/internal/public_unnamespace.sh" 626cfghdrs_in="${cfghdrs_in} include/jemalloc/internal/size_classes.sh" 627cfghdrs_in="${cfghdrs_in} include/jemalloc/jemalloc_rename.sh" 628cfghdrs_in="${cfghdrs_in} include/jemalloc/jemalloc_mangle.sh" 629cfghdrs_in="${cfghdrs_in} include/jemalloc/jemalloc.sh" 630cfghdrs_in="${cfghdrs_in} test/include/test/jemalloc_test_defs.h.in" 631 632cfghdrs_out="include/jemalloc/jemalloc_defs.h" 633cfghdrs_out="${cfghdrs_out} include/jemalloc/jemalloc${install_suffix}.h" 634cfghdrs_out="${cfghdrs_out} include/jemalloc/internal/private_namespace.h" 635cfghdrs_out="${cfghdrs_out} include/jemalloc/internal/private_unnamespace.h" 636cfghdrs_out="${cfghdrs_out} include/jemalloc/internal/public_symbols.txt" 637cfghdrs_out="${cfghdrs_out} include/jemalloc/internal/public_namespace.h" 638cfghdrs_out="${cfghdrs_out} include/jemalloc/internal/public_unnamespace.h" 639cfghdrs_out="${cfghdrs_out} include/jemalloc/internal/size_classes.h" 640cfghdrs_out="${cfghdrs_out} include/jemalloc/jemalloc_protos_jet.h" 641cfghdrs_out="${cfghdrs_out} include/jemalloc/jemalloc_rename.h" 642cfghdrs_out="${cfghdrs_out} include/jemalloc/jemalloc_mangle.h" 643cfghdrs_out="${cfghdrs_out} include/jemalloc/jemalloc_mangle_jet.h" 644cfghdrs_out="${cfghdrs_out} include/jemalloc/internal/jemalloc_internal_defs.h" 645cfghdrs_out="${cfghdrs_out} test/include/test/jemalloc_test_defs.h" 646 647cfghdrs_tup="include/jemalloc/jemalloc_defs.h:include/jemalloc/jemalloc_defs.h.in" 648cfghdrs_tup="${cfghdrs_tup} include/jemalloc/internal/jemalloc_internal_defs.h:include/jemalloc/internal/jemalloc_internal_defs.h.in" 649cfghdrs_tup="${cfghdrs_tup} test/include/test/jemalloc_test_defs.h:test/include/test/jemalloc_test_defs.h.in" 650 651dnl Silence irrelevant compiler warnings by default. 652AC_ARG_ENABLE([cc-silence], 653 [AS_HELP_STRING([--disable-cc-silence], 654 [Do not silence irrelevant compiler warnings])], 655[if test "x$enable_cc_silence" = "xno" ; then 656 enable_cc_silence="0" 657else 658 enable_cc_silence="1" 659fi 660], 661[enable_cc_silence="1"] 662) 663if test "x$enable_cc_silence" = "x1" ; then 664 AC_DEFINE([JEMALLOC_CC_SILENCE], [ ]) 665fi 666 667dnl Do not compile with debugging by default. 668AC_ARG_ENABLE([debug], 669 [AS_HELP_STRING([--enable-debug], 670 [Build debugging code (implies --enable-ivsalloc)])], 671[if test "x$enable_debug" = "xno" ; then 672 enable_debug="0" 673else 674 enable_debug="1" 675fi 676], 677[enable_debug="0"] 678) 679if test "x$enable_debug" = "x1" ; then 680 AC_DEFINE([JEMALLOC_DEBUG], [ ]) 681fi 682if test "x$enable_debug" = "x1" ; then 683 AC_DEFINE([JEMALLOC_DEBUG], [ ]) 684 enable_ivsalloc="1" 685fi 686AC_SUBST([enable_debug]) 687 688dnl Do not validate pointers by default. 689AC_ARG_ENABLE([ivsalloc], 690 [AS_HELP_STRING([--enable-ivsalloc], 691 [Validate pointers passed through the public API])], 692[if test "x$enable_ivsalloc" = "xno" ; then 693 enable_ivsalloc="0" 694else 695 enable_ivsalloc="1" 696fi 697], 698[enable_ivsalloc="0"] 699) 700if test "x$enable_ivsalloc" = "x1" ; then 701 AC_DEFINE([JEMALLOC_IVSALLOC], [ ]) 702fi 703 704dnl Only optimize if not debugging. 705if test "x$enable_debug" = "x0" -a "x$no_CFLAGS" = "xyes" ; then 706 dnl Make sure that an optimization flag was not specified in EXTRA_CFLAGS. 707 optimize="no" 708 echo "$CFLAGS $EXTRA_CFLAGS" | grep '\-O' >/dev/null || optimize="yes" 709 if test "x${optimize}" = "xyes" ; then 710 if test "x$GCC" = "xyes" ; then 711 JE_CFLAGS_APPEND([-O3]) 712 JE_CFLAGS_APPEND([-funroll-loops]) 713 elif test "x$je_cv_msvc" = "xyes" ; then 714 JE_CFLAGS_APPEND([-O2]) 715 else 716 JE_CFLAGS_APPEND([-O]) 717 fi 718 fi 719fi 720 721dnl Enable statistics calculation by default. 722AC_ARG_ENABLE([stats], 723 [AS_HELP_STRING([--disable-stats], 724 [Disable statistics calculation/reporting])], 725[if test "x$enable_stats" = "xno" ; then 726 enable_stats="0" 727else 728 enable_stats="1" 729fi 730], 731[enable_stats="1"] 732) 733if test "x$enable_stats" = "x1" ; then 734 AC_DEFINE([JEMALLOC_STATS], [ ]) 735fi 736AC_SUBST([enable_stats]) 737 738dnl Do not enable profiling by default. 739AC_ARG_ENABLE([prof], 740 [AS_HELP_STRING([--enable-prof], [Enable allocation profiling])], 741[if test "x$enable_prof" = "xno" ; then 742 enable_prof="0" 743else 744 enable_prof="1" 745fi 746], 747[enable_prof="0"] 748) 749if test "x$enable_prof" = "x1" ; then 750 backtrace_method="" 751else 752 backtrace_method="N/A" 753fi 754 755AC_ARG_ENABLE([prof-libunwind], 756 [AS_HELP_STRING([--enable-prof-libunwind], [Use libunwind for backtracing])], 757[if test "x$enable_prof_libunwind" = "xno" ; then 758 enable_prof_libunwind="0" 759else 760 enable_prof_libunwind="1" 761fi 762], 763[enable_prof_libunwind="0"] 764) 765AC_ARG_WITH([static_libunwind], 766 [AS_HELP_STRING([--with-static-libunwind=<libunwind.a>], 767 [Path to static libunwind library; use rather than dynamically linking])], 768if test "x$with_static_libunwind" = "xno" ; then 769 LUNWIND="-lunwind" 770else 771 if test ! -f "$with_static_libunwind" ; then 772 AC_MSG_ERROR([Static libunwind not found: $with_static_libunwind]) 773 fi 774 LUNWIND="$with_static_libunwind" 775fi, 776 LUNWIND="-lunwind" 777) 778if test "x$backtrace_method" = "x" -a "x$enable_prof_libunwind" = "x1" ; then 779 AC_CHECK_HEADERS([libunwind.h], , [enable_prof_libunwind="0"]) 780 if test "x$LUNWIND" = "x-lunwind" ; then 781 AC_CHECK_LIB([unwind], [unw_backtrace], [LIBS="$LIBS $LUNWIND"], 782 [enable_prof_libunwind="0"]) 783 else 784 LIBS="$LIBS $LUNWIND" 785 fi 786 if test "x${enable_prof_libunwind}" = "x1" ; then 787 backtrace_method="libunwind" 788 AC_DEFINE([JEMALLOC_PROF_LIBUNWIND], [ ]) 789 fi 790fi 791 792AC_ARG_ENABLE([prof-libgcc], 793 [AS_HELP_STRING([--disable-prof-libgcc], 794 [Do not use libgcc for backtracing])], 795[if test "x$enable_prof_libgcc" = "xno" ; then 796 enable_prof_libgcc="0" 797else 798 enable_prof_libgcc="1" 799fi 800], 801[enable_prof_libgcc="1"] 802) 803if test "x$backtrace_method" = "x" -a "x$enable_prof_libgcc" = "x1" \ 804 -a "x$GCC" = "xyes" ; then 805 AC_CHECK_HEADERS([unwind.h], , [enable_prof_libgcc="0"]) 806 AC_CHECK_LIB([gcc], [_Unwind_Backtrace], [LIBS="$LIBS -lgcc"], [enable_prof_libgcc="0"]) 807 if test "x${enable_prof_libgcc}" = "x1" ; then 808 backtrace_method="libgcc" 809 AC_DEFINE([JEMALLOC_PROF_LIBGCC], [ ]) 810 fi 811else 812 enable_prof_libgcc="0" 813fi 814 815AC_ARG_ENABLE([prof-gcc], 816 [AS_HELP_STRING([--disable-prof-gcc], 817 [Do not use gcc intrinsics for backtracing])], 818[if test "x$enable_prof_gcc" = "xno" ; then 819 enable_prof_gcc="0" 820else 821 enable_prof_gcc="1" 822fi 823], 824[enable_prof_gcc="1"] 825) 826if test "x$backtrace_method" = "x" -a "x$enable_prof_gcc" = "x1" \ 827 -a "x$GCC" = "xyes" ; then 828 JE_CFLAGS_APPEND([-fno-omit-frame-pointer]) 829 backtrace_method="gcc intrinsics" 830 AC_DEFINE([JEMALLOC_PROF_GCC], [ ]) 831else 832 enable_prof_gcc="0" 833fi 834 835if test "x$backtrace_method" = "x" ; then 836 backtrace_method="none (disabling profiling)" 837 enable_prof="0" 838fi 839AC_MSG_CHECKING([configured backtracing method]) 840AC_MSG_RESULT([$backtrace_method]) 841if test "x$enable_prof" = "x1" ; then 842 if test "x$abi" != "xpecoff"; then 843 dnl Heap profiling uses the log(3) function. 844 LIBS="$LIBS -lm" 845 fi 846 847 AC_DEFINE([JEMALLOC_PROF], [ ]) 848fi 849AC_SUBST([enable_prof]) 850 851dnl Enable thread-specific caching by default. 852AC_ARG_ENABLE([tcache], 853 [AS_HELP_STRING([--disable-tcache], [Disable per thread caches])], 854[if test "x$enable_tcache" = "xno" ; then 855 enable_tcache="0" 856else 857 enable_tcache="1" 858fi 859], 860[enable_tcache="1"] 861) 862if test "x$enable_tcache" = "x1" ; then 863 AC_DEFINE([JEMALLOC_TCACHE], [ ]) 864fi 865AC_SUBST([enable_tcache]) 866 867dnl Indicate whether adjacent virtual memory mappings automatically coalesce 868dnl (and fragment on demand). 869if test "x${maps_coalesce}" = "x1" ; then 870 AC_DEFINE([JEMALLOC_MAPS_COALESCE], [ ]) 871fi 872 873dnl Enable VM deallocation via munmap() by default. 874AC_ARG_ENABLE([munmap], 875 [AS_HELP_STRING([--disable-munmap], [Disable VM deallocation via munmap(2)])], 876[if test "x$enable_munmap" = "xno" ; then 877 enable_munmap="0" 878else 879 enable_munmap="1" 880fi 881], 882[enable_munmap="${default_munmap}"] 883) 884if test "x$enable_munmap" = "x1" ; then 885 AC_DEFINE([JEMALLOC_MUNMAP], [ ]) 886fi 887AC_SUBST([enable_munmap]) 888 889dnl Enable allocation from DSS if supported by the OS. 890have_dss="1" 891dnl Check whether the BSD/SUSv1 sbrk() exists. If not, disable DSS support. 892AC_CHECK_FUNC([sbrk], [have_sbrk="1"], [have_sbrk="0"]) 893if test "x$have_sbrk" = "x1" ; then 894 if test "x$sbrk_deprecated" = "x1" ; then 895 AC_MSG_RESULT([Disabling dss allocation because sbrk is deprecated]) 896 have_dss="0" 897 fi 898else 899 have_dss="0" 900fi 901 902if test "x$have_dss" = "x1" ; then 903 AC_DEFINE([JEMALLOC_DSS], [ ]) 904fi 905 906dnl Support the junk/zero filling option by default. 907AC_ARG_ENABLE([fill], 908 [AS_HELP_STRING([--disable-fill], 909 [Disable support for junk/zero filling, quarantine, and redzones])], 910[if test "x$enable_fill" = "xno" ; then 911 enable_fill="0" 912else 913 enable_fill="1" 914fi 915], 916[enable_fill="1"] 917) 918if test "x$enable_fill" = "x1" ; then 919 AC_DEFINE([JEMALLOC_FILL], [ ]) 920fi 921AC_SUBST([enable_fill]) 922 923dnl Disable utrace(2)-based tracing by default. 924AC_ARG_ENABLE([utrace], 925 [AS_HELP_STRING([--enable-utrace], [Enable utrace(2)-based tracing])], 926[if test "x$enable_utrace" = "xno" ; then 927 enable_utrace="0" 928else 929 enable_utrace="1" 930fi 931], 932[enable_utrace="0"] 933) 934JE_COMPILABLE([utrace(2)], [ 935#include <sys/types.h> 936#include <sys/param.h> 937#include <sys/time.h> 938#include <sys/uio.h> 939#include <sys/ktrace.h> 940], [ 941 utrace((void *)0, 0); 942], [je_cv_utrace]) 943if test "x${je_cv_utrace}" = "xno" ; then 944 enable_utrace="0" 945fi 946if test "x$enable_utrace" = "x1" ; then 947 AC_DEFINE([JEMALLOC_UTRACE], [ ]) 948fi 949AC_SUBST([enable_utrace]) 950 951dnl Support Valgrind by default. 952AC_ARG_ENABLE([valgrind], 953 [AS_HELP_STRING([--disable-valgrind], [Disable support for Valgrind])], 954[if test "x$enable_valgrind" = "xno" ; then 955 enable_valgrind="0" 956else 957 enable_valgrind="1" 958fi 959], 960[enable_valgrind="1"] 961) 962if test "x$enable_valgrind" = "x1" ; then 963 JE_COMPILABLE([valgrind], [ 964#include <valgrind/valgrind.h> 965#include <valgrind/memcheck.h> 966 967#if !defined(VALGRIND_RESIZEINPLACE_BLOCK) 968# error "Incompatible Valgrind version" 969#endif 970], [], [je_cv_valgrind]) 971 if test "x${je_cv_valgrind}" = "xno" ; then 972 enable_valgrind="0" 973 fi 974 if test "x$enable_valgrind" = "x1" ; then 975 AC_DEFINE([JEMALLOC_VALGRIND], [ ]) 976 fi 977fi 978AC_SUBST([enable_valgrind]) 979 980dnl Do not support the xmalloc option by default. 981AC_ARG_ENABLE([xmalloc], 982 [AS_HELP_STRING([--enable-xmalloc], [Support xmalloc option])], 983[if test "x$enable_xmalloc" = "xno" ; then 984 enable_xmalloc="0" 985else 986 enable_xmalloc="1" 987fi 988], 989[enable_xmalloc="0"] 990) 991if test "x$enable_xmalloc" = "x1" ; then 992 AC_DEFINE([JEMALLOC_XMALLOC], [ ]) 993fi 994AC_SUBST([enable_xmalloc]) 995 996dnl Support cache-oblivious allocation alignment by default. 997AC_ARG_ENABLE([cache-oblivious], 998 [AS_HELP_STRING([--disable-cache-oblivious], 999 [Disable support for cache-oblivious allocation alignment])], 1000[if test "x$enable_cache_oblivious" = "xno" ; then 1001 enable_cache_oblivious="0" 1002else 1003 enable_cache_oblivious="1" 1004fi 1005], 1006[enable_cache_oblivious="1"] 1007) 1008if test "x$enable_cache_oblivious" = "x1" ; then 1009 AC_DEFINE([JEMALLOC_CACHE_OBLIVIOUS], [ ]) 1010fi 1011AC_SUBST([enable_cache_oblivious]) 1012 1013dnl ============================================================================ 1014dnl Check for __builtin_ffsl(), then ffsl(3), and fail if neither are found. 1015dnl One of those two functions should (theoretically) exist on all platforms 1016dnl that jemalloc currently has a chance of functioning on without modification. 1017dnl We additionally assume ffs() or __builtin_ffs() are defined if 1018dnl ffsl() or __builtin_ffsl() are defined, respectively. 1019JE_COMPILABLE([a program using __builtin_ffsl], [ 1020#include <stdio.h> 1021#include <strings.h> 1022#include <string.h> 1023], [ 1024 { 1025 int rv = __builtin_ffsl(0x08); 1026 printf("%d\n", rv); 1027 } 1028], [je_cv_gcc_builtin_ffsl]) 1029if test "x${je_cv_gcc_builtin_ffsl}" = "xyes" ; then 1030 AC_DEFINE([JEMALLOC_INTERNAL_FFSL], [__builtin_ffsl]) 1031 AC_DEFINE([JEMALLOC_INTERNAL_FFS], [__builtin_ffs]) 1032else 1033 JE_COMPILABLE([a program using ffsl], [ 1034 #include <stdio.h> 1035 #include <strings.h> 1036 #include <string.h> 1037 ], [ 1038 { 1039 int rv = ffsl(0x08); 1040 printf("%d\n", rv); 1041 } 1042 ], [je_cv_function_ffsl]) 1043 if test "x${je_cv_function_ffsl}" = "xyes" ; then 1044 AC_DEFINE([JEMALLOC_INTERNAL_FFSL], [ffsl]) 1045 AC_DEFINE([JEMALLOC_INTERNAL_FFS], [ffs]) 1046 else 1047 AC_MSG_ERROR([Cannot build without ffsl(3) or __builtin_ffsl()]) 1048 fi 1049fi 1050 1051AC_ARG_WITH([lg_tiny_min], 1052 [AS_HELP_STRING([--with-lg-tiny-min=<lg-tiny-min>], 1053 [Base 2 log of minimum tiny size class to support])], 1054 [LG_TINY_MIN="$with_lg_tiny_min"], 1055 [LG_TINY_MIN="3"]) 1056AC_DEFINE_UNQUOTED([LG_TINY_MIN], [$LG_TINY_MIN]) 1057 1058AC_ARG_WITH([lg_quantum], 1059 [AS_HELP_STRING([--with-lg-quantum=<lg-quantum>], 1060 [Base 2 log of minimum allocation alignment])], 1061 [LG_QUANTA="$with_lg_quantum"], 1062 [LG_QUANTA="3 4"]) 1063if test "x$with_lg_quantum" != "x" ; then 1064 AC_DEFINE_UNQUOTED([LG_QUANTUM], [$with_lg_quantum]) 1065fi 1066 1067AC_ARG_WITH([lg_page], 1068 [AS_HELP_STRING([--with-lg-page=<lg-page>], [Base 2 log of system page size])], 1069 [LG_PAGE="$with_lg_page"], [LG_PAGE="detect"]) 1070if test "x$LG_PAGE" = "xdetect"; then 1071 AC_CACHE_CHECK([LG_PAGE], 1072 [je_cv_lg_page], 1073 AC_RUN_IFELSE([AC_LANG_PROGRAM( 1074[[ 1075#include <strings.h> 1076#ifdef _WIN32 1077#include <windows.h> 1078#else 1079#include <unistd.h> 1080#endif 1081#include <stdio.h> 1082]], 1083[[ 1084 int result; 1085 FILE *f; 1086 1087#ifdef _WIN32 1088 SYSTEM_INFO si; 1089 GetSystemInfo(&si); 1090 result = si.dwPageSize; 1091#else 1092 result = sysconf(_SC_PAGESIZE); 1093#endif 1094 if (result == -1) { 1095 return 1; 1096 } 1097 result = JEMALLOC_INTERNAL_FFSL(result) - 1; 1098 1099 f = fopen("conftest.out", "w"); 1100 if (f == NULL) { 1101 return 1; 1102 } 1103 fprintf(f, "%d\n", result); 1104 fclose(f); 1105 1106 return 0; 1107]])], 1108 [je_cv_lg_page=`cat conftest.out`], 1109 [je_cv_lg_page=undefined], 1110 [je_cv_lg_page=12])) 1111fi 1112if test "x${je_cv_lg_page}" != "x" ; then 1113 LG_PAGE="${je_cv_lg_page}" 1114fi 1115if test "x${LG_PAGE}" != "xundefined" ; then 1116 AC_DEFINE_UNQUOTED([LG_PAGE], [$LG_PAGE]) 1117else 1118 AC_MSG_ERROR([cannot determine value for LG_PAGE]) 1119fi 1120 1121AC_ARG_WITH([lg_page_sizes], 1122 [AS_HELP_STRING([--with-lg-page-sizes=<lg-page-sizes>], 1123 [Base 2 logs of system page sizes to support])], 1124 [LG_PAGE_SIZES="$with_lg_page_sizes"], [LG_PAGE_SIZES="$LG_PAGE"]) 1125 1126AC_ARG_WITH([lg_size_class_group], 1127 [AS_HELP_STRING([--with-lg-size-class-group=<lg-size-class-group>], 1128 [Base 2 log of size classes per doubling])], 1129 [LG_SIZE_CLASS_GROUP="$with_lg_size_class_group"], 1130 [LG_SIZE_CLASS_GROUP="2"]) 1131 1132dnl ============================================================================ 1133dnl jemalloc configuration. 1134dnl 1135 1136dnl Set VERSION if source directory is inside a git repository. 1137if test "x`test ! \"${srcroot}\" && cd \"${srcroot}\"; git rev-parse --is-inside-work-tree 2>/dev/null`" = "xtrue" ; then 1138 dnl Pattern globs aren't powerful enough to match both single- and 1139 dnl double-digit version numbers, so iterate over patterns to support up to 1140 dnl version 99.99.99 without any accidental matches. 1141 rm -f "${objroot}VERSION" 1142 for pattern in ['[0-9].[0-9].[0-9]' '[0-9].[0-9].[0-9][0-9]' \ 1143 '[0-9].[0-9][0-9].[0-9]' '[0-9].[0-9][0-9].[0-9][0-9]' \ 1144 '[0-9][0-9].[0-9].[0-9]' '[0-9][0-9].[0-9].[0-9][0-9]' \ 1145 '[0-9][0-9].[0-9][0-9].[0-9]' \ 1146 '[0-9][0-9].[0-9][0-9].[0-9][0-9]']; do 1147 if test ! -e "${objroot}VERSION" ; then 1148 (test ! "${srcroot}" && cd "${srcroot}"; git describe --long --abbrev=40 --match="${pattern}") > "${objroot}VERSION.tmp" 2>/dev/null 1149 if test $? -eq 0 ; then 1150 mv "${objroot}VERSION.tmp" "${objroot}VERSION" 1151 break 1152 fi 1153 fi 1154 done 1155fi 1156rm -f "${objroot}VERSION.tmp" 1157if test ! -e "${objroot}VERSION" ; then 1158 if test ! -e "${srcroot}VERSION" ; then 1159 AC_MSG_RESULT( 1160 [Missing VERSION file, and unable to generate it; creating bogus VERSION]) 1161 echo "0.0.0-0-g0000000000000000000000000000000000000000" > "${objroot}VERSION" 1162 else 1163 cp ${srcroot}VERSION ${objroot}VERSION 1164 fi 1165fi 1166jemalloc_version=`cat "${objroot}VERSION"` 1167jemalloc_version_major=`echo ${jemalloc_version} | tr ".g-" " " | awk '{print [$]1}'` 1168jemalloc_version_minor=`echo ${jemalloc_version} | tr ".g-" " " | awk '{print [$]2}'` 1169jemalloc_version_bugfix=`echo ${jemalloc_version} | tr ".g-" " " | awk '{print [$]3}'` 1170jemalloc_version_nrev=`echo ${jemalloc_version} | tr ".g-" " " | awk '{print [$]4}'` 1171jemalloc_version_gid=`echo ${jemalloc_version} | tr ".g-" " " | awk '{print [$]5}'` 1172AC_SUBST([jemalloc_version]) 1173AC_SUBST([jemalloc_version_major]) 1174AC_SUBST([jemalloc_version_minor]) 1175AC_SUBST([jemalloc_version_bugfix]) 1176AC_SUBST([jemalloc_version_nrev]) 1177AC_SUBST([jemalloc_version_gid]) 1178 1179dnl ============================================================================ 1180dnl Configure pthreads. 1181 1182if test "x$abi" != "xpecoff" ; then 1183 AC_CHECK_HEADERS([pthread.h], , [AC_MSG_ERROR([pthread.h is missing])]) 1184 dnl Some systems may embed pthreads functionality in libc; check for libpthread 1185 dnl first, but try libc too before failing. 1186 AC_CHECK_LIB([pthread], [pthread_create], [LIBS="$LIBS -lpthread"], 1187 [AC_SEARCH_LIBS([pthread_create], , , 1188 AC_MSG_ERROR([libpthread is missing]))]) 1189fi 1190 1191CPPFLAGS="$CPPFLAGS -D_REENTRANT" 1192 1193dnl Check whether clock_gettime(2) is in libc or librt. This function is only 1194dnl used in test code, so save the result to TESTLIBS to avoid poluting LIBS. 1195SAVED_LIBS="${LIBS}" 1196LIBS= 1197AC_SEARCH_LIBS([clock_gettime], [rt], [TESTLIBS="${LIBS}"]) 1198AC_SUBST([TESTLIBS]) 1199LIBS="${SAVED_LIBS}" 1200 1201dnl Check if the GNU-specific secure_getenv function exists. 1202AC_CHECK_FUNC([secure_getenv], 1203 [have_secure_getenv="1"], 1204 [have_secure_getenv="0"] 1205 ) 1206if test "x$have_secure_getenv" = "x1" ; then 1207 AC_DEFINE([JEMALLOC_HAVE_SECURE_GETENV], [ ]) 1208fi 1209 1210dnl Check if the Solaris/BSD issetugid function exists. 1211AC_CHECK_FUNC([issetugid], 1212 [have_issetugid="1"], 1213 [have_issetugid="0"] 1214 ) 1215if test "x$have_issetugid" = "x1" ; then 1216 AC_DEFINE([JEMALLOC_HAVE_ISSETUGID], [ ]) 1217fi 1218 1219dnl Check whether the BSD-specific _malloc_thread_cleanup() exists. If so, use 1220dnl it rather than pthreads TSD cleanup functions to support cleanup during 1221dnl thread exit, in order to avoid pthreads library recursion during 1222dnl bootstrapping. 1223AC_CHECK_FUNC([_malloc_thread_cleanup], 1224 [have__malloc_thread_cleanup="1"], 1225 [have__malloc_thread_cleanup="0"] 1226 ) 1227if test "x$have__malloc_thread_cleanup" = "x1" ; then 1228 AC_DEFINE([JEMALLOC_MALLOC_THREAD_CLEANUP], [ ]) 1229 force_tls="1" 1230fi 1231 1232dnl Check whether the BSD-specific _pthread_mutex_init_calloc_cb() exists. If 1233dnl so, mutex initialization causes allocation, and we need to implement this 1234dnl callback function in order to prevent recursive allocation. 1235AC_CHECK_FUNC([_pthread_mutex_init_calloc_cb], 1236 [have__pthread_mutex_init_calloc_cb="1"], 1237 [have__pthread_mutex_init_calloc_cb="0"] 1238 ) 1239if test "x$have__pthread_mutex_init_calloc_cb" = "x1" ; then 1240 AC_DEFINE([JEMALLOC_MUTEX_INIT_CB]) 1241fi 1242 1243dnl Disable lazy locking by default. 1244AC_ARG_ENABLE([lazy_lock], 1245 [AS_HELP_STRING([--enable-lazy-lock], 1246 [Enable lazy locking (only lock when multi-threaded)])], 1247[if test "x$enable_lazy_lock" = "xno" ; then 1248 enable_lazy_lock="0" 1249else 1250 enable_lazy_lock="1" 1251fi 1252], 1253[enable_lazy_lock=""] 1254) 1255if test "x$enable_lazy_lock" = "x" -a "x${force_lazy_lock}" = "x1" ; then 1256 AC_MSG_RESULT([Forcing lazy-lock to avoid allocator/threading bootstrap issues]) 1257 enable_lazy_lock="1" 1258fi 1259if test "x$enable_lazy_lock" = "x1" ; then 1260 if test "x$abi" != "xpecoff" ; then 1261 AC_CHECK_HEADERS([dlfcn.h], , [AC_MSG_ERROR([dlfcn.h is missing])]) 1262 AC_CHECK_FUNC([dlsym], [], 1263 [AC_CHECK_LIB([dl], [dlsym], [LIBS="$LIBS -ldl"], 1264 [AC_MSG_ERROR([libdl is missing])]) 1265 ]) 1266 fi 1267 AC_DEFINE([JEMALLOC_LAZY_LOCK], [ ]) 1268else 1269 enable_lazy_lock="0" 1270fi 1271AC_SUBST([enable_lazy_lock]) 1272 1273AC_ARG_ENABLE([tls], 1274 [AS_HELP_STRING([--disable-tls], [Disable thread-local storage (__thread keyword)])], 1275if test "x$enable_tls" = "xno" ; then 1276 enable_tls="0" 1277else 1278 enable_tls="1" 1279fi 1280, 1281enable_tls="" 1282) 1283if test "x${enable_tls}" = "x" ; then 1284 if test "x${force_tls}" = "x1" ; then 1285 AC_MSG_RESULT([Forcing TLS to avoid allocator/threading bootstrap issues]) 1286 enable_tls="1" 1287 elif test "x${force_tls}" = "x0" ; then 1288 AC_MSG_RESULT([Forcing no TLS to avoid allocator/threading bootstrap issues]) 1289 enable_tls="0" 1290 else 1291 enable_tls="1" 1292 fi 1293fi 1294if test "x${enable_tls}" = "x1" ; then 1295AC_MSG_CHECKING([for TLS]) 1296AC_COMPILE_IFELSE([AC_LANG_PROGRAM( 1297[[ 1298 __thread int x; 1299]], [[ 1300 x = 42; 1301 1302 return 0; 1303]])], 1304 AC_MSG_RESULT([yes]), 1305 AC_MSG_RESULT([no]) 1306 enable_tls="0") 1307else 1308 enable_tls="0" 1309fi 1310AC_SUBST([enable_tls]) 1311if test "x${enable_tls}" = "x1" ; then 1312 if test "x${force_tls}" = "x0" ; then 1313 AC_MSG_WARN([TLS enabled despite being marked unusable on this platform]) 1314 fi 1315 AC_DEFINE_UNQUOTED([JEMALLOC_TLS], [ ]) 1316elif test "x${force_tls}" = "x1" ; then 1317 AC_MSG_WARN([TLS disabled despite being marked critical on this platform]) 1318fi 1319 1320dnl ============================================================================ 1321dnl Check for C11 atomics. 1322 1323JE_COMPILABLE([C11 atomics], [ 1324#include <stdint.h> 1325#if (__STDC_VERSION__ >= 201112L) && !defined(__STDC_NO_ATOMICS__) 1326#include <stdatomic.h> 1327#else 1328#error Atomics not available 1329#endif 1330], [ 1331 uint64_t *p = (uint64_t *)0; 1332 uint64_t x = 1; 1333 volatile atomic_uint_least64_t *a = (volatile atomic_uint_least64_t *)p; 1334 uint64_t r = atomic_fetch_add(a, x) + x; 1335 return (r == 0); 1336], [je_cv_c11atomics]) 1337if test "x${je_cv_c11atomics}" = "xyes" ; then 1338 AC_DEFINE([JEMALLOC_C11ATOMICS]) 1339fi 1340 1341dnl ============================================================================ 1342dnl Check for atomic(9) operations as provided on FreeBSD. 1343 1344JE_COMPILABLE([atomic(9)], [ 1345#include <sys/types.h> 1346#include <machine/atomic.h> 1347#include <inttypes.h> 1348], [ 1349 { 1350 uint32_t x32 = 0; 1351 volatile uint32_t *x32p = &x32; 1352 atomic_fetchadd_32(x32p, 1); 1353 } 1354 { 1355 unsigned long xlong = 0; 1356 volatile unsigned long *xlongp = &xlong; 1357 atomic_fetchadd_long(xlongp, 1); 1358 } 1359], [je_cv_atomic9]) 1360if test "x${je_cv_atomic9}" = "xyes" ; then 1361 AC_DEFINE([JEMALLOC_ATOMIC9]) 1362fi 1363 1364dnl ============================================================================ 1365dnl Check for atomic(3) operations as provided on Darwin. 1366 1367JE_COMPILABLE([Darwin OSAtomic*()], [ 1368#include <libkern/OSAtomic.h> 1369#include <inttypes.h> 1370], [ 1371 { 1372 int32_t x32 = 0; 1373 volatile int32_t *x32p = &x32; 1374 OSAtomicAdd32(1, x32p); 1375 } 1376 { 1377 int64_t x64 = 0; 1378 volatile int64_t *x64p = &x64; 1379 OSAtomicAdd64(1, x64p); 1380 } 1381], [je_cv_osatomic]) 1382if test "x${je_cv_osatomic}" = "xyes" ; then 1383 AC_DEFINE([JEMALLOC_OSATOMIC], [ ]) 1384fi 1385 1386dnl ============================================================================ 1387dnl Check for madvise(2). 1388 1389JE_COMPILABLE([madvise(2)], [ 1390#include <sys/mman.h> 1391], [ 1392 { 1393 madvise((void *)0, 0, 0); 1394 } 1395], [je_cv_madvise]) 1396if test "x${je_cv_madvise}" = "xyes" ; then 1397 AC_DEFINE([JEMALLOC_HAVE_MADVISE], [ ]) 1398fi 1399 1400dnl ============================================================================ 1401dnl Check whether __sync_{add,sub}_and_fetch() are available despite 1402dnl __GCC_HAVE_SYNC_COMPARE_AND_SWAP_n macros being undefined. 1403 1404AC_DEFUN([JE_SYNC_COMPARE_AND_SWAP_CHECK],[ 1405 AC_CACHE_CHECK([whether to force $1-bit __sync_{add,sub}_and_fetch()], 1406 [je_cv_sync_compare_and_swap_$2], 1407 [AC_LINK_IFELSE([AC_LANG_PROGRAM([ 1408 #include <stdint.h> 1409 ], 1410 [ 1411 #ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_$2 1412 { 1413 uint$1_t x$1 = 0; 1414 __sync_add_and_fetch(&x$1, 42); 1415 __sync_sub_and_fetch(&x$1, 1); 1416 } 1417 #else 1418 #error __GCC_HAVE_SYNC_COMPARE_AND_SWAP_$2 is defined, no need to force 1419 #endif 1420 ])], 1421 [je_cv_sync_compare_and_swap_$2=yes], 1422 [je_cv_sync_compare_and_swap_$2=no])]) 1423 1424 if test "x${je_cv_sync_compare_and_swap_$2}" = "xyes" ; then 1425 AC_DEFINE([JE_FORCE_SYNC_COMPARE_AND_SWAP_$2], [ ]) 1426 fi 1427]) 1428 1429if test "x${je_cv_atomic9}" != "xyes" -a "x${je_cv_osatomic}" != "xyes" ; then 1430 JE_SYNC_COMPARE_AND_SWAP_CHECK(32, 4) 1431 JE_SYNC_COMPARE_AND_SWAP_CHECK(64, 8) 1432fi 1433 1434dnl ============================================================================ 1435dnl Check for __builtin_clz() and __builtin_clzl(). 1436 1437AC_CACHE_CHECK([for __builtin_clz], 1438 [je_cv_builtin_clz], 1439 [AC_LINK_IFELSE([AC_LANG_PROGRAM([], 1440 [ 1441 { 1442 unsigned x = 0; 1443 int y = __builtin_clz(x); 1444 } 1445 { 1446 unsigned long x = 0; 1447 int y = __builtin_clzl(x); 1448 } 1449 ])], 1450 [je_cv_builtin_clz=yes], 1451 [je_cv_builtin_clz=no])]) 1452 1453if test "x${je_cv_builtin_clz}" = "xyes" ; then 1454 AC_DEFINE([JEMALLOC_HAVE_BUILTIN_CLZ], [ ]) 1455fi 1456 1457dnl ============================================================================ 1458dnl Check for spinlock(3) operations as provided on Darwin. 1459 1460JE_COMPILABLE([Darwin OSSpin*()], [ 1461#include <libkern/OSAtomic.h> 1462#include <inttypes.h> 1463], [ 1464 OSSpinLock lock = 0; 1465 OSSpinLockLock(&lock); 1466 OSSpinLockUnlock(&lock); 1467], [je_cv_osspin]) 1468if test "x${je_cv_osspin}" = "xyes" ; then 1469 AC_DEFINE([JEMALLOC_OSSPIN], [ ]) 1470fi 1471 1472dnl ============================================================================ 1473dnl Darwin-related configuration. 1474 1475AC_ARG_ENABLE([zone-allocator], 1476 [AS_HELP_STRING([--disable-zone-allocator], 1477 [Disable zone allocator for Darwin])], 1478[if test "x$enable_zone_allocator" = "xno" ; then 1479 enable_zone_allocator="0" 1480else 1481 enable_zone_allocator="1" 1482fi 1483], 1484[if test "x${abi}" = "xmacho"; then 1485 enable_zone_allocator="1" 1486fi 1487] 1488) 1489AC_SUBST([enable_zone_allocator]) 1490 1491if test "x${enable_zone_allocator}" = "x1" ; then 1492 if test "x${abi}" != "xmacho"; then 1493 AC_MSG_ERROR([--enable-zone-allocator is only supported on Darwin]) 1494 fi 1495 AC_DEFINE([JEMALLOC_ZONE], [ ]) 1496 1497 dnl The szone version jumped from 3 to 6 between the OS X 10.5.x and 10.6 1498 dnl releases. malloc_zone_t and malloc_introspection_t have new fields in 1499 dnl 10.6, which is the only source-level indication of the change. 1500 AC_MSG_CHECKING([malloc zone version]) 1501 AC_DEFUN([JE_ZONE_PROGRAM], 1502 [AC_LANG_PROGRAM( 1503 [#include <malloc/malloc.h>], 1504 [static int foo[[sizeof($1) $2 sizeof(void *) * $3 ? 1 : -1]]] 1505 )]) 1506 1507 AC_COMPILE_IFELSE([JE_ZONE_PROGRAM(malloc_zone_t,==,14)],[JEMALLOC_ZONE_VERSION=3],[ 1508 AC_COMPILE_IFELSE([JE_ZONE_PROGRAM(malloc_zone_t,==,15)],[JEMALLOC_ZONE_VERSION=5],[ 1509 AC_COMPILE_IFELSE([JE_ZONE_PROGRAM(malloc_zone_t,==,16)],[ 1510 AC_COMPILE_IFELSE([JE_ZONE_PROGRAM(malloc_introspection_t,==,9)],[JEMALLOC_ZONE_VERSION=6],[ 1511 AC_COMPILE_IFELSE([JE_ZONE_PROGRAM(malloc_introspection_t,==,13)],[JEMALLOC_ZONE_VERSION=7],[JEMALLOC_ZONE_VERSION=] 1512 )])],[ 1513 AC_COMPILE_IFELSE([JE_ZONE_PROGRAM(malloc_zone_t,==,17)],[JEMALLOC_ZONE_VERSION=8],[ 1514 AC_COMPILE_IFELSE([JE_ZONE_PROGRAM(malloc_zone_t,>,17)],[JEMALLOC_ZONE_VERSION=9],[JEMALLOC_ZONE_VERSION=] 1515 )])])])]) 1516 if test "x${JEMALLOC_ZONE_VERSION}" = "x"; then 1517 AC_MSG_RESULT([unsupported]) 1518 AC_MSG_ERROR([Unsupported malloc zone version]) 1519 fi 1520 if test "${JEMALLOC_ZONE_VERSION}" = 9; then 1521 JEMALLOC_ZONE_VERSION=8 1522 AC_MSG_RESULT([> 8]) 1523 else 1524 AC_MSG_RESULT([$JEMALLOC_ZONE_VERSION]) 1525 fi 1526 AC_DEFINE_UNQUOTED(JEMALLOC_ZONE_VERSION, [$JEMALLOC_ZONE_VERSION]) 1527fi 1528 1529dnl ============================================================================ 1530dnl Check for glibc malloc hooks 1531 1532JE_COMPILABLE([glibc malloc hook], [ 1533#include <stddef.h> 1534 1535extern void (* __free_hook)(void *ptr); 1536extern void *(* __malloc_hook)(size_t size); 1537extern void *(* __realloc_hook)(void *ptr, size_t size); 1538], [ 1539 void *ptr = 0L; 1540 if (__malloc_hook) ptr = __malloc_hook(1); 1541 if (__realloc_hook) ptr = __realloc_hook(ptr, 2); 1542 if (__free_hook && ptr) __free_hook(ptr); 1543], [je_cv_glibc_malloc_hook]) 1544if test "x${je_cv_glibc_malloc_hook}" = "xyes" ; then 1545 AC_DEFINE([JEMALLOC_GLIBC_MALLOC_HOOK], [ ]) 1546fi 1547 1548JE_COMPILABLE([glibc memalign hook], [ 1549#include <stddef.h> 1550 1551extern void *(* __memalign_hook)(size_t alignment, size_t size); 1552], [ 1553 void *ptr = 0L; 1554 if (__memalign_hook) ptr = __memalign_hook(16, 7); 1555], [je_cv_glibc_memalign_hook]) 1556if test "x${je_cv_glibc_memalign_hook}" = "xyes" ; then 1557 AC_DEFINE([JEMALLOC_GLIBC_MEMALIGN_HOOK], [ ]) 1558fi 1559 1560JE_COMPILABLE([pthreads adaptive mutexes], [ 1561#include <pthread.h> 1562], [ 1563 pthread_mutexattr_t attr; 1564 pthread_mutexattr_init(&attr); 1565 pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ADAPTIVE_NP); 1566 pthread_mutexattr_destroy(&attr); 1567], [je_cv_pthread_mutex_adaptive_np]) 1568if test "x${je_cv_pthread_mutex_adaptive_np}" = "xyes" ; then 1569 AC_DEFINE([JEMALLOC_HAVE_PTHREAD_MUTEX_ADAPTIVE_NP], [ ]) 1570fi 1571 1572dnl ============================================================================ 1573dnl Check for typedefs, structures, and compiler characteristics. 1574AC_HEADER_STDBOOL 1575 1576dnl ============================================================================ 1577dnl Define commands that generate output files. 1578 1579AC_CONFIG_COMMANDS([include/jemalloc/internal/private_namespace.h], [ 1580 mkdir -p "${objroot}include/jemalloc/internal" 1581 "${srcdir}/include/jemalloc/internal/private_namespace.sh" "${srcdir}/include/jemalloc/internal/private_symbols.txt" > "${objroot}include/jemalloc/internal/private_namespace.h" 1582], [ 1583 srcdir="${srcdir}" 1584 objroot="${objroot}" 1585]) 1586AC_CONFIG_COMMANDS([include/jemalloc/internal/private_unnamespace.h], [ 1587 mkdir -p "${objroot}include/jemalloc/internal" 1588 "${srcdir}/include/jemalloc/internal/private_unnamespace.sh" "${srcdir}/include/jemalloc/internal/private_symbols.txt" > "${objroot}include/jemalloc/internal/private_unnamespace.h" 1589], [ 1590 srcdir="${srcdir}" 1591 objroot="${objroot}" 1592]) 1593AC_CONFIG_COMMANDS([include/jemalloc/internal/public_symbols.txt], [ 1594 f="${objroot}include/jemalloc/internal/public_symbols.txt" 1595 mkdir -p "${objroot}include/jemalloc/internal" 1596 cp /dev/null "${f}" 1597 for nm in `echo ${mangling_map} |tr ',' ' '` ; do 1598 n=`echo ${nm} |tr ':' ' ' |awk '{print $[]1}'` 1599 m=`echo ${nm} |tr ':' ' ' |awk '{print $[]2}'` 1600 echo "${n}:${m}" >> "${f}" 1601 dnl Remove name from public_syms so that it isn't redefined later. 1602 public_syms=`for sym in ${public_syms}; do echo "${sym}"; done |grep -v "^${n}\$" |tr '\n' ' '` 1603 done 1604 for sym in ${public_syms} ; do 1605 n="${sym}" 1606 m="${JEMALLOC_PREFIX}${sym}" 1607 echo "${n}:${m}" >> "${f}" 1608 done 1609], [ 1610 srcdir="${srcdir}" 1611 objroot="${objroot}" 1612 mangling_map="${mangling_map}" 1613 public_syms="${public_syms}" 1614 JEMALLOC_PREFIX="${JEMALLOC_PREFIX}" 1615]) 1616AC_CONFIG_COMMANDS([include/jemalloc/internal/public_namespace.h], [ 1617 mkdir -p "${objroot}include/jemalloc/internal" 1618 "${srcdir}/include/jemalloc/internal/public_namespace.sh" "${objroot}include/jemalloc/internal/public_symbols.txt" > "${objroot}include/jemalloc/internal/public_namespace.h" 1619], [ 1620 srcdir="${srcdir}" 1621 objroot="${objroot}" 1622]) 1623AC_CONFIG_COMMANDS([include/jemalloc/internal/public_unnamespace.h], [ 1624 mkdir -p "${objroot}include/jemalloc/internal" 1625 "${srcdir}/include/jemalloc/internal/public_unnamespace.sh" "${objroot}include/jemalloc/internal/public_symbols.txt" > "${objroot}include/jemalloc/internal/public_unnamespace.h" 1626], [ 1627 srcdir="${srcdir}" 1628 objroot="${objroot}" 1629]) 1630AC_CONFIG_COMMANDS([include/jemalloc/internal/size_classes.h], [ 1631 mkdir -p "${objroot}include/jemalloc/internal" 1632 "${SHELL}" "${srcdir}/include/jemalloc/internal/size_classes.sh" "${LG_QUANTA}" ${LG_TINY_MIN} "${LG_PAGE_SIZES}" ${LG_SIZE_CLASS_GROUP} > "${objroot}include/jemalloc/internal/size_classes.h" 1633], [ 1634 SHELL="${SHELL}" 1635 srcdir="${srcdir}" 1636 objroot="${objroot}" 1637 LG_QUANTA="${LG_QUANTA}" 1638 LG_TINY_MIN=${LG_TINY_MIN} 1639 LG_PAGE_SIZES="${LG_PAGE_SIZES}" 1640 LG_SIZE_CLASS_GROUP=${LG_SIZE_CLASS_GROUP} 1641]) 1642AC_CONFIG_COMMANDS([include/jemalloc/jemalloc_protos_jet.h], [ 1643 mkdir -p "${objroot}include/jemalloc" 1644 cat "${srcdir}/include/jemalloc/jemalloc_protos.h.in" | sed -e 's/@je_@/jet_/g' > "${objroot}include/jemalloc/jemalloc_protos_jet.h" 1645], [ 1646 srcdir="${srcdir}" 1647 objroot="${objroot}" 1648]) 1649AC_CONFIG_COMMANDS([include/jemalloc/jemalloc_rename.h], [ 1650 mkdir -p "${objroot}include/jemalloc" 1651 "${srcdir}/include/jemalloc/jemalloc_rename.sh" "${objroot}include/jemalloc/internal/public_symbols.txt" > "${objroot}include/jemalloc/jemalloc_rename.h" 1652], [ 1653 srcdir="${srcdir}" 1654 objroot="${objroot}" 1655]) 1656AC_CONFIG_COMMANDS([include/jemalloc/jemalloc_mangle.h], [ 1657 mkdir -p "${objroot}include/jemalloc" 1658 "${srcdir}/include/jemalloc/jemalloc_mangle.sh" "${objroot}include/jemalloc/internal/public_symbols.txt" je_ > "${objroot}include/jemalloc/jemalloc_mangle.h" 1659], [ 1660 srcdir="${srcdir}" 1661 objroot="${objroot}" 1662]) 1663AC_CONFIG_COMMANDS([include/jemalloc/jemalloc_mangle_jet.h], [ 1664 mkdir -p "${objroot}include/jemalloc" 1665 "${srcdir}/include/jemalloc/jemalloc_mangle.sh" "${objroot}include/jemalloc/internal/public_symbols.txt" jet_ > "${objroot}include/jemalloc/jemalloc_mangle_jet.h" 1666], [ 1667 srcdir="${srcdir}" 1668 objroot="${objroot}" 1669]) 1670AC_CONFIG_COMMANDS([include/jemalloc/jemalloc.h], [ 1671 mkdir -p "${objroot}include/jemalloc" 1672 "${srcdir}/include/jemalloc/jemalloc.sh" "${objroot}" > "${objroot}include/jemalloc/jemalloc${install_suffix}.h" 1673], [ 1674 srcdir="${srcdir}" 1675 objroot="${objroot}" 1676 install_suffix="${install_suffix}" 1677]) 1678 1679dnl Process .in files. 1680AC_SUBST([cfghdrs_in]) 1681AC_SUBST([cfghdrs_out]) 1682AC_CONFIG_HEADERS([$cfghdrs_tup]) 1683 1684dnl ============================================================================ 1685dnl Generate outputs. 1686 1687AC_CONFIG_FILES([$cfgoutputs_tup config.stamp bin/jemalloc-config bin/jemalloc.sh bin/jeprof]) 1688AC_SUBST([cfgoutputs_in]) 1689AC_SUBST([cfgoutputs_out]) 1690AC_OUTPUT 1691 1692dnl ============================================================================ 1693dnl Print out the results of configuration. 1694AC_MSG_RESULT([===============================================================================]) 1695AC_MSG_RESULT([jemalloc version : ${jemalloc_version}]) 1696AC_MSG_RESULT([library revision : ${rev}]) 1697AC_MSG_RESULT([]) 1698AC_MSG_RESULT([CONFIG : ${CONFIG}]) 1699AC_MSG_RESULT([CC : ${CC}]) 1700AC_MSG_RESULT([CFLAGS : ${CFLAGS}]) 1701AC_MSG_RESULT([CPPFLAGS : ${CPPFLAGS}]) 1702AC_MSG_RESULT([LDFLAGS : ${LDFLAGS}]) 1703AC_MSG_RESULT([EXTRA_LDFLAGS : ${EXTRA_LDFLAGS}]) 1704AC_MSG_RESULT([LIBS : ${LIBS}]) 1705AC_MSG_RESULT([TESTLIBS : ${TESTLIBS}]) 1706AC_MSG_RESULT([RPATH_EXTRA : ${RPATH_EXTRA}]) 1707AC_MSG_RESULT([]) 1708AC_MSG_RESULT([XSLTPROC : ${XSLTPROC}]) 1709AC_MSG_RESULT([XSLROOT : ${XSLROOT}]) 1710AC_MSG_RESULT([]) 1711AC_MSG_RESULT([PREFIX : ${PREFIX}]) 1712AC_MSG_RESULT([BINDIR : ${BINDIR}]) 1713AC_MSG_RESULT([DATADIR : ${DATADIR}]) 1714AC_MSG_RESULT([INCLUDEDIR : ${INCLUDEDIR}]) 1715AC_MSG_RESULT([LIBDIR : ${LIBDIR}]) 1716AC_MSG_RESULT([MANDIR : ${MANDIR}]) 1717AC_MSG_RESULT([]) 1718AC_MSG_RESULT([srcroot : ${srcroot}]) 1719AC_MSG_RESULT([abs_srcroot : ${abs_srcroot}]) 1720AC_MSG_RESULT([objroot : ${objroot}]) 1721AC_MSG_RESULT([abs_objroot : ${abs_objroot}]) 1722AC_MSG_RESULT([]) 1723AC_MSG_RESULT([JEMALLOC_PREFIX : ${JEMALLOC_PREFIX}]) 1724AC_MSG_RESULT([JEMALLOC_PRIVATE_NAMESPACE]) 1725AC_MSG_RESULT([ : ${JEMALLOC_PRIVATE_NAMESPACE}]) 1726AC_MSG_RESULT([install_suffix : ${install_suffix}]) 1727AC_MSG_RESULT([autogen : ${enable_autogen}]) 1728AC_MSG_RESULT([cc-silence : ${enable_cc_silence}]) 1729AC_MSG_RESULT([debug : ${enable_debug}]) 1730AC_MSG_RESULT([code-coverage : ${enable_code_coverage}]) 1731AC_MSG_RESULT([stats : ${enable_stats}]) 1732AC_MSG_RESULT([prof : ${enable_prof}]) 1733AC_MSG_RESULT([prof-libunwind : ${enable_prof_libunwind}]) 1734AC_MSG_RESULT([prof-libgcc : ${enable_prof_libgcc}]) 1735AC_MSG_RESULT([prof-gcc : ${enable_prof_gcc}]) 1736AC_MSG_RESULT([tcache : ${enable_tcache}]) 1737AC_MSG_RESULT([fill : ${enable_fill}]) 1738AC_MSG_RESULT([utrace : ${enable_utrace}]) 1739AC_MSG_RESULT([valgrind : ${enable_valgrind}]) 1740AC_MSG_RESULT([xmalloc : ${enable_xmalloc}]) 1741AC_MSG_RESULT([munmap : ${enable_munmap}]) 1742AC_MSG_RESULT([lazy_lock : ${enable_lazy_lock}]) 1743AC_MSG_RESULT([tls : ${enable_tls}]) 1744AC_MSG_RESULT([cache-oblivious : ${enable_cache_oblivious}]) 1745AC_MSG_RESULT([===============================================================================]) 1746