Bug 1257434 - Move --enable-vtune and --enable-profiling to moz.configure. r=ted draft
authorMike Hommey <mh+mozilla@glandium.org>
Thu, 17 Mar 2016 16:24:30 +0900
changeset 341880 b6b1061df94ed8670420354e8543b09b1028d8ba
parent 341879 8689910b342ad73850c85c0bd8141fcc40607c5e
child 516487 923295d932bdf8940d65f44de31f20628e22115f
push id13315
push userbmo:mh+mozilla@glandium.org
push dateThu, 17 Mar 2016 23:55:06 +0000
reviewersted
bugs1257434
milestone48.0a1
Bug 1257434 - Move --enable-vtune and --enable-profiling to moz.configure. r=ted old-configure and js/src/old-configure interestingly didn't handle both the same way. But vtune support is only actually implemented in js/src, so only the rules from js/src/old-configure matter (nothing was enforcing the decistion from old-configure to js/src/old-configure), and this is what is implemented here.
build/moz.configure/init.configure
build/moz.configure/old.configure
js/moz.configure
js/src/old-configure.in
old-configure.in
toolkit/moz.configure
--- a/build/moz.configure/init.configure
+++ b/build/moz.configure/init.configure
@@ -260,17 +260,19 @@ def wanted_mozconfig_variables(help):
          'MOZ_ARTIFACT_BUILDS',
          'MOZ_BUILD_APP',
          'MOZ_CALLGRIND',
          'MOZ_DMD',
          'MOZ_FMP4',
          'MOZ_INSTRUMENT_EVENT_LOOP',
          'MOZ_INSTRUMENTS',
          'MOZ_JPROF',
+         'MOZ_PROFILING',
          'MOZ_USE_SYSTRACE',
+         'MOZ_VTUNE',
          'MOZTTDIR',
          'PERL',
          'RPMBUILD',
          'TAR',
          'UNZIP',
          'USE_FC_FREETYPE',
          'WITHOUT_X',
          'XARGS',
--- a/build/moz.configure/old.configure
+++ b/build/moz.configure/old.configure
@@ -237,17 +237,16 @@ def old_configure_options(*options):
     '--enable-perf',
     '--enable-permissions',
     '--enable-pie',
     '--enable-png-arm-neon-support',
     '--enable-posix-nspr-emulation',
     '--enable-pref-extensions',
     '--enable-printing',
     '--enable-profilelocking',
-    '--enable-profiling',
     '--enable-pulseaudio',
     '--enable-raw',
     '--enable-readline',
     '--enable-reflow-perf',
     '--enable-release',
     '--enable-replace-malloc',
     '--enable-require-all-d3dc-versions',
     '--enable-rust',
@@ -278,17 +277,16 @@ def old_configure_options(*options):
     '--enable-ui-locale',
     '--enable-universalchardet',
     '--enable-update-channel',
     '--enable-update-packaging',
     '--enable-updater',
     '--enable-url-classifier',
     '--enable-valgrind',
     '--enable-verify-mar',
-    '--enable-vtune',
     '--enable-warnings-as-errors',
     '--enable-webapp-runtime',
     '--enable-webrtc',
     '--enable-websms-backend',
     '--enable-webspeech',
     '--enable-webspeechtestbackend',
     '--enable-xul',
     '--enable-zipwriter',
