Bug 1257448 - Move MOZ_MEMORY_* defines to moz.configure. r?nalexander draft
authorMike Hommey <mh+mozilla@glandium.org>
Thu, 14 Apr 2016 18:43:49 +0900
changeset 351704 95620efdf489787c8231bd55975c0c7658603ccb
parent 350880 273338bc520d696d81c2710dd6b217ef7aea1b8c
child 351705 c7b6bb8ea5987b142cd7734e3391bf07e626338c
push id15511
push userbmo:mh+mozilla@glandium.org
push dateThu, 14 Apr 2016 21:56:32 +0000
reviewersnalexander
bugs1257448
milestone48.0a1
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
@@ -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)