blob: 4bdd66aaf60191ef881c636ce2b7269a3c45cb9d [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 Evans3a923192015-11-12 11:23:39 -08004AC_CONFIG_AUX_DIR([build-aux])
5
Jason Evansf3340ca2009-06-30 16:17:05 -07006dnl ============================================================================
7dnl Custom macro definitions.
8
9dnl JE_CFLAGS_APPEND(cflag)
10AC_DEFUN([JE_CFLAGS_APPEND],
11[
12AC_MSG_CHECKING([whether compiler supports $1])
13TCFLAGS="${CFLAGS}"
14if test "x${CFLAGS}" = "x" ; then
15 CFLAGS="$1"
16else
17 CFLAGS="${CFLAGS} $1"
18fi
Jason Evans6684cac2012-03-05 12:15:36 -080019AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
Jason Evansf3340ca2009-06-30 16:17:05 -070020[[
21]], [[
22 return 0;
23]])],
Jason Evans99b0fbb2014-02-24 16:08:38 -080024 [je_cv_cflags_appended=$1]
Jason Evansf3340ca2009-06-30 16:17:05 -070025 AC_MSG_RESULT([yes]),
Jason Evans99b0fbb2014-02-24 16:08:38 -080026 [je_cv_cflags_appended=]
Jason Evansf3340ca2009-06-30 16:17:05 -070027 AC_MSG_RESULT([no])
28 [CFLAGS="${TCFLAGS}"]
29)
30])
31
32dnl JE_COMPILABLE(label, hcode, mcode, rvar)
Jason Evans4c2faa82012-03-13 11:09:23 -070033dnl
Jason Evansf3e139a2012-03-19 09:54:20 -070034dnl Use AC_LINK_IFELSE() rather than AC_COMPILE_IFELSE() so that linker errors
Jason Evans4c2faa82012-03-13 11:09:23 -070035dnl cause failure.
Jason Evansf3340ca2009-06-30 16:17:05 -070036AC_DEFUN([JE_COMPILABLE],
37[
Jason Evans6684cac2012-03-05 12:15:36 -080038AC_CACHE_CHECK([whether $1 is compilable],
39 [$4],
Jason Evansf3e139a2012-03-19 09:54:20 -070040 [AC_LINK_IFELSE([AC_LANG_PROGRAM([$2],
41 [$3])],
42 [$4=yes],
43 [$4=no])])
Jason Evansf3340ca2009-06-30 16:17:05 -070044])
45
46dnl ============================================================================
47
Jason Evans41f2e692015-01-25 20:15:13 -080048CONFIG=`echo ${ac_configure_args} | sed -e 's#'"'"'\([^ ]*\)'"'"'#\1#g'`
Jason Evansbec6a8d2015-01-22 17:55:58 -080049AC_SUBST([CONFIG])
50
Jason Evansf576c632011-11-01 22:27:41 -070051dnl Library revision.
Jason Evans9790b962014-04-14 22:32:31 -070052rev=2
Jason Evansf576c632011-11-01 22:27:41 -070053AC_SUBST([rev])
54
Jason Evansb7924f52009-06-23 19:01:18 -070055srcroot=$srcdir
56if test "x${srcroot}" = "x." ; then
57 srcroot=""
58else
59 srcroot="${srcroot}/"
60fi
61AC_SUBST([srcroot])
62abs_srcroot="`cd \"${srcdir}\"; pwd`/"
63AC_SUBST([abs_srcroot])
64
65objroot=""
66AC_SUBST([objroot])
67abs_objroot="`pwd`/"
68AC_SUBST([abs_objroot])
69
70dnl Munge install path variables.
71if test "x$prefix" = "xNONE" ; then
72 prefix="/usr/local"
73fi
74if test "x$exec_prefix" = "xNONE" ; then
75 exec_prefix=$prefix
76fi
77PREFIX=$prefix
78AC_SUBST([PREFIX])
79BINDIR=`eval echo $bindir`
80BINDIR=`eval echo $BINDIR`
81AC_SUBST([BINDIR])
82INCLUDEDIR=`eval echo $includedir`
83INCLUDEDIR=`eval echo $INCLUDEDIR`
84AC_SUBST([INCLUDEDIR])
85LIBDIR=`eval echo $libdir`
86LIBDIR=`eval echo $LIBDIR`
87AC_SUBST([LIBDIR])
88DATADIR=`eval echo $datadir`
89DATADIR=`eval echo $DATADIR`
90AC_SUBST([DATADIR])
91MANDIR=`eval echo $mandir`
92MANDIR=`eval echo $MANDIR`
93AC_SUBST([MANDIR])
94
Jason Evansaee7fd22010-11-24 22:00:02 -080095dnl Support for building documentation.
Jason Evans7329a4f2013-01-22 10:53:29 -080096AC_PATH_PROG([XSLTPROC], [xsltproc], [false], [$PATH])
Jason Evans7091b412012-03-19 09:36:44 -070097if test -d "/usr/share/xml/docbook/stylesheet/docbook-xsl" ; then
98 DEFAULT_XSLROOT="/usr/share/xml/docbook/stylesheet/docbook-xsl"
99elif test -d "/usr/share/sgml/docbook/xsl-stylesheets" ; then
100 DEFAULT_XSLROOT="/usr/share/sgml/docbook/xsl-stylesheets"
101else
102 dnl Documentation building will fail if this default gets used.
103 DEFAULT_XSLROOT=""
104fi
Jason Evansaee7fd22010-11-24 22:00:02 -0800105AC_ARG_WITH([xslroot],
Jason Evans7091b412012-03-19 09:36:44 -0700106 [AS_HELP_STRING([--with-xslroot=<path>], [XSL stylesheet root path])], [
Jason Evansaee7fd22010-11-24 22:00:02 -0800107if test "x$with_xslroot" = "xno" ; then
Jason Evans7091b412012-03-19 09:36:44 -0700108 XSLROOT="${DEFAULT_XSLROOT}"
Jason Evansaee7fd22010-11-24 22:00:02 -0800109else
110 XSLROOT="${with_xslroot}"
Jason Evans7091b412012-03-19 09:36:44 -0700111fi
112],
113 XSLROOT="${DEFAULT_XSLROOT}"
Jason Evansaee7fd22010-11-24 22:00:02 -0800114)
115AC_SUBST([XSLROOT])
116
Jason Evansf3340ca2009-06-30 16:17:05 -0700117dnl If CFLAGS isn't defined, set CFLAGS to something reasonable. Otherwise,
118dnl just prevent autoconf from molesting CFLAGS.
Jason Evansb7924f52009-06-23 19:01:18 -0700119CFLAGS=$CFLAGS
120AC_PROG_CC
Elliot Ronaghan8701bc72016-06-14 15:26:07 -0700121
Mike Hommeyfd97b1d2012-04-30 12:38:31 +0200122if test "x$GCC" != "xyes" ; then
123 AC_CACHE_CHECK([whether compiler is MSVC],
124 [je_cv_msvc],
125 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],
126 [
127#ifndef _MSC_VER
128 int fail[-1];
129#endif
130])],
131 [je_cv_msvc=yes],
132 [je_cv_msvc=no])])
133fi
134
Elliot Ronaghan3573fb92016-06-14 13:18:08 -0700135dnl check if a cray prgenv wrapper compiler is being used
136je_cv_cray_prgenv_wrapper=""
137if test "x${PE_ENV}" != "x" ; then
138 case "${CC}" in
139 CC|cc)
140 je_cv_cray_prgenv_wrapper="yes"
141 ;;
142 *)
143 ;;
144 esac
145fi
146
Elliot Ronaghan8701bc72016-06-14 15:26:07 -0700147AC_CACHE_CHECK([whether compiler is cray],
148 [je_cv_cray],
149 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],
150 [
151#ifndef _CRAYC
152 int fail[-1];
153#endif
154])],
155 [je_cv_cray=yes],
156 [je_cv_cray=no])])
157
158if test "x${je_cv_cray}" = "xyes" ; then
159 AC_CACHE_CHECK([whether cray compiler version is 8.4],
160 [je_cv_cray_84],
161 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],
162 [
163#if !(_RELEASE_MAJOR == 8 && _RELEASE_MINOR == 4)
164 int fail[-1];
165#endif
166])],
167 [je_cv_cray_84=yes],
168 [je_cv_cray_84=no])])
169fi
170
Jason Evansb7924f52009-06-23 19:01:18 -0700171if test "x$CFLAGS" = "x" ; then
172 no_CFLAGS="yes"
Jason Evanscfeccd32010-03-03 15:48:20 -0800173 if test "x$GCC" = "xyes" ; then
174 JE_CFLAGS_APPEND([-std=gnu99])
Jason Evans99b0fbb2014-02-24 16:08:38 -0800175 if test "x$je_cv_cflags_appended" = "x-std=gnu99" ; then
176 AC_DEFINE_UNQUOTED([JEMALLOC_HAS_RESTRICT])
177 fi
Jason Evanscfeccd32010-03-03 15:48:20 -0800178 JE_CFLAGS_APPEND([-Wall])
Mike Hommeyb7b44df2014-12-18 15:12:53 +0900179 JE_CFLAGS_APPEND([-Werror=declaration-after-statement])
Jason Evansb3d00702016-02-24 13:00:40 -0800180 JE_CFLAGS_APPEND([-Wshorten-64-to-32])
Chris Peterson18903c52016-03-14 21:44:32 -0700181 JE_CFLAGS_APPEND([-Wsign-compare])
Jason Evanscfeccd32010-03-03 15:48:20 -0800182 JE_CFLAGS_APPEND([-pipe])
183 JE_CFLAGS_APPEND([-g3])
Mike Hommeyfd97b1d2012-04-30 12:38:31 +0200184 elif test "x$je_cv_msvc" = "xyes" ; then
185 CC="$CC -nologo"
186 JE_CFLAGS_APPEND([-Zi])
187 JE_CFLAGS_APPEND([-MT])
188 JE_CFLAGS_APPEND([-W3])
Mike Hommey8c615752014-05-29 16:58:21 +0900189 JE_CFLAGS_APPEND([-FS])
Mike Hommey6f6704c2014-05-29 17:01:10 +0900190 CPPFLAGS="$CPPFLAGS -I${srcdir}/include/msvc_compat"
Jason Evanscfeccd32010-03-03 15:48:20 -0800191 fi
Elliot Ronaghan8701bc72016-06-14 15:26:07 -0700192 if test "x$je_cv_cray" = "xyes" ; then
193 dnl cray compiler 8.4 has an inlining bug
194 if test "x$je_cv_cray_84" = "xyes" ; then
195 JE_CFLAGS_APPEND([-hipa2])
196 JE_CFLAGS_APPEND([-hnognu])
197 fi
Elliot Ronaghanc1281672016-07-07 15:06:01 -0700198 if test "x$enable_cc_silence" != "xno" ; then
199 dnl ignore unreachable code warning
200 JE_CFLAGS_APPEND([-hnomessage=128])
201 dnl ignore redefinition of "malloc", "free", etc warning
202 JE_CFLAGS_APPEND([-hnomessage=1357])
203 fi
Elliot Ronaghan8701bc72016-06-14 15:26:07 -0700204 fi
Jason Evansb7924f52009-06-23 19:01:18 -0700205fi
Jason Evans35a108c2016-10-29 22:14:55 -0700206AC_SUBST([EXTRA_CFLAGS])
Jason Evansb7924f52009-06-23 19:01:18 -0700207AC_PROG_CPP
208
Jason Evansdf3f2702014-03-30 16:27:08 -0700209AC_C_BIGENDIAN([ac_cv_big_endian=1], [ac_cv_big_endian=0])
210if test "x${ac_cv_big_endian}" = "x1" ; then
211 AC_DEFINE_UNQUOTED([JEMALLOC_BIG_ENDIAN], [ ])
212fi
213
Mike Hommeyff2e9992014-05-29 16:33:02 +0900214if test "x${je_cv_msvc}" = "xyes" -a "x${ac_cv_header_inttypes_h}" = "xno"; then
Mike Hommey6f6704c2014-05-29 17:01:10 +0900215 CPPFLAGS="$CPPFLAGS -I${srcdir}/include/msvc_compat/C99"
Mike Hommeyff2e9992014-05-29 16:33:02 +0900216fi
217
rustyx46e0b232016-01-30 13:37:26 +0100218if test "x${je_cv_msvc}" = "xyes" ; then
219 LG_SIZEOF_PTR=LG_SIZEOF_PTR_WIN
220 AC_MSG_RESULT([Using a predefined value for sizeof(void *): 4 for 32-bit, 8 for 64-bit])
Jason Evansb7924f52009-06-23 19:01:18 -0700221else
rustyx46e0b232016-01-30 13:37:26 +0100222 AC_CHECK_SIZEOF([void *])
223 if test "x${ac_cv_sizeof_void_p}" = "x8" ; then
224 LG_SIZEOF_PTR=3
225 elif test "x${ac_cv_sizeof_void_p}" = "x4" ; then
226 LG_SIZEOF_PTR=2
227 else
228 AC_MSG_ERROR([Unsupported pointer size: ${ac_cv_sizeof_void_p}])
229 fi
Jason Evansb7924f52009-06-23 19:01:18 -0700230fi
Jason Evans94ad2b52009-12-29 00:09:15 -0800231AC_DEFINE_UNQUOTED([LG_SIZEOF_PTR], [$LG_SIZEOF_PTR])
232
233AC_CHECK_SIZEOF([int])
234if test "x${ac_cv_sizeof_int}" = "x8" ; then
235 LG_SIZEOF_INT=3
236elif test "x${ac_cv_sizeof_int}" = "x4" ; then
237 LG_SIZEOF_INT=2
238else
239 AC_MSG_ERROR([Unsupported int size: ${ac_cv_sizeof_int}])
240fi
241AC_DEFINE_UNQUOTED([LG_SIZEOF_INT], [$LG_SIZEOF_INT])
Jason Evansb7924f52009-06-23 19:01:18 -0700242
Jason Evans84c8eef2011-03-16 10:30:13 -0700243AC_CHECK_SIZEOF([long])
244if test "x${ac_cv_sizeof_long}" = "x8" ; then
245 LG_SIZEOF_LONG=3
246elif test "x${ac_cv_sizeof_long}" = "x4" ; then
247 LG_SIZEOF_LONG=2
248else
249 AC_MSG_ERROR([Unsupported long size: ${ac_cv_sizeof_long}])
250fi
251AC_DEFINE_UNQUOTED([LG_SIZEOF_LONG], [$LG_SIZEOF_LONG])
252
Jason Evansecae1232016-02-20 23:41:33 -0800253AC_CHECK_SIZEOF([long long])
254if test "x${ac_cv_sizeof_long_long}" = "x8" ; then
255 LG_SIZEOF_LONG_LONG=3
256elif test "x${ac_cv_sizeof_long_long}" = "x4" ; then
257 LG_SIZEOF_LONG_LONG=2
258else
259 AC_MSG_ERROR([Unsupported long long size: ${ac_cv_sizeof_long_long}])
260fi
261AC_DEFINE_UNQUOTED([LG_SIZEOF_LONG_LONG], [$LG_SIZEOF_LONG_LONG])
262
Jason Evansd81e4bd2012-03-06 14:57:45 -0800263AC_CHECK_SIZEOF([intmax_t])
264if test "x${ac_cv_sizeof_intmax_t}" = "x16" ; then
265 LG_SIZEOF_INTMAX_T=4
266elif test "x${ac_cv_sizeof_intmax_t}" = "x8" ; then
267 LG_SIZEOF_INTMAX_T=3
268elif test "x${ac_cv_sizeof_intmax_t}" = "x4" ; then
269 LG_SIZEOF_INTMAX_T=2
270else
Mike Hommey14103d32012-04-20 08:38:39 +0200271 AC_MSG_ERROR([Unsupported intmax_t size: ${ac_cv_sizeof_intmax_t}])
Jason Evansd81e4bd2012-03-06 14:57:45 -0800272fi
273AC_DEFINE_UNQUOTED([LG_SIZEOF_INTMAX_T], [$LG_SIZEOF_INTMAX_T])
274
Jason Evansb7924f52009-06-23 19:01:18 -0700275AC_CANONICAL_HOST
276dnl CPU-specific settings.
277CPU_SPINWAIT=""
278case "${host_cpu}" in
Jason Evanscb657e32014-02-25 11:21:41 -0800279 i686|x86_64)
rustyx90c72692016-01-30 13:41:09 +0100280 if test "x${je_cv_msvc}" = "xyes" ; then
281 AC_CACHE_VAL([je_cv_pause_msvc],
282 [JE_COMPILABLE([pause instruction MSVC], [],
283 [[_mm_pause(); return 0;]],
284 [je_cv_pause_msvc])])
285 if test "x${je_cv_pause_msvc}" = "xyes" ; then
286 CPU_SPINWAIT='_mm_pause()'
287 fi
288 else
289 AC_CACHE_VAL([je_cv_pause],
290 [JE_COMPILABLE([pause instruction], [],
291 [[__asm__ volatile("pause"); return 0;]],
292 [je_cv_pause])])
293 if test "x${je_cv_pause}" = "xyes" ; then
294 CPU_SPINWAIT='__asm__ volatile("pause")'
295 fi
Jason Evansf3340ca2009-06-30 16:17:05 -0700296 fi
Jason Evans80061b62013-12-09 13:21:08 -0800297 ;;
298 powerpc)
299 AC_DEFINE_UNQUOTED([HAVE_ALTIVEC], [ ])
Jason Evansb7924f52009-06-23 19:01:18 -0700300 ;;
301 *)
302 ;;
303esac
304AC_DEFINE_UNQUOTED([CPU_SPINWAIT], [$CPU_SPINWAIT])
305
Antony Dovgal2bd3cbc2011-10-13 09:33:33 +0400306LD_PRELOAD_VAR="LD_PRELOAD"
Jason Evansf576c632011-11-01 22:27:41 -0700307so="so"
Mike Hommeyfd97b1d2012-04-30 12:38:31 +0200308importlib="${so}"
Mike Hommey7cdea392012-04-30 12:38:27 +0200309o="$ac_objext"
Mike Hommey5bee66d2012-04-16 16:30:24 +0200310a="a"
Mike Hommey7cdea392012-04-30 12:38:27 +0200311exe="$ac_exeext"
Mike Hommeya19e87f2012-04-21 21:27:46 -0700312libprefix="lib"
Jason Evans875ff152016-10-27 17:10:56 -0700313link_whole_archive="0"
Mike Hommeyfa08da72012-04-16 16:30:25 +0200314DSO_LDFLAGS='-shared -Wl,-soname,$(@F)'
315RPATH='-Wl,-rpath,$(1)'
Mike Hommey7cdea392012-04-30 12:38:27 +0200316SOREV="${so}.${rev}"
Mike Hommey188da7c2012-04-18 18:29:41 +0200317PIC_CFLAGS='-fPIC -DPIC'
Mike Hommeyfd97b1d2012-04-30 12:38:31 +0200318CTARGET='-o $@'
319LDTARGET='-o $@'
Elliot Ronaghan3573fb92016-06-14 13:18:08 -0700320TEST_LD_MODE=
Mike Hommeyfd97b1d2012-04-30 12:38:31 +0200321EXTRA_LDFLAGS=
Jason Evans80ddf492013-08-20 11:48:19 +0100322ARFLAGS='crus'
323AROUT=' $@'
Mike Hommey79c4bca2012-05-02 21:30:51 +0200324CC_MM=1
Jason Evans7372b152012-02-10 20:22:09 -0800325
Elliot Ronaghan3573fb92016-06-14 13:18:08 -0700326if test "x$je_cv_cray_prgenv_wrapper" = "xyes" ; then
327 TEST_LD_MODE='-dynamic'
328fi
329
Elliot Ronaghan1d42a992016-06-14 15:26:29 -0700330if test "x${je_cv_cray}" = "xyes" ; then
331 CC_MM=
332fi
333
Jory A. Prattad505e02013-08-11 09:44:59 -0500334AN_MAKEVAR([AR], [AC_PROG_AR])
335AN_PROGRAM([ar], [AC_PROG_AR])
336AC_DEFUN([AC_PROG_AR], [AC_CHECK_TOOL(AR, ar, :)])
337AC_PROG_AR
338
Jason Evansb7924f52009-06-23 19:01:18 -0700339dnl Platform-specific settings. abi and RPATH can probably be determined
340dnl programmatically, but doing so is error-prone, which makes it generally
341dnl not worth the trouble.
342dnl
343dnl Define cpp macros in CPPFLAGS, rather than doing AC_DEFINE(macro), since the
344dnl definitions need to be seen before any headers are included, which is a pain
345dnl to make happen otherwise.
Jason Evansb732c392016-10-07 08:47:16 -0700346CFLAGS="$CFLAGS"
Jason Evans59ae2762012-04-16 17:52:27 -0700347default_munmap="1"
Jason Evansd059b9d2015-07-24 18:21:42 -0700348maps_coalesce="1"
Jason Evansb7924f52009-06-23 19:01:18 -0700349case "${host}" in
Valerii Hiora5921ba72014-05-16 16:28:20 +0300350 *-*-darwin* | *-*-ios*)
Jason Evansb7924f52009-06-23 19:01:18 -0700351 abi="macho"
Jason Evanse24c7af2012-03-19 10:21:17 -0700352 AC_DEFINE([JEMALLOC_PURGE_MADVISE_FREE], [ ])
Jason Evansb7924f52009-06-23 19:01:18 -0700353 RPATH=""
Antony Dovgal2bd3cbc2011-10-13 09:33:33 +0400354 LD_PRELOAD_VAR="DYLD_INSERT_LIBRARIES"
Jason Evansf576c632011-11-01 22:27:41 -0700355 so="dylib"
Mike Hommeyfd97b1d2012-04-30 12:38:31 +0200356 importlib="${so}"
Jason Evansb80581d2012-03-23 16:17:43 -0700357 force_tls="0"
Jason Evansf1f2b452015-05-01 08:57:41 -0700358 DSO_LDFLAGS='-shared -Wl,-install_name,$(LIBDIR)/$(@F)'
Mike Hommey7cdea392012-04-30 12:38:27 +0200359 SOREV="${rev}.${so}"
Jason Evans66688532013-12-03 21:49:36 -0800360 sbrk_deprecated="1"
Jason Evansb7924f52009-06-23 19:01:18 -0700361 ;;
362 *-*-freebsd*)
Jason Evansb7924f52009-06-23 19:01:18 -0700363 abi="elf"
Jason Evansc2f970c2016-05-05 17:45:02 -0700364 AC_DEFINE([JEMALLOC_SYSCTL_VM_OVERCOMMIT], [ ])
Jason Evanse24c7af2012-03-19 10:21:17 -0700365 AC_DEFINE([JEMALLOC_PURGE_MADVISE_FREE], [ ])
Jason Evansfd4fcef2012-03-23 17:40:58 -0700366 force_lazy_lock="1"
Jason Evansb7924f52009-06-23 19:01:18 -0700367 ;;
Michael Neumann1aa25a32014-08-05 03:06:02 +0200368 *-*-dragonfly*)
Michael Neumann1aa25a32014-08-05 03:06:02 +0200369 abi="elf"
370 AC_DEFINE([JEMALLOC_PURGE_MADVISE_FREE], [ ])
371 ;;
Sébastien Marieb80fbcb2015-04-07 12:21:19 +0200372 *-*-openbsd*)
Sébastien Marieb80fbcb2015-04-07 12:21:19 +0200373 abi="elf"
374 AC_DEFINE([JEMALLOC_PURGE_MADVISE_FREE], [ ])
375 force_tls="0"
376 ;;
377 *-*-bitrig*)
Sébastien Marie77d597e2015-01-25 10:18:32 +0100378 abi="elf"
379 AC_DEFINE([JEMALLOC_PURGE_MADVISE_FREE], [ ])
380 ;;
Jason Evansb7924f52009-06-23 19:01:18 -0700381 *-*-linux*)
Jason Evansb732c392016-10-07 08:47:16 -0700382 dnl secure_getenv() is exposed by _GNU_SOURCE.
Jason Evansb7924f52009-06-23 19:01:18 -0700383 CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
384 abi="elf"
Garrett Cooper13e4e242012-12-02 17:58:40 -0800385 AC_DEFINE([JEMALLOC_HAS_ALLOCA_H])
Jason Evansc2f970c2016-05-05 17:45:02 -0700386 AC_DEFINE([JEMALLOC_PROC_SYS_VM_OVERCOMMIT_MEMORY], [ ])
Jason Evanse24c7af2012-03-19 10:21:17 -0700387 AC_DEFINE([JEMALLOC_PURGE_MADVISE_DONTNEED], [ ])
Jason Evans02b23122012-04-05 11:06:23 -0700388 AC_DEFINE([JEMALLOC_THREADED_INIT], [ ])
Jason Evansae93d6b2015-07-10 14:33:00 -0700389 AC_DEFINE([JEMALLOC_USE_CXX_THROW], [ ])
Jason Evans59ae2762012-04-16 17:52:27 -0700390 default_munmap="0"
Jason Evansb7924f52009-06-23 19:01:18 -0700391 ;;
392 *-*-netbsd*)
393 AC_MSG_CHECKING([ABI])
394 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
395[[#ifdef __ELF__
396/* ELF */
397#else
398#error aout
399#endif
400]])],
Jason Evansb732c392016-10-07 08:47:16 -0700401 [abi="elf"],
Jason Evansb7924f52009-06-23 19:01:18 -0700402 [abi="aout"])
403 AC_MSG_RESULT([$abi])
Jason Evanse24c7af2012-03-19 10:21:17 -0700404 AC_DEFINE([JEMALLOC_PURGE_MADVISE_FREE], [ ])
Jason Evansb7924f52009-06-23 19:01:18 -0700405 ;;
406 *-*-solaris2*)
Jason Evansb7924f52009-06-23 19:01:18 -0700407 abi="elf"
George Koladdd6bd42014-02-12 23:05:45 +0000408 AC_DEFINE([JEMALLOC_PURGE_MADVISE_FREE], [ ])
Mike Hommeyfa08da72012-04-16 16:30:25 +0200409 RPATH='-Wl,-R,$(1)'
Jason Evansb7924f52009-06-23 19:01:18 -0700410 dnl Solaris needs this for sigwait().
411 CPPFLAGS="$CPPFLAGS -D_POSIX_PTHREAD_SEMANTICS"
412 LIBS="$LIBS -lposix4 -lsocket -lnsl"
413 ;;
Antony Dovgal2bd3cbc2011-10-13 09:33:33 +0400414 *-ibm-aix*)
415 if "$LG_SIZEOF_PTR" = "8"; then
416 dnl 64bit AIX
417 LD_PRELOAD_VAR="LDR_PRELOAD64"
418 else
419 dnl 32bit AIX
420 LD_PRELOAD_VAR="LDR_PRELOAD"
421 fi
422 abi="xcoff"
Antony Dovgal2bd3cbc2011-10-13 09:33:33 +0400423 ;;
Dave Rigby70bdee02014-09-22 15:53:16 +0100424 *-*-mingw* | *-*-cygwin*)
Mike Hommeya19e87f2012-04-21 21:27:46 -0700425 abi="pecoff"
426 force_tls="0"
Jason Evansd059b9d2015-07-24 18:21:42 -0700427 maps_coalesce="0"
Mike Hommeya19e87f2012-04-21 21:27:46 -0700428 RPATH=""
429 so="dll"
Mike Hommeyfd97b1d2012-04-30 12:38:31 +0200430 if test "x$je_cv_msvc" = "xyes" ; then
431 importlib="lib"
432 DSO_LDFLAGS="-LD"
433 EXTRA_LDFLAGS="-link -DEBUG"
434 CTARGET='-Fo$@'
435 LDTARGET='-Fe$@'
Jory A. Prattad505e02013-08-11 09:44:59 -0500436 AR='lib'
437 ARFLAGS='-nologo -out:'
Jason Evans80ddf492013-08-20 11:48:19 +0100438 AROUT='$@'
Mike Hommey79c4bca2012-05-02 21:30:51 +0200439 CC_MM=
Mike Hommeyfd97b1d2012-04-30 12:38:31 +0200440 else
441 importlib="${so}"
442 DSO_LDFLAGS="-shared"
Jason Evans875ff152016-10-27 17:10:56 -0700443 link_whole_archive="1"
Mike Hommeyfd97b1d2012-04-30 12:38:31 +0200444 fi
Mike Hommeya19e87f2012-04-21 21:27:46 -0700445 a="lib"
446 libprefix=""
Mike Hommey7cdea392012-04-30 12:38:27 +0200447 SOREV="${so}"
Mike Hommeya19e87f2012-04-21 21:27:46 -0700448 PIC_CFLAGS=""
449 ;;
Jason Evansb7924f52009-06-23 19:01:18 -0700450 *)
451 AC_MSG_RESULT([Unsupported operating system: ${host}])
452 abi="elf"
Jason Evansb7924f52009-06-23 19:01:18 -0700453 ;;
454esac
Mike Hommeyaffe0092014-05-28 08:10:12 +0900455
456JEMALLOC_USABLE_SIZE_CONST=const
457AC_CHECK_HEADERS([malloc.h], [
458 AC_MSG_CHECKING([whether malloc_usable_size definition can use const argument])
459 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
460 [#include <malloc.h>
461 #include <stddef.h>
462 size_t malloc_usable_size(const void *ptr);
463 ],
464 [])],[
465 AC_MSG_RESULT([yes])
466 ],[
467 JEMALLOC_USABLE_SIZE_CONST=
468 AC_MSG_RESULT([no])
469 ])
470])
Jason Evans247d1242012-10-09 16:20:10 -0700471AC_DEFINE_UNQUOTED([JEMALLOC_USABLE_SIZE_CONST], [$JEMALLOC_USABLE_SIZE_CONST])
Jason Evansb7924f52009-06-23 19:01:18 -0700472AC_SUBST([abi])
473AC_SUBST([RPATH])
Antony Dovgal2bd3cbc2011-10-13 09:33:33 +0400474AC_SUBST([LD_PRELOAD_VAR])
Jason Evansf576c632011-11-01 22:27:41 -0700475AC_SUBST([so])
Mike Hommeyfd97b1d2012-04-30 12:38:31 +0200476AC_SUBST([importlib])
Mike Hommey5bee66d2012-04-16 16:30:24 +0200477AC_SUBST([o])
478AC_SUBST([a])
479AC_SUBST([exe])
Mike Hommeya19e87f2012-04-21 21:27:46 -0700480AC_SUBST([libprefix])
Jason Evans875ff152016-10-27 17:10:56 -0700481AC_SUBST([link_whole_archive])
Mike Hommeyfa08da72012-04-16 16:30:25 +0200482AC_SUBST([DSO_LDFLAGS])
Mike Hommeyfd97b1d2012-04-30 12:38:31 +0200483AC_SUBST([EXTRA_LDFLAGS])
Mike Hommey85221d52012-04-18 18:29:40 +0200484AC_SUBST([SOREV])
Mike Hommey188da7c2012-04-18 18:29:41 +0200485AC_SUBST([PIC_CFLAGS])
Mike Hommeyfd97b1d2012-04-30 12:38:31 +0200486AC_SUBST([CTARGET])
487AC_SUBST([LDTARGET])
Elliot Ronaghan3573fb92016-06-14 13:18:08 -0700488AC_SUBST([TEST_LD_MODE])
Mike Hommeyfd97b1d2012-04-30 12:38:31 +0200489AC_SUBST([MKLIB])
Jason Evans80ddf492013-08-20 11:48:19 +0100490AC_SUBST([ARFLAGS])
491AC_SUBST([AROUT])
Mike Hommey79c4bca2012-05-02 21:30:51 +0200492AC_SUBST([CC_MM])
Mike Hommeyfd97b1d2012-04-30 12:38:31 +0200493
Jason Evanse7d67792016-10-27 21:23:48 -0700494dnl Determine whether libm must be linked to use e.g. log(3).
495AC_SEARCH_LIBS([log], [m], , [AC_MSG_ERROR([Missing math functions])])
496if test "x$ac_cv_search_log" != "xnone required" ; then
497 LM="$ac_cv_search_log"
498else
499 LM=
500fi
501AC_SUBST(LM)
502
Jason Evansfa5d2452011-03-15 10:25:59 -0700503JE_COMPILABLE([__attribute__ syntax],
504 [static __attribute__((unused)) void foo(void){}],
505 [],
Jason Evans6684cac2012-03-05 12:15:36 -0800506 [je_cv_attribute])
507if test "x${je_cv_attribute}" = "xyes" ; then
Jason Evansfa5d2452011-03-15 10:25:59 -0700508 AC_DEFINE([JEMALLOC_HAVE_ATTR], [ ])
509 if test "x${GCC}" = "xyes" -a "x${abi}" = "xelf"; then
510 JE_CFLAGS_APPEND([-fvisibility=hidden])
511 fi
512fi
Jason Evans3cc1f1a2012-04-03 22:30:05 -0700513dnl Check for tls_model attribute support (clang 3.0 still lacks support).
514SAVED_CFLAGS="${CFLAGS}"
515JE_CFLAGS_APPEND([-Werror])
Elliot Ronaghan4b525182016-06-14 15:26:53 -0700516JE_CFLAGS_APPEND([-herror_on_warning])
Jason Evans3cc1f1a2012-04-03 22:30:05 -0700517JE_COMPILABLE([tls_model attribute], [],
518 [static __thread int
Daniel Micayf1cf3ea2014-09-16 04:42:33 -0400519 __attribute__((tls_model("initial-exec"), unused)) foo;
Jason Evans3cc1f1a2012-04-03 22:30:05 -0700520 foo = 0;],
521 [je_cv_tls_model])
522CFLAGS="${SAVED_CFLAGS}"
523if test "x${je_cv_tls_model}" = "xyes" ; then
524 AC_DEFINE([JEMALLOC_TLS_MODEL],
525 [__attribute__((tls_model("initial-exec")))])
526else
527 AC_DEFINE([JEMALLOC_TLS_MODEL], [ ])
528fi
Jason Evans0b8f0bc2015-07-10 16:41:12 -0700529dnl Check for alloc_size attribute support.
530SAVED_CFLAGS="${CFLAGS}"
531JE_CFLAGS_APPEND([-Werror])
Elliot Ronaghan4b525182016-06-14 15:26:53 -0700532JE_CFLAGS_APPEND([-herror_on_warning])
Jason Evans92d72ee2015-07-10 16:45:32 -0700533JE_COMPILABLE([alloc_size attribute], [#include <stdlib.h>],
534 [void *foo(size_t size) __attribute__((alloc_size(1)));],
Jason Evans0b8f0bc2015-07-10 16:41:12 -0700535 [je_cv_alloc_size])
536CFLAGS="${SAVED_CFLAGS}"
537if test "x${je_cv_alloc_size}" = "xyes" ; then
538 AC_DEFINE([JEMALLOC_HAVE_ATTR_ALLOC_SIZE], [ ])
539fi
Jason Evanse42c3092015-07-22 15:44:47 -0700540dnl Check for format(gnu_printf, ...) attribute support.
541SAVED_CFLAGS="${CFLAGS}"
542JE_CFLAGS_APPEND([-Werror])
Elliot Ronaghan4b525182016-06-14 15:26:53 -0700543JE_CFLAGS_APPEND([-herror_on_warning])
Jason Evanse42c3092015-07-22 15:44:47 -0700544JE_COMPILABLE([format(gnu_printf, ...) attribute], [#include <stdlib.h>],
545 [void *foo(const char *format, ...) __attribute__((format(gnu_printf, 1, 2)));],
546 [je_cv_format_gnu_printf])
547CFLAGS="${SAVED_CFLAGS}"
548if test "x${je_cv_format_gnu_printf}" = "xyes" ; then
549 AC_DEFINE([JEMALLOC_HAVE_ATTR_FORMAT_GNU_PRINTF], [ ])
550fi
551dnl Check for format(printf, ...) attribute support.
552SAVED_CFLAGS="${CFLAGS}"
553JE_CFLAGS_APPEND([-Werror])
Elliot Ronaghan4b525182016-06-14 15:26:53 -0700554JE_CFLAGS_APPEND([-herror_on_warning])
Jason Evanse42c3092015-07-22 15:44:47 -0700555JE_COMPILABLE([format(printf, ...) attribute], [#include <stdlib.h>],
556 [void *foo(const char *format, ...) __attribute__((format(printf, 1, 2)));],
557 [je_cv_format_printf])
558CFLAGS="${SAVED_CFLAGS}"
559if test "x${je_cv_format_printf}" = "xyes" ; then
560 AC_DEFINE([JEMALLOC_HAVE_ATTR_FORMAT_PRINTF], [ ])
561fi
Jason Evansfa5d2452011-03-15 10:25:59 -0700562
Jason Evansb7924f52009-06-23 19:01:18 -0700563dnl Support optional additions to rpath.
564AC_ARG_WITH([rpath],
Jason Evans90895cf2009-12-29 00:09:15 -0800565 [AS_HELP_STRING([--with-rpath=<rpath>], [Colon-separated rpath (ELF systems only)])],
Jason Evansb7924f52009-06-23 19:01:18 -0700566if test "x$with_rpath" = "xno" ; then
567 RPATH_EXTRA=
568else
569 RPATH_EXTRA="`echo $with_rpath | tr \":\" \" \"`"
570fi,
571 RPATH_EXTRA=
572)
573AC_SUBST([RPATH_EXTRA])
574
575dnl Disable rules that do automatic regeneration of configure output by default.
576AC_ARG_ENABLE([autogen],
Jason Evans78d815c2010-01-17 14:06:20 -0800577 [AS_HELP_STRING([--enable-autogen], [Automatically regenerate configure output])],
Jason Evansb7924f52009-06-23 19:01:18 -0700578if test "x$enable_autogen" = "xno" ; then
579 enable_autogen="0"
580else
581 enable_autogen="1"
582fi
583,
584enable_autogen="0"
585)
586AC_SUBST([enable_autogen])
587
588AC_PROG_INSTALL
589AC_PROG_RANLIB
Jason Evans7329a4f2013-01-22 10:53:29 -0800590AC_PATH_PROG([LD], [ld], [false], [$PATH])
591AC_PATH_PROG([AUTOCONF], [autoconf], [false], [$PATH])
Jason Evansb7924f52009-06-23 19:01:18 -0700592
Daniel Micay4cfe5512014-08-28 15:41:48 -0400593public_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 -0800594
595dnl Check for allocator-related functions that should be wrapped.
596AC_CHECK_FUNC([memalign],
Jason Evanse24c7af2012-03-19 10:21:17 -0700597 [AC_DEFINE([JEMALLOC_OVERRIDE_MEMALIGN], [ ])
Jason Evans7e77eaf2012-03-02 17:47:37 -0800598 public_syms="${public_syms} memalign"])
599AC_CHECK_FUNC([valloc],
Jason Evanse24c7af2012-03-19 10:21:17 -0700600 [AC_DEFINE([JEMALLOC_OVERRIDE_VALLOC], [ ])
Jason Evans7e77eaf2012-03-02 17:47:37 -0800601 public_syms="${public_syms} valloc"])
602
Jason Evans748dfac2013-12-06 18:27:33 -0800603dnl Do not compute test code coverage by default.
604GCOV_FLAGS=
605AC_ARG_ENABLE([code-coverage],
606 [AS_HELP_STRING([--enable-code-coverage],
607 [Enable code coverage])],
608[if test "x$enable_code_coverage" = "xno" ; then
609 enable_code_coverage="0"
610else
611 enable_code_coverage="1"
612fi
613],
614[enable_code_coverage="0"]
615)
616if test "x$enable_code_coverage" = "x1" ; then
617 deoptimize="no"
618 echo "$CFLAGS $EXTRA_CFLAGS" | grep '\-O' >/dev/null || deoptimize="yes"
619 if test "x${deoptimize}" = "xyes" ; then
620 JE_CFLAGS_APPEND([-O0])
621 fi
622 JE_CFLAGS_APPEND([-fprofile-arcs -ftest-coverage])
623 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -fprofile-arcs -ftest-coverage"
624 AC_DEFINE([JEMALLOC_CODE_COVERAGE], [ ])
625fi
626AC_SUBST([enable_code_coverage])
627
Jason Evans0a5489e2012-03-01 17:19:20 -0800628dnl Perform no name mangling by default.
629AC_ARG_WITH([mangling],
630 [AS_HELP_STRING([--with-mangling=<map>], [Mangle symbols in <map>])],
631 [mangling_map="$with_mangling"], [mangling_map=""])
Jason Evans0a5489e2012-03-01 17:19:20 -0800632
Jason Evans90895cf2009-12-29 00:09:15 -0800633dnl Do not prefix public APIs by default.
634AC_ARG_WITH([jemalloc_prefix],
635 [AS_HELP_STRING([--with-jemalloc-prefix=<prefix>], [Prefix to prepend to all public APIs])],
Jason Evansb0fd5012010-01-17 01:49:20 -0800636 [JEMALLOC_PREFIX="$with_jemalloc_prefix"],
Mike Hommey7cdea392012-04-30 12:38:27 +0200637 [if test "x$abi" != "xmacho" -a "x$abi" != "xpecoff"; then
Jason Evans2dbecf12010-09-05 10:35:13 -0700638 JEMALLOC_PREFIX=""
639else
640 JEMALLOC_PREFIX="je_"
641fi]
Jason Evans90895cf2009-12-29 00:09:15 -0800642)
643if test "x$JEMALLOC_PREFIX" != "x" ; then
Jason Evanse7339702010-10-23 18:37:06 -0700644 JEMALLOC_CPREFIX=`echo ${JEMALLOC_PREFIX} | tr "a-z" "A-Z"`
645 AC_DEFINE_UNQUOTED([JEMALLOC_PREFIX], ["$JEMALLOC_PREFIX"])
646 AC_DEFINE_UNQUOTED([JEMALLOC_CPREFIX], ["$JEMALLOC_CPREFIX"])
Jason Evans90895cf2009-12-29 00:09:15 -0800647fi
Jason Evans241abc62015-06-23 18:47:07 -0700648AC_SUBST([JEMALLOC_CPREFIX])
Jason Evans90895cf2009-12-29 00:09:15 -0800649
Mike Hommey99066602012-11-19 10:55:26 +0100650AC_ARG_WITH([export],
651 [AS_HELP_STRING([--without-export], [disable exporting jemalloc public APIs])],
652 [if test "x$with_export" = "xno"; then
Jason Evans2625c892013-01-22 16:46:27 -0800653 AC_DEFINE([JEMALLOC_EXPORT],[])
Mike Hommey99066602012-11-19 10:55:26 +0100654fi]
655)
656
Jason Evans86abd0d2013-11-30 15:25:42 -0800657dnl Mangle library-private APIs.
Jason Evans746e77a2011-07-30 16:40:52 -0700658AC_ARG_WITH([private_namespace],
659 [AS_HELP_STRING([--with-private-namespace=<prefix>], [Prefix to prepend to all library-private APIs])],
Jason Evans86abd0d2013-11-30 15:25:42 -0800660 [JEMALLOC_PRIVATE_NAMESPACE="${with_private_namespace}je_"],
661 [JEMALLOC_PRIVATE_NAMESPACE="je_"]
Jason Evans746e77a2011-07-30 16:40:52 -0700662)
Jason Evans86abd0d2013-11-30 15:25:42 -0800663AC_DEFINE_UNQUOTED([JEMALLOC_PRIVATE_NAMESPACE], [$JEMALLOC_PRIVATE_NAMESPACE])
664private_namespace="$JEMALLOC_PRIVATE_NAMESPACE"
665AC_SUBST([private_namespace])
Jason Evans746e77a2011-07-30 16:40:52 -0700666
Jason Evansb0fd5012010-01-17 01:49:20 -0800667dnl Do not add suffix to installed files by default.
668AC_ARG_WITH([install_suffix],
669 [AS_HELP_STRING([--with-install-suffix=<suffix>], [Suffix to append to all installed files])],
670 [INSTALL_SUFFIX="$with_install_suffix"],
671 [INSTALL_SUFFIX=]
672)
673install_suffix="$INSTALL_SUFFIX"
674AC_SUBST([install_suffix])
675
Jason Evansf8290092016-02-07 14:23:22 -0800676dnl Specify default malloc_conf.
677AC_ARG_WITH([malloc_conf],
678 [AS_HELP_STRING([--with-malloc-conf=<malloc_conf>], [config.malloc_conf options string])],
679 [JEMALLOC_CONFIG_MALLOC_CONF="$with_malloc_conf"],
680 [JEMALLOC_CONFIG_MALLOC_CONF=""]
681)
682config_malloc_conf="$JEMALLOC_CONFIG_MALLOC_CONF"
683AC_DEFINE_UNQUOTED([JEMALLOC_CONFIG_MALLOC_CONF], ["$config_malloc_conf"])
684
Jason Evans86abd0d2013-11-30 15:25:42 -0800685dnl Substitute @je_@ in jemalloc_protos.h.in, primarily to make generation of
686dnl jemalloc_protos_jet.h easy.
687je_="je_"
688AC_SUBST([je_])
689
Mike Hommeycf6032d2014-07-30 18:16:13 +0900690cfgoutputs_in="Makefile.in"
Nick White913e9a82014-09-19 22:01:23 +0100691cfgoutputs_in="${cfgoutputs_in} jemalloc.pc.in"
Mike Hommeycf6032d2014-07-30 18:16:13 +0900692cfgoutputs_in="${cfgoutputs_in} doc/html.xsl.in"
693cfgoutputs_in="${cfgoutputs_in} doc/manpages.xsl.in"
694cfgoutputs_in="${cfgoutputs_in} doc/jemalloc.xml.in"
695cfgoutputs_in="${cfgoutputs_in} include/jemalloc/jemalloc_macros.h.in"
696cfgoutputs_in="${cfgoutputs_in} include/jemalloc/jemalloc_protos.h.in"
Jason Evans82e88d12014-09-07 19:55:03 -0700697cfgoutputs_in="${cfgoutputs_in} include/jemalloc/jemalloc_typedefs.h.in"
Mike Hommeycf6032d2014-07-30 18:16:13 +0900698cfgoutputs_in="${cfgoutputs_in} include/jemalloc/internal/jemalloc_internal.h.in"
699cfgoutputs_in="${cfgoutputs_in} test/test.sh.in"
700cfgoutputs_in="${cfgoutputs_in} test/include/test/jemalloc_test.h.in"
Jason Evansb0fd5012010-01-17 01:49:20 -0800701
Jason Evansaee7fd22010-11-24 22:00:02 -0800702cfgoutputs_out="Makefile"
Nick White913e9a82014-09-19 22:01:23 +0100703cfgoutputs_out="${cfgoutputs_out} jemalloc.pc"
Jason Evansaee7fd22010-11-24 22:00:02 -0800704cfgoutputs_out="${cfgoutputs_out} doc/html.xsl"
705cfgoutputs_out="${cfgoutputs_out} doc/manpages.xsl"
Jason Evans86abd0d2013-11-30 15:25:42 -0800706cfgoutputs_out="${cfgoutputs_out} doc/jemalloc.xml"
707cfgoutputs_out="${cfgoutputs_out} include/jemalloc/jemalloc_macros.h"
708cfgoutputs_out="${cfgoutputs_out} include/jemalloc/jemalloc_protos.h"
Jason Evans82e88d12014-09-07 19:55:03 -0700709cfgoutputs_out="${cfgoutputs_out} include/jemalloc/jemalloc_typedefs.h"
Jason Evans376b1522010-02-11 14:45:59 -0800710cfgoutputs_out="${cfgoutputs_out} include/jemalloc/internal/jemalloc_internal.h"
Jason Evans86abd0d2013-11-30 15:25:42 -0800711cfgoutputs_out="${cfgoutputs_out} test/test.sh"
712cfgoutputs_out="${cfgoutputs_out} test/include/test/jemalloc_test.h"
Jason Evansb0fd5012010-01-17 01:49:20 -0800713
Jason Evansaee7fd22010-11-24 22:00:02 -0800714cfgoutputs_tup="Makefile"
Nick White913e9a82014-09-19 22:01:23 +0100715cfgoutputs_tup="${cfgoutputs_tup} jemalloc.pc:jemalloc.pc.in"
Jason Evansaee7fd22010-11-24 22:00:02 -0800716cfgoutputs_tup="${cfgoutputs_tup} doc/html.xsl:doc/html.xsl.in"
717cfgoutputs_tup="${cfgoutputs_tup} doc/manpages.xsl:doc/manpages.xsl.in"
Jason Evans86abd0d2013-11-30 15:25:42 -0800718cfgoutputs_tup="${cfgoutputs_tup} doc/jemalloc.xml:doc/jemalloc.xml.in"
719cfgoutputs_tup="${cfgoutputs_tup} include/jemalloc/jemalloc_macros.h:include/jemalloc/jemalloc_macros.h.in"
720cfgoutputs_tup="${cfgoutputs_tup} include/jemalloc/jemalloc_protos.h:include/jemalloc/jemalloc_protos.h.in"
Jason Evans82e88d12014-09-07 19:55:03 -0700721cfgoutputs_tup="${cfgoutputs_tup} include/jemalloc/jemalloc_typedefs.h:include/jemalloc/jemalloc_typedefs.h.in"
Jason Evans376b1522010-02-11 14:45:59 -0800722cfgoutputs_tup="${cfgoutputs_tup} include/jemalloc/internal/jemalloc_internal.h"
Jason Evans86abd0d2013-11-30 15:25:42 -0800723cfgoutputs_tup="${cfgoutputs_tup} test/test.sh:test/test.sh.in"
724cfgoutputs_tup="${cfgoutputs_tup} test/include/test/jemalloc_test.h:test/include/test/jemalloc_test.h.in"
Jason Evansb0fd5012010-01-17 01:49:20 -0800725
Mike Hommeycf6032d2014-07-30 18:16:13 +0900726cfghdrs_in="include/jemalloc/jemalloc_defs.h.in"
727cfghdrs_in="${cfghdrs_in} include/jemalloc/internal/jemalloc_internal_defs.h.in"
728cfghdrs_in="${cfghdrs_in} include/jemalloc/internal/private_namespace.sh"
729cfghdrs_in="${cfghdrs_in} include/jemalloc/internal/private_unnamespace.sh"
730cfghdrs_in="${cfghdrs_in} include/jemalloc/internal/private_symbols.txt"
731cfghdrs_in="${cfghdrs_in} include/jemalloc/internal/public_namespace.sh"
732cfghdrs_in="${cfghdrs_in} include/jemalloc/internal/public_unnamespace.sh"
733cfghdrs_in="${cfghdrs_in} include/jemalloc/internal/size_classes.sh"
734cfghdrs_in="${cfghdrs_in} include/jemalloc/jemalloc_rename.sh"
735cfghdrs_in="${cfghdrs_in} include/jemalloc/jemalloc_mangle.sh"
736cfghdrs_in="${cfghdrs_in} include/jemalloc/jemalloc.sh"
737cfghdrs_in="${cfghdrs_in} test/include/test/jemalloc_test_defs.h.in"
Jason Evansb0fd5012010-01-17 01:49:20 -0800738
Jason Evans86abd0d2013-11-30 15:25:42 -0800739cfghdrs_out="include/jemalloc/jemalloc_defs.h"
740cfghdrs_out="${cfghdrs_out} include/jemalloc/jemalloc${install_suffix}.h"
Jason Evans86abd0d2013-11-30 15:25:42 -0800741cfghdrs_out="${cfghdrs_out} include/jemalloc/internal/private_namespace.h"
742cfghdrs_out="${cfghdrs_out} include/jemalloc/internal/private_unnamespace.h"
Jason Evansf234dc52014-01-16 17:38:01 -0800743cfghdrs_out="${cfghdrs_out} include/jemalloc/internal/public_symbols.txt"
Jason Evans86abd0d2013-11-30 15:25:42 -0800744cfghdrs_out="${cfghdrs_out} include/jemalloc/internal/public_namespace.h"
745cfghdrs_out="${cfghdrs_out} include/jemalloc/internal/public_unnamespace.h"
Jason Evansb1726102012-02-28 16:50:47 -0800746cfghdrs_out="${cfghdrs_out} include/jemalloc/internal/size_classes.h"
Jason Evansf234dc52014-01-16 17:38:01 -0800747cfghdrs_out="${cfghdrs_out} include/jemalloc/jemalloc_protos_jet.h"
748cfghdrs_out="${cfghdrs_out} include/jemalloc/jemalloc_rename.h"
749cfghdrs_out="${cfghdrs_out} include/jemalloc/jemalloc_mangle.h"
750cfghdrs_out="${cfghdrs_out} include/jemalloc/jemalloc_mangle_jet.h"
751cfghdrs_out="${cfghdrs_out} include/jemalloc/internal/jemalloc_internal_defs.h"
Jason Evans80061b62013-12-09 13:21:08 -0800752cfghdrs_out="${cfghdrs_out} test/include/test/jemalloc_test_defs.h"
Jason Evansb0fd5012010-01-17 01:49:20 -0800753
Jason Evans86abd0d2013-11-30 15:25:42 -0800754cfghdrs_tup="include/jemalloc/jemalloc_defs.h:include/jemalloc/jemalloc_defs.h.in"
Mike Hommeycf6032d2014-07-30 18:16:13 +0900755cfghdrs_tup="${cfghdrs_tup} include/jemalloc/internal/jemalloc_internal_defs.h:include/jemalloc/internal/jemalloc_internal_defs.h.in"
756cfghdrs_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 -0800757
Jason Evans644d4142014-04-14 22:49:23 -0700758dnl Silence irrelevant compiler warnings by default.
Jason Evans355b4382010-09-20 19:20:48 -0700759AC_ARG_ENABLE([cc-silence],
Jason Evans644d4142014-04-14 22:49:23 -0700760 [AS_HELP_STRING([--disable-cc-silence],
761 [Do not silence irrelevant compiler warnings])],
Jason Evans355b4382010-09-20 19:20:48 -0700762[if test "x$enable_cc_silence" = "xno" ; then
763 enable_cc_silence="0"
764else
765 enable_cc_silence="1"
766fi
767],
Jason Evans644d4142014-04-14 22:49:23 -0700768[enable_cc_silence="1"]
Jason Evans355b4382010-09-20 19:20:48 -0700769)
770if test "x$enable_cc_silence" = "x1" ; then
Jason Evanse24c7af2012-03-19 10:21:17 -0700771 AC_DEFINE([JEMALLOC_CC_SILENCE], [ ])
Jason Evans355b4382010-09-20 19:20:48 -0700772fi
773
Jason Evansb7924f52009-06-23 19:01:18 -0700774dnl Do not compile with debugging by default.
775AC_ARG_ENABLE([debug],
Jason Evanse0a08a12015-03-18 21:06:58 -0700776 [AS_HELP_STRING([--enable-debug],
777 [Build debugging code (implies --enable-ivsalloc)])],
Jason Evansb7924f52009-06-23 19:01:18 -0700778[if test "x$enable_debug" = "xno" ; then
779 enable_debug="0"
780else
781 enable_debug="1"
782fi
783],
784[enable_debug="0"]
785)
Jason Evans02e5dcf2015-02-15 20:12:06 -0800786if test "x$enable_debug" = "x1" ; then
787 AC_DEFINE([JEMALLOC_DEBUG], [ ])
788fi
Jason Evanse0a08a12015-03-18 21:06:58 -0700789if test "x$enable_debug" = "x1" ; then
790 AC_DEFINE([JEMALLOC_DEBUG], [ ])
791 enable_ivsalloc="1"
792fi
Jason Evansb7924f52009-06-23 19:01:18 -0700793AC_SUBST([enable_debug])
794
Jason Evanse0a08a12015-03-18 21:06:58 -0700795dnl Do not validate pointers by default.
796AC_ARG_ENABLE([ivsalloc],
797 [AS_HELP_STRING([--enable-ivsalloc],
798 [Validate pointers passed through the public API])],
799[if test "x$enable_ivsalloc" = "xno" ; then
800 enable_ivsalloc="0"
801else
802 enable_ivsalloc="1"
803fi
804],
805[enable_ivsalloc="0"]
806)
807if test "x$enable_ivsalloc" = "x1" ; then
808 AC_DEFINE([JEMALLOC_IVSALLOC], [ ])
809fi
810
Jason Evansb7924f52009-06-23 19:01:18 -0700811dnl Only optimize if not debugging.
812if test "x$enable_debug" = "x0" -a "x$no_CFLAGS" = "xyes" ; then
813 dnl Make sure that an optimization flag was not specified in EXTRA_CFLAGS.
Jason Evansf3340ca2009-06-30 16:17:05 -0700814 optimize="no"
Jason Evans748dfac2013-12-06 18:27:33 -0800815 echo "$CFLAGS $EXTRA_CFLAGS" | grep '\-O' >/dev/null || optimize="yes"
Jason Evansf3340ca2009-06-30 16:17:05 -0700816 if test "x${optimize}" = "xyes" ; then
817 if test "x$GCC" = "xyes" ; then
818 JE_CFLAGS_APPEND([-O3])
819 JE_CFLAGS_APPEND([-funroll-loops])
Mike Hommeyfd97b1d2012-04-30 12:38:31 +0200820 elif test "x$je_cv_msvc" = "xyes" ; then
821 JE_CFLAGS_APPEND([-O2])
Jason Evansf3340ca2009-06-30 16:17:05 -0700822 else
823 JE_CFLAGS_APPEND([-O])
824 fi
Jason Evansb7924f52009-06-23 19:01:18 -0700825 fi
826fi
827
Jason Evansd073a322012-02-28 20:41:16 -0800828dnl Enable statistics calculation by default.
Jason Evansb7924f52009-06-23 19:01:18 -0700829AC_ARG_ENABLE([stats],
Jason Evans777c1912012-02-28 20:49:22 -0800830 [AS_HELP_STRING([--disable-stats],
831 [Disable statistics calculation/reporting])],
Jason Evansb7924f52009-06-23 19:01:18 -0700832[if test "x$enable_stats" = "xno" ; then
833 enable_stats="0"
834else
835 enable_stats="1"
836fi
837],
Jason Evansd073a322012-02-28 20:41:16 -0800838[enable_stats="1"]
Jason Evansb7924f52009-06-23 19:01:18 -0700839)
840if test "x$enable_stats" = "x1" ; then
841 AC_DEFINE([JEMALLOC_STATS], [ ])
842fi
843AC_SUBST([enable_stats])
844
Jason Evans6109fe02010-02-10 10:37:56 -0800845dnl Do not enable profiling by default.
846AC_ARG_ENABLE([prof],
847 [AS_HELP_STRING([--enable-prof], [Enable allocation profiling])],
848[if test "x$enable_prof" = "xno" ; then
849 enable_prof="0"
850else
851 enable_prof="1"
852fi
853],
854[enable_prof="0"]
855)
Jason Evans77f350b2011-03-15 22:23:12 -0700856if test "x$enable_prof" = "x1" ; then
857 backtrace_method=""
Jason Evansb27805b2010-02-10 18:15:53 -0800858else
Jason Evans77f350b2011-03-15 22:23:12 -0700859 backtrace_method="N/A"
Jason Evansb27805b2010-02-10 18:15:53 -0800860fi
Jason Evans77f350b2011-03-15 22:23:12 -0700861
Jason Evans6109fe02010-02-10 10:37:56 -0800862AC_ARG_ENABLE([prof-libunwind],
863 [AS_HELP_STRING([--enable-prof-libunwind], [Use libunwind for backtracing])],
864[if test "x$enable_prof_libunwind" = "xno" ; then
865 enable_prof_libunwind="0"
866else
867 enable_prof_libunwind="1"
868fi
869],
870[enable_prof_libunwind="0"]
871)
Jason Evansca6bd4f2010-03-02 14:12:58 -0800872AC_ARG_WITH([static_libunwind],
873 [AS_HELP_STRING([--with-static-libunwind=<libunwind.a>],
874 [Path to static libunwind library; use rather than dynamically linking])],
875if test "x$with_static_libunwind" = "xno" ; then
876 LUNWIND="-lunwind"
877else
878 if test ! -f "$with_static_libunwind" ; then
879 AC_MSG_ERROR([Static libunwind not found: $with_static_libunwind])
880 fi
881 LUNWIND="$with_static_libunwind"
882fi,
883 LUNWIND="-lunwind"
884)
Jason Evans77f350b2011-03-15 22:23:12 -0700885if test "x$backtrace_method" = "x" -a "x$enable_prof_libunwind" = "x1" ; then
886 AC_CHECK_HEADERS([libunwind.h], , [enable_prof_libunwind="0"])
887 if test "x$LUNWIND" = "x-lunwind" ; then
Jason Evans05125b82014-04-22 20:48:07 -0700888 AC_CHECK_LIB([unwind], [unw_backtrace], [LIBS="$LIBS $LUNWIND"],
Jason Evans77f350b2011-03-15 22:23:12 -0700889 [enable_prof_libunwind="0"])
890 else
891 LIBS="$LIBS $LUNWIND"
892 fi
893 if test "x${enable_prof_libunwind}" = "x1" ; then
894 backtrace_method="libunwind"
895 AC_DEFINE([JEMALLOC_PROF_LIBUNWIND], [ ])
896 fi
897fi
898
899AC_ARG_ENABLE([prof-libgcc],
900 [AS_HELP_STRING([--disable-prof-libgcc],
901 [Do not use libgcc for backtracing])],
902[if test "x$enable_prof_libgcc" = "xno" ; then
903 enable_prof_libgcc="0"
904else
905 enable_prof_libgcc="1"
906fi
907],
908[enable_prof_libgcc="1"]
909)
910if test "x$backtrace_method" = "x" -a "x$enable_prof_libgcc" = "x1" \
911 -a "x$GCC" = "xyes" ; then
912 AC_CHECK_HEADERS([unwind.h], , [enable_prof_libgcc="0"])
913 AC_CHECK_LIB([gcc], [_Unwind_Backtrace], [LIBS="$LIBS -lgcc"], [enable_prof_libgcc="0"])
Jason Evans77f350b2011-03-15 22:23:12 -0700914 if test "x${enable_prof_libgcc}" = "x1" ; then
915 backtrace_method="libgcc"
916 AC_DEFINE([JEMALLOC_PROF_LIBGCC], [ ])
917 fi
918else
919 enable_prof_libgcc="0"
920fi
921
922AC_ARG_ENABLE([prof-gcc],
923 [AS_HELP_STRING([--disable-prof-gcc],
924 [Do not use gcc intrinsics for backtracing])],
925[if test "x$enable_prof_gcc" = "xno" ; then
926 enable_prof_gcc="0"
927else
928 enable_prof_gcc="1"
929fi
930],
931[enable_prof_gcc="1"]
932)
933if test "x$backtrace_method" = "x" -a "x$enable_prof_gcc" = "x1" \
934 -a "x$GCC" = "xyes" ; then
Jason Evanse181f5a2014-03-30 18:58:32 -0700935 JE_CFLAGS_APPEND([-fno-omit-frame-pointer])
Jason Evans77f350b2011-03-15 22:23:12 -0700936 backtrace_method="gcc intrinsics"
937 AC_DEFINE([JEMALLOC_PROF_GCC], [ ])
938else
939 enable_prof_gcc="0"
940fi
941
942if test "x$backtrace_method" = "x" ; then
943 backtrace_method="none (disabling profiling)"
944 enable_prof="0"
945fi
946AC_MSG_CHECKING([configured backtracing method])
947AC_MSG_RESULT([$backtrace_method])
Jason Evans2dbecf12010-09-05 10:35:13 -0700948if test "x$enable_prof" = "x1" ; then
Jason Evanse7d67792016-10-27 21:23:48 -0700949 dnl Heap profiling uses the log(3) function.
950 if test "x$LM" != "x" ; then
951 LIBS="$LIBS $LM"
Jason Evansd37d5ad2013-12-05 23:01:50 -0800952 fi
953
Jason Evans2dbecf12010-09-05 10:35:13 -0700954 AC_DEFINE([JEMALLOC_PROF], [ ])
Jason Evans2dbecf12010-09-05 10:35:13 -0700955fi
956AC_SUBST([enable_prof])
Jason Evans2dbecf12010-09-05 10:35:13 -0700957
Jason Evans84cbbcb2009-12-29 00:09:15 -0800958dnl Enable thread-specific caching by default.
959AC_ARG_ENABLE([tcache],
960 [AS_HELP_STRING([--disable-tcache], [Disable per thread caches])],
961[if test "x$enable_tcache" = "xno" ; then
962 enable_tcache="0"
Jason Evansb7924f52009-06-23 19:01:18 -0700963else
Jason Evans84cbbcb2009-12-29 00:09:15 -0800964 enable_tcache="1"
Jason Evansb7924f52009-06-23 19:01:18 -0700965fi
966],
Jason Evans84cbbcb2009-12-29 00:09:15 -0800967[enable_tcache="1"]
Jason Evansb7924f52009-06-23 19:01:18 -0700968)
Jason Evans2dbecf12010-09-05 10:35:13 -0700969if test "x$enable_tcache" = "x1" ; then
970 AC_DEFINE([JEMALLOC_TCACHE], [ ])
971fi
972AC_SUBST([enable_tcache])
Jason Evansb7924f52009-06-23 19:01:18 -0700973
Jason Evansd059b9d2015-07-24 18:21:42 -0700974dnl Indicate whether adjacent virtual memory mappings automatically coalesce
975dnl (and fragment on demand).
976if test "x${maps_coalesce}" = "x1" ; then
977 AC_DEFINE([JEMALLOC_MAPS_COALESCE], [ ])
978fi
979
Jason Evans59ae2762012-04-16 17:52:27 -0700980dnl Enable VM deallocation via munmap() by default.
981AC_ARG_ENABLE([munmap],
982 [AS_HELP_STRING([--disable-munmap], [Disable VM deallocation via munmap(2)])],
983[if test "x$enable_munmap" = "xno" ; then
984 enable_munmap="0"
985else
986 enable_munmap="1"
987fi
988],
989[enable_munmap="${default_munmap}"]
990)
991if test "x$enable_munmap" = "x1" ; then
992 AC_DEFINE([JEMALLOC_MUNMAP], [ ])
993fi
994AC_SUBST([enable_munmap])
995
Jason Evans4d434ad2014-04-15 12:09:48 -0700996dnl Enable allocation from DSS if supported by the OS.
997have_dss="1"
Mike Hommey83c324a2012-04-12 10:13:03 +0200998dnl Check whether the BSD/SUSv1 sbrk() exists. If not, disable DSS support.
999AC_CHECK_FUNC([sbrk], [have_sbrk="1"], [have_sbrk="0"])
1000if test "x$have_sbrk" = "x1" ; then
Steven Stewart-Gallus79230fe2014-06-19 16:11:43 -07001001 if test "x$sbrk_deprecated" = "x1" ; then
Jason Evans66688532013-12-03 21:49:36 -08001002 AC_MSG_RESULT([Disabling dss allocation because sbrk is deprecated])
Jason Evans4d434ad2014-04-15 12:09:48 -07001003 have_dss="0"
Jason Evans66688532013-12-03 21:49:36 -08001004 fi
Mike Hommey83c324a2012-04-12 10:13:03 +02001005else
Jason Evans4d434ad2014-04-15 12:09:48 -07001006 have_dss="0"
Mike Hommey83c324a2012-04-12 10:13:03 +02001007fi
1008
Jason Evans4d434ad2014-04-15 12:09:48 -07001009if test "x$have_dss" = "x1" ; then
Jason Evansb7924f52009-06-23 19:01:18 -07001010 AC_DEFINE([JEMALLOC_DSS], [ ])
1011fi
Jason Evansb7924f52009-06-23 19:01:18 -07001012
Jason Evans777c1912012-02-28 20:49:22 -08001013dnl Support the junk/zero filling option by default.
Jason Evansb7924f52009-06-23 19:01:18 -07001014AC_ARG_ENABLE([fill],
Jason Evans122449b2012-04-06 00:35:09 -07001015 [AS_HELP_STRING([--disable-fill],
1016 [Disable support for junk/zero filling, quarantine, and redzones])],
Jason Evansb7924f52009-06-23 19:01:18 -07001017[if test "x$enable_fill" = "xno" ; then
1018 enable_fill="0"
1019else
1020 enable_fill="1"
1021fi
1022],
Jason Evans777c1912012-02-28 20:49:22 -08001023[enable_fill="1"]
Jason Evansb7924f52009-06-23 19:01:18 -07001024)
1025if test "x$enable_fill" = "x1" ; then
1026 AC_DEFINE([JEMALLOC_FILL], [ ])
1027fi
1028AC_SUBST([enable_fill])
1029
Jason Evansb1476112012-04-05 13:36:17 -07001030dnl Disable utrace(2)-based tracing by default.
1031AC_ARG_ENABLE([utrace],
1032 [AS_HELP_STRING([--enable-utrace], [Enable utrace(2)-based tracing])],
1033[if test "x$enable_utrace" = "xno" ; then
1034 enable_utrace="0"
1035else
1036 enable_utrace="1"
1037fi
1038],
1039[enable_utrace="0"]
1040)
1041JE_COMPILABLE([utrace(2)], [
1042#include <sys/types.h>
1043#include <sys/param.h>
1044#include <sys/time.h>
1045#include <sys/uio.h>
1046#include <sys/ktrace.h>
1047], [
1048 utrace((void *)0, 0);
1049], [je_cv_utrace])
1050if test "x${je_cv_utrace}" = "xno" ; then
1051 enable_utrace="0"
1052fi
1053if test "x$enable_utrace" = "x1" ; then
1054 AC_DEFINE([JEMALLOC_UTRACE], [ ])
1055fi
1056AC_SUBST([enable_utrace])
1057
Jason Evans122449b2012-04-06 00:35:09 -07001058dnl Support Valgrind by default.
1059AC_ARG_ENABLE([valgrind],
1060 [AS_HELP_STRING([--disable-valgrind], [Disable support for Valgrind])],
1061[if test "x$enable_valgrind" = "xno" ; then
1062 enable_valgrind="0"
1063else
1064 enable_valgrind="1"
1065fi
1066],
1067[enable_valgrind="1"]
1068)
1069if test "x$enable_valgrind" = "x1" ; then
1070 JE_COMPILABLE([valgrind], [
1071#include <valgrind/valgrind.h>
1072#include <valgrind/memcheck.h>
1073
Mike Hommey7bfecf42012-04-30 15:15:15 +02001074#if !defined(VALGRIND_RESIZEINPLACE_BLOCK)
Jason Evans122449b2012-04-06 00:35:09 -07001075# error "Incompatible Valgrind version"
1076#endif
1077], [], [je_cv_valgrind])
1078 if test "x${je_cv_valgrind}" = "xno" ; then
1079 enable_valgrind="0"
1080 fi
1081 if test "x$enable_valgrind" = "x1" ; then
1082 AC_DEFINE([JEMALLOC_VALGRIND], [ ])
1083 fi
1084fi
1085AC_SUBST([enable_valgrind])
1086
Jason Evansb7924f52009-06-23 19:01:18 -07001087dnl Do not support the xmalloc option by default.
1088AC_ARG_ENABLE([xmalloc],
1089 [AS_HELP_STRING([--enable-xmalloc], [Support xmalloc option])],
1090[if test "x$enable_xmalloc" = "xno" ; then
1091 enable_xmalloc="0"
1092else
1093 enable_xmalloc="1"
1094fi
1095],
1096[enable_xmalloc="0"]
1097)
1098if test "x$enable_xmalloc" = "x1" ; then
1099 AC_DEFINE([JEMALLOC_XMALLOC], [ ])
1100fi
1101AC_SUBST([enable_xmalloc])
1102
Jason Evans8a03cf02015-05-04 09:58:36 -07001103dnl Support cache-oblivious allocation alignment by default.
1104AC_ARG_ENABLE([cache-oblivious],
1105 [AS_HELP_STRING([--disable-cache-oblivious],
1106 [Disable support for cache-oblivious allocation alignment])],
1107[if test "x$enable_cache_oblivious" = "xno" ; then
1108 enable_cache_oblivious="0"
1109else
1110 enable_cache_oblivious="1"
1111fi
1112],
1113[enable_cache_oblivious="1"]
1114)
1115if test "x$enable_cache_oblivious" = "x1" ; then
1116 AC_DEFINE([JEMALLOC_CACHE_OBLIVIOUS], [ ])
1117fi
1118AC_SUBST([enable_cache_oblivious])
1119
Elliot Ronaghand1207f02016-06-17 13:28:39 -07001120
1121
1122JE_COMPILABLE([a program using __builtin_unreachable], [
1123void foo (void) {
1124 __builtin_unreachable();
1125}
1126], [
1127 {
1128 foo();
1129 }
1130], [je_cv_gcc_builtin_unreachable])
Elliot Ronaghan38a96f02016-07-12 15:52:18 -07001131if test "x${je_cv_gcc_builtin_unreachable}" = "xyes" ; then
Elliot Ronaghand1207f02016-06-17 13:28:39 -07001132 AC_DEFINE([JEMALLOC_INTERNAL_UNREACHABLE], [__builtin_unreachable])
1133else
1134 AC_DEFINE([JEMALLOC_INTERNAL_UNREACHABLE], [abort])
1135fi
1136
Mike Hommey8f50ec82014-06-04 12:12:55 +09001137dnl ============================================================================
1138dnl Check for __builtin_ffsl(), then ffsl(3), and fail if neither are found.
1139dnl One of those two functions should (theoretically) exist on all platforms
1140dnl that jemalloc currently has a chance of functioning on without modification.
Jason Evansecae1232016-02-20 23:41:33 -08001141dnl We additionally assume ffs[ll]() or __builtin_ffs[ll]() are defined if
Mike Hommey8f50ec82014-06-04 12:12:55 +09001142dnl ffsl() or __builtin_ffsl() are defined, respectively.
1143JE_COMPILABLE([a program using __builtin_ffsl], [
1144#include <stdio.h>
1145#include <strings.h>
1146#include <string.h>
1147], [
1148 {
1149 int rv = __builtin_ffsl(0x08);
1150 printf("%d\n", rv);
1151 }
1152], [je_cv_gcc_builtin_ffsl])
Steven Stewart-Gallus79230fe2014-06-19 16:11:43 -07001153if test "x${je_cv_gcc_builtin_ffsl}" = "xyes" ; then
Jason Evansecae1232016-02-20 23:41:33 -08001154 AC_DEFINE([JEMALLOC_INTERNAL_FFSLL], [__builtin_ffsll])
Mike Hommey8f50ec82014-06-04 12:12:55 +09001155 AC_DEFINE([JEMALLOC_INTERNAL_FFSL], [__builtin_ffsl])
1156 AC_DEFINE([JEMALLOC_INTERNAL_FFS], [__builtin_ffs])
1157else
1158 JE_COMPILABLE([a program using ffsl], [
1159 #include <stdio.h>
1160 #include <strings.h>
1161 #include <string.h>
1162 ], [
1163 {
1164 int rv = ffsl(0x08);
1165 printf("%d\n", rv);
1166 }
1167 ], [je_cv_function_ffsl])
Steven Stewart-Gallus79230fe2014-06-19 16:11:43 -07001168 if test "x${je_cv_function_ffsl}" = "xyes" ; then
Jason Evansecae1232016-02-20 23:41:33 -08001169 AC_DEFINE([JEMALLOC_INTERNAL_FFSLL], [ffsll])
Mike Hommey8f50ec82014-06-04 12:12:55 +09001170 AC_DEFINE([JEMALLOC_INTERNAL_FFSL], [ffsl])
1171 AC_DEFINE([JEMALLOC_INTERNAL_FFS], [ffs])
1172 else
1173 AC_MSG_ERROR([Cannot build without ffsl(3) or __builtin_ffsl()])
1174 fi
1175fi
1176
Jason Evans81e54752014-10-10 22:34:25 -07001177AC_ARG_WITH([lg_tiny_min],
1178 [AS_HELP_STRING([--with-lg-tiny-min=<lg-tiny-min>],
1179 [Base 2 log of minimum tiny size class to support])],
1180 [LG_TINY_MIN="$with_lg_tiny_min"],
1181 [LG_TINY_MIN="3"])
1182AC_DEFINE_UNQUOTED([LG_TINY_MIN], [$LG_TINY_MIN])
1183
Jason Evansfc0b3b72014-10-09 17:54:06 -07001184AC_ARG_WITH([lg_quantum],
1185 [AS_HELP_STRING([--with-lg-quantum=<lg-quantum>],
1186 [Base 2 log of minimum allocation alignment])],
Jason Evans81e54752014-10-10 22:34:25 -07001187 [LG_QUANTA="$with_lg_quantum"],
1188 [LG_QUANTA="3 4"])
1189if test "x$with_lg_quantum" != "x" ; then
1190 AC_DEFINE_UNQUOTED([LG_QUANTUM], [$with_lg_quantum])
1191fi
Jason Evansfc0b3b72014-10-09 17:54:06 -07001192
1193AC_ARG_WITH([lg_page],
1194 [AS_HELP_STRING([--with-lg-page=<lg-page>], [Base 2 log of system page size])],
1195 [LG_PAGE="$with_lg_page"], [LG_PAGE="detect"])
Jason Evansb0808d52015-02-03 12:39:31 -08001196if test "x$LG_PAGE" = "xdetect"; then
Jason Evansfc0b3b72014-10-09 17:54:06 -07001197 AC_CACHE_CHECK([LG_PAGE],
1198 [je_cv_lg_page],
Jason Evans6684cac2012-03-05 12:15:36 -08001199 AC_RUN_IFELSE([AC_LANG_PROGRAM(
Mike Hommeya19e87f2012-04-21 21:27:46 -07001200[[
Mike Hommeyfd97b1d2012-04-30 12:38:31 +02001201#include <strings.h>
Mike Hommeya19e87f2012-04-21 21:27:46 -07001202#ifdef _WIN32
1203#include <windows.h>
1204#else
Jason Evansb7924f52009-06-23 19:01:18 -07001205#include <unistd.h>
Mike Hommeya19e87f2012-04-21 21:27:46 -07001206#endif
1207#include <stdio.h>
Jason Evans6684cac2012-03-05 12:15:36 -08001208]],
1209[[
Garrett Cooper72c1e592012-12-02 17:57:28 -08001210 int result;
Jason Evansb7924f52009-06-23 19:01:18 -07001211 FILE *f;
1212
Mike Hommeya19e87f2012-04-21 21:27:46 -07001213#ifdef _WIN32
1214 SYSTEM_INFO si;
1215 GetSystemInfo(&si);
1216 result = si.dwPageSize;
1217#else
Jason Evansb7924f52009-06-23 19:01:18 -07001218 result = sysconf(_SC_PAGESIZE);
Mike Hommeya19e87f2012-04-21 21:27:46 -07001219#endif
Jason Evansb7924f52009-06-23 19:01:18 -07001220 if (result == -1) {
1221 return 1;
1222 }
Mike Hommey8f50ec82014-06-04 12:12:55 +09001223 result = JEMALLOC_INTERNAL_FFSL(result) - 1;
Mike Hommeya19e87f2012-04-21 21:27:46 -07001224
Jason Evansb7924f52009-06-23 19:01:18 -07001225 f = fopen("conftest.out", "w");
1226 if (f == NULL) {
1227 return 1;
1228 }
rustyxbc498632016-01-30 13:38:33 +01001229 fprintf(f, "%d", result);
Jason Evans3cc1f1a2012-04-03 22:30:05 -07001230 fclose(f);
Jason Evansb7924f52009-06-23 19:01:18 -07001231
1232 return 0;
1233]])],
Jason Evansfc0b3b72014-10-09 17:54:06 -07001234 [je_cv_lg_page=`cat conftest.out`],
1235 [je_cv_lg_page=undefined],
1236 [je_cv_lg_page=12]))
Jason Evans6684cac2012-03-05 12:15:36 -08001237fi
Jason Evansfc0b3b72014-10-09 17:54:06 -07001238if test "x${je_cv_lg_page}" != "x" ; then
1239 LG_PAGE="${je_cv_lg_page}"
1240fi
1241if test "x${LG_PAGE}" != "xundefined" ; then
1242 AC_DEFINE_UNQUOTED([LG_PAGE], [$LG_PAGE])
1243else
1244 AC_MSG_ERROR([cannot determine value for LG_PAGE])
1245fi
1246
1247AC_ARG_WITH([lg_page_sizes],
1248 [AS_HELP_STRING([--with-lg-page-sizes=<lg-page-sizes>],
1249 [Base 2 logs of system page sizes to support])],
1250 [LG_PAGE_SIZES="$with_lg_page_sizes"], [LG_PAGE_SIZES="$LG_PAGE"])
1251
1252AC_ARG_WITH([lg_size_class_group],
1253 [AS_HELP_STRING([--with-lg-size-class-group=<lg-size-class-group>],
1254 [Base 2 log of size classes per doubling])],
1255 [LG_SIZE_CLASS_GROUP="$with_lg_size_class_group"],
1256 [LG_SIZE_CLASS_GROUP="2"])
Jason Evansb7924f52009-06-23 19:01:18 -07001257
1258dnl ============================================================================
1259dnl jemalloc configuration.
1260dnl
Jason Evansa40bc7a2010-03-02 13:01:16 -08001261
Jason Evans434ea642016-03-14 20:19:11 -07001262AC_ARG_WITH([version],
1263 [AS_HELP_STRING([--with-version=<major>.<minor>.<bugfix>-<nrev>-g<gid>],
1264 [Version string])],
1265 [
1266 echo "${with_version}" | grep ['^[0-9]\+\.[0-9]\+\.[0-9]\+-[0-9]\+-g[0-9a-f]\+$'] 2>&1 1>/dev/null
1267 if test $? -ne 0 ; then
1268 AC_MSG_ERROR([${with_version} does not match <major>.<minor>.<bugfix>-<nrev>-g<gid>])
Jason Evansa5a658a2014-09-02 15:07:07 -07001269 fi
Jason Evans434ea642016-03-14 20:19:11 -07001270 echo "$with_version" > "${objroot}VERSION"
1271 ], [
1272 dnl Set VERSION if source directory is inside a git repository.
1273 if test "x`test ! \"${srcroot}\" && cd \"${srcroot}\"; git rev-parse --is-inside-work-tree 2>/dev/null`" = "xtrue" ; then
1274 dnl Pattern globs aren't powerful enough to match both single- and
1275 dnl double-digit version numbers, so iterate over patterns to support up
1276 dnl to version 99.99.99 without any accidental matches.
1277 for pattern in ['[0-9].[0-9].[0-9]' '[0-9].[0-9].[0-9][0-9]' \
1278 '[0-9].[0-9][0-9].[0-9]' '[0-9].[0-9][0-9].[0-9][0-9]' \
1279 '[0-9][0-9].[0-9].[0-9]' '[0-9][0-9].[0-9].[0-9][0-9]' \
1280 '[0-9][0-9].[0-9][0-9].[0-9]' \
1281 '[0-9][0-9].[0-9][0-9].[0-9][0-9]']; do
1282 (test ! "${srcroot}" && cd "${srcroot}"; git describe --long --abbrev=40 --match="${pattern}") > "${objroot}VERSION.tmp" 2>/dev/null
1283 if test $? -eq 0 ; then
1284 mv "${objroot}VERSION.tmp" "${objroot}VERSION"
1285 break
1286 fi
1287 done
1288 fi
1289 rm -f "${objroot}VERSION.tmp"
1290 ])
1291
Dan McGregorf8880312014-12-23 16:10:08 -06001292if test ! -e "${objroot}VERSION" ; then
1293 if test ! -e "${srcroot}VERSION" ; then
1294 AC_MSG_RESULT(
1295 [Missing VERSION file, and unable to generate it; creating bogus VERSION])
1296 echo "0.0.0-0-g0000000000000000000000000000000000000000" > "${objroot}VERSION"
1297 else
1298 cp ${srcroot}VERSION ${objroot}VERSION
1299 fi
Jason Evansa5a658a2014-09-02 15:07:07 -07001300fi
Dan McGregorf8880312014-12-23 16:10:08 -06001301jemalloc_version=`cat "${objroot}VERSION"`
Jason Evansa40bc7a2010-03-02 13:01:16 -08001302jemalloc_version_major=`echo ${jemalloc_version} | tr ".g-" " " | awk '{print [$]1}'`
1303jemalloc_version_minor=`echo ${jemalloc_version} | tr ".g-" " " | awk '{print [$]2}'`
1304jemalloc_version_bugfix=`echo ${jemalloc_version} | tr ".g-" " " | awk '{print [$]3}'`
1305jemalloc_version_nrev=`echo ${jemalloc_version} | tr ".g-" " " | awk '{print [$]4}'`
1306jemalloc_version_gid=`echo ${jemalloc_version} | tr ".g-" " " | awk '{print [$]5}'`
Jason Evansb7924f52009-06-23 19:01:18 -07001307AC_SUBST([jemalloc_version])
Jason Evansa40bc7a2010-03-02 13:01:16 -08001308AC_SUBST([jemalloc_version_major])
1309AC_SUBST([jemalloc_version_minor])
1310AC_SUBST([jemalloc_version_bugfix])
1311AC_SUBST([jemalloc_version_nrev])
1312AC_SUBST([jemalloc_version_gid])
Jason Evansb7924f52009-06-23 19:01:18 -07001313
1314dnl ============================================================================
1315dnl Configure pthreads.
1316
Mike Hommeya19e87f2012-04-21 21:27:46 -07001317if test "x$abi" != "xpecoff" ; then
1318 AC_CHECK_HEADERS([pthread.h], , [AC_MSG_ERROR([pthread.h is missing])])
1319 dnl Some systems may embed pthreads functionality in libc; check for libpthread
1320 dnl first, but try libc too before failing.
1321 AC_CHECK_LIB([pthread], [pthread_create], [LIBS="$LIBS -lpthread"],
1322 [AC_SEARCH_LIBS([pthread_create], , ,
1323 AC_MSG_ERROR([libpthread is missing]))])
1324fi
Jason Evansb7924f52009-06-23 19:01:18 -07001325
1326CPPFLAGS="$CPPFLAGS -D_REENTRANT"
1327
Jason Evansc1e9cf42016-05-03 21:28:20 -07001328dnl Check whether clock_gettime(2) is in libc or librt.
1329AC_SEARCH_LIBS([clock_gettime], [rt])
Jason Evans345c1b02015-09-15 14:59:56 -07001330
Elliot Ronaghanb770d2d2016-06-14 14:20:28 -07001331dnl Cray wrapper compiler often adds `-lrt` when using `-static`. Check with
1332dnl `-dynamic` as well in case a user tries to dynamically link in jemalloc
1333if test "x$je_cv_cray_prgenv_wrapper" = "xyes" ; then
1334 if test "$ac_cv_search_clock_gettime" != "-lrt"; then
1335 SAVED_CFLAGS="${CFLAGS}"
1336
1337 unset ac_cv_search_clock_gettime
1338 JE_CFLAGS_APPEND([-dynamic])
1339 AC_SEARCH_LIBS([clock_gettime], [rt])
1340
1341 CFLAGS="${SAVED_CFLAGS}"
1342 fi
1343fi
1344
Jason Evans1d57c032016-10-29 22:55:08 -07001345dnl check for CLOCK_MONOTONIC_COARSE (Linux-specific).
1346JE_COMPILABLE([clock_gettime(CLOCK_MONOTONIC_COARSE, ...)], [
Jason Evansb732c392016-10-07 08:47:16 -07001347#include <time.h>
1348], [
1349 struct timespec ts;
1350
Jason Evans1d57c032016-10-29 22:55:08 -07001351 clock_gettime(CLOCK_MONOTONIC_COARSE, &ts);
1352], [je_cv_clock_monotonic_coarse])
1353if test "x${je_cv_clock_monotonic_coarse}" = "xyes" ; then
1354 AC_DEFINE([JEMALLOC_HAVE_CLOCK_MONOTONIC_COARSE])
Jason Evansb732c392016-10-07 08:47:16 -07001355fi
1356
1357dnl check for CLOCK_MONOTONIC.
1358JE_COMPILABLE([clock_gettime(CLOCK_MONOTONIC, ...)], [
1359#include <unistd.h>
1360#include <time.h>
1361], [
1362 struct timespec ts;
1363
1364 clock_gettime(CLOCK_MONOTONIC, &ts);
1365#if !defined(_POSIX_MONOTONIC_CLOCK) || _POSIX_MONOTONIC_CLOCK < 0
1366# error _POSIX_MONOTONIC_CLOCK missing/invalid
1367#endif
1368], [je_cv_clock_monotonic])
1369if test "x${je_cv_clock_monotonic}" = "xyes" ; then
1370 AC_DEFINE([JEMALLOC_HAVE_CLOCK_MONOTONIC])
1371fi
1372
1373dnl Check for mach_absolute_time().
1374JE_COMPILABLE([mach_absolute_time()], [
1375#include <mach/mach_time.h>
1376], [
1377 mach_absolute_time();
1378], [je_cv_mach_absolute_time])
1379if test "x${je_cv_mach_absolute_time}" = "xyes" ; then
1380 AC_DEFINE([JEMALLOC_HAVE_MACH_ABSOLUTE_TIME])
1381fi
1382
Daniel Micayb74041f2014-12-09 17:41:34 -05001383dnl Check if the GNU-specific secure_getenv function exists.
1384AC_CHECK_FUNC([secure_getenv],
1385 [have_secure_getenv="1"],
1386 [have_secure_getenv="0"]
1387 )
1388if test "x$have_secure_getenv" = "x1" ; then
1389 AC_DEFINE([JEMALLOC_HAVE_SECURE_GETENV], [ ])
1390fi
1391
1392dnl Check if the Solaris/BSD issetugid function exists.
1393AC_CHECK_FUNC([issetugid],
1394 [have_issetugid="1"],
1395 [have_issetugid="0"]
1396 )
1397if test "x$have_issetugid" = "x1" ; then
1398 AC_DEFINE([JEMALLOC_HAVE_ISSETUGID], [ ])
1399fi
1400
Jason Evanscd9a1342012-03-21 18:33:03 -07001401dnl Check whether the BSD-specific _malloc_thread_cleanup() exists. If so, use
1402dnl it rather than pthreads TSD cleanup functions to support cleanup during
1403dnl thread exit, in order to avoid pthreads library recursion during
1404dnl bootstrapping.
Jason Evanscd9a1342012-03-21 18:33:03 -07001405AC_CHECK_FUNC([_malloc_thread_cleanup],
1406 [have__malloc_thread_cleanup="1"],
1407 [have__malloc_thread_cleanup="0"]
1408 )
1409if test "x$have__malloc_thread_cleanup" = "x1" ; then
1410 AC_DEFINE([JEMALLOC_MALLOC_THREAD_CLEANUP], [ ])
1411 force_tls="1"
1412fi
1413
Jason Evans41b6afb2012-02-02 22:04:57 -08001414dnl Check whether the BSD-specific _pthread_mutex_init_calloc_cb() exists. If
1415dnl so, mutex initialization causes allocation, and we need to implement this
1416dnl callback function in order to prevent recursive allocation.
1417AC_CHECK_FUNC([_pthread_mutex_init_calloc_cb],
1418 [have__pthread_mutex_init_calloc_cb="1"],
1419 [have__pthread_mutex_init_calloc_cb="0"]
1420 )
1421if test "x$have__pthread_mutex_init_calloc_cb" = "x1" ; then
1422 AC_DEFINE([JEMALLOC_MUTEX_INIT_CB])
1423fi
1424
Jason Evans0fee70d2012-02-13 12:36:11 -08001425dnl Disable lazy locking by default.
Jason Evansb7924f52009-06-23 19:01:18 -07001426AC_ARG_ENABLE([lazy_lock],
Jason Evans0fee70d2012-02-13 12:36:11 -08001427 [AS_HELP_STRING([--enable-lazy-lock],
1428 [Enable lazy locking (only lock when multi-threaded)])],
Jason Evansb7924f52009-06-23 19:01:18 -07001429[if test "x$enable_lazy_lock" = "xno" ; then
1430 enable_lazy_lock="0"
1431else
1432 enable_lazy_lock="1"
1433fi
1434],
Mike Hommeyac5db022015-08-11 14:01:59 +09001435[enable_lazy_lock=""]
Jason Evansb7924f52009-06-23 19:01:18 -07001436)
Jason Evans07ee4c52016-11-02 08:54:07 -07001437if test "x${enable_lazy_lock}" = "x" ; then
1438 if test "x${force_lazy_lock}" = "x1" ; then
1439 AC_MSG_RESULT([Forcing lazy-lock to avoid allocator/threading bootstrap issues])
1440 enable_lazy_lock="1"
1441 else
1442 enable_lazy_lock="0"
1443 fi
1444fi
1445if test "x${enable_lazy_lock}" = "x1" -a "x${abi}" = "xpecoff" ; then
1446 AC_MSG_RESULT([Forcing no lazy-lock because thread creation monitoring is unimplemented])
1447 enable_lazy_lock="0"
Jason Evansfd4fcef2012-03-23 17:40:58 -07001448fi
Jason Evansb7924f52009-06-23 19:01:18 -07001449if test "x$enable_lazy_lock" = "x1" ; then
Mike Hommeya19e87f2012-04-21 21:27:46 -07001450 if test "x$abi" != "xpecoff" ; then
1451 AC_CHECK_HEADERS([dlfcn.h], , [AC_MSG_ERROR([dlfcn.h is missing])])
1452 AC_CHECK_FUNC([dlsym], [],
1453 [AC_CHECK_LIB([dl], [dlsym], [LIBS="$LIBS -ldl"],
1454 [AC_MSG_ERROR([libdl is missing])])
1455 ])
1456 fi
Jason Evansb7924f52009-06-23 19:01:18 -07001457 AC_DEFINE([JEMALLOC_LAZY_LOCK], [ ])
1458fi
1459AC_SUBST([enable_lazy_lock])
1460
Jason Evans78d815c2010-01-17 14:06:20 -08001461AC_ARG_ENABLE([tls],
1462 [AS_HELP_STRING([--disable-tls], [Disable thread-local storage (__thread keyword)])],
1463if test "x$enable_tls" = "xno" ; then
1464 enable_tls="0"
1465else
1466 enable_tls="1"
1467fi
1468,
Mike Hommeyac5db022015-08-11 14:01:59 +09001469enable_tls=""
Jason Evans78d815c2010-01-17 14:06:20 -08001470)
Jason Evansc0f43b62015-09-02 12:46:35 -07001471if test "x${enable_tls}" = "x" ; then
1472 if test "x${force_tls}" = "x1" ; then
1473 AC_MSG_RESULT([Forcing TLS to avoid allocator/threading bootstrap issues])
1474 enable_tls="1"
1475 elif test "x${force_tls}" = "x0" ; then
1476 AC_MSG_RESULT([Forcing no TLS to avoid allocator/threading bootstrap issues])
1477 enable_tls="0"
1478 else
1479 enable_tls="1"
1480 fi
Jason Evansb80581d2012-03-23 16:17:43 -07001481fi
Jason Evans78d815c2010-01-17 14:06:20 -08001482if test "x${enable_tls}" = "x1" ; then
1483AC_MSG_CHECKING([for TLS])
Jason Evans6684cac2012-03-05 12:15:36 -08001484AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
Jason Evans78d815c2010-01-17 14:06:20 -08001485[[
1486 __thread int x;
1487]], [[
1488 x = 42;
1489
1490 return 0;
1491]])],
1492 AC_MSG_RESULT([yes]),
1493 AC_MSG_RESULT([no])
1494 enable_tls="0")
Mike Hommeyac5db022015-08-11 14:01:59 +09001495else
1496 enable_tls="0"
Jason Evans78d815c2010-01-17 14:06:20 -08001497fi
Jason Evansb267d0f2010-08-13 15:42:29 -07001498AC_SUBST([enable_tls])
Jason Evanse24c7af2012-03-19 10:21:17 -07001499if test "x${enable_tls}" = "x1" ; then
Jason Evansc0f43b62015-09-02 12:46:35 -07001500 if test "x${force_tls}" = "x0" ; then
1501 AC_MSG_WARN([TLS enabled despite being marked unusable on this platform])
1502 fi
Jason Evanse24c7af2012-03-19 10:21:17 -07001503 AC_DEFINE_UNQUOTED([JEMALLOC_TLS], [ ])
Jason Evanscd9a1342012-03-21 18:33:03 -07001504elif test "x${force_tls}" = "x1" ; then
Jason Evansc0f43b62015-09-02 12:46:35 -07001505 AC_MSG_WARN([TLS disabled despite being marked critical on this platform])
Jason Evans78d815c2010-01-17 14:06:20 -08001506fi
1507
Jason Evans2dbecf12010-09-05 10:35:13 -07001508dnl ============================================================================
Chih-hung Hsieh59cd80e2014-12-05 17:42:41 -08001509dnl Check for C11 atomics.
1510
1511JE_COMPILABLE([C11 atomics], [
1512#include <stdint.h>
1513#if (__STDC_VERSION__ >= 201112L) && !defined(__STDC_NO_ATOMICS__)
1514#include <stdatomic.h>
1515#else
1516#error Atomics not available
1517#endif
1518], [
1519 uint64_t *p = (uint64_t *)0;
1520 uint64_t x = 1;
1521 volatile atomic_uint_least64_t *a = (volatile atomic_uint_least64_t *)p;
1522 uint64_t r = atomic_fetch_add(a, x) + x;
1523 return (r == 0);
1524], [je_cv_c11atomics])
1525if test "x${je_cv_c11atomics}" = "xyes" ; then
1526 AC_DEFINE([JEMALLOC_C11ATOMICS])
1527fi
1528
1529dnl ============================================================================
Jason Evansb57d3ec2012-04-17 13:17:54 -07001530dnl Check for atomic(9) operations as provided on FreeBSD.
1531
1532JE_COMPILABLE([atomic(9)], [
1533#include <sys/types.h>
1534#include <machine/atomic.h>
1535#include <inttypes.h>
1536], [
1537 {
1538 uint32_t x32 = 0;
1539 volatile uint32_t *x32p = &x32;
1540 atomic_fetchadd_32(x32p, 1);
1541 }
1542 {
1543 unsigned long xlong = 0;
1544 volatile unsigned long *xlongp = &xlong;
1545 atomic_fetchadd_long(xlongp, 1);
1546 }
1547], [je_cv_atomic9])
1548if test "x${je_cv_atomic9}" = "xyes" ; then
1549 AC_DEFINE([JEMALLOC_ATOMIC9])
1550fi
1551
1552dnl ============================================================================
Jason Evans763baa62011-03-18 19:10:31 -07001553dnl Check for atomic(3) operations as provided on Darwin.
1554
1555JE_COMPILABLE([Darwin OSAtomic*()], [
1556#include <libkern/OSAtomic.h>
1557#include <inttypes.h>
1558], [
1559 {
1560 int32_t x32 = 0;
1561 volatile int32_t *x32p = &x32;
1562 OSAtomicAdd32(1, x32p);
1563 }
1564 {
1565 int64_t x64 = 0;
1566 volatile int64_t *x64p = &x64;
1567 OSAtomicAdd64(1, x64p);
1568 }
Jason Evans6684cac2012-03-05 12:15:36 -08001569], [je_cv_osatomic])
1570if test "x${je_cv_osatomic}" = "xyes" ; then
Jason Evanse24c7af2012-03-19 10:21:17 -07001571 AC_DEFINE([JEMALLOC_OSATOMIC], [ ])
Jason Evans763baa62011-03-18 19:10:31 -07001572fi
1573
1574dnl ============================================================================
Richard Diamond994fad92014-06-03 02:39:18 -05001575dnl Check for madvise(2).
1576
1577JE_COMPILABLE([madvise(2)], [
1578#include <sys/mman.h>
1579], [
1580 {
1581 madvise((void *)0, 0, 0);
1582 }
1583], [je_cv_madvise])
1584if test "x${je_cv_madvise}" = "xyes" ; then
1585 AC_DEFINE([JEMALLOC_HAVE_MADVISE], [ ])
1586fi
1587
1588dnl ============================================================================
Mike Hommeyc1e567b2012-03-26 17:03:41 +02001589dnl Check whether __sync_{add,sub}_and_fetch() are available despite
1590dnl __GCC_HAVE_SYNC_COMPARE_AND_SWAP_n macros being undefined.
1591
1592AC_DEFUN([JE_SYNC_COMPARE_AND_SWAP_CHECK],[
1593 AC_CACHE_CHECK([whether to force $1-bit __sync_{add,sub}_and_fetch()],
1594 [je_cv_sync_compare_and_swap_$2],
Mike Hommey2cfe6d62012-03-27 15:03:07 +02001595 [AC_LINK_IFELSE([AC_LANG_PROGRAM([
1596 #include <stdint.h>
1597 ],
1598 [
1599 #ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_$2
1600 {
1601 uint$1_t x$1 = 0;
1602 __sync_add_and_fetch(&x$1, 42);
1603 __sync_sub_and_fetch(&x$1, 1);
1604 }
1605 #else
1606 #error __GCC_HAVE_SYNC_COMPARE_AND_SWAP_$2 is defined, no need to force
1607 #endif
1608 ])],
Mike Hommeyc1e567b2012-03-26 17:03:41 +02001609 [je_cv_sync_compare_and_swap_$2=yes],
1610 [je_cv_sync_compare_and_swap_$2=no])])
1611
1612 if test "x${je_cv_sync_compare_and_swap_$2}" = "xyes" ; then
1613 AC_DEFINE([JE_FORCE_SYNC_COMPARE_AND_SWAP_$2], [ ])
1614 fi
1615])
1616
Jason Evansb57d3ec2012-04-17 13:17:54 -07001617if test "x${je_cv_atomic9}" != "xyes" -a "x${je_cv_osatomic}" != "xyes" ; then
Mike Hommeyc1e567b2012-03-26 17:03:41 +02001618 JE_SYNC_COMPARE_AND_SWAP_CHECK(32, 4)
1619 JE_SYNC_COMPARE_AND_SWAP_CHECK(64, 8)
1620fi
1621
1622dnl ============================================================================
Jason Evansd04047c2014-05-28 16:11:55 -07001623dnl Check for __builtin_clz() and __builtin_clzl().
1624
1625AC_CACHE_CHECK([for __builtin_clz],
1626 [je_cv_builtin_clz],
1627 [AC_LINK_IFELSE([AC_LANG_PROGRAM([],
1628 [
1629 {
1630 unsigned x = 0;
1631 int y = __builtin_clz(x);
1632 }
1633 {
1634 unsigned long x = 0;
1635 int y = __builtin_clzl(x);
1636 }
1637 ])],
1638 [je_cv_builtin_clz=yes],
1639 [je_cv_builtin_clz=no])])
1640
1641if test "x${je_cv_builtin_clz}" = "xyes" ; then
1642 AC_DEFINE([JEMALLOC_HAVE_BUILTIN_CLZ], [ ])
1643fi
1644
1645dnl ============================================================================
Jason Evans893a0ed2011-03-18 19:30:18 -07001646dnl Check for spinlock(3) operations as provided on Darwin.
1647
1648JE_COMPILABLE([Darwin OSSpin*()], [
1649#include <libkern/OSAtomic.h>
1650#include <inttypes.h>
1651], [
1652 OSSpinLock lock = 0;
1653 OSSpinLockLock(&lock);
1654 OSSpinLockUnlock(&lock);
Jason Evans6684cac2012-03-05 12:15:36 -08001655], [je_cv_osspin])
1656if test "x${je_cv_osspin}" = "xyes" ; then
Jason Evanse24c7af2012-03-19 10:21:17 -07001657 AC_DEFINE([JEMALLOC_OSSPIN], [ ])
Jason Evans893a0ed2011-03-18 19:30:18 -07001658fi
1659
1660dnl ============================================================================
Jason Evans2dbecf12010-09-05 10:35:13 -07001661dnl Darwin-related configuration.
Jason Evans78d815c2010-01-17 14:06:20 -08001662
Mike Hommeyd0357f72012-11-26 18:52:41 +01001663AC_ARG_ENABLE([zone-allocator],
1664 [AS_HELP_STRING([--disable-zone-allocator],
1665 [Disable zone allocator for Darwin])],
1666[if test "x$enable_zone_allocator" = "xno" ; then
1667 enable_zone_allocator="0"
1668else
1669 enable_zone_allocator="1"
1670fi
1671],
1672[if test "x${abi}" = "xmacho"; then
1673 enable_zone_allocator="1"
1674fi
1675]
1676)
1677AC_SUBST([enable_zone_allocator])
1678
1679if test "x${enable_zone_allocator}" = "x1" ; then
1680 if test "x${abi}" != "xmacho"; then
1681 AC_MSG_ERROR([--enable-zone-allocator is only supported on Darwin])
1682 fi
Jason Evanse24c7af2012-03-19 10:21:17 -07001683 AC_DEFINE([JEMALLOC_ZONE], [ ])
Jason Evans6109fe02010-02-10 10:37:56 -08001684
Jason Evans2dbecf12010-09-05 10:35:13 -07001685 dnl The szone version jumped from 3 to 6 between the OS X 10.5.x and 10.6
1686 dnl releases. malloc_zone_t and malloc_introspection_t have new fields in
1687 dnl 10.6, which is the only source-level indication of the change.
1688 AC_MSG_CHECKING([malloc zone version])
Mike Hommey154829d2012-03-20 18:01:38 +01001689 AC_DEFUN([JE_ZONE_PROGRAM],
1690 [AC_LANG_PROGRAM(
1691 [#include <malloc/malloc.h>],
Guilherme Goncalves79725aa2014-10-20 14:08:37 -02001692 [static int foo[[sizeof($1) $2 sizeof(void *) * $3 ? 1 : -1]]]
Mike Hommey154829d2012-03-20 18:01:38 +01001693 )])
Jason Evans2dbecf12010-09-05 10:35:13 -07001694
Mike Hommey154829d2012-03-20 18:01:38 +01001695 AC_COMPILE_IFELSE([JE_ZONE_PROGRAM(malloc_zone_t,==,14)],[JEMALLOC_ZONE_VERSION=3],[
1696 AC_COMPILE_IFELSE([JE_ZONE_PROGRAM(malloc_zone_t,==,15)],[JEMALLOC_ZONE_VERSION=5],[
1697 AC_COMPILE_IFELSE([JE_ZONE_PROGRAM(malloc_zone_t,==,16)],[
1698 AC_COMPILE_IFELSE([JE_ZONE_PROGRAM(malloc_introspection_t,==,9)],[JEMALLOC_ZONE_VERSION=6],[
1699 AC_COMPILE_IFELSE([JE_ZONE_PROGRAM(malloc_introspection_t,==,13)],[JEMALLOC_ZONE_VERSION=7],[JEMALLOC_ZONE_VERSION=]
1700 )])],[
1701 AC_COMPILE_IFELSE([JE_ZONE_PROGRAM(malloc_zone_t,==,17)],[JEMALLOC_ZONE_VERSION=8],[
1702 AC_COMPILE_IFELSE([JE_ZONE_PROGRAM(malloc_zone_t,>,17)],[JEMALLOC_ZONE_VERSION=9],[JEMALLOC_ZONE_VERSION=]
1703 )])])])])
1704 if test "x${JEMALLOC_ZONE_VERSION}" = "x"; then
1705 AC_MSG_RESULT([unsupported])
1706 AC_MSG_ERROR([Unsupported malloc zone version])
1707 fi
1708 if test "${JEMALLOC_ZONE_VERSION}" = 9; then
1709 JEMALLOC_ZONE_VERSION=8
1710 AC_MSG_RESULT([> 8])
1711 else
1712 AC_MSG_RESULT([$JEMALLOC_ZONE_VERSION])
1713 fi
1714 AC_DEFINE_UNQUOTED(JEMALLOC_ZONE_VERSION, [$JEMALLOC_ZONE_VERSION])
Jason Evansb27805b2010-02-10 18:15:53 -08001715fi
1716
Jason Evansb7924f52009-06-23 19:01:18 -07001717dnl ============================================================================
Sara Golemon3e24afa2014-08-18 13:06:39 -07001718dnl Check for glibc malloc hooks
1719
1720JE_COMPILABLE([glibc malloc hook], [
1721#include <stddef.h>
1722
1723extern void (* __free_hook)(void *ptr);
1724extern void *(* __malloc_hook)(size_t size);
1725extern void *(* __realloc_hook)(void *ptr, size_t size);
1726], [
1727 void *ptr = 0L;
1728 if (__malloc_hook) ptr = __malloc_hook(1);
1729 if (__realloc_hook) ptr = __realloc_hook(ptr, 2);
1730 if (__free_hook && ptr) __free_hook(ptr);
1731], [je_cv_glibc_malloc_hook])
1732if test "x${je_cv_glibc_malloc_hook}" = "xyes" ; then
1733 AC_DEFINE([JEMALLOC_GLIBC_MALLOC_HOOK], [ ])
1734fi
1735
1736JE_COMPILABLE([glibc memalign hook], [
1737#include <stddef.h>
1738
1739extern void *(* __memalign_hook)(size_t alignment, size_t size);
1740], [
1741 void *ptr = 0L;
1742 if (__memalign_hook) ptr = __memalign_hook(16, 7);
1743], [je_cv_glibc_memalign_hook])
1744if test "x${je_cv_glibc_memalign_hook}" = "xyes" ; then
1745 AC_DEFINE([JEMALLOC_GLIBC_MEMALIGN_HOOK], [ ])
1746fi
1747
Eric Wong4dcf04b2014-08-31 03:57:06 +00001748JE_COMPILABLE([pthreads adaptive mutexes], [
1749#include <pthread.h>
1750], [
1751 pthread_mutexattr_t attr;
1752 pthread_mutexattr_init(&attr);
1753 pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ADAPTIVE_NP);
1754 pthread_mutexattr_destroy(&attr);
1755], [je_cv_pthread_mutex_adaptive_np])
1756if test "x${je_cv_pthread_mutex_adaptive_np}" = "xyes" ; then
1757 AC_DEFINE([JEMALLOC_HAVE_PTHREAD_MUTEX_ADAPTIVE_NP], [ ])
1758fi
1759
Sara Golemon3e24afa2014-08-18 13:06:39 -07001760dnl ============================================================================
Jason Evansb7924f52009-06-23 19:01:18 -07001761dnl Check for typedefs, structures, and compiler characteristics.
1762AC_HEADER_STDBOOL
1763
Jason Evans748dfac2013-12-06 18:27:33 -08001764dnl ============================================================================
1765dnl Define commands that generate output files.
1766
Jason Evans86abd0d2013-11-30 15:25:42 -08001767AC_CONFIG_COMMANDS([include/jemalloc/internal/private_namespace.h], [
1768 mkdir -p "${objroot}include/jemalloc/internal"
1769 "${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 -08001770], [
1771 srcdir="${srcdir}"
1772 objroot="${objroot}"
Jason Evans86abd0d2013-11-30 15:25:42 -08001773])
1774AC_CONFIG_COMMANDS([include/jemalloc/internal/private_unnamespace.h], [
1775 mkdir -p "${objroot}include/jemalloc/internal"
1776 "${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 -08001777], [
1778 srcdir="${srcdir}"
1779 objroot="${objroot}"
1780])
1781AC_CONFIG_COMMANDS([include/jemalloc/internal/public_symbols.txt], [
1782 f="${objroot}include/jemalloc/internal/public_symbols.txt"
1783 mkdir -p "${objroot}include/jemalloc/internal"
1784 cp /dev/null "${f}"
1785 for nm in `echo ${mangling_map} |tr ',' ' '` ; do
1786 n=`echo ${nm} |tr ':' ' ' |awk '{print $[]1}'`
1787 m=`echo ${nm} |tr ':' ' ' |awk '{print $[]2}'`
1788 echo "${n}:${m}" >> "${f}"
1789 dnl Remove name from public_syms so that it isn't redefined later.
1790 public_syms=`for sym in ${public_syms}; do echo "${sym}"; done |grep -v "^${n}\$" |tr '\n' ' '`
1791 done
1792 for sym in ${public_syms} ; do
1793 n="${sym}"
1794 m="${JEMALLOC_PREFIX}${sym}"
1795 echo "${n}:${m}" >> "${f}"
1796 done
1797], [
1798 srcdir="${srcdir}"
1799 objroot="${objroot}"
1800 mangling_map="${mangling_map}"
1801 public_syms="${public_syms}"
1802 JEMALLOC_PREFIX="${JEMALLOC_PREFIX}"
Jason Evans86abd0d2013-11-30 15:25:42 -08001803])
1804AC_CONFIG_COMMANDS([include/jemalloc/internal/public_namespace.h], [
1805 mkdir -p "${objroot}include/jemalloc/internal"
Jason Evansf234dc52014-01-16 17:38:01 -08001806 "${srcdir}/include/jemalloc/internal/public_namespace.sh" "${objroot}include/jemalloc/internal/public_symbols.txt" > "${objroot}include/jemalloc/internal/public_namespace.h"
1807], [
1808 srcdir="${srcdir}"
1809 objroot="${objroot}"
Jason Evans86abd0d2013-11-30 15:25:42 -08001810])
1811AC_CONFIG_COMMANDS([include/jemalloc/internal/public_unnamespace.h], [
1812 mkdir -p "${objroot}include/jemalloc/internal"
Jason Evansf234dc52014-01-16 17:38:01 -08001813 "${srcdir}/include/jemalloc/internal/public_unnamespace.sh" "${objroot}include/jemalloc/internal/public_symbols.txt" > "${objroot}include/jemalloc/internal/public_unnamespace.h"
1814], [
1815 srcdir="${srcdir}"
1816 objroot="${objroot}"
Jason Evans86abd0d2013-11-30 15:25:42 -08001817])
Jason Evansb1726102012-02-28 16:50:47 -08001818AC_CONFIG_COMMANDS([include/jemalloc/internal/size_classes.h], [
Jason Evans86abd0d2013-11-30 15:25:42 -08001819 mkdir -p "${objroot}include/jemalloc/internal"
Jason Evans6d919292015-09-15 10:42:36 -07001820 "${SHELL}" "${srcdir}/include/jemalloc/internal/size_classes.sh" "${LG_QUANTA}" ${LG_TINY_MIN} "${LG_PAGE_SIZES}" ${LG_SIZE_CLASS_GROUP} > "${objroot}include/jemalloc/internal/size_classes.h"
Jason Evansf234dc52014-01-16 17:38:01 -08001821], [
Jason Evans6d919292015-09-15 10:42:36 -07001822 SHELL="${SHELL}"
Jason Evansf234dc52014-01-16 17:38:01 -08001823 srcdir="${srcdir}"
1824 objroot="${objroot}"
Jason Evans81e54752014-10-10 22:34:25 -07001825 LG_QUANTA="${LG_QUANTA}"
1826 LG_TINY_MIN=${LG_TINY_MIN}
1827 LG_PAGE_SIZES="${LG_PAGE_SIZES}"
Jason Evansfc0b3b72014-10-09 17:54:06 -07001828 LG_SIZE_CLASS_GROUP=${LG_SIZE_CLASS_GROUP}
Jason Evansb1726102012-02-28 16:50:47 -08001829])
Jason Evans86abd0d2013-11-30 15:25:42 -08001830AC_CONFIG_COMMANDS([include/jemalloc/jemalloc_protos_jet.h], [
1831 mkdir -p "${objroot}include/jemalloc"
1832 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 -08001833], [
1834 srcdir="${srcdir}"
1835 objroot="${objroot}"
1836])
1837AC_CONFIG_COMMANDS([include/jemalloc/jemalloc_rename.h], [
1838 mkdir -p "${objroot}include/jemalloc"
1839 "${srcdir}/include/jemalloc/jemalloc_rename.sh" "${objroot}include/jemalloc/internal/public_symbols.txt" > "${objroot}include/jemalloc/jemalloc_rename.h"
1840], [
1841 srcdir="${srcdir}"
1842 objroot="${objroot}"
1843])
1844AC_CONFIG_COMMANDS([include/jemalloc/jemalloc_mangle.h], [
1845 mkdir -p "${objroot}include/jemalloc"
1846 "${srcdir}/include/jemalloc/jemalloc_mangle.sh" "${objroot}include/jemalloc/internal/public_symbols.txt" je_ > "${objroot}include/jemalloc/jemalloc_mangle.h"
1847], [
1848 srcdir="${srcdir}"
1849 objroot="${objroot}"
1850])
1851AC_CONFIG_COMMANDS([include/jemalloc/jemalloc_mangle_jet.h], [
1852 mkdir -p "${objroot}include/jemalloc"
1853 "${srcdir}/include/jemalloc/jemalloc_mangle.sh" "${objroot}include/jemalloc/internal/public_symbols.txt" jet_ > "${objroot}include/jemalloc/jemalloc_mangle_jet.h"
1854], [
1855 srcdir="${srcdir}"
1856 objroot="${objroot}"
Jason Evans86abd0d2013-11-30 15:25:42 -08001857])
1858AC_CONFIG_COMMANDS([include/jemalloc/jemalloc.h], [
1859 mkdir -p "${objroot}include/jemalloc"
1860 "${srcdir}/include/jemalloc/jemalloc.sh" "${objroot}" > "${objroot}include/jemalloc/jemalloc${install_suffix}.h"
Jason Evansf234dc52014-01-16 17:38:01 -08001861], [
1862 srcdir="${srcdir}"
1863 objroot="${objroot}"
1864 install_suffix="${install_suffix}"
Jason Evans86abd0d2013-11-30 15:25:42 -08001865])
Jason Evansb1726102012-02-28 16:50:47 -08001866
Jason Evansb7924f52009-06-23 19:01:18 -07001867dnl Process .in files.
Jason Evansb0fd5012010-01-17 01:49:20 -08001868AC_SUBST([cfghdrs_in])
1869AC_SUBST([cfghdrs_out])
Jason Evans0656ec02010-04-07 23:37:35 -07001870AC_CONFIG_HEADERS([$cfghdrs_tup])
Jason Evansb7924f52009-06-23 19:01:18 -07001871
1872dnl ============================================================================
1873dnl Generate outputs.
Jason Evans748dfac2013-12-06 18:27:33 -08001874
Jason Evans70417202015-05-01 12:31:12 -07001875AC_CONFIG_FILES([$cfgoutputs_tup config.stamp bin/jemalloc-config bin/jemalloc.sh bin/jeprof])
Jason Evansb0fd5012010-01-17 01:49:20 -08001876AC_SUBST([cfgoutputs_in])
1877AC_SUBST([cfgoutputs_out])
Jason Evansb7924f52009-06-23 19:01:18 -07001878AC_OUTPUT
1879
1880dnl ============================================================================
1881dnl Print out the results of configuration.
1882AC_MSG_RESULT([===============================================================================])
Jason Evansf576c632011-11-01 22:27:41 -07001883AC_MSG_RESULT([jemalloc version : ${jemalloc_version}])
1884AC_MSG_RESULT([library revision : ${rev}])
Jason Evansb7924f52009-06-23 19:01:18 -07001885AC_MSG_RESULT([])
Jason Evansbec6a8d2015-01-22 17:55:58 -08001886AC_MSG_RESULT([CONFIG : ${CONFIG}])
Jason Evansb7924f52009-06-23 19:01:18 -07001887AC_MSG_RESULT([CC : ${CC}])
Jason Evansb7924f52009-06-23 19:01:18 -07001888AC_MSG_RESULT([CFLAGS : ${CFLAGS}])
Jason Evans35a108c2016-10-29 22:14:55 -07001889AC_MSG_RESULT([EXTRA_CFLAGS : ${EXTRA_CFLAGS}])
Jason Evansbec6a8d2015-01-22 17:55:58 -08001890AC_MSG_RESULT([CPPFLAGS : ${CPPFLAGS}])
Jason Evansb7924f52009-06-23 19:01:18 -07001891AC_MSG_RESULT([LDFLAGS : ${LDFLAGS}])
Jason Evans748dfac2013-12-06 18:27:33 -08001892AC_MSG_RESULT([EXTRA_LDFLAGS : ${EXTRA_LDFLAGS}])
Jason Evansb7924f52009-06-23 19:01:18 -07001893AC_MSG_RESULT([LIBS : ${LIBS}])
1894AC_MSG_RESULT([RPATH_EXTRA : ${RPATH_EXTRA}])
1895AC_MSG_RESULT([])
Jason Evansaee7fd22010-11-24 22:00:02 -08001896AC_MSG_RESULT([XSLTPROC : ${XSLTPROC}])
1897AC_MSG_RESULT([XSLROOT : ${XSLROOT}])
1898AC_MSG_RESULT([])
Jason Evansb7924f52009-06-23 19:01:18 -07001899AC_MSG_RESULT([PREFIX : ${PREFIX}])
1900AC_MSG_RESULT([BINDIR : ${BINDIR}])
Jason Evansbec6a8d2015-01-22 17:55:58 -08001901AC_MSG_RESULT([DATADIR : ${DATADIR}])
Jason Evans662a0172009-07-01 19:24:31 -07001902AC_MSG_RESULT([INCLUDEDIR : ${INCLUDEDIR}])
1903AC_MSG_RESULT([LIBDIR : ${LIBDIR}])
Jason Evansb7924f52009-06-23 19:01:18 -07001904AC_MSG_RESULT([MANDIR : ${MANDIR}])
1905AC_MSG_RESULT([])
1906AC_MSG_RESULT([srcroot : ${srcroot}])
1907AC_MSG_RESULT([abs_srcroot : ${abs_srcroot}])
1908AC_MSG_RESULT([objroot : ${objroot}])
1909AC_MSG_RESULT([abs_objroot : ${abs_objroot}])
1910AC_MSG_RESULT([])
Jason Evans90895cf2009-12-29 00:09:15 -08001911AC_MSG_RESULT([JEMALLOC_PREFIX : ${JEMALLOC_PREFIX}])
Jason Evans746e77a2011-07-30 16:40:52 -07001912AC_MSG_RESULT([JEMALLOC_PRIVATE_NAMESPACE])
1913AC_MSG_RESULT([ : ${JEMALLOC_PRIVATE_NAMESPACE}])
Jason Evansb0fd5012010-01-17 01:49:20 -08001914AC_MSG_RESULT([install_suffix : ${install_suffix}])
Jason Evansf8290092016-02-07 14:23:22 -08001915AC_MSG_RESULT([malloc_conf : ${config_malloc_conf}])
Jason Evansb7924f52009-06-23 19:01:18 -07001916AC_MSG_RESULT([autogen : ${enable_autogen}])
Jason Evans355b4382010-09-20 19:20:48 -07001917AC_MSG_RESULT([cc-silence : ${enable_cc_silence}])
Jason Evansb7924f52009-06-23 19:01:18 -07001918AC_MSG_RESULT([debug : ${enable_debug}])
Jason Evans748dfac2013-12-06 18:27:33 -08001919AC_MSG_RESULT([code-coverage : ${enable_code_coverage}])
Jason Evansb7924f52009-06-23 19:01:18 -07001920AC_MSG_RESULT([stats : ${enable_stats}])
Jason Evans6109fe02010-02-10 10:37:56 -08001921AC_MSG_RESULT([prof : ${enable_prof}])
1922AC_MSG_RESULT([prof-libunwind : ${enable_prof_libunwind}])
Jason Evans77f350b2011-03-15 22:23:12 -07001923AC_MSG_RESULT([prof-libgcc : ${enable_prof_libgcc}])
1924AC_MSG_RESULT([prof-gcc : ${enable_prof_gcc}])
Jason Evans84cbbcb2009-12-29 00:09:15 -08001925AC_MSG_RESULT([tcache : ${enable_tcache}])
Jason Evansb7924f52009-06-23 19:01:18 -07001926AC_MSG_RESULT([fill : ${enable_fill}])
Jason Evansb1476112012-04-05 13:36:17 -07001927AC_MSG_RESULT([utrace : ${enable_utrace}])
Jason Evans122449b2012-04-06 00:35:09 -07001928AC_MSG_RESULT([valgrind : ${enable_valgrind}])
1929AC_MSG_RESULT([xmalloc : ${enable_xmalloc}])
Jason Evans59ae2762012-04-16 17:52:27 -07001930AC_MSG_RESULT([munmap : ${enable_munmap}])
Jason Evansb7924f52009-06-23 19:01:18 -07001931AC_MSG_RESULT([lazy_lock : ${enable_lazy_lock}])
Jason Evans2dbecf12010-09-05 10:35:13 -07001932AC_MSG_RESULT([tls : ${enable_tls}])
Jason Evans8a03cf02015-05-04 09:58:36 -07001933AC_MSG_RESULT([cache-oblivious : ${enable_cache_oblivious}])
Jason Evansb7924f52009-06-23 19:01:18 -07001934AC_MSG_RESULT([===============================================================================])