On May 21, 2014, at 6:40 AM, Mike Hommey <[email protected]> wrote: > On Wed, May 21, 2014 at 10:37:26PM +0900, Mike Hommey wrote: >> From: Mike Hommey <[email protected]> >> >> --- >> configure.ac | 18 ++++++++++++++++-- >> 1 file changed, 16 insertions(+), 2 deletions(-) >> >> diff --git a/configure.ac b/configure.ac >> index 57015d1..0a3d8a8 100644 >> --- a/configure.ac >> +++ b/configure.ac >> @@ -258,7 +258,6 @@ dnl Define cpp macros in CPPFLAGS, rather than doing >> AC_DEFINE(macro), since the >> dnl definitions need to be seen before any headers are included, which is a >> pain >> dnl to make happen otherwise. >> default_munmap="1" >> -JEMALLOC_USABLE_SIZE_CONST="const" >> case "${host}" in >> *-*-darwin*) >> CFLAGS="$CFLAGS" >> @@ -286,7 +285,6 @@ case "${host}" in >> AC_DEFINE([JEMALLOC_HAS_ALLOCA_H]) >> AC_DEFINE([JEMALLOC_PURGE_MADVISE_DONTNEED], [ ]) >> AC_DEFINE([JEMALLOC_THREADED_INIT], [ ]) >> - JEMALLOC_USABLE_SIZE_CONST="" >> default_munmap="0" >> ;; >> *-*-netbsd*) >> @@ -351,6 +349,22 @@ case "${host}" in >> abi="elf" >> ;; >> esac >> + >> +JEMALLOC_USABLE_SIZE_CONST= >> +AC_CHECK_HEADERS([malloc.h], [ >> + AC_MSG_CHECKING([whether system malloc_usable_size definition uses const >> argument]) > > Note, this sentence is wrong on windows, where there is no system > malloc_usable_size, but where the test *does* run and return yes. > > Also, it might be better to check independently of whether malloc.h is > available or not. > > Tell me if you want me to fix those.
I'm not sure there's a way to write a resilient configure test. Because malloc_usable_size() isn't a standard function, there's not a standard header for it. For example, here's FreeBSD's malloc.h (malloc_usable_size() is defined in malloc_np.h): #if __STDC__ #error "<malloc.h> has been replaced by <stdlib.h>" #else #include <stdlib.h> #endif If nothing else, JEMALLOC_USABLE_SIZE_CONST="const" needs to be added to the FreeBSD (and NetBSD?) sections for this diff to work correctly. Thanks, Jason _______________________________________________ jemalloc-discuss mailing list [email protected] http://www.canonware.com/mailman/listinfo/jemalloc-discuss
