author Nick Alexander <>
Fri, 12 Oct 2018 22:38:44 +0000
changeset 499408 91300d29898b1a1102e1b62164aeee1f56b2ee86
parent 330783 23b31c46e2117f80b78e6033fb5f1dee3a222965
child 513429 65511e8d7a7e0df5df7c4b7c96ffc3cbd2590db3
permissions -rw-r--r--
Bug 1489443 - Set GCC_USE_GNU_LD based on linker kind. r=froydnj The desired outcome of this change is that we'll set `-Wl,--version-script` based on linker kind and not on the output of `$LINKER -v`. This is a cheap way to address a simple problem that has a complicated ideal solution. The underlying issue is that in some situations, when targeting Android, a macOS system `ld` is interrogated to determine if a cross-compiling linker "is GNU ld" and a particular linker feature is set in that situation. The macOS system `ld` doesn't pass the "is GNU ld" test, and the linker feature isn't set; that causes link failures, even though the actual linker has nothing to do with the system `ld`. The ideal solution is to test for linker capabilities dynamically. We do a lot of that in, and we don't do any of that in toolchain.configure. Rather than start testing in toolchain.configure, we hard-code: a cheap solution to the immediate problem. Differential Revision:

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

dnl Wrap AC_INIT_PREPARE to add the above trap.

test "x$prefix" = xNONE && prefix=$ac_default_prefix
# Let make expand exec_prefix.
test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'

> subconfigures
> skip_subconfigures

[for moz_config_dir in $1; do
  case "$moz_config_dir" in
    objdir=$(echo $moz_config_dir | awk -F: '{print [$]2}')
  dnl Because config.status, storing AC_SUBSTs, is written before any
  dnl subconfigure runs, we need to use a file. Moreover, some subconfigures
  dnl are started from a subshell, and variable modifications from a subshell
  dnl wouldn't be preserved.
  echo $objdir >> subconfigures

  dumpenv="true | "
  case "$host" in
    _CONFIG_SHELL=$(cd $(dirname $_CONFIG_SHELL); pwd -W)/$(basename $_CONFIG_SHELL)
    if test ! -e "$_CONFIG_SHELL" -a -e "${_CONFIG_SHELL}.exe"; then
    dnl Yes, this is horrible. But since msys doesn't preserve environment
    dnl variables and command line arguments as they are when transitioning
    dnl from msys (this script) to python (below), we have to resort to hacks,
    dnl storing the environment and command line arguments from a msys process
    dnl (perl), and reading it from python.
    dumpenv="$PERL $_topsrcdir/build/win32/ $ac_configure_args | "

  eval $dumpenv $PYTHON $_topsrcdir/build/ --prepare "$srcdir" "$moz_config_dir" "$_CONFIG_SHELL" $ac_configure_args ifelse($2,,,--cache-file="$2")

  dnl Actual subconfigure execution happens in MOZ_RUN_CONFIG_STATUS

for moz_config_dir_ in $1; do
  tail -1 subconfigures >> skip_subconfigures
  MOZ_RUN_SUBCONFIGURES(`tail -1 skip_subconfigures`)

[dnl Execute subconfigure, unless --no-recursion was passed to configure.
if test "$no_recursion" != yes; then
  trap '' EXIT
  if ! $PYTHON $_topsrcdir/build/ $1; then
      exit 1

MOZ_RUN_SUBCONFIGURES([--list subconfigures --skip skip_subconfigures])

dnl Print error messages in config.log as well as stderr
[{ echo "configure: error: $1" 1>&2; echo "configure: error: $1" 1>&5; exit 1; }])