8213239: Configure cannot handle command overrides with arguments
Reviewed-by: erikj
This commit is contained in:
parent
86fdbc0f85
commit
68dbbf566d
@ -489,31 +489,43 @@ AC_DEFUN([BASIC_SETUP_TOOL],
|
||||
# for unknown variables in the end.
|
||||
CONFIGURE_OVERRIDDEN_VARIABLES="$try_remove_var"
|
||||
|
||||
tool_override=[$]$1
|
||||
AC_MSG_NOTICE([User supplied override $1="$tool_override"])
|
||||
|
||||
# Check if we try to supply an empty value
|
||||
if test "x[$]$1" = x; then
|
||||
AC_MSG_NOTICE([Setting user supplied tool $1= (no value)])
|
||||
if test "x$tool_override" = x; then
|
||||
AC_MSG_CHECKING([for $1])
|
||||
AC_MSG_RESULT([disabled])
|
||||
else
|
||||
# Split up override in command part and argument part
|
||||
tool_and_args=($tool_override)
|
||||
[ tool_command=${tool_and_args[0]} ]
|
||||
[ unset 'tool_and_args[0]' ]
|
||||
[ tool_args=${tool_and_args[@]} ]
|
||||
|
||||
# Check if the provided tool contains a complete path.
|
||||
tool_specified="[$]$1"
|
||||
tool_basename="${tool_specified##*/}"
|
||||
if test "x$tool_basename" = "x$tool_specified"; then
|
||||
tool_basename="${tool_command##*/}"
|
||||
if test "x$tool_basename" = "x$tool_command"; then
|
||||
# A command without a complete path is provided, search $PATH.
|
||||
AC_MSG_NOTICE([Will search for user supplied tool $1=$tool_basename])
|
||||
AC_MSG_NOTICE([Will search for user supplied tool "$tool_basename"])
|
||||
AC_PATH_PROG($1, $tool_basename)
|
||||
if test "x[$]$1" = x; then
|
||||
AC_MSG_ERROR([User supplied tool $tool_basename could not be found])
|
||||
AC_MSG_ERROR([User supplied tool $1="$tool_basename" could not be found])
|
||||
fi
|
||||
else
|
||||
# Otherwise we believe it is a complete path. Use it as it is.
|
||||
AC_MSG_NOTICE([Will use user supplied tool $1=$tool_specified])
|
||||
AC_MSG_CHECKING([for $1])
|
||||
if test ! -x "$tool_specified"; then
|
||||
AC_MSG_NOTICE([Will use user supplied tool "$tool_command"])
|
||||
AC_MSG_CHECKING([for $tool_command])
|
||||
if test ! -x "$tool_command"; then
|
||||
AC_MSG_RESULT([not found])
|
||||
AC_MSG_ERROR([User supplied tool $1=$tool_specified does not exist or is not executable])
|
||||
AC_MSG_ERROR([User supplied tool $1="$tool_command" does not exist or is not executable])
|
||||
fi
|
||||
AC_MSG_RESULT([$tool_specified])
|
||||
$1="$tool_command"
|
||||
AC_MSG_RESULT([found])
|
||||
fi
|
||||
if test "x$tool_args" != x; then
|
||||
# If we got arguments, re-append them to the command after the fixup.
|
||||
$1="[$]$1 $tool_args"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
Loading…
x
Reference in New Issue
Block a user