Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 1 | dnl Process this file with autoconf to produce a configure script. |
| 2 | AC_INIT([Makefile.in]) |
| 3 | |
Jason Evans | f3340ca | 2009-06-30 16:17:05 -0700 | [diff] [blame] | 4 | dnl ============================================================================ |
| 5 | dnl Custom macro definitions. |
| 6 | |
| 7 | dnl JE_CFLAGS_APPEND(cflag) |
| 8 | AC_DEFUN([JE_CFLAGS_APPEND], |
| 9 | [ |
| 10 | AC_MSG_CHECKING([whether compiler supports $1]) |
| 11 | TCFLAGS="${CFLAGS}" |
| 12 | if test "x${CFLAGS}" = "x" ; then |
| 13 | CFLAGS="$1" |
| 14 | else |
| 15 | CFLAGS="${CFLAGS} $1" |
| 16 | fi |
Jason Evans | 6684cac | 2012-03-05 12:15:36 -0800 | [diff] [blame] | 17 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM( |
Jason Evans | f3340ca | 2009-06-30 16:17:05 -0700 | [diff] [blame] | 18 | [[ |
| 19 | ]], [[ |
| 20 | return 0; |
| 21 | ]])], |
Jason Evans | 99b0fbb | 2014-02-24 16:08:38 -0800 | [diff] [blame] | 22 | [je_cv_cflags_appended=$1] |
Jason Evans | f3340ca | 2009-06-30 16:17:05 -0700 | [diff] [blame] | 23 | AC_MSG_RESULT([yes]), |
Jason Evans | 99b0fbb | 2014-02-24 16:08:38 -0800 | [diff] [blame] | 24 | [je_cv_cflags_appended=] |
Jason Evans | f3340ca | 2009-06-30 16:17:05 -0700 | [diff] [blame] | 25 | AC_MSG_RESULT([no]) |
| 26 | [CFLAGS="${TCFLAGS}"] |
| 27 | ) |
| 28 | ]) |
| 29 | |
| 30 | dnl JE_COMPILABLE(label, hcode, mcode, rvar) |
Jason Evans | 4c2faa8 | 2012-03-13 11:09:23 -0700 | [diff] [blame] | 31 | dnl |
Jason Evans | f3e139a | 2012-03-19 09:54:20 -0700 | [diff] [blame] | 32 | dnl Use AC_LINK_IFELSE() rather than AC_COMPILE_IFELSE() so that linker errors |
Jason Evans | 4c2faa8 | 2012-03-13 11:09:23 -0700 | [diff] [blame] | 33 | dnl cause failure. |
Jason Evans | f3340ca | 2009-06-30 16:17:05 -0700 | [diff] [blame] | 34 | AC_DEFUN([JE_COMPILABLE], |
| 35 | [ |
Jason Evans | 6684cac | 2012-03-05 12:15:36 -0800 | [diff] [blame] | 36 | AC_CACHE_CHECK([whether $1 is compilable], |
| 37 | [$4], |
Jason Evans | f3e139a | 2012-03-19 09:54:20 -0700 | [diff] [blame] | 38 | [AC_LINK_IFELSE([AC_LANG_PROGRAM([$2], |
| 39 | [$3])], |
| 40 | [$4=yes], |
| 41 | [$4=no])]) |
Jason Evans | f3340ca | 2009-06-30 16:17:05 -0700 | [diff] [blame] | 42 | ]) |
| 43 | |
| 44 | dnl ============================================================================ |
| 45 | |
Jason Evans | f576c63 | 2011-11-01 22:27:41 -0700 | [diff] [blame] | 46 | dnl Library revision. |
Jason Evans | 9790b96 | 2014-04-14 22:32:31 -0700 | [diff] [blame] | 47 | rev=2 |
Jason Evans | f576c63 | 2011-11-01 22:27:41 -0700 | [diff] [blame] | 48 | AC_SUBST([rev]) |
| 49 | |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 50 | srcroot=$srcdir |
| 51 | if test "x${srcroot}" = "x." ; then |
| 52 | srcroot="" |
| 53 | else |
| 54 | srcroot="${srcroot}/" |
| 55 | fi |
| 56 | AC_SUBST([srcroot]) |
| 57 | abs_srcroot="`cd \"${srcdir}\"; pwd`/" |
| 58 | AC_SUBST([abs_srcroot]) |
| 59 | |
| 60 | objroot="" |
| 61 | AC_SUBST([objroot]) |
| 62 | abs_objroot="`pwd`/" |
| 63 | AC_SUBST([abs_objroot]) |
| 64 | |
| 65 | dnl Munge install path variables. |
| 66 | if test "x$prefix" = "xNONE" ; then |
| 67 | prefix="/usr/local" |
| 68 | fi |
| 69 | if test "x$exec_prefix" = "xNONE" ; then |
| 70 | exec_prefix=$prefix |
| 71 | fi |
| 72 | PREFIX=$prefix |
| 73 | AC_SUBST([PREFIX]) |
| 74 | BINDIR=`eval echo $bindir` |
| 75 | BINDIR=`eval echo $BINDIR` |
| 76 | AC_SUBST([BINDIR]) |
| 77 | INCLUDEDIR=`eval echo $includedir` |
| 78 | INCLUDEDIR=`eval echo $INCLUDEDIR` |
| 79 | AC_SUBST([INCLUDEDIR]) |
| 80 | LIBDIR=`eval echo $libdir` |
| 81 | LIBDIR=`eval echo $LIBDIR` |
| 82 | AC_SUBST([LIBDIR]) |
| 83 | DATADIR=`eval echo $datadir` |
| 84 | DATADIR=`eval echo $DATADIR` |
| 85 | AC_SUBST([DATADIR]) |
| 86 | MANDIR=`eval echo $mandir` |
| 87 | MANDIR=`eval echo $MANDIR` |
| 88 | AC_SUBST([MANDIR]) |
| 89 | |
Jason Evans | aee7fd2 | 2010-11-24 22:00:02 -0800 | [diff] [blame] | 90 | dnl Support for building documentation. |
Jason Evans | 7329a4f | 2013-01-22 10:53:29 -0800 | [diff] [blame] | 91 | AC_PATH_PROG([XSLTPROC], [xsltproc], [false], [$PATH]) |
Jason Evans | 7091b41 | 2012-03-19 09:36:44 -0700 | [diff] [blame] | 92 | if test -d "/usr/share/xml/docbook/stylesheet/docbook-xsl" ; then |
| 93 | DEFAULT_XSLROOT="/usr/share/xml/docbook/stylesheet/docbook-xsl" |
| 94 | elif test -d "/usr/share/sgml/docbook/xsl-stylesheets" ; then |
| 95 | DEFAULT_XSLROOT="/usr/share/sgml/docbook/xsl-stylesheets" |
| 96 | else |
| 97 | dnl Documentation building will fail if this default gets used. |
| 98 | DEFAULT_XSLROOT="" |
| 99 | fi |
Jason Evans | aee7fd2 | 2010-11-24 22:00:02 -0800 | [diff] [blame] | 100 | AC_ARG_WITH([xslroot], |
Jason Evans | 7091b41 | 2012-03-19 09:36:44 -0700 | [diff] [blame] | 101 | [AS_HELP_STRING([--with-xslroot=<path>], [XSL stylesheet root path])], [ |
Jason Evans | aee7fd2 | 2010-11-24 22:00:02 -0800 | [diff] [blame] | 102 | if test "x$with_xslroot" = "xno" ; then |
Jason Evans | 7091b41 | 2012-03-19 09:36:44 -0700 | [diff] [blame] | 103 | XSLROOT="${DEFAULT_XSLROOT}" |
Jason Evans | aee7fd2 | 2010-11-24 22:00:02 -0800 | [diff] [blame] | 104 | else |
| 105 | XSLROOT="${with_xslroot}" |
Jason Evans | 7091b41 | 2012-03-19 09:36:44 -0700 | [diff] [blame] | 106 | fi |
| 107 | ], |
| 108 | XSLROOT="${DEFAULT_XSLROOT}" |
Jason Evans | aee7fd2 | 2010-11-24 22:00:02 -0800 | [diff] [blame] | 109 | ) |
| 110 | AC_SUBST([XSLROOT]) |
| 111 | |
Jason Evans | f3340ca | 2009-06-30 16:17:05 -0700 | [diff] [blame] | 112 | dnl If CFLAGS isn't defined, set CFLAGS to something reasonable. Otherwise, |
| 113 | dnl just prevent autoconf from molesting CFLAGS. |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 114 | CFLAGS=$CFLAGS |
| 115 | AC_PROG_CC |
Mike Hommey | fd97b1d | 2012-04-30 12:38:31 +0200 | [diff] [blame] | 116 | if test "x$GCC" != "xyes" ; then |
| 117 | AC_CACHE_CHECK([whether compiler is MSVC], |
| 118 | [je_cv_msvc], |
| 119 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], |
| 120 | [ |
| 121 | #ifndef _MSC_VER |
| 122 | int fail[-1]; |
| 123 | #endif |
| 124 | ])], |
| 125 | [je_cv_msvc=yes], |
| 126 | [je_cv_msvc=no])]) |
| 127 | fi |
| 128 | |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 129 | if test "x$CFLAGS" = "x" ; then |
| 130 | no_CFLAGS="yes" |
Jason Evans | cfeccd3 | 2010-03-03 15:48:20 -0800 | [diff] [blame] | 131 | if test "x$GCC" = "xyes" ; then |
| 132 | JE_CFLAGS_APPEND([-std=gnu99]) |
Jason Evans | 99b0fbb | 2014-02-24 16:08:38 -0800 | [diff] [blame] | 133 | if test "x$je_cv_cflags_appended" = "x-std=gnu99" ; then |
| 134 | AC_DEFINE_UNQUOTED([JEMALLOC_HAS_RESTRICT]) |
| 135 | fi |
Jason Evans | cfeccd3 | 2010-03-03 15:48:20 -0800 | [diff] [blame] | 136 | JE_CFLAGS_APPEND([-Wall]) |
| 137 | JE_CFLAGS_APPEND([-pipe]) |
| 138 | JE_CFLAGS_APPEND([-g3]) |
Mike Hommey | fd97b1d | 2012-04-30 12:38:31 +0200 | [diff] [blame] | 139 | elif test "x$je_cv_msvc" = "xyes" ; then |
| 140 | CC="$CC -nologo" |
| 141 | JE_CFLAGS_APPEND([-Zi]) |
| 142 | JE_CFLAGS_APPEND([-MT]) |
| 143 | JE_CFLAGS_APPEND([-W3]) |
Mike Hommey | 8c61575 | 2014-05-29 16:58:21 +0900 | [diff] [blame] | 144 | JE_CFLAGS_APPEND([-FS]) |
Mike Hommey | 6f6704c | 2014-05-29 17:01:10 +0900 | [diff] [blame] | 145 | CPPFLAGS="$CPPFLAGS -I${srcdir}/include/msvc_compat" |
Jason Evans | cfeccd3 | 2010-03-03 15:48:20 -0800 | [diff] [blame] | 146 | fi |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 147 | fi |
| 148 | dnl Append EXTRA_CFLAGS to CFLAGS, if defined. |
| 149 | if test "x$EXTRA_CFLAGS" != "x" ; then |
Jason Evans | f3340ca | 2009-06-30 16:17:05 -0700 | [diff] [blame] | 150 | JE_CFLAGS_APPEND([$EXTRA_CFLAGS]) |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 151 | fi |
| 152 | AC_PROG_CPP |
| 153 | |
Jason Evans | df3f270 | 2014-03-30 16:27:08 -0700 | [diff] [blame] | 154 | AC_C_BIGENDIAN([ac_cv_big_endian=1], [ac_cv_big_endian=0]) |
| 155 | if test "x${ac_cv_big_endian}" = "x1" ; then |
| 156 | AC_DEFINE_UNQUOTED([JEMALLOC_BIG_ENDIAN], [ ]) |
| 157 | fi |
| 158 | |
Mike Hommey | ff2e999 | 2014-05-29 16:33:02 +0900 | [diff] [blame] | 159 | if test "x${je_cv_msvc}" = "xyes" -a "x${ac_cv_header_inttypes_h}" = "xno"; then |
Mike Hommey | 6f6704c | 2014-05-29 17:01:10 +0900 | [diff] [blame] | 160 | CPPFLAGS="$CPPFLAGS -I${srcdir}/include/msvc_compat/C99" |
Mike Hommey | ff2e999 | 2014-05-29 16:33:02 +0900 | [diff] [blame] | 161 | fi |
| 162 | |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 163 | AC_CHECK_SIZEOF([void *]) |
| 164 | if test "x${ac_cv_sizeof_void_p}" = "x8" ; then |
Jason Evans | 94ad2b5 | 2009-12-29 00:09:15 -0800 | [diff] [blame] | 165 | LG_SIZEOF_PTR=3 |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 166 | elif test "x${ac_cv_sizeof_void_p}" = "x4" ; then |
Jason Evans | 94ad2b5 | 2009-12-29 00:09:15 -0800 | [diff] [blame] | 167 | LG_SIZEOF_PTR=2 |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 168 | else |
| 169 | AC_MSG_ERROR([Unsupported pointer size: ${ac_cv_sizeof_void_p}]) |
| 170 | fi |
Jason Evans | 94ad2b5 | 2009-12-29 00:09:15 -0800 | [diff] [blame] | 171 | AC_DEFINE_UNQUOTED([LG_SIZEOF_PTR], [$LG_SIZEOF_PTR]) |
| 172 | |
| 173 | AC_CHECK_SIZEOF([int]) |
| 174 | if test "x${ac_cv_sizeof_int}" = "x8" ; then |
| 175 | LG_SIZEOF_INT=3 |
| 176 | elif test "x${ac_cv_sizeof_int}" = "x4" ; then |
| 177 | LG_SIZEOF_INT=2 |
| 178 | else |
| 179 | AC_MSG_ERROR([Unsupported int size: ${ac_cv_sizeof_int}]) |
| 180 | fi |
| 181 | AC_DEFINE_UNQUOTED([LG_SIZEOF_INT], [$LG_SIZEOF_INT]) |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 182 | |
Jason Evans | 84c8eef | 2011-03-16 10:30:13 -0700 | [diff] [blame] | 183 | AC_CHECK_SIZEOF([long]) |
| 184 | if test "x${ac_cv_sizeof_long}" = "x8" ; then |
| 185 | LG_SIZEOF_LONG=3 |
| 186 | elif test "x${ac_cv_sizeof_long}" = "x4" ; then |
| 187 | LG_SIZEOF_LONG=2 |
| 188 | else |
| 189 | AC_MSG_ERROR([Unsupported long size: ${ac_cv_sizeof_long}]) |
| 190 | fi |
| 191 | AC_DEFINE_UNQUOTED([LG_SIZEOF_LONG], [$LG_SIZEOF_LONG]) |
| 192 | |
Jason Evans | d81e4bd | 2012-03-06 14:57:45 -0800 | [diff] [blame] | 193 | AC_CHECK_SIZEOF([intmax_t]) |
| 194 | if test "x${ac_cv_sizeof_intmax_t}" = "x16" ; then |
| 195 | LG_SIZEOF_INTMAX_T=4 |
| 196 | elif test "x${ac_cv_sizeof_intmax_t}" = "x8" ; then |
| 197 | LG_SIZEOF_INTMAX_T=3 |
| 198 | elif test "x${ac_cv_sizeof_intmax_t}" = "x4" ; then |
| 199 | LG_SIZEOF_INTMAX_T=2 |
| 200 | else |
Mike Hommey | 14103d3 | 2012-04-20 08:38:39 +0200 | [diff] [blame] | 201 | AC_MSG_ERROR([Unsupported intmax_t size: ${ac_cv_sizeof_intmax_t}]) |
Jason Evans | d81e4bd | 2012-03-06 14:57:45 -0800 | [diff] [blame] | 202 | fi |
| 203 | AC_DEFINE_UNQUOTED([LG_SIZEOF_INTMAX_T], [$LG_SIZEOF_INTMAX_T]) |
| 204 | |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 205 | AC_CANONICAL_HOST |
| 206 | dnl CPU-specific settings. |
| 207 | CPU_SPINWAIT="" |
| 208 | case "${host_cpu}" in |
| 209 | i[[345]]86) |
| 210 | ;; |
Jason Evans | cb657e3 | 2014-02-25 11:21:41 -0800 | [diff] [blame] | 211 | i686|x86_64) |
| 212 | JE_COMPILABLE([pause instruction], [], |
| 213 | [[__asm__ volatile("pause"); return 0;]], |
| 214 | [je_cv_pause]) |
| 215 | if test "x${je_cv_pause}" = "xyes" ; then |
Jason Evans | f3340ca | 2009-06-30 16:17:05 -0700 | [diff] [blame] | 216 | CPU_SPINWAIT='__asm__ volatile("pause")' |
| 217 | fi |
Jason Evans | cb657e3 | 2014-02-25 11:21:41 -0800 | [diff] [blame] | 218 | dnl emmintrin.h fails to compile unless MMX, SSE, and SSE2 are |
| 219 | dnl supported. |
| 220 | JE_COMPILABLE([SSE2 intrinsics], [ |
| 221 | #include <emmintrin.h> |
| 222 | ], [], [je_cv_sse2]) |
| 223 | if test "x${je_cv_sse2}" = "xyes" ; then |
| 224 | AC_DEFINE_UNQUOTED([HAVE_SSE2], [ ]) |
Jason Evans | f3340ca | 2009-06-30 16:17:05 -0700 | [diff] [blame] | 225 | fi |
Jason Evans | 80061b6 | 2013-12-09 13:21:08 -0800 | [diff] [blame] | 226 | ;; |
| 227 | powerpc) |
| 228 | AC_DEFINE_UNQUOTED([HAVE_ALTIVEC], [ ]) |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 229 | ;; |
| 230 | *) |
| 231 | ;; |
| 232 | esac |
| 233 | AC_DEFINE_UNQUOTED([CPU_SPINWAIT], [$CPU_SPINWAIT]) |
| 234 | |
Antony Dovgal | 2bd3cbc | 2011-10-13 09:33:33 +0400 | [diff] [blame] | 235 | LD_PRELOAD_VAR="LD_PRELOAD" |
Jason Evans | f576c63 | 2011-11-01 22:27:41 -0700 | [diff] [blame] | 236 | so="so" |
Mike Hommey | fd97b1d | 2012-04-30 12:38:31 +0200 | [diff] [blame] | 237 | importlib="${so}" |
Mike Hommey | 7cdea39 | 2012-04-30 12:38:27 +0200 | [diff] [blame] | 238 | o="$ac_objext" |
Mike Hommey | 5bee66d | 2012-04-16 16:30:24 +0200 | [diff] [blame] | 239 | a="a" |
Mike Hommey | 7cdea39 | 2012-04-30 12:38:27 +0200 | [diff] [blame] | 240 | exe="$ac_exeext" |
Mike Hommey | a19e87f | 2012-04-21 21:27:46 -0700 | [diff] [blame] | 241 | libprefix="lib" |
Mike Hommey | fa08da7 | 2012-04-16 16:30:25 +0200 | [diff] [blame] | 242 | DSO_LDFLAGS='-shared -Wl,-soname,$(@F)' |
| 243 | RPATH='-Wl,-rpath,$(1)' |
Mike Hommey | 7cdea39 | 2012-04-30 12:38:27 +0200 | [diff] [blame] | 244 | SOREV="${so}.${rev}" |
Mike Hommey | 188da7c | 2012-04-18 18:29:41 +0200 | [diff] [blame] | 245 | PIC_CFLAGS='-fPIC -DPIC' |
Mike Hommey | fd97b1d | 2012-04-30 12:38:31 +0200 | [diff] [blame] | 246 | CTARGET='-o $@' |
| 247 | LDTARGET='-o $@' |
| 248 | EXTRA_LDFLAGS= |
Jason Evans | 80ddf49 | 2013-08-20 11:48:19 +0100 | [diff] [blame] | 249 | ARFLAGS='crus' |
| 250 | AROUT=' $@' |
Mike Hommey | 79c4bca | 2012-05-02 21:30:51 +0200 | [diff] [blame] | 251 | CC_MM=1 |
Jason Evans | 7372b15 | 2012-02-10 20:22:09 -0800 | [diff] [blame] | 252 | |
Jory A. Pratt | ad505e0 | 2013-08-11 09:44:59 -0500 | [diff] [blame] | 253 | AN_MAKEVAR([AR], [AC_PROG_AR]) |
| 254 | AN_PROGRAM([ar], [AC_PROG_AR]) |
| 255 | AC_DEFUN([AC_PROG_AR], [AC_CHECK_TOOL(AR, ar, :)]) |
| 256 | AC_PROG_AR |
| 257 | |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 258 | dnl Platform-specific settings. abi and RPATH can probably be determined |
| 259 | dnl programmatically, but doing so is error-prone, which makes it generally |
| 260 | dnl not worth the trouble. |
| 261 | dnl |
| 262 | dnl Define cpp macros in CPPFLAGS, rather than doing AC_DEFINE(macro), since the |
| 263 | dnl definitions need to be seen before any headers are included, which is a pain |
| 264 | dnl to make happen otherwise. |
Jason Evans | 59ae276 | 2012-04-16 17:52:27 -0700 | [diff] [blame] | 265 | default_munmap="1" |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 266 | case "${host}" in |
| 267 | *-*-darwin*) |
Mike Hommey | a6770a7 | 2012-05-03 14:12:49 +0200 | [diff] [blame] | 268 | CFLAGS="$CFLAGS" |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 269 | abi="macho" |
Jason Evans | e24c7af | 2012-03-19 10:21:17 -0700 | [diff] [blame] | 270 | AC_DEFINE([JEMALLOC_PURGE_MADVISE_FREE], [ ]) |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 271 | RPATH="" |
Antony Dovgal | 2bd3cbc | 2011-10-13 09:33:33 +0400 | [diff] [blame] | 272 | LD_PRELOAD_VAR="DYLD_INSERT_LIBRARIES" |
Jason Evans | f576c63 | 2011-11-01 22:27:41 -0700 | [diff] [blame] | 273 | so="dylib" |
Mike Hommey | fd97b1d | 2012-04-30 12:38:31 +0200 | [diff] [blame] | 274 | importlib="${so}" |
Jason Evans | b80581d | 2012-03-23 16:17:43 -0700 | [diff] [blame] | 275 | force_tls="0" |
Mike Hommey | fa08da7 | 2012-04-16 16:30:25 +0200 | [diff] [blame] | 276 | DSO_LDFLAGS='-shared -Wl,-dylib_install_name,$(@F)' |
Mike Hommey | 7cdea39 | 2012-04-30 12:38:27 +0200 | [diff] [blame] | 277 | SOREV="${rev}.${so}" |
Jason Evans | 6668853 | 2013-12-03 21:49:36 -0800 | [diff] [blame] | 278 | sbrk_deprecated="1" |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 279 | ;; |
| 280 | *-*-freebsd*) |
| 281 | CFLAGS="$CFLAGS" |
| 282 | abi="elf" |
Jason Evans | e24c7af | 2012-03-19 10:21:17 -0700 | [diff] [blame] | 283 | AC_DEFINE([JEMALLOC_PURGE_MADVISE_FREE], [ ]) |
Jason Evans | fd4fcef | 2012-03-23 17:40:58 -0700 | [diff] [blame] | 284 | force_lazy_lock="1" |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 285 | ;; |
| 286 | *-*-linux*) |
| 287 | CFLAGS="$CFLAGS" |
| 288 | CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE" |
| 289 | abi="elf" |
Garrett Cooper | 13e4e24 | 2012-12-02 17:58:40 -0800 | [diff] [blame] | 290 | AC_DEFINE([JEMALLOC_HAS_ALLOCA_H]) |
Jason Evans | e24c7af | 2012-03-19 10:21:17 -0700 | [diff] [blame] | 291 | AC_DEFINE([JEMALLOC_PURGE_MADVISE_DONTNEED], [ ]) |
Jason Evans | 02b2312 | 2012-04-05 11:06:23 -0700 | [diff] [blame] | 292 | AC_DEFINE([JEMALLOC_THREADED_INIT], [ ]) |
Jason Evans | 59ae276 | 2012-04-16 17:52:27 -0700 | [diff] [blame] | 293 | default_munmap="0" |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 294 | ;; |
| 295 | *-*-netbsd*) |
| 296 | AC_MSG_CHECKING([ABI]) |
| 297 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM( |
| 298 | [[#ifdef __ELF__ |
| 299 | /* ELF */ |
| 300 | #else |
| 301 | #error aout |
| 302 | #endif |
| 303 | ]])], |
| 304 | [CFLAGS="$CFLAGS"; abi="elf"], |
| 305 | [abi="aout"]) |
| 306 | AC_MSG_RESULT([$abi]) |
Jason Evans | e24c7af | 2012-03-19 10:21:17 -0700 | [diff] [blame] | 307 | AC_DEFINE([JEMALLOC_PURGE_MADVISE_FREE], [ ]) |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 308 | ;; |
| 309 | *-*-solaris2*) |
| 310 | CFLAGS="$CFLAGS" |
| 311 | abi="elf" |
George Kola | ddd6bd4 | 2014-02-12 23:05:45 +0000 | [diff] [blame] | 312 | AC_DEFINE([JEMALLOC_PURGE_MADVISE_FREE], [ ]) |
Mike Hommey | fa08da7 | 2012-04-16 16:30:25 +0200 | [diff] [blame] | 313 | RPATH='-Wl,-R,$(1)' |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 314 | dnl Solaris needs this for sigwait(). |
| 315 | CPPFLAGS="$CPPFLAGS -D_POSIX_PTHREAD_SEMANTICS" |
| 316 | LIBS="$LIBS -lposix4 -lsocket -lnsl" |
| 317 | ;; |
Antony Dovgal | 2bd3cbc | 2011-10-13 09:33:33 +0400 | [diff] [blame] | 318 | *-ibm-aix*) |
| 319 | if "$LG_SIZEOF_PTR" = "8"; then |
| 320 | dnl 64bit AIX |
| 321 | LD_PRELOAD_VAR="LDR_PRELOAD64" |
| 322 | else |
| 323 | dnl 32bit AIX |
| 324 | LD_PRELOAD_VAR="LDR_PRELOAD" |
| 325 | fi |
| 326 | abi="xcoff" |
Antony Dovgal | 2bd3cbc | 2011-10-13 09:33:33 +0400 | [diff] [blame] | 327 | ;; |
Mike Hommey | a19e87f | 2012-04-21 21:27:46 -0700 | [diff] [blame] | 328 | *-*-mingw*) |
| 329 | abi="pecoff" |
| 330 | force_tls="0" |
| 331 | RPATH="" |
| 332 | so="dll" |
Mike Hommey | fd97b1d | 2012-04-30 12:38:31 +0200 | [diff] [blame] | 333 | if test "x$je_cv_msvc" = "xyes" ; then |
| 334 | importlib="lib" |
| 335 | DSO_LDFLAGS="-LD" |
| 336 | EXTRA_LDFLAGS="-link -DEBUG" |
| 337 | CTARGET='-Fo$@' |
| 338 | LDTARGET='-Fe$@' |
Jory A. Pratt | ad505e0 | 2013-08-11 09:44:59 -0500 | [diff] [blame] | 339 | AR='lib' |
| 340 | ARFLAGS='-nologo -out:' |
Jason Evans | 80ddf49 | 2013-08-20 11:48:19 +0100 | [diff] [blame] | 341 | AROUT='$@' |
Mike Hommey | 79c4bca | 2012-05-02 21:30:51 +0200 | [diff] [blame] | 342 | CC_MM= |
Mike Hommey | fd97b1d | 2012-04-30 12:38:31 +0200 | [diff] [blame] | 343 | else |
| 344 | importlib="${so}" |
| 345 | DSO_LDFLAGS="-shared" |
| 346 | fi |
Mike Hommey | a19e87f | 2012-04-21 21:27:46 -0700 | [diff] [blame] | 347 | a="lib" |
| 348 | libprefix="" |
Mike Hommey | 7cdea39 | 2012-04-30 12:38:27 +0200 | [diff] [blame] | 349 | SOREV="${so}" |
Mike Hommey | a19e87f | 2012-04-21 21:27:46 -0700 | [diff] [blame] | 350 | PIC_CFLAGS="" |
| 351 | ;; |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 352 | *) |
| 353 | AC_MSG_RESULT([Unsupported operating system: ${host}]) |
| 354 | abi="elf" |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 355 | ;; |
| 356 | esac |
Mike Hommey | affe009 | 2014-05-28 08:10:12 +0900 | [diff] [blame] | 357 | |
| 358 | JEMALLOC_USABLE_SIZE_CONST=const |
| 359 | AC_CHECK_HEADERS([malloc.h], [ |
| 360 | AC_MSG_CHECKING([whether malloc_usable_size definition can use const argument]) |
| 361 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM( |
| 362 | [#include <malloc.h> |
| 363 | #include <stddef.h> |
| 364 | size_t malloc_usable_size(const void *ptr); |
| 365 | ], |
| 366 | [])],[ |
| 367 | AC_MSG_RESULT([yes]) |
| 368 | ],[ |
| 369 | JEMALLOC_USABLE_SIZE_CONST= |
| 370 | AC_MSG_RESULT([no]) |
| 371 | ]) |
| 372 | ]) |
Jason Evans | 247d124 | 2012-10-09 16:20:10 -0700 | [diff] [blame] | 373 | AC_DEFINE_UNQUOTED([JEMALLOC_USABLE_SIZE_CONST], [$JEMALLOC_USABLE_SIZE_CONST]) |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 374 | AC_SUBST([abi]) |
| 375 | AC_SUBST([RPATH]) |
Antony Dovgal | 2bd3cbc | 2011-10-13 09:33:33 +0400 | [diff] [blame] | 376 | AC_SUBST([LD_PRELOAD_VAR]) |
Jason Evans | f576c63 | 2011-11-01 22:27:41 -0700 | [diff] [blame] | 377 | AC_SUBST([so]) |
Mike Hommey | fd97b1d | 2012-04-30 12:38:31 +0200 | [diff] [blame] | 378 | AC_SUBST([importlib]) |
Mike Hommey | 5bee66d | 2012-04-16 16:30:24 +0200 | [diff] [blame] | 379 | AC_SUBST([o]) |
| 380 | AC_SUBST([a]) |
| 381 | AC_SUBST([exe]) |
Mike Hommey | a19e87f | 2012-04-21 21:27:46 -0700 | [diff] [blame] | 382 | AC_SUBST([libprefix]) |
Mike Hommey | fa08da7 | 2012-04-16 16:30:25 +0200 | [diff] [blame] | 383 | AC_SUBST([DSO_LDFLAGS]) |
Mike Hommey | fd97b1d | 2012-04-30 12:38:31 +0200 | [diff] [blame] | 384 | AC_SUBST([EXTRA_LDFLAGS]) |
Mike Hommey | 85221d5 | 2012-04-18 18:29:40 +0200 | [diff] [blame] | 385 | AC_SUBST([SOREV]) |
Mike Hommey | 188da7c | 2012-04-18 18:29:41 +0200 | [diff] [blame] | 386 | AC_SUBST([PIC_CFLAGS]) |
Mike Hommey | fd97b1d | 2012-04-30 12:38:31 +0200 | [diff] [blame] | 387 | AC_SUBST([CTARGET]) |
| 388 | AC_SUBST([LDTARGET]) |
| 389 | AC_SUBST([MKLIB]) |
Jason Evans | 80ddf49 | 2013-08-20 11:48:19 +0100 | [diff] [blame] | 390 | AC_SUBST([ARFLAGS]) |
| 391 | AC_SUBST([AROUT]) |
Mike Hommey | 79c4bca | 2012-05-02 21:30:51 +0200 | [diff] [blame] | 392 | AC_SUBST([CC_MM]) |
Mike Hommey | fd97b1d | 2012-04-30 12:38:31 +0200 | [diff] [blame] | 393 | |
Jason Evans | fa5d245 | 2011-03-15 10:25:59 -0700 | [diff] [blame] | 394 | JE_COMPILABLE([__attribute__ syntax], |
| 395 | [static __attribute__((unused)) void foo(void){}], |
| 396 | [], |
Jason Evans | 6684cac | 2012-03-05 12:15:36 -0800 | [diff] [blame] | 397 | [je_cv_attribute]) |
| 398 | if test "x${je_cv_attribute}" = "xyes" ; then |
Jason Evans | fa5d245 | 2011-03-15 10:25:59 -0700 | [diff] [blame] | 399 | AC_DEFINE([JEMALLOC_HAVE_ATTR], [ ]) |
| 400 | if test "x${GCC}" = "xyes" -a "x${abi}" = "xelf"; then |
| 401 | JE_CFLAGS_APPEND([-fvisibility=hidden]) |
| 402 | fi |
| 403 | fi |
Jason Evans | 3cc1f1a | 2012-04-03 22:30:05 -0700 | [diff] [blame] | 404 | dnl Check for tls_model attribute support (clang 3.0 still lacks support). |
| 405 | SAVED_CFLAGS="${CFLAGS}" |
| 406 | JE_CFLAGS_APPEND([-Werror]) |
| 407 | JE_COMPILABLE([tls_model attribute], [], |
| 408 | [static __thread int |
| 409 | __attribute__((tls_model("initial-exec"))) foo; |
| 410 | foo = 0;], |
| 411 | [je_cv_tls_model]) |
| 412 | CFLAGS="${SAVED_CFLAGS}" |
| 413 | if test "x${je_cv_tls_model}" = "xyes" ; then |
| 414 | AC_DEFINE([JEMALLOC_TLS_MODEL], |
| 415 | [__attribute__((tls_model("initial-exec")))]) |
| 416 | else |
| 417 | AC_DEFINE([JEMALLOC_TLS_MODEL], [ ]) |
| 418 | fi |
Jason Evans | fa5d245 | 2011-03-15 10:25:59 -0700 | [diff] [blame] | 419 | |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 420 | dnl Support optional additions to rpath. |
| 421 | AC_ARG_WITH([rpath], |
Jason Evans | 90895cf | 2009-12-29 00:09:15 -0800 | [diff] [blame] | 422 | [AS_HELP_STRING([--with-rpath=<rpath>], [Colon-separated rpath (ELF systems only)])], |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 423 | if test "x$with_rpath" = "xno" ; then |
| 424 | RPATH_EXTRA= |
| 425 | else |
| 426 | RPATH_EXTRA="`echo $with_rpath | tr \":\" \" \"`" |
| 427 | fi, |
| 428 | RPATH_EXTRA= |
| 429 | ) |
| 430 | AC_SUBST([RPATH_EXTRA]) |
| 431 | |
| 432 | dnl Disable rules that do automatic regeneration of configure output by default. |
| 433 | AC_ARG_ENABLE([autogen], |
Jason Evans | 78d815c | 2010-01-17 14:06:20 -0800 | [diff] [blame] | 434 | [AS_HELP_STRING([--enable-autogen], [Automatically regenerate configure output])], |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 435 | if test "x$enable_autogen" = "xno" ; then |
| 436 | enable_autogen="0" |
| 437 | else |
| 438 | enable_autogen="1" |
| 439 | fi |
| 440 | , |
| 441 | enable_autogen="0" |
| 442 | ) |
| 443 | AC_SUBST([enable_autogen]) |
| 444 | |
| 445 | AC_PROG_INSTALL |
| 446 | AC_PROG_RANLIB |
Jason Evans | 7329a4f | 2013-01-22 10:53:29 -0800 | [diff] [blame] | 447 | AC_PATH_PROG([LD], [ld], [false], [$PATH]) |
| 448 | AC_PATH_PROG([AUTOCONF], [autoconf], [false], [$PATH]) |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 449 | |
Jason Evans | d82a5e6 | 2013-12-12 22:35:52 -0800 | [diff] [blame] | 450 | public_syms="malloc_conf malloc_message malloc calloc posix_memalign aligned_alloc realloc free mallocx rallocx xallocx sallocx dallocx nallocx mallctl mallctlnametomib mallctlbymib malloc_stats_print malloc_usable_size" |
Jason Evans | 7e77eaf | 2012-03-02 17:47:37 -0800 | [diff] [blame] | 451 | |
| 452 | dnl Check for allocator-related functions that should be wrapped. |
| 453 | AC_CHECK_FUNC([memalign], |
Jason Evans | e24c7af | 2012-03-19 10:21:17 -0700 | [diff] [blame] | 454 | [AC_DEFINE([JEMALLOC_OVERRIDE_MEMALIGN], [ ]) |
Jason Evans | 7e77eaf | 2012-03-02 17:47:37 -0800 | [diff] [blame] | 455 | public_syms="${public_syms} memalign"]) |
| 456 | AC_CHECK_FUNC([valloc], |
Jason Evans | e24c7af | 2012-03-19 10:21:17 -0700 | [diff] [blame] | 457 | [AC_DEFINE([JEMALLOC_OVERRIDE_VALLOC], [ ]) |
Jason Evans | 7e77eaf | 2012-03-02 17:47:37 -0800 | [diff] [blame] | 458 | public_syms="${public_syms} valloc"]) |
| 459 | |
Jason Evans | 748dfac | 2013-12-06 18:27:33 -0800 | [diff] [blame] | 460 | dnl Do not compute test code coverage by default. |
| 461 | GCOV_FLAGS= |
| 462 | AC_ARG_ENABLE([code-coverage], |
| 463 | [AS_HELP_STRING([--enable-code-coverage], |
| 464 | [Enable code coverage])], |
| 465 | [if test "x$enable_code_coverage" = "xno" ; then |
| 466 | enable_code_coverage="0" |
| 467 | else |
| 468 | enable_code_coverage="1" |
| 469 | fi |
| 470 | ], |
| 471 | [enable_code_coverage="0"] |
| 472 | ) |
| 473 | if test "x$enable_code_coverage" = "x1" ; then |
| 474 | deoptimize="no" |
| 475 | echo "$CFLAGS $EXTRA_CFLAGS" | grep '\-O' >/dev/null || deoptimize="yes" |
| 476 | if test "x${deoptimize}" = "xyes" ; then |
| 477 | JE_CFLAGS_APPEND([-O0]) |
| 478 | fi |
| 479 | JE_CFLAGS_APPEND([-fprofile-arcs -ftest-coverage]) |
| 480 | EXTRA_LDFLAGS="$EXTRA_LDFLAGS -fprofile-arcs -ftest-coverage" |
| 481 | AC_DEFINE([JEMALLOC_CODE_COVERAGE], [ ]) |
| 482 | fi |
| 483 | AC_SUBST([enable_code_coverage]) |
| 484 | |
Jason Evans | 0a5489e | 2012-03-01 17:19:20 -0800 | [diff] [blame] | 485 | dnl Perform no name mangling by default. |
| 486 | AC_ARG_WITH([mangling], |
| 487 | [AS_HELP_STRING([--with-mangling=<map>], [Mangle symbols in <map>])], |
| 488 | [mangling_map="$with_mangling"], [mangling_map=""]) |
Jason Evans | 0a5489e | 2012-03-01 17:19:20 -0800 | [diff] [blame] | 489 | |
Jason Evans | 90895cf | 2009-12-29 00:09:15 -0800 | [diff] [blame] | 490 | dnl Do not prefix public APIs by default. |
| 491 | AC_ARG_WITH([jemalloc_prefix], |
| 492 | [AS_HELP_STRING([--with-jemalloc-prefix=<prefix>], [Prefix to prepend to all public APIs])], |
Jason Evans | b0fd501 | 2010-01-17 01:49:20 -0800 | [diff] [blame] | 493 | [JEMALLOC_PREFIX="$with_jemalloc_prefix"], |
Mike Hommey | 7cdea39 | 2012-04-30 12:38:27 +0200 | [diff] [blame] | 494 | [if test "x$abi" != "xmacho" -a "x$abi" != "xpecoff"; then |
Jason Evans | 2dbecf1 | 2010-09-05 10:35:13 -0700 | [diff] [blame] | 495 | JEMALLOC_PREFIX="" |
| 496 | else |
| 497 | JEMALLOC_PREFIX="je_" |
| 498 | fi] |
Jason Evans | 90895cf | 2009-12-29 00:09:15 -0800 | [diff] [blame] | 499 | ) |
| 500 | if test "x$JEMALLOC_PREFIX" != "x" ; then |
Jason Evans | e733970 | 2010-10-23 18:37:06 -0700 | [diff] [blame] | 501 | JEMALLOC_CPREFIX=`echo ${JEMALLOC_PREFIX} | tr "a-z" "A-Z"` |
| 502 | AC_DEFINE_UNQUOTED([JEMALLOC_PREFIX], ["$JEMALLOC_PREFIX"]) |
| 503 | AC_DEFINE_UNQUOTED([JEMALLOC_CPREFIX], ["$JEMALLOC_CPREFIX"]) |
Jason Evans | 90895cf | 2009-12-29 00:09:15 -0800 | [diff] [blame] | 504 | fi |
| 505 | |
Mike Hommey | 9906660 | 2012-11-19 10:55:26 +0100 | [diff] [blame] | 506 | AC_ARG_WITH([export], |
| 507 | [AS_HELP_STRING([--without-export], [disable exporting jemalloc public APIs])], |
| 508 | [if test "x$with_export" = "xno"; then |
Jason Evans | 2625c89 | 2013-01-22 16:46:27 -0800 | [diff] [blame] | 509 | AC_DEFINE([JEMALLOC_EXPORT],[]) |
Mike Hommey | 9906660 | 2012-11-19 10:55:26 +0100 | [diff] [blame] | 510 | fi] |
| 511 | ) |
| 512 | |
Jason Evans | 86abd0d | 2013-11-30 15:25:42 -0800 | [diff] [blame] | 513 | dnl Mangle library-private APIs. |
Jason Evans | 746e77a | 2011-07-30 16:40:52 -0700 | [diff] [blame] | 514 | AC_ARG_WITH([private_namespace], |
| 515 | [AS_HELP_STRING([--with-private-namespace=<prefix>], [Prefix to prepend to all library-private APIs])], |
Jason Evans | 86abd0d | 2013-11-30 15:25:42 -0800 | [diff] [blame] | 516 | [JEMALLOC_PRIVATE_NAMESPACE="${with_private_namespace}je_"], |
| 517 | [JEMALLOC_PRIVATE_NAMESPACE="je_"] |
Jason Evans | 746e77a | 2011-07-30 16:40:52 -0700 | [diff] [blame] | 518 | ) |
Jason Evans | 86abd0d | 2013-11-30 15:25:42 -0800 | [diff] [blame] | 519 | AC_DEFINE_UNQUOTED([JEMALLOC_PRIVATE_NAMESPACE], [$JEMALLOC_PRIVATE_NAMESPACE]) |
| 520 | private_namespace="$JEMALLOC_PRIVATE_NAMESPACE" |
| 521 | AC_SUBST([private_namespace]) |
Jason Evans | 746e77a | 2011-07-30 16:40:52 -0700 | [diff] [blame] | 522 | |
Jason Evans | b0fd501 | 2010-01-17 01:49:20 -0800 | [diff] [blame] | 523 | dnl Do not add suffix to installed files by default. |
| 524 | AC_ARG_WITH([install_suffix], |
| 525 | [AS_HELP_STRING([--with-install-suffix=<suffix>], [Suffix to append to all installed files])], |
| 526 | [INSTALL_SUFFIX="$with_install_suffix"], |
| 527 | [INSTALL_SUFFIX=] |
| 528 | ) |
| 529 | install_suffix="$INSTALL_SUFFIX" |
| 530 | AC_SUBST([install_suffix]) |
| 531 | |
Jason Evans | 86abd0d | 2013-11-30 15:25:42 -0800 | [diff] [blame] | 532 | dnl Substitute @je_@ in jemalloc_protos.h.in, primarily to make generation of |
| 533 | dnl jemalloc_protos_jet.h easy. |
| 534 | je_="je_" |
| 535 | AC_SUBST([je_]) |
| 536 | |
Jason Evans | aee7fd2 | 2010-11-24 22:00:02 -0800 | [diff] [blame] | 537 | cfgoutputs_in="${srcroot}Makefile.in" |
| 538 | cfgoutputs_in="${cfgoutputs_in} ${srcroot}doc/html.xsl.in" |
| 539 | cfgoutputs_in="${cfgoutputs_in} ${srcroot}doc/manpages.xsl.in" |
| 540 | cfgoutputs_in="${cfgoutputs_in} ${srcroot}doc/jemalloc.xml.in" |
Jason Evans | 86abd0d | 2013-11-30 15:25:42 -0800 | [diff] [blame] | 541 | cfgoutputs_in="${cfgoutputs_in} ${srcroot}include/jemalloc/jemalloc_macros.h.in" |
| 542 | cfgoutputs_in="${cfgoutputs_in} ${srcroot}include/jemalloc/jemalloc_protos.h.in" |
Jason Evans | 0656ec0 | 2010-04-07 23:37:35 -0700 | [diff] [blame] | 543 | cfgoutputs_in="${cfgoutputs_in} ${srcroot}include/jemalloc/internal/jemalloc_internal.h.in" |
Jason Evans | 86abd0d | 2013-11-30 15:25:42 -0800 | [diff] [blame] | 544 | cfgoutputs_in="${cfgoutputs_in} ${srcroot}test/test.sh.in" |
| 545 | cfgoutputs_in="${cfgoutputs_in} ${srcroot}test/include/test/jemalloc_test.h.in" |
Jason Evans | b0fd501 | 2010-01-17 01:49:20 -0800 | [diff] [blame] | 546 | |
Jason Evans | aee7fd2 | 2010-11-24 22:00:02 -0800 | [diff] [blame] | 547 | cfgoutputs_out="Makefile" |
| 548 | cfgoutputs_out="${cfgoutputs_out} doc/html.xsl" |
| 549 | cfgoutputs_out="${cfgoutputs_out} doc/manpages.xsl" |
Jason Evans | 86abd0d | 2013-11-30 15:25:42 -0800 | [diff] [blame] | 550 | cfgoutputs_out="${cfgoutputs_out} doc/jemalloc.xml" |
| 551 | cfgoutputs_out="${cfgoutputs_out} include/jemalloc/jemalloc_macros.h" |
| 552 | cfgoutputs_out="${cfgoutputs_out} include/jemalloc/jemalloc_protos.h" |
Jason Evans | 376b152 | 2010-02-11 14:45:59 -0800 | [diff] [blame] | 553 | cfgoutputs_out="${cfgoutputs_out} include/jemalloc/internal/jemalloc_internal.h" |
Jason Evans | 86abd0d | 2013-11-30 15:25:42 -0800 | [diff] [blame] | 554 | cfgoutputs_out="${cfgoutputs_out} test/test.sh" |
| 555 | cfgoutputs_out="${cfgoutputs_out} test/include/test/jemalloc_test.h" |
Jason Evans | b0fd501 | 2010-01-17 01:49:20 -0800 | [diff] [blame] | 556 | |
Jason Evans | aee7fd2 | 2010-11-24 22:00:02 -0800 | [diff] [blame] | 557 | cfgoutputs_tup="Makefile" |
| 558 | cfgoutputs_tup="${cfgoutputs_tup} doc/html.xsl:doc/html.xsl.in" |
| 559 | cfgoutputs_tup="${cfgoutputs_tup} doc/manpages.xsl:doc/manpages.xsl.in" |
Jason Evans | 86abd0d | 2013-11-30 15:25:42 -0800 | [diff] [blame] | 560 | cfgoutputs_tup="${cfgoutputs_tup} doc/jemalloc.xml:doc/jemalloc.xml.in" |
| 561 | cfgoutputs_tup="${cfgoutputs_tup} include/jemalloc/jemalloc_macros.h:include/jemalloc/jemalloc_macros.h.in" |
| 562 | cfgoutputs_tup="${cfgoutputs_tup} include/jemalloc/jemalloc_protos.h:include/jemalloc/jemalloc_protos.h.in" |
Jason Evans | 376b152 | 2010-02-11 14:45:59 -0800 | [diff] [blame] | 563 | cfgoutputs_tup="${cfgoutputs_tup} include/jemalloc/internal/jemalloc_internal.h" |
Jason Evans | 86abd0d | 2013-11-30 15:25:42 -0800 | [diff] [blame] | 564 | cfgoutputs_tup="${cfgoutputs_tup} test/test.sh:test/test.sh.in" |
| 565 | cfgoutputs_tup="${cfgoutputs_tup} test/include/test/jemalloc_test.h:test/include/test/jemalloc_test.h.in" |
Jason Evans | b0fd501 | 2010-01-17 01:49:20 -0800 | [diff] [blame] | 566 | |
Jason Evans | 0656ec0 | 2010-04-07 23:37:35 -0700 | [diff] [blame] | 567 | cfghdrs_in="${srcroot}include/jemalloc/jemalloc_defs.h.in" |
Jason Evans | 86abd0d | 2013-11-30 15:25:42 -0800 | [diff] [blame] | 568 | cfghdrs_in="${cfghdrs_in} ${srcroot}include/jemalloc/internal/jemalloc_internal_defs.h.in" |
| 569 | cfghdrs_in="${cfghdrs_in} ${srcroot}include/jemalloc/internal/private_namespace.sh" |
| 570 | cfghdrs_in="${cfghdrs_in} ${srcroot}include/jemalloc/internal/private_unnamespace.sh" |
Jason Evans | f234dc5 | 2014-01-16 17:38:01 -0800 | [diff] [blame] | 571 | cfghdrs_in="${cfghdrs_in} ${srcroot}include/jemalloc/internal/private_symbols.txt" |
Jason Evans | 86abd0d | 2013-11-30 15:25:42 -0800 | [diff] [blame] | 572 | cfghdrs_in="${cfghdrs_in} ${srcroot}include/jemalloc/internal/public_namespace.sh" |
| 573 | cfghdrs_in="${cfghdrs_in} ${srcroot}include/jemalloc/internal/public_unnamespace.sh" |
Jason Evans | b172610 | 2012-02-28 16:50:47 -0800 | [diff] [blame] | 574 | cfghdrs_in="${cfghdrs_in} ${srcroot}include/jemalloc/internal/size_classes.sh" |
Jason Evans | f234dc5 | 2014-01-16 17:38:01 -0800 | [diff] [blame] | 575 | cfghdrs_in="${cfghdrs_in} ${srcroot}include/jemalloc/jemalloc_rename.sh" |
| 576 | cfghdrs_in="${cfghdrs_in} ${srcroot}include/jemalloc/jemalloc_mangle.sh" |
Jason Evans | dc1bed6 | 2013-12-05 21:43:46 -0800 | [diff] [blame] | 577 | cfghdrs_in="${cfghdrs_in} ${srcroot}include/jemalloc/jemalloc.sh" |
Jason Evans | 80061b6 | 2013-12-09 13:21:08 -0800 | [diff] [blame] | 578 | cfghdrs_in="${cfghdrs_in} ${srcroot}test/include/test/jemalloc_test_defs.h.in" |
Jason Evans | b0fd501 | 2010-01-17 01:49:20 -0800 | [diff] [blame] | 579 | |
Jason Evans | 86abd0d | 2013-11-30 15:25:42 -0800 | [diff] [blame] | 580 | cfghdrs_out="include/jemalloc/jemalloc_defs.h" |
| 581 | cfghdrs_out="${cfghdrs_out} include/jemalloc/jemalloc${install_suffix}.h" |
Jason Evans | 86abd0d | 2013-11-30 15:25:42 -0800 | [diff] [blame] | 582 | cfghdrs_out="${cfghdrs_out} include/jemalloc/internal/private_namespace.h" |
| 583 | cfghdrs_out="${cfghdrs_out} include/jemalloc/internal/private_unnamespace.h" |
Jason Evans | f234dc5 | 2014-01-16 17:38:01 -0800 | [diff] [blame] | 584 | cfghdrs_out="${cfghdrs_out} include/jemalloc/internal/public_symbols.txt" |
Jason Evans | 86abd0d | 2013-11-30 15:25:42 -0800 | [diff] [blame] | 585 | cfghdrs_out="${cfghdrs_out} include/jemalloc/internal/public_namespace.h" |
| 586 | cfghdrs_out="${cfghdrs_out} include/jemalloc/internal/public_unnamespace.h" |
Jason Evans | b172610 | 2012-02-28 16:50:47 -0800 | [diff] [blame] | 587 | cfghdrs_out="${cfghdrs_out} include/jemalloc/internal/size_classes.h" |
Jason Evans | f234dc5 | 2014-01-16 17:38:01 -0800 | [diff] [blame] | 588 | cfghdrs_out="${cfghdrs_out} include/jemalloc/jemalloc_protos_jet.h" |
| 589 | cfghdrs_out="${cfghdrs_out} include/jemalloc/jemalloc_rename.h" |
| 590 | cfghdrs_out="${cfghdrs_out} include/jemalloc/jemalloc_mangle.h" |
| 591 | cfghdrs_out="${cfghdrs_out} include/jemalloc/jemalloc_mangle_jet.h" |
| 592 | cfghdrs_out="${cfghdrs_out} include/jemalloc/internal/jemalloc_internal_defs.h" |
Jason Evans | 80061b6 | 2013-12-09 13:21:08 -0800 | [diff] [blame] | 593 | cfghdrs_out="${cfghdrs_out} test/include/test/jemalloc_test_defs.h" |
Jason Evans | b0fd501 | 2010-01-17 01:49:20 -0800 | [diff] [blame] | 594 | |
Jason Evans | 86abd0d | 2013-11-30 15:25:42 -0800 | [diff] [blame] | 595 | cfghdrs_tup="include/jemalloc/jemalloc_defs.h:include/jemalloc/jemalloc_defs.h.in" |
| 596 | cfghdrs_tup="${cfghdrs_tup} include/jemalloc/internal/jemalloc_internal_defs.h:${srcroot}include/jemalloc/internal/jemalloc_internal_defs.h.in" |
Jason Evans | 80061b6 | 2013-12-09 13:21:08 -0800 | [diff] [blame] | 597 | cfghdrs_tup="${cfghdrs_tup} test/include/test/jemalloc_test_defs.h:${srcroot}test/include/test/jemalloc_test_defs.h.in" |
Jason Evans | b0fd501 | 2010-01-17 01:49:20 -0800 | [diff] [blame] | 598 | |
Jason Evans | 644d414 | 2014-04-14 22:49:23 -0700 | [diff] [blame] | 599 | dnl Silence irrelevant compiler warnings by default. |
Jason Evans | 355b438 | 2010-09-20 19:20:48 -0700 | [diff] [blame] | 600 | AC_ARG_ENABLE([cc-silence], |
Jason Evans | 644d414 | 2014-04-14 22:49:23 -0700 | [diff] [blame] | 601 | [AS_HELP_STRING([--disable-cc-silence], |
| 602 | [Do not silence irrelevant compiler warnings])], |
Jason Evans | 355b438 | 2010-09-20 19:20:48 -0700 | [diff] [blame] | 603 | [if test "x$enable_cc_silence" = "xno" ; then |
| 604 | enable_cc_silence="0" |
| 605 | else |
| 606 | enable_cc_silence="1" |
| 607 | fi |
| 608 | ], |
Jason Evans | 644d414 | 2014-04-14 22:49:23 -0700 | [diff] [blame] | 609 | [enable_cc_silence="1"] |
Jason Evans | 355b438 | 2010-09-20 19:20:48 -0700 | [diff] [blame] | 610 | ) |
| 611 | if test "x$enable_cc_silence" = "x1" ; then |
Jason Evans | e24c7af | 2012-03-19 10:21:17 -0700 | [diff] [blame] | 612 | AC_DEFINE([JEMALLOC_CC_SILENCE], [ ]) |
Jason Evans | 355b438 | 2010-09-20 19:20:48 -0700 | [diff] [blame] | 613 | fi |
| 614 | |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 615 | dnl Do not compile with debugging by default. |
| 616 | AC_ARG_ENABLE([debug], |
Mike Hommey | 5135e34 | 2012-12-06 22:16:26 +0100 | [diff] [blame] | 617 | [AS_HELP_STRING([--enable-debug], [Build debugging code (implies --enable-ivsalloc)])], |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 618 | [if test "x$enable_debug" = "xno" ; then |
| 619 | enable_debug="0" |
| 620 | else |
| 621 | enable_debug="1" |
| 622 | fi |
| 623 | ], |
| 624 | [enable_debug="0"] |
| 625 | ) |
| 626 | if test "x$enable_debug" = "x1" ; then |
| 627 | AC_DEFINE([JEMALLOC_DEBUG], [ ]) |
Mike Hommey | 5135e34 | 2012-12-06 22:16:26 +0100 | [diff] [blame] | 628 | enable_ivsalloc="1" |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 629 | fi |
| 630 | AC_SUBST([enable_debug]) |
| 631 | |
Mike Hommey | 5135e34 | 2012-12-06 22:16:26 +0100 | [diff] [blame] | 632 | dnl Do not validate pointers by default. |
| 633 | AC_ARG_ENABLE([ivsalloc], |
| 634 | [AS_HELP_STRING([--enable-ivsalloc], [Validate pointers passed through the public API])], |
| 635 | [if test "x$enable_ivsalloc" = "xno" ; then |
| 636 | enable_ivsalloc="0" |
| 637 | else |
| 638 | enable_ivsalloc="1" |
| 639 | fi |
| 640 | ], |
| 641 | [enable_ivsalloc="0"] |
| 642 | ) |
| 643 | if test "x$enable_ivsalloc" = "x1" ; then |
| 644 | AC_DEFINE([JEMALLOC_IVSALLOC], [ ]) |
| 645 | fi |
| 646 | |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 647 | dnl Only optimize if not debugging. |
| 648 | if test "x$enable_debug" = "x0" -a "x$no_CFLAGS" = "xyes" ; then |
| 649 | dnl Make sure that an optimization flag was not specified in EXTRA_CFLAGS. |
Jason Evans | f3340ca | 2009-06-30 16:17:05 -0700 | [diff] [blame] | 650 | optimize="no" |
Jason Evans | 748dfac | 2013-12-06 18:27:33 -0800 | [diff] [blame] | 651 | echo "$CFLAGS $EXTRA_CFLAGS" | grep '\-O' >/dev/null || optimize="yes" |
Jason Evans | f3340ca | 2009-06-30 16:17:05 -0700 | [diff] [blame] | 652 | if test "x${optimize}" = "xyes" ; then |
| 653 | if test "x$GCC" = "xyes" ; then |
| 654 | JE_CFLAGS_APPEND([-O3]) |
| 655 | JE_CFLAGS_APPEND([-funroll-loops]) |
Mike Hommey | fd97b1d | 2012-04-30 12:38:31 +0200 | [diff] [blame] | 656 | elif test "x$je_cv_msvc" = "xyes" ; then |
| 657 | JE_CFLAGS_APPEND([-O2]) |
Jason Evans | f3340ca | 2009-06-30 16:17:05 -0700 | [diff] [blame] | 658 | else |
| 659 | JE_CFLAGS_APPEND([-O]) |
| 660 | fi |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 661 | fi |
| 662 | fi |
| 663 | |
Jason Evans | d073a32 | 2012-02-28 20:41:16 -0800 | [diff] [blame] | 664 | dnl Enable statistics calculation by default. |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 665 | AC_ARG_ENABLE([stats], |
Jason Evans | 777c191 | 2012-02-28 20:49:22 -0800 | [diff] [blame] | 666 | [AS_HELP_STRING([--disable-stats], |
| 667 | [Disable statistics calculation/reporting])], |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 668 | [if test "x$enable_stats" = "xno" ; then |
| 669 | enable_stats="0" |
| 670 | else |
| 671 | enable_stats="1" |
| 672 | fi |
| 673 | ], |
Jason Evans | d073a32 | 2012-02-28 20:41:16 -0800 | [diff] [blame] | 674 | [enable_stats="1"] |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 675 | ) |
| 676 | if test "x$enable_stats" = "x1" ; then |
| 677 | AC_DEFINE([JEMALLOC_STATS], [ ]) |
| 678 | fi |
| 679 | AC_SUBST([enable_stats]) |
| 680 | |
Jason Evans | 6109fe0 | 2010-02-10 10:37:56 -0800 | [diff] [blame] | 681 | dnl Do not enable profiling by default. |
| 682 | AC_ARG_ENABLE([prof], |
| 683 | [AS_HELP_STRING([--enable-prof], [Enable allocation profiling])], |
| 684 | [if test "x$enable_prof" = "xno" ; then |
| 685 | enable_prof="0" |
| 686 | else |
| 687 | enable_prof="1" |
| 688 | fi |
| 689 | ], |
| 690 | [enable_prof="0"] |
| 691 | ) |
Jason Evans | 77f350b | 2011-03-15 22:23:12 -0700 | [diff] [blame] | 692 | if test "x$enable_prof" = "x1" ; then |
| 693 | backtrace_method="" |
Jason Evans | b27805b | 2010-02-10 18:15:53 -0800 | [diff] [blame] | 694 | else |
Jason Evans | 77f350b | 2011-03-15 22:23:12 -0700 | [diff] [blame] | 695 | backtrace_method="N/A" |
Jason Evans | b27805b | 2010-02-10 18:15:53 -0800 | [diff] [blame] | 696 | fi |
Jason Evans | 77f350b | 2011-03-15 22:23:12 -0700 | [diff] [blame] | 697 | |
Jason Evans | 6109fe0 | 2010-02-10 10:37:56 -0800 | [diff] [blame] | 698 | AC_ARG_ENABLE([prof-libunwind], |
| 699 | [AS_HELP_STRING([--enable-prof-libunwind], [Use libunwind for backtracing])], |
| 700 | [if test "x$enable_prof_libunwind" = "xno" ; then |
| 701 | enable_prof_libunwind="0" |
| 702 | else |
| 703 | enable_prof_libunwind="1" |
| 704 | fi |
| 705 | ], |
| 706 | [enable_prof_libunwind="0"] |
| 707 | ) |
Jason Evans | ca6bd4f | 2010-03-02 14:12:58 -0800 | [diff] [blame] | 708 | AC_ARG_WITH([static_libunwind], |
| 709 | [AS_HELP_STRING([--with-static-libunwind=<libunwind.a>], |
| 710 | [Path to static libunwind library; use rather than dynamically linking])], |
| 711 | if test "x$with_static_libunwind" = "xno" ; then |
| 712 | LUNWIND="-lunwind" |
| 713 | else |
| 714 | if test ! -f "$with_static_libunwind" ; then |
| 715 | AC_MSG_ERROR([Static libunwind not found: $with_static_libunwind]) |
| 716 | fi |
| 717 | LUNWIND="$with_static_libunwind" |
| 718 | fi, |
| 719 | LUNWIND="-lunwind" |
| 720 | ) |
Jason Evans | 77f350b | 2011-03-15 22:23:12 -0700 | [diff] [blame] | 721 | if test "x$backtrace_method" = "x" -a "x$enable_prof_libunwind" = "x1" ; then |
| 722 | AC_CHECK_HEADERS([libunwind.h], , [enable_prof_libunwind="0"]) |
| 723 | if test "x$LUNWIND" = "x-lunwind" ; then |
Jason Evans | 05125b8 | 2014-04-22 20:48:07 -0700 | [diff] [blame] | 724 | AC_CHECK_LIB([unwind], [unw_backtrace], [LIBS="$LIBS $LUNWIND"], |
Jason Evans | 77f350b | 2011-03-15 22:23:12 -0700 | [diff] [blame] | 725 | [enable_prof_libunwind="0"]) |
| 726 | else |
| 727 | LIBS="$LIBS $LUNWIND" |
| 728 | fi |
| 729 | if test "x${enable_prof_libunwind}" = "x1" ; then |
| 730 | backtrace_method="libunwind" |
| 731 | AC_DEFINE([JEMALLOC_PROF_LIBUNWIND], [ ]) |
| 732 | fi |
| 733 | fi |
| 734 | |
| 735 | AC_ARG_ENABLE([prof-libgcc], |
| 736 | [AS_HELP_STRING([--disable-prof-libgcc], |
| 737 | [Do not use libgcc for backtracing])], |
| 738 | [if test "x$enable_prof_libgcc" = "xno" ; then |
| 739 | enable_prof_libgcc="0" |
| 740 | else |
| 741 | enable_prof_libgcc="1" |
| 742 | fi |
| 743 | ], |
| 744 | [enable_prof_libgcc="1"] |
| 745 | ) |
| 746 | if test "x$backtrace_method" = "x" -a "x$enable_prof_libgcc" = "x1" \ |
| 747 | -a "x$GCC" = "xyes" ; then |
| 748 | AC_CHECK_HEADERS([unwind.h], , [enable_prof_libgcc="0"]) |
| 749 | AC_CHECK_LIB([gcc], [_Unwind_Backtrace], [LIBS="$LIBS -lgcc"], [enable_prof_libgcc="0"]) |
Jason Evans | 77f350b | 2011-03-15 22:23:12 -0700 | [diff] [blame] | 750 | if test "x${enable_prof_libgcc}" = "x1" ; then |
| 751 | backtrace_method="libgcc" |
| 752 | AC_DEFINE([JEMALLOC_PROF_LIBGCC], [ ]) |
| 753 | fi |
| 754 | else |
| 755 | enable_prof_libgcc="0" |
| 756 | fi |
| 757 | |
| 758 | AC_ARG_ENABLE([prof-gcc], |
| 759 | [AS_HELP_STRING([--disable-prof-gcc], |
| 760 | [Do not use gcc intrinsics for backtracing])], |
| 761 | [if test "x$enable_prof_gcc" = "xno" ; then |
| 762 | enable_prof_gcc="0" |
| 763 | else |
| 764 | enable_prof_gcc="1" |
| 765 | fi |
| 766 | ], |
| 767 | [enable_prof_gcc="1"] |
| 768 | ) |
| 769 | if test "x$backtrace_method" = "x" -a "x$enable_prof_gcc" = "x1" \ |
| 770 | -a "x$GCC" = "xyes" ; then |
Jason Evans | e181f5a | 2014-03-30 18:58:32 -0700 | [diff] [blame] | 771 | JE_CFLAGS_APPEND([-fno-omit-frame-pointer]) |
Jason Evans | 77f350b | 2011-03-15 22:23:12 -0700 | [diff] [blame] | 772 | backtrace_method="gcc intrinsics" |
| 773 | AC_DEFINE([JEMALLOC_PROF_GCC], [ ]) |
| 774 | else |
| 775 | enable_prof_gcc="0" |
| 776 | fi |
| 777 | |
| 778 | if test "x$backtrace_method" = "x" ; then |
| 779 | backtrace_method="none (disabling profiling)" |
| 780 | enable_prof="0" |
| 781 | fi |
| 782 | AC_MSG_CHECKING([configured backtracing method]) |
| 783 | AC_MSG_RESULT([$backtrace_method]) |
Jason Evans | 2dbecf1 | 2010-09-05 10:35:13 -0700 | [diff] [blame] | 784 | if test "x$enable_prof" = "x1" ; then |
Jason Evans | 6716aa8 | 2012-04-23 13:04:55 -0700 | [diff] [blame] | 785 | if test "x${force_tls}" = "x0" ; then |
| 786 | AC_MSG_ERROR([Heap profiling requires TLS]); |
| 787 | fi |
| 788 | force_tls="1" |
Jason Evans | d37d5ad | 2013-12-05 23:01:50 -0800 | [diff] [blame] | 789 | |
| 790 | if test "x$abi" != "xpecoff"; then |
| 791 | dnl Heap profiling uses the log(3) function. |
| 792 | LIBS="$LIBS -lm" |
| 793 | fi |
| 794 | |
Jason Evans | 2dbecf1 | 2010-09-05 10:35:13 -0700 | [diff] [blame] | 795 | AC_DEFINE([JEMALLOC_PROF], [ ]) |
Jason Evans | 2dbecf1 | 2010-09-05 10:35:13 -0700 | [diff] [blame] | 796 | fi |
| 797 | AC_SUBST([enable_prof]) |
Jason Evans | 2dbecf1 | 2010-09-05 10:35:13 -0700 | [diff] [blame] | 798 | |
Jason Evans | 84cbbcb | 2009-12-29 00:09:15 -0800 | [diff] [blame] | 799 | dnl Enable thread-specific caching by default. |
| 800 | AC_ARG_ENABLE([tcache], |
| 801 | [AS_HELP_STRING([--disable-tcache], [Disable per thread caches])], |
| 802 | [if test "x$enable_tcache" = "xno" ; then |
| 803 | enable_tcache="0" |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 804 | else |
Jason Evans | 84cbbcb | 2009-12-29 00:09:15 -0800 | [diff] [blame] | 805 | enable_tcache="1" |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 806 | fi |
| 807 | ], |
Jason Evans | 84cbbcb | 2009-12-29 00:09:15 -0800 | [diff] [blame] | 808 | [enable_tcache="1"] |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 809 | ) |
Jason Evans | 2dbecf1 | 2010-09-05 10:35:13 -0700 | [diff] [blame] | 810 | if test "x$enable_tcache" = "x1" ; then |
| 811 | AC_DEFINE([JEMALLOC_TCACHE], [ ]) |
| 812 | fi |
| 813 | AC_SUBST([enable_tcache]) |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 814 | |
Jason Evans | 59ae276 | 2012-04-16 17:52:27 -0700 | [diff] [blame] | 815 | dnl Enable VM deallocation via munmap() by default. |
| 816 | AC_ARG_ENABLE([munmap], |
| 817 | [AS_HELP_STRING([--disable-munmap], [Disable VM deallocation via munmap(2)])], |
| 818 | [if test "x$enable_munmap" = "xno" ; then |
| 819 | enable_munmap="0" |
| 820 | else |
| 821 | enable_munmap="1" |
| 822 | fi |
| 823 | ], |
| 824 | [enable_munmap="${default_munmap}"] |
| 825 | ) |
| 826 | if test "x$enable_munmap" = "x1" ; then |
| 827 | AC_DEFINE([JEMALLOC_MUNMAP], [ ]) |
| 828 | fi |
| 829 | AC_SUBST([enable_munmap]) |
| 830 | |
Jason Evans | 4d434ad | 2014-04-15 12:09:48 -0700 | [diff] [blame] | 831 | dnl Enable allocation from DSS if supported by the OS. |
| 832 | have_dss="1" |
Mike Hommey | 83c324a | 2012-04-12 10:13:03 +0200 | [diff] [blame] | 833 | dnl Check whether the BSD/SUSv1 sbrk() exists. If not, disable DSS support. |
| 834 | AC_CHECK_FUNC([sbrk], [have_sbrk="1"], [have_sbrk="0"]) |
| 835 | if test "x$have_sbrk" = "x1" ; then |
Jason Evans | 6668853 | 2013-12-03 21:49:36 -0800 | [diff] [blame] | 836 | if test "x$sbrk_deprecated" == "x1" ; then |
| 837 | AC_MSG_RESULT([Disabling dss allocation because sbrk is deprecated]) |
Jason Evans | 4d434ad | 2014-04-15 12:09:48 -0700 | [diff] [blame] | 838 | have_dss="0" |
Jason Evans | 6668853 | 2013-12-03 21:49:36 -0800 | [diff] [blame] | 839 | fi |
Mike Hommey | 83c324a | 2012-04-12 10:13:03 +0200 | [diff] [blame] | 840 | else |
Jason Evans | 4d434ad | 2014-04-15 12:09:48 -0700 | [diff] [blame] | 841 | have_dss="0" |
Mike Hommey | 83c324a | 2012-04-12 10:13:03 +0200 | [diff] [blame] | 842 | fi |
| 843 | |
Jason Evans | 4d434ad | 2014-04-15 12:09:48 -0700 | [diff] [blame] | 844 | if test "x$have_dss" = "x1" ; then |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 845 | AC_DEFINE([JEMALLOC_DSS], [ ]) |
| 846 | fi |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 847 | |
Jason Evans | 777c191 | 2012-02-28 20:49:22 -0800 | [diff] [blame] | 848 | dnl Support the junk/zero filling option by default. |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 849 | AC_ARG_ENABLE([fill], |
Jason Evans | 122449b | 2012-04-06 00:35:09 -0700 | [diff] [blame] | 850 | [AS_HELP_STRING([--disable-fill], |
| 851 | [Disable support for junk/zero filling, quarantine, and redzones])], |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 852 | [if test "x$enable_fill" = "xno" ; then |
| 853 | enable_fill="0" |
| 854 | else |
| 855 | enable_fill="1" |
| 856 | fi |
| 857 | ], |
Jason Evans | 777c191 | 2012-02-28 20:49:22 -0800 | [diff] [blame] | 858 | [enable_fill="1"] |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 859 | ) |
| 860 | if test "x$enable_fill" = "x1" ; then |
| 861 | AC_DEFINE([JEMALLOC_FILL], [ ]) |
| 862 | fi |
| 863 | AC_SUBST([enable_fill]) |
| 864 | |
Jason Evans | b147611 | 2012-04-05 13:36:17 -0700 | [diff] [blame] | 865 | dnl Disable utrace(2)-based tracing by default. |
| 866 | AC_ARG_ENABLE([utrace], |
| 867 | [AS_HELP_STRING([--enable-utrace], [Enable utrace(2)-based tracing])], |
| 868 | [if test "x$enable_utrace" = "xno" ; then |
| 869 | enable_utrace="0" |
| 870 | else |
| 871 | enable_utrace="1" |
| 872 | fi |
| 873 | ], |
| 874 | [enable_utrace="0"] |
| 875 | ) |
| 876 | JE_COMPILABLE([utrace(2)], [ |
| 877 | #include <sys/types.h> |
| 878 | #include <sys/param.h> |
| 879 | #include <sys/time.h> |
| 880 | #include <sys/uio.h> |
| 881 | #include <sys/ktrace.h> |
| 882 | ], [ |
| 883 | utrace((void *)0, 0); |
| 884 | ], [je_cv_utrace]) |
| 885 | if test "x${je_cv_utrace}" = "xno" ; then |
| 886 | enable_utrace="0" |
| 887 | fi |
| 888 | if test "x$enable_utrace" = "x1" ; then |
| 889 | AC_DEFINE([JEMALLOC_UTRACE], [ ]) |
| 890 | fi |
| 891 | AC_SUBST([enable_utrace]) |
| 892 | |
Jason Evans | 122449b | 2012-04-06 00:35:09 -0700 | [diff] [blame] | 893 | dnl Support Valgrind by default. |
| 894 | AC_ARG_ENABLE([valgrind], |
| 895 | [AS_HELP_STRING([--disable-valgrind], [Disable support for Valgrind])], |
| 896 | [if test "x$enable_valgrind" = "xno" ; then |
| 897 | enable_valgrind="0" |
| 898 | else |
| 899 | enable_valgrind="1" |
| 900 | fi |
| 901 | ], |
| 902 | [enable_valgrind="1"] |
| 903 | ) |
| 904 | if test "x$enable_valgrind" = "x1" ; then |
| 905 | JE_COMPILABLE([valgrind], [ |
| 906 | #include <valgrind/valgrind.h> |
| 907 | #include <valgrind/memcheck.h> |
| 908 | |
Mike Hommey | 7bfecf4 | 2012-04-30 15:15:15 +0200 | [diff] [blame] | 909 | #if !defined(VALGRIND_RESIZEINPLACE_BLOCK) |
Jason Evans | 122449b | 2012-04-06 00:35:09 -0700 | [diff] [blame] | 910 | # error "Incompatible Valgrind version" |
| 911 | #endif |
| 912 | ], [], [je_cv_valgrind]) |
| 913 | if test "x${je_cv_valgrind}" = "xno" ; then |
| 914 | enable_valgrind="0" |
| 915 | fi |
| 916 | if test "x$enable_valgrind" = "x1" ; then |
| 917 | AC_DEFINE([JEMALLOC_VALGRIND], [ ]) |
| 918 | fi |
| 919 | fi |
| 920 | AC_SUBST([enable_valgrind]) |
| 921 | |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 922 | dnl Do not support the xmalloc option by default. |
| 923 | AC_ARG_ENABLE([xmalloc], |
| 924 | [AS_HELP_STRING([--enable-xmalloc], [Support xmalloc option])], |
| 925 | [if test "x$enable_xmalloc" = "xno" ; then |
| 926 | enable_xmalloc="0" |
| 927 | else |
| 928 | enable_xmalloc="1" |
| 929 | fi |
| 930 | ], |
| 931 | [enable_xmalloc="0"] |
| 932 | ) |
| 933 | if test "x$enable_xmalloc" = "x1" ; then |
| 934 | AC_DEFINE([JEMALLOC_XMALLOC], [ ]) |
| 935 | fi |
| 936 | AC_SUBST([enable_xmalloc]) |
| 937 | |
Jason Evans | 6684cac | 2012-03-05 12:15:36 -0800 | [diff] [blame] | 938 | AC_CACHE_CHECK([STATIC_PAGE_SHIFT], |
| 939 | [je_cv_static_page_shift], |
| 940 | AC_RUN_IFELSE([AC_LANG_PROGRAM( |
Mike Hommey | a19e87f | 2012-04-21 21:27:46 -0700 | [diff] [blame] | 941 | [[ |
Mike Hommey | fd97b1d | 2012-04-30 12:38:31 +0200 | [diff] [blame] | 942 | #include <strings.h> |
Mike Hommey | a19e87f | 2012-04-21 21:27:46 -0700 | [diff] [blame] | 943 | #ifdef _WIN32 |
| 944 | #include <windows.h> |
| 945 | #else |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 946 | #include <unistd.h> |
Mike Hommey | a19e87f | 2012-04-21 21:27:46 -0700 | [diff] [blame] | 947 | #endif |
| 948 | #include <stdio.h> |
Jason Evans | 6684cac | 2012-03-05 12:15:36 -0800 | [diff] [blame] | 949 | ]], |
| 950 | [[ |
Garrett Cooper | 72c1e59 | 2012-12-02 17:57:28 -0800 | [diff] [blame] | 951 | int result; |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 952 | FILE *f; |
| 953 | |
Mike Hommey | a19e87f | 2012-04-21 21:27:46 -0700 | [diff] [blame] | 954 | #ifdef _WIN32 |
| 955 | SYSTEM_INFO si; |
| 956 | GetSystemInfo(&si); |
| 957 | result = si.dwPageSize; |
| 958 | #else |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 959 | result = sysconf(_SC_PAGESIZE); |
Mike Hommey | a19e87f | 2012-04-21 21:27:46 -0700 | [diff] [blame] | 960 | #endif |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 961 | if (result == -1) { |
| 962 | return 1; |
| 963 | } |
Mike Hommey | a19e87f | 2012-04-21 21:27:46 -0700 | [diff] [blame] | 964 | result = ffsl(result) - 1; |
| 965 | |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 966 | f = fopen("conftest.out", "w"); |
| 967 | if (f == NULL) { |
| 968 | return 1; |
| 969 | } |
Garrett Cooper | 72c1e59 | 2012-12-02 17:57:28 -0800 | [diff] [blame] | 970 | fprintf(f, "%d\n", result); |
Jason Evans | 3cc1f1a | 2012-04-03 22:30:05 -0700 | [diff] [blame] | 971 | fclose(f); |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 972 | |
| 973 | return 0; |
| 974 | ]])], |
Jason Evans | 6684cac | 2012-03-05 12:15:36 -0800 | [diff] [blame] | 975 | [je_cv_static_page_shift=`cat conftest.out`], |
Daniel Micay | ccf0466 | 2014-05-07 01:17:05 -0400 | [diff] [blame] | 976 | [je_cv_static_page_shift=undefined], |
| 977 | [je_cv_static_page_shift=12])) |
Jason Evans | 6684cac | 2012-03-05 12:15:36 -0800 | [diff] [blame] | 978 | |
| 979 | if test "x$je_cv_static_page_shift" != "xundefined"; then |
| 980 | AC_DEFINE_UNQUOTED([STATIC_PAGE_SHIFT], [$je_cv_static_page_shift]) |
| 981 | else |
| 982 | AC_MSG_ERROR([cannot determine value for STATIC_PAGE_SHIFT]) |
| 983 | fi |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 984 | |
| 985 | dnl ============================================================================ |
| 986 | dnl jemalloc configuration. |
| 987 | dnl |
Jason Evans | a40bc7a | 2010-03-02 13:01:16 -0800 | [diff] [blame] | 988 | |
| 989 | dnl Set VERSION if source directory has an embedded git repository. |
Jason Evans | 955851f | 2011-03-31 22:38:51 -0700 | [diff] [blame] | 990 | if test -d "${srcroot}.git" ; then |
Jason Evans | 79d660d | 2010-09-17 17:38:24 -0700 | [diff] [blame] | 991 | git describe --long --abbrev=40 > ${srcroot}VERSION |
Jason Evans | a40bc7a | 2010-03-02 13:01:16 -0800 | [diff] [blame] | 992 | fi |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 993 | jemalloc_version=`cat ${srcroot}VERSION` |
Jason Evans | a40bc7a | 2010-03-02 13:01:16 -0800 | [diff] [blame] | 994 | jemalloc_version_major=`echo ${jemalloc_version} | tr ".g-" " " | awk '{print [$]1}'` |
| 995 | jemalloc_version_minor=`echo ${jemalloc_version} | tr ".g-" " " | awk '{print [$]2}'` |
| 996 | jemalloc_version_bugfix=`echo ${jemalloc_version} | tr ".g-" " " | awk '{print [$]3}'` |
| 997 | jemalloc_version_nrev=`echo ${jemalloc_version} | tr ".g-" " " | awk '{print [$]4}'` |
| 998 | jemalloc_version_gid=`echo ${jemalloc_version} | tr ".g-" " " | awk '{print [$]5}'` |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 999 | AC_SUBST([jemalloc_version]) |
Jason Evans | a40bc7a | 2010-03-02 13:01:16 -0800 | [diff] [blame] | 1000 | AC_SUBST([jemalloc_version_major]) |
| 1001 | AC_SUBST([jemalloc_version_minor]) |
| 1002 | AC_SUBST([jemalloc_version_bugfix]) |
| 1003 | AC_SUBST([jemalloc_version_nrev]) |
| 1004 | AC_SUBST([jemalloc_version_gid]) |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 1005 | |
| 1006 | dnl ============================================================================ |
| 1007 | dnl Configure pthreads. |
| 1008 | |
Mike Hommey | a19e87f | 2012-04-21 21:27:46 -0700 | [diff] [blame] | 1009 | if test "x$abi" != "xpecoff" ; then |
| 1010 | AC_CHECK_HEADERS([pthread.h], , [AC_MSG_ERROR([pthread.h is missing])]) |
| 1011 | dnl Some systems may embed pthreads functionality in libc; check for libpthread |
| 1012 | dnl first, but try libc too before failing. |
| 1013 | AC_CHECK_LIB([pthread], [pthread_create], [LIBS="$LIBS -lpthread"], |
| 1014 | [AC_SEARCH_LIBS([pthread_create], , , |
| 1015 | AC_MSG_ERROR([libpthread is missing]))]) |
| 1016 | fi |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 1017 | |
| 1018 | CPPFLAGS="$CPPFLAGS -D_REENTRANT" |
| 1019 | |
Jason Evans | cd9a134 | 2012-03-21 18:33:03 -0700 | [diff] [blame] | 1020 | dnl Check whether the BSD-specific _malloc_thread_cleanup() exists. If so, use |
| 1021 | dnl it rather than pthreads TSD cleanup functions to support cleanup during |
| 1022 | dnl thread exit, in order to avoid pthreads library recursion during |
| 1023 | dnl bootstrapping. |
Jason Evans | cd9a134 | 2012-03-21 18:33:03 -0700 | [diff] [blame] | 1024 | AC_CHECK_FUNC([_malloc_thread_cleanup], |
| 1025 | [have__malloc_thread_cleanup="1"], |
| 1026 | [have__malloc_thread_cleanup="0"] |
| 1027 | ) |
| 1028 | if test "x$have__malloc_thread_cleanup" = "x1" ; then |
| 1029 | AC_DEFINE([JEMALLOC_MALLOC_THREAD_CLEANUP], [ ]) |
| 1030 | force_tls="1" |
| 1031 | fi |
| 1032 | |
Jason Evans | 41b6afb | 2012-02-02 22:04:57 -0800 | [diff] [blame] | 1033 | dnl Check whether the BSD-specific _pthread_mutex_init_calloc_cb() exists. If |
| 1034 | dnl so, mutex initialization causes allocation, and we need to implement this |
| 1035 | dnl callback function in order to prevent recursive allocation. |
| 1036 | AC_CHECK_FUNC([_pthread_mutex_init_calloc_cb], |
| 1037 | [have__pthread_mutex_init_calloc_cb="1"], |
| 1038 | [have__pthread_mutex_init_calloc_cb="0"] |
| 1039 | ) |
| 1040 | if test "x$have__pthread_mutex_init_calloc_cb" = "x1" ; then |
| 1041 | AC_DEFINE([JEMALLOC_MUTEX_INIT_CB]) |
| 1042 | fi |
| 1043 | |
Jason Evans | 0fee70d | 2012-02-13 12:36:11 -0800 | [diff] [blame] | 1044 | dnl Disable lazy locking by default. |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 1045 | AC_ARG_ENABLE([lazy_lock], |
Jason Evans | 0fee70d | 2012-02-13 12:36:11 -0800 | [diff] [blame] | 1046 | [AS_HELP_STRING([--enable-lazy-lock], |
| 1047 | [Enable lazy locking (only lock when multi-threaded)])], |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 1048 | [if test "x$enable_lazy_lock" = "xno" ; then |
| 1049 | enable_lazy_lock="0" |
| 1050 | else |
| 1051 | enable_lazy_lock="1" |
| 1052 | fi |
| 1053 | ], |
Jason Evans | 0fee70d | 2012-02-13 12:36:11 -0800 | [diff] [blame] | 1054 | [enable_lazy_lock="0"] |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 1055 | ) |
Jason Evans | fd4fcef | 2012-03-23 17:40:58 -0700 | [diff] [blame] | 1056 | if test "x$enable_lazy_lock" = "x0" -a "x${force_lazy_lock}" = "x1" ; then |
| 1057 | AC_MSG_RESULT([Forcing lazy-lock to avoid allocator/threading bootstrap issues]) |
| 1058 | enable_lazy_lock="1" |
| 1059 | fi |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 1060 | if test "x$enable_lazy_lock" = "x1" ; then |
Mike Hommey | a19e87f | 2012-04-21 21:27:46 -0700 | [diff] [blame] | 1061 | if test "x$abi" != "xpecoff" ; then |
| 1062 | AC_CHECK_HEADERS([dlfcn.h], , [AC_MSG_ERROR([dlfcn.h is missing])]) |
| 1063 | AC_CHECK_FUNC([dlsym], [], |
| 1064 | [AC_CHECK_LIB([dl], [dlsym], [LIBS="$LIBS -ldl"], |
| 1065 | [AC_MSG_ERROR([libdl is missing])]) |
| 1066 | ]) |
| 1067 | fi |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 1068 | AC_DEFINE([JEMALLOC_LAZY_LOCK], [ ]) |
| 1069 | fi |
| 1070 | AC_SUBST([enable_lazy_lock]) |
| 1071 | |
Jason Evans | 78d815c | 2010-01-17 14:06:20 -0800 | [diff] [blame] | 1072 | AC_ARG_ENABLE([tls], |
| 1073 | [AS_HELP_STRING([--disable-tls], [Disable thread-local storage (__thread keyword)])], |
| 1074 | if test "x$enable_tls" = "xno" ; then |
| 1075 | enable_tls="0" |
| 1076 | else |
| 1077 | enable_tls="1" |
| 1078 | fi |
| 1079 | , |
| 1080 | enable_tls="1" |
| 1081 | ) |
Jason Evans | cd9a134 | 2012-03-21 18:33:03 -0700 | [diff] [blame] | 1082 | if test "x${enable_tls}" = "x0" -a "x${force_tls}" = "x1" ; then |
| 1083 | AC_MSG_RESULT([Forcing TLS to avoid allocator/threading bootstrap issues]) |
| 1084 | enable_tls="1" |
| 1085 | fi |
Jason Evans | b80581d | 2012-03-23 16:17:43 -0700 | [diff] [blame] | 1086 | if test "x${enable_tls}" = "x1" -a "x${force_tls}" = "x0" ; then |
| 1087 | AC_MSG_RESULT([Forcing no TLS to avoid allocator/threading bootstrap issues]) |
| 1088 | enable_tls="0" |
| 1089 | fi |
Jason Evans | 78d815c | 2010-01-17 14:06:20 -0800 | [diff] [blame] | 1090 | if test "x${enable_tls}" = "x1" ; then |
| 1091 | AC_MSG_CHECKING([for TLS]) |
Jason Evans | 6684cac | 2012-03-05 12:15:36 -0800 | [diff] [blame] | 1092 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM( |
Jason Evans | 78d815c | 2010-01-17 14:06:20 -0800 | [diff] [blame] | 1093 | [[ |
| 1094 | __thread int x; |
| 1095 | ]], [[ |
| 1096 | x = 42; |
| 1097 | |
| 1098 | return 0; |
| 1099 | ]])], |
| 1100 | AC_MSG_RESULT([yes]), |
| 1101 | AC_MSG_RESULT([no]) |
| 1102 | enable_tls="0") |
| 1103 | fi |
Jason Evans | b267d0f | 2010-08-13 15:42:29 -0700 | [diff] [blame] | 1104 | AC_SUBST([enable_tls]) |
Jason Evans | e24c7af | 2012-03-19 10:21:17 -0700 | [diff] [blame] | 1105 | if test "x${enable_tls}" = "x1" ; then |
| 1106 | AC_DEFINE_UNQUOTED([JEMALLOC_TLS], [ ]) |
Jason Evans | cd9a134 | 2012-03-21 18:33:03 -0700 | [diff] [blame] | 1107 | elif test "x${force_tls}" = "x1" ; then |
| 1108 | AC_MSG_ERROR([Failed to configure TLS, which is mandatory for correct function]) |
Jason Evans | 78d815c | 2010-01-17 14:06:20 -0800 | [diff] [blame] | 1109 | fi |
| 1110 | |
Jason Evans | 2dbecf1 | 2010-09-05 10:35:13 -0700 | [diff] [blame] | 1111 | dnl ============================================================================ |
Richard Diamond | 9c3a10f | 2014-05-28 21:37:02 -0500 | [diff] [blame] | 1112 | dnl Check for ffsl(3), then __builtin_ffsl(), and fail if neither are found. |
| 1113 | dnl One of those two functions should (theoretically) exist on all platforms |
| 1114 | dnl that jemalloc currently has a chance of functioning on without modification. |
| 1115 | dnl We additionally assume ffs() or __builtin_ffs() are defined if |
| 1116 | dnl ffsl() or __builtin_ffsl() are defined, respectively. |
Jason Evans | 4c2faa8 | 2012-03-13 11:09:23 -0700 | [diff] [blame] | 1117 | JE_COMPILABLE([a program using ffsl], [ |
Garrett Cooper | 72c1e59 | 2012-12-02 17:57:28 -0800 | [diff] [blame] | 1118 | #include <stdio.h> |
Jason Evans | 382132e | 2012-04-04 15:25:43 -0700 | [diff] [blame] | 1119 | #include <strings.h> |
Jason Evans | 4c2faa8 | 2012-03-13 11:09:23 -0700 | [diff] [blame] | 1120 | #include <string.h> |
| 1121 | ], [ |
| 1122 | { |
| 1123 | int rv = ffsl(0x08); |
Garrett Cooper | 72c1e59 | 2012-12-02 17:57:28 -0800 | [diff] [blame] | 1124 | printf("%d\n", rv); |
Jason Evans | 4c2faa8 | 2012-03-13 11:09:23 -0700 | [diff] [blame] | 1125 | } |
| 1126 | ], [je_cv_function_ffsl]) |
Richard Diamond | 9c3a10f | 2014-05-28 21:37:02 -0500 | [diff] [blame] | 1127 | if test "x${je_cv_function_ffsl}" == "xyes" ; then |
| 1128 | AC_DEFINE([JEMALLOC_INTERNAL_FFSL], [ffsl]) |
| 1129 | AC_DEFINE([JEMALLOC_INTERNAL_FFS], [ffs]) |
| 1130 | else |
| 1131 | JE_COMPILABLE([a program using __builtin_ffsl], [ |
| 1132 | #include <stdio.h> |
| 1133 | #include <strings.h> |
| 1134 | #include <string.h> |
| 1135 | ], [ |
| 1136 | { |
| 1137 | int rv = __builtin_ffsl(0x08); |
| 1138 | printf("%d\n", rv); |
| 1139 | } |
| 1140 | ], [je_cv_gcc_builtin_ffsl]) |
| 1141 | if test "x${je_cv_gcc_builtin_ffsl}" == "xyes" ; then |
| 1142 | AC_DEFINE([JEMALLOC_INTERNAL_FFSL], [__builtin_ffsl]) |
| 1143 | AC_DEFINE([JEMALLOC_INTERNAL_FFS], [__builtin_ffs]) |
| 1144 | else |
| 1145 | AC_MSG_ERROR([Cannot build without ffsl(3) or __builtin_ffsl()]) |
| 1146 | fi |
Jason Evans | 6684cac | 2012-03-05 12:15:36 -0800 | [diff] [blame] | 1147 | fi |
Jason Evans | 84c8eef | 2011-03-16 10:30:13 -0700 | [diff] [blame] | 1148 | |
| 1149 | dnl ============================================================================ |
Jason Evans | b57d3ec | 2012-04-17 13:17:54 -0700 | [diff] [blame] | 1150 | dnl Check for atomic(9) operations as provided on FreeBSD. |
| 1151 | |
| 1152 | JE_COMPILABLE([atomic(9)], [ |
| 1153 | #include <sys/types.h> |
| 1154 | #include <machine/atomic.h> |
| 1155 | #include <inttypes.h> |
| 1156 | ], [ |
| 1157 | { |
| 1158 | uint32_t x32 = 0; |
| 1159 | volatile uint32_t *x32p = &x32; |
| 1160 | atomic_fetchadd_32(x32p, 1); |
| 1161 | } |
| 1162 | { |
| 1163 | unsigned long xlong = 0; |
| 1164 | volatile unsigned long *xlongp = &xlong; |
| 1165 | atomic_fetchadd_long(xlongp, 1); |
| 1166 | } |
| 1167 | ], [je_cv_atomic9]) |
| 1168 | if test "x${je_cv_atomic9}" = "xyes" ; then |
| 1169 | AC_DEFINE([JEMALLOC_ATOMIC9]) |
| 1170 | fi |
| 1171 | |
| 1172 | dnl ============================================================================ |
Jason Evans | 763baa6 | 2011-03-18 19:10:31 -0700 | [diff] [blame] | 1173 | dnl Check for atomic(3) operations as provided on Darwin. |
| 1174 | |
| 1175 | JE_COMPILABLE([Darwin OSAtomic*()], [ |
| 1176 | #include <libkern/OSAtomic.h> |
| 1177 | #include <inttypes.h> |
| 1178 | ], [ |
| 1179 | { |
| 1180 | int32_t x32 = 0; |
| 1181 | volatile int32_t *x32p = &x32; |
| 1182 | OSAtomicAdd32(1, x32p); |
| 1183 | } |
| 1184 | { |
| 1185 | int64_t x64 = 0; |
| 1186 | volatile int64_t *x64p = &x64; |
| 1187 | OSAtomicAdd64(1, x64p); |
| 1188 | } |
Jason Evans | 6684cac | 2012-03-05 12:15:36 -0800 | [diff] [blame] | 1189 | ], [je_cv_osatomic]) |
| 1190 | if test "x${je_cv_osatomic}" = "xyes" ; then |
Jason Evans | e24c7af | 2012-03-19 10:21:17 -0700 | [diff] [blame] | 1191 | AC_DEFINE([JEMALLOC_OSATOMIC], [ ]) |
Jason Evans | 763baa6 | 2011-03-18 19:10:31 -0700 | [diff] [blame] | 1192 | fi |
| 1193 | |
| 1194 | dnl ============================================================================ |
Richard Diamond | 994fad9 | 2014-06-03 02:39:18 -0500 | [diff] [blame^] | 1195 | dnl Check for madvise(2). |
| 1196 | |
| 1197 | JE_COMPILABLE([madvise(2)], [ |
| 1198 | #include <sys/mman.h> |
| 1199 | ], [ |
| 1200 | { |
| 1201 | madvise((void *)0, 0, 0); |
| 1202 | } |
| 1203 | ], [je_cv_madvise]) |
| 1204 | if test "x${je_cv_madvise}" = "xyes" ; then |
| 1205 | AC_DEFINE([JEMALLOC_HAVE_MADVISE], [ ]) |
| 1206 | fi |
| 1207 | |
| 1208 | dnl ============================================================================ |
Mike Hommey | c1e567b | 2012-03-26 17:03:41 +0200 | [diff] [blame] | 1209 | dnl Check whether __sync_{add,sub}_and_fetch() are available despite |
| 1210 | dnl __GCC_HAVE_SYNC_COMPARE_AND_SWAP_n macros being undefined. |
| 1211 | |
| 1212 | AC_DEFUN([JE_SYNC_COMPARE_AND_SWAP_CHECK],[ |
| 1213 | AC_CACHE_CHECK([whether to force $1-bit __sync_{add,sub}_and_fetch()], |
| 1214 | [je_cv_sync_compare_and_swap_$2], |
Mike Hommey | 2cfe6d6 | 2012-03-27 15:03:07 +0200 | [diff] [blame] | 1215 | [AC_LINK_IFELSE([AC_LANG_PROGRAM([ |
| 1216 | #include <stdint.h> |
| 1217 | ], |
| 1218 | [ |
| 1219 | #ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_$2 |
| 1220 | { |
| 1221 | uint$1_t x$1 = 0; |
| 1222 | __sync_add_and_fetch(&x$1, 42); |
| 1223 | __sync_sub_and_fetch(&x$1, 1); |
| 1224 | } |
| 1225 | #else |
| 1226 | #error __GCC_HAVE_SYNC_COMPARE_AND_SWAP_$2 is defined, no need to force |
| 1227 | #endif |
| 1228 | ])], |
Mike Hommey | c1e567b | 2012-03-26 17:03:41 +0200 | [diff] [blame] | 1229 | [je_cv_sync_compare_and_swap_$2=yes], |
| 1230 | [je_cv_sync_compare_and_swap_$2=no])]) |
| 1231 | |
| 1232 | if test "x${je_cv_sync_compare_and_swap_$2}" = "xyes" ; then |
| 1233 | AC_DEFINE([JE_FORCE_SYNC_COMPARE_AND_SWAP_$2], [ ]) |
| 1234 | fi |
| 1235 | ]) |
| 1236 | |
Jason Evans | b57d3ec | 2012-04-17 13:17:54 -0700 | [diff] [blame] | 1237 | if test "x${je_cv_atomic9}" != "xyes" -a "x${je_cv_osatomic}" != "xyes" ; then |
Mike Hommey | c1e567b | 2012-03-26 17:03:41 +0200 | [diff] [blame] | 1238 | JE_SYNC_COMPARE_AND_SWAP_CHECK(32, 4) |
| 1239 | JE_SYNC_COMPARE_AND_SWAP_CHECK(64, 8) |
| 1240 | fi |
| 1241 | |
| 1242 | dnl ============================================================================ |
Jason Evans | d04047c | 2014-05-28 16:11:55 -0700 | [diff] [blame] | 1243 | dnl Check for __builtin_clz() and __builtin_clzl(). |
| 1244 | |
| 1245 | AC_CACHE_CHECK([for __builtin_clz], |
| 1246 | [je_cv_builtin_clz], |
| 1247 | [AC_LINK_IFELSE([AC_LANG_PROGRAM([], |
| 1248 | [ |
| 1249 | { |
| 1250 | unsigned x = 0; |
| 1251 | int y = __builtin_clz(x); |
| 1252 | } |
| 1253 | { |
| 1254 | unsigned long x = 0; |
| 1255 | int y = __builtin_clzl(x); |
| 1256 | } |
| 1257 | ])], |
| 1258 | [je_cv_builtin_clz=yes], |
| 1259 | [je_cv_builtin_clz=no])]) |
| 1260 | |
| 1261 | if test "x${je_cv_builtin_clz}" = "xyes" ; then |
| 1262 | AC_DEFINE([JEMALLOC_HAVE_BUILTIN_CLZ], [ ]) |
| 1263 | fi |
| 1264 | |
| 1265 | dnl ============================================================================ |
Jason Evans | 893a0ed | 2011-03-18 19:30:18 -0700 | [diff] [blame] | 1266 | dnl Check for spinlock(3) operations as provided on Darwin. |
| 1267 | |
| 1268 | JE_COMPILABLE([Darwin OSSpin*()], [ |
| 1269 | #include <libkern/OSAtomic.h> |
| 1270 | #include <inttypes.h> |
| 1271 | ], [ |
| 1272 | OSSpinLock lock = 0; |
| 1273 | OSSpinLockLock(&lock); |
| 1274 | OSSpinLockUnlock(&lock); |
Jason Evans | 6684cac | 2012-03-05 12:15:36 -0800 | [diff] [blame] | 1275 | ], [je_cv_osspin]) |
| 1276 | if test "x${je_cv_osspin}" = "xyes" ; then |
Jason Evans | e24c7af | 2012-03-19 10:21:17 -0700 | [diff] [blame] | 1277 | AC_DEFINE([JEMALLOC_OSSPIN], [ ]) |
Jason Evans | 893a0ed | 2011-03-18 19:30:18 -0700 | [diff] [blame] | 1278 | fi |
| 1279 | |
| 1280 | dnl ============================================================================ |
Jason Evans | 2dbecf1 | 2010-09-05 10:35:13 -0700 | [diff] [blame] | 1281 | dnl Darwin-related configuration. |
Jason Evans | 78d815c | 2010-01-17 14:06:20 -0800 | [diff] [blame] | 1282 | |
Mike Hommey | d0357f7 | 2012-11-26 18:52:41 +0100 | [diff] [blame] | 1283 | AC_ARG_ENABLE([zone-allocator], |
| 1284 | [AS_HELP_STRING([--disable-zone-allocator], |
| 1285 | [Disable zone allocator for Darwin])], |
| 1286 | [if test "x$enable_zone_allocator" = "xno" ; then |
| 1287 | enable_zone_allocator="0" |
| 1288 | else |
| 1289 | enable_zone_allocator="1" |
| 1290 | fi |
| 1291 | ], |
| 1292 | [if test "x${abi}" = "xmacho"; then |
| 1293 | enable_zone_allocator="1" |
| 1294 | fi |
| 1295 | ] |
| 1296 | ) |
| 1297 | AC_SUBST([enable_zone_allocator]) |
| 1298 | |
| 1299 | if test "x${enable_zone_allocator}" = "x1" ; then |
| 1300 | if test "x${abi}" != "xmacho"; then |
| 1301 | AC_MSG_ERROR([--enable-zone-allocator is only supported on Darwin]) |
| 1302 | fi |
Jason Evans | e24c7af | 2012-03-19 10:21:17 -0700 | [diff] [blame] | 1303 | AC_DEFINE([JEMALLOC_IVSALLOC], [ ]) |
| 1304 | AC_DEFINE([JEMALLOC_ZONE], [ ]) |
Jason Evans | 6109fe0 | 2010-02-10 10:37:56 -0800 | [diff] [blame] | 1305 | |
Jason Evans | 2dbecf1 | 2010-09-05 10:35:13 -0700 | [diff] [blame] | 1306 | dnl The szone version jumped from 3 to 6 between the OS X 10.5.x and 10.6 |
| 1307 | dnl releases. malloc_zone_t and malloc_introspection_t have new fields in |
| 1308 | dnl 10.6, which is the only source-level indication of the change. |
| 1309 | AC_MSG_CHECKING([malloc zone version]) |
Mike Hommey | 154829d | 2012-03-20 18:01:38 +0100 | [diff] [blame] | 1310 | AC_DEFUN([JE_ZONE_PROGRAM], |
| 1311 | [AC_LANG_PROGRAM( |
| 1312 | [#include <malloc/malloc.h>], |
| 1313 | [static foo[[sizeof($1) $2 sizeof(void *) * $3 ? 1 : -1]]] |
| 1314 | )]) |
Jason Evans | 2dbecf1 | 2010-09-05 10:35:13 -0700 | [diff] [blame] | 1315 | |
Mike Hommey | 154829d | 2012-03-20 18:01:38 +0100 | [diff] [blame] | 1316 | AC_COMPILE_IFELSE([JE_ZONE_PROGRAM(malloc_zone_t,==,14)],[JEMALLOC_ZONE_VERSION=3],[ |
| 1317 | AC_COMPILE_IFELSE([JE_ZONE_PROGRAM(malloc_zone_t,==,15)],[JEMALLOC_ZONE_VERSION=5],[ |
| 1318 | AC_COMPILE_IFELSE([JE_ZONE_PROGRAM(malloc_zone_t,==,16)],[ |
| 1319 | AC_COMPILE_IFELSE([JE_ZONE_PROGRAM(malloc_introspection_t,==,9)],[JEMALLOC_ZONE_VERSION=6],[ |
| 1320 | AC_COMPILE_IFELSE([JE_ZONE_PROGRAM(malloc_introspection_t,==,13)],[JEMALLOC_ZONE_VERSION=7],[JEMALLOC_ZONE_VERSION=] |
| 1321 | )])],[ |
| 1322 | AC_COMPILE_IFELSE([JE_ZONE_PROGRAM(malloc_zone_t,==,17)],[JEMALLOC_ZONE_VERSION=8],[ |
| 1323 | AC_COMPILE_IFELSE([JE_ZONE_PROGRAM(malloc_zone_t,>,17)],[JEMALLOC_ZONE_VERSION=9],[JEMALLOC_ZONE_VERSION=] |
| 1324 | )])])])]) |
| 1325 | if test "x${JEMALLOC_ZONE_VERSION}" = "x"; then |
| 1326 | AC_MSG_RESULT([unsupported]) |
| 1327 | AC_MSG_ERROR([Unsupported malloc zone version]) |
| 1328 | fi |
| 1329 | if test "${JEMALLOC_ZONE_VERSION}" = 9; then |
| 1330 | JEMALLOC_ZONE_VERSION=8 |
| 1331 | AC_MSG_RESULT([> 8]) |
| 1332 | else |
| 1333 | AC_MSG_RESULT([$JEMALLOC_ZONE_VERSION]) |
| 1334 | fi |
| 1335 | AC_DEFINE_UNQUOTED(JEMALLOC_ZONE_VERSION, [$JEMALLOC_ZONE_VERSION]) |
Jason Evans | b27805b | 2010-02-10 18:15:53 -0800 | [diff] [blame] | 1336 | fi |
| 1337 | |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 1338 | dnl ============================================================================ |
| 1339 | dnl Check for typedefs, structures, and compiler characteristics. |
| 1340 | AC_HEADER_STDBOOL |
| 1341 | |
Jason Evans | 748dfac | 2013-12-06 18:27:33 -0800 | [diff] [blame] | 1342 | dnl ============================================================================ |
| 1343 | dnl Define commands that generate output files. |
| 1344 | |
Jason Evans | 86abd0d | 2013-11-30 15:25:42 -0800 | [diff] [blame] | 1345 | AC_CONFIG_COMMANDS([include/jemalloc/internal/private_namespace.h], [ |
| 1346 | mkdir -p "${objroot}include/jemalloc/internal" |
| 1347 | "${srcdir}/include/jemalloc/internal/private_namespace.sh" "${srcdir}/include/jemalloc/internal/private_symbols.txt" > "${objroot}include/jemalloc/internal/private_namespace.h" |
Jason Evans | f234dc5 | 2014-01-16 17:38:01 -0800 | [diff] [blame] | 1348 | ], [ |
| 1349 | srcdir="${srcdir}" |
| 1350 | objroot="${objroot}" |
Jason Evans | 86abd0d | 2013-11-30 15:25:42 -0800 | [diff] [blame] | 1351 | ]) |
| 1352 | AC_CONFIG_COMMANDS([include/jemalloc/internal/private_unnamespace.h], [ |
| 1353 | mkdir -p "${objroot}include/jemalloc/internal" |
| 1354 | "${srcdir}/include/jemalloc/internal/private_unnamespace.sh" "${srcdir}/include/jemalloc/internal/private_symbols.txt" > "${objroot}include/jemalloc/internal/private_unnamespace.h" |
Jason Evans | f234dc5 | 2014-01-16 17:38:01 -0800 | [diff] [blame] | 1355 | ], [ |
| 1356 | srcdir="${srcdir}" |
| 1357 | objroot="${objroot}" |
| 1358 | ]) |
| 1359 | AC_CONFIG_COMMANDS([include/jemalloc/internal/public_symbols.txt], [ |
| 1360 | f="${objroot}include/jemalloc/internal/public_symbols.txt" |
| 1361 | mkdir -p "${objroot}include/jemalloc/internal" |
| 1362 | cp /dev/null "${f}" |
| 1363 | for nm in `echo ${mangling_map} |tr ',' ' '` ; do |
| 1364 | n=`echo ${nm} |tr ':' ' ' |awk '{print $[]1}'` |
| 1365 | m=`echo ${nm} |tr ':' ' ' |awk '{print $[]2}'` |
| 1366 | echo "${n}:${m}" >> "${f}" |
| 1367 | dnl Remove name from public_syms so that it isn't redefined later. |
| 1368 | public_syms=`for sym in ${public_syms}; do echo "${sym}"; done |grep -v "^${n}\$" |tr '\n' ' '` |
| 1369 | done |
| 1370 | for sym in ${public_syms} ; do |
| 1371 | n="${sym}" |
| 1372 | m="${JEMALLOC_PREFIX}${sym}" |
| 1373 | echo "${n}:${m}" >> "${f}" |
| 1374 | done |
| 1375 | ], [ |
| 1376 | srcdir="${srcdir}" |
| 1377 | objroot="${objroot}" |
| 1378 | mangling_map="${mangling_map}" |
| 1379 | public_syms="${public_syms}" |
| 1380 | JEMALLOC_PREFIX="${JEMALLOC_PREFIX}" |
Jason Evans | 86abd0d | 2013-11-30 15:25:42 -0800 | [diff] [blame] | 1381 | ]) |
| 1382 | AC_CONFIG_COMMANDS([include/jemalloc/internal/public_namespace.h], [ |
| 1383 | mkdir -p "${objroot}include/jemalloc/internal" |
Jason Evans | f234dc5 | 2014-01-16 17:38:01 -0800 | [diff] [blame] | 1384 | "${srcdir}/include/jemalloc/internal/public_namespace.sh" "${objroot}include/jemalloc/internal/public_symbols.txt" > "${objroot}include/jemalloc/internal/public_namespace.h" |
| 1385 | ], [ |
| 1386 | srcdir="${srcdir}" |
| 1387 | objroot="${objroot}" |
Jason Evans | 86abd0d | 2013-11-30 15:25:42 -0800 | [diff] [blame] | 1388 | ]) |
| 1389 | AC_CONFIG_COMMANDS([include/jemalloc/internal/public_unnamespace.h], [ |
| 1390 | mkdir -p "${objroot}include/jemalloc/internal" |
Jason Evans | f234dc5 | 2014-01-16 17:38:01 -0800 | [diff] [blame] | 1391 | "${srcdir}/include/jemalloc/internal/public_unnamespace.sh" "${objroot}include/jemalloc/internal/public_symbols.txt" > "${objroot}include/jemalloc/internal/public_unnamespace.h" |
| 1392 | ], [ |
| 1393 | srcdir="${srcdir}" |
| 1394 | objroot="${objroot}" |
Jason Evans | 86abd0d | 2013-11-30 15:25:42 -0800 | [diff] [blame] | 1395 | ]) |
Jason Evans | b172610 | 2012-02-28 16:50:47 -0800 | [diff] [blame] | 1396 | AC_CONFIG_COMMANDS([include/jemalloc/internal/size_classes.h], [ |
Jason Evans | 86abd0d | 2013-11-30 15:25:42 -0800 | [diff] [blame] | 1397 | mkdir -p "${objroot}include/jemalloc/internal" |
Jason Evans | b172610 | 2012-02-28 16:50:47 -0800 | [diff] [blame] | 1398 | "${srcdir}/include/jemalloc/internal/size_classes.sh" > "${objroot}include/jemalloc/internal/size_classes.h" |
Jason Evans | f234dc5 | 2014-01-16 17:38:01 -0800 | [diff] [blame] | 1399 | ], [ |
| 1400 | srcdir="${srcdir}" |
| 1401 | objroot="${objroot}" |
Jason Evans | b172610 | 2012-02-28 16:50:47 -0800 | [diff] [blame] | 1402 | ]) |
Jason Evans | 86abd0d | 2013-11-30 15:25:42 -0800 | [diff] [blame] | 1403 | AC_CONFIG_COMMANDS([include/jemalloc/jemalloc_protos_jet.h], [ |
| 1404 | mkdir -p "${objroot}include/jemalloc" |
| 1405 | cat "${srcdir}/include/jemalloc/jemalloc_protos.h.in" | sed -e 's/@je_@/jet_/g' > "${objroot}include/jemalloc/jemalloc_protos_jet.h" |
Jason Evans | f234dc5 | 2014-01-16 17:38:01 -0800 | [diff] [blame] | 1406 | ], [ |
| 1407 | srcdir="${srcdir}" |
| 1408 | objroot="${objroot}" |
| 1409 | ]) |
| 1410 | AC_CONFIG_COMMANDS([include/jemalloc/jemalloc_rename.h], [ |
| 1411 | mkdir -p "${objroot}include/jemalloc" |
| 1412 | "${srcdir}/include/jemalloc/jemalloc_rename.sh" "${objroot}include/jemalloc/internal/public_symbols.txt" > "${objroot}include/jemalloc/jemalloc_rename.h" |
| 1413 | ], [ |
| 1414 | srcdir="${srcdir}" |
| 1415 | objroot="${objroot}" |
| 1416 | ]) |
| 1417 | AC_CONFIG_COMMANDS([include/jemalloc/jemalloc_mangle.h], [ |
| 1418 | mkdir -p "${objroot}include/jemalloc" |
| 1419 | "${srcdir}/include/jemalloc/jemalloc_mangle.sh" "${objroot}include/jemalloc/internal/public_symbols.txt" je_ > "${objroot}include/jemalloc/jemalloc_mangle.h" |
| 1420 | ], [ |
| 1421 | srcdir="${srcdir}" |
| 1422 | objroot="${objroot}" |
| 1423 | ]) |
| 1424 | AC_CONFIG_COMMANDS([include/jemalloc/jemalloc_mangle_jet.h], [ |
| 1425 | mkdir -p "${objroot}include/jemalloc" |
| 1426 | "${srcdir}/include/jemalloc/jemalloc_mangle.sh" "${objroot}include/jemalloc/internal/public_symbols.txt" jet_ > "${objroot}include/jemalloc/jemalloc_mangle_jet.h" |
| 1427 | ], [ |
| 1428 | srcdir="${srcdir}" |
| 1429 | objroot="${objroot}" |
Jason Evans | 86abd0d | 2013-11-30 15:25:42 -0800 | [diff] [blame] | 1430 | ]) |
| 1431 | AC_CONFIG_COMMANDS([include/jemalloc/jemalloc.h], [ |
| 1432 | mkdir -p "${objroot}include/jemalloc" |
| 1433 | "${srcdir}/include/jemalloc/jemalloc.sh" "${objroot}" > "${objroot}include/jemalloc/jemalloc${install_suffix}.h" |
Jason Evans | f234dc5 | 2014-01-16 17:38:01 -0800 | [diff] [blame] | 1434 | ], [ |
| 1435 | srcdir="${srcdir}" |
| 1436 | objroot="${objroot}" |
| 1437 | install_suffix="${install_suffix}" |
Jason Evans | 86abd0d | 2013-11-30 15:25:42 -0800 | [diff] [blame] | 1438 | ]) |
Jason Evans | b172610 | 2012-02-28 16:50:47 -0800 | [diff] [blame] | 1439 | |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 1440 | dnl Process .in files. |
Jason Evans | b0fd501 | 2010-01-17 01:49:20 -0800 | [diff] [blame] | 1441 | AC_SUBST([cfghdrs_in]) |
| 1442 | AC_SUBST([cfghdrs_out]) |
Jason Evans | 0656ec0 | 2010-04-07 23:37:35 -0700 | [diff] [blame] | 1443 | AC_CONFIG_HEADERS([$cfghdrs_tup]) |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 1444 | |
| 1445 | dnl ============================================================================ |
| 1446 | dnl Generate outputs. |
Jason Evans | 748dfac | 2013-12-06 18:27:33 -0800 | [diff] [blame] | 1447 | |
Antony Dovgal | 2bd3cbc | 2011-10-13 09:33:33 +0400 | [diff] [blame] | 1448 | AC_CONFIG_FILES([$cfgoutputs_tup config.stamp bin/jemalloc.sh]) |
Jason Evans | b0fd501 | 2010-01-17 01:49:20 -0800 | [diff] [blame] | 1449 | AC_SUBST([cfgoutputs_in]) |
| 1450 | AC_SUBST([cfgoutputs_out]) |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 1451 | AC_OUTPUT |
| 1452 | |
| 1453 | dnl ============================================================================ |
| 1454 | dnl Print out the results of configuration. |
| 1455 | AC_MSG_RESULT([===============================================================================]) |
Jason Evans | f576c63 | 2011-11-01 22:27:41 -0700 | [diff] [blame] | 1456 | AC_MSG_RESULT([jemalloc version : ${jemalloc_version}]) |
| 1457 | AC_MSG_RESULT([library revision : ${rev}]) |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 1458 | AC_MSG_RESULT([]) |
| 1459 | AC_MSG_RESULT([CC : ${CC}]) |
| 1460 | AC_MSG_RESULT([CPPFLAGS : ${CPPFLAGS}]) |
| 1461 | AC_MSG_RESULT([CFLAGS : ${CFLAGS}]) |
| 1462 | AC_MSG_RESULT([LDFLAGS : ${LDFLAGS}]) |
Jason Evans | 748dfac | 2013-12-06 18:27:33 -0800 | [diff] [blame] | 1463 | AC_MSG_RESULT([EXTRA_LDFLAGS : ${EXTRA_LDFLAGS}]) |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 1464 | AC_MSG_RESULT([LIBS : ${LIBS}]) |
| 1465 | AC_MSG_RESULT([RPATH_EXTRA : ${RPATH_EXTRA}]) |
| 1466 | AC_MSG_RESULT([]) |
Jason Evans | aee7fd2 | 2010-11-24 22:00:02 -0800 | [diff] [blame] | 1467 | AC_MSG_RESULT([XSLTPROC : ${XSLTPROC}]) |
| 1468 | AC_MSG_RESULT([XSLROOT : ${XSLROOT}]) |
| 1469 | AC_MSG_RESULT([]) |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 1470 | AC_MSG_RESULT([PREFIX : ${PREFIX}]) |
| 1471 | AC_MSG_RESULT([BINDIR : ${BINDIR}]) |
Jason Evans | 662a017 | 2009-07-01 19:24:31 -0700 | [diff] [blame] | 1472 | AC_MSG_RESULT([INCLUDEDIR : ${INCLUDEDIR}]) |
| 1473 | AC_MSG_RESULT([LIBDIR : ${LIBDIR}]) |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 1474 | AC_MSG_RESULT([DATADIR : ${DATADIR}]) |
| 1475 | AC_MSG_RESULT([MANDIR : ${MANDIR}]) |
| 1476 | AC_MSG_RESULT([]) |
| 1477 | AC_MSG_RESULT([srcroot : ${srcroot}]) |
| 1478 | AC_MSG_RESULT([abs_srcroot : ${abs_srcroot}]) |
| 1479 | AC_MSG_RESULT([objroot : ${objroot}]) |
| 1480 | AC_MSG_RESULT([abs_objroot : ${abs_objroot}]) |
| 1481 | AC_MSG_RESULT([]) |
Jason Evans | 90895cf | 2009-12-29 00:09:15 -0800 | [diff] [blame] | 1482 | AC_MSG_RESULT([JEMALLOC_PREFIX : ${JEMALLOC_PREFIX}]) |
Jason Evans | 746e77a | 2011-07-30 16:40:52 -0700 | [diff] [blame] | 1483 | AC_MSG_RESULT([JEMALLOC_PRIVATE_NAMESPACE]) |
| 1484 | AC_MSG_RESULT([ : ${JEMALLOC_PRIVATE_NAMESPACE}]) |
Jason Evans | b0fd501 | 2010-01-17 01:49:20 -0800 | [diff] [blame] | 1485 | AC_MSG_RESULT([install_suffix : ${install_suffix}]) |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 1486 | AC_MSG_RESULT([autogen : ${enable_autogen}]) |
Jason Evans | 355b438 | 2010-09-20 19:20:48 -0700 | [diff] [blame] | 1487 | AC_MSG_RESULT([cc-silence : ${enable_cc_silence}]) |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 1488 | AC_MSG_RESULT([debug : ${enable_debug}]) |
Jason Evans | 748dfac | 2013-12-06 18:27:33 -0800 | [diff] [blame] | 1489 | AC_MSG_RESULT([code-coverage : ${enable_code_coverage}]) |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 1490 | AC_MSG_RESULT([stats : ${enable_stats}]) |
Jason Evans | 6109fe0 | 2010-02-10 10:37:56 -0800 | [diff] [blame] | 1491 | AC_MSG_RESULT([prof : ${enable_prof}]) |
| 1492 | AC_MSG_RESULT([prof-libunwind : ${enable_prof_libunwind}]) |
Jason Evans | 77f350b | 2011-03-15 22:23:12 -0700 | [diff] [blame] | 1493 | AC_MSG_RESULT([prof-libgcc : ${enable_prof_libgcc}]) |
| 1494 | AC_MSG_RESULT([prof-gcc : ${enable_prof_gcc}]) |
Jason Evans | 84cbbcb | 2009-12-29 00:09:15 -0800 | [diff] [blame] | 1495 | AC_MSG_RESULT([tcache : ${enable_tcache}]) |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 1496 | AC_MSG_RESULT([fill : ${enable_fill}]) |
Jason Evans | b147611 | 2012-04-05 13:36:17 -0700 | [diff] [blame] | 1497 | AC_MSG_RESULT([utrace : ${enable_utrace}]) |
Jason Evans | 122449b | 2012-04-06 00:35:09 -0700 | [diff] [blame] | 1498 | AC_MSG_RESULT([valgrind : ${enable_valgrind}]) |
| 1499 | AC_MSG_RESULT([xmalloc : ${enable_xmalloc}]) |
Jason Evans | 59ae276 | 2012-04-16 17:52:27 -0700 | [diff] [blame] | 1500 | AC_MSG_RESULT([munmap : ${enable_munmap}]) |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 1501 | AC_MSG_RESULT([lazy_lock : ${enable_lazy_lock}]) |
Jason Evans | 2dbecf1 | 2010-09-05 10:35:13 -0700 | [diff] [blame] | 1502 | AC_MSG_RESULT([tls : ${enable_tls}]) |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 1503 | AC_MSG_RESULT([===============================================================================]) |