1 diff --git a/configure b/configure
4 @@ -1905,83 +1905,16 @@ fi
5 # interfere with the next link command; also delete a directory that is
6 # left behind by Apple's compiler. We do this before executing the actions.
7 rm -rf conftest.dSYM conftest_ipa8_conftest.oo
8 eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
9 as_fn_set_status $ac_retval
13 -# ac_fn_c_check_func LINENO FUNC VAR
14 -# ----------------------------------
15 -# Tests whether FUNC exists, setting the cache variable VAR accordingly
16 -ac_fn_c_check_func ()
18 - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
19 - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
20 -$as_echo_n "checking for $2... " >&6; }
21 -if eval \${$3+:} false; then :
22 - $as_echo_n "(cached) " >&6
24 - cat confdefs.h - <<_ACEOF >conftest.$ac_ext
25 -/* end confdefs.h. */
26 -/* Define $2 to an innocuous variant, in case <limits.h> declares $2.
27 - For example, HP-UX 11i <limits.h> declares gettimeofday. */
28 -#define $2 innocuous_$2
30 -/* System header to define __stub macros and hopefully few prototypes,
31 - which can conflict with char $2 (); below.
32 - Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
33 - <limits.h> exists even on freestanding compilers. */
43 -/* Override any GCC internal prototype to avoid an error.
44 - Use char because int might match the return type of a GCC
45 - builtin and then its argument prototype would still apply. */
50 -/* The GNU C library defines this for functions which it implements
51 - to always fail with ENOSYS. Some functions are actually named
52 - something starting with __ and the normal name is an alias. */
53 -#if defined __stub_$2 || defined __stub___$2
65 -if ac_fn_c_try_link "$LINENO"; then :
70 -rm -f core conftest.err conftest.$ac_objext \
71 - conftest$ac_exeext conftest.$ac_ext
74 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
75 -$as_echo "$ac_res" >&6; }
76 - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
78 -} # ac_fn_c_check_func
80 # ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES
81 # -------------------------------------------------------
82 # Tests whether HEADER exists, giving a warning if it cannot be compiled using
83 # the include files in INCLUDES and setting the cache variable VAR
85 ac_fn_c_check_header_mongrel ()
87 as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
88 @@ -2059,16 +1992,83 @@ fi
90 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
91 $as_echo "$ac_res" >&6; }
93 eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
95 } # ac_fn_c_check_header_mongrel
97 +# ac_fn_c_check_func LINENO FUNC VAR
98 +# ----------------------------------
99 +# Tests whether FUNC exists, setting the cache variable VAR accordingly
100 +ac_fn_c_check_func ()
102 + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
103 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
104 +$as_echo_n "checking for $2... " >&6; }
105 +if eval \${$3+:} false; then :
106 + $as_echo_n "(cached) " >&6
108 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext
109 +/* end confdefs.h. */
110 +/* Define $2 to an innocuous variant, in case <limits.h> declares $2.
111 + For example, HP-UX 11i <limits.h> declares gettimeofday. */
112 +#define $2 innocuous_$2
114 +/* System header to define __stub macros and hopefully few prototypes,
115 + which can conflict with char $2 (); below.
116 + Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
117 + <limits.h> exists even on freestanding compilers. */
120 +# include <limits.h>
122 +# include <assert.h>
127 +/* Override any GCC internal prototype to avoid an error.
128 + Use char because int might match the return type of a GCC
129 + builtin and then its argument prototype would still apply. */
134 +/* The GNU C library defines this for functions which it implements
135 + to always fail with ENOSYS. Some functions are actually named
136 + something starting with __ and the normal name is an alias. */
137 +#if defined __stub_$2 || defined __stub___$2
149 +if ac_fn_c_try_link "$LINENO"; then :
154 +rm -f core conftest.err conftest.$ac_objext \
155 + conftest$ac_exeext conftest.$ac_ext
158 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
159 +$as_echo "$ac_res" >&6; }
160 + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
162 +} # ac_fn_c_check_func
164 # ac_fn_c_check_type LINENO TYPE VAR INCLUDES
165 # -------------------------------------------
166 # Tests whether TYPE exists after having included INCLUDES, setting cache
167 # variable VAR accordingly.
168 ac_fn_c_check_type ()
170 as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
171 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
172 @@ -4817,17 +4817,16 @@ esac
181 -JEMALLOC_USABLE_SIZE_CONST="const"
186 $as_echo "#define JEMALLOC_PURGE_MADVISE_FREE " >>confdefs.h
189 LD_PRELOAD_VAR="DYLD_INSERT_LIBRARIES"
190 @@ -4850,17 +4849,16 @@ case "${host}" in
191 CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
193 $as_echo "#define JEMALLOC_HAS_ALLOCA_H 1" >>confdefs.h
195 $as_echo "#define JEMALLOC_PURGE_MADVISE_DONTNEED " >>confdefs.h
197 $as_echo "#define JEMALLOC_THREADED_INIT " >>confdefs.h
199 - JEMALLOC_USABLE_SIZE_CONST=""
203 { $as_echo "$as_me:${as_lineno-$LINENO}: checking ABI" >&5
204 $as_echo_n "checking ABI... " >&6; }
205 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
206 /* end confdefs.h. */
208 @@ -4930,16 +4928,60 @@ rm -f core conftest.err conftest.$ac_obj
212 { $as_echo "$as_me:${as_lineno-$LINENO}: result: Unsupported operating system: ${host}" >&5
213 $as_echo "Unsupported operating system: ${host}" >&6; }
218 +JEMALLOC_USABLE_SIZE_CONST=const
219 +for ac_header in malloc.h
221 + ac_fn_c_check_header_mongrel "$LINENO" "malloc.h" "ac_cv_header_malloc_h" "$ac_includes_default"
222 +if test "x$ac_cv_header_malloc_h" = xyes; then :
223 + cat >>confdefs.h <<_ACEOF
224 +#define HAVE_MALLOC_H 1
227 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether malloc_usable_size definition can use const argument" >&5
228 +$as_echo_n "checking whether malloc_usable_size definition can use const argument... " >&6; }
229 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext
230 +/* end confdefs.h. */
232 + #include <stddef.h>
233 + size_t malloc_usable_size(const void *ptr);
243 +if ac_fn_c_try_compile "$LINENO"; then :
245 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
246 +$as_echo "yes" >&6; }
250 + JEMALLOC_USABLE_SIZE_CONST=
251 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
252 +$as_echo "no" >&6; }
255 +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
261 cat >>confdefs.h <<_ACEOF
262 #define JEMALLOC_USABLE_SIZE_CONST $JEMALLOC_USABLE_SIZE_CONST
269 diff --git a/configure.ac b/configure.ac
272 @@ -253,17 +253,16 @@ AC_PROG_AR
273 dnl Platform-specific settings. abi and RPATH can probably be determined
274 dnl programmatically, but doing so is error-prone, which makes it generally
275 dnl not worth the trouble.
277 dnl Define cpp macros in CPPFLAGS, rather than doing AC_DEFINE(macro), since the
278 dnl definitions need to be seen before any headers are included, which is a pain
279 dnl to make happen otherwise.
281 -JEMALLOC_USABLE_SIZE_CONST="const"
286 AC_DEFINE([JEMALLOC_PURGE_MADVISE_FREE], [ ])
288 LD_PRELOAD_VAR="DYLD_INSERT_LIBRARIES"
290 @@ -281,17 +280,16 @@ case "${host}" in
294 CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
296 AC_DEFINE([JEMALLOC_HAS_ALLOCA_H])
297 AC_DEFINE([JEMALLOC_PURGE_MADVISE_DONTNEED], [ ])
298 AC_DEFINE([JEMALLOC_THREADED_INIT], [ ])
299 - JEMALLOC_USABLE_SIZE_CONST=""
303 AC_MSG_CHECKING([ABI])
304 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
308 @@ -346,16 +344,32 @@ case "${host}" in
313 AC_MSG_RESULT([Unsupported operating system: ${host}])
318 +JEMALLOC_USABLE_SIZE_CONST=const
319 +AC_CHECK_HEADERS([malloc.h], [
320 + AC_MSG_CHECKING([whether malloc_usable_size definition can use const argument])
321 + AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
322 + [#include <malloc.h>
323 + #include <stddef.h>
324 + size_t malloc_usable_size(const void *ptr);
327 + AC_MSG_RESULT([yes])
329 + JEMALLOC_USABLE_SIZE_CONST=
330 + AC_MSG_RESULT([no])
333 AC_DEFINE_UNQUOTED([JEMALLOC_USABLE_SIZE_CONST], [$JEMALLOC_USABLE_SIZE_CONST])
336 AC_SUBST([LD_PRELOAD_VAR])
338 AC_SUBST([importlib])