blob: 95133c4949205dff92c32541f53303a3042dbcce [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 Evansf576c632011-11-01 22:27:41 -070046dnl Library revision.
Jason Evans9790b962014-04-14 22:32:31 -070047rev=2
Jason Evansf576c632011-11-01 22:27:41 -070048AC_SUBST([rev])
49
Jason Evansb7924f52009-06-23 19:01:18 -070050srcroot=$srcdir
51if test "x${srcroot}" = "x." ; then
52 srcroot=""
53else
54 srcroot="${srcroot}/"
55fi
56AC_SUBST([srcroot])
57abs_srcroot="`cd \"${srcdir}\"; pwd`/"
58AC_SUBST([abs_srcroot])
59
60objroot=""
61AC_SUBST([objroot])
62abs_objroot="`pwd`/"
63AC_SUBST([abs_objroot])
64
65dnl Munge install path variables.
66if test "x$prefix" = "xNONE" ; then
67 prefix="/usr/local"
68fi
69if test "x$exec_prefix" = "xNONE" ; then
70 exec_prefix=$prefix
71fi
72PREFIX=$prefix
73AC_SUBST([PREFIX])
74BINDIR=`eval echo $bindir`
75BINDIR=`eval echo $BINDIR`
76AC_SUBST([BINDIR])
77INCLUDEDIR=`eval echo $includedir`
78INCLUDEDIR=`eval echo $INCLUDEDIR`
79AC_SUBST([INCLUDEDIR])
80LIBDIR=`eval echo $libdir`
81LIBDIR=`eval echo $LIBDIR`
82AC_SUBST([LIBDIR])
83DATADIR=`eval echo $datadir`
84DATADIR=`eval echo $DATADIR`
85AC_SUBST([DATADIR])
86MANDIR=`eval echo $mandir`
87MANDIR=`eval echo $MANDIR`
88AC_SUBST([MANDIR])
89
Jason Evansaee7fd22010-11-24 22:00:02 -080090dnl Support for building documentation.
Jason Evans7329a4f2013-01-22 10:53:29 -080091AC_PATH_PROG([XSLTPROC], [xsltproc], [false], [$PATH])
Jason Evans7091b412012-03-19 09:36:44 -070092if test -d "/usr/share/xml/docbook/stylesheet/docbook-xsl" ; then
93 DEFAULT_XSLROOT="/usr/share/xml/docbook/stylesheet/docbook-xsl"
94elif test -d "/usr/share/sgml/docbook/xsl-stylesheets" ; then
95 DEFAULT_XSLROOT="/usr/share/sgml/docbook/xsl-stylesheets"
96else
97 dnl Documentation building will fail if this default gets used.
98 DEFAULT_XSLROOT=""
99fi
Jason Evansaee7fd22010-11-24 22:00:02 -0800100AC_ARG_WITH([xslroot],
Jason Evans7091b412012-03-19 09:36:44 -0700101 [AS_HELP_STRING([--with-xslroot=<path>], [XSL stylesheet root path])], [
Jason Evansaee7fd22010-11-24 22:00:02 -0800102if test "x$with_xslroot" = "xno" ; then
Jason Evans7091b412012-03-19 09:36:44 -0700103 XSLROOT="${DEFAULT_XSLROOT}"
Jason Evansaee7fd22010-11-24 22:00:02 -0800104else
105 XSLROOT="${with_xslroot}"
Jason Evans7091b412012-03-19 09:36:44 -0700106fi
107],
108 XSLROOT="${DEFAULT_XSLROOT}"
Jason Evansaee7fd22010-11-24 22:00:02 -0800109)
110AC_SUBST([XSLROOT])
111
Jason Evansf3340ca2009-06-30 16:17:05 -0700112dnl If CFLAGS isn't defined, set CFLAGS to something reasonable. Otherwise,
113dnl just prevent autoconf from molesting CFLAGS.
Jason Evansb7924f52009-06-23 19:01:18 -0700114CFLAGS=$CFLAGS
115AC_PROG_CC
Mike Hommeyfd97b1d2012-04-30 12:38:31 +0200116if test "x$GCC" != "xyes" ; then
117 AC_CACHE_CHECK([whether compiler is MSVC],
118 [je_cv_msvc],
119 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],
120 [
121#ifndef _MSC_VER
122 int fail[-1];
123#endif
124])],
125 [je_cv_msvc=yes],
126 [je_cv_msvc=no])])
127fi
128
Jason Evansb7924f52009-06-23 19:01:18 -0700129if test "x$CFLAGS" = "x" ; then
130 no_CFLAGS="yes"
Jason Evanscfeccd32010-03-03 15:48:20 -0800131 if test "x$GCC" = "xyes" ; then
132 JE_CFLAGS_APPEND([-std=gnu99])
Jason Evans99b0fbb2014-02-24 16:08:38 -0800133 if test "x$je_cv_cflags_appended" = "x-std=gnu99" ; then
134 AC_DEFINE_UNQUOTED([JEMALLOC_HAS_RESTRICT])
135 fi
Jason Evanscfeccd32010-03-03 15:48:20 -0800136 JE_CFLAGS_APPEND([-Wall])
Mike Hommeyb7b44df2014-12-18 15:12:53 +0900137 JE_CFLAGS_APPEND([-Werror=declaration-after-statement])
Jason Evanscfeccd32010-03-03 15:48:20 -0800138 JE_CFLAGS_APPEND([-pipe])
139 JE_CFLAGS_APPEND([-g3])
Mike Hommeyfd97b1d2012-04-30 12:38:31 +0200140 elif test "x$je_cv_msvc" = "xyes" ; then
141 CC="$CC -nologo"
142 JE_CFLAGS_APPEND([-Zi])
143 JE_CFLAGS_APPEND([-MT])
144 JE_CFLAGS_APPEND([-W3])
Mike Hommey8c615752014-05-29 16:58:21 +0900145 JE_CFLAGS_APPEND([-FS])
Mike Hommey6f6704c2014-05-29 17:01:10 +0900146 CPPFLAGS="$CPPFLAGS -I${srcdir}/include/msvc_compat"
Jason Evanscfeccd32010-03-03 15:48:20 -0800147 fi
Jason Evansb7924f52009-06-23 19:01:18 -0700148fi
149dnl Append EXTRA_CFLAGS to CFLAGS, if defined.
150if test "x$EXTRA_CFLAGS" != "x" ; then
Jason Evansf3340ca2009-06-30 16:17:05 -0700151 JE_CFLAGS_APPEND([$EXTRA_CFLAGS])
Jason Evansb7924f52009-06-23 19:01:18 -0700152fi
153AC_PROG_CPP
154
Jason Evansdf3f2702014-03-30 16:27:08 -0700155AC_C_BIGENDIAN([ac_cv_big_endian=1], [ac_cv_big_endian=0])
156if test "x${ac_cv_big_endian}" = "x1" ; then
157 AC_DEFINE_UNQUOTED([JEMALLOC_BIG_ENDIAN], [ ])
158fi
159
Mike Hommeyff2e9992014-05-29 16:33:02 +0900160if test "x${je_cv_msvc}" = "xyes" -a "x${ac_cv_header_inttypes_h}" = "xno"; then
Mike Hommey6f6704c2014-05-29 17:01:10 +0900161 CPPFLAGS="$CPPFLAGS -I${srcdir}/include/msvc_compat/C99"
Mike Hommeyff2e9992014-05-29 16:33:02 +0900162fi
163
Jason Evansb7924f52009-06-23 19:01:18 -0700164AC_CHECK_SIZEOF([void *])
165if test "x${ac_cv_sizeof_void_p}" = "x8" ; then
Jason Evans94ad2b52009-12-29 00:09:15 -0800166 LG_SIZEOF_PTR=3
Jason Evansb7924f52009-06-23 19:01:18 -0700167elif test "x${ac_cv_sizeof_void_p}" = "x4" ; then
Jason Evans94ad2b52009-12-29 00:09:15 -0800168 LG_SIZEOF_PTR=2
Jason Evansb7924f52009-06-23 19:01:18 -0700169else
170 AC_MSG_ERROR([Unsupported pointer size: ${ac_cv_sizeof_void_p}])
171fi
Jason Evans94ad2b52009-12-29 00:09:15 -0800172AC_DEFINE_UNQUOTED([LG_SIZEOF_PTR], [$LG_SIZEOF_PTR])
173
174AC_CHECK_SIZEOF([int])
175if test "x${ac_cv_sizeof_int}" = "x8" ; then
176 LG_SIZEOF_INT=3
177elif test "x${ac_cv_sizeof_int}" = "x4" ; then
178 LG_SIZEOF_INT=2
179else
180 AC_MSG_ERROR([Unsupported int size: ${ac_cv_sizeof_int}])
181fi
182AC_DEFINE_UNQUOTED([LG_SIZEOF_INT], [$LG_SIZEOF_INT])
Jason Evansb7924f52009-06-23 19:01:18 -0700183
Jason Evans84c8eef2011-03-16 10:30:13 -0700184AC_CHECK_SIZEOF([long])
185if test "x${ac_cv_sizeof_long}" = "x8" ; then
186 LG_SIZEOF_LONG=3
187elif test "x${ac_cv_sizeof_long}" = "x4" ; then
188 LG_SIZEOF_LONG=2
189else
190 AC_MSG_ERROR([Unsupported long size: ${ac_cv_sizeof_long}])
191fi
192AC_DEFINE_UNQUOTED([LG_SIZEOF_LONG], [$LG_SIZEOF_LONG])
193
Jason Evansd81e4bd2012-03-06 14:57:45 -0800194AC_CHECK_SIZEOF([intmax_t])
195if test "x${ac_cv_sizeof_intmax_t}" = "x16" ; then
196 LG_SIZEOF_INTMAX_T=4
197elif test "x${ac_cv_sizeof_intmax_t}" = "x8" ; then
198 LG_SIZEOF_INTMAX_T=3
199elif test "x${ac_cv_sizeof_intmax_t}" = "x4" ; then
200 LG_SIZEOF_INTMAX_T=2
201else
Mike Hommey14103d32012-04-20 08:38:39 +0200202 AC_MSG_ERROR([Unsupported intmax_t size: ${ac_cv_sizeof_intmax_t}])
Jason Evansd81e4bd2012-03-06 14:57:45 -0800203fi
204AC_DEFINE_UNQUOTED([LG_SIZEOF_INTMAX_T], [$LG_SIZEOF_INTMAX_T])
205
Jason Evansb7924f52009-06-23 19:01:18 -0700206AC_CANONICAL_HOST
207dnl CPU-specific settings.
208CPU_SPINWAIT=""
209case "${host_cpu}" in
Jason Evanscb657e32014-02-25 11:21:41 -0800210 i686|x86_64)
Jason Evans81e54752014-10-10 22:34:25 -0700211 AC_CACHE_VAL([je_cv_pause],
Jason Evans2eb941a2014-10-10 20:40:43 -0700212 [JE_COMPILABLE([pause instruction], [],
213 [[__asm__ volatile("pause"); return 0;]],
214 [je_cv_pause])])
Jason Evanscb657e32014-02-25 11:21:41 -0800215 if test "x${je_cv_pause}" = "xyes" ; then
Jason Evansf3340ca2009-06-30 16:17:05 -0700216 CPU_SPINWAIT='__asm__ volatile("pause")'
217 fi
Jason Evans80061b62013-12-09 13:21:08 -0800218 ;;
219 powerpc)
220 AC_DEFINE_UNQUOTED([HAVE_ALTIVEC], [ ])
Jason Evansb7924f52009-06-23 19:01:18 -0700221 ;;
222 *)
223 ;;
224esac
225AC_DEFINE_UNQUOTED([CPU_SPINWAIT], [$CPU_SPINWAIT])
226
Antony Dovgal2bd3cbc2011-10-13 09:33:33 +0400227LD_PRELOAD_VAR="LD_PRELOAD"
Jason Evansf576c632011-11-01 22:27:41 -0700228so="so"
Mike Hommeyfd97b1d2012-04-30 12:38:31 +0200229importlib="${so}"
Mike Hommey7cdea392012-04-30 12:38:27 +0200230o="$ac_objext"
Mike Hommey5bee66d2012-04-16 16:30:24 +0200231a="a"
Mike Hommey7cdea392012-04-30 12:38:27 +0200232exe="$ac_exeext"
Mike Hommeya19e87f2012-04-21 21:27:46 -0700233libprefix="lib"
Mike Hommeyfa08da72012-04-16 16:30:25 +0200234DSO_LDFLAGS='-shared -Wl,-soname,$(@F)'
235RPATH='-Wl,-rpath,$(1)'
Mike Hommey7cdea392012-04-30 12:38:27 +0200236SOREV="${so}.${rev}"
Mike Hommey188da7c2012-04-18 18:29:41 +0200237PIC_CFLAGS='-fPIC -DPIC'
Mike Hommeyfd97b1d2012-04-30 12:38:31 +0200238CTARGET='-o $@'
239LDTARGET='-o $@'
240EXTRA_LDFLAGS=
Jason Evans80ddf492013-08-20 11:48:19 +0100241ARFLAGS='crus'
242AROUT=' $@'
Mike Hommey79c4bca2012-05-02 21:30:51 +0200243CC_MM=1
Jason Evans7372b152012-02-10 20:22:09 -0800244
Jory A. Prattad505e02013-08-11 09:44:59 -0500245AN_MAKEVAR([AR], [AC_PROG_AR])
246AN_PROGRAM([ar], [AC_PROG_AR])
247AC_DEFUN([AC_PROG_AR], [AC_CHECK_TOOL(AR, ar, :)])
248AC_PROG_AR
249
Jason Evansb7924f52009-06-23 19:01:18 -0700250dnl Platform-specific settings. abi and RPATH can probably be determined
251dnl programmatically, but doing so is error-prone, which makes it generally
252dnl not worth the trouble.
253dnl
254dnl Define cpp macros in CPPFLAGS, rather than doing AC_DEFINE(macro), since the
255dnl definitions need to be seen before any headers are included, which is a pain
256dnl to make happen otherwise.
Jason Evans59ae2762012-04-16 17:52:27 -0700257default_munmap="1"
Jason Evansb7924f52009-06-23 19:01:18 -0700258case "${host}" in
Valerii Hiora5921ba72014-05-16 16:28:20 +0300259 *-*-darwin* | *-*-ios*)
Mike Hommeya6770a72012-05-03 14:12:49 +0200260 CFLAGS="$CFLAGS"
Jason Evansb7924f52009-06-23 19:01:18 -0700261 abi="macho"
Jason Evanse24c7af2012-03-19 10:21:17 -0700262 AC_DEFINE([JEMALLOC_PURGE_MADVISE_FREE], [ ])
Jason Evansb7924f52009-06-23 19:01:18 -0700263 RPATH=""
Antony Dovgal2bd3cbc2011-10-13 09:33:33 +0400264 LD_PRELOAD_VAR="DYLD_INSERT_LIBRARIES"
Jason Evansf576c632011-11-01 22:27:41 -0700265 so="dylib"
Mike Hommeyfd97b1d2012-04-30 12:38:31 +0200266 importlib="${so}"
Jason Evansb80581d2012-03-23 16:17:43 -0700267 force_tls="0"
Mike Hommeyfa08da72012-04-16 16:30:25 +0200268 DSO_LDFLAGS='-shared -Wl,-dylib_install_name,$(@F)'
Mike Hommey7cdea392012-04-30 12:38:27 +0200269 SOREV="${rev}.${so}"
Jason Evans66688532013-12-03 21:49:36 -0800270 sbrk_deprecated="1"
Jason Evansb7924f52009-06-23 19:01:18 -0700271 ;;
272 *-*-freebsd*)
273 CFLAGS="$CFLAGS"
274 abi="elf"
Jason Evanse24c7af2012-03-19 10:21:17 -0700275 AC_DEFINE([JEMALLOC_PURGE_MADVISE_FREE], [ ])
Jason Evansfd4fcef2012-03-23 17:40:58 -0700276 force_lazy_lock="1"
Jason Evansb7924f52009-06-23 19:01:18 -0700277 ;;
Michael Neumann1aa25a32014-08-05 03:06:02 +0200278 *-*-dragonfly*)
279 CFLAGS="$CFLAGS"
280 abi="elf"
281 AC_DEFINE([JEMALLOC_PURGE_MADVISE_FREE], [ ])
282 ;;
Jason Evansb7924f52009-06-23 19:01:18 -0700283 *-*-linux*)
284 CFLAGS="$CFLAGS"
285 CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
286 abi="elf"
Garrett Cooper13e4e242012-12-02 17:58:40 -0800287 AC_DEFINE([JEMALLOC_HAS_ALLOCA_H])
Jason Evanse24c7af2012-03-19 10:21:17 -0700288 AC_DEFINE([JEMALLOC_PURGE_MADVISE_DONTNEED], [ ])
Jason Evans02b23122012-04-05 11:06:23 -0700289 AC_DEFINE([JEMALLOC_THREADED_INIT], [ ])
Jason Evans59ae2762012-04-16 17:52:27 -0700290 default_munmap="0"
Jason Evansb7924f52009-06-23 19:01:18 -0700291 ;;
292 *-*-netbsd*)
293 AC_MSG_CHECKING([ABI])
294 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
295[[#ifdef __ELF__
296/* ELF */
297#else
298#error aout
299#endif
300]])],
301 [CFLAGS="$CFLAGS"; abi="elf"],
302 [abi="aout"])
303 AC_MSG_RESULT([$abi])
Jason Evanse24c7af2012-03-19 10:21:17 -0700304 AC_DEFINE([JEMALLOC_PURGE_MADVISE_FREE], [ ])
Jason Evansb7924f52009-06-23 19:01:18 -0700305 ;;
306 *-*-solaris2*)
307 CFLAGS="$CFLAGS"
308 abi="elf"
George Koladdd6bd42014-02-12 23:05:45 +0000309 AC_DEFINE([JEMALLOC_PURGE_MADVISE_FREE], [ ])
Mike Hommeyfa08da72012-04-16 16:30:25 +0200310 RPATH='-Wl,-R,$(1)'
Jason Evansb7924f52009-06-23 19:01:18 -0700311 dnl Solaris needs this for sigwait().
312 CPPFLAGS="$CPPFLAGS -D_POSIX_PTHREAD_SEMANTICS"
313 LIBS="$LIBS -lposix4 -lsocket -lnsl"
314 ;;
Antony Dovgal2bd3cbc2011-10-13 09:33:33 +0400315 *-ibm-aix*)
316 if "$LG_SIZEOF_PTR" = "8"; then
317 dnl 64bit AIX
318 LD_PRELOAD_VAR="LDR_PRELOAD64"
319 else
320 dnl 32bit AIX
321 LD_PRELOAD_VAR="LDR_PRELOAD"
322 fi
323 abi="xcoff"
Antony Dovgal2bd3cbc2011-10-13 09:33:33 +0400324 ;;
Dave Rigby70bdee02014-09-22 15:53:16 +0100325 *-*-mingw* | *-*-cygwin*)
Mike Hommeya19e87f2012-04-21 21:27:46 -0700326 abi="pecoff"
327 force_tls="0"
328 RPATH=""
329 so="dll"
Mike Hommeyfd97b1d2012-04-30 12:38:31 +0200330 if test "x$je_cv_msvc" = "xyes" ; then
331 importlib="lib"
332 DSO_LDFLAGS="-LD"
333 EXTRA_LDFLAGS="-link -DEBUG"
334 CTARGET='-Fo$@'
335 LDTARGET='-Fe$@'
Jory A. Prattad505e02013-08-11 09:44:59 -0500336 AR='lib'
337 ARFLAGS='-nologo -out:'
Jason Evans80ddf492013-08-20 11:48:19 +0100338 AROUT='$@'
Mike Hommey79c4bca2012-05-02 21:30:51 +0200339 CC_MM=
Mike Hommeyfd97b1d2012-04-30 12:38:31 +0200340 else
341 importlib="${so}"
342 DSO_LDFLAGS="-shared"
343 fi
Mike Hommeya19e87f2012-04-21 21:27:46 -0700344 a="lib"
345 libprefix=""
Mike Hommey7cdea392012-04-30 12:38:27 +0200346 SOREV="${so}"
Mike Hommeya19e87f2012-04-21 21:27:46 -0700347 PIC_CFLAGS=""
348 ;;
Jason Evansb7924f52009-06-23 19:01:18 -0700349 *)
350 AC_MSG_RESULT([Unsupported operating system: ${host}])
351 abi="elf"
Jason Evansb7924f52009-06-23 19:01:18 -0700352 ;;
353esac
Mike Hommeyaffe0092014-05-28 08:10:12 +0900354
355JEMALLOC_USABLE_SIZE_CONST=const
356AC_CHECK_HEADERS([malloc.h], [
357 AC_MSG_CHECKING([whether malloc_usable_size definition can use const argument])
358 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
359 [#include <malloc.h>
360 #include <stddef.h>
361 size_t malloc_usable_size(const void *ptr);
362 ],
363 [])],[
364 AC_MSG_RESULT([yes])
365 ],[
366 JEMALLOC_USABLE_SIZE_CONST=
367 AC_MSG_RESULT([no])
368 ])
369])
Jason Evans247d1242012-10-09 16:20:10 -0700370AC_DEFINE_UNQUOTED([JEMALLOC_USABLE_SIZE_CONST], [$JEMALLOC_USABLE_SIZE_CONST])
Jason Evansb7924f52009-06-23 19:01:18 -0700371AC_SUBST([abi])
372AC_SUBST([RPATH])
Antony Dovgal2bd3cbc2011-10-13 09:33:33 +0400373AC_SUBST([LD_PRELOAD_VAR])
Jason Evansf576c632011-11-01 22:27:41 -0700374AC_SUBST([so])
Mike Hommeyfd97b1d2012-04-30 12:38:31 +0200375AC_SUBST([importlib])
Mike Hommey5bee66d2012-04-16 16:30:24 +0200376AC_SUBST([o])
377AC_SUBST([a])
378AC_SUBST([exe])
Mike Hommeya19e87f2012-04-21 21:27:46 -0700379AC_SUBST([libprefix])
Mike Hommeyfa08da72012-04-16 16:30:25 +0200380AC_SUBST([DSO_LDFLAGS])
Mike Hommeyfd97b1d2012-04-30 12:38:31 +0200381AC_SUBST([EXTRA_LDFLAGS])
Mike Hommey85221d52012-04-18 18:29:40 +0200382AC_SUBST([SOREV])
Mike Hommey188da7c2012-04-18 18:29:41 +0200383AC_SUBST([PIC_CFLAGS])
Mike Hommeyfd97b1d2012-04-30 12:38:31 +0200384AC_SUBST([CTARGET])
385AC_SUBST([LDTARGET])
386AC_SUBST([MKLIB])
Jason Evans80ddf492013-08-20 11:48:19 +0100387AC_SUBST([ARFLAGS])
388AC_SUBST([AROUT])
Mike Hommey79c4bca2012-05-02 21:30:51 +0200389AC_SUBST([CC_MM])
Mike Hommeyfd97b1d2012-04-30 12:38:31 +0200390
Jason Evansfa5d2452011-03-15 10:25:59 -0700391JE_COMPILABLE([__attribute__ syntax],
392 [static __attribute__((unused)) void foo(void){}],
393 [],
Jason Evans6684cac2012-03-05 12:15:36 -0800394 [je_cv_attribute])
395if test "x${je_cv_attribute}" = "xyes" ; then
Jason Evansfa5d2452011-03-15 10:25:59 -0700396 AC_DEFINE([JEMALLOC_HAVE_ATTR], [ ])
397 if test "x${GCC}" = "xyes" -a "x${abi}" = "xelf"; then
398 JE_CFLAGS_APPEND([-fvisibility=hidden])
399 fi
400fi
Jason Evans3cc1f1a2012-04-03 22:30:05 -0700401dnl Check for tls_model attribute support (clang 3.0 still lacks support).
402SAVED_CFLAGS="${CFLAGS}"
403JE_CFLAGS_APPEND([-Werror])
404JE_COMPILABLE([tls_model attribute], [],
405 [static __thread int
Daniel Micayf1cf3ea2014-09-16 04:42:33 -0400406 __attribute__((tls_model("initial-exec"), unused)) foo;
Jason Evans3cc1f1a2012-04-03 22:30:05 -0700407 foo = 0;],
408 [je_cv_tls_model])
409CFLAGS="${SAVED_CFLAGS}"
410if test "x${je_cv_tls_model}" = "xyes" ; then
411 AC_DEFINE([JEMALLOC_TLS_MODEL],
412 [__attribute__((tls_model("initial-exec")))])
413else
414 AC_DEFINE([JEMALLOC_TLS_MODEL], [ ])
415fi
Jason Evansfa5d2452011-03-15 10:25:59 -0700416
Jason Evansb7924f52009-06-23 19:01:18 -0700417dnl Support optional additions to rpath.
418AC_ARG_WITH([rpath],
Jason Evans90895cf2009-12-29 00:09:15 -0800419 [AS_HELP_STRING([--with-rpath=<rpath>], [Colon-separated rpath (ELF systems only)])],
Jason Evansb7924f52009-06-23 19:01:18 -0700420if test "x$with_rpath" = "xno" ; then
421 RPATH_EXTRA=
422else
423 RPATH_EXTRA="`echo $with_rpath | tr \":\" \" \"`"
424fi,
425 RPATH_EXTRA=
426)
427AC_SUBST([RPATH_EXTRA])
428
429dnl Disable rules that do automatic regeneration of configure output by default.
430AC_ARG_ENABLE([autogen],
Jason Evans78d815c2010-01-17 14:06:20 -0800431 [AS_HELP_STRING([--enable-autogen], [Automatically regenerate configure output])],
Jason Evansb7924f52009-06-23 19:01:18 -0700432if test "x$enable_autogen" = "xno" ; then
433 enable_autogen="0"
434else
435 enable_autogen="1"
436fi
437,
438enable_autogen="0"
439)
440AC_SUBST([enable_autogen])
441
442AC_PROG_INSTALL
443AC_PROG_RANLIB
Jason Evans7329a4f2013-01-22 10:53:29 -0800444AC_PATH_PROG([LD], [ld], [false], [$PATH])
445AC_PATH_PROG([AUTOCONF], [autoconf], [false], [$PATH])
Jason Evansb7924f52009-06-23 19:01:18 -0700446
Daniel Micay4cfe5512014-08-28 15:41:48 -0400447public_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 -0800448
449dnl Check for allocator-related functions that should be wrapped.
450AC_CHECK_FUNC([memalign],
Jason Evanse24c7af2012-03-19 10:21:17 -0700451 [AC_DEFINE([JEMALLOC_OVERRIDE_MEMALIGN], [ ])
Jason Evans7e77eaf2012-03-02 17:47:37 -0800452 public_syms="${public_syms} memalign"])
453AC_CHECK_FUNC([valloc],
Jason Evanse24c7af2012-03-19 10:21:17 -0700454 [AC_DEFINE([JEMALLOC_OVERRIDE_VALLOC], [ ])
Jason Evans7e77eaf2012-03-02 17:47:37 -0800455 public_syms="${public_syms} valloc"])
456
Jason Evans748dfac2013-12-06 18:27:33 -0800457dnl Do not compute test code coverage by default.
458GCOV_FLAGS=
459AC_ARG_ENABLE([code-coverage],
460 [AS_HELP_STRING([--enable-code-coverage],
461 [Enable code coverage])],
462[if test "x$enable_code_coverage" = "xno" ; then
463 enable_code_coverage="0"
464else
465 enable_code_coverage="1"
466fi
467],
468[enable_code_coverage="0"]
469)
470if test "x$enable_code_coverage" = "x1" ; then
471 deoptimize="no"
472 echo "$CFLAGS $EXTRA_CFLAGS" | grep '\-O' >/dev/null || deoptimize="yes"
473 if test "x${deoptimize}" = "xyes" ; then
474 JE_CFLAGS_APPEND([-O0])
475 fi
476 JE_CFLAGS_APPEND([-fprofile-arcs -ftest-coverage])
477 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -fprofile-arcs -ftest-coverage"
478 AC_DEFINE([JEMALLOC_CODE_COVERAGE], [ ])
479fi
480AC_SUBST([enable_code_coverage])
481
Jason Evans0a5489e2012-03-01 17:19:20 -0800482dnl Perform no name mangling by default.
483AC_ARG_WITH([mangling],
484 [AS_HELP_STRING([--with-mangling=<map>], [Mangle symbols in <map>])],
485 [mangling_map="$with_mangling"], [mangling_map=""])
Jason Evans0a5489e2012-03-01 17:19:20 -0800486
Jason Evans90895cf2009-12-29 00:09:15 -0800487dnl Do not prefix public APIs by default.
488AC_ARG_WITH([jemalloc_prefix],
489 [AS_HELP_STRING([--with-jemalloc-prefix=<prefix>], [Prefix to prepend to all public APIs])],
Jason Evansb0fd5012010-01-17 01:49:20 -0800490 [JEMALLOC_PREFIX="$with_jemalloc_prefix"],
Mike Hommey7cdea392012-04-30 12:38:27 +0200491 [if test "x$abi" != "xmacho" -a "x$abi" != "xpecoff"; then
Jason Evans2dbecf12010-09-05 10:35:13 -0700492 JEMALLOC_PREFIX=""
493else
494 JEMALLOC_PREFIX="je_"
495fi]
Jason Evans90895cf2009-12-29 00:09:15 -0800496)
497if test "x$JEMALLOC_PREFIX" != "x" ; then
Jason Evanse7339702010-10-23 18:37:06 -0700498 JEMALLOC_CPREFIX=`echo ${JEMALLOC_PREFIX} | tr "a-z" "A-Z"`
499 AC_DEFINE_UNQUOTED([JEMALLOC_PREFIX], ["$JEMALLOC_PREFIX"])
500 AC_DEFINE_UNQUOTED([JEMALLOC_CPREFIX], ["$JEMALLOC_CPREFIX"])
Jason Evans90895cf2009-12-29 00:09:15 -0800501fi
502
Mike Hommey99066602012-11-19 10:55:26 +0100503AC_ARG_WITH([export],
504 [AS_HELP_STRING([--without-export], [disable exporting jemalloc public APIs])],
505 [if test "x$with_export" = "xno"; then
Jason Evans2625c892013-01-22 16:46:27 -0800506 AC_DEFINE([JEMALLOC_EXPORT],[])
Mike Hommey99066602012-11-19 10:55:26 +0100507fi]
508)
509
Jason Evans86abd0d2013-11-30 15:25:42 -0800510dnl Mangle library-private APIs.
Jason Evans746e77a2011-07-30 16:40:52 -0700511AC_ARG_WITH([private_namespace],
512 [AS_HELP_STRING([--with-private-namespace=<prefix>], [Prefix to prepend to all library-private APIs])],
Jason Evans86abd0d2013-11-30 15:25:42 -0800513 [JEMALLOC_PRIVATE_NAMESPACE="${with_private_namespace}je_"],
514 [JEMALLOC_PRIVATE_NAMESPACE="je_"]
Jason Evans746e77a2011-07-30 16:40:52 -0700515)
Jason Evans86abd0d2013-11-30 15:25:42 -0800516AC_DEFINE_UNQUOTED([JEMALLOC_PRIVATE_NAMESPACE], [$JEMALLOC_PRIVATE_NAMESPACE])
517private_namespace="$JEMALLOC_PRIVATE_NAMESPACE"
518AC_SUBST([private_namespace])
Jason Evans746e77a2011-07-30 16:40:52 -0700519
Jason Evansb0fd5012010-01-17 01:49:20 -0800520dnl Do not add suffix to installed files by default.
521AC_ARG_WITH([install_suffix],
522 [AS_HELP_STRING([--with-install-suffix=<suffix>], [Suffix to append to all installed files])],
523 [INSTALL_SUFFIX="$with_install_suffix"],
524 [INSTALL_SUFFIX=]
525)
526install_suffix="$INSTALL_SUFFIX"
527AC_SUBST([install_suffix])
528
Jason Evans86abd0d2013-11-30 15:25:42 -0800529dnl Substitute @je_@ in jemalloc_protos.h.in, primarily to make generation of
530dnl jemalloc_protos_jet.h easy.
531je_="je_"
532AC_SUBST([je_])
533
Mike Hommeycf6032d2014-07-30 18:16:13 +0900534cfgoutputs_in="Makefile.in"
Nick White913e9a82014-09-19 22:01:23 +0100535cfgoutputs_in="${cfgoutputs_in} jemalloc.pc.in"
Mike Hommeycf6032d2014-07-30 18:16:13 +0900536cfgoutputs_in="${cfgoutputs_in} doc/html.xsl.in"
537cfgoutputs_in="${cfgoutputs_in} doc/manpages.xsl.in"
538cfgoutputs_in="${cfgoutputs_in} doc/jemalloc.xml.in"
539cfgoutputs_in="${cfgoutputs_in} include/jemalloc/jemalloc_macros.h.in"
540cfgoutputs_in="${cfgoutputs_in} include/jemalloc/jemalloc_protos.h.in"
Jason Evans82e88d12014-09-07 19:55:03 -0700541cfgoutputs_in="${cfgoutputs_in} include/jemalloc/jemalloc_typedefs.h.in"
Mike Hommeycf6032d2014-07-30 18:16:13 +0900542cfgoutputs_in="${cfgoutputs_in} include/jemalloc/internal/jemalloc_internal.h.in"
543cfgoutputs_in="${cfgoutputs_in} test/test.sh.in"
544cfgoutputs_in="${cfgoutputs_in} test/include/test/jemalloc_test.h.in"
Jason Evansb0fd5012010-01-17 01:49:20 -0800545
Jason Evansaee7fd22010-11-24 22:00:02 -0800546cfgoutputs_out="Makefile"
Nick White913e9a82014-09-19 22:01:23 +0100547cfgoutputs_out="${cfgoutputs_out} jemalloc.pc"
Jason Evansaee7fd22010-11-24 22:00:02 -0800548cfgoutputs_out="${cfgoutputs_out} doc/html.xsl"
549cfgoutputs_out="${cfgoutputs_out} doc/manpages.xsl"
Jason Evans86abd0d2013-11-30 15:25:42 -0800550cfgoutputs_out="${cfgoutputs_out} doc/jemalloc.xml"
551cfgoutputs_out="${cfgoutputs_out} include/jemalloc/jemalloc_macros.h"
552cfgoutputs_out="${cfgoutputs_out} include/jemalloc/jemalloc_protos.h"
Jason Evans82e88d12014-09-07 19:55:03 -0700553cfgoutputs_out="${cfgoutputs_out} include/jemalloc/jemalloc_typedefs.h"
Jason Evans376b1522010-02-11 14:45:59 -0800554cfgoutputs_out="${cfgoutputs_out} include/jemalloc/internal/jemalloc_internal.h"
Jason Evans86abd0d2013-11-30 15:25:42 -0800555cfgoutputs_out="${cfgoutputs_out} test/test.sh"
556cfgoutputs_out="${cfgoutputs_out} test/include/test/jemalloc_test.h"
Jason Evansb0fd5012010-01-17 01:49:20 -0800557
Jason Evansaee7fd22010-11-24 22:00:02 -0800558cfgoutputs_tup="Makefile"
Nick White913e9a82014-09-19 22:01:23 +0100559cfgoutputs_tup="${cfgoutputs_tup} jemalloc.pc:jemalloc.pc.in"
Jason Evansaee7fd22010-11-24 22:00:02 -0800560cfgoutputs_tup="${cfgoutputs_tup} doc/html.xsl:doc/html.xsl.in"
561cfgoutputs_tup="${cfgoutputs_tup} doc/manpages.xsl:doc/manpages.xsl.in"
Jason Evans86abd0d2013-11-30 15:25:42 -0800562cfgoutputs_tup="${cfgoutputs_tup} doc/jemalloc.xml:doc/jemalloc.xml.in"
563cfgoutputs_tup="${cfgoutputs_tup} include/jemalloc/jemalloc_macros.h:include/jemalloc/jemalloc_macros.h.in"
564cfgoutputs_tup="${cfgoutputs_tup} include/jemalloc/jemalloc_protos.h:include/jemalloc/jemalloc_protos.h.in"
Jason Evans82e88d12014-09-07 19:55:03 -0700565cfgoutputs_tup="${cfgoutputs_tup} include/jemalloc/jemalloc_typedefs.h:include/jemalloc/jemalloc_typedefs.h.in"
Jason Evans376b1522010-02-11 14:45:59 -0800566cfgoutputs_tup="${cfgoutputs_tup} include/jemalloc/internal/jemalloc_internal.h"
Jason Evans86abd0d2013-11-30 15:25:42 -0800567cfgoutputs_tup="${cfgoutputs_tup} test/test.sh:test/test.sh.in"
568cfgoutputs_tup="${cfgoutputs_tup} test/include/test/jemalloc_test.h:test/include/test/jemalloc_test.h.in"
Jason Evansb0fd5012010-01-17 01:49:20 -0800569
Mike Hommeycf6032d2014-07-30 18:16:13 +0900570cfghdrs_in="include/jemalloc/jemalloc_defs.h.in"
571cfghdrs_in="${cfghdrs_in} include/jemalloc/internal/jemalloc_internal_defs.h.in"
572cfghdrs_in="${cfghdrs_in} include/jemalloc/internal/private_namespace.sh"
573cfghdrs_in="${cfghdrs_in} include/jemalloc/internal/private_unnamespace.sh"
574cfghdrs_in="${cfghdrs_in} include/jemalloc/internal/private_symbols.txt"
575cfghdrs_in="${cfghdrs_in} include/jemalloc/internal/public_namespace.sh"
576cfghdrs_in="${cfghdrs_in} include/jemalloc/internal/public_unnamespace.sh"
577cfghdrs_in="${cfghdrs_in} include/jemalloc/internal/size_classes.sh"
578cfghdrs_in="${cfghdrs_in} include/jemalloc/jemalloc_rename.sh"
579cfghdrs_in="${cfghdrs_in} include/jemalloc/jemalloc_mangle.sh"
580cfghdrs_in="${cfghdrs_in} include/jemalloc/jemalloc.sh"
581cfghdrs_in="${cfghdrs_in} test/include/test/jemalloc_test_defs.h.in"
Jason Evansb0fd5012010-01-17 01:49:20 -0800582
Jason Evans86abd0d2013-11-30 15:25:42 -0800583cfghdrs_out="include/jemalloc/jemalloc_defs.h"
584cfghdrs_out="${cfghdrs_out} include/jemalloc/jemalloc${install_suffix}.h"
Jason Evans86abd0d2013-11-30 15:25:42 -0800585cfghdrs_out="${cfghdrs_out} include/jemalloc/internal/private_namespace.h"
586cfghdrs_out="${cfghdrs_out} include/jemalloc/internal/private_unnamespace.h"
Jason Evansf234dc52014-01-16 17:38:01 -0800587cfghdrs_out="${cfghdrs_out} include/jemalloc/internal/public_symbols.txt"
Jason Evans86abd0d2013-11-30 15:25:42 -0800588cfghdrs_out="${cfghdrs_out} include/jemalloc/internal/public_namespace.h"
589cfghdrs_out="${cfghdrs_out} include/jemalloc/internal/public_unnamespace.h"
Jason Evansb1726102012-02-28 16:50:47 -0800590cfghdrs_out="${cfghdrs_out} include/jemalloc/internal/size_classes.h"
Jason Evansf234dc52014-01-16 17:38:01 -0800591cfghdrs_out="${cfghdrs_out} include/jemalloc/jemalloc_protos_jet.h"
592cfghdrs_out="${cfghdrs_out} include/jemalloc/jemalloc_rename.h"
593cfghdrs_out="${cfghdrs_out} include/jemalloc/jemalloc_mangle.h"
594cfghdrs_out="${cfghdrs_out} include/jemalloc/jemalloc_mangle_jet.h"
595cfghdrs_out="${cfghdrs_out} include/jemalloc/internal/jemalloc_internal_defs.h"
Jason Evans80061b62013-12-09 13:21:08 -0800596cfghdrs_out="${cfghdrs_out} test/include/test/jemalloc_test_defs.h"
Jason Evansb0fd5012010-01-17 01:49:20 -0800597
Jason Evans86abd0d2013-11-30 15:25:42 -0800598cfghdrs_tup="include/jemalloc/jemalloc_defs.h:include/jemalloc/jemalloc_defs.h.in"
Mike Hommeycf6032d2014-07-30 18:16:13 +0900599cfghdrs_tup="${cfghdrs_tup} include/jemalloc/internal/jemalloc_internal_defs.h:include/jemalloc/internal/jemalloc_internal_defs.h.in"
600cfghdrs_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 -0800601
Jason Evans644d4142014-04-14 22:49:23 -0700602dnl Silence irrelevant compiler warnings by default.
Jason Evans355b4382010-09-20 19:20:48 -0700603AC_ARG_ENABLE([cc-silence],
Jason Evans644d4142014-04-14 22:49:23 -0700604 [AS_HELP_STRING([--disable-cc-silence],
605 [Do not silence irrelevant compiler warnings])],
Jason Evans355b4382010-09-20 19:20:48 -0700606[if test "x$enable_cc_silence" = "xno" ; then
607 enable_cc_silence="0"
608else
609 enable_cc_silence="1"
610fi
611],
Jason Evans644d4142014-04-14 22:49:23 -0700612[enable_cc_silence="1"]
Jason Evans355b4382010-09-20 19:20:48 -0700613)
614if test "x$enable_cc_silence" = "x1" ; then
Jason Evanse24c7af2012-03-19 10:21:17 -0700615 AC_DEFINE([JEMALLOC_CC_SILENCE], [ ])
Jason Evans355b4382010-09-20 19:20:48 -0700616fi
617
Jason Evansb7924f52009-06-23 19:01:18 -0700618dnl Do not compile with debugging by default.
619AC_ARG_ENABLE([debug],
Mike Hommey5135e342012-12-06 22:16:26 +0100620 [AS_HELP_STRING([--enable-debug], [Build debugging code (implies --enable-ivsalloc)])],
Jason Evansb7924f52009-06-23 19:01:18 -0700621[if test "x$enable_debug" = "xno" ; then
622 enable_debug="0"
623else
624 enable_debug="1"
625fi
626],
627[enable_debug="0"]
628)
629if test "x$enable_debug" = "x1" ; then
630 AC_DEFINE([JEMALLOC_DEBUG], [ ])
Mike Hommey5135e342012-12-06 22:16:26 +0100631 enable_ivsalloc="1"
Jason Evansb7924f52009-06-23 19:01:18 -0700632fi
633AC_SUBST([enable_debug])
634
Mike Hommey5135e342012-12-06 22:16:26 +0100635dnl Do not validate pointers by default.
636AC_ARG_ENABLE([ivsalloc],
637 [AS_HELP_STRING([--enable-ivsalloc], [Validate pointers passed through the public API])],
638[if test "x$enable_ivsalloc" = "xno" ; then
639 enable_ivsalloc="0"
640else
641 enable_ivsalloc="1"
642fi
643],
644[enable_ivsalloc="0"]
645)
646if test "x$enable_ivsalloc" = "x1" ; then
647 AC_DEFINE([JEMALLOC_IVSALLOC], [ ])
648fi
649
Jason Evansb7924f52009-06-23 19:01:18 -0700650dnl Only optimize if not debugging.
651if test "x$enable_debug" = "x0" -a "x$no_CFLAGS" = "xyes" ; then
652 dnl Make sure that an optimization flag was not specified in EXTRA_CFLAGS.
Jason Evansf3340ca2009-06-30 16:17:05 -0700653 optimize="no"
Jason Evans748dfac2013-12-06 18:27:33 -0800654 echo "$CFLAGS $EXTRA_CFLAGS" | grep '\-O' >/dev/null || optimize="yes"
Jason Evansf3340ca2009-06-30 16:17:05 -0700655 if test "x${optimize}" = "xyes" ; then
656 if test "x$GCC" = "xyes" ; then
657 JE_CFLAGS_APPEND([-O3])
658 JE_CFLAGS_APPEND([-funroll-loops])
Mike Hommeyfd97b1d2012-04-30 12:38:31 +0200659 elif test "x$je_cv_msvc" = "xyes" ; then
660 JE_CFLAGS_APPEND([-O2])
Jason Evansf3340ca2009-06-30 16:17:05 -0700661 else
662 JE_CFLAGS_APPEND([-O])
663 fi
Jason Evansb7924f52009-06-23 19:01:18 -0700664 fi
665fi
666
Jason Evansd073a322012-02-28 20:41:16 -0800667dnl Enable statistics calculation by default.
Jason Evansb7924f52009-06-23 19:01:18 -0700668AC_ARG_ENABLE([stats],
Jason Evans777c1912012-02-28 20:49:22 -0800669 [AS_HELP_STRING([--disable-stats],
670 [Disable statistics calculation/reporting])],
Jason Evansb7924f52009-06-23 19:01:18 -0700671[if test "x$enable_stats" = "xno" ; then
672 enable_stats="0"
673else
674 enable_stats="1"
675fi
676],
Jason Evansd073a322012-02-28 20:41:16 -0800677[enable_stats="1"]
Jason Evansb7924f52009-06-23 19:01:18 -0700678)
679if test "x$enable_stats" = "x1" ; then
680 AC_DEFINE([JEMALLOC_STATS], [ ])
681fi
682AC_SUBST([enable_stats])
683
Jason Evans6109fe02010-02-10 10:37:56 -0800684dnl Do not enable profiling by default.
685AC_ARG_ENABLE([prof],
686 [AS_HELP_STRING([--enable-prof], [Enable allocation profiling])],
687[if test "x$enable_prof" = "xno" ; then
688 enable_prof="0"
689else
690 enable_prof="1"
691fi
692],
693[enable_prof="0"]
694)
Jason Evans77f350b2011-03-15 22:23:12 -0700695if test "x$enable_prof" = "x1" ; then
696 backtrace_method=""
Jason Evansb27805b2010-02-10 18:15:53 -0800697else
Jason Evans77f350b2011-03-15 22:23:12 -0700698 backtrace_method="N/A"
Jason Evansb27805b2010-02-10 18:15:53 -0800699fi
Jason Evans77f350b2011-03-15 22:23:12 -0700700
Jason Evans6109fe02010-02-10 10:37:56 -0800701AC_ARG_ENABLE([prof-libunwind],
702 [AS_HELP_STRING([--enable-prof-libunwind], [Use libunwind for backtracing])],
703[if test "x$enable_prof_libunwind" = "xno" ; then
704 enable_prof_libunwind="0"
705else
706 enable_prof_libunwind="1"
707fi
708],
709[enable_prof_libunwind="0"]
710)
Jason Evansca6bd4f2010-03-02 14:12:58 -0800711AC_ARG_WITH([static_libunwind],
712 [AS_HELP_STRING([--with-static-libunwind=<libunwind.a>],
713 [Path to static libunwind library; use rather than dynamically linking])],
714if test "x$with_static_libunwind" = "xno" ; then
715 LUNWIND="-lunwind"
716else
717 if test ! -f "$with_static_libunwind" ; then
718 AC_MSG_ERROR([Static libunwind not found: $with_static_libunwind])
719 fi
720 LUNWIND="$with_static_libunwind"
721fi,
722 LUNWIND="-lunwind"
723)
Jason Evans77f350b2011-03-15 22:23:12 -0700724if test "x$backtrace_method" = "x" -a "x$enable_prof_libunwind" = "x1" ; then
725 AC_CHECK_HEADERS([libunwind.h], , [enable_prof_libunwind="0"])
726 if test "x$LUNWIND" = "x-lunwind" ; then
Jason Evans05125b82014-04-22 20:48:07 -0700727 AC_CHECK_LIB([unwind], [unw_backtrace], [LIBS="$LIBS $LUNWIND"],
Jason Evans77f350b2011-03-15 22:23:12 -0700728 [enable_prof_libunwind="0"])
729 else
730 LIBS="$LIBS $LUNWIND"
731 fi
732 if test "x${enable_prof_libunwind}" = "x1" ; then
733 backtrace_method="libunwind"
734 AC_DEFINE([JEMALLOC_PROF_LIBUNWIND], [ ])
735 fi
736fi
737
738AC_ARG_ENABLE([prof-libgcc],
739 [AS_HELP_STRING([--disable-prof-libgcc],
740 [Do not use libgcc for backtracing])],
741[if test "x$enable_prof_libgcc" = "xno" ; then
742 enable_prof_libgcc="0"
743else
744 enable_prof_libgcc="1"
745fi
746],
747[enable_prof_libgcc="1"]
748)
749if test "x$backtrace_method" = "x" -a "x$enable_prof_libgcc" = "x1" \
750 -a "x$GCC" = "xyes" ; then
751 AC_CHECK_HEADERS([unwind.h], , [enable_prof_libgcc="0"])
752 AC_CHECK_LIB([gcc], [_Unwind_Backtrace], [LIBS="$LIBS -lgcc"], [enable_prof_libgcc="0"])
Jason Evans77f350b2011-03-15 22:23:12 -0700753 if test "x${enable_prof_libgcc}" = "x1" ; then
754 backtrace_method="libgcc"
755 AC_DEFINE([JEMALLOC_PROF_LIBGCC], [ ])
756 fi
757else
758 enable_prof_libgcc="0"
759fi
760
761AC_ARG_ENABLE([prof-gcc],
762 [AS_HELP_STRING([--disable-prof-gcc],
763 [Do not use gcc intrinsics for backtracing])],
764[if test "x$enable_prof_gcc" = "xno" ; then
765 enable_prof_gcc="0"
766else
767 enable_prof_gcc="1"
768fi
769],
770[enable_prof_gcc="1"]
771)
772if test "x$backtrace_method" = "x" -a "x$enable_prof_gcc" = "x1" \
773 -a "x$GCC" = "xyes" ; then
Jason Evanse181f5a2014-03-30 18:58:32 -0700774 JE_CFLAGS_APPEND([-fno-omit-frame-pointer])
Jason Evans77f350b2011-03-15 22:23:12 -0700775 backtrace_method="gcc intrinsics"
776 AC_DEFINE([JEMALLOC_PROF_GCC], [ ])
777else
778 enable_prof_gcc="0"
779fi
780
781if test "x$backtrace_method" = "x" ; then
782 backtrace_method="none (disabling profiling)"
783 enable_prof="0"
784fi
785AC_MSG_CHECKING([configured backtracing method])
786AC_MSG_RESULT([$backtrace_method])
Jason Evans2dbecf12010-09-05 10:35:13 -0700787if test "x$enable_prof" = "x1" ; then
Jason Evansd37d5ad2013-12-05 23:01:50 -0800788 if test "x$abi" != "xpecoff"; then
789 dnl Heap profiling uses the log(3) function.
790 LIBS="$LIBS -lm"
791 fi
792
Jason Evans2dbecf12010-09-05 10:35:13 -0700793 AC_DEFINE([JEMALLOC_PROF], [ ])
Jason Evans2dbecf12010-09-05 10:35:13 -0700794fi
795AC_SUBST([enable_prof])
Jason Evans2dbecf12010-09-05 10:35:13 -0700796
Jason Evans84cbbcb2009-12-29 00:09:15 -0800797dnl Enable thread-specific caching by default.
798AC_ARG_ENABLE([tcache],
799 [AS_HELP_STRING([--disable-tcache], [Disable per thread caches])],
800[if test "x$enable_tcache" = "xno" ; then
801 enable_tcache="0"
Jason Evansb7924f52009-06-23 19:01:18 -0700802else
Jason Evans84cbbcb2009-12-29 00:09:15 -0800803 enable_tcache="1"
Jason Evansb7924f52009-06-23 19:01:18 -0700804fi
805],
Jason Evans84cbbcb2009-12-29 00:09:15 -0800806[enable_tcache="1"]
Jason Evansb7924f52009-06-23 19:01:18 -0700807)
Jason Evans2dbecf12010-09-05 10:35:13 -0700808if test "x$enable_tcache" = "x1" ; then
809 AC_DEFINE([JEMALLOC_TCACHE], [ ])
810fi
811AC_SUBST([enable_tcache])
Jason Evansb7924f52009-06-23 19:01:18 -0700812
Jason Evans59ae2762012-04-16 17:52:27 -0700813dnl Enable VM deallocation via munmap() by default.
814AC_ARG_ENABLE([munmap],
815 [AS_HELP_STRING([--disable-munmap], [Disable VM deallocation via munmap(2)])],
816[if test "x$enable_munmap" = "xno" ; then
817 enable_munmap="0"
818else
819 enable_munmap="1"
820fi
821],
822[enable_munmap="${default_munmap}"]
823)
824if test "x$enable_munmap" = "x1" ; then
825 AC_DEFINE([JEMALLOC_MUNMAP], [ ])
826fi
827AC_SUBST([enable_munmap])
828
Jason Evans4d434ad2014-04-15 12:09:48 -0700829dnl Enable allocation from DSS if supported by the OS.
830have_dss="1"
Mike Hommey83c324a2012-04-12 10:13:03 +0200831dnl Check whether the BSD/SUSv1 sbrk() exists. If not, disable DSS support.
832AC_CHECK_FUNC([sbrk], [have_sbrk="1"], [have_sbrk="0"])
833if test "x$have_sbrk" = "x1" ; then
Steven Stewart-Gallus79230fe2014-06-19 16:11:43 -0700834 if test "x$sbrk_deprecated" = "x1" ; then
Jason Evans66688532013-12-03 21:49:36 -0800835 AC_MSG_RESULT([Disabling dss allocation because sbrk is deprecated])
Jason Evans4d434ad2014-04-15 12:09:48 -0700836 have_dss="0"
Jason Evans66688532013-12-03 21:49:36 -0800837 fi
Mike Hommey83c324a2012-04-12 10:13:03 +0200838else
Jason Evans4d434ad2014-04-15 12:09:48 -0700839 have_dss="0"
Mike Hommey83c324a2012-04-12 10:13:03 +0200840fi
841
Jason Evans4d434ad2014-04-15 12:09:48 -0700842if test "x$have_dss" = "x1" ; then
Jason Evansb7924f52009-06-23 19:01:18 -0700843 AC_DEFINE([JEMALLOC_DSS], [ ])
844fi
Jason Evansb7924f52009-06-23 19:01:18 -0700845
Jason Evans777c1912012-02-28 20:49:22 -0800846dnl Support the junk/zero filling option by default.
Jason Evansb7924f52009-06-23 19:01:18 -0700847AC_ARG_ENABLE([fill],
Jason Evans122449b2012-04-06 00:35:09 -0700848 [AS_HELP_STRING([--disable-fill],
849 [Disable support for junk/zero filling, quarantine, and redzones])],
Jason Evansb7924f52009-06-23 19:01:18 -0700850[if test "x$enable_fill" = "xno" ; then
851 enable_fill="0"
852else
853 enable_fill="1"
854fi
855],
Jason Evans777c1912012-02-28 20:49:22 -0800856[enable_fill="1"]
Jason Evansb7924f52009-06-23 19:01:18 -0700857)
858if test "x$enable_fill" = "x1" ; then
859 AC_DEFINE([JEMALLOC_FILL], [ ])
860fi
861AC_SUBST([enable_fill])
862
Jason Evansb1476112012-04-05 13:36:17 -0700863dnl Disable utrace(2)-based tracing by default.
864AC_ARG_ENABLE([utrace],
865 [AS_HELP_STRING([--enable-utrace], [Enable utrace(2)-based tracing])],
866[if test "x$enable_utrace" = "xno" ; then
867 enable_utrace="0"
868else
869 enable_utrace="1"
870fi
871],
872[enable_utrace="0"]
873)
874JE_COMPILABLE([utrace(2)], [
875#include <sys/types.h>
876#include <sys/param.h>
877#include <sys/time.h>
878#include <sys/uio.h>
879#include <sys/ktrace.h>
880], [
881 utrace((void *)0, 0);
882], [je_cv_utrace])
883if test "x${je_cv_utrace}" = "xno" ; then
884 enable_utrace="0"
885fi
886if test "x$enable_utrace" = "x1" ; then
887 AC_DEFINE([JEMALLOC_UTRACE], [ ])
888fi
889AC_SUBST([enable_utrace])
890
Jason Evans122449b2012-04-06 00:35:09 -0700891dnl Support Valgrind by default.
892AC_ARG_ENABLE([valgrind],
893 [AS_HELP_STRING([--disable-valgrind], [Disable support for Valgrind])],
894[if test "x$enable_valgrind" = "xno" ; then
895 enable_valgrind="0"
896else
897 enable_valgrind="1"
898fi
899],
900[enable_valgrind="1"]
901)
902if test "x$enable_valgrind" = "x1" ; then
903 JE_COMPILABLE([valgrind], [
904#include <valgrind/valgrind.h>
905#include <valgrind/memcheck.h>
906
Mike Hommey7bfecf42012-04-30 15:15:15 +0200907#if !defined(VALGRIND_RESIZEINPLACE_BLOCK)
Jason Evans122449b2012-04-06 00:35:09 -0700908# error "Incompatible Valgrind version"
909#endif
910], [], [je_cv_valgrind])
911 if test "x${je_cv_valgrind}" = "xno" ; then
912 enable_valgrind="0"
913 fi
914 if test "x$enable_valgrind" = "x1" ; then
915 AC_DEFINE([JEMALLOC_VALGRIND], [ ])
916 fi
917fi
918AC_SUBST([enable_valgrind])
919
Jason Evansb7924f52009-06-23 19:01:18 -0700920dnl Do not support the xmalloc option by default.
921AC_ARG_ENABLE([xmalloc],
922 [AS_HELP_STRING([--enable-xmalloc], [Support xmalloc option])],
923[if test "x$enable_xmalloc" = "xno" ; then
924 enable_xmalloc="0"
925else
926 enable_xmalloc="1"
927fi
928],
929[enable_xmalloc="0"]
930)
931if test "x$enable_xmalloc" = "x1" ; then
932 AC_DEFINE([JEMALLOC_XMALLOC], [ ])
933fi
934AC_SUBST([enable_xmalloc])
935
Mike Hommey8f50ec82014-06-04 12:12:55 +0900936dnl ============================================================================
937dnl Check for __builtin_ffsl(), then ffsl(3), and fail if neither are found.
938dnl One of those two functions should (theoretically) exist on all platforms
939dnl that jemalloc currently has a chance of functioning on without modification.
940dnl We additionally assume ffs() or __builtin_ffs() are defined if
941dnl ffsl() or __builtin_ffsl() are defined, respectively.
942JE_COMPILABLE([a program using __builtin_ffsl], [
943#include <stdio.h>
944#include <strings.h>
945#include <string.h>
946], [
947 {
948 int rv = __builtin_ffsl(0x08);
949 printf("%d\n", rv);
950 }
951], [je_cv_gcc_builtin_ffsl])
Steven Stewart-Gallus79230fe2014-06-19 16:11:43 -0700952if test "x${je_cv_gcc_builtin_ffsl}" = "xyes" ; then
Mike Hommey8f50ec82014-06-04 12:12:55 +0900953 AC_DEFINE([JEMALLOC_INTERNAL_FFSL], [__builtin_ffsl])
954 AC_DEFINE([JEMALLOC_INTERNAL_FFS], [__builtin_ffs])
955else
956 JE_COMPILABLE([a program using ffsl], [
957 #include <stdio.h>
958 #include <strings.h>
959 #include <string.h>
960 ], [
961 {
962 int rv = ffsl(0x08);
963 printf("%d\n", rv);
964 }
965 ], [je_cv_function_ffsl])
Steven Stewart-Gallus79230fe2014-06-19 16:11:43 -0700966 if test "x${je_cv_function_ffsl}" = "xyes" ; then
Mike Hommey8f50ec82014-06-04 12:12:55 +0900967 AC_DEFINE([JEMALLOC_INTERNAL_FFSL], [ffsl])
968 AC_DEFINE([JEMALLOC_INTERNAL_FFS], [ffs])
969 else
970 AC_MSG_ERROR([Cannot build without ffsl(3) or __builtin_ffsl()])
971 fi
972fi
973
Jason Evans81e54752014-10-10 22:34:25 -0700974AC_ARG_WITH([lg_tiny_min],
975 [AS_HELP_STRING([--with-lg-tiny-min=<lg-tiny-min>],
976 [Base 2 log of minimum tiny size class to support])],
977 [LG_TINY_MIN="$with_lg_tiny_min"],
978 [LG_TINY_MIN="3"])
979AC_DEFINE_UNQUOTED([LG_TINY_MIN], [$LG_TINY_MIN])
980
Jason Evansfc0b3b72014-10-09 17:54:06 -0700981AC_ARG_WITH([lg_quantum],
982 [AS_HELP_STRING([--with-lg-quantum=<lg-quantum>],
983 [Base 2 log of minimum allocation alignment])],
Jason Evans81e54752014-10-10 22:34:25 -0700984 [LG_QUANTA="$with_lg_quantum"],
985 [LG_QUANTA="3 4"])
986if test "x$with_lg_quantum" != "x" ; then
987 AC_DEFINE_UNQUOTED([LG_QUANTUM], [$with_lg_quantum])
988fi
Jason Evansfc0b3b72014-10-09 17:54:06 -0700989
990AC_ARG_WITH([lg_page],
991 [AS_HELP_STRING([--with-lg-page=<lg-page>], [Base 2 log of system page size])],
992 [LG_PAGE="$with_lg_page"], [LG_PAGE="detect"])
993if test "x$LG_PAGE" == "xdetect"; then
994 AC_CACHE_CHECK([LG_PAGE],
995 [je_cv_lg_page],
Jason Evans6684cac2012-03-05 12:15:36 -0800996 AC_RUN_IFELSE([AC_LANG_PROGRAM(
Mike Hommeya19e87f2012-04-21 21:27:46 -0700997[[
Mike Hommeyfd97b1d2012-04-30 12:38:31 +0200998#include <strings.h>
Mike Hommeya19e87f2012-04-21 21:27:46 -0700999#ifdef _WIN32
1000#include <windows.h>
1001#else
Jason Evansb7924f52009-06-23 19:01:18 -07001002#include <unistd.h>
Mike Hommeya19e87f2012-04-21 21:27:46 -07001003#endif
1004#include <stdio.h>
Jason Evans6684cac2012-03-05 12:15:36 -08001005]],
1006[[
Garrett Cooper72c1e592012-12-02 17:57:28 -08001007 int result;
Jason Evansb7924f52009-06-23 19:01:18 -07001008 FILE *f;
1009
Mike Hommeya19e87f2012-04-21 21:27:46 -07001010#ifdef _WIN32
1011 SYSTEM_INFO si;
1012 GetSystemInfo(&si);
1013 result = si.dwPageSize;
1014#else
Jason Evansb7924f52009-06-23 19:01:18 -07001015 result = sysconf(_SC_PAGESIZE);
Mike Hommeya19e87f2012-04-21 21:27:46 -07001016#endif
Jason Evansb7924f52009-06-23 19:01:18 -07001017 if (result == -1) {
1018 return 1;
1019 }
Mike Hommey8f50ec82014-06-04 12:12:55 +09001020 result = JEMALLOC_INTERNAL_FFSL(result) - 1;
Mike Hommeya19e87f2012-04-21 21:27:46 -07001021
Jason Evansb7924f52009-06-23 19:01:18 -07001022 f = fopen("conftest.out", "w");
1023 if (f == NULL) {
1024 return 1;
1025 }
Garrett Cooper72c1e592012-12-02 17:57:28 -08001026 fprintf(f, "%d\n", result);
Jason Evans3cc1f1a2012-04-03 22:30:05 -07001027 fclose(f);
Jason Evansb7924f52009-06-23 19:01:18 -07001028
1029 return 0;
1030]])],
Jason Evansfc0b3b72014-10-09 17:54:06 -07001031 [je_cv_lg_page=`cat conftest.out`],
1032 [je_cv_lg_page=undefined],
1033 [je_cv_lg_page=12]))
Jason Evans6684cac2012-03-05 12:15:36 -08001034fi
Jason Evansfc0b3b72014-10-09 17:54:06 -07001035if test "x${je_cv_lg_page}" != "x" ; then
1036 LG_PAGE="${je_cv_lg_page}"
1037fi
1038if test "x${LG_PAGE}" != "xundefined" ; then
1039 AC_DEFINE_UNQUOTED([LG_PAGE], [$LG_PAGE])
1040else
1041 AC_MSG_ERROR([cannot determine value for LG_PAGE])
1042fi
1043
1044AC_ARG_WITH([lg_page_sizes],
1045 [AS_HELP_STRING([--with-lg-page-sizes=<lg-page-sizes>],
1046 [Base 2 logs of system page sizes to support])],
1047 [LG_PAGE_SIZES="$with_lg_page_sizes"], [LG_PAGE_SIZES="$LG_PAGE"])
1048
1049AC_ARG_WITH([lg_size_class_group],
1050 [AS_HELP_STRING([--with-lg-size-class-group=<lg-size-class-group>],
1051 [Base 2 log of size classes per doubling])],
1052 [LG_SIZE_CLASS_GROUP="$with_lg_size_class_group"],
1053 [LG_SIZE_CLASS_GROUP="2"])
Jason Evansb7924f52009-06-23 19:01:18 -07001054
1055dnl ============================================================================
1056dnl jemalloc configuration.
1057dnl
Jason Evansa40bc7a2010-03-02 13:01:16 -08001058
Jason Evansa5a658a2014-09-02 15:07:07 -07001059dnl Set VERSION if source directory is inside a git repository.
1060if test "x`git rev-parse --is-inside-work-tree 2>/dev/null`" = "xtrue" ; then
1061 dnl Pattern globs aren't powerful enough to match both single- and
1062 dnl double-digit version numbers, so iterate over patterns to support up to
1063 dnl version 99.99.99 without any accidental matches.
1064 rm -f "${srcroot}VERSION"
1065 for pattern in ['[0-9].[0-9].[0-9]' '[0-9].[0-9].[0-9][0-9]' \
1066 '[0-9].[0-9][0-9].[0-9]' '[0-9].[0-9][0-9].[0-9][0-9]' \
1067 '[0-9][0-9].[0-9].[0-9]' '[0-9][0-9].[0-9].[0-9][0-9]' \
1068 '[0-9][0-9].[0-9][0-9].[0-9]' \
1069 '[0-9][0-9].[0-9][0-9].[0-9][0-9]']; do
1070 if test ! -e "${srcroot}VERSION" ; then
1071 git describe --long --abbrev=40 --match="${pattern}" > "${srcroot}VERSION.tmp" 2>/dev/null
1072 if test $? -eq 0 ; then
1073 mv "${srcroot}VERSION.tmp" "${srcroot}VERSION"
1074 break
1075 fi
1076 fi
1077 done
Jason Evansa40bc7a2010-03-02 13:01:16 -08001078fi
Jason Evansa5a658a2014-09-02 15:07:07 -07001079rm -f "${srcroot}VERSION.tmp"
1080if test ! -e "${srcroot}VERSION" ; then
1081 AC_MSG_RESULT(
1082 [Missing VERSION file, and unable to generate it; creating bogus VERSION])
1083 echo "0.0.0-0-g0000000000000000000000000000000000000000" > "${srcroot}VERSION"
1084fi
1085jemalloc_version=`cat "${srcroot}VERSION"`
Jason Evansa40bc7a2010-03-02 13:01:16 -08001086jemalloc_version_major=`echo ${jemalloc_version} | tr ".g-" " " | awk '{print [$]1}'`
1087jemalloc_version_minor=`echo ${jemalloc_version} | tr ".g-" " " | awk '{print [$]2}'`
1088jemalloc_version_bugfix=`echo ${jemalloc_version} | tr ".g-" " " | awk '{print [$]3}'`
1089jemalloc_version_nrev=`echo ${jemalloc_version} | tr ".g-" " " | awk '{print [$]4}'`
1090jemalloc_version_gid=`echo ${jemalloc_version} | tr ".g-" " " | awk '{print [$]5}'`
Jason Evansb7924f52009-06-23 19:01:18 -07001091AC_SUBST([jemalloc_version])
Jason Evansa40bc7a2010-03-02 13:01:16 -08001092AC_SUBST([jemalloc_version_major])
1093AC_SUBST([jemalloc_version_minor])
1094AC_SUBST([jemalloc_version_bugfix])
1095AC_SUBST([jemalloc_version_nrev])
1096AC_SUBST([jemalloc_version_gid])
Jason Evansb7924f52009-06-23 19:01:18 -07001097
1098dnl ============================================================================
1099dnl Configure pthreads.
1100
Mike Hommeya19e87f2012-04-21 21:27:46 -07001101if test "x$abi" != "xpecoff" ; then
1102 AC_CHECK_HEADERS([pthread.h], , [AC_MSG_ERROR([pthread.h is missing])])
1103 dnl Some systems may embed pthreads functionality in libc; check for libpthread
1104 dnl first, but try libc too before failing.
1105 AC_CHECK_LIB([pthread], [pthread_create], [LIBS="$LIBS -lpthread"],
1106 [AC_SEARCH_LIBS([pthread_create], , ,
1107 AC_MSG_ERROR([libpthread is missing]))])
1108fi
Jason Evansb7924f52009-06-23 19:01:18 -07001109
1110CPPFLAGS="$CPPFLAGS -D_REENTRANT"
1111
Daniel Micayb74041f2014-12-09 17:41:34 -05001112dnl Check if the GNU-specific secure_getenv function exists.
1113AC_CHECK_FUNC([secure_getenv],
1114 [have_secure_getenv="1"],
1115 [have_secure_getenv="0"]
1116 )
1117if test "x$have_secure_getenv" = "x1" ; then
1118 AC_DEFINE([JEMALLOC_HAVE_SECURE_GETENV], [ ])
1119fi
1120
1121dnl Check if the Solaris/BSD issetugid function exists.
1122AC_CHECK_FUNC([issetugid],
1123 [have_issetugid="1"],
1124 [have_issetugid="0"]
1125 )
1126if test "x$have_issetugid" = "x1" ; then
1127 AC_DEFINE([JEMALLOC_HAVE_ISSETUGID], [ ])
1128fi
1129
Jason Evanscd9a1342012-03-21 18:33:03 -07001130dnl Check whether the BSD-specific _malloc_thread_cleanup() exists. If so, use
1131dnl it rather than pthreads TSD cleanup functions to support cleanup during
1132dnl thread exit, in order to avoid pthreads library recursion during
1133dnl bootstrapping.
Jason Evanscd9a1342012-03-21 18:33:03 -07001134AC_CHECK_FUNC([_malloc_thread_cleanup],
1135 [have__malloc_thread_cleanup="1"],
1136 [have__malloc_thread_cleanup="0"]
1137 )
1138if test "x$have__malloc_thread_cleanup" = "x1" ; then
1139 AC_DEFINE([JEMALLOC_MALLOC_THREAD_CLEANUP], [ ])
1140 force_tls="1"
1141fi
1142
Jason Evans41b6afb2012-02-02 22:04:57 -08001143dnl Check whether the BSD-specific _pthread_mutex_init_calloc_cb() exists. If
1144dnl so, mutex initialization causes allocation, and we need to implement this
1145dnl callback function in order to prevent recursive allocation.
1146AC_CHECK_FUNC([_pthread_mutex_init_calloc_cb],
1147 [have__pthread_mutex_init_calloc_cb="1"],
1148 [have__pthread_mutex_init_calloc_cb="0"]
1149 )
1150if test "x$have__pthread_mutex_init_calloc_cb" = "x1" ; then
1151 AC_DEFINE([JEMALLOC_MUTEX_INIT_CB])
1152fi
1153
Jason Evans0fee70d2012-02-13 12:36:11 -08001154dnl Disable lazy locking by default.
Jason Evansb7924f52009-06-23 19:01:18 -07001155AC_ARG_ENABLE([lazy_lock],
Jason Evans0fee70d2012-02-13 12:36:11 -08001156 [AS_HELP_STRING([--enable-lazy-lock],
1157 [Enable lazy locking (only lock when multi-threaded)])],
Jason Evansb7924f52009-06-23 19:01:18 -07001158[if test "x$enable_lazy_lock" = "xno" ; then
1159 enable_lazy_lock="0"
1160else
1161 enable_lazy_lock="1"
1162fi
1163],
Jason Evans0fee70d2012-02-13 12:36:11 -08001164[enable_lazy_lock="0"]
Jason Evansb7924f52009-06-23 19:01:18 -07001165)
Jason Evansfd4fcef2012-03-23 17:40:58 -07001166if test "x$enable_lazy_lock" = "x0" -a "x${force_lazy_lock}" = "x1" ; then
1167 AC_MSG_RESULT([Forcing lazy-lock to avoid allocator/threading bootstrap issues])
1168 enable_lazy_lock="1"
1169fi
Jason Evansb7924f52009-06-23 19:01:18 -07001170if test "x$enable_lazy_lock" = "x1" ; then
Mike Hommeya19e87f2012-04-21 21:27:46 -07001171 if test "x$abi" != "xpecoff" ; then
1172 AC_CHECK_HEADERS([dlfcn.h], , [AC_MSG_ERROR([dlfcn.h is missing])])
1173 AC_CHECK_FUNC([dlsym], [],
1174 [AC_CHECK_LIB([dl], [dlsym], [LIBS="$LIBS -ldl"],
1175 [AC_MSG_ERROR([libdl is missing])])
1176 ])
1177 fi
Jason Evansb7924f52009-06-23 19:01:18 -07001178 AC_DEFINE([JEMALLOC_LAZY_LOCK], [ ])
1179fi
1180AC_SUBST([enable_lazy_lock])
1181
Jason Evans78d815c2010-01-17 14:06:20 -08001182AC_ARG_ENABLE([tls],
1183 [AS_HELP_STRING([--disable-tls], [Disable thread-local storage (__thread keyword)])],
1184if test "x$enable_tls" = "xno" ; then
1185 enable_tls="0"
1186else
1187 enable_tls="1"
1188fi
1189,
1190enable_tls="1"
1191)
Jason Evanscd9a1342012-03-21 18:33:03 -07001192if test "x${enable_tls}" = "x0" -a "x${force_tls}" = "x1" ; then
1193 AC_MSG_RESULT([Forcing TLS to avoid allocator/threading bootstrap issues])
1194 enable_tls="1"
1195fi
Jason Evansb80581d2012-03-23 16:17:43 -07001196if test "x${enable_tls}" = "x1" -a "x${force_tls}" = "x0" ; then
1197 AC_MSG_RESULT([Forcing no TLS to avoid allocator/threading bootstrap issues])
1198 enable_tls="0"
1199fi
Jason Evans78d815c2010-01-17 14:06:20 -08001200if test "x${enable_tls}" = "x1" ; then
1201AC_MSG_CHECKING([for TLS])
Jason Evans6684cac2012-03-05 12:15:36 -08001202AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
Jason Evans78d815c2010-01-17 14:06:20 -08001203[[
1204 __thread int x;
1205]], [[
1206 x = 42;
1207
1208 return 0;
1209]])],
1210 AC_MSG_RESULT([yes]),
1211 AC_MSG_RESULT([no])
1212 enable_tls="0")
1213fi
Jason Evansb267d0f2010-08-13 15:42:29 -07001214AC_SUBST([enable_tls])
Jason Evanse24c7af2012-03-19 10:21:17 -07001215if test "x${enable_tls}" = "x1" ; then
1216 AC_DEFINE_UNQUOTED([JEMALLOC_TLS], [ ])
Jason Evanscd9a1342012-03-21 18:33:03 -07001217elif test "x${force_tls}" = "x1" ; then
1218 AC_MSG_ERROR([Failed to configure TLS, which is mandatory for correct function])
Jason Evans78d815c2010-01-17 14:06:20 -08001219fi
1220
Jason Evans2dbecf12010-09-05 10:35:13 -07001221dnl ============================================================================
Chih-hung Hsieh59cd80e2014-12-05 17:42:41 -08001222dnl Check for C11 atomics.
1223
1224JE_COMPILABLE([C11 atomics], [
1225#include <stdint.h>
1226#if (__STDC_VERSION__ >= 201112L) && !defined(__STDC_NO_ATOMICS__)
1227#include <stdatomic.h>
1228#else
1229#error Atomics not available
1230#endif
1231], [
1232 uint64_t *p = (uint64_t *)0;
1233 uint64_t x = 1;
1234 volatile atomic_uint_least64_t *a = (volatile atomic_uint_least64_t *)p;
1235 uint64_t r = atomic_fetch_add(a, x) + x;
1236 return (r == 0);
1237], [je_cv_c11atomics])
1238if test "x${je_cv_c11atomics}" = "xyes" ; then
1239 AC_DEFINE([JEMALLOC_C11ATOMICS])
1240fi
1241
1242dnl ============================================================================
Jason Evansb57d3ec2012-04-17 13:17:54 -07001243dnl Check for atomic(9) operations as provided on FreeBSD.
1244
1245JE_COMPILABLE([atomic(9)], [
1246#include <sys/types.h>
1247#include <machine/atomic.h>
1248#include <inttypes.h>
1249], [
1250 {
1251 uint32_t x32 = 0;
1252 volatile uint32_t *x32p = &x32;
1253 atomic_fetchadd_32(x32p, 1);
1254 }
1255 {
1256 unsigned long xlong = 0;
1257 volatile unsigned long *xlongp = &xlong;
1258 atomic_fetchadd_long(xlongp, 1);
1259 }
1260], [je_cv_atomic9])
1261if test "x${je_cv_atomic9}" = "xyes" ; then
1262 AC_DEFINE([JEMALLOC_ATOMIC9])
1263fi
1264
1265dnl ============================================================================
Jason Evans763baa62011-03-18 19:10:31 -07001266dnl Check for atomic(3) operations as provided on Darwin.
1267
1268JE_COMPILABLE([Darwin OSAtomic*()], [
1269#include <libkern/OSAtomic.h>
1270#include <inttypes.h>
1271], [
1272 {
1273 int32_t x32 = 0;
1274 volatile int32_t *x32p = &x32;
1275 OSAtomicAdd32(1, x32p);
1276 }
1277 {
1278 int64_t x64 = 0;
1279 volatile int64_t *x64p = &x64;
1280 OSAtomicAdd64(1, x64p);
1281 }
Jason Evans6684cac2012-03-05 12:15:36 -08001282], [je_cv_osatomic])
1283if test "x${je_cv_osatomic}" = "xyes" ; then
Jason Evanse24c7af2012-03-19 10:21:17 -07001284 AC_DEFINE([JEMALLOC_OSATOMIC], [ ])
Jason Evans763baa62011-03-18 19:10:31 -07001285fi
1286
1287dnl ============================================================================
Richard Diamond994fad92014-06-03 02:39:18 -05001288dnl Check for madvise(2).
1289
1290JE_COMPILABLE([madvise(2)], [
1291#include <sys/mman.h>
1292], [
1293 {
1294 madvise((void *)0, 0, 0);
1295 }
1296], [je_cv_madvise])
1297if test "x${je_cv_madvise}" = "xyes" ; then
1298 AC_DEFINE([JEMALLOC_HAVE_MADVISE], [ ])
1299fi
1300
1301dnl ============================================================================
Mike Hommeyc1e567b2012-03-26 17:03:41 +02001302dnl Check whether __sync_{add,sub}_and_fetch() are available despite
1303dnl __GCC_HAVE_SYNC_COMPARE_AND_SWAP_n macros being undefined.
1304
1305AC_DEFUN([JE_SYNC_COMPARE_AND_SWAP_CHECK],[
1306 AC_CACHE_CHECK([whether to force $1-bit __sync_{add,sub}_and_fetch()],
1307 [je_cv_sync_compare_and_swap_$2],
Mike Hommey2cfe6d62012-03-27 15:03:07 +02001308 [AC_LINK_IFELSE([AC_LANG_PROGRAM([
1309 #include <stdint.h>
1310 ],
1311 [
1312 #ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_$2
1313 {
1314 uint$1_t x$1 = 0;
1315 __sync_add_and_fetch(&x$1, 42);
1316 __sync_sub_and_fetch(&x$1, 1);
1317 }
1318 #else
1319 #error __GCC_HAVE_SYNC_COMPARE_AND_SWAP_$2 is defined, no need to force
1320 #endif
1321 ])],
Mike Hommeyc1e567b2012-03-26 17:03:41 +02001322 [je_cv_sync_compare_and_swap_$2=yes],
1323 [je_cv_sync_compare_and_swap_$2=no])])
1324
1325 if test "x${je_cv_sync_compare_and_swap_$2}" = "xyes" ; then
1326 AC_DEFINE([JE_FORCE_SYNC_COMPARE_AND_SWAP_$2], [ ])
1327 fi
1328])
1329
Jason Evansb57d3ec2012-04-17 13:17:54 -07001330if test "x${je_cv_atomic9}" != "xyes" -a "x${je_cv_osatomic}" != "xyes" ; then
Mike Hommeyc1e567b2012-03-26 17:03:41 +02001331 JE_SYNC_COMPARE_AND_SWAP_CHECK(32, 4)
1332 JE_SYNC_COMPARE_AND_SWAP_CHECK(64, 8)
1333fi
1334
1335dnl ============================================================================
Jason Evansd04047c2014-05-28 16:11:55 -07001336dnl Check for __builtin_clz() and __builtin_clzl().
1337
1338AC_CACHE_CHECK([for __builtin_clz],
1339 [je_cv_builtin_clz],
1340 [AC_LINK_IFELSE([AC_LANG_PROGRAM([],
1341 [
1342 {
1343 unsigned x = 0;
1344 int y = __builtin_clz(x);
1345 }
1346 {
1347 unsigned long x = 0;
1348 int y = __builtin_clzl(x);
1349 }
1350 ])],
1351 [je_cv_builtin_clz=yes],
1352 [je_cv_builtin_clz=no])])
1353
1354if test "x${je_cv_builtin_clz}" = "xyes" ; then
1355 AC_DEFINE([JEMALLOC_HAVE_BUILTIN_CLZ], [ ])
1356fi
1357
1358dnl ============================================================================
Jason Evans893a0ed2011-03-18 19:30:18 -07001359dnl Check for spinlock(3) operations as provided on Darwin.
1360
1361JE_COMPILABLE([Darwin OSSpin*()], [
1362#include <libkern/OSAtomic.h>
1363#include <inttypes.h>
1364], [
1365 OSSpinLock lock = 0;
1366 OSSpinLockLock(&lock);
1367 OSSpinLockUnlock(&lock);
Jason Evans6684cac2012-03-05 12:15:36 -08001368], [je_cv_osspin])
1369if test "x${je_cv_osspin}" = "xyes" ; then
Jason Evanse24c7af2012-03-19 10:21:17 -07001370 AC_DEFINE([JEMALLOC_OSSPIN], [ ])
Jason Evans893a0ed2011-03-18 19:30:18 -07001371fi
1372
1373dnl ============================================================================
Jason Evans2dbecf12010-09-05 10:35:13 -07001374dnl Darwin-related configuration.
Jason Evans78d815c2010-01-17 14:06:20 -08001375
Mike Hommeyd0357f72012-11-26 18:52:41 +01001376AC_ARG_ENABLE([zone-allocator],
1377 [AS_HELP_STRING([--disable-zone-allocator],
1378 [Disable zone allocator for Darwin])],
1379[if test "x$enable_zone_allocator" = "xno" ; then
1380 enable_zone_allocator="0"
1381else
1382 enable_zone_allocator="1"
1383fi
1384],
1385[if test "x${abi}" = "xmacho"; then
1386 enable_zone_allocator="1"
1387fi
1388]
1389)
1390AC_SUBST([enable_zone_allocator])
1391
1392if test "x${enable_zone_allocator}" = "x1" ; then
1393 if test "x${abi}" != "xmacho"; then
1394 AC_MSG_ERROR([--enable-zone-allocator is only supported on Darwin])
1395 fi
Jason Evanse24c7af2012-03-19 10:21:17 -07001396 AC_DEFINE([JEMALLOC_IVSALLOC], [ ])
1397 AC_DEFINE([JEMALLOC_ZONE], [ ])
Jason Evans6109fe02010-02-10 10:37:56 -08001398
Jason Evans2dbecf12010-09-05 10:35:13 -07001399 dnl The szone version jumped from 3 to 6 between the OS X 10.5.x and 10.6
1400 dnl releases. malloc_zone_t and malloc_introspection_t have new fields in
1401 dnl 10.6, which is the only source-level indication of the change.
1402 AC_MSG_CHECKING([malloc zone version])
Mike Hommey154829d2012-03-20 18:01:38 +01001403 AC_DEFUN([JE_ZONE_PROGRAM],
1404 [AC_LANG_PROGRAM(
1405 [#include <malloc/malloc.h>],
Guilherme Goncalves79725aa2014-10-20 14:08:37 -02001406 [static int foo[[sizeof($1) $2 sizeof(void *) * $3 ? 1 : -1]]]
Mike Hommey154829d2012-03-20 18:01:38 +01001407 )])
Jason Evans2dbecf12010-09-05 10:35:13 -07001408
Mike Hommey154829d2012-03-20 18:01:38 +01001409 AC_COMPILE_IFELSE([JE_ZONE_PROGRAM(malloc_zone_t,==,14)],[JEMALLOC_ZONE_VERSION=3],[
1410 AC_COMPILE_IFELSE([JE_ZONE_PROGRAM(malloc_zone_t,==,15)],[JEMALLOC_ZONE_VERSION=5],[
1411 AC_COMPILE_IFELSE([JE_ZONE_PROGRAM(malloc_zone_t,==,16)],[
1412 AC_COMPILE_IFELSE([JE_ZONE_PROGRAM(malloc_introspection_t,==,9)],[JEMALLOC_ZONE_VERSION=6],[
1413 AC_COMPILE_IFELSE([JE_ZONE_PROGRAM(malloc_introspection_t,==,13)],[JEMALLOC_ZONE_VERSION=7],[JEMALLOC_ZONE_VERSION=]
1414 )])],[
1415 AC_COMPILE_IFELSE([JE_ZONE_PROGRAM(malloc_zone_t,==,17)],[JEMALLOC_ZONE_VERSION=8],[
1416 AC_COMPILE_IFELSE([JE_ZONE_PROGRAM(malloc_zone_t,>,17)],[JEMALLOC_ZONE_VERSION=9],[JEMALLOC_ZONE_VERSION=]
1417 )])])])])
1418 if test "x${JEMALLOC_ZONE_VERSION}" = "x"; then
1419 AC_MSG_RESULT([unsupported])
1420 AC_MSG_ERROR([Unsupported malloc zone version])
1421 fi
1422 if test "${JEMALLOC_ZONE_VERSION}" = 9; then
1423 JEMALLOC_ZONE_VERSION=8
1424 AC_MSG_RESULT([> 8])
1425 else
1426 AC_MSG_RESULT([$JEMALLOC_ZONE_VERSION])
1427 fi
1428 AC_DEFINE_UNQUOTED(JEMALLOC_ZONE_VERSION, [$JEMALLOC_ZONE_VERSION])
Jason Evansb27805b2010-02-10 18:15:53 -08001429fi
1430
Jason Evansb7924f52009-06-23 19:01:18 -07001431dnl ============================================================================
Sara Golemon3e24afa2014-08-18 13:06:39 -07001432dnl Check for glibc malloc hooks
1433
1434JE_COMPILABLE([glibc malloc hook], [
1435#include <stddef.h>
1436
1437extern void (* __free_hook)(void *ptr);
1438extern void *(* __malloc_hook)(size_t size);
1439extern void *(* __realloc_hook)(void *ptr, size_t size);
1440], [
1441 void *ptr = 0L;
1442 if (__malloc_hook) ptr = __malloc_hook(1);
1443 if (__realloc_hook) ptr = __realloc_hook(ptr, 2);
1444 if (__free_hook && ptr) __free_hook(ptr);
1445], [je_cv_glibc_malloc_hook])
1446if test "x${je_cv_glibc_malloc_hook}" = "xyes" ; then
1447 AC_DEFINE([JEMALLOC_GLIBC_MALLOC_HOOK], [ ])
1448fi
1449
1450JE_COMPILABLE([glibc memalign hook], [
1451#include <stddef.h>
1452
1453extern void *(* __memalign_hook)(size_t alignment, size_t size);
1454], [
1455 void *ptr = 0L;
1456 if (__memalign_hook) ptr = __memalign_hook(16, 7);
1457], [je_cv_glibc_memalign_hook])
1458if test "x${je_cv_glibc_memalign_hook}" = "xyes" ; then
1459 AC_DEFINE([JEMALLOC_GLIBC_MEMALIGN_HOOK], [ ])
1460fi
1461
Eric Wong4dcf04b2014-08-31 03:57:06 +00001462JE_COMPILABLE([pthreads adaptive mutexes], [
1463#include <pthread.h>
1464], [
1465 pthread_mutexattr_t attr;
1466 pthread_mutexattr_init(&attr);
1467 pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ADAPTIVE_NP);
1468 pthread_mutexattr_destroy(&attr);
1469], [je_cv_pthread_mutex_adaptive_np])
1470if test "x${je_cv_pthread_mutex_adaptive_np}" = "xyes" ; then
1471 AC_DEFINE([JEMALLOC_HAVE_PTHREAD_MUTEX_ADAPTIVE_NP], [ ])
1472fi
1473
Sara Golemon3e24afa2014-08-18 13:06:39 -07001474dnl ============================================================================
Jason Evansb7924f52009-06-23 19:01:18 -07001475dnl Check for typedefs, structures, and compiler characteristics.
1476AC_HEADER_STDBOOL
1477
Jason Evans748dfac2013-12-06 18:27:33 -08001478dnl ============================================================================
1479dnl Define commands that generate output files.
1480
Jason Evans86abd0d2013-11-30 15:25:42 -08001481AC_CONFIG_COMMANDS([include/jemalloc/internal/private_namespace.h], [
1482 mkdir -p "${objroot}include/jemalloc/internal"
1483 "${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 -08001484], [
1485 srcdir="${srcdir}"
1486 objroot="${objroot}"
Jason Evans86abd0d2013-11-30 15:25:42 -08001487])
1488AC_CONFIG_COMMANDS([include/jemalloc/internal/private_unnamespace.h], [
1489 mkdir -p "${objroot}include/jemalloc/internal"
1490 "${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 -08001491], [
1492 srcdir="${srcdir}"
1493 objroot="${objroot}"
1494])
1495AC_CONFIG_COMMANDS([include/jemalloc/internal/public_symbols.txt], [
1496 f="${objroot}include/jemalloc/internal/public_symbols.txt"
1497 mkdir -p "${objroot}include/jemalloc/internal"
1498 cp /dev/null "${f}"
1499 for nm in `echo ${mangling_map} |tr ',' ' '` ; do
1500 n=`echo ${nm} |tr ':' ' ' |awk '{print $[]1}'`
1501 m=`echo ${nm} |tr ':' ' ' |awk '{print $[]2}'`
1502 echo "${n}:${m}" >> "${f}"
1503 dnl Remove name from public_syms so that it isn't redefined later.
1504 public_syms=`for sym in ${public_syms}; do echo "${sym}"; done |grep -v "^${n}\$" |tr '\n' ' '`
1505 done
1506 for sym in ${public_syms} ; do
1507 n="${sym}"
1508 m="${JEMALLOC_PREFIX}${sym}"
1509 echo "${n}:${m}" >> "${f}"
1510 done
1511], [
1512 srcdir="${srcdir}"
1513 objroot="${objroot}"
1514 mangling_map="${mangling_map}"
1515 public_syms="${public_syms}"
1516 JEMALLOC_PREFIX="${JEMALLOC_PREFIX}"
Jason Evans86abd0d2013-11-30 15:25:42 -08001517])
1518AC_CONFIG_COMMANDS([include/jemalloc/internal/public_namespace.h], [
1519 mkdir -p "${objroot}include/jemalloc/internal"
Jason Evansf234dc52014-01-16 17:38:01 -08001520 "${srcdir}/include/jemalloc/internal/public_namespace.sh" "${objroot}include/jemalloc/internal/public_symbols.txt" > "${objroot}include/jemalloc/internal/public_namespace.h"
1521], [
1522 srcdir="${srcdir}"
1523 objroot="${objroot}"
Jason Evans86abd0d2013-11-30 15:25:42 -08001524])
1525AC_CONFIG_COMMANDS([include/jemalloc/internal/public_unnamespace.h], [
1526 mkdir -p "${objroot}include/jemalloc/internal"
Jason Evansf234dc52014-01-16 17:38:01 -08001527 "${srcdir}/include/jemalloc/internal/public_unnamespace.sh" "${objroot}include/jemalloc/internal/public_symbols.txt" > "${objroot}include/jemalloc/internal/public_unnamespace.h"
1528], [
1529 srcdir="${srcdir}"
1530 objroot="${objroot}"
Jason Evans86abd0d2013-11-30 15:25:42 -08001531])
Jason Evansb1726102012-02-28 16:50:47 -08001532AC_CONFIG_COMMANDS([include/jemalloc/internal/size_classes.h], [
Jason Evans86abd0d2013-11-30 15:25:42 -08001533 mkdir -p "${objroot}include/jemalloc/internal"
Jason Evans81e54752014-10-10 22:34:25 -07001534 "${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 -08001535], [
1536 srcdir="${srcdir}"
1537 objroot="${objroot}"
Jason Evans81e54752014-10-10 22:34:25 -07001538 LG_QUANTA="${LG_QUANTA}"
1539 LG_TINY_MIN=${LG_TINY_MIN}
1540 LG_PAGE_SIZES="${LG_PAGE_SIZES}"
Jason Evansfc0b3b72014-10-09 17:54:06 -07001541 LG_SIZE_CLASS_GROUP=${LG_SIZE_CLASS_GROUP}
Jason Evansb1726102012-02-28 16:50:47 -08001542])
Jason Evans86abd0d2013-11-30 15:25:42 -08001543AC_CONFIG_COMMANDS([include/jemalloc/jemalloc_protos_jet.h], [
1544 mkdir -p "${objroot}include/jemalloc"
1545 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 -08001546], [
1547 srcdir="${srcdir}"
1548 objroot="${objroot}"
1549])
1550AC_CONFIG_COMMANDS([include/jemalloc/jemalloc_rename.h], [
1551 mkdir -p "${objroot}include/jemalloc"
1552 "${srcdir}/include/jemalloc/jemalloc_rename.sh" "${objroot}include/jemalloc/internal/public_symbols.txt" > "${objroot}include/jemalloc/jemalloc_rename.h"
1553], [
1554 srcdir="${srcdir}"
1555 objroot="${objroot}"
1556])
1557AC_CONFIG_COMMANDS([include/jemalloc/jemalloc_mangle.h], [
1558 mkdir -p "${objroot}include/jemalloc"
1559 "${srcdir}/include/jemalloc/jemalloc_mangle.sh" "${objroot}include/jemalloc/internal/public_symbols.txt" je_ > "${objroot}include/jemalloc/jemalloc_mangle.h"
1560], [
1561 srcdir="${srcdir}"
1562 objroot="${objroot}"
1563])
1564AC_CONFIG_COMMANDS([include/jemalloc/jemalloc_mangle_jet.h], [
1565 mkdir -p "${objroot}include/jemalloc"
1566 "${srcdir}/include/jemalloc/jemalloc_mangle.sh" "${objroot}include/jemalloc/internal/public_symbols.txt" jet_ > "${objroot}include/jemalloc/jemalloc_mangle_jet.h"
1567], [
1568 srcdir="${srcdir}"
1569 objroot="${objroot}"
Jason Evans86abd0d2013-11-30 15:25:42 -08001570])
1571AC_CONFIG_COMMANDS([include/jemalloc/jemalloc.h], [
1572 mkdir -p "${objroot}include/jemalloc"
1573 "${srcdir}/include/jemalloc/jemalloc.sh" "${objroot}" > "${objroot}include/jemalloc/jemalloc${install_suffix}.h"
Jason Evansf234dc52014-01-16 17:38:01 -08001574], [
1575 srcdir="${srcdir}"
1576 objroot="${objroot}"
1577 install_suffix="${install_suffix}"
Jason Evans86abd0d2013-11-30 15:25:42 -08001578])
Jason Evansb1726102012-02-28 16:50:47 -08001579
Jason Evansb7924f52009-06-23 19:01:18 -07001580dnl Process .in files.
Jason Evansb0fd5012010-01-17 01:49:20 -08001581AC_SUBST([cfghdrs_in])
1582AC_SUBST([cfghdrs_out])
Jason Evans0656ec02010-04-07 23:37:35 -07001583AC_CONFIG_HEADERS([$cfghdrs_tup])
Jason Evansb7924f52009-06-23 19:01:18 -07001584
1585dnl ============================================================================
1586dnl Generate outputs.
Jason Evans748dfac2013-12-06 18:27:33 -08001587
Antony Dovgal2bd3cbc2011-10-13 09:33:33 +04001588AC_CONFIG_FILES([$cfgoutputs_tup config.stamp bin/jemalloc.sh])
Jason Evansb0fd5012010-01-17 01:49:20 -08001589AC_SUBST([cfgoutputs_in])
1590AC_SUBST([cfgoutputs_out])
Jason Evansb7924f52009-06-23 19:01:18 -07001591AC_OUTPUT
1592
1593dnl ============================================================================
1594dnl Print out the results of configuration.
1595AC_MSG_RESULT([===============================================================================])
Jason Evansf576c632011-11-01 22:27:41 -07001596AC_MSG_RESULT([jemalloc version : ${jemalloc_version}])
1597AC_MSG_RESULT([library revision : ${rev}])
Jason Evansb7924f52009-06-23 19:01:18 -07001598AC_MSG_RESULT([])
1599AC_MSG_RESULT([CC : ${CC}])
1600AC_MSG_RESULT([CPPFLAGS : ${CPPFLAGS}])
1601AC_MSG_RESULT([CFLAGS : ${CFLAGS}])
1602AC_MSG_RESULT([LDFLAGS : ${LDFLAGS}])
Jason Evans748dfac2013-12-06 18:27:33 -08001603AC_MSG_RESULT([EXTRA_LDFLAGS : ${EXTRA_LDFLAGS}])
Jason Evansb7924f52009-06-23 19:01:18 -07001604AC_MSG_RESULT([LIBS : ${LIBS}])
1605AC_MSG_RESULT([RPATH_EXTRA : ${RPATH_EXTRA}])
1606AC_MSG_RESULT([])
Jason Evansaee7fd22010-11-24 22:00:02 -08001607AC_MSG_RESULT([XSLTPROC : ${XSLTPROC}])
1608AC_MSG_RESULT([XSLROOT : ${XSLROOT}])
1609AC_MSG_RESULT([])
Jason Evansb7924f52009-06-23 19:01:18 -07001610AC_MSG_RESULT([PREFIX : ${PREFIX}])
1611AC_MSG_RESULT([BINDIR : ${BINDIR}])
Jason Evans662a0172009-07-01 19:24:31 -07001612AC_MSG_RESULT([INCLUDEDIR : ${INCLUDEDIR}])
1613AC_MSG_RESULT([LIBDIR : ${LIBDIR}])
Jason Evansb7924f52009-06-23 19:01:18 -07001614AC_MSG_RESULT([DATADIR : ${DATADIR}])
1615AC_MSG_RESULT([MANDIR : ${MANDIR}])
1616AC_MSG_RESULT([])
1617AC_MSG_RESULT([srcroot : ${srcroot}])
1618AC_MSG_RESULT([abs_srcroot : ${abs_srcroot}])
1619AC_MSG_RESULT([objroot : ${objroot}])
1620AC_MSG_RESULT([abs_objroot : ${abs_objroot}])
1621AC_MSG_RESULT([])
Jason Evans90895cf2009-12-29 00:09:15 -08001622AC_MSG_RESULT([JEMALLOC_PREFIX : ${JEMALLOC_PREFIX}])
Jason Evans746e77a2011-07-30 16:40:52 -07001623AC_MSG_RESULT([JEMALLOC_PRIVATE_NAMESPACE])
1624AC_MSG_RESULT([ : ${JEMALLOC_PRIVATE_NAMESPACE}])
Jason Evansb0fd5012010-01-17 01:49:20 -08001625AC_MSG_RESULT([install_suffix : ${install_suffix}])
Jason Evansb7924f52009-06-23 19:01:18 -07001626AC_MSG_RESULT([autogen : ${enable_autogen}])
Jason Evans355b4382010-09-20 19:20:48 -07001627AC_MSG_RESULT([cc-silence : ${enable_cc_silence}])
Jason Evansb7924f52009-06-23 19:01:18 -07001628AC_MSG_RESULT([debug : ${enable_debug}])
Jason Evans748dfac2013-12-06 18:27:33 -08001629AC_MSG_RESULT([code-coverage : ${enable_code_coverage}])
Jason Evansb7924f52009-06-23 19:01:18 -07001630AC_MSG_RESULT([stats : ${enable_stats}])
Jason Evans6109fe02010-02-10 10:37:56 -08001631AC_MSG_RESULT([prof : ${enable_prof}])
1632AC_MSG_RESULT([prof-libunwind : ${enable_prof_libunwind}])
Jason Evans77f350b2011-03-15 22:23:12 -07001633AC_MSG_RESULT([prof-libgcc : ${enable_prof_libgcc}])
1634AC_MSG_RESULT([prof-gcc : ${enable_prof_gcc}])
Jason Evans84cbbcb2009-12-29 00:09:15 -08001635AC_MSG_RESULT([tcache : ${enable_tcache}])
Jason Evansb7924f52009-06-23 19:01:18 -07001636AC_MSG_RESULT([fill : ${enable_fill}])
Jason Evansb1476112012-04-05 13:36:17 -07001637AC_MSG_RESULT([utrace : ${enable_utrace}])
Jason Evans122449b2012-04-06 00:35:09 -07001638AC_MSG_RESULT([valgrind : ${enable_valgrind}])
1639AC_MSG_RESULT([xmalloc : ${enable_xmalloc}])
Jason Evans59ae2762012-04-16 17:52:27 -07001640AC_MSG_RESULT([munmap : ${enable_munmap}])
Jason Evansb7924f52009-06-23 19:01:18 -07001641AC_MSG_RESULT([lazy_lock : ${enable_lazy_lock}])
Jason Evans2dbecf12010-09-05 10:35:13 -07001642AC_MSG_RESULT([tls : ${enable_tls}])
Jason Evansb7924f52009-06-23 19:01:18 -07001643AC_MSG_RESULT([===============================================================================])