Bug 1290040 - Find link.exe from python configure. r?gps
This ensures we have a full path to link.exe from MSVC in LD, avoiding
to use /usr/bin/link on msys2.
--- a/build/autoconf/compiler-opts.m4
+++ b/build/autoconf/compiler-opts.m4
@@ -20,17 +20,16 @@ dnl Default to MSVC for win32 and gcc-4.
dnl ==============================================================
if test -z "$CROSS_COMPILE"; then
case "$target" in
*-mingw*)
if test -z "$CC"; then CC=cl; fi
if test -z "$CXX"; then CXX=cl; fi
if test -z "$CPP"; then CPP="$CC -E -nologo"; fi
if test -z "$CXXCPP"; then CXXCPP="$CXX -TP -E -nologo"; ac_cv_prog_CXXCPP="$CXXCPP"; fi
- if test -z "$LD"; then LD=link; fi
if test -z "$AS"; then
case "${target_cpu}" in
i*86)
AS=ml;
;;
x86_64)
AS=ml64;
;;
--- a/build/moz.configure/windows.configure
+++ b/build/moz.configure/windows.configure
@@ -374,16 +374,26 @@ def valid_mt(path):
except subprocess.CalledProcessError:
pass
raise FatalCheckError('%s is not Microsoft Manifest Tool')
set_config('MSMANIFEST_TOOL', depends(valid_mt)(lambda x: bool(x)))
+# Ultimately, this will move to toolchain.configure and be turned into a
+# cross-platform check.
+option(env='LD', nargs=1, help='Path to the linker')
+
+link = check_prog('LINK', depends_win()(lambda: ('link.exe',)), input='LD',
+ paths=vc_compiler_path)
+
+add_old_configure_assignment('LD', depends_win(link)(lambda x: x))
+
+
# Normally, we'd just have CC, etc. set to absolute paths, but the build system
# doesn't currently handle properly the case where the paths contain spaces.
# Additionally, there's the issue described in toolchain.configure, in
# valid_compiler().
@depends_win(sdk_bin_path)
@imports('os')
def alter_path(sdk_bin_path):
path = os.pathsep.join(sdk_bin_path)