# HG changeset patch # User ihse # Date 1571314826 -7200 # Node ID 931ec3339786ed046b48a43ab57f19c256a65d63 # Parent eda750f21308c0ceafc2fd1ac92bb21909099733 8213239: Configure cannot handle command overrides with arguments Reviewed-by: erikj diff -r eda750f21308 -r 931ec3339786 make/autoconf/basics.m4 --- a/make/autoconf/basics.m4 Thu Oct 17 07:35:22 2019 -0400 +++ b/make/autoconf/basics.m4 Thu Oct 17 14:20:26 2019 +0200 @@ -489,31 +489,43 @@ # 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