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