diff --git a/make/autoconf/basic_tools.m4 b/make/autoconf/basic_tools.m4 index 8e42f9205a454..d75142a6dbaff 100644 --- a/make/autoconf/basic_tools.m4 +++ b/make/autoconf/basic_tools.m4 @@ -56,8 +56,21 @@ AC_DEFUN_ONCE([BASIC_SETUP_FUNDAMENTAL_TOOLS], # Tools only needed on some platforms UTIL_LOOKUP_PROGS(LOCALE, locale) UTIL_LOOKUP_PROGS(PATHTOOL, cygpath wslpath) - UTIL_LOOKUP_PROGS(CMD, cmd.exe, $PATH:/cygdrive/c/windows/system32:/mnt/c/windows/system32:/c/windows/system32) UTIL_LOOKUP_PROGS(LSB_RELEASE, lsb_release) + + case "`uname -s 2>/dev/null || true`" in + *MINGW*|*MSYS*|*CYGWIN*|*NT*) HAVE_WINDOWS_ENV=yes ;; + *) HAVE_WINDOWS_ENV=no ;; + esac + + if test "x${HAVE_WINDOWS_ENV}" = "xyes"; then + if test "x${SYSTEMROOT:-}" = "x"; then + AC_MSG_ERROR([Environment variable SYSTEMROOT is not set. Please set SYSTEMROOT (e.g. C:\Windows) before building on Windows.]) + fi + fi + + SYSTEM32_PATH=$($PATHTOOL -u "${SYSTEMROOT}/system32" 2>/dev/null) + UTIL_LOOKUP_PROGS(CMD, cmd.exe, $PATH:${SYSTEM32_PATH}) ]) ################################################################################ diff --git a/make/autoconf/toolchain_microsoft.m4 b/make/autoconf/toolchain_microsoft.m4 index f577cf1a2a1d6..af08434ec3675 100644 --- a/make/autoconf/toolchain_microsoft.m4 +++ b/make/autoconf/toolchain_microsoft.m4 @@ -338,7 +338,7 @@ AC_DEFUN([TOOLCHAIN_EXTRACT_VISUAL_STUDIO_ENV], OLDPATH="$PATH" # Make sure we only capture additions to PATH needed by VS. # Clear out path, but need system dir present for vsvars cmd file to be able to run - export PATH=$WINENV_PREFIX/c/windows/system32 + export PATH=$(${PATHTOOL} -u "${SYSTEMROOT}")/system32 # The "| cat" is to stop SetEnv.Cmd to mess with system colors on some systems # We can't pass -vcvars_ver=$VCVARS_VER here because cmd.exe eats all '=' # in bat file arguments. :-( diff --git a/make/scripts/fixpath.sh b/make/scripts/fixpath.sh index 6a524df4c680b..7644b1eb0050e 100644 --- a/make/scripts/fixpath.sh +++ b/make/scripts/fixpath.sh @@ -71,8 +71,10 @@ function setup() { fi if [[ -z ${DRIVEPREFIX+x} ]]; then - winroot="$($PATHTOOL -u c:/)" - DRIVEPREFIX="${winroot%/c/}" + drive_letter="${SYSTEMROOT%%:*}" + drive_letter_lower="$(echo "${drive_letter}" | tr 'A-Z' 'a-z')" + cyg_systemroot="$(${PATHTOOL} -u "${SYSTEMROOT}")" + DRIVEPREFIX="${cyg_systemroot%%/${drive_letter_lower}/*}" else if [[ $DRIVEPREFIX == "NONE" ]]; then DRIVEPREFIX="" @@ -88,7 +90,9 @@ function setup() { fi if [[ -z ${CMD+x} ]]; then - CMD="$DRIVEPREFIX/c/windows/system32/cmd.exe" + # Use SYSTEMROOT to find Windows directory regardless of drive letter + cyg_systemroot="$(${PATHTOOL} -u "${SYSTEMROOT}")" + CMD="${cyg_systemroot}/system32/cmd.exe" fi if [[ -z ${WINTEMP+x} ]]; then diff --git a/test/jdk/com/sun/jdi/JdbReadTwiceTest.sh b/test/jdk/com/sun/jdi/JdbReadTwiceTest.sh index 5902abe50ad69..885472ddb1c58 100644 --- a/test/jdk/com/sun/jdi/JdbReadTwiceTest.sh +++ b/test/jdk/com/sun/jdi/JdbReadTwiceTest.sh @@ -44,13 +44,20 @@ if [ -z "$TESTCLASSES" ] ; then fi case `uname -s` in + *MINGW*|*MSYS*|*CYGWIN*|*NT*) + IS_WINDOWS=true + ;; Linux) + IS_WINDOWS=false + # Need this to convert to the /.automount/... form which # is what jdb will report when it reads an init file. echo TESTCLASSES=$TESTCLASSES TESTCLASSES=`(cd $TESTCLASSES; /bin/pwd)` echo TESTCLASSES=$TESTCLASSES ;; + *) + IS_WINDOWS=false esac # All output will go under this dir. We define HOME to @@ -84,7 +91,7 @@ failIfNot() # $1 is the expected number of occurances of $2 in the jdb output. count=$1 shift - if [ -r c:/ ] ; then + if [ "${IS_WINDOWS}" = "true" ] ; then sed -e 's@\\@/@g' $tmpResult > $tmpResult.1 mv $tmpResult.1 $tmpResult fi @@ -177,7 +184,7 @@ mkFiles $HOME/.jdbrc $here/jdb.ini clean -if [ ! -r c:/ ] ; then +if [ "${IS_WINDOWS}" != "true" ] ; then # No symlinks on windows. echo echo "+++++++++++++++++++++++++++++++++++" @@ -191,7 +198,7 @@ if [ ! -r c:/ ] ; then fi -if [ ! -r c:/ ] ; then +if [ "${IS_WINDOWS}" != "true" ] ; then # No symlinks on windows. echo echo "+++++++++++++++++++++++++++++++++++" diff --git a/test/jdk/java/awt/Dialog/FileDialogUIUpdate.java b/test/jdk/java/awt/Dialog/FileDialogUIUpdate.java index f97d947991b43..b479b748d8502 100644 --- a/test/jdk/java/awt/Dialog/FileDialogUIUpdate.java +++ b/test/jdk/java/awt/Dialog/FileDialogUIUpdate.java @@ -70,7 +70,7 @@ public FileDialogUIUpdate() { Button showButton = new Button("Show FileDialog"); setLayout(new BorderLayout()); - fd.setDirectory("c:/"); + fd.setDirectory(System.getenv("SYSTEMROOT")); showButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { fd.setVisible(true);