--- a/js/moz.configure
+++ b/js/moz.configure
@@ -79,17 +79,44 @@ js_option('--enable-instruments', env='M
 def instruments(value, target):
     if value and target.os != 'OSX':
         error('--enable-instruments cannot be used when targeting %s'
               % target.os)
     if value:
         set_config('MOZ_INSTRUMENTS', '1')
         set_define('MOZ_INSTRUMENTS', '1')
         add_old_configure_assignment('MOZ_INSTRUMENTS', '1')
+        imply_option('--enable-profiling', reason='--enable-instruments')
 
 
 js_option('--enable-callgrind', env='MOZ_CALLGRIND',
           help='Enable callgrind profiling')
 
 @depends('--enable-callgrind')
 def callgrind(value):
     if value:
         set_define('MOZ_CALLGRIND', '1')
+        imply_option('--enable-profiling')
+
+
+js_option('--enable-profiling', env='MOZ_PROFILING',
+          help='Set compile flags necessary for using sampling profilers '
+               '(e.g. shark, perf)')
+
+@depends('--enable-profiling', target)
+def vtune(value, target):
+    if value:
+        set_config('MOZ_PROFILING', '1')
+        set_define('MOZ_PROFILING', '1')
+        add_old_configure_assignment('MOZ_PROFILING', '1')
+
+        if target.kernel == 'WINNT' or (target.kernel == 'Linux' and
+                                        target.os == 'GNU'):
+            imply_option('--enable-vtune', reason='--enable-profiling')
+
+
+js_option('--enable-vtune', env='MOZ_VTUNE', help='Enable vtune profiling')
+
+@depends('--enable-vtune')
+def profiling(value):
+    if value:
+        set_config('MOZ_VTUNE', '1')
+        set_define('MOZ_VTUNE', '1')
--- a/js/src/old-configure.in
+++ b/js/src/old-configure.in
@@ -867,24 +867,16 @@ if test "$result" = "yes"; then
     AC_DEFINE(HAVE_64BIT_BUILD)
     HAVE_64BIT_BUILD=1
 fi
 AC_SUBST(HAVE_64BIT_BUILD)
 AC_LANG_RESTORE
 fi # COMPILE_ENVIRONMENT
 
 dnl ========================================================
-dnl = Use profiling compile flags
-dnl ========================================================
-MOZ_ARG_ENABLE_BOOL(profiling,
-[  --enable-profiling      Set compile flags necessary for using sampling profilers (e.g. shark, perf)],
-    MOZ_PROFILING=1,
-    MOZ_PROFILING= )
-
-dnl ========================================================
 dnl System overrides of the defaults for host
 dnl ========================================================
 case "$host" in
 *mingw*)
     if test -n "$_WIN32_MSVC"; then
         HOST_AR=lib
         HOST_AR_FLAGS='-NOLOGO -OUT:$@'
         HOST_CFLAGS="$HOST_CFLAGS -TC -nologo"
@@ -2332,46 +2324,23 @@ AC_SUBST(JS_CODEGEN_X86)
 AC_SUBST(JS_CODEGEN_X64)
 AC_SUBST(JS_CODEGEN_NONE)
 AC_SUBST(JS_DISASM_ARM)
 AC_SUBST(ASMJS_MAY_USE_SIGNAL_HANDLERS)
 AC_SUBST(ASMJS_MAY_USE_SIGNAL_HANDLERS_FOR_OOB)
 AC_SUBST(ASMJS_MAY_USE_SIGNAL_HANDLERS_FOR_UNALIGNED)
 
 dnl ========================================================
-dnl jprof
-dnl ========================================================
-if test -n "$MOZ_JPROF"; then
-    MOZ_PROFILING=1
-fi
-
-dnl ========================================================
 dnl instruments
 dnl ========================================================
 if test -n "$MOZ_INSTRUMENTS"; then
-    MOZ_PROFILING=1
     LIBS="$LIBS -framework CoreFoundation"
 fi
 
 dnl ========================================================
-dnl callgrind
-dnl ========================================================
-if test -n "$MOZ_CALLGRIND"; then
-    MOZ_PROFILING=1
-fi
-
-dnl ========================================================
-dnl vtune
-dnl ========================================================
-MOZ_ARG_ENABLE_BOOL(vtune,
-[  --enable-vtune          Enable vtune profiling. Implies --enable-profiling.],
-    MOZ_VTUNE=1,
-    MOZ_VTUNE= )
-
-dnl ========================================================
 dnl JitSpew.  Enabled by default in debug builds.
 dnl ========================================================
 MOZ_ARG_ENABLE_BOOL(jitspew,
 [  --enable-jitspew        Enable the Jit spew and IONFLAGS.],
     JS_JITSPEW=1,
     JS_JITSPEW= )
 
 if test -n "$JS_JITSPEW" -o -n "$MOZ_DEBUG"; then
