]> git.sesse.net Git - x264/commitdiff
msvs: Prefer link.exe from the same directory as cl.exe
authorHenrik Gramner <henrik@gramner.com>
Sun, 26 Jul 2015 21:13:19 +0000 (23:13 +0200)
committerAnton Mitrofanov <BugMaster@narod.ru>
Tue, 18 Aug 2015 22:00:14 +0000 (01:00 +0300)
/usr/bin/link from coreutils may be located before the MSVS linker in $PATH
which causes linking to fail due to using the wrong binary.

configure

index 768a78141a9202c79a4ba721809904eb7d5d01b6..fb761d63eb2a1e3722e3afe83147e2955103a4b6 100755 (executable)
--- a/configure
+++ b/configure
@@ -1243,7 +1243,13 @@ DEPMT="${QPRE}MT"
 if [ $compiler_style = MS ]; then
     AR="lib -nologo -out:"
     LD="link -out:"
-    [ $compiler = ICL ] && AR="xi$AR" && LD="xi$LD"
+    if [ $compiler = ICL ]; then
+        AR="xi$AR"
+        LD="xi$LD"
+    else
+        mslink="$(dirname "$(command -v cl 2>/dev/null)")/link"
+        [ -x "$mslink" ] && LD="\"$mslink\" -out:"
+    fi
     HAVE_GETOPT_LONG=0
     LDFLAGS="-nologo -incremental:no $(cl_ldflags $LDFLAGS)"
     LDFLAGSCLI="$(cl_ldflags $LDFLAGSCLI)"