Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 1 | dnl Process this file with autoconf to produce a configure script. |
Jason Evans | 2b31cf5 | 2017-06-29 13:56:22 -0700 | [diff] [blame] | 2 | AC_PREREQ(2.68) |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 3 | AC_INIT([Makefile.in]) |
| 4 | |
Jason Evans | 3a92319 | 2015-11-12 11:23:39 -0800 | [diff] [blame] | 5 | AC_CONFIG_AUX_DIR([build-aux]) |
| 6 | |
Jason Evans | f3340ca | 2009-06-30 16:17:05 -0700 | [diff] [blame] | 7 | dnl ============================================================================ |
| 8 | dnl Custom macro definitions. |
| 9 | |
Jason Evans | 194d6f9 | 2016-12-16 07:18:55 -0800 | [diff] [blame] | 10 | dnl JE_CONCAT_VVV(r, a, b) |
Tamir Duberstein | 96f1468 | 2017-07-06 14:50:55 -0400 | [diff] [blame] | 11 | dnl |
Jason Evans | 194d6f9 | 2016-12-16 07:18:55 -0800 | [diff] [blame] | 12 | dnl Set $r to the concatenation of $a and $b, with a space separating them iff |
| 13 | dnl both $a and $b are non-emty. |
| 14 | AC_DEFUN([JE_CONCAT_VVV], |
| 15 | if test "x[$]{$2}" = "x" -o "x[$]{$3}" = "x" ; then |
| 16 | $1="[$]{$2}[$]{$3}" |
| 17 | else |
| 18 | $1="[$]{$2} [$]{$3}" |
| 19 | fi |
| 20 | ) |
| 21 | |
| 22 | dnl JE_APPEND_VS(a, b) |
Tamir Duberstein | 96f1468 | 2017-07-06 14:50:55 -0400 | [diff] [blame] | 23 | dnl |
Jason Evans | 194d6f9 | 2016-12-16 07:18:55 -0800 | [diff] [blame] | 24 | dnl Set $a to the concatenation of $a and b, with a space separating them iff |
| 25 | dnl both $a and b are non-empty. |
| 26 | AC_DEFUN([JE_APPEND_VS], |
| 27 | T_APPEND_V=$2 |
| 28 | JE_CONCAT_VVV($1, $1, T_APPEND_V) |
| 29 | ) |
| 30 | |
| 31 | CONFIGURE_CFLAGS= |
| 32 | SPECIFIED_CFLAGS="${CFLAGS}" |
| 33 | dnl JE_CFLAGS_ADD(cflag) |
Tamir Duberstein | 96f1468 | 2017-07-06 14:50:55 -0400 | [diff] [blame] | 34 | dnl |
Jason Evans | 194d6f9 | 2016-12-16 07:18:55 -0800 | [diff] [blame] | 35 | dnl CFLAGS is the concatenation of CONFIGURE_CFLAGS and SPECIFIED_CFLAGS |
| 36 | dnl (ignoring EXTRA_CFLAGS, which does not impact configure tests. This macro |
| 37 | dnl appends to CONFIGURE_CFLAGS and regenerates CFLAGS. |
| 38 | AC_DEFUN([JE_CFLAGS_ADD], |
Jason Evans | f3340ca | 2009-06-30 16:17:05 -0700 | [diff] [blame] | 39 | [ |
| 40 | AC_MSG_CHECKING([whether compiler supports $1]) |
Jason Evans | 194d6f9 | 2016-12-16 07:18:55 -0800 | [diff] [blame] | 41 | T_CONFIGURE_CFLAGS="${CONFIGURE_CFLAGS}" |
| 42 | JE_APPEND_VS(CONFIGURE_CFLAGS, $1) |
| 43 | JE_CONCAT_VVV(CFLAGS, CONFIGURE_CFLAGS, SPECIFIED_CFLAGS) |
Jason Evans | 6684cac | 2012-03-05 12:15:36 -0800 | [diff] [blame] | 44 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM( |
Jason Evans | f3340ca | 2009-06-30 16:17:05 -0700 | [diff] [blame] | 45 | [[ |
| 46 | ]], [[ |
| 47 | return 0; |
| 48 | ]])], |
Jason Evans | 194d6f9 | 2016-12-16 07:18:55 -0800 | [diff] [blame] | 49 | [je_cv_cflags_added=$1] |
Jason Evans | f3340ca | 2009-06-30 16:17:05 -0700 | [diff] [blame] | 50 | AC_MSG_RESULT([yes]), |
Jason Evans | 194d6f9 | 2016-12-16 07:18:55 -0800 | [diff] [blame] | 51 | [je_cv_cflags_added=] |
Jason Evans | f3340ca | 2009-06-30 16:17:05 -0700 | [diff] [blame] | 52 | AC_MSG_RESULT([no]) |
Jason Evans | 194d6f9 | 2016-12-16 07:18:55 -0800 | [diff] [blame] | 53 | [CONFIGURE_CFLAGS="${T_CONFIGURE_CFLAGS}"] |
Jason Evans | f3340ca | 2009-06-30 16:17:05 -0700 | [diff] [blame] | 54 | ) |
Jason Evans | 194d6f9 | 2016-12-16 07:18:55 -0800 | [diff] [blame] | 55 | JE_CONCAT_VVV(CFLAGS, CONFIGURE_CFLAGS, SPECIFIED_CFLAGS) |
Jason Evans | f3340ca | 2009-06-30 16:17:05 -0700 | [diff] [blame] | 56 | ]) |
| 57 | |
Jason Evans | 194d6f9 | 2016-12-16 07:18:55 -0800 | [diff] [blame] | 58 | dnl JE_CFLAGS_SAVE() |
| 59 | dnl JE_CFLAGS_RESTORE() |
Tamir Duberstein | 96f1468 | 2017-07-06 14:50:55 -0400 | [diff] [blame] | 60 | dnl |
Jason Evans | 194d6f9 | 2016-12-16 07:18:55 -0800 | [diff] [blame] | 61 | dnl Save/restore CFLAGS. Nesting is not supported. |
| 62 | AC_DEFUN([JE_CFLAGS_SAVE], |
| 63 | SAVED_CONFIGURE_CFLAGS="${CONFIGURE_CFLAGS}" |
| 64 | ) |
| 65 | AC_DEFUN([JE_CFLAGS_RESTORE], |
| 66 | CONFIGURE_CFLAGS="${SAVED_CONFIGURE_CFLAGS}" |
| 67 | JE_CONCAT_VVV(CFLAGS, CONFIGURE_CFLAGS, SPECIFIED_CFLAGS) |
| 68 | ) |
| 69 | |
| 70 | CONFIGURE_CXXFLAGS= |
| 71 | SPECIFIED_CXXFLAGS="${CXXFLAGS}" |
| 72 | dnl JE_CXXFLAGS_ADD(cxxflag) |
| 73 | AC_DEFUN([JE_CXXFLAGS_ADD], |
Dave Watson | 2319152 | 2016-10-23 15:56:30 -0700 | [diff] [blame] | 74 | [ |
| 75 | AC_MSG_CHECKING([whether compiler supports $1]) |
Jason Evans | 194d6f9 | 2016-12-16 07:18:55 -0800 | [diff] [blame] | 76 | T_CONFIGURE_CXXFLAGS="${CONFIGURE_CXXFLAGS}" |
| 77 | JE_APPEND_VS(CONFIGURE_CXXFLAGS, $1) |
| 78 | JE_CONCAT_VVV(CXXFLAGS, CONFIGURE_CXXFLAGS, SPECIFIED_CXXFLAGS) |
Nehal J Wani | 78a87e4 | 2017-12-31 06:52:33 -0600 | [diff] [blame] | 79 | AC_LANG_PUSH([C++]) |
Dave Watson | 2319152 | 2016-10-23 15:56:30 -0700 | [diff] [blame] | 80 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM( |
| 81 | [[ |
| 82 | ]], [[ |
| 83 | return 0; |
| 84 | ]])], |
Jason Evans | 194d6f9 | 2016-12-16 07:18:55 -0800 | [diff] [blame] | 85 | [je_cv_cxxflags_added=$1] |
Dave Watson | 2319152 | 2016-10-23 15:56:30 -0700 | [diff] [blame] | 86 | AC_MSG_RESULT([yes]), |
Jason Evans | 194d6f9 | 2016-12-16 07:18:55 -0800 | [diff] [blame] | 87 | [je_cv_cxxflags_added=] |
Dave Watson | 2319152 | 2016-10-23 15:56:30 -0700 | [diff] [blame] | 88 | AC_MSG_RESULT([no]) |
Jason Evans | 194d6f9 | 2016-12-16 07:18:55 -0800 | [diff] [blame] | 89 | [CONFIGURE_CXXFLAGS="${T_CONFIGURE_CXXFLAGS}"] |
Dave Watson | 2319152 | 2016-10-23 15:56:30 -0700 | [diff] [blame] | 90 | ) |
Nehal J Wani | 78a87e4 | 2017-12-31 06:52:33 -0600 | [diff] [blame] | 91 | AC_LANG_POP([C++]) |
Jason Evans | 194d6f9 | 2016-12-16 07:18:55 -0800 | [diff] [blame] | 92 | JE_CONCAT_VVV(CXXFLAGS, CONFIGURE_CXXFLAGS, SPECIFIED_CXXFLAGS) |
Dave Watson | 2319152 | 2016-10-23 15:56:30 -0700 | [diff] [blame] | 93 | ]) |
| 94 | |
Jason Evans | f3340ca | 2009-06-30 16:17:05 -0700 | [diff] [blame] | 95 | dnl JE_COMPILABLE(label, hcode, mcode, rvar) |
Tamir Duberstein | 96f1468 | 2017-07-06 14:50:55 -0400 | [diff] [blame] | 96 | dnl |
Jason Evans | f3e139a | 2012-03-19 09:54:20 -0700 | [diff] [blame] | 97 | 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] | 98 | dnl cause failure. |
Jason Evans | f3340ca | 2009-06-30 16:17:05 -0700 | [diff] [blame] | 99 | AC_DEFUN([JE_COMPILABLE], |
| 100 | [ |
Jason Evans | 6684cac | 2012-03-05 12:15:36 -0800 | [diff] [blame] | 101 | AC_CACHE_CHECK([whether $1 is compilable], |
| 102 | [$4], |
Jason Evans | f3e139a | 2012-03-19 09:54:20 -0700 | [diff] [blame] | 103 | [AC_LINK_IFELSE([AC_LANG_PROGRAM([$2], |
| 104 | [$3])], |
| 105 | [$4=yes], |
| 106 | [$4=no])]) |
Jason Evans | f3340ca | 2009-06-30 16:17:05 -0700 | [diff] [blame] | 107 | ]) |
| 108 | |
| 109 | dnl ============================================================================ |
| 110 | |
Jason Evans | 41f2e69 | 2015-01-25 20:15:13 -0800 | [diff] [blame] | 111 | CONFIG=`echo ${ac_configure_args} | sed -e 's#'"'"'\([^ ]*\)'"'"'#\1#g'` |
Jason Evans | bec6a8d | 2015-01-22 17:55:58 -0800 | [diff] [blame] | 112 | AC_SUBST([CONFIG]) |
| 113 | |
Jason Evans | f576c63 | 2011-11-01 22:27:41 -0700 | [diff] [blame] | 114 | dnl Library revision. |
Jason Evans | 9790b96 | 2014-04-14 22:32:31 -0700 | [diff] [blame] | 115 | rev=2 |
Jason Evans | f576c63 | 2011-11-01 22:27:41 -0700 | [diff] [blame] | 116 | AC_SUBST([rev]) |
| 117 | |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 118 | srcroot=$srcdir |
| 119 | if test "x${srcroot}" = "x." ; then |
| 120 | srcroot="" |
| 121 | else |
| 122 | srcroot="${srcroot}/" |
| 123 | fi |
| 124 | AC_SUBST([srcroot]) |
| 125 | abs_srcroot="`cd \"${srcdir}\"; pwd`/" |
| 126 | AC_SUBST([abs_srcroot]) |
| 127 | |
| 128 | objroot="" |
| 129 | AC_SUBST([objroot]) |
| 130 | abs_objroot="`pwd`/" |
| 131 | AC_SUBST([abs_objroot]) |
| 132 | |
| 133 | dnl Munge install path variables. |
| 134 | if test "x$prefix" = "xNONE" ; then |
| 135 | prefix="/usr/local" |
| 136 | fi |
| 137 | if test "x$exec_prefix" = "xNONE" ; then |
| 138 | exec_prefix=$prefix |
| 139 | fi |
| 140 | PREFIX=$prefix |
| 141 | AC_SUBST([PREFIX]) |
| 142 | BINDIR=`eval echo $bindir` |
| 143 | BINDIR=`eval echo $BINDIR` |
| 144 | AC_SUBST([BINDIR]) |
| 145 | INCLUDEDIR=`eval echo $includedir` |
| 146 | INCLUDEDIR=`eval echo $INCLUDEDIR` |
| 147 | AC_SUBST([INCLUDEDIR]) |
| 148 | LIBDIR=`eval echo $libdir` |
| 149 | LIBDIR=`eval echo $LIBDIR` |
| 150 | AC_SUBST([LIBDIR]) |
| 151 | DATADIR=`eval echo $datadir` |
| 152 | DATADIR=`eval echo $DATADIR` |
| 153 | AC_SUBST([DATADIR]) |
| 154 | MANDIR=`eval echo $mandir` |
| 155 | MANDIR=`eval echo $MANDIR` |
| 156 | AC_SUBST([MANDIR]) |
| 157 | |
Jason Evans | aee7fd2 | 2010-11-24 22:00:02 -0800 | [diff] [blame] | 158 | dnl Support for building documentation. |
Jason Evans | 7329a4f | 2013-01-22 10:53:29 -0800 | [diff] [blame] | 159 | AC_PATH_PROG([XSLTPROC], [xsltproc], [false], [$PATH]) |
Jason Evans | 7091b41 | 2012-03-19 09:36:44 -0700 | [diff] [blame] | 160 | if test -d "/usr/share/xml/docbook/stylesheet/docbook-xsl" ; then |
| 161 | DEFAULT_XSLROOT="/usr/share/xml/docbook/stylesheet/docbook-xsl" |
| 162 | elif test -d "/usr/share/sgml/docbook/xsl-stylesheets" ; then |
| 163 | DEFAULT_XSLROOT="/usr/share/sgml/docbook/xsl-stylesheets" |
| 164 | else |
| 165 | dnl Documentation building will fail if this default gets used. |
| 166 | DEFAULT_XSLROOT="" |
| 167 | fi |
Jason Evans | aee7fd2 | 2010-11-24 22:00:02 -0800 | [diff] [blame] | 168 | AC_ARG_WITH([xslroot], |
Jason Evans | 7091b41 | 2012-03-19 09:36:44 -0700 | [diff] [blame] | 169 | [AS_HELP_STRING([--with-xslroot=<path>], [XSL stylesheet root path])], [ |
Jason Evans | aee7fd2 | 2010-11-24 22:00:02 -0800 | [diff] [blame] | 170 | if test "x$with_xslroot" = "xno" ; then |
Jason Evans | 7091b41 | 2012-03-19 09:36:44 -0700 | [diff] [blame] | 171 | XSLROOT="${DEFAULT_XSLROOT}" |
Jason Evans | aee7fd2 | 2010-11-24 22:00:02 -0800 | [diff] [blame] | 172 | else |
| 173 | XSLROOT="${with_xslroot}" |
Jason Evans | 7091b41 | 2012-03-19 09:36:44 -0700 | [diff] [blame] | 174 | fi |
| 175 | ], |
| 176 | XSLROOT="${DEFAULT_XSLROOT}" |
Jason Evans | aee7fd2 | 2010-11-24 22:00:02 -0800 | [diff] [blame] | 177 | ) |
| 178 | AC_SUBST([XSLROOT]) |
| 179 | |
Jason Evans | f3340ca | 2009-06-30 16:17:05 -0700 | [diff] [blame] | 180 | dnl If CFLAGS isn't defined, set CFLAGS to something reasonable. Otherwise, |
| 181 | dnl just prevent autoconf from molesting CFLAGS. |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 182 | CFLAGS=$CFLAGS |
| 183 | AC_PROG_CC |
Elliot Ronaghan | aec0753 | 2016-06-14 15:26:07 -0700 | [diff] [blame] | 184 | |
Mike Hommey | fd97b1d | 2012-04-30 12:38:31 +0200 | [diff] [blame] | 185 | if test "x$GCC" != "xyes" ; then |
| 186 | AC_CACHE_CHECK([whether compiler is MSVC], |
| 187 | [je_cv_msvc], |
| 188 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], |
| 189 | [ |
| 190 | #ifndef _MSC_VER |
| 191 | int fail[-1]; |
| 192 | #endif |
| 193 | ])], |
| 194 | [je_cv_msvc=yes], |
| 195 | [je_cv_msvc=no])]) |
| 196 | fi |
| 197 | |
Elliot Ronaghan | ccd6416 | 2016-06-14 13:18:08 -0700 | [diff] [blame] | 198 | dnl check if a cray prgenv wrapper compiler is being used |
| 199 | je_cv_cray_prgenv_wrapper="" |
| 200 | if test "x${PE_ENV}" != "x" ; then |
| 201 | case "${CC}" in |
| 202 | CC|cc) |
| 203 | je_cv_cray_prgenv_wrapper="yes" |
| 204 | ;; |
| 205 | *) |
| 206 | ;; |
| 207 | esac |
| 208 | fi |
| 209 | |
Elliot Ronaghan | aec0753 | 2016-06-14 15:26:07 -0700 | [diff] [blame] | 210 | AC_CACHE_CHECK([whether compiler is cray], |
| 211 | [je_cv_cray], |
| 212 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], |
| 213 | [ |
| 214 | #ifndef _CRAYC |
| 215 | int fail[-1]; |
| 216 | #endif |
| 217 | ])], |
| 218 | [je_cv_cray=yes], |
| 219 | [je_cv_cray=no])]) |
| 220 | |
| 221 | if test "x${je_cv_cray}" = "xyes" ; then |
| 222 | AC_CACHE_CHECK([whether cray compiler version is 8.4], |
| 223 | [je_cv_cray_84], |
| 224 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], |
| 225 | [ |
| 226 | #if !(_RELEASE_MAJOR == 8 && _RELEASE_MINOR == 4) |
| 227 | int fail[-1]; |
| 228 | #endif |
| 229 | ])], |
| 230 | [je_cv_cray_84=yes], |
| 231 | [je_cv_cray_84=no])]) |
| 232 | fi |
| 233 | |
Jason Evans | 194d6f9 | 2016-12-16 07:18:55 -0800 | [diff] [blame] | 234 | if test "x$GCC" = "xyes" ; then |
| 235 | JE_CFLAGS_ADD([-std=gnu11]) |
| 236 | if test "x$je_cv_cflags_added" = "x-std=gnu11" ; then |
| 237 | AC_DEFINE_UNQUOTED([JEMALLOC_HAS_RESTRICT]) |
| 238 | else |
| 239 | JE_CFLAGS_ADD([-std=gnu99]) |
| 240 | if test "x$je_cv_cflags_added" = "x-std=gnu99" ; then |
Jason Evans | 99b0fbb | 2014-02-24 16:08:38 -0800 | [diff] [blame] | 241 | AC_DEFINE_UNQUOTED([JEMALLOC_HAS_RESTRICT]) |
| 242 | fi |
Jason Evans | cfeccd3 | 2010-03-03 15:48:20 -0800 | [diff] [blame] | 243 | fi |
Jason Evans | 194d6f9 | 2016-12-16 07:18:55 -0800 | [diff] [blame] | 244 | JE_CFLAGS_ADD([-Wall]) |
Jason Evans | 194d6f9 | 2016-12-16 07:18:55 -0800 | [diff] [blame] | 245 | JE_CFLAGS_ADD([-Wshorten-64-to-32]) |
| 246 | JE_CFLAGS_ADD([-Wsign-compare]) |
David Goldblatt | 425253e | 2017-04-21 13:47:49 -0700 | [diff] [blame] | 247 | JE_CFLAGS_ADD([-Wundef]) |
David Goldblatt | a9f7732 | 2017-07-21 13:34:45 -0700 | [diff] [blame] | 248 | JE_CFLAGS_ADD([-Wno-format-zero-length]) |
Jason Evans | 194d6f9 | 2016-12-16 07:18:55 -0800 | [diff] [blame] | 249 | JE_CFLAGS_ADD([-pipe]) |
| 250 | JE_CFLAGS_ADD([-g3]) |
| 251 | elif test "x$je_cv_msvc" = "xyes" ; then |
| 252 | CC="$CC -nologo" |
| 253 | JE_CFLAGS_ADD([-Zi]) |
| 254 | JE_CFLAGS_ADD([-MT]) |
| 255 | JE_CFLAGS_ADD([-W3]) |
| 256 | JE_CFLAGS_ADD([-FS]) |
| 257 | JE_APPEND_VS(CPPFLAGS, -I${srcdir}/include/msvc_compat) |
| 258 | fi |
| 259 | if test "x$je_cv_cray" = "xyes" ; then |
| 260 | dnl cray compiler 8.4 has an inlining bug |
| 261 | if test "x$je_cv_cray_84" = "xyes" ; then |
| 262 | JE_CFLAGS_ADD([-hipa2]) |
| 263 | JE_CFLAGS_ADD([-hnognu]) |
| 264 | fi |
Jason Evans | 0f63396 | 2017-04-24 11:47:10 -0700 | [diff] [blame] | 265 | dnl ignore unreachable code warning |
| 266 | JE_CFLAGS_ADD([-hnomessage=128]) |
| 267 | dnl ignore redefinition of "malloc", "free", etc warning |
| 268 | JE_CFLAGS_ADD([-hnomessage=1357]) |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 269 | fi |
Jason Evans | 194d6f9 | 2016-12-16 07:18:55 -0800 | [diff] [blame] | 270 | AC_SUBST([CONFIGURE_CFLAGS]) |
| 271 | AC_SUBST([SPECIFIED_CFLAGS]) |
Jason Evans | af0e28f | 2016-10-29 22:14:55 -0700 | [diff] [blame] | 272 | AC_SUBST([EXTRA_CFLAGS]) |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 273 | AC_PROG_CPP |
| 274 | |
Dave Watson | 2319152 | 2016-10-23 15:56:30 -0700 | [diff] [blame] | 275 | AC_ARG_ENABLE([cxx], |
| 276 | [AS_HELP_STRING([--disable-cxx], [Disable C++ integration])], |
| 277 | if test "x$enable_cxx" = "xno" ; then |
| 278 | enable_cxx="0" |
| 279 | else |
| 280 | enable_cxx="1" |
| 281 | fi |
| 282 | , |
| 283 | enable_cxx="1" |
| 284 | ) |
| 285 | if test "x$enable_cxx" = "x1" ; then |
Dave Watson | 2319152 | 2016-10-23 15:56:30 -0700 | [diff] [blame] | 286 | dnl Require at least c++14, which is the first version to support sized |
| 287 | dnl deallocation. C++ support is not compiled otherwise. |
| 288 | m4_include([m4/ax_cxx_compile_stdcxx.m4]) |
| 289 | AX_CXX_COMPILE_STDCXX([14], [noext], [optional]) |
| 290 | if test "x${HAVE_CXX14}" = "x1" ; then |
Jason Evans | 194d6f9 | 2016-12-16 07:18:55 -0800 | [diff] [blame] | 291 | JE_CXXFLAGS_ADD([-Wall]) |
| 292 | JE_CXXFLAGS_ADD([-g3]) |
Dave Watson | 2319152 | 2016-10-23 15:56:30 -0700 | [diff] [blame] | 293 | |
| 294 | SAVED_LIBS="${LIBS}" |
Jason Evans | 194d6f9 | 2016-12-16 07:18:55 -0800 | [diff] [blame] | 295 | JE_APPEND_VS(LIBS, -lstdc++) |
Dave Watson | 2319152 | 2016-10-23 15:56:30 -0700 | [diff] [blame] | 296 | JE_COMPILABLE([libstdc++ linkage], [ |
| 297 | #include <stdlib.h> |
| 298 | ], [[ |
| 299 | int *arr = (int *)malloc(sizeof(int) * 42); |
| 300 | if (arr == NULL) |
Jason Evans | f408643 | 2017-01-19 18:15:45 -0800 | [diff] [blame] | 301 | return 1; |
Dave Watson | 2319152 | 2016-10-23 15:56:30 -0700 | [diff] [blame] | 302 | ]], [je_cv_libstdcxx]) |
| 303 | if test "x${je_cv_libstdcxx}" = "xno" ; then |
| 304 | LIBS="${SAVED_LIBS}" |
| 305 | fi |
| 306 | else |
| 307 | enable_cxx="0" |
| 308 | fi |
| 309 | fi |
| 310 | AC_SUBST([enable_cxx]) |
Jason Evans | 194d6f9 | 2016-12-16 07:18:55 -0800 | [diff] [blame] | 311 | AC_SUBST([CONFIGURE_CXXFLAGS]) |
| 312 | AC_SUBST([SPECIFIED_CXXFLAGS]) |
Dave Watson | 2319152 | 2016-10-23 15:56:30 -0700 | [diff] [blame] | 313 | AC_SUBST([EXTRA_CXXFLAGS]) |
| 314 | |
Jason Evans | df3f270 | 2014-03-30 16:27:08 -0700 | [diff] [blame] | 315 | AC_C_BIGENDIAN([ac_cv_big_endian=1], [ac_cv_big_endian=0]) |
| 316 | if test "x${ac_cv_big_endian}" = "x1" ; then |
| 317 | AC_DEFINE_UNQUOTED([JEMALLOC_BIG_ENDIAN], [ ]) |
| 318 | fi |
| 319 | |
Mike Hommey | ff2e999 | 2014-05-29 16:33:02 +0900 | [diff] [blame] | 320 | if test "x${je_cv_msvc}" = "xyes" -a "x${ac_cv_header_inttypes_h}" = "xno"; then |
Jason Evans | 194d6f9 | 2016-12-16 07:18:55 -0800 | [diff] [blame] | 321 | JE_APPEND_VS(CPPFLAGS, -I${srcdir}/include/msvc_compat/C99) |
Mike Hommey | ff2e999 | 2014-05-29 16:33:02 +0900 | [diff] [blame] | 322 | fi |
| 323 | |
rustyx | 46e0b23 | 2016-01-30 13:37:26 +0100 | [diff] [blame] | 324 | if test "x${je_cv_msvc}" = "xyes" ; then |
| 325 | LG_SIZEOF_PTR=LG_SIZEOF_PTR_WIN |
| 326 | AC_MSG_RESULT([Using a predefined value for sizeof(void *): 4 for 32-bit, 8 for 64-bit]) |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 327 | else |
rustyx | 46e0b23 | 2016-01-30 13:37:26 +0100 | [diff] [blame] | 328 | AC_CHECK_SIZEOF([void *]) |
| 329 | if test "x${ac_cv_sizeof_void_p}" = "x8" ; then |
| 330 | LG_SIZEOF_PTR=3 |
| 331 | elif test "x${ac_cv_sizeof_void_p}" = "x4" ; then |
| 332 | LG_SIZEOF_PTR=2 |
| 333 | else |
| 334 | AC_MSG_ERROR([Unsupported pointer size: ${ac_cv_sizeof_void_p}]) |
| 335 | fi |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 336 | fi |
Jason Evans | 94ad2b5 | 2009-12-29 00:09:15 -0800 | [diff] [blame] | 337 | AC_DEFINE_UNQUOTED([LG_SIZEOF_PTR], [$LG_SIZEOF_PTR]) |
| 338 | |
| 339 | AC_CHECK_SIZEOF([int]) |
| 340 | if test "x${ac_cv_sizeof_int}" = "x8" ; then |
| 341 | LG_SIZEOF_INT=3 |
| 342 | elif test "x${ac_cv_sizeof_int}" = "x4" ; then |
| 343 | LG_SIZEOF_INT=2 |
| 344 | else |
| 345 | AC_MSG_ERROR([Unsupported int size: ${ac_cv_sizeof_int}]) |
| 346 | fi |
| 347 | AC_DEFINE_UNQUOTED([LG_SIZEOF_INT], [$LG_SIZEOF_INT]) |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 348 | |
Jason Evans | 84c8eef | 2011-03-16 10:30:13 -0700 | [diff] [blame] | 349 | AC_CHECK_SIZEOF([long]) |
| 350 | if test "x${ac_cv_sizeof_long}" = "x8" ; then |
| 351 | LG_SIZEOF_LONG=3 |
| 352 | elif test "x${ac_cv_sizeof_long}" = "x4" ; then |
| 353 | LG_SIZEOF_LONG=2 |
| 354 | else |
| 355 | AC_MSG_ERROR([Unsupported long size: ${ac_cv_sizeof_long}]) |
| 356 | fi |
| 357 | AC_DEFINE_UNQUOTED([LG_SIZEOF_LONG], [$LG_SIZEOF_LONG]) |
| 358 | |
Jason Evans | ecae123 | 2016-02-20 23:41:33 -0800 | [diff] [blame] | 359 | AC_CHECK_SIZEOF([long long]) |
| 360 | if test "x${ac_cv_sizeof_long_long}" = "x8" ; then |
| 361 | LG_SIZEOF_LONG_LONG=3 |
| 362 | elif test "x${ac_cv_sizeof_long_long}" = "x4" ; then |
| 363 | LG_SIZEOF_LONG_LONG=2 |
| 364 | else |
| 365 | AC_MSG_ERROR([Unsupported long long size: ${ac_cv_sizeof_long_long}]) |
| 366 | fi |
| 367 | AC_DEFINE_UNQUOTED([LG_SIZEOF_LONG_LONG], [$LG_SIZEOF_LONG_LONG]) |
| 368 | |
Jason Evans | d81e4bd | 2012-03-06 14:57:45 -0800 | [diff] [blame] | 369 | AC_CHECK_SIZEOF([intmax_t]) |
| 370 | if test "x${ac_cv_sizeof_intmax_t}" = "x16" ; then |
| 371 | LG_SIZEOF_INTMAX_T=4 |
| 372 | elif test "x${ac_cv_sizeof_intmax_t}" = "x8" ; then |
| 373 | LG_SIZEOF_INTMAX_T=3 |
| 374 | elif test "x${ac_cv_sizeof_intmax_t}" = "x4" ; then |
| 375 | LG_SIZEOF_INTMAX_T=2 |
| 376 | else |
Mike Hommey | 14103d3 | 2012-04-20 08:38:39 +0200 | [diff] [blame] | 377 | AC_MSG_ERROR([Unsupported intmax_t size: ${ac_cv_sizeof_intmax_t}]) |
Jason Evans | d81e4bd | 2012-03-06 14:57:45 -0800 | [diff] [blame] | 378 | fi |
| 379 | AC_DEFINE_UNQUOTED([LG_SIZEOF_INTMAX_T], [$LG_SIZEOF_INTMAX_T]) |
| 380 | |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 381 | AC_CANONICAL_HOST |
| 382 | dnl CPU-specific settings. |
| 383 | CPU_SPINWAIT="" |
| 384 | case "${host_cpu}" in |
Jason Evans | cb657e3 | 2014-02-25 11:21:41 -0800 | [diff] [blame] | 385 | i686|x86_64) |
David Goldblatt | 1245faa | 2017-10-03 18:03:02 -0700 | [diff] [blame] | 386 | HAVE_CPU_SPINWAIT=1 |
rustyx | 90c7269 | 2016-01-30 13:41:09 +0100 | [diff] [blame] | 387 | if test "x${je_cv_msvc}" = "xyes" ; then |
| 388 | AC_CACHE_VAL([je_cv_pause_msvc], |
| 389 | [JE_COMPILABLE([pause instruction MSVC], [], |
| 390 | [[_mm_pause(); return 0;]], |
| 391 | [je_cv_pause_msvc])]) |
| 392 | if test "x${je_cv_pause_msvc}" = "xyes" ; then |
| 393 | CPU_SPINWAIT='_mm_pause()' |
| 394 | fi |
| 395 | else |
| 396 | AC_CACHE_VAL([je_cv_pause], |
| 397 | [JE_COMPILABLE([pause instruction], [], |
| 398 | [[__asm__ volatile("pause"); return 0;]], |
| 399 | [je_cv_pause])]) |
| 400 | if test "x${je_cv_pause}" = "xyes" ; then |
| 401 | CPU_SPINWAIT='__asm__ volatile("pause")' |
| 402 | fi |
Jason Evans | f3340ca | 2009-06-30 16:17:05 -0700 | [diff] [blame] | 403 | fi |
Jason Evans | 80061b6 | 2013-12-09 13:21:08 -0800 | [diff] [blame] | 404 | ;; |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 405 | *) |
David Goldblatt | 1245faa | 2017-10-03 18:03:02 -0700 | [diff] [blame] | 406 | HAVE_CPU_SPINWAIT=0 |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 407 | ;; |
| 408 | esac |
David Goldblatt | 1245faa | 2017-10-03 18:03:02 -0700 | [diff] [blame] | 409 | AC_DEFINE_UNQUOTED([HAVE_CPU_SPINWAIT], [$HAVE_CPU_SPINWAIT]) |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 410 | AC_DEFINE_UNQUOTED([CPU_SPINWAIT], [$CPU_SPINWAIT]) |
| 411 | |
Jason Evans | f5cf9b1 | 2017-02-06 13:17:12 -0800 | [diff] [blame] | 412 | case "${host_cpu}" in |
| 413 | aarch64) |
| 414 | AC_MSG_CHECKING([number of significant virtual address bits]) |
| 415 | LG_VADDR=48 |
| 416 | AC_MSG_RESULT([$LG_VADDR]) |
| 417 | ;; |
| 418 | x86_64) |
| 419 | AC_CACHE_CHECK([number of significant virtual address bits], |
| 420 | [je_cv_lg_vaddr], |
| 421 | AC_RUN_IFELSE([AC_LANG_PROGRAM( |
| 422 | [[ |
| 423 | #include <stdio.h> |
| 424 | #ifdef _WIN32 |
| 425 | #include <limits.h> |
| 426 | #include <intrin.h> |
| 427 | typedef unsigned __int32 uint32_t; |
| 428 | #else |
| 429 | #include <stdint.h> |
| 430 | #endif |
| 431 | ]], [[ |
| 432 | uint32_t r[[4]]; |
| 433 | uint32_t eax_in = 0x80000008U; |
| 434 | #ifdef _WIN32 |
| 435 | __cpuid((int *)r, (int)eax_in); |
| 436 | #else |
| 437 | asm volatile ("cpuid" |
| 438 | : "=a" (r[[0]]), "=b" (r[[1]]), "=c" (r[[2]]), "=d" (r[[3]]) |
| 439 | : "a" (eax_in), "c" (0) |
| 440 | ); |
| 441 | #endif |
| 442 | uint32_t eax_out = r[[0]]; |
| 443 | uint32_t vaddr = ((eax_out & 0x0000ff00U) >> 8); |
| 444 | FILE *f = fopen("conftest.out", "w"); |
| 445 | if (f == NULL) { |
| 446 | return 1; |
| 447 | } |
Jason Evans | bda12bd | 2017-03-20 17:37:02 -0700 | [diff] [blame] | 448 | if (vaddr > (sizeof(void *) << 3)) { |
| 449 | vaddr = sizeof(void *) << 3; |
| 450 | } |
Jason Evans | f5cf9b1 | 2017-02-06 13:17:12 -0800 | [diff] [blame] | 451 | fprintf(f, "%u", vaddr); |
| 452 | fclose(f); |
| 453 | return 0; |
| 454 | ]])], |
| 455 | [je_cv_lg_vaddr=`cat conftest.out`], |
| 456 | [je_cv_lg_vaddr=error], |
| 457 | [je_cv_lg_vaddr=57])) |
| 458 | if test "x${je_cv_lg_vaddr}" != "x" ; then |
| 459 | LG_VADDR="${je_cv_lg_vaddr}" |
| 460 | fi |
| 461 | if test "x${LG_VADDR}" != "xerror" ; then |
| 462 | AC_DEFINE_UNQUOTED([LG_VADDR], [$LG_VADDR]) |
| 463 | else |
| 464 | AC_MSG_ERROR([cannot determine number of significant virtual address bits]) |
| 465 | fi |
| 466 | ;; |
| 467 | *) |
| 468 | AC_MSG_CHECKING([number of significant virtual address bits]) |
| 469 | if test "x${LG_SIZEOF_PTR}" = "x3" ; then |
| 470 | LG_VADDR=64 |
| 471 | elif test "x${LG_SIZEOF_PTR}" = "x2" ; then |
| 472 | LG_VADDR=32 |
| 473 | elif test "x${LG_SIZEOF_PTR}" = "xLG_SIZEOF_PTR_WIN" ; then |
| 474 | LG_VADDR="(1U << (LG_SIZEOF_PTR_WIN+3))" |
| 475 | else |
| 476 | AC_MSG_ERROR([Unsupported lg(pointer size): ${LG_SIZEOF_PTR}]) |
| 477 | fi |
| 478 | AC_MSG_RESULT([$LG_VADDR]) |
| 479 | ;; |
| 480 | esac |
| 481 | AC_DEFINE_UNQUOTED([LG_VADDR], [$LG_VADDR]) |
| 482 | |
Antony Dovgal | 2bd3cbc | 2011-10-13 09:33:33 +0400 | [diff] [blame] | 483 | LD_PRELOAD_VAR="LD_PRELOAD" |
Jason Evans | f576c63 | 2011-11-01 22:27:41 -0700 | [diff] [blame] | 484 | so="so" |
Mike Hommey | fd97b1d | 2012-04-30 12:38:31 +0200 | [diff] [blame] | 485 | importlib="${so}" |
Mike Hommey | 7cdea39 | 2012-04-30 12:38:27 +0200 | [diff] [blame] | 486 | o="$ac_objext" |
Mike Hommey | 5bee66d | 2012-04-16 16:30:24 +0200 | [diff] [blame] | 487 | a="a" |
Mike Hommey | 7cdea39 | 2012-04-30 12:38:27 +0200 | [diff] [blame] | 488 | exe="$ac_exeext" |
Mike Hommey | a19e87f | 2012-04-21 21:27:46 -0700 | [diff] [blame] | 489 | libprefix="lib" |
Jason Evans | c44fa92 | 2016-10-27 17:10:56 -0700 | [diff] [blame] | 490 | link_whole_archive="0" |
Mike Hommey | fa08da7 | 2012-04-16 16:30:25 +0200 | [diff] [blame] | 491 | DSO_LDFLAGS='-shared -Wl,-soname,$(@F)' |
| 492 | RPATH='-Wl,-rpath,$(1)' |
Mike Hommey | 7cdea39 | 2012-04-30 12:38:27 +0200 | [diff] [blame] | 493 | SOREV="${so}.${rev}" |
Mike Hommey | 188da7c | 2012-04-18 18:29:41 +0200 | [diff] [blame] | 494 | PIC_CFLAGS='-fPIC -DPIC' |
Mike Hommey | fd97b1d | 2012-04-30 12:38:31 +0200 | [diff] [blame] | 495 | CTARGET='-o $@' |
| 496 | LDTARGET='-o $@' |
Elliot Ronaghan | ccd6416 | 2016-06-14 13:18:08 -0700 | [diff] [blame] | 497 | TEST_LD_MODE= |
Mike Hommey | fd97b1d | 2012-04-30 12:38:31 +0200 | [diff] [blame] | 498 | EXTRA_LDFLAGS= |
Jason Evans | 80ddf49 | 2013-08-20 11:48:19 +0100 | [diff] [blame] | 499 | ARFLAGS='crus' |
| 500 | AROUT=' $@' |
Mike Hommey | 79c4bca | 2012-05-02 21:30:51 +0200 | [diff] [blame] | 501 | CC_MM=1 |
Jason Evans | 7372b15 | 2012-02-10 20:22:09 -0800 | [diff] [blame] | 502 | |
Elliot Ronaghan | ccd6416 | 2016-06-14 13:18:08 -0700 | [diff] [blame] | 503 | if test "x$je_cv_cray_prgenv_wrapper" = "xyes" ; then |
| 504 | TEST_LD_MODE='-dynamic' |
| 505 | fi |
| 506 | |
Elliot Ronaghan | 3ef6793 | 2016-06-14 15:26:29 -0700 | [diff] [blame] | 507 | if test "x${je_cv_cray}" = "xyes" ; then |
| 508 | CC_MM= |
| 509 | fi |
| 510 | |
Jory A. Pratt | ad505e0 | 2013-08-11 09:44:59 -0500 | [diff] [blame] | 511 | AN_MAKEVAR([AR], [AC_PROG_AR]) |
| 512 | AN_PROGRAM([ar], [AC_PROG_AR]) |
| 513 | AC_DEFUN([AC_PROG_AR], [AC_CHECK_TOOL(AR, ar, :)]) |
| 514 | AC_PROG_AR |
| 515 | |
Tamir Duberstein | 24766cc | 2017-07-06 15:04:17 -0400 | [diff] [blame] | 516 | AN_MAKEVAR([NM], [AC_PROG_NM]) |
| 517 | AN_PROGRAM([nm], [AC_PROG_NM]) |
| 518 | AC_DEFUN([AC_PROG_NM], [AC_CHECK_TOOL(NM, nm, :)]) |
| 519 | AC_PROG_NM |
| 520 | |
Jason Evans | 909f048 | 2017-05-04 11:20:43 -0700 | [diff] [blame] | 521 | AC_PROG_AWK |
| 522 | |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 523 | dnl Platform-specific settings. abi and RPATH can probably be determined |
| 524 | dnl programmatically, but doing so is error-prone, which makes it generally |
| 525 | dnl not worth the trouble. |
Tamir Duberstein | 96f1468 | 2017-07-06 14:50:55 -0400 | [diff] [blame] | 526 | dnl |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 527 | dnl Define cpp macros in CPPFLAGS, rather than doing AC_DEFINE(macro), since the |
| 528 | dnl definitions need to be seen before any headers are included, which is a pain |
| 529 | dnl to make happen otherwise. |
Jason Evans | b9ab04a | 2017-04-26 16:26:12 -0700 | [diff] [blame] | 530 | default_retain="0" |
Jason Evans | d059b9d | 2015-07-24 18:21:42 -0700 | [diff] [blame] | 531 | maps_coalesce="1" |
Tamir Duberstein | 24766cc | 2017-07-06 15:04:17 -0400 | [diff] [blame] | 532 | DUMP_SYMS="${NM} -a" |
Jason Evans | 909f048 | 2017-05-04 11:20:43 -0700 | [diff] [blame] | 533 | SYM_PREFIX="" |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 534 | case "${host}" in |
Valerii Hiora | 5921ba7 | 2014-05-16 16:28:20 +0300 | [diff] [blame] | 535 | *-*-darwin* | *-*-ios*) |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 536 | abi="macho" |
| 537 | RPATH="" |
Antony Dovgal | 2bd3cbc | 2011-10-13 09:33:33 +0400 | [diff] [blame] | 538 | LD_PRELOAD_VAR="DYLD_INSERT_LIBRARIES" |
Jason Evans | f576c63 | 2011-11-01 22:27:41 -0700 | [diff] [blame] | 539 | so="dylib" |
Mike Hommey | fd97b1d | 2012-04-30 12:38:31 +0200 | [diff] [blame] | 540 | importlib="${so}" |
Jason Evans | b80581d | 2012-03-23 16:17:43 -0700 | [diff] [blame] | 541 | force_tls="0" |
Jason Evans | f1f2b45 | 2015-05-01 08:57:41 -0700 | [diff] [blame] | 542 | DSO_LDFLAGS='-shared -Wl,-install_name,$(LIBDIR)/$(@F)' |
Mike Hommey | 7cdea39 | 2012-04-30 12:38:27 +0200 | [diff] [blame] | 543 | SOREV="${rev}.${so}" |
Jason Evans | 6668853 | 2013-12-03 21:49:36 -0800 | [diff] [blame] | 544 | sbrk_deprecated="1" |
Jason Evans | 909f048 | 2017-05-04 11:20:43 -0700 | [diff] [blame] | 545 | SYM_PREFIX="_" |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 546 | ;; |
| 547 | *-*-freebsd*) |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 548 | abi="elf" |
Jason Evans | c2f970c | 2016-05-05 17:45:02 -0700 | [diff] [blame] | 549 | AC_DEFINE([JEMALLOC_SYSCTL_VM_OVERCOMMIT], [ ]) |
Jason Evans | fd4fcef | 2012-03-23 17:40:58 -0700 | [diff] [blame] | 550 | force_lazy_lock="1" |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 551 | ;; |
Michael Neumann | 1aa25a3 | 2014-08-05 03:06:02 +0200 | [diff] [blame] | 552 | *-*-dragonfly*) |
Michael Neumann | 1aa25a3 | 2014-08-05 03:06:02 +0200 | [diff] [blame] | 553 | abi="elf" |
Michael Neumann | 1aa25a3 | 2014-08-05 03:06:02 +0200 | [diff] [blame] | 554 | ;; |
Sébastien Marie | b80fbcb | 2015-04-07 12:21:19 +0200 | [diff] [blame] | 555 | *-*-openbsd*) |
Sébastien Marie | b80fbcb | 2015-04-07 12:21:19 +0200 | [diff] [blame] | 556 | abi="elf" |
Sébastien Marie | b80fbcb | 2015-04-07 12:21:19 +0200 | [diff] [blame] | 557 | force_tls="0" |
| 558 | ;; |
| 559 | *-*-bitrig*) |
Sébastien Marie | 77d597e | 2015-01-25 10:18:32 +0100 | [diff] [blame] | 560 | abi="elf" |
Sébastien Marie | 77d597e | 2015-01-25 10:18:32 +0100 | [diff] [blame] | 561 | ;; |
Jason Evans | 32d69e9 | 2016-11-10 15:35:29 -0800 | [diff] [blame] | 562 | *-*-linux-android) |
| 563 | dnl syscall(2) and secure_getenv(3) are exposed by _GNU_SOURCE. |
Jason Evans | 194d6f9 | 2016-12-16 07:18:55 -0800 | [diff] [blame] | 564 | JE_APPEND_VS(CPPFLAGS, -D_GNU_SOURCE) |
Jason Evans | 32d69e9 | 2016-11-10 15:35:29 -0800 | [diff] [blame] | 565 | abi="elf" |
Qi Wang | f4f814c | 2017-10-05 16:32:28 -0700 | [diff] [blame] | 566 | AC_DEFINE([JEMALLOC_PURGE_MADVISE_DONTNEED_ZEROS], [ ]) |
Jason Evans | 32d69e9 | 2016-11-10 15:35:29 -0800 | [diff] [blame] | 567 | AC_DEFINE([JEMALLOC_HAS_ALLOCA_H]) |
| 568 | AC_DEFINE([JEMALLOC_PROC_SYS_VM_OVERCOMMIT_MEMORY], [ ]) |
Jason Evans | 32d69e9 | 2016-11-10 15:35:29 -0800 | [diff] [blame] | 569 | AC_DEFINE([JEMALLOC_THREADED_INIT], [ ]) |
David Goldblatt | d4ac758 | 2017-01-25 09:54:27 -0800 | [diff] [blame] | 570 | AC_DEFINE([JEMALLOC_C11_ATOMICS]) |
Jason Evans | 32d69e9 | 2016-11-10 15:35:29 -0800 | [diff] [blame] | 571 | force_tls="0" |
Jason Evans | 7d86c92 | 2017-04-24 09:14:31 -0700 | [diff] [blame] | 572 | if test "${LG_SIZEOF_PTR}" = "3"; then |
Jason Evans | b9ab04a | 2017-04-26 16:26:12 -0700 | [diff] [blame] | 573 | default_retain="1" |
Jason Evans | a01f993 | 2017-04-17 15:54:53 -0700 | [diff] [blame] | 574 | fi |
Jason Evans | 32d69e9 | 2016-11-10 15:35:29 -0800 | [diff] [blame] | 575 | ;; |
Faidon Liambotis | 8da69b6 | 2017-08-07 21:51:09 +0300 | [diff] [blame] | 576 | *-*-linux*) |
Jason Evans | 83ebf2f | 2016-11-02 19:50:44 -0700 | [diff] [blame] | 577 | dnl syscall(2) and secure_getenv(3) are exposed by _GNU_SOURCE. |
Jason Evans | 194d6f9 | 2016-12-16 07:18:55 -0800 | [diff] [blame] | 578 | JE_APPEND_VS(CPPFLAGS, -D_GNU_SOURCE) |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 579 | abi="elf" |
Qi Wang | f4f814c | 2017-10-05 16:32:28 -0700 | [diff] [blame] | 580 | AC_DEFINE([JEMALLOC_PURGE_MADVISE_DONTNEED_ZEROS], [ ]) |
Garrett Cooper | 13e4e24 | 2012-12-02 17:58:40 -0800 | [diff] [blame] | 581 | AC_DEFINE([JEMALLOC_HAS_ALLOCA_H]) |
Jason Evans | c2f970c | 2016-05-05 17:45:02 -0700 | [diff] [blame] | 582 | AC_DEFINE([JEMALLOC_PROC_SYS_VM_OVERCOMMIT_MEMORY], [ ]) |
Jason Evans | 02b2312 | 2012-04-05 11:06:23 -0700 | [diff] [blame] | 583 | AC_DEFINE([JEMALLOC_THREADED_INIT], [ ]) |
Jason Evans | ae93d6b | 2015-07-10 14:33:00 -0700 | [diff] [blame] | 584 | AC_DEFINE([JEMALLOC_USE_CXX_THROW], [ ]) |
Jason Evans | 7d86c92 | 2017-04-24 09:14:31 -0700 | [diff] [blame] | 585 | if test "${LG_SIZEOF_PTR}" = "3"; then |
Jason Evans | b9ab04a | 2017-04-26 16:26:12 -0700 | [diff] [blame] | 586 | default_retain="1" |
Jason Evans | a01f993 | 2017-04-17 15:54:53 -0700 | [diff] [blame] | 587 | fi |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 588 | ;; |
Faidon Liambotis | 8da69b6 | 2017-08-07 21:51:09 +0300 | [diff] [blame] | 589 | *-*-kfreebsd*) |
| 590 | dnl syscall(2) and secure_getenv(3) are exposed by _GNU_SOURCE. |
| 591 | JE_APPEND_VS(CPPFLAGS, -D_GNU_SOURCE) |
| 592 | abi="elf" |
| 593 | AC_DEFINE([JEMALLOC_HAS_ALLOCA_H]) |
| 594 | AC_DEFINE([JEMALLOC_SYSCTL_VM_OVERCOMMIT], [ ]) |
| 595 | AC_DEFINE([JEMALLOC_THREADED_INIT], [ ]) |
| 596 | AC_DEFINE([JEMALLOC_USE_CXX_THROW], [ ]) |
| 597 | ;; |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 598 | *-*-netbsd*) |
| 599 | AC_MSG_CHECKING([ABI]) |
| 600 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM( |
| 601 | [[#ifdef __ELF__ |
| 602 | /* ELF */ |
| 603 | #else |
| 604 | #error aout |
| 605 | #endif |
| 606 | ]])], |
Jason Evans | e0164bc | 2016-10-07 08:47:16 -0700 | [diff] [blame] | 607 | [abi="elf"], |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 608 | [abi="aout"]) |
| 609 | AC_MSG_RESULT([$abi]) |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 610 | ;; |
| 611 | *-*-solaris2*) |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 612 | abi="elf" |
Mike Hommey | fa08da7 | 2012-04-16 16:30:25 +0200 | [diff] [blame] | 613 | RPATH='-Wl,-R,$(1)' |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 614 | dnl Solaris needs this for sigwait(). |
Jason Evans | 194d6f9 | 2016-12-16 07:18:55 -0800 | [diff] [blame] | 615 | JE_APPEND_VS(CPPFLAGS, -D_POSIX_PTHREAD_SEMANTICS) |
| 616 | JE_APPEND_VS(LIBS, -lposix4 -lsocket -lnsl) |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 617 | ;; |
Antony Dovgal | 2bd3cbc | 2011-10-13 09:33:33 +0400 | [diff] [blame] | 618 | *-ibm-aix*) |
Jason Evans | 7d86c92 | 2017-04-24 09:14:31 -0700 | [diff] [blame] | 619 | if test "${LG_SIZEOF_PTR}" = "3"; then |
Antony Dovgal | 2bd3cbc | 2011-10-13 09:33:33 +0400 | [diff] [blame] | 620 | dnl 64bit AIX |
| 621 | LD_PRELOAD_VAR="LDR_PRELOAD64" |
| 622 | else |
| 623 | dnl 32bit AIX |
| 624 | LD_PRELOAD_VAR="LDR_PRELOAD" |
| 625 | fi |
| 626 | abi="xcoff" |
Antony Dovgal | 2bd3cbc | 2011-10-13 09:33:33 +0400 | [diff] [blame] | 627 | ;; |
Dave Rigby | 70bdee0 | 2014-09-22 15:53:16 +0100 | [diff] [blame] | 628 | *-*-mingw* | *-*-cygwin*) |
Mike Hommey | a19e87f | 2012-04-21 21:27:46 -0700 | [diff] [blame] | 629 | abi="pecoff" |
| 630 | force_tls="0" |
Jason Evans | d059b9d | 2015-07-24 18:21:42 -0700 | [diff] [blame] | 631 | maps_coalesce="0" |
Mike Hommey | a19e87f | 2012-04-21 21:27:46 -0700 | [diff] [blame] | 632 | RPATH="" |
| 633 | so="dll" |
Mike Hommey | fd97b1d | 2012-04-30 12:38:31 +0200 | [diff] [blame] | 634 | if test "x$je_cv_msvc" = "xyes" ; then |
| 635 | importlib="lib" |
| 636 | DSO_LDFLAGS="-LD" |
| 637 | EXTRA_LDFLAGS="-link -DEBUG" |
| 638 | CTARGET='-Fo$@' |
| 639 | LDTARGET='-Fe$@' |
Jory A. Pratt | ad505e0 | 2013-08-11 09:44:59 -0500 | [diff] [blame] | 640 | AR='lib' |
| 641 | ARFLAGS='-nologo -out:' |
Jason Evans | 80ddf49 | 2013-08-20 11:48:19 +0100 | [diff] [blame] | 642 | AROUT='$@' |
Mike Hommey | 79c4bca | 2012-05-02 21:30:51 +0200 | [diff] [blame] | 643 | CC_MM= |
Mike Hommey | fd97b1d | 2012-04-30 12:38:31 +0200 | [diff] [blame] | 644 | else |
| 645 | importlib="${so}" |
| 646 | DSO_LDFLAGS="-shared" |
Jason Evans | c44fa92 | 2016-10-27 17:10:56 -0700 | [diff] [blame] | 647 | link_whole_archive="1" |
Mike Hommey | fd97b1d | 2012-04-30 12:38:31 +0200 | [diff] [blame] | 648 | fi |
Tamir Duberstein | a545f18 | 2017-07-06 15:14:48 -0400 | [diff] [blame] | 649 | case "${host}" in |
| 650 | *-*-cygwin*) |
| 651 | DUMP_SYMS="dumpbin /SYMBOLS" |
| 652 | ;; |
| 653 | *) |
| 654 | ;; |
| 655 | esac |
Mike Hommey | a19e87f | 2012-04-21 21:27:46 -0700 | [diff] [blame] | 656 | a="lib" |
| 657 | libprefix="" |
Mike Hommey | 7cdea39 | 2012-04-30 12:38:27 +0200 | [diff] [blame] | 658 | SOREV="${so}" |
Mike Hommey | a19e87f | 2012-04-21 21:27:46 -0700 | [diff] [blame] | 659 | PIC_CFLAGS="" |
| 660 | ;; |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 661 | *) |
| 662 | AC_MSG_RESULT([Unsupported operating system: ${host}]) |
| 663 | abi="elf" |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 664 | ;; |
| 665 | esac |
Mike Hommey | affe009 | 2014-05-28 08:10:12 +0900 | [diff] [blame] | 666 | |
| 667 | JEMALLOC_USABLE_SIZE_CONST=const |
| 668 | AC_CHECK_HEADERS([malloc.h], [ |
| 669 | AC_MSG_CHECKING([whether malloc_usable_size definition can use const argument]) |
| 670 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM( |
| 671 | [#include <malloc.h> |
| 672 | #include <stddef.h> |
| 673 | size_t malloc_usable_size(const void *ptr); |
| 674 | ], |
| 675 | [])],[ |
| 676 | AC_MSG_RESULT([yes]) |
| 677 | ],[ |
| 678 | JEMALLOC_USABLE_SIZE_CONST= |
| 679 | AC_MSG_RESULT([no]) |
| 680 | ]) |
| 681 | ]) |
Jason Evans | 247d124 | 2012-10-09 16:20:10 -0700 | [diff] [blame] | 682 | AC_DEFINE_UNQUOTED([JEMALLOC_USABLE_SIZE_CONST], [$JEMALLOC_USABLE_SIZE_CONST]) |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 683 | AC_SUBST([abi]) |
| 684 | AC_SUBST([RPATH]) |
Antony Dovgal | 2bd3cbc | 2011-10-13 09:33:33 +0400 | [diff] [blame] | 685 | AC_SUBST([LD_PRELOAD_VAR]) |
Jason Evans | f576c63 | 2011-11-01 22:27:41 -0700 | [diff] [blame] | 686 | AC_SUBST([so]) |
Mike Hommey | fd97b1d | 2012-04-30 12:38:31 +0200 | [diff] [blame] | 687 | AC_SUBST([importlib]) |
Mike Hommey | 5bee66d | 2012-04-16 16:30:24 +0200 | [diff] [blame] | 688 | AC_SUBST([o]) |
| 689 | AC_SUBST([a]) |
| 690 | AC_SUBST([exe]) |
Mike Hommey | a19e87f | 2012-04-21 21:27:46 -0700 | [diff] [blame] | 691 | AC_SUBST([libprefix]) |
Jason Evans | c44fa92 | 2016-10-27 17:10:56 -0700 | [diff] [blame] | 692 | AC_SUBST([link_whole_archive]) |
Mike Hommey | fa08da7 | 2012-04-16 16:30:25 +0200 | [diff] [blame] | 693 | AC_SUBST([DSO_LDFLAGS]) |
Mike Hommey | fd97b1d | 2012-04-30 12:38:31 +0200 | [diff] [blame] | 694 | AC_SUBST([EXTRA_LDFLAGS]) |
Mike Hommey | 85221d5 | 2012-04-18 18:29:40 +0200 | [diff] [blame] | 695 | AC_SUBST([SOREV]) |
Mike Hommey | 188da7c | 2012-04-18 18:29:41 +0200 | [diff] [blame] | 696 | AC_SUBST([PIC_CFLAGS]) |
Mike Hommey | fd97b1d | 2012-04-30 12:38:31 +0200 | [diff] [blame] | 697 | AC_SUBST([CTARGET]) |
| 698 | AC_SUBST([LDTARGET]) |
Elliot Ronaghan | ccd6416 | 2016-06-14 13:18:08 -0700 | [diff] [blame] | 699 | AC_SUBST([TEST_LD_MODE]) |
Mike Hommey | fd97b1d | 2012-04-30 12:38:31 +0200 | [diff] [blame] | 700 | AC_SUBST([MKLIB]) |
Jason Evans | 80ddf49 | 2013-08-20 11:48:19 +0100 | [diff] [blame] | 701 | AC_SUBST([ARFLAGS]) |
| 702 | AC_SUBST([AROUT]) |
Jason Evans | 909f048 | 2017-05-04 11:20:43 -0700 | [diff] [blame] | 703 | AC_SUBST([DUMP_SYMS]) |
Mike Hommey | 79c4bca | 2012-05-02 21:30:51 +0200 | [diff] [blame] | 704 | AC_SUBST([CC_MM]) |
Mike Hommey | fd97b1d | 2012-04-30 12:38:31 +0200 | [diff] [blame] | 705 | |
Jason Evans | d76cfec | 2016-10-27 21:23:48 -0700 | [diff] [blame] | 706 | dnl Determine whether libm must be linked to use e.g. log(3). |
| 707 | AC_SEARCH_LIBS([log], [m], , [AC_MSG_ERROR([Missing math functions])]) |
| 708 | if test "x$ac_cv_search_log" != "xnone required" ; then |
| 709 | LM="$ac_cv_search_log" |
| 710 | else |
| 711 | LM= |
| 712 | fi |
| 713 | AC_SUBST(LM) |
| 714 | |
Jason Evans | fa5d245 | 2011-03-15 10:25:59 -0700 | [diff] [blame] | 715 | JE_COMPILABLE([__attribute__ syntax], |
| 716 | [static __attribute__((unused)) void foo(void){}], |
| 717 | [], |
Jason Evans | 6684cac | 2012-03-05 12:15:36 -0800 | [diff] [blame] | 718 | [je_cv_attribute]) |
| 719 | if test "x${je_cv_attribute}" = "xyes" ; then |
Jason Evans | fa5d245 | 2011-03-15 10:25:59 -0700 | [diff] [blame] | 720 | AC_DEFINE([JEMALLOC_HAVE_ATTR], [ ]) |
| 721 | if test "x${GCC}" = "xyes" -a "x${abi}" = "xelf"; then |
Jason Evans | 194d6f9 | 2016-12-16 07:18:55 -0800 | [diff] [blame] | 722 | JE_CFLAGS_ADD([-fvisibility=hidden]) |
| 723 | JE_CXXFLAGS_ADD([-fvisibility=hidden]) |
Jason Evans | fa5d245 | 2011-03-15 10:25:59 -0700 | [diff] [blame] | 724 | fi |
| 725 | fi |
Jason Evans | 3cc1f1a | 2012-04-03 22:30:05 -0700 | [diff] [blame] | 726 | dnl Check for tls_model attribute support (clang 3.0 still lacks support). |
Jason Evans | 194d6f9 | 2016-12-16 07:18:55 -0800 | [diff] [blame] | 727 | JE_CFLAGS_SAVE() |
| 728 | JE_CFLAGS_ADD([-Werror]) |
| 729 | JE_CFLAGS_ADD([-herror_on_warning]) |
Jason Evans | 3cc1f1a | 2012-04-03 22:30:05 -0700 | [diff] [blame] | 730 | JE_COMPILABLE([tls_model attribute], [], |
| 731 | [static __thread int |
Daniel Micay | f1cf3ea | 2014-09-16 04:42:33 -0400 | [diff] [blame] | 732 | __attribute__((tls_model("initial-exec"), unused)) foo; |
Jason Evans | 3cc1f1a | 2012-04-03 22:30:05 -0700 | [diff] [blame] | 733 | foo = 0;], |
| 734 | [je_cv_tls_model]) |
Jason Evans | 194d6f9 | 2016-12-16 07:18:55 -0800 | [diff] [blame] | 735 | JE_CFLAGS_RESTORE() |
Jason Evans | 3cc1f1a | 2012-04-03 22:30:05 -0700 | [diff] [blame] | 736 | if test "x${je_cv_tls_model}" = "xyes" ; then |
| 737 | AC_DEFINE([JEMALLOC_TLS_MODEL], |
| 738 | [__attribute__((tls_model("initial-exec")))]) |
| 739 | else |
| 740 | AC_DEFINE([JEMALLOC_TLS_MODEL], [ ]) |
| 741 | fi |
Jason Evans | 0b8f0bc | 2015-07-10 16:41:12 -0700 | [diff] [blame] | 742 | dnl Check for alloc_size attribute support. |
Jason Evans | 194d6f9 | 2016-12-16 07:18:55 -0800 | [diff] [blame] | 743 | JE_CFLAGS_SAVE() |
| 744 | JE_CFLAGS_ADD([-Werror]) |
| 745 | JE_CFLAGS_ADD([-herror_on_warning]) |
Jason Evans | 92d72ee | 2015-07-10 16:45:32 -0700 | [diff] [blame] | 746 | JE_COMPILABLE([alloc_size attribute], [#include <stdlib.h>], |
| 747 | [void *foo(size_t size) __attribute__((alloc_size(1)));], |
Jason Evans | 0b8f0bc | 2015-07-10 16:41:12 -0700 | [diff] [blame] | 748 | [je_cv_alloc_size]) |
Jason Evans | 194d6f9 | 2016-12-16 07:18:55 -0800 | [diff] [blame] | 749 | JE_CFLAGS_RESTORE() |
Jason Evans | 0b8f0bc | 2015-07-10 16:41:12 -0700 | [diff] [blame] | 750 | if test "x${je_cv_alloc_size}" = "xyes" ; then |
| 751 | AC_DEFINE([JEMALLOC_HAVE_ATTR_ALLOC_SIZE], [ ]) |
| 752 | fi |
Jason Evans | e42c309 | 2015-07-22 15:44:47 -0700 | [diff] [blame] | 753 | dnl Check for format(gnu_printf, ...) attribute support. |
Jason Evans | 194d6f9 | 2016-12-16 07:18:55 -0800 | [diff] [blame] | 754 | JE_CFLAGS_SAVE() |
| 755 | JE_CFLAGS_ADD([-Werror]) |
| 756 | JE_CFLAGS_ADD([-herror_on_warning]) |
Jason Evans | e42c309 | 2015-07-22 15:44:47 -0700 | [diff] [blame] | 757 | JE_COMPILABLE([format(gnu_printf, ...) attribute], [#include <stdlib.h>], |
| 758 | [void *foo(const char *format, ...) __attribute__((format(gnu_printf, 1, 2)));], |
| 759 | [je_cv_format_gnu_printf]) |
Jason Evans | 194d6f9 | 2016-12-16 07:18:55 -0800 | [diff] [blame] | 760 | JE_CFLAGS_RESTORE() |
Jason Evans | e42c309 | 2015-07-22 15:44:47 -0700 | [diff] [blame] | 761 | if test "x${je_cv_format_gnu_printf}" = "xyes" ; then |
| 762 | AC_DEFINE([JEMALLOC_HAVE_ATTR_FORMAT_GNU_PRINTF], [ ]) |
| 763 | fi |
| 764 | dnl Check for format(printf, ...) attribute support. |
Jason Evans | 194d6f9 | 2016-12-16 07:18:55 -0800 | [diff] [blame] | 765 | JE_CFLAGS_SAVE() |
| 766 | JE_CFLAGS_ADD([-Werror]) |
| 767 | JE_CFLAGS_ADD([-herror_on_warning]) |
Jason Evans | e42c309 | 2015-07-22 15:44:47 -0700 | [diff] [blame] | 768 | JE_COMPILABLE([format(printf, ...) attribute], [#include <stdlib.h>], |
| 769 | [void *foo(const char *format, ...) __attribute__((format(printf, 1, 2)));], |
| 770 | [je_cv_format_printf]) |
Jason Evans | 194d6f9 | 2016-12-16 07:18:55 -0800 | [diff] [blame] | 771 | JE_CFLAGS_RESTORE() |
Jason Evans | e42c309 | 2015-07-22 15:44:47 -0700 | [diff] [blame] | 772 | if test "x${je_cv_format_printf}" = "xyes" ; then |
| 773 | AC_DEFINE([JEMALLOC_HAVE_ATTR_FORMAT_PRINTF], [ ]) |
| 774 | fi |
Jason Evans | fa5d245 | 2011-03-15 10:25:59 -0700 | [diff] [blame] | 775 | |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 776 | dnl Support optional additions to rpath. |
| 777 | AC_ARG_WITH([rpath], |
Jason Evans | 90895cf | 2009-12-29 00:09:15 -0800 | [diff] [blame] | 778 | [AS_HELP_STRING([--with-rpath=<rpath>], [Colon-separated rpath (ELF systems only)])], |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 779 | if test "x$with_rpath" = "xno" ; then |
| 780 | RPATH_EXTRA= |
| 781 | else |
| 782 | RPATH_EXTRA="`echo $with_rpath | tr \":\" \" \"`" |
| 783 | fi, |
| 784 | RPATH_EXTRA= |
| 785 | ) |
| 786 | AC_SUBST([RPATH_EXTRA]) |
| 787 | |
| 788 | dnl Disable rules that do automatic regeneration of configure output by default. |
| 789 | AC_ARG_ENABLE([autogen], |
Jason Evans | 78d815c | 2010-01-17 14:06:20 -0800 | [diff] [blame] | 790 | [AS_HELP_STRING([--enable-autogen], [Automatically regenerate configure output])], |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 791 | if test "x$enable_autogen" = "xno" ; then |
| 792 | enable_autogen="0" |
| 793 | else |
| 794 | enable_autogen="1" |
| 795 | fi |
| 796 | , |
| 797 | enable_autogen="0" |
| 798 | ) |
| 799 | AC_SUBST([enable_autogen]) |
| 800 | |
| 801 | AC_PROG_INSTALL |
| 802 | AC_PROG_RANLIB |
Jason Evans | 7329a4f | 2013-01-22 10:53:29 -0800 | [diff] [blame] | 803 | AC_PATH_PROG([LD], [ld], [false], [$PATH]) |
| 804 | AC_PATH_PROG([AUTOCONF], [autoconf], [false], [$PATH]) |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 805 | |
Jason Evans | 0a5489e | 2012-03-01 17:19:20 -0800 | [diff] [blame] | 806 | dnl Perform no name mangling by default. |
| 807 | AC_ARG_WITH([mangling], |
| 808 | [AS_HELP_STRING([--with-mangling=<map>], [Mangle symbols in <map>])], |
| 809 | [mangling_map="$with_mangling"], [mangling_map=""]) |
Jason Evans | 0a5489e | 2012-03-01 17:19:20 -0800 | [diff] [blame] | 810 | |
Jason Evans | 90895cf | 2009-12-29 00:09:15 -0800 | [diff] [blame] | 811 | dnl Do not prefix public APIs by default. |
| 812 | AC_ARG_WITH([jemalloc_prefix], |
| 813 | [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] | 814 | [JEMALLOC_PREFIX="$with_jemalloc_prefix"], |
Mike Hommey | 7cdea39 | 2012-04-30 12:38:27 +0200 | [diff] [blame] | 815 | [if test "x$abi" != "xmacho" -a "x$abi" != "xpecoff"; then |
Jason Evans | 2dbecf1 | 2010-09-05 10:35:13 -0700 | [diff] [blame] | 816 | JEMALLOC_PREFIX="" |
| 817 | else |
| 818 | JEMALLOC_PREFIX="je_" |
| 819 | fi] |
Jason Evans | 90895cf | 2009-12-29 00:09:15 -0800 | [diff] [blame] | 820 | ) |
David Goldblatt | 425253e | 2017-04-21 13:47:49 -0700 | [diff] [blame] | 821 | if test "x$JEMALLOC_PREFIX" = "x" ; then |
| 822 | AC_DEFINE([JEMALLOC_IS_MALLOC]) |
| 823 | else |
Jason Evans | e733970 | 2010-10-23 18:37:06 -0700 | [diff] [blame] | 824 | JEMALLOC_CPREFIX=`echo ${JEMALLOC_PREFIX} | tr "a-z" "A-Z"` |
| 825 | AC_DEFINE_UNQUOTED([JEMALLOC_PREFIX], ["$JEMALLOC_PREFIX"]) |
| 826 | AC_DEFINE_UNQUOTED([JEMALLOC_CPREFIX], ["$JEMALLOC_CPREFIX"]) |
Jason Evans | 90895cf | 2009-12-29 00:09:15 -0800 | [diff] [blame] | 827 | fi |
Jason Evans | ff8062a | 2017-05-30 14:26:02 -0700 | [diff] [blame] | 828 | AC_SUBST([JEMALLOC_PREFIX]) |
Jason Evans | 241abc6 | 2015-06-23 18:47:07 -0700 | [diff] [blame] | 829 | AC_SUBST([JEMALLOC_CPREFIX]) |
Jason Evans | 90895cf | 2009-12-29 00:09:15 -0800 | [diff] [blame] | 830 | |
Mike Hommey | 9906660 | 2012-11-19 10:55:26 +0100 | [diff] [blame] | 831 | AC_ARG_WITH([export], |
| 832 | [AS_HELP_STRING([--without-export], [disable exporting jemalloc public APIs])], |
| 833 | [if test "x$with_export" = "xno"; then |
Jason Evans | 2625c89 | 2013-01-22 16:46:27 -0800 | [diff] [blame] | 834 | AC_DEFINE([JEMALLOC_EXPORT],[]) |
Mike Hommey | 9906660 | 2012-11-19 10:55:26 +0100 | [diff] [blame] | 835 | fi] |
| 836 | ) |
| 837 | |
Jason Evans | 909f048 | 2017-05-04 11:20:43 -0700 | [diff] [blame] | 838 | public_syms="aligned_alloc calloc dallocx free mallctl mallctlbymib mallctlnametomib malloc malloc_conf malloc_message malloc_stats_print malloc_usable_size mallocx nallocx posix_memalign rallocx realloc sallocx sdallocx xallocx" |
| 839 | dnl Check for additional platform-specific public API functions. |
| 840 | AC_CHECK_FUNC([memalign], |
| 841 | [AC_DEFINE([JEMALLOC_OVERRIDE_MEMALIGN], [ ]) |
| 842 | public_syms="${public_syms} memalign"]) |
| 843 | AC_CHECK_FUNC([valloc], |
| 844 | [AC_DEFINE([JEMALLOC_OVERRIDE_VALLOC], [ ]) |
| 845 | public_syms="${public_syms} valloc"]) |
| 846 | |
| 847 | dnl Check for allocator-related functions that should be wrapped. |
| 848 | wrap_syms= |
| 849 | if test "x${JEMALLOC_PREFIX}" = "x" ; then |
| 850 | AC_CHECK_FUNC([__libc_calloc], |
| 851 | [AC_DEFINE([JEMALLOC_OVERRIDE___LIBC_CALLOC], [ ]) |
| 852 | wrap_syms="${wrap_syms} __libc_calloc"]) |
| 853 | AC_CHECK_FUNC([__libc_free], |
| 854 | [AC_DEFINE([JEMALLOC_OVERRIDE___LIBC_FREE], [ ]) |
| 855 | wrap_syms="${wrap_syms} __libc_free"]) |
| 856 | AC_CHECK_FUNC([__libc_malloc], |
| 857 | [AC_DEFINE([JEMALLOC_OVERRIDE___LIBC_MALLOC], [ ]) |
| 858 | wrap_syms="${wrap_syms} __libc_malloc"]) |
| 859 | AC_CHECK_FUNC([__libc_memalign], |
| 860 | [AC_DEFINE([JEMALLOC_OVERRIDE___LIBC_MEMALIGN], [ ]) |
| 861 | wrap_syms="${wrap_syms} __libc_memalign"]) |
| 862 | AC_CHECK_FUNC([__libc_realloc], |
| 863 | [AC_DEFINE([JEMALLOC_OVERRIDE___LIBC_REALLOC], [ ]) |
| 864 | wrap_syms="${wrap_syms} __libc_realloc"]) |
| 865 | AC_CHECK_FUNC([__libc_valloc], |
| 866 | [AC_DEFINE([JEMALLOC_OVERRIDE___LIBC_VALLOC], [ ]) |
| 867 | wrap_syms="${wrap_syms} __libc_valloc"]) |
| 868 | AC_CHECK_FUNC([__posix_memalign], |
| 869 | [AC_DEFINE([JEMALLOC_OVERRIDE___POSIX_MEMALIGN], [ ]) |
| 870 | wrap_syms="${wrap_syms} __posix_memalign"]) |
| 871 | fi |
| 872 | |
| 873 | case "${host}" in |
| 874 | *-*-mingw* | *-*-cygwin*) |
| 875 | wrap_syms="${wrap_syms} tls_callback" |
| 876 | ;; |
| 877 | *) |
| 878 | ;; |
| 879 | esac |
| 880 | |
Jason Evans | 86abd0d | 2013-11-30 15:25:42 -0800 | [diff] [blame] | 881 | dnl Mangle library-private APIs. |
Jason Evans | 746e77a | 2011-07-30 16:40:52 -0700 | [diff] [blame] | 882 | AC_ARG_WITH([private_namespace], |
| 883 | [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] | 884 | [JEMALLOC_PRIVATE_NAMESPACE="${with_private_namespace}je_"], |
| 885 | [JEMALLOC_PRIVATE_NAMESPACE="je_"] |
Jason Evans | 746e77a | 2011-07-30 16:40:52 -0700 | [diff] [blame] | 886 | ) |
Jason Evans | 86abd0d | 2013-11-30 15:25:42 -0800 | [diff] [blame] | 887 | AC_DEFINE_UNQUOTED([JEMALLOC_PRIVATE_NAMESPACE], [$JEMALLOC_PRIVATE_NAMESPACE]) |
| 888 | private_namespace="$JEMALLOC_PRIVATE_NAMESPACE" |
| 889 | AC_SUBST([private_namespace]) |
Jason Evans | 746e77a | 2011-07-30 16:40:52 -0700 | [diff] [blame] | 890 | |
Jason Evans | b0fd501 | 2010-01-17 01:49:20 -0800 | [diff] [blame] | 891 | dnl Do not add suffix to installed files by default. |
| 892 | AC_ARG_WITH([install_suffix], |
| 893 | [AS_HELP_STRING([--with-install-suffix=<suffix>], [Suffix to append to all installed files])], |
| 894 | [INSTALL_SUFFIX="$with_install_suffix"], |
| 895 | [INSTALL_SUFFIX=] |
| 896 | ) |
| 897 | install_suffix="$INSTALL_SUFFIX" |
| 898 | AC_SUBST([install_suffix]) |
| 899 | |
Jason Evans | f829009 | 2016-02-07 14:23:22 -0800 | [diff] [blame] | 900 | dnl Specify default malloc_conf. |
| 901 | AC_ARG_WITH([malloc_conf], |
| 902 | [AS_HELP_STRING([--with-malloc-conf=<malloc_conf>], [config.malloc_conf options string])], |
| 903 | [JEMALLOC_CONFIG_MALLOC_CONF="$with_malloc_conf"], |
| 904 | [JEMALLOC_CONFIG_MALLOC_CONF=""] |
| 905 | ) |
| 906 | config_malloc_conf="$JEMALLOC_CONFIG_MALLOC_CONF" |
| 907 | AC_DEFINE_UNQUOTED([JEMALLOC_CONFIG_MALLOC_CONF], ["$config_malloc_conf"]) |
| 908 | |
Jason Evans | 86abd0d | 2013-11-30 15:25:42 -0800 | [diff] [blame] | 909 | dnl Substitute @je_@ in jemalloc_protos.h.in, primarily to make generation of |
| 910 | dnl jemalloc_protos_jet.h easy. |
| 911 | je_="je_" |
| 912 | AC_SUBST([je_]) |
| 913 | |
Mike Hommey | cf6032d | 2014-07-30 18:16:13 +0900 | [diff] [blame] | 914 | cfgoutputs_in="Makefile.in" |
Nick White | 913e9a8 | 2014-09-19 22:01:23 +0100 | [diff] [blame] | 915 | cfgoutputs_in="${cfgoutputs_in} jemalloc.pc.in" |
Mike Hommey | cf6032d | 2014-07-30 18:16:13 +0900 | [diff] [blame] | 916 | cfgoutputs_in="${cfgoutputs_in} doc/html.xsl.in" |
| 917 | cfgoutputs_in="${cfgoutputs_in} doc/manpages.xsl.in" |
| 918 | cfgoutputs_in="${cfgoutputs_in} doc/jemalloc.xml.in" |
| 919 | cfgoutputs_in="${cfgoutputs_in} include/jemalloc/jemalloc_macros.h.in" |
| 920 | cfgoutputs_in="${cfgoutputs_in} include/jemalloc/jemalloc_protos.h.in" |
Jason Evans | 82e88d1 | 2014-09-07 19:55:03 -0700 | [diff] [blame] | 921 | cfgoutputs_in="${cfgoutputs_in} include/jemalloc/jemalloc_typedefs.h.in" |
David Goldblatt | 743d940 | 2017-04-10 18:17:55 -0700 | [diff] [blame] | 922 | cfgoutputs_in="${cfgoutputs_in} include/jemalloc/internal/jemalloc_preamble.h.in" |
Mike Hommey | cf6032d | 2014-07-30 18:16:13 +0900 | [diff] [blame] | 923 | cfgoutputs_in="${cfgoutputs_in} test/test.sh.in" |
| 924 | cfgoutputs_in="${cfgoutputs_in} test/include/test/jemalloc_test.h.in" |
Jason Evans | b0fd501 | 2010-01-17 01:49:20 -0800 | [diff] [blame] | 925 | |
Jason Evans | aee7fd2 | 2010-11-24 22:00:02 -0800 | [diff] [blame] | 926 | cfgoutputs_out="Makefile" |
Nick White | 913e9a8 | 2014-09-19 22:01:23 +0100 | [diff] [blame] | 927 | cfgoutputs_out="${cfgoutputs_out} jemalloc.pc" |
Jason Evans | aee7fd2 | 2010-11-24 22:00:02 -0800 | [diff] [blame] | 928 | cfgoutputs_out="${cfgoutputs_out} doc/html.xsl" |
| 929 | cfgoutputs_out="${cfgoutputs_out} doc/manpages.xsl" |
Jason Evans | 86abd0d | 2013-11-30 15:25:42 -0800 | [diff] [blame] | 930 | cfgoutputs_out="${cfgoutputs_out} doc/jemalloc.xml" |
| 931 | cfgoutputs_out="${cfgoutputs_out} include/jemalloc/jemalloc_macros.h" |
| 932 | cfgoutputs_out="${cfgoutputs_out} include/jemalloc/jemalloc_protos.h" |
Jason Evans | 82e88d1 | 2014-09-07 19:55:03 -0700 | [diff] [blame] | 933 | cfgoutputs_out="${cfgoutputs_out} include/jemalloc/jemalloc_typedefs.h" |
David Goldblatt | 743d940 | 2017-04-10 18:17:55 -0700 | [diff] [blame] | 934 | cfgoutputs_out="${cfgoutputs_out} include/jemalloc/internal/jemalloc_preamble.h" |
Jason Evans | 86abd0d | 2013-11-30 15:25:42 -0800 | [diff] [blame] | 935 | cfgoutputs_out="${cfgoutputs_out} test/test.sh" |
| 936 | cfgoutputs_out="${cfgoutputs_out} test/include/test/jemalloc_test.h" |
Jason Evans | b0fd501 | 2010-01-17 01:49:20 -0800 | [diff] [blame] | 937 | |
Jason Evans | aee7fd2 | 2010-11-24 22:00:02 -0800 | [diff] [blame] | 938 | cfgoutputs_tup="Makefile" |
Nick White | 913e9a8 | 2014-09-19 22:01:23 +0100 | [diff] [blame] | 939 | cfgoutputs_tup="${cfgoutputs_tup} jemalloc.pc:jemalloc.pc.in" |
Jason Evans | aee7fd2 | 2010-11-24 22:00:02 -0800 | [diff] [blame] | 940 | cfgoutputs_tup="${cfgoutputs_tup} doc/html.xsl:doc/html.xsl.in" |
| 941 | cfgoutputs_tup="${cfgoutputs_tup} doc/manpages.xsl:doc/manpages.xsl.in" |
Jason Evans | 86abd0d | 2013-11-30 15:25:42 -0800 | [diff] [blame] | 942 | cfgoutputs_tup="${cfgoutputs_tup} doc/jemalloc.xml:doc/jemalloc.xml.in" |
| 943 | cfgoutputs_tup="${cfgoutputs_tup} include/jemalloc/jemalloc_macros.h:include/jemalloc/jemalloc_macros.h.in" |
| 944 | 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] | 945 | cfgoutputs_tup="${cfgoutputs_tup} include/jemalloc/jemalloc_typedefs.h:include/jemalloc/jemalloc_typedefs.h.in" |
David Goldblatt | 743d940 | 2017-04-10 18:17:55 -0700 | [diff] [blame] | 946 | cfgoutputs_tup="${cfgoutputs_tup} include/jemalloc/internal/jemalloc_preamble.h" |
Jason Evans | 86abd0d | 2013-11-30 15:25:42 -0800 | [diff] [blame] | 947 | cfgoutputs_tup="${cfgoutputs_tup} test/test.sh:test/test.sh.in" |
| 948 | 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] | 949 | |
Mike Hommey | cf6032d | 2014-07-30 18:16:13 +0900 | [diff] [blame] | 950 | cfghdrs_in="include/jemalloc/jemalloc_defs.h.in" |
| 951 | cfghdrs_in="${cfghdrs_in} include/jemalloc/internal/jemalloc_internal_defs.h.in" |
Jason Evans | 909f048 | 2017-05-04 11:20:43 -0700 | [diff] [blame] | 952 | cfghdrs_in="${cfghdrs_in} include/jemalloc/internal/private_symbols.sh" |
Mike Hommey | cf6032d | 2014-07-30 18:16:13 +0900 | [diff] [blame] | 953 | cfghdrs_in="${cfghdrs_in} include/jemalloc/internal/private_namespace.sh" |
Mike Hommey | cf6032d | 2014-07-30 18:16:13 +0900 | [diff] [blame] | 954 | cfghdrs_in="${cfghdrs_in} include/jemalloc/internal/public_namespace.sh" |
| 955 | cfghdrs_in="${cfghdrs_in} include/jemalloc/internal/public_unnamespace.sh" |
| 956 | cfghdrs_in="${cfghdrs_in} include/jemalloc/internal/size_classes.sh" |
| 957 | cfghdrs_in="${cfghdrs_in} include/jemalloc/jemalloc_rename.sh" |
| 958 | cfghdrs_in="${cfghdrs_in} include/jemalloc/jemalloc_mangle.sh" |
| 959 | cfghdrs_in="${cfghdrs_in} include/jemalloc/jemalloc.sh" |
| 960 | cfghdrs_in="${cfghdrs_in} test/include/test/jemalloc_test_defs.h.in" |
Jason Evans | b0fd501 | 2010-01-17 01:49:20 -0800 | [diff] [blame] | 961 | |
Jason Evans | 86abd0d | 2013-11-30 15:25:42 -0800 | [diff] [blame] | 962 | cfghdrs_out="include/jemalloc/jemalloc_defs.h" |
| 963 | cfghdrs_out="${cfghdrs_out} include/jemalloc/jemalloc${install_suffix}.h" |
Jason Evans | 909f048 | 2017-05-04 11:20:43 -0700 | [diff] [blame] | 964 | cfghdrs_out="${cfghdrs_out} include/jemalloc/internal/private_symbols.awk" |
| 965 | cfghdrs_out="${cfghdrs_out} include/jemalloc/internal/private_symbols_jet.awk" |
Jason Evans | f234dc5 | 2014-01-16 17:38:01 -0800 | [diff] [blame] | 966 | cfghdrs_out="${cfghdrs_out} include/jemalloc/internal/public_symbols.txt" |
Jason Evans | 86abd0d | 2013-11-30 15:25:42 -0800 | [diff] [blame] | 967 | cfghdrs_out="${cfghdrs_out} include/jemalloc/internal/public_namespace.h" |
| 968 | cfghdrs_out="${cfghdrs_out} include/jemalloc/internal/public_unnamespace.h" |
Jason Evans | b172610 | 2012-02-28 16:50:47 -0800 | [diff] [blame] | 969 | cfghdrs_out="${cfghdrs_out} include/jemalloc/internal/size_classes.h" |
Jason Evans | f234dc5 | 2014-01-16 17:38:01 -0800 | [diff] [blame] | 970 | cfghdrs_out="${cfghdrs_out} include/jemalloc/jemalloc_protos_jet.h" |
| 971 | cfghdrs_out="${cfghdrs_out} include/jemalloc/jemalloc_rename.h" |
| 972 | cfghdrs_out="${cfghdrs_out} include/jemalloc/jemalloc_mangle.h" |
| 973 | cfghdrs_out="${cfghdrs_out} include/jemalloc/jemalloc_mangle_jet.h" |
| 974 | cfghdrs_out="${cfghdrs_out} include/jemalloc/internal/jemalloc_internal_defs.h" |
Jason Evans | 80061b6 | 2013-12-09 13:21:08 -0800 | [diff] [blame] | 975 | cfghdrs_out="${cfghdrs_out} test/include/test/jemalloc_test_defs.h" |
Jason Evans | b0fd501 | 2010-01-17 01:49:20 -0800 | [diff] [blame] | 976 | |
Jason Evans | 86abd0d | 2013-11-30 15:25:42 -0800 | [diff] [blame] | 977 | 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] | 978 | cfghdrs_tup="${cfghdrs_tup} include/jemalloc/internal/jemalloc_internal_defs.h:include/jemalloc/internal/jemalloc_internal_defs.h.in" |
| 979 | 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] | 980 | |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 981 | dnl Do not compile with debugging by default. |
| 982 | AC_ARG_ENABLE([debug], |
Jason Evans | e0a08a1 | 2015-03-18 21:06:58 -0700 | [diff] [blame] | 983 | [AS_HELP_STRING([--enable-debug], |
Jason Evans | 3823eff | 2017-04-21 11:00:36 -0700 | [diff] [blame] | 984 | [Build debugging code])], |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 985 | [if test "x$enable_debug" = "xno" ; then |
| 986 | enable_debug="0" |
| 987 | else |
| 988 | enable_debug="1" |
| 989 | fi |
| 990 | ], |
| 991 | [enable_debug="0"] |
| 992 | ) |
Jason Evans | 02e5dcf | 2015-02-15 20:12:06 -0800 | [diff] [blame] | 993 | if test "x$enable_debug" = "x1" ; then |
| 994 | AC_DEFINE([JEMALLOC_DEBUG], [ ]) |
| 995 | fi |
Jason Evans | e0a08a1 | 2015-03-18 21:06:58 -0700 | [diff] [blame] | 996 | if test "x$enable_debug" = "x1" ; then |
| 997 | AC_DEFINE([JEMALLOC_DEBUG], [ ]) |
Jason Evans | e0a08a1 | 2015-03-18 21:06:58 -0700 | [diff] [blame] | 998 | fi |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 999 | AC_SUBST([enable_debug]) |
| 1000 | |
| 1001 | dnl Only optimize if not debugging. |
Jason Evans | 194d6f9 | 2016-12-16 07:18:55 -0800 | [diff] [blame] | 1002 | if test "x$enable_debug" = "x0" ; then |
| 1003 | if test "x$GCC" = "xyes" ; then |
| 1004 | JE_CFLAGS_ADD([-O3]) |
| 1005 | JE_CXXFLAGS_ADD([-O3]) |
| 1006 | JE_CFLAGS_ADD([-funroll-loops]) |
| 1007 | elif test "x$je_cv_msvc" = "xyes" ; then |
| 1008 | JE_CFLAGS_ADD([-O2]) |
| 1009 | JE_CXXFLAGS_ADD([-O2]) |
| 1010 | else |
| 1011 | JE_CFLAGS_ADD([-O]) |
| 1012 | JE_CXXFLAGS_ADD([-O]) |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 1013 | fi |
| 1014 | fi |
| 1015 | |
Jason Evans | d073a32 | 2012-02-28 20:41:16 -0800 | [diff] [blame] | 1016 | dnl Enable statistics calculation by default. |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 1017 | AC_ARG_ENABLE([stats], |
Jason Evans | 777c191 | 2012-02-28 20:49:22 -0800 | [diff] [blame] | 1018 | [AS_HELP_STRING([--disable-stats], |
| 1019 | [Disable statistics calculation/reporting])], |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 1020 | [if test "x$enable_stats" = "xno" ; then |
| 1021 | enable_stats="0" |
| 1022 | else |
| 1023 | enable_stats="1" |
| 1024 | fi |
| 1025 | ], |
Jason Evans | d073a32 | 2012-02-28 20:41:16 -0800 | [diff] [blame] | 1026 | [enable_stats="1"] |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 1027 | ) |
| 1028 | if test "x$enable_stats" = "x1" ; then |
| 1029 | AC_DEFINE([JEMALLOC_STATS], [ ]) |
| 1030 | fi |
| 1031 | AC_SUBST([enable_stats]) |
| 1032 | |
Jason Evans | 6109fe0 | 2010-02-10 10:37:56 -0800 | [diff] [blame] | 1033 | dnl Do not enable profiling by default. |
| 1034 | AC_ARG_ENABLE([prof], |
| 1035 | [AS_HELP_STRING([--enable-prof], [Enable allocation profiling])], |
| 1036 | [if test "x$enable_prof" = "xno" ; then |
| 1037 | enable_prof="0" |
| 1038 | else |
| 1039 | enable_prof="1" |
| 1040 | fi |
| 1041 | ], |
| 1042 | [enable_prof="0"] |
| 1043 | ) |
Jason Evans | 77f350b | 2011-03-15 22:23:12 -0700 | [diff] [blame] | 1044 | if test "x$enable_prof" = "x1" ; then |
| 1045 | backtrace_method="" |
Jason Evans | b27805b | 2010-02-10 18:15:53 -0800 | [diff] [blame] | 1046 | else |
Jason Evans | 77f350b | 2011-03-15 22:23:12 -0700 | [diff] [blame] | 1047 | backtrace_method="N/A" |
Jason Evans | b27805b | 2010-02-10 18:15:53 -0800 | [diff] [blame] | 1048 | fi |
Jason Evans | 77f350b | 2011-03-15 22:23:12 -0700 | [diff] [blame] | 1049 | |
Jason Evans | 6109fe0 | 2010-02-10 10:37:56 -0800 | [diff] [blame] | 1050 | AC_ARG_ENABLE([prof-libunwind], |
| 1051 | [AS_HELP_STRING([--enable-prof-libunwind], [Use libunwind for backtracing])], |
| 1052 | [if test "x$enable_prof_libunwind" = "xno" ; then |
| 1053 | enable_prof_libunwind="0" |
| 1054 | else |
| 1055 | enable_prof_libunwind="1" |
| 1056 | fi |
| 1057 | ], |
| 1058 | [enable_prof_libunwind="0"] |
| 1059 | ) |
Jason Evans | ca6bd4f | 2010-03-02 14:12:58 -0800 | [diff] [blame] | 1060 | AC_ARG_WITH([static_libunwind], |
| 1061 | [AS_HELP_STRING([--with-static-libunwind=<libunwind.a>], |
| 1062 | [Path to static libunwind library; use rather than dynamically linking])], |
| 1063 | if test "x$with_static_libunwind" = "xno" ; then |
| 1064 | LUNWIND="-lunwind" |
| 1065 | else |
| 1066 | if test ! -f "$with_static_libunwind" ; then |
| 1067 | AC_MSG_ERROR([Static libunwind not found: $with_static_libunwind]) |
| 1068 | fi |
| 1069 | LUNWIND="$with_static_libunwind" |
| 1070 | fi, |
| 1071 | LUNWIND="-lunwind" |
| 1072 | ) |
Jason Evans | 77f350b | 2011-03-15 22:23:12 -0700 | [diff] [blame] | 1073 | if test "x$backtrace_method" = "x" -a "x$enable_prof_libunwind" = "x1" ; then |
| 1074 | AC_CHECK_HEADERS([libunwind.h], , [enable_prof_libunwind="0"]) |
| 1075 | if test "x$LUNWIND" = "x-lunwind" ; then |
Jason Evans | 194d6f9 | 2016-12-16 07:18:55 -0800 | [diff] [blame] | 1076 | AC_CHECK_LIB([unwind], [unw_backtrace], [JE_APPEND_VS(LIBS, $LUNWIND)], |
Jason Evans | 77f350b | 2011-03-15 22:23:12 -0700 | [diff] [blame] | 1077 | [enable_prof_libunwind="0"]) |
| 1078 | else |
Jason Evans | 194d6f9 | 2016-12-16 07:18:55 -0800 | [diff] [blame] | 1079 | JE_APPEND_VS(LIBS, $LUNWIND) |
Jason Evans | 77f350b | 2011-03-15 22:23:12 -0700 | [diff] [blame] | 1080 | fi |
| 1081 | if test "x${enable_prof_libunwind}" = "x1" ; then |
| 1082 | backtrace_method="libunwind" |
| 1083 | AC_DEFINE([JEMALLOC_PROF_LIBUNWIND], [ ]) |
| 1084 | fi |
| 1085 | fi |
| 1086 | |
| 1087 | AC_ARG_ENABLE([prof-libgcc], |
| 1088 | [AS_HELP_STRING([--disable-prof-libgcc], |
| 1089 | [Do not use libgcc for backtracing])], |
| 1090 | [if test "x$enable_prof_libgcc" = "xno" ; then |
| 1091 | enable_prof_libgcc="0" |
| 1092 | else |
| 1093 | enable_prof_libgcc="1" |
| 1094 | fi |
| 1095 | ], |
| 1096 | [enable_prof_libgcc="1"] |
| 1097 | ) |
| 1098 | if test "x$backtrace_method" = "x" -a "x$enable_prof_libgcc" = "x1" \ |
| 1099 | -a "x$GCC" = "xyes" ; then |
| 1100 | AC_CHECK_HEADERS([unwind.h], , [enable_prof_libgcc="0"]) |
Jason Evans | 664ef65 | 2017-02-18 00:02:23 -0800 | [diff] [blame] | 1101 | if test "x${enable_prof_libgcc}" = "x1" ; then |
| 1102 | AC_CHECK_LIB([gcc], [_Unwind_Backtrace], [JE_APPEND_VS(LIBS, -lgcc)], [enable_prof_libgcc="0"]) |
| 1103 | fi |
Jason Evans | 77f350b | 2011-03-15 22:23:12 -0700 | [diff] [blame] | 1104 | if test "x${enable_prof_libgcc}" = "x1" ; then |
| 1105 | backtrace_method="libgcc" |
| 1106 | AC_DEFINE([JEMALLOC_PROF_LIBGCC], [ ]) |
| 1107 | fi |
| 1108 | else |
| 1109 | enable_prof_libgcc="0" |
| 1110 | fi |
| 1111 | |
| 1112 | AC_ARG_ENABLE([prof-gcc], |
| 1113 | [AS_HELP_STRING([--disable-prof-gcc], |
| 1114 | [Do not use gcc intrinsics for backtracing])], |
| 1115 | [if test "x$enable_prof_gcc" = "xno" ; then |
| 1116 | enable_prof_gcc="0" |
| 1117 | else |
| 1118 | enable_prof_gcc="1" |
| 1119 | fi |
| 1120 | ], |
| 1121 | [enable_prof_gcc="1"] |
| 1122 | ) |
| 1123 | if test "x$backtrace_method" = "x" -a "x$enable_prof_gcc" = "x1" \ |
| 1124 | -a "x$GCC" = "xyes" ; then |
Jason Evans | 194d6f9 | 2016-12-16 07:18:55 -0800 | [diff] [blame] | 1125 | JE_CFLAGS_ADD([-fno-omit-frame-pointer]) |
Jason Evans | 77f350b | 2011-03-15 22:23:12 -0700 | [diff] [blame] | 1126 | backtrace_method="gcc intrinsics" |
| 1127 | AC_DEFINE([JEMALLOC_PROF_GCC], [ ]) |
| 1128 | else |
| 1129 | enable_prof_gcc="0" |
| 1130 | fi |
| 1131 | |
| 1132 | if test "x$backtrace_method" = "x" ; then |
| 1133 | backtrace_method="none (disabling profiling)" |
| 1134 | enable_prof="0" |
| 1135 | fi |
| 1136 | AC_MSG_CHECKING([configured backtracing method]) |
| 1137 | AC_MSG_RESULT([$backtrace_method]) |
Jason Evans | 2dbecf1 | 2010-09-05 10:35:13 -0700 | [diff] [blame] | 1138 | if test "x$enable_prof" = "x1" ; then |
Jason Evans | d76cfec | 2016-10-27 21:23:48 -0700 | [diff] [blame] | 1139 | dnl Heap profiling uses the log(3) function. |
Jason Evans | 194d6f9 | 2016-12-16 07:18:55 -0800 | [diff] [blame] | 1140 | JE_APPEND_VS(LIBS, $LM) |
Jason Evans | d37d5ad | 2013-12-05 23:01:50 -0800 | [diff] [blame] | 1141 | |
Jason Evans | 2dbecf1 | 2010-09-05 10:35:13 -0700 | [diff] [blame] | 1142 | AC_DEFINE([JEMALLOC_PROF], [ ]) |
Jason Evans | 2dbecf1 | 2010-09-05 10:35:13 -0700 | [diff] [blame] | 1143 | fi |
| 1144 | AC_SUBST([enable_prof]) |
Jason Evans | 2dbecf1 | 2010-09-05 10:35:13 -0700 | [diff] [blame] | 1145 | |
Jason Evans | d059b9d | 2015-07-24 18:21:42 -0700 | [diff] [blame] | 1146 | dnl Indicate whether adjacent virtual memory mappings automatically coalesce |
| 1147 | dnl (and fragment on demand). |
| 1148 | if test "x${maps_coalesce}" = "x1" ; then |
| 1149 | AC_DEFINE([JEMALLOC_MAPS_COALESCE], [ ]) |
| 1150 | fi |
| 1151 | |
Jason Evans | c86c8f4 | 2017-04-27 15:51:35 -0700 | [diff] [blame] | 1152 | dnl Indicate whether to retain memory (rather than using munmap()) by default. |
Jason Evans | b9ab04a | 2017-04-26 16:26:12 -0700 | [diff] [blame] | 1153 | if test "x$default_retain" = "x1" ; then |
| 1154 | AC_DEFINE([JEMALLOC_RETAIN], [ ]) |
Jason Evans | 59ae276 | 2012-04-16 17:52:27 -0700 | [diff] [blame] | 1155 | fi |
Jason Evans | 59ae276 | 2012-04-16 17:52:27 -0700 | [diff] [blame] | 1156 | |
Jason Evans | 4d434ad | 2014-04-15 12:09:48 -0700 | [diff] [blame] | 1157 | dnl Enable allocation from DSS if supported by the OS. |
| 1158 | have_dss="1" |
Mike Hommey | 83c324a | 2012-04-12 10:13:03 +0200 | [diff] [blame] | 1159 | dnl Check whether the BSD/SUSv1 sbrk() exists. If not, disable DSS support. |
| 1160 | AC_CHECK_FUNC([sbrk], [have_sbrk="1"], [have_sbrk="0"]) |
| 1161 | if test "x$have_sbrk" = "x1" ; then |
Steven Stewart-Gallus | 79230fe | 2014-06-19 16:11:43 -0700 | [diff] [blame] | 1162 | if test "x$sbrk_deprecated" = "x1" ; then |
Jason Evans | 6668853 | 2013-12-03 21:49:36 -0800 | [diff] [blame] | 1163 | AC_MSG_RESULT([Disabling dss allocation because sbrk is deprecated]) |
Jason Evans | 4d434ad | 2014-04-15 12:09:48 -0700 | [diff] [blame] | 1164 | have_dss="0" |
Jason Evans | 6668853 | 2013-12-03 21:49:36 -0800 | [diff] [blame] | 1165 | fi |
Mike Hommey | 83c324a | 2012-04-12 10:13:03 +0200 | [diff] [blame] | 1166 | else |
Jason Evans | 4d434ad | 2014-04-15 12:09:48 -0700 | [diff] [blame] | 1167 | have_dss="0" |
Mike Hommey | 83c324a | 2012-04-12 10:13:03 +0200 | [diff] [blame] | 1168 | fi |
| 1169 | |
Jason Evans | 4d434ad | 2014-04-15 12:09:48 -0700 | [diff] [blame] | 1170 | if test "x$have_dss" = "x1" ; then |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 1171 | AC_DEFINE([JEMALLOC_DSS], [ ]) |
| 1172 | fi |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 1173 | |
Jason Evans | 777c191 | 2012-02-28 20:49:22 -0800 | [diff] [blame] | 1174 | dnl Support the junk/zero filling option by default. |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 1175 | AC_ARG_ENABLE([fill], |
Jason Evans | 17c021c | 2016-04-05 18:18:15 -0700 | [diff] [blame] | 1176 | [AS_HELP_STRING([--disable-fill], [Disable support for junk/zero filling])], |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 1177 | [if test "x$enable_fill" = "xno" ; then |
| 1178 | enable_fill="0" |
| 1179 | else |
| 1180 | enable_fill="1" |
| 1181 | fi |
| 1182 | ], |
Jason Evans | 777c191 | 2012-02-28 20:49:22 -0800 | [diff] [blame] | 1183 | [enable_fill="1"] |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 1184 | ) |
| 1185 | if test "x$enable_fill" = "x1" ; then |
| 1186 | AC_DEFINE([JEMALLOC_FILL], [ ]) |
| 1187 | fi |
| 1188 | AC_SUBST([enable_fill]) |
| 1189 | |
Jason Evans | b147611 | 2012-04-05 13:36:17 -0700 | [diff] [blame] | 1190 | dnl Disable utrace(2)-based tracing by default. |
| 1191 | AC_ARG_ENABLE([utrace], |
| 1192 | [AS_HELP_STRING([--enable-utrace], [Enable utrace(2)-based tracing])], |
| 1193 | [if test "x$enable_utrace" = "xno" ; then |
| 1194 | enable_utrace="0" |
| 1195 | else |
| 1196 | enable_utrace="1" |
| 1197 | fi |
| 1198 | ], |
| 1199 | [enable_utrace="0"] |
| 1200 | ) |
| 1201 | JE_COMPILABLE([utrace(2)], [ |
| 1202 | #include <sys/types.h> |
| 1203 | #include <sys/param.h> |
| 1204 | #include <sys/time.h> |
| 1205 | #include <sys/uio.h> |
| 1206 | #include <sys/ktrace.h> |
| 1207 | ], [ |
| 1208 | utrace((void *)0, 0); |
| 1209 | ], [je_cv_utrace]) |
| 1210 | if test "x${je_cv_utrace}" = "xno" ; then |
| 1211 | enable_utrace="0" |
| 1212 | fi |
| 1213 | if test "x$enable_utrace" = "x1" ; then |
| 1214 | AC_DEFINE([JEMALLOC_UTRACE], [ ]) |
| 1215 | fi |
| 1216 | AC_SUBST([enable_utrace]) |
| 1217 | |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 1218 | dnl Do not support the xmalloc option by default. |
| 1219 | AC_ARG_ENABLE([xmalloc], |
| 1220 | [AS_HELP_STRING([--enable-xmalloc], [Support xmalloc option])], |
| 1221 | [if test "x$enable_xmalloc" = "xno" ; then |
| 1222 | enable_xmalloc="0" |
| 1223 | else |
| 1224 | enable_xmalloc="1" |
| 1225 | fi |
| 1226 | ], |
| 1227 | [enable_xmalloc="0"] |
| 1228 | ) |
| 1229 | if test "x$enable_xmalloc" = "x1" ; then |
| 1230 | AC_DEFINE([JEMALLOC_XMALLOC], [ ]) |
| 1231 | fi |
| 1232 | AC_SUBST([enable_xmalloc]) |
| 1233 | |
Jason Evans | 8a03cf0 | 2015-05-04 09:58:36 -0700 | [diff] [blame] | 1234 | dnl Support cache-oblivious allocation alignment by default. |
| 1235 | AC_ARG_ENABLE([cache-oblivious], |
| 1236 | [AS_HELP_STRING([--disable-cache-oblivious], |
| 1237 | [Disable support for cache-oblivious allocation alignment])], |
| 1238 | [if test "x$enable_cache_oblivious" = "xno" ; then |
| 1239 | enable_cache_oblivious="0" |
| 1240 | else |
| 1241 | enable_cache_oblivious="1" |
| 1242 | fi |
| 1243 | ], |
| 1244 | [enable_cache_oblivious="1"] |
| 1245 | ) |
| 1246 | if test "x$enable_cache_oblivious" = "x1" ; then |
| 1247 | AC_DEFINE([JEMALLOC_CACHE_OBLIVIOUS], [ ]) |
| 1248 | fi |
| 1249 | AC_SUBST([enable_cache_oblivious]) |
| 1250 | |
David T. Goldblatt | 9761b44 | 2017-07-19 16:36:46 -0700 | [diff] [blame] | 1251 | dnl Do not log by default. |
| 1252 | AC_ARG_ENABLE([log], |
| 1253 | [AS_HELP_STRING([--enable-log], [Support debug logging])], |
| 1254 | [if test "x$enable_log" = "xno" ; then |
| 1255 | enable_log="0" |
| 1256 | else |
| 1257 | enable_log="1" |
| 1258 | fi |
| 1259 | ], |
| 1260 | [enable_log="0"] |
| 1261 | ) |
| 1262 | if test "x$enable_log" = "x1" ; then |
| 1263 | AC_DEFINE([JEMALLOC_LOG], [ ]) |
| 1264 | fi |
| 1265 | AC_SUBST([enable_log]) |
Elliot Ronaghan | 1167e9e | 2016-06-17 13:28:39 -0700 | [diff] [blame] | 1266 | |
| 1267 | |
| 1268 | JE_COMPILABLE([a program using __builtin_unreachable], [ |
| 1269 | void foo (void) { |
| 1270 | __builtin_unreachable(); |
| 1271 | } |
| 1272 | ], [ |
| 1273 | { |
| 1274 | foo(); |
| 1275 | } |
| 1276 | ], [je_cv_gcc_builtin_unreachable]) |
Elliot Ronaghan | c096ccf | 2016-07-12 15:52:18 -0700 | [diff] [blame] | 1277 | if test "x${je_cv_gcc_builtin_unreachable}" = "xyes" ; then |
Elliot Ronaghan | 1167e9e | 2016-06-17 13:28:39 -0700 | [diff] [blame] | 1278 | AC_DEFINE([JEMALLOC_INTERNAL_UNREACHABLE], [__builtin_unreachable]) |
| 1279 | else |
| 1280 | AC_DEFINE([JEMALLOC_INTERNAL_UNREACHABLE], [abort]) |
| 1281 | fi |
| 1282 | |
Mike Hommey | 8f50ec8 | 2014-06-04 12:12:55 +0900 | [diff] [blame] | 1283 | dnl ============================================================================ |
| 1284 | dnl Check for __builtin_ffsl(), then ffsl(3), and fail if neither are found. |
| 1285 | dnl One of those two functions should (theoretically) exist on all platforms |
| 1286 | dnl that jemalloc currently has a chance of functioning on without modification. |
Jason Evans | ecae123 | 2016-02-20 23:41:33 -0800 | [diff] [blame] | 1287 | dnl We additionally assume ffs[ll]() or __builtin_ffs[ll]() are defined if |
Mike Hommey | 8f50ec8 | 2014-06-04 12:12:55 +0900 | [diff] [blame] | 1288 | dnl ffsl() or __builtin_ffsl() are defined, respectively. |
| 1289 | JE_COMPILABLE([a program using __builtin_ffsl], [ |
| 1290 | #include <stdio.h> |
| 1291 | #include <strings.h> |
| 1292 | #include <string.h> |
| 1293 | ], [ |
| 1294 | { |
| 1295 | int rv = __builtin_ffsl(0x08); |
| 1296 | printf("%d\n", rv); |
| 1297 | } |
| 1298 | ], [je_cv_gcc_builtin_ffsl]) |
Steven Stewart-Gallus | 79230fe | 2014-06-19 16:11:43 -0700 | [diff] [blame] | 1299 | if test "x${je_cv_gcc_builtin_ffsl}" = "xyes" ; then |
Jason Evans | ecae123 | 2016-02-20 23:41:33 -0800 | [diff] [blame] | 1300 | AC_DEFINE([JEMALLOC_INTERNAL_FFSLL], [__builtin_ffsll]) |
Mike Hommey | 8f50ec8 | 2014-06-04 12:12:55 +0900 | [diff] [blame] | 1301 | AC_DEFINE([JEMALLOC_INTERNAL_FFSL], [__builtin_ffsl]) |
| 1302 | AC_DEFINE([JEMALLOC_INTERNAL_FFS], [__builtin_ffs]) |
| 1303 | else |
| 1304 | JE_COMPILABLE([a program using ffsl], [ |
| 1305 | #include <stdio.h> |
| 1306 | #include <strings.h> |
| 1307 | #include <string.h> |
| 1308 | ], [ |
| 1309 | { |
| 1310 | int rv = ffsl(0x08); |
| 1311 | printf("%d\n", rv); |
| 1312 | } |
| 1313 | ], [je_cv_function_ffsl]) |
Steven Stewart-Gallus | 79230fe | 2014-06-19 16:11:43 -0700 | [diff] [blame] | 1314 | if test "x${je_cv_function_ffsl}" = "xyes" ; then |
Jason Evans | ecae123 | 2016-02-20 23:41:33 -0800 | [diff] [blame] | 1315 | AC_DEFINE([JEMALLOC_INTERNAL_FFSLL], [ffsll]) |
Mike Hommey | 8f50ec8 | 2014-06-04 12:12:55 +0900 | [diff] [blame] | 1316 | AC_DEFINE([JEMALLOC_INTERNAL_FFSL], [ffsl]) |
| 1317 | AC_DEFINE([JEMALLOC_INTERNAL_FFS], [ffs]) |
| 1318 | else |
| 1319 | AC_MSG_ERROR([Cannot build without ffsl(3) or __builtin_ffsl()]) |
| 1320 | fi |
| 1321 | fi |
| 1322 | |
Jason Evans | fc0b3b7 | 2014-10-09 17:54:06 -0700 | [diff] [blame] | 1323 | AC_ARG_WITH([lg_quantum], |
| 1324 | [AS_HELP_STRING([--with-lg-quantum=<lg-quantum>], |
| 1325 | [Base 2 log of minimum allocation alignment])], |
Jason Evans | 81e5475 | 2014-10-10 22:34:25 -0700 | [diff] [blame] | 1326 | [LG_QUANTA="$with_lg_quantum"], |
| 1327 | [LG_QUANTA="3 4"]) |
| 1328 | if test "x$with_lg_quantum" != "x" ; then |
| 1329 | AC_DEFINE_UNQUOTED([LG_QUANTUM], [$with_lg_quantum]) |
| 1330 | fi |
Jason Evans | fc0b3b7 | 2014-10-09 17:54:06 -0700 | [diff] [blame] | 1331 | |
| 1332 | AC_ARG_WITH([lg_page], |
| 1333 | [AS_HELP_STRING([--with-lg-page=<lg-page>], [Base 2 log of system page size])], |
| 1334 | [LG_PAGE="$with_lg_page"], [LG_PAGE="detect"]) |
Jason Evans | b0808d5 | 2015-02-03 12:39:31 -0800 | [diff] [blame] | 1335 | if test "x$LG_PAGE" = "xdetect"; then |
Jason Evans | fc0b3b7 | 2014-10-09 17:54:06 -0700 | [diff] [blame] | 1336 | AC_CACHE_CHECK([LG_PAGE], |
| 1337 | [je_cv_lg_page], |
Jason Evans | 6684cac | 2012-03-05 12:15:36 -0800 | [diff] [blame] | 1338 | AC_RUN_IFELSE([AC_LANG_PROGRAM( |
Mike Hommey | a19e87f | 2012-04-21 21:27:46 -0700 | [diff] [blame] | 1339 | [[ |
Mike Hommey | fd97b1d | 2012-04-30 12:38:31 +0200 | [diff] [blame] | 1340 | #include <strings.h> |
Mike Hommey | a19e87f | 2012-04-21 21:27:46 -0700 | [diff] [blame] | 1341 | #ifdef _WIN32 |
| 1342 | #include <windows.h> |
| 1343 | #else |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 1344 | #include <unistd.h> |
Mike Hommey | a19e87f | 2012-04-21 21:27:46 -0700 | [diff] [blame] | 1345 | #endif |
| 1346 | #include <stdio.h> |
Jason Evans | 6684cac | 2012-03-05 12:15:36 -0800 | [diff] [blame] | 1347 | ]], |
| 1348 | [[ |
Garrett Cooper | 72c1e59 | 2012-12-02 17:57:28 -0800 | [diff] [blame] | 1349 | int result; |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 1350 | FILE *f; |
| 1351 | |
Mike Hommey | a19e87f | 2012-04-21 21:27:46 -0700 | [diff] [blame] | 1352 | #ifdef _WIN32 |
| 1353 | SYSTEM_INFO si; |
| 1354 | GetSystemInfo(&si); |
| 1355 | result = si.dwPageSize; |
| 1356 | #else |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 1357 | result = sysconf(_SC_PAGESIZE); |
Mike Hommey | a19e87f | 2012-04-21 21:27:46 -0700 | [diff] [blame] | 1358 | #endif |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 1359 | if (result == -1) { |
| 1360 | return 1; |
| 1361 | } |
Mike Hommey | 8f50ec8 | 2014-06-04 12:12:55 +0900 | [diff] [blame] | 1362 | result = JEMALLOC_INTERNAL_FFSL(result) - 1; |
Mike Hommey | a19e87f | 2012-04-21 21:27:46 -0700 | [diff] [blame] | 1363 | |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 1364 | f = fopen("conftest.out", "w"); |
| 1365 | if (f == NULL) { |
| 1366 | return 1; |
| 1367 | } |
rustyx | bc49863 | 2016-01-30 13:38:33 +0100 | [diff] [blame] | 1368 | fprintf(f, "%d", result); |
Jason Evans | 3cc1f1a | 2012-04-03 22:30:05 -0700 | [diff] [blame] | 1369 | fclose(f); |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 1370 | |
| 1371 | return 0; |
| 1372 | ]])], |
Jason Evans | fc0b3b7 | 2014-10-09 17:54:06 -0700 | [diff] [blame] | 1373 | [je_cv_lg_page=`cat conftest.out`], |
| 1374 | [je_cv_lg_page=undefined], |
| 1375 | [je_cv_lg_page=12])) |
Jason Evans | 6684cac | 2012-03-05 12:15:36 -0800 | [diff] [blame] | 1376 | fi |
Jason Evans | fc0b3b7 | 2014-10-09 17:54:06 -0700 | [diff] [blame] | 1377 | if test "x${je_cv_lg_page}" != "x" ; then |
| 1378 | LG_PAGE="${je_cv_lg_page}" |
| 1379 | fi |
| 1380 | if test "x${LG_PAGE}" != "xundefined" ; then |
| 1381 | AC_DEFINE_UNQUOTED([LG_PAGE], [$LG_PAGE]) |
| 1382 | else |
| 1383 | AC_MSG_ERROR([cannot determine value for LG_PAGE]) |
| 1384 | fi |
| 1385 | |
Jason Evans | c1baa0a | 2016-11-17 13:36:17 -0800 | [diff] [blame] | 1386 | AC_ARG_WITH([lg_hugepage], |
| 1387 | [AS_HELP_STRING([--with-lg-hugepage=<lg-hugepage>], |
charsyam | a8c9e9c | 2017-03-01 20:58:38 +0900 | [diff] [blame] | 1388 | [Base 2 log of system huge page size])], |
Jason Evans | c1baa0a | 2016-11-17 13:36:17 -0800 | [diff] [blame] | 1389 | [je_cv_lg_hugepage="${with_lg_hugepage}"], |
| 1390 | [je_cv_lg_hugepage=""]) |
| 1391 | if test "x${je_cv_lg_hugepage}" = "x" ; then |
| 1392 | dnl Look in /proc/meminfo (Linux-specific) for information on the default huge |
| 1393 | dnl page size, if any. The relevant line looks like: |
| 1394 | dnl |
| 1395 | dnl Hugepagesize: 2048 kB |
| 1396 | if test -e "/proc/meminfo" ; then |
| 1397 | hpsk=[`cat /proc/meminfo 2>/dev/null | \ |
| 1398 | grep -e '^Hugepagesize:[[:space:]]\+[0-9]\+[[:space:]]kB$' | \ |
| 1399 | awk '{print $2}'`] |
| 1400 | if test "x${hpsk}" != "x" ; then |
| 1401 | je_cv_lg_hugepage=10 |
| 1402 | while test "${hpsk}" -gt 1 ; do |
| 1403 | hpsk="$((hpsk / 2))" |
| 1404 | je_cv_lg_hugepage="$((je_cv_lg_hugepage + 1))" |
| 1405 | done |
| 1406 | fi |
| 1407 | fi |
| 1408 | |
| 1409 | dnl Set default if unable to automatically configure. |
| 1410 | if test "x${je_cv_lg_hugepage}" = "x" ; then |
| 1411 | je_cv_lg_hugepage=21 |
| 1412 | fi |
| 1413 | fi |
Jason Evans | c99e570 | 2017-06-23 12:35:17 -0700 | [diff] [blame] | 1414 | if test "x${LG_PAGE}" != "xundefined" -a \ |
| 1415 | "${je_cv_lg_hugepage}" -lt "${LG_PAGE}" ; then |
| 1416 | AC_MSG_ERROR([Huge page size (2^${je_cv_lg_hugepage}) must be at least page size (2^${LG_PAGE})]) |
| 1417 | fi |
Jason Evans | c1baa0a | 2016-11-17 13:36:17 -0800 | [diff] [blame] | 1418 | AC_DEFINE_UNQUOTED([LG_HUGEPAGE], [${je_cv_lg_hugepage}]) |
| 1419 | |
Jason Evans | fc0b3b7 | 2014-10-09 17:54:06 -0700 | [diff] [blame] | 1420 | AC_ARG_WITH([lg_page_sizes], |
| 1421 | [AS_HELP_STRING([--with-lg-page-sizes=<lg-page-sizes>], |
| 1422 | [Base 2 logs of system page sizes to support])], |
| 1423 | [LG_PAGE_SIZES="$with_lg_page_sizes"], [LG_PAGE_SIZES="$LG_PAGE"]) |
| 1424 | |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 1425 | dnl ============================================================================ |
| 1426 | dnl jemalloc configuration. |
Tamir Duberstein | 96f1468 | 2017-07-06 14:50:55 -0400 | [diff] [blame] | 1427 | dnl |
Jason Evans | a40bc7a | 2010-03-02 13:01:16 -0800 | [diff] [blame] | 1428 | |
Jason Evans | 434ea64 | 2016-03-14 20:19:11 -0700 | [diff] [blame] | 1429 | AC_ARG_WITH([version], |
| 1430 | [AS_HELP_STRING([--with-version=<major>.<minor>.<bugfix>-<nrev>-g<gid>], |
| 1431 | [Version string])], |
| 1432 | [ |
| 1433 | echo "${with_version}" | grep ['^[0-9]\+\.[0-9]\+\.[0-9]\+-[0-9]\+-g[0-9a-f]\+$'] 2>&1 1>/dev/null |
Jason Evans | 31baedb | 2017-05-03 10:07:39 -0700 | [diff] [blame] | 1434 | if test $? -eq 0 ; then |
| 1435 | echo "$with_version" > "${objroot}VERSION" |
| 1436 | else |
| 1437 | echo "${with_version}" | grep ['^VERSION$'] 2>&1 1>/dev/null |
| 1438 | if test $? -ne 0 ; then |
| 1439 | AC_MSG_ERROR([${with_version} does not match <major>.<minor>.<bugfix>-<nrev>-g<gid> or VERSION]) |
| 1440 | fi |
Jason Evans | a5a658a | 2014-09-02 15:07:07 -0700 | [diff] [blame] | 1441 | fi |
Jason Evans | 434ea64 | 2016-03-14 20:19:11 -0700 | [diff] [blame] | 1442 | ], [ |
| 1443 | dnl Set VERSION if source directory is inside a git repository. |
| 1444 | if test "x`test ! \"${srcroot}\" && cd \"${srcroot}\"; git rev-parse --is-inside-work-tree 2>/dev/null`" = "xtrue" ; then |
| 1445 | dnl Pattern globs aren't powerful enough to match both single- and |
| 1446 | dnl double-digit version numbers, so iterate over patterns to support up |
| 1447 | dnl to version 99.99.99 without any accidental matches. |
| 1448 | for pattern in ['[0-9].[0-9].[0-9]' '[0-9].[0-9].[0-9][0-9]' \ |
| 1449 | '[0-9].[0-9][0-9].[0-9]' '[0-9].[0-9][0-9].[0-9][0-9]' \ |
| 1450 | '[0-9][0-9].[0-9].[0-9]' '[0-9][0-9].[0-9].[0-9][0-9]' \ |
| 1451 | '[0-9][0-9].[0-9][0-9].[0-9]' \ |
| 1452 | '[0-9][0-9].[0-9][0-9].[0-9][0-9]']; do |
| 1453 | (test ! "${srcroot}" && cd "${srcroot}"; git describe --long --abbrev=40 --match="${pattern}") > "${objroot}VERSION.tmp" 2>/dev/null |
| 1454 | if test $? -eq 0 ; then |
| 1455 | mv "${objroot}VERSION.tmp" "${objroot}VERSION" |
| 1456 | break |
| 1457 | fi |
| 1458 | done |
| 1459 | fi |
| 1460 | rm -f "${objroot}VERSION.tmp" |
| 1461 | ]) |
| 1462 | |
Dan McGregor | f888031 | 2014-12-23 16:10:08 -0600 | [diff] [blame] | 1463 | if test ! -e "${objroot}VERSION" ; then |
| 1464 | if test ! -e "${srcroot}VERSION" ; then |
| 1465 | AC_MSG_RESULT( |
| 1466 | [Missing VERSION file, and unable to generate it; creating bogus VERSION]) |
| 1467 | echo "0.0.0-0-g0000000000000000000000000000000000000000" > "${objroot}VERSION" |
| 1468 | else |
| 1469 | cp ${srcroot}VERSION ${objroot}VERSION |
| 1470 | fi |
Jason Evans | a5a658a | 2014-09-02 15:07:07 -0700 | [diff] [blame] | 1471 | fi |
Dan McGregor | f888031 | 2014-12-23 16:10:08 -0600 | [diff] [blame] | 1472 | jemalloc_version=`cat "${objroot}VERSION"` |
Jason Evans | a40bc7a | 2010-03-02 13:01:16 -0800 | [diff] [blame] | 1473 | jemalloc_version_major=`echo ${jemalloc_version} | tr ".g-" " " | awk '{print [$]1}'` |
| 1474 | jemalloc_version_minor=`echo ${jemalloc_version} | tr ".g-" " " | awk '{print [$]2}'` |
| 1475 | jemalloc_version_bugfix=`echo ${jemalloc_version} | tr ".g-" " " | awk '{print [$]3}'` |
| 1476 | jemalloc_version_nrev=`echo ${jemalloc_version} | tr ".g-" " " | awk '{print [$]4}'` |
| 1477 | jemalloc_version_gid=`echo ${jemalloc_version} | tr ".g-" " " | awk '{print [$]5}'` |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 1478 | AC_SUBST([jemalloc_version]) |
Jason Evans | a40bc7a | 2010-03-02 13:01:16 -0800 | [diff] [blame] | 1479 | AC_SUBST([jemalloc_version_major]) |
| 1480 | AC_SUBST([jemalloc_version_minor]) |
| 1481 | AC_SUBST([jemalloc_version_bugfix]) |
| 1482 | AC_SUBST([jemalloc_version_nrev]) |
| 1483 | AC_SUBST([jemalloc_version_gid]) |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 1484 | |
| 1485 | dnl ============================================================================ |
| 1486 | dnl Configure pthreads. |
| 1487 | |
Mike Hommey | a19e87f | 2012-04-21 21:27:46 -0700 | [diff] [blame] | 1488 | if test "x$abi" != "xpecoff" ; then |
Qi Wang | b693c78 | 2017-03-17 12:42:33 -0700 | [diff] [blame] | 1489 | AC_DEFINE([JEMALLOC_HAVE_PTHREAD], [ ]) |
Mike Hommey | a19e87f | 2012-04-21 21:27:46 -0700 | [diff] [blame] | 1490 | AC_CHECK_HEADERS([pthread.h], , [AC_MSG_ERROR([pthread.h is missing])]) |
| 1491 | dnl Some systems may embed pthreads functionality in libc; check for libpthread |
| 1492 | dnl first, but try libc too before failing. |
Jason Evans | 194d6f9 | 2016-12-16 07:18:55 -0800 | [diff] [blame] | 1493 | AC_CHECK_LIB([pthread], [pthread_create], [JE_APPEND_VS(LIBS, -lpthread)], |
Mike Hommey | a19e87f | 2012-04-21 21:27:46 -0700 | [diff] [blame] | 1494 | [AC_SEARCH_LIBS([pthread_create], , , |
| 1495 | AC_MSG_ERROR([libpthread is missing]))]) |
Qi Wang | b693c78 | 2017-03-17 12:42:33 -0700 | [diff] [blame] | 1496 | wrap_syms="${wrap_syms} pthread_create" |
Jason Evans | 13685ab | 2017-06-08 22:07:21 -0700 | [diff] [blame] | 1497 | have_pthread="1" |
Qi Wang | b693c78 | 2017-03-17 12:42:33 -0700 | [diff] [blame] | 1498 | dnl Check if we have dlsym support. |
| 1499 | have_dlsym="1" |
| 1500 | AC_CHECK_HEADERS([dlfcn.h], |
| 1501 | AC_CHECK_FUNC([dlsym], [], |
| 1502 | [AC_CHECK_LIB([dl], [dlsym], [LIBS="$LIBS -ldl"], [have_dlsym="0"])]), |
| 1503 | [have_dlsym="0"]) |
| 1504 | if test "x$have_dlsym" = "x1" ; then |
| 1505 | AC_DEFINE([JEMALLOC_HAVE_DLSYM], [ ]) |
| 1506 | fi |
Jason Evans | 5234be2 | 2016-11-17 15:14:57 -0800 | [diff] [blame] | 1507 | JE_COMPILABLE([pthread_atfork(3)], [ |
| 1508 | #include <pthread.h> |
| 1509 | ], [ |
| 1510 | pthread_atfork((void *)0, (void *)0, (void *)0); |
| 1511 | ], [je_cv_pthread_atfork]) |
| 1512 | if test "x${je_cv_pthread_atfork}" = "xyes" ; then |
| 1513 | AC_DEFINE([JEMALLOC_HAVE_PTHREAD_ATFORK], [ ]) |
| 1514 | fi |
Qi Wang | a3f4977 | 2017-06-23 09:58:35 -0700 | [diff] [blame] | 1515 | dnl Check if pthread_setname_np is available with the expected API. |
| 1516 | JE_COMPILABLE([pthread_setname_np(3)], [ |
| 1517 | #include <pthread.h> |
| 1518 | ], [ |
| 1519 | pthread_setname_np(pthread_self(), "setname_test"); |
| 1520 | ], [je_cv_pthread_setname_np]) |
| 1521 | if test "x${je_cv_pthread_setname_np}" = "xyes" ; then |
| 1522 | AC_DEFINE([JEMALLOC_HAVE_PTHREAD_SETNAME_NP], [ ]) |
| 1523 | fi |
Mike Hommey | a19e87f | 2012-04-21 21:27:46 -0700 | [diff] [blame] | 1524 | fi |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 1525 | |
Jason Evans | 4a06864 | 2017-02-27 17:35:19 -0800 | [diff] [blame] | 1526 | JE_APPEND_VS(CPPFLAGS, -D_REENTRANT) |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 1527 | |
Jason Evans | c1e9cf4 | 2016-05-03 21:28:20 -0700 | [diff] [blame] | 1528 | dnl Check whether clock_gettime(2) is in libc or librt. |
| 1529 | AC_SEARCH_LIBS([clock_gettime], [rt]) |
Jason Evans | 345c1b0 | 2015-09-15 14:59:56 -0700 | [diff] [blame] | 1530 | |
Elliot Ronaghan | ae33147 | 2016-06-14 14:20:28 -0700 | [diff] [blame] | 1531 | dnl Cray wrapper compiler often adds `-lrt` when using `-static`. Check with |
| 1532 | dnl `-dynamic` as well in case a user tries to dynamically link in jemalloc |
| 1533 | if test "x$je_cv_cray_prgenv_wrapper" = "xyes" ; then |
| 1534 | if test "$ac_cv_search_clock_gettime" != "-lrt"; then |
Jason Evans | 194d6f9 | 2016-12-16 07:18:55 -0800 | [diff] [blame] | 1535 | JE_CFLAGS_SAVE() |
Elliot Ronaghan | ae33147 | 2016-06-14 14:20:28 -0700 | [diff] [blame] | 1536 | |
| 1537 | unset ac_cv_search_clock_gettime |
Jason Evans | 194d6f9 | 2016-12-16 07:18:55 -0800 | [diff] [blame] | 1538 | JE_CFLAGS_ADD([-dynamic]) |
Elliot Ronaghan | ae33147 | 2016-06-14 14:20:28 -0700 | [diff] [blame] | 1539 | AC_SEARCH_LIBS([clock_gettime], [rt]) |
| 1540 | |
Jason Evans | 194d6f9 | 2016-12-16 07:18:55 -0800 | [diff] [blame] | 1541 | JE_CFLAGS_RESTORE() |
Elliot Ronaghan | ae33147 | 2016-06-14 14:20:28 -0700 | [diff] [blame] | 1542 | fi |
| 1543 | fi |
| 1544 | |
Jason Evans | 6c80321 | 2016-10-29 22:55:08 -0700 | [diff] [blame] | 1545 | dnl check for CLOCK_MONOTONIC_COARSE (Linux-specific). |
| 1546 | JE_COMPILABLE([clock_gettime(CLOCK_MONOTONIC_COARSE, ...)], [ |
Jason Evans | e0164bc | 2016-10-07 08:47:16 -0700 | [diff] [blame] | 1547 | #include <time.h> |
| 1548 | ], [ |
| 1549 | struct timespec ts; |
| 1550 | |
Jason Evans | 6c80321 | 2016-10-29 22:55:08 -0700 | [diff] [blame] | 1551 | clock_gettime(CLOCK_MONOTONIC_COARSE, &ts); |
| 1552 | ], [je_cv_clock_monotonic_coarse]) |
| 1553 | if test "x${je_cv_clock_monotonic_coarse}" = "xyes" ; then |
| 1554 | AC_DEFINE([JEMALLOC_HAVE_CLOCK_MONOTONIC_COARSE]) |
Jason Evans | e0164bc | 2016-10-07 08:47:16 -0700 | [diff] [blame] | 1555 | fi |
| 1556 | |
| 1557 | dnl check for CLOCK_MONOTONIC. |
| 1558 | JE_COMPILABLE([clock_gettime(CLOCK_MONOTONIC, ...)], [ |
| 1559 | #include <unistd.h> |
| 1560 | #include <time.h> |
| 1561 | ], [ |
| 1562 | struct timespec ts; |
| 1563 | |
| 1564 | clock_gettime(CLOCK_MONOTONIC, &ts); |
| 1565 | #if !defined(_POSIX_MONOTONIC_CLOCK) || _POSIX_MONOTONIC_CLOCK < 0 |
| 1566 | # error _POSIX_MONOTONIC_CLOCK missing/invalid |
| 1567 | #endif |
| 1568 | ], [je_cv_clock_monotonic]) |
| 1569 | if test "x${je_cv_clock_monotonic}" = "xyes" ; then |
| 1570 | AC_DEFINE([JEMALLOC_HAVE_CLOCK_MONOTONIC]) |
| 1571 | fi |
| 1572 | |
| 1573 | dnl Check for mach_absolute_time(). |
| 1574 | JE_COMPILABLE([mach_absolute_time()], [ |
| 1575 | #include <mach/mach_time.h> |
| 1576 | ], [ |
| 1577 | mach_absolute_time(); |
| 1578 | ], [je_cv_mach_absolute_time]) |
| 1579 | if test "x${je_cv_mach_absolute_time}" = "xyes" ; then |
| 1580 | AC_DEFINE([JEMALLOC_HAVE_MACH_ABSOLUTE_TIME]) |
| 1581 | fi |
| 1582 | |
Jason Evans | acb7b1f | 2016-12-03 16:47:36 -0800 | [diff] [blame] | 1583 | dnl Use syscall(2) (if available) by default. |
| 1584 | AC_ARG_ENABLE([syscall], |
| 1585 | [AS_HELP_STRING([--disable-syscall], [Disable use of syscall(2)])], |
| 1586 | [if test "x$enable_syscall" = "xno" ; then |
| 1587 | enable_syscall="0" |
| 1588 | else |
| 1589 | enable_syscall="1" |
| 1590 | fi |
| 1591 | ], |
| 1592 | [enable_syscall="1"] |
| 1593 | ) |
| 1594 | if test "x$enable_syscall" = "x1" ; then |
| 1595 | dnl Check if syscall(2) is usable. Treat warnings as errors, so that e.g. OS |
| 1596 | dnl X 10.12's deprecation warning prevents use. |
Jason Evans | 194d6f9 | 2016-12-16 07:18:55 -0800 | [diff] [blame] | 1597 | JE_CFLAGS_SAVE() |
| 1598 | JE_CFLAGS_ADD([-Werror]) |
Jason Evans | acb7b1f | 2016-12-03 16:47:36 -0800 | [diff] [blame] | 1599 | JE_COMPILABLE([syscall(2)], [ |
Jason Evans | d82f2b3 | 2016-11-02 19:18:33 -0700 | [diff] [blame] | 1600 | #include <sys/syscall.h> |
| 1601 | #include <unistd.h> |
| 1602 | ], [ |
| 1603 | syscall(SYS_write, 2, "hello", 5); |
| 1604 | ], |
Jason Evans | acb7b1f | 2016-12-03 16:47:36 -0800 | [diff] [blame] | 1605 | [je_cv_syscall]) |
Jason Evans | 194d6f9 | 2016-12-16 07:18:55 -0800 | [diff] [blame] | 1606 | JE_CFLAGS_RESTORE() |
Jason Evans | acb7b1f | 2016-12-03 16:47:36 -0800 | [diff] [blame] | 1607 | if test "x$je_cv_syscall" = "xyes" ; then |
| 1608 | AC_DEFINE([JEMALLOC_USE_SYSCALL], [ ]) |
| 1609 | fi |
Jason Evans | d82f2b3 | 2016-11-02 19:18:33 -0700 | [diff] [blame] | 1610 | fi |
| 1611 | |
Daniel Micay | b74041f | 2014-12-09 17:41:34 -0500 | [diff] [blame] | 1612 | dnl Check if the GNU-specific secure_getenv function exists. |
| 1613 | AC_CHECK_FUNC([secure_getenv], |
| 1614 | [have_secure_getenv="1"], |
| 1615 | [have_secure_getenv="0"] |
| 1616 | ) |
| 1617 | if test "x$have_secure_getenv" = "x1" ; then |
| 1618 | AC_DEFINE([JEMALLOC_HAVE_SECURE_GETENV], [ ]) |
| 1619 | fi |
| 1620 | |
Qi Wang | ec532e2 | 2017-02-02 17:02:05 -0800 | [diff] [blame] | 1621 | dnl Check if the GNU-specific sched_getcpu function exists. |
| 1622 | AC_CHECK_FUNC([sched_getcpu], |
| 1623 | [have_sched_getcpu="1"], |
| 1624 | [have_sched_getcpu="0"] |
| 1625 | ) |
| 1626 | if test "x$have_sched_getcpu" = "x1" ; then |
| 1627 | AC_DEFINE([JEMALLOC_HAVE_SCHED_GETCPU], [ ]) |
| 1628 | fi |
| 1629 | |
Qi Wang | b693c78 | 2017-03-17 12:42:33 -0700 | [diff] [blame] | 1630 | dnl Check if the GNU-specific sched_setaffinity function exists. |
| 1631 | AC_CHECK_FUNC([sched_setaffinity], |
| 1632 | [have_sched_setaffinity="1"], |
| 1633 | [have_sched_setaffinity="0"] |
| 1634 | ) |
| 1635 | if test "x$have_sched_setaffinity" = "x1" ; then |
| 1636 | AC_DEFINE([JEMALLOC_HAVE_SCHED_SETAFFINITY], [ ]) |
| 1637 | fi |
| 1638 | |
Daniel Micay | b74041f | 2014-12-09 17:41:34 -0500 | [diff] [blame] | 1639 | dnl Check if the Solaris/BSD issetugid function exists. |
| 1640 | AC_CHECK_FUNC([issetugid], |
| 1641 | [have_issetugid="1"], |
| 1642 | [have_issetugid="0"] |
| 1643 | ) |
| 1644 | if test "x$have_issetugid" = "x1" ; then |
| 1645 | AC_DEFINE([JEMALLOC_HAVE_ISSETUGID], [ ]) |
| 1646 | fi |
| 1647 | |
Jason Evans | cd9a134 | 2012-03-21 18:33:03 -0700 | [diff] [blame] | 1648 | dnl Check whether the BSD-specific _malloc_thread_cleanup() exists. If so, use |
| 1649 | dnl it rather than pthreads TSD cleanup functions to support cleanup during |
| 1650 | dnl thread exit, in order to avoid pthreads library recursion during |
| 1651 | dnl bootstrapping. |
Jason Evans | cd9a134 | 2012-03-21 18:33:03 -0700 | [diff] [blame] | 1652 | AC_CHECK_FUNC([_malloc_thread_cleanup], |
| 1653 | [have__malloc_thread_cleanup="1"], |
| 1654 | [have__malloc_thread_cleanup="0"] |
| 1655 | ) |
| 1656 | if test "x$have__malloc_thread_cleanup" = "x1" ; then |
| 1657 | AC_DEFINE([JEMALLOC_MALLOC_THREAD_CLEANUP], [ ]) |
Jason Evans | 909f048 | 2017-05-04 11:20:43 -0700 | [diff] [blame] | 1658 | wrap_syms="${wrap_syms} _malloc_thread_cleanup" |
Jason Evans | cd9a134 | 2012-03-21 18:33:03 -0700 | [diff] [blame] | 1659 | force_tls="1" |
| 1660 | fi |
| 1661 | |
Jason Evans | 41b6afb | 2012-02-02 22:04:57 -0800 | [diff] [blame] | 1662 | dnl Check whether the BSD-specific _pthread_mutex_init_calloc_cb() exists. If |
| 1663 | dnl so, mutex initialization causes allocation, and we need to implement this |
| 1664 | dnl callback function in order to prevent recursive allocation. |
| 1665 | AC_CHECK_FUNC([_pthread_mutex_init_calloc_cb], |
| 1666 | [have__pthread_mutex_init_calloc_cb="1"], |
| 1667 | [have__pthread_mutex_init_calloc_cb="0"] |
| 1668 | ) |
| 1669 | if test "x$have__pthread_mutex_init_calloc_cb" = "x1" ; then |
| 1670 | AC_DEFINE([JEMALLOC_MUTEX_INIT_CB]) |
Jason Evans | 909f048 | 2017-05-04 11:20:43 -0700 | [diff] [blame] | 1671 | wrap_syms="${wrap_syms} _malloc_prefork _malloc_postfork" |
Jason Evans | 41b6afb | 2012-02-02 22:04:57 -0800 | [diff] [blame] | 1672 | fi |
| 1673 | |
Jason Evans | 0fee70d | 2012-02-13 12:36:11 -0800 | [diff] [blame] | 1674 | dnl Disable lazy locking by default. |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 1675 | AC_ARG_ENABLE([lazy_lock], |
Jason Evans | 0fee70d | 2012-02-13 12:36:11 -0800 | [diff] [blame] | 1676 | [AS_HELP_STRING([--enable-lazy-lock], |
| 1677 | [Enable lazy locking (only lock when multi-threaded)])], |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 1678 | [if test "x$enable_lazy_lock" = "xno" ; then |
| 1679 | enable_lazy_lock="0" |
| 1680 | else |
| 1681 | enable_lazy_lock="1" |
| 1682 | fi |
| 1683 | ], |
Mike Hommey | ac5db02 | 2015-08-11 14:01:59 +0900 | [diff] [blame] | 1684 | [enable_lazy_lock=""] |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 1685 | ) |
Jason Evans | eee1ca6 | 2016-11-02 08:54:07 -0700 | [diff] [blame] | 1686 | if test "x${enable_lazy_lock}" = "x" ; then |
| 1687 | if test "x${force_lazy_lock}" = "x1" ; then |
| 1688 | AC_MSG_RESULT([Forcing lazy-lock to avoid allocator/threading bootstrap issues]) |
| 1689 | enable_lazy_lock="1" |
| 1690 | else |
| 1691 | enable_lazy_lock="0" |
| 1692 | fi |
| 1693 | fi |
| 1694 | if test "x${enable_lazy_lock}" = "x1" -a "x${abi}" = "xpecoff" ; then |
| 1695 | AC_MSG_RESULT([Forcing no lazy-lock because thread creation monitoring is unimplemented]) |
| 1696 | enable_lazy_lock="0" |
Jason Evans | fd4fcef | 2012-03-23 17:40:58 -0700 | [diff] [blame] | 1697 | fi |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 1698 | if test "x$enable_lazy_lock" = "x1" ; then |
Qi Wang | b693c78 | 2017-03-17 12:42:33 -0700 | [diff] [blame] | 1699 | if test "x$have_dlsym" = "x1" ; then |
| 1700 | AC_DEFINE([JEMALLOC_LAZY_LOCK], [ ]) |
| 1701 | else |
| 1702 | AC_MSG_ERROR([Missing dlsym support: lazy-lock cannot be enabled.]) |
Mike Hommey | a19e87f | 2012-04-21 21:27:46 -0700 | [diff] [blame] | 1703 | fi |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 1704 | fi |
| 1705 | AC_SUBST([enable_lazy_lock]) |
| 1706 | |
Jason Evans | b2a8453 | 2017-04-21 10:07:01 -0700 | [diff] [blame] | 1707 | dnl Automatically configure TLS. |
| 1708 | if test "x${force_tls}" = "x1" ; then |
| 1709 | enable_tls="1" |
| 1710 | elif test "x${force_tls}" = "x0" ; then |
Jason Evans | 78d815c | 2010-01-17 14:06:20 -0800 | [diff] [blame] | 1711 | enable_tls="0" |
| 1712 | else |
| 1713 | enable_tls="1" |
| 1714 | fi |
Jason Evans | 78d815c | 2010-01-17 14:06:20 -0800 | [diff] [blame] | 1715 | if test "x${enable_tls}" = "x1" ; then |
| 1716 | AC_MSG_CHECKING([for TLS]) |
Jason Evans | 6684cac | 2012-03-05 12:15:36 -0800 | [diff] [blame] | 1717 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM( |
Jason Evans | 78d815c | 2010-01-17 14:06:20 -0800 | [diff] [blame] | 1718 | [[ |
| 1719 | __thread int x; |
| 1720 | ]], [[ |
| 1721 | x = 42; |
| 1722 | |
| 1723 | return 0; |
| 1724 | ]])], |
| 1725 | AC_MSG_RESULT([yes]), |
| 1726 | AC_MSG_RESULT([no]) |
| 1727 | enable_tls="0") |
Mike Hommey | ac5db02 | 2015-08-11 14:01:59 +0900 | [diff] [blame] | 1728 | else |
| 1729 | enable_tls="0" |
Jason Evans | 78d815c | 2010-01-17 14:06:20 -0800 | [diff] [blame] | 1730 | fi |
Jason Evans | b267d0f | 2010-08-13 15:42:29 -0700 | [diff] [blame] | 1731 | AC_SUBST([enable_tls]) |
Jason Evans | e24c7af | 2012-03-19 10:21:17 -0700 | [diff] [blame] | 1732 | if test "x${enable_tls}" = "x1" ; then |
| 1733 | AC_DEFINE_UNQUOTED([JEMALLOC_TLS], [ ]) |
Jason Evans | 78d815c | 2010-01-17 14:06:20 -0800 | [diff] [blame] | 1734 | fi |
| 1735 | |
Jason Evans | 2dbecf1 | 2010-09-05 10:35:13 -0700 | [diff] [blame] | 1736 | dnl ============================================================================ |
Chih-hung Hsieh | 59cd80e | 2014-12-05 17:42:41 -0800 | [diff] [blame] | 1737 | dnl Check for C11 atomics. |
| 1738 | |
| 1739 | JE_COMPILABLE([C11 atomics], [ |
| 1740 | #include <stdint.h> |
| 1741 | #if (__STDC_VERSION__ >= 201112L) && !defined(__STDC_NO_ATOMICS__) |
| 1742 | #include <stdatomic.h> |
| 1743 | #else |
| 1744 | #error Atomics not available |
| 1745 | #endif |
| 1746 | ], [ |
| 1747 | uint64_t *p = (uint64_t *)0; |
| 1748 | uint64_t x = 1; |
| 1749 | volatile atomic_uint_least64_t *a = (volatile atomic_uint_least64_t *)p; |
| 1750 | uint64_t r = atomic_fetch_add(a, x) + x; |
Jason Evans | f408643 | 2017-01-19 18:15:45 -0800 | [diff] [blame] | 1751 | return r == 0; |
David Goldblatt | d4ac758 | 2017-01-25 09:54:27 -0800 | [diff] [blame] | 1752 | ], [je_cv_c11_atomics]) |
| 1753 | if test "x${je_cv_c11_atomics}" = "xyes" ; then |
| 1754 | AC_DEFINE([JEMALLOC_C11_ATOMICS]) |
Chih-hung Hsieh | 59cd80e | 2014-12-05 17:42:41 -0800 | [diff] [blame] | 1755 | fi |
| 1756 | |
| 1757 | dnl ============================================================================ |
David Goldblatt | d4ac758 | 2017-01-25 09:54:27 -0800 | [diff] [blame] | 1758 | dnl Check for GCC-style __atomic atomics. |
Jason Evans | b57d3ec | 2012-04-17 13:17:54 -0700 | [diff] [blame] | 1759 | |
David Goldblatt | d4ac758 | 2017-01-25 09:54:27 -0800 | [diff] [blame] | 1760 | JE_COMPILABLE([GCC __atomic atomics], [ |
Jason Evans | b57d3ec | 2012-04-17 13:17:54 -0700 | [diff] [blame] | 1761 | ], [ |
David Goldblatt | d4ac758 | 2017-01-25 09:54:27 -0800 | [diff] [blame] | 1762 | int x = 0; |
| 1763 | int val = 1; |
| 1764 | int y = __atomic_fetch_add(&x, val, __ATOMIC_RELAXED); |
| 1765 | int after_add = x; |
| 1766 | return after_add == 1; |
| 1767 | ], [je_cv_gcc_atomic_atomics]) |
| 1768 | if test "x${je_cv_gcc_atomic_atomics}" = "xyes" ; then |
| 1769 | AC_DEFINE([JEMALLOC_GCC_ATOMIC_ATOMICS]) |
| 1770 | fi |
| 1771 | |
| 1772 | dnl ============================================================================ |
| 1773 | dnl Check for GCC-style __sync atomics. |
| 1774 | |
| 1775 | JE_COMPILABLE([GCC __sync atomics], [ |
| 1776 | ], [ |
| 1777 | int x = 0; |
| 1778 | int before_add = __sync_fetch_and_add(&x, 1); |
| 1779 | int after_add = x; |
| 1780 | return (before_add == 0) && (after_add == 1); |
| 1781 | ], [je_cv_gcc_sync_atomics]) |
| 1782 | if test "x${je_cv_gcc_sync_atomics}" = "xyes" ; then |
| 1783 | AC_DEFINE([JEMALLOC_GCC_SYNC_ATOMICS]) |
Jason Evans | b57d3ec | 2012-04-17 13:17:54 -0700 | [diff] [blame] | 1784 | fi |
| 1785 | |
| 1786 | dnl ============================================================================ |
Jason Evans | 763baa6 | 2011-03-18 19:10:31 -0700 | [diff] [blame] | 1787 | dnl Check for atomic(3) operations as provided on Darwin. |
David Goldblatt | d4ac758 | 2017-01-25 09:54:27 -0800 | [diff] [blame] | 1788 | dnl We need this not for the atomic operations (which are provided above), but |
| 1789 | dnl rather for the OSSpinLock type it exposes. |
Jason Evans | 763baa6 | 2011-03-18 19:10:31 -0700 | [diff] [blame] | 1790 | |
| 1791 | JE_COMPILABLE([Darwin OSAtomic*()], [ |
| 1792 | #include <libkern/OSAtomic.h> |
| 1793 | #include <inttypes.h> |
| 1794 | ], [ |
| 1795 | { |
| 1796 | int32_t x32 = 0; |
| 1797 | volatile int32_t *x32p = &x32; |
| 1798 | OSAtomicAdd32(1, x32p); |
| 1799 | } |
| 1800 | { |
| 1801 | int64_t x64 = 0; |
| 1802 | volatile int64_t *x64p = &x64; |
| 1803 | OSAtomicAdd64(1, x64p); |
| 1804 | } |
Jason Evans | 6684cac | 2012-03-05 12:15:36 -0800 | [diff] [blame] | 1805 | ], [je_cv_osatomic]) |
| 1806 | if test "x${je_cv_osatomic}" = "xyes" ; then |
Jason Evans | e24c7af | 2012-03-19 10:21:17 -0700 | [diff] [blame] | 1807 | AC_DEFINE([JEMALLOC_OSATOMIC], [ ]) |
Jason Evans | 763baa6 | 2011-03-18 19:10:31 -0700 | [diff] [blame] | 1808 | fi |
| 1809 | |
| 1810 | dnl ============================================================================ |
Richard Diamond | 994fad9 | 2014-06-03 02:39:18 -0500 | [diff] [blame] | 1811 | dnl Check for madvise(2). |
| 1812 | |
| 1813 | JE_COMPILABLE([madvise(2)], [ |
| 1814 | #include <sys/mman.h> |
| 1815 | ], [ |
Jason Evans | a64123c | 2016-11-17 10:24:51 -0800 | [diff] [blame] | 1816 | madvise((void *)0, 0, 0); |
Richard Diamond | 994fad9 | 2014-06-03 02:39:18 -0500 | [diff] [blame] | 1817 | ], [je_cv_madvise]) |
| 1818 | if test "x${je_cv_madvise}" = "xyes" ; then |
Jason Evans | c1baa0a | 2016-11-17 13:36:17 -0800 | [diff] [blame] | 1819 | AC_DEFINE([JEMALLOC_HAVE_MADVISE], [ ]) |
| 1820 | |
Jason Evans | a64123c | 2016-11-17 10:24:51 -0800 | [diff] [blame] | 1821 | dnl Check for madvise(..., MADV_FREE). |
| 1822 | JE_COMPILABLE([madvise(..., MADV_FREE)], [ |
| 1823 | #include <sys/mman.h> |
| 1824 | ], [ |
| 1825 | madvise((void *)0, 0, MADV_FREE); |
| 1826 | ], [je_cv_madv_free]) |
| 1827 | if test "x${je_cv_madv_free}" = "xyes" ; then |
| 1828 | AC_DEFINE([JEMALLOC_PURGE_MADVISE_FREE], [ ]) |
Qi Wang | 31ab38b | 2017-10-05 16:28:55 -0700 | [diff] [blame] | 1829 | elif test "x${je_cv_madvise}" = "xyes" ; then |
| 1830 | case "${host_cpu}" in i686|x86_64) |
| 1831 | case "${host}" in *-*-linux*) |
| 1832 | AC_DEFINE([JEMALLOC_PURGE_MADVISE_FREE], [ ]) |
| 1833 | AC_DEFINE([JEMALLOC_DEFINE_MADVISE_FREE], [ ]) |
| 1834 | ;; |
| 1835 | esac |
| 1836 | ;; |
| 1837 | esac |
Jason Evans | a64123c | 2016-11-17 10:24:51 -0800 | [diff] [blame] | 1838 | fi |
| 1839 | |
| 1840 | dnl Check for madvise(..., MADV_DONTNEED). |
| 1841 | JE_COMPILABLE([madvise(..., MADV_DONTNEED)], [ |
| 1842 | #include <sys/mman.h> |
| 1843 | ], [ |
| 1844 | madvise((void *)0, 0, MADV_DONTNEED); |
| 1845 | ], [je_cv_madv_dontneed]) |
| 1846 | if test "x${je_cv_madv_dontneed}" = "xyes" ; then |
| 1847 | AC_DEFINE([JEMALLOC_PURGE_MADVISE_DONTNEED], [ ]) |
| 1848 | fi |
| 1849 | |
David Goldblatt | ccd0905 | 2017-09-18 15:03:52 -0700 | [diff] [blame] | 1850 | dnl Check for madvise(..., MADV_DO[NT]DUMP). |
| 1851 | JE_COMPILABLE([madvise(..., MADV_DO[[NT]]DUMP)], [ |
| 1852 | #include <sys/mman.h> |
| 1853 | ], [ |
| 1854 | madvise((void *)0, 0, MADV_DONTDUMP); |
| 1855 | madvise((void *)0, 0, MADV_DODUMP); |
| 1856 | ], [je_cv_madv_dontdump]) |
| 1857 | if test "x${je_cv_madv_dontdump}" = "xyes" ; then |
| 1858 | AC_DEFINE([JEMALLOC_MADVISE_DONTDUMP], [ ]) |
| 1859 | fi |
| 1860 | |
Jason Evans | c1baa0a | 2016-11-17 13:36:17 -0800 | [diff] [blame] | 1861 | dnl Check for madvise(..., MADV_[NO]HUGEPAGE). |
| 1862 | JE_COMPILABLE([madvise(..., MADV_[[NO]]HUGEPAGE)], [ |
| 1863 | #include <sys/mman.h> |
| 1864 | ], [ |
| 1865 | madvise((void *)0, 0, MADV_HUGEPAGE); |
| 1866 | madvise((void *)0, 0, MADV_NOHUGEPAGE); |
| 1867 | ], [je_cv_thp]) |
marxin | 433c2ed | 2018-01-02 10:29:19 +0100 | [diff] [blame] | 1868 | case "${host_cpu}" in |
| 1869 | arm*) |
| 1870 | ;; |
| 1871 | *) |
Qi Wang | 8fdd9a5 | 2017-08-10 13:14:26 -0700 | [diff] [blame] | 1872 | if test "x${je_cv_thp}" = "xyes" ; then |
| 1873 | AC_DEFINE([JEMALLOC_HAVE_MADVISE_HUGE], [ ]) |
| 1874 | fi |
marxin | 433c2ed | 2018-01-02 10:29:19 +0100 | [diff] [blame] | 1875 | ;; |
| 1876 | esac |
Richard Diamond | 994fad9 | 2014-06-03 02:39:18 -0500 | [diff] [blame] | 1877 | fi |
| 1878 | |
Jason Evans | c606a87 | 2017-05-30 09:54:49 -0700 | [diff] [blame] | 1879 | dnl Enable transparent huge page support by default. |
| 1880 | AC_ARG_ENABLE([thp], |
| 1881 | [AS_HELP_STRING([--disable-thp], |
| 1882 | [Disable transparent huge page support])], |
| 1883 | [if test "x$enable_thp" = "xno" -o "x${je_cv_thp}" != "xyes" ; then |
| 1884 | enable_thp="0" |
| 1885 | else |
| 1886 | enable_thp="1" |
| 1887 | fi |
| 1888 | ], |
| 1889 | [if test "x${je_cv_thp}" = "xyes" ; then |
| 1890 | enable_thp="1" |
| 1891 | else |
| 1892 | enable_thp="0" |
| 1893 | fi |
| 1894 | ]) |
| 1895 | if test "x$enable_thp" = "x1" ; then |
| 1896 | AC_DEFINE([JEMALLOC_THP], [ ]) |
| 1897 | fi |
| 1898 | AC_SUBST([enable_thp]) |
| 1899 | |
Richard Diamond | 994fad9 | 2014-06-03 02:39:18 -0500 | [diff] [blame] | 1900 | dnl ============================================================================ |
Mike Hommey | c1e567b | 2012-03-26 17:03:41 +0200 | [diff] [blame] | 1901 | dnl Check whether __sync_{add,sub}_and_fetch() are available despite |
| 1902 | dnl __GCC_HAVE_SYNC_COMPARE_AND_SWAP_n macros being undefined. |
| 1903 | |
| 1904 | AC_DEFUN([JE_SYNC_COMPARE_AND_SWAP_CHECK],[ |
| 1905 | AC_CACHE_CHECK([whether to force $1-bit __sync_{add,sub}_and_fetch()], |
| 1906 | [je_cv_sync_compare_and_swap_$2], |
Mike Hommey | 2cfe6d6 | 2012-03-27 15:03:07 +0200 | [diff] [blame] | 1907 | [AC_LINK_IFELSE([AC_LANG_PROGRAM([ |
| 1908 | #include <stdint.h> |
| 1909 | ], |
| 1910 | [ |
| 1911 | #ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_$2 |
| 1912 | { |
| 1913 | uint$1_t x$1 = 0; |
| 1914 | __sync_add_and_fetch(&x$1, 42); |
| 1915 | __sync_sub_and_fetch(&x$1, 1); |
| 1916 | } |
| 1917 | #else |
| 1918 | #error __GCC_HAVE_SYNC_COMPARE_AND_SWAP_$2 is defined, no need to force |
| 1919 | #endif |
| 1920 | ])], |
Mike Hommey | c1e567b | 2012-03-26 17:03:41 +0200 | [diff] [blame] | 1921 | [je_cv_sync_compare_and_swap_$2=yes], |
| 1922 | [je_cv_sync_compare_and_swap_$2=no])]) |
| 1923 | |
| 1924 | if test "x${je_cv_sync_compare_and_swap_$2}" = "xyes" ; then |
| 1925 | AC_DEFINE([JE_FORCE_SYNC_COMPARE_AND_SWAP_$2], [ ]) |
| 1926 | fi |
| 1927 | ]) |
| 1928 | |
Jason Evans | b57d3ec | 2012-04-17 13:17:54 -0700 | [diff] [blame] | 1929 | 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] | 1930 | JE_SYNC_COMPARE_AND_SWAP_CHECK(32, 4) |
| 1931 | JE_SYNC_COMPARE_AND_SWAP_CHECK(64, 8) |
| 1932 | fi |
| 1933 | |
| 1934 | dnl ============================================================================ |
Jason Evans | d04047c | 2014-05-28 16:11:55 -0700 | [diff] [blame] | 1935 | dnl Check for __builtin_clz() and __builtin_clzl(). |
| 1936 | |
| 1937 | AC_CACHE_CHECK([for __builtin_clz], |
| 1938 | [je_cv_builtin_clz], |
| 1939 | [AC_LINK_IFELSE([AC_LANG_PROGRAM([], |
| 1940 | [ |
| 1941 | { |
| 1942 | unsigned x = 0; |
| 1943 | int y = __builtin_clz(x); |
| 1944 | } |
| 1945 | { |
| 1946 | unsigned long x = 0; |
| 1947 | int y = __builtin_clzl(x); |
| 1948 | } |
| 1949 | ])], |
| 1950 | [je_cv_builtin_clz=yes], |
| 1951 | [je_cv_builtin_clz=no])]) |
| 1952 | |
| 1953 | if test "x${je_cv_builtin_clz}" = "xyes" ; then |
| 1954 | AC_DEFINE([JEMALLOC_HAVE_BUILTIN_CLZ], [ ]) |
| 1955 | fi |
| 1956 | |
| 1957 | dnl ============================================================================ |
Jason Evans | 795f668 | 2016-11-02 18:09:45 -0700 | [diff] [blame] | 1958 | dnl Check for os_unfair_lock operations as provided on Darwin. |
| 1959 | |
Jason Evans | 4066b4e | 2016-11-16 10:40:00 -0800 | [diff] [blame] | 1960 | JE_COMPILABLE([Darwin os_unfair_lock_*()], [ |
Jason Evans | 795f668 | 2016-11-02 18:09:45 -0700 | [diff] [blame] | 1961 | #include <os/lock.h> |
John Szakmeister | eb29d7e | 2016-11-23 15:32:35 -0500 | [diff] [blame] | 1962 | #include <AvailabilityMacros.h> |
Jason Evans | 795f668 | 2016-11-02 18:09:45 -0700 | [diff] [blame] | 1963 | ], [ |
John Szakmeister | eb29d7e | 2016-11-23 15:32:35 -0500 | [diff] [blame] | 1964 | #if MAC_OS_X_VERSION_MIN_REQUIRED < 101200 |
| 1965 | #error "os_unfair_lock is not supported" |
| 1966 | #else |
Jason Evans | 795f668 | 2016-11-02 18:09:45 -0700 | [diff] [blame] | 1967 | os_unfair_lock lock = OS_UNFAIR_LOCK_INIT; |
| 1968 | os_unfair_lock_lock(&lock); |
| 1969 | os_unfair_lock_unlock(&lock); |
John Szakmeister | eb29d7e | 2016-11-23 15:32:35 -0500 | [diff] [blame] | 1970 | #endif |
Jason Evans | 795f668 | 2016-11-02 18:09:45 -0700 | [diff] [blame] | 1971 | ], [je_cv_os_unfair_lock]) |
| 1972 | if test "x${je_cv_os_unfair_lock}" = "xyes" ; then |
| 1973 | AC_DEFINE([JEMALLOC_OS_UNFAIR_LOCK], [ ]) |
| 1974 | fi |
| 1975 | |
| 1976 | dnl ============================================================================ |
Jason Evans | 893a0ed | 2011-03-18 19:30:18 -0700 | [diff] [blame] | 1977 | dnl Check for spinlock(3) operations as provided on Darwin. |
| 1978 | |
| 1979 | JE_COMPILABLE([Darwin OSSpin*()], [ |
| 1980 | #include <libkern/OSAtomic.h> |
| 1981 | #include <inttypes.h> |
| 1982 | ], [ |
| 1983 | OSSpinLock lock = 0; |
| 1984 | OSSpinLockLock(&lock); |
| 1985 | OSSpinLockUnlock(&lock); |
Jason Evans | 6684cac | 2012-03-05 12:15:36 -0800 | [diff] [blame] | 1986 | ], [je_cv_osspin]) |
| 1987 | if test "x${je_cv_osspin}" = "xyes" ; then |
Jason Evans | e24c7af | 2012-03-19 10:21:17 -0700 | [diff] [blame] | 1988 | AC_DEFINE([JEMALLOC_OSSPIN], [ ]) |
Jason Evans | 893a0ed | 2011-03-18 19:30:18 -0700 | [diff] [blame] | 1989 | fi |
| 1990 | |
| 1991 | dnl ============================================================================ |
Jason Evans | 2dbecf1 | 2010-09-05 10:35:13 -0700 | [diff] [blame] | 1992 | dnl Darwin-related configuration. |
Jason Evans | 78d815c | 2010-01-17 14:06:20 -0800 | [diff] [blame] | 1993 | |
Mike Hommey | d0357f7 | 2012-11-26 18:52:41 +0100 | [diff] [blame] | 1994 | AC_ARG_ENABLE([zone-allocator], |
| 1995 | [AS_HELP_STRING([--disable-zone-allocator], |
| 1996 | [Disable zone allocator for Darwin])], |
| 1997 | [if test "x$enable_zone_allocator" = "xno" ; then |
| 1998 | enable_zone_allocator="0" |
| 1999 | else |
| 2000 | enable_zone_allocator="1" |
| 2001 | fi |
| 2002 | ], |
| 2003 | [if test "x${abi}" = "xmacho"; then |
| 2004 | enable_zone_allocator="1" |
| 2005 | fi |
| 2006 | ] |
| 2007 | ) |
| 2008 | AC_SUBST([enable_zone_allocator]) |
| 2009 | |
| 2010 | if test "x${enable_zone_allocator}" = "x1" ; then |
| 2011 | if test "x${abi}" != "xmacho"; then |
| 2012 | AC_MSG_ERROR([--enable-zone-allocator is only supported on Darwin]) |
| 2013 | fi |
Jason Evans | e24c7af | 2012-03-19 10:21:17 -0700 | [diff] [blame] | 2014 | AC_DEFINE([JEMALLOC_ZONE], [ ]) |
Jason Evans | b27805b | 2010-02-10 18:15:53 -0800 | [diff] [blame] | 2015 | fi |
| 2016 | |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 2017 | dnl ============================================================================ |
Jason Evans | 13685ab | 2017-06-08 22:07:21 -0700 | [diff] [blame] | 2018 | dnl Enable background threads if possible. |
| 2019 | |
| 2020 | if test "x${have_pthread}" = "x1" -a "x${have_dlsym}" = "x1" \ |
| 2021 | -a "x${je_cv_os_unfair_lock}" != "xyes" \ |
| 2022 | -a "x${je_cv_osspin}" != "xyes" ; then |
| 2023 | AC_DEFINE([JEMALLOC_BACKGROUND_THREAD]) |
| 2024 | fi |
| 2025 | |
| 2026 | dnl ============================================================================ |
Sara Golemon | 3e24afa | 2014-08-18 13:06:39 -0700 | [diff] [blame] | 2027 | dnl Check for glibc malloc hooks |
| 2028 | |
| 2029 | JE_COMPILABLE([glibc malloc hook], [ |
| 2030 | #include <stddef.h> |
| 2031 | |
| 2032 | extern void (* __free_hook)(void *ptr); |
| 2033 | extern void *(* __malloc_hook)(size_t size); |
| 2034 | extern void *(* __realloc_hook)(void *ptr, size_t size); |
| 2035 | ], [ |
| 2036 | void *ptr = 0L; |
| 2037 | if (__malloc_hook) ptr = __malloc_hook(1); |
| 2038 | if (__realloc_hook) ptr = __realloc_hook(ptr, 2); |
| 2039 | if (__free_hook && ptr) __free_hook(ptr); |
| 2040 | ], [je_cv_glibc_malloc_hook]) |
| 2041 | if test "x${je_cv_glibc_malloc_hook}" = "xyes" ; then |
Jason Evans | 909f048 | 2017-05-04 11:20:43 -0700 | [diff] [blame] | 2042 | if test "x${JEMALLOC_PREFIX}" = "x" ; then |
| 2043 | AC_DEFINE([JEMALLOC_GLIBC_MALLOC_HOOK], [ ]) |
| 2044 | wrap_syms="${wrap_syms} __free_hook __malloc_hook __realloc_hook" |
| 2045 | fi |
Sara Golemon | 3e24afa | 2014-08-18 13:06:39 -0700 | [diff] [blame] | 2046 | fi |
| 2047 | |
| 2048 | JE_COMPILABLE([glibc memalign hook], [ |
| 2049 | #include <stddef.h> |
| 2050 | |
| 2051 | extern void *(* __memalign_hook)(size_t alignment, size_t size); |
| 2052 | ], [ |
| 2053 | void *ptr = 0L; |
| 2054 | if (__memalign_hook) ptr = __memalign_hook(16, 7); |
| 2055 | ], [je_cv_glibc_memalign_hook]) |
| 2056 | if test "x${je_cv_glibc_memalign_hook}" = "xyes" ; then |
Jason Evans | 909f048 | 2017-05-04 11:20:43 -0700 | [diff] [blame] | 2057 | if test "x${JEMALLOC_PREFIX}" = "x" ; then |
| 2058 | AC_DEFINE([JEMALLOC_GLIBC_MEMALIGN_HOOK], [ ]) |
| 2059 | wrap_syms="${wrap_syms} __memalign_hook" |
| 2060 | fi |
Sara Golemon | 3e24afa | 2014-08-18 13:06:39 -0700 | [diff] [blame] | 2061 | fi |
| 2062 | |
Eric Wong | 4dcf04b | 2014-08-31 03:57:06 +0000 | [diff] [blame] | 2063 | JE_COMPILABLE([pthreads adaptive mutexes], [ |
| 2064 | #include <pthread.h> |
| 2065 | ], [ |
| 2066 | pthread_mutexattr_t attr; |
| 2067 | pthread_mutexattr_init(&attr); |
| 2068 | pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ADAPTIVE_NP); |
| 2069 | pthread_mutexattr_destroy(&attr); |
| 2070 | ], [je_cv_pthread_mutex_adaptive_np]) |
| 2071 | if test "x${je_cv_pthread_mutex_adaptive_np}" = "xyes" ; then |
| 2072 | AC_DEFINE([JEMALLOC_HAVE_PTHREAD_MUTEX_ADAPTIVE_NP], [ ]) |
| 2073 | fi |
| 2074 | |
Christopher Ferris | f78d4ca | 2017-09-22 12:24:50 -0700 | [diff] [blame^] | 2075 | JE_CFLAGS_SAVE() |
| 2076 | JE_CFLAGS_ADD([-D_GNU_SOURCE]) |
| 2077 | JE_CFLAGS_ADD([-Werror]) |
| 2078 | JE_CFLAGS_ADD([-herror_on_warning]) |
| 2079 | JE_COMPILABLE([strerror_r returns char with gnu source], [ |
| 2080 | #include <errno.h> |
| 2081 | #include <stdio.h> |
| 2082 | #include <stdlib.h> |
| 2083 | #include <string.h> |
| 2084 | ], [ |
| 2085 | char *buffer = (char *) malloc(100); |
| 2086 | char *error = strerror_r(EINVAL, buffer, 100); |
| 2087 | printf("%s\n", error); |
| 2088 | ], [je_cv_strerror_r_returns_char_with_gnu_source]) |
| 2089 | JE_CFLAGS_RESTORE() |
| 2090 | if test "x${je_cv_strerror_r_returns_char_with_gnu_source}" = "xyes" ; then |
| 2091 | AC_DEFINE([JEMALLOC_STRERROR_R_RETURNS_CHAR_WITH_GNU_SOURCE], [ ]) |
| 2092 | fi |
| 2093 | |
Sara Golemon | 3e24afa | 2014-08-18 13:06:39 -0700 | [diff] [blame] | 2094 | dnl ============================================================================ |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 2095 | dnl Check for typedefs, structures, and compiler characteristics. |
| 2096 | AC_HEADER_STDBOOL |
| 2097 | |
Jason Evans | 748dfac | 2013-12-06 18:27:33 -0800 | [diff] [blame] | 2098 | dnl ============================================================================ |
| 2099 | dnl Define commands that generate output files. |
| 2100 | |
Jason Evans | f234dc5 | 2014-01-16 17:38:01 -0800 | [diff] [blame] | 2101 | AC_CONFIG_COMMANDS([include/jemalloc/internal/public_symbols.txt], [ |
| 2102 | f="${objroot}include/jemalloc/internal/public_symbols.txt" |
| 2103 | mkdir -p "${objroot}include/jemalloc/internal" |
| 2104 | cp /dev/null "${f}" |
| 2105 | for nm in `echo ${mangling_map} |tr ',' ' '` ; do |
| 2106 | n=`echo ${nm} |tr ':' ' ' |awk '{print $[]1}'` |
| 2107 | m=`echo ${nm} |tr ':' ' ' |awk '{print $[]2}'` |
| 2108 | echo "${n}:${m}" >> "${f}" |
| 2109 | dnl Remove name from public_syms so that it isn't redefined later. |
| 2110 | public_syms=`for sym in ${public_syms}; do echo "${sym}"; done |grep -v "^${n}\$" |tr '\n' ' '` |
| 2111 | done |
| 2112 | for sym in ${public_syms} ; do |
| 2113 | n="${sym}" |
| 2114 | m="${JEMALLOC_PREFIX}${sym}" |
| 2115 | echo "${n}:${m}" >> "${f}" |
| 2116 | done |
| 2117 | ], [ |
| 2118 | srcdir="${srcdir}" |
| 2119 | objroot="${objroot}" |
| 2120 | mangling_map="${mangling_map}" |
| 2121 | public_syms="${public_syms}" |
| 2122 | JEMALLOC_PREFIX="${JEMALLOC_PREFIX}" |
Jason Evans | 86abd0d | 2013-11-30 15:25:42 -0800 | [diff] [blame] | 2123 | ]) |
Jason Evans | 909f048 | 2017-05-04 11:20:43 -0700 | [diff] [blame] | 2124 | AC_CONFIG_COMMANDS([include/jemalloc/internal/private_symbols.awk], [ |
| 2125 | f="${objroot}include/jemalloc/internal/private_symbols.awk" |
| 2126 | mkdir -p "${objroot}include/jemalloc/internal" |
| 2127 | export_syms=`for sym in ${public_syms}; do echo "${JEMALLOC_PREFIX}${sym}"; done; for sym in ${wrap_syms}; do echo "${sym}"; done;` |
| 2128 | "${srcdir}/include/jemalloc/internal/private_symbols.sh" "${SYM_PREFIX}" ${export_syms} > "${objroot}include/jemalloc/internal/private_symbols.awk" |
| 2129 | ], [ |
| 2130 | srcdir="${srcdir}" |
| 2131 | objroot="${objroot}" |
| 2132 | public_syms="${public_syms}" |
| 2133 | wrap_syms="${wrap_syms}" |
| 2134 | SYM_PREFIX="${SYM_PREFIX}" |
| 2135 | JEMALLOC_PREFIX="${JEMALLOC_PREFIX}" |
| 2136 | ]) |
| 2137 | AC_CONFIG_COMMANDS([include/jemalloc/internal/private_symbols_jet.awk], [ |
| 2138 | f="${objroot}include/jemalloc/internal/private_symbols_jet.awk" |
| 2139 | mkdir -p "${objroot}include/jemalloc/internal" |
| 2140 | export_syms=`for sym in ${public_syms}; do echo "jet_${sym}"; done; for sym in ${wrap_syms}; do echo "${sym}"; done;` |
| 2141 | "${srcdir}/include/jemalloc/internal/private_symbols.sh" "${SYM_PREFIX}" ${export_syms} > "${objroot}include/jemalloc/internal/private_symbols_jet.awk" |
| 2142 | ], [ |
| 2143 | srcdir="${srcdir}" |
| 2144 | objroot="${objroot}" |
| 2145 | public_syms="${public_syms}" |
| 2146 | wrap_syms="${wrap_syms}" |
| 2147 | SYM_PREFIX="${SYM_PREFIX}" |
| 2148 | ]) |
Jason Evans | 86abd0d | 2013-11-30 15:25:42 -0800 | [diff] [blame] | 2149 | AC_CONFIG_COMMANDS([include/jemalloc/internal/public_namespace.h], [ |
| 2150 | mkdir -p "${objroot}include/jemalloc/internal" |
Jason Evans | f234dc5 | 2014-01-16 17:38:01 -0800 | [diff] [blame] | 2151 | "${srcdir}/include/jemalloc/internal/public_namespace.sh" "${objroot}include/jemalloc/internal/public_symbols.txt" > "${objroot}include/jemalloc/internal/public_namespace.h" |
| 2152 | ], [ |
| 2153 | srcdir="${srcdir}" |
| 2154 | objroot="${objroot}" |
Jason Evans | 86abd0d | 2013-11-30 15:25:42 -0800 | [diff] [blame] | 2155 | ]) |
| 2156 | AC_CONFIG_COMMANDS([include/jemalloc/internal/public_unnamespace.h], [ |
| 2157 | mkdir -p "${objroot}include/jemalloc/internal" |
Jason Evans | f234dc5 | 2014-01-16 17:38:01 -0800 | [diff] [blame] | 2158 | "${srcdir}/include/jemalloc/internal/public_unnamespace.sh" "${objroot}include/jemalloc/internal/public_symbols.txt" > "${objroot}include/jemalloc/internal/public_unnamespace.h" |
| 2159 | ], [ |
| 2160 | srcdir="${srcdir}" |
| 2161 | objroot="${objroot}" |
Jason Evans | 86abd0d | 2013-11-30 15:25:42 -0800 | [diff] [blame] | 2162 | ]) |
Jason Evans | b172610 | 2012-02-28 16:50:47 -0800 | [diff] [blame] | 2163 | AC_CONFIG_COMMANDS([include/jemalloc/internal/size_classes.h], [ |
Jason Evans | 86abd0d | 2013-11-30 15:25:42 -0800 | [diff] [blame] | 2164 | mkdir -p "${objroot}include/jemalloc/internal" |
Jason Evans | af76f0e | 2017-04-21 15:35:54 -0700 | [diff] [blame] | 2165 | "${SHELL}" "${srcdir}/include/jemalloc/internal/size_classes.sh" "${LG_QUANTA}" 3 "${LG_PAGE_SIZES}" 2 > "${objroot}include/jemalloc/internal/size_classes.h" |
Jason Evans | f234dc5 | 2014-01-16 17:38:01 -0800 | [diff] [blame] | 2166 | ], [ |
Jason Evans | 6d91929 | 2015-09-15 10:42:36 -0700 | [diff] [blame] | 2167 | SHELL="${SHELL}" |
Jason Evans | f234dc5 | 2014-01-16 17:38:01 -0800 | [diff] [blame] | 2168 | srcdir="${srcdir}" |
| 2169 | objroot="${objroot}" |
Jason Evans | 81e5475 | 2014-10-10 22:34:25 -0700 | [diff] [blame] | 2170 | LG_QUANTA="${LG_QUANTA}" |
Jason Evans | 81e5475 | 2014-10-10 22:34:25 -0700 | [diff] [blame] | 2171 | LG_PAGE_SIZES="${LG_PAGE_SIZES}" |
Jason Evans | b172610 | 2012-02-28 16:50:47 -0800 | [diff] [blame] | 2172 | ]) |
Jason Evans | 86abd0d | 2013-11-30 15:25:42 -0800 | [diff] [blame] | 2173 | AC_CONFIG_COMMANDS([include/jemalloc/jemalloc_protos_jet.h], [ |
| 2174 | mkdir -p "${objroot}include/jemalloc" |
| 2175 | 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] | 2176 | ], [ |
| 2177 | srcdir="${srcdir}" |
| 2178 | objroot="${objroot}" |
| 2179 | ]) |
| 2180 | AC_CONFIG_COMMANDS([include/jemalloc/jemalloc_rename.h], [ |
| 2181 | mkdir -p "${objroot}include/jemalloc" |
| 2182 | "${srcdir}/include/jemalloc/jemalloc_rename.sh" "${objroot}include/jemalloc/internal/public_symbols.txt" > "${objroot}include/jemalloc/jemalloc_rename.h" |
| 2183 | ], [ |
| 2184 | srcdir="${srcdir}" |
| 2185 | objroot="${objroot}" |
| 2186 | ]) |
| 2187 | AC_CONFIG_COMMANDS([include/jemalloc/jemalloc_mangle.h], [ |
| 2188 | mkdir -p "${objroot}include/jemalloc" |
| 2189 | "${srcdir}/include/jemalloc/jemalloc_mangle.sh" "${objroot}include/jemalloc/internal/public_symbols.txt" je_ > "${objroot}include/jemalloc/jemalloc_mangle.h" |
| 2190 | ], [ |
| 2191 | srcdir="${srcdir}" |
| 2192 | objroot="${objroot}" |
| 2193 | ]) |
| 2194 | AC_CONFIG_COMMANDS([include/jemalloc/jemalloc_mangle_jet.h], [ |
| 2195 | mkdir -p "${objroot}include/jemalloc" |
| 2196 | "${srcdir}/include/jemalloc/jemalloc_mangle.sh" "${objroot}include/jemalloc/internal/public_symbols.txt" jet_ > "${objroot}include/jemalloc/jemalloc_mangle_jet.h" |
| 2197 | ], [ |
| 2198 | srcdir="${srcdir}" |
| 2199 | objroot="${objroot}" |
Jason Evans | 86abd0d | 2013-11-30 15:25:42 -0800 | [diff] [blame] | 2200 | ]) |
| 2201 | AC_CONFIG_COMMANDS([include/jemalloc/jemalloc.h], [ |
| 2202 | mkdir -p "${objroot}include/jemalloc" |
| 2203 | "${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] | 2204 | ], [ |
| 2205 | srcdir="${srcdir}" |
| 2206 | objroot="${objroot}" |
| 2207 | install_suffix="${install_suffix}" |
Jason Evans | 86abd0d | 2013-11-30 15:25:42 -0800 | [diff] [blame] | 2208 | ]) |
Jason Evans | b172610 | 2012-02-28 16:50:47 -0800 | [diff] [blame] | 2209 | |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 2210 | dnl Process .in files. |
Jason Evans | b0fd501 | 2010-01-17 01:49:20 -0800 | [diff] [blame] | 2211 | AC_SUBST([cfghdrs_in]) |
| 2212 | AC_SUBST([cfghdrs_out]) |
Jason Evans | 0656ec0 | 2010-04-07 23:37:35 -0700 | [diff] [blame] | 2213 | AC_CONFIG_HEADERS([$cfghdrs_tup]) |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 2214 | |
| 2215 | dnl ============================================================================ |
| 2216 | dnl Generate outputs. |
Jason Evans | 748dfac | 2013-12-06 18:27:33 -0800 | [diff] [blame] | 2217 | |
Jason Evans | 7041720 | 2015-05-01 12:31:12 -0700 | [diff] [blame] | 2218 | AC_CONFIG_FILES([$cfgoutputs_tup config.stamp bin/jemalloc-config bin/jemalloc.sh bin/jeprof]) |
Jason Evans | b0fd501 | 2010-01-17 01:49:20 -0800 | [diff] [blame] | 2219 | AC_SUBST([cfgoutputs_in]) |
| 2220 | AC_SUBST([cfgoutputs_out]) |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 2221 | AC_OUTPUT |
| 2222 | |
| 2223 | dnl ============================================================================ |
| 2224 | dnl Print out the results of configuration. |
| 2225 | AC_MSG_RESULT([===============================================================================]) |
Jason Evans | f576c63 | 2011-11-01 22:27:41 -0700 | [diff] [blame] | 2226 | AC_MSG_RESULT([jemalloc version : ${jemalloc_version}]) |
| 2227 | AC_MSG_RESULT([library revision : ${rev}]) |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 2228 | AC_MSG_RESULT([]) |
Jason Evans | bec6a8d | 2015-01-22 17:55:58 -0800 | [diff] [blame] | 2229 | AC_MSG_RESULT([CONFIG : ${CONFIG}]) |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 2230 | AC_MSG_RESULT([CC : ${CC}]) |
Jason Evans | 194d6f9 | 2016-12-16 07:18:55 -0800 | [diff] [blame] | 2231 | AC_MSG_RESULT([CONFIGURE_CFLAGS : ${CONFIGURE_CFLAGS}]) |
| 2232 | AC_MSG_RESULT([SPECIFIED_CFLAGS : ${SPECIFIED_CFLAGS}]) |
Jason Evans | af0e28f | 2016-10-29 22:14:55 -0700 | [diff] [blame] | 2233 | AC_MSG_RESULT([EXTRA_CFLAGS : ${EXTRA_CFLAGS}]) |
Jason Evans | bec6a8d | 2015-01-22 17:55:58 -0800 | [diff] [blame] | 2234 | AC_MSG_RESULT([CPPFLAGS : ${CPPFLAGS}]) |
Dave Watson | 2319152 | 2016-10-23 15:56:30 -0700 | [diff] [blame] | 2235 | AC_MSG_RESULT([CXX : ${CXX}]) |
Jason Evans | 194d6f9 | 2016-12-16 07:18:55 -0800 | [diff] [blame] | 2236 | AC_MSG_RESULT([CONFIGURE_CXXFLAGS : ${CONFIGURE_CXXFLAGS}]) |
| 2237 | AC_MSG_RESULT([SPECIFIED_CXXFLAGS : ${SPECIFIED_CXXFLAGS}]) |
Dave Watson | 2319152 | 2016-10-23 15:56:30 -0700 | [diff] [blame] | 2238 | AC_MSG_RESULT([EXTRA_CXXFLAGS : ${EXTRA_CXXFLAGS}]) |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 2239 | AC_MSG_RESULT([LDFLAGS : ${LDFLAGS}]) |
Jason Evans | 748dfac | 2013-12-06 18:27:33 -0800 | [diff] [blame] | 2240 | AC_MSG_RESULT([EXTRA_LDFLAGS : ${EXTRA_LDFLAGS}]) |
Dave Watson | 2319152 | 2016-10-23 15:56:30 -0700 | [diff] [blame] | 2241 | AC_MSG_RESULT([DSO_LDFLAGS : ${DSO_LDFLAGS}]) |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 2242 | AC_MSG_RESULT([LIBS : ${LIBS}]) |
| 2243 | AC_MSG_RESULT([RPATH_EXTRA : ${RPATH_EXTRA}]) |
| 2244 | AC_MSG_RESULT([]) |
Jason Evans | aee7fd2 | 2010-11-24 22:00:02 -0800 | [diff] [blame] | 2245 | AC_MSG_RESULT([XSLTPROC : ${XSLTPROC}]) |
| 2246 | AC_MSG_RESULT([XSLROOT : ${XSLROOT}]) |
| 2247 | AC_MSG_RESULT([]) |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 2248 | AC_MSG_RESULT([PREFIX : ${PREFIX}]) |
| 2249 | AC_MSG_RESULT([BINDIR : ${BINDIR}]) |
Jason Evans | bec6a8d | 2015-01-22 17:55:58 -0800 | [diff] [blame] | 2250 | AC_MSG_RESULT([DATADIR : ${DATADIR}]) |
Jason Evans | 662a017 | 2009-07-01 19:24:31 -0700 | [diff] [blame] | 2251 | AC_MSG_RESULT([INCLUDEDIR : ${INCLUDEDIR}]) |
| 2252 | AC_MSG_RESULT([LIBDIR : ${LIBDIR}]) |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 2253 | AC_MSG_RESULT([MANDIR : ${MANDIR}]) |
| 2254 | AC_MSG_RESULT([]) |
| 2255 | AC_MSG_RESULT([srcroot : ${srcroot}]) |
| 2256 | AC_MSG_RESULT([abs_srcroot : ${abs_srcroot}]) |
| 2257 | AC_MSG_RESULT([objroot : ${objroot}]) |
| 2258 | AC_MSG_RESULT([abs_objroot : ${abs_objroot}]) |
| 2259 | AC_MSG_RESULT([]) |
Jason Evans | 90895cf | 2009-12-29 00:09:15 -0800 | [diff] [blame] | 2260 | AC_MSG_RESULT([JEMALLOC_PREFIX : ${JEMALLOC_PREFIX}]) |
Jason Evans | 746e77a | 2011-07-30 16:40:52 -0700 | [diff] [blame] | 2261 | AC_MSG_RESULT([JEMALLOC_PRIVATE_NAMESPACE]) |
| 2262 | AC_MSG_RESULT([ : ${JEMALLOC_PRIVATE_NAMESPACE}]) |
Jason Evans | b0fd501 | 2010-01-17 01:49:20 -0800 | [diff] [blame] | 2263 | AC_MSG_RESULT([install_suffix : ${install_suffix}]) |
Jason Evans | f829009 | 2016-02-07 14:23:22 -0800 | [diff] [blame] | 2264 | AC_MSG_RESULT([malloc_conf : ${config_malloc_conf}]) |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 2265 | AC_MSG_RESULT([autogen : ${enable_autogen}]) |
| 2266 | AC_MSG_RESULT([debug : ${enable_debug}]) |
| 2267 | AC_MSG_RESULT([stats : ${enable_stats}]) |
Jason Evans | 6109fe0 | 2010-02-10 10:37:56 -0800 | [diff] [blame] | 2268 | AC_MSG_RESULT([prof : ${enable_prof}]) |
| 2269 | AC_MSG_RESULT([prof-libunwind : ${enable_prof_libunwind}]) |
Jason Evans | 77f350b | 2011-03-15 22:23:12 -0700 | [diff] [blame] | 2270 | AC_MSG_RESULT([prof-libgcc : ${enable_prof_libgcc}]) |
| 2271 | AC_MSG_RESULT([prof-gcc : ${enable_prof_gcc}]) |
Jason Evans | c606a87 | 2017-05-30 09:54:49 -0700 | [diff] [blame] | 2272 | AC_MSG_RESULT([thp : ${enable_thp}]) |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 2273 | AC_MSG_RESULT([fill : ${enable_fill}]) |
Jason Evans | b147611 | 2012-04-05 13:36:17 -0700 | [diff] [blame] | 2274 | AC_MSG_RESULT([utrace : ${enable_utrace}]) |
Jason Evans | 122449b | 2012-04-06 00:35:09 -0700 | [diff] [blame] | 2275 | AC_MSG_RESULT([xmalloc : ${enable_xmalloc}]) |
David T. Goldblatt | 9761b44 | 2017-07-19 16:36:46 -0700 | [diff] [blame] | 2276 | AC_MSG_RESULT([log : ${enable_log}]) |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 2277 | AC_MSG_RESULT([lazy_lock : ${enable_lazy_lock}]) |
Jason Evans | 8a03cf0 | 2015-05-04 09:58:36 -0700 | [diff] [blame] | 2278 | AC_MSG_RESULT([cache-oblivious : ${enable_cache_oblivious}]) |
Dave Watson | 2319152 | 2016-10-23 15:56:30 -0700 | [diff] [blame] | 2279 | AC_MSG_RESULT([cxx : ${enable_cxx}]) |
Jason Evans | b7924f5 | 2009-06-23 19:01:18 -0700 | [diff] [blame] | 2280 | AC_MSG_RESULT([===============================================================================]) |