Bug 1905600 - begin migration of CFLAGS, CXXFLAGS and LDFLAGS from old-configure to moz.configure r=glandium

Differential Revision: https://phabricator.services.mozilla.com/D215378
This commit is contained in:
serge-sans-paille 2024-07-17 23:45:25 +00:00
parent ea9a97547c
commit e84f42f0da
9 changed files with 72 additions and 105 deletions

1
aclocal.m4 vendored
View File

@ -7,7 +7,6 @@ builtin(include, build/autoconf/hooks.m4)dnl
builtin(include, build/autoconf/config.status.m4)dnl
builtin(include, build/autoconf/toolchain.m4)dnl
builtin(include, build/autoconf/altoptions.m4)dnl
builtin(include, build/autoconf/arch.m4)dnl
builtin(include, build/autoconf/clang-plugin.m4)dnl
# Read the user's .mozconfig script. We can't do this in

View File

@ -1,14 +0,0 @@
dnl This Source Code Form is subject to the terms of the Mozilla Public
dnl License, v. 2.0. If a copy of the MPL was not distributed with this
dnl file, You can obtain one at http://mozilla.org/MPL/2.0/.
AC_DEFUN([MOZ_ARCH_OPTS],
[
if test -n "$_ARM_FLAGS"; then
CFLAGS="$CFLAGS $_ARM_FLAGS"
CXXFLAGS="$CXXFLAGS $_ARM_FLAGS"
if test -n "$_THUMB_FLAGS"; then
LDFLAGS="$LDFLAGS $_THUMB_FLAGS"
fi
fi
])

View File

@ -172,10 +172,6 @@ def all_arm_flags(flags, interwork):
return flags + interwork
add_old_configure_assignment("_ARM_FLAGS", all_arm_flags)
add_old_configure_assignment("_THUMB_FLAGS", thumb_option)
@depends(configure_cache, c_compiler, all_arm_flags)
@checking("ARM version support in compiler", lambda x: x.arm_arch)
@imports(_from="textwrap", _import="dedent")

View File

