forked from mirrors/gecko-dev
Bug 1892043 - Move MOZ_EXPAND_LIBS check to moz.configure r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D207752
This commit is contained in:
parent
adc8165284
commit
a40d3c0d23
6 changed files with 67 additions and 54 deletions
1
aclocal.m4
vendored
1
aclocal.m4
vendored
|
|
@ -10,7 +10,6 @@ builtin(include, build/autoconf/altoptions.m4)dnl
|
|||
builtin(include, build/autoconf/mozprog.m4)dnl
|
||||
builtin(include, build/autoconf/mozheader.m4)dnl
|
||||
builtin(include, build/autoconf/compiler-opts.m4)dnl
|
||||
builtin(include, build/autoconf/expandlibs.m4)dnl
|
||||
builtin(include, build/autoconf/arch.m4)dnl
|
||||
builtin(include, build/autoconf/android.m4)dnl
|
||||
builtin(include, build/autoconf/clang-plugin.m4)dnl
|
||||
|
|
|
|||
|
|
@ -1,46 +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_EXPAND_LIBS],
|
||||
[
|
||||
dnl ========================================================
|
||||
dnl =
|
||||
dnl = Check what kind of list files are supported by the
|
||||
dnl = linker
|
||||
dnl =
|
||||
dnl ========================================================
|
||||
|
||||
AC_CACHE_CHECK(what kind of list files are supported by the linker,
|
||||
moz_cv_expand_libs_list_style,
|
||||
[echo "int main() {return 0;}" > conftest.${ac_ext}
|
||||
if AC_TRY_COMMAND(${CC-cc} -o conftest.${OBJ_SUFFIX} -c $CFLAGS $CPPFLAGS conftest.${ac_ext} 1>&5) && test -s conftest.${OBJ_SUFFIX}; then
|
||||
if test "$CC_TYPE" = "clang-cl"; then
|
||||
link="$LINKER -OUT:conftest${ac_exeext}"
|
||||
else
|
||||
link="${CC-cc} -o conftest${ac_exeext}"
|
||||
fi
|
||||
echo "conftest.${OBJ_SUFFIX}" > conftest.list
|
||||
if AC_TRY_COMMAND($link $LDFLAGS [-Wl,@conftest.list] $LIBS 1>&5) && test -s conftest${ac_exeext}; then
|
||||
moz_cv_expand_libs_list_style=linkerlist
|
||||
|
||||
dnl -filelist is for the OS X linker. We need to try -filelist first
|
||||
dnl because clang understands @file, but may pass an oversized argument
|
||||
dnl list to the linker depending on the contents of @file.
|
||||
elif AC_TRY_COMMAND($link $LDFLAGS [-Wl,-filelist,conftest.list] $LIBS 1>&5) && test -s conftest${ac_exeext}; then
|
||||
moz_cv_expand_libs_list_style=filelist
|
||||
elif AC_TRY_COMMAND($link $LDFLAGS [@conftest.list] $LIBS 1>&5) && test -s conftest${ac_exeext}; then
|
||||
moz_cv_expand_libs_list_style=list
|
||||
else
|
||||
AC_ERROR([Couldn't find one that works])
|
||||
fi
|
||||
else
|
||||
dnl We really don't expect to get here, but just in case
|
||||
AC_ERROR([couldn't compile a simple C file])
|
||||
fi
|
||||
rm -rf conftest*])
|
||||
|
||||
EXPAND_LIBS_LIST_STYLE=$moz_cv_expand_libs_list_style
|
||||
AC_SUBST(EXPAND_LIBS_LIST_STYLE)
|
||||
|
||||
])
|
||||
|
|
@ -223,6 +223,73 @@ def check_Bsymbolic(enable_asan, building_with_gnu_cc):
|
|||
# Using -Wl,-Bsymbolic ensures no exported symbol can be interposed.
|
||||
check_and_add_linker_flag("-Wl,-Bsymbolic", when=check_Bsymbolic)
|
||||
|
||||
|
||||
# Check what kind of list files are supported by the linker
|
||||
@depends(c_compiler, link, linker_ldflags, extra_toolchain_flags)
|
||||
@checking("what kind of list files are supported by the linker")
|
||||
@imports("os")
|
||||
@imports(_from="__builtin__", _import="open")
|
||||
@imports(_from="tempfile", _import="mkstemp")
|
||||
def expand_libs_list_style(c_compiler, link, linker_flags, extra_flags):
|
||||
objfd, objname = mkstemp(prefix="conftest.", suffix=".o")
|
||||
os.close(objfd)
|
||||
|
||||
listfd, listname = mkstemp(prefix="conftest.", suffix=".list")
|
||||
os.write(listfd, objname.encode())
|
||||
os.close(listfd)
|
||||
|
||||
outfd, outname = mkstemp(prefix="conftest.", suffix=".out")
|
||||
os.close(outfd)
|
||||
|
||||
try:
|
||||
cflags = c_compiler.flags
|
||||
|
||||
if (
|
||||
try_invoke_compiler(
|
||||
# No configure_cache because it would not create the
|
||||
# expected output file.
|
||||
None,
|
||||
[c_compiler.compiler] + cflags,
|
||||
c_compiler.language,
|
||||
"int main() {}",
|
||||
["-c", "-o", objname],
|
||||
wrapper=c_compiler.wrapper,
|
||||
onerror=lambda: None,
|
||||
)
|
||||
is None
|
||||
):
|
||||
die("couldn't compile a simple C file")
|
||||
|
||||
ldflags = linker_flags + (extra_flags or [])
|
||||
|
||||
if c_compiler.type == "clang-cl":
|
||||
base_linker_cmd = [link] + ldflags + [f"-OUT:{outname}"]
|
||||
else:
|
||||
base_linker_cmd = [c_compiler.compiler] + cflags + ldflags + ["-o", outname]
|
||||
|
||||
# -filelist is for the OS X linker. We need to try -filelist
|
||||
# first because clang understands @file, but may pass an
|
||||
# oversized argument list to the linker depending on the
|
||||
# contents of @file.
|
||||
options = [
|
||||
("linkerlist", f"-Wl,@{listname}"),
|
||||
("filelist", f"-Wl,@{listname}"),
|
||||
("list", f"@{listname}"),
|
||||
]
|
||||
for kind, option in options:
|
||||
linker_cmd = base_linker_cmd + [option]
|
||||
if check_cmd_output(*linker_cmd, onerror=lambda: None) is not None:
|
||||
return kind
|
||||
die("Couldn't find one that works")
|
||||
|
||||
finally:
|
||||
os.remove(objname)
|
||||
os.remove(listname)
|
||||
os.remove(outname)
|
||||
|
||||
|
||||
set_config("EXPAND_LIBS_LIST_STYLE", expand_libs_list_style)
|
||||
|
||||
# Please keep these last in this file.
|
||||
add_old_configure_assignment("_COMPILATION_ASFLAGS", asm_flags.asflags)
|
||||
add_old_configure_assignment("_COMPILATION_HOST_ASFLAGS", asm_flags.host_asflags)
|
||||
|
|
|
|||
1
js/src/aclocal.m4
vendored
1
js/src/aclocal.m4
vendored
|
|
@ -10,7 +10,6 @@ builtin(include, ../../build/autoconf/altoptions.m4)dnl
|
|||
builtin(include, ../../build/autoconf/mozprog.m4)dnl
|
||||
builtin(include, ../../build/autoconf/mozheader.m4)dnl
|
||||
builtin(include, ../../build/autoconf/compiler-opts.m4)dnl
|
||||
builtin(include, ../../build/autoconf/expandlibs.m4)dnl
|
||||
builtin(include, ../../build/autoconf/arch.m4)dnl
|
||||
builtin(include, ../../build/autoconf/android.m4)dnl
|
||||
builtin(include, ../../build/autoconf/clang-plugin.m4)dnl
|
||||
|
|
|
|||
|
|
@ -563,8 +563,6 @@ if test -n "$COMPILE_ENVIRONMENT"; then
|
|||
MOZ_CONFIG_CLANG_PLUGIN
|
||||
fi # COMPILE_ENVIRONMENT
|
||||
|
||||
MOZ_EXPAND_LIBS
|
||||
|
||||
dnl ========================================================
|
||||
dnl =
|
||||
dnl = Maintainer debug option (no --enable equivalent)
|
||||
|
|
|
|||
|
|
@ -652,10 +652,6 @@ fi # COMPILE_ENVIRONMENT
|
|||
|
||||
AC_LANG_C
|
||||
|
||||
if test "$COMPILE_ENVIRONMENT"; then
|
||||
MOZ_EXPAND_LIBS
|
||||
fi # COMPILE_ENVIRONMENT
|
||||
|
||||
dnl ========================================================
|
||||
dnl =
|
||||
dnl = Maintainer debug option (no --enable equivalent)
|
||||
|
|
|
|||
Loading…
Reference in a new issue