blob: b58540e19250957c315ee617b9fc79763b1ab6f6 [file] [log] [blame]
Jason Evansb7924f52009-06-23 19:01:18 -07001dnl Process this file with autoconf to produce a configure script.
Jason Evans2b31cf52017-06-29 13:56:22 -07002AC_PREREQ(2.68)
Jason Evansb7924f52009-06-23 19:01:18 -07003AC_INIT([Makefile.in])
4
Jason Evans3a923192015-11-12 11:23:39 -08005AC_CONFIG_AUX_DIR([build-aux])
6
Jason Evansf3340ca2009-06-30 16:17:05 -07007dnl ============================================================================
8dnl Custom macro definitions.
9
Jason Evans194d6f92016-12-16 07:18:55 -080010dnl JE_CONCAT_VVV(r, a, b)
Tamir Duberstein96f14682017-07-06 14:50:55 -040011dnl
Jason Evans194d6f92016-12-16 07:18:55 -080012dnl Set $r to the concatenation of $a and $b, with a space separating them iff
13dnl both $a and $b are non-emty.
14AC_DEFUN([JE_CONCAT_VVV],
15if test "x[$]{$2}" = "x" -o "x[$]{$3}" = "x" ; then
16 $1="[$]{$2}[$]{$3}"
17else
18 $1="[$]{$2} [$]{$3}"
19fi
20)
21
22dnl JE_APPEND_VS(a, b)
Tamir Duberstein96f14682017-07-06 14:50:55 -040023dnl
Jason Evans194d6f92016-12-16 07:18:55 -080024dnl Set $a to the concatenation of $a and b, with a space separating them iff
25dnl both $a and b are non-empty.
26AC_DEFUN([JE_APPEND_VS],
27 T_APPEND_V=$2
28 JE_CONCAT_VVV($1, $1, T_APPEND_V)
29)
30
31CONFIGURE_CFLAGS=
32SPECIFIED_CFLAGS="${CFLAGS}"
33dnl JE_CFLAGS_ADD(cflag)
Tamir Duberstein96f14682017-07-06 14:50:55 -040034dnl
Jason Evans194d6f92016-12-16 07:18:55 -080035dnl CFLAGS is the concatenation of CONFIGURE_CFLAGS and SPECIFIED_CFLAGS
36dnl (ignoring EXTRA_CFLAGS, which does not impact configure tests. This macro
37dnl appends to CONFIGURE_CFLAGS and regenerates CFLAGS.
38AC_DEFUN([JE_CFLAGS_ADD],
Jason Evansf3340ca2009-06-30 16:17:05 -070039[
40AC_MSG_CHECKING([whether compiler supports $1])
Jason Evans194d6f92016-12-16 07:18:55 -080041T_CONFIGURE_CFLAGS="${CONFIGURE_CFLAGS}"
42JE_APPEND_VS(CONFIGURE_CFLAGS, $1)
43JE_CONCAT_VVV(CFLAGS, CONFIGURE_CFLAGS, SPECIFIED_CFLAGS)
Jason Evans6684cac2012-03-05 12:15:36 -080044AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
Jason Evansf3340ca2009-06-30 16:17:05 -070045[[
46]], [[
47 return 0;
48]])],
Jason Evans194d6f92016-12-16 07:18:55 -080049 [je_cv_cflags_added=$1]
Jason Evansf3340ca2009-06-30 16:17:05 -070050 AC_MSG_RESULT([yes]),
Jason Evans194d6f92016-12-16 07:18:55 -080051 [je_cv_cflags_added=]
Jason Evansf3340ca2009-06-30 16:17:05 -070052 AC_MSG_RESULT([no])
Jason Evans194d6f92016-12-16 07:18:55 -080053 [CONFIGURE_CFLAGS="${T_CONFIGURE_CFLAGS}"]
Jason Evansf3340ca2009-06-30 16:17:05 -070054)
Jason Evans194d6f92016-12-16 07:18:55 -080055JE_CONCAT_VVV(CFLAGS, CONFIGURE_CFLAGS, SPECIFIED_CFLAGS)
Jason Evansf3340ca2009-06-30 16:17:05 -070056])
57
Jason Evans194d6f92016-12-16 07:18:55 -080058dnl JE_CFLAGS_SAVE()
59dnl JE_CFLAGS_RESTORE()
Tamir Duberstein96f14682017-07-06 14:50:55 -040060dnl
Jason Evans194d6f92016-12-16 07:18:55 -080061dnl Save/restore CFLAGS. Nesting is not supported.
62AC_DEFUN([JE_CFLAGS_SAVE],
63SAVED_CONFIGURE_CFLAGS="${CONFIGURE_CFLAGS}"
64)
65AC_DEFUN([JE_CFLAGS_RESTORE],
66CONFIGURE_CFLAGS="${SAVED_CONFIGURE_CFLAGS}"
67JE_CONCAT_VVV(CFLAGS, CONFIGURE_CFLAGS, SPECIFIED_CFLAGS)
68)
69
70CONFIGURE_CXXFLAGS=
71SPECIFIED_CXXFLAGS="${CXXFLAGS}"
72dnl JE_CXXFLAGS_ADD(cxxflag)
73AC_DEFUN([JE_CXXFLAGS_ADD],
Dave Watson23191522016-10-23 15:56:30 -070074[
75AC_MSG_CHECKING([whether compiler supports $1])
Jason Evans194d6f92016-12-16 07:18:55 -080076T_CONFIGURE_CXXFLAGS="${CONFIGURE_CXXFLAGS}"
77JE_APPEND_VS(CONFIGURE_CXXFLAGS, $1)
78JE_CONCAT_VVV(CXXFLAGS, CONFIGURE_CXXFLAGS, SPECIFIED_CXXFLAGS)
Nehal J Wani78a87e42017-12-31 06:52:33 -060079AC_LANG_PUSH([C++])
Dave Watson23191522016-10-23 15:56:30 -070080AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
81[[
82]], [[
83 return 0;
84]])],
Jason Evans194d6f92016-12-16 07:18:55 -080085 [je_cv_cxxflags_added=$1]
Dave Watson23191522016-10-23 15:56:30 -070086 AC_MSG_RESULT([yes]),
Jason Evans194d6f92016-12-16 07:18:55 -080087 [je_cv_cxxflags_added=]
Dave Watson23191522016-10-23 15:56:30 -070088 AC_MSG_RESULT([no])
Jason Evans194d6f92016-12-16 07:18:55 -080089 [CONFIGURE_CXXFLAGS="${T_CONFIGURE_CXXFLAGS}"]
Dave Watson23191522016-10-23 15:56:30 -070090)
Nehal J Wani78a87e42017-12-31 06:52:33 -060091AC_LANG_POP([C++])
Jason Evans194d6f92016-12-16 07:18:55 -080092JE_CONCAT_VVV(CXXFLAGS, CONFIGURE_CXXFLAGS, SPECIFIED_CXXFLAGS)
Dave Watson23191522016-10-23 15:56:30 -070093])
94
Jason Evansf3340ca2009-06-30 16:17:05 -070095dnl JE_COMPILABLE(label, hcode, mcode, rvar)
Tamir Duberstein96f14682017-07-06 14:50:55 -040096dnl
Jason Evansf3e139a2012-03-19 09:54:20 -070097dnl Use AC_LINK_IFELSE() rather than AC_COMPILE_IFELSE() so that linker errors
Jason Evans4c2faa82012-03-13 11:09:23 -070098dnl cause failure.
Jason Evansf3340ca2009-06-30 16:17:05 -070099AC_DEFUN([JE_COMPILABLE],
100[
Jason Evans6684cac2012-03-05 12:15:36 -0800101AC_CACHE_CHECK([whether $1 is compilable],
102 [$4],
Jason Evansf3e139a2012-03-19 09:54:20 -0700103 [AC_LINK_IFELSE([AC_LANG_PROGRAM([$2],
104 [$3])],
105 [$4=yes],
106 [$4=no])])
Jason Evansf3340ca2009-06-30 16:17:05 -0700107])
108
109dnl ============================================================================
110
Jason Evans41f2e692015-01-25 20:15:13 -0800111CONFIG=`echo ${ac_configure_args} | sed -e 's#'"'"'\([^ ]*\)'"'"'#\1#g'`
Jason Evansbec6a8d2015-01-22 17:55:58 -0800112AC_SUBST([CONFIG])
113
Jason Evansf576c632011-11-01 22:27:41 -0700114dnl Library revision.
Jason Evans9790b962014-04-14 22:32:31 -0700115rev=2
Jason Evansf576c632011-11-01 22:27:41 -0700116AC_SUBST([rev])
117
Jason Evansb7924f52009-06-23 19:01:18 -0700118srcroot=$srcdir
119if test "x${srcroot}" = "x." ; then
120 srcroot=""
121else
122 srcroot="${srcroot}/"
123fi
124AC_SUBST([srcroot])
125abs_srcroot="`cd \"${srcdir}\"; pwd`/"
126AC_SUBST([abs_srcroot])
127
128objroot=""
129AC_SUBST([objroot])
130abs_objroot="`pwd`/"
131AC_SUBST([abs_objroot])
132
133dnl Munge install path variables.
134if test "x$prefix" = "xNONE" ; then
135 prefix="/usr/local"
136fi
137if test "x$exec_prefix" = "xNONE" ; then
138 exec_prefix=$prefix
139fi
140PREFIX=$prefix
141AC_SUBST([PREFIX])
142BINDIR=`eval echo $bindir`
143BINDIR=`eval echo $BINDIR`
144AC_SUBST([BINDIR])
145INCLUDEDIR=`eval echo $includedir`
146INCLUDEDIR=`eval echo $INCLUDEDIR`
147AC_SUBST([INCLUDEDIR])
148LIBDIR=`eval echo $libdir`
149LIBDIR=`eval echo $LIBDIR`
150AC_SUBST([LIBDIR])
151DATADIR=`eval echo $datadir`
152DATADIR=`eval echo $DATADIR`
153AC_SUBST([DATADIR])
154MANDIR=`eval echo $mandir`
155MANDIR=`eval echo $MANDIR`
156AC_SUBST([MANDIR])
157
Jason Evansaee7fd22010-11-24 22:00:02 -0800158dnl Support for building documentation.
Jason Evans7329a4f2013-01-22 10:53:29 -0800159AC_PATH_PROG([XSLTPROC], [xsltproc], [false], [$PATH])
Jason Evans7091b412012-03-19 09:36:44 -0700160if test -d "/usr/share/xml/docbook/stylesheet/docbook-xsl" ; then
161 DEFAULT_XSLROOT="/usr/share/xml/docbook/stylesheet/docbook-xsl"
162elif test -d "/usr/share/sgml/docbook/xsl-stylesheets" ; then
163 DEFAULT_XSLROOT="/usr/share/sgml/docbook/xsl-stylesheets"
164else
165 dnl Documentation building will fail if this default gets used.
166 DEFAULT_XSLROOT=""
167fi
Jason Evansaee7fd22010-11-24 22:00:02 -0800168AC_ARG_WITH([xslroot],
Jason Evans7091b412012-03-19 09:36:44 -0700169 [AS_HELP_STRING([--with-xslroot=<path>], [XSL stylesheet root path])], [
Jason Evansaee7fd22010-11-24 22:00:02 -0800170if test "x$with_xslroot" = "xno" ; then
Jason Evans7091b412012-03-19 09:36:44 -0700171 XSLROOT="${DEFAULT_XSLROOT}"
Jason Evansaee7fd22010-11-24 22:00:02 -0800172else
173 XSLROOT="${with_xslroot}"
Jason Evans7091b412012-03-19 09:36:44 -0700174fi
175],
176 XSLROOT="${DEFAULT_XSLROOT}"
Jason Evansaee7fd22010-11-24 22:00:02 -0800177)
178AC_SUBST([XSLROOT])
179
Jason Evansf3340ca2009-06-30 16:17:05 -0700180dnl If CFLAGS isn't defined, set CFLAGS to something reasonable. Otherwise,
181dnl just prevent autoconf from molesting CFLAGS.
Jason Evansb7924f52009-06-23 19:01:18 -0700182CFLAGS=$CFLAGS
183AC_PROG_CC
Elliot Ronaghanaec07532016-06-14 15:26:07 -0700184
Mike Hommeyfd97b1d2012-04-30 12:38:31 +0200185if test "x$GCC" != "xyes" ; then
186 AC_CACHE_CHECK([whether compiler is MSVC],
187 [je_cv_msvc],
188 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],
189 [
190#ifndef _MSC_VER
191 int fail[-1];
192#endif
193])],
194 [je_cv_msvc=yes],
195 [je_cv_msvc=no])])
196fi
197
Elliot Ronaghanccd64162016-06-14 13:18:08 -0700198dnl check if a cray prgenv wrapper compiler is being used
199je_cv_cray_prgenv_wrapper=""
200if test "x${PE_ENV}" != "x" ; then
201 case "${CC}" in
202 CC|cc)
203 je_cv_cray_prgenv_wrapper="yes"
204 ;;
205 *)
206 ;;
207 esac
208fi
209
Elliot Ronaghanaec07532016-06-14 15:26:07 -0700210AC_CACHE_CHECK([whether compiler is cray],
211 [je_cv_cray],
212 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],
213 [
214#ifndef _CRAYC
215 int fail[-1];
216#endif
217])],
218 [je_cv_cray=yes],
219 [je_cv_cray=no])])
220
221if test "x${je_cv_cray}" = "xyes" ; then
222 AC_CACHE_CHECK([whether cray compiler version is 8.4],
223 [je_cv_cray_84],
224 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],
225 [
226#if !(_RELEASE_MAJOR == 8 && _RELEASE_MINOR == 4)
227 int fail[-1];
228#endif
229])],
230 [je_cv_cray_84=yes],
231 [je_cv_cray_84=no])])
232fi
233
Jason Evans194d6f92016-12-16 07:18:55 -0800234if test "x$GCC" = "xyes" ; then
235 JE_CFLAGS_ADD([-std=gnu11])
236 if test "x$je_cv_cflags_added" = "x-std=gnu11" ; then
237 AC_DEFINE_UNQUOTED([JEMALLOC_HAS_RESTRICT])
238 else
239 JE_CFLAGS_ADD([-std=gnu99])
240 if test "x$je_cv_cflags_added" = "x-std=gnu99" ; then
Jason Evans99b0fbb2014-02-24 16:08:38 -0800241 AC_DEFINE_UNQUOTED([JEMALLOC_HAS_RESTRICT])
242 fi
Jason Evanscfeccd32010-03-03 15:48:20 -0800243 fi
Jason Evans194d6f92016-12-16 07:18:55 -0800244 JE_CFLAGS_ADD([-Wall])
Jason Evans194d6f92016-12-16 07:18:55 -0800245 JE_CFLAGS_ADD([-Wshorten-64-to-32])
246 JE_CFLAGS_ADD([-Wsign-compare])
David Goldblatt425253e2017-04-21 13:47:49 -0700247 JE_CFLAGS_ADD([-Wundef])
David Goldblatta9f77322017-07-21 13:34:45 -0700248 JE_CFLAGS_ADD([-Wno-format-zero-length])
Jason Evans194d6f92016-12-16 07:18:55 -0800249 JE_CFLAGS_ADD([-pipe])
250 JE_CFLAGS_ADD([-g3])
251elif test "x$je_cv_msvc" = "xyes" ; then
252 CC="$CC -nologo"
253 JE_CFLAGS_ADD([-Zi])
254 JE_CFLAGS_ADD([-MT])
255 JE_CFLAGS_ADD([-W3])
256 JE_CFLAGS_ADD([-FS])
257 JE_APPEND_VS(CPPFLAGS, -I${srcdir}/include/msvc_compat)
258fi
259if test "x$je_cv_cray" = "xyes" ; then
260 dnl cray compiler 8.4 has an inlining bug
261 if test "x$je_cv_cray_84" = "xyes" ; then
262 JE_CFLAGS_ADD([-hipa2])
263 JE_CFLAGS_ADD([-hnognu])
264 fi
Jason Evans0f633962017-04-24 11:47:10 -0700265 dnl ignore unreachable code warning
266 JE_CFLAGS_ADD([-hnomessage=128])
267 dnl ignore redefinition of "malloc", "free", etc warning
268 JE_CFLAGS_ADD([-hnomessage=1357])
Jason Evansb7924f52009-06-23 19:01:18 -0700269fi
Jason Evans194d6f92016-12-16 07:18:55 -0800270AC_SUBST([CONFIGURE_CFLAGS])
271AC_SUBST([SPECIFIED_CFLAGS])
Jason Evansaf0e28f2016-10-29 22:14:55 -0700272AC_SUBST([EXTRA_CFLAGS])
Jason Evansb7924f52009-06-23 19:01:18 -0700273AC_PROG_CPP
274
Dave Watson23191522016-10-23 15:56:30 -0700275AC_ARG_ENABLE([cxx],
276 [AS_HELP_STRING([--disable-cxx], [Disable C++ integration])],
277if test "x$enable_cxx" = "xno" ; then
278 enable_cxx="0"
279else
280 enable_cxx="1"
281fi
282,
283enable_cxx="1"
284)
285if test "x$enable_cxx" = "x1" ; then
Dave Watson23191522016-10-23 15:56:30 -0700286 dnl Require at least c++14, which is the first version to support sized
287 dnl deallocation. C++ support is not compiled otherwise.
288 m4_include([m4/ax_cxx_compile_stdcxx.m4])
289 AX_CXX_COMPILE_STDCXX([14], [noext], [optional])
290 if test "x${HAVE_CXX14}" = "x1" ; then
Jason Evans194d6f92016-12-16 07:18:55 -0800291 JE_CXXFLAGS_ADD([-Wall])
292 JE_CXXFLAGS_ADD([-g3])
Dave Watson23191522016-10-23 15:56:30 -0700293
294 SAVED_LIBS="${LIBS}"
Jason Evans194d6f92016-12-16 07:18:55 -0800295 JE_APPEND_VS(LIBS, -lstdc++)
Dave Watson23191522016-10-23 15:56:30 -0700296 JE_COMPILABLE([libstdc++ linkage], [
297#include <stdlib.h>
298], [[
299 int *arr = (int *)malloc(sizeof(int) * 42);
300 if (arr == NULL)
Jason Evansf4086432017-01-19 18:15:45 -0800301 return 1;
Dave Watson23191522016-10-23 15:56:30 -0700302]], [je_cv_libstdcxx])
303 if test "x${je_cv_libstdcxx}" = "xno" ; then
304 LIBS="${SAVED_LIBS}"
305 fi
306 else
307 enable_cxx="0"
308 fi
309fi
310AC_SUBST([enable_cxx])
Jason Evans194d6f92016-12-16 07:18:55 -0800311AC_SUBST([CONFIGURE_CXXFLAGS])
312AC_SUBST([SPECIFIED_CXXFLAGS])
Dave Watson23191522016-10-23 15:56:30 -0700313AC_SUBST([EXTRA_CXXFLAGS])
314
Jason Evansdf3f2702014-03-30 16:27:08 -0700315AC_C_BIGENDIAN([ac_cv_big_endian=1], [ac_cv_big_endian=0])
316if test "x${ac_cv_big_endian}" = "x1" ; then
317 AC_DEFINE_UNQUOTED([JEMALLOC_BIG_ENDIAN], [ ])
318fi
319
Mike Hommeyff2e9992014-05-29 16:33:02 +0900320if test "x${je_cv_msvc}" = "xyes" -a "x${ac_cv_header_inttypes_h}" = "xno"; then
Jason Evans194d6f92016-12-16 07:18:55 -0800321 JE_APPEND_VS(CPPFLAGS, -I${srcdir}/include/msvc_compat/C99)
Mike Hommeyff2e9992014-05-29 16:33:02 +0900322fi
323
rustyx46e0b232016-01-30 13:37:26 +0100324if test "x${je_cv_msvc}" = "xyes" ; then
325 LG_SIZEOF_PTR=LG_SIZEOF_PTR_WIN
326 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 -0700327else
rustyx46e0b232016-01-30 13:37:26 +0100328 AC_CHECK_SIZEOF([void *])
329 if test "x${ac_cv_sizeof_void_p}" = "x8" ; then
330 LG_SIZEOF_PTR=3
331 elif test "x${ac_cv_sizeof_void_p}" = "x4" ; then
332 LG_SIZEOF_PTR=2
333 else
334 AC_MSG_ERROR([Unsupported pointer size: ${ac_cv_sizeof_void_p}])
335 fi
Jason Evansb7924f52009-06-23 19:01:18 -0700336fi
Jason Evans94ad2b52009-12-29 00:09:15 -0800337AC_DEFINE_UNQUOTED([LG_SIZEOF_PTR], [$LG_SIZEOF_PTR])
338
339AC_CHECK_SIZEOF([int])
340if test "x${ac_cv_sizeof_int}" = "x8" ; then
341 LG_SIZEOF_INT=3
342elif test "x${ac_cv_sizeof_int}" = "x4" ; then
343 LG_SIZEOF_INT=2
344else
345 AC_MSG_ERROR([Unsupported int size: ${ac_cv_sizeof_int}])
346fi
347AC_DEFINE_UNQUOTED([LG_SIZEOF_INT], [$LG_SIZEOF_INT])
Jason Evansb7924f52009-06-23 19:01:18 -0700348
Jason Evans84c8eef2011-03-16 10:30:13 -0700349AC_CHECK_SIZEOF([long])
350if test "x${ac_cv_sizeof_long}" = "x8" ; then
351 LG_SIZEOF_LONG=3
352elif test "x${ac_cv_sizeof_long}" = "x4" ; then
353 LG_SIZEOF_LONG=2
354else
355 AC_MSG_ERROR([Unsupported long size: ${ac_cv_sizeof_long}])
356fi
357AC_DEFINE_UNQUOTED([LG_SIZEOF_LONG], [$LG_SIZEOF_LONG])
358
Jason Evansecae1232016-02-20 23:41:33 -0800359AC_CHECK_SIZEOF([long long])
360if test "x${ac_cv_sizeof_long_long}" = "x8" ; then
361 LG_SIZEOF_LONG_LONG=3
362elif test "x${ac_cv_sizeof_long_long}" = "x4" ; then
363 LG_SIZEOF_LONG_LONG=2
364else
365 AC_MSG_ERROR([Unsupported long long size: ${ac_cv_sizeof_long_long}])
366fi
367AC_DEFINE_UNQUOTED([LG_SIZEOF_LONG_LONG], [$LG_SIZEOF_LONG_LONG])
368
Jason Evansd81e4bd2012-03-06 14:57:45 -0800369AC_CHECK_SIZEOF([intmax_t])
370if test "x${ac_cv_sizeof_intmax_t}" = "x16" ; then
371 LG_SIZEOF_INTMAX_T=4
372elif test "x${ac_cv_sizeof_intmax_t}" = "x8" ; then
373 LG_SIZEOF_INTMAX_T=3
374elif test "x${ac_cv_sizeof_intmax_t}" = "x4" ; then
375 LG_SIZEOF_INTMAX_T=2
376else
Mike Hommey14103d32012-04-20 08:38:39 +0200377 AC_MSG_ERROR([Unsupported intmax_t size: ${ac_cv_sizeof_intmax_t}])
Jason Evansd81e4bd2012-03-06 14:57:45 -0800378fi
379AC_DEFINE_UNQUOTED([LG_SIZEOF_INTMAX_T], [$LG_SIZEOF_INTMAX_T])
380
Jason Evansb7924f52009-06-23 19:01:18 -0700381AC_CANONICAL_HOST
382dnl CPU-specific settings.
383CPU_SPINWAIT=""
384case "${host_cpu}" in
Jason Evanscb657e32014-02-25 11:21:41 -0800385 i686|x86_64)
David Goldblatt1245faa2017-10-03 18:03:02 -0700386 HAVE_CPU_SPINWAIT=1
rustyx90c72692016-01-30 13:41:09 +0100387 if test "x${je_cv_msvc}" = "xyes" ; then
388 AC_CACHE_VAL([je_cv_pause_msvc],
389 [JE_COMPILABLE([pause instruction MSVC], [],
390 [[_mm_pause(); return 0;]],
391 [je_cv_pause_msvc])])
392 if test "x${je_cv_pause_msvc}" = "xyes" ; then
393 CPU_SPINWAIT='_mm_pause()'
394 fi
395 else
396 AC_CACHE_VAL([je_cv_pause],
397 [JE_COMPILABLE([pause instruction], [],
398 [[__asm__ volatile("pause"); return 0;]],
399 [je_cv_pause])])
400 if test "x${je_cv_pause}" = "xyes" ; then
401 CPU_SPINWAIT='__asm__ volatile("pause")'
402 fi
Jason Evansf3340ca2009-06-30 16:17:05 -0700403 fi
Jason Evans80061b62013-12-09 13:21:08 -0800404 ;;
Jason Evansb7924f52009-06-23 19:01:18 -0700405 *)
David Goldblatt1245faa2017-10-03 18:03:02 -0700406 HAVE_CPU_SPINWAIT=0
Jason Evansb7924f52009-06-23 19:01:18 -0700407 ;;
408esac
David Goldblatt1245faa2017-10-03 18:03:02 -0700409AC_DEFINE_UNQUOTED([HAVE_CPU_SPINWAIT], [$HAVE_CPU_SPINWAIT])
Jason Evansb7924f52009-06-23 19:01:18 -0700410AC_DEFINE_UNQUOTED([CPU_SPINWAIT], [$CPU_SPINWAIT])
411
Jason Evansf5cf9b12017-02-06 13:17:12 -0800412case "${host_cpu}" in
413 aarch64)
414 AC_MSG_CHECKING([number of significant virtual address bits])
415 LG_VADDR=48
416 AC_MSG_RESULT([$LG_VADDR])
417 ;;
418 x86_64)
419 AC_CACHE_CHECK([number of significant virtual address bits],
420 [je_cv_lg_vaddr],
421 AC_RUN_IFELSE([AC_LANG_PROGRAM(
422[[
423#include <stdio.h>
424#ifdef _WIN32
425#include <limits.h>
426#include <intrin.h>
427typedef unsigned __int32 uint32_t;
428#else
429#include <stdint.h>
430#endif
431]], [[
432 uint32_t r[[4]];
433 uint32_t eax_in = 0x80000008U;
434#ifdef _WIN32
435 __cpuid((int *)r, (int)eax_in);
436#else
437 asm volatile ("cpuid"
438 : "=a" (r[[0]]), "=b" (r[[1]]), "=c" (r[[2]]), "=d" (r[[3]])
439 : "a" (eax_in), "c" (0)
440 );
441#endif
442 uint32_t eax_out = r[[0]];
443 uint32_t vaddr = ((eax_out & 0x0000ff00U) >> 8);
444 FILE *f = fopen("conftest.out", "w");
445 if (f == NULL) {
446 return 1;
447 }
Jason Evansbda12bd2017-03-20 17:37:02 -0700448 if (vaddr > (sizeof(void *) << 3)) {
449 vaddr = sizeof(void *) << 3;
450 }
Jason Evansf5cf9b12017-02-06 13:17:12 -0800451 fprintf(f, "%u", vaddr);
452 fclose(f);
453 return 0;
454]])],
455 [je_cv_lg_vaddr=`cat conftest.out`],
456 [je_cv_lg_vaddr=error],
457 [je_cv_lg_vaddr=57]))
458 if test "x${je_cv_lg_vaddr}" != "x" ; then
459 LG_VADDR="${je_cv_lg_vaddr}"
460 fi
461 if test "x${LG_VADDR}" != "xerror" ; then
462 AC_DEFINE_UNQUOTED([LG_VADDR], [$LG_VADDR])
463 else
464 AC_MSG_ERROR([cannot determine number of significant virtual address bits])
465 fi
466 ;;
467 *)
468 AC_MSG_CHECKING([number of significant virtual address bits])
469 if test "x${LG_SIZEOF_PTR}" = "x3" ; then
470 LG_VADDR=64
471 elif test "x${LG_SIZEOF_PTR}" = "x2" ; then
472 LG_VADDR=32
473 elif test "x${LG_SIZEOF_PTR}" = "xLG_SIZEOF_PTR_WIN" ; then
474 LG_VADDR="(1U << (LG_SIZEOF_PTR_WIN+3))"
475 else
476 AC_MSG_ERROR([Unsupported lg(pointer size): ${LG_SIZEOF_PTR}])
477 fi
478 AC_MSG_RESULT([$LG_VADDR])
479 ;;
480esac
481AC_DEFINE_UNQUOTED([LG_VADDR], [$LG_VADDR])
482
Antony Dovgal2bd3cbc2011-10-13 09:33:33 +0400483LD_PRELOAD_VAR="LD_PRELOAD"
Jason Evansf576c632011-11-01 22:27:41 -0700484so="so"
Mike Hommeyfd97b1d2012-04-30 12:38:31 +0200485importlib="${so}"
Mike Hommey7cdea392012-04-30 12:38:27 +0200486o="$ac_objext"
Mike Hommey5bee66d2012-04-16 16:30:24 +0200487a="a"
Mike Hommey7cdea392012-04-30 12:38:27 +0200488exe="$ac_exeext"
Mike Hommeya19e87f2012-04-21 21:27:46 -0700489libprefix="lib"
Jason Evansc44fa922016-10-27 17:10:56 -0700490link_whole_archive="0"
Mike Hommeyfa08da72012-04-16 16:30:25 +0200491DSO_LDFLAGS='-shared -Wl,-soname,$(@F)'
492RPATH='-Wl,-rpath,$(1)'
Mike Hommey7cdea392012-04-30 12:38:27 +0200493SOREV="${so}.${rev}"
Mike Hommey188da7c2012-04-18 18:29:41 +0200494PIC_CFLAGS='-fPIC -DPIC'
Mike Hommeyfd97b1d2012-04-30 12:38:31 +0200495CTARGET='-o $@'
496LDTARGET='-o $@'
Elliot Ronaghanccd64162016-06-14 13:18:08 -0700497TEST_LD_MODE=
Mike Hommeyfd97b1d2012-04-30 12:38:31 +0200498EXTRA_LDFLAGS=
Jason Evans80ddf492013-08-20 11:48:19 +0100499ARFLAGS='crus'
500AROUT=' $@'
Mike Hommey79c4bca2012-05-02 21:30:51 +0200501CC_MM=1
Jason Evans7372b152012-02-10 20:22:09 -0800502
Elliot Ronaghanccd64162016-06-14 13:18:08 -0700503if test "x$je_cv_cray_prgenv_wrapper" = "xyes" ; then
504 TEST_LD_MODE='-dynamic'
505fi
506
Elliot Ronaghan3ef67932016-06-14 15:26:29 -0700507if test "x${je_cv_cray}" = "xyes" ; then
508 CC_MM=
509fi
510
Jory A. Prattad505e02013-08-11 09:44:59 -0500511AN_MAKEVAR([AR], [AC_PROG_AR])
512AN_PROGRAM([ar], [AC_PROG_AR])
513AC_DEFUN([AC_PROG_AR], [AC_CHECK_TOOL(AR, ar, :)])
514AC_PROG_AR
515
Tamir Duberstein24766cc2017-07-06 15:04:17 -0400516AN_MAKEVAR([NM], [AC_PROG_NM])
517AN_PROGRAM([nm], [AC_PROG_NM])
518AC_DEFUN([AC_PROG_NM], [AC_CHECK_TOOL(NM, nm, :)])
519AC_PROG_NM
520
Jason Evans909f0482017-05-04 11:20:43 -0700521AC_PROG_AWK
522
Jason Evansb7924f52009-06-23 19:01:18 -0700523dnl Platform-specific settings. abi and RPATH can probably be determined
524dnl programmatically, but doing so is error-prone, which makes it generally
525dnl not worth the trouble.
Tamir Duberstein96f14682017-07-06 14:50:55 -0400526dnl
Jason Evansb7924f52009-06-23 19:01:18 -0700527dnl Define cpp macros in CPPFLAGS, rather than doing AC_DEFINE(macro), since the
528dnl definitions need to be seen before any headers are included, which is a pain
529dnl to make happen otherwise.
Jason Evansb9ab04a2017-04-26 16:26:12 -0700530default_retain="0"
Jason Evansd059b9d2015-07-24 18:21:42 -0700531maps_coalesce="1"
Tamir Duberstein24766cc2017-07-06 15:04:17 -0400532DUMP_SYMS="${NM} -a"
Jason Evans909f0482017-05-04 11:20:43 -0700533SYM_PREFIX=""
Jason Evansb7924f52009-06-23 19:01:18 -0700534case "${host}" in
Valerii Hiora5921ba72014-05-16 16:28:20 +0300535 *-*-darwin* | *-*-ios*)
Jason Evansb7924f52009-06-23 19:01:18 -0700536 abi="macho"
537 RPATH=""
Antony Dovgal2bd3cbc2011-10-13 09:33:33 +0400538 LD_PRELOAD_VAR="DYLD_INSERT_LIBRARIES"
Jason Evansf576c632011-11-01 22:27:41 -0700539 so="dylib"
Mike Hommeyfd97b1d2012-04-30 12:38:31 +0200540 importlib="${so}"
Jason Evansb80581d2012-03-23 16:17:43 -0700541 force_tls="0"
Jason Evansf1f2b452015-05-01 08:57:41 -0700542 DSO_LDFLAGS='-shared -Wl,-install_name,$(LIBDIR)/$(@F)'
Mike Hommey7cdea392012-04-30 12:38:27 +0200543 SOREV="${rev}.${so}"
Jason Evans66688532013-12-03 21:49:36 -0800544 sbrk_deprecated="1"
Jason Evans909f0482017-05-04 11:20:43 -0700545 SYM_PREFIX="_"
Jason Evansb7924f52009-06-23 19:01:18 -0700546 ;;
547 *-*-freebsd*)
Jason Evansb7924f52009-06-23 19:01:18 -0700548 abi="elf"
Jason Evansc2f970c2016-05-05 17:45:02 -0700549 AC_DEFINE([JEMALLOC_SYSCTL_VM_OVERCOMMIT], [ ])
Jason Evansfd4fcef2012-03-23 17:40:58 -0700550 force_lazy_lock="1"
Jason Evansb7924f52009-06-23 19:01:18 -0700551 ;;
Michael Neumann1aa25a32014-08-05 03:06:02 +0200552 *-*-dragonfly*)
Michael Neumann1aa25a32014-08-05 03:06:02 +0200553 abi="elf"
Michael Neumann1aa25a32014-08-05 03:06:02 +0200554 ;;
Sébastien Marieb80fbcb2015-04-07 12:21:19 +0200555 *-*-openbsd*)
Sébastien Marieb80fbcb2015-04-07 12:21:19 +0200556 abi="elf"
Sébastien Marieb80fbcb2015-04-07 12:21:19 +0200557 force_tls="0"
558 ;;
559 *-*-bitrig*)
Sébastien Marie77d597e2015-01-25 10:18:32 +0100560 abi="elf"
Sébastien Marie77d597e2015-01-25 10:18:32 +0100561 ;;
Jason Evans32d69e92016-11-10 15:35:29 -0800562 *-*-linux-android)
563 dnl syscall(2) and secure_getenv(3) are exposed by _GNU_SOURCE.
Jason Evans194d6f92016-12-16 07:18:55 -0800564 JE_APPEND_VS(CPPFLAGS, -D_GNU_SOURCE)
Jason Evans32d69e92016-11-10 15:35:29 -0800565 abi="elf"
Qi Wangf4f814c2017-10-05 16:32:28 -0700566 AC_DEFINE([JEMALLOC_PURGE_MADVISE_DONTNEED_ZEROS], [ ])
Jason Evans32d69e92016-11-10 15:35:29 -0800567 AC_DEFINE([JEMALLOC_HAS_ALLOCA_H])
568 AC_DEFINE([JEMALLOC_PROC_SYS_VM_OVERCOMMIT_MEMORY], [ ])
Jason Evans32d69e92016-11-10 15:35:29 -0800569 AC_DEFINE([JEMALLOC_THREADED_INIT], [ ])
David Goldblattd4ac7582017-01-25 09:54:27 -0800570 AC_DEFINE([JEMALLOC_C11_ATOMICS])
Jason Evans32d69e92016-11-10 15:35:29 -0800571 force_tls="0"
Jason Evans7d86c922017-04-24 09:14:31 -0700572 if test "${LG_SIZEOF_PTR}" = "3"; then
Jason Evansb9ab04a2017-04-26 16:26:12 -0700573 default_retain="1"
Jason Evansa01f9932017-04-17 15:54:53 -0700574 fi
Jason Evans32d69e92016-11-10 15:35:29 -0800575 ;;
Faidon Liambotis8da69b62017-08-07 21:51:09 +0300576 *-*-linux*)
Jason Evans83ebf2f2016-11-02 19:50:44 -0700577 dnl syscall(2) and secure_getenv(3) are exposed by _GNU_SOURCE.
Jason Evans194d6f92016-12-16 07:18:55 -0800578 JE_APPEND_VS(CPPFLAGS, -D_GNU_SOURCE)
Jason Evansb7924f52009-06-23 19:01:18 -0700579 abi="elf"
Qi Wangf4f814c2017-10-05 16:32:28 -0700580 AC_DEFINE([JEMALLOC_PURGE_MADVISE_DONTNEED_ZEROS], [ ])
Garrett Cooper13e4e242012-12-02 17:58:40 -0800581 AC_DEFINE([JEMALLOC_HAS_ALLOCA_H])
Jason Evansc2f970c2016-05-05 17:45:02 -0700582 AC_DEFINE([JEMALLOC_PROC_SYS_VM_OVERCOMMIT_MEMORY], [ ])
Jason Evans02b23122012-04-05 11:06:23 -0700583 AC_DEFINE([JEMALLOC_THREADED_INIT], [ ])
Jason Evansae93d6b2015-07-10 14:33:00 -0700584 AC_DEFINE([JEMALLOC_USE_CXX_THROW], [ ])
Jason Evans7d86c922017-04-24 09:14:31 -0700585 if test "${LG_SIZEOF_PTR}" = "3"; then
Jason Evansb9ab04a2017-04-26 16:26:12 -0700586 default_retain="1"
Jason Evansa01f9932017-04-17 15:54:53 -0700587 fi
Jason Evansb7924f52009-06-23 19:01:18 -0700588 ;;
Faidon Liambotis8da69b62017-08-07 21:51:09 +0300589 *-*-kfreebsd*)
590 dnl syscall(2) and secure_getenv(3) are exposed by _GNU_SOURCE.
591 JE_APPEND_VS(CPPFLAGS, -D_GNU_SOURCE)
592 abi="elf"
593 AC_DEFINE([JEMALLOC_HAS_ALLOCA_H])
594 AC_DEFINE([JEMALLOC_SYSCTL_VM_OVERCOMMIT], [ ])
595 AC_DEFINE([JEMALLOC_THREADED_INIT], [ ])
596 AC_DEFINE([JEMALLOC_USE_CXX_THROW], [ ])
597 ;;
Jason Evansb7924f52009-06-23 19:01:18 -0700598 *-*-netbsd*)
599 AC_MSG_CHECKING([ABI])
600 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
601[[#ifdef __ELF__
602/* ELF */
603#else
604#error aout
605#endif
606]])],
Jason Evanse0164bc2016-10-07 08:47:16 -0700607 [abi="elf"],
Jason Evansb7924f52009-06-23 19:01:18 -0700608 [abi="aout"])
609 AC_MSG_RESULT([$abi])
Jason Evansb7924f52009-06-23 19:01:18 -0700610 ;;
611 *-*-solaris2*)
Jason Evansb7924f52009-06-23 19:01:18 -0700612 abi="elf"
Mike Hommeyfa08da72012-04-16 16:30:25 +0200613 RPATH='-Wl,-R,$(1)'
Jason Evansb7924f52009-06-23 19:01:18 -0700614 dnl Solaris needs this for sigwait().
Jason Evans194d6f92016-12-16 07:18:55 -0800615 JE_APPEND_VS(CPPFLAGS, -D_POSIX_PTHREAD_SEMANTICS)
616 JE_APPEND_VS(LIBS, -lposix4 -lsocket -lnsl)
Jason Evansb7924f52009-06-23 19:01:18 -0700617 ;;
Antony Dovgal2bd3cbc2011-10-13 09:33:33 +0400618 *-ibm-aix*)
Jason Evans7d86c922017-04-24 09:14:31 -0700619 if test "${LG_SIZEOF_PTR}" = "3"; then
Antony Dovgal2bd3cbc2011-10-13 09:33:33 +0400620 dnl 64bit AIX
621 LD_PRELOAD_VAR="LDR_PRELOAD64"
622 else
623 dnl 32bit AIX
624 LD_PRELOAD_VAR="LDR_PRELOAD"
625 fi
626 abi="xcoff"
Antony Dovgal2bd3cbc2011-10-13 09:33:33 +0400627 ;;
Dave Rigby70bdee02014-09-22 15:53:16 +0100628 *-*-mingw* | *-*-cygwin*)
Mike Hommeya19e87f2012-04-21 21:27:46 -0700629 abi="pecoff"
630 force_tls="0"
Jason Evansd059b9d2015-07-24 18:21:42 -0700631 maps_coalesce="0"
Mike Hommeya19e87f2012-04-21 21:27:46 -0700632 RPATH=""
633 so="dll"
Mike Hommeyfd97b1d2012-04-30 12:38:31 +0200634 if test "x$je_cv_msvc" = "xyes" ; then
635 importlib="lib"
636 DSO_LDFLAGS="-LD"
637 EXTRA_LDFLAGS="-link -DEBUG"
638 CTARGET='-Fo$@'
639 LDTARGET='-Fe$@'
Jory A. Prattad505e02013-08-11 09:44:59 -0500640 AR='lib'
641 ARFLAGS='-nologo -out:'
Jason Evans80ddf492013-08-20 11:48:19 +0100642 AROUT='$@'
Mike Hommey79c4bca2012-05-02 21:30:51 +0200643 CC_MM=
Mike Hommeyfd97b1d2012-04-30 12:38:31 +0200644 else
645 importlib="${so}"
646 DSO_LDFLAGS="-shared"
Jason Evansc44fa922016-10-27 17:10:56 -0700647 link_whole_archive="1"
Mike Hommeyfd97b1d2012-04-30 12:38:31 +0200648 fi
Tamir Dubersteina545f182017-07-06 15:14:48 -0400649 case "${host}" in
650 *-*-cygwin*)
651 DUMP_SYMS="dumpbin /SYMBOLS"
652 ;;
653 *)
654 ;;
655 esac
Mike Hommeya19e87f2012-04-21 21:27:46 -0700656 a="lib"
657 libprefix=""
Mike Hommey7cdea392012-04-30 12:38:27 +0200658 SOREV="${so}"
Mike Hommeya19e87f2012-04-21 21:27:46 -0700659 PIC_CFLAGS=""
660 ;;
Jason Evansb7924f52009-06-23 19:01:18 -0700661 *)
662 AC_MSG_RESULT([Unsupported operating system: ${host}])
663 abi="elf"
Jason Evansb7924f52009-06-23 19:01:18 -0700664 ;;
665esac
Mike Hommeyaffe0092014-05-28 08:10:12 +0900666
667JEMALLOC_USABLE_SIZE_CONST=const
668AC_CHECK_HEADERS([malloc.h], [
669 AC_MSG_CHECKING([whether malloc_usable_size definition can use const argument])
670 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
671 [#include <malloc.h>
672 #include <stddef.h>
673 size_t malloc_usable_size(const void *ptr);
674 ],
675 [])],[
676 AC_MSG_RESULT([yes])
677 ],[
678 JEMALLOC_USABLE_SIZE_CONST=
679 AC_MSG_RESULT([no])
680 ])
681])
Jason Evans247d1242012-10-09 16:20:10 -0700682AC_DEFINE_UNQUOTED([JEMALLOC_USABLE_SIZE_CONST], [$JEMALLOC_USABLE_SIZE_CONST])
Jason Evansb7924f52009-06-23 19:01:18 -0700683AC_SUBST([abi])
684AC_SUBST([RPATH])
Antony Dovgal2bd3cbc2011-10-13 09:33:33 +0400685AC_SUBST([LD_PRELOAD_VAR])
Jason Evansf576c632011-11-01 22:27:41 -0700686AC_SUBST([so])
Mike Hommeyfd97b1d2012-04-30 12:38:31 +0200687AC_SUBST([importlib])
Mike Hommey5bee66d2012-04-16 16:30:24 +0200688AC_SUBST([o])
689AC_SUBST([a])
690AC_SUBST([exe])
Mike Hommeya19e87f2012-04-21 21:27:46 -0700691AC_SUBST([libprefix])
Jason Evansc44fa922016-10-27 17:10:56 -0700692AC_SUBST([link_whole_archive])
Mike Hommeyfa08da72012-04-16 16:30:25 +0200693AC_SUBST([DSO_LDFLAGS])
Mike Hommeyfd97b1d2012-04-30 12:38:31 +0200694AC_SUBST([EXTRA_LDFLAGS])
Mike Hommey85221d52012-04-18 18:29:40 +0200695AC_SUBST([SOREV])
Mike Hommey188da7c2012-04-18 18:29:41 +0200696AC_SUBST([PIC_CFLAGS])
Mike Hommeyfd97b1d2012-04-30 12:38:31 +0200697AC_SUBST([CTARGET])
698AC_SUBST([LDTARGET])
Elliot Ronaghanccd64162016-06-14 13:18:08 -0700699AC_SUBST([TEST_LD_MODE])
Mike Hommeyfd97b1d2012-04-30 12:38:31 +0200700AC_SUBST([MKLIB])
Jason Evans80ddf492013-08-20 11:48:19 +0100701AC_SUBST([ARFLAGS])
702AC_SUBST([AROUT])
Jason Evans909f0482017-05-04 11:20:43 -0700703AC_SUBST([DUMP_SYMS])
Mike Hommey79c4bca2012-05-02 21:30:51 +0200704AC_SUBST([CC_MM])
Mike Hommeyfd97b1d2012-04-30 12:38:31 +0200705
Jason Evansd76cfec2016-10-27 21:23:48 -0700706dnl Determine whether libm must be linked to use e.g. log(3).
707AC_SEARCH_LIBS([log], [m], , [AC_MSG_ERROR([Missing math functions])])
708if test "x$ac_cv_search_log" != "xnone required" ; then
709 LM="$ac_cv_search_log"
710else
711 LM=
712fi
713AC_SUBST(LM)
714
Jason Evansfa5d2452011-03-15 10:25:59 -0700715JE_COMPILABLE([__attribute__ syntax],
716 [static __attribute__((unused)) void foo(void){}],
717 [],
Jason Evans6684cac2012-03-05 12:15:36 -0800718 [je_cv_attribute])
719if test "x${je_cv_attribute}" = "xyes" ; then
Jason Evansfa5d2452011-03-15 10:25:59 -0700720 AC_DEFINE([JEMALLOC_HAVE_ATTR], [ ])
721 if test "x${GCC}" = "xyes" -a "x${abi}" = "xelf"; then
Jason Evans194d6f92016-12-16 07:18:55 -0800722 JE_CFLAGS_ADD([-fvisibility=hidden])
723 JE_CXXFLAGS_ADD([-fvisibility=hidden])
Jason Evansfa5d2452011-03-15 10:25:59 -0700724 fi
725fi
Jason Evans3cc1f1a2012-04-03 22:30:05 -0700726dnl Check for tls_model attribute support (clang 3.0 still lacks support).
Jason Evans194d6f92016-12-16 07:18:55 -0800727JE_CFLAGS_SAVE()
728JE_CFLAGS_ADD([-Werror])
729JE_CFLAGS_ADD([-herror_on_warning])
Jason Evans3cc1f1a2012-04-03 22:30:05 -0700730JE_COMPILABLE([tls_model attribute], [],
731 [static __thread int
Daniel Micayf1cf3ea2014-09-16 04:42:33 -0400732 __attribute__((tls_model("initial-exec"), unused)) foo;
Jason Evans3cc1f1a2012-04-03 22:30:05 -0700733 foo = 0;],
734 [je_cv_tls_model])
Jason Evans194d6f92016-12-16 07:18:55 -0800735JE_CFLAGS_RESTORE()
Jason Evans3cc1f1a2012-04-03 22:30:05 -0700736if test "x${je_cv_tls_model}" = "xyes" ; then
737 AC_DEFINE([JEMALLOC_TLS_MODEL],
738 [__attribute__((tls_model("initial-exec")))])
739else
740 AC_DEFINE([JEMALLOC_TLS_MODEL], [ ])
741fi
Jason Evans0b8f0bc2015-07-10 16:41:12 -0700742dnl Check for alloc_size attribute support.
Jason Evans194d6f92016-12-16 07:18:55 -0800743JE_CFLAGS_SAVE()
744JE_CFLAGS_ADD([-Werror])
745JE_CFLAGS_ADD([-herror_on_warning])
Jason Evans92d72ee2015-07-10 16:45:32 -0700746JE_COMPILABLE([alloc_size attribute], [#include <stdlib.h>],
747 [void *foo(size_t size) __attribute__((alloc_size(1)));],
Jason Evans0b8f0bc2015-07-10 16:41:12 -0700748 [je_cv_alloc_size])
Jason Evans194d6f92016-12-16 07:18:55 -0800749JE_CFLAGS_RESTORE()
Jason Evans0b8f0bc2015-07-10 16:41:12 -0700750if test "x${je_cv_alloc_size}" = "xyes" ; then
751 AC_DEFINE([JEMALLOC_HAVE_ATTR_ALLOC_SIZE], [ ])
752fi
Jason Evanse42c3092015-07-22 15:44:47 -0700753dnl Check for format(gnu_printf, ...) attribute support.
Jason Evans194d6f92016-12-16 07:18:55 -0800754JE_CFLAGS_SAVE()
755JE_CFLAGS_ADD([-Werror])
756JE_CFLAGS_ADD([-herror_on_warning])
Jason Evanse42c3092015-07-22 15:44:47 -0700757JE_COMPILABLE([format(gnu_printf, ...) attribute], [#include <stdlib.h>],
758 [void *foo(const char *format, ...) __attribute__((format(gnu_printf, 1, 2)));],
759 [je_cv_format_gnu_printf])
Jason Evans194d6f92016-12-16 07:18:55 -0800760JE_CFLAGS_RESTORE()
Jason Evanse42c3092015-07-22 15:44:47 -0700761if test "x${je_cv_format_gnu_printf}" = "xyes" ; then
762 AC_DEFINE([JEMALLOC_HAVE_ATTR_FORMAT_GNU_PRINTF], [ ])
763fi
764dnl Check for format(printf, ...) attribute support.
Jason Evans194d6f92016-12-16 07:18:55 -0800765JE_CFLAGS_SAVE()
766JE_CFLAGS_ADD([-Werror])
767JE_CFLAGS_ADD([-herror_on_warning])
Jason Evanse42c3092015-07-22 15:44:47 -0700768JE_COMPILABLE([format(printf, ...) attribute], [#include <stdlib.h>],
769 [void *foo(const char *format, ...) __attribute__((format(printf, 1, 2)));],
770 [je_cv_format_printf])
Jason Evans194d6f92016-12-16 07:18:55 -0800771JE_CFLAGS_RESTORE()
Jason Evanse42c3092015-07-22 15:44:47 -0700772if test "x${je_cv_format_printf}" = "xyes" ; then
773 AC_DEFINE([JEMALLOC_HAVE_ATTR_FORMAT_PRINTF], [ ])
774fi
Jason Evansfa5d2452011-03-15 10:25:59 -0700775
Jason Evansb7924f52009-06-23 19:01:18 -0700776dnl Support optional additions to rpath.
777AC_ARG_WITH([rpath],
Jason Evans90895cf2009-12-29 00:09:15 -0800778 [AS_HELP_STRING([--with-rpath=<rpath>], [Colon-separated rpath (ELF systems only)])],
Jason Evansb7924f52009-06-23 19:01:18 -0700779if test "x$with_rpath" = "xno" ; then
780 RPATH_EXTRA=
781else
782 RPATH_EXTRA="`echo $with_rpath | tr \":\" \" \"`"
783fi,
784 RPATH_EXTRA=
785)
786AC_SUBST([RPATH_EXTRA])
787
788dnl Disable rules that do automatic regeneration of configure output by default.
789AC_ARG_ENABLE([autogen],
Jason Evans78d815c2010-01-17 14:06:20 -0800790 [AS_HELP_STRING([--enable-autogen], [Automatically regenerate configure output])],
Jason Evansb7924f52009-06-23 19:01:18 -0700791if test "x$enable_autogen" = "xno" ; then
792 enable_autogen="0"
793else
794 enable_autogen="1"
795fi
796,
797enable_autogen="0"
798)
799AC_SUBST([enable_autogen])
800
801AC_PROG_INSTALL
802AC_PROG_RANLIB
Jason Evans7329a4f2013-01-22 10:53:29 -0800803AC_PATH_PROG([LD], [ld], [false], [$PATH])
804AC_PATH_PROG([AUTOCONF], [autoconf], [false], [$PATH])
Jason Evansb7924f52009-06-23 19:01:18 -0700805
Jason Evans0a5489e2012-03-01 17:19:20 -0800806dnl Perform no name mangling by default.
807AC_ARG_WITH([mangling],
808 [AS_HELP_STRING([--with-mangling=<map>], [Mangle symbols in <map>])],
809 [mangling_map="$with_mangling"], [mangling_map=""])
Jason Evans0a5489e2012-03-01 17:19:20 -0800810
Jason Evans90895cf2009-12-29 00:09:15 -0800811dnl Do not prefix public APIs by default.
812AC_ARG_WITH([jemalloc_prefix],
813 [AS_HELP_STRING([--with-jemalloc-prefix=<prefix>], [Prefix to prepend to all public APIs])],
Jason Evansb0fd5012010-01-17 01:49:20 -0800814 [JEMALLOC_PREFIX="$with_jemalloc_prefix"],
Mike Hommey7cdea392012-04-30 12:38:27 +0200815 [if test "x$abi" != "xmacho" -a "x$abi" != "xpecoff"; then
Jason Evans2dbecf12010-09-05 10:35:13 -0700816 JEMALLOC_PREFIX=""
817else
818 JEMALLOC_PREFIX="je_"
819fi]
Jason Evans90895cf2009-12-29 00:09:15 -0800820)
David Goldblatt425253e2017-04-21 13:47:49 -0700821if test "x$JEMALLOC_PREFIX" = "x" ; then
822 AC_DEFINE([JEMALLOC_IS_MALLOC])
823else
Jason Evanse7339702010-10-23 18:37:06 -0700824 JEMALLOC_CPREFIX=`echo ${JEMALLOC_PREFIX} | tr "a-z" "A-Z"`
825 AC_DEFINE_UNQUOTED([JEMALLOC_PREFIX], ["$JEMALLOC_PREFIX"])
826 AC_DEFINE_UNQUOTED([JEMALLOC_CPREFIX], ["$JEMALLOC_CPREFIX"])
Jason Evans90895cf2009-12-29 00:09:15 -0800827fi
Jason Evansff8062a2017-05-30 14:26:02 -0700828AC_SUBST([JEMALLOC_PREFIX])
Jason Evans241abc62015-06-23 18:47:07 -0700829AC_SUBST([JEMALLOC_CPREFIX])
Jason Evans90895cf2009-12-29 00:09:15 -0800830
Mike Hommey99066602012-11-19 10:55:26 +0100831AC_ARG_WITH([export],
832 [AS_HELP_STRING([--without-export], [disable exporting jemalloc public APIs])],
833 [if test "x$with_export" = "xno"; then
Jason Evans2625c892013-01-22 16:46:27 -0800834 AC_DEFINE([JEMALLOC_EXPORT],[])
Mike Hommey99066602012-11-19 10:55:26 +0100835fi]
836)
837
Jason Evans909f0482017-05-04 11:20:43 -0700838public_syms="aligned_alloc calloc dallocx free mallctl mallctlbymib mallctlnametomib malloc malloc_conf malloc_message malloc_stats_print malloc_usable_size mallocx nallocx posix_memalign rallocx realloc sallocx sdallocx xallocx"
839dnl Check for additional platform-specific public API functions.
840AC_CHECK_FUNC([memalign],
841 [AC_DEFINE([JEMALLOC_OVERRIDE_MEMALIGN], [ ])
842 public_syms="${public_syms} memalign"])
843AC_CHECK_FUNC([valloc],
844 [AC_DEFINE([JEMALLOC_OVERRIDE_VALLOC], [ ])
845 public_syms="${public_syms} valloc"])
846
847dnl Check for allocator-related functions that should be wrapped.
848wrap_syms=
849if test "x${JEMALLOC_PREFIX}" = "x" ; then
850 AC_CHECK_FUNC([__libc_calloc],
851 [AC_DEFINE([JEMALLOC_OVERRIDE___LIBC_CALLOC], [ ])
852 wrap_syms="${wrap_syms} __libc_calloc"])
853 AC_CHECK_FUNC([__libc_free],
854 [AC_DEFINE([JEMALLOC_OVERRIDE___LIBC_FREE], [ ])
855 wrap_syms="${wrap_syms} __libc_free"])
856 AC_CHECK_FUNC([__libc_malloc],
857 [AC_DEFINE([JEMALLOC_OVERRIDE___LIBC_MALLOC], [ ])
858 wrap_syms="${wrap_syms} __libc_malloc"])
859 AC_CHECK_FUNC([__libc_memalign],
860 [AC_DEFINE([JEMALLOC_OVERRIDE___LIBC_MEMALIGN], [ ])
861 wrap_syms="${wrap_syms} __libc_memalign"])
862 AC_CHECK_FUNC([__libc_realloc],
863 [AC_DEFINE([JEMALLOC_OVERRIDE___LIBC_REALLOC], [ ])
864 wrap_syms="${wrap_syms} __libc_realloc"])
865 AC_CHECK_FUNC([__libc_valloc],
866 [AC_DEFINE([JEMALLOC_OVERRIDE___LIBC_VALLOC], [ ])
867 wrap_syms="${wrap_syms} __libc_valloc"])
868 AC_CHECK_FUNC([__posix_memalign],
869 [AC_DEFINE([JEMALLOC_OVERRIDE___POSIX_MEMALIGN], [ ])
870 wrap_syms="${wrap_syms} __posix_memalign"])
871fi
872
873case "${host}" in
874 *-*-mingw* | *-*-cygwin*)
875 wrap_syms="${wrap_syms} tls_callback"
876 ;;
877 *)
878 ;;
879esac
880
Jason Evans86abd0d2013-11-30 15:25:42 -0800881dnl Mangle library-private APIs.
Jason Evans746e77a2011-07-30 16:40:52 -0700882AC_ARG_WITH([private_namespace],
883 [AS_HELP_STRING([--with-private-namespace=<prefix>], [Prefix to prepend to all library-private APIs])],
Jason Evans86abd0d2013-11-30 15:25:42 -0800884 [JEMALLOC_PRIVATE_NAMESPACE="${with_private_namespace}je_"],
885 [JEMALLOC_PRIVATE_NAMESPACE="je_"]
Jason Evans746e77a2011-07-30 16:40:52 -0700886)
Jason Evans86abd0d2013-11-30 15:25:42 -0800887AC_DEFINE_UNQUOTED([JEMALLOC_PRIVATE_NAMESPACE], [$JEMALLOC_PRIVATE_NAMESPACE])
888private_namespace="$JEMALLOC_PRIVATE_NAMESPACE"
889AC_SUBST([private_namespace])
Jason Evans746e77a2011-07-30 16:40:52 -0700890
Jason Evansb0fd5012010-01-17 01:49:20 -0800891dnl Do not add suffix to installed files by default.
892AC_ARG_WITH([install_suffix],
893 [AS_HELP_STRING([--with-install-suffix=<suffix>], [Suffix to append to all installed files])],
894 [INSTALL_SUFFIX="$with_install_suffix"],
895 [INSTALL_SUFFIX=]
896)
897install_suffix="$INSTALL_SUFFIX"
898AC_SUBST([install_suffix])
899
Jason Evansf8290092016-02-07 14:23:22 -0800900dnl Specify default malloc_conf.
901AC_ARG_WITH([malloc_conf],
902 [AS_HELP_STRING([--with-malloc-conf=<malloc_conf>], [config.malloc_conf options string])],
903 [JEMALLOC_CONFIG_MALLOC_CONF="$with_malloc_conf"],
904 [JEMALLOC_CONFIG_MALLOC_CONF=""]
905)
906config_malloc_conf="$JEMALLOC_CONFIG_MALLOC_CONF"
907AC_DEFINE_UNQUOTED([JEMALLOC_CONFIG_MALLOC_CONF], ["$config_malloc_conf"])
908
Jason Evans86abd0d2013-11-30 15:25:42 -0800909dnl Substitute @je_@ in jemalloc_protos.h.in, primarily to make generation of
910dnl jemalloc_protos_jet.h easy.
911je_="je_"
912AC_SUBST([je_])
913
Mike Hommeycf6032d2014-07-30 18:16:13 +0900914cfgoutputs_in="Makefile.in"
Nick White913e9a82014-09-19 22:01:23 +0100915cfgoutputs_in="${cfgoutputs_in} jemalloc.pc.in"
Mike Hommeycf6032d2014-07-30 18:16:13 +0900916cfgoutputs_in="${cfgoutputs_in} doc/html.xsl.in"
917cfgoutputs_in="${cfgoutputs_in} doc/manpages.xsl.in"
918cfgoutputs_in="${cfgoutputs_in} doc/jemalloc.xml.in"
919cfgoutputs_in="${cfgoutputs_in} include/jemalloc/jemalloc_macros.h.in"
920cfgoutputs_in="${cfgoutputs_in} include/jemalloc/jemalloc_protos.h.in"
Jason Evans82e88d12014-09-07 19:55:03 -0700921cfgoutputs_in="${cfgoutputs_in} include/jemalloc/jemalloc_typedefs.h.in"
David Goldblatt743d9402017-04-10 18:17:55 -0700922cfgoutputs_in="${cfgoutputs_in} include/jemalloc/internal/jemalloc_preamble.h.in"
Mike Hommeycf6032d2014-07-30 18:16:13 +0900923cfgoutputs_in="${cfgoutputs_in} test/test.sh.in"
924cfgoutputs_in="${cfgoutputs_in} test/include/test/jemalloc_test.h.in"
Jason Evansb0fd5012010-01-17 01:49:20 -0800925
Jason Evansaee7fd22010-11-24 22:00:02 -0800926cfgoutputs_out="Makefile"
Nick White913e9a82014-09-19 22:01:23 +0100927cfgoutputs_out="${cfgoutputs_out} jemalloc.pc"
Jason Evansaee7fd22010-11-24 22:00:02 -0800928cfgoutputs_out="${cfgoutputs_out} doc/html.xsl"
929cfgoutputs_out="${cfgoutputs_out} doc/manpages.xsl"
Jason Evans86abd0d2013-11-30 15:25:42 -0800930cfgoutputs_out="${cfgoutputs_out} doc/jemalloc.xml"
931cfgoutputs_out="${cfgoutputs_out} include/jemalloc/jemalloc_macros.h"
932cfgoutputs_out="${cfgoutputs_out} include/jemalloc/jemalloc_protos.h"
Jason Evans82e88d12014-09-07 19:55:03 -0700933cfgoutputs_out="${cfgoutputs_out} include/jemalloc/jemalloc_typedefs.h"
David Goldblatt743d9402017-04-10 18:17:55 -0700934cfgoutputs_out="${cfgoutputs_out} include/jemalloc/internal/jemalloc_preamble.h"
Jason Evans86abd0d2013-11-30 15:25:42 -0800935cfgoutputs_out="${cfgoutputs_out} test/test.sh"
936cfgoutputs_out="${cfgoutputs_out} test/include/test/jemalloc_test.h"
Jason Evansb0fd5012010-01-17 01:49:20 -0800937
Jason Evansaee7fd22010-11-24 22:00:02 -0800938cfgoutputs_tup="Makefile"
Nick White913e9a82014-09-19 22:01:23 +0100939cfgoutputs_tup="${cfgoutputs_tup} jemalloc.pc:jemalloc.pc.in"
Jason Evansaee7fd22010-11-24 22:00:02 -0800940cfgoutputs_tup="${cfgoutputs_tup} doc/html.xsl:doc/html.xsl.in"
941cfgoutputs_tup="${cfgoutputs_tup} doc/manpages.xsl:doc/manpages.xsl.in"
Jason Evans86abd0d2013-11-30 15:25:42 -0800942cfgoutputs_tup="${cfgoutputs_tup} doc/jemalloc.xml:doc/jemalloc.xml.in"
943cfgoutputs_tup="${cfgoutputs_tup} include/jemalloc/jemalloc_macros.h:include/jemalloc/jemalloc_macros.h.in"
944cfgoutputs_tup="${cfgoutputs_tup} include/jemalloc/jemalloc_protos.h:include/jemalloc/jemalloc_protos.h.in"
Jason Evans82e88d12014-09-07 19:55:03 -0700945cfgoutputs_tup="${cfgoutputs_tup} include/jemalloc/jemalloc_typedefs.h:include/jemalloc/jemalloc_typedefs.h.in"
David Goldblatt743d9402017-04-10 18:17:55 -0700946cfgoutputs_tup="${cfgoutputs_tup} include/jemalloc/internal/jemalloc_preamble.h"
Jason Evans86abd0d2013-11-30 15:25:42 -0800947cfgoutputs_tup="${cfgoutputs_tup} test/test.sh:test/test.sh.in"
948cfgoutputs_tup="${cfgoutputs_tup} test/include/test/jemalloc_test.h:test/include/test/jemalloc_test.h.in"
Jason Evansb0fd5012010-01-17 01:49:20 -0800949
Mike Hommeycf6032d2014-07-30 18:16:13 +0900950cfghdrs_in="include/jemalloc/jemalloc_defs.h.in"
951cfghdrs_in="${cfghdrs_in} include/jemalloc/internal/jemalloc_internal_defs.h.in"
Jason Evans909f0482017-05-04 11:20:43 -0700952cfghdrs_in="${cfghdrs_in} include/jemalloc/internal/private_symbols.sh"
Mike Hommeycf6032d2014-07-30 18:16:13 +0900953cfghdrs_in="${cfghdrs_in} include/jemalloc/internal/private_namespace.sh"
Mike Hommeycf6032d2014-07-30 18:16:13 +0900954cfghdrs_in="${cfghdrs_in} include/jemalloc/internal/public_namespace.sh"
955cfghdrs_in="${cfghdrs_in} include/jemalloc/internal/public_unnamespace.sh"
956cfghdrs_in="${cfghdrs_in} include/jemalloc/internal/size_classes.sh"
957cfghdrs_in="${cfghdrs_in} include/jemalloc/jemalloc_rename.sh"
958cfghdrs_in="${cfghdrs_in} include/jemalloc/jemalloc_mangle.sh"
959cfghdrs_in="${cfghdrs_in} include/jemalloc/jemalloc.sh"
960cfghdrs_in="${cfghdrs_in} test/include/test/jemalloc_test_defs.h.in"
Jason Evansb0fd5012010-01-17 01:49:20 -0800961
Jason Evans86abd0d2013-11-30 15:25:42 -0800962cfghdrs_out="include/jemalloc/jemalloc_defs.h"
963cfghdrs_out="${cfghdrs_out} include/jemalloc/jemalloc${install_suffix}.h"
Jason Evans909f0482017-05-04 11:20:43 -0700964cfghdrs_out="${cfghdrs_out} include/jemalloc/internal/private_symbols.awk"
965cfghdrs_out="${cfghdrs_out} include/jemalloc/internal/private_symbols_jet.awk"
Jason Evansf234dc52014-01-16 17:38:01 -0800966cfghdrs_out="${cfghdrs_out} include/jemalloc/internal/public_symbols.txt"
Jason Evans86abd0d2013-11-30 15:25:42 -0800967cfghdrs_out="${cfghdrs_out} include/jemalloc/internal/public_namespace.h"
968cfghdrs_out="${cfghdrs_out} include/jemalloc/internal/public_unnamespace.h"
Jason Evansb1726102012-02-28 16:50:47 -0800969cfghdrs_out="${cfghdrs_out} include/jemalloc/internal/size_classes.h"
Jason Evansf234dc52014-01-16 17:38:01 -0800970cfghdrs_out="${cfghdrs_out} include/jemalloc/jemalloc_protos_jet.h"
971cfghdrs_out="${cfghdrs_out} include/jemalloc/jemalloc_rename.h"
972cfghdrs_out="${cfghdrs_out} include/jemalloc/jemalloc_mangle.h"
973cfghdrs_out="${cfghdrs_out} include/jemalloc/jemalloc_mangle_jet.h"
974cfghdrs_out="${cfghdrs_out} include/jemalloc/internal/jemalloc_internal_defs.h"
Jason Evans80061b62013-12-09 13:21:08 -0800975cfghdrs_out="${cfghdrs_out} test/include/test/jemalloc_test_defs.h"
Jason Evansb0fd5012010-01-17 01:49:20 -0800976
Jason Evans86abd0d2013-11-30 15:25:42 -0800977cfghdrs_tup="include/jemalloc/jemalloc_defs.h:include/jemalloc/jemalloc_defs.h.in"
Mike Hommeycf6032d2014-07-30 18:16:13 +0900978cfghdrs_tup="${cfghdrs_tup} include/jemalloc/internal/jemalloc_internal_defs.h:include/jemalloc/internal/jemalloc_internal_defs.h.in"
979cfghdrs_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 -0800980
Jason Evansb7924f52009-06-23 19:01:18 -0700981dnl Do not compile with debugging by default.
982AC_ARG_ENABLE([debug],
Jason Evanse0a08a12015-03-18 21:06:58 -0700983 [AS_HELP_STRING([--enable-debug],
Jason Evans3823eff2017-04-21 11:00:36 -0700984 [Build debugging code])],
Jason Evansb7924f52009-06-23 19:01:18 -0700985[if test "x$enable_debug" = "xno" ; then
986 enable_debug="0"
987else
988 enable_debug="1"
989fi
990],
991[enable_debug="0"]
992)
Jason Evans02e5dcf2015-02-15 20:12:06 -0800993if test "x$enable_debug" = "x1" ; then
994 AC_DEFINE([JEMALLOC_DEBUG], [ ])
995fi
Jason Evanse0a08a12015-03-18 21:06:58 -0700996if test "x$enable_debug" = "x1" ; then
997 AC_DEFINE([JEMALLOC_DEBUG], [ ])
Jason Evanse0a08a12015-03-18 21:06:58 -0700998fi
Jason Evansb7924f52009-06-23 19:01:18 -0700999AC_SUBST([enable_debug])
1000
1001dnl Only optimize if not debugging.
Jason Evans194d6f92016-12-16 07:18:55 -08001002if test "x$enable_debug" = "x0" ; then
1003 if test "x$GCC" = "xyes" ; then
1004 JE_CFLAGS_ADD([-O3])
1005 JE_CXXFLAGS_ADD([-O3])
1006 JE_CFLAGS_ADD([-funroll-loops])
1007 elif test "x$je_cv_msvc" = "xyes" ; then
1008 JE_CFLAGS_ADD([-O2])
1009 JE_CXXFLAGS_ADD([-O2])
1010 else
1011 JE_CFLAGS_ADD([-O])
1012 JE_CXXFLAGS_ADD([-O])
Jason Evansb7924f52009-06-23 19:01:18 -07001013 fi
1014fi
1015
Jason Evansd073a322012-02-28 20:41:16 -08001016dnl Enable statistics calculation by default.
Jason Evansb7924f52009-06-23 19:01:18 -07001017AC_ARG_ENABLE([stats],
Jason Evans777c1912012-02-28 20:49:22 -08001018 [AS_HELP_STRING([--disable-stats],
1019 [Disable statistics calculation/reporting])],
Jason Evansb7924f52009-06-23 19:01:18 -07001020[if test "x$enable_stats" = "xno" ; then
1021 enable_stats="0"
1022else
1023 enable_stats="1"
1024fi
1025],
Jason Evansd073a322012-02-28 20:41:16 -08001026[enable_stats="1"]
Jason Evansb7924f52009-06-23 19:01:18 -07001027)
1028if test "x$enable_stats" = "x1" ; then
1029 AC_DEFINE([JEMALLOC_STATS], [ ])
1030fi
1031AC_SUBST([enable_stats])
1032
Jason Evans6109fe02010-02-10 10:37:56 -08001033dnl Do not enable profiling by default.
1034AC_ARG_ENABLE([prof],
1035 [AS_HELP_STRING([--enable-prof], [Enable allocation profiling])],
1036[if test "x$enable_prof" = "xno" ; then
1037 enable_prof="0"
1038else
1039 enable_prof="1"
1040fi
1041],
1042[enable_prof="0"]
1043)
Jason Evans77f350b2011-03-15 22:23:12 -07001044if test "x$enable_prof" = "x1" ; then
1045 backtrace_method=""
Jason Evansb27805b2010-02-10 18:15:53 -08001046else
Jason Evans77f350b2011-03-15 22:23:12 -07001047 backtrace_method="N/A"
Jason Evansb27805b2010-02-10 18:15:53 -08001048fi
Jason Evans77f350b2011-03-15 22:23:12 -07001049
Jason Evans6109fe02010-02-10 10:37:56 -08001050AC_ARG_ENABLE([prof-libunwind],
1051 [AS_HELP_STRING([--enable-prof-libunwind], [Use libunwind for backtracing])],
1052[if test "x$enable_prof_libunwind" = "xno" ; then
1053 enable_prof_libunwind="0"
1054else
1055 enable_prof_libunwind="1"
1056fi
1057],
1058[enable_prof_libunwind="0"]
1059)
Jason Evansca6bd4f2010-03-02 14:12:58 -08001060AC_ARG_WITH([static_libunwind],
1061 [AS_HELP_STRING([--with-static-libunwind=<libunwind.a>],
1062 [Path to static libunwind library; use rather than dynamically linking])],
1063if test "x$with_static_libunwind" = "xno" ; then
1064 LUNWIND="-lunwind"
1065else
1066 if test ! -f "$with_static_libunwind" ; then
1067 AC_MSG_ERROR([Static libunwind not found: $with_static_libunwind])
1068 fi
1069 LUNWIND="$with_static_libunwind"
1070fi,
1071 LUNWIND="-lunwind"
1072)
Jason Evans77f350b2011-03-15 22:23:12 -07001073if test "x$backtrace_method" = "x" -a "x$enable_prof_libunwind" = "x1" ; then
1074 AC_CHECK_HEADERS([libunwind.h], , [enable_prof_libunwind="0"])
1075 if test "x$LUNWIND" = "x-lunwind" ; then
Jason Evans194d6f92016-12-16 07:18:55 -08001076 AC_CHECK_LIB([unwind], [unw_backtrace], [JE_APPEND_VS(LIBS, $LUNWIND)],
Jason Evans77f350b2011-03-15 22:23:12 -07001077 [enable_prof_libunwind="0"])
1078 else
Jason Evans194d6f92016-12-16 07:18:55 -08001079 JE_APPEND_VS(LIBS, $LUNWIND)
Jason Evans77f350b2011-03-15 22:23:12 -07001080 fi
1081 if test "x${enable_prof_libunwind}" = "x1" ; then
1082 backtrace_method="libunwind"
1083 AC_DEFINE([JEMALLOC_PROF_LIBUNWIND], [ ])
1084 fi
1085fi
1086
1087AC_ARG_ENABLE([prof-libgcc],
1088 [AS_HELP_STRING([--disable-prof-libgcc],
1089 [Do not use libgcc for backtracing])],
1090[if test "x$enable_prof_libgcc" = "xno" ; then
1091 enable_prof_libgcc="0"
1092else
1093 enable_prof_libgcc="1"
1094fi
1095],
1096[enable_prof_libgcc="1"]
1097)
1098if test "x$backtrace_method" = "x" -a "x$enable_prof_libgcc" = "x1" \
1099 -a "x$GCC" = "xyes" ; then
1100 AC_CHECK_HEADERS([unwind.h], , [enable_prof_libgcc="0"])
Jason Evans664ef652017-02-18 00:02:23 -08001101 if test "x${enable_prof_libgcc}" = "x1" ; then
1102 AC_CHECK_LIB([gcc], [_Unwind_Backtrace], [JE_APPEND_VS(LIBS, -lgcc)], [enable_prof_libgcc="0"])
1103 fi
Jason Evans77f350b2011-03-15 22:23:12 -07001104 if test "x${enable_prof_libgcc}" = "x1" ; then
1105 backtrace_method="libgcc"
1106 AC_DEFINE([JEMALLOC_PROF_LIBGCC], [ ])
1107 fi
1108else
1109 enable_prof_libgcc="0"
1110fi
1111
1112AC_ARG_ENABLE([prof-gcc],
1113 [AS_HELP_STRING([--disable-prof-gcc],
1114 [Do not use gcc intrinsics for backtracing])],
1115[if test "x$enable_prof_gcc" = "xno" ; then
1116 enable_prof_gcc="0"
1117else
1118 enable_prof_gcc="1"
1119fi
1120],
1121[enable_prof_gcc="1"]
1122)
1123if test "x$backtrace_method" = "x" -a "x$enable_prof_gcc" = "x1" \
1124 -a "x$GCC" = "xyes" ; then
Jason Evans194d6f92016-12-16 07:18:55 -08001125 JE_CFLAGS_ADD([-fno-omit-frame-pointer])
Jason Evans77f350b2011-03-15 22:23:12 -07001126 backtrace_method="gcc intrinsics"
1127 AC_DEFINE([JEMALLOC_PROF_GCC], [ ])
1128else
1129 enable_prof_gcc="0"
1130fi
1131
1132if test "x$backtrace_method" = "x" ; then
1133 backtrace_method="none (disabling profiling)"
1134 enable_prof="0"
1135fi
1136AC_MSG_CHECKING([configured backtracing method])
1137AC_MSG_RESULT([$backtrace_method])
Jason Evans2dbecf12010-09-05 10:35:13 -07001138if test "x$enable_prof" = "x1" ; then
Jason Evansd76cfec2016-10-27 21:23:48 -07001139 dnl Heap profiling uses the log(3) function.
Jason Evans194d6f92016-12-16 07:18:55 -08001140 JE_APPEND_VS(LIBS, $LM)
Jason Evansd37d5ad2013-12-05 23:01:50 -08001141
Jason Evans2dbecf12010-09-05 10:35:13 -07001142 AC_DEFINE([JEMALLOC_PROF], [ ])
Jason Evans2dbecf12010-09-05 10:35:13 -07001143fi
1144AC_SUBST([enable_prof])
Jason Evans2dbecf12010-09-05 10:35:13 -07001145
Jason Evansd059b9d2015-07-24 18:21:42 -07001146dnl Indicate whether adjacent virtual memory mappings automatically coalesce
1147dnl (and fragment on demand).
1148if test "x${maps_coalesce}" = "x1" ; then
1149 AC_DEFINE([JEMALLOC_MAPS_COALESCE], [ ])
1150fi
1151
Jason Evansc86c8f42017-04-27 15:51:35 -07001152dnl Indicate whether to retain memory (rather than using munmap()) by default.
Jason Evansb9ab04a2017-04-26 16:26:12 -07001153if test "x$default_retain" = "x1" ; then
1154 AC_DEFINE([JEMALLOC_RETAIN], [ ])
Jason Evans59ae2762012-04-16 17:52:27 -07001155fi
Jason Evans59ae2762012-04-16 17:52:27 -07001156
Jason Evans4d434ad2014-04-15 12:09:48 -07001157dnl Enable allocation from DSS if supported by the OS.
1158have_dss="1"
Mike Hommey83c324a2012-04-12 10:13:03 +02001159dnl Check whether the BSD/SUSv1 sbrk() exists. If not, disable DSS support.
1160AC_CHECK_FUNC([sbrk], [have_sbrk="1"], [have_sbrk="0"])
1161if test "x$have_sbrk" = "x1" ; then
Steven Stewart-Gallus79230fe2014-06-19 16:11:43 -07001162 if test "x$sbrk_deprecated" = "x1" ; then
Jason Evans66688532013-12-03 21:49:36 -08001163 AC_MSG_RESULT([Disabling dss allocation because sbrk is deprecated])
Jason Evans4d434ad2014-04-15 12:09:48 -07001164 have_dss="0"
Jason Evans66688532013-12-03 21:49:36 -08001165 fi
Mike Hommey83c324a2012-04-12 10:13:03 +02001166else
Jason Evans4d434ad2014-04-15 12:09:48 -07001167 have_dss="0"
Mike Hommey83c324a2012-04-12 10:13:03 +02001168fi
1169
Jason Evans4d434ad2014-04-15 12:09:48 -07001170if test "x$have_dss" = "x1" ; then
Jason Evansb7924f52009-06-23 19:01:18 -07001171 AC_DEFINE([JEMALLOC_DSS], [ ])
1172fi
Jason Evansb7924f52009-06-23 19:01:18 -07001173
Jason Evans777c1912012-02-28 20:49:22 -08001174dnl Support the junk/zero filling option by default.
Jason Evansb7924f52009-06-23 19:01:18 -07001175AC_ARG_ENABLE([fill],
Jason Evans17c021c2016-04-05 18:18:15 -07001176 [AS_HELP_STRING([--disable-fill], [Disable support for junk/zero filling])],
Jason Evansb7924f52009-06-23 19:01:18 -07001177[if test "x$enable_fill" = "xno" ; then
1178 enable_fill="0"
1179else
1180 enable_fill="1"
1181fi
1182],
Jason Evans777c1912012-02-28 20:49:22 -08001183[enable_fill="1"]
Jason Evansb7924f52009-06-23 19:01:18 -07001184)
1185if test "x$enable_fill" = "x1" ; then
1186 AC_DEFINE([JEMALLOC_FILL], [ ])
1187fi
1188AC_SUBST([enable_fill])
1189
Jason Evansb1476112012-04-05 13:36:17 -07001190dnl Disable utrace(2)-based tracing by default.
1191AC_ARG_ENABLE([utrace],
1192 [AS_HELP_STRING([--enable-utrace], [Enable utrace(2)-based tracing])],
1193[if test "x$enable_utrace" = "xno" ; then
1194 enable_utrace="0"
1195else
1196 enable_utrace="1"
1197fi
1198],
1199[enable_utrace="0"]
1200)
1201JE_COMPILABLE([utrace(2)], [
1202#include <sys/types.h>
1203#include <sys/param.h>
1204#include <sys/time.h>
1205#include <sys/uio.h>
1206#include <sys/ktrace.h>
1207], [
1208 utrace((void *)0, 0);
1209], [je_cv_utrace])
1210if test "x${je_cv_utrace}" = "xno" ; then
1211 enable_utrace="0"
1212fi
1213if test "x$enable_utrace" = "x1" ; then
1214 AC_DEFINE([JEMALLOC_UTRACE], [ ])
1215fi
1216AC_SUBST([enable_utrace])
1217
Jason Evansb7924f52009-06-23 19:01:18 -07001218dnl Do not support the xmalloc option by default.
1219AC_ARG_ENABLE([xmalloc],
1220 [AS_HELP_STRING([--enable-xmalloc], [Support xmalloc option])],
1221[if test "x$enable_xmalloc" = "xno" ; then
1222 enable_xmalloc="0"
1223else
1224 enable_xmalloc="1"
1225fi
1226],
1227[enable_xmalloc="0"]
1228)
1229if test "x$enable_xmalloc" = "x1" ; then
1230 AC_DEFINE([JEMALLOC_XMALLOC], [ ])
1231fi
1232AC_SUBST([enable_xmalloc])
1233
Jason Evans8a03cf02015-05-04 09:58:36 -07001234dnl Support cache-oblivious allocation alignment by default.
1235AC_ARG_ENABLE([cache-oblivious],
1236 [AS_HELP_STRING([--disable-cache-oblivious],
1237 [Disable support for cache-oblivious allocation alignment])],
1238[if test "x$enable_cache_oblivious" = "xno" ; then
1239 enable_cache_oblivious="0"
1240else
1241 enable_cache_oblivious="1"
1242fi
1243],
1244[enable_cache_oblivious="1"]
1245)
1246if test "x$enable_cache_oblivious" = "x1" ; then
1247 AC_DEFINE([JEMALLOC_CACHE_OBLIVIOUS], [ ])
1248fi
1249AC_SUBST([enable_cache_oblivious])
1250
David T. Goldblatt9761b442017-07-19 16:36:46 -07001251dnl Do not log by default.
1252AC_ARG_ENABLE([log],
1253 [AS_HELP_STRING([--enable-log], [Support debug logging])],
1254[if test "x$enable_log" = "xno" ; then
1255 enable_log="0"
1256else
1257 enable_log="1"
1258fi
1259],
1260[enable_log="0"]
1261)
1262if test "x$enable_log" = "x1" ; then
1263 AC_DEFINE([JEMALLOC_LOG], [ ])
1264fi
1265AC_SUBST([enable_log])
Elliot Ronaghan1167e9e2016-06-17 13:28:39 -07001266
1267
1268JE_COMPILABLE([a program using __builtin_unreachable], [
1269void foo (void) {
1270 __builtin_unreachable();
1271}
1272], [
1273 {
1274 foo();
1275 }
1276], [je_cv_gcc_builtin_unreachable])
Elliot Ronaghanc096ccf2016-07-12 15:52:18 -07001277if test "x${je_cv_gcc_builtin_unreachable}" = "xyes" ; then
Elliot Ronaghan1167e9e2016-06-17 13:28:39 -07001278 AC_DEFINE([JEMALLOC_INTERNAL_UNREACHABLE], [__builtin_unreachable])
1279else
1280 AC_DEFINE([JEMALLOC_INTERNAL_UNREACHABLE], [abort])
1281fi
1282
Mike Hommey8f50ec82014-06-04 12:12:55 +09001283dnl ============================================================================
1284dnl Check for __builtin_ffsl(), then ffsl(3), and fail if neither are found.
1285dnl One of those two functions should (theoretically) exist on all platforms
1286dnl that jemalloc currently has a chance of functioning on without modification.
Jason Evansecae1232016-02-20 23:41:33 -08001287dnl We additionally assume ffs[ll]() or __builtin_ffs[ll]() are defined if
Mike Hommey8f50ec82014-06-04 12:12:55 +09001288dnl ffsl() or __builtin_ffsl() are defined, respectively.
1289JE_COMPILABLE([a program using __builtin_ffsl], [
1290#include <stdio.h>
1291#include <strings.h>
1292#include <string.h>
1293], [
1294 {
1295 int rv = __builtin_ffsl(0x08);
1296 printf("%d\n", rv);
1297 }
1298], [je_cv_gcc_builtin_ffsl])
Steven Stewart-Gallus79230fe2014-06-19 16:11:43 -07001299if test "x${je_cv_gcc_builtin_ffsl}" = "xyes" ; then
Jason Evansecae1232016-02-20 23:41:33 -08001300 AC_DEFINE([JEMALLOC_INTERNAL_FFSLL], [__builtin_ffsll])
Mike Hommey8f50ec82014-06-04 12:12:55 +09001301 AC_DEFINE([JEMALLOC_INTERNAL_FFSL], [__builtin_ffsl])
1302 AC_DEFINE([JEMALLOC_INTERNAL_FFS], [__builtin_ffs])
1303else
1304 JE_COMPILABLE([a program using ffsl], [
1305 #include <stdio.h>
1306 #include <strings.h>
1307 #include <string.h>
1308 ], [
1309 {
1310 int rv = ffsl(0x08);
1311 printf("%d\n", rv);
1312 }
1313 ], [je_cv_function_ffsl])
Steven Stewart-Gallus79230fe2014-06-19 16:11:43 -07001314 if test "x${je_cv_function_ffsl}" = "xyes" ; then
Jason Evansecae1232016-02-20 23:41:33 -08001315 AC_DEFINE([JEMALLOC_INTERNAL_FFSLL], [ffsll])
Mike Hommey8f50ec82014-06-04 12:12:55 +09001316 AC_DEFINE([JEMALLOC_INTERNAL_FFSL], [ffsl])
1317 AC_DEFINE([JEMALLOC_INTERNAL_FFS], [ffs])
1318 else
1319 AC_MSG_ERROR([Cannot build without ffsl(3) or __builtin_ffsl()])
1320 fi
1321fi
1322
Jason Evansfc0b3b72014-10-09 17:54:06 -07001323AC_ARG_WITH([lg_quantum],
1324 [AS_HELP_STRING([--with-lg-quantum=<lg-quantum>],
1325 [Base 2 log of minimum allocation alignment])],
Jason Evans81e54752014-10-10 22:34:25 -07001326 [LG_QUANTA="$with_lg_quantum"],
1327 [LG_QUANTA="3 4"])
1328if test "x$with_lg_quantum" != "x" ; then
1329 AC_DEFINE_UNQUOTED([LG_QUANTUM], [$with_lg_quantum])
1330fi
Jason Evansfc0b3b72014-10-09 17:54:06 -07001331
1332AC_ARG_WITH([lg_page],
1333 [AS_HELP_STRING([--with-lg-page=<lg-page>], [Base 2 log of system page size])],
1334 [LG_PAGE="$with_lg_page"], [LG_PAGE="detect"])
Jason Evansb0808d52015-02-03 12:39:31 -08001335if test "x$LG_PAGE" = "xdetect"; then
Jason Evansfc0b3b72014-10-09 17:54:06 -07001336 AC_CACHE_CHECK([LG_PAGE],
1337 [je_cv_lg_page],
Jason Evans6684cac2012-03-05 12:15:36 -08001338 AC_RUN_IFELSE([AC_LANG_PROGRAM(
Mike Hommeya19e87f2012-04-21 21:27:46 -07001339[[
Mike Hommeyfd97b1d2012-04-30 12:38:31 +02001340#include <strings.h>
Mike Hommeya19e87f2012-04-21 21:27:46 -07001341#ifdef _WIN32
1342#include <windows.h>
1343#else
Jason Evansb7924f52009-06-23 19:01:18 -07001344#include <unistd.h>
Mike Hommeya19e87f2012-04-21 21:27:46 -07001345#endif
1346#include <stdio.h>
Jason Evans6684cac2012-03-05 12:15:36 -08001347]],
1348[[
Garrett Cooper72c1e592012-12-02 17:57:28 -08001349 int result;
Jason Evansb7924f52009-06-23 19:01:18 -07001350 FILE *f;
1351
Mike Hommeya19e87f2012-04-21 21:27:46 -07001352#ifdef _WIN32
1353 SYSTEM_INFO si;
1354 GetSystemInfo(&si);
1355 result = si.dwPageSize;
1356#else
Jason Evansb7924f52009-06-23 19:01:18 -07001357 result = sysconf(_SC_PAGESIZE);
Mike Hommeya19e87f2012-04-21 21:27:46 -07001358#endif
Jason Evansb7924f52009-06-23 19:01:18 -07001359 if (result == -1) {
1360 return 1;
1361 }
Mike Hommey8f50ec82014-06-04 12:12:55 +09001362 result = JEMALLOC_INTERNAL_FFSL(result) - 1;
Mike Hommeya19e87f2012-04-21 21:27:46 -07001363
Jason Evansb7924f52009-06-23 19:01:18 -07001364 f = fopen("conftest.out", "w");
1365 if (f == NULL) {
1366 return 1;
1367 }
rustyxbc498632016-01-30 13:38:33 +01001368 fprintf(f, "%d", result);
Jason Evans3cc1f1a2012-04-03 22:30:05 -07001369 fclose(f);
Jason Evansb7924f52009-06-23 19:01:18 -07001370
1371 return 0;
1372]])],
Jason Evansfc0b3b72014-10-09 17:54:06 -07001373 [je_cv_lg_page=`cat conftest.out`],
1374 [je_cv_lg_page=undefined],
1375 [je_cv_lg_page=12]))
Jason Evans6684cac2012-03-05 12:15:36 -08001376fi
Jason Evansfc0b3b72014-10-09 17:54:06 -07001377if test "x${je_cv_lg_page}" != "x" ; then
1378 LG_PAGE="${je_cv_lg_page}"
1379fi
1380if test "x${LG_PAGE}" != "xundefined" ; then
1381 AC_DEFINE_UNQUOTED([LG_PAGE], [$LG_PAGE])
1382else
1383 AC_MSG_ERROR([cannot determine value for LG_PAGE])
1384fi
1385
Jason Evansc1baa0a2016-11-17 13:36:17 -08001386AC_ARG_WITH([lg_hugepage],
1387 [AS_HELP_STRING([--with-lg-hugepage=<lg-hugepage>],
charsyama8c9e9c2017-03-01 20:58:38 +09001388 [Base 2 log of system huge page size])],
Jason Evansc1baa0a2016-11-17 13:36:17 -08001389 [je_cv_lg_hugepage="${with_lg_hugepage}"],
1390 [je_cv_lg_hugepage=""])
1391if test "x${je_cv_lg_hugepage}" = "x" ; then
1392 dnl Look in /proc/meminfo (Linux-specific) for information on the default huge
1393 dnl page size, if any. The relevant line looks like:
1394 dnl
1395 dnl Hugepagesize: 2048 kB
1396 if test -e "/proc/meminfo" ; then
1397 hpsk=[`cat /proc/meminfo 2>/dev/null | \
1398 grep -e '^Hugepagesize:[[:space:]]\+[0-9]\+[[:space:]]kB$' | \
1399 awk '{print $2}'`]
1400 if test "x${hpsk}" != "x" ; then
1401 je_cv_lg_hugepage=10
1402 while test "${hpsk}" -gt 1 ; do
1403 hpsk="$((hpsk / 2))"
1404 je_cv_lg_hugepage="$((je_cv_lg_hugepage + 1))"
1405 done
1406 fi
1407 fi
1408
1409 dnl Set default if unable to automatically configure.
1410 if test "x${je_cv_lg_hugepage}" = "x" ; then
1411 je_cv_lg_hugepage=21
1412 fi
1413fi
Jason Evansc99e5702017-06-23 12:35:17 -07001414if test "x${LG_PAGE}" != "xundefined" -a \
1415 "${je_cv_lg_hugepage}" -lt "${LG_PAGE}" ; then
1416 AC_MSG_ERROR([Huge page size (2^${je_cv_lg_hugepage}) must be at least page size (2^${LG_PAGE})])
1417fi
Jason Evansc1baa0a2016-11-17 13:36:17 -08001418AC_DEFINE_UNQUOTED([LG_HUGEPAGE], [${je_cv_lg_hugepage}])
1419
Jason Evansfc0b3b72014-10-09 17:54:06 -07001420AC_ARG_WITH([lg_page_sizes],
1421 [AS_HELP_STRING([--with-lg-page-sizes=<lg-page-sizes>],
1422 [Base 2 logs of system page sizes to support])],
1423 [LG_PAGE_SIZES="$with_lg_page_sizes"], [LG_PAGE_SIZES="$LG_PAGE"])
1424
Jason Evansb7924f52009-06-23 19:01:18 -07001425dnl ============================================================================
1426dnl jemalloc configuration.
Tamir Duberstein96f14682017-07-06 14:50:55 -04001427dnl
Jason Evansa40bc7a2010-03-02 13:01:16 -08001428
Jason Evans434ea642016-03-14 20:19:11 -07001429AC_ARG_WITH([version],
1430 [AS_HELP_STRING([--with-version=<major>.<minor>.<bugfix>-<nrev>-g<gid>],
1431 [Version string])],
1432 [
1433 echo "${with_version}" | grep ['^[0-9]\+\.[0-9]\+\.[0-9]\+-[0-9]\+-g[0-9a-f]\+$'] 2>&1 1>/dev/null
Jason Evans31baedb2017-05-03 10:07:39 -07001434 if test $? -eq 0 ; then
1435 echo "$with_version" > "${objroot}VERSION"
1436 else
1437 echo "${with_version}" | grep ['^VERSION$'] 2>&1 1>/dev/null
1438 if test $? -ne 0 ; then
1439 AC_MSG_ERROR([${with_version} does not match <major>.<minor>.<bugfix>-<nrev>-g<gid> or VERSION])
1440 fi
Jason Evansa5a658a2014-09-02 15:07:07 -07001441 fi
Jason Evans434ea642016-03-14 20:19:11 -07001442 ], [
1443 dnl Set VERSION if source directory is inside a git repository.
1444 if test "x`test ! \"${srcroot}\" && cd \"${srcroot}\"; git rev-parse --is-inside-work-tree 2>/dev/null`" = "xtrue" ; then
1445 dnl Pattern globs aren't powerful enough to match both single- and
1446 dnl double-digit version numbers, so iterate over patterns to support up
1447 dnl to version 99.99.99 without any accidental matches.
1448 for pattern in ['[0-9].[0-9].[0-9]' '[0-9].[0-9].[0-9][0-9]' \
1449 '[0-9].[0-9][0-9].[0-9]' '[0-9].[0-9][0-9].[0-9][0-9]' \
1450 '[0-9][0-9].[0-9].[0-9]' '[0-9][0-9].[0-9].[0-9][0-9]' \
1451 '[0-9][0-9].[0-9][0-9].[0-9]' \
1452 '[0-9][0-9].[0-9][0-9].[0-9][0-9]']; do
1453 (test ! "${srcroot}" && cd "${srcroot}"; git describe --long --abbrev=40 --match="${pattern}") > "${objroot}VERSION.tmp" 2>/dev/null
1454 if test $? -eq 0 ; then
1455 mv "${objroot}VERSION.tmp" "${objroot}VERSION"
1456 break
1457 fi
1458 done
1459 fi
1460 rm -f "${objroot}VERSION.tmp"
1461 ])
1462
Dan McGregorf8880312014-12-23 16:10:08 -06001463if test ! -e "${objroot}VERSION" ; then
1464 if test ! -e "${srcroot}VERSION" ; then
1465 AC_MSG_RESULT(
1466 [Missing VERSION file, and unable to generate it; creating bogus VERSION])
1467 echo "0.0.0-0-g0000000000000000000000000000000000000000" > "${objroot}VERSION"
1468 else
1469 cp ${srcroot}VERSION ${objroot}VERSION
1470 fi
Jason Evansa5a658a2014-09-02 15:07:07 -07001471fi
Dan McGregorf8880312014-12-23 16:10:08 -06001472jemalloc_version=`cat "${objroot}VERSION"`
Jason Evansa40bc7a2010-03-02 13:01:16 -08001473jemalloc_version_major=`echo ${jemalloc_version} | tr ".g-" " " | awk '{print [$]1}'`
1474jemalloc_version_minor=`echo ${jemalloc_version} | tr ".g-" " " | awk '{print [$]2}'`
1475jemalloc_version_bugfix=`echo ${jemalloc_version} | tr ".g-" " " | awk '{print [$]3}'`
1476jemalloc_version_nrev=`echo ${jemalloc_version} | tr ".g-" " " | awk '{print [$]4}'`
1477jemalloc_version_gid=`echo ${jemalloc_version} | tr ".g-" " " | awk '{print [$]5}'`
Jason Evansb7924f52009-06-23 19:01:18 -07001478AC_SUBST([jemalloc_version])
Jason Evansa40bc7a2010-03-02 13:01:16 -08001479AC_SUBST([jemalloc_version_major])
1480AC_SUBST([jemalloc_version_minor])
1481AC_SUBST([jemalloc_version_bugfix])
1482AC_SUBST([jemalloc_version_nrev])
1483AC_SUBST([jemalloc_version_gid])
Jason Evansb7924f52009-06-23 19:01:18 -07001484
1485dnl ============================================================================
1486dnl Configure pthreads.
1487
Mike Hommeya19e87f2012-04-21 21:27:46 -07001488if test "x$abi" != "xpecoff" ; then
Qi Wangb693c782017-03-17 12:42:33 -07001489 AC_DEFINE([JEMALLOC_HAVE_PTHREAD], [ ])
Mike Hommeya19e87f2012-04-21 21:27:46 -07001490 AC_CHECK_HEADERS([pthread.h], , [AC_MSG_ERROR([pthread.h is missing])])
1491 dnl Some systems may embed pthreads functionality in libc; check for libpthread
1492 dnl first, but try libc too before failing.
Jason Evans194d6f92016-12-16 07:18:55 -08001493 AC_CHECK_LIB([pthread], [pthread_create], [JE_APPEND_VS(LIBS, -lpthread)],
Mike Hommeya19e87f2012-04-21 21:27:46 -07001494 [AC_SEARCH_LIBS([pthread_create], , ,
1495 AC_MSG_ERROR([libpthread is missing]))])
Qi Wangb693c782017-03-17 12:42:33 -07001496 wrap_syms="${wrap_syms} pthread_create"
Jason Evans13685ab2017-06-08 22:07:21 -07001497 have_pthread="1"
Qi Wangb693c782017-03-17 12:42:33 -07001498 dnl Check if we have dlsym support.
1499 have_dlsym="1"
1500 AC_CHECK_HEADERS([dlfcn.h],
1501 AC_CHECK_FUNC([dlsym], [],
1502 [AC_CHECK_LIB([dl], [dlsym], [LIBS="$LIBS -ldl"], [have_dlsym="0"])]),
1503 [have_dlsym="0"])
1504 if test "x$have_dlsym" = "x1" ; then
1505 AC_DEFINE([JEMALLOC_HAVE_DLSYM], [ ])
1506 fi
Jason Evans5234be22016-11-17 15:14:57 -08001507 JE_COMPILABLE([pthread_atfork(3)], [
1508#include <pthread.h>
1509], [
1510 pthread_atfork((void *)0, (void *)0, (void *)0);
1511], [je_cv_pthread_atfork])
1512 if test "x${je_cv_pthread_atfork}" = "xyes" ; then
1513 AC_DEFINE([JEMALLOC_HAVE_PTHREAD_ATFORK], [ ])
1514 fi
Qi Wanga3f49772017-06-23 09:58:35 -07001515 dnl Check if pthread_setname_np is available with the expected API.
1516 JE_COMPILABLE([pthread_setname_np(3)], [
1517#include <pthread.h>
1518], [
1519 pthread_setname_np(pthread_self(), "setname_test");
1520], [je_cv_pthread_setname_np])
1521 if test "x${je_cv_pthread_setname_np}" = "xyes" ; then
1522 AC_DEFINE([JEMALLOC_HAVE_PTHREAD_SETNAME_NP], [ ])
1523 fi
Mike Hommeya19e87f2012-04-21 21:27:46 -07001524fi
Jason Evansb7924f52009-06-23 19:01:18 -07001525
Jason Evans4a068642017-02-27 17:35:19 -08001526JE_APPEND_VS(CPPFLAGS, -D_REENTRANT)
Jason Evansb7924f52009-06-23 19:01:18 -07001527
Jason Evansc1e9cf42016-05-03 21:28:20 -07001528dnl Check whether clock_gettime(2) is in libc or librt.
1529AC_SEARCH_LIBS([clock_gettime], [rt])
Jason Evans345c1b02015-09-15 14:59:56 -07001530
Elliot Ronaghanae331472016-06-14 14:20:28 -07001531dnl Cray wrapper compiler often adds `-lrt` when using `-static`. Check with
1532dnl `-dynamic` as well in case a user tries to dynamically link in jemalloc
1533if test "x$je_cv_cray_prgenv_wrapper" = "xyes" ; then
1534 if test "$ac_cv_search_clock_gettime" != "-lrt"; then
Jason Evans194d6f92016-12-16 07:18:55 -08001535 JE_CFLAGS_SAVE()
Elliot Ronaghanae331472016-06-14 14:20:28 -07001536
1537 unset ac_cv_search_clock_gettime
Jason Evans194d6f92016-12-16 07:18:55 -08001538 JE_CFLAGS_ADD([-dynamic])
Elliot Ronaghanae331472016-06-14 14:20:28 -07001539 AC_SEARCH_LIBS([clock_gettime], [rt])
1540
Jason Evans194d6f92016-12-16 07:18:55 -08001541 JE_CFLAGS_RESTORE()
Elliot Ronaghanae331472016-06-14 14:20:28 -07001542 fi
1543fi
1544
Jason Evans6c803212016-10-29 22:55:08 -07001545dnl check for CLOCK_MONOTONIC_COARSE (Linux-specific).
1546JE_COMPILABLE([clock_gettime(CLOCK_MONOTONIC_COARSE, ...)], [
Jason Evanse0164bc2016-10-07 08:47:16 -07001547#include <time.h>
1548], [
1549 struct timespec ts;
1550
Jason Evans6c803212016-10-29 22:55:08 -07001551 clock_gettime(CLOCK_MONOTONIC_COARSE, &ts);
1552], [je_cv_clock_monotonic_coarse])
1553if test "x${je_cv_clock_monotonic_coarse}" = "xyes" ; then
1554 AC_DEFINE([JEMALLOC_HAVE_CLOCK_MONOTONIC_COARSE])
Jason Evanse0164bc2016-10-07 08:47:16 -07001555fi
1556
1557dnl check for CLOCK_MONOTONIC.
1558JE_COMPILABLE([clock_gettime(CLOCK_MONOTONIC, ...)], [
1559#include <unistd.h>
1560#include <time.h>
1561], [
1562 struct timespec ts;
1563
1564 clock_gettime(CLOCK_MONOTONIC, &ts);
1565#if !defined(_POSIX_MONOTONIC_CLOCK) || _POSIX_MONOTONIC_CLOCK < 0
1566# error _POSIX_MONOTONIC_CLOCK missing/invalid
1567#endif
1568], [je_cv_clock_monotonic])
1569if test "x${je_cv_clock_monotonic}" = "xyes" ; then
1570 AC_DEFINE([JEMALLOC_HAVE_CLOCK_MONOTONIC])
1571fi
1572
1573dnl Check for mach_absolute_time().
1574JE_COMPILABLE([mach_absolute_time()], [
1575#include <mach/mach_time.h>
1576], [
1577 mach_absolute_time();
1578], [je_cv_mach_absolute_time])
1579if test "x${je_cv_mach_absolute_time}" = "xyes" ; then
1580 AC_DEFINE([JEMALLOC_HAVE_MACH_ABSOLUTE_TIME])
1581fi
1582
Jason Evansacb7b1f2016-12-03 16:47:36 -08001583dnl Use syscall(2) (if available) by default.
1584AC_ARG_ENABLE([syscall],
1585 [AS_HELP_STRING([--disable-syscall], [Disable use of syscall(2)])],
1586[if test "x$enable_syscall" = "xno" ; then
1587 enable_syscall="0"
1588else
1589 enable_syscall="1"
1590fi
1591],
1592[enable_syscall="1"]
1593)
1594if test "x$enable_syscall" = "x1" ; then
1595 dnl Check if syscall(2) is usable. Treat warnings as errors, so that e.g. OS
1596 dnl X 10.12's deprecation warning prevents use.
Jason Evans194d6f92016-12-16 07:18:55 -08001597 JE_CFLAGS_SAVE()
1598 JE_CFLAGS_ADD([-Werror])
Jason Evansacb7b1f2016-12-03 16:47:36 -08001599 JE_COMPILABLE([syscall(2)], [
Jason Evansd82f2b32016-11-02 19:18:33 -07001600#include <sys/syscall.h>
1601#include <unistd.h>
1602], [
1603 syscall(SYS_write, 2, "hello", 5);
1604],
Jason Evansacb7b1f2016-12-03 16:47:36 -08001605 [je_cv_syscall])
Jason Evans194d6f92016-12-16 07:18:55 -08001606 JE_CFLAGS_RESTORE()
Jason Evansacb7b1f2016-12-03 16:47:36 -08001607 if test "x$je_cv_syscall" = "xyes" ; then
1608 AC_DEFINE([JEMALLOC_USE_SYSCALL], [ ])
1609 fi
Jason Evansd82f2b32016-11-02 19:18:33 -07001610fi
1611
Daniel Micayb74041f2014-12-09 17:41:34 -05001612dnl Check if the GNU-specific secure_getenv function exists.
1613AC_CHECK_FUNC([secure_getenv],
1614 [have_secure_getenv="1"],
1615 [have_secure_getenv="0"]
1616 )
1617if test "x$have_secure_getenv" = "x1" ; then
1618 AC_DEFINE([JEMALLOC_HAVE_SECURE_GETENV], [ ])
1619fi
1620
Qi Wangec532e22017-02-02 17:02:05 -08001621dnl Check if the GNU-specific sched_getcpu function exists.
1622AC_CHECK_FUNC([sched_getcpu],
1623 [have_sched_getcpu="1"],
1624 [have_sched_getcpu="0"]
1625 )
1626if test "x$have_sched_getcpu" = "x1" ; then
1627 AC_DEFINE([JEMALLOC_HAVE_SCHED_GETCPU], [ ])
1628fi
1629
Qi Wangb693c782017-03-17 12:42:33 -07001630dnl Check if the GNU-specific sched_setaffinity function exists.
1631AC_CHECK_FUNC([sched_setaffinity],
1632 [have_sched_setaffinity="1"],
1633 [have_sched_setaffinity="0"]
1634 )
1635if test "x$have_sched_setaffinity" = "x1" ; then
1636 AC_DEFINE([JEMALLOC_HAVE_SCHED_SETAFFINITY], [ ])
1637fi
1638
Daniel Micayb74041f2014-12-09 17:41:34 -05001639dnl Check if the Solaris/BSD issetugid function exists.
1640AC_CHECK_FUNC([issetugid],
1641 [have_issetugid="1"],
1642 [have_issetugid="0"]
1643 )
1644if test "x$have_issetugid" = "x1" ; then
1645 AC_DEFINE([JEMALLOC_HAVE_ISSETUGID], [ ])
1646fi
1647
Jason Evanscd9a1342012-03-21 18:33:03 -07001648dnl Check whether the BSD-specific _malloc_thread_cleanup() exists. If so, use
1649dnl it rather than pthreads TSD cleanup functions to support cleanup during
1650dnl thread exit, in order to avoid pthreads library recursion during
1651dnl bootstrapping.
Jason Evanscd9a1342012-03-21 18:33:03 -07001652AC_CHECK_FUNC([_malloc_thread_cleanup],
1653 [have__malloc_thread_cleanup="1"],
1654 [have__malloc_thread_cleanup="0"]
1655 )
1656if test "x$have__malloc_thread_cleanup" = "x1" ; then
1657 AC_DEFINE([JEMALLOC_MALLOC_THREAD_CLEANUP], [ ])
Jason Evans909f0482017-05-04 11:20:43 -07001658 wrap_syms="${wrap_syms} _malloc_thread_cleanup"
Jason Evanscd9a1342012-03-21 18:33:03 -07001659 force_tls="1"
1660fi
1661
Jason Evans41b6afb2012-02-02 22:04:57 -08001662dnl Check whether the BSD-specific _pthread_mutex_init_calloc_cb() exists. If
1663dnl so, mutex initialization causes allocation, and we need to implement this
1664dnl callback function in order to prevent recursive allocation.
1665AC_CHECK_FUNC([_pthread_mutex_init_calloc_cb],
1666 [have__pthread_mutex_init_calloc_cb="1"],
1667 [have__pthread_mutex_init_calloc_cb="0"]
1668 )
1669if test "x$have__pthread_mutex_init_calloc_cb" = "x1" ; then
1670 AC_DEFINE([JEMALLOC_MUTEX_INIT_CB])
Jason Evans909f0482017-05-04 11:20:43 -07001671 wrap_syms="${wrap_syms} _malloc_prefork _malloc_postfork"
Jason Evans41b6afb2012-02-02 22:04:57 -08001672fi
1673
Jason Evans0fee70d2012-02-13 12:36:11 -08001674dnl Disable lazy locking by default.
Jason Evansb7924f52009-06-23 19:01:18 -07001675AC_ARG_ENABLE([lazy_lock],
Jason Evans0fee70d2012-02-13 12:36:11 -08001676 [AS_HELP_STRING([--enable-lazy-lock],
1677 [Enable lazy locking (only lock when multi-threaded)])],
Jason Evansb7924f52009-06-23 19:01:18 -07001678[if test "x$enable_lazy_lock" = "xno" ; then
1679 enable_lazy_lock="0"
1680else
1681 enable_lazy_lock="1"
1682fi
1683],
Mike Hommeyac5db022015-08-11 14:01:59 +09001684[enable_lazy_lock=""]
Jason Evansb7924f52009-06-23 19:01:18 -07001685)
Jason Evanseee1ca62016-11-02 08:54:07 -07001686if test "x${enable_lazy_lock}" = "x" ; then
1687 if test "x${force_lazy_lock}" = "x1" ; then
1688 AC_MSG_RESULT([Forcing lazy-lock to avoid allocator/threading bootstrap issues])
1689 enable_lazy_lock="1"
1690 else
1691 enable_lazy_lock="0"
1692 fi
1693fi
1694if test "x${enable_lazy_lock}" = "x1" -a "x${abi}" = "xpecoff" ; then
1695 AC_MSG_RESULT([Forcing no lazy-lock because thread creation monitoring is unimplemented])
1696 enable_lazy_lock="0"
Jason Evansfd4fcef2012-03-23 17:40:58 -07001697fi
Jason Evansb7924f52009-06-23 19:01:18 -07001698if test "x$enable_lazy_lock" = "x1" ; then
Qi Wangb693c782017-03-17 12:42:33 -07001699 if test "x$have_dlsym" = "x1" ; then
1700 AC_DEFINE([JEMALLOC_LAZY_LOCK], [ ])
1701 else
1702 AC_MSG_ERROR([Missing dlsym support: lazy-lock cannot be enabled.])
Mike Hommeya19e87f2012-04-21 21:27:46 -07001703 fi
Jason Evansb7924f52009-06-23 19:01:18 -07001704fi
1705AC_SUBST([enable_lazy_lock])
1706
Jason Evansb2a84532017-04-21 10:07:01 -07001707dnl Automatically configure TLS.
1708if test "x${force_tls}" = "x1" ; then
1709 enable_tls="1"
1710elif test "x${force_tls}" = "x0" ; then
Jason Evans78d815c2010-01-17 14:06:20 -08001711 enable_tls="0"
1712else
1713 enable_tls="1"
1714fi
Jason Evans78d815c2010-01-17 14:06:20 -08001715if test "x${enable_tls}" = "x1" ; then
1716AC_MSG_CHECKING([for TLS])
Jason Evans6684cac2012-03-05 12:15:36 -08001717AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
Jason Evans78d815c2010-01-17 14:06:20 -08001718[[
1719 __thread int x;
1720]], [[
1721 x = 42;
1722
1723 return 0;
1724]])],
1725 AC_MSG_RESULT([yes]),
1726 AC_MSG_RESULT([no])
1727 enable_tls="0")
Mike Hommeyac5db022015-08-11 14:01:59 +09001728else
1729 enable_tls="0"
Jason Evans78d815c2010-01-17 14:06:20 -08001730fi
Jason Evansb267d0f2010-08-13 15:42:29 -07001731AC_SUBST([enable_tls])
Jason Evanse24c7af2012-03-19 10:21:17 -07001732if test "x${enable_tls}" = "x1" ; then
1733 AC_DEFINE_UNQUOTED([JEMALLOC_TLS], [ ])
Jason Evans78d815c2010-01-17 14:06:20 -08001734fi
1735
Jason Evans2dbecf12010-09-05 10:35:13 -07001736dnl ============================================================================
Chih-hung Hsieh59cd80e2014-12-05 17:42:41 -08001737dnl Check for C11 atomics.
1738
1739JE_COMPILABLE([C11 atomics], [
1740#include <stdint.h>
1741#if (__STDC_VERSION__ >= 201112L) && !defined(__STDC_NO_ATOMICS__)
1742#include <stdatomic.h>
1743#else
1744#error Atomics not available
1745#endif
1746], [
1747 uint64_t *p = (uint64_t *)0;
1748 uint64_t x = 1;
1749 volatile atomic_uint_least64_t *a = (volatile atomic_uint_least64_t *)p;
1750 uint64_t r = atomic_fetch_add(a, x) + x;
Jason Evansf4086432017-01-19 18:15:45 -08001751 return r == 0;
David Goldblattd4ac7582017-01-25 09:54:27 -08001752], [je_cv_c11_atomics])
1753if test "x${je_cv_c11_atomics}" = "xyes" ; then
1754 AC_DEFINE([JEMALLOC_C11_ATOMICS])
Chih-hung Hsieh59cd80e2014-12-05 17:42:41 -08001755fi
1756
1757dnl ============================================================================
David Goldblattd4ac7582017-01-25 09:54:27 -08001758dnl Check for GCC-style __atomic atomics.
Jason Evansb57d3ec2012-04-17 13:17:54 -07001759
David Goldblattd4ac7582017-01-25 09:54:27 -08001760JE_COMPILABLE([GCC __atomic atomics], [
Jason Evansb57d3ec2012-04-17 13:17:54 -07001761], [
David Goldblattd4ac7582017-01-25 09:54:27 -08001762 int x = 0;
1763 int val = 1;
1764 int y = __atomic_fetch_add(&x, val, __ATOMIC_RELAXED);
1765 int after_add = x;
1766 return after_add == 1;
1767], [je_cv_gcc_atomic_atomics])
1768if test "x${je_cv_gcc_atomic_atomics}" = "xyes" ; then
1769 AC_DEFINE([JEMALLOC_GCC_ATOMIC_ATOMICS])
1770fi
1771
1772dnl ============================================================================
1773dnl Check for GCC-style __sync atomics.
1774
1775JE_COMPILABLE([GCC __sync atomics], [
1776], [
1777 int x = 0;
1778 int before_add = __sync_fetch_and_add(&x, 1);
1779 int after_add = x;
1780 return (before_add == 0) && (after_add == 1);
1781], [je_cv_gcc_sync_atomics])
1782if test "x${je_cv_gcc_sync_atomics}" = "xyes" ; then
1783 AC_DEFINE([JEMALLOC_GCC_SYNC_ATOMICS])
Jason Evansb57d3ec2012-04-17 13:17:54 -07001784fi
1785
1786dnl ============================================================================
Jason Evans763baa62011-03-18 19:10:31 -07001787dnl Check for atomic(3) operations as provided on Darwin.
David Goldblattd4ac7582017-01-25 09:54:27 -08001788dnl We need this not for the atomic operations (which are provided above), but
1789dnl rather for the OSSpinLock type it exposes.
Jason Evans763baa62011-03-18 19:10:31 -07001790
1791JE_COMPILABLE([Darwin OSAtomic*()], [
1792#include <libkern/OSAtomic.h>
1793#include <inttypes.h>
1794], [
1795 {
1796 int32_t x32 = 0;
1797 volatile int32_t *x32p = &x32;
1798 OSAtomicAdd32(1, x32p);
1799 }
1800 {
1801 int64_t x64 = 0;
1802 volatile int64_t *x64p = &x64;
1803 OSAtomicAdd64(1, x64p);
1804 }
Jason Evans6684cac2012-03-05 12:15:36 -08001805], [je_cv_osatomic])
1806if test "x${je_cv_osatomic}" = "xyes" ; then
Jason Evanse24c7af2012-03-19 10:21:17 -07001807 AC_DEFINE([JEMALLOC_OSATOMIC], [ ])
Jason Evans763baa62011-03-18 19:10:31 -07001808fi
1809
1810dnl ============================================================================
Richard Diamond994fad92014-06-03 02:39:18 -05001811dnl Check for madvise(2).
1812
1813JE_COMPILABLE([madvise(2)], [
1814#include <sys/mman.h>
1815], [
Jason Evansa64123c2016-11-17 10:24:51 -08001816 madvise((void *)0, 0, 0);
Richard Diamond994fad92014-06-03 02:39:18 -05001817], [je_cv_madvise])
1818if test "x${je_cv_madvise}" = "xyes" ; then
Jason Evansc1baa0a2016-11-17 13:36:17 -08001819 AC_DEFINE([JEMALLOC_HAVE_MADVISE], [ ])
1820
Jason Evansa64123c2016-11-17 10:24:51 -08001821 dnl Check for madvise(..., MADV_FREE).
1822 JE_COMPILABLE([madvise(..., MADV_FREE)], [
1823#include <sys/mman.h>
1824], [
1825 madvise((void *)0, 0, MADV_FREE);
1826], [je_cv_madv_free])
1827 if test "x${je_cv_madv_free}" = "xyes" ; then
1828 AC_DEFINE([JEMALLOC_PURGE_MADVISE_FREE], [ ])
Qi Wang31ab38b2017-10-05 16:28:55 -07001829 elif test "x${je_cv_madvise}" = "xyes" ; then
1830 case "${host_cpu}" in i686|x86_64)
1831 case "${host}" in *-*-linux*)
1832 AC_DEFINE([JEMALLOC_PURGE_MADVISE_FREE], [ ])
1833 AC_DEFINE([JEMALLOC_DEFINE_MADVISE_FREE], [ ])
1834 ;;
1835 esac
1836 ;;
1837 esac
Jason Evansa64123c2016-11-17 10:24:51 -08001838 fi
1839
1840 dnl Check for madvise(..., MADV_DONTNEED).
1841 JE_COMPILABLE([madvise(..., MADV_DONTNEED)], [
1842#include <sys/mman.h>
1843], [
1844 madvise((void *)0, 0, MADV_DONTNEED);
1845], [je_cv_madv_dontneed])
1846 if test "x${je_cv_madv_dontneed}" = "xyes" ; then
1847 AC_DEFINE([JEMALLOC_PURGE_MADVISE_DONTNEED], [ ])
1848 fi
1849
David Goldblattccd09052017-09-18 15:03:52 -07001850 dnl Check for madvise(..., MADV_DO[NT]DUMP).
1851 JE_COMPILABLE([madvise(..., MADV_DO[[NT]]DUMP)], [
1852#include <sys/mman.h>
1853], [
1854 madvise((void *)0, 0, MADV_DONTDUMP);
1855 madvise((void *)0, 0, MADV_DODUMP);
1856], [je_cv_madv_dontdump])
1857 if test "x${je_cv_madv_dontdump}" = "xyes" ; then
1858 AC_DEFINE([JEMALLOC_MADVISE_DONTDUMP], [ ])
1859 fi
1860
Jason Evansc1baa0a2016-11-17 13:36:17 -08001861 dnl Check for madvise(..., MADV_[NO]HUGEPAGE).
1862 JE_COMPILABLE([madvise(..., MADV_[[NO]]HUGEPAGE)], [
1863#include <sys/mman.h>
1864], [
1865 madvise((void *)0, 0, MADV_HUGEPAGE);
1866 madvise((void *)0, 0, MADV_NOHUGEPAGE);
1867], [je_cv_thp])
marxin433c2ed2018-01-02 10:29:19 +01001868case "${host_cpu}" in
1869 arm*)
1870 ;;
1871 *)
Qi Wang8fdd9a52017-08-10 13:14:26 -07001872 if test "x${je_cv_thp}" = "xyes" ; then
1873 AC_DEFINE([JEMALLOC_HAVE_MADVISE_HUGE], [ ])
1874 fi
marxin433c2ed2018-01-02 10:29:19 +01001875 ;;
1876esac
Richard Diamond994fad92014-06-03 02:39:18 -05001877fi
1878
Jason Evansc606a872017-05-30 09:54:49 -07001879dnl Enable transparent huge page support by default.
1880AC_ARG_ENABLE([thp],
1881 [AS_HELP_STRING([--disable-thp],
1882 [Disable transparent huge page support])],
1883[if test "x$enable_thp" = "xno" -o "x${je_cv_thp}" != "xyes" ; then
1884 enable_thp="0"
1885else
1886 enable_thp="1"
1887fi
1888],
1889[if test "x${je_cv_thp}" = "xyes" ; then
1890 enable_thp="1"
1891else
1892 enable_thp="0"
1893fi
1894])
1895if test "x$enable_thp" = "x1" ; then
1896 AC_DEFINE([JEMALLOC_THP], [ ])
1897fi
1898AC_SUBST([enable_thp])
1899
Richard Diamond994fad92014-06-03 02:39:18 -05001900dnl ============================================================================
Mike Hommeyc1e567b2012-03-26 17:03:41 +02001901dnl Check whether __sync_{add,sub}_and_fetch() are available despite
1902dnl __GCC_HAVE_SYNC_COMPARE_AND_SWAP_n macros being undefined.
1903
1904AC_DEFUN([JE_SYNC_COMPARE_AND_SWAP_CHECK],[
1905 AC_CACHE_CHECK([whether to force $1-bit __sync_{add,sub}_and_fetch()],
1906 [je_cv_sync_compare_and_swap_$2],
Mike Hommey2cfe6d62012-03-27 15:03:07 +02001907 [AC_LINK_IFELSE([AC_LANG_PROGRAM([
1908 #include <stdint.h>
1909 ],
1910 [
1911 #ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_$2
1912 {
1913 uint$1_t x$1 = 0;
1914 __sync_add_and_fetch(&x$1, 42);
1915 __sync_sub_and_fetch(&x$1, 1);
1916 }
1917 #else
1918 #error __GCC_HAVE_SYNC_COMPARE_AND_SWAP_$2 is defined, no need to force
1919 #endif
1920 ])],
Mike Hommeyc1e567b2012-03-26 17:03:41 +02001921 [je_cv_sync_compare_and_swap_$2=yes],
1922 [je_cv_sync_compare_and_swap_$2=no])])
1923
1924 if test "x${je_cv_sync_compare_and_swap_$2}" = "xyes" ; then
1925 AC_DEFINE([JE_FORCE_SYNC_COMPARE_AND_SWAP_$2], [ ])
1926 fi
1927])
1928
Jason Evansb57d3ec2012-04-17 13:17:54 -07001929if test "x${je_cv_atomic9}" != "xyes" -a "x${je_cv_osatomic}" != "xyes" ; then
Mike Hommeyc1e567b2012-03-26 17:03:41 +02001930 JE_SYNC_COMPARE_AND_SWAP_CHECK(32, 4)
1931 JE_SYNC_COMPARE_AND_SWAP_CHECK(64, 8)
1932fi
1933
1934dnl ============================================================================
Jason Evansd04047c2014-05-28 16:11:55 -07001935dnl Check for __builtin_clz() and __builtin_clzl().
1936
1937AC_CACHE_CHECK([for __builtin_clz],
1938 [je_cv_builtin_clz],
1939 [AC_LINK_IFELSE([AC_LANG_PROGRAM([],
1940 [
1941 {
1942 unsigned x = 0;
1943 int y = __builtin_clz(x);
1944 }
1945 {
1946 unsigned long x = 0;
1947 int y = __builtin_clzl(x);
1948 }
1949 ])],
1950 [je_cv_builtin_clz=yes],
1951 [je_cv_builtin_clz=no])])
1952
1953if test "x${je_cv_builtin_clz}" = "xyes" ; then
1954 AC_DEFINE([JEMALLOC_HAVE_BUILTIN_CLZ], [ ])
1955fi
1956
1957dnl ============================================================================
Jason Evans795f6682016-11-02 18:09:45 -07001958dnl Check for os_unfair_lock operations as provided on Darwin.
1959
Jason Evans4066b4e2016-11-16 10:40:00 -08001960JE_COMPILABLE([Darwin os_unfair_lock_*()], [
Jason Evans795f6682016-11-02 18:09:45 -07001961#include <os/lock.h>
John Szakmeistereb29d7e2016-11-23 15:32:35 -05001962#include <AvailabilityMacros.h>
Jason Evans795f6682016-11-02 18:09:45 -07001963], [
John Szakmeistereb29d7e2016-11-23 15:32:35 -05001964 #if MAC_OS_X_VERSION_MIN_REQUIRED < 101200
1965 #error "os_unfair_lock is not supported"
1966 #else
Jason Evans795f6682016-11-02 18:09:45 -07001967 os_unfair_lock lock = OS_UNFAIR_LOCK_INIT;
1968 os_unfair_lock_lock(&lock);
1969 os_unfair_lock_unlock(&lock);
John Szakmeistereb29d7e2016-11-23 15:32:35 -05001970 #endif
Jason Evans795f6682016-11-02 18:09:45 -07001971], [je_cv_os_unfair_lock])
1972if test "x${je_cv_os_unfair_lock}" = "xyes" ; then
1973 AC_DEFINE([JEMALLOC_OS_UNFAIR_LOCK], [ ])
1974fi
1975
1976dnl ============================================================================
Jason Evans893a0ed2011-03-18 19:30:18 -07001977dnl Check for spinlock(3) operations as provided on Darwin.
1978
1979JE_COMPILABLE([Darwin OSSpin*()], [
1980#include <libkern/OSAtomic.h>
1981#include <inttypes.h>
1982], [
1983 OSSpinLock lock = 0;
1984 OSSpinLockLock(&lock);
1985 OSSpinLockUnlock(&lock);
Jason Evans6684cac2012-03-05 12:15:36 -08001986], [je_cv_osspin])
1987if test "x${je_cv_osspin}" = "xyes" ; then
Jason Evanse24c7af2012-03-19 10:21:17 -07001988 AC_DEFINE([JEMALLOC_OSSPIN], [ ])
Jason Evans893a0ed2011-03-18 19:30:18 -07001989fi
1990
1991dnl ============================================================================
Jason Evans2dbecf12010-09-05 10:35:13 -07001992dnl Darwin-related configuration.
Jason Evans78d815c2010-01-17 14:06:20 -08001993
Mike Hommeyd0357f72012-11-26 18:52:41 +01001994AC_ARG_ENABLE([zone-allocator],
1995 [AS_HELP_STRING([--disable-zone-allocator],
1996 [Disable zone allocator for Darwin])],
1997[if test "x$enable_zone_allocator" = "xno" ; then
1998 enable_zone_allocator="0"
1999else
2000 enable_zone_allocator="1"
2001fi
2002],
2003[if test "x${abi}" = "xmacho"; then
2004 enable_zone_allocator="1"
2005fi
2006]
2007)
2008AC_SUBST([enable_zone_allocator])
2009
2010if test "x${enable_zone_allocator}" = "x1" ; then
2011 if test "x${abi}" != "xmacho"; then
2012 AC_MSG_ERROR([--enable-zone-allocator is only supported on Darwin])
2013 fi
Jason Evanse24c7af2012-03-19 10:21:17 -07002014 AC_DEFINE([JEMALLOC_ZONE], [ ])
Jason Evansb27805b2010-02-10 18:15:53 -08002015fi
2016
Jason Evansb7924f52009-06-23 19:01:18 -07002017dnl ============================================================================
Jason Evans13685ab2017-06-08 22:07:21 -07002018dnl Enable background threads if possible.
2019
2020if test "x${have_pthread}" = "x1" -a "x${have_dlsym}" = "x1" \
2021 -a "x${je_cv_os_unfair_lock}" != "xyes" \
2022 -a "x${je_cv_osspin}" != "xyes" ; then
2023 AC_DEFINE([JEMALLOC_BACKGROUND_THREAD])
2024fi
2025
2026dnl ============================================================================
Sara Golemon3e24afa2014-08-18 13:06:39 -07002027dnl Check for glibc malloc hooks
2028
2029JE_COMPILABLE([glibc malloc hook], [
2030#include <stddef.h>
2031
2032extern void (* __free_hook)(void *ptr);
2033extern void *(* __malloc_hook)(size_t size);
2034extern void *(* __realloc_hook)(void *ptr, size_t size);
2035], [
2036 void *ptr = 0L;
2037 if (__malloc_hook) ptr = __malloc_hook(1);
2038 if (__realloc_hook) ptr = __realloc_hook(ptr, 2);
2039 if (__free_hook && ptr) __free_hook(ptr);
2040], [je_cv_glibc_malloc_hook])
2041if test "x${je_cv_glibc_malloc_hook}" = "xyes" ; then
Jason Evans909f0482017-05-04 11:20:43 -07002042 if test "x${JEMALLOC_PREFIX}" = "x" ; then
2043 AC_DEFINE([JEMALLOC_GLIBC_MALLOC_HOOK], [ ])
2044 wrap_syms="${wrap_syms} __free_hook __malloc_hook __realloc_hook"
2045 fi
Sara Golemon3e24afa2014-08-18 13:06:39 -07002046fi
2047
2048JE_COMPILABLE([glibc memalign hook], [
2049#include <stddef.h>
2050
2051extern void *(* __memalign_hook)(size_t alignment, size_t size);
2052], [
2053 void *ptr = 0L;
2054 if (__memalign_hook) ptr = __memalign_hook(16, 7);
2055], [je_cv_glibc_memalign_hook])
2056if test "x${je_cv_glibc_memalign_hook}" = "xyes" ; then
Jason Evans909f0482017-05-04 11:20:43 -07002057 if test "x${JEMALLOC_PREFIX}" = "x" ; then
2058 AC_DEFINE([JEMALLOC_GLIBC_MEMALIGN_HOOK], [ ])
2059 wrap_syms="${wrap_syms} __memalign_hook"
2060 fi
Sara Golemon3e24afa2014-08-18 13:06:39 -07002061fi
2062
Eric Wong4dcf04b2014-08-31 03:57:06 +00002063JE_COMPILABLE([pthreads adaptive mutexes], [
2064#include <pthread.h>
2065], [
2066 pthread_mutexattr_t attr;
2067 pthread_mutexattr_init(&attr);
2068 pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ADAPTIVE_NP);
2069 pthread_mutexattr_destroy(&attr);
2070], [je_cv_pthread_mutex_adaptive_np])
2071if test "x${je_cv_pthread_mutex_adaptive_np}" = "xyes" ; then
2072 AC_DEFINE([JEMALLOC_HAVE_PTHREAD_MUTEX_ADAPTIVE_NP], [ ])
2073fi
2074
Christopher Ferrisf78d4ca2017-09-22 12:24:50 -07002075JE_CFLAGS_SAVE()
2076JE_CFLAGS_ADD([-D_GNU_SOURCE])
2077JE_CFLAGS_ADD([-Werror])
2078JE_CFLAGS_ADD([-herror_on_warning])
2079JE_COMPILABLE([strerror_r returns char with gnu source], [
2080#include <errno.h>
2081#include <stdio.h>
2082#include <stdlib.h>
2083#include <string.h>
2084], [
2085 char *buffer = (char *) malloc(100);
2086 char *error = strerror_r(EINVAL, buffer, 100);
2087 printf("%s\n", error);
2088], [je_cv_strerror_r_returns_char_with_gnu_source])
2089JE_CFLAGS_RESTORE()
2090if test "x${je_cv_strerror_r_returns_char_with_gnu_source}" = "xyes" ; then
2091 AC_DEFINE([JEMALLOC_STRERROR_R_RETURNS_CHAR_WITH_GNU_SOURCE], [ ])
2092fi
2093
Sara Golemon3e24afa2014-08-18 13:06:39 -07002094dnl ============================================================================
Jason Evansb7924f52009-06-23 19:01:18 -07002095dnl Check for typedefs, structures, and compiler characteristics.
2096AC_HEADER_STDBOOL
2097
Jason Evans748dfac2013-12-06 18:27:33 -08002098dnl ============================================================================
2099dnl Define commands that generate output files.
2100
Jason Evansf234dc52014-01-16 17:38:01 -08002101AC_CONFIG_COMMANDS([include/jemalloc/internal/public_symbols.txt], [
2102 f="${objroot}include/jemalloc/internal/public_symbols.txt"
2103 mkdir -p "${objroot}include/jemalloc/internal"
2104 cp /dev/null "${f}"
2105 for nm in `echo ${mangling_map} |tr ',' ' '` ; do
2106 n=`echo ${nm} |tr ':' ' ' |awk '{print $[]1}'`
2107 m=`echo ${nm} |tr ':' ' ' |awk '{print $[]2}'`
2108 echo "${n}:${m}" >> "${f}"
2109 dnl Remove name from public_syms so that it isn't redefined later.
2110 public_syms=`for sym in ${public_syms}; do echo "${sym}"; done |grep -v "^${n}\$" |tr '\n' ' '`
2111 done
2112 for sym in ${public_syms} ; do
2113 n="${sym}"
2114 m="${JEMALLOC_PREFIX}${sym}"
2115 echo "${n}:${m}" >> "${f}"
2116 done
2117], [
2118 srcdir="${srcdir}"
2119 objroot="${objroot}"
2120 mangling_map="${mangling_map}"
2121 public_syms="${public_syms}"
2122 JEMALLOC_PREFIX="${JEMALLOC_PREFIX}"
Jason Evans86abd0d2013-11-30 15:25:42 -08002123])
Jason Evans909f0482017-05-04 11:20:43 -07002124AC_CONFIG_COMMANDS([include/jemalloc/internal/private_symbols.awk], [
2125 f="${objroot}include/jemalloc/internal/private_symbols.awk"
2126 mkdir -p "${objroot}include/jemalloc/internal"
2127 export_syms=`for sym in ${public_syms}; do echo "${JEMALLOC_PREFIX}${sym}"; done; for sym in ${wrap_syms}; do echo "${sym}"; done;`
2128 "${srcdir}/include/jemalloc/internal/private_symbols.sh" "${SYM_PREFIX}" ${export_syms} > "${objroot}include/jemalloc/internal/private_symbols.awk"
2129], [
2130 srcdir="${srcdir}"
2131 objroot="${objroot}"
2132 public_syms="${public_syms}"
2133 wrap_syms="${wrap_syms}"
2134 SYM_PREFIX="${SYM_PREFIX}"
2135 JEMALLOC_PREFIX="${JEMALLOC_PREFIX}"
2136])
2137AC_CONFIG_COMMANDS([include/jemalloc/internal/private_symbols_jet.awk], [
2138 f="${objroot}include/jemalloc/internal/private_symbols_jet.awk"
2139 mkdir -p "${objroot}include/jemalloc/internal"
2140 export_syms=`for sym in ${public_syms}; do echo "jet_${sym}"; done; for sym in ${wrap_syms}; do echo "${sym}"; done;`
2141 "${srcdir}/include/jemalloc/internal/private_symbols.sh" "${SYM_PREFIX}" ${export_syms} > "${objroot}include/jemalloc/internal/private_symbols_jet.awk"
2142], [
2143 srcdir="${srcdir}"
2144 objroot="${objroot}"
2145 public_syms="${public_syms}"
2146 wrap_syms="${wrap_syms}"
2147 SYM_PREFIX="${SYM_PREFIX}"
2148])
Jason Evans86abd0d2013-11-30 15:25:42 -08002149AC_CONFIG_COMMANDS([include/jemalloc/internal/public_namespace.h], [
2150 mkdir -p "${objroot}include/jemalloc/internal"
Jason Evansf234dc52014-01-16 17:38:01 -08002151 "${srcdir}/include/jemalloc/internal/public_namespace.sh" "${objroot}include/jemalloc/internal/public_symbols.txt" > "${objroot}include/jemalloc/internal/public_namespace.h"
2152], [
2153 srcdir="${srcdir}"
2154 objroot="${objroot}"
Jason Evans86abd0d2013-11-30 15:25:42 -08002155])
2156AC_CONFIG_COMMANDS([include/jemalloc/internal/public_unnamespace.h], [
2157 mkdir -p "${objroot}include/jemalloc/internal"
Jason Evansf234dc52014-01-16 17:38:01 -08002158 "${srcdir}/include/jemalloc/internal/public_unnamespace.sh" "${objroot}include/jemalloc/internal/public_symbols.txt" > "${objroot}include/jemalloc/internal/public_unnamespace.h"
2159], [
2160 srcdir="${srcdir}"
2161 objroot="${objroot}"
Jason Evans86abd0d2013-11-30 15:25:42 -08002162])
Jason Evansb1726102012-02-28 16:50:47 -08002163AC_CONFIG_COMMANDS([include/jemalloc/internal/size_classes.h], [
Jason Evans86abd0d2013-11-30 15:25:42 -08002164 mkdir -p "${objroot}include/jemalloc/internal"
Jason Evansaf76f0e2017-04-21 15:35:54 -07002165 "${SHELL}" "${srcdir}/include/jemalloc/internal/size_classes.sh" "${LG_QUANTA}" 3 "${LG_PAGE_SIZES}" 2 > "${objroot}include/jemalloc/internal/size_classes.h"
Jason Evansf234dc52014-01-16 17:38:01 -08002166], [
Jason Evans6d919292015-09-15 10:42:36 -07002167 SHELL="${SHELL}"
Jason Evansf234dc52014-01-16 17:38:01 -08002168 srcdir="${srcdir}"
2169 objroot="${objroot}"
Jason Evans81e54752014-10-10 22:34:25 -07002170 LG_QUANTA="${LG_QUANTA}"
Jason Evans81e54752014-10-10 22:34:25 -07002171 LG_PAGE_SIZES="${LG_PAGE_SIZES}"
Jason Evansb1726102012-02-28 16:50:47 -08002172])
Jason Evans86abd0d2013-11-30 15:25:42 -08002173AC_CONFIG_COMMANDS([include/jemalloc/jemalloc_protos_jet.h], [
2174 mkdir -p "${objroot}include/jemalloc"
2175 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 -08002176], [
2177 srcdir="${srcdir}"
2178 objroot="${objroot}"
2179])
2180AC_CONFIG_COMMANDS([include/jemalloc/jemalloc_rename.h], [
2181 mkdir -p "${objroot}include/jemalloc"
2182 "${srcdir}/include/jemalloc/jemalloc_rename.sh" "${objroot}include/jemalloc/internal/public_symbols.txt" > "${objroot}include/jemalloc/jemalloc_rename.h"
2183], [
2184 srcdir="${srcdir}"
2185 objroot="${objroot}"
2186])
2187AC_CONFIG_COMMANDS([include/jemalloc/jemalloc_mangle.h], [
2188 mkdir -p "${objroot}include/jemalloc"
2189 "${srcdir}/include/jemalloc/jemalloc_mangle.sh" "${objroot}include/jemalloc/internal/public_symbols.txt" je_ > "${objroot}include/jemalloc/jemalloc_mangle.h"
2190], [
2191 srcdir="${srcdir}"
2192 objroot="${objroot}"
2193])
2194AC_CONFIG_COMMANDS([include/jemalloc/jemalloc_mangle_jet.h], [
2195 mkdir -p "${objroot}include/jemalloc"
2196 "${srcdir}/include/jemalloc/jemalloc_mangle.sh" "${objroot}include/jemalloc/internal/public_symbols.txt" jet_ > "${objroot}include/jemalloc/jemalloc_mangle_jet.h"
2197], [
2198 srcdir="${srcdir}"
2199 objroot="${objroot}"
Jason Evans86abd0d2013-11-30 15:25:42 -08002200])
2201AC_CONFIG_COMMANDS([include/jemalloc/jemalloc.h], [
2202 mkdir -p "${objroot}include/jemalloc"
2203 "${srcdir}/include/jemalloc/jemalloc.sh" "${objroot}" > "${objroot}include/jemalloc/jemalloc${install_suffix}.h"
Jason Evansf234dc52014-01-16 17:38:01 -08002204], [
2205 srcdir="${srcdir}"
2206 objroot="${objroot}"
2207 install_suffix="${install_suffix}"
Jason Evans86abd0d2013-11-30 15:25:42 -08002208])
Jason Evansb1726102012-02-28 16:50:47 -08002209
Jason Evansb7924f52009-06-23 19:01:18 -07002210dnl Process .in files.
Jason Evansb0fd5012010-01-17 01:49:20 -08002211AC_SUBST([cfghdrs_in])
2212AC_SUBST([cfghdrs_out])
Jason Evans0656ec02010-04-07 23:37:35 -07002213AC_CONFIG_HEADERS([$cfghdrs_tup])
Jason Evansb7924f52009-06-23 19:01:18 -07002214
2215dnl ============================================================================
2216dnl Generate outputs.
Jason Evans748dfac2013-12-06 18:27:33 -08002217
Jason Evans70417202015-05-01 12:31:12 -07002218AC_CONFIG_FILES([$cfgoutputs_tup config.stamp bin/jemalloc-config bin/jemalloc.sh bin/jeprof])
Jason Evansb0fd5012010-01-17 01:49:20 -08002219AC_SUBST([cfgoutputs_in])
2220AC_SUBST([cfgoutputs_out])
Jason Evansb7924f52009-06-23 19:01:18 -07002221AC_OUTPUT
2222
2223dnl ============================================================================
2224dnl Print out the results of configuration.
2225AC_MSG_RESULT([===============================================================================])
Jason Evansf576c632011-11-01 22:27:41 -07002226AC_MSG_RESULT([jemalloc version : ${jemalloc_version}])
2227AC_MSG_RESULT([library revision : ${rev}])
Jason Evansb7924f52009-06-23 19:01:18 -07002228AC_MSG_RESULT([])
Jason Evansbec6a8d2015-01-22 17:55:58 -08002229AC_MSG_RESULT([CONFIG : ${CONFIG}])
Jason Evansb7924f52009-06-23 19:01:18 -07002230AC_MSG_RESULT([CC : ${CC}])
Jason Evans194d6f92016-12-16 07:18:55 -08002231AC_MSG_RESULT([CONFIGURE_CFLAGS : ${CONFIGURE_CFLAGS}])
2232AC_MSG_RESULT([SPECIFIED_CFLAGS : ${SPECIFIED_CFLAGS}])
Jason Evansaf0e28f2016-10-29 22:14:55 -07002233AC_MSG_RESULT([EXTRA_CFLAGS : ${EXTRA_CFLAGS}])
Jason Evansbec6a8d2015-01-22 17:55:58 -08002234AC_MSG_RESULT([CPPFLAGS : ${CPPFLAGS}])
Dave Watson23191522016-10-23 15:56:30 -07002235AC_MSG_RESULT([CXX : ${CXX}])
Jason Evans194d6f92016-12-16 07:18:55 -08002236AC_MSG_RESULT([CONFIGURE_CXXFLAGS : ${CONFIGURE_CXXFLAGS}])
2237AC_MSG_RESULT([SPECIFIED_CXXFLAGS : ${SPECIFIED_CXXFLAGS}])
Dave Watson23191522016-10-23 15:56:30 -07002238AC_MSG_RESULT([EXTRA_CXXFLAGS : ${EXTRA_CXXFLAGS}])
Jason Evansb7924f52009-06-23 19:01:18 -07002239AC_MSG_RESULT([LDFLAGS : ${LDFLAGS}])
Jason Evans748dfac2013-12-06 18:27:33 -08002240AC_MSG_RESULT([EXTRA_LDFLAGS : ${EXTRA_LDFLAGS}])
Dave Watson23191522016-10-23 15:56:30 -07002241AC_MSG_RESULT([DSO_LDFLAGS : ${DSO_LDFLAGS}])
Jason Evansb7924f52009-06-23 19:01:18 -07002242AC_MSG_RESULT([LIBS : ${LIBS}])
2243AC_MSG_RESULT([RPATH_EXTRA : ${RPATH_EXTRA}])
2244AC_MSG_RESULT([])
Jason Evansaee7fd22010-11-24 22:00:02 -08002245AC_MSG_RESULT([XSLTPROC : ${XSLTPROC}])
2246AC_MSG_RESULT([XSLROOT : ${XSLROOT}])
2247AC_MSG_RESULT([])
Jason Evansb7924f52009-06-23 19:01:18 -07002248AC_MSG_RESULT([PREFIX : ${PREFIX}])
2249AC_MSG_RESULT([BINDIR : ${BINDIR}])
Jason Evansbec6a8d2015-01-22 17:55:58 -08002250AC_MSG_RESULT([DATADIR : ${DATADIR}])
Jason Evans662a0172009-07-01 19:24:31 -07002251AC_MSG_RESULT([INCLUDEDIR : ${INCLUDEDIR}])
2252AC_MSG_RESULT([LIBDIR : ${LIBDIR}])
Jason Evansb7924f52009-06-23 19:01:18 -07002253AC_MSG_RESULT([MANDIR : ${MANDIR}])
2254AC_MSG_RESULT([])
2255AC_MSG_RESULT([srcroot : ${srcroot}])
2256AC_MSG_RESULT([abs_srcroot : ${abs_srcroot}])
2257AC_MSG_RESULT([objroot : ${objroot}])
2258AC_MSG_RESULT([abs_objroot : ${abs_objroot}])
2259AC_MSG_RESULT([])
Jason Evans90895cf2009-12-29 00:09:15 -08002260AC_MSG_RESULT([JEMALLOC_PREFIX : ${JEMALLOC_PREFIX}])
Jason Evans746e77a2011-07-30 16:40:52 -07002261AC_MSG_RESULT([JEMALLOC_PRIVATE_NAMESPACE])
2262AC_MSG_RESULT([ : ${JEMALLOC_PRIVATE_NAMESPACE}])
Jason Evansb0fd5012010-01-17 01:49:20 -08002263AC_MSG_RESULT([install_suffix : ${install_suffix}])
Jason Evansf8290092016-02-07 14:23:22 -08002264AC_MSG_RESULT([malloc_conf : ${config_malloc_conf}])
Jason Evansb7924f52009-06-23 19:01:18 -07002265AC_MSG_RESULT([autogen : ${enable_autogen}])
2266AC_MSG_RESULT([debug : ${enable_debug}])
2267AC_MSG_RESULT([stats : ${enable_stats}])
Jason Evans6109fe02010-02-10 10:37:56 -08002268AC_MSG_RESULT([prof : ${enable_prof}])
2269AC_MSG_RESULT([prof-libunwind : ${enable_prof_libunwind}])
Jason Evans77f350b2011-03-15 22:23:12 -07002270AC_MSG_RESULT([prof-libgcc : ${enable_prof_libgcc}])
2271AC_MSG_RESULT([prof-gcc : ${enable_prof_gcc}])
Jason Evansc606a872017-05-30 09:54:49 -07002272AC_MSG_RESULT([thp : ${enable_thp}])
Jason Evansb7924f52009-06-23 19:01:18 -07002273AC_MSG_RESULT([fill : ${enable_fill}])
Jason Evansb1476112012-04-05 13:36:17 -07002274AC_MSG_RESULT([utrace : ${enable_utrace}])
Jason Evans122449b2012-04-06 00:35:09 -07002275AC_MSG_RESULT([xmalloc : ${enable_xmalloc}])
David T. Goldblatt9761b442017-07-19 16:36:46 -07002276AC_MSG_RESULT([log : ${enable_log}])
Jason Evansb7924f52009-06-23 19:01:18 -07002277AC_MSG_RESULT([lazy_lock : ${enable_lazy_lock}])
Jason Evans8a03cf02015-05-04 09:58:36 -07002278AC_MSG_RESULT([cache-oblivious : ${enable_cache_oblivious}])
Dave Watson23191522016-10-23 15:56:30 -07002279AC_MSG_RESULT([cxx : ${enable_cxx}])
Jason Evansb7924f52009-06-23 19:01:18 -07002280AC_MSG_RESULT([===============================================================================])