blob: 240d27af733d893a4f6eb67377c2dc262cb09b2d [file] [log] [blame]
Jason Evansb7924f52009-06-23 19:01:18 -07001dnl Process this file with autoconf to produce a configure script.
2AC_INIT([Makefile.in])
3
Jason Evansf3340ca2009-06-30 16:17:05 -07004dnl ============================================================================
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
Jason Evans6684cac2012-03-05 12:15:36 -080017AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
Jason Evansf3340ca2009-06-30 16:17:05 -070018[[
19]], [[
20 return 0;
21]])],
Jason Evans99b0fbb2014-02-24 16:08:38 -080022 [je_cv_cflags_appended=$1]
Jason Evansf3340ca2009-06-30 16:17:05 -070023 AC_MSG_RESULT([yes]),
Jason Evans99b0fbb2014-02-24 16:08:38 -080024 [je_cv_cflags_appended=]
Jason Evansf3340ca2009-06-30 16:17:05 -070025 AC_MSG_RESULT([no])
26 [CFLAGS="${TCFLAGS}"]
27)
28])
29
30dnl JE_COMPILABLE(label, hcode, mcode, rvar)
Jason Evans4c2faa82012-03-13 11:09:23 -070031dnl
Jason Evansf3e139a2012-03-19 09:54:20 -070032dnl Use AC_LINK_IFELSE() rather than AC_COMPILE_IFELSE() so that linker errors
Jason Evans4c2faa82012-03-13 11:09:23 -070033dnl cause failure.
Jason Evansf3340ca2009-06-30 16:17:05 -070034AC_DEFUN([JE_COMPILABLE],
35[
Jason Evans6684cac2012-03-05 12:15:36 -080036AC_CACHE_CHECK([whether $1 is compilable],
37 [$4],
Jason Evansf3e139a2012-03-19 09:54:20 -070038 [AC_LINK_IFELSE([AC_LANG_PROGRAM([$2],
39 [$3])],
40 [$4=yes],
41 [$4=no])])
Jason Evansf3340ca2009-06-30 16:17:05 -070042])
43
44dnl ============================================================================
45
Jason Evans41f2e692015-01-25 20:15:13 -080046CONFIG=`echo ${ac_configure_args} | sed -e 's#'"'"'\([^ ]*\)'"'"'#\1#g'`
Jason Evansbec6a8d2015-01-22 17:55:58 -080047AC_SUBST([CONFIG])
48
Jason Evansf576c632011-11-01 22:27:41 -070049dnl Library revision.
Jason Evans9790b962014-04-14 22:32:31 -070050rev=2
Jason Evansf576c632011-11-01 22:27:41 -070051AC_SUBST([rev])
52
Jason Evansb7924f52009-06-23 19:01:18 -070053srcroot=$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
Jason Evansaee7fd22010-11-24 22:00:02 -080093dnl Support for building documentation.
Jason Evans7329a4f2013-01-22 10:53:29 -080094AC_PATH_PROG([XSLTPROC], [xsltproc], [false], [$PATH])
Jason Evans7091b412012-03-19 09:36:44 -070095if 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
Jason Evansaee7fd22010-11-24 22:00:02 -0800103AC_ARG_WITH([xslroot],
Jason Evans7091b412012-03-19 09:36:44 -0700104 [AS_HELP_STRING([--with-xslroot=<path>], [XSL stylesheet root path])], [
Jason Evansaee7fd22010-11-24 22:00:02 -0800105if test "x$with_xslroot" = "xno" ; then
Jason Evans7091b412012-03-19 09:36:44 -0700106 XSLROOT="${DEFAULT_XSLROOT}"
Jason Evansaee7fd22010-11-24 22:00:02 -0800107else
108 XSLROOT="${with_xslroot}"
Jason Evans7091b412012-03-19 09:36:44 -0700109fi
110],
111 XSLROOT="${DEFAULT_XSLROOT}"
Jason Evansaee7fd22010-11-24 22:00:02 -0800112)
113AC_SUBST([XSLROOT])
114
Jason Evansf3340ca2009-06-30 16:17:05 -0700115dnl If CFLAGS isn't defined, set CFLAGS to something reasonable. Otherwise,
116dnl just prevent autoconf from molesting CFLAGS.
Jason Evansb7924f52009-06-23 19:01:18 -0700117CFLAGS=$CFLAGS
118AC_PROG_CC
Mike Hommeyfd97b1d2012-04-30 12:38:31 +0200119if 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
Jason Evansb7924f52009-06-23 19:01:18 -0700132if test "x$CFLAGS" = "x" ; then
133 no_CFLAGS="yes"
Jason Evanscfeccd32010-03-03 15:48:20 -0800134 if test "x$GCC" = "xyes" ; then
135 JE_CFLAGS_APPEND([-std=gnu99])
Jason Evans99b0fbb2014-02-24 16:08:38 -0800136 if test "x$je_cv_cflags_appended" = "x-std=gnu99" ; then
137 AC_DEFINE_UNQUOTED([JEMALLOC_HAS_RESTRICT])
138 fi
Jason Evanscfeccd32010-03-03 15:48:20 -0800139 JE_CFLAGS_APPEND([-Wall])
Mike Hommeyb7b44df2014-12-18 15:12:53 +0900140 JE_CFLAGS_APPEND([-Werror=declaration-after-statement])
Jason Evanscfeccd32010-03-03 15:48:20 -0800141 JE_CFLAGS_APPEND([-pipe])
142 JE_CFLAGS_APPEND([-g3])
Mike Hommeyfd97b1d2012-04-30 12:38:31 +0200143 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])
Mike Hommey8c615752014-05-29 16:58:21 +0900148 JE_CFLAGS_APPEND([-FS])
Mike Hommey6f6704c2014-05-29 17:01:10 +0900149 CPPFLAGS="$CPPFLAGS -I${srcdir}/include/msvc_compat"
Jason Evanscfeccd32010-03-03 15:48:20 -0800150 fi
Jason Evansb7924f52009-06-23 19:01:18 -0700151fi
152dnl Append EXTRA_CFLAGS to CFLAGS, if defined.
153if test "x$EXTRA_CFLAGS" != "x" ; then
Jason Evansf3340ca2009-06-30 16:17:05 -0700154 JE_CFLAGS_APPEND([$EXTRA_CFLAGS])
Jason Evansb7924f52009-06-23 19:01:18 -0700155fi
156AC_PROG_CPP
157
Jason Evansdf3f2702014-03-30 16:27:08 -0700158AC_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
Mike Hommeyff2e9992014-05-29 16:33:02 +0900163if test "x${je_cv_msvc}" = "xyes" -a "x${ac_cv_header_inttypes_h}" = "xno"; then
Mike Hommey6f6704c2014-05-29 17:01:10 +0900164 CPPFLAGS="$CPPFLAGS -I${srcdir}/include/msvc_compat/C99"
Mike Hommeyff2e9992014-05-29 16:33:02 +0900165fi
166
Jason Evansb7924f52009-06-23 19:01:18 -0700167AC_CHECK_SIZEOF([void *])
168if test "x${ac_cv_sizeof_void_p}" = "x8" ; then
Jason Evans94ad2b52009-12-29 00:09:15 -0800169 LG_SIZEOF_PTR=3
Jason Evansb7924f52009-06-23 19:01:18 -0700170elif test "x${ac_cv_sizeof_void_p}" = "x4" ; then
Jason Evans94ad2b52009-12-29 00:09:15 -0800171 LG_SIZEOF_PTR=2
Jason Evansb7924f52009-06-23 19:01:18 -0700172else
173 AC_MSG_ERROR([Unsupported pointer size: ${ac_cv_sizeof_void_p}])
174fi
Jason Evans94ad2b52009-12-29 00:09:15 -0800175AC_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])
Jason Evansb7924f52009-06-23 19:01:18 -0700186
Jason Evans84c8eef2011-03-16 10:30:13 -0700187AC_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
Jason Evansd81e4bd2012-03-06 14:57:45 -0800197AC_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
Mike Hommey14103d32012-04-20 08:38:39 +0200205 AC_MSG_ERROR([Unsupported intmax_t size: ${ac_cv_sizeof_intmax_t}])
Jason Evansd81e4bd2012-03-06 14:57:45 -0800206fi
207AC_DEFINE_UNQUOTED([LG_SIZEOF_INTMAX_T], [$LG_SIZEOF_INTMAX_T])
208
Jason Evansb7924f52009-06-23 19:01:18 -0700209AC_CANONICAL_HOST
210dnl CPU-specific settings.
211CPU_SPINWAIT=""
212case "${host_cpu}" in
Jason Evanscb657e32014-02-25 11:21:41 -0800213 i686|x86_64)
Jason Evans81e54752014-10-10 22:34:25 -0700214 AC_CACHE_VAL([je_cv_pause],
Jason Evans2eb941a2014-10-10 20:40:43 -0700215 [JE_COMPILABLE([pause instruction], [],
216 [[__asm__ volatile("pause"); return 0;]],
217 [je_cv_pause])])
Jason Evanscb657e32014-02-25 11:21:41 -0800218 if test "x${je_cv_pause}" = "xyes" ; then
Jason Evansf3340ca2009-06-30 16:17:05 -0700219 CPU_SPINWAIT='__asm__ volatile("pause")'
220 fi
Jason Evans80061b62013-12-09 13:21:08 -0800221 ;;
222 powerpc)
223 AC_DEFINE_UNQUOTED([HAVE_ALTIVEC], [ ])
Jason Evansb7924f52009-06-23 19:01:18 -0700224 ;;
225 *)
226 ;;
227esac
228AC_DEFINE_UNQUOTED([CPU_SPINWAIT], [$CPU_SPINWAIT])
229
Antony Dovgal2bd3cbc2011-10-13 09:33:33 +0400230LD_PRELOAD_VAR="LD_PRELOAD"
Jason Evansf576c632011-11-01 22:27:41 -0700231so="so"
Mike Hommeyfd97b1d2012-04-30 12:38:31 +0200232importlib="${so}"
Mike Hommey7cdea392012-04-30 12:38:27 +0200233o="$ac_objext"
Mike Hommey5bee66d2012-04-16 16:30:24 +0200234a="a"
Mike Hommey7cdea392012-04-30 12:38:27 +0200235exe="$ac_exeext"
Mike Hommeya19e87f2012-04-21 21:27:46 -0700236libprefix="lib"
Mike Hommeyfa08da72012-04-16 16:30:25 +0200237DSO_LDFLAGS='-shared -Wl,-soname,$(@F)'
238RPATH='-Wl,-rpath,$(1)'
Mike Hommey7cdea392012-04-30 12:38:27 +0200239SOREV="${so}.${rev}"
Mike Hommey188da7c2012-04-18 18:29:41 +0200240PIC_CFLAGS='-fPIC -DPIC'
Mike Hommeyfd97b1d2012-04-30 12:38:31 +0200241CTARGET='-o $@'
242LDTARGET='-o $@'
243EXTRA_LDFLAGS=
Jason Evans80ddf492013-08-20 11:48:19 +0100244ARFLAGS='crus'
245AROUT=' $@'
Mike Hommey79c4bca2012-05-02 21:30:51 +0200246CC_MM=1
Jason Evans7372b152012-02-10 20:22:09 -0800247
Jory A. Prattad505e02013-08-11 09:44:59 -0500248AN_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
Jason Evansb7924f52009-06-23 19:01:18 -0700253dnl 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.
Jason Evans59ae2762012-04-16 17:52:27 -0700260default_munmap="1"
Jason Evansb7924f52009-06-23 19:01:18 -0700261case "${host}" in
Valerii Hiora5921ba72014-05-16 16:28:20 +0300262 *-*-darwin* | *-*-ios*)
Mike Hommeya6770a72012-05-03 14:12:49 +0200263 CFLAGS="$CFLAGS"
Jason Evansb7924f52009-06-23 19:01:18 -0700264 abi="macho"
Jason Evanse24c7af2012-03-19 10:21:17 -0700265 AC_DEFINE([JEMALLOC_PURGE_MADVISE_FREE], [ ])
Jason Evansb7924f52009-06-23 19:01:18 -0700266 RPATH=""
Antony Dovgal2bd3cbc2011-10-13 09:33:33 +0400267 LD_PRELOAD_VAR="DYLD_INSERT_LIBRARIES"
Jason Evansf576c632011-11-01 22:27:41 -0700268 so="dylib"
Mike Hommeyfd97b1d2012-04-30 12:38:31 +0200269 importlib="${so}"
Jason Evansb80581d2012-03-23 16:17:43 -0700270 force_tls="0"
Mike Hommeyfa08da72012-04-16 16:30:25 +0200271 DSO_LDFLAGS='-shared -Wl,-dylib_install_name,$(@F)'
Mike Hommey7cdea392012-04-30 12:38:27 +0200272 SOREV="${rev}.${so}"
Jason Evans66688532013-12-03 21:49:36 -0800273 sbrk_deprecated="1"
Jason Evansb7924f52009-06-23 19:01:18 -0700274 ;;
275 *-*-freebsd*)
276 CFLAGS="$CFLAGS"
277 abi="elf"
Jason Evanse24c7af2012-03-19 10:21:17 -0700278 AC_DEFINE([JEMALLOC_PURGE_MADVISE_FREE], [ ])
Jason Evansfd4fcef2012-03-23 17:40:58 -0700279 force_lazy_lock="1"
Jason Evansb7924f52009-06-23 19:01:18 -0700280 ;;
Michael Neumann1aa25a32014-08-05 03:06:02 +0200281 *-*-dragonfly*)
282 CFLAGS="$CFLAGS"
283 abi="elf"
284 AC_DEFINE([JEMALLOC_PURGE_MADVISE_FREE], [ ])
285 ;;
Sébastien Marie77d597e2015-01-25 10:18:32 +0100286 *-*-openbsd*)
287 CFLAGS="$CFLAGS"
288 abi="elf"
289 AC_DEFINE([JEMALLOC_PURGE_MADVISE_FREE], [ ])
290 ;;
Jason Evansb7924f52009-06-23 19:01:18 -0700291 *-*-linux*)
292 CFLAGS="$CFLAGS"
293 CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
294 abi="elf"
Garrett Cooper13e4e242012-12-02 17:58:40 -0800295 AC_DEFINE([JEMALLOC_HAS_ALLOCA_H])
Jason Evanse24c7af2012-03-19 10:21:17 -0700296 AC_DEFINE([JEMALLOC_PURGE_MADVISE_DONTNEED], [ ])
Jason Evans02b23122012-04-05 11:06:23 -0700297 AC_DEFINE([JEMALLOC_THREADED_INIT], [ ])
Jason Evans59ae2762012-04-16 17:52:27 -0700298 default_munmap="0"
Jason Evansb7924f52009-06-23 19:01:18 -0700299 ;;
300 *-*-netbsd*)
301 AC_MSG_CHECKING([ABI])
302 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
303[[#ifdef __ELF__
304/* ELF */
305#else
306#error aout
307#endif
308]])],
309 [CFLAGS="$CFLAGS"; abi="elf"],
310 [abi="aout"])
311 AC_MSG_RESULT([$abi])
Jason Evanse24c7af2012-03-19 10:21:17 -0700312 AC_DEFINE([JEMALLOC_PURGE_MADVISE_FREE], [ ])
Jason Evansb7924f52009-06-23 19:01:18 -0700313 ;;
314 *-*-solaris2*)
315 CFLAGS="$CFLAGS"
316 abi="elf"
George Koladdd6bd42014-02-12 23:05:45 +0000317 AC_DEFINE([JEMALLOC_PURGE_MADVISE_FREE], [ ])
Mike Hommeyfa08da72012-04-16 16:30:25 +0200318 RPATH='-Wl,-R,$(1)'
Jason Evansb7924f52009-06-23 19:01:18 -0700319 dnl Solaris needs this for sigwait().
320 CPPFLAGS="$CPPFLAGS -D_POSIX_PTHREAD_SEMANTICS"
321 LIBS="$LIBS -lposix4 -lsocket -lnsl"
322 ;;
Antony Dovgal2bd3cbc2011-10-13 09:33:33 +0400323 *-ibm-aix*)
324 if "$LG_SIZEOF_PTR" = "8"; then
325 dnl 64bit AIX
326 LD_PRELOAD_VAR="LDR_PRELOAD64"
327 else
328 dnl 32bit AIX
329 LD_PRELOAD_VAR="LDR_PRELOAD"
330 fi
331 abi="xcoff"
Antony Dovgal2bd3cbc2011-10-13 09:33:33 +0400332 ;;
Dave Rigby70bdee02014-09-22 15:53:16 +0100333 *-*-mingw* | *-*-cygwin*)
Mike Hommeya19e87f2012-04-21 21:27:46 -0700334 abi="pecoff"
335 force_tls="0"
336 RPATH=""
337 so="dll"
Mike Hommeyfd97b1d2012-04-30 12:38:31 +0200338 if test "x$je_cv_msvc" = "xyes" ; then
339 importlib="lib"
340 DSO_LDFLAGS="-LD"
341 EXTRA_LDFLAGS="-link -DEBUG"
342 CTARGET='-Fo$@'
343 LDTARGET='-Fe$@'
Jory A. Prattad505e02013-08-11 09:44:59 -0500344 AR='lib'
345 ARFLAGS='-nologo -out:'
Jason Evans80ddf492013-08-20 11:48:19 +0100346 AROUT='$@'
Mike Hommey79c4bca2012-05-02 21:30:51 +0200347 CC_MM=
Mike Hommeyfd97b1d2012-04-30 12:38:31 +0200348 else
349 importlib="${so}"
350 DSO_LDFLAGS="-shared"
351 fi
Mike Hommeya19e87f2012-04-21 21:27:46 -0700352 a="lib"
353 libprefix=""
Mike Hommey7cdea392012-04-30 12:38:27 +0200354 SOREV="${so}"
Mike Hommeya19e87f2012-04-21 21:27:46 -0700355 PIC_CFLAGS=""
356 ;;
Jason Evansb7924f52009-06-23 19:01:18 -0700357 *)
358 AC_MSG_RESULT([Unsupported operating system: ${host}])
359 abi="elf"
Jason Evansb7924f52009-06-23 19:01:18 -0700360 ;;
361esac
Mike Hommeyaffe0092014-05-28 08:10:12 +0900362
363JEMALLOC_USABLE_SIZE_CONST=const
364AC_CHECK_HEADERS([malloc.h], [
365 AC_MSG_CHECKING([whether malloc_usable_size definition can use const argument])
366 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
367 [#include <malloc.h>
368 #include <stddef.h>
369 size_t malloc_usable_size(const void *ptr);
370 ],
371 [])],[
372 AC_MSG_RESULT([yes])
373 ],[
374 JEMALLOC_USABLE_SIZE_CONST=
375 AC_MSG_RESULT([no])
376 ])
377])
Jason Evans247d1242012-10-09 16:20:10 -0700378AC_DEFINE_UNQUOTED([JEMALLOC_USABLE_SIZE_CONST], [$JEMALLOC_USABLE_SIZE_CONST])
Jason Evansb7924f52009-06-23 19:01:18 -0700379AC_SUBST([abi])
380AC_SUBST([RPATH])
Antony Dovgal2bd3cbc2011-10-13 09:33:33 +0400381AC_SUBST([LD_PRELOAD_VAR])
Jason Evansf576c632011-11-01 22:27:41 -0700382AC_SUBST([so])
Mike Hommeyfd97b1d2012-04-30 12:38:31 +0200383AC_SUBST([importlib])
Mike Hommey5bee66d2012-04-16 16:30:24 +0200384AC_SUBST([o])
385AC_SUBST([a])
386AC_SUBST([exe])
Mike Hommeya19e87f2012-04-21 21:27:46 -0700387AC_SUBST([libprefix])
Mike Hommeyfa08da72012-04-16 16:30:25 +0200388AC_SUBST([DSO_LDFLAGS])
Mike Hommeyfd97b1d2012-04-30 12:38:31 +0200389AC_SUBST([EXTRA_LDFLAGS])
Mike Hommey85221d52012-04-18 18:29:40 +0200390AC_SUBST([SOREV])
Mike Hommey188da7c2012-04-18 18:29:41 +0200391AC_SUBST([PIC_CFLAGS])
Mike Hommeyfd97b1d2012-04-30 12:38:31 +0200392AC_SUBST([CTARGET])
393AC_SUBST([LDTARGET])
394AC_SUBST([MKLIB])
Jason Evans80ddf492013-08-20 11:48:19 +0100395AC_SUBST([ARFLAGS])
396AC_SUBST([AROUT])
Mike Hommey79c4bca2012-05-02 21:30:51 +0200397AC_SUBST([CC_MM])
Mike Hommeyfd97b1d2012-04-30 12:38:31 +0200398
Jason Evansfa5d2452011-03-15 10:25:59 -0700399JE_COMPILABLE([__attribute__ syntax],
400 [static __attribute__((unused)) void foo(void){}],
401 [],
Jason Evans6684cac2012-03-05 12:15:36 -0800402 [je_cv_attribute])
403if test "x${je_cv_attribute}" = "xyes" ; then
Jason Evansfa5d2452011-03-15 10:25:59 -0700404 AC_DEFINE([JEMALLOC_HAVE_ATTR], [ ])
405 if test "x${GCC}" = "xyes" -a "x${abi}" = "xelf"; then
406 JE_CFLAGS_APPEND([-fvisibility=hidden])
407 fi
408fi
Jason Evans3cc1f1a2012-04-03 22:30:05 -0700409dnl Check for tls_model attribute support (clang 3.0 still lacks support).
410SAVED_CFLAGS="${CFLAGS}"
411JE_CFLAGS_APPEND([-Werror])
412JE_COMPILABLE([tls_model attribute], [],
413 [static __thread int
Daniel Micayf1cf3ea2014-09-16 04:42:33 -0400414 __attribute__((tls_model("initial-exec"), unused)) foo;
Jason Evans3cc1f1a2012-04-03 22:30:05 -0700415 foo = 0;],
416 [je_cv_tls_model])
417CFLAGS="${SAVED_CFLAGS}"
418if test "x${je_cv_tls_model}" = "xyes" ; then
419 AC_DEFINE([JEMALLOC_TLS_MODEL],
420 [__attribute__((tls_model("initial-exec")))])
421else
422 AC_DEFINE([JEMALLOC_TLS_MODEL], [ ])
423fi
Jason Evansfa5d2452011-03-15 10:25:59 -0700424
Jason Evansb7924f52009-06-23 19:01:18 -0700425dnl Support optional additions to rpath.
426AC_ARG_WITH([rpath],
Jason Evans90895cf2009-12-29 00:09:15 -0800427 [AS_HELP_STRING([--with-rpath=<rpath>], [Colon-separated rpath (ELF systems only)])],
Jason Evansb7924f52009-06-23 19:01:18 -0700428if test "x$with_rpath" = "xno" ; then
429 RPATH_EXTRA=
430else
431 RPATH_EXTRA="`echo $with_rpath | tr \":\" \" \"`"
432fi,
433 RPATH_EXTRA=
434)
435AC_SUBST([RPATH_EXTRA])
436
437dnl Disable rules that do automatic regeneration of configure output by default.
438AC_ARG_ENABLE([autogen],
Jason Evans78d815c2010-01-17 14:06:20 -0800439 [AS_HELP_STRING([--enable-autogen], [Automatically regenerate configure output])],
Jason Evansb7924f52009-06-23 19:01:18 -0700440if test "x$enable_autogen" = "xno" ; then
441 enable_autogen="0"
442else
443 enable_autogen="1"
444fi
445,
446enable_autogen="0"
447)
448AC_SUBST([enable_autogen])
449
450AC_PROG_INSTALL
451AC_PROG_RANLIB
Jason Evans7329a4f2013-01-22 10:53:29 -0800452AC_PATH_PROG([LD], [ld], [false], [$PATH])
453AC_PATH_PROG([AUTOCONF], [autoconf], [false], [$PATH])
Jason Evansb7924f52009-06-23 19:01:18 -0700454
Daniel Micay4cfe5512014-08-28 15:41:48 -0400455public_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"
Jason Evans7e77eaf2012-03-02 17:47:37 -0800456
457dnl Check for allocator-related functions that should be wrapped.
458AC_CHECK_FUNC([memalign],
Jason Evanse24c7af2012-03-19 10:21:17 -0700459 [AC_DEFINE([JEMALLOC_OVERRIDE_MEMALIGN], [ ])
Jason Evans7e77eaf2012-03-02 17:47:37 -0800460 public_syms="${public_syms} memalign"])
461AC_CHECK_FUNC([valloc],
Jason Evanse24c7af2012-03-19 10:21:17 -0700462 [AC_DEFINE([JEMALLOC_OVERRIDE_VALLOC], [ ])
Jason Evans7e77eaf2012-03-02 17:47:37 -0800463 public_syms="${public_syms} valloc"])
464
Jason Evans748dfac2013-12-06 18:27:33 -0800465dnl Do not compute test code coverage by default.
466GCOV_FLAGS=
467AC_ARG_ENABLE([code-coverage],
468 [AS_HELP_STRING([--enable-code-coverage],
469 [Enable code coverage])],
470[if test "x$enable_code_coverage" = "xno" ; then
471 enable_code_coverage="0"
472else
473 enable_code_coverage="1"
474fi
475],
476[enable_code_coverage="0"]
477)
478if test "x$enable_code_coverage" = "x1" ; then
479 deoptimize="no"
480 echo "$CFLAGS $EXTRA_CFLAGS" | grep '\-O' >/dev/null || deoptimize="yes"
481 if test "x${deoptimize}" = "xyes" ; then
482 JE_CFLAGS_APPEND([-O0])
483 fi
484 JE_CFLAGS_APPEND([-fprofile-arcs -ftest-coverage])
485 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -fprofile-arcs -ftest-coverage"
486 AC_DEFINE([JEMALLOC_CODE_COVERAGE], [ ])
487fi
488AC_SUBST([enable_code_coverage])
489
Jason Evans0a5489e2012-03-01 17:19:20 -0800490dnl Perform no name mangling by default.
491AC_ARG_WITH([mangling],
492 [AS_HELP_STRING([--with-mangling=<map>], [Mangle symbols in <map>])],
493 [mangling_map="$with_mangling"], [mangling_map=""])
Jason Evans0a5489e2012-03-01 17:19:20 -0800494
Jason Evans90895cf2009-12-29 00:09:15 -0800495dnl Do not prefix public APIs by default.
496AC_ARG_WITH([jemalloc_prefix],
497 [AS_HELP_STRING([--with-jemalloc-prefix=<prefix>], [Prefix to prepend to all public APIs])],
Jason Evansb0fd5012010-01-17 01:49:20 -0800498 [JEMALLOC_PREFIX="$with_jemalloc_prefix"],
Mike Hommey7cdea392012-04-30 12:38:27 +0200499 [if test "x$abi" != "xmacho" -a "x$abi" != "xpecoff"; then
Jason Evans2dbecf12010-09-05 10:35:13 -0700500 JEMALLOC_PREFIX=""
501else
502 JEMALLOC_PREFIX="je_"
503fi]
Jason Evans90895cf2009-12-29 00:09:15 -0800504)
505if test "x$JEMALLOC_PREFIX" != "x" ; then
Jason Evanse7339702010-10-23 18:37:06 -0700506 JEMALLOC_CPREFIX=`echo ${JEMALLOC_PREFIX} | tr "a-z" "A-Z"`
507 AC_DEFINE_UNQUOTED([JEMALLOC_PREFIX], ["$JEMALLOC_PREFIX"])
508 AC_DEFINE_UNQUOTED([JEMALLOC_CPREFIX], ["$JEMALLOC_CPREFIX"])
Jason Evans90895cf2009-12-29 00:09:15 -0800509fi
510
Mike Hommey99066602012-11-19 10:55:26 +0100511AC_ARG_WITH([export],
512 [AS_HELP_STRING([--without-export], [disable exporting jemalloc public APIs])],
513 [if test "x$with_export" = "xno"; then
Jason Evans2625c892013-01-22 16:46:27 -0800514 AC_DEFINE([JEMALLOC_EXPORT],[])
Mike Hommey99066602012-11-19 10:55:26 +0100515fi]
516)
517
Jason Evans86abd0d2013-11-30 15:25:42 -0800518dnl Mangle library-private APIs.
Jason Evans746e77a2011-07-30 16:40:52 -0700519AC_ARG_WITH([private_namespace],
520 [AS_HELP_STRING([--with-private-namespace=<prefix>], [Prefix to prepend to all library-private APIs])],
Jason Evans86abd0d2013-11-30 15:25:42 -0800521 [JEMALLOC_PRIVATE_NAMESPACE="${with_private_namespace}je_"],
522 [JEMALLOC_PRIVATE_NAMESPACE="je_"]
Jason Evans746e77a2011-07-30 16:40:52 -0700523)
Jason Evans86abd0d2013-11-30 15:25:42 -0800524AC_DEFINE_UNQUOTED([JEMALLOC_PRIVATE_NAMESPACE], [$JEMALLOC_PRIVATE_NAMESPACE])
525private_namespace="$JEMALLOC_PRIVATE_NAMESPACE"
526AC_SUBST([private_namespace])
Jason Evans746e77a2011-07-30 16:40:52 -0700527
Jason Evansb0fd5012010-01-17 01:49:20 -0800528dnl Do not add suffix to installed files by default.
529AC_ARG_WITH([install_suffix],
530 [AS_HELP_STRING([--with-install-suffix=<suffix>], [Suffix to append to all installed files])],
531 [INSTALL_SUFFIX="$with_install_suffix"],
532 [INSTALL_SUFFIX=]
533)
534install_suffix="$INSTALL_SUFFIX"
535AC_SUBST([install_suffix])
536
Jason Evans86abd0d2013-11-30 15:25:42 -0800537dnl Substitute @je_@ in jemalloc_protos.h.in, primarily to make generation of
538dnl jemalloc_protos_jet.h easy.
539je_="je_"
540AC_SUBST([je_])
541
Mike Hommeycf6032d2014-07-30 18:16:13 +0900542cfgoutputs_in="Makefile.in"
Nick White913e9a82014-09-19 22:01:23 +0100543cfgoutputs_in="${cfgoutputs_in} jemalloc.pc.in"
Mike Hommeycf6032d2014-07-30 18:16:13 +0900544cfgoutputs_in="${cfgoutputs_in} doc/html.xsl.in"
545cfgoutputs_in="${cfgoutputs_in} doc/manpages.xsl.in"
546cfgoutputs_in="${cfgoutputs_in} doc/jemalloc.xml.in"
547cfgoutputs_in="${cfgoutputs_in} include/jemalloc/jemalloc_macros.h.in"
548cfgoutputs_in="${cfgoutputs_in} include/jemalloc/jemalloc_protos.h.in"
Jason Evans82e88d12014-09-07 19:55:03 -0700549cfgoutputs_in="${cfgoutputs_in} include/jemalloc/jemalloc_typedefs.h.in"
Mike Hommeycf6032d2014-07-30 18:16:13 +0900550cfgoutputs_in="${cfgoutputs_in} include/jemalloc/internal/jemalloc_internal.h.in"
551cfgoutputs_in="${cfgoutputs_in} test/test.sh.in"
552cfgoutputs_in="${cfgoutputs_in} test/include/test/jemalloc_test.h.in"
Jason Evansb0fd5012010-01-17 01:49:20 -0800553
Jason Evansaee7fd22010-11-24 22:00:02 -0800554cfgoutputs_out="Makefile"
Nick White913e9a82014-09-19 22:01:23 +0100555cfgoutputs_out="${cfgoutputs_out} jemalloc.pc"
Jason Evansaee7fd22010-11-24 22:00:02 -0800556cfgoutputs_out="${cfgoutputs_out} doc/html.xsl"
557cfgoutputs_out="${cfgoutputs_out} doc/manpages.xsl"
Jason Evans86abd0d2013-11-30 15:25:42 -0800558cfgoutputs_out="${cfgoutputs_out} doc/jemalloc.xml"
559cfgoutputs_out="${cfgoutputs_out} include/jemalloc/jemalloc_macros.h"
560cfgoutputs_out="${cfgoutputs_out} include/jemalloc/jemalloc_protos.h"
Jason Evans82e88d12014-09-07 19:55:03 -0700561cfgoutputs_out="${cfgoutputs_out} include/jemalloc/jemalloc_typedefs.h"
Jason Evans376b1522010-02-11 14:45:59 -0800562cfgoutputs_out="${cfgoutputs_out} include/jemalloc/internal/jemalloc_internal.h"
Jason Evans86abd0d2013-11-30 15:25:42 -0800563cfgoutputs_out="${cfgoutputs_out} test/test.sh"
564cfgoutputs_out="${cfgoutputs_out} test/include/test/jemalloc_test.h"
Jason Evansb0fd5012010-01-17 01:49:20 -0800565
Jason Evansaee7fd22010-11-24 22:00:02 -0800566cfgoutputs_tup="Makefile"
Nick White913e9a82014-09-19 22:01:23 +0100567cfgoutputs_tup="${cfgoutputs_tup} jemalloc.pc:jemalloc.pc.in"
Jason Evansaee7fd22010-11-24 22:00:02 -0800568cfgoutputs_tup="${cfgoutputs_tup} doc/html.xsl:doc/html.xsl.in"
569cfgoutputs_tup="${cfgoutputs_tup} doc/manpages.xsl:doc/manpages.xsl.in"
Jason Evans86abd0d2013-11-30 15:25:42 -0800570cfgoutputs_tup="${cfgoutputs_tup} doc/jemalloc.xml:doc/jemalloc.xml.in"
571cfgoutputs_tup="${cfgoutputs_tup} include/jemalloc/jemalloc_macros.h:include/jemalloc/jemalloc_macros.h.in"
572cfgoutputs_tup="${cfgoutputs_tup} include/jemalloc/jemalloc_protos.h:include/jemalloc/jemalloc_protos.h.in"
Jason Evans82e88d12014-09-07 19:55:03 -0700573cfgoutputs_tup="${cfgoutputs_tup} include/jemalloc/jemalloc_typedefs.h:include/jemalloc/jemalloc_typedefs.h.in"
Jason Evans376b1522010-02-11 14:45:59 -0800574cfgoutputs_tup="${cfgoutputs_tup} include/jemalloc/internal/jemalloc_internal.h"
Jason Evans86abd0d2013-11-30 15:25:42 -0800575cfgoutputs_tup="${cfgoutputs_tup} test/test.sh:test/test.sh.in"
576cfgoutputs_tup="${cfgoutputs_tup} test/include/test/jemalloc_test.h:test/include/test/jemalloc_test.h.in"
Jason Evansb0fd5012010-01-17 01:49:20 -0800577
Mike Hommeycf6032d2014-07-30 18:16:13 +0900578cfghdrs_in="include/jemalloc/jemalloc_defs.h.in"
579cfghdrs_in="${cfghdrs_in} include/jemalloc/internal/jemalloc_internal_defs.h.in"
580cfghdrs_in="${cfghdrs_in} include/jemalloc/internal/private_namespace.sh"
581cfghdrs_in="${cfghdrs_in} include/jemalloc/internal/private_unnamespace.sh"
582cfghdrs_in="${cfghdrs_in} include/jemalloc/internal/private_symbols.txt"
583cfghdrs_in="${cfghdrs_in} include/jemalloc/internal/public_namespace.sh"
584cfghdrs_in="${cfghdrs_in} include/jemalloc/internal/public_unnamespace.sh"
585cfghdrs_in="${cfghdrs_in} include/jemalloc/internal/size_classes.sh"
586cfghdrs_in="${cfghdrs_in} include/jemalloc/jemalloc_rename.sh"
587cfghdrs_in="${cfghdrs_in} include/jemalloc/jemalloc_mangle.sh"
588cfghdrs_in="${cfghdrs_in} include/jemalloc/jemalloc.sh"
589cfghdrs_in="${cfghdrs_in} test/include/test/jemalloc_test_defs.h.in"
Jason Evansb0fd5012010-01-17 01:49:20 -0800590
Jason Evans86abd0d2013-11-30 15:25:42 -0800591cfghdrs_out="include/jemalloc/jemalloc_defs.h"
592cfghdrs_out="${cfghdrs_out} include/jemalloc/jemalloc${install_suffix}.h"
Jason Evans86abd0d2013-11-30 15:25:42 -0800593cfghdrs_out="${cfghdrs_out} include/jemalloc/internal/private_namespace.h"
594cfghdrs_out="${cfghdrs_out} include/jemalloc/internal/private_unnamespace.h"
Jason Evansf234dc52014-01-16 17:38:01 -0800595cfghdrs_out="${cfghdrs_out} include/jemalloc/internal/public_symbols.txt"
Jason Evans86abd0d2013-11-30 15:25:42 -0800596cfghdrs_out="${cfghdrs_out} include/jemalloc/internal/public_namespace.h"
597cfghdrs_out="${cfghdrs_out} include/jemalloc/internal/public_unnamespace.h"
Jason Evansb1726102012-02-28 16:50:47 -0800598cfghdrs_out="${cfghdrs_out} include/jemalloc/internal/size_classes.h"
Jason Evansf234dc52014-01-16 17:38:01 -0800599cfghdrs_out="${cfghdrs_out} include/jemalloc/jemalloc_protos_jet.h"
600cfghdrs_out="${cfghdrs_out} include/jemalloc/jemalloc_rename.h"
601cfghdrs_out="${cfghdrs_out} include/jemalloc/jemalloc_mangle.h"
602cfghdrs_out="${cfghdrs_out} include/jemalloc/jemalloc_mangle_jet.h"
603cfghdrs_out="${cfghdrs_out} include/jemalloc/internal/jemalloc_internal_defs.h"
Jason Evans80061b62013-12-09 13:21:08 -0800604cfghdrs_out="${cfghdrs_out} test/include/test/jemalloc_test_defs.h"
Jason Evansb0fd5012010-01-17 01:49:20 -0800605
Jason Evans86abd0d2013-11-30 15:25:42 -0800606cfghdrs_tup="include/jemalloc/jemalloc_defs.h:include/jemalloc/jemalloc_defs.h.in"
Mike Hommeycf6032d2014-07-30 18:16:13 +0900607cfghdrs_tup="${cfghdrs_tup} include/jemalloc/internal/jemalloc_internal_defs.h:include/jemalloc/internal/jemalloc_internal_defs.h.in"
608cfghdrs_tup="${cfghdrs_tup} test/include/test/jemalloc_test_defs.h:test/include/test/jemalloc_test_defs.h.in"
Jason Evansb0fd5012010-01-17 01:49:20 -0800609
Jason Evans644d4142014-04-14 22:49:23 -0700610dnl Silence irrelevant compiler warnings by default.
Jason Evans355b4382010-09-20 19:20:48 -0700611AC_ARG_ENABLE([cc-silence],
Jason Evans644d4142014-04-14 22:49:23 -0700612 [AS_HELP_STRING([--disable-cc-silence],
613 [Do not silence irrelevant compiler warnings])],
Jason Evans355b4382010-09-20 19:20:48 -0700614[if test "x$enable_cc_silence" = "xno" ; then
615 enable_cc_silence="0"
616else
617 enable_cc_silence="1"
618fi
619],
Jason Evans644d4142014-04-14 22:49:23 -0700620[enable_cc_silence="1"]
Jason Evans355b4382010-09-20 19:20:48 -0700621)
622if test "x$enable_cc_silence" = "x1" ; then
Jason Evanse24c7af2012-03-19 10:21:17 -0700623 AC_DEFINE([JEMALLOC_CC_SILENCE], [ ])
Jason Evans355b4382010-09-20 19:20:48 -0700624fi
625
Jason Evansb7924f52009-06-23 19:01:18 -0700626dnl Do not compile with debugging by default.
627AC_ARG_ENABLE([debug],
Jason Evanscbf3a6d2015-02-11 12:24:27 -0800628 [AS_HELP_STRING([--enable-debug], [Build debugging code])],
Jason Evansb7924f52009-06-23 19:01:18 -0700629[if test "x$enable_debug" = "xno" ; then
630 enable_debug="0"
631else
632 enable_debug="1"
633fi
634],
635[enable_debug="0"]
636)
Jason Evansb7924f52009-06-23 19:01:18 -0700637AC_SUBST([enable_debug])
638
639dnl Only optimize if not debugging.
640if test "x$enable_debug" = "x0" -a "x$no_CFLAGS" = "xyes" ; then
641 dnl Make sure that an optimization flag was not specified in EXTRA_CFLAGS.
Jason Evansf3340ca2009-06-30 16:17:05 -0700642 optimize="no"
Jason Evans748dfac2013-12-06 18:27:33 -0800643 echo "$CFLAGS $EXTRA_CFLAGS" | grep '\-O' >/dev/null || optimize="yes"
Jason Evansf3340ca2009-06-30 16:17:05 -0700644 if test "x${optimize}" = "xyes" ; then
645 if test "x$GCC" = "xyes" ; then
646 JE_CFLAGS_APPEND([-O3])
647 JE_CFLAGS_APPEND([-funroll-loops])
Mike Hommeyfd97b1d2012-04-30 12:38:31 +0200648 elif test "x$je_cv_msvc" = "xyes" ; then
649 JE_CFLAGS_APPEND([-O2])
Jason Evansf3340ca2009-06-30 16:17:05 -0700650 else
651 JE_CFLAGS_APPEND([-O])
652 fi
Jason Evansb7924f52009-06-23 19:01:18 -0700653 fi
654fi
655
Jason Evansd073a322012-02-28 20:41:16 -0800656dnl Enable statistics calculation by default.
Jason Evansb7924f52009-06-23 19:01:18 -0700657AC_ARG_ENABLE([stats],
Jason Evans777c1912012-02-28 20:49:22 -0800658 [AS_HELP_STRING([--disable-stats],
659 [Disable statistics calculation/reporting])],
Jason Evansb7924f52009-06-23 19:01:18 -0700660[if test "x$enable_stats" = "xno" ; then
661 enable_stats="0"
662else
663 enable_stats="1"
664fi
665],
Jason Evansd073a322012-02-28 20:41:16 -0800666[enable_stats="1"]
Jason Evansb7924f52009-06-23 19:01:18 -0700667)
668if test "x$enable_stats" = "x1" ; then
669 AC_DEFINE([JEMALLOC_STATS], [ ])
670fi
671AC_SUBST([enable_stats])
672
Jason Evans6109fe02010-02-10 10:37:56 -0800673dnl Do not enable profiling by default.
674AC_ARG_ENABLE([prof],
675 [AS_HELP_STRING([--enable-prof], [Enable allocation profiling])],
676[if test "x$enable_prof" = "xno" ; then
677 enable_prof="0"
678else
679 enable_prof="1"
680fi
681],
682[enable_prof="0"]
683)
Jason Evans77f350b2011-03-15 22:23:12 -0700684if test "x$enable_prof" = "x1" ; then
685 backtrace_method=""
Jason Evansb27805b2010-02-10 18:15:53 -0800686else
Jason Evans77f350b2011-03-15 22:23:12 -0700687 backtrace_method="N/A"
Jason Evansb27805b2010-02-10 18:15:53 -0800688fi
Jason Evans77f350b2011-03-15 22:23:12 -0700689
Jason Evans6109fe02010-02-10 10:37:56 -0800690AC_ARG_ENABLE([prof-libunwind],
691 [AS_HELP_STRING([--enable-prof-libunwind], [Use libunwind for backtracing])],
692[if test "x$enable_prof_libunwind" = "xno" ; then
693 enable_prof_libunwind="0"
694else
695 enable_prof_libunwind="1"
696fi
697],
698[enable_prof_libunwind="0"]
699)
Jason Evansca6bd4f2010-03-02 14:12:58 -0800700AC_ARG_WITH([static_libunwind],
701 [AS_HELP_STRING([--with-static-libunwind=<libunwind.a>],
702 [Path to static libunwind library; use rather than dynamically linking])],
703if test "x$with_static_libunwind" = "xno" ; then
704 LUNWIND="-lunwind"
705else
706 if test ! -f "$with_static_libunwind" ; then
707 AC_MSG_ERROR([Static libunwind not found: $with_static_libunwind])
708 fi
709 LUNWIND="$with_static_libunwind"
710fi,
711 LUNWIND="-lunwind"
712)
Jason Evans77f350b2011-03-15 22:23:12 -0700713if test "x$backtrace_method" = "x" -a "x$enable_prof_libunwind" = "x1" ; then
714 AC_CHECK_HEADERS([libunwind.h], , [enable_prof_libunwind="0"])
715 if test "x$LUNWIND" = "x-lunwind" ; then
Jason Evans05125b82014-04-22 20:48:07 -0700716 AC_CHECK_LIB([unwind], [unw_backtrace], [LIBS="$LIBS $LUNWIND"],
Jason Evans77f350b2011-03-15 22:23:12 -0700717 [enable_prof_libunwind="0"])
718 else
719 LIBS="$LIBS $LUNWIND"
720 fi
721 if test "x${enable_prof_libunwind}" = "x1" ; then
722 backtrace_method="libunwind"
723 AC_DEFINE([JEMALLOC_PROF_LIBUNWIND], [ ])
724 fi
725fi
726
727AC_ARG_ENABLE([prof-libgcc],
728 [AS_HELP_STRING([--disable-prof-libgcc],
729 [Do not use libgcc for backtracing])],
730[if test "x$enable_prof_libgcc" = "xno" ; then
731 enable_prof_libgcc="0"
732else
733 enable_prof_libgcc="1"
734fi
735],
736[enable_prof_libgcc="1"]
737)
738if test "x$backtrace_method" = "x" -a "x$enable_prof_libgcc" = "x1" \
739 -a "x$GCC" = "xyes" ; then
740 AC_CHECK_HEADERS([unwind.h], , [enable_prof_libgcc="0"])
741 AC_CHECK_LIB([gcc], [_Unwind_Backtrace], [LIBS="$LIBS -lgcc"], [enable_prof_libgcc="0"])
Jason Evans77f350b2011-03-15 22:23:12 -0700742 if test "x${enable_prof_libgcc}" = "x1" ; then
743 backtrace_method="libgcc"
744 AC_DEFINE([JEMALLOC_PROF_LIBGCC], [ ])
745 fi
746else
747 enable_prof_libgcc="0"
748fi
749
750AC_ARG_ENABLE([prof-gcc],
751 [AS_HELP_STRING([--disable-prof-gcc],
752 [Do not use gcc intrinsics for backtracing])],
753[if test "x$enable_prof_gcc" = "xno" ; then
754 enable_prof_gcc="0"
755else
756 enable_prof_gcc="1"
757fi
758],
759[enable_prof_gcc="1"]
760)
761if test "x$backtrace_method" = "x" -a "x$enable_prof_gcc" = "x1" \
762 -a "x$GCC" = "xyes" ; then
Jason Evanse181f5a2014-03-30 18:58:32 -0700763 JE_CFLAGS_APPEND([-fno-omit-frame-pointer])
Jason Evans77f350b2011-03-15 22:23:12 -0700764 backtrace_method="gcc intrinsics"
765 AC_DEFINE([JEMALLOC_PROF_GCC], [ ])
766else
767 enable_prof_gcc="0"
768fi
769
770if test "x$backtrace_method" = "x" ; then
771 backtrace_method="none (disabling profiling)"
772 enable_prof="0"
773fi
774AC_MSG_CHECKING([configured backtracing method])
775AC_MSG_RESULT([$backtrace_method])
Jason Evans2dbecf12010-09-05 10:35:13 -0700776if test "x$enable_prof" = "x1" ; then
Jason Evansd37d5ad2013-12-05 23:01:50 -0800777 if test "x$abi" != "xpecoff"; then
778 dnl Heap profiling uses the log(3) function.
779 LIBS="$LIBS -lm"
780 fi
781
Jason Evans2dbecf12010-09-05 10:35:13 -0700782 AC_DEFINE([JEMALLOC_PROF], [ ])
Jason Evans2dbecf12010-09-05 10:35:13 -0700783fi
784AC_SUBST([enable_prof])
Jason Evans2dbecf12010-09-05 10:35:13 -0700785
Jason Evans84cbbcb2009-12-29 00:09:15 -0800786dnl Enable thread-specific caching by default.
787AC_ARG_ENABLE([tcache],
788 [AS_HELP_STRING([--disable-tcache], [Disable per thread caches])],
789[if test "x$enable_tcache" = "xno" ; then
790 enable_tcache="0"
Jason Evansb7924f52009-06-23 19:01:18 -0700791else
Jason Evans84cbbcb2009-12-29 00:09:15 -0800792 enable_tcache="1"
Jason Evansb7924f52009-06-23 19:01:18 -0700793fi
794],
Jason Evans84cbbcb2009-12-29 00:09:15 -0800795[enable_tcache="1"]
Jason Evansb7924f52009-06-23 19:01:18 -0700796)
Jason Evans2dbecf12010-09-05 10:35:13 -0700797if test "x$enable_tcache" = "x1" ; then
798 AC_DEFINE([JEMALLOC_TCACHE], [ ])
799fi
800AC_SUBST([enable_tcache])
Jason Evansb7924f52009-06-23 19:01:18 -0700801
Jason Evans59ae2762012-04-16 17:52:27 -0700802dnl Enable VM deallocation via munmap() by default.
803AC_ARG_ENABLE([munmap],
804 [AS_HELP_STRING([--disable-munmap], [Disable VM deallocation via munmap(2)])],
805[if test "x$enable_munmap" = "xno" ; then
806 enable_munmap="0"
807else
808 enable_munmap="1"
809fi
810],
811[enable_munmap="${default_munmap}"]
812)
813if test "x$enable_munmap" = "x1" ; then
814 AC_DEFINE([JEMALLOC_MUNMAP], [ ])
815fi
816AC_SUBST([enable_munmap])
817
Jason Evans4d434ad2014-04-15 12:09:48 -0700818dnl Enable allocation from DSS if supported by the OS.
819have_dss="1"
Mike Hommey83c324a2012-04-12 10:13:03 +0200820dnl Check whether the BSD/SUSv1 sbrk() exists. If not, disable DSS support.
821AC_CHECK_FUNC([sbrk], [have_sbrk="1"], [have_sbrk="0"])
822if test "x$have_sbrk" = "x1" ; then
Steven Stewart-Gallus79230fe2014-06-19 16:11:43 -0700823 if test "x$sbrk_deprecated" = "x1" ; then
Jason Evans66688532013-12-03 21:49:36 -0800824 AC_MSG_RESULT([Disabling dss allocation because sbrk is deprecated])
Jason Evans4d434ad2014-04-15 12:09:48 -0700825 have_dss="0"
Jason Evans66688532013-12-03 21:49:36 -0800826 fi
Mike Hommey83c324a2012-04-12 10:13:03 +0200827else
Jason Evans4d434ad2014-04-15 12:09:48 -0700828 have_dss="0"
Mike Hommey83c324a2012-04-12 10:13:03 +0200829fi
830
Jason Evans4d434ad2014-04-15 12:09:48 -0700831if test "x$have_dss" = "x1" ; then
Jason Evansb7924f52009-06-23 19:01:18 -0700832 AC_DEFINE([JEMALLOC_DSS], [ ])
833fi
Jason Evansb7924f52009-06-23 19:01:18 -0700834
Jason Evans777c1912012-02-28 20:49:22 -0800835dnl Support the junk/zero filling option by default.
Jason Evansb7924f52009-06-23 19:01:18 -0700836AC_ARG_ENABLE([fill],
Jason Evans122449b2012-04-06 00:35:09 -0700837 [AS_HELP_STRING([--disable-fill],
838 [Disable support for junk/zero filling, quarantine, and redzones])],
Jason Evansb7924f52009-06-23 19:01:18 -0700839[if test "x$enable_fill" = "xno" ; then
840 enable_fill="0"
841else
842 enable_fill="1"
843fi
844],
Jason Evans777c1912012-02-28 20:49:22 -0800845[enable_fill="1"]
Jason Evansb7924f52009-06-23 19:01:18 -0700846)
847if test "x$enable_fill" = "x1" ; then
848 AC_DEFINE([JEMALLOC_FILL], [ ])
849fi
850AC_SUBST([enable_fill])
851
Jason Evansb1476112012-04-05 13:36:17 -0700852dnl Disable utrace(2)-based tracing by default.
853AC_ARG_ENABLE([utrace],
854 [AS_HELP_STRING([--enable-utrace], [Enable utrace(2)-based tracing])],
855[if test "x$enable_utrace" = "xno" ; then
856 enable_utrace="0"
857else
858 enable_utrace="1"
859fi
860],
861[enable_utrace="0"]
862)
863JE_COMPILABLE([utrace(2)], [
864#include <sys/types.h>
865#include <sys/param.h>
866#include <sys/time.h>
867#include <sys/uio.h>
868#include <sys/ktrace.h>
869], [
870 utrace((void *)0, 0);
871], [je_cv_utrace])
872if test "x${je_cv_utrace}" = "xno" ; then
873 enable_utrace="0"
874fi
875if test "x$enable_utrace" = "x1" ; then
876 AC_DEFINE([JEMALLOC_UTRACE], [ ])
877fi
878AC_SUBST([enable_utrace])
879
Jason Evans122449b2012-04-06 00:35:09 -0700880dnl Support Valgrind by default.
881AC_ARG_ENABLE([valgrind],
882 [AS_HELP_STRING([--disable-valgrind], [Disable support for Valgrind])],
883[if test "x$enable_valgrind" = "xno" ; then
884 enable_valgrind="0"
885else
886 enable_valgrind="1"
887fi
888],
889[enable_valgrind="1"]
890)
891if test "x$enable_valgrind" = "x1" ; then
892 JE_COMPILABLE([valgrind], [
893#include <valgrind/valgrind.h>
894#include <valgrind/memcheck.h>
895
Mike Hommey7bfecf42012-04-30 15:15:15 +0200896#if !defined(VALGRIND_RESIZEINPLACE_BLOCK)
Jason Evans122449b2012-04-06 00:35:09 -0700897# error "Incompatible Valgrind version"
898#endif
899], [], [je_cv_valgrind])
900 if test "x${je_cv_valgrind}" = "xno" ; then
901 enable_valgrind="0"
902 fi
903 if test "x$enable_valgrind" = "x1" ; then
904 AC_DEFINE([JEMALLOC_VALGRIND], [ ])
905 fi
906fi
907AC_SUBST([enable_valgrind])
908
Jason Evansb7924f52009-06-23 19:01:18 -0700909dnl Do not support the xmalloc option by default.
910AC_ARG_ENABLE([xmalloc],
911 [AS_HELP_STRING([--enable-xmalloc], [Support xmalloc option])],
912[if test "x$enable_xmalloc" = "xno" ; then
913 enable_xmalloc="0"
914else
915 enable_xmalloc="1"
916fi
917],
918[enable_xmalloc="0"]
919)
920if test "x$enable_xmalloc" = "x1" ; then
921 AC_DEFINE([JEMALLOC_XMALLOC], [ ])
922fi
923AC_SUBST([enable_xmalloc])
924
Mike Hommey8f50ec82014-06-04 12:12:55 +0900925dnl ============================================================================
926dnl Check for __builtin_ffsl(), then ffsl(3), and fail if neither are found.
927dnl One of those two functions should (theoretically) exist on all platforms
928dnl that jemalloc currently has a chance of functioning on without modification.
929dnl We additionally assume ffs() or __builtin_ffs() are defined if
930dnl ffsl() or __builtin_ffsl() are defined, respectively.
931JE_COMPILABLE([a program using __builtin_ffsl], [
932#include <stdio.h>
933#include <strings.h>
934#include <string.h>
935], [
936 {
937 int rv = __builtin_ffsl(0x08);
938 printf("%d\n", rv);
939 }
940], [je_cv_gcc_builtin_ffsl])
Steven Stewart-Gallus79230fe2014-06-19 16:11:43 -0700941if test "x${je_cv_gcc_builtin_ffsl}" = "xyes" ; then
Mike Hommey8f50ec82014-06-04 12:12:55 +0900942 AC_DEFINE([JEMALLOC_INTERNAL_FFSL], [__builtin_ffsl])
943 AC_DEFINE([JEMALLOC_INTERNAL_FFS], [__builtin_ffs])
944else
945 JE_COMPILABLE([a program using ffsl], [
946 #include <stdio.h>
947 #include <strings.h>
948 #include <string.h>
949 ], [
950 {
951 int rv = ffsl(0x08);
952 printf("%d\n", rv);
953 }
954 ], [je_cv_function_ffsl])
Steven Stewart-Gallus79230fe2014-06-19 16:11:43 -0700955 if test "x${je_cv_function_ffsl}" = "xyes" ; then
Mike Hommey8f50ec82014-06-04 12:12:55 +0900956 AC_DEFINE([JEMALLOC_INTERNAL_FFSL], [ffsl])
957 AC_DEFINE([JEMALLOC_INTERNAL_FFS], [ffs])
958 else
959 AC_MSG_ERROR([Cannot build without ffsl(3) or __builtin_ffsl()])
960 fi
961fi
962
Jason Evans81e54752014-10-10 22:34:25 -0700963AC_ARG_WITH([lg_tiny_min],
964 [AS_HELP_STRING([--with-lg-tiny-min=<lg-tiny-min>],
965 [Base 2 log of minimum tiny size class to support])],
966 [LG_TINY_MIN="$with_lg_tiny_min"],
967 [LG_TINY_MIN="3"])
968AC_DEFINE_UNQUOTED([LG_TINY_MIN], [$LG_TINY_MIN])
969
Jason Evansfc0b3b72014-10-09 17:54:06 -0700970AC_ARG_WITH([lg_quantum],
971 [AS_HELP_STRING([--with-lg-quantum=<lg-quantum>],
972 [Base 2 log of minimum allocation alignment])],
Jason Evans81e54752014-10-10 22:34:25 -0700973 [LG_QUANTA="$with_lg_quantum"],
974 [LG_QUANTA="3 4"])
975if test "x$with_lg_quantum" != "x" ; then
976 AC_DEFINE_UNQUOTED([LG_QUANTUM], [$with_lg_quantum])
977fi
Jason Evansfc0b3b72014-10-09 17:54:06 -0700978
979AC_ARG_WITH([lg_page],
980 [AS_HELP_STRING([--with-lg-page=<lg-page>], [Base 2 log of system page size])],
981 [LG_PAGE="$with_lg_page"], [LG_PAGE="detect"])
Jason Evansb0808d52015-02-03 12:39:31 -0800982if test "x$LG_PAGE" = "xdetect"; then
Jason Evansfc0b3b72014-10-09 17:54:06 -0700983 AC_CACHE_CHECK([LG_PAGE],
984 [je_cv_lg_page],
Jason Evans6684cac2012-03-05 12:15:36 -0800985 AC_RUN_IFELSE([AC_LANG_PROGRAM(
Mike Hommeya19e87f2012-04-21 21:27:46 -0700986[[
Mike Hommeyfd97b1d2012-04-30 12:38:31 +0200987#include <strings.h>
Mike Hommeya19e87f2012-04-21 21:27:46 -0700988#ifdef _WIN32
989#include <windows.h>
990#else
Jason Evansb7924f52009-06-23 19:01:18 -0700991#include <unistd.h>
Mike Hommeya19e87f2012-04-21 21:27:46 -0700992#endif
993#include <stdio.h>
Jason Evans6684cac2012-03-05 12:15:36 -0800994]],
995[[
Garrett Cooper72c1e592012-12-02 17:57:28 -0800996 int result;
Jason Evansb7924f52009-06-23 19:01:18 -0700997 FILE *f;
998
Mike Hommeya19e87f2012-04-21 21:27:46 -0700999#ifdef _WIN32
1000 SYSTEM_INFO si;
1001 GetSystemInfo(&si);
1002 result = si.dwPageSize;
1003#else
Jason Evansb7924f52009-06-23 19:01:18 -07001004 result = sysconf(_SC_PAGESIZE);
Mike Hommeya19e87f2012-04-21 21:27:46 -07001005#endif
Jason Evansb7924f52009-06-23 19:01:18 -07001006 if (result == -1) {
1007 return 1;
1008 }
Mike Hommey8f50ec82014-06-04 12:12:55 +09001009 result = JEMALLOC_INTERNAL_FFSL(result) - 1;
Mike Hommeya19e87f2012-04-21 21:27:46 -07001010
Jason Evansb7924f52009-06-23 19:01:18 -07001011 f = fopen("conftest.out", "w");
1012 if (f == NULL) {
1013 return 1;
1014 }
Garrett Cooper72c1e592012-12-02 17:57:28 -08001015 fprintf(f, "%d\n", result);
Jason Evans3cc1f1a2012-04-03 22:30:05 -07001016 fclose(f);
Jason Evansb7924f52009-06-23 19:01:18 -07001017
1018 return 0;
1019]])],
Jason Evansfc0b3b72014-10-09 17:54:06 -07001020 [je_cv_lg_page=`cat conftest.out`],
1021 [je_cv_lg_page=undefined],
1022 [je_cv_lg_page=12]))
Jason Evans6684cac2012-03-05 12:15:36 -08001023fi
Jason Evansfc0b3b72014-10-09 17:54:06 -07001024if test "x${je_cv_lg_page}" != "x" ; then
1025 LG_PAGE="${je_cv_lg_page}"
1026fi
1027if test "x${LG_PAGE}" != "xundefined" ; then
1028 AC_DEFINE_UNQUOTED([LG_PAGE], [$LG_PAGE])
1029else
1030 AC_MSG_ERROR([cannot determine value for LG_PAGE])
1031fi
1032
1033AC_ARG_WITH([lg_page_sizes],
1034 [AS_HELP_STRING([--with-lg-page-sizes=<lg-page-sizes>],
1035 [Base 2 logs of system page sizes to support])],
1036 [LG_PAGE_SIZES="$with_lg_page_sizes"], [LG_PAGE_SIZES="$LG_PAGE"])
1037
1038AC_ARG_WITH([lg_size_class_group],
1039 [AS_HELP_STRING([--with-lg-size-class-group=<lg-size-class-group>],
1040 [Base 2 log of size classes per doubling])],
1041 [LG_SIZE_CLASS_GROUP="$with_lg_size_class_group"],
1042 [LG_SIZE_CLASS_GROUP="2"])
Jason Evansb7924f52009-06-23 19:01:18 -07001043
1044dnl ============================================================================
1045dnl jemalloc configuration.
1046dnl
Jason Evansa40bc7a2010-03-02 13:01:16 -08001047
Jason Evansa5a658a2014-09-02 15:07:07 -07001048dnl Set VERSION if source directory is inside a git repository.
Dan McGregorf8880312014-12-23 16:10:08 -06001049if test "x`test ! \"${srcroot}\" && cd \"${srcroot}\"; git rev-parse --is-inside-work-tree 2>/dev/null`" = "xtrue" ; then
Jason Evansa5a658a2014-09-02 15:07:07 -07001050 dnl Pattern globs aren't powerful enough to match both single- and
1051 dnl double-digit version numbers, so iterate over patterns to support up to
1052 dnl version 99.99.99 without any accidental matches.
Dan McGregorf8880312014-12-23 16:10:08 -06001053 rm -f "${objroot}VERSION"
Jason Evansa5a658a2014-09-02 15:07:07 -07001054 for pattern in ['[0-9].[0-9].[0-9]' '[0-9].[0-9].[0-9][0-9]' \
1055 '[0-9].[0-9][0-9].[0-9]' '[0-9].[0-9][0-9].[0-9][0-9]' \
1056 '[0-9][0-9].[0-9].[0-9]' '[0-9][0-9].[0-9].[0-9][0-9]' \
1057 '[0-9][0-9].[0-9][0-9].[0-9]' \
1058 '[0-9][0-9].[0-9][0-9].[0-9][0-9]']; do
Dan McGregorf8880312014-12-23 16:10:08 -06001059 if test ! -e "${objroot}VERSION" ; then
1060 (test ! "${srcroot}" && cd "${srcroot}"; git describe --long --abbrev=40 --match="${pattern}") > "${objroot}VERSION.tmp" 2>/dev/null
Jason Evansa5a658a2014-09-02 15:07:07 -07001061 if test $? -eq 0 ; then
Dan McGregorf8880312014-12-23 16:10:08 -06001062 mv "${objroot}VERSION.tmp" "${objroot}VERSION"
Jason Evansa5a658a2014-09-02 15:07:07 -07001063 break
1064 fi
1065 fi
1066 done
Jason Evansa40bc7a2010-03-02 13:01:16 -08001067fi
Dan McGregorf8880312014-12-23 16:10:08 -06001068rm -f "${objroot}VERSION.tmp"
1069if test ! -e "${objroot}VERSION" ; then
1070 if test ! -e "${srcroot}VERSION" ; then
1071 AC_MSG_RESULT(
1072 [Missing VERSION file, and unable to generate it; creating bogus VERSION])
1073 echo "0.0.0-0-g0000000000000000000000000000000000000000" > "${objroot}VERSION"
1074 else
1075 cp ${srcroot}VERSION ${objroot}VERSION
1076 fi
Jason Evansa5a658a2014-09-02 15:07:07 -07001077fi
Dan McGregorf8880312014-12-23 16:10:08 -06001078jemalloc_version=`cat "${objroot}VERSION"`
Jason Evansa40bc7a2010-03-02 13:01:16 -08001079jemalloc_version_major=`echo ${jemalloc_version} | tr ".g-" " " | awk '{print [$]1}'`
1080jemalloc_version_minor=`echo ${jemalloc_version} | tr ".g-" " " | awk '{print [$]2}'`
1081jemalloc_version_bugfix=`echo ${jemalloc_version} | tr ".g-" " " | awk '{print [$]3}'`
1082jemalloc_version_nrev=`echo ${jemalloc_version} | tr ".g-" " " | awk '{print [$]4}'`
1083jemalloc_version_gid=`echo ${jemalloc_version} | tr ".g-" " " | awk '{print [$]5}'`
Jason Evansb7924f52009-06-23 19:01:18 -07001084AC_SUBST([jemalloc_version])
Jason Evansa40bc7a2010-03-02 13:01:16 -08001085AC_SUBST([jemalloc_version_major])
1086AC_SUBST([jemalloc_version_minor])
1087AC_SUBST([jemalloc_version_bugfix])
1088AC_SUBST([jemalloc_version_nrev])
1089AC_SUBST([jemalloc_version_gid])
Jason Evansb7924f52009-06-23 19:01:18 -07001090
1091dnl ============================================================================
1092dnl Configure pthreads.
1093
Mike Hommeya19e87f2012-04-21 21:27:46 -07001094if test "x$abi" != "xpecoff" ; then
1095 AC_CHECK_HEADERS([pthread.h], , [AC_MSG_ERROR([pthread.h is missing])])
1096 dnl Some systems may embed pthreads functionality in libc; check for libpthread
1097 dnl first, but try libc too before failing.
1098 AC_CHECK_LIB([pthread], [pthread_create], [LIBS="$LIBS -lpthread"],
1099 [AC_SEARCH_LIBS([pthread_create], , ,
1100 AC_MSG_ERROR([libpthread is missing]))])
1101fi
Jason Evansb7924f52009-06-23 19:01:18 -07001102
1103CPPFLAGS="$CPPFLAGS -D_REENTRANT"
1104
Daniel Micayb74041f2014-12-09 17:41:34 -05001105dnl Check if the GNU-specific secure_getenv function exists.
1106AC_CHECK_FUNC([secure_getenv],
1107 [have_secure_getenv="1"],
1108 [have_secure_getenv="0"]
1109 )
1110if test "x$have_secure_getenv" = "x1" ; then
1111 AC_DEFINE([JEMALLOC_HAVE_SECURE_GETENV], [ ])
1112fi
1113
1114dnl Check if the Solaris/BSD issetugid function exists.
1115AC_CHECK_FUNC([issetugid],
1116 [have_issetugid="1"],
1117 [have_issetugid="0"]
1118 )
1119if test "x$have_issetugid" = "x1" ; then
1120 AC_DEFINE([JEMALLOC_HAVE_ISSETUGID], [ ])
1121fi
1122
Jason Evanscd9a1342012-03-21 18:33:03 -07001123dnl Check whether the BSD-specific _malloc_thread_cleanup() exists. If so, use
1124dnl it rather than pthreads TSD cleanup functions to support cleanup during
1125dnl thread exit, in order to avoid pthreads library recursion during
1126dnl bootstrapping.
Jason Evanscd9a1342012-03-21 18:33:03 -07001127AC_CHECK_FUNC([_malloc_thread_cleanup],
1128 [have__malloc_thread_cleanup="1"],
1129 [have__malloc_thread_cleanup="0"]
1130 )
1131if test "x$have__malloc_thread_cleanup" = "x1" ; then
1132 AC_DEFINE([JEMALLOC_MALLOC_THREAD_CLEANUP], [ ])
1133 force_tls="1"
1134fi
1135
Jason Evans41b6afb2012-02-02 22:04:57 -08001136dnl Check whether the BSD-specific _pthread_mutex_init_calloc_cb() exists. If
1137dnl so, mutex initialization causes allocation, and we need to implement this
1138dnl callback function in order to prevent recursive allocation.
1139AC_CHECK_FUNC([_pthread_mutex_init_calloc_cb],
1140 [have__pthread_mutex_init_calloc_cb="1"],
1141 [have__pthread_mutex_init_calloc_cb="0"]
1142 )
1143if test "x$have__pthread_mutex_init_calloc_cb" = "x1" ; then
1144 AC_DEFINE([JEMALLOC_MUTEX_INIT_CB])
1145fi
1146
Jason Evans0fee70d2012-02-13 12:36:11 -08001147dnl Disable lazy locking by default.
Jason Evansb7924f52009-06-23 19:01:18 -07001148AC_ARG_ENABLE([lazy_lock],
Jason Evans0fee70d2012-02-13 12:36:11 -08001149 [AS_HELP_STRING([--enable-lazy-lock],
1150 [Enable lazy locking (only lock when multi-threaded)])],
Jason Evansb7924f52009-06-23 19:01:18 -07001151[if test "x$enable_lazy_lock" = "xno" ; then
1152 enable_lazy_lock="0"
1153else
1154 enable_lazy_lock="1"
1155fi
1156],
Jason Evans0fee70d2012-02-13 12:36:11 -08001157[enable_lazy_lock="0"]
Jason Evansb7924f52009-06-23 19:01:18 -07001158)
Jason Evansfd4fcef2012-03-23 17:40:58 -07001159if test "x$enable_lazy_lock" = "x0" -a "x${force_lazy_lock}" = "x1" ; then
1160 AC_MSG_RESULT([Forcing lazy-lock to avoid allocator/threading bootstrap issues])
1161 enable_lazy_lock="1"
1162fi
Jason Evansb7924f52009-06-23 19:01:18 -07001163if test "x$enable_lazy_lock" = "x1" ; then
Mike Hommeya19e87f2012-04-21 21:27:46 -07001164 if test "x$abi" != "xpecoff" ; then
1165 AC_CHECK_HEADERS([dlfcn.h], , [AC_MSG_ERROR([dlfcn.h is missing])])
1166 AC_CHECK_FUNC([dlsym], [],
1167 [AC_CHECK_LIB([dl], [dlsym], [LIBS="$LIBS -ldl"],
1168 [AC_MSG_ERROR([libdl is missing])])
1169 ])
1170 fi
Jason Evansb7924f52009-06-23 19:01:18 -07001171 AC_DEFINE([JEMALLOC_LAZY_LOCK], [ ])
1172fi
1173AC_SUBST([enable_lazy_lock])
1174
Jason Evans78d815c2010-01-17 14:06:20 -08001175AC_ARG_ENABLE([tls],
1176 [AS_HELP_STRING([--disable-tls], [Disable thread-local storage (__thread keyword)])],
1177if test "x$enable_tls" = "xno" ; then
1178 enable_tls="0"
1179else
1180 enable_tls="1"
1181fi
1182,
1183enable_tls="1"
1184)
Jason Evanscd9a1342012-03-21 18:33:03 -07001185if test "x${enable_tls}" = "x0" -a "x${force_tls}" = "x1" ; then
1186 AC_MSG_RESULT([Forcing TLS to avoid allocator/threading bootstrap issues])
1187 enable_tls="1"
1188fi
Jason Evansb80581d2012-03-23 16:17:43 -07001189if test "x${enable_tls}" = "x1" -a "x${force_tls}" = "x0" ; then
1190 AC_MSG_RESULT([Forcing no TLS to avoid allocator/threading bootstrap issues])
1191 enable_tls="0"
1192fi
Jason Evans78d815c2010-01-17 14:06:20 -08001193if test "x${enable_tls}" = "x1" ; then
1194AC_MSG_CHECKING([for TLS])
Jason Evans6684cac2012-03-05 12:15:36 -08001195AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
Jason Evans78d815c2010-01-17 14:06:20 -08001196[[
1197 __thread int x;
1198]], [[
1199 x = 42;
1200
1201 return 0;
1202]])],
1203 AC_MSG_RESULT([yes]),
1204 AC_MSG_RESULT([no])
1205 enable_tls="0")
1206fi
Jason Evansb267d0f2010-08-13 15:42:29 -07001207AC_SUBST([enable_tls])
Jason Evanse24c7af2012-03-19 10:21:17 -07001208if test "x${enable_tls}" = "x1" ; then
1209 AC_DEFINE_UNQUOTED([JEMALLOC_TLS], [ ])
Jason Evanscd9a1342012-03-21 18:33:03 -07001210elif test "x${force_tls}" = "x1" ; then
1211 AC_MSG_ERROR([Failed to configure TLS, which is mandatory for correct function])
Jason Evans78d815c2010-01-17 14:06:20 -08001212fi
1213
Jason Evans2dbecf12010-09-05 10:35:13 -07001214dnl ============================================================================
Chih-hung Hsieh59cd80e2014-12-05 17:42:41 -08001215dnl Check for C11 atomics.
1216
1217JE_COMPILABLE([C11 atomics], [
1218#include <stdint.h>
1219#if (__STDC_VERSION__ >= 201112L) && !defined(__STDC_NO_ATOMICS__)
1220#include <stdatomic.h>
1221#else
1222#error Atomics not available
1223#endif
1224], [
1225 uint64_t *p = (uint64_t *)0;
1226 uint64_t x = 1;
1227 volatile atomic_uint_least64_t *a = (volatile atomic_uint_least64_t *)p;
1228 uint64_t r = atomic_fetch_add(a, x) + x;
1229 return (r == 0);
1230], [je_cv_c11atomics])
1231if test "x${je_cv_c11atomics}" = "xyes" ; then
1232 AC_DEFINE([JEMALLOC_C11ATOMICS])
1233fi
1234
1235dnl ============================================================================
Jason Evansb57d3ec2012-04-17 13:17:54 -07001236dnl Check for atomic(9) operations as provided on FreeBSD.
1237
1238JE_COMPILABLE([atomic(9)], [
1239#include <sys/types.h>
1240#include <machine/atomic.h>
1241#include <inttypes.h>
1242], [
1243 {
1244 uint32_t x32 = 0;
1245 volatile uint32_t *x32p = &x32;
1246 atomic_fetchadd_32(x32p, 1);
1247 }
1248 {
1249 unsigned long xlong = 0;
1250 volatile unsigned long *xlongp = &xlong;
1251 atomic_fetchadd_long(xlongp, 1);
1252 }
1253], [je_cv_atomic9])
1254if test "x${je_cv_atomic9}" = "xyes" ; then
1255 AC_DEFINE([JEMALLOC_ATOMIC9])
1256fi
1257
1258dnl ============================================================================
Jason Evans763baa62011-03-18 19:10:31 -07001259dnl Check for atomic(3) operations as provided on Darwin.
1260
1261JE_COMPILABLE([Darwin OSAtomic*()], [
1262#include <libkern/OSAtomic.h>
1263#include <inttypes.h>
1264], [
1265 {
1266 int32_t x32 = 0;
1267 volatile int32_t *x32p = &x32;
1268 OSAtomicAdd32(1, x32p);
1269 }
1270 {
1271 int64_t x64 = 0;
1272 volatile int64_t *x64p = &x64;
1273 OSAtomicAdd64(1, x64p);
1274 }
Jason Evans6684cac2012-03-05 12:15:36 -08001275], [je_cv_osatomic])
1276if test "x${je_cv_osatomic}" = "xyes" ; then
Jason Evanse24c7af2012-03-19 10:21:17 -07001277 AC_DEFINE([JEMALLOC_OSATOMIC], [ ])
Jason Evans763baa62011-03-18 19:10:31 -07001278fi
1279
1280dnl ============================================================================
Richard Diamond994fad92014-06-03 02:39:18 -05001281dnl Check for madvise(2).
1282
1283JE_COMPILABLE([madvise(2)], [
1284#include <sys/mman.h>
1285], [
1286 {
1287 madvise((void *)0, 0, 0);
1288 }
1289], [je_cv_madvise])
1290if test "x${je_cv_madvise}" = "xyes" ; then
1291 AC_DEFINE([JEMALLOC_HAVE_MADVISE], [ ])
1292fi
1293
1294dnl ============================================================================
Mike Hommeyc1e567b2012-03-26 17:03:41 +02001295dnl Check whether __sync_{add,sub}_and_fetch() are available despite
1296dnl __GCC_HAVE_SYNC_COMPARE_AND_SWAP_n macros being undefined.
1297
1298AC_DEFUN([JE_SYNC_COMPARE_AND_SWAP_CHECK],[
1299 AC_CACHE_CHECK([whether to force $1-bit __sync_{add,sub}_and_fetch()],
1300 [je_cv_sync_compare_and_swap_$2],
Mike Hommey2cfe6d62012-03-27 15:03:07 +02001301 [AC_LINK_IFELSE([AC_LANG_PROGRAM([
1302 #include <stdint.h>
1303 ],
1304 [
1305 #ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_$2
1306 {
1307 uint$1_t x$1 = 0;
1308 __sync_add_and_fetch(&x$1, 42);
1309 __sync_sub_and_fetch(&x$1, 1);
1310 }
1311 #else
1312 #error __GCC_HAVE_SYNC_COMPARE_AND_SWAP_$2 is defined, no need to force
1313 #endif
1314 ])],
Mike Hommeyc1e567b2012-03-26 17:03:41 +02001315 [je_cv_sync_compare_and_swap_$2=yes],
1316 [je_cv_sync_compare_and_swap_$2=no])])
1317
1318 if test "x${je_cv_sync_compare_and_swap_$2}" = "xyes" ; then
1319 AC_DEFINE([JE_FORCE_SYNC_COMPARE_AND_SWAP_$2], [ ])
1320 fi
1321])
1322
Jason Evansb57d3ec2012-04-17 13:17:54 -07001323if test "x${je_cv_atomic9}" != "xyes" -a "x${je_cv_osatomic}" != "xyes" ; then
Mike Hommeyc1e567b2012-03-26 17:03:41 +02001324 JE_SYNC_COMPARE_AND_SWAP_CHECK(32, 4)
1325 JE_SYNC_COMPARE_AND_SWAP_CHECK(64, 8)
1326fi
1327
1328dnl ============================================================================
Jason Evansd04047c2014-05-28 16:11:55 -07001329dnl Check for __builtin_clz() and __builtin_clzl().
1330
1331AC_CACHE_CHECK([for __builtin_clz],
1332 [je_cv_builtin_clz],
1333 [AC_LINK_IFELSE([AC_LANG_PROGRAM([],
1334 [
1335 {
1336 unsigned x = 0;
1337 int y = __builtin_clz(x);
1338 }
1339 {
1340 unsigned long x = 0;
1341 int y = __builtin_clzl(x);
1342 }
1343 ])],
1344 [je_cv_builtin_clz=yes],
1345 [je_cv_builtin_clz=no])])
1346
1347if test "x${je_cv_builtin_clz}" = "xyes" ; then
1348 AC_DEFINE([JEMALLOC_HAVE_BUILTIN_CLZ], [ ])
1349fi
1350
1351dnl ============================================================================
Jason Evans893a0ed2011-03-18 19:30:18 -07001352dnl Check for spinlock(3) operations as provided on Darwin.
1353
1354JE_COMPILABLE([Darwin OSSpin*()], [
1355#include <libkern/OSAtomic.h>
1356#include <inttypes.h>
1357], [
1358 OSSpinLock lock = 0;
1359 OSSpinLockLock(&lock);
1360 OSSpinLockUnlock(&lock);
Jason Evans6684cac2012-03-05 12:15:36 -08001361], [je_cv_osspin])
1362if test "x${je_cv_osspin}" = "xyes" ; then
Jason Evanse24c7af2012-03-19 10:21:17 -07001363 AC_DEFINE([JEMALLOC_OSSPIN], [ ])
Jason Evans893a0ed2011-03-18 19:30:18 -07001364fi
1365
1366dnl ============================================================================
Jason Evans2dbecf12010-09-05 10:35:13 -07001367dnl Darwin-related configuration.
Jason Evans78d815c2010-01-17 14:06:20 -08001368
Mike Hommeyd0357f72012-11-26 18:52:41 +01001369AC_ARG_ENABLE([zone-allocator],
1370 [AS_HELP_STRING([--disable-zone-allocator],
1371 [Disable zone allocator for Darwin])],
1372[if test "x$enable_zone_allocator" = "xno" ; then
1373 enable_zone_allocator="0"
1374else
1375 enable_zone_allocator="1"
1376fi
1377],
1378[if test "x${abi}" = "xmacho"; then
1379 enable_zone_allocator="1"
1380fi
1381]
1382)
1383AC_SUBST([enable_zone_allocator])
1384
1385if test "x${enable_zone_allocator}" = "x1" ; then
1386 if test "x${abi}" != "xmacho"; then
1387 AC_MSG_ERROR([--enable-zone-allocator is only supported on Darwin])
1388 fi
Jason Evanse24c7af2012-03-19 10:21:17 -07001389 AC_DEFINE([JEMALLOC_ZONE], [ ])
Jason Evans6109fe02010-02-10 10:37:56 -08001390
Jason Evans2dbecf12010-09-05 10:35:13 -07001391 dnl The szone version jumped from 3 to 6 between the OS X 10.5.x and 10.6
1392 dnl releases. malloc_zone_t and malloc_introspection_t have new fields in
1393 dnl 10.6, which is the only source-level indication of the change.
1394 AC_MSG_CHECKING([malloc zone version])
Mike Hommey154829d2012-03-20 18:01:38 +01001395 AC_DEFUN([JE_ZONE_PROGRAM],
1396 [AC_LANG_PROGRAM(
1397 [#include <malloc/malloc.h>],
Guilherme Goncalves79725aa2014-10-20 14:08:37 -02001398 [static int foo[[sizeof($1) $2 sizeof(void *) * $3 ? 1 : -1]]]
Mike Hommey154829d2012-03-20 18:01:38 +01001399 )])
Jason Evans2dbecf12010-09-05 10:35:13 -07001400
Mike Hommey154829d2012-03-20 18:01:38 +01001401 AC_COMPILE_IFELSE([JE_ZONE_PROGRAM(malloc_zone_t,==,14)],[JEMALLOC_ZONE_VERSION=3],[
1402 AC_COMPILE_IFELSE([JE_ZONE_PROGRAM(malloc_zone_t,==,15)],[JEMALLOC_ZONE_VERSION=5],[
1403 AC_COMPILE_IFELSE([JE_ZONE_PROGRAM(malloc_zone_t,==,16)],[
1404 AC_COMPILE_IFELSE([JE_ZONE_PROGRAM(malloc_introspection_t,==,9)],[JEMALLOC_ZONE_VERSION=6],[
1405 AC_COMPILE_IFELSE([JE_ZONE_PROGRAM(malloc_introspection_t,==,13)],[JEMALLOC_ZONE_VERSION=7],[JEMALLOC_ZONE_VERSION=]
1406 )])],[
1407 AC_COMPILE_IFELSE([JE_ZONE_PROGRAM(malloc_zone_t,==,17)],[JEMALLOC_ZONE_VERSION=8],[
1408 AC_COMPILE_IFELSE([JE_ZONE_PROGRAM(malloc_zone_t,>,17)],[JEMALLOC_ZONE_VERSION=9],[JEMALLOC_ZONE_VERSION=]
1409 )])])])])
1410 if test "x${JEMALLOC_ZONE_VERSION}" = "x"; then
1411 AC_MSG_RESULT([unsupported])
1412 AC_MSG_ERROR([Unsupported malloc zone version])
1413 fi
1414 if test "${JEMALLOC_ZONE_VERSION}" = 9; then
1415 JEMALLOC_ZONE_VERSION=8
1416 AC_MSG_RESULT([> 8])
1417 else
1418 AC_MSG_RESULT([$JEMALLOC_ZONE_VERSION])
1419 fi
1420 AC_DEFINE_UNQUOTED(JEMALLOC_ZONE_VERSION, [$JEMALLOC_ZONE_VERSION])
Jason Evansb27805b2010-02-10 18:15:53 -08001421fi
1422
Jason Evansb7924f52009-06-23 19:01:18 -07001423dnl ============================================================================
Sara Golemon3e24afa2014-08-18 13:06:39 -07001424dnl Check for glibc malloc hooks
1425
1426JE_COMPILABLE([glibc malloc hook], [
1427#include <stddef.h>
1428
1429extern void (* __free_hook)(void *ptr);
1430extern void *(* __malloc_hook)(size_t size);
1431extern void *(* __realloc_hook)(void *ptr, size_t size);
1432], [
1433 void *ptr = 0L;
1434 if (__malloc_hook) ptr = __malloc_hook(1);
1435 if (__realloc_hook) ptr = __realloc_hook(ptr, 2);
1436 if (__free_hook && ptr) __free_hook(ptr);
1437], [je_cv_glibc_malloc_hook])
1438if test "x${je_cv_glibc_malloc_hook}" = "xyes" ; then
1439 AC_DEFINE([JEMALLOC_GLIBC_MALLOC_HOOK], [ ])
1440fi
1441
1442JE_COMPILABLE([glibc memalign hook], [
1443#include <stddef.h>
1444
1445extern void *(* __memalign_hook)(size_t alignment, size_t size);
1446], [
1447 void *ptr = 0L;
1448 if (__memalign_hook) ptr = __memalign_hook(16, 7);
1449], [je_cv_glibc_memalign_hook])
1450if test "x${je_cv_glibc_memalign_hook}" = "xyes" ; then
1451 AC_DEFINE([JEMALLOC_GLIBC_MEMALIGN_HOOK], [ ])
1452fi
1453
Eric Wong4dcf04b2014-08-31 03:57:06 +00001454JE_COMPILABLE([pthreads adaptive mutexes], [
1455#include <pthread.h>
1456], [
1457 pthread_mutexattr_t attr;
1458 pthread_mutexattr_init(&attr);
1459 pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ADAPTIVE_NP);
1460 pthread_mutexattr_destroy(&attr);
1461], [je_cv_pthread_mutex_adaptive_np])
1462if test "x${je_cv_pthread_mutex_adaptive_np}" = "xyes" ; then
1463 AC_DEFINE([JEMALLOC_HAVE_PTHREAD_MUTEX_ADAPTIVE_NP], [ ])
1464fi
1465
Sara Golemon3e24afa2014-08-18 13:06:39 -07001466dnl ============================================================================
Jason Evansb7924f52009-06-23 19:01:18 -07001467dnl Check for typedefs, structures, and compiler characteristics.
1468AC_HEADER_STDBOOL
1469
Jason Evans748dfac2013-12-06 18:27:33 -08001470dnl ============================================================================
1471dnl Define commands that generate output files.
1472
Jason Evans86abd0d2013-11-30 15:25:42 -08001473AC_CONFIG_COMMANDS([include/jemalloc/internal/private_namespace.h], [
1474 mkdir -p "${objroot}include/jemalloc/internal"
1475 "${srcdir}/include/jemalloc/internal/private_namespace.sh" "${srcdir}/include/jemalloc/internal/private_symbols.txt" > "${objroot}include/jemalloc/internal/private_namespace.h"
Jason Evansf234dc52014-01-16 17:38:01 -08001476], [
1477 srcdir="${srcdir}"
1478 objroot="${objroot}"
Jason Evans86abd0d2013-11-30 15:25:42 -08001479])
1480AC_CONFIG_COMMANDS([include/jemalloc/internal/private_unnamespace.h], [
1481 mkdir -p "${objroot}include/jemalloc/internal"
1482 "${srcdir}/include/jemalloc/internal/private_unnamespace.sh" "${srcdir}/include/jemalloc/internal/private_symbols.txt" > "${objroot}include/jemalloc/internal/private_unnamespace.h"
Jason Evansf234dc52014-01-16 17:38:01 -08001483], [
1484 srcdir="${srcdir}"
1485 objroot="${objroot}"
1486])
1487AC_CONFIG_COMMANDS([include/jemalloc/internal/public_symbols.txt], [
1488 f="${objroot}include/jemalloc/internal/public_symbols.txt"
1489 mkdir -p "${objroot}include/jemalloc/internal"
1490 cp /dev/null "${f}"
1491 for nm in `echo ${mangling_map} |tr ',' ' '` ; do
1492 n=`echo ${nm} |tr ':' ' ' |awk '{print $[]1}'`
1493 m=`echo ${nm} |tr ':' ' ' |awk '{print $[]2}'`
1494 echo "${n}:${m}" >> "${f}"
1495 dnl Remove name from public_syms so that it isn't redefined later.
1496 public_syms=`for sym in ${public_syms}; do echo "${sym}"; done |grep -v "^${n}\$" |tr '\n' ' '`
1497 done
1498 for sym in ${public_syms} ; do
1499 n="${sym}"
1500 m="${JEMALLOC_PREFIX}${sym}"
1501 echo "${n}:${m}" >> "${f}"
1502 done
1503], [
1504 srcdir="${srcdir}"
1505 objroot="${objroot}"
1506 mangling_map="${mangling_map}"
1507 public_syms="${public_syms}"
1508 JEMALLOC_PREFIX="${JEMALLOC_PREFIX}"
Jason Evans86abd0d2013-11-30 15:25:42 -08001509])
1510AC_CONFIG_COMMANDS([include/jemalloc/internal/public_namespace.h], [
1511 mkdir -p "${objroot}include/jemalloc/internal"
Jason Evansf234dc52014-01-16 17:38:01 -08001512 "${srcdir}/include/jemalloc/internal/public_namespace.sh" "${objroot}include/jemalloc/internal/public_symbols.txt" > "${objroot}include/jemalloc/internal/public_namespace.h"
1513], [
1514 srcdir="${srcdir}"
1515 objroot="${objroot}"
Jason Evans86abd0d2013-11-30 15:25:42 -08001516])
1517AC_CONFIG_COMMANDS([include/jemalloc/internal/public_unnamespace.h], [
1518 mkdir -p "${objroot}include/jemalloc/internal"
Jason Evansf234dc52014-01-16 17:38:01 -08001519 "${srcdir}/include/jemalloc/internal/public_unnamespace.sh" "${objroot}include/jemalloc/internal/public_symbols.txt" > "${objroot}include/jemalloc/internal/public_unnamespace.h"
1520], [
1521 srcdir="${srcdir}"
1522 objroot="${objroot}"
Jason Evans86abd0d2013-11-30 15:25:42 -08001523])
Jason Evansb1726102012-02-28 16:50:47 -08001524AC_CONFIG_COMMANDS([include/jemalloc/internal/size_classes.h], [
Jason Evans86abd0d2013-11-30 15:25:42 -08001525 mkdir -p "${objroot}include/jemalloc/internal"
Jason Evans81e54752014-10-10 22:34:25 -07001526 "${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"
Jason Evansf234dc52014-01-16 17:38:01 -08001527], [
1528 srcdir="${srcdir}"
1529 objroot="${objroot}"
Jason Evans81e54752014-10-10 22:34:25 -07001530 LG_QUANTA="${LG_QUANTA}"
1531 LG_TINY_MIN=${LG_TINY_MIN}
1532 LG_PAGE_SIZES="${LG_PAGE_SIZES}"
Jason Evansfc0b3b72014-10-09 17:54:06 -07001533 LG_SIZE_CLASS_GROUP=${LG_SIZE_CLASS_GROUP}
Jason Evansb1726102012-02-28 16:50:47 -08001534])
Jason Evans86abd0d2013-11-30 15:25:42 -08001535AC_CONFIG_COMMANDS([include/jemalloc/jemalloc_protos_jet.h], [
1536 mkdir -p "${objroot}include/jemalloc"
1537 cat "${srcdir}/include/jemalloc/jemalloc_protos.h.in" | sed -e 's/@je_@/jet_/g' > "${objroot}include/jemalloc/jemalloc_protos_jet.h"
Jason Evansf234dc52014-01-16 17:38:01 -08001538], [
1539 srcdir="${srcdir}"
1540 objroot="${objroot}"
1541])
1542AC_CONFIG_COMMANDS([include/jemalloc/jemalloc_rename.h], [
1543 mkdir -p "${objroot}include/jemalloc"
1544 "${srcdir}/include/jemalloc/jemalloc_rename.sh" "${objroot}include/jemalloc/internal/public_symbols.txt" > "${objroot}include/jemalloc/jemalloc_rename.h"
1545], [
1546 srcdir="${srcdir}"
1547 objroot="${objroot}"
1548])
1549AC_CONFIG_COMMANDS([include/jemalloc/jemalloc_mangle.h], [
1550 mkdir -p "${objroot}include/jemalloc"
1551 "${srcdir}/include/jemalloc/jemalloc_mangle.sh" "${objroot}include/jemalloc/internal/public_symbols.txt" je_ > "${objroot}include/jemalloc/jemalloc_mangle.h"
1552], [
1553 srcdir="${srcdir}"
1554 objroot="${objroot}"
1555])
1556AC_CONFIG_COMMANDS([include/jemalloc/jemalloc_mangle_jet.h], [
1557 mkdir -p "${objroot}include/jemalloc"
1558 "${srcdir}/include/jemalloc/jemalloc_mangle.sh" "${objroot}include/jemalloc/internal/public_symbols.txt" jet_ > "${objroot}include/jemalloc/jemalloc_mangle_jet.h"
1559], [
1560 srcdir="${srcdir}"
1561 objroot="${objroot}"
Jason Evans86abd0d2013-11-30 15:25:42 -08001562])
1563AC_CONFIG_COMMANDS([include/jemalloc/jemalloc.h], [
1564 mkdir -p "${objroot}include/jemalloc"
1565 "${srcdir}/include/jemalloc/jemalloc.sh" "${objroot}" > "${objroot}include/jemalloc/jemalloc${install_suffix}.h"
Jason Evansf234dc52014-01-16 17:38:01 -08001566], [
1567 srcdir="${srcdir}"
1568 objroot="${objroot}"
1569 install_suffix="${install_suffix}"
Jason Evans86abd0d2013-11-30 15:25:42 -08001570])
Jason Evansb1726102012-02-28 16:50:47 -08001571
Jason Evansb7924f52009-06-23 19:01:18 -07001572dnl Process .in files.
Jason Evansb0fd5012010-01-17 01:49:20 -08001573AC_SUBST([cfghdrs_in])
1574AC_SUBST([cfghdrs_out])
Jason Evans0656ec02010-04-07 23:37:35 -07001575AC_CONFIG_HEADERS([$cfghdrs_tup])
Jason Evansb7924f52009-06-23 19:01:18 -07001576
1577dnl ============================================================================
1578dnl Generate outputs.
Jason Evans748dfac2013-12-06 18:27:33 -08001579
Jason Evansbec6a8d2015-01-22 17:55:58 -08001580AC_CONFIG_FILES([$cfgoutputs_tup config.stamp bin/jemalloc-config bin/jemalloc.sh])
Jason Evansb0fd5012010-01-17 01:49:20 -08001581AC_SUBST([cfgoutputs_in])
1582AC_SUBST([cfgoutputs_out])
Jason Evansb7924f52009-06-23 19:01:18 -07001583AC_OUTPUT
1584
1585dnl ============================================================================
1586dnl Print out the results of configuration.
1587AC_MSG_RESULT([===============================================================================])
Jason Evansf576c632011-11-01 22:27:41 -07001588AC_MSG_RESULT([jemalloc version : ${jemalloc_version}])
1589AC_MSG_RESULT([library revision : ${rev}])
Jason Evansb7924f52009-06-23 19:01:18 -07001590AC_MSG_RESULT([])
Jason Evansbec6a8d2015-01-22 17:55:58 -08001591AC_MSG_RESULT([CONFIG : ${CONFIG}])
Jason Evansb7924f52009-06-23 19:01:18 -07001592AC_MSG_RESULT([CC : ${CC}])
Jason Evansb7924f52009-06-23 19:01:18 -07001593AC_MSG_RESULT([CFLAGS : ${CFLAGS}])
Jason Evansbec6a8d2015-01-22 17:55:58 -08001594AC_MSG_RESULT([CPPFLAGS : ${CPPFLAGS}])
Jason Evansb7924f52009-06-23 19:01:18 -07001595AC_MSG_RESULT([LDFLAGS : ${LDFLAGS}])
Jason Evans748dfac2013-12-06 18:27:33 -08001596AC_MSG_RESULT([EXTRA_LDFLAGS : ${EXTRA_LDFLAGS}])
Jason Evansb7924f52009-06-23 19:01:18 -07001597AC_MSG_RESULT([LIBS : ${LIBS}])
1598AC_MSG_RESULT([RPATH_EXTRA : ${RPATH_EXTRA}])
1599AC_MSG_RESULT([])
Jason Evansaee7fd22010-11-24 22:00:02 -08001600AC_MSG_RESULT([XSLTPROC : ${XSLTPROC}])
1601AC_MSG_RESULT([XSLROOT : ${XSLROOT}])
1602AC_MSG_RESULT([])
Jason Evansb7924f52009-06-23 19:01:18 -07001603AC_MSG_RESULT([PREFIX : ${PREFIX}])
1604AC_MSG_RESULT([BINDIR : ${BINDIR}])
Jason Evansbec6a8d2015-01-22 17:55:58 -08001605AC_MSG_RESULT([DATADIR : ${DATADIR}])
Jason Evans662a0172009-07-01 19:24:31 -07001606AC_MSG_RESULT([INCLUDEDIR : ${INCLUDEDIR}])
1607AC_MSG_RESULT([LIBDIR : ${LIBDIR}])
Jason Evansb7924f52009-06-23 19:01:18 -07001608AC_MSG_RESULT([MANDIR : ${MANDIR}])
1609AC_MSG_RESULT([])
1610AC_MSG_RESULT([srcroot : ${srcroot}])
1611AC_MSG_RESULT([abs_srcroot : ${abs_srcroot}])
1612AC_MSG_RESULT([objroot : ${objroot}])
1613AC_MSG_RESULT([abs_objroot : ${abs_objroot}])
1614AC_MSG_RESULT([])
Jason Evans90895cf2009-12-29 00:09:15 -08001615AC_MSG_RESULT([JEMALLOC_PREFIX : ${JEMALLOC_PREFIX}])
Jason Evans746e77a2011-07-30 16:40:52 -07001616AC_MSG_RESULT([JEMALLOC_PRIVATE_NAMESPACE])
1617AC_MSG_RESULT([ : ${JEMALLOC_PRIVATE_NAMESPACE}])
Jason Evansb0fd5012010-01-17 01:49:20 -08001618AC_MSG_RESULT([install_suffix : ${install_suffix}])
Jason Evansb7924f52009-06-23 19:01:18 -07001619AC_MSG_RESULT([autogen : ${enable_autogen}])
Jason Evans355b4382010-09-20 19:20:48 -07001620AC_MSG_RESULT([cc-silence : ${enable_cc_silence}])
Jason Evansb7924f52009-06-23 19:01:18 -07001621AC_MSG_RESULT([debug : ${enable_debug}])
Jason Evans748dfac2013-12-06 18:27:33 -08001622AC_MSG_RESULT([code-coverage : ${enable_code_coverage}])
Jason Evansb7924f52009-06-23 19:01:18 -07001623AC_MSG_RESULT([stats : ${enable_stats}])
Jason Evans6109fe02010-02-10 10:37:56 -08001624AC_MSG_RESULT([prof : ${enable_prof}])
1625AC_MSG_RESULT([prof-libunwind : ${enable_prof_libunwind}])
Jason Evans77f350b2011-03-15 22:23:12 -07001626AC_MSG_RESULT([prof-libgcc : ${enable_prof_libgcc}])
1627AC_MSG_RESULT([prof-gcc : ${enable_prof_gcc}])
Jason Evans84cbbcb2009-12-29 00:09:15 -08001628AC_MSG_RESULT([tcache : ${enable_tcache}])
Jason Evansb7924f52009-06-23 19:01:18 -07001629AC_MSG_RESULT([fill : ${enable_fill}])
Jason Evansb1476112012-04-05 13:36:17 -07001630AC_MSG_RESULT([utrace : ${enable_utrace}])
Jason Evans122449b2012-04-06 00:35:09 -07001631AC_MSG_RESULT([valgrind : ${enable_valgrind}])
1632AC_MSG_RESULT([xmalloc : ${enable_xmalloc}])
Jason Evans59ae2762012-04-16 17:52:27 -07001633AC_MSG_RESULT([munmap : ${enable_munmap}])
Jason Evansb7924f52009-06-23 19:01:18 -07001634AC_MSG_RESULT([lazy_lock : ${enable_lazy_lock}])
Jason Evans2dbecf12010-09-05 10:35:13 -07001635AC_MSG_RESULT([tls : ${enable_tls}])
Jason Evansb7924f52009-06-23 19:01:18 -07001636AC_MSG_RESULT([===============================================================================])