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