Hi Everyone,

I've been working on getting the OpenJDK to build on WSL (Windows Subsystem for 
Linux).  Currently, our Windows build uses Cygwin.  Given that WSL is provided 
with newer versions of the OS (and doesn't suffer from many of the issues that 
Cygwin does, given that it is built into the Windows kernel), I think it would 
be great if OpenJDK would support building on WSL.  I've attached a patch with 
my proposed changes.

One important thing to note is that the WSL build targets Windows.  It is also 
possible to use WSL to target itself (a WSL Linux binary) or even other 
distributions of Linux.  I have not implemented that yet, but I think I could 
do that as a next step if you guys think it would be useful (at least I think 
it would be useful, then you can test your changes for both Windows and Linux 
on one system...).

Steps in case you want to try this out:


1.       Due to autotools not handling spaces well, you have to create symlinks 
in Windows that will allow you to access Windows Kits and the VC++ compiler 
without spaces in the path:

mklink /D C:\VS "C:\Program Files (x86)\Microsoft Visual Studio"

mklink /D C:\WindowsKits "C:\Program Files (x86)\Windows Kits"

2.       wsl must be started from a Windows Developer command prompt.  To 
ensure the correct environment variables are propagated from Windows to WSL, 
you can run the following commands:

set WSLENV=INCLUDE/l:LIBPATH/l

3.       Start wsl (bash):

wsl

4.       After starting bash you must set your compiler variables to explicitly 
point to the correct tools:

export 
AR=/mnt/c/VS/2017/Enterprise/VC/Tools/MSVC/14.16.27023/bin/Hostx64/x64/lib.exe

export 
CC=/mnt/c/VS/2017/Enterprise/VC/Tools/MSVC/14.16.27023/bin/Hostx64/x64/cl.exe

export 
CXX=/mnt/c/VS/2017/Enterprise/VC/Tools/MSVC/14.16.27023/bin/Hostx64/x64/cl.exe

export 
LD=/mnt/c/VS/2017/Enterprise/VC/Tools/MSVC/14.16.27023/bin/Hostx64/x64/link.exe

export RC=/mnt/c/WindowsKits/10/bin/10.0.17763.0/x64/rc.exe

export MT=/mnt/c/WindowsKits/10/bin/10.0.17763.0/x64/mt.exe

export 
DUMPBIN=/mnt/c/VS/2017/Enterprise/VC/Tools/MSVC/14.16.27023/bin/Hostx64/x64/dumpbin.exe

5.       Run configure:

./configure 
--with-boot-jdk=/mnt/c/Users/Andrew/Downloads/openjdk-11.0.1_windows-x64_bin/jdk-11.0.1
 --with-tools-dir="C:\VS\2017\Enterprise\VC\Auxiliary" 
--with-ucrt-dll-dir="/mnt/c/WindowsKits/10/Redist/ucrt/DLLs/x64"

6.       Run make

I've tested make with the default target as well as "make images"

Let me know if you have any feedback/comments.

Thanks,

-Andrew

ÿþdiff --git a/make/Images.gmk 
b/make/Images.gmk

--- a/make/Images.gmk

+++ b/make/Images.gmk

@@ -99,7 +99,7 @@

      )

         ifeq ($(BUILD_CDS_ARCHIVE), 
true)

        $(call LogWarn, Creating CDS 
archive for jdk image)

-       $(JDK_IMAGE_DIR)/bin/java 
-Xshare:dump -Xmx128M -Xms128M 
$(LOG_INFO)

+       
$(JDK_IMAGE_DIR)/bin/java$(EXE_SUFFIX) 
-Xshare:dump -Xmx128M -Xms128M 
$(LOG_INFO)

         endif

      $(TOUCH) $@

 

@@ -114,7 +114,7 @@

      )

         ifeq ($(BUILD_CDS_ARCHIVE), 
true)

        $(call LogWarn, Creating CDS 
archive for jre image)

-       $(JRE_IMAGE_DIR)/bin/java 
-Xshare:dump -Xmx128M -Xms128M 
$(LOG_INFO)

+       
$(JRE_IMAGE_DIR)/bin/java$(EXE_SUFFIX) 
-Xshare:dump -Xmx128M -Xms128M 
$(LOG_INFO)

         endif

      $(TOUCH) $@

 

diff --git a/make/autoconf/basics.m4 
b/make/autoconf/basics.m4

--- a/make/autoconf/basics.m4

+++ b/make/autoconf/basics.m4

@@ -607,6 +607,7 @@

 

   # These are not required on all 
platforms

   BASIC_PATH_PROGS(CYGPATH, cygpath)

+  BASIC_PATH_PROGS(WSLPATH, wslpath)

   BASIC_PATH_PROGS(DF, df)

   BASIC_PATH_PROGS(CPIO, [cpio 
bsdcpio])

   BASIC_PATH_PROGS(NICE, nice)

@@ -634,8 +635,10 @@

     BASIC_CHECK_PATHS_WINDOWS

   else

     PATH_SEP=":"

+     EXECUTABLE_SUFFIX=""

   fi

   AC_SUBST(PATH_SEP)

+  AC_SUBST(EXECUTABLE_SUFFIX)

 

   # We get the top-level directory 
from the supporting wrappers.

   AC_MSG_CHECKING([for top-level 
directory])

@@ -980,6 +983,8 @@

             MAKE_EXPECTED_ENV='cygwin'

           elif test 
"x$OPENJDK_BUILD_OS_ENV" = 
"xwindows.msys"; then

             MAKE_EXPECTED_ENV='msys'

+          elif test 
"x$OPENJDK_BUILD_OS_ENV" = 
"xwindows.wsl"; then

+            
MAKE_EXPECTED_ENV='x86_64-pc-linux-gnu'

           else

             AC_MSG_ERROR([Unknown 
Windows environment])

           fi

diff --git 
a/make/autoconf/basics_windows.m4 
b/make/autoconf/basics_windows.m4

--- a/make/autoconf/basics_windows.m4

+++ b/make/autoconf/basics_windows.m4

@@ -32,6 +32,9 @@

   elif test "x$OPENJDK_BUILD_OS_ENV" = 
"xwindows.msys"; then

     unix_path=`$ECHO "$windows_path" | 
$SED -e 's,^\\(.\\):,/\\1,g' -e 
's,\\\\,/,g'`

     $1="$unix_path"

+  elif test "x$OPENJDK_BUILD_OS_ENV" = 
"xwindows.wsl"; then

+    unix_path=`$WSLPATH -u 
"$windows_path"`

