blob: ab2f41ae305afb2e3c7f2c49ed6c0d407bad5820 [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)
Dave Watson23191522016-10-23 15:56:30 -070079AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
80[[
81]], [[
82 return 0;
83]])],
Jason Evans194d6f92016-12-16 07:18:55 -080084 [je_cv_cxxflags_added=$1]
Dave Watson23191522016-10-23 15:56:30 -070085 AC_MSG_RESULT([yes]),
Jason Evans194d6f92016-12-16 07:18:55 -080086 [je_cv_cxxflags_added=]
Dave Watson23191522016-10-23 15:56:30 -070087 AC_MSG_RESULT([no])
Jason Evans194d6f92016-12-16 07:18:55 -080088 [CONFIGURE_CXXFLAGS="${T_CONFIGURE_CXXFLAGS}"]
Dave Watson23191522016-10-23 15:56:30 -070089)
Jason Evans194d6f92016-12-16 07:18:55 -080090JE_CONCAT_VVV(CXXFLAGS, CONFIGURE_CXXFLAGS, SPECIFIED_CXXFLAGS)
Dave Watson23191522016-10-23 15:56:30 -070091])
92
Jason Evansf3340ca2009-06-30 16:17:05 -070093dnl JE_COMPILABLE(label, hcode, mcode, rvar)
Tamir Duberstein96f14682017-07-06 14:50:55 -040094dnl
Jason Evansf3e139a2012-03-19 09:54:20 -070095dnl Use AC_LINK_IFELSE() rather than AC_COMPILE_IFELSE() so that linker errors
Jason Evans4c2faa82012-03-13 11:09:23 -070096dnl cause failure.
Jason Evansf3340ca2009-06-30 16:17:05 -070097AC_DEFUN([JE_COMPILABLE],
98[
Jason Evans6684cac2012-03-05 12:15:36 -080099AC_CACHE_CHECK([whether $1 is compilable],
100 [$4],
Jason Evansf3e139a2012-03-19 09:54:20 -0700101 [AC_LINK_IFELSE([AC_LANG_PROGRAM([$2],
102 [$3])],
103 [$4=yes],
104 [$4=no])])
Jason Evansf3340ca2009-06-30 16:17:05 -0700105])
106
107dnl ============================================================================
108
Jason Evans41f2e692015-01-25 20:15:13 -0800109CONFIG=`echo ${ac_configure_args} | sed -e 's#'"'"'\([^ ]*\)'"'"'#\1#g'`
Jason Evansbec6a8d2015-01-22 17:55:58 -0800110AC_SUBST([CONFIG])
111
Jason Evansf576c632011-11-01 22:27:41 -0700112dnl Library revision.
Jason Evans9790b962014-04-14 22:32:31 -0700113rev=2
Jason Evansf576c632011-11-01 22:27:41 -0700114AC_SUBST([rev])
115
Jason Evansb7924f52009-06-23 19:01:18 -0700116srcroot=$srcdir
117if test "x${srcroot}" = "x." ; then
118 srcroot=""
119else
120 srcroot="${srcroot}/"
121fi
122AC_SUBST([srcroot])
123abs_srcroot="`cd \"${srcdir}\"; pwd`/"
124AC_SUBST([abs_srcroot])
125
126objroot=""
127AC_SUBST([objroot])
128abs_objroot="`pwd`/"
129AC_SUBST([abs_objroot])
130
131dnl Munge install path variables.
132if test "x$prefix" = "xNONE" ; then
133 prefix="/usr/local"
134fi
135if test "x$exec_prefix" = "xNONE" ; then
136 exec_prefix=$prefix
137fi
138PREFIX=$prefix
139AC_SUBST([PREFIX])
140BINDIR=`eval echo $bindir`
141BINDIR=`eval echo $BINDIR`
142AC_SUBST([BINDIR])
143INCLUDEDIR=`eval echo $includedir`
144INCLUDEDIR=`eval echo $INCLUDEDIR`
145AC_SUBST([INCLUDEDIR])
146LIBDIR=`eval echo $libdir`
147LIBDIR=`eval echo $LIBDIR`
148AC_SUBST([LIBDIR])
149DATADIR=`eval echo $datadir`
150DATADIR=`eval echo $DATADIR`
151AC_SUBST([DATADIR])
152MANDIR=`eval echo $mandir`
153MANDIR=`eval echo $MANDIR`
154AC_SUBST([MANDIR])
155
Jason Evansaee7fd22010-11-24 22:00:02 -0800156dnl Support for building documentation.
Jason Evans7329a4f2013-01-22 10:53:29 -0800157AC_PATH_PROG([XSLTPROC], [xsltproc], [false], [$PATH])
Jason Evans7091b412012-03-19 09:36:44 -0700158if test -d "/usr/share/xml/docbook/stylesheet/docbook-xsl" ; then
159 DEFAULT_XSLROOT="/usr/share/xml/docbook/stylesheet/docbook-xsl"
160elif test -d "/usr/share/sgml/docbook/xsl-stylesheets" ; then
161 DEFAULT_XSLROOT="/usr/share/sgml/docbook/xsl-stylesheets"
162else
163 dnl Documentation building will fail if this default gets used.
164 DEFAULT_XSLROOT=""
165fi
Jason Evansaee7fd22010-11-24 22:00:02 -0800166AC_ARG_WITH([xslroot],
Jason Evans7091b412012-03-19 09:36:44 -0700167 [AS_HELP_STRING([--with-xslroot=<path>], [XSL stylesheet root path])], [
Jason Evansaee7fd22010-11-24 22:00:02 -0800168if test "x$with_xslroot" = "xno" ; then
Jason Evans7091b412012-03-19 09:36:44 -0700169 XSLROOT="${DEFAULT_XSLROOT}"
Jason Evansaee7fd22010-11-24 22:00:02 -0800170else
171 XSLROOT="${with_xslroot}"
Jason Evans7091b412012-03-19 09:36:44 -0700172fi
173],
174 XSLROOT="${DEFAULT_XSLROOT}"
Jason Evansaee7fd22010-11-24 22:00:02 -0800175)
176AC_SUBST([XSLROOT])
177
Jason Evansf3340ca2009-06-30 16:17:05 -0700178dnl If CFLAGS isn't defined, set CFLAGS to something reasonable. Otherwise,
179dnl just prevent autoconf from molesting CFLAGS.
Jason Evansb7924f52009-06-23 19:01:18 -0700180CFLAGS=$CFLAGS
181AC_PROG_CC
Elliot Ronaghanaec07532016-06-14 15:26:07 -0700182
Mike Hommeyfd97b1d2012-04-30 12:38:31 +0200183if test "x$GCC" != "xyes" ; then
184 AC_CACHE_CHECK([whether compiler is MSVC],
185 [je_cv_msvc],
186 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],
187 [
188#ifndef _MSC_VER
189 int fail[-1];
190#endif
191])],
192 [je_cv_msvc=yes],
193 [je_cv_msvc=no])])
194fi
195
Elliot Ronaghanccd64162016-06-14 13:18:08 -0700196dnl check if a cray prgenv wrapper compiler is being used
197je_cv_cray_prgenv_wrapper=""
198if test "x${PE_ENV}" != "x" ; then
199 case "${CC}" in
200 CC|cc)
201 je_cv_cray_prgenv_wrapper="yes"
202 ;;
203 *)
204 ;;
205 esac
206fi
207
Elliot Ronaghanaec07532016-06-14 15:26:07 -0700208AC_CACHE_CHECK([whether compiler is cray],
209 [je_cv_cray],
210 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],
211 [
212#ifndef _CRAYC
213 int fail[-1];
214#endif
215])],
216 [je_cv_cray=yes],
217 [je_cv_cray=no])])
218
219if test "x${je_cv_cray}" = "xyes" ; then
220 AC_CACHE_CHECK([whether cray compiler version is 8.4],
221 [je_cv_cray_84],
222 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],
223 [
224#if !(_RELEASE_MAJOR == 8 && _RELEASE_MINOR == 4)
225 int fail[-1];
226#endif
227])],
228 [je_cv_cray_84=yes],
229 [je_cv_cray_84=no])])
230fi
231
Jason Evans194d6f92016-12-16 07:18:55 -0800232if test "x$GCC" = "xyes" ; then
233 JE_CFLAGS_ADD([-std=gnu11])
234 if test "x$je_cv_cflags_added" = "x-std=gnu11" ; then
235 AC_DEFINE_UNQUOTED([JEMALLOC_HAS_RESTRICT])
236 else
237 JE_CFLAGS_ADD([-std=gnu99])
238 if test "x$je_cv_cflags_added" = "x-std=gnu99" ; then
Jason Evans99b0fbb2014-02-24 16:08:38 -0800239 AC_DEFINE_UNQUOTED([JEMALLOC_HAS_RESTRICT])
240 fi
Jason Evanscfeccd32010-03-03 15:48:20 -0800241 fi
Jason Evans194d6f92016-12-16 07:18:55 -0800242 JE_CFLAGS_ADD([-Wall])
Jason Evans194d6f92016-12-16 07:18:55 -0800243 JE_CFLAGS_ADD([-Wshorten-64-to-32])
244 JE_CFLAGS_ADD([-Wsign-compare])
David Goldblatt425253e2017-04-21 13:47:49 -0700245 JE_CFLAGS_ADD([-Wundef])
David Goldblatta9f77322017-07-21 13:34:45 -0700246 JE_CFLAGS_ADD([-Wno-format-zero-length])
Jason Evans194d6f92016-12-16 07:18:55 -0800247 JE_CFLAGS_ADD([-pipe])
248 JE_CFLAGS_ADD([-g3])
249elif test "x$je_cv_msvc" = "xyes" ; then
250 CC="$CC -nologo"
251 JE_CFLAGS_ADD([-Zi])
252 JE_CFLAGS_ADD([-MT])
253 JE_CFLAGS_ADD([-W3])
254 JE_CFLAGS_ADD([-FS])
255 JE_APPEND_VS(CPPFLAGS, -I${srcdir}/include/msvc_compat)
256fi
257if test "x$je_cv_cray" = "xyes" ; then
258 dnl cray compiler 8.4 has an inlining bug
259 if test "x$je_cv_cray_84" = "xyes" ; then
260 JE_CFLAGS_ADD([-hipa2])
261 JE_CFLAGS_ADD([-hnognu])
262 fi
Jason Evans0f633962017-04-24 11:47:10 -0700263 dnl ignore unreachable code warning
264 JE_CFLAGS_ADD([-hnomessage=128])
265 dnl ignore redefinition of "malloc", "free", etc warning
266 JE_CFLAGS_ADD([-hnomessage=1357])
Jason Evansb7924f52009-06-23 19:01:18 -0700267fi
Jason Evans194d6f92016-12-16 07:18:55 -0800268AC_SUBST([CONFIGURE_CFLAGS])
269AC_SUBST([SPECIFIED_CFLAGS])
Jason Evansaf0e28f2016-10-29 22:14:55 -0700270AC_SUBST([EXTRA_CFLAGS])
Jason Evansb7924f52009-06-23 19:01:18 -0700271AC_PROG_CPP
272
Dave Watson23191522016-10-23 15:56:30 -0700273AC_ARG_ENABLE([cxx],
274 [AS_HELP_STRING([--disable-cxx], [Disable C++ integration])],
275if test "x$enable_cxx" = "xno" ; then
276 enable_cxx="0"
277else
278 enable_cxx="1"
279fi
280,
281enable_cxx="1"
282)
283if test "x$enable_cxx" = "x1" ; then
Dave Watson23191522016-10-23 15:56:30 -0700284 dnl Require at least c++14, which is the first version to support sized
285 dnl deallocation. C++ support is not compiled otherwise.
286 m4_include([m4/ax_cxx_compile_stdcxx.m4])
287 AX_CXX_COMPILE_STDCXX([14], [noext], [optional])
288 if test "x${HAVE_CXX14}" = "x1" ; then
Jason Evans194d6f92016-12-16 07:18:55 -0800289 JE_CXXFLAGS_ADD([-Wall])
290 JE_CXXFLAGS_ADD([-g3])
Dave Watson23191522016-10-23 15:56:30 -0700291
292 SAVED_LIBS="${LIBS}"
Jason Evans194d6f92016-12-16 07:18:55 -0800293 JE_APPEND_VS(LIBS, -lstdc++)
Dave Watson23191522016-10-23 15:56:30 -0700294 JE_COMPILABLE([libstdc++ linkage], [
295#include <stdlib.h>
296], [[
297 int *arr = (int *)malloc(sizeof(int) * 42);
298 if (arr == NULL)
Jason Evansf4086432017-01-19 18:15:45 -0800299 return 1;
Dave Watson23191522016-10-23 15:56:30 -0700300]], [je_cv_libstdcxx])
301 if test "x${je_cv_libstdcxx}" = "xno" ; then
302 LIBS="${SAVED_LIBS}"
303 fi
304 else
305 enable_cxx="0"
306 fi
307fi
308AC_SUBST([enable_cxx])
Jason Evans194d6f92016-12-16 07:18:55 -0800309AC_SUBST([CONFIGURE_CXXFLAGS])
310AC_SUBST([SPECIFIED_CXXFLAGS])
Dave Watson23191522016-10-23 15:56:30 -0700311AC_SUBST([EXTRA_CXXFLAGS])
312
Jason Evansdf3f2702014-03-30 16:27:08 -0700313AC_C_BIGENDIAN([ac_cv_big_endian=1], [ac_cv_big_endian=0])
314if test "x${ac_cv_big_endian}" = "x1" ; then
315 AC_DEFINE_UNQUOTED([JEMALLOC_BIG_ENDIAN], [ ])
316fi
317
Mike Hommeyff2e9992014-05-29 16:33:02 +0900318if test "x${je_cv_msvc}" = "xyes" -a "x${ac_cv_header_inttypes_h}" = "xno"; then
Jason Evans194d6f92016-12-16 07:18:55 -0800319 JE_APPEND_VS(CPPFLAGS, -I${srcdir}/include/msvc_compat/C99)
Mike Hommeyff2e9992014-05-29 16:33:02 +0900320fi
321
rustyx46e0b232016-01-30 13:37:26 +0100322if test "x${je_cv_msvc}" = "xyes" ; then
323 LG_SIZEOF_PTR=LG_SIZEOF_PTR_WIN
324 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 -0700325else
rustyx46e0b232016-01-30 13:37:26 +0100326 AC_CHECK_SIZEOF([void *])
327 if test "x${ac_cv_sizeof_void_p}" = "x8" ; then
328 LG_SIZEOF_PTR=3
329 elif test "x${ac_cv_sizeof_void_p}" = "x4" ; then
330 LG_SIZEOF_PTR=2
331 else
332 AC_MSG_ERROR([Unsupported pointer size: ${ac_cv_sizeof_void_p}])
333 fi
Jason Evansb7924f52009-06-23 19:01:18 -0700334fi
Jason Evans94ad2b52009-12-29 00:09:15 -0800335AC_DEFINE_UNQUOTED([LG_SIZEOF_PTR], [$LG_SIZEOF_PTR])
336
337AC_CHECK_SIZEOF([int])
338if test "x${ac_cv_sizeof_int}" = "x8" ; then
339 LG_SIZEOF_INT=3
340elif test "x${ac_cv_sizeof_int}" = "x4" ; then
341 LG_SIZEOF_INT=2
342else
343 AC_MSG_ERROR([Unsupported int size: ${ac_cv_sizeof_int}])
344fi
345AC_DEFINE_UNQUOTED([LG_SIZEOF_INT], [$LG_SIZEOF_INT])
Jason Evansb7924f52009-06-23 19:01:18 -0700346
Jason Evans84c8eef2011-03-16 10:30:13 -0700347AC_CHECK_SIZEOF([long])
348if test "x${ac_cv_sizeof_long}" = "x8" ; then
349 LG_SIZEOF_LONG=3
350elif test "x${ac_cv_sizeof_long}" = "x4" ; then
351 LG_SIZEOF_LONG=2
352else
353 AC_MSG_ERROR([Unsupported long size: ${ac_cv_sizeof_long}])
354fi
355AC_DEFINE_UNQUOTED([LG_SIZEOF_LONG], [$LG_SIZEOF_LONG])
356
Jason Evansecae1232016-02-20 23:41:33 -0800357AC_CHECK_SIZEOF([long long])
358if test "x${ac_cv_sizeof_long_long}" = "x8" ; then
359 LG_SIZEOF_LONG_LONG=3
360elif test "x${ac_cv_sizeof_long_long}" = "x4" ; then
361 LG_SIZEOF_LONG_LONG=2
362else
363 AC_MSG_ERROR([Unsupported long long size: ${ac_cv_sizeof_long_long}])
364fi
365AC_DEFINE_UNQUOTED([LG_SIZEOF_LONG_LONG], [$LG_SIZEOF_LONG_LONG])
366
Jason Evansd81e4bd2012-03-06 14:57:45 -0800367AC_CHECK_SIZEOF([intmax_t])
368if test "x${ac_cv_sizeof_intmax_t}" = "x16" ; then
369 LG_SIZEOF_INTMAX_T=4
370elif test "x${ac_cv_sizeof_intmax_t}" = "x8" ; then
371 LG_SIZEOF_INTMAX_T=3
372elif test "x${ac_cv_sizeof_intmax_t}" = "x4" ; then
373 LG_SIZEOF_INTMAX_T=2
374else
Mike Hommey14103d32012-04-20 08:38:39 +0200375 AC_MSG_ERROR([Unsupported intmax_t size: ${ac_cv_sizeof_intmax_t}])
Jason Evansd81e4bd2012-03-06 14:57:45 -0800376fi
377AC_DEFINE_UNQUOTED([LG_SIZEOF_INTMAX_T], [$LG_SIZEOF_INTMAX_T])
378
Jason Evansb7924f52009-06-23 19:01:18 -0700379AC_CANONICAL_HOST
380dnl CPU-specific settings.
381CPU_SPINWAIT=""
382case "${host_cpu}" in
Jason Evanscb657e32014-02-25 11:21:41 -0800383 i686|x86_64)
rustyx90c72692016-01-30 13:41:09 +0100384 if test "x${je_cv_msvc}" = "xyes" ; then
385 AC_CACHE_VAL([je_cv_pause_msvc],
386 [JE_COMPILABLE([pause instruction MSVC], [],
387 [[_mm_pause(); return 0;]],
388 [je_cv_pause_msvc])])
389 if test "x${je_cv_pause_msvc}" = "xyes" ; then
390 CPU_SPINWAIT='_mm_pause()'
391 fi
392 else
393 AC_CACHE_VAL([je_cv_pause],
394 [JE_COMPILABLE([pause instruction], [],
395 [[__asm__ volatile("pause"); return 0;]],
396 [je_cv_pause])])
397 if test "x${je_cv_pause}" = "xyes" ; then
398 CPU_SPINWAIT='__asm__ volatile("pause")'
399 fi
Jason Evansf3340ca2009-06-30 16:17:05 -0700400 fi
Jason Evans80061b62013-12-09 13:21:08 -0800401 ;;
Rafael Folco701daa52017-04-10 12:39:38 +0000402 powerpc*)
Jason Evans80061b62013-12-09 13:21:08 -0800403 AC_DEFINE_UNQUOTED([HAVE_ALTIVEC], [ ])
Rafael Folco701daa52017-04-10 12:39:38 +0000404 CPU_SPINWAIT='__asm__ volatile("or 31,31,31")'
Jason Evansb7924f52009-06-23 19:01:18 -0700405 ;;
406 *)
407 ;;
408esac
409AC_DEFINE_UNQUOTED([CPU_SPINWAIT], [$CPU_SPINWAIT])
410
Jason Evansf5cf9b12017-02-06 13:17:12 -0800411case "${host_cpu}" in
412 aarch64)
413 AC_MSG_CHECKING([number of significant virtual address bits])
414 LG_VADDR=48
415 AC_MSG_RESULT([$LG_VADDR])
416 ;;
417 x86_64)
418 AC_CACHE_CHECK([number of significant virtual address bits],
419 [je_cv_lg_vaddr],
420 AC_RUN_IFELSE([AC_LANG_PROGRAM(
421[[
422#include <stdio.h>
423#ifdef _WIN32
424#include <limits.h>
425#include <intrin.h>
426typedef unsigned __int32 uint32_t;
427#else
428#include <stdint.h>
429#endif
430]], [[
431 uint32_t r[[4]];
432 uint32_t eax_in = 0x80000008U;
433#ifdef _WIN32
434 __cpuid((int *)r, (int)eax_in);
435#else
436 asm volatile ("cpuid"
437 : "=a" (r[[0]]), "=b" (r[[1]]), "=c" (r[[2]]), "=d" (r[[3]])
438 : "a" (eax_in), "c" (0)
439 );
440#endif
441 uint32_t eax_out = r[[0]];
442 uint32_t vaddr = ((eax_out & 0x0000ff00U) >> 8);
443 FILE *f = fopen("conftest.out", "w");
444 if (f == NULL) {
445 return 1;
446 }
Jason Evansbda12bd2017-03-20 17:37:02 -0700447 if (vaddr > (sizeof(void *) << 3)) {
448 vaddr = sizeof(void *) << 3;
449 }
Jason Evansf5cf9b12017-02-06 13:17:12 -0800450 fprintf(f, "%u", vaddr);
451 fclose(f);
452 return 0;
453]])],
454 [je_cv_lg_vaddr=`cat conftest.out`],
455 [je_cv_lg_vaddr=error],
456 [je_cv_lg_vaddr=57]))
457 if test "x${je_cv_lg_vaddr}" != "x" ; then
458 LG_VADDR="${je_cv_lg_vaddr}"
459 fi
460 if test "x${LG_VADDR}" != "xerror" ; then
461 AC_DEFINE_UNQUOTED([LG_VADDR], [$LG_VADDR])
462 else
463 AC_MSG_ERROR([cannot determine number of significant virtual address bits])
464 fi
465 ;;
466 *)
467 AC_MSG_CHECKING([number of significant virtual address bits])
468 if test "x${LG_SIZEOF_PTR}" = "x3" ; then
469 LG_VADDR=64
470 elif test "x${LG_SIZEOF_PTR}" = "x2" ; then
471 LG_VADDR=32
472 elif test "x${LG_SIZEOF_PTR}" = "xLG_SIZEOF_PTR_WIN" ; then
473 LG_VADDR="(1U << (LG_SIZEOF_PTR_WIN+3))"
474 else
475 AC_MSG_ERROR([Unsupported lg(pointer size): ${LG_SIZEOF_PTR}])
476 fi
477 AC_MSG_RESULT([$LG_VADDR])
478 ;;
479esac
480AC_DEFINE_UNQUOTED([LG_VADDR], [$LG_VADDR])
481
Antony Dovgal2bd3cbc2011-10-13 09:33:33 +0400482LD_PRELOAD_VAR="LD_PRELOAD"
Jason Evansf576c632011-11-01 22:27:41 -0700483so="so"
Mike Hommeyfd97b1d2012-04-30 12:38:31 +0200484importlib="${so}"
Mike Hommey7cdea392012-04-30 12:38:27 +0200485o="$ac_objext"
Mike Hommey5bee66d2012-04-16 16:30:24 +0200486a="a"
Mike Hommey7cdea392012-04-30 12:38:27 +0200487exe="$ac_exeext"
Mike Hommeya19e87f2012-04-21 21:27:46 -0700488libprefix="lib"
Jason Evansc44fa922016-10-27 17:10:56 -0700489link_whole_archive="0"
Mike Hommeyfa08da72012-04-16 16:30:25 +0200490DSO_LDFLAGS='-shared -Wl,-soname,$(@F)'
491RPATH='-Wl,-rpath,$(1)'
Mike Hommey7cdea392012-04-30 12:38:27 +0200492SOREV="${so}.${rev}"
Mike Hommey188da7c2012-04-18 18:29:41 +0200493PIC_CFLAGS='-fPIC -DPIC'
Mike Hommeyfd97b1d2012-04-30 12:38:31 +0200494CTARGET='-o $@'
495LDTARGET='-o $@'
Elliot Ronaghanccd64162016-06-14 13:18:08 -0700496TEST_LD_MODE=
Mike Hommeyfd97b1d2012-04-30 12:38:31 +0200497EXTRA_LDFLAGS=
Jason Evans80ddf492013-08-20 11:48:19 +0100498ARFLAGS='crus'
499AROUT=' $@'
Mike Hommey79c4bca2012-05-02 21:30:51 +0200500CC_MM=1
Jason Evans7372b152012-02-10 20:22:09 -0800501
Elliot Ronaghanccd64162016-06-14 13:18:08 -0700502if test "x$je_cv_cray_prgenv_wrapper" = "xyes" ; then
503 TEST_LD_MODE='-dynamic'
504fi
505
Elliot Ronaghan3ef67932016-06-14 15:26:29 -0700506if test "x${je_cv_cray}" = "xyes" ; then
507 CC_MM=
508fi
509
Jory A. Prattad505e02013-08-11 09:44:59 -0500510AN_MAKEVAR([AR], [AC_PROG_AR])
511AN_PROGRAM([ar], [AC_PROG_AR])
512AC_DEFUN([AC_PROG_AR], [AC_CHECK_TOOL(AR, ar, :)])
513AC_PROG_AR
514
Tamir Duberstein24766cc2017-07-06 15:04:17 -0400515AN_MAKEVAR([NM], [AC_PROG_NM])
516AN_PROGRAM([nm], [AC_PROG_NM])
517AC_DEFUN([AC_PROG_NM], [AC_CHECK_TOOL(NM, nm, :)])
518AC_PROG_NM
519
Jason Evans909f0482017-05-04 11:20:43 -0700520AC_PROG_AWK
521
Jason Evansb7924f52009-06-23 19:01:18 -0700522dnl Platform-specific settings. abi and RPATH can probably be determined
523dnl programmatically, but doing so is error-prone, which makes it generally
524dnl not worth the trouble.
Tamir Duberstein96f14682017-07-06 14:50:55 -0400525dnl
Jason Evansb7924f52009-06-23 19:01:18 -0700526dnl Define cpp macros in CPPFLAGS, rather than doing AC_DEFINE(macro), since the
527dnl definitions need to be seen before any headers are included, which is a pain
528dnl to make happen otherwise.
Jason Evansb9ab04a2017-04-26 16:26:12 -0700529default_retain="0"
Jason Evansd059b9d2015-07-24 18:21:42 -0700530maps_coalesce="1"
Tamir Duberstein24766cc2017-07-06 15:04:17 -0400531DUMP_SYMS="${NM} -a"
Jason Evans909f0482017-05-04 11:20:43 -0700532SYM_PREFIX=""
Jason Evansb7924f52009-06-23 19:01:18 -0700533case "${host}" in
Valerii Hiora5921ba72014-05-16 16:28:20 +0300534 *-*-darwin* | *-*-ios*)
Jason Evansb7924f52009-06-23 19:01:18 -0700535 abi="macho"
536 RPATH=""
Antony Dovgal2bd3cbc2011-10-13 09:33:33 +0400537 LD_PRELOAD_VAR="DYLD_INSERT_LIBRARIES"
Jason Evansf576c632011-11-01 22:27:41 -0700538 so="dylib"
Mike Hommeyfd97b1d2012-04-30 12:38:31 +0200539 importlib="${so}"
Jason Evansb80581d2012-03-23 16:17:43 -0700540 force_tls="0"
Jason Evansf1f2b452015-05-01 08:57:41 -0700541 DSO_LDFLAGS='-shared -Wl,-install_name,$(LIBDIR)/$(@F)'
Mike Hommey7cdea392012-04-30 12:38:27 +0200542 SOREV="${rev}.${so}"
Jason Evans66688532013-12-03 21:49:36 -0800543 sbrk_deprecated="1"
Jason Evans909f0482017-05-04 11:20:43 -0700544 SYM_PREFIX="_"
Jason Evansb7924f52009-06-23 19:01:18 -0700545 ;;
546 *-*-freebsd*)
Jason Evansb7924f52009-06-23 19:01:18 -0700547 abi="elf"
Jason Evansc2f970c2016-05-05 17:45:02 -0700548 AC_DEFINE([JEMALLOC_SYSCTL_VM_OVERCOMMIT], [ ])
Jason Evansfd4fcef2012-03-23 17:40:58 -0700549 force_lazy_lock="1"
Jason Evansb7924f52009-06-23 19:01:18 -0700550 ;;
Michael Neumann1aa25a32014-08-05 03:06:02 +0200551 *-*-dragonfly*)
Michael Neumann1aa25a32014-08-05 03:06:02 +0200552 abi="elf"
Michael Neumann1aa25a32014-08-05 03:06:02 +0200553 ;;
Sébastien Marieb80fbcb2015-04-07 12:21:19 +0200554 *-*-openbsd*)
Sébastien Marieb80fbcb2015-04-07 12:21:19 +0200555 abi="elf"
Sébastien Marieb80fbcb2015-04-07 12:21:19 +0200556 force_tls="0"
557 ;;
558 *-*-bitrig*)
Sébastien Marie77d597e2015-01-25 10:18:32 +0100559 abi="elf"
Sébastien Marie77d597e2015-01-25 10:18:32 +0100560 ;;
Jason Evans32d69e92016-11-10 15:35:29 -0800561 *-*-linux-android)
562 dnl syscall(2) and secure_getenv(3) are exposed by _GNU_SOURCE.
Jason Evans194d6f92016-12-16 07:18:55 -0800563 JE_APPEND_VS(CPPFLAGS, -D_GNU_SOURCE)
Jason Evans32d69e92016-11-10 15:35:29 -0800564 abi="elf"
Jason Evans7cbcd2e2017-03-09 18:20:02 -0800565 AC_DEFINE([JEMALLOC_PURGE_MADVISE_DONTNEED_ZEROS])
Jason Evans32d69e92016-11-10 15:35:29 -0800566 AC_DEFINE([JEMALLOC_HAS_ALLOCA_H])
567 AC_DEFINE([JEMALLOC_PROC_SYS_VM_OVERCOMMIT_MEMORY], [ ])
Jason Evans32d69e92016-11-10 15:35:29 -0800568 AC_DEFINE([JEMALLOC_THREADED_INIT], [ ])
David Goldblattd4ac7582017-01-25 09:54:27 -0800569 AC_DEFINE([JEMALLOC_C11_ATOMICS])
Jason Evans32d69e92016-11-10 15:35:29 -0800570 force_tls="0"
Jason Evans7d86c922017-04-24 09:14:31 -0700571 if test "${LG_SIZEOF_PTR}" = "3"; then
Jason Evansb9ab04a2017-04-26 16:26:12 -0700572 default_retain="1"
Jason Evansa01f9932017-04-17 15:54:53 -0700573 fi
Jason Evans32d69e92016-11-10 15:35:29 -0800574 ;;
Faidon Liambotis8da69b62017-08-07 21:51:09 +0300575 *-*-linux*)
Jason Evans83ebf2f2016-11-02 19:50:44 -0700576 dnl syscall(2) and secure_getenv(3) are exposed by _GNU_SOURCE.
Jason Evans194d6f92016-12-16 07:18:55 -0800577 JE_APPEND_VS(CPPFLAGS, -D_GNU_SOURCE)
Jason Evansb7924f52009-06-23 19:01:18 -0700578 abi="elf"
Jason Evans7cbcd2e2017-03-09 18:20:02 -0800579 AC_DEFINE([JEMALLOC_PURGE_MADVISE_DONTNEED_ZEROS])
Garrett Cooper13e4e242012-12-02 17:58:40 -0800580 AC_DEFINE([JEMALLOC_HAS_ALLOCA_H])
Jason Evansc2f970c2016-05-05 17:45:02 -0700581 AC_DEFINE([JEMALLOC_PROC_SYS_VM_OVERCOMMIT_MEMORY], [ ])
Jason Evans02b23122012-04-05 11:06:23 -0700582 AC_DEFINE([JEMALLOC_THREADED_INIT], [ ])
Jason Evansae93d6b2015-07-10 14:33:00 -0700583 AC_DEFINE([JEMALLOC_USE_CXX_THROW], [ ])
Jason Evans7d86c922017-04-24 09:14:31 -0700584 if test "${LG_SIZEOF_PTR}" = "3"; then
Jason Evansb9ab04a2017-04-26 16:26:12 -0700585 default_retain="1"
Jason Evansa01f9932017-04-17 15:54:53 -0700586 fi
Jason Evansb7924f52009-06-23 19:01:18 -0700587 ;;
Faidon Liambotis8da69b62017-08-07 21:51:09 +0300588 *-*-kfreebsd*)
589 dnl syscall(2) and secure_getenv(3) are exposed by _GNU_SOURCE.
590 JE_APPEND_VS(CPPFLAGS, -D_GNU_SOURCE)
591 abi="elf"
592 AC_DEFINE([JEMALLOC_HAS_ALLOCA_H])
593 AC_DEFINE([JEMALLOC_SYSCTL_VM_OVERCOMMIT], [ ])
594 AC_DEFINE([JEMALLOC_THREADED_INIT], [ ])
595 AC_DEFINE([JEMALLOC_USE_CXX_THROW], [ ])
596 ;;
Jason Evansb7924f52009-06-23 19:01:18 -0700597 *-*-netbsd*)
598 AC_MSG_CHECKING([ABI])
599 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
600[[#ifdef __ELF__
601/* ELF */
602#else
603#error aout
604#endif
605]])],
Jason Evanse0164bc2016-10-07 08:47:16 -0700606 [abi="elf"],
Jason Evansb7924f52009-06-23 19:01:18 -0700607 [abi="aout"])
608 AC_MSG_RESULT([$abi])
Jason Evansb7924f52009-06-23 19:01:18 -0700609 ;;
610 *-*-solaris2*)
Jason Evansb7924f52009-06-23 19:01:18 -0700611 abi="elf"
Mike Hommeyfa08da72012-04-16 16:30:25 +0200612 RPATH='-Wl,-R,$(1)'
Jason Evansb7924f52009-06-23 19:01:18 -0700613 dnl Solaris needs this for sigwait().
Jason Evans194d6f92016-12-16 07:18:55 -0800614 JE_APPEND_VS(CPPFLAGS, -D_POSIX_PTHREAD_SEMANTICS)
615 JE_APPEND_VS(LIBS, -lposix4 -lsocket -lnsl)
Jason Evansb7924f52009-06-23 19:01:18 -0700616 ;;
Antony Dovgal2bd3cbc2011-10-13 09:33:33 +0400617 *-ibm-aix*)
Jason Evans7d86c922017-04-24 09:14:31 -0700618 if test "${LG_SIZEOF_PTR}" = "3"; then
Antony Dovgal2bd3cbc2011-10-13 09:33:33 +0400619 dnl 64bit AIX
620 LD_PRELOAD_VAR="LDR_PRELOAD64"
621 else
622 dnl 32bit AIX
623 LD_PRELOAD_VAR="LDR_PRELOAD"
624 fi
625 abi="xcoff"
Antony Dovgal2bd3cbc2011-10-13 09:33:33 +0400626 ;;
Dave Rigby70bdee02014-09-22 15:53:16 +0100627 *-*-mingw* | *-*-cygwin*)
Mike Hommeya19e87f2012-04-21 21:27:46 -0700628 abi="pecoff"
629 force_tls="0"
Jason Evansd059b9d2015-07-24 18:21:42 -0700630 maps_coalesce="0"
Mike Hommeya19e87f2012-04-21 21:27:46 -0700631 RPATH=""
632 so="dll"
Mike Hommeyfd97b1d2012-04-30 12:38:31 +0200633 if test "x$je_cv_msvc" = "xyes" ; then
634 importlib="lib"
635 DSO_LDFLAGS="-LD"
636 EXTRA_LDFLAGS="-link -DEBUG"
637 CTARGET='-Fo$@'
638 LDTARGET='-Fe$@'
Jory A. Prattad505e02013-08-11 09:44:59 -0500639 AR='lib'
640 ARFLAGS='-nologo -out:'
Jason Evans80ddf492013-08-20 11:48:19 +0100641 AROUT='$@'
Mike Hommey79c4bca2012-05-02 21:30:51 +0200642 CC_MM=
Mike Hommeyfd97b1d2012-04-30 12:38:31 +0200643 else
644 importlib="${so}"
645 DSO_LDFLAGS="-shared"
Jason Evansc44fa922016-10-27 17:10:56 -0700646 link_whole_archive="1"
Mike Hommeyfd97b1d2012-04-30 12:38:31 +0200647 fi
Tamir Dubersteina545f182017-07-06 15:14:48 -0400648 case "${host}" in
649 *-*-cygwin*)
650 DUMP_SYMS="dumpbin /SYMBOLS"
651 ;;
652 *)
653 ;;
654 esac
Mike Hommeya19e87f2012-04-21 21:27:46 -0700655 a="lib"
656 libprefix=""
Mike Hommey7cdea392012-04-30 12:38:27 +0200657 SOREV="${so}"
Mike Hommeya19e87f2012-04-21 21:27:46 -0700658 PIC_CFLAGS=""
659 ;;
Jason Evansb7924f52009-06-23 19:01:18 -0700660 *)
661 AC_MSG_RESULT([Unsupported operating system: ${host}])
662 abi="elf"
Jason Evansb7924f52009-06-23 19:01:18 -0700663 ;;
664esac
Mike Hommeyaffe0092014-05-28 08:10:12 +0900665
666JEMALLOC_USABLE_SIZE_CONST=const
667AC_CHECK_HEADERS([malloc.h], [
668 AC_MSG_CHECKING([whether malloc_usable_size definition can use const argument])
669 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
670 [#include <malloc.h>
671 #include <stddef.h>
672 size_t malloc_usable_size(const void *ptr);
673 ],
674 [])],[
675 AC_MSG_RESULT([yes])
676 ],[
677 JEMALLOC_USABLE_SIZE_CONST=
678 AC_MSG_RESULT([no])
679 ])
680])
Jason Evans247d1242012-10-09 16:20:10 -0700681AC_DEFINE_UNQUOTED([JEMALLOC_USABLE_SIZE_CONST], [$JEMALLOC_USABLE_SIZE_CONST])
Jason Evansb7924f52009-06-23 19:01:18 -0700682AC_SUBST([abi])
683AC_SUBST([RPATH])
Antony Dovgal2bd3cbc2011-10-13 09:33:33 +0400684AC_SUBST([LD_PRELOAD_VAR])
Jason Evansf576c632011-11-01 22:27:41 -0700685AC_SUBST([so])
Mike Hommeyfd97b1d2012-04-30 12:38:31 +0200686AC_SUBST([importlib])
Mike Hommey5bee66d2012-04-16 16:30:24 +0200687AC_SUBST([o])
688AC_SUBST([a])
689AC_SUBST([exe])
Mike Hommeya19e87f2012-04-21 21:27:46 -0700690AC_SUBST([libprefix])
Jason Evansc44fa922016-10-27 17:10:56 -0700691AC_SUBST([link_whole_archive])
Mike Hommeyfa08da72012-04-16 16:30:25 +0200692AC_SUBST([DSO_LDFLAGS])
Mike Hommeyfd97b1d2012-04-30 12:38:31 +0200693AC_SUBST([EXTRA_LDFLAGS])
Mike Hommey85221d52012-04-18 18:29:40 +0200694AC_SUBST([SOREV])
Mike Hommey188da7c2012-04-18 18:29:41 +0200695AC_SUBST([PIC_CFLAGS])
Mike Hommeyfd97b1d2012-04-30 12:38:31 +0200696AC_SUBST([CTARGET])
697AC_SUBST([LDTARGET])
Elliot Ronaghanccd64162016-06-14 13:18:08 -0700698AC_SUBST([TEST_LD_MODE])
Mike Hommeyfd97b1d2012-04-30 12:38:31 +0200699AC_SUBST([MKLIB])
Jason Evans80ddf492013-08-20 11:48:19 +0100700AC_SUBST([ARFLAGS])
701AC_SUBST([AROUT])
Jason Evans909f0482017-05-04 11:20:43 -0700702AC_SUBST([DUMP_SYMS])
Mike Hommey79c4bca2012-05-02 21:30:51 +0200703AC_SUBST([CC_MM])
Mike Hommeyfd97b1d2012-04-30 12:38:31 +0200704
Jason Evansd76cfec2016-10-27 21:23:48 -0700705dnl Determine whether libm must be linked to use e.g. log(3).
706AC_SEARCH_LIBS([log], [m], , [AC_MSG_ERROR([Missing math functions])])
707if test "x$ac_cv_search_log" != "xnone required" ; then
708 LM="$ac_cv_search_log"
709else
710 LM=
711fi
712AC_SUBST(LM)
713
Jason Evansfa5d2452011-03-15 10:25:59 -0700714JE_COMPILABLE([__attribute__ syntax],
715 [static __attribute__((unused)) void foo(void){}],
716 [],
Jason Evans6684cac2012-03-05 12:15:36 -0800717 [je_cv_attribute])
718if test "x${je_cv_attribute}" = "xyes" ; then
Jason Evansfa5d2452011-03-15 10:25:59 -0700719 AC_DEFINE([JEMALLOC_HAVE_ATTR], [ ])
720 if test "x${GCC}" = "xyes" -a "x${abi}" = "xelf"; then
Jason Evans194d6f92016-12-16 07:18:55 -0800721 JE_CFLAGS_ADD([-fvisibility=hidden])
722 JE_CXXFLAGS_ADD([-fvisibility=hidden])
Jason Evansfa5d2452011-03-15 10:25:59 -0700723 fi
724fi
Jason Evans3cc1f1a2012-04-03 22:30:05 -0700725dnl Check for tls_model attribute support (clang 3.0 still lacks support).
Jason Evans194d6f92016-12-16 07:18:55 -0800726JE_CFLAGS_SAVE()
727JE_CFLAGS_ADD([-Werror])
728JE_CFLAGS_ADD([-herror_on_warning])
Jason Evans3cc1f1a2012-04-03 22:30:05 -0700729JE_COMPILABLE([tls_model attribute], [],
730 [static __thread int
Daniel Micayf1cf3ea2014-09-16 04:42:33 -0400731 __attribute__((tls_model("initial-exec"), unused)) foo;
Jason Evans3cc1f1a2012-04-03 22:30:05 -0700732 foo = 0;],
733 [je_cv_tls_model])
Jason Evans194d6f92016-12-16 07:18:55 -0800734JE_CFLAGS_RESTORE()
Jason Evans3cc1f1a2012-04-03 22:30:05 -0700735if test "x${je_cv_tls_model}" = "xyes" ; then
736 AC_DEFINE([JEMALLOC_TLS_MODEL],
737 [__attribute__((tls_model("initial-exec")))])
738else
739 AC_DEFINE([JEMALLOC_TLS_MODEL], [ ])
740fi
Jason Evans0b8f0bc2015-07-10 16:41:12 -0700741dnl Check for alloc_size attribute support.
Jason Evans194d6f92016-12-16 07:18:55 -0800742JE_CFLAGS_SAVE()
743JE_CFLAGS_ADD([-Werror])
744JE_CFLAGS_ADD([-herror_on_warning])
Jason Evans92d72ee2015-07-10 16:45:32 -0700745JE_COMPILABLE([alloc_size attribute], [#include <stdlib.h>],
746 [void *foo(size_t size) __attribute__((alloc_size(1)));],
Jason Evans0b8f0bc2015-07-10 16:41:12 -0700747 [je_cv_alloc_size])
Jason Evans194d6f92016-12-16 07:18:55 -0800748JE_CFLAGS_RESTORE()
Jason Evans0b8f0bc2015-07-10 16:41:12 -0700749if test "x${je_cv_alloc_size}" = "xyes" ; then
750 AC_DEFINE([JEMALLOC_HAVE_ATTR_ALLOC_SIZE], [ ])
751fi
Jason Evanse42c3092015-07-22 15:44:47 -0700752dnl Check for format(gnu_printf, ...) attribute support.
Jason Evans194d6f92016-12-16 07:18:55 -0800753JE_CFLAGS_SAVE()
754JE_CFLAGS_ADD([-Werror])
755JE_CFLAGS_ADD([-herror_on_warning])
Jason Evanse42c3092015-07-22 15:44:47 -0700756JE_COMPILABLE([format(gnu_printf, ...) attribute], [#include <stdlib.h>],
757 [void *foo(const char *format, ...) __attribute__((format(gnu_printf, 1, 2)));],
758 [je_cv_format_gnu_printf])
Jason Evans194d6f92016-12-16 07:18:55 -0800759JE_CFLAGS_RESTORE()
Jason Evanse42c3092015-07-22 15:44:47 -0700760if test "x${je_cv_format_gnu_printf}" = "xyes" ; then
761 AC_DEFINE([JEMALLOC_HAVE_ATTR_FORMAT_GNU_PRINTF], [ ])
762fi
763dnl Check for format(printf, ...) attribute support.
Jason Evans194d6f92016-12-16 07:18:55 -0800764JE_CFLAGS_SAVE()
765JE_CFLAGS_ADD([-Werror])
766JE_CFLAGS_ADD([-herror_on_warning])
Jason Evanse42c3092015-07-22 15:44:47 -0700767JE_COMPILABLE([format(printf, ...) attribute], [#include <stdlib.h>],
768 [void *foo(const char *format, ...) __attribute__((format(printf, 1, 2)));],
769 [je_cv_format_printf])
Jason Evans194d6f92016-12-16 07:18:55 -0800770JE_CFLAGS_RESTORE()
Jason Evanse42c3092015-07-22 15:44:47 -0700771if test "x${je_cv_format_printf}" = "xyes" ; then
772 AC_DEFINE([JEMALLOC_HAVE_ATTR_FORMAT_PRINTF], [ ])
773fi
Jason Evansfa5d2452011-03-15 10:25:59 -0700774
Jason Evansb7924f52009-06-23 19:01:18 -0700775dnl Support optional additions to rpath.
776AC_ARG_WITH([rpath],
Jason Evans90895cf2009-12-29 00:09:15 -0800777 [AS_HELP_STRING([--with-rpath=<rpath>], [Colon-separated rpath (ELF systems only)])],
Jason Evansb7924f52009-06-23 19:01:18 -0700778if test "x$with_rpath" = "xno" ; then
779 RPATH_EXTRA=
780else
781 RPATH_EXTRA="`echo $with_rpath | tr \":\" \" \"`"
782fi,
783 RPATH_EXTRA=
784)
785AC_SUBST([RPATH_EXTRA])
786
787dnl Disable rules that do automatic regeneration of configure output by default.
788AC_ARG_ENABLE([autogen],
Jason Evans78d815c2010-01-17 14:06:20 -0800789 [AS_HELP_STRING([--enable-autogen], [Automatically regenerate configure output])],
Jason Evansb7924f52009-06-23 19:01:18 -0700790if test "x$enable_autogen" = "xno" ; then
791 enable_autogen="0"
792else
793 enable_autogen="1"
794fi
795,
796enable_autogen="0"
797)
798AC_SUBST([enable_autogen])
799
800AC_PROG_INSTALL
801AC_PROG_RANLIB
Jason Evans7329a4f2013-01-22 10:53:29 -0800802AC_PATH_PROG([LD], [ld], [false], [$PATH])
803AC_PATH_PROG([AUTOCONF], [autoconf], [false], [$PATH])
Jason Evansb7924f52009-06-23 19:01:18 -0700804
Jason Evans0a5489e2012-03-01 17:19:20 -0800805dnl Perform no name mangling by default.
806AC_ARG_WITH([mangling],
807 [AS_HELP_STRING([--with-mangling=<map>], [Mangle symbols in <map>])],
808 [mangling_map="$with_mangling"], [mangling_map=""])
Jason Evans0a5489e2012-03-01 17:19:20 -0800809
Jason Evans90895cf2009-12-29 00:09:15 -0800810dnl Do not prefix public APIs by default.
811AC_ARG_WITH([jemalloc_prefix],
812 [AS_HELP_STRING([--with-jemalloc-prefix=<prefix>], [Prefix to prepend to all public APIs])],
Jason Evansb0fd5012010-01-17 01:49:20 -0800813 [JEMALLOC_PREFIX="$with_jemalloc_prefix"],
Mike Hommey7cdea392012-04-30 12:38:27 +0200814 [if test "x$abi" != "xmacho" -a "x$abi" != "xpecoff"; then
Jason Evans2dbecf12010-09-05 10:35:13 -0700815 JEMALLOC_PREFIX=""
816else
817 JEMALLOC_PREFIX="je_"
818fi]
Jason Evans90895cf2009-12-29 00:09:15 -0800819)
David Goldblatt425253e2017-04-21 13:47:49 -0700820if test "x$JEMALLOC_PREFIX" = "x" ; then
821 AC_DEFINE([JEMALLOC_IS_MALLOC])
822else
Jason Evanse7339702010-10-23 18:37:06 -0700823 JEMALLOC_CPREFIX=`echo ${JEMALLOC_PREFIX} | tr "a-z" "A-Z"`
824 AC_DEFINE_UNQUOTED([JEMALLOC_PREFIX], ["$JEMALLOC_PREFIX"])
825 AC_DEFINE_UNQUOTED([JEMALLOC_CPREFIX], ["$JEMALLOC_CPREFIX"])
Jason Evans90895cf2009-12-29 00:09:15 -0800826fi
Jason Evansff8062a2017-05-30 14:26:02 -0700827AC_SUBST([JEMALLOC_PREFIX])
Jason Evans241abc62015-06-23 18:47:07 -0700828AC_SUBST([JEMALLOC_CPREFIX])
Jason Evans90895cf2009-12-29 00:09:15 -0800829
Mike Hommey99066602012-11-19 10:55:26 +0100830AC_ARG_WITH([export],
831 [AS_HELP_STRING([--without-export], [disable exporting jemalloc public APIs])],
832 [if test "x$with_export" = "xno"; then
Jason Evans2625c892013-01-22 16:46:27 -0800833 AC_DEFINE([JEMALLOC_EXPORT],[])
Mike Hommey99066602012-11-19 10:55:26 +0100834fi]
835)
836
Jason Evans909f0482017-05-04 11:20:43 -0700837public_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"
838dnl Check for additional platform-specific public API functions.
839AC_CHECK_FUNC([memalign],
840 [AC_DEFINE([JEMALLOC_OVERRIDE_MEMALIGN], [ ])
841 public_syms="${public_syms} memalign"])
842AC_CHECK_FUNC([valloc],
843 [AC_DEFINE([JEMALLOC_OVERRIDE_VALLOC], [ ])
844 public_syms="${public_syms} valloc"])
845
846dnl Check for allocator-related functions that should be wrapped.
847wrap_syms=
848if test "x${JEMALLOC_PREFIX}" = "x" ; then
849 AC_CHECK_FUNC([__libc_calloc],
850 [AC_DEFINE([JEMALLOC_OVERRIDE___LIBC_CALLOC], [ ])
851 wrap_syms="${wrap_syms} __libc_calloc"])
852 AC_CHECK_FUNC([__libc_free],
853 [AC_DEFINE([JEMALLOC_OVERRIDE___LIBC_FREE], [ ])
854 wrap_syms="${wrap_syms} __libc_free"])
855 AC_CHECK_FUNC([__libc_malloc],
856 [AC_DEFINE([JEMALLOC_OVERRIDE___LIBC_MALLOC], [ ])
857 wrap_syms="${wrap_syms} __libc_malloc"])
858 AC_CHECK_FUNC([__libc_memalign],
859 [AC_DEFINE([JEMALLOC_OVERRIDE___LIBC_MEMALIGN], [ ])
860 wrap_syms="${wrap_syms} __libc_memalign"])
861 AC_CHECK_FUNC([__libc_realloc],
862 [AC_DEFINE([JEMALLOC_OVERRIDE___LIBC_REALLOC], [ ])
863 wrap_syms="${wrap_syms} __libc_realloc"])
864 AC_CHECK_FUNC([__libc_valloc],
865 [AC_DEFINE([JEMALLOC_OVERRIDE___LIBC_VALLOC], [ ])
866 wrap_syms="${wrap_syms} __libc_valloc"])
867 AC_CHECK_FUNC([__posix_memalign],
868 [AC_DEFINE([JEMALLOC_OVERRIDE___POSIX_MEMALIGN], [ ])
869 wrap_syms="${wrap_syms} __posix_memalign"])
870fi
871
872case "${host}" in
873 *-*-mingw* | *-*-cygwin*)
874 wrap_syms="${wrap_syms} tls_callback"
875 ;;
876 *)
877 ;;
878esac
879
Jason Evans86abd0d2013-11-30 15:25:42 -0800880dnl Mangle library-private APIs.
Jason Evans746e77a2011-07-30 16:40:52 -0700881AC_ARG_WITH([private_namespace],
882 [AS_HELP_STRING([--with-private-namespace=<prefix>], [Prefix to prepend to all library-private APIs])],
Jason Evans86abd0d2013-11-30 15:25:42 -0800883 [JEMALLOC_PRIVATE_NAMESPACE="${with_private_namespace}je_"],
884 [JEMALLOC_PRIVATE_NAMESPACE="je_"]
Jason Evans746e77a2011-07-30 16:40:52 -0700885)
Jason Evans86abd0d2013-11-30 15:25:42 -0800886AC_DEFINE_UNQUOTED([JEMALLOC_PRIVATE_NAMESPACE], [$JEMALLOC_PRIVATE_NAMESPACE])
887private_namespace="$JEMALLOC_PRIVATE_NAMESPACE"
888AC_SUBST([private_namespace])
Jason Evans746e77a2011-07-30 16:40:52 -0700889
Jason Evansb0fd5012010-01-17 01:49:20 -0800890dnl Do not add suffix to installed files by default.
891AC_ARG_WITH([install_suffix],
892 [AS_HELP_STRING([--with-install-suffix=<suffix>], [Suffix to append to all installed files])],
893 [INSTALL_SUFFIX="$with_install_suffix"],
894 [INSTALL_SUFFIX=]
895)
896install_suffix="$INSTALL_SUFFIX"
897AC_SUBST([install_suffix])
898
Jason Evansf8290092016-02-07 14:23:22 -0800899dnl Specify default malloc_conf.
900AC_ARG_WITH([malloc_conf],
901 [AS_HELP_STRING([--with-malloc-conf=<malloc_conf>], [config.malloc_conf options string])],
902 [JEMALLOC_CONFIG_MALLOC_CONF="$with_malloc_conf"],
903 [JEMALLOC_CONFIG_MALLOC_CONF=""]
904)
905config_malloc_conf="$JEMALLOC_CONFIG_MALLOC_CONF"
906AC_DEFINE_UNQUOTED([JEMALLOC_CONFIG_MALLOC_CONF], ["$config_malloc_conf"])
907
Jason Evans86abd0d2013-11-30 15:25:42 -0800908dnl Substitute @je_@ in jemalloc_protos.h.in, primarily to make generation of
909dnl jemalloc_protos_jet.h easy.
910je_="je_"
911AC_SUBST([je_])
912
Mike Hommeycf6032d2014-07-30 18:16:13 +0900913cfgoutputs_in="Makefile.in"
Nick White913e9a82014-09-19 22:01:23 +0100914cfgoutputs_in="${cfgoutputs_in} jemalloc.pc.in"
Mike Hommeycf6032d2014-07-30 18:16:13 +0900915cfgoutputs_in="${cfgoutputs_in} doc/html.xsl.in"
916cfgoutputs_in="${cfgoutputs_in} doc/manpages.xsl.in"
917cfgoutputs_in="${cfgoutputs_in} doc/jemalloc.xml.in"
918cfgoutputs_in="${cfgoutputs_in} include/jemalloc/jemalloc_macros.h.in"
919cfgoutputs_in="${cfgoutputs_in} include/jemalloc/jemalloc_protos.h.in"
Jason Evans82e88d12014-09-07 19:55:03 -0700920cfgoutputs_in="${cfgoutputs_in} include/jemalloc/jemalloc_typedefs.h.in"
David Goldblatt743d9402017-04-10 18:17:55 -0700921cfgoutputs_in="${cfgoutputs_in} include/jemalloc/internal/jemalloc_preamble.h.in"
Mike Hommeycf6032d2014-07-30 18:16:13 +0900922cfgoutputs_in="${cfgoutputs_in} test/test.sh.in"
923cfgoutputs_in="${cfgoutputs_in} test/include/test/jemalloc_test.h.in"
Jason Evansb0fd5012010-01-17 01:49:20 -0800924
Jason Evansaee7fd22010-11-24 22:00:02 -0800925cfgoutputs_out="Makefile"
Nick White913e9a82014-09-19 22:01:23 +0100926cfgoutputs_out="${cfgoutputs_out} jemalloc.pc"
Jason Evansaee7fd22010-11-24 22:00:02 -0800927cfgoutputs_out="${cfgoutputs_out} doc/html.xsl"
928cfgoutputs_out="${cfgoutputs_out} doc/manpages.xsl"
Jason Evans86abd0d2013-11-30 15:25:42 -0800929cfgoutputs_out="${cfgoutputs_out} doc/jemalloc.xml"
930cfgoutputs_out="${cfgoutputs_out} include/jemalloc/jemalloc_macros.h"
931cfgoutputs_out="${cfgoutputs_out} include/jemalloc/jemalloc_protos.h"
Jason Evans82e88d12014-09-07 19:55:03 -0700932cfgoutputs_out="${cfgoutputs_out} include/jemalloc/jemalloc_typedefs.h"
David Goldblatt743d9402017-04-10 18:17:55 -0700933cfgoutputs_out="${cfgoutputs_out} include/jemalloc/internal/jemalloc_preamble.h"
Jason Evans86abd0d2013-11-30 15:25:42 -0800934cfgoutputs_out="${cfgoutputs_out} test/test.sh"
935cfgoutputs_out="${cfgoutputs_out} test/include/test/jemalloc_test.h"
Jason Evansb0fd5012010-01-17 01:49:20 -0800936
Jason Evansaee7fd22010-11-24 22:00:02 -0800937cfgoutputs_tup="Makefile"
Nick White913e9a82014-09-19 22:01:23 +0100938cfgoutputs_tup="${cfgoutputs_tup} jemalloc.pc:jemalloc.pc.in"
Jason Evansaee7fd22010-11-24 22:00:02 -0800939cfgoutputs_tup="${cfgoutputs_tup} doc/html.xsl:doc/html.xsl.in"
940cfgoutputs_tup="${cfgoutputs_tup} doc/manpages.xsl:doc/manpages.xsl.in"
Jason Evans86abd0d2013-11-30 15:25:42 -0800941cfgoutputs_tup="${cfgoutputs_tup} doc/jemalloc.xml:doc/jemalloc.xml.in"
942cfgoutputs_tup="${cfgoutputs_tup} include/jemalloc/jemalloc_macros.h:include/jemalloc/jemalloc_macros.h.in"
943cfgoutputs_tup="${cfgoutputs_tup} include/jemalloc/jemalloc_protos.h:include/jemalloc/jemalloc_protos.h.in"
Jason Evans82e88d12014-09-07 19:55:03 -0700944cfgoutputs_tup="${cfgoutputs_tup} include/jemalloc/jemalloc_typedefs.h:include/jemalloc/jemalloc_typedefs.h.in"
David Goldblatt743d9402017-04-10 18:17:55 -0700945cfgoutputs_tup="${cfgoutputs_tup} include/jemalloc/internal/jemalloc_preamble.h"
Jason Evans86abd0d2013-11-30 15:25:42 -0800946cfgoutputs_tup="${cfgoutputs_tup} test/test.sh:test/test.sh.in"
947cfgoutputs_tup="${cfgoutputs_tup} test/include/test/jemalloc_test.h:test/include/test/jemalloc_test.h.in"
Jason Evansb0fd5012010-01-17 01:49:20 -0800948
Mike Hommeycf6032d2014-07-30 18:16:13 +0900949cfghdrs_in="include/jemalloc/jemalloc_defs.h.in"
950cfghdrs_in="${cfghdrs_in} include/jemalloc/internal/jemalloc_internal_defs.h.in"
Jason Evans909f0482017-05-04 11:20:43 -0700951cfghdrs_in="${cfghdrs_in} include/jemalloc/internal/private_symbols.sh"
Mike Hommeycf6032d2014-07-30 18:16:13 +0900952cfghdrs_in="${cfghdrs_in} include/jemalloc/internal/private_namespace.sh"
Mike Hommeycf6032d2014-07-30 18:16:13 +0900953cfghdrs_in="${cfghdrs_in} include/jemalloc/internal/public_namespace.sh"
954cfghdrs_in="${cfghdrs_in} include/jemalloc/internal/public_unnamespace.sh"
955cfghdrs_in="${cfghdrs_in} include/jemalloc/internal/size_classes.sh"
956cfghdrs_in="${cfghdrs_in} include/jemalloc/jemalloc_rename.sh"
957cfghdrs_in="${cfghdrs_in} include/jemalloc/jemalloc_mangle.sh"
958cfghdrs_in="${cfghdrs_in} include/jemalloc/jemalloc.sh"
959cfghdrs_in="${cfghdrs_in} test/include/test/jemalloc_test_defs.h.in"
Jason Evansb0fd5012010-01-17 01:49:20 -0800960
Jason Evans86abd0d2013-11-30 15:25:42 -0800961cfghdrs_out="include/jemalloc/jemalloc_defs.h"
962cfghdrs_out="${cfghdrs_out} include/jemalloc/jemalloc${install_suffix}.h"
Jason Evans909f0482017-05-04 11:20:43 -0700963cfghdrs_out="${cfghdrs_out} include/jemalloc/internal/private_symbols.awk"
964cfghdrs_out="${cfghdrs_out} include/jemalloc/internal/private_symbols_jet.awk"
Jason Evansf234dc52014-01-16 17:38:01 -0800965cfghdrs_out="${cfghdrs_out} include/jemalloc/internal/public_symbols.txt"
Jason Evans86abd0d2013-11-30 15:25:42 -0800966cfghdrs_out="${cfghdrs_out} include/jemalloc/internal/public_namespace.h"
967cfghdrs_out="${cfghdrs_out} include/jemalloc/internal/public_unnamespace.h"
Jason Evansb1726102012-02-28 16:50:47 -0800968cfghdrs_out="${cfghdrs_out} include/jemalloc/internal/size_classes.h"
Jason Evansf234dc52014-01-16 17:38:01 -0800969cfghdrs_out="${cfghdrs_out} include/jemalloc/jemalloc_protos_jet.h"
970cfghdrs_out="${cfghdrs_out} include/jemalloc/jemalloc_rename.h"
971cfghdrs_out="${cfghdrs_out} include/jemalloc/jemalloc_mangle.h"
972cfghdrs_out="${cfghdrs_out} include/jemalloc/jemalloc_mangle_jet.h"
973cfghdrs_out="${cfghdrs_out} include/jemalloc/internal/jemalloc_internal_defs.h"
Jason Evans80061b62013-12-09 13:21:08 -0800974cfghdrs_out="${cfghdrs_out} test/include/test/jemalloc_test_defs.h"
Jason Evansb0fd5012010-01-17 01:49:20 -0800975
Jason Evans86abd0d2013-11-30 15:25:42 -0800976cfghdrs_tup="include/jemalloc/jemalloc_defs.h:include/jemalloc/jemalloc_defs.h.in"
Mike Hommeycf6032d2014-07-30 18:16:13 +0900977cfghdrs_tup="${cfghdrs_tup} include/jemalloc/internal/jemalloc_internal_defs.h:include/jemalloc/internal/jemalloc_internal_defs.h.in"
978cfghdrs_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 -0800979
Jason Evansb7924f52009-06-23 19:01:18 -0700980dnl Do not compile with debugging by default.
981AC_ARG_ENABLE([debug],
Jason Evanse0a08a12015-03-18 21:06:58 -0700982 [AS_HELP_STRING([--enable-debug],
Jason Evans3823eff2017-04-21 11:00:36 -0700983 [Build debugging code])],
Jason Evansb7924f52009-06-23 19:01:18 -0700984[if test "x$enable_debug" = "xno" ; then
985 enable_debug="0"
986else
987 enable_debug="1"
988fi
989],
990[enable_debug="0"]
991)
Jason Evans02e5dcf2015-02-15 20:12:06 -0800992if test "x$enable_debug" = "x1" ; then
993 AC_DEFINE([JEMALLOC_DEBUG], [ ])
994fi
Jason Evanse0a08a12015-03-18 21:06:58 -0700995if test "x$enable_debug" = "x1" ; then
996 AC_DEFINE([JEMALLOC_DEBUG], [ ])
Jason Evanse0a08a12015-03-18 21:06:58 -0700997fi
Jason Evansb7924f52009-06-23 19:01:18 -0700998AC_SUBST([enable_debug])
999
1000dnl Only optimize if not debugging.
Jason Evans194d6f92016-12-16 07:18:55 -08001001if test "x$enable_debug" = "x0" ; then
1002 if test "x$GCC" = "xyes" ; then
1003 JE_CFLAGS_ADD([-O3])
1004 JE_CXXFLAGS_ADD([-O3])
1005 JE_CFLAGS_ADD([-funroll-loops])
1006 elif test "x$je_cv_msvc" = "xyes" ; then
1007 JE_CFLAGS_ADD([-O2])
1008 JE_CXXFLAGS_ADD([-O2])
1009 else
1010 JE_CFLAGS_ADD([-O])
1011 JE_CXXFLAGS_ADD([-O])
Jason Evansb7924f52009-06-23 19:01:18 -07001012 fi
1013fi
1014
Jason Evansd073a322012-02-28 20:41:16 -08001015dnl Enable statistics calculation by default.
Jason Evansb7924f52009-06-23 19:01:18 -07001016AC_ARG_ENABLE([stats],
Jason Evans777c1912012-02-28 20:49:22 -08001017 [AS_HELP_STRING([--disable-stats],
1018 [Disable statistics calculation/reporting])],
Jason Evansb7924f52009-06-23 19:01:18 -07001019[if test "x$enable_stats" = "xno" ; then
1020 enable_stats="0"
1021else
1022 enable_stats="1"
1023fi
1024],
Jason Evansd073a322012-02-28 20:41:16 -08001025[enable_stats="1"]
Jason Evansb7924f52009-06-23 19:01:18 -07001026)
1027if test "x$enable_stats" = "x1" ; then
1028 AC_DEFINE([JEMALLOC_STATS], [ ])
1029fi
1030AC_SUBST([enable_stats])
1031
Jason Evans6109fe02010-02-10 10:37:56 -08001032dnl Do not enable profiling by default.
1033AC_ARG_ENABLE([prof],
1034 [AS_HELP_STRING([--enable-prof], [Enable allocation profiling])],
1035[if test "x$enable_prof" = "xno" ; then
1036 enable_prof="0"
1037else
1038 enable_prof="1"
1039fi
1040],
1041[enable_prof="0"]
1042)
Jason Evans77f350b2011-03-15 22:23:12 -07001043if test "x$enable_prof" = "x1" ; then
1044 backtrace_method=""
Jason Evansb27805b2010-02-10 18:15:53 -08001045else
Jason Evans77f350b2011-03-15 22:23:12 -07001046 backtrace_method="N/A"
Jason Evansb27805b2010-02-10 18:15:53 -08001047fi
Jason Evans77f350b2011-03-15 22:23:12 -07001048
Jason Evans6109fe02010-02-10 10:37:56 -08001049AC_ARG_ENABLE([prof-libunwind],
1050 [AS_HELP_STRING([--enable-prof-libunwind], [Use libunwind for backtracing])],
1051[if test "x$enable_prof_libunwind" = "xno" ; then
1052 enable_prof_libunwind="0"
1053else
1054 enable_prof_libunwind="1"
1055fi
1056],
1057[enable_prof_libunwind="0"]
1058)
Jason Evansca6bd4f2010-03-02 14:12:58 -08001059AC_ARG_WITH([static_libunwind],
1060 [AS_HELP_STRING([--with-static-libunwind=<libunwind.a>],
1061 [Path to static libunwind library; use rather than dynamically linking])],
1062if test "x$with_static_libunwind" = "xno" ; then
1063 LUNWIND="-lunwind"
1064else
1065 if test ! -f "$with_static_libunwind" ; then
1066 AC_MSG_ERROR([Static libunwind not found: $with_static_libunwind])
1067 fi
1068 LUNWIND="$with_static_libunwind"
1069fi,
1070 LUNWIND="-lunwind"
1071)
Jason Evans77f350b2011-03-15 22:23:12 -07001072if test "x$backtrace_method" = "x" -a "x$enable_prof_libunwind" = "x1" ; then
1073 AC_CHECK_HEADERS([libunwind.h], , [enable_prof_libunwind="0"])
1074 if test "x$LUNWIND" = "x-lunwind" ; then
Jason Evans194d6f92016-12-16 07:18:55 -08001075 AC_CHECK_LIB([unwind], [unw_backtrace], [JE_APPEND_VS(LIBS, $LUNWIND)],
Jason Evans77f350b2011-03-15 22:23:12 -07001076 [enable_prof_libunwind="0"])
1077 else
Jason Evans194d6f92016-12-16 07:18:55 -08001078 JE_APPEND_VS(LIBS, $LUNWIND)
Jason Evans77f350b2011-03-15 22:23:12 -07001079 fi
1080 if test "x${enable_prof_libunwind}" = "x1" ; then
1081 backtrace_method="libunwind"
1082 AC_DEFINE([JEMALLOC_PROF_LIBUNWIND], [ ])
1083 fi
1084fi
1085
1086AC_ARG_ENABLE([prof-libgcc],
1087 [AS_HELP_STRING([--disable-prof-libgcc],
1088 [Do not use libgcc for backtracing])],
1089[if test "x$enable_prof_libgcc" = "xno" ; then
1090 enable_prof_libgcc="0"
1091else
1092 enable_prof_libgcc="1"
1093fi
1094],
1095[enable_prof_libgcc="1"]
1096)
1097if test "x$backtrace_method" = "x" -a "x$enable_prof_libgcc" = "x1" \
1098 -a "x$GCC" = "xyes" ; then
1099 AC_CHECK_HEADERS([unwind.h], , [enable_prof_libgcc="0"])
Jason Evans664ef652017-02-18 00:02:23 -08001100 if test "x${enable_prof_libgcc}" = "x1" ; then
1101 AC_CHECK_LIB([gcc], [_Unwind_Backtrace], [JE_APPEND_VS(LIBS, -lgcc)], [enable_prof_libgcc="0"])
1102 fi
Jason Evans77f350b2011-03-15 22:23:12 -07001103 if test "x${enable_prof_libgcc}" = "x1" ; then
1104 backtrace_method="libgcc"
1105 AC_DEFINE([JEMALLOC_PROF_LIBGCC], [ ])
1106 fi
1107else
1108 enable_prof_libgcc="0"
1109fi
1110
1111AC_ARG_ENABLE([prof-gcc],
1112 [AS_HELP_STRING([--disable-prof-gcc],
1113 [Do not use gcc intrinsics for backtracing])],
1114[if test "x$enable_prof_gcc" = "xno" ; then
1115 enable_prof_gcc="0"
1116else
1117 enable_prof_gcc="1"
1118fi
1119],
1120[enable_prof_gcc="1"]
1121)
1122if test "x$backtrace_method" = "x" -a "x$enable_prof_gcc" = "x1" \
1123 -a "x$GCC" = "xyes" ; then
Jason Evans194d6f92016-12-16 07:18:55 -08001124 JE_CFLAGS_ADD([-fno-omit-frame-pointer])
Jason Evans77f350b2011-03-15 22:23:12 -07001125 backtrace_method="gcc intrinsics"
1126 AC_DEFINE([JEMALLOC_PROF_GCC], [ ])
1127else
1128 enable_prof_gcc="0"
1129fi
1130
1131if test "x$backtrace_method" = "x" ; then
1132 backtrace_method="none (disabling profiling)"
1133 enable_prof="0"
1134fi
1135AC_MSG_CHECKING([configured backtracing method])
1136AC_MSG_RESULT([$backtrace_method])
Jason Evans2dbecf12010-09-05 10:35:13 -07001137if test "x$enable_prof" = "x1" ; then
Jason Evansd76cfec2016-10-27 21:23:48 -07001138 dnl Heap profiling uses the log(3) function.
Jason Evans194d6f92016-12-16 07:18:55 -08001139 JE_APPEND_VS(LIBS, $LM)
Jason Evansd37d5ad2013-12-05 23:01:50 -08001140
Jason Evans2dbecf12010-09-05 10:35:13 -07001141 AC_DEFINE([JEMALLOC_PROF], [ ])
Jason Evans2dbecf12010-09-05 10:35:13 -07001142fi
1143AC_SUBST([enable_prof])
Jason Evans2dbecf12010-09-05 10:35:13 -07001144
Jason Evansd059b9d2015-07-24 18:21:42 -07001145dnl Indicate whether adjacent virtual memory mappings automatically coalesce
1146dnl (and fragment on demand).
1147if test "x${maps_coalesce}" = "x1" ; then
1148 AC_DEFINE([JEMALLOC_MAPS_COALESCE], [ ])
1149fi
1150
Jason Evansc86c8f42017-04-27 15:51:35 -07001151dnl Indicate whether to retain memory (rather than using munmap()) by default.
Jason Evansb9ab04a2017-04-26 16:26:12 -07001152if test "x$default_retain" = "x1" ; then
1153 AC_DEFINE([JEMALLOC_RETAIN], [ ])
Jason Evans59ae2762012-04-16 17:52:27 -07001154fi
Jason Evans59ae2762012-04-16 17:52:27 -07001155
Jason Evans4d434ad2014-04-15 12:09:48 -07001156dnl Enable allocation from DSS if supported by the OS.
1157have_dss="1"
Mike Hommey83c324a2012-04-12 10:13:03 +02001158dnl Check whether the BSD/SUSv1 sbrk() exists. If not, disable DSS support.
1159AC_CHECK_FUNC([sbrk], [have_sbrk="1"], [have_sbrk="0"])
1160if test "x$have_sbrk" = "x1" ; then
Steven Stewart-Gallus79230fe2014-06-19 16:11:43 -07001161 if test "x$sbrk_deprecated" = "x1" ; then
Jason Evans66688532013-12-03 21:49:36 -08001162 AC_MSG_RESULT([Disabling dss allocation because sbrk is deprecated])
Jason Evans4d434ad2014-04-15 12:09:48 -07001163 have_dss="0"
Jason Evans66688532013-12-03 21:49:36 -08001164 fi
Mike Hommey83c324a2012-04-12 10:13:03 +02001165else
Jason Evans4d434ad2014-04-15 12:09:48 -07001166 have_dss="0"
Mike Hommey83c324a2012-04-12 10:13:03 +02001167fi
1168
Jason Evans4d434ad2014-04-15 12:09:48 -07001169if test "x$have_dss" = "x1" ; then
Jason Evansb7924f52009-06-23 19:01:18 -07001170 AC_DEFINE([JEMALLOC_DSS], [ ])
1171fi
Jason Evansb7924f52009-06-23 19:01:18 -07001172
Jason Evans777c1912012-02-28 20:49:22 -08001173dnl Support the junk/zero filling option by default.
Jason Evansb7924f52009-06-23 19:01:18 -07001174AC_ARG_ENABLE([fill],
Jason Evans17c021c2016-04-05 18:18:15 -07001175 [AS_HELP_STRING([--disable-fill], [Disable support for junk/zero filling])],
Jason Evansb7924f52009-06-23 19:01:18 -07001176[if test "x$enable_fill" = "xno" ; then
1177 enable_fill="0"
1178else
1179 enable_fill="1"
1180fi
1181],
Jason Evans777c1912012-02-28 20:49:22 -08001182[enable_fill="1"]
Jason Evansb7924f52009-06-23 19:01:18 -07001183)
1184if test "x$enable_fill" = "x1" ; then
1185 AC_DEFINE([JEMALLOC_FILL], [ ])
1186fi
1187AC_SUBST([enable_fill])
1188
Jason Evansb1476112012-04-05 13:36:17 -07001189dnl Disable utrace(2)-based tracing by default.
1190AC_ARG_ENABLE([utrace],
1191 [AS_HELP_STRING([--enable-utrace], [Enable utrace(2)-based tracing])],
1192[if test "x$enable_utrace" = "xno" ; then
1193 enable_utrace="0"
1194else
1195 enable_utrace="1"
1196fi
1197],
1198[enable_utrace="0"]
1199)
1200JE_COMPILABLE([utrace(2)], [
1201#include <sys/types.h>
1202#include <sys/param.h>
1203#include <sys/time.h>
1204#include <sys/uio.h>
1205#include <sys/ktrace.h>
1206], [
1207 utrace((void *)0, 0);
1208], [je_cv_utrace])
1209if test "x${je_cv_utrace}" = "xno" ; then
1210 enable_utrace="0"
1211fi
1212if test "x$enable_utrace" = "x1" ; then
1213 AC_DEFINE([JEMALLOC_UTRACE], [ ])
1214fi
1215AC_SUBST([enable_utrace])
1216
Jason Evansb7924f52009-06-23 19:01:18 -07001217dnl Do not support the xmalloc option by default.
1218AC_ARG_ENABLE([xmalloc],
1219 [AS_HELP_STRING([--enable-xmalloc], [Support xmalloc option])],
1220[if test "x$enable_xmalloc" = "xno" ; then
1221 enable_xmalloc="0"
1222else
1223 enable_xmalloc="1"
1224fi
1225],
1226[enable_xmalloc="0"]
1227)
1228if test "x$enable_xmalloc" = "x1" ; then
1229 AC_DEFINE([JEMALLOC_XMALLOC], [ ])
1230fi
1231AC_SUBST([enable_xmalloc])
1232
Jason Evans8a03cf02015-05-04 09:58:36 -07001233dnl Support cache-oblivious allocation alignment by default.
1234AC_ARG_ENABLE([cache-oblivious],
1235 [AS_HELP_STRING([--disable-cache-oblivious],
1236 [Disable support for cache-oblivious allocation alignment])],
1237[if test "x$enable_cache_oblivious" = "xno" ; then
1238 enable_cache_oblivious="0"
1239else
1240 enable_cache_oblivious="1"
1241fi
1242],
1243[enable_cache_oblivious="1"]
1244)
1245if test "x$enable_cache_oblivious" = "x1" ; then
1246 AC_DEFINE([JEMALLOC_CACHE_OBLIVIOUS], [ ])
1247fi
1248AC_SUBST([enable_cache_oblivious])
1249
David T. Goldblatt9761b442017-07-19 16:36:46 -07001250dnl Do not log by default.
1251AC_ARG_ENABLE([log],
1252 [AS_HELP_STRING([--enable-log], [Support debug logging])],
1253[if test "x$enable_log" = "xno" ; then
1254 enable_log="0"
1255else
1256 enable_log="1"
1257fi
1258],
1259[enable_log="0"]
1260)
1261if test "x$enable_log" = "x1" ; then
1262 AC_DEFINE([JEMALLOC_LOG], [ ])
1263fi
1264AC_SUBST([enable_log])
Elliot Ronaghan1167e9e2016-06-17 13:28:39 -07001265
1266
1267JE_COMPILABLE([a program using __builtin_unreachable], [
1268void foo (void) {
1269 __builtin_unreachable();
1270}
1271], [
1272 {
1273 foo();
1274 }
1275], [je_cv_gcc_builtin_unreachable])
Elliot Ronaghanc096ccf2016-07-12 15:52:18 -07001276if test "x${je_cv_gcc_builtin_unreachable}" = "xyes" ; then
Elliot Ronaghan1167e9e2016-06-17 13:28:39 -07001277 AC_DEFINE([JEMALLOC_INTERNAL_UNREACHABLE], [__builtin_unreachable])
1278else
1279 AC_DEFINE([JEMALLOC_INTERNAL_UNREACHABLE], [abort])
1280fi
1281
Mike Hommey8f50ec82014-06-04 12:12:55 +09001282dnl ============================================================================
1283dnl Check for __builtin_ffsl(), then ffsl(3), and fail if neither are found.
1284dnl One of those two functions should (theoretically) exist on all platforms
1285dnl that jemalloc currently has a chance of functioning on without modification.
Jason Evansecae1232016-02-20 23:41:33 -08001286dnl We additionally assume ffs[ll]() or __builtin_ffs[ll]() are defined if
Mike Hommey8f50ec82014-06-04 12:12:55 +09001287dnl ffsl() or __builtin_ffsl() are defined, respectively.
1288JE_COMPILABLE([a program using __builtin_ffsl], [
1289#include <stdio.h>
1290#include <strings.h>
1291#include <string.h>
1292], [
1293 {
1294 int rv = __builtin_ffsl(0x08);
1295 printf("%d\n", rv);
1296 }
1297], [je_cv_gcc_builtin_ffsl])
Steven Stewart-Gallus79230fe2014-06-19 16:11:43 -07001298if test "x${je_cv_gcc_builtin_ffsl}" = "xyes" ; then
Jason Evansecae1232016-02-20 23:41:33 -08001299 AC_DEFINE([JEMALLOC_INTERNAL_FFSLL], [__builtin_ffsll])
Mike Hommey8f50ec82014-06-04 12:12:55 +09001300 AC_DEFINE([JEMALLOC_INTERNAL_FFSL], [__builtin_ffsl])
1301 AC_DEFINE([JEMALLOC_INTERNAL_FFS], [__builtin_ffs])
1302else
1303 JE_COMPILABLE([a program using ffsl], [
1304 #include <stdio.h>
1305 #include <strings.h>
1306 #include <string.h>
1307 ], [
1308 {
1309 int rv = ffsl(0x08);
1310 printf("%d\n", rv);
1311 }
1312 ], [je_cv_function_ffsl])
Steven Stewart-Gallus79230fe2014-06-19 16:11:43 -07001313 if test "x${je_cv_function_ffsl}" = "xyes" ; then
Jason Evansecae1232016-02-20 23:41:33 -08001314 AC_DEFINE([JEMALLOC_INTERNAL_FFSLL], [ffsll])
Mike Hommey8f50ec82014-06-04 12:12:55 +09001315 AC_DEFINE([JEMALLOC_INTERNAL_FFSL], [ffsl])
1316 AC_DEFINE([JEMALLOC_INTERNAL_FFS], [ffs])
1317 else
1318 AC_MSG_ERROR([Cannot build without ffsl(3) or __builtin_ffsl()])
1319 fi
1320fi
1321
Jason Evansfc0b3b72014-10-09 17:54:06 -07001322AC_ARG_WITH([lg_quantum],
1323 [AS_HELP_STRING([--with-lg-quantum=<lg-quantum>],
1324 [Base 2 log of minimum allocation alignment])],
Jason Evans81e54752014-10-10 22:34:25 -07001325 [LG_QUANTA="$with_lg_quantum"],
1326 [LG_QUANTA="3 4"])
1327if test "x$with_lg_quantum" != "x" ; then
1328 AC_DEFINE_UNQUOTED([LG_QUANTUM], [$with_lg_quantum])
1329fi
Jason Evansfc0b3b72014-10-09 17:54:06 -07001330
1331AC_ARG_WITH([lg_page],
1332 [AS_HELP_STRING([--with-lg-page=<lg-page>], [Base 2 log of system page size])],
1333 [LG_PAGE="$with_lg_page"], [LG_PAGE="detect"])
Jason Evansb0808d52015-02-03 12:39:31 -08001334if test "x$LG_PAGE" = "xdetect"; then
Jason Evansfc0b3b72014-10-09 17:54:06 -07001335 AC_CACHE_CHECK([LG_PAGE],
1336 [je_cv_lg_page],
Jason Evans6684cac2012-03-05 12:15:36 -08001337 AC_RUN_IFELSE([AC_LANG_PROGRAM(
Mike Hommeya19e87f2012-04-21 21:27:46 -07001338[[
Mike Hommeyfd97b1d2012-04-30 12:38:31 +02001339#include <strings.h>
Mike Hommeya19e87f2012-04-21 21:27:46 -07001340#ifdef _WIN32
1341#include <windows.h>
1342#else
Jason Evansb7924f52009-06-23 19:01:18 -07001343#include <unistd.h>
Mike Hommeya19e87f2012-04-21 21:27:46 -07001344#endif
1345#include <stdio.h>
Jason Evans6684cac2012-03-05 12:15:36 -08001346]],
1347[[
Garrett Cooper72c1e592012-12-02 17:57:28 -08001348 int result;
Jason Evansb7924f52009-06-23 19:01:18 -07001349 FILE *f;
1350
Mike Hommeya19e87f2012-04-21 21:27:46 -07001351#ifdef _WIN32
1352 SYSTEM_INFO si;
1353 GetSystemInfo(&si);
1354 result = si.dwPageSize;
1355#else
Jason Evansb7924f52009-06-23 19:01:18 -07001356 result = sysconf(_SC_PAGESIZE);
Mike Hommeya19e87f2012-04-21 21:27:46 -07001357#endif
Jason Evansb7924f52009-06-23 19:01:18 -07001358 if (result == -1) {
1359 return 1;
1360 }
Mike Hommey8f50ec82014-06-04 12:12:55 +09001361 result = JEMALLOC_INTERNAL_FFSL(result) - 1;
Mike Hommeya19e87f2012-04-21 21:27:46 -07001362
Jason Evansb7924f52009-06-23 19:01:18 -07001363 f = fopen("conftest.out", "w");
1364 if (f == NULL) {
1365 return 1;
1366 }
rustyxbc498632016-01-30 13:38:33 +01001367 fprintf(f, "%d", result);
Jason Evans3cc1f1a2012-04-03 22:30:05 -07001368 fclose(f);
Jason Evansb7924f52009-06-23 19:01:18 -07001369
1370 return 0;
1371]])],
Jason Evansfc0b3b72014-10-09 17:54:06 -07001372 [je_cv_lg_page=`cat conftest.out`],
1373 [je_cv_lg_page=undefined],
1374 [je_cv_lg_page=12]))
Jason Evans6684cac2012-03-05 12:15:36 -08001375fi
Jason Evansfc0b3b72014-10-09 17:54:06 -07001376if test "x${je_cv_lg_page}" != "x" ; then
1377 LG_PAGE="${je_cv_lg_page}"
1378fi
1379if test "x${LG_PAGE}" != "xundefined" ; then
1380 AC_DEFINE_UNQUOTED([LG_PAGE], [$LG_PAGE])
1381else
1382 AC_MSG_ERROR([cannot determine value for LG_PAGE])
1383fi
1384
Jason Evansc1baa0a2016-11-17 13:36:17 -08001385AC_ARG_WITH([lg_hugepage],
1386 [AS_HELP_STRING([--with-lg-hugepage=<lg-hugepage>],
charsyama8c9e9c2017-03-01 20:58:38 +09001387 [Base 2 log of system huge page size])],
Jason Evansc1baa0a2016-11-17 13:36:17 -08001388 [je_cv_lg_hugepage="${with_lg_hugepage}"],
1389 [je_cv_lg_hugepage=""])
1390if test "x${je_cv_lg_hugepage}" = "x" ; then
1391 dnl Look in /proc/meminfo (Linux-specific) for information on the default huge
1392 dnl page size, if any. The relevant line looks like:
1393 dnl
1394 dnl Hugepagesize: 2048 kB
1395 if test -e "/proc/meminfo" ; then
1396 hpsk=[`cat /proc/meminfo 2>/dev/null | \
1397 grep -e '^Hugepagesize:[[:space:]]\+[0-9]\+[[:space:]]kB$' | \
1398 awk '{print $2}'`]
1399 if test "x${hpsk}" != "x" ; then
1400 je_cv_lg_hugepage=10
1401 while test "${hpsk}" -gt 1 ; do
1402 hpsk="$((hpsk / 2))"
1403 je_cv_lg_hugepage="$((je_cv_lg_hugepage + 1))"
1404 done
1405 fi
1406 fi
1407
1408 dnl Set default if unable to automatically configure.
1409 if test "x${je_cv_lg_hugepage}" = "x" ; then
1410 je_cv_lg_hugepage=21
1411 fi
1412fi
Jason Evansc99e5702017-06-23 12:35:17 -07001413if test "x${LG_PAGE}" != "xundefined" -a \
1414 "${je_cv_lg_hugepage}" -lt "${LG_PAGE}" ; then
1415 AC_MSG_ERROR([Huge page size (2^${je_cv_lg_hugepage}) must be at least page size (2^${LG_PAGE})])
1416fi
Jason Evansc1baa0a2016-11-17 13:36:17 -08001417AC_DEFINE_UNQUOTED([LG_HUGEPAGE], [${je_cv_lg_hugepage}])
1418
Jason Evansfc0b3b72014-10-09 17:54:06 -07001419AC_ARG_WITH([lg_page_sizes],
1420 [AS_HELP_STRING([--with-lg-page-sizes=<lg-page-sizes>],
1421 [Base 2 logs of system page sizes to support])],
1422 [LG_PAGE_SIZES="$with_lg_page_sizes"], [LG_PAGE_SIZES="$LG_PAGE"])
1423
Jason Evansb7924f52009-06-23 19:01:18 -07001424dnl ============================================================================
1425dnl jemalloc configuration.
Tamir Duberstein96f14682017-07-06 14:50:55 -04001426dnl
Jason Evansa40bc7a2010-03-02 13:01:16 -08001427
Jason Evans434ea642016-03-14 20:19:11 -07001428AC_ARG_WITH([version],
1429 [AS_HELP_STRING([--with-version=<major>.<minor>.<bugfix>-<nrev>-g<gid>],
1430 [Version string])],
1431 [
1432 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 -07001433 if test $? -eq 0 ; then
1434 echo "$with_version" > "${objroot}VERSION"
1435 else
1436 echo "${with_version}" | grep ['^VERSION$'] 2>&1 1>/dev/null
1437 if test $? -ne 0 ; then
1438 AC_MSG_ERROR([${with_version} does not match <major>.<minor>.<bugfix>-<nrev>-g<gid> or VERSION])
1439 fi
Jason Evansa5a658a2014-09-02 15:07:07 -07001440 fi
Jason Evans434ea642016-03-14 20:19:11 -07001441 ], [
1442 dnl Set VERSION if source directory is inside a git repository.
1443 if test "x`test ! \"${srcroot}\" && cd \"${srcroot}\"; git rev-parse --is-inside-work-tree 2>/dev/null`" = "xtrue" ; then
1444 dnl Pattern globs aren't powerful enough to match both single- and
1445 dnl double-digit version numbers, so iterate over patterns to support up
1446 dnl to version 99.99.99 without any accidental matches.
1447 for pattern in ['[0-9].[0-9].[0-9]' '[0-9].[0-9].[0-9][0-9]' \
1448 '[0-9].[0-9][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]' \
1451 '[0-9][0-9].[0-9][0-9].[0-9][0-9]']; do
1452 (test ! "${srcroot}" && cd "${srcroot}"; git describe --long --abbrev=40 --match="${pattern}") > "${objroot}VERSION.tmp" 2>/dev/null
1453 if test $? -eq 0 ; then
1454 mv "${objroot}VERSION.tmp" "${objroot}VERSION"
1455 break
1456 fi
1457 done
1458 fi
1459 rm -f "${objroot}VERSION.tmp"
1460 ])
1461
Dan McGregorf8880312014-12-23 16:10:08 -06001462if test ! -e "${objroot}VERSION" ; then
1463 if test ! -e "${srcroot}VERSION" ; then
1464 AC_MSG_RESULT(
1465 [Missing VERSION file, and unable to generate it; creating bogus VERSION])
1466 echo "0.0.0-0-g0000000000000000000000000000000000000000" > "${objroot}VERSION"
1467 else
1468 cp ${srcroot}VERSION ${objroot}VERSION
1469 fi
Jason Evansa5a658a2014-09-02 15:07:07 -07001470fi
Dan McGregorf8880312014-12-23 16:10:08 -06001471jemalloc_version=`cat "${objroot}VERSION"`
Jason Evansa40bc7a2010-03-02 13:01:16 -08001472jemalloc_version_major=`echo ${jemalloc_version} | tr ".g-" " " | awk '{print [$]1}'`
1473jemalloc_version_minor=`echo ${jemalloc_version} | tr ".g-" " " | awk '{print [$]2}'`
1474jemalloc_version_bugfix=`echo ${jemalloc_version} | tr ".g-" " " | awk '{print [$]3}'`
1475jemalloc_version_nrev=`echo ${jemalloc_version} | tr ".g-" " " | awk '{print [$]4}'`
1476jemalloc_version_gid=`echo ${jemalloc_version} | tr ".g-" " " | awk '{print [$]5}'`
Jason Evansb7924f52009-06-23 19:01:18 -07001477AC_SUBST([jemalloc_version])
Jason Evansa40bc7a2010-03-02 13:01:16 -08001478AC_SUBST([jemalloc_version_major])
1479AC_SUBST([jemalloc_version_minor])
1480AC_SUBST([jemalloc_version_bugfix])
1481AC_SUBST([jemalloc_version_nrev])
1482AC_SUBST([jemalloc_version_gid])
Jason Evansb7924f52009-06-23 19:01:18 -07001483
1484dnl ============================================================================
1485dnl Configure pthreads.
1486
Mike Hommeya19e87f2012-04-21 21:27:46 -07001487if test "x$abi" != "xpecoff" ; then
Qi Wangb693c782017-03-17 12:42:33 -07001488 AC_DEFINE([JEMALLOC_HAVE_PTHREAD], [ ])
Mike Hommeya19e87f2012-04-21 21:27:46 -07001489 AC_CHECK_HEADERS([pthread.h], , [AC_MSG_ERROR([pthread.h is missing])])
1490 dnl Some systems may embed pthreads functionality in libc; check for libpthread
1491 dnl first, but try libc too before failing.
Jason Evans194d6f92016-12-16 07:18:55 -08001492 AC_CHECK_LIB([pthread], [pthread_create], [JE_APPEND_VS(LIBS, -lpthread)],
Mike Hommeya19e87f2012-04-21 21:27:46 -07001493 [AC_SEARCH_LIBS([pthread_create], , ,
1494 AC_MSG_ERROR([libpthread is missing]))])
Qi Wangb693c782017-03-17 12:42:33 -07001495 wrap_syms="${wrap_syms} pthread_create"
Jason Evans13685ab2017-06-08 22:07:21 -07001496 have_pthread="1"
Qi Wangb693c782017-03-17 12:42:33 -07001497 dnl Check if we have dlsym support.
1498 have_dlsym="1"
1499 AC_CHECK_HEADERS([dlfcn.h],
1500 AC_CHECK_FUNC([dlsym], [],
1501 [AC_CHECK_LIB([dl], [dlsym], [LIBS="$LIBS -ldl"], [have_dlsym="0"])]),
1502 [have_dlsym="0"])
1503 if test "x$have_dlsym" = "x1" ; then
1504 AC_DEFINE([JEMALLOC_HAVE_DLSYM], [ ])
1505 fi
Jason Evans5234be22016-11-17 15:14:57 -08001506 JE_COMPILABLE([pthread_atfork(3)], [
1507#include <pthread.h>
1508], [
1509 pthread_atfork((void *)0, (void *)0, (void *)0);
1510], [je_cv_pthread_atfork])
1511 if test "x${je_cv_pthread_atfork}" = "xyes" ; then
1512 AC_DEFINE([JEMALLOC_HAVE_PTHREAD_ATFORK], [ ])
1513 fi
Qi Wanga3f49772017-06-23 09:58:35 -07001514 dnl Check if pthread_setname_np is available with the expected API.
1515 JE_COMPILABLE([pthread_setname_np(3)], [
1516#include <pthread.h>
1517], [
1518 pthread_setname_np(pthread_self(), "setname_test");
1519], [je_cv_pthread_setname_np])
1520 if test "x${je_cv_pthread_setname_np}" = "xyes" ; then
1521 AC_DEFINE([JEMALLOC_HAVE_PTHREAD_SETNAME_NP], [ ])
1522 fi
Mike Hommeya19e87f2012-04-21 21:27:46 -07001523fi
Jason Evansb7924f52009-06-23 19:01:18 -07001524
Jason Evans4a068642017-02-27 17:35:19 -08001525JE_APPEND_VS(CPPFLAGS, -D_REENTRANT)
Jason Evansb7924f52009-06-23 19:01:18 -07001526
Jason Evansc1e9cf42016-05-03 21:28:20 -07001527dnl Check whether clock_gettime(2) is in libc or librt.
1528AC_SEARCH_LIBS([clock_gettime], [rt])
Jason Evans345c1b02015-09-15 14:59:56 -07001529
Elliot Ronaghanae331472016-06-14 14:20:28 -07001530dnl Cray wrapper compiler often adds `-lrt` when using `-static`. Check with
1531dnl `-dynamic` as well in case a user tries to dynamically link in jemalloc
1532if test "x$je_cv_cray_prgenv_wrapper" = "xyes" ; then
1533 if test "$ac_cv_search_clock_gettime" != "-lrt"; then
Jason Evans194d6f92016-12-16 07:18:55 -08001534 JE_CFLAGS_SAVE()
Elliot Ronaghanae331472016-06-14 14:20:28 -07001535
1536 unset ac_cv_search_clock_gettime
Jason Evans194d6f92016-12-16 07:18:55 -08001537 JE_CFLAGS_ADD([-dynamic])
Elliot Ronaghanae331472016-06-14 14:20:28 -07001538 AC_SEARCH_LIBS([clock_gettime], [rt])
1539
Jason Evans194d6f92016-12-16 07:18:55 -08001540 JE_CFLAGS_RESTORE()
Elliot Ronaghanae331472016-06-14 14:20:28 -07001541 fi
1542fi
1543
Jason Evans6c803212016-10-29 22:55:08 -07001544dnl check for CLOCK_MONOTONIC_COARSE (Linux-specific).
1545JE_COMPILABLE([clock_gettime(CLOCK_MONOTONIC_COARSE, ...)], [
Jason Evanse0164bc2016-10-07 08:47:16 -07001546#include <time.h>
1547], [
1548 struct timespec ts;
1549
Jason Evans6c803212016-10-29 22:55:08 -07001550 clock_gettime(CLOCK_MONOTONIC_COARSE, &ts);
1551], [je_cv_clock_monotonic_coarse])
1552if test "x${je_cv_clock_monotonic_coarse}" = "xyes" ; then
1553 AC_DEFINE([JEMALLOC_HAVE_CLOCK_MONOTONIC_COARSE])
Jason Evanse0164bc2016-10-07 08:47:16 -07001554fi
1555
1556dnl check for CLOCK_MONOTONIC.
1557JE_COMPILABLE([clock_gettime(CLOCK_MONOTONIC, ...)], [
1558#include <unistd.h>
1559#include <time.h>
1560], [
1561 struct timespec ts;
1562
1563 clock_gettime(CLOCK_MONOTONIC, &ts);
1564#if !defined(_POSIX_MONOTONIC_CLOCK) || _POSIX_MONOTONIC_CLOCK < 0
1565# error _POSIX_MONOTONIC_CLOCK missing/invalid
1566#endif
1567], [je_cv_clock_monotonic])
1568if test "x${je_cv_clock_monotonic}" = "xyes" ; then
1569 AC_DEFINE([JEMALLOC_HAVE_CLOCK_MONOTONIC])
1570fi
1571
1572dnl Check for mach_absolute_time().
1573JE_COMPILABLE([mach_absolute_time()], [
1574#include <mach/mach_time.h>
1575], [
1576 mach_absolute_time();
1577], [je_cv_mach_absolute_time])
1578if test "x${je_cv_mach_absolute_time}" = "xyes" ; then
1579 AC_DEFINE([JEMALLOC_HAVE_MACH_ABSOLUTE_TIME])
1580fi
1581
Jason Evansacb7b1f2016-12-03 16:47:36 -08001582dnl Use syscall(2) (if available) by default.
1583AC_ARG_ENABLE([syscall],
1584 [AS_HELP_STRING([--disable-syscall], [Disable use of syscall(2)])],
1585[if test "x$enable_syscall" = "xno" ; then
1586 enable_syscall="0"
1587else
1588 enable_syscall="1"
1589fi
1590],
1591[enable_syscall="1"]
1592)
1593if test "x$enable_syscall" = "x1" ; then
1594 dnl Check if syscall(2) is usable. Treat warnings as errors, so that e.g. OS
1595 dnl X 10.12's deprecation warning prevents use.
Jason Evans194d6f92016-12-16 07:18:55 -08001596 JE_CFLAGS_SAVE()
1597 JE_CFLAGS_ADD([-Werror])
Jason Evansacb7b1f2016-12-03 16:47:36 -08001598 JE_COMPILABLE([syscall(2)], [
Jason Evansd82f2b32016-11-02 19:18:33 -07001599#include <sys/syscall.h>
1600#include <unistd.h>
1601], [
1602 syscall(SYS_write, 2, "hello", 5);
1603],
Jason Evansacb7b1f2016-12-03 16:47:36 -08001604 [je_cv_syscall])
Jason Evans194d6f92016-12-16 07:18:55 -08001605 JE_CFLAGS_RESTORE()
Jason Evansacb7b1f2016-12-03 16:47:36 -08001606 if test "x$je_cv_syscall" = "xyes" ; then
1607 AC_DEFINE([JEMALLOC_USE_SYSCALL], [ ])
1608 fi
Jason Evansd82f2b32016-11-02 19:18:33 -07001609fi
1610
Daniel Micayb74041f2014-12-09 17:41:34 -05001611dnl Check if the GNU-specific secure_getenv function exists.
1612AC_CHECK_FUNC([secure_getenv],
1613 [have_secure_getenv="1"],
1614 [have_secure_getenv="0"]
1615 )
1616if test "x$have_secure_getenv" = "x1" ; then
1617 AC_DEFINE([JEMALLOC_HAVE_SECURE_GETENV], [ ])
1618fi
1619
Qi Wangec532e22017-02-02 17:02:05 -08001620dnl Check if the GNU-specific sched_getcpu function exists.
1621AC_CHECK_FUNC([sched_getcpu],
1622 [have_sched_getcpu="1"],
1623 [have_sched_getcpu="0"]
1624 )
1625if test "x$have_sched_getcpu" = "x1" ; then
1626 AC_DEFINE([JEMALLOC_HAVE_SCHED_GETCPU], [ ])
1627fi
1628
Qi Wangb693c782017-03-17 12:42:33 -07001629dnl Check if the GNU-specific sched_setaffinity function exists.
1630AC_CHECK_FUNC([sched_setaffinity],
1631 [have_sched_setaffinity="1"],
1632 [have_sched_setaffinity="0"]
1633 )
1634if test "x$have_sched_setaffinity" = "x1" ; then
1635 AC_DEFINE([JEMALLOC_HAVE_SCHED_SETAFFINITY], [ ])
1636fi
1637
Daniel Micayb74041f2014-12-09 17:41:34 -05001638dnl Check if the Solaris/BSD issetugid function exists.
1639AC_CHECK_FUNC([issetugid],
1640 [have_issetugid="1"],
1641 [have_issetugid="0"]
1642 )
1643if test "x$have_issetugid" = "x1" ; then
1644 AC_DEFINE([JEMALLOC_HAVE_ISSETUGID], [ ])
1645fi
1646
Jason Evanscd9a1342012-03-21 18:33:03 -07001647dnl Check whether the BSD-specific _malloc_thread_cleanup() exists. If so, use
1648dnl it rather than pthreads TSD cleanup functions to support cleanup during
1649dnl thread exit, in order to avoid pthreads library recursion during
1650dnl bootstrapping.
Jason Evanscd9a1342012-03-21 18:33:03 -07001651AC_CHECK_FUNC([_malloc_thread_cleanup],
1652 [have__malloc_thread_cleanup="1"],
1653 [have__malloc_thread_cleanup="0"]
1654 )
1655if test "x$have__malloc_thread_cleanup" = "x1" ; then
1656 AC_DEFINE([JEMALLOC_MALLOC_THREAD_CLEANUP], [ ])
Jason Evans909f0482017-05-04 11:20:43 -07001657 wrap_syms="${wrap_syms} _malloc_thread_cleanup"
Jason Evanscd9a1342012-03-21 18:33:03 -07001658 force_tls="1"
1659fi
1660
Jason Evans41b6afb2012-02-02 22:04:57 -08001661dnl Check whether the BSD-specific _pthread_mutex_init_calloc_cb() exists. If
1662dnl so, mutex initialization causes allocation, and we need to implement this
1663dnl callback function in order to prevent recursive allocation.
1664AC_CHECK_FUNC([_pthread_mutex_init_calloc_cb],
1665 [have__pthread_mutex_init_calloc_cb="1"],
1666 [have__pthread_mutex_init_calloc_cb="0"]
1667 )
1668if test "x$have__pthread_mutex_init_calloc_cb" = "x1" ; then
1669 AC_DEFINE([JEMALLOC_MUTEX_INIT_CB])
Jason Evans909f0482017-05-04 11:20:43 -07001670 wrap_syms="${wrap_syms} _malloc_prefork _malloc_postfork"
Jason Evans41b6afb2012-02-02 22:04:57 -08001671fi
1672
Jason Evans0fee70d2012-02-13 12:36:11 -08001673dnl Disable lazy locking by default.
Jason Evansb7924f52009-06-23 19:01:18 -07001674AC_ARG_ENABLE([lazy_lock],
Jason Evans0fee70d2012-02-13 12:36:11 -08001675 [AS_HELP_STRING([--enable-lazy-lock],
1676 [Enable lazy locking (only lock when multi-threaded)])],
Jason Evansb7924f52009-06-23 19:01:18 -07001677[if test "x$enable_lazy_lock" = "xno" ; then
1678 enable_lazy_lock="0"
1679else
1680 enable_lazy_lock="1"
1681fi
1682],
Mike Hommeyac5db022015-08-11 14:01:59 +09001683[enable_lazy_lock=""]
Jason Evansb7924f52009-06-23 19:01:18 -07001684)
Jason Evanseee1ca62016-11-02 08:54:07 -07001685if test "x${enable_lazy_lock}" = "x" ; then
1686 if test "x${force_lazy_lock}" = "x1" ; then
1687 AC_MSG_RESULT([Forcing lazy-lock to avoid allocator/threading bootstrap issues])
1688 enable_lazy_lock="1"
1689 else
1690 enable_lazy_lock="0"
1691 fi
1692fi
1693if test "x${enable_lazy_lock}" = "x1" -a "x${abi}" = "xpecoff" ; then
1694 AC_MSG_RESULT([Forcing no lazy-lock because thread creation monitoring is unimplemented])
1695 enable_lazy_lock="0"
Jason Evansfd4fcef2012-03-23 17:40:58 -07001696fi
Jason Evansb7924f52009-06-23 19:01:18 -07001697if test "x$enable_lazy_lock" = "x1" ; then
Qi Wangb693c782017-03-17 12:42:33 -07001698 if test "x$have_dlsym" = "x1" ; then
1699 AC_DEFINE([JEMALLOC_LAZY_LOCK], [ ])
1700 else
1701 AC_MSG_ERROR([Missing dlsym support: lazy-lock cannot be enabled.])
Mike Hommeya19e87f2012-04-21 21:27:46 -07001702 fi
Jason Evansb7924f52009-06-23 19:01:18 -07001703fi
1704AC_SUBST([enable_lazy_lock])
1705
Jason Evansb2a84532017-04-21 10:07:01 -07001706dnl Automatically configure TLS.
1707if test "x${force_tls}" = "x1" ; then
1708 enable_tls="1"
1709elif test "x${force_tls}" = "x0" ; then
Jason Evans78d815c2010-01-17 14:06:20 -08001710 enable_tls="0"
1711else
1712 enable_tls="1"
1713fi
Jason Evans78d815c2010-01-17 14:06:20 -08001714if test "x${enable_tls}" = "x1" ; then
1715AC_MSG_CHECKING([for TLS])
Jason Evans6684cac2012-03-05 12:15:36 -08001716AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
Jason Evans78d815c2010-01-17 14:06:20 -08001717[[
1718 __thread int x;
1719]], [[
1720 x = 42;
1721
1722 return 0;
1723]])],
1724 AC_MSG_RESULT([yes]),
1725 AC_MSG_RESULT([no])
1726 enable_tls="0")
Mike Hommeyac5db022015-08-11 14:01:59 +09001727else
1728 enable_tls="0"
Jason Evans78d815c2010-01-17 14:06:20 -08001729fi
Jason Evansb267d0f2010-08-13 15:42:29 -07001730AC_SUBST([enable_tls])
Jason Evanse24c7af2012-03-19 10:21:17 -07001731if test "x${enable_tls}" = "x1" ; then
1732 AC_DEFINE_UNQUOTED([JEMALLOC_TLS], [ ])
Jason Evans78d815c2010-01-17 14:06:20 -08001733fi
1734
Jason Evans2dbecf12010-09-05 10:35:13 -07001735dnl ============================================================================
Chih-hung Hsieh59cd80e2014-12-05 17:42:41 -08001736dnl Check for C11 atomics.
1737
1738JE_COMPILABLE([C11 atomics], [
1739#include <stdint.h>
1740#if (__STDC_VERSION__ >= 201112L) && !defined(__STDC_NO_ATOMICS__)
1741#include <stdatomic.h>
1742#else
1743#error Atomics not available
1744#endif
1745], [
1746 uint64_t *p = (uint64_t *)0;
1747 uint64_t x = 1;
1748 volatile atomic_uint_least64_t *a = (volatile atomic_uint_least64_t *)p;
1749 uint64_t r = atomic_fetch_add(a, x) + x;
Jason Evansf4086432017-01-19 18:15:45 -08001750 return r == 0;
David Goldblattd4ac7582017-01-25 09:54:27 -08001751], [je_cv_c11_atomics])
1752if test "x${je_cv_c11_atomics}" = "xyes" ; then
1753 AC_DEFINE([JEMALLOC_C11_ATOMICS])
Chih-hung Hsieh59cd80e2014-12-05 17:42:41 -08001754fi
1755
1756dnl ============================================================================
David Goldblattd4ac7582017-01-25 09:54:27 -08001757dnl Check for GCC-style __atomic atomics.
Jason Evansb57d3ec2012-04-17 13:17:54 -07001758
David Goldblattd4ac7582017-01-25 09:54:27 -08001759JE_COMPILABLE([GCC __atomic atomics], [
Jason Evansb57d3ec2012-04-17 13:17:54 -07001760], [
David Goldblattd4ac7582017-01-25 09:54:27 -08001761 int x = 0;
1762 int val = 1;
1763 int y = __atomic_fetch_add(&x, val, __ATOMIC_RELAXED);
1764 int after_add = x;
1765 return after_add == 1;
1766], [je_cv_gcc_atomic_atomics])
1767if test "x${je_cv_gcc_atomic_atomics}" = "xyes" ; then
1768 AC_DEFINE([JEMALLOC_GCC_ATOMIC_ATOMICS])
1769fi
1770
1771dnl ============================================================================
1772dnl Check for GCC-style __sync atomics.
1773
1774JE_COMPILABLE([GCC __sync atomics], [
1775], [
1776 int x = 0;
1777 int before_add = __sync_fetch_and_add(&x, 1);
1778 int after_add = x;
1779 return (before_add == 0) && (after_add == 1);
1780], [je_cv_gcc_sync_atomics])
1781if test "x${je_cv_gcc_sync_atomics}" = "xyes" ; then
1782 AC_DEFINE([JEMALLOC_GCC_SYNC_ATOMICS])
Jason Evansb57d3ec2012-04-17 13:17:54 -07001783fi
1784
1785dnl ============================================================================
Jason Evans763baa62011-03-18 19:10:31 -07001786dnl Check for atomic(3) operations as provided on Darwin.
David Goldblattd4ac7582017-01-25 09:54:27 -08001787dnl We need this not for the atomic operations (which are provided above), but
1788dnl rather for the OSSpinLock type it exposes.
Jason Evans763baa62011-03-18 19:10:31 -07001789
1790JE_COMPILABLE([Darwin OSAtomic*()], [
1791#include <libkern/OSAtomic.h>
1792#include <inttypes.h>
1793], [
1794 {
1795 int32_t x32 = 0;
1796 volatile int32_t *x32p = &x32;
1797 OSAtomicAdd32(1, x32p);
1798 }
1799 {
1800 int64_t x64 = 0;
1801 volatile int64_t *x64p = &x64;
1802 OSAtomicAdd64(1, x64p);
1803 }
Jason Evans6684cac2012-03-05 12:15:36 -08001804], [je_cv_osatomic])
1805if test "x${je_cv_osatomic}" = "xyes" ; then
Jason Evanse24c7af2012-03-19 10:21:17 -07001806 AC_DEFINE([JEMALLOC_OSATOMIC], [ ])
Jason Evans763baa62011-03-18 19:10:31 -07001807fi
1808
1809dnl ============================================================================
Richard Diamond994fad92014-06-03 02:39:18 -05001810dnl Check for madvise(2).
1811
1812JE_COMPILABLE([madvise(2)], [
1813#include <sys/mman.h>
1814], [
Jason Evansa64123c2016-11-17 10:24:51 -08001815 madvise((void *)0, 0, 0);
Richard Diamond994fad92014-06-03 02:39:18 -05001816], [je_cv_madvise])
1817if test "x${je_cv_madvise}" = "xyes" ; then
Jason Evansc1baa0a2016-11-17 13:36:17 -08001818 AC_DEFINE([JEMALLOC_HAVE_MADVISE], [ ])
1819
Jason Evansa64123c2016-11-17 10:24:51 -08001820 dnl Check for madvise(..., MADV_FREE).
1821 JE_COMPILABLE([madvise(..., MADV_FREE)], [
1822#include <sys/mman.h>
1823], [
1824 madvise((void *)0, 0, MADV_FREE);
1825], [je_cv_madv_free])
1826 if test "x${je_cv_madv_free}" = "xyes" ; then
1827 AC_DEFINE([JEMALLOC_PURGE_MADVISE_FREE], [ ])
1828 fi
1829
1830 dnl Check for madvise(..., MADV_DONTNEED).
1831 JE_COMPILABLE([madvise(..., MADV_DONTNEED)], [
1832#include <sys/mman.h>
1833], [
1834 madvise((void *)0, 0, MADV_DONTNEED);
1835], [je_cv_madv_dontneed])
1836 if test "x${je_cv_madv_dontneed}" = "xyes" ; then
1837 AC_DEFINE([JEMALLOC_PURGE_MADVISE_DONTNEED], [ ])
1838 fi
1839
Jason Evansc1baa0a2016-11-17 13:36:17 -08001840 dnl Check for madvise(..., MADV_[NO]HUGEPAGE).
1841 JE_COMPILABLE([madvise(..., MADV_[[NO]]HUGEPAGE)], [
1842#include <sys/mman.h>
1843], [
1844 madvise((void *)0, 0, MADV_HUGEPAGE);
1845 madvise((void *)0, 0, MADV_NOHUGEPAGE);
1846], [je_cv_thp])
Qi Wang8fdd9a52017-08-10 13:14:26 -07001847 if test "x${je_cv_thp}" = "xyes" ; then
1848 AC_DEFINE([JEMALLOC_HAVE_MADVISE_HUGE], [ ])
1849 fi
Richard Diamond994fad92014-06-03 02:39:18 -05001850fi
1851
Jason Evansc606a872017-05-30 09:54:49 -07001852dnl Enable transparent huge page support by default.
1853AC_ARG_ENABLE([thp],
1854 [AS_HELP_STRING([--disable-thp],
1855 [Disable transparent huge page support])],
1856[if test "x$enable_thp" = "xno" -o "x${je_cv_thp}" != "xyes" ; then
1857 enable_thp="0"
1858else
1859 enable_thp="1"
1860fi
1861],
1862[if test "x${je_cv_thp}" = "xyes" ; then
1863 enable_thp="1"
1864else
1865 enable_thp="0"
1866fi
1867])
1868if test "x$enable_thp" = "x1" ; then
1869 AC_DEFINE([JEMALLOC_THP], [ ])
1870fi
1871AC_SUBST([enable_thp])
1872
Richard Diamond994fad92014-06-03 02:39:18 -05001873dnl ============================================================================
Mike Hommeyc1e567b2012-03-26 17:03:41 +02001874dnl Check whether __sync_{add,sub}_and_fetch() are available despite
1875dnl __GCC_HAVE_SYNC_COMPARE_AND_SWAP_n macros being undefined.
1876
1877AC_DEFUN([JE_SYNC_COMPARE_AND_SWAP_CHECK],[
1878 AC_CACHE_CHECK([whether to force $1-bit __sync_{add,sub}_and_fetch()],
1879 [je_cv_sync_compare_and_swap_$2],
Mike Hommey2cfe6d62012-03-27 15:03:07 +02001880 [AC_LINK_IFELSE([AC_LANG_PROGRAM([
1881 #include <stdint.h>
1882 ],
1883 [
1884 #ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_$2
1885 {
1886 uint$1_t x$1 = 0;
1887 __sync_add_and_fetch(&x$1, 42);
1888 __sync_sub_and_fetch(&x$1, 1);
1889 }
1890 #else
1891 #error __GCC_HAVE_SYNC_COMPARE_AND_SWAP_$2 is defined, no need to force
1892 #endif
1893 ])],
Mike Hommeyc1e567b2012-03-26 17:03:41 +02001894 [je_cv_sync_compare_and_swap_$2=yes],
1895 [je_cv_sync_compare_and_swap_$2=no])])
1896
1897 if test "x${je_cv_sync_compare_and_swap_$2}" = "xyes" ; then
1898 AC_DEFINE([JE_FORCE_SYNC_COMPARE_AND_SWAP_$2], [ ])
1899 fi
1900])
1901
Jason Evansb57d3ec2012-04-17 13:17:54 -07001902if test "x${je_cv_atomic9}" != "xyes" -a "x${je_cv_osatomic}" != "xyes" ; then
Mike Hommeyc1e567b2012-03-26 17:03:41 +02001903 JE_SYNC_COMPARE_AND_SWAP_CHECK(32, 4)
1904 JE_SYNC_COMPARE_AND_SWAP_CHECK(64, 8)
1905fi
1906
1907dnl ============================================================================
Jason Evansd04047c2014-05-28 16:11:55 -07001908dnl Check for __builtin_clz() and __builtin_clzl().
1909
1910AC_CACHE_CHECK([for __builtin_clz],
1911 [je_cv_builtin_clz],
1912 [AC_LINK_IFELSE([AC_LANG_PROGRAM([],
1913 [
1914 {
1915 unsigned x = 0;
1916 int y = __builtin_clz(x);
1917 }
1918 {
1919 unsigned long x = 0;
1920 int y = __builtin_clzl(x);
1921 }
1922 ])],
1923 [je_cv_builtin_clz=yes],
1924 [je_cv_builtin_clz=no])])
1925
1926if test "x${je_cv_builtin_clz}" = "xyes" ; then
1927 AC_DEFINE([JEMALLOC_HAVE_BUILTIN_CLZ], [ ])
1928fi
1929
1930dnl ============================================================================
Jason Evans795f6682016-11-02 18:09:45 -07001931dnl Check for os_unfair_lock operations as provided on Darwin.
1932
Jason Evans4066b4e2016-11-16 10:40:00 -08001933JE_COMPILABLE([Darwin os_unfair_lock_*()], [
Jason Evans795f6682016-11-02 18:09:45 -07001934#include <os/lock.h>
John Szakmeistereb29d7e2016-11-23 15:32:35 -05001935#include <AvailabilityMacros.h>
Jason Evans795f6682016-11-02 18:09:45 -07001936], [
John Szakmeistereb29d7e2016-11-23 15:32:35 -05001937 #if MAC_OS_X_VERSION_MIN_REQUIRED < 101200
1938 #error "os_unfair_lock is not supported"
1939 #else
Jason Evans795f6682016-11-02 18:09:45 -07001940 os_unfair_lock lock = OS_UNFAIR_LOCK_INIT;
1941 os_unfair_lock_lock(&lock);
1942 os_unfair_lock_unlock(&lock);
John Szakmeistereb29d7e2016-11-23 15:32:35 -05001943 #endif
Jason Evans795f6682016-11-02 18:09:45 -07001944], [je_cv_os_unfair_lock])
1945if test "x${je_cv_os_unfair_lock}" = "xyes" ; then
1946 AC_DEFINE([JEMALLOC_OS_UNFAIR_LOCK], [ ])
1947fi
1948
1949dnl ============================================================================
Jason Evans893a0ed2011-03-18 19:30:18 -07001950dnl Check for spinlock(3) operations as provided on Darwin.
1951
1952JE_COMPILABLE([Darwin OSSpin*()], [
1953#include <libkern/OSAtomic.h>
1954#include <inttypes.h>
1955], [
1956 OSSpinLock lock = 0;
1957 OSSpinLockLock(&lock);
1958 OSSpinLockUnlock(&lock);
Jason Evans6684cac2012-03-05 12:15:36 -08001959], [je_cv_osspin])
1960if test "x${je_cv_osspin}" = "xyes" ; then
Jason Evanse24c7af2012-03-19 10:21:17 -07001961 AC_DEFINE([JEMALLOC_OSSPIN], [ ])
Jason Evans893a0ed2011-03-18 19:30:18 -07001962fi
1963
1964dnl ============================================================================
Jason Evans2dbecf12010-09-05 10:35:13 -07001965dnl Darwin-related configuration.
Jason Evans78d815c2010-01-17 14:06:20 -08001966
Mike Hommeyd0357f72012-11-26 18:52:41 +01001967AC_ARG_ENABLE([zone-allocator],
1968 [AS_HELP_STRING([--disable-zone-allocator],
1969 [Disable zone allocator for Darwin])],
1970[if test "x$enable_zone_allocator" = "xno" ; then
1971 enable_zone_allocator="0"
1972else
1973 enable_zone_allocator="1"
1974fi
1975],
1976[if test "x${abi}" = "xmacho"; then
1977 enable_zone_allocator="1"
1978fi
1979]
1980)
1981AC_SUBST([enable_zone_allocator])
1982
1983if test "x${enable_zone_allocator}" = "x1" ; then
1984 if test "x${abi}" != "xmacho"; then
1985 AC_MSG_ERROR([--enable-zone-allocator is only supported on Darwin])
1986 fi
Jason Evanse24c7af2012-03-19 10:21:17 -07001987 AC_DEFINE([JEMALLOC_ZONE], [ ])
Jason Evansb27805b2010-02-10 18:15:53 -08001988fi
1989
Jason Evansb7924f52009-06-23 19:01:18 -07001990dnl ============================================================================
Jason Evans13685ab2017-06-08 22:07:21 -07001991dnl Enable background threads if possible.
1992
1993if test "x${have_pthread}" = "x1" -a "x${have_dlsym}" = "x1" \
1994 -a "x${je_cv_os_unfair_lock}" != "xyes" \
1995 -a "x${je_cv_osspin}" != "xyes" ; then
1996 AC_DEFINE([JEMALLOC_BACKGROUND_THREAD])
1997fi
1998
1999dnl ============================================================================
Sara Golemon3e24afa2014-08-18 13:06:39 -07002000dnl Check for glibc malloc hooks
2001
2002JE_COMPILABLE([glibc malloc hook], [
2003#include <stddef.h>
2004
2005extern void (* __free_hook)(void *ptr);
2006extern void *(* __malloc_hook)(size_t size);
2007extern void *(* __realloc_hook)(void *ptr, size_t size);
2008], [
2009 void *ptr = 0L;
2010 if (__malloc_hook) ptr = __malloc_hook(1);
2011 if (__realloc_hook) ptr = __realloc_hook(ptr, 2);
2012 if (__free_hook && ptr) __free_hook(ptr);
2013], [je_cv_glibc_malloc_hook])
2014if test "x${je_cv_glibc_malloc_hook}" = "xyes" ; then
Jason Evans909f0482017-05-04 11:20:43 -07002015 if test "x${JEMALLOC_PREFIX}" = "x" ; then
2016 AC_DEFINE([JEMALLOC_GLIBC_MALLOC_HOOK], [ ])
2017 wrap_syms="${wrap_syms} __free_hook __malloc_hook __realloc_hook"
2018 fi
Sara Golemon3e24afa2014-08-18 13:06:39 -07002019fi
2020
2021JE_COMPILABLE([glibc memalign hook], [
2022#include <stddef.h>
2023
2024extern void *(* __memalign_hook)(size_t alignment, size_t size);
2025], [
2026 void *ptr = 0L;
2027 if (__memalign_hook) ptr = __memalign_hook(16, 7);
2028], [je_cv_glibc_memalign_hook])
2029if test "x${je_cv_glibc_memalign_hook}" = "xyes" ; then
Jason Evans909f0482017-05-04 11:20:43 -07002030 if test "x${JEMALLOC_PREFIX}" = "x" ; then
2031 AC_DEFINE([JEMALLOC_GLIBC_MEMALIGN_HOOK], [ ])
2032 wrap_syms="${wrap_syms} __memalign_hook"
2033 fi
Sara Golemon3e24afa2014-08-18 13:06:39 -07002034fi
2035
Eric Wong4dcf04b2014-08-31 03:57:06 +00002036JE_COMPILABLE([pthreads adaptive mutexes], [
2037#include <pthread.h>
2038], [
2039 pthread_mutexattr_t attr;
2040 pthread_mutexattr_init(&attr);
2041 pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ADAPTIVE_NP);
2042 pthread_mutexattr_destroy(&attr);
2043], [je_cv_pthread_mutex_adaptive_np])
2044if test "x${je_cv_pthread_mutex_adaptive_np}" = "xyes" ; then
2045 AC_DEFINE([JEMALLOC_HAVE_PTHREAD_MUTEX_ADAPTIVE_NP], [ ])
2046fi
2047
Sara Golemon3e24afa2014-08-18 13:06:39 -07002048dnl ============================================================================
Jason Evansb7924f52009-06-23 19:01:18 -07002049dnl Check for typedefs, structures, and compiler characteristics.
2050AC_HEADER_STDBOOL
2051
Jason Evans748dfac2013-12-06 18:27:33 -08002052dnl ============================================================================
2053dnl Define commands that generate output files.
2054
Jason Evansf234dc52014-01-16 17:38:01 -08002055AC_CONFIG_COMMANDS([include/jemalloc/internal/public_symbols.txt], [
2056 f="${objroot}include/jemalloc/internal/public_symbols.txt"
2057 mkdir -p "${objroot}include/jemalloc/internal"
2058 cp /dev/null "${f}"
2059 for nm in `echo ${mangling_map} |tr ',' ' '` ; do
2060 n=`echo ${nm} |tr ':' ' ' |awk '{print $[]1}'`
2061 m=`echo ${nm} |tr ':' ' ' |awk '{print $[]2}'`
2062 echo "${n}:${m}" >> "${f}"
2063 dnl Remove name from public_syms so that it isn't redefined later.
2064 public_syms=`for sym in ${public_syms}; do echo "${sym}"; done |grep -v "^${n}\$" |tr '\n' ' '`
2065 done
2066 for sym in ${public_syms} ; do
2067 n="${sym}"
2068 m="${JEMALLOC_PREFIX}${sym}"
2069 echo "${n}:${m}" >> "${f}"
2070 done
2071], [
2072 srcdir="${srcdir}"
2073 objroot="${objroot}"
2074 mangling_map="${mangling_map}"
2075 public_syms="${public_syms}"
2076 JEMALLOC_PREFIX="${JEMALLOC_PREFIX}"
Jason Evans86abd0d2013-11-30 15:25:42 -08002077])
Jason Evans909f0482017-05-04 11:20:43 -07002078AC_CONFIG_COMMANDS([include/jemalloc/internal/private_symbols.awk], [
2079 f="${objroot}include/jemalloc/internal/private_symbols.awk"
2080 mkdir -p "${objroot}include/jemalloc/internal"
2081 export_syms=`for sym in ${public_syms}; do echo "${JEMALLOC_PREFIX}${sym}"; done; for sym in ${wrap_syms}; do echo "${sym}"; done;`
2082 "${srcdir}/include/jemalloc/internal/private_symbols.sh" "${SYM_PREFIX}" ${export_syms} > "${objroot}include/jemalloc/internal/private_symbols.awk"
2083], [
2084 srcdir="${srcdir}"
2085 objroot="${objroot}"
2086 public_syms="${public_syms}"
2087 wrap_syms="${wrap_syms}"
2088 SYM_PREFIX="${SYM_PREFIX}"
2089 JEMALLOC_PREFIX="${JEMALLOC_PREFIX}"
2090])
2091AC_CONFIG_COMMANDS([include/jemalloc/internal/private_symbols_jet.awk], [
2092 f="${objroot}include/jemalloc/internal/private_symbols_jet.awk"
2093 mkdir -p "${objroot}include/jemalloc/internal"
2094 export_syms=`for sym in ${public_syms}; do echo "jet_${sym}"; done; for sym in ${wrap_syms}; do echo "${sym}"; done;`
2095 "${srcdir}/include/jemalloc/internal/private_symbols.sh" "${SYM_PREFIX}" ${export_syms} > "${objroot}include/jemalloc/internal/private_symbols_jet.awk"
2096], [
2097 srcdir="${srcdir}"
2098 objroot="${objroot}"
2099 public_syms="${public_syms}"
2100 wrap_syms="${wrap_syms}"
2101 SYM_PREFIX="${SYM_PREFIX}"
2102])
Jason Evans86abd0d2013-11-30 15:25:42 -08002103AC_CONFIG_COMMANDS([include/jemalloc/internal/public_namespace.h], [
2104 mkdir -p "${objroot}include/jemalloc/internal"
Jason Evansf234dc52014-01-16 17:38:01 -08002105 "${srcdir}/include/jemalloc/internal/public_namespace.sh" "${objroot}include/jemalloc/internal/public_symbols.txt" > "${objroot}include/jemalloc/internal/public_namespace.h"
2106], [
2107 srcdir="${srcdir}"
2108 objroot="${objroot}"
Jason Evans86abd0d2013-11-30 15:25:42 -08002109])
2110AC_CONFIG_COMMANDS([include/jemalloc/internal/public_unnamespace.h], [
2111 mkdir -p "${objroot}include/jemalloc/internal"
Jason Evansf234dc52014-01-16 17:38:01 -08002112 "${srcdir}/include/jemalloc/internal/public_unnamespace.sh" "${objroot}include/jemalloc/internal/public_symbols.txt" > "${objroot}include/jemalloc/internal/public_unnamespace.h"
2113], [
2114 srcdir="${srcdir}"
2115 objroot="${objroot}"
Jason Evans86abd0d2013-11-30 15:25:42 -08002116])
Jason Evansb1726102012-02-28 16:50:47 -08002117AC_CONFIG_COMMANDS([include/jemalloc/internal/size_classes.h], [
Jason Evans86abd0d2013-11-30 15:25:42 -08002118 mkdir -p "${objroot}include/jemalloc/internal"
Jason Evansaf76f0e2017-04-21 15:35:54 -07002119 "${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 -08002120], [
Jason Evans6d919292015-09-15 10:42:36 -07002121 SHELL="${SHELL}"
Jason Evansf234dc52014-01-16 17:38:01 -08002122 srcdir="${srcdir}"
2123 objroot="${objroot}"
Jason Evans81e54752014-10-10 22:34:25 -07002124 LG_QUANTA="${LG_QUANTA}"
Jason Evans81e54752014-10-10 22:34:25 -07002125 LG_PAGE_SIZES="${LG_PAGE_SIZES}"
Jason Evansb1726102012-02-28 16:50:47 -08002126])
Jason Evans86abd0d2013-11-30 15:25:42 -08002127AC_CONFIG_COMMANDS([include/jemalloc/jemalloc_protos_jet.h], [
2128 mkdir -p "${objroot}include/jemalloc"
2129 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 -08002130], [
2131 srcdir="${srcdir}"
2132 objroot="${objroot}"
2133])
2134AC_CONFIG_COMMANDS([include/jemalloc/jemalloc_rename.h], [
2135 mkdir -p "${objroot}include/jemalloc"
2136 "${srcdir}/include/jemalloc/jemalloc_rename.sh" "${objroot}include/jemalloc/internal/public_symbols.txt" > "${objroot}include/jemalloc/jemalloc_rename.h"
2137], [
2138 srcdir="${srcdir}"
2139 objroot="${objroot}"
2140])
2141AC_CONFIG_COMMANDS([include/jemalloc/jemalloc_mangle.h], [
2142 mkdir -p "${objroot}include/jemalloc"
2143 "${srcdir}/include/jemalloc/jemalloc_mangle.sh" "${objroot}include/jemalloc/internal/public_symbols.txt" je_ > "${objroot}include/jemalloc/jemalloc_mangle.h"
2144], [
2145 srcdir="${srcdir}"
2146 objroot="${objroot}"
2147])
2148AC_CONFIG_COMMANDS([include/jemalloc/jemalloc_mangle_jet.h], [
2149 mkdir -p "${objroot}include/jemalloc"
2150 "${srcdir}/include/jemalloc/jemalloc_mangle.sh" "${objroot}include/jemalloc/internal/public_symbols.txt" jet_ > "${objroot}include/jemalloc/jemalloc_mangle_jet.h"
2151], [
2152 srcdir="${srcdir}"
2153 objroot="${objroot}"
Jason Evans86abd0d2013-11-30 15:25:42 -08002154])
2155AC_CONFIG_COMMANDS([include/jemalloc/jemalloc.h], [
2156 mkdir -p "${objroot}include/jemalloc"
2157 "${srcdir}/include/jemalloc/jemalloc.sh" "${objroot}" > "${objroot}include/jemalloc/jemalloc${install_suffix}.h"
Jason Evansf234dc52014-01-16 17:38:01 -08002158], [
2159 srcdir="${srcdir}"
2160 objroot="${objroot}"
2161 install_suffix="${install_suffix}"
Jason Evans86abd0d2013-11-30 15:25:42 -08002162])
Jason Evansb1726102012-02-28 16:50:47 -08002163
Jason Evansb7924f52009-06-23 19:01:18 -07002164dnl Process .in files.
Jason Evansb0fd5012010-01-17 01:49:20 -08002165AC_SUBST([cfghdrs_in])
2166AC_SUBST([cfghdrs_out])
Jason Evans0656ec02010-04-07 23:37:35 -07002167AC_CONFIG_HEADERS([$cfghdrs_tup])
Jason Evansb7924f52009-06-23 19:01:18 -07002168
2169dnl ============================================================================
2170dnl Generate outputs.
Jason Evans748dfac2013-12-06 18:27:33 -08002171
Jason Evans70417202015-05-01 12:31:12 -07002172AC_CONFIG_FILES([$cfgoutputs_tup config.stamp bin/jemalloc-config bin/jemalloc.sh bin/jeprof])
Jason Evansb0fd5012010-01-17 01:49:20 -08002173AC_SUBST([cfgoutputs_in])
2174AC_SUBST([cfgoutputs_out])
Jason Evansb7924f52009-06-23 19:01:18 -07002175AC_OUTPUT
2176
2177dnl ============================================================================
2178dnl Print out the results of configuration.
2179AC_MSG_RESULT([===============================================================================])
Jason Evansf576c632011-11-01 22:27:41 -07002180AC_MSG_RESULT([jemalloc version : ${jemalloc_version}])
2181AC_MSG_RESULT([library revision : ${rev}])
Jason Evansb7924f52009-06-23 19:01:18 -07002182AC_MSG_RESULT([])
Jason Evansbec6a8d2015-01-22 17:55:58 -08002183AC_MSG_RESULT([CONFIG : ${CONFIG}])
Jason Evansb7924f52009-06-23 19:01:18 -07002184AC_MSG_RESULT([CC : ${CC}])
Jason Evans194d6f92016-12-16 07:18:55 -08002185AC_MSG_RESULT([CONFIGURE_CFLAGS : ${CONFIGURE_CFLAGS}])
2186AC_MSG_RESULT([SPECIFIED_CFLAGS : ${SPECIFIED_CFLAGS}])
Jason Evansaf0e28f2016-10-29 22:14:55 -07002187AC_MSG_RESULT([EXTRA_CFLAGS : ${EXTRA_CFLAGS}])
Jason Evansbec6a8d2015-01-22 17:55:58 -08002188AC_MSG_RESULT([CPPFLAGS : ${CPPFLAGS}])
Dave Watson23191522016-10-23 15:56:30 -07002189AC_MSG_RESULT([CXX : ${CXX}])
Jason Evans194d6f92016-12-16 07:18:55 -08002190AC_MSG_RESULT([CONFIGURE_CXXFLAGS : ${CONFIGURE_CXXFLAGS}])
2191AC_MSG_RESULT([SPECIFIED_CXXFLAGS : ${SPECIFIED_CXXFLAGS}])
Dave Watson23191522016-10-23 15:56:30 -07002192AC_MSG_RESULT([EXTRA_CXXFLAGS : ${EXTRA_CXXFLAGS}])
Jason Evansb7924f52009-06-23 19:01:18 -07002193AC_MSG_RESULT([LDFLAGS : ${LDFLAGS}])
Jason Evans748dfac2013-12-06 18:27:33 -08002194AC_MSG_RESULT([EXTRA_LDFLAGS : ${EXTRA_LDFLAGS}])
Dave Watson23191522016-10-23 15:56:30 -07002195AC_MSG_RESULT([DSO_LDFLAGS : ${DSO_LDFLAGS}])
Jason Evansb7924f52009-06-23 19:01:18 -07002196AC_MSG_RESULT([LIBS : ${LIBS}])
2197AC_MSG_RESULT([RPATH_EXTRA : ${RPATH_EXTRA}])
2198AC_MSG_RESULT([])
Jason Evansaee7fd22010-11-24 22:00:02 -08002199AC_MSG_RESULT([XSLTPROC : ${XSLTPROC}])
2200AC_MSG_RESULT([XSLROOT : ${XSLROOT}])
2201AC_MSG_RESULT([])
Jason Evansb7924f52009-06-23 19:01:18 -07002202AC_MSG_RESULT([PREFIX : ${PREFIX}])
2203AC_MSG_RESULT([BINDIR : ${BINDIR}])
Jason Evansbec6a8d2015-01-22 17:55:58 -08002204AC_MSG_RESULT([DATADIR : ${DATADIR}])
Jason Evans662a0172009-07-01 19:24:31 -07002205AC_MSG_RESULT([INCLUDEDIR : ${INCLUDEDIR}])
2206AC_MSG_RESULT([LIBDIR : ${LIBDIR}])
Jason Evansb7924f52009-06-23 19:01:18 -07002207AC_MSG_RESULT([MANDIR : ${MANDIR}])
2208AC_MSG_RESULT([])
2209AC_MSG_RESULT([srcroot : ${srcroot}])
2210AC_MSG_RESULT([abs_srcroot : ${abs_srcroot}])
2211AC_MSG_RESULT([objroot : ${objroot}])
2212AC_MSG_RESULT([abs_objroot : ${abs_objroot}])
2213AC_MSG_RESULT([])
Jason Evans90895cf2009-12-29 00:09:15 -08002214AC_MSG_RESULT([JEMALLOC_PREFIX : ${JEMALLOC_PREFIX}])
Jason Evans746e77a2011-07-30 16:40:52 -07002215AC_MSG_RESULT([JEMALLOC_PRIVATE_NAMESPACE])
2216AC_MSG_RESULT([ : ${JEMALLOC_PRIVATE_NAMESPACE}])
Jason Evansb0fd5012010-01-17 01:49:20 -08002217AC_MSG_RESULT([install_suffix : ${install_suffix}])
Jason Evansf8290092016-02-07 14:23:22 -08002218AC_MSG_RESULT([malloc_conf : ${config_malloc_conf}])
Jason Evansb7924f52009-06-23 19:01:18 -07002219AC_MSG_RESULT([autogen : ${enable_autogen}])
2220AC_MSG_RESULT([debug : ${enable_debug}])
2221AC_MSG_RESULT([stats : ${enable_stats}])
Jason Evans6109fe02010-02-10 10:37:56 -08002222AC_MSG_RESULT([prof : ${enable_prof}])
2223AC_MSG_RESULT([prof-libunwind : ${enable_prof_libunwind}])
Jason Evans77f350b2011-03-15 22:23:12 -07002224AC_MSG_RESULT([prof-libgcc : ${enable_prof_libgcc}])
2225AC_MSG_RESULT([prof-gcc : ${enable_prof_gcc}])
Jason Evansc606a872017-05-30 09:54:49 -07002226AC_MSG_RESULT([thp : ${enable_thp}])
Jason Evansb7924f52009-06-23 19:01:18 -07002227AC_MSG_RESULT([fill : ${enable_fill}])
Jason Evansb1476112012-04-05 13:36:17 -07002228AC_MSG_RESULT([utrace : ${enable_utrace}])
Jason Evans122449b2012-04-06 00:35:09 -07002229AC_MSG_RESULT([xmalloc : ${enable_xmalloc}])
David T. Goldblatt9761b442017-07-19 16:36:46 -07002230AC_MSG_RESULT([log : ${enable_log}])
Jason Evansb7924f52009-06-23 19:01:18 -07002231AC_MSG_RESULT([lazy_lock : ${enable_lazy_lock}])
Jason Evans8a03cf02015-05-04 09:58:36 -07002232AC_MSG_RESULT([cache-oblivious : ${enable_cache_oblivious}])
Dave Watson23191522016-10-23 15:56:30 -07002233AC_MSG_RESULT([cxx : ${enable_cxx}])
Jason Evansb7924f52009-06-23 19:01:18 -07002234AC_MSG_RESULT([===============================================================================])