@@ -58,21 +58,32 @@ AC_DEFUN([UTIL_PREPEND_TO_PATH],
5858# 2) The path will be absolute, and it will be in unix-style (on
5959# cygwin).
6060# $1: The name of the variable to fix
61- # $2: if NOFAIL, errors will be silently ignored
61+ # $2: if NOFAIL, if the path cannot be resolved then errors will not be
62+ # reported and an empty path will be set
6263AC_DEFUN ( [ UTIL_FIXUP_PATH] ,
6364[
6465 # Only process if variable expands to non-empty
6566 path="[ $] $1 "
6667 if test "x$path" != x; then
6768 if test "x$OPENJDK_BUILD_OS" = "xwindows"; then
68- if test "x$2 " = "xNOFAIL"; then
69- quiet_option="-q"
69+ imported_path=`$FIXPATH_BASE -q import "$path"`
70+ if test $? -ne 0 || test ! -e $imported_path; then
71+ if test "x$2 " != "xNOFAIL"; then
72+ AC_MSG_NOTICE ( [ The path of $1 , which is given as "$path", can not be properly resolved.] )
73+ AC_MSG_NOTICE ( [ Please see the section "Special Considerations" in building.md.] )
74+ AC_MSG_NOTICE ( [ This is the error message given by fixpath:] )
75+ # Rerun fixpath without -q to get an error message
76+ $FIXPATH_BASE import "$path"
77+ AC_MSG_ERROR ( [ Cannot continue] )
78+ else
79+ imported_path=""
80+ fi
7081 fi
71- imported_path=`$FIXPATH_BASE $quiet_option import "$path"`
72- $FIXPATH_BASE verify "$imported_path"
82+
83+ $FIXPATH_BASE -q verify "$imported_path"
7384 if test $? -ne 0; then
7485 if test "x$2 " != "xNOFAIL"; then
75- AC_MSG_ERROR ( [ The path of $1 , which resolves as "$path", could not be imported .] )
86+ AC_MSG_ERROR ( [ The path of $1 , which resolves as "$path", could not be verified .] )
7687 else
7788 imported_path=""
7889 fi
@@ -83,7 +94,7 @@ AC_DEFUN([UTIL_FIXUP_PATH],
8394 if test "x$imported_path_lower" != "x$orig_path_lower"; then
8495 $1 ="$imported_path"
8596 fi
86- else
97+ else # non-Windows
8798 [ if [ [ "$path" =~ " " ] ] ; then ]
8899 if test "x$2 " != "xNOFAIL"; then
89100 AC_MSG_NOTICE ( [ The path of $1 , which resolves as "$path", is invalid.] )
@@ -232,15 +243,19 @@ AC_DEFUN([UTIL_FIXUP_EXECUTABLE],
232243 # This is a path with slashes, don't look at $PATH
233244 if test "x$OPENJDK_BUILD_OS" = "xwindows"; then
234245 # fixpath.sh import will do all heavy lifting for us
235- new_path=`$FIXPATH_BASE import "$path"`
246+ new_path=`$FIXPATH_BASE -q import "$path"`
236247
237- if test ! -e $new_path; then
248+ if test $? -ne 0 || test ! -e $new_path; then
238249 # It failed, but maybe spaces were part of the path and not separating
239250 # the command and argument. Retry using that assumption.
240- new_path=`$FIXPATH_BASE import "$input"`
241- if test ! -e $new_path; then
242- AC_MSG_NOTICE ( [ The command for $1 , which resolves as "$input", can not be found.] )
243- AC_MSG_ERROR ( [ Cannot locate $input] )
251+ new_path=`$FIXPATH_BASE -q import "$input"`
252+ if test $? -ne 0 || test ! -e $new_path; then
253+ AC_MSG_NOTICE ( [ The command for $1 , which is given as "$input", can not be properly resolved.] )
254+ AC_MSG_NOTICE ( [ Please see the section "Special Considerations" in building.md.] )
255+ AC_MSG_NOTICE ( [ This is the error message given by fixpath:] )
256+ # Rerun fixpath without -q to get an error message
257+ $FIXPATH_BASE import "$input"
258+ AC_MSG_ERROR ( [ Cannot continue] )
244259 fi
245260 # It worked, clear all "arguments"
246261 arguments=""
@@ -348,7 +363,15 @@ AC_DEFUN([UTIL_SETUP_TOOL],
348363 else
349364 # Otherwise we believe it is a complete path. Use it as it is.
350365 if test ! -x "$tool_command" && test ! -x "${tool_command}.exe"; then
351- AC_MSG_ERROR ( [ User supplied tool $1 ="$tool_command" does not exist or is not executable] )
366+ # Maybe the path had spaces in it; try again with the entire argument
367+ if test ! -x "$tool_override" && test ! -x "${tool_override}.exe"; then
368+ AC_MSG_ERROR ( [ User supplied tool $1 ="$tool_override" does not exist or is not executable] )
369+ else
370+ # We successfully located the executable assuming the spaces were part of the path.
371+ # We can't combine using paths with spaces and arguments, so assume tool_args is empty.
372+ tool_command="$tool_override"
373+ tool_args=""
374+ fi
352375 fi
353376 if test ! -x "$tool_command"; then
354377 tool_command="${tool_command}.exe"
0 commit comments