Bug 1460373 - move --enable-valgrind to moz.configure; r=ted.mielczarek
authorNathan Froyd <froydnj@mozilla.com>
Wed, 09 May 2018 17:26:31 -0400
changeset 465766 2dd51c7e5789d45631e1e56b59ee02ac81e55b35
parent 465765 758cb28b70144afa10405624044bec305f101dc2
child 465767 e61af28c3143645eb79a8245112863c0b702d7e4
push id177
push userfmarier@mozilla.com
push dateThu, 24 May 2018 16:58:35 +0000
reviewersted
bugs1460373
milestone62.0a1
Bug 1460373 - move --enable-valgrind to moz.configure; r=ted.mielczarek
build/moz.configure/old.configure
js/src/old-configure.in
moz.configure
old-configure.in
--- a/build/moz.configure/old.configure
+++ b/build/moz.configure/old.configure
@@ -219,17 +219,16 @@ def old_configure_options(*options):
     '--enable-system-pixman',
     '--enable-system-sqlite',
     '--enable-tasktracer',
     '--enable-thread-sanitizer',
     '--enable-signed-overflow-sanitizer',
     '--enable-universalchardet',
     '--enable-unsigned-overflow-sanitizer',
     '--enable-updater',
-    '--enable-valgrind',
     '--enable-verify-mar',
     '--enable-xul',
     '--enable-zipwriter',
     '--includedir',
     '--libdir',
     '--no-create',
     '--prefix',
     '--with-android-distribution-directory',
--- a/js/src/old-configure.in
+++ b/js/src/old-configure.in
@@ -1433,32 +1433,16 @@ if test "$MOZ_MEMORY"; then
     export MOZ_NO_DEBUG_RTL=1
     ;;
   esac
 fi
 AC_SUBST(MOZ_GLUE_IN_PROGRAM)
 AC_SUBST_LIST(MOZ_GLUE_WRAP_LDFLAGS)
 
 dnl ========================================================
-dnl = Use Valgrind
-dnl ========================================================
-MOZ_ARG_ENABLE_BOOL(valgrind,
-[  --enable-valgrind       Enable Valgrind integration hooks (default=no)],
-    MOZ_VALGRIND=1,
-    MOZ_VALGRIND= )
-if test -n "$MOZ_VALGRIND"; then
-    MOZ_CHECK_HEADER([valgrind/valgrind.h], [],
-        AC_MSG_ERROR(
-            [--enable-valgrind specified but Valgrind is not installed]))
-    AC_DEFINE(MOZ_VALGRIND)
-    MOZ_VALGRIND=1
-fi
-AC_SUBST(MOZ_VALGRIND)
-
-dnl ========================================================
 dnl instruments
 dnl ========================================================
 if test -n "$MOZ_INSTRUMENTS"; then
     LIBS="$LIBS -framework CoreFoundation"
 fi
 
 dnl ========================================================
 dnl Debug (see Bug 939505)
--- a/moz.configure
+++ b/moz.configure
@@ -138,16 +138,31 @@ include('build/moz.configure/memory.conf
 include('build/moz.configure/headers.configure',
         when='--enable-compile-environment')
 include('build/moz.configure/warnings.configure',
         when='--enable-compile-environment')
 include('build/moz.configure/flags.configure',
         when='--enable-compile-environment')
 
 
+js_option('--enable-valgrind',
+          help='Enable Valgrind integration hooks')
+
+valgrind_h = check_header('valgrind/valgrind.h', when='--enable-valgrind')
+
+@depends('--enable-valgrind', valgrind_h)
+def check_valgrind(valgrind, valgrind_h):
+    if valgrind:
+        if not valgrind_h:
+            die('--enable-valgrind specified but Valgrind is not installed')
+        return True
+
+set_define('MOZ_VALGRIND', check_valgrind)
+set_config('MOZ_VALGRIND', check_valgrind)
+
 @depends(target, host)
 def is_openbsd(target, host):
     return target.kernel == 'OpenBSD' or host.kernel == 'OpenBSD'
 
 option(env='SO_VERSION', nargs=1, default='1.0', when=is_openbsd,
        help='Shared library version for OpenBSD systems')
 
 @depends('SO_VERSION', when=is_openbsd)
--- a/old-configure.in
+++ b/old-configure.in
@@ -655,31 +655,16 @@ fi
 if test "$GNU_CXX"; then
     # FIXME: Let us build with strict aliasing. bug 414641.
     CXXFLAGS="$CXXFLAGS -fno-exceptions -fno-strict-aliasing"
 
     _DEFINES_CXXFLAGS="-DMOZILLA_CLIENT -include $_objdir/mozilla-config.h"
     _USE_CPP_INCLUDE_FLAG=1
 fi
 
-dnl ========================================================
-dnl = Use Valgrind
-dnl ========================================================
-MOZ_ARG_ENABLE_BOOL(valgrind,
-[  --enable-valgrind       Enable Valgrind integration hooks (default=no)],
-    MOZ_VALGRIND=1,
-    MOZ_VALGRIND= )
-if test -n "$MOZ_VALGRIND"; then
-    MOZ_CHECK_HEADER([valgrind/valgrind.h], [],
-        AC_MSG_ERROR(
-            [--enable-valgrind specified but Valgrind is not installed]))
-    AC_DEFINE(MOZ_VALGRIND)
-fi
-AC_SUBST(MOZ_VALGRIND)
-
 # For profiling builds keep the symbol information
 if test "$MOZ_PROFILING" -a -z "$STRIP_FLAGS"; then
     case "$OS_TARGET" in
     Linux|DragonFly|FreeBSD|NetBSD|OpenBSD)
         STRIP_FLAGS="--strip-debug"
         ;;
     esac
 fi