+    $1="$unix_path"

   fi

 ])

 

@@ -44,6 +47,9 @@

   elif test "x$OPENJDK_BUILD_OS_ENV" = 
"xwindows.msys"; then

     windows_path=`cmd //c echo 
$unix_path`

     $1="$windows_path"

+  elif test "x$OPENJDK_BUILD_OS_ENV" = 
"xwindows.wsl"; then

+    windows_path=`$WSLPATH -m 
"$unix_path"`

+    $1="$windows_path"

   fi

 ])

 

@@ -339,6 +345,7 @@

     if test "x$test_cygdrive_prefix" = 
x; then

       AC_MSG_ERROR([Your cygdrive 
prefix is not /cygdrive. This is 
currently not supported. Change with 
mount -c.])

     fi

+     EXECUTABLE_SUFFIX=""

   elif test "x$OPENJDK_BUILD_OS_ENV" = 
"xwindows.msys"; then

     AC_MSG_CHECKING([msys release])

     MSYS_VERSION=`$UNAME -r`

@@ -353,8 +360,11 @@

     
BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(MSYS_ROOT_PATH)

     AC_MSG_RESULT([$MSYS_ROOT_PATH])

     
WINDOWS_ENV_ROOT_PATH="$MSYS_ROOT_PATH"

+     EXECUTABLE_SUFFIX=""

+  elif test "x$OPENJDK_BUILD_OS_ENV" = 
"xwindows.wsl"; then

+     EXECUTABLE_SUFFIX=".exe"

   else

-    AC_MSG_ERROR([Unknown Windows 
environment. Neither cygwin nor msys 
was detected.])

+    AC_MSG_ERROR([Unknown Windows 
environment. Neither cygwin, msys, nor 
wsl was detected.])

   fi

 

   # Test if windows or unix 
(cygwin/msys) find is first in path.

@@ -395,6 +405,8 @@

           | tr ' ' '\n' | $GREP '^/./' 
| $SORT | $UNIQ`

       fixpath_argument_list=`echo 
$all_unique_prefixes  | tr ' ' '@'`

       FIXPATH="$FIXPATH_BIN 
-m$fixpath_argument_list"

+     elif test "x$OPENJDK_BUILD_OS_ENV" 
= xwindows.wsl; then

+      FIXPATH="$FIXPATH_BIN -w"

     fi

     FIXPATH_SRC_W="$FIXPATH_SRC"

     FIXPATH_BIN_W="$FIXPATH_BIN"

diff --git a/make/autoconf/boot-jdk.m4 
b/make/autoconf/boot-jdk.m4

--- a/make/autoconf/boot-jdk.m4

+++ b/make/autoconf/boot-jdk.m4

@@ -63,18 +63,18 @@

     # If previous step claimed to have 
found a JDK, check it to see if it 
seems to be valid.

     if test "x$BOOT_JDK_FOUND" = 
xmaybe; then

       # Do we have a bin/java?

-      if test ! -x 
"$BOOT_JDK/bin/java"; then

+      if test ! -x 
"$BOOT_JDK/bin/java$EXECUTABLE_SUFFIX"; 
then

         AC_MSG_NOTICE([Potential Boot 
JDK found at $BOOT_JDK did not contain 
bin/java; ignoring])

         BOOT_JDK_FOUND=no

       else

         # Do we have a bin/javac?

-        if test ! -x 
"$BOOT_JDK/bin/javac"; then

+        if test ! -x 
"$BOOT_JDK/bin/javac$EXECUTABLE_SUFFIX";
 then

           AC_MSG_NOTICE([Potential 
Boot JDK found at $BOOT_JDK did not 
contain bin/javac; ignoring])

           AC_MSG_NOTICE([(This might 
be an JRE instead of an JDK)])

           BOOT_JDK_FOUND=no

         else

           # Oh, this is looking good! 
We probably have found a proper JDK. Is 
it the correct version?

-          
BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" 
$USER_BOOT_JDK_OPTIONS -version 2>&1 | 
$HEAD -n 1`

+          
BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java$EXECUTABLE_SUFFIX"
 $USER_BOOT_JDK_OPTIONS -version 2>&1 | 
$HEAD -n 1`

           if [ [[ "$BOOT_JDK_VERSION" 
=~ "Picked up" ]] ]; then

             AC_MSG_NOTICE([You have 
_JAVA_OPTIONS or JAVA_TOOL_OPTIONS set. 
This can mess up the build. Please use 
--with-boot-jdk-jvmargs instead.])

             AC_MSG_NOTICE([Java 
reports: "$BOOT_JDK_VERSION".])

@@ -101,7 +101,7 @@

             AC_MSG_CHECKING([for Boot 
JDK])

             AC_MSG_RESULT([$BOOT_JDK])

             AC_MSG_CHECKING([Boot JDK 
version])

-            
BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" 
$USER_BOOT_JDK_OPTIONS -version 2>&1 | 
$TR '\n\r' '  '`

+            
BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java$EXECUTABLE_SUFFIX"
 $USER_BOOT_JDK_OPTIONS -version 2>&1 | 
