Bug 1907067 - Remove AC_PROG_CC, AC_PROG_CXX and MOZ_CROSS_COMPILER from old-configure r=glandium

Differential Revision: https://phabricator.services.mozilla.com/D216164
This commit is contained in:
serge-sans-paille 2024-08-15 09:39:59 +00:00
parent ed09cb9244
commit 09cc177dea
6 changed files with 15 additions and 119 deletions

1
aclocal.m4 vendored
View File

@ -5,7 +5,6 @@ dnl
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
# Read the user's .mozconfig script. We can't do this in

View File

@ -1,58 +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/.
dnl Several autoconf functions AC_REQUIRE AC_PROG_CPP/AC_PROG_CXXCPP
dnl or AC_HEADER_STDC, meaning they are called even when we don't call
dnl them explicitly.
dnl However, theses checks are not necessary and python configure sets
dnl the corresponding variables already, so just skip those tests
dnl entirely.
define([AC_PROG_CPP],[])
define([AC_PROG_CXXCPP],[])
define([AC_HEADER_STDC], [])
dnl AC_LANG_* set ac_link to the C/C++ compiler, which works fine with
dnl gcc and clang, but not great with clang-cl, where the build system
dnl currently expects to run the linker independently. So LDFLAGS are not
dnl really adapted to be used with clang-cl, which then proceeds to
dnl execute link.exe rather than lld-link.exe.
dnl So when the compiler is clang-cl, we modify ac_link to use a separate
dnl linker call.
define([_MOZ_AC_LANG_C], defn([AC_LANG_C]))
define([AC_LANG_C],
[_MOZ_AC_LANG_C
if test "$CC_TYPE" = "clang-cl"; then
ac_link="$ac_compile"' && ${LINKER} -OUT:conftest${ac_exeext} $LDFLAGS conftest.obj $LIBS 1>&AC_FD_CC'
fi
])
define([_MOZ_AC_LANG_CPLUSPLUS], defn([AC_LANG_CPLUSPLUS]))
define([AC_LANG_CPLUSPLUS],
[_MOZ_AC_LANG_CPLUSPLUS
if test "$CC_TYPE" = "clang-cl"; then
ac_link="$ac_compile"' && ${LINKER} -OUT:conftest${ac_exeext} $LDFLAGS conftest.obj $LIBS 1>&AC_FD_CC'
fi
])
AC_DEFUN([MOZ_CROSS_COMPILER],
[
echo "cross compiling from $host to $target"
dnl AC_CHECK_PROGS manually goes through $PATH, and as such fails to handle
dnl absolute or relative paths. Relative paths wouldn't work anyways, but
dnl absolute paths would. Trick AC_CHECK_PROGS into working in that case by
dnl adding / to PATH. This is temporary until this moves to moz.configure
dnl (soon).
_SAVE_PATH=$PATH
case "${TOOLCHAIN_PREFIX}" in
/*)
PATH="/:$PATH"
;;
esac
AC_PROG_CC
AC_PROG_CXX
PATH=$_SAVE_PATH
])

View File

@ -1713,12 +1713,21 @@ def compiler(
# Set CC/CXX/HOST_CC/HOST_CXX for old-configure, which needs the wrapper
# and the flags that were part of the user input for those variables to
# be provided.
add_old_configure_assignment(
var,
depends_if(valid_compiler)(
lambda x: list(x.wrapper) + [x.compiler] + list(x.flags)
),
)
if var in ("CC", "CXX"):
# FIXME: we should return a plain list here.
@depends_if(valid_compiler)
@imports(_from="mozbuild.shellutil", _import="quote")
def value(x):
return quote(*x.wrapper, x.compiler, *x.flags)
set_config(var, value)
else:
add_old_configure_assignment(
var,
depends_if(valid_compiler)(
lambda x: list(x.wrapper) + [x.compiler] + list(x.flags)
),
)
if host_or_target is target:
add_old_configure_assignment(

1
js/src/aclocal.m4 vendored
View File

@ -5,7 +5,6 @@ dnl
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
define([__MOZ_AC_INIT_PREPARE], defn([AC_INIT_PREPARE]))

View File

@ -16,35 +16,6 @@ if test -z "$JS_STANDALONE"; then
fi
AC_SUBST(autoconfmk)
dnl ========================================================
dnl Checks for compilers.
dnl ========================================================
if test "$COMPILE_ENVIRONMENT"; then
# This prevents mingw from adding .exe when generating executable. Internal use
# only.
ac_exeext=.out
# Note:
# In Mozilla, we use the names $target, $host and $build incorrectly, but are
# too far gone to back out now. See Bug 475488:
# - When we say $target, we mean $host, that is, the system on which
# Mozilla will be run.
# - When we say $host, we mean $build, that is, the system on which Mozilla
# is built.
# - $target (in its correct usage) is for compilers who generate code for a
# different platform than $host, so it would not be used by Mozilla.
if test "$target" != "$host"; then
MOZ_CROSS_COMPILER
else
AC_PROG_CC
AC_PROG_CXX
fi
fi # COMPILE_ENVIRONMENT
dnl ========================================================
dnl =
dnl = Maintainer debug option (no --enable equivalent)

View File

@ -11,30 +11,6 @@ AC_INIT(config/config.mk)
AC_CONFIG_AUX_DIR(${srcdir}/build/autoconf)
AC_CANONICAL_SYSTEM
dnl ========================================================
dnl Checks for compilers.
dnl ========================================================
if test "$COMPILE_ENVIRONMENT"; then
# This prevents mingw from adding .exe when generating executable. Internal use
# only.
ac_exeext=.out
if test "$target" != "$host"; then
MOZ_CROSS_COMPILER
else
AC_PROG_CC
case "$target" in
*-mingw*)
# Work around the conftest.exe access problem on Windows
sleep 2
esac
AC_PROG_CXX
fi
fi # COMPILE_ENVIRONMENT
dnl ========================================================
dnl =
dnl = Application