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