>From 054e8e88aa574b1957328d2358dbcc29f6205b4d Mon Sep 17 00:00:00 2001
From: Cyber Sinh <cyber.sinh@free.fr>
Date: Fri, 29 Dec 2017 02:59:08 +0100
Subject: [PATCH] Allow MSVC building under WSL (Linux bash on Windows 10)

---
 compat/windows/makedef |  4 ++--
 compat/windows/mslink  |  4 ++--
 configure              | 18 +++++++++---------
 3 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/compat/windows/makedef b/compat/windows/makedef
index 7258b94a92..add8222d13 100755
--- a/compat/windows/makedef
+++ b/compat/windows/makedef
@@ -48,7 +48,7 @@ trap 'rm -f -- $libname' EXIT
 if [ -n "$AR" ]; then
     $AR rcs ${libname} $@ >/dev/null
 else
-    lib -out:${libname} $@ >/dev/null
+    lib.exe -out:${libname} $@ >/dev/null
 fi
 if [ $? != 0 ]; then
     echo "Could not create temporary library." >&2
@@ -108,7 +108,7 @@ if [ -n "$NM" ]; then
               cut -d' ' -f3 |
               sed -e "s/^${prefix}//")
 else
-    dump=$(dumpbin -linkermember:1 ${libname} |
+    dump=$(dumpbin.exe -linkermember:1 ${libname} |
               sed -e '/public symbols/,$!d' -e '/^ \{1,\}Summary/,$d' -e "s/ \{1,\}${prefix}/ /" -e 's/ \{1,\}/ /g' |
               tail -n +2 |
               cut -d' ' -f3)
diff --git a/compat/windows/mslink b/compat/windows/mslink
index 07b2b3e378..9b6b83c4ed 100755
--- a/compat/windows/mslink
+++ b/compat/windows/mslink
@@ -1,9 +1,9 @@
 #!/bin/sh
 
-LINK_EXE_PATH=$(dirname "$(command -v cl)")/link
+LINK_EXE_PATH=$(dirname "$(command -v cl.exe)")/link.exe
 if [ -x "$LINK_EXE_PATH" ]; then
     "$LINK_EXE_PATH" $@
 else
-    link $@
+    link.exe $@
 fi
 exit $?
diff --git a/configure b/configure
index 70de780f82..ba5baf14fd 100755
--- a/configure
+++ b/configure
@@ -3852,23 +3852,23 @@ case "$toolchain" in
         # behaviour if the regexp was unable to match anything, since this
         # successfully parses the version number of existing supported
         # versions that require the converter (MSVC 2010 and 2012).
-        cl_major_ver=$(cl 2>&1 | sed -n 's/.*Version \([[:digit:]]\{1,\}\)\..*/\1/p')
+        cl_major_ver=$(cl.exe 2>&1 | sed -n 's/.*Version \([[:digit:]]\{1,\}\)\..*/\1/p')
         if [ -z "$cl_major_ver" ] || [ $cl_major_ver -ge 18 ]; then
-            cc_default="cl"
-            cxx_default="cl"
+            cc_default="cl.exe"
+            cxx_default="cl.exe"
         else
-            cc_default="c99wrap cl"
-            cxx_default="c99wrap cl"
+            cc_default="c99wrap cl.exe"
+            cxx_default="c99wrap cl.exe"
         fi
         ld_default="$source_path/compat/windows/mslink"
-        nm_default="dumpbin -symbols"
-        ar_default="lib"
+        nm_default="dumpbin.exe -symbols"
+        ar_default="lib.exe"
         case "$arch" in
         aarch64|arm64)
-            as_default="armasm64"
+            as_default="armasm64.exe"
             ;;
         arm*)
-            as_default="armasm"
+            as_default="armasm.exe"
             ;;
         esac
         target_os_default="win32"
-- 
2.14.1.windows.1

