Bug 1257448 - Move MOZ_MEMORY_* defines to moz.configure. r=nalexander
authorMike Hommey <mh+mozilla@glandium.org>
Thu, 14 Apr 2016 18:43:49 +0900
changeset 293265 e830d7f62e4daf87facecff79e0b33fe6a1db46a
parent 293264 19192644236646c8c4bec4d475bc3fd628608846
child 293266 f521d5b4368efcc3e163d601410b27152220d60a
push id75153
push usermh@glandium.org
push dateThu, 14 Apr 2016 23:14:57 +0000
treeherdermozilla-inbound@993766c094cf [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnalexander
bugs1257448
milestone48.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1257448 - Move MOZ_MEMORY_* defines to moz.configure. r=nalexander
build/moz.configure/memory.configure
js/src/old-configure.in
old-configure.in
--- 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
@@ -5706,49 +5706,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)