@@ -2383,32 +2352,16 @@ AC_SUBST(JS_JITSPEW)
 dnl ========================================================
 dnl Debug (see Bug 939505)
 dnl ========================================================
 if test -n "$MOZ_DEBUG"; then
     AC_DEFINE(JS_DEBUG)
 fi
 
 dnl ========================================================
-dnl Profiling
-dnl ========================================================
-if test -n "$MOZ_PROFILING"; then
-    AC_DEFINE(MOZ_PROFILING)
-
-    case "$OS_TARGET" in
-        Linux) MOZ_VTUNE=1 ;;
-        WINNT) MOZ_VTUNE=1 ;;
-    esac
-fi
-
-if test -n "$MOZ_VTUNE"; then
-    AC_DEFINE(MOZ_VTUNE)
-fi
-
-dnl ========================================================
 dnl Zealous JavaScript GC
 dnl ========================================================
 MOZ_ARG_ENABLE_BOOL(gczeal,
 [  --enable-gczeal         Enable zealous GCing],
     JS_GC_ZEAL=1,
     JS_GC_ZEAL= )
 if test -n "$JS_GC_ZEAL" -o -n "$MOZ_DEBUG"; then
     AC_DEFINE(JS_GC_ZEAL)
@@ -2767,18 +2720,16 @@ AC_SUBST(MC)
 AC_SUBST(WINDRES)
 AC_SUBST(IMPLIB)
 AC_SUBST(FILTER)
 AC_SUBST(BIN_FLAGS)
 AC_SUBST(MOZ_DEBUG)
 AC_SUBST(MOZ_DEBUG_SYMBOLS)
 AC_SUBST(MOZ_DEBUG_LDFLAGS)
 AC_SUBST(WARNINGS_AS_ERRORS)
-AC_SUBST(MOZ_VTUNE)
-AC_SUBST(MOZ_PROFILING)
 AC_SUBST(LIBICONV)
 
 AC_SUBST(ENABLE_TESTS)
 
 AC_SUBST(ENABLE_STRIP)
 AC_SUBST(PKG_SKIP_STRIP)
 AC_SUBST(INCREMENTAL_LINKER)
 AC_SUBST(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS)
--- a/old-configure.in
+++ b/old-configure.in
@@ -1182,71 +1182,30 @@ EOF
   if test -z "$MOZ_RUST"; then
     AC_MSG_ERROR([rustc does not support MacOS X $MACOSX_DEPLOYMENT_TARGET
       Add 'ac_add_options --enable-macos-target=10.7' (or later)
       to mozconfig, disable Rust support, or use an alternate toolchain.])
   fi
 fi
 
 dnl ========================================================
-dnl = Use profiling compile flags
-dnl ========================================================
-MOZ_ARG_ENABLE_BOOL(profiling,
-[  --enable-profiling      Set compile flags necessary for using sampling profilers (e.g. shark, perf)],
-    MOZ_PROFILING=1,
-    MOZ_PROFILING= )
-
-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)
 
-dnl ========================================================
-dnl jprof
-dnl ========================================================
-if test -n "$MOZ_JPROF"; then
-    MOZ_PROFILING=1
-fi
-
-dnl ========================================================
-dnl instruments
-dnl ========================================================
-if test -n "$MOZ_INSTRUMENTS"; then
-    MOZ_PROFILING=1
-fi
-
-dnl ========================================================
-dnl callgrind
-dnl ========================================================
-if test -n "$MOZ_CALLGRIND"; then
-    MOZ_PROFILING=1
-fi
-
-dnl ========================================================
-dnl vtune
-dnl ========================================================
-MOZ_ARG_ENABLE_BOOL(vtune,
-[  --enable-vtune          Enable vtune profiling. Implies --enable-profiling.],
-    MOZ_VTUNE=1,
-    MOZ_VTUNE= )
-if test -n "$MOZ_VTUNE"; then
-    MOZ_PROFILING=1
-    AC_DEFINE(MOZ_VTUNE)
-fi
-
 # 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
