Bug 1257448 - Move --enable-replace-malloc to moz.configure. r?nalexander
--- a/build/moz.configure/memory.configure
+++ b/build/moz.configure/memory.configure
@@ -73,8 +73,25 @@ def jemalloc_os_define(jemalloc, jemallo
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')
+
+
+option('--enable-replace-malloc',
+ help='Enable ability to dynamically replace the malloc implementation')
+
+@depends('--enable-replace-malloc', jemalloc, milestone, build_project)
+def replace_malloc(value, jemalloc, milestone, build_project):
+ # Enable on central for the debugging opportunities it adds.
+ if milestone.is_nightly and jemalloc and build_project != 'js':
+ return True
+ if value and not jemalloc:
+ die('--enable-replace-malloc requires --enable-jemalloc')
+ return bool(value) or None
+
+set_config('MOZ_REPLACE_MALLOC', replace_malloc)
+set_define('MOZ_REPLACE_MALLOC', replace_malloc)
+add_old_configure_assignment('MOZ_REPLACE_MALLOC', replace_malloc)
--- a/build/moz.configure/old.configure
+++ b/build/moz.configure/old.configure
@@ -228,17 +228,16 @@ def old_configure_options(*options):
'--enable-posix-nspr-emulation',
'--enable-pref-extensions',
'--enable-printing',
'--enable-pulseaudio',
'--enable-raw',
'--enable-readline',
'--enable-reflow-perf',
'--enable-release',
- '--enable-replace-malloc',
'--enable-require-all-d3dc-versions',
'--enable-rust',
'--enable-safe-browsing',
'--enable-sandbox',
'--enable-signmar',
'--enable-simulator',
'--enable-skia',
'--enable-skia-gpu',
--- a/old-configure.in
+++ b/old-configure.in
@@ -1143,18 +1143,16 @@ dnl ====================================
dnl = Enable DMD
dnl ========================================================
if test "$MOZ_DMD"; then
if test "${CPU_ARCH}" = "arm"; then
CFLAGS="$CFLAGS -funwind-tables"
CXXFLAGS="$CXXFLAGS -funwind-tables"
fi
-
- MOZ_REPLACE_MALLOC=1 # DMD enables replace-malloc
fi
dnl ========================================================
dnl System overrides of the defaults for host
dnl ========================================================
case "$host" in
*mingw*)
if test -n "$_WIN32_MSVC"; then
@@ -5605,34 +5603,17 @@ Android|WINNT|Darwin)
;;
*)
dnl On !Android !Windows !OSX, we only want to link executables against mozglue
MOZ_GLUE_IN_PROGRAM=1
AC_DEFINE(MOZ_GLUE_IN_PROGRAM)
;;
esac
-dnl ========================================================
-dnl = Enable dynamic replacement of malloc implementation
-dnl ========================================================
-if test -n "$NIGHTLY_BUILD" -a -n "$MOZ_MEMORY"; then
- # Enable on central for the debugging opportunities it adds.
- MOZ_REPLACE_MALLOC=1
-fi
-MOZ_ARG_ENABLE_BOOL(replace-malloc,
-[ --enable-replace-malloc Enable ability to dynamically replace the malloc implementation],
- MOZ_REPLACE_MALLOC=1,
- MOZ_REPLACE_MALLOC= )
-
-if test -n "$MOZ_REPLACE_MALLOC" -a -z "$MOZ_MEMORY"; then
- dnl We don't want to enable jemalloc unconditionally because it may be a
- dnl deliberate choice not to enable it (bug 702250, for instance)
- AC_MSG_ERROR([--enable-replace-malloc requires --enable-jemalloc])
-elif test -n "$MOZ_REPLACE_MALLOC"; then
- AC_DEFINE(MOZ_REPLACE_MALLOC)
+if test -n "$MOZ_REPLACE_MALLOC"; then
MOZ_SYSTEM_JEMALLOC=
dnl Replace-malloc Mac linkage quirks
if test -n "$MACOSX_DEPLOYMENT_TARGET"; then
AC_CACHE_CHECK([how to do weak dynamic linking],
ac_cv_weak_dynamic_linking,
[echo 'extern void foo() __attribute__((weak_import));int bar() { if (foo) foo(); return 0; }' > conftest.c
if AC_TRY_COMMAND([${CC-cc} -o conftest${DLL_SUFFIX} $CFLAGS -dynamiclib $LDFLAGS -Wl,-U,_foo conftest.c $LIBS 1>&5]) &&
@@ -5677,17 +5658,16 @@ elif test -n "$MOZ_REPLACE_MALLOC"; then
fi
else
AC_ERROR([couldn't compile a simple C file])
fi
rm -rf conftest*])
MOZ_REPLACE_MALLOC_LINKAGE="$ac_cv_weak_dynamic_linking"
fi
fi
-AC_SUBST(MOZ_REPLACE_MALLOC)
AC_SUBST(MOZ_REPLACE_MALLOC_LINKAGE)
dnl ========================================================
dnl = Jemalloc build setup
dnl ========================================================
if test -z "$MOZ_MEMORY"; then
case "${target}" in
*-mingw*)
--- a/toolkit/moz.configure
+++ b/toolkit/moz.configure
@@ -61,16 +61,17 @@ def dmd(value):
if value:
return True
set_config('MOZ_DMD', dmd)
set_define('MOZ_DMD', dmd)
add_old_configure_assignment('MOZ_DMD', dmd)
imply_option('--enable-profiling', dmd)
imply_option('--enable-jemalloc', dmd)
+imply_option('--enable-replace-malloc', dmd)
# Javascript engine
# ==============================================================
include('../js/moz.configure')
# L10N
# ==============================================================