mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-07-24 22:03:07 +00:00
Improve zone support for OSX
I tested a build from 10.7 run on 10.7 and 10.6, and a build from 10.6 run on 10.6. The AC_COMPILE_IFELSE limbo is to avoid running a program during configure, which presumably makes it work when cross compiling for iOS.
This commit is contained in:
57
configure.ac
57
configure.ac
@@ -877,39 +877,32 @@ if test "x${abi}" = "xmacho" ; then
|
||||
dnl releases. malloc_zone_t and malloc_introspection_t have new fields in
|
||||
dnl 10.6, which is the only source-level indication of the change.
|
||||
AC_MSG_CHECKING([malloc zone version])
|
||||
AC_TRY_COMPILE([#include <stdlib.h>
|
||||
#include <malloc/malloc.h>], [
|
||||
static malloc_zone_t zone;
|
||||
static struct malloc_introspection_t zone_introspect;
|
||||
AC_DEFUN([JE_ZONE_PROGRAM],
|
||||
[AC_LANG_PROGRAM(
|
||||
[#include <malloc/malloc.h>],
|
||||
[static foo[[sizeof($1) $2 sizeof(void *) * $3 ? 1 : -1]]]
|
||||
)])
|
||||
|
||||
zone.size = NULL;
|
||||
zone.malloc = NULL;
|
||||
zone.calloc = NULL;
|
||||
zone.valloc = NULL;
|
||||
zone.free = NULL;
|
||||
zone.realloc = NULL;
|
||||
zone.destroy = NULL;
|
||||
zone.zone_name = "jemalloc_zone";
|
||||
zone.batch_malloc = NULL;
|
||||
zone.batch_free = NULL;
|
||||
zone.introspect = &zone_introspect;
|
||||
zone.version = 6;
|
||||
zone.memalign = NULL;
|
||||
zone.free_definite_size = NULL;
|
||||
|
||||
zone_introspect.enumerator = NULL;
|
||||
zone_introspect.good_size = NULL;
|
||||
zone_introspect.check = NULL;
|
||||
zone_introspect.print = NULL;
|
||||
zone_introspect.log = NULL;
|
||||
zone_introspect.force_lock = NULL;
|
||||
zone_introspect.force_unlock = NULL;
|
||||
zone_introspect.statistics = NULL;
|
||||
zone_introspect.zone_locked = NULL;
|
||||
], [AC_DEFINE_UNQUOTED([JEMALLOC_ZONE_VERSION], [6])
|
||||
AC_MSG_RESULT([6])],
|
||||
[AC_DEFINE_UNQUOTED([JEMALLOC_ZONE_VERSION], [3])
|
||||
AC_MSG_RESULT([3])])
|
||||
AC_COMPILE_IFELSE([JE_ZONE_PROGRAM(malloc_zone_t,==,14)],[JEMALLOC_ZONE_VERSION=3],[
|
||||
AC_COMPILE_IFELSE([JE_ZONE_PROGRAM(malloc_zone_t,==,15)],[JEMALLOC_ZONE_VERSION=5],[
|
||||
AC_COMPILE_IFELSE([JE_ZONE_PROGRAM(malloc_zone_t,==,16)],[
|
||||
AC_COMPILE_IFELSE([JE_ZONE_PROGRAM(malloc_introspection_t,==,9)],[JEMALLOC_ZONE_VERSION=6],[
|
||||
AC_COMPILE_IFELSE([JE_ZONE_PROGRAM(malloc_introspection_t,==,13)],[JEMALLOC_ZONE_VERSION=7],[JEMALLOC_ZONE_VERSION=]
|
||||
)])],[
|
||||
AC_COMPILE_IFELSE([JE_ZONE_PROGRAM(malloc_zone_t,==,17)],[JEMALLOC_ZONE_VERSION=8],[
|
||||
AC_COMPILE_IFELSE([JE_ZONE_PROGRAM(malloc_zone_t,>,17)],[JEMALLOC_ZONE_VERSION=9],[JEMALLOC_ZONE_VERSION=]
|
||||
)])])])])
|
||||
if test "x${JEMALLOC_ZONE_VERSION}" = "x"; then
|
||||
AC_MSG_RESULT([unsupported])
|
||||
AC_MSG_ERROR([Unsupported malloc zone version])
|
||||
fi
|
||||
if test "${JEMALLOC_ZONE_VERSION}" = 9; then
|
||||
JEMALLOC_ZONE_VERSION=8
|
||||
AC_MSG_RESULT([> 8])
|
||||
else
|
||||
AC_MSG_RESULT([$JEMALLOC_ZONE_VERSION])
|
||||
fi
|
||||
AC_DEFINE_UNQUOTED(JEMALLOC_ZONE_VERSION, [$JEMALLOC_ZONE_VERSION])
|
||||
fi
|
||||
|
||||
dnl ============================================================================
|
||||
|
||||
Reference in New Issue
Block a user