1.1 --- a/common/autoconf/configure Sat Apr 07 03:28:39 2018 -0700 1.2 +++ b/common/autoconf/configure Tue Apr 10 07:46:25 2018 -0700 1.3 @@ -32,7 +32,6 @@ 1.4 export CONFIG_SHELL=$BASH 1.5 export _as_can_reexec=no 1.6 1.7 -CONFIGURE_COMMAND_LINE="$@" 1.8 conf_script_dir=`dirname $0` 1.9 1.10 if [ "$CUSTOM_CONFIG_DIR" = "" ]; then 1.11 @@ -114,14 +113,40 @@ 1.12 if test "x$conf_debug_configure" = xtrue; then 1.13 conf_debug_configure=recursive 1.14 fi 1.15 + 1.16 ### 1.17 ### Process command-line arguments 1.18 ### 1.19 + 1.20 +# Returns a shell-escaped version of the argument given. 1.21 +function shell_quote() { 1.22 + if [[ -n "$1" ]]; then 1.23 + # Uses only shell-safe characters? No quoting needed. 1.24 + # '=' is a zsh meta-character, but only in word-initial position. 1.25 + if [[ "$1" =~ ^[ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.:,%/+=_-]+$ && ! "$1" =~ ^= ]]; then 1.26 + quoted="$1" 1.27 + else 1.28 + if [[ "$1" =~ [\'!] ]]; then 1.29 + # csh does history expansion within single quotes, but not 1.30 + # when backslash-escaped! 1.31 + local quoted_quote="'\\''" quoted_exclam="'\\!'" 1.32 + word="${1//\'/${quoted_quote}}" 1.33 + word="${1//\!/${quoted_exclam}}" 1.34 + fi 1.35 + quoted="'$1'" 1.36 + fi 1.37 + echo "$quoted" 1.38 + fi 1.39 +} 1.40 + 1.41 conf_processed_arguments=() 1.42 +conf_quoted_arguments=() 1.43 conf_openjdk_target= 1.44 1.45 for conf_option 1.46 do 1.47 + 1.48 + # Process (and remove) our own extensions that will not be passed to autoconf 1.49 case $conf_option in 1.50 --openjdk-target=*) 1.51 conf_openjdk_target=`expr "X$conf_option" : '[^=]*=\(.*\)'` 1.52 @@ -132,18 +157,35 @@ 1.53 export conf_debug_configure 1.54 fi 1.55 ;; 1.56 - [^-]*=*) 1.57 - # Add name of variable to CONFIGURE_OVERRIDDEN_VARIABLES list inside !...!. 1.58 - conf_env_var=`expr "x$conf_option" : 'x\([^=]*\)='` 1.59 - CONFIGURE_OVERRIDDEN_VARIABLES="$CONFIGURE_OVERRIDDEN_VARIABLES!$conf_env_var!" 1.60 - # ... and then process argument as usual 1.61 - conf_processed_arguments=("${conf_processed_arguments[@]}" "$conf_option") 1.62 - ;; 1.63 *) 1.64 conf_processed_arguments=("${conf_processed_arguments[@]}" "$conf_option") 1.65 ;; 1.66 esac 1.67 1.68 + # Store all variables overridden on the command line 1.69 + case $conf_option in 1.70 + [^-]*=*) 1.71 + # Add name of variable to CONFIGURE_OVERRIDDEN_VARIABLES list inside !...!. 1.72 + conf_env_var=`expr "x$conf_option" : 'x\([^=]*\)='` 1.73 + CONFIGURE_OVERRIDDEN_VARIABLES="$CONFIGURE_OVERRIDDEN_VARIABLES!$conf_env_var!" 1.74 + ;; 1.75 + esac 1.76 + 1.77 + # Save the arguments, intelligently quoted for CONFIGURE_COMMAND_LINE. 1.78 + case $conf_option in 1.79 + *=*) 1.80 + conf_option_name=`expr "x$conf_option" : 'x\([^=]*\)='` 1.81 + conf_option_name=$(shell_quote "$conf_option_name") 1.82 + conf_option_value=`expr "x$conf_option" : 'x[^=]*=\(.*\)'` 1.83 + conf_option_value=$(shell_quote "$conf_option_value") 1.84 + conf_quoted_arguments=("${conf_quoted_arguments[@]}" "$conf_option_name=$conf_option_value") 1.85 + ;; 1.86 + *) 1.87 + conf_quoted_arguments=("${conf_quoted_arguments[@]}" "$(shell_quote "$conf_option")") 1.88 + ;; 1.89 + esac 1.90 + 1.91 + # Check for certain autoconf options that require extra action 1.92 case $conf_option in 1.93 -build | --build | --buil | --bui | --bu |-build=* | --build=* | --buil=* | --bui=* | --bu=*) 1.94 conf_legacy_crosscompile="$conf_legacy_crosscompile $conf_option" ;; 1.95 @@ -156,6 +198,9 @@ 1.96 esac 1.97 done 1.98 1.99 +# Save the quoted command line 1.100 +CONFIGURE_COMMAND_LINE="${conf_quoted_arguments[@]}" 1.101 + 1.102 if test "x$conf_legacy_crosscompile" != "x"; then 1.103 if test "x$conf_openjdk_target" != "x"; then 1.104 echo "Error: Specifying --openjdk-target together with autoconf"