Skip to content

Commit 7ae384b

Browse files
committed
8206125: [windows] cannot pass relative path to --with-boot-jdk
Reviewed-by: tbell
1 parent 79192e3 commit 7ae384b

File tree

2 files changed

+34
-14
lines changed

2 files changed

+34
-14
lines changed

make/autoconf/basics.m4

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,32 @@ AC_DEFUN([BASIC_PREPEND_TO_PATH],
205205
fi
206206
])
207207

208+
################################################################################
209+
# This will make a path absolute. Assumes it's already a unix path. Also
210+
# resolves ~ to homedir.
211+
AC_DEFUN([BASIC_ABSOLUTE_PATH],
212+
[
213+
if test "x[$]$1" != x; then
214+
new_path="[$]$1"
215+
216+
if [ [[ "$new_path" = ~* ]] ]; then
217+
# Use eval to expand a potential ~
218+
eval new_path="$new_path"
219+
if test ! -f "$new_path" && test ! -d "$new_path"; then
220+
AC_MSG_ERROR([The new_path of $1, which resolves as "$new_path", is not found.])
221+
fi
222+
fi
223+
224+
if test -d "$new_path"; then
225+
$1="`cd "$new_path"; $THEPWDCMD -L`"
226+
else
227+
dir="`$DIRNAME "$new_path"`"
228+
base="`$BASENAME "$new_path"`"
229+
$1="`cd "$dir"; $THEPWDCMD -L`/$base"
230+
fi
231+
fi
232+
])
233+
208234
###############################################################################
209235
# This will make sure the given variable points to a full and proper
210236
# path. This means:
@@ -217,7 +243,6 @@ AC_DEFUN([BASIC_PREPEND_TO_PATH],
217243
AC_DEFUN([BASIC_FIXUP_PATH],
218244
[
219245
# Only process if variable expands to non-empty
220-
221246
if test "x[$]$1" != x; then
222247
if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
223248
BASIC_FIXUP_PATH_CYGWIN($1)
@@ -234,19 +259,8 @@ AC_DEFUN([BASIC_FIXUP_PATH],
234259
AC_MSG_ERROR([Spaces are not allowed in this path.])
235260
fi
236261
237-
# Use eval to expand a potential ~
238-
eval path="$path"
239-
if test ! -f "$path" && test ! -d "$path"; then
240-
AC_MSG_ERROR([The path of $1, which resolves as "$path", is not found.])
241-
fi
242-
243-
if test -d "$path"; then
244-
$1="`cd "$path"; $THEPWDCMD -L`"
245-
else
246-
dir="`$DIRNAME "$path"`"
247-
base="`$BASENAME "$path"`"
248-
$1="`cd "$dir"; $THEPWDCMD -L`/$base"
249-
fi
262+
BASIC_ABSOLUTE_PATH(path)
263+
$1="$path"
250264
fi
251265
fi
252266
])

make/autoconf/basics_windows.m4

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,8 @@ AC_DEFUN([BASIC_FIXUP_PATH_CYGWIN],
148148
path="[$]$1"
149149
new_path=`$CYGPATH -u "$path"`
150150
151+
BASIC_ABSOLUTE_PATH(new_path)
152+
151153
# Cygwin tries to hide some aspects of the Windows file system, such that binaries are
152154
# named .exe but called without that suffix. Therefore, "foo" and "foo.exe" are considered
153155
# the same file, most of the time (as in "test -f"). But not when running cygpath -s, then
@@ -181,6 +183,8 @@ AC_DEFUN([BASIC_FIXUP_PATH_MSYS],
181183
new_path=`cmd //c echo $path`
182184
fi
183185
186+
BASIC_ABSOLUTE_PATH(new_path)
187+
184188
BASIC_MAKE_WINDOWS_SPACE_SAFE_MSYS([$new_path])
185189
BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(new_path)
186190
if test "x$path" != "x$new_path"; then
@@ -199,6 +203,8 @@ AC_DEFUN([BASIC_FIXUP_PATH_WSL],
199203
new_path="[$]$1"
200204
BASIC_WINDOWS_REWRITE_AS_UNIX_PATH([new_path])
201205
206+
BASIC_ABSOLUTE_PATH(new_path)
207+
202208
# Call helper function which possibly converts this using DOS-style short mode.
203209
# If so, the updated path is stored in $new_path.
204210
BASIC_MAKE_WINDOWS_SPACE_SAFE_WSL([$new_path])

0 commit comments

Comments
 (0)