blob: 0a32ac80a569ea13ea0cb876709543c3ed810f91 [file] [log] [blame]
Jason Evansb7924f52009-06-23 19:01:18 -07001dnl Process this file with autoconf to produce a configure script.
2AC_INIT([Makefile.in])
3
Jason Evansf3340ca2009-06-30 16:17:05 -07004dnl ============================================================================
5dnl Custom macro definitions.
6
7dnl JE_CFLAGS_APPEND(cflag)
8AC_DEFUN([JE_CFLAGS_APPEND],
9[
10AC_MSG_CHECKING([whether compiler supports $1])
11TCFLAGS="${CFLAGS}"
12if test "x${CFLAGS}" = "x" ; then
13 CFLAGS="$1"
14else
15 CFLAGS="${CFLAGS} $1"
16fi
17AC_RUN_IFELSE([AC_LANG_PROGRAM(
18[[
19]], [[
20 return 0;
21]])],
22 AC_MSG_RESULT([yes]),
23 AC_MSG_RESULT([no])
24 [CFLAGS="${TCFLAGS}"]
25)
26])
27
28dnl JE_COMPILABLE(label, hcode, mcode, rvar)
29AC_DEFUN([JE_COMPILABLE],
30[
31AC_MSG_CHECKING([whether $1 is compilable])
32AC_RUN_IFELSE([AC_LANG_PROGRAM(
33[$2], [$3])],
34 AC_MSG_RESULT([yes])
35 [$4="yes"],
36 AC_MSG_RESULT([no])
37 [$4="no"]
38)
39])
40
41dnl ============================================================================
42
Jason Evansb7924f52009-06-23 19:01:18 -070043srcroot=$srcdir
44if test "x${srcroot}" = "x." ; then
45 srcroot=""
46else
47 srcroot="${srcroot}/"
48fi
49AC_SUBST([srcroot])
50abs_srcroot="`cd \"${srcdir}\"; pwd`/"
51AC_SUBST([abs_srcroot])
52
53objroot=""
54AC_SUBST([objroot])
55abs_objroot="`pwd`/"
56AC_SUBST([abs_objroot])
57
58dnl Munge install path variables.
59if test "x$prefix" = "xNONE" ; then
60 prefix="/usr/local"
61fi
62if test "x$exec_prefix" = "xNONE" ; then
63 exec_prefix=$prefix
64fi
65PREFIX=$prefix
66AC_SUBST([PREFIX])
67BINDIR=`eval echo $bindir`
68BINDIR=`eval echo $BINDIR`
69AC_SUBST([BINDIR])
70INCLUDEDIR=`eval echo $includedir`
71INCLUDEDIR=`eval echo $INCLUDEDIR`
72AC_SUBST([INCLUDEDIR])
73LIBDIR=`eval echo $libdir`
74LIBDIR=`eval echo $LIBDIR`
75AC_SUBST([LIBDIR])
76DATADIR=`eval echo $datadir`
77DATADIR=`eval echo $DATADIR`
78AC_SUBST([DATADIR])
79MANDIR=`eval echo $mandir`
80MANDIR=`eval echo $MANDIR`
81AC_SUBST([MANDIR])
82
Jason Evanscc00a152009-06-25 18:06:48 -070083cfgoutputs="Makefile doc/jemalloc.3"
Jason Evansb7924f52009-06-23 19:01:18 -070084cfghdrs="src/jemalloc_defs.h"
85
Jason Evansf3340ca2009-06-30 16:17:05 -070086dnl If CFLAGS isn't defined, set CFLAGS to something reasonable. Otherwise,
87dnl just prevent autoconf from molesting CFLAGS.
Jason Evansb7924f52009-06-23 19:01:18 -070088CFLAGS=$CFLAGS
89AC_PROG_CC
90if test "x$CFLAGS" = "x" ; then
91 no_CFLAGS="yes"
Jason Evansf3340ca2009-06-30 16:17:05 -070092 JE_CFLAGS_APPEND([-std=gnu99])
93 JE_CFLAGS_APPEND([-Wall])
94 JE_CFLAGS_APPEND([-pipe])
95 JE_CFLAGS_APPEND([-g3])
96 JE_CFLAGS_APPEND([-march=native])
97 JE_CFLAGS_APPEND([-ftls-model=initial-exec])
Jason Evansb7924f52009-06-23 19:01:18 -070098fi
99dnl Append EXTRA_CFLAGS to CFLAGS, if defined.
100if test "x$EXTRA_CFLAGS" != "x" ; then
Jason Evansf3340ca2009-06-30 16:17:05 -0700101 JE_CFLAGS_APPEND([$EXTRA_CFLAGS])
Jason Evansb7924f52009-06-23 19:01:18 -0700102fi
103AC_PROG_CPP
104
Jason Evansb7924f52009-06-23 19:01:18 -0700105AC_CHECK_SIZEOF([void *])
106if test "x${ac_cv_sizeof_void_p}" = "x8" ; then
Jason Evans94ad2b52009-12-29 00:09:15 -0800107 LG_SIZEOF_PTR=3
Jason Evansb7924f52009-06-23 19:01:18 -0700108elif test "x${ac_cv_sizeof_void_p}" = "x4" ; then
Jason Evans94ad2b52009-12-29 00:09:15 -0800109 LG_SIZEOF_PTR=2
Jason Evansb7924f52009-06-23 19:01:18 -0700110else
111 AC_MSG_ERROR([Unsupported pointer size: ${ac_cv_sizeof_void_p}])
112fi
Jason Evans94ad2b52009-12-29 00:09:15 -0800113AC_DEFINE_UNQUOTED([LG_SIZEOF_PTR], [$LG_SIZEOF_PTR])
114
115AC_CHECK_SIZEOF([int])
116if test "x${ac_cv_sizeof_int}" = "x8" ; then
117 LG_SIZEOF_INT=3
118elif test "x${ac_cv_sizeof_int}" = "x4" ; then
119 LG_SIZEOF_INT=2
120else
121 AC_MSG_ERROR([Unsupported int size: ${ac_cv_sizeof_int}])
122fi
123AC_DEFINE_UNQUOTED([LG_SIZEOF_INT], [$LG_SIZEOF_INT])
Jason Evansb7924f52009-06-23 19:01:18 -0700124
125AC_CANONICAL_HOST
126dnl CPU-specific settings.
127CPU_SPINWAIT=""
128case "${host_cpu}" in
129 i[[345]]86)
130 ;;
131 i686)
Jason Evansf3340ca2009-06-30 16:17:05 -0700132 JE_COMPILABLE([__asm__], [], [[__asm__ volatile("pause"); return 0;]],
133 [asm])
134 if test "x${asm}" = "xyes" ; then
135 CPU_SPINWAIT='__asm__ volatile("pause")'
136 fi
Jason Evansb7924f52009-06-23 19:01:18 -0700137 ;;
138 x86_64)
Jason Evansf3340ca2009-06-30 16:17:05 -0700139 JE_COMPILABLE([__asm__ syntax], [],
140 [[__asm__ volatile("pause"); return 0;]], [asm])
141 if test "x${asm}" = "xyes" ; then
142 CPU_SPINWAIT='__asm__ volatile("pause")'
143 fi
Jason Evansb7924f52009-06-23 19:01:18 -0700144 ;;
145 *)
146 ;;
147esac
148AC_DEFINE_UNQUOTED([CPU_SPINWAIT], [$CPU_SPINWAIT])
149
Jason Evansf3340ca2009-06-30 16:17:05 -0700150JE_COMPILABLE([__attribute__ syntax],
151 [static __attribute__((unused)) void foo(void){}],
152 [],
153 [attribute])
154if test "x${attribute}" = "xyes" ; then
155 AC_DEFINE_UNQUOTED([JEMALLOC_UNUSED], [__attribute__((unused))])
156else
157 AC_DEFINE_UNQUOTED([JEMALLOC_UNUSED], [])
158fi
159
Jason Evansb7924f52009-06-23 19:01:18 -0700160dnl Platform-specific settings. abi and RPATH can probably be determined
161dnl programmatically, but doing so is error-prone, which makes it generally
162dnl not worth the trouble.
163dnl
164dnl Define cpp macros in CPPFLAGS, rather than doing AC_DEFINE(macro), since the
165dnl definitions need to be seen before any headers are included, which is a pain
166dnl to make happen otherwise.
167case "${host}" in
168 *-*-darwin*)
169 CFLAGS="$CFLAGS -fno-common -no-cpp-precomp"
170 abi="macho"
171 RPATH=""
172 ;;
173 *-*-freebsd*)
174 CFLAGS="$CFLAGS"
175 abi="elf"
176 RPATH="-Wl,-rpath,"
177 ;;
178 *-*-linux*)
179 CFLAGS="$CFLAGS"
180 CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
181 abi="elf"
182 RPATH="-Wl,-rpath,"
183 ;;
184 *-*-netbsd*)
185 AC_MSG_CHECKING([ABI])
186 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
187[[#ifdef __ELF__
188/* ELF */
189#else
190#error aout
191#endif
192]])],
193 [CFLAGS="$CFLAGS"; abi="elf"],
194 [abi="aout"])
195 AC_MSG_RESULT([$abi])
196 RPATH="-Wl,-rpath,"
197 ;;
198 *-*-solaris2*)
199 CFLAGS="$CFLAGS"
200 abi="elf"
201 RPATH="-Wl,-R,"
202 dnl Solaris needs this for sigwait().
203 CPPFLAGS="$CPPFLAGS -D_POSIX_PTHREAD_SEMANTICS"
204 LIBS="$LIBS -lposix4 -lsocket -lnsl"
205 ;;
206 *)
207 AC_MSG_RESULT([Unsupported operating system: ${host}])
208 abi="elf"
209 RPATH="-Wl,-rpath,"
210 ;;
211esac
212AC_SUBST([abi])
213AC_SUBST([RPATH])
214
215dnl Support optional additions to rpath.
216AC_ARG_WITH([rpath],
Jason Evans90895cf2009-12-29 00:09:15 -0800217 [AS_HELP_STRING([--with-rpath=<rpath>], [Colon-separated rpath (ELF systems only)])],
Jason Evansb7924f52009-06-23 19:01:18 -0700218if test "x$with_rpath" = "xno" ; then
219 RPATH_EXTRA=
220else
221 RPATH_EXTRA="`echo $with_rpath | tr \":\" \" \"`"
222fi,
223 RPATH_EXTRA=
224)
225AC_SUBST([RPATH_EXTRA])
226
227dnl Disable rules that do automatic regeneration of configure output by default.
228AC_ARG_ENABLE([autogen],
229 [AS_HELP_STRING[--enable-autogen], [Automatically regenerate configure output])],
230if test "x$enable_autogen" = "xno" ; then
231 enable_autogen="0"
232else
233 enable_autogen="1"
234fi
235,
236enable_autogen="0"
237)
238AC_SUBST([enable_autogen])
239
240AC_PROG_INSTALL
241AC_PROG_RANLIB
242AC_PATH_PROG([AR], [ar], , [$PATH])
243AC_PATH_PROG([LD], [ld], , [$PATH])
244AC_PATH_PROG([AUTOCONF], [autoconf], , [$PATH])
245
Jason Evans90895cf2009-12-29 00:09:15 -0800246dnl Do not prefix public APIs by default.
247AC_ARG_WITH([jemalloc_prefix],
248 [AS_HELP_STRING([--with-jemalloc-prefix=<prefix>], [Prefix to prepend to all public APIs])],
249if test "x$with_jemalloc_prefix" = "xno" ; then
250 JEMALLOC_PREFIX=
251else
252 JEMALLOC_PREFIX="$with_jemalloc_prefix"
253fi,
254 JEMALLOC_PREFIX=
255)
256if test "x$JEMALLOC_PREFIX" != "x" ; then
257 AC_DEFINE([JEMALLOC_PREFIX], [ ])
258 jemalloc_prefix=$JEMALLOC_PREFIX
259 AC_SUBST([jemalloc_prefix])
260 AC_DEFINE_UNQUOTED([malloc], [${JEMALLOC_PREFIX}malloc])
261 AC_DEFINE_UNQUOTED([calloc], [${JEMALLOC_PREFIX}calloc])
262 AC_DEFINE_UNQUOTED([posix_memalign], [${JEMALLOC_PREFIX}posix_memalign])
263 AC_DEFINE_UNQUOTED([realloc], [${JEMALLOC_PREFIX}realloc])
264 AC_DEFINE_UNQUOTED([free], [${JEMALLOC_PREFIX}free])
265 AC_DEFINE_UNQUOTED([malloc_usable_size], [${JEMALLOC_PREFIX}malloc_usable_size])
Jason Evans84cbbcb2009-12-29 00:09:15 -0800266 AC_DEFINE_UNQUOTED([malloc_tcache_flush], [${JEMALLOC_PREFIX}malloc_tcache_flush])
Jason Evans90895cf2009-12-29 00:09:15 -0800267 AC_DEFINE_UNQUOTED([malloc_options], [${JEMALLOC_PREFIX}malloc_options])
268 AC_DEFINE_UNQUOTED([malloc_message], [${JEMALLOC_PREFIX}malloc_message])
269fi
270
Jason Evansb7924f52009-06-23 19:01:18 -0700271dnl Do not compile with debugging by default.
272AC_ARG_ENABLE([debug],
273 [AS_HELP_STRING([--enable-debug], [Build debugging code])],
274[if test "x$enable_debug" = "xno" ; then
275 enable_debug="0"
276else
277 enable_debug="1"
278fi
279],
280[enable_debug="0"]
281)
282if test "x$enable_debug" = "x1" ; then
283 AC_DEFINE([JEMALLOC_DEBUG], [ ])
284fi
285AC_SUBST([enable_debug])
286
287dnl Only optimize if not debugging.
288if test "x$enable_debug" = "x0" -a "x$no_CFLAGS" = "xyes" ; then
289 dnl Make sure that an optimization flag was not specified in EXTRA_CFLAGS.
Jason Evansf3340ca2009-06-30 16:17:05 -0700290 optimize="no"
291 echo "$EXTRA_CFLAGS" | grep "\-O" >/dev/null || optimize="yes"
292 if test "x${optimize}" = "xyes" ; then
293 if test "x$GCC" = "xyes" ; then
294 JE_CFLAGS_APPEND([-O3])
295 JE_CFLAGS_APPEND([-funroll-loops])
296 JE_CFLAGS_APPEND([-fomit-frame-pointer])
297 else
298 JE_CFLAGS_APPEND([-O])
299 fi
Jason Evansb7924f52009-06-23 19:01:18 -0700300 fi
301fi
302
303dnl Do not enable statistics calculation by default.
304AC_ARG_ENABLE([stats],
305 [AS_HELP_STRING([--enable-stats], [Enable statistics calculation/reporting])],
306[if test "x$enable_stats" = "xno" ; then
307 enable_stats="0"
308else
309 enable_stats="1"
310fi
311],
312[enable_stats="0"]
313)
314if test "x$enable_stats" = "x1" ; then
315 AC_DEFINE([JEMALLOC_STATS], [ ])
316fi
317AC_SUBST([enable_stats])
Jason Evanscc00a152009-06-25 18:06:48 -0700318if test "x$enable_stats" = "x0" ; then
319 roff_stats=".\\\" "
320else
321 roff_stats=""
322fi
323AC_SUBST([roff_stats])
Jason Evansb7924f52009-06-23 19:01:18 -0700324
Jason Evans569432c2009-12-29 00:09:15 -0800325dnl Do not enable tracing by default.
326AC_ARG_ENABLE([trace],
327 [AS_HELP_STRING([--enable-trace], [Enable allocation tracing (logging)])],
328[if test "x$enable_trace" = "xno" ; then
329 enable_trace="0"
330else
331 enable_trace="1"
332fi
333],
334[enable_trace="0"]
335)
336if test "x$enable_trace" = "x1" ; then
337 AC_DEFINE([JEMALLOC_TRACE], [ ])
338fi
339AC_SUBST([enable_trace])
340if test "x$enable_trace" = "x0" ; then
341 roff_trace=".\\\" "
342else
343 roff_trace=""
344fi
345AC_SUBST([roff_trace])
346
Jason Evansb7924f52009-06-23 19:01:18 -0700347dnl Enable tiny allocations by default.
348AC_ARG_ENABLE([tiny],
349 [AS_HELP_STRING([--disable-tiny], [Disable tiny (sub-quantum) allocations])],
350[if test "x$enable_tiny" = "xno" ; then
351 enable_tiny="0"
352else
353 enable_tiny="1"
354fi
355],
356[enable_tiny="1"]
357)
358if test "x$enable_tiny" = "x1" ; then
359 AC_DEFINE([JEMALLOC_TINY], [ ])
360fi
361AC_SUBST([enable_tiny])
Jason Evanscc00a152009-06-25 18:06:48 -0700362if test "x$enable_tiny" = "x0" ; then
363 roff_tiny=".\\\" "
364 roff_no_tiny=""
365else
366 roff_tiny=""
367 roff_no_tiny=".\\\" "
368fi
369AC_SUBST([roff_tiny])
370AC_SUBST([roff_no_tiny])
Jason Evansb7924f52009-06-23 19:01:18 -0700371
Jason Evans84cbbcb2009-12-29 00:09:15 -0800372dnl Enable thread-specific caching by default.
373AC_ARG_ENABLE([tcache],
374 [AS_HELP_STRING([--disable-tcache], [Disable per thread caches])],
375[if test "x$enable_tcache" = "xno" ; then
376 enable_tcache="0"
Jason Evansb7924f52009-06-23 19:01:18 -0700377else
Jason Evans84cbbcb2009-12-29 00:09:15 -0800378 enable_tcache="1"
Jason Evansb7924f52009-06-23 19:01:18 -0700379fi
380],
Jason Evans84cbbcb2009-12-29 00:09:15 -0800381[enable_tcache="1"]
Jason Evansb7924f52009-06-23 19:01:18 -0700382)
Jason Evans84cbbcb2009-12-29 00:09:15 -0800383dnl Finish tcache-related definitions below, once TLS configuration is done.
Jason Evansb7924f52009-06-23 19:01:18 -0700384
Jason Evansb7924f52009-06-23 19:01:18 -0700385dnl Do not enable allocation from DSS by default.
386AC_ARG_ENABLE([dss],
387 [AS_HELP_STRING([--enable-dss], [Enable allocation from DSS])],
388[if test "x$enable_dss" = "xno" ; then
389 enable_dss="0"
390else
391 enable_dss="1"
392fi
393],
394[enable_dss="0"]
395)
396if test "x$enable_dss" = "x1" ; then
397 AC_DEFINE([JEMALLOC_DSS], [ ])
398fi
399AC_SUBST([enable_dss])
Jason Evanscc00a152009-06-25 18:06:48 -0700400if test "x$enable_dss" = "x0" ; then
401 roff_dss=".\\\" "
402else
403 roff_dss=""
404fi
405AC_SUBST([roff_dss])
Jason Evansb7924f52009-06-23 19:01:18 -0700406
407dnl Do not support the junk/zero filling option by default.
408AC_ARG_ENABLE([fill],
409 [AS_HELP_STRING([--enable-fill], [Support junk/zero filling option])],
410[if test "x$enable_fill" = "xno" ; then
411 enable_fill="0"
412else
413 enable_fill="1"
414fi
415],
416[enable_fill="0"]
417)
418if test "x$enable_fill" = "x1" ; then
419 AC_DEFINE([JEMALLOC_FILL], [ ])
420fi
421AC_SUBST([enable_fill])
Jason Evanscc00a152009-06-25 18:06:48 -0700422if test "x$enable_fill" = "x0" ; then
423 roff_fill=".\\\" "
424else
425 roff_fill=""
426fi
427AC_SUBST([roff_fill])
Jason Evansb7924f52009-06-23 19:01:18 -0700428
429dnl Do not support the xmalloc option by default.
430AC_ARG_ENABLE([xmalloc],
431 [AS_HELP_STRING([--enable-xmalloc], [Support xmalloc option])],
432[if test "x$enable_xmalloc" = "xno" ; then
433 enable_xmalloc="0"
434else
435 enable_xmalloc="1"
436fi
437],
438[enable_xmalloc="0"]
439)
440if test "x$enable_xmalloc" = "x1" ; then
441 AC_DEFINE([JEMALLOC_XMALLOC], [ ])
442fi
443AC_SUBST([enable_xmalloc])
Jason Evanscc00a152009-06-25 18:06:48 -0700444if test "x$enable_xmalloc" = "x0" ; then
445 roff_xmalloc=".\\\" "
446else
447 roff_xmalloc=""
448fi
449AC_SUBST([roff_xmalloc])
Jason Evansb7924f52009-06-23 19:01:18 -0700450
451dnl Do not support the SYSV option by default.
452AC_ARG_ENABLE([sysv],
453 [AS_HELP_STRING([--enable-sysv], [Support SYSV semantics option])],
454[if test "x$enable_sysv" = "xno" ; then
455 enable_sysv="0"
456else
457 enable_sysv="1"
458fi
459],
460[enable_sysv="0"]
461)
462if test "x$enable_sysv" = "x1" ; then
463 AC_DEFINE([JEMALLOC_SYSV], [ ])
464fi
465AC_SUBST([enable_sysv])
Jason Evanscc00a152009-06-25 18:06:48 -0700466if test "x$enable_sysv" = "x0" ; then
467 roff_sysv=".\\\" "
468else
469 roff_sysv=""
470fi
471AC_SUBST([roff_sysv])
Jason Evansb7924f52009-06-23 19:01:18 -0700472
473dnl Do not determine page shift at run time by default.
474AC_ARG_ENABLE([dynamic_page_shift],
475 [AS_HELP_STRING([--enable-dynamic-page-shift],
476 [Determine page size at run time (don't trust configure result)])],
477[if test "x$enable_dynamic_page_shift" = "xno" ; then
478 enable_dynamic_page_shift="0"
479else
480 enable_dynamic_page_shift="1"
481fi
482],
483[enable_dynamic_page_shift="0"]
484)
485if test "x$enable_dynamic_page_shift" = "x1" ; then
486 AC_DEFINE([DYNAMIC_PAGE_SHIFT], [ ])
487fi
488AC_SUBST([enable_dynamic_page_shift])
489
490AC_MSG_CHECKING([STATIC_PAGE_SHIFT])
491AC_RUN_IFELSE([AC_LANG_PROGRAM(
492[[#include <stdio.h>
493#include <unistd.h>
494#include <strings.h>
495]], [[
496 long result;
497 FILE *f;
498
499 result = sysconf(_SC_PAGESIZE);
500 if (result == -1) {
501 return 1;
502 }
503 f = fopen("conftest.out", "w");
504 if (f == NULL) {
505 return 1;
506 }
507 fprintf(f, "%u\n", ffs((int)result) - 1);
508 close(f);
509
510 return 0;
511]])],
512 [STATIC_PAGE_SHIFT=`cat conftest.out`]
513 AC_MSG_RESULT([$STATIC_PAGE_SHIFT])
514 AC_DEFINE_UNQUOTED([STATIC_PAGE_SHIFT], [$STATIC_PAGE_SHIFT]),
515 AC_MSG_RESULT([error]))
516
517dnl ============================================================================
518dnl jemalloc configuration.
519dnl
520jemalloc_version=`cat ${srcroot}VERSION`
Jason Evanscc00a152009-06-25 18:06:48 -0700521AC_DEFINE_UNQUOTED([JEMALLOC_VERSION], ["$jemalloc_version"])
Jason Evansb7924f52009-06-23 19:01:18 -0700522AC_SUBST([jemalloc_version])
523
524dnl ============================================================================
525dnl Configure pthreads.
526
527AC_CHECK_HEADERS([pthread.h], , [AC_MSG_ERROR([pthread.h is missing])])
528AC_CHECK_LIB([pthread], [pthread_create], [LIBS="$LIBS -lpthread"],
529 [AC_MSG_ERROR([libpthread is missing])])
530
531CPPFLAGS="$CPPFLAGS -D_REENTRANT"
532
533AC_MSG_CHECKING([for TLS])
534AC_RUN_IFELSE([AC_LANG_PROGRAM(
535[[
536 __thread int x;
537]], [[
538 x = 42;
539
540 return 0;
541]])],
Jason Evanscc00a152009-06-25 18:06:48 -0700542 AC_MSG_RESULT([yes])
Jason Evans84cbbcb2009-12-29 00:09:15 -0800543 have_tls="1",
Jason Evansb7924f52009-06-23 19:01:18 -0700544 AC_MSG_RESULT([no])
Jason Evans84cbbcb2009-12-29 00:09:15 -0800545 have_tls="0"
Jason Evansb7924f52009-06-23 19:01:18 -0700546 AC_DEFINE_UNQUOTED([NO_TLS], [ ]))
Jason Evans84cbbcb2009-12-29 00:09:15 -0800547
548dnl Finish tcache-related definitions, now that TLS configuration is done.
549if test "x$have_tls" = "x0" ; then
550 enable_tcache="0"
551fi
552if test "x$enable_tcache" = "x1" ; then
553 AC_DEFINE([JEMALLOC_TCACHE], [ ])
554fi
555AC_SUBST([enable_tcache])
556if test "x$enable_tcache" = "x0" ; then
557 roff_tcache=".\\\" "
558 roff_no_tcache=""
559else
560 roff_tcache=""
561 roff_no_tcache=".\\\" "
562fi
563AC_SUBST([roff_tcache])
564AC_SUBST([roff_no_tcache])
Jason Evansb7924f52009-06-23 19:01:18 -0700565
Jason Evanscc00a152009-06-25 18:06:48 -0700566dnl Enable lazy locking by default.
Jason Evansb7924f52009-06-23 19:01:18 -0700567AC_ARG_ENABLE([lazy_lock],
Jason Evansa1624022009-11-09 14:58:12 -0800568 [AS_HELP_STRING([--disable-lazy-lock],
Jason Evanscc00a152009-06-25 18:06:48 -0700569 [Disable lazy locking (always lock, even when single-threaded)])],
Jason Evansb7924f52009-06-23 19:01:18 -0700570[if test "x$enable_lazy_lock" = "xno" ; then
571 enable_lazy_lock="0"
572else
573 enable_lazy_lock="1"
574fi
575],
Jason Evanscc00a152009-06-25 18:06:48 -0700576[enable_lazy_lock="1"]
Jason Evansb7924f52009-06-23 19:01:18 -0700577)
578if test "x$enable_lazy_lock" = "x1" ; then
579 AC_CHECK_HEADERS([dlfcn.h], , [AC_MSG_ERROR([dlfcn.h is missing])])
580 AC_CHECK_LIB([dl], [dlopen], [LIBS="$LIBS -ldl"],
581 [AC_MSG_ERROR([libdl is missing])])
582 AC_DEFINE([JEMALLOC_LAZY_LOCK], [ ])
583fi
584AC_SUBST([enable_lazy_lock])
585
586dnl ============================================================================
Jason Evans662a0172009-07-01 19:24:31 -0700587dnl Configure libgd for mtrgraph.
Jason Evans569432c2009-12-29 00:09:15 -0800588bins="${objroot}bin/jemtr2mtr ${objroot}bin/mtrplay"
Jason Evans662a0172009-07-01 19:24:31 -0700589GDLIBS=""
590
591have_libgd="yes"
592AC_CHECK_HEADERS([gd.h], , [have_libgd="no"])
593AC_CHECK_HEADERS([gdfontt.h], , [have_libgd="no"])
594AC_CHECK_HEADERS([gdfonts.h], , [have_libgd="no"])
595AC_CHECK_HEADERS([gdfontmb.h], , [have_libgd="no"])
596AC_CHECK_HEADERS([gdfontl.h], , [have_libgd="no"])
597AC_CHECK_HEADERS([gdfontg.h], , [have_libgd="no"])
598AC_CHECK_LIB([gd], [gdImageCreate], [GDLIBS="-lgd"], [have_libgd="no"])
599
600if test "x${have_libgd}" = "xyes" ; then
601 bins="${bins} ${objroot}bin/mtrgraph"
602fi
603AC_SUBST([bins])
604AC_SUBST([GDLIBS])
605
606dnl ============================================================================
Jason Evansb7924f52009-06-23 19:01:18 -0700607dnl Check for typedefs, structures, and compiler characteristics.
608AC_HEADER_STDBOOL
609
610dnl Process .in files.
611AC_SUBST([cfghdrs])
612AC_CONFIG_HEADERS([$cfghdrs cfghdrs.stamp])
613
614dnl ============================================================================
615dnl Generate outputs.
616AC_CONFIG_FILES([$cfgoutputs cfgoutputs.stamp])
617AC_SUBST([cfgoutputs])
618AC_OUTPUT
619
620dnl ============================================================================
621dnl Print out the results of configuration.
622AC_MSG_RESULT([===============================================================================])
623AC_MSG_RESULT([jemalloc version : $jemalloc_version])
624AC_MSG_RESULT([])
625AC_MSG_RESULT([CC : ${CC}])
626AC_MSG_RESULT([CPPFLAGS : ${CPPFLAGS}])
627AC_MSG_RESULT([CFLAGS : ${CFLAGS}])
628AC_MSG_RESULT([LDFLAGS : ${LDFLAGS}])
629AC_MSG_RESULT([LIBS : ${LIBS}])
630AC_MSG_RESULT([RPATH_EXTRA : ${RPATH_EXTRA}])
631AC_MSG_RESULT([])
632AC_MSG_RESULT([PREFIX : ${PREFIX}])
633AC_MSG_RESULT([BINDIR : ${BINDIR}])
Jason Evans662a0172009-07-01 19:24:31 -0700634AC_MSG_RESULT([INCLUDEDIR : ${INCLUDEDIR}])
635AC_MSG_RESULT([LIBDIR : ${LIBDIR}])
Jason Evansb7924f52009-06-23 19:01:18 -0700636AC_MSG_RESULT([DATADIR : ${DATADIR}])
637AC_MSG_RESULT([MANDIR : ${MANDIR}])
638AC_MSG_RESULT([])
639AC_MSG_RESULT([srcroot : ${srcroot}])
640AC_MSG_RESULT([abs_srcroot : ${abs_srcroot}])
641AC_MSG_RESULT([objroot : ${objroot}])
642AC_MSG_RESULT([abs_objroot : ${abs_objroot}])
643AC_MSG_RESULT([])
Jason Evans662a0172009-07-01 19:24:31 -0700644AC_MSG_RESULT([bins : ${bins}])
645AC_MSG_RESULT([])
Jason Evans90895cf2009-12-29 00:09:15 -0800646AC_MSG_RESULT([JEMALLOC_PREFIX : ${JEMALLOC_PREFIX}])
Jason Evansb7924f52009-06-23 19:01:18 -0700647AC_MSG_RESULT([autogen : ${enable_autogen}])
648AC_MSG_RESULT([debug : ${enable_debug}])
649AC_MSG_RESULT([stats : ${enable_stats}])
Jason Evans569432c2009-12-29 00:09:15 -0800650AC_MSG_RESULT([trace : ${enable_trace}])
Jason Evansb7924f52009-06-23 19:01:18 -0700651AC_MSG_RESULT([tiny : ${enable_tiny}])
Jason Evans84cbbcb2009-12-29 00:09:15 -0800652AC_MSG_RESULT([tcache : ${enable_tcache}])
Jason Evansb7924f52009-06-23 19:01:18 -0700653AC_MSG_RESULT([fill : ${enable_fill}])
654AC_MSG_RESULT([xmalloc : ${enable_xmalloc}])
655AC_MSG_RESULT([sysv : ${enable_sysv}])
656AC_MSG_RESULT([dss : ${enable_dss}])
657AC_MSG_RESULT([dynamic_page_shift : ${enable_dynamic_page_shift}])
658AC_MSG_RESULT([lazy_lock : ${enable_lazy_lock}])
659AC_MSG_RESULT([===============================================================================])