From f4fb844e60052198dd16b7ebb2468421c0938704 Mon Sep 17 00:00:00 2001
From: "Julio C. Rocha" <julio@rochsquadron.net>
Date: Fri, 31 Jul 2020 01:33:09 -0700
Subject: [PATCH 2/2] Use relative paths on Windows/WSL.

---
 configure | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/configure b/configure
index 7b43374643..19d8d192f1 100755
--- a/configure
+++ b/configure
@@ -5574,11 +5574,15 @@ link_name=$(mktemp -u $TMPDIR/name_XXXXXXXX)
 mkdir "$link_dest"
 $ln_s "$link_dest" "$link_name"
 touch "$link_dest/test_file"
-if [ "$source_path" != "." ] && [ "$source_path" != "src" ] && ([ ! -d src ] || [ -L src ]) && [ -e "$link_name/test_file" ]; then
+if [ "$source_path" != "." ] && [ "$source_path" != "src" ] && ([ ! -d src ] || [ -L src ]) && [ -e "$link_name/test_file" ] && [ ! -e /bin/wslpath ]; then
     # create link to source path
     [ -e src ] && rm src
     $ln_s "$source_path" src
     source_link=src
+elif [ -e /bin/wslpath ]; then
+    # cl.exe does not support slash-lead paths (i.e. /mnt/c/source/code.c). Use relative path instead.
+    source_path=$(realpath --relative-to=$(pwd) "$source_path")
+    source_link=$source_path
 else
     # creating directory links doesn't work
     # fall back to using the full source path
-- 
2.28.0.windows.1