@ -610,6 +610,32 @@ def os_cppflags(env_cppflags):
return flags
@depends("CFLAGS", compilation_flags, android_flags, all_arm_flags)
@imports(_from="mozbuild.shellutil", _import="split")
def os_cflags(env_cflags, compilation_flags, android_flags, all_arm_flags):
flags = []
if android_flags:
flags.extend(android_flags.cflags)
if all_arm_flags:
flags.extend(all_arm_flags)
flags.extend(compilation_flags.cflags)
flags.extend(split(env_cflags[0]))
return flags
@depends("CXXFLAGS", compilation_flags, android_flags, all_arm_flags)
@imports(_from="mozbuild.shellutil", _import="split")
def os_cxxflags(env_cxxflags, compilation_flags, android_flags, all_arm_flags):
flags = []
if android_flags:
flags.extend(android_flags.cxxflags)
if all_arm_flags:
flags.extend(all_arm_flags)
flags.extend(compilation_flags.cxxflags)
flags.extend(split(env_cxxflags[0]))
return flags
@depends(
"ASFLAGS",
asm_flags,
@ -642,12 +668,24 @@ def os_asflags(
return flags
# Please keep these last in this file.
add_old_configure_assignment("_COMPILATION_LDFLAGS", linker_flags.ldflags)
add_old_configure_assignment("CPPFLAGS", os_cppflags)
@depends("LDFLAGS", linker_flags, android_flags, thumb_option)
@imports(_from="mozbuild.shellutil", _import="split")
def os_ldflags(env_ldflags, linker_flags, android_flags, thumb_option):
flags = []
if android_flags:
flags.extend(android_flags.ldflags)
if thumb_option:
flags.extend(thumb_option)
flags.extend(split(env_ldflags[0]))
flags.extend(linker_flags.ldflags)
return flags
add_old_configure_assignment("_COMPILATION_CFLAGS", compilation_flags.cflags)
add_old_configure_assignment("_COMPILATION_CXXFLAGS", compilation_flags.cxxflags)
# Please keep these last in this file.
add_old_configure_assignment("CPPFLAGS", os_cppflags)
add_old_configure_assignment("CFLAGS", os_cflags)
add_old_configure_assignment("CXXFLAGS", os_cxxflags)
add_old_configure_assignment("LDFLAGS", os_ldflags)
set_config("HOST_CPPFLAGS", host_cppflags)
set_config("HOST_CFLAGS", host_cflags)

View File

@ -46,6 +46,22 @@ option(
)
option(
env="CFLAGS",
help="Extra flags for compiling C sources.",
nargs=1,
default="",
)
option(
env="CXXFLAGS",
help="Extra flags for compiling C++ sources.",
nargs=1,
default="",
)
option(
env="ASFLAGS",
help="Extra flags for assembling sources.",
@ -54,6 +70,14 @@ option(
)
option(
env="LDFLAGS",
help="Extra flags for linking object files.",
nargs=1,
default="",
)
option(
env="MOZ_OPTIMIZE_FLAGS",
help="Extra optimization flags.",
@ -61,6 +85,7 @@ option(
default="",
)
# Code optimization
# ==============================================================

View File

@ -9,6 +9,10 @@ NO_CACHE=1
# Override any toolchain defines we've inherited from other mozconfigs.
unset CC
unset CXX
unset CPPFLAGS
unset CFLAGS
unset CXXFLAGS
unset LDFLAGS
unset HOST_CC
unset HOST_CXX
unset HOST_CPPFLAGS

1
js/src/aclocal.m4 vendored
View File

@ -7,7 +7,6 @@ builtin(include, ../../build/autoconf/hooks.m4)dnl
builtin(include, ../../build/autoconf/config.status.m4)dnl
builtin(include, ../../build/autoconf/toolchain.m4)dnl
builtin(include, ../../build/autoconf/altoptions.m4)dnl
builtin(include, ../../build/autoconf/arch.m4)dnl
builtin(include, ../../build/autoconf/clang-plugin.m4)dnl
define([__MOZ_AC_INIT_PREPARE], defn([AC_INIT_PREPARE]))

View File

@ -11,27 +11,6 @@ AC_INIT(js/src/jsapi.h)
AC_CONFIG_AUX_DIR(${srcdir}/build/autoconf)
AC_CANONICAL_SYSTEM
dnl ========================================================
dnl =
dnl = Don't change the following lines. Doing so breaks:
dnl =
dnl = CFLAGS="-foo" ./configure
dnl =
dnl ========================================================
CFLAGS="${CFLAGS=}"
CXXFLAGS="${CXXFLAGS=}"
LDFLAGS="${LDFLAGS=}"
dnl Propagate extra android flags
dnl =============================
case "$target" in
*-android*|*-linuxandroid*)
LDFLAGS="$ANDROID_LDFLAGS $LDFLAGS"
CFLAGS="$ANDROID_CFLAGS $CFLAGS"
CXXFLAGS="$ANDROID_CXXFLAGS $CXXFLAGS"
;;
esac
dnl Set the minimum version of toolkit libs used by mozilla
dnl ========================================================
@ -70,10 +49,6 @@ fi
fi # COMPILE_ENVIRONMENT
dnl Configure platform-specific CPU architecture compiler options.
dnl ==============================================================
MOZ_ARCH_OPTS
dnl ========================================================
dnl System overrides of the defaults for target
dnl ========================================================
@ -214,19 +189,6 @@ AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
AC_SUBST(MOZ_APP_DISPLAYNAME)
dnl Echo the CFLAGS to remove extra whitespace.
CFLAGS=`echo \
$_COMPILATION_CFLAGS \
$CFLAGS`
CXXFLAGS=`echo \
$_COMPILATION_CXXFLAGS \
$CXXFLAGS`
LDFLAGS=`echo \
$LDFLAGS \
$_COMPILATION_LDFLAGS`
OS_CFLAGS="$CFLAGS"
OS_CXXFLAGS="$CXXFLAGS"
OS_LDFLAGS="$LDFLAGS"

View File

@ -11,29 +11,6 @@ AC_INIT(config/config.mk)
AC_CONFIG_AUX_DIR(${srcdir}/build/autoconf)
AC_CANONICAL_SYSTEM
dnl ========================================================
dnl =
dnl = Don't change the following lines. Doing so breaks:
dnl =
dnl = CFLAGS="-foo" ./configure
dnl =
dnl ========================================================
CFLAGS="${CFLAGS=}"
CXXFLAGS="${CXXFLAGS=}"
LDFLAGS="${LDFLAGS=}"
dnl Propagate extra android flags
dnl =============================
case "$target" in
*-android*|*-linuxandroid*)
LDFLAGS="$ANDROID_LDFLAGS $LDFLAGS"
CFLAGS="$ANDROID_CFLAGS $CFLAGS"
CXXFLAGS="$ANDROID_CXXFLAGS $CXXFLAGS"
;;
esac
dnl Set the minimum version of toolkit libs used by mozilla
dnl ========================================================
@ -64,12 +41,6 @@ fi
fi # COMPILE_ENVIRONMENT
dnl Configure platform-specific CPU architecture compiler options.
dnl ==============================================================
if test "$COMPILE_ENVIRONMENT"; then
MOZ_ARCH_OPTS
fi # COMPILE_ENVIRONMENT
dnl ========================================================
dnl System overrides of the defaults for target
dnl ========================================================
@ -358,19 +329,6 @@ AC_DEFINE_UNQUOTED(MOZ_APP_UA_VERSION, "$MOZ_APP_VERSION")
AC_SUBST(MOZ_APP_MAXVERSION)
dnl Echo the CFLAGS to remove extra whitespace.
CFLAGS=`echo \
$_COMPILATION_CFLAGS \
$CFLAGS`
CXXFLAGS=`echo \
$_COMPILATION_CXXFLAGS \
$CXXFLAGS`
LDFLAGS=`echo \
$LDFLAGS \
$_COMPILATION_LDFLAGS`
OS_CFLAGS="$CFLAGS"
OS_CXXFLAGS="$CXXFLAGS"
OS_LDFLAGS="$LDFLAGS"