blob: 249a66c43e7a58db72608cc05fade2e035821c89 [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]])],
22 AC_MSG_RESULT([yes]),
23 AC_MSG_RESULT([no])
24 [CFLAGS="${TCFLAGS}"]
25)
26])
27
28dnl JE_COMPILABLE(label, hcode, mcode, rvar)
Jason Evans4c2faa82012-03-13 11:09:23 -070029dnl
Jason Evansf3e139a2012-03-19 09:54:20 -070030dnl Use AC_LINK_IFELSE() rather than AC_COMPILE_IFELSE() so that linker errors
Jason Evans4c2faa82012-03-13 11:09:23 -070031dnl cause failure.
Jason Evansf3340ca2009-06-30 16:17:05 -070032AC_DEFUN([JE_COMPILABLE],
33[
Jason Evans6684cac2012-03-05 12:15:36 -080034AC_CACHE_CHECK([whether $1 is compilable],
35 [$4],
Jason Evansf3e139a2012-03-19 09:54:20 -070036 [AC_LINK_IFELSE([AC_LANG_PROGRAM([$2],
37 [$3])],
38 [$4=yes],
39 [$4=no])])
Jason Evansf3340ca2009-06-30 16:17:05 -070040])
41
42dnl ============================================================================
43
Jason Evansf576c632011-11-01 22:27:41 -070044dnl Library revision.
45rev=1
46AC_SUBST([rev])
47
Jason Evansb7924f52009-06-23 19:01:18 -070048srcroot=$srcdir
49if test "x${srcroot}" = "x." ; then
50 srcroot=""
51else
52 srcroot="${srcroot}/"
53fi
54AC_SUBST([srcroot])
55abs_srcroot="`cd \"${srcdir}\"; pwd`/"
56AC_SUBST([abs_srcroot])
57
58objroot=""
59AC_SUBST([objroot])
60abs_objroot="`pwd`/"
61AC_SUBST([abs_objroot])
62
63dnl Munge install path variables.
64if test "x$prefix" = "xNONE" ; then
65 prefix="/usr/local"
66fi
67if test "x$exec_prefix" = "xNONE" ; then
68 exec_prefix=$prefix
69fi
70PREFIX=$prefix
71AC_SUBST([PREFIX])
72BINDIR=`eval echo $bindir`
73BINDIR=`eval echo $BINDIR`
74AC_SUBST([BINDIR])
75INCLUDEDIR=`eval echo $includedir`
76INCLUDEDIR=`eval echo $INCLUDEDIR`
77AC_SUBST([INCLUDEDIR])
78LIBDIR=`eval echo $libdir`
79LIBDIR=`eval echo $LIBDIR`
80AC_SUBST([LIBDIR])
81DATADIR=`eval echo $datadir`
82DATADIR=`eval echo $DATADIR`
83AC_SUBST([DATADIR])
84MANDIR=`eval echo $mandir`
85MANDIR=`eval echo $MANDIR`
86AC_SUBST([MANDIR])
87
Jason Evansaee7fd22010-11-24 22:00:02 -080088dnl Support for building documentation.
89AC_PATH_PROG([XSLTPROC], [xsltproc], , [$PATH])
Jason Evans7091b412012-03-19 09:36:44 -070090if test -d "/usr/share/xml/docbook/stylesheet/docbook-xsl" ; then
91 DEFAULT_XSLROOT="/usr/share/xml/docbook/stylesheet/docbook-xsl"
92elif test -d "/usr/share/sgml/docbook/xsl-stylesheets" ; then
93 DEFAULT_XSLROOT="/usr/share/sgml/docbook/xsl-stylesheets"
94else
95 dnl Documentation building will fail if this default gets used.
96 DEFAULT_XSLROOT=""
97fi
Jason Evansaee7fd22010-11-24 22:00:02 -080098AC_ARG_WITH([xslroot],
Jason Evans7091b412012-03-19 09:36:44 -070099 [AS_HELP_STRING([--with-xslroot=<path>], [XSL stylesheet root path])], [
Jason Evansaee7fd22010-11-24 22:00:02 -0800100if test "x$with_xslroot" = "xno" ; then
Jason Evans7091b412012-03-19 09:36:44 -0700101 XSLROOT="${DEFAULT_XSLROOT}"
Jason Evansaee7fd22010-11-24 22:00:02 -0800102else
103 XSLROOT="${with_xslroot}"
Jason Evans7091b412012-03-19 09:36:44 -0700104fi
105],
106 XSLROOT="${DEFAULT_XSLROOT}"
Jason Evansaee7fd22010-11-24 22:00:02 -0800107)
108AC_SUBST([XSLROOT])
109
Jason Evansf3340ca2009-06-30 16:17:05 -0700110dnl If CFLAGS isn't defined, set CFLAGS to something reasonable. Otherwise,
111dnl just prevent autoconf from molesting CFLAGS.
Jason Evansb7924f52009-06-23 19:01:18 -0700112CFLAGS=$CFLAGS
113AC_PROG_CC
Mike Hommeyfd97b1d2012-04-30 12:38:31 +0200114if test "x$GCC" != "xyes" ; then
115 AC_CACHE_CHECK([whether compiler is MSVC],
116 [je_cv_msvc],
117 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],
118 [
119#ifndef _MSC_VER
120 int fail[-1];
121#endif
122])],
123 [je_cv_msvc=yes],
124 [je_cv_msvc=no])])
125fi
126
Jason Evansb7924f52009-06-23 19:01:18 -0700127if test "x$CFLAGS" = "x" ; then
128 no_CFLAGS="yes"
Jason Evanscfeccd32010-03-03 15:48:20 -0800129 if test "x$GCC" = "xyes" ; then
130 JE_CFLAGS_APPEND([-std=gnu99])
131 JE_CFLAGS_APPEND([-Wall])
132 JE_CFLAGS_APPEND([-pipe])
133 JE_CFLAGS_APPEND([-g3])
Mike Hommeyfd97b1d2012-04-30 12:38:31 +0200134 elif test "x$je_cv_msvc" = "xyes" ; then
135 CC="$CC -nologo"
136 JE_CFLAGS_APPEND([-Zi])
137 JE_CFLAGS_APPEND([-MT])
138 JE_CFLAGS_APPEND([-W3])
139 CPPFLAGS="$CPPFLAGS -I${srcroot}/include/msvc_compat"
Jason Evanscfeccd32010-03-03 15:48:20 -0800140 fi
Jason Evansb7924f52009-06-23 19:01:18 -0700141fi
142dnl Append EXTRA_CFLAGS to CFLAGS, if defined.
143if test "x$EXTRA_CFLAGS" != "x" ; then
Jason Evansf3340ca2009-06-30 16:17:05 -0700144 JE_CFLAGS_APPEND([$EXTRA_CFLAGS])
Jason Evansb7924f52009-06-23 19:01:18 -0700145fi
146AC_PROG_CPP
147
Jason Evansb7924f52009-06-23 19:01:18 -0700148AC_CHECK_SIZEOF([void *])
149if test "x${ac_cv_sizeof_void_p}" = "x8" ; then
Jason Evans94ad2b52009-12-29 00:09:15 -0800150 LG_SIZEOF_PTR=3
Jason Evansb7924f52009-06-23 19:01:18 -0700151elif test "x${ac_cv_sizeof_void_p}" = "x4" ; then
Jason Evans94ad2b52009-12-29 00:09:15 -0800152 LG_SIZEOF_PTR=2
Jason Evansb7924f52009-06-23 19:01:18 -0700153else
154 AC_MSG_ERROR([Unsupported pointer size: ${ac_cv_sizeof_void_p}])
155fi
Jason Evans94ad2b52009-12-29 00:09:15 -0800156AC_DEFINE_UNQUOTED([LG_SIZEOF_PTR], [$LG_SIZEOF_PTR])
157
158AC_CHECK_SIZEOF([int])
159if test "x${ac_cv_sizeof_int}" = "x8" ; then
160 LG_SIZEOF_INT=3
161elif test "x${ac_cv_sizeof_int}" = "x4" ; then
162 LG_SIZEOF_INT=2
163else
164 AC_MSG_ERROR([Unsupported int size: ${ac_cv_sizeof_int}])
165fi
166AC_DEFINE_UNQUOTED([LG_SIZEOF_INT], [$LG_SIZEOF_INT])
Jason Evansb7924f52009-06-23 19:01:18 -0700167
Jason Evans84c8eef2011-03-16 10:30:13 -0700168AC_CHECK_SIZEOF([long])
169if test "x${ac_cv_sizeof_long}" = "x8" ; then
170 LG_SIZEOF_LONG=3
171elif test "x${ac_cv_sizeof_long}" = "x4" ; then
172 LG_SIZEOF_LONG=2
173else
174 AC_MSG_ERROR([Unsupported long size: ${ac_cv_sizeof_long}])
175fi
176AC_DEFINE_UNQUOTED([LG_SIZEOF_LONG], [$LG_SIZEOF_LONG])
177
Jason Evansd81e4bd2012-03-06 14:57:45 -0800178AC_CHECK_SIZEOF([intmax_t])
179if test "x${ac_cv_sizeof_intmax_t}" = "x16" ; then
180 LG_SIZEOF_INTMAX_T=4
181elif test "x${ac_cv_sizeof_intmax_t}" = "x8" ; then
182 LG_SIZEOF_INTMAX_T=3
183elif test "x${ac_cv_sizeof_intmax_t}" = "x4" ; then
184 LG_SIZEOF_INTMAX_T=2
185else
Mike Hommey14103d32012-04-20 08:38:39 +0200186 AC_MSG_ERROR([Unsupported intmax_t size: ${ac_cv_sizeof_intmax_t}])
Jason Evansd81e4bd2012-03-06 14:57:45 -0800187fi
188AC_DEFINE_UNQUOTED([LG_SIZEOF_INTMAX_T], [$LG_SIZEOF_INTMAX_T])
189
Jason Evansb7924f52009-06-23 19:01:18 -0700190AC_CANONICAL_HOST
191dnl CPU-specific settings.
192CPU_SPINWAIT=""
193case "${host_cpu}" in
194 i[[345]]86)
195 ;;
196 i686)
Jason Evansf3340ca2009-06-30 16:17:05 -0700197 JE_COMPILABLE([__asm__], [], [[__asm__ volatile("pause"); return 0;]],
Jason Evans6684cac2012-03-05 12:15:36 -0800198 [je_cv_asm])
199 if test "x${je_cv_asm}" = "xyes" ; then
Jason Evansf3340ca2009-06-30 16:17:05 -0700200 CPU_SPINWAIT='__asm__ volatile("pause")'
201 fi
Jason Evansb7924f52009-06-23 19:01:18 -0700202 ;;
203 x86_64)
Jason Evansf3340ca2009-06-30 16:17:05 -0700204 JE_COMPILABLE([__asm__ syntax], [],
Jason Evans6684cac2012-03-05 12:15:36 -0800205 [[__asm__ volatile("pause"); return 0;]], [je_cv_asm])
206 if test "x${je_cv_asm}" = "xyes" ; then
Jason Evansf3340ca2009-06-30 16:17:05 -0700207 CPU_SPINWAIT='__asm__ volatile("pause")'
208 fi
Jason Evansb7924f52009-06-23 19:01:18 -0700209 ;;
210 *)
211 ;;
212esac
213AC_DEFINE_UNQUOTED([CPU_SPINWAIT], [$CPU_SPINWAIT])
214
Antony Dovgal2bd3cbc2011-10-13 09:33:33 +0400215LD_PRELOAD_VAR="LD_PRELOAD"
Jason Evansf576c632011-11-01 22:27:41 -0700216so="so"
Mike Hommeyfd97b1d2012-04-30 12:38:31 +0200217importlib="${so}"
Mike Hommey7cdea392012-04-30 12:38:27 +0200218o="$ac_objext"
Mike Hommey5bee66d2012-04-16 16:30:24 +0200219a="a"
Mike Hommey7cdea392012-04-30 12:38:27 +0200220exe="$ac_exeext"
Mike Hommeya19e87f2012-04-21 21:27:46 -0700221libprefix="lib"
Mike Hommeyfa08da72012-04-16 16:30:25 +0200222DSO_LDFLAGS='-shared -Wl,-soname,$(@F)'
223RPATH='-Wl,-rpath,$(1)'
Mike Hommey7cdea392012-04-30 12:38:27 +0200224SOREV="${so}.${rev}"
Mike Hommey188da7c2012-04-18 18:29:41 +0200225PIC_CFLAGS='-fPIC -DPIC'
Mike Hommeyfd97b1d2012-04-30 12:38:31 +0200226CTARGET='-o $@'
227LDTARGET='-o $@'
228EXTRA_LDFLAGS=
229MKLIB='ar crus $@'
Mike Hommey79c4bca2012-05-02 21:30:51 +0200230CC_MM=1
Jason Evans7372b152012-02-10 20:22:09 -0800231
Jason Evansb7924f52009-06-23 19:01:18 -0700232dnl Platform-specific settings. abi and RPATH can probably be determined
233dnl programmatically, but doing so is error-prone, which makes it generally
234dnl not worth the trouble.
235dnl
236dnl Define cpp macros in CPPFLAGS, rather than doing AC_DEFINE(macro), since the
237dnl definitions need to be seen before any headers are included, which is a pain
238dnl to make happen otherwise.
Jason Evans59ae2762012-04-16 17:52:27 -0700239default_munmap="1"
Jason Evans247d1242012-10-09 16:20:10 -0700240JEMALLOC_USABLE_SIZE_CONST="const"
Jason Evansb7924f52009-06-23 19:01:18 -0700241case "${host}" in
242 *-*-darwin*)
Mike Hommeya6770a72012-05-03 14:12:49 +0200243 CFLAGS="$CFLAGS"
Jason Evansb7924f52009-06-23 19:01:18 -0700244 abi="macho"
Jason Evanse24c7af2012-03-19 10:21:17 -0700245 AC_DEFINE([JEMALLOC_PURGE_MADVISE_FREE], [ ])
Jason Evansb7924f52009-06-23 19:01:18 -0700246 RPATH=""
Antony Dovgal2bd3cbc2011-10-13 09:33:33 +0400247 LD_PRELOAD_VAR="DYLD_INSERT_LIBRARIES"
Jason Evansf576c632011-11-01 22:27:41 -0700248 so="dylib"
Mike Hommeyfd97b1d2012-04-30 12:38:31 +0200249 importlib="${so}"
Jason Evansb80581d2012-03-23 16:17:43 -0700250 force_tls="0"
Mike Hommeyfa08da72012-04-16 16:30:25 +0200251 DSO_LDFLAGS='-shared -Wl,-dylib_install_name,$(@F)'
Mike Hommey7cdea392012-04-30 12:38:27 +0200252 SOREV="${rev}.${so}"
Jason Evansb7924f52009-06-23 19:01:18 -0700253 ;;
254 *-*-freebsd*)
255 CFLAGS="$CFLAGS"
256 abi="elf"
Jason Evanse24c7af2012-03-19 10:21:17 -0700257 AC_DEFINE([JEMALLOC_PURGE_MADVISE_FREE], [ ])
Jason Evansfd4fcef2012-03-23 17:40:58 -0700258 force_lazy_lock="1"
Jason Evansb7924f52009-06-23 19:01:18 -0700259 ;;
260 *-*-linux*)
261 CFLAGS="$CFLAGS"
262 CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
263 abi="elf"
Jason Evanse24c7af2012-03-19 10:21:17 -0700264 AC_DEFINE([JEMALLOC_PURGE_MADVISE_DONTNEED], [ ])
Jason Evans02b23122012-04-05 11:06:23 -0700265 AC_DEFINE([JEMALLOC_THREADED_INIT], [ ])
Jason Evans247d1242012-10-09 16:20:10 -0700266 JEMALLOC_USABLE_SIZE_CONST=""
Jason Evans59ae2762012-04-16 17:52:27 -0700267 default_munmap="0"
Jason Evansb7924f52009-06-23 19:01:18 -0700268 ;;
269 *-*-netbsd*)
270 AC_MSG_CHECKING([ABI])
271 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
272[[#ifdef __ELF__
273/* ELF */
274#else
275#error aout
276#endif
277]])],
278 [CFLAGS="$CFLAGS"; abi="elf"],
279 [abi="aout"])
280 AC_MSG_RESULT([$abi])
Jason Evanse24c7af2012-03-19 10:21:17 -0700281 AC_DEFINE([JEMALLOC_PURGE_MADVISE_FREE], [ ])
Jason Evansb7924f52009-06-23 19:01:18 -0700282 ;;
283 *-*-solaris2*)
284 CFLAGS="$CFLAGS"
285 abi="elf"
Mike Hommeyfa08da72012-04-16 16:30:25 +0200286 RPATH='-Wl,-R,$(1)'
Jason Evansb7924f52009-06-23 19:01:18 -0700287 dnl Solaris needs this for sigwait().
288 CPPFLAGS="$CPPFLAGS -D_POSIX_PTHREAD_SEMANTICS"
289 LIBS="$LIBS -lposix4 -lsocket -lnsl"
290 ;;
Antony Dovgal2bd3cbc2011-10-13 09:33:33 +0400291 *-ibm-aix*)
292 if "$LG_SIZEOF_PTR" = "8"; then
293 dnl 64bit AIX
294 LD_PRELOAD_VAR="LDR_PRELOAD64"
295 else
296 dnl 32bit AIX
297 LD_PRELOAD_VAR="LDR_PRELOAD"
298 fi
299 abi="xcoff"
Antony Dovgal2bd3cbc2011-10-13 09:33:33 +0400300 ;;
Mike Hommeya19e87f2012-04-21 21:27:46 -0700301 *-*-mingw*)
302 abi="pecoff"
303 force_tls="0"
304 RPATH=""
305 so="dll"
Mike Hommeyfd97b1d2012-04-30 12:38:31 +0200306 if test "x$je_cv_msvc" = "xyes" ; then
307 importlib="lib"
308 DSO_LDFLAGS="-LD"
309 EXTRA_LDFLAGS="-link -DEBUG"
310 CTARGET='-Fo$@'
311 LDTARGET='-Fe$@'
312 MKLIB='lib -nologo -out:$@'
Mike Hommey79c4bca2012-05-02 21:30:51 +0200313 CC_MM=
Mike Hommeyfd97b1d2012-04-30 12:38:31 +0200314 else
315 importlib="${so}"
316 DSO_LDFLAGS="-shared"
317 fi
Mike Hommeya19e87f2012-04-21 21:27:46 -0700318 a="lib"
319 libprefix=""
Mike Hommey7cdea392012-04-30 12:38:27 +0200320 SOREV="${so}"
Mike Hommeya19e87f2012-04-21 21:27:46 -0700321 PIC_CFLAGS=""
322 ;;
Jason Evansb7924f52009-06-23 19:01:18 -0700323 *)
324 AC_MSG_RESULT([Unsupported operating system: ${host}])
325 abi="elf"
Jason Evansb7924f52009-06-23 19:01:18 -0700326 ;;
327esac
Jason Evans247d1242012-10-09 16:20:10 -0700328AC_DEFINE_UNQUOTED([JEMALLOC_USABLE_SIZE_CONST], [$JEMALLOC_USABLE_SIZE_CONST])
Jason Evansb7924f52009-06-23 19:01:18 -0700329AC_SUBST([abi])
330AC_SUBST([RPATH])
Antony Dovgal2bd3cbc2011-10-13 09:33:33 +0400331AC_SUBST([LD_PRELOAD_VAR])
Jason Evansf576c632011-11-01 22:27:41 -0700332AC_SUBST([so])
Mike Hommeyfd97b1d2012-04-30 12:38:31 +0200333AC_SUBST([importlib])
Mike Hommey5bee66d2012-04-16 16:30:24 +0200334AC_SUBST([o])
335AC_SUBST([a])
336AC_SUBST([exe])
Mike Hommeya19e87f2012-04-21 21:27:46 -0700337AC_SUBST([libprefix])
Mike Hommeyfa08da72012-04-16 16:30:25 +0200338AC_SUBST([DSO_LDFLAGS])
Mike Hommeyfd97b1d2012-04-30 12:38:31 +0200339AC_SUBST([EXTRA_LDFLAGS])
Mike Hommey85221d52012-04-18 18:29:40 +0200340AC_SUBST([SOREV])
Mike Hommey188da7c2012-04-18 18:29:41 +0200341AC_SUBST([PIC_CFLAGS])
Mike Hommeyfd97b1d2012-04-30 12:38:31 +0200342AC_SUBST([CTARGET])
343AC_SUBST([LDTARGET])
344AC_SUBST([MKLIB])
Mike Hommey79c4bca2012-05-02 21:30:51 +0200345AC_SUBST([CC_MM])
Mike Hommeyfd97b1d2012-04-30 12:38:31 +0200346
347if test "x$abi" != "xpecoff"; then
348 dnl Heap profiling uses the log(3) function.
349 LIBS="$LIBS -lm"
350fi
Jason Evansb7924f52009-06-23 19:01:18 -0700351
Jason Evansfa5d2452011-03-15 10:25:59 -0700352JE_COMPILABLE([__attribute__ syntax],
353 [static __attribute__((unused)) void foo(void){}],
354 [],
Jason Evans6684cac2012-03-05 12:15:36 -0800355 [je_cv_attribute])
356if test "x${je_cv_attribute}" = "xyes" ; then
Jason Evansfa5d2452011-03-15 10:25:59 -0700357 AC_DEFINE([JEMALLOC_HAVE_ATTR], [ ])
358 if test "x${GCC}" = "xyes" -a "x${abi}" = "xelf"; then
359 JE_CFLAGS_APPEND([-fvisibility=hidden])
360 fi
361fi
Jason Evans3cc1f1a2012-04-03 22:30:05 -0700362dnl Check for tls_model attribute support (clang 3.0 still lacks support).
363SAVED_CFLAGS="${CFLAGS}"
364JE_CFLAGS_APPEND([-Werror])
365JE_COMPILABLE([tls_model attribute], [],
366 [static __thread int
367 __attribute__((tls_model("initial-exec"))) foo;
368 foo = 0;],
369 [je_cv_tls_model])
370CFLAGS="${SAVED_CFLAGS}"
371if test "x${je_cv_tls_model}" = "xyes" ; then
372 AC_DEFINE([JEMALLOC_TLS_MODEL],
373 [__attribute__((tls_model("initial-exec")))])
374else
375 AC_DEFINE([JEMALLOC_TLS_MODEL], [ ])
376fi
Jason Evansfa5d2452011-03-15 10:25:59 -0700377
Jason Evansb7924f52009-06-23 19:01:18 -0700378dnl Support optional additions to rpath.
379AC_ARG_WITH([rpath],
Jason Evans90895cf2009-12-29 00:09:15 -0800380 [AS_HELP_STRING([--with-rpath=<rpath>], [Colon-separated rpath (ELF systems only)])],
Jason Evansb7924f52009-06-23 19:01:18 -0700381if test "x$with_rpath" = "xno" ; then
382 RPATH_EXTRA=
383else
384 RPATH_EXTRA="`echo $with_rpath | tr \":\" \" \"`"
385fi,
386 RPATH_EXTRA=
387)
388AC_SUBST([RPATH_EXTRA])
389
390dnl Disable rules that do automatic regeneration of configure output by default.
391AC_ARG_ENABLE([autogen],
Jason Evans78d815c2010-01-17 14:06:20 -0800392 [AS_HELP_STRING([--enable-autogen], [Automatically regenerate configure output])],
Jason Evansb7924f52009-06-23 19:01:18 -0700393if test "x$enable_autogen" = "xno" ; then
394 enable_autogen="0"
395else
396 enable_autogen="1"
397fi
398,
399enable_autogen="0"
400)
401AC_SUBST([enable_autogen])
402
403AC_PROG_INSTALL
404AC_PROG_RANLIB
405AC_PATH_PROG([AR], [ar], , [$PATH])
406AC_PATH_PROG([LD], [ld], , [$PATH])
407AC_PATH_PROG([AUTOCONF], [autoconf], , [$PATH])
408
Jason Evans0a0bbf62012-03-13 12:55:21 -0700409public_syms="malloc_conf malloc_message malloc calloc posix_memalign aligned_alloc realloc free malloc_usable_size malloc_stats_print mallctl mallctlnametomib mallctlbymib"
Jason Evans7e77eaf2012-03-02 17:47:37 -0800410
411dnl Check for allocator-related functions that should be wrapped.
412AC_CHECK_FUNC([memalign],
Jason Evanse24c7af2012-03-19 10:21:17 -0700413 [AC_DEFINE([JEMALLOC_OVERRIDE_MEMALIGN], [ ])
Jason Evans7e77eaf2012-03-02 17:47:37 -0800414 public_syms="${public_syms} memalign"])
415AC_CHECK_FUNC([valloc],
Jason Evanse24c7af2012-03-19 10:21:17 -0700416 [AC_DEFINE([JEMALLOC_OVERRIDE_VALLOC], [ ])
Jason Evans7e77eaf2012-03-02 17:47:37 -0800417 public_syms="${public_syms} valloc"])
418
419dnl Support the experimental API by default.
420AC_ARG_ENABLE([experimental],
421 [AS_HELP_STRING([--disable-experimental],
422 [Disable support for the experimental API])],
423[if test "x$enable_experimental" = "xno" ; then
424 enable_experimental="0"
425else
426 enable_experimental="1"
427fi
428],
429[enable_experimental="1"]
430)
431if test "x$enable_experimental" = "x1" ; then
432 AC_DEFINE([JEMALLOC_EXPERIMENTAL], [ ])
433 public_syms="${public_syms} allocm dallocm nallocm rallocm sallocm"
434fi
435AC_SUBST([enable_experimental])
436
Jason Evans0a5489e2012-03-01 17:19:20 -0800437dnl Perform no name mangling by default.
438AC_ARG_WITH([mangling],
439 [AS_HELP_STRING([--with-mangling=<map>], [Mangle symbols in <map>])],
440 [mangling_map="$with_mangling"], [mangling_map=""])
441for nm in `echo ${mangling_map} |tr ',' ' '` ; do
Jason Evans08fc3b22012-03-12 15:07:53 -0700442 k="`echo ${nm} |tr ':' ' ' |awk '{print $1}'`"
443 n="je_${k}"
Jason Evans0a5489e2012-03-01 17:19:20 -0800444 m=`echo ${nm} |tr ':' ' ' |awk '{print $2}'`
445 AC_DEFINE_UNQUOTED([${n}], [${m}])
Jason Evans08fc3b22012-03-12 15:07:53 -0700446 dnl Remove key from public_syms so that it isn't redefined later.
447 public_syms=`for sym in ${public_syms}; do echo "${sym}"; done |grep -v "^${k}\$" |tr '\n' ' '`
Jason Evans0a5489e2012-03-01 17:19:20 -0800448done
449
Jason Evans90895cf2009-12-29 00:09:15 -0800450dnl Do not prefix public APIs by default.
451AC_ARG_WITH([jemalloc_prefix],
452 [AS_HELP_STRING([--with-jemalloc-prefix=<prefix>], [Prefix to prepend to all public APIs])],
Jason Evansb0fd5012010-01-17 01:49:20 -0800453 [JEMALLOC_PREFIX="$with_jemalloc_prefix"],
Mike Hommey7cdea392012-04-30 12:38:27 +0200454 [if test "x$abi" != "xmacho" -a "x$abi" != "xpecoff"; then
Jason Evans2dbecf12010-09-05 10:35:13 -0700455 JEMALLOC_PREFIX=""
456else
457 JEMALLOC_PREFIX="je_"
458fi]
Jason Evans90895cf2009-12-29 00:09:15 -0800459)
460if test "x$JEMALLOC_PREFIX" != "x" ; then
Jason Evanse7339702010-10-23 18:37:06 -0700461 JEMALLOC_CPREFIX=`echo ${JEMALLOC_PREFIX} | tr "a-z" "A-Z"`
462 AC_DEFINE_UNQUOTED([JEMALLOC_PREFIX], ["$JEMALLOC_PREFIX"])
463 AC_DEFINE_UNQUOTED([JEMALLOC_CPREFIX], ["$JEMALLOC_CPREFIX"])
Jason Evans90895cf2009-12-29 00:09:15 -0800464fi
Jason Evans0a5489e2012-03-01 17:19:20 -0800465dnl Generate macros to rename public symbols. All public symbols are prefixed
466dnl with je_ in the source code, so these macro definitions are needed even if
467dnl --with-jemalloc-prefix wasn't specified.
Jason Evans7e77eaf2012-03-02 17:47:37 -0800468for stem in ${public_syms}; do
Jason Evans0a5489e2012-03-01 17:19:20 -0800469 n="je_${stem}"
470 m="${JEMALLOC_PREFIX}${stem}"
471 AC_DEFINE_UNQUOTED([${n}], [${m}])
472done
Jason Evans90895cf2009-12-29 00:09:15 -0800473
Mike Hommey99066602012-11-19 10:55:26 +0100474AC_ARG_WITH([export],
475 [AS_HELP_STRING([--without-export], [disable exporting jemalloc public APIs])],
476 [if test "x$with_export" = "xno"; then
477 AC_DEFINE([JEMALLOC_EXPORT],[])]
478fi]
479)
480
Jason Evans746e77a2011-07-30 16:40:52 -0700481dnl Do not mangle library-private APIs by default.
482AC_ARG_WITH([private_namespace],
483 [AS_HELP_STRING([--with-private-namespace=<prefix>], [Prefix to prepend to all library-private APIs])],
484 [JEMALLOC_PRIVATE_NAMESPACE="$with_private_namespace"],
485 [JEMALLOC_PRIVATE_NAMESPACE=""]
486)
487AC_DEFINE_UNQUOTED([JEMALLOC_PRIVATE_NAMESPACE], ["$JEMALLOC_PRIVATE_NAMESPACE"])
488if test "x$JEMALLOC_PRIVATE_NAMESPACE" != "x" ; then
489 AC_DEFINE_UNQUOTED([JEMALLOC_N(string_that_no_one_should_want_to_use_as_a_jemalloc_private_namespace_prefix)], [${JEMALLOC_PRIVATE_NAMESPACE}##string_that_no_one_should_want_to_use_as_a_jemalloc_private_namespace_prefix])
490else
491 AC_DEFINE_UNQUOTED([JEMALLOC_N(string_that_no_one_should_want_to_use_as_a_jemalloc_private_namespace_prefix)], [string_that_no_one_should_want_to_use_as_a_jemalloc_private_namespace_prefix])
492fi
493
Jason Evansb0fd5012010-01-17 01:49:20 -0800494dnl Do not add suffix to installed files by default.
495AC_ARG_WITH([install_suffix],
496 [AS_HELP_STRING([--with-install-suffix=<suffix>], [Suffix to append to all installed files])],
497 [INSTALL_SUFFIX="$with_install_suffix"],
498 [INSTALL_SUFFIX=]
499)
500install_suffix="$INSTALL_SUFFIX"
501AC_SUBST([install_suffix])
502
Jason Evansaee7fd22010-11-24 22:00:02 -0800503cfgoutputs_in="${srcroot}Makefile.in"
504cfgoutputs_in="${cfgoutputs_in} ${srcroot}doc/html.xsl.in"
505cfgoutputs_in="${cfgoutputs_in} ${srcroot}doc/manpages.xsl.in"
506cfgoutputs_in="${cfgoutputs_in} ${srcroot}doc/jemalloc.xml.in"
Jason Evans0656ec02010-04-07 23:37:35 -0700507cfgoutputs_in="${cfgoutputs_in} ${srcroot}include/jemalloc/jemalloc.h.in"
508cfgoutputs_in="${cfgoutputs_in} ${srcroot}include/jemalloc/internal/jemalloc_internal.h.in"
Jason Evans9f3b0a72010-10-07 09:53:26 -0700509cfgoutputs_in="${cfgoutputs_in} ${srcroot}test/jemalloc_test.h.in"
Jason Evansb0fd5012010-01-17 01:49:20 -0800510
Jason Evansaee7fd22010-11-24 22:00:02 -0800511cfgoutputs_out="Makefile"
512cfgoutputs_out="${cfgoutputs_out} doc/html.xsl"
513cfgoutputs_out="${cfgoutputs_out} doc/manpages.xsl"
514cfgoutputs_out="${cfgoutputs_out} doc/jemalloc${install_suffix}.xml"
Jason Evans376b1522010-02-11 14:45:59 -0800515cfgoutputs_out="${cfgoutputs_out} include/jemalloc/jemalloc${install_suffix}.h"
516cfgoutputs_out="${cfgoutputs_out} include/jemalloc/internal/jemalloc_internal.h"
Jason Evans9f3b0a72010-10-07 09:53:26 -0700517cfgoutputs_out="${cfgoutputs_out} test/jemalloc_test.h"
Jason Evansb0fd5012010-01-17 01:49:20 -0800518
Jason Evansaee7fd22010-11-24 22:00:02 -0800519cfgoutputs_tup="Makefile"
520cfgoutputs_tup="${cfgoutputs_tup} doc/html.xsl:doc/html.xsl.in"
521cfgoutputs_tup="${cfgoutputs_tup} doc/manpages.xsl:doc/manpages.xsl.in"
522cfgoutputs_tup="${cfgoutputs_tup} doc/jemalloc${install_suffix}.xml:doc/jemalloc.xml.in"
Jason Evans376b1522010-02-11 14:45:59 -0800523cfgoutputs_tup="${cfgoutputs_tup} include/jemalloc/jemalloc${install_suffix}.h:include/jemalloc/jemalloc.h.in"
524cfgoutputs_tup="${cfgoutputs_tup} include/jemalloc/internal/jemalloc_internal.h"
Jason Evans9f3b0a72010-10-07 09:53:26 -0700525cfgoutputs_tup="${cfgoutputs_tup} test/jemalloc_test.h:test/jemalloc_test.h.in"
Jason Evansb0fd5012010-01-17 01:49:20 -0800526
Jason Evans0656ec02010-04-07 23:37:35 -0700527cfghdrs_in="${srcroot}include/jemalloc/jemalloc_defs.h.in"
Jason Evansb1726102012-02-28 16:50:47 -0800528cfghdrs_in="${cfghdrs_in} ${srcroot}include/jemalloc/internal/size_classes.sh"
Jason Evansb0fd5012010-01-17 01:49:20 -0800529
Jason Evans376b1522010-02-11 14:45:59 -0800530cfghdrs_out="include/jemalloc/jemalloc_defs${install_suffix}.h"
Jason Evansb1726102012-02-28 16:50:47 -0800531cfghdrs_out="${cfghdrs_out} include/jemalloc/internal/size_classes.h"
Jason Evansb0fd5012010-01-17 01:49:20 -0800532
Jason Evans376b1522010-02-11 14:45:59 -0800533cfghdrs_tup="include/jemalloc/jemalloc_defs${install_suffix}.h:include/jemalloc/jemalloc_defs.h.in"
Jason Evansb0fd5012010-01-17 01:49:20 -0800534
Jason Evans355b4382010-09-20 19:20:48 -0700535dnl Do not silence irrelevant compiler warnings by default, since enabling this
536dnl option incurs a performance penalty.
537AC_ARG_ENABLE([cc-silence],
538 [AS_HELP_STRING([--enable-cc-silence],
539 [Silence irrelevant compiler warnings])],
540[if test "x$enable_cc_silence" = "xno" ; then
541 enable_cc_silence="0"
542else
543 enable_cc_silence="1"
544fi
545],
546[enable_cc_silence="0"]
547)
548if test "x$enable_cc_silence" = "x1" ; then
Jason Evanse24c7af2012-03-19 10:21:17 -0700549 AC_DEFINE([JEMALLOC_CC_SILENCE], [ ])
Jason Evans355b4382010-09-20 19:20:48 -0700550fi
551
Jason Evansb7924f52009-06-23 19:01:18 -0700552dnl Do not compile with debugging by default.
553AC_ARG_ENABLE([debug],
554 [AS_HELP_STRING([--enable-debug], [Build debugging code])],
555[if test "x$enable_debug" = "xno" ; then
556 enable_debug="0"
557else
558 enable_debug="1"
559fi
560],
561[enable_debug="0"]
562)
563if test "x$enable_debug" = "x1" ; then
564 AC_DEFINE([JEMALLOC_DEBUG], [ ])
Jason Evans2dbecf12010-09-05 10:35:13 -0700565 AC_DEFINE([JEMALLOC_IVSALLOC], [ ])
Jason Evansb7924f52009-06-23 19:01:18 -0700566fi
567AC_SUBST([enable_debug])
568
569dnl Only optimize if not debugging.
570if test "x$enable_debug" = "x0" -a "x$no_CFLAGS" = "xyes" ; then
571 dnl Make sure that an optimization flag was not specified in EXTRA_CFLAGS.
Jason Evansf3340ca2009-06-30 16:17:05 -0700572 optimize="no"
573 echo "$EXTRA_CFLAGS" | grep "\-O" >/dev/null || optimize="yes"
574 if test "x${optimize}" = "xyes" ; then
575 if test "x$GCC" = "xyes" ; then
576 JE_CFLAGS_APPEND([-O3])
577 JE_CFLAGS_APPEND([-funroll-loops])
Mike Hommeyfd97b1d2012-04-30 12:38:31 +0200578 elif test "x$je_cv_msvc" = "xyes" ; then
579 JE_CFLAGS_APPEND([-O2])
Jason Evansf3340ca2009-06-30 16:17:05 -0700580 else
581 JE_CFLAGS_APPEND([-O])
582 fi
Jason Evansb7924f52009-06-23 19:01:18 -0700583 fi
584fi
585
Jason Evansd073a322012-02-28 20:41:16 -0800586dnl Enable statistics calculation by default.
Jason Evansb7924f52009-06-23 19:01:18 -0700587AC_ARG_ENABLE([stats],
Jason Evans777c1912012-02-28 20:49:22 -0800588 [AS_HELP_STRING([--disable-stats],
589 [Disable statistics calculation/reporting])],
Jason Evansb7924f52009-06-23 19:01:18 -0700590[if test "x$enable_stats" = "xno" ; then
591 enable_stats="0"
592else
593 enable_stats="1"
594fi
595],
Jason Evansd073a322012-02-28 20:41:16 -0800596[enable_stats="1"]
Jason Evansb7924f52009-06-23 19:01:18 -0700597)
598if test "x$enable_stats" = "x1" ; then
599 AC_DEFINE([JEMALLOC_STATS], [ ])
600fi
601AC_SUBST([enable_stats])
602
Jason Evans6109fe02010-02-10 10:37:56 -0800603dnl Do not enable profiling by default.
604AC_ARG_ENABLE([prof],
605 [AS_HELP_STRING([--enable-prof], [Enable allocation profiling])],
606[if test "x$enable_prof" = "xno" ; then
607 enable_prof="0"
608else
609 enable_prof="1"
610fi
611],
612[enable_prof="0"]
613)
Jason Evans77f350b2011-03-15 22:23:12 -0700614if test "x$enable_prof" = "x1" ; then
615 backtrace_method=""
Jason Evansb27805b2010-02-10 18:15:53 -0800616else
Jason Evans77f350b2011-03-15 22:23:12 -0700617 backtrace_method="N/A"
Jason Evansb27805b2010-02-10 18:15:53 -0800618fi
Jason Evans77f350b2011-03-15 22:23:12 -0700619
Jason Evans6109fe02010-02-10 10:37:56 -0800620AC_ARG_ENABLE([prof-libunwind],
621 [AS_HELP_STRING([--enable-prof-libunwind], [Use libunwind for backtracing])],
622[if test "x$enable_prof_libunwind" = "xno" ; then
623 enable_prof_libunwind="0"
624else
625 enable_prof_libunwind="1"
626fi
627],
628[enable_prof_libunwind="0"]
629)
Jason Evansca6bd4f2010-03-02 14:12:58 -0800630AC_ARG_WITH([static_libunwind],
631 [AS_HELP_STRING([--with-static-libunwind=<libunwind.a>],
632 [Path to static libunwind library; use rather than dynamically linking])],
633if test "x$with_static_libunwind" = "xno" ; then
634 LUNWIND="-lunwind"
635else
636 if test ! -f "$with_static_libunwind" ; then
637 AC_MSG_ERROR([Static libunwind not found: $with_static_libunwind])
638 fi
639 LUNWIND="$with_static_libunwind"
640fi,
641 LUNWIND="-lunwind"
642)
Jason Evans77f350b2011-03-15 22:23:12 -0700643if test "x$backtrace_method" = "x" -a "x$enable_prof_libunwind" = "x1" ; then
644 AC_CHECK_HEADERS([libunwind.h], , [enable_prof_libunwind="0"])
645 if test "x$LUNWIND" = "x-lunwind" ; then
646 AC_CHECK_LIB([unwind], [backtrace], [LIBS="$LIBS $LUNWIND"],
647 [enable_prof_libunwind="0"])
648 else
649 LIBS="$LIBS $LUNWIND"
650 fi
651 if test "x${enable_prof_libunwind}" = "x1" ; then
652 backtrace_method="libunwind"
653 AC_DEFINE([JEMALLOC_PROF_LIBUNWIND], [ ])
654 fi
655fi
656
657AC_ARG_ENABLE([prof-libgcc],
658 [AS_HELP_STRING([--disable-prof-libgcc],
659 [Do not use libgcc for backtracing])],
660[if test "x$enable_prof_libgcc" = "xno" ; then
661 enable_prof_libgcc="0"
662else
663 enable_prof_libgcc="1"
664fi
665],
666[enable_prof_libgcc="1"]
667)
668if test "x$backtrace_method" = "x" -a "x$enable_prof_libgcc" = "x1" \
669 -a "x$GCC" = "xyes" ; then
670 AC_CHECK_HEADERS([unwind.h], , [enable_prof_libgcc="0"])
671 AC_CHECK_LIB([gcc], [_Unwind_Backtrace], [LIBS="$LIBS -lgcc"], [enable_prof_libgcc="0"])
672 dnl The following is conservative, in that it only has entries for CPUs on
673 dnl which jemalloc has been tested.
674 AC_MSG_CHECKING([libgcc-based backtracing reliability on ${host_cpu}])
675 case "${host_cpu}" in
676 i[[3456]]86)
677 AC_MSG_RESULT([unreliable])
678 enable_prof_libgcc="0";
679 ;;
680 x86_64)
681 AC_MSG_RESULT([reliable])
682 ;;
683 *)
684 AC_MSG_RESULT([unreliable])
685 enable_prof_libgcc="0";
686 ;;
687 esac
688 if test "x${enable_prof_libgcc}" = "x1" ; then
689 backtrace_method="libgcc"
690 AC_DEFINE([JEMALLOC_PROF_LIBGCC], [ ])
691 fi
692else
693 enable_prof_libgcc="0"
694fi
695
696AC_ARG_ENABLE([prof-gcc],
697 [AS_HELP_STRING([--disable-prof-gcc],
698 [Do not use gcc intrinsics for backtracing])],
699[if test "x$enable_prof_gcc" = "xno" ; then
700 enable_prof_gcc="0"
701else
702 enable_prof_gcc="1"
703fi
704],
705[enable_prof_gcc="1"]
706)
707if test "x$backtrace_method" = "x" -a "x$enable_prof_gcc" = "x1" \
708 -a "x$GCC" = "xyes" ; then
709 backtrace_method="gcc intrinsics"
710 AC_DEFINE([JEMALLOC_PROF_GCC], [ ])
711else
712 enable_prof_gcc="0"
713fi
714
715if test "x$backtrace_method" = "x" ; then
716 backtrace_method="none (disabling profiling)"
717 enable_prof="0"
718fi
719AC_MSG_CHECKING([configured backtracing method])
720AC_MSG_RESULT([$backtrace_method])
Jason Evans2dbecf12010-09-05 10:35:13 -0700721if test "x$enable_prof" = "x1" ; then
Jason Evans6716aa82012-04-23 13:04:55 -0700722 if test "x${force_tls}" = "x0" ; then
723 AC_MSG_ERROR([Heap profiling requires TLS]);
724 fi
725 force_tls="1"
Jason Evans2dbecf12010-09-05 10:35:13 -0700726 AC_DEFINE([JEMALLOC_PROF], [ ])
Jason Evans2dbecf12010-09-05 10:35:13 -0700727fi
728AC_SUBST([enable_prof])
Jason Evans2dbecf12010-09-05 10:35:13 -0700729
Jason Evans84cbbcb2009-12-29 00:09:15 -0800730dnl Enable thread-specific caching by default.
731AC_ARG_ENABLE([tcache],
732 [AS_HELP_STRING([--disable-tcache], [Disable per thread caches])],
733[if test "x$enable_tcache" = "xno" ; then
734 enable_tcache="0"
Jason Evansb7924f52009-06-23 19:01:18 -0700735else
Jason Evans84cbbcb2009-12-29 00:09:15 -0800736 enable_tcache="1"
Jason Evansb7924f52009-06-23 19:01:18 -0700737fi
738],
Jason Evans84cbbcb2009-12-29 00:09:15 -0800739[enable_tcache="1"]
Jason Evansb7924f52009-06-23 19:01:18 -0700740)
Jason Evans2dbecf12010-09-05 10:35:13 -0700741if test "x$enable_tcache" = "x1" ; then
742 AC_DEFINE([JEMALLOC_TCACHE], [ ])
743fi
744AC_SUBST([enable_tcache])
Jason Evansb7924f52009-06-23 19:01:18 -0700745
Jason Evans2e671ff2012-05-09 16:12:00 -0700746dnl Disable mremap() for huge realloc() by default.
747AC_ARG_ENABLE([mremap],
748 [AS_HELP_STRING([--enable-mremap], [Enable mremap(2) for huge realloc()])],
749[if test "x$enable_mremap" = "xno" ; then
750 enable_mremap="0"
751else
752 enable_mremap="1"
753fi
754],
755[enable_mremap="0"]
756)
757if test "x$enable_mremap" = "x1" ; then
758 JE_COMPILABLE([mremap(...MREMAP_FIXED...)], [
759#define _GNU_SOURCE
760#include <sys/mman.h>
761], [
762void *p = mremap((void *)0, 0, 0, MREMAP_MAYMOVE|MREMAP_FIXED, (void *)0);
763], [je_cv_mremap_fixed])
764 if test "x${je_cv_mremap_fixed}" = "xno" ; then
765 enable_mremap="0"
766 fi
767fi
768if test "x$enable_mremap" = "x1" ; then
769 AC_DEFINE([JEMALLOC_MREMAP], [ ])
770fi
771AC_SUBST([enable_mremap])
772
Jason Evans59ae2762012-04-16 17:52:27 -0700773dnl Enable VM deallocation via munmap() by default.
774AC_ARG_ENABLE([munmap],
775 [AS_HELP_STRING([--disable-munmap], [Disable VM deallocation via munmap(2)])],
776[if test "x$enable_munmap" = "xno" ; then
777 enable_munmap="0"
778else
779 enable_munmap="1"
780fi
781],
782[enable_munmap="${default_munmap}"]
783)
784if test "x$enable_munmap" = "x1" ; then
785 AC_DEFINE([JEMALLOC_MUNMAP], [ ])
786fi
787AC_SUBST([enable_munmap])
788
Jason Evansb7924f52009-06-23 19:01:18 -0700789dnl Do not enable allocation from DSS by default.
790AC_ARG_ENABLE([dss],
791 [AS_HELP_STRING([--enable-dss], [Enable allocation from DSS])],
792[if test "x$enable_dss" = "xno" ; then
793 enable_dss="0"
794else
795 enable_dss="1"
796fi
797],
798[enable_dss="0"]
799)
Mike Hommey83c324a2012-04-12 10:13:03 +0200800dnl Check whether the BSD/SUSv1 sbrk() exists. If not, disable DSS support.
801AC_CHECK_FUNC([sbrk], [have_sbrk="1"], [have_sbrk="0"])
802if test "x$have_sbrk" = "x1" ; then
803 AC_DEFINE([JEMALLOC_HAVE_SBRK], [ ])
804else
805 enable_dss="0"
806fi
807
Jason Evansb7924f52009-06-23 19:01:18 -0700808if test "x$enable_dss" = "x1" ; then
809 AC_DEFINE([JEMALLOC_DSS], [ ])
810fi
811AC_SUBST([enable_dss])
812
Jason Evans777c1912012-02-28 20:49:22 -0800813dnl Support the junk/zero filling option by default.
Jason Evansb7924f52009-06-23 19:01:18 -0700814AC_ARG_ENABLE([fill],
Jason Evans122449b2012-04-06 00:35:09 -0700815 [AS_HELP_STRING([--disable-fill],
816 [Disable support for junk/zero filling, quarantine, and redzones])],
Jason Evansb7924f52009-06-23 19:01:18 -0700817[if test "x$enable_fill" = "xno" ; then
818 enable_fill="0"
819else
820 enable_fill="1"
821fi
822],
Jason Evans777c1912012-02-28 20:49:22 -0800823[enable_fill="1"]
Jason Evansb7924f52009-06-23 19:01:18 -0700824)
825if test "x$enable_fill" = "x1" ; then
826 AC_DEFINE([JEMALLOC_FILL], [ ])
827fi
828AC_SUBST([enable_fill])
829
Jason Evansb1476112012-04-05 13:36:17 -0700830dnl Disable utrace(2)-based tracing by default.
831AC_ARG_ENABLE([utrace],
832 [AS_HELP_STRING([--enable-utrace], [Enable utrace(2)-based tracing])],
833[if test "x$enable_utrace" = "xno" ; then
834 enable_utrace="0"
835else
836 enable_utrace="1"
837fi
838],
839[enable_utrace="0"]
840)
841JE_COMPILABLE([utrace(2)], [
842#include <sys/types.h>
843#include <sys/param.h>
844#include <sys/time.h>
845#include <sys/uio.h>
846#include <sys/ktrace.h>
847], [
848 utrace((void *)0, 0);
849], [je_cv_utrace])
850if test "x${je_cv_utrace}" = "xno" ; then
851 enable_utrace="0"
852fi
853if test "x$enable_utrace" = "x1" ; then
854 AC_DEFINE([JEMALLOC_UTRACE], [ ])
855fi
856AC_SUBST([enable_utrace])
857
Jason Evans122449b2012-04-06 00:35:09 -0700858dnl Support Valgrind by default.
859AC_ARG_ENABLE([valgrind],
860 [AS_HELP_STRING([--disable-valgrind], [Disable support for Valgrind])],
861[if test "x$enable_valgrind" = "xno" ; then
862 enable_valgrind="0"
863else
864 enable_valgrind="1"
865fi
866],
867[enable_valgrind="1"]
868)
869if test "x$enable_valgrind" = "x1" ; then
870 JE_COMPILABLE([valgrind], [
871#include <valgrind/valgrind.h>
872#include <valgrind/memcheck.h>
873
Mike Hommey7bfecf42012-04-30 15:15:15 +0200874#if !defined(VALGRIND_RESIZEINPLACE_BLOCK)
Jason Evans122449b2012-04-06 00:35:09 -0700875# error "Incompatible Valgrind version"
876#endif
877], [], [je_cv_valgrind])
878 if test "x${je_cv_valgrind}" = "xno" ; then
879 enable_valgrind="0"
880 fi
881 if test "x$enable_valgrind" = "x1" ; then
882 AC_DEFINE([JEMALLOC_VALGRIND], [ ])
883 fi
884fi
885AC_SUBST([enable_valgrind])
886
Jason Evansb7924f52009-06-23 19:01:18 -0700887dnl Do not support the xmalloc option by default.
888AC_ARG_ENABLE([xmalloc],
889 [AS_HELP_STRING([--enable-xmalloc], [Support xmalloc option])],
890[if test "x$enable_xmalloc" = "xno" ; then
891 enable_xmalloc="0"
892else
893 enable_xmalloc="1"
894fi
895],
896[enable_xmalloc="0"]
897)
898if test "x$enable_xmalloc" = "x1" ; then
899 AC_DEFINE([JEMALLOC_XMALLOC], [ ])
900fi
901AC_SUBST([enable_xmalloc])
902
Jason Evans6684cac2012-03-05 12:15:36 -0800903AC_CACHE_CHECK([STATIC_PAGE_SHIFT],
904 [je_cv_static_page_shift],
905 AC_RUN_IFELSE([AC_LANG_PROGRAM(
Mike Hommeya19e87f2012-04-21 21:27:46 -0700906[[
Mike Hommeyfd97b1d2012-04-30 12:38:31 +0200907#include <strings.h>
Mike Hommeya19e87f2012-04-21 21:27:46 -0700908#ifdef _WIN32
909#include <windows.h>
910#else
Jason Evansb7924f52009-06-23 19:01:18 -0700911#include <unistd.h>
Mike Hommeya19e87f2012-04-21 21:27:46 -0700912#endif
913#include <stdio.h>
Jason Evans6684cac2012-03-05 12:15:36 -0800914]],
915[[
Jason Evansb7924f52009-06-23 19:01:18 -0700916 long result;
917 FILE *f;
918
Mike Hommeya19e87f2012-04-21 21:27:46 -0700919#ifdef _WIN32
920 SYSTEM_INFO si;
921 GetSystemInfo(&si);
922 result = si.dwPageSize;
923#else
Jason Evansb7924f52009-06-23 19:01:18 -0700924 result = sysconf(_SC_PAGESIZE);
Mike Hommeya19e87f2012-04-21 21:27:46 -0700925#endif
Jason Evansb7924f52009-06-23 19:01:18 -0700926 if (result == -1) {
927 return 1;
928 }
Mike Hommeya19e87f2012-04-21 21:27:46 -0700929 result = ffsl(result) - 1;
930
Jason Evansb7924f52009-06-23 19:01:18 -0700931 f = fopen("conftest.out", "w");
932 if (f == NULL) {
933 return 1;
934 }
Mike Hommeya19e87f2012-04-21 21:27:46 -0700935 fprintf(f, "%u\n", result);
Jason Evans3cc1f1a2012-04-03 22:30:05 -0700936 fclose(f);
Jason Evansb7924f52009-06-23 19:01:18 -0700937
938 return 0;
939]])],
Jason Evans6684cac2012-03-05 12:15:36 -0800940 [je_cv_static_page_shift=`cat conftest.out`],
941 [je_cv_static_page_shift=undefined]))
942
943if test "x$je_cv_static_page_shift" != "xundefined"; then
944 AC_DEFINE_UNQUOTED([STATIC_PAGE_SHIFT], [$je_cv_static_page_shift])
945else
946 AC_MSG_ERROR([cannot determine value for STATIC_PAGE_SHIFT])
947fi
Jason Evansb7924f52009-06-23 19:01:18 -0700948
949dnl ============================================================================
950dnl jemalloc configuration.
951dnl
Jason Evansa40bc7a2010-03-02 13:01:16 -0800952
953dnl Set VERSION if source directory has an embedded git repository.
Jason Evans955851f2011-03-31 22:38:51 -0700954if test -d "${srcroot}.git" ; then
Jason Evans79d660d2010-09-17 17:38:24 -0700955 git describe --long --abbrev=40 > ${srcroot}VERSION
Jason Evansa40bc7a2010-03-02 13:01:16 -0800956fi
Jason Evansb7924f52009-06-23 19:01:18 -0700957jemalloc_version=`cat ${srcroot}VERSION`
Jason Evansa40bc7a2010-03-02 13:01:16 -0800958jemalloc_version_major=`echo ${jemalloc_version} | tr ".g-" " " | awk '{print [$]1}'`
959jemalloc_version_minor=`echo ${jemalloc_version} | tr ".g-" " " | awk '{print [$]2}'`
960jemalloc_version_bugfix=`echo ${jemalloc_version} | tr ".g-" " " | awk '{print [$]3}'`
961jemalloc_version_nrev=`echo ${jemalloc_version} | tr ".g-" " " | awk '{print [$]4}'`
962jemalloc_version_gid=`echo ${jemalloc_version} | tr ".g-" " " | awk '{print [$]5}'`
Jason Evansb7924f52009-06-23 19:01:18 -0700963AC_SUBST([jemalloc_version])
Jason Evansa40bc7a2010-03-02 13:01:16 -0800964AC_SUBST([jemalloc_version_major])
965AC_SUBST([jemalloc_version_minor])
966AC_SUBST([jemalloc_version_bugfix])
967AC_SUBST([jemalloc_version_nrev])
968AC_SUBST([jemalloc_version_gid])
Jason Evansb7924f52009-06-23 19:01:18 -0700969
970dnl ============================================================================
971dnl Configure pthreads.
972
Mike Hommeya19e87f2012-04-21 21:27:46 -0700973if test "x$abi" != "xpecoff" ; then
974 AC_CHECK_HEADERS([pthread.h], , [AC_MSG_ERROR([pthread.h is missing])])
975 dnl Some systems may embed pthreads functionality in libc; check for libpthread
976 dnl first, but try libc too before failing.
977 AC_CHECK_LIB([pthread], [pthread_create], [LIBS="$LIBS -lpthread"],
978 [AC_SEARCH_LIBS([pthread_create], , ,
979 AC_MSG_ERROR([libpthread is missing]))])
980fi
Jason Evansb7924f52009-06-23 19:01:18 -0700981
982CPPFLAGS="$CPPFLAGS -D_REENTRANT"
983
Jason Evanscd9a1342012-03-21 18:33:03 -0700984dnl Check whether the BSD-specific _malloc_thread_cleanup() exists. If so, use
985dnl it rather than pthreads TSD cleanup functions to support cleanup during
986dnl thread exit, in order to avoid pthreads library recursion during
987dnl bootstrapping.
Jason Evanscd9a1342012-03-21 18:33:03 -0700988AC_CHECK_FUNC([_malloc_thread_cleanup],
989 [have__malloc_thread_cleanup="1"],
990 [have__malloc_thread_cleanup="0"]
991 )
992if test "x$have__malloc_thread_cleanup" = "x1" ; then
993 AC_DEFINE([JEMALLOC_MALLOC_THREAD_CLEANUP], [ ])
994 force_tls="1"
995fi
996
Jason Evans41b6afb2012-02-02 22:04:57 -0800997dnl Check whether the BSD-specific _pthread_mutex_init_calloc_cb() exists. If
998dnl so, mutex initialization causes allocation, and we need to implement this
999dnl callback function in order to prevent recursive allocation.
1000AC_CHECK_FUNC([_pthread_mutex_init_calloc_cb],
1001 [have__pthread_mutex_init_calloc_cb="1"],
1002 [have__pthread_mutex_init_calloc_cb="0"]
1003 )
1004if test "x$have__pthread_mutex_init_calloc_cb" = "x1" ; then
1005 AC_DEFINE([JEMALLOC_MUTEX_INIT_CB])
1006fi
1007
Jason Evans0fee70d2012-02-13 12:36:11 -08001008dnl Disable lazy locking by default.
Jason Evansb7924f52009-06-23 19:01:18 -07001009AC_ARG_ENABLE([lazy_lock],
Jason Evans0fee70d2012-02-13 12:36:11 -08001010 [AS_HELP_STRING([--enable-lazy-lock],
1011 [Enable lazy locking (only lock when multi-threaded)])],
Jason Evansb7924f52009-06-23 19:01:18 -07001012[if test "x$enable_lazy_lock" = "xno" ; then
1013 enable_lazy_lock="0"
1014else
1015 enable_lazy_lock="1"
1016fi
1017],
Jason Evans0fee70d2012-02-13 12:36:11 -08001018[enable_lazy_lock="0"]
Jason Evansb7924f52009-06-23 19:01:18 -07001019)
Jason Evansfd4fcef2012-03-23 17:40:58 -07001020if test "x$enable_lazy_lock" = "x0" -a "x${force_lazy_lock}" = "x1" ; then
1021 AC_MSG_RESULT([Forcing lazy-lock to avoid allocator/threading bootstrap issues])
1022 enable_lazy_lock="1"
1023fi
Jason Evansb7924f52009-06-23 19:01:18 -07001024if test "x$enable_lazy_lock" = "x1" ; then
Mike Hommeya19e87f2012-04-21 21:27:46 -07001025 if test "x$abi" != "xpecoff" ; then
1026 AC_CHECK_HEADERS([dlfcn.h], , [AC_MSG_ERROR([dlfcn.h is missing])])
1027 AC_CHECK_FUNC([dlsym], [],
1028 [AC_CHECK_LIB([dl], [dlsym], [LIBS="$LIBS -ldl"],
1029 [AC_MSG_ERROR([libdl is missing])])
1030 ])
1031 fi
Jason Evansb7924f52009-06-23 19:01:18 -07001032 AC_DEFINE([JEMALLOC_LAZY_LOCK], [ ])
1033fi
1034AC_SUBST([enable_lazy_lock])
1035
Jason Evans78d815c2010-01-17 14:06:20 -08001036AC_ARG_ENABLE([tls],
1037 [AS_HELP_STRING([--disable-tls], [Disable thread-local storage (__thread keyword)])],
1038if test "x$enable_tls" = "xno" ; then
1039 enable_tls="0"
1040else
1041 enable_tls="1"
1042fi
1043,
1044enable_tls="1"
1045)
Jason Evanscd9a1342012-03-21 18:33:03 -07001046if test "x${enable_tls}" = "x0" -a "x${force_tls}" = "x1" ; then
1047 AC_MSG_RESULT([Forcing TLS to avoid allocator/threading bootstrap issues])
1048 enable_tls="1"
1049fi
Jason Evansb80581d2012-03-23 16:17:43 -07001050if test "x${enable_tls}" = "x1" -a "x${force_tls}" = "x0" ; then
1051 AC_MSG_RESULT([Forcing no TLS to avoid allocator/threading bootstrap issues])
1052 enable_tls="0"
1053fi
Jason Evans78d815c2010-01-17 14:06:20 -08001054if test "x${enable_tls}" = "x1" ; then
1055AC_MSG_CHECKING([for TLS])
Jason Evans6684cac2012-03-05 12:15:36 -08001056AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
Jason Evans78d815c2010-01-17 14:06:20 -08001057[[
1058 __thread int x;
1059]], [[
1060 x = 42;
1061
1062 return 0;
1063]])],
1064 AC_MSG_RESULT([yes]),
1065 AC_MSG_RESULT([no])
1066 enable_tls="0")
1067fi
Jason Evansb267d0f2010-08-13 15:42:29 -07001068AC_SUBST([enable_tls])
Jason Evanse24c7af2012-03-19 10:21:17 -07001069if test "x${enable_tls}" = "x1" ; then
1070 AC_DEFINE_UNQUOTED([JEMALLOC_TLS], [ ])
Jason Evanscd9a1342012-03-21 18:33:03 -07001071elif test "x${force_tls}" = "x1" ; then
1072 AC_MSG_ERROR([Failed to configure TLS, which is mandatory for correct function])
Jason Evans78d815c2010-01-17 14:06:20 -08001073fi
1074
Jason Evans2dbecf12010-09-05 10:35:13 -07001075dnl ============================================================================
Jason Evans84c8eef2011-03-16 10:30:13 -07001076dnl Check for ffsl(3), and fail if not found. This function exists on all
1077dnl platforms that jemalloc currently has a chance of functioning on without
1078dnl modification.
Jason Evans4c2faa82012-03-13 11:09:23 -07001079JE_COMPILABLE([a program using ffsl], [
Jason Evans382132e2012-04-04 15:25:43 -07001080#include <strings.h>
Jason Evans4c2faa82012-03-13 11:09:23 -07001081#include <string.h>
1082], [
1083 {
1084 int rv = ffsl(0x08);
1085 }
1086], [je_cv_function_ffsl])
Jason Evans6684cac2012-03-05 12:15:36 -08001087if test "x${je_cv_function_ffsl}" != "xyes" ; then
1088 AC_MSG_ERROR([Cannot build without ffsl(3)])
1089fi
Jason Evans84c8eef2011-03-16 10:30:13 -07001090
1091dnl ============================================================================
Jason Evansb57d3ec2012-04-17 13:17:54 -07001092dnl Check for atomic(9) operations as provided on FreeBSD.
1093
1094JE_COMPILABLE([atomic(9)], [
1095#include <sys/types.h>
1096#include <machine/atomic.h>
1097#include <inttypes.h>
1098], [
1099 {
1100 uint32_t x32 = 0;
1101 volatile uint32_t *x32p = &x32;
1102 atomic_fetchadd_32(x32p, 1);
1103 }
1104 {
1105 unsigned long xlong = 0;
1106 volatile unsigned long *xlongp = &xlong;
1107 atomic_fetchadd_long(xlongp, 1);
1108 }
1109], [je_cv_atomic9])
1110if test "x${je_cv_atomic9}" = "xyes" ; then
1111 AC_DEFINE([JEMALLOC_ATOMIC9])
1112fi
1113
1114dnl ============================================================================
Jason Evans763baa62011-03-18 19:10:31 -07001115dnl Check for atomic(3) operations as provided on Darwin.
1116
1117JE_COMPILABLE([Darwin OSAtomic*()], [
1118#include <libkern/OSAtomic.h>
1119#include <inttypes.h>
1120], [
1121 {
1122 int32_t x32 = 0;
1123 volatile int32_t *x32p = &x32;
1124 OSAtomicAdd32(1, x32p);
1125 }
1126 {
1127 int64_t x64 = 0;
1128 volatile int64_t *x64p = &x64;
1129 OSAtomicAdd64(1, x64p);
1130 }
Jason Evans6684cac2012-03-05 12:15:36 -08001131], [je_cv_osatomic])
1132if test "x${je_cv_osatomic}" = "xyes" ; then
Jason Evanse24c7af2012-03-19 10:21:17 -07001133 AC_DEFINE([JEMALLOC_OSATOMIC], [ ])
Jason Evans763baa62011-03-18 19:10:31 -07001134fi
1135
1136dnl ============================================================================
Mike Hommeyc1e567b2012-03-26 17:03:41 +02001137dnl Check whether __sync_{add,sub}_and_fetch() are available despite
1138dnl __GCC_HAVE_SYNC_COMPARE_AND_SWAP_n macros being undefined.
1139
1140AC_DEFUN([JE_SYNC_COMPARE_AND_SWAP_CHECK],[
1141 AC_CACHE_CHECK([whether to force $1-bit __sync_{add,sub}_and_fetch()],
1142 [je_cv_sync_compare_and_swap_$2],
Mike Hommey2cfe6d62012-03-27 15:03:07 +02001143 [AC_LINK_IFELSE([AC_LANG_PROGRAM([
1144 #include <stdint.h>
1145 ],
1146 [
1147 #ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_$2
1148 {
1149 uint$1_t x$1 = 0;
1150 __sync_add_and_fetch(&x$1, 42);
1151 __sync_sub_and_fetch(&x$1, 1);
1152 }
1153 #else
1154 #error __GCC_HAVE_SYNC_COMPARE_AND_SWAP_$2 is defined, no need to force
1155 #endif
1156 ])],
Mike Hommeyc1e567b2012-03-26 17:03:41 +02001157 [je_cv_sync_compare_and_swap_$2=yes],
1158 [je_cv_sync_compare_and_swap_$2=no])])
1159
1160 if test "x${je_cv_sync_compare_and_swap_$2}" = "xyes" ; then
1161 AC_DEFINE([JE_FORCE_SYNC_COMPARE_AND_SWAP_$2], [ ])
1162 fi
1163])
1164
Jason Evansb57d3ec2012-04-17 13:17:54 -07001165if test "x${je_cv_atomic9}" != "xyes" -a "x${je_cv_osatomic}" != "xyes" ; then
Mike Hommeyc1e567b2012-03-26 17:03:41 +02001166 JE_SYNC_COMPARE_AND_SWAP_CHECK(32, 4)
1167 JE_SYNC_COMPARE_AND_SWAP_CHECK(64, 8)
1168fi
1169
1170dnl ============================================================================
Jason Evans893a0ed2011-03-18 19:30:18 -07001171dnl Check for spinlock(3) operations as provided on Darwin.
1172
1173JE_COMPILABLE([Darwin OSSpin*()], [
1174#include <libkern/OSAtomic.h>
1175#include <inttypes.h>
1176], [
1177 OSSpinLock lock = 0;
1178 OSSpinLockLock(&lock);
1179 OSSpinLockUnlock(&lock);
Jason Evans6684cac2012-03-05 12:15:36 -08001180], [je_cv_osspin])
1181if test "x${je_cv_osspin}" = "xyes" ; then
Jason Evanse24c7af2012-03-19 10:21:17 -07001182 AC_DEFINE([JEMALLOC_OSSPIN], [ ])
Jason Evans893a0ed2011-03-18 19:30:18 -07001183fi
1184
1185dnl ============================================================================
Jason Evans2dbecf12010-09-05 10:35:13 -07001186dnl Darwin-related configuration.
Jason Evans78d815c2010-01-17 14:06:20 -08001187
Mike Hommeyd0357f72012-11-26 18:52:41 +01001188AC_ARG_ENABLE([zone-allocator],
1189 [AS_HELP_STRING([--disable-zone-allocator],
1190 [Disable zone allocator for Darwin])],
1191[if test "x$enable_zone_allocator" = "xno" ; then
1192 enable_zone_allocator="0"
1193else
1194 enable_zone_allocator="1"
1195fi
1196],
1197[if test "x${abi}" = "xmacho"; then
1198 enable_zone_allocator="1"
1199fi
1200]
1201)
1202AC_SUBST([enable_zone_allocator])
1203
1204if test "x${enable_zone_allocator}" = "x1" ; then
1205 if test "x${abi}" != "xmacho"; then
1206 AC_MSG_ERROR([--enable-zone-allocator is only supported on Darwin])
1207 fi
Jason Evanse24c7af2012-03-19 10:21:17 -07001208 AC_DEFINE([JEMALLOC_IVSALLOC], [ ])
1209 AC_DEFINE([JEMALLOC_ZONE], [ ])
Jason Evans6109fe02010-02-10 10:37:56 -08001210
Jason Evans2dbecf12010-09-05 10:35:13 -07001211 dnl The szone version jumped from 3 to 6 between the OS X 10.5.x and 10.6
1212 dnl releases. malloc_zone_t and malloc_introspection_t have new fields in
1213 dnl 10.6, which is the only source-level indication of the change.
1214 AC_MSG_CHECKING([malloc zone version])
Mike Hommey154829d2012-03-20 18:01:38 +01001215 AC_DEFUN([JE_ZONE_PROGRAM],
1216 [AC_LANG_PROGRAM(
1217 [#include <malloc/malloc.h>],
1218 [static foo[[sizeof($1) $2 sizeof(void *) * $3 ? 1 : -1]]]
1219 )])
Jason Evans2dbecf12010-09-05 10:35:13 -07001220
Mike Hommey154829d2012-03-20 18:01:38 +01001221 AC_COMPILE_IFELSE([JE_ZONE_PROGRAM(malloc_zone_t,==,14)],[JEMALLOC_ZONE_VERSION=3],[
1222 AC_COMPILE_IFELSE([JE_ZONE_PROGRAM(malloc_zone_t,==,15)],[JEMALLOC_ZONE_VERSION=5],[
1223 AC_COMPILE_IFELSE([JE_ZONE_PROGRAM(malloc_zone_t,==,16)],[
1224 AC_COMPILE_IFELSE([JE_ZONE_PROGRAM(malloc_introspection_t,==,9)],[JEMALLOC_ZONE_VERSION=6],[
1225 AC_COMPILE_IFELSE([JE_ZONE_PROGRAM(malloc_introspection_t,==,13)],[JEMALLOC_ZONE_VERSION=7],[JEMALLOC_ZONE_VERSION=]
1226 )])],[
1227 AC_COMPILE_IFELSE([JE_ZONE_PROGRAM(malloc_zone_t,==,17)],[JEMALLOC_ZONE_VERSION=8],[
1228 AC_COMPILE_IFELSE([JE_ZONE_PROGRAM(malloc_zone_t,>,17)],[JEMALLOC_ZONE_VERSION=9],[JEMALLOC_ZONE_VERSION=]
1229 )])])])])
1230 if test "x${JEMALLOC_ZONE_VERSION}" = "x"; then
1231 AC_MSG_RESULT([unsupported])
1232 AC_MSG_ERROR([Unsupported malloc zone version])
1233 fi
1234 if test "${JEMALLOC_ZONE_VERSION}" = 9; then
1235 JEMALLOC_ZONE_VERSION=8
1236 AC_MSG_RESULT([> 8])
1237 else
1238 AC_MSG_RESULT([$JEMALLOC_ZONE_VERSION])
1239 fi
1240 AC_DEFINE_UNQUOTED(JEMALLOC_ZONE_VERSION, [$JEMALLOC_ZONE_VERSION])
Jason Evansb27805b2010-02-10 18:15:53 -08001241fi
1242
Jason Evansb7924f52009-06-23 19:01:18 -07001243dnl ============================================================================
1244dnl Check for typedefs, structures, and compiler characteristics.
1245AC_HEADER_STDBOOL
1246
Jason Evansb1726102012-02-28 16:50:47 -08001247AC_CONFIG_COMMANDS([include/jemalloc/internal/size_classes.h], [
1248 mkdir -p "include/jemalloc/internal"
1249 "${srcdir}/include/jemalloc/internal/size_classes.sh" > "${objroot}include/jemalloc/internal/size_classes.h"
1250])
1251
Jason Evansb7924f52009-06-23 19:01:18 -07001252dnl Process .in files.
Jason Evansb0fd5012010-01-17 01:49:20 -08001253AC_SUBST([cfghdrs_in])
1254AC_SUBST([cfghdrs_out])
Jason Evans0656ec02010-04-07 23:37:35 -07001255AC_CONFIG_HEADERS([$cfghdrs_tup])
Jason Evansb7924f52009-06-23 19:01:18 -07001256
1257dnl ============================================================================
1258dnl Generate outputs.
Antony Dovgal2bd3cbc2011-10-13 09:33:33 +04001259AC_CONFIG_FILES([$cfgoutputs_tup config.stamp bin/jemalloc.sh])
Jason Evansb0fd5012010-01-17 01:49:20 -08001260AC_SUBST([cfgoutputs_in])
1261AC_SUBST([cfgoutputs_out])
Jason Evansb7924f52009-06-23 19:01:18 -07001262AC_OUTPUT
1263
1264dnl ============================================================================
1265dnl Print out the results of configuration.
1266AC_MSG_RESULT([===============================================================================])
Jason Evansf576c632011-11-01 22:27:41 -07001267AC_MSG_RESULT([jemalloc version : ${jemalloc_version}])
1268AC_MSG_RESULT([library revision : ${rev}])
Jason Evansb7924f52009-06-23 19:01:18 -07001269AC_MSG_RESULT([])
1270AC_MSG_RESULT([CC : ${CC}])
1271AC_MSG_RESULT([CPPFLAGS : ${CPPFLAGS}])
1272AC_MSG_RESULT([CFLAGS : ${CFLAGS}])
1273AC_MSG_RESULT([LDFLAGS : ${LDFLAGS}])
1274AC_MSG_RESULT([LIBS : ${LIBS}])
1275AC_MSG_RESULT([RPATH_EXTRA : ${RPATH_EXTRA}])
1276AC_MSG_RESULT([])
Jason Evansaee7fd22010-11-24 22:00:02 -08001277AC_MSG_RESULT([XSLTPROC : ${XSLTPROC}])
1278AC_MSG_RESULT([XSLROOT : ${XSLROOT}])
1279AC_MSG_RESULT([])
Jason Evansb7924f52009-06-23 19:01:18 -07001280AC_MSG_RESULT([PREFIX : ${PREFIX}])
1281AC_MSG_RESULT([BINDIR : ${BINDIR}])
Jason Evans662a0172009-07-01 19:24:31 -07001282AC_MSG_RESULT([INCLUDEDIR : ${INCLUDEDIR}])
1283AC_MSG_RESULT([LIBDIR : ${LIBDIR}])
Jason Evansb7924f52009-06-23 19:01:18 -07001284AC_MSG_RESULT([DATADIR : ${DATADIR}])
1285AC_MSG_RESULT([MANDIR : ${MANDIR}])
1286AC_MSG_RESULT([])
1287AC_MSG_RESULT([srcroot : ${srcroot}])
1288AC_MSG_RESULT([abs_srcroot : ${abs_srcroot}])
1289AC_MSG_RESULT([objroot : ${objroot}])
1290AC_MSG_RESULT([abs_objroot : ${abs_objroot}])
1291AC_MSG_RESULT([])
Jason Evans90895cf2009-12-29 00:09:15 -08001292AC_MSG_RESULT([JEMALLOC_PREFIX : ${JEMALLOC_PREFIX}])
Jason Evans746e77a2011-07-30 16:40:52 -07001293AC_MSG_RESULT([JEMALLOC_PRIVATE_NAMESPACE])
1294AC_MSG_RESULT([ : ${JEMALLOC_PRIVATE_NAMESPACE}])
Jason Evansb0fd5012010-01-17 01:49:20 -08001295AC_MSG_RESULT([install_suffix : ${install_suffix}])
Jason Evansb7924f52009-06-23 19:01:18 -07001296AC_MSG_RESULT([autogen : ${enable_autogen}])
Jason Evans7e77eaf2012-03-02 17:47:37 -08001297AC_MSG_RESULT([experimental : ${enable_experimental}])
Jason Evans355b4382010-09-20 19:20:48 -07001298AC_MSG_RESULT([cc-silence : ${enable_cc_silence}])
Jason Evansb7924f52009-06-23 19:01:18 -07001299AC_MSG_RESULT([debug : ${enable_debug}])
1300AC_MSG_RESULT([stats : ${enable_stats}])
Jason Evans6109fe02010-02-10 10:37:56 -08001301AC_MSG_RESULT([prof : ${enable_prof}])
1302AC_MSG_RESULT([prof-libunwind : ${enable_prof_libunwind}])
Jason Evans77f350b2011-03-15 22:23:12 -07001303AC_MSG_RESULT([prof-libgcc : ${enable_prof_libgcc}])
1304AC_MSG_RESULT([prof-gcc : ${enable_prof_gcc}])
Jason Evans84cbbcb2009-12-29 00:09:15 -08001305AC_MSG_RESULT([tcache : ${enable_tcache}])
Jason Evansb7924f52009-06-23 19:01:18 -07001306AC_MSG_RESULT([fill : ${enable_fill}])
Jason Evansb1476112012-04-05 13:36:17 -07001307AC_MSG_RESULT([utrace : ${enable_utrace}])
Jason Evans122449b2012-04-06 00:35:09 -07001308AC_MSG_RESULT([valgrind : ${enable_valgrind}])
1309AC_MSG_RESULT([xmalloc : ${enable_xmalloc}])
Jason Evans2e671ff2012-05-09 16:12:00 -07001310AC_MSG_RESULT([mremap : ${enable_mremap}])
Jason Evans59ae2762012-04-16 17:52:27 -07001311AC_MSG_RESULT([munmap : ${enable_munmap}])
Jason Evansb7924f52009-06-23 19:01:18 -07001312AC_MSG_RESULT([dss : ${enable_dss}])
Jason Evansb7924f52009-06-23 19:01:18 -07001313AC_MSG_RESULT([lazy_lock : ${enable_lazy_lock}])
Jason Evans2dbecf12010-09-05 10:35:13 -07001314AC_MSG_RESULT([tls : ${enable_tls}])
Jason Evansb7924f52009-06-23 19:01:18 -07001315AC_MSG_RESULT([===============================================================================])