Bug 1279369 - Move --enable-debug, MOZ_DEBUG_FLAGS, and --enable-debug-symbols to Python configure. r=glandium
Setting MOZ_DEBUG_SYMBOLS as a define was not moved, as this value is not
checked, and exporting MOZ_DEBUG_SYMBOLS was not moved, as this would only
impact nspr, and we're no longer using the nspr build system.
MozReview-Commit-ID: EvBTunhxcsr
--- a/build/autoconf/compiler-opts.m4
+++ b/build/autoconf/compiler-opts.m4
@@ -90,40 +90,16 @@ fi
dnl ========================================================
dnl =
dnl = Debugging Options
dnl =
dnl ========================================================
AC_DEFUN([MOZ_DEBUGGING_OPTS],
[
-dnl Debug info is ON by default.
-if test -z "$MOZ_DEBUG_FLAGS"; then
- if test -n "$_MSC_VER"; then
- MOZ_DEBUG_FLAGS="-Zi"
- else
- MOZ_DEBUG_FLAGS="-g"
- fi
-fi
-
-AC_SUBST(MOZ_DEBUG_FLAGS)
-
-MOZ_ARG_ENABLE_STRING(debug,
-[ --enable-debug[=DBG] Enable building with developer debug info
- (using compiler flags DBG)],
-[ if test "$enableval" != "no"; then
- MOZ_DEBUG=1
- if test -n "$enableval" -a "$enableval" != "yes"; then
- MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
- _MOZ_DEBUG_FLAGS_SET=1
- fi
- else
- MOZ_DEBUG=
- fi ],
- MOZ_DEBUG=)
if test -z "$MOZ_DEBUG" -o -n "$MOZ_ASAN"; then
MOZ_NO_DEBUG_RTL=1
fi
AC_SUBST(MOZ_NO_DEBUG_RTL)
MOZ_DEBUG_ENABLE_DEFS="DEBUG TRACING"
@@ -151,41 +127,16 @@ if test -n "$MOZ_DEBUG"; then
MOZ_DEBUG_DEFINES="$MOZ_DEBUG_ENABLE_DEFS"
else
MOZ_DEBUG_DEFINES="NDEBUG TRIMMED"
fi
AC_SUBST_LIST(MOZ_DEBUG_DEFINES)
-dnl ========================================================
-dnl = Enable generation of debug symbols
-dnl ========================================================
-MOZ_ARG_ENABLE_STRING(debug-symbols,
-[ --enable-debug-symbols[=DBG]
- Enable debugging symbols (using compiler flags DBG)],
-[ if test "$enableval" != "no"; then
- MOZ_DEBUG_SYMBOLS=1
- if test -n "$enableval" -a "$enableval" != "yes"; then
- if test -z "$_MOZ_DEBUG_FLAGS_SET"; then
- MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
- else
- AC_MSG_ERROR([--enable-debug-symbols flags cannot be used with --enable-debug flags])
- fi
- fi
- else
- MOZ_DEBUG_SYMBOLS=
- fi ],
- MOZ_DEBUG_SYMBOLS=1)
-
-if test -n "$MOZ_DEBUG" -o -n "$MOZ_DEBUG_SYMBOLS"; then
- AC_DEFINE(MOZ_DEBUG_SYMBOLS)
- export MOZ_DEBUG_SYMBOLS
-fi
-
])
dnl A high level macro for selecting compiler options.
AC_DEFUN([MOZ_COMPILER_OPTS],
[
MOZ_DEBUGGING_OPTS
MOZ_RTTI
if test "$CLANG_CXX"; then
--- a/build/moz.configure/old.configure
+++ b/build/moz.configure/old.configure
@@ -167,19 +167,17 @@ def old_configure_options(*options):
'--enable-clang-plugin',
'--enable-content-sandbox',
'--enable-cookies',
'--enable-cpp-rtti',
'--enable-crashreporter',
'--enable-ctypes',
'--enable-dbm',
'--enable-dbus',
- '--enable-debug',
'--enable-debug-js-modules',
- '--enable-debug-symbols',
'--enable-directshow',
'--enable-dtrace',
'--enable-dump-painting',
'--enable-elf-hack',
'--enable-extensions',
'--enable-faststripe',
'--enable-feeds',
'--enable-gamepad',
--- a/build/moz.configure/toolchain.configure
+++ b/build/moz.configure/toolchain.configure
@@ -599,8 +599,52 @@ def compiler(language, host_or_target, c
c_compiler = compiler('C', target)
cxx_compiler = compiler('C++', target, c_compiler=c_compiler)
host_c_compiler = compiler('C', host, other_compiler=c_compiler)
host_cxx_compiler = compiler('C++', host, c_compiler=host_c_compiler,
other_compiler=cxx_compiler,
other_c_compiler=c_compiler)
+
+@depends(c_compiler)
+def default_debug_flags(compiler_info):
+ # Debug info is ON by default.
+ if compiler_info.type == 'msvc':
+ return '-Zi'
+ return '-g'
+
+option(env='MOZ_DEBUG_FLAGS',
+ nargs=1,
+ help='Debug compiler flags')
+
+js_option('--enable-debug-symbols',
+ nargs='?',
+ default=True,
+ help='Enable debug symbols using the given compiler flags')
+
+@depends('--enable-debug-symbols', '--enable-debug')
+def debug_symbols(debug_symbols, debug):
+ if debug_symbols or debug:
+ return True
+
+set_config('MOZ_DEBUG_SYMBOLS', debug_symbols)
+
+@depends('MOZ_DEBUG_FLAGS', '--enable-debug', '--enable-debug-symbols',
+ default_debug_flags)
+def debug_flags(env_debug_flags, enable_debug_flags, debug_symbols_flags,
+ default_debug_flags):
+ if len(enable_debug_flags) and len(debug_symbols_flags):
+ die('--enable-debug-symbols flags cannot be used with --enable-debug flags')
+ # If MOZ_DEBUG_FLAGS is set, and --enable-debug is set to a value,
+ # --enable-debug takes precedence.
+ if len(enable_debug_flags):
+ return enable_debug_flags[0]
+ # If MOZ_DEBUG_FLAGS is set, and --enable-debug-symbols is set to a value,
+ # --enable-debug-symbols takes precedence.
+ if len(debug_symbols_flags):
+ return debug_symbols_flags[0]
+ if env_debug_flags:
+ return env_debug_flags[0]
+ return default_debug_flags
+
+set_config('MOZ_DEBUG_FLAGS', debug_flags)
+add_old_configure_assignment('MOZ_DEBUG_FLAGS', debug_flags)
--- a/js/src/old-configure.in
+++ b/js/src/old-configure.in
@@ -2446,17 +2446,16 @@ AC_SUBST(AS_DASH_C_FLAG)
AC_SUBST(LD)
AC_SUBST(RC)
AC_SUBST(RCFLAGS)
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(LIBICONV)
AC_SUBST(ENABLE_STRIP)
AC_SUBST(PKG_SKIP_STRIP)
AC_SUBST(INCREMENTAL_LINKER)
--- a/moz.configure
+++ b/moz.configure
@@ -80,16 +80,24 @@ def linux_gtest_defines(target, enable_t
set_define('GTEST_OS_LINUX_ANDROID',
delayed_getattr(linux_gtest_defines, 'os_linux_android'))
set_define('GTEST_USE_OWN_TR1_TUPLE',
delayed_getattr(linux_gtest_defines, 'use_own_tr1_tuple'))
set_define('GTEST_HAS_CLONE',
delayed_getattr(linux_gtest_defines, 'has_clone'))
+js_option('--enable-debug',
+ nargs='?',
+ help='Enable building with developer debug info '
+ '(using the given compiler flags).')
+
+add_old_configure_assignment('MOZ_DEBUG',
+ depends_if('--enable-debug')(lambda _: True))
+
@depends('--disable-compile-environment', '--help')
def toolchain_include(compile_env, help):
if compile_env:
return 'build/moz.configure/toolchain.configure'
include(toolchain_include)
@depends('--disable-compile-environment', '--help')
--- a/old-configure.in
+++ b/old-configure.in
@@ -6479,17 +6479,16 @@ AC_SUBST(RC)
AC_SUBST(RCFLAGS)
AC_SUBST(WINDRES)
AC_SUBST(IMPLIB)
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(LIBICONV)
AC_SUBST(MOZ_TOOLKIT_SEARCH)
AC_SUBST(MOZ_FEEDS)
AC_SUBST(NS_PRINTING)
AC_SUBST(MOZ_HELP_VIEWER)