@@ -1258,24 +1217,16 @@ dnl ====================================
 if test "$MOZ_DMD"; then
     if test "${CPU_ARCH}" = "arm"; then
         CFLAGS="$CFLAGS -funwind-tables"
         CXXFLAGS="$CXXFLAGS -funwind-tables"
     fi
 
     MOZ_MEMORY=1                        # DMD enables jemalloc
     MOZ_REPLACE_MALLOC=1                # DMD enables replace-malloc
-    MOZ_PROFILING=1                     # DMD enables profiling
-fi
-
-dnl ========================================================
-dnl Profiling
-dnl ========================================================
-if test -n "$MOZ_PROFILING"; then
-    AC_DEFINE(MOZ_PROFILING)
 fi
 
 dnl ========================================================
 dnl System overrides of the defaults for host
 dnl ========================================================
 case "$host" in
 *mingw*)
     if test -n "$_WIN32_MSVC"; then
@@ -7373,18 +7324,16 @@ AC_SUBST(FILTER)
 AC_SUBST(BIN_FLAGS)
 AC_SUBST(MOZ_AUTH_EXTENSION)
 AC_SUBST(MOZ_PREF_EXTENSIONS)
 AC_SUBST(MOZ_DEBUG)
 AC_SUBST(MOZ_DEBUG_SYMBOLS)
 AC_SUBST(MOZ_DEBUG_LDFLAGS)
 AC_SUBST(WARNINGS_AS_ERRORS)
 AC_SUBST_SET(MOZ_EXTENSIONS)
-AC_SUBST(MOZ_VTUNE)
-AC_SUBST(MOZ_PROFILING)
 AC_SUBST(LIBICONV)
 AC_SUBST(MOZ_PLACES)
 AC_SUBST(MOZ_SOCIAL)
 AC_SUBST(MOZ_TOOLKIT_SEARCH)
 AC_SUBST(MOZ_FEEDS)
 AC_SUBST(NS_PRINTING)
 AC_SUBST(MOZ_HELP_VIEWER)
 AC_SUBST(TOOLCHAIN_PREFIX)
--- a/toolkit/moz.configure
+++ b/toolkit/moz.configure
@@ -24,17 +24,17 @@ def systrace(value, target):
 option('--enable-jprof', env='MOZ_JPROF',
        help='Enable jprof profiling tool (needs mozilla/tools/jprof)')
 
 @depends('--enable-jprof')
 def jprof(value):
     if value:
         set_config('MOZ_JPROF', '1')
         set_define('MOZ_JPROF', '1')
-        add_old_configure_assignment('MOZ_JPROF', '1')
+        imply_option('--enable-profiling')
 
 
 @depends(target)
 def sps_profiler(target):
     if target.os == 'Android':
         return target.cpu in ('arm', 'x86')
     elif target.kernel == 'Linux':
         return target.cpu in ('x86', 'x86_64')
@@ -52,16 +52,17 @@ option('--enable-dmd', env='MOZ_DMD',
             'Also enables jemalloc, replace-malloc and profiling')
 
 @depends('--enable-dmd')
 def dmd(value):
     if value:
         set_config('MOZ_DMD', '1')
         set_define('MOZ_DMD', '1')
         add_old_configure_assignment('MOZ_DMD', '1')
+        imply_option('--enable-profiling')
 
 
 # Javascript engine
 # ==============================================================
 include('../js/moz.configure')
 
 
 # L10N