$TR '\n\r' '  '`

             
AC_MSG_RESULT([$BOOT_JDK_VERSION])

           fi # end check jdk version

         fi # end check javac

@@ -335,11 +335,11 @@

   AC_SUBST(BOOT_JDK)

 

   # Setup tools from the Boot JDK.

-  BOOTJDK_CHECK_TOOL_IN_BOOTJDK(JAVA, 
java)

-  BOOTJDK_CHECK_TOOL_IN_BOOTJDK(JAVAC, 
javac)

-  
BOOTJDK_CHECK_TOOL_IN_BOOTJDK(JAVADOC, 
javadoc)

-  BOOTJDK_CHECK_TOOL_IN_BOOTJDK(JAR, 
jar)

-  
BOOTJDK_CHECK_TOOL_IN_BOOTJDK(JARSIGNER,
 jarsigner)

+  BOOTJDK_CHECK_TOOL_IN_BOOTJDK(JAVA, 
java$EXECUTABLE_SUFFIX)

+  BOOTJDK_CHECK_TOOL_IN_BOOTJDK(JAVAC, 
javac$EXECUTABLE_SUFFIX)

+  
BOOTJDK_CHECK_TOOL_IN_BOOTJDK(JAVADOC, 
javadoc$EXECUTABLE_SUFFIX)

+  BOOTJDK_CHECK_TOOL_IN_BOOTJDK(JAR, 
jar$EXECUTABLE_SUFFIX)

+  
BOOTJDK_CHECK_TOOL_IN_BOOTJDK(JARSIGNER,
 jarsigner$EXECUTABLE_SUFFIX)

 

   # Finally, set some other options...

 

diff --git 
a/make/autoconf/build-aux/autoconf-config.guess
 
b/make/autoconf/build-aux/autoconf-config.guess

--- 
a/make/autoconf/build-aux/autoconf-config.guess

+++ 
b/make/autoconf/build-aux/autoconf-config.guess

@@ -826,6 +826,9 @@

     i*:CYGWIN*:*)

      echo ${UNAME_MACHINE}-pc-cygwin

      exit ;;

+    *:*:*Microsoft*)

+     echo ${UNAME_MACHINE}-pc-wsl

+     exit ;;

     *:MINGW*:*)

      echo ${UNAME_MACHINE}-pc-mingw32

      exit ;;

diff --git 
a/make/autoconf/build-aux/autoconf-config.sub
 
b/make/autoconf/build-aux/autoconf-config.sub

--- 
a/make/autoconf/build-aux/autoconf-config.sub

+++ 
b/make/autoconf/build-aux/autoconf-config.sub

@@ -1275,7 +1275,7 @@

            | -ptx* | -coff* | -ecoff* | 
-winnt* | -domain* | -vsta* \

            | -udi* | -eabi* | -lites* | 
-ieee* | -go32* | -aux* \

            | -chorusos* | -chorusrdb* \

-           | -cygwin* | -pe* | -psos* | 
-moss* | -proelf* | -rtems* \

+           | -cygwin* | -wsl* | -pe* | 
-psos* | -moss* | -proelf* | -rtems* \

            | -mingw32* | -linux-gnu* | 
-linux-newlib* | -linux-uclibc* \

            | -uxpv* | -beos* | -mpeix* | 
-udk* \

            | -interix* | -uwin* | -mks* 
| -rhapsody* | -darwin* | -opened* \

diff --git a/make/autoconf/platform.m4 
b/make/autoconf/platform.m4

--- a/make/autoconf/platform.m4

+++ b/make/autoconf/platform.m4

@@ -188,6 +188,10 @@

       VAR_OS=windows

       VAR_OS_ENV=windows.cygwin

       ;;

+    *wsl*)

+      VAR_OS=windows

+      VAR_OS_ENV=windows.wsl

+      ;;

     *mingw*)

       VAR_OS=windows

       VAR_OS_ENV=windows.msys

diff --git a/make/autoconf/toolchain.m4 
b/make/autoconf/toolchain.m4

--- a/make/autoconf/toolchain.m4

+++ b/make/autoconf/toolchain.m4

@@ -281,13 +281,13 @@

 

   TOOLCHAIN_CC_BINARY_clang="clang"

   TOOLCHAIN_CC_BINARY_gcc="gcc"

-  TOOLCHAIN_CC_BINARY_microsoft="cl"

+  
TOOLCHAIN_CC_BINARY_microsoft="cl$EXECUTABLE_SUFFIX"

   TOOLCHAIN_CC_BINARY_solstudio="cc"

   TOOLCHAIN_CC_BINARY_xlc="xlc_r"

 

   TOOLCHAIN_CXX_BINARY_clang="clang++"

   TOOLCHAIN_CXX_BINARY_gcc="g++"

-  TOOLCHAIN_CXX_BINARY_microsoft="cl"

+  
TOOLCHAIN_CXX_BINARY_microsoft="cl$EXECUTABLE_SUFFIX"

   TOOLCHAIN_CXX_BINARY_solstudio="CC"

   TOOLCHAIN_CXX_BINARY_xlc="xlC_r"

 

@@ -430,7 +430,7 @@

     # There is no specific version 
flag, but all output starts with a 
version string.

     # First line typically looks 
something like:

     # Microsoft (R) 32-bit C/C++ 
Optimizing Compiler Version 
16.00.40219.01 for 80x86

-    COMPILER_VERSION_OUTPUT=`$COMPILER 
2>&1 | $HEAD -n 1 | $TR -d '\r'`

+    
COMPILER_VERSION_OUTPUT=`"$COMPILER" 
2>&1 | $HEAD -n 1 | $TR -d '\r'`

     # Check that this is likely to be 
Microsoft CL.EXE.

     $ECHO "$COMPILER_VERSION_OUTPUT" | 
$GREP "Microsoft.*Compiler" > /dev/null

     if test $? -ne 0; then

@@ -561,22 +561,25 @@

   BASIC_FIXUP_EXECUTABLE($1)

   TEST_COMPILER="[$]$1"

 

-  AC_MSG_CHECKING([resolved symbolic 
links for $1])

-  SYMLINK_ORIGINAL="$TEST_COMPILER"

-  
BASIC_REMOVE_SYMBOLIC_LINKS(SYMLINK_ORIGINAL)

-  if test "x$TEST_COMPILER" = 
"x$SYMLINK_ORIGINAL"; then

-    AC_MSG_RESULT([no symlink])

-  else

-    AC_MSG_RESULT([$SYMLINK_ORIGINAL])

+  if test "x$OPENJDK_BUILD_OS_ENV" != 
"xwindows.wsl"; then

+    AC_MSG_CHECKING([resolved symbolic 
links for $1])

+    SYMLINK_ORIGINAL="$TEST_COMPILER"

+    
BASIC_REMOVE_SYMBOLIC_LINKS(SYMLINK_ORIGINAL)

+     if test "x$TEST_COMPILER" = 
"x$SYMLINK_ORIGINAL"; then

+      AC_MSG_RESULT([no symlink])

+    else

+      
AC_MSG_RESULT([$SYMLINK_ORIGINAL])

 

-    # We can't handle ccache by gcc 
wrappers, since we need to know if 
we're

-    # using ccache. Instead ccache 
usage must be controlled by a configure 
option.

-    COMPILER_BASENAME=`$BASENAME 
"$SYMLINK_ORIGINAL"`

-    if test "x$COMPILER_BASENAME" = 
"xccache"; then

-      AC_MSG_NOTICE([Please use 
--enable-ccache instead of providing a 
wrapped compiler.])

-      AC_MSG_ERROR([$TEST_COMPILER is 
a symbolic link to ccache. This is not 
supported.])

+      # We can't handle ccache by gcc 
wrappers, since we need to know if 
we're

+      # using ccache. Instead ccache 
usage must be controlled by a configure 
option.

+      COMPILER_BASENAME=`$BASENAME 
"$SYMLINK_ORIGINAL"`

+      if test "x$COMPILER_BASENAME" = 
"xccache"; then

+        AC_MSG_NOTICE([Please use 
--enable-ccache instead of providing a 
wrapped compiler.])

+        AC_MSG_ERROR([$TEST_COMPILER 
is a symbolic link to ccache. This is 
not supported.])

+      fi

     fi

   fi

+  

 

   
TOOLCHAIN_EXTRACT_COMPILER_VERSION([$1],
 [$COMPILER_NAME])

 ])

diff --git 
a/make/autoconf/toolchain_windows.m4 
b/make/autoconf/toolchain_windows.m4

--- 
a/make/autoconf/toolchain_windows.m4

+++ 
b/make/autoconf/toolchain_windows.m4

@@ -108,14 +108,14 @@

         fi

       done

     fi

-

+     

     if test -d "$VS_BASE"; then

       AC_MSG_NOTICE([Found Visual 
Studio installation at $VS_BASE using 
$METHOD])

       if test 
"x$OPENJDK_TARGET_CPU_BITS" = x32; then

         
VCVARSFILES="vc/bin/vcvars32.bat 
vc/auxiliary/build/vcvars32.bat"

       else

         
VCVARSFILES="vc/bin/amd64/vcvars64.bat 
vc/bin/x86_amd64/vcvarsx86_amd64.bat \

-            
vc/auxiliary/build/vcvarsx86_amd64.bat 
vc/auxiliary/build/vcvars64.bat"

+            
VC/Auxiliary/Build/vcvarsx86_amd64.bat 
VC/Auxiliary/Build/vcvars64.bat"

       fi

 

       for VCVARSFILE in $VCVARSFILES; 
do

@@ -200,46 +200,46 @@

       AC_MSG_NOTICE([directory within 
the Visual Studio installation])

       AC_MSG_ERROR([Cannot locate a 
valid Visual Studio installation])

     fi

-  fi

-

-  VS_ENV_CMD=""

+  else

+    VS_ENV_CMD=""

 

-  if test "x$VS_COMNTOOLS" != x; then

-    
TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([${VS_VERSION}],

-        [$VS_COMNTOOLS/../..], 
[$VS_COMNTOOLS_VAR variable])

-  fi

-  if test "x$PROGRAMFILES" != x; then

-    
TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([${VS_VERSION}],

-        
[$PROGRAMFILES/$VS_INSTALL_DIR], 
[well-known name])

-  fi

-  # Work around the insanely named 
ProgramFiles(x86) env variable

-  PROGRAMFILES_X86="`env | $SED -n 
's/^ProgramFiles(x86)=//p'`"

-  if test "x$PROGRAMFILES_X86" != x; 
then

-    
TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([${VS_VERSION}],

-        
[$PROGRAMFILES_X86/$VS_INSTALL_DIR], 
[well-known name])

-  fi

-  
TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([${VS_VERSION}],

-      [C:/Program 
Files/$VS_INSTALL_DIR], [well-known 
name])

-  
TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([${VS_VERSION}],

-      [C:/Program Files 
(x86)/$VS_INSTALL_DIR], [well-known 
name])

-

-  if test "x$SDK_INSTALL_DIR" != x; 
then

-    if test "x$ProgramW6432" != x; 
then

-      
TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([${VS_VERSION}],

-          
[$ProgramW6432/$SDK_INSTALL_DIR], 
[well-known name])

-    fi

-    if test "x$PROGRAMW6432" != x; 
then

-      
TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([${VS_VERSION}],

-          
[$PROGRAMW6432/$SDK_INSTALL_DIR], 
[well-known name])

+    if test "x$VS_COMNTOOLS" != x; 
then

+      
TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([${VS_VERSION}],

+          [$VS_COMNTOOLS/../..], 
[$VS_COMNTOOLS_VAR variable])

     fi

     if test "x$PROGRAMFILES" != x; 
then

-      
TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([${VS_VERSION}],

-          
[$PROGRAMFILES/$SDK_INSTALL_DIR], 
[well-known name])

+      
TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([${VS_VERSION}],

+          
[$PROGRAMFILES/$VS_INSTALL_DIR], 
[well-known name])

+    fi

+    # Work around the insanely named 
ProgramFiles(x86) env variable

+    PROGRAMFILES_X86="`env | $SED -n 
's/^ProgramFiles(x86)=//p'`"

+    if test "x$PROGRAMFILES_X86" != x; 
then

+      
TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([${VS_VERSION}],

+          
[$PROGRAMFILES_X86/$VS_INSTALL_DIR], 
[well-known name])

     fi

-    
TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([${VS_VERSION}],

-        [C:/Program 
Files/$SDK_INSTALL_DIR], [well-known 
name])

-    
TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([${VS_VERSION}],

-        [C:/Program Files 
(x86)/$SDK_INSTALL_DIR], [well-known 
name])

+    
TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([${VS_VERSION}],

+        [C:/Program 
Files/$VS_INSTALL_DIR], [well-known 
name])

+    
TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([${VS_VERSION}],

+        [C:/Program Files 
(x86)/$VS_INSTALL_DIR], [well-known 
name])

+

+    if test "x$SDK_INSTALL_DIR" != x; 
then

+      if test "x$ProgramW6432" != x; 
then

+        
TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([${VS_VERSION}],

+            
[$ProgramW6432/$SDK_INSTALL_DIR], 
[well-known name])

+      fi

+      if test "x$PROGRAMW6432" != x; 
then

+        
TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([${VS_VERSION}],

+            
[$PROGRAMW6432/$SDK_INSTALL_DIR], 
[well-known name])

+      fi

+      if test "x$PROGRAMFILES" != x; 
then

+        
TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([${VS_VERSION}],

+            
[$PROGRAMFILES/$SDK_INSTALL_DIR], 
[well-known name])

+      fi

+      
TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([${VS_VERSION}],

+          [C:/Program 
Files/$SDK_INSTALL_DIR], [well-known 
name])

+      
TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([${VS_VERSION}],

+          [C:/Program Files 
(x86)/$SDK_INSTALL_DIR], [well-known 
name])

+    fi

   fi

 ])

 

@@ -354,7 +354,7 @@

 

   # First-hand choice is to locate and 
run the vsvars bat file.

   TOOLCHAIN_FIND_VISUAL_STUDIO

-

+  

   # If we have a devkit, skip all of 
the below.

   if test "x$DEVKIT_VS_VERSION" = x; 
then

     if test "x$VS_ENV_CMD" != x; then

@@ -372,8 +372,13 @@

       # Instead create a shell script 
which will set the relevant variables 
when run.

       WINPATH_VS_ENV_CMD="$VS_ENV_CMD"

       
BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH([WINPATH_VS_ENV_CMD])

-      WINPATH_BASH="$BASH"

-      
BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH([WINPATH_BASH])

+       

+      if test "x$OPENJDK_BUILD_OS_ENV" 
= "xwindows.wsl"; then

+        WINPATH_BASH="bash"

+      else

+        WINPATH_BASH="$BASH"

+        
BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH([WINPATH_BASH])

+      fi

 

       # Generate a DOS batch file 
which runs $VS_ENV_CMD, and then 
creates a shell

       # script (executable by bash) 
that will setup the important 
variables.

@@ -381,7 +386,7 @@

       $ECHO "@echo off" >  
$EXTRACT_VC_ENV_BAT_FILE

       # This will end up something 
like:

       # call 
C:/progra~2/micros~2.0/vc/bin/amd64/vcvars64.bat

-      $ECHO "call $WINPATH_VS_ENV_CMD 
$VS_ENV_ARGS" >> 
$EXTRACT_VC_ENV_BAT_FILE

+      $ECHO "call 
\"$WINPATH_VS_ENV_CMD\" $VS_ENV_ARGS" 
>> $EXTRACT_VC_ENV_BAT_FILE

       # In some cases, the VS_ENV_CMD 
will change directory, change back so

       # the set-vs-env.sh ends up in 
the right place.

       $ECHO 'cd %~dp0' >> 
$EXTRACT_VC_ENV_BAT_FILE

@@ -389,28 +394,29 @@

       # C:/CygWin/bin/bash -c 'echo 
VS_PATH=\"$PATH\" > localdevenv.sh

       # The trailing space for 
everyone except PATH is no typo, but is 
needed due

       # to trailing \ in the Windows 
paths. These will be stripped later.

-      $ECHO "$WINPATH_BASH -c 'echo 
VS_PATH="'\"$PATH\" > set-vs-env.sh' \

+      $ECHO "$WINPATH_BASH"' -c "echo 
VS_PATH=\\\"\"$PATH\"\\\" > 
set-vs-env.sh"' \

           >> $EXTRACT_VC_ENV_BAT_FILE

-      $ECHO "$WINPATH_BASH -c 'echo 
VS_INCLUDE="'\"$INCLUDE\;$include \" >> 
set-vs-env.sh' \

+      $ECHO "$WINPATH_BASH"' -c "echo 
VS_INCLUDE=\\\"\"$INCLUDE\;$include 
\"\\\" >> set-vs-env.sh"' \

           >> $EXTRACT_VC_ENV_BAT_FILE

-      $ECHO "$WINPATH_BASH -c 'echo 
VS_LIB="'\"$LIB\;$lib \" >> 
set-vs-env.sh' \

+      $ECHO "$WINPATH_BASH"' -c "echo 
VS_LIB=\\\"\"$LIB\;$lib \"\\\" >> 
set-vs-env.sh"' \

           >> $EXTRACT_VC_ENV_BAT_FILE

-      $ECHO "$WINPATH_BASH -c 'echo 
VCINSTALLDIR="'\"$VCINSTALLDIR \" >> 
set-vs-env.sh' \

+      $ECHO "$WINPATH_BASH"' -c "echo 
VCINSTALLDIR=\\\"\"$VCINSTALLDIR \"\\\" 
>> set-vs-env.sh"' \

           >> $EXTRACT_VC_ENV_BAT_FILE

-      $ECHO "$WINPATH_BASH -c 'echo 
WindowsSdkDir="'\"$WindowsSdkDir \" >> 
set-vs-env.sh' \

+      $ECHO "$WINPATH_BASH"' -c "echo 
WindowsSdkDir=\\\"\"$WindowsSdkDir 
\"\\\" >> set-vs-env.sh"' \

           >> $EXTRACT_VC_ENV_BAT_FILE

-      $ECHO "$WINPATH_BASH -c 'echo 
WINDOWSSDKDIR="'\"$WINDOWSSDKDIR \" >> 
set-vs-env.sh' \

+      $ECHO "$WINPATH_BASH"' -c "echo 
WINDOWSSDKDIR=\\\"\"$WINDOWSSDKDIR 
\"\\\" >> set-vs-env.sh"' \

           >> $EXTRACT_VC_ENV_BAT_FILE

 

       # Now execute the newly created 
bat file.

       # The | cat is to stop 
SetEnv.Cmd to mess with system colors 
on msys.

       # Change directory so we don't 
need to mess with Windows paths in 
redirects.

       cd $VS_ENV_TMP_DIR

-      cmd /c extract-vs-env.bat | $CAT

+      AC_MSG_NOTICE($VS_ENV_TMP_DIR)

+      cmd$EXECUTABLE_SUFFIX /c 
extract-vs-env.bat | $CAT

       cd $CURDIR

 

       if test ! -s 
$VS_ENV_TMP_DIR/set-vs-env.sh; then

-        AC_MSG_NOTICE([Could not 
succesfully extract the envionment 
variables needed for the VS setup.])

+        AC_MSG_NOTICE([Could not 
succesfully extract the environment 
variables needed for the VS setup.])

         AC_MSG_NOTICE([Try setting 
--with-tools-dir to the VC/bin 
directory within the VS installation])

         AC_MSG_NOTICE([or run 
"bash.exe -l" from a VS command prompt 
and then run configure from there.])

         AC_MSG_ERROR([Cannot 
continue])

@@ -693,7 +699,7 @@

   if test "x$USE_UCRT" = "xtrue"; then

     AC_MSG_CHECKING([for UCRT DLL 
dir])

     if test "x$with_ucrt_dll_dir" != 
x; then

-      if test -z "$(ls -d 
"$with_ucrt_dll_dir/*.dll" 2> 
/dev/null)"; then

+      if test -z "$(ls -d 
$with_ucrt_dll_dir/*.dll 2> 
/dev/null)"; then

         AC_MSG_RESULT([no])

         AC_MSG_ERROR([Could not find 
any dlls in $with_ucrt_dll_dir])

       else

diff --git 
a/make/gendata/Gendata-java.base.gmk 
b/make/gendata/Gendata-java.base.gmk

--- 
a/make/gendata/Gendata-java.base.gmk

+++ 
b/make/gendata/Gendata-java.base.gmk

@@ -55,7 +55,7 @@

 $(GENDATA_CURDATA): 
$(TOPDIR)/make/data/currency/CurrencyData.properties
 $(BUILD_TOOLS_JDK)

      $(call MakeDir, $(@D))

      $(RM) $@

-     $(TOOL_GENERATECURRENCYDATA) -o 
$@.tmp < $<

+     $(TOOL_GENERATECURRENCYDATA) -o 
$@.tmp -i $<

      $(MV) $@.tmp $@

      $(CHMOD) 444 $@

 

diff --git 
a/make/gensrc/GensrcBuffer.gmk 
b/make/gensrc/GensrcBuffer.gmk

--- a/make/gensrc/GensrcBuffer.gmk

+++ b/make/gensrc/GensrcBuffer.gmk

@@ -230,7 +230,8 @@

   endif

 

   $$($1_DST): $$($1_DEP) 
$(GENSRC_BUFFER_DST)/_the.buffer.dir

-     $(TOOL_SPP) < $$($1_SRC) > 
$$($1_OUT).tmp \

+     $(RM) $$($1_OUT).tmp

+     $(TOOL_SPP) -i$$($1_SRC) 
-o$$($1_OUT).tmp \

          -K$$($1_type) \

          -K$$($1_category) \

          -K$$($1_streams) \

@@ -260,12 +261,12 @@

         ifeq ($$($1_BIN), 1)

        $(SED) -e '/#BIN/,$$$$d' < 
$$($1_OUT) > $$($1_DST).tmp

        $(RM) $$($1_OUT)

-       $$($1_char_CMD) < $$($1_SRC_BIN) 
>> $$($1_DST).tmp

-       $$($1_short_CMD) < $$($1_SRC_BIN) 
>> $$($1_DST).tmp

-       $$($1_int_CMD) < $$($1_SRC_BIN) 
>> $$($1_DST).tmp

-       $$($1_long_CMD) < $$($1_SRC_BIN) 
>> $$($1_DST).tmp

-       $$($1_float_CMD) < $$($1_SRC_BIN) 
>> $$($1_DST).tmp

-       $$($1_double_CMD) < 
$$($1_SRC_BIN) >> $$($1_DST).tmp

+       $$($1_char_CMD) -i$$($1_SRC_BIN) 
-o$$($1_DST).tmp

+       $$($1_short_CMD) -i$$($1_SRC_BIN) 
-o$$($1_DST).tmp

+       $$($1_int_CMD) -i$$($1_SRC_BIN) 
-o$$($1_DST).tmp

+       $$($1_long_CMD) -i$$($1_SRC_BIN) 
-o$$($1_DST).tmp

+       $$($1_float_CMD) -i$$($1_SRC_BIN) 
-o$$($1_DST).tmp

+       $$($1_double_CMD) 
-i$$($1_SRC_BIN) -o$$($1_DST).tmp

        $(PRINTF) "}\n" >> $$($1_DST).tmp

        mv $$($1_DST).tmp $$($1_DST)

         endif

diff --git 
a/make/gensrc/GensrcCharsetCoder.gmk 
b/make/gensrc/GensrcCharsetCoder.gmk

--- 
a/make/gensrc/GensrcCharsetCoder.gmk

+++ 
b/make/gensrc/GensrcCharsetCoder.gmk

@@ -36,7 +36,7 @@

 
$(GENSRC_CHARSETCODER_DST)/CharsetDecoder.java:
 $(GENSRC_CHARSETCODER_TEMPLATE)

      $(call MakeTargetDir)

      $(RM) $@.tmp

-     $(TOOL_SPP) < $< >$@.tmp \

+     $(TOOL_SPP) -i$< -o$@.tmp \

          -Kdecoder \

          -DA='A' \

          -Da='a' \

@@ -71,7 +71,7 @@

 
$(GENSRC_CHARSETCODER_DST)/CharsetEncoder.java:
 $(GENSRC_CHARSETCODER_TEMPLATE)

      $(call MakeTargetDir)

      $(RM) $@.tmp

-     $(TOOL_SPP) < $< >$@.tmp \

+     $(TOOL_SPP) -i$< -o$@.tmp \

          -Kencoder \

          -DA='An' \

          -Da='an' \

diff --git 
a/make/gensrc/GensrcVarHandles.gmk 
b/make/gensrc/GensrcVarHandles.gmk

--- a/make/gensrc/GensrcVarHandles.gmk

+++ b/make/gensrc/GensrcVarHandles.gmk

@@ -59,8 +59,9 @@

        $$(eval $1_type := $$$$(shell 
$(TR) '[:upper:]' '[:lower:]' <<< 
$$$$($1_Type)))

         endif

      $$(call MakeDir, $$(@D))

+     $(RM) $$@

      $(TOOL_SPP) -nel -K$$($1_type) 
-Dtype=$$($1_type) -DType=$$($1_Type) \

-         $$($1_ARGS) < $$< > $$@

+         $$($1_ARGS) -i$$< -o$$@

 

   GENSRC_VARHANDLES += $$($1_FILENAME)

 endef

@@ -147,10 +148,11 @@

 

   $$($1_FILENAME): 
$(VARHANDLES_SRC_DIR)/X-VarHandleByteArrayView.java.template
 $(BUILD_TOOLS_JDK)

      $$(call MakeDir, $$(@D))

+     $(RM) $$@

      $(TOOL_SPP) -nel -K$$($1_type) \

          -Dtype=$$($1_type) 
-DType=$$($1_Type) 
-DBoxType=$$($1_BoxType) \

          -DrawType=$$($1_rawType) 
-DRawType=$$($1_RawType) 
-DRawBoxType=$$($1_RawBoxType) \

-         $$($1_ARGS) < $$< > $$@

+         $$($1_ARGS) -i$$< -o$$@

 

   GENSRC_VARHANDLES += $$($1_FILENAME)

 endef

diff --git 
a/make/jdk/src/classes/build/tools/generatecurrencydata/GenerateCurrencyData.java
 
b/make/jdk/src/classes/build/tools/generatecurrencydata/GenerateCurrencyData.java

--- 
a/make/jdk/src/classes/build/tools/generatecurrencydata/GenerateCurrencyData.java

+++ 
b/make/jdk/src/classes/build/tools/generatecurrencydata/GenerateCurrencyData.java

@@ -28,7 +28,9 @@

 import java.io.IOException;

 import java.io.FileNotFoundException;

 import java.io.DataOutputStream;

+import java.io.FileInputStream;

 import java.io.FileOutputStream;

+import java.io.InputStream;

 import java.text.SimpleDateFormat;

 import java.util.Date;

 import java.util.HashMap;

@@ -134,19 +136,44 @@

     private static String 
currenciesWithMinorUnitsUndefined;

 

     public static void main(String[] 
args) {

-

+         InputStream in = System.in;

         // Look for "-o 
outputfilename" option

-        if ( args.length == 2 && 
args[0].equals("-o") ) {

-            try {

-                out = new 
DataOutputStream(new 
FileOutputStream(args[1]));

-            } catch ( 
FileNotFoundException e ) {

-                
System.err.println("Error: " + 
e.getMessage());

-                
e.printStackTrace(System.err);

-                System.exit(1);

-            }

-        } else {

-            System.err.println("Error: 
Illegal arg count");

-            System.exit(1);

+        for (int n = 0; n < 
args.length; ++n) {

+            if (args[n].equals("-o")) 
{

+                          ++n;

+                          if (n >= args.length) {

+                                 
System.err.println("Error: Invalid 
argument format");

+                                 System.exit(1);

+                          }

+                          try {

+                                 out = new 
DataOutputStream(new 
FileOutputStream(args[n]));

+                          } catch ( 
FileNotFoundException e ) {

+                                 
System.err.println("Error: " + 
e.getMessage());

+                                 
e.printStackTrace(System.err);

+                                 System.exit(1);

+                          }

+                   } else if 
(args[n].equals("-i")) {

+                          ++n;

+                          if (n >= args.length) {

+                                 
System.err.println("Error: Invalid 
argument format");

+                                 System.exit(1);

+                          }

+                          try {

+                                 in = new 
FileInputStream(args[n]);

+                          } catch ( 
FileNotFoundException e ) {

+                                 
System.err.println("Error: " + 
e.getMessage());

+                                 
e.printStackTrace(System.err);

+                                 System.exit(1);

+                          }

+                   } else {

+                          
System.err.println("Error: Invalid 
argument " + args[n]);

+                          System.exit(1);

+                   }

+        }

+

+        if (out == null) {

+                   System.err.println("Error: 
Invalid argument format");

+                   System.exit(1);

         }

 

         format = new 
SimpleDateFormat("yyyy-MM-dd-HH-mm-ss", 
Locale.US);

@@ -154,7 +181,7 @@

         format.setLenient(false);

 

         try {

-            readInput();

+            readInput(in);

             
buildMainAndSpecialCaseTables();

             buildOtherTables();

             writeOutput();

@@ -167,9 +194,9 @@

         }

     }

 

-    private static void readInput() 
throws IOException {

+    private static void 
readInput(InputStream in) throws 
IOException {

         currencyData = new 
Properties();

-        currencyData.load(System.in);

+        currencyData.load(in);

 

         // initialize other lookup 
strings

         formatVersion = (String) 
currencyData.get("formatVersion");

diff --git 
a/make/jdk/src/classes/build/tools/spp/Spp.java
 
b/make/jdk/src/classes/build/tools/spp/Spp.java

--- 
a/make/jdk/src/classes/build/tools/spp/Spp.java

+++ 
b/make/jdk/src/classes/build/tools/spp/Spp.java

@@ -25,6 +25,8 @@

 

 package build.tools.spp;

 

+import java.io.FileInputStream;

+import java.io.FileOutputStream;

 import java.util.*;

 import java.util.regex.*;

 

@@ -69,6 +71,8 @@

         Set<String> keys = new 
HashSet<>();

         boolean be = false;

         boolean el = true;

+            String inputFile = null;

+            String outputFile = null;

 

         for (String arg:args) {

             if (arg.startsWith("-D")) 
{

@@ -76,6 +80,10 @@

                 
vars.put(arg.substring(2, 
i),arg.substring(i+1));

             } else if 
(arg.startsWith("-K")) {

                 
keys.add(arg.substring(2));

+            } else if 
(arg.startsWith("-i")) {

+                inputFile = 
arg.substring(2);

+            } else if 
(arg.startsWith("-o")) {

+                outputFile = 
arg.substring(2);

             } else if 
("-be".equals(arg)) {

                 be = true;

             } else if 
("-nel".equals(arg)) {

@@ -87,11 +95,11 @@

         }

 

         StringBuffer out = new 
StringBuffer();

-        new Spp().spp(new 
Scanner(System.in),

+        new Spp().spp(new Scanner(new 
FileInputStream(inputFile)),

                       out, "",

                       keys, vars, be, 
el,

                       false);

-        
System.out.print(out.toString());

+        new 
FileOutputStream(outputFile, 
true).write(out.toString().getBytes());

     }

 

     static final String LNSEP = 
System.getProperty("line.separator");

diff --git a/make/src/native/fixpath.c 
b/make/src/native/fixpath.c

--- a/make/src/native/fixpath.c

+++ b/make/src/native/fixpath.c

@@ -24,6 +24,7 @@

  */

 

 #include <Windows.h>

+#include <stdbool.h>

 #include <io.h>

 #include <stdio.h>

 #include <string.h>

@@ -53,25 +54,16 @@

 }

 

 /*

- * Test if pos points to /cygdrive/_/ 
where _ can

+ * Test if pos points to /prefix/_/ 
where _ can

  * be any character.

  */

-int is_cygdrive_here(int pos, char 
const *in, int len)

+int is_prefix_here(int pos, char const 
*in, int len, const char* prefix)

 {

-  // Length of /cygdrive/c/ is 12

-  if (pos+12 > len) return 0;

-  if (in[pos+11]=='/' &&

-      in[pos+9]=='/' &&

-      in[pos+8]=='e' &&

-      in[pos+7]=='v' &&

-      in[pos+6]=='i' &&

-      in[pos+5]=='r' &&

-      in[pos+4]=='d' &&

-      in[pos+3]=='g' &&

-      in[pos+2]=='y' &&

-      in[pos+1]=='c' &&

-      in[pos+0]=='/') {

-    return 1;

+  // Length of c/ is 2

+  int prefix_size = strlen(prefix);

+  if (pos+prefix_size+2 > len) return 
0;

+  if (in[pos+prefix_size+1]=='/') {

+    return strncmp(in + pos, prefix, 
prefix_size) == 0;

   }

   return 0;

 }

@@ -93,7 +85,7 @@

   }

 

   for (i = 0, j = 0; i<len;) {

-    if (is_cygdrive_here(i, in, len)) 
{

+    if (is_prefix_here(i, in, len, 
"/cygdrive/")) {

       out[j++] = in[i+10];

       out[j++] = ':';

       i+=11;

@@ -196,7 +188,39 @@

   return str;

 }

 

+/*

+ * Replace /mnt/_/ with _:/

+ * Works in place since drive letter 
is always

+ * shorter than /mnt/

+ */

+char *replace_cygdrive_wsl(char const 
*in)

+{

+  size_t len = strlen(in);

+  char *out = (char*) malloc(len+1);

+  int i,j;

+

+  if (len < 7) {

+    memmove(out, in, len + 1);

+    return out;

+  }

+

+  for (i = 0, j = 0; i<len;) {

+    if (is_prefix_here(i, in, len, 
"/mnt/")) {

+      out[j++] = in[i+5];

+      out[j++] = ':';

+      i+=6;

+    } else {

+      out[j] = in[i];

+      i++;

+      j++;

+    }

+  }

+  out[j] = '\0';

+  return out;

+}

+

 char*(*replace_cygdrive)(char const 
*in) = NULL;

+bool debug_fixpath = false;

 

 char *files_to_delete[1024];

 int num_files_to_delete = 0;

@@ -250,11 +274,11 @@

     append(&buffer, &buflen, &used, 
block, blocklen);

   }

   buffer[used] = 0;

-  if (getenv("DEBUG_FIXPATH") != NULL) 
{

+  if (debug_fixpath) {

     fprintf(stderr, "fixpath input 
from @-file %s: %s\n", &in[1], buffer);

   }

   fixed = replace_cygdrive(buffer);

-  if (getenv("DEBUG_FIXPATH") != NULL) 
{

+  if (debug_fixpath) {

     fprintf(stderr, "fixpath converted 
to @-file %s is: %s\n", name, fixed);

   }

   fwrite(fixed, strlen(fixed), 1, 
atout);

@@ -363,27 +387,34 @@

     BOOL processInheritHandles = TRUE;

     BOOL waitForChild = TRUE;

 

-    if (argc<2 || argv[1][0] != '-' || 
(argv[1][1] != 'c' && argv[1][1] != 
'm')) {

-        fprintf(stderr, "Usage: 
fixpath -c|m<path@path@...> [--detach] 
/cygdrive/c/WINDOWS/notepad.exe 
[/cygdrive/c/x/test.txt|@/cygdrive/c/x/atfile]\n");

+     debug_fixpath = 
(getenv("DEBUG_FIXPATH") != NULL);

+

+    if (argc<2 || argv[1][0] != '-' || 
(argv[1][1] != 'c' && argv[1][1] != 'm' 
&& argv[1][1] != 'w')) {

+        fprintf(stderr, "Usage: 
fixpath -c|m|w<path@path@...> 
[--detach] 
/cygdrive/c/WINDOWS/notepad.exe 
[/cygdrive/c/x/test.txt|@/cygdrive/c/x/atfile]\n");

         exit(0);

     }

 

-    if (getenv("DEBUG_FIXPATH") != 
NULL) {

+    if (debug_fixpath) {

       char const * cmdline = 
GetCommandLine();

       fprintf(stderr, "fixpath input 
line >%s<\n", strstr(cmdline, 
argv[1]));

     }

 

     if (argv[1][1] == 'c' && 
argv[1][2] == '\0') {

-      if (getenv("DEBUG_FIXPATH") != 
NULL) {

+      if (debug_fixpath) {

         fprintf(stderr, "fixpath using 
cygwin mode\n");

       }

       replace_cygdrive = 
replace_cygdrive_cygwin;

     } else if (argv[1][1] == 'm') {

-      if (getenv("DEBUG_FIXPATH") != 
NULL) {

+      if (debug_fixpath) {

         fprintf(stderr, "fixpath using 
msys mode, with path list: %s\n", 
&argv[1][2]);

       }

       setup_msys_path_list(argv[1]);

       replace_cygdrive = 
replace_cygdrive_msys;

+     } else if (argv[1][1] == 'w') {

+      if (debug_fixpath) {

+        fprintf(stderr, "fixpath using 
wsl mode, with path list: %s\n", 
&argv[1][2]);

+      }

+      replace_cygdrive = 
replace_cygdrive_wsl;

     } else {

       fprintf(stderr, "fixpath Unknown 
mode: %s\n", argv[1]);

       exit(-1);

@@ -391,7 +422,7 @@

 

     if (argv[2][0] == '-') {

       if (strcmp(argv[2], "--detach") 
== 0) {

-        if (getenv("DEBUG_FIXPATH") != 
NULL) {

+        if (debug_fixpath) {

           fprintf(stderr, "fixpath in 
detached mode\n");

         }

         processFlags |= 
DETACHED_PROCESS;

@@ -417,7 +448,7 @@

         var[var_len - 1] = '\0';

         strupr(var);

 

-        if (getenv("DEBUG_FIXPATH") != 
NULL) {

+        if (debug_fixpath) {

           fprintf(stderr, "fixpath 
setting var >%s< to >%s<\n", var, val);

         }

 

@@ -480,12 +511,12 @@

     }

     *current = '\0';

 

-    if (getenv("DEBUG_FIXPATH") != 
NULL) {

+    if (debug_fixpath) {

       fprintf(stderr, "fixpath 
converted line >%s<\n", line);

     }

 

     if (cmd == argc) {

-       if (getenv("DEBUG_FIXPATH") != 
NULL) {

+       if (debug_fixpath) {

          fprintf(stderr, "fixpath no 
command provided!\n");

        }

        exit(0);

@@ -518,7 +549,7 @@

       WaitForSingleObject(pi.hProcess, 
INFINITE);

       GetExitCodeProcess(pi.hProcess, 
&exitCode);

 

-      if (getenv("DEBUG_FIXPATH") != 
NULL) {

+      if (debug_fixpath) {

         for (i=0; 
i<num_files_to_delete; ++i) {

           fprintf(stderr, "fixpath Not 
deleting temporary file %s\n",

                   files_to_delete[i]);

@@ -530,13 +561,13 @@

       }

 

       if (exitCode != 0) {

-        if (getenv("DEBUG_FIXPATH") != 
NULL) {

+        if (debug_fixpath) {

           fprintf(stderr, "fixpath 
exit code %d\n",

                   exitCode);

         }

       }

     } else {

-      if (getenv("DEBUG_FIXPATH") != 
NULL) {

+      if (debug_fixpath) {

         fprintf(stderr, "fixpath Not 
waiting for child process");

       }

     }

Reply via email to