Bug 1257448 - Move MOZ_MEMORY_* defines to moz.configure. r?nalexander
--- a/build/moz.configure/memory.configure
+++ b/build/moz.configure/memory.configure
@@ -50,8 +50,31 @@ add_old_configure_assignment('MOZ_JEMALL
# through the old-configure.
@depends(jemalloc, jemalloc4)
def jemalloc_for_old_configure(jemalloc, jemalloc4):
if jemalloc:
return '--enable-jemalloc=4' if jemalloc4 else '--enable-jemalloc'
return '--disable-jemalloc'
add_old_configure_arg(jemalloc_for_old_configure)
+
+
+@depends(jemalloc, jemalloc4, target)
+def jemalloc_os_define(jemalloc, jemalloc4, target):
+ if jemalloc and not jemalloc4:
+ if target.kernel == 'WINNT':
+ return 'MOZ_MEMORY_WINDOWS'
+ if target.kernel == 'Linux':
+ return 'MOZ_MEMORY_LINUX'
+ if target.kernel == 'Darwin':
+ return 'MOZ_MEMORY_DARWIN'
+ if target.kernel in ('kFreeBSD', 'FreeBSD', 'NetBSD'):
+ return 'MOZ_MEMORY_BSD'
+ die('--enable-jemalloc is not supported on %s', target.kernel)
+
+set_define(jemalloc_os_define, '1')
+
+@depends(jemalloc, jemalloc4, target)
+def jemalloc_os_define_android(jemalloc, jemalloc4, target):
+ if jemalloc and not jemalloc4 and target.os == 'Android':
+ return 'MOZ_MEMORY_ANDROID'
+
+set_define(jemalloc_os_define_android, '1')
--- a/js/src/old-configure.in
+++ b/js/src/old-configure.in
@@ -1989,39 +1989,19 @@ esac
if test "$MOZ_MEMORY"; then
if test "x$MOZ_DEBUG" = "x1"; then
AC_DEFINE(MOZ_MEMORY_DEBUG)
fi
dnl The generic feature tests that determine how to compute ncpus are long and
dnl complicated. Therefore, simply define special cpp variables for the
dnl platforms we have special knowledge of.
case "${target}" in
- *-darwin*)
- AC_DEFINE(MOZ_MEMORY_DARWIN)
- ;;
- *-*freebsd*)
- AC_DEFINE(MOZ_MEMORY_BSD)
- ;;
- *-android*|*-linuxandroid*)
- AC_DEFINE(MOZ_MEMORY_LINUX)
- AC_DEFINE(MOZ_MEMORY_ANDROID)
- ;;
- *-*linux*)
- AC_DEFINE(MOZ_MEMORY_LINUX)
- ;;
- *-netbsd*)
- AC_DEFINE(MOZ_MEMORY_BSD)
- ;;
*-mingw*)
- AC_DEFINE(MOZ_MEMORY_WINDOWS)
export MOZ_NO_DEBUG_RTL=1
;;
- *)
- AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
- ;;
esac
fi
AC_SUBST(MOZ_CRT)
AC_SUBST(MOZ_GLUE_IN_PROGRAM)
AC_SUBST_LIST(MOZ_GLUE_WRAP_LDFLAGS)
dnl ========================================================
dnl = Use a smaller chunk size for GC chunks
--- a/old-configure.in
+++ b/old-configure.in
@@ -5708,49 +5708,29 @@ else
fi
if test "x$MOZ_DEBUG" = "x1"; then
AC_DEFINE(MOZ_MEMORY_DEBUG)
fi
dnl The generic feature tests that determine how to compute ncpus are long and
dnl complicated. Therefore, simply define special cpp variables for the
dnl platforms we have special knowledge of.
case "${target}" in
- *-darwin*)
- AC_DEFINE(MOZ_MEMORY_DARWIN)
- ;;
- *-*freebsd*)
- AC_DEFINE(MOZ_MEMORY_BSD)
- ;;
- *-android*|*-linuxandroid*)
- AC_DEFINE(MOZ_MEMORY_LINUX)
- AC_DEFINE(MOZ_MEMORY_ANDROID)
- ;;
- *-*linux*)
- AC_DEFINE(MOZ_MEMORY_LINUX)
- ;;
- *-netbsd*)
- AC_DEFINE(MOZ_MEMORY_BSD)
- ;;
*-mingw*)
- AC_DEFINE(MOZ_MEMORY_WINDOWS)
export MOZ_NO_DEBUG_RTL=1
if test "$MSVS_VERSION" != "2015"; then
WIN32_CRT_LIBS="msvcrt.lib msvcprt.lib"
dnl Look for a broken crtdll.obj
WIN32_CRTDLL_FULLPATH=`lib -nologo -list $WIN32_CRT_LIBS | grep crtdll\\.obj`
lib -NOLOGO -OUT:crtdll.obj $WIN32_CRT_LIBS -EXTRACT:$WIN32_CRTDLL_FULLPATH
if grep -q '__imp__\{0,1\}free' crtdll.obj; then
MOZ_CRT=1
fi
rm crtdll.obj
fi
;;
- *)
- AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
- ;;
esac
fi # MOZ_MEMORY
AC_SUBST(MOZ_SYSTEM_JEMALLOC)
AC_SUBST(MOZ_CRT)
export MOZ_CRT
AC_SUBST(MOZ_GLUE_IN_PROGRAM)
AC_SUBST_LIST(WIN32_CRT_LIBS)