common/autoconf/configure
changeset 22716 cf32fe2eb254
parent 22714 a752920c4317
child 22721 63761da45392
equal deleted inserted replaced
22715:8621ef3d6caa 22716:cf32fe2eb254
    26   echo This script needs bash to run.
    26   echo This script needs bash to run.
    27   echo It is recommended to use the configure script in the source tree root instead.
    27   echo It is recommended to use the configure script in the source tree root instead.
    28   exit 1
    28   exit 1
    29 fi
    29 fi
    30 
    30 
    31 CONFIGURE_COMMAND_LINE="$@"
       
    32 conf_script_dir=`dirname $0`
    31 conf_script_dir=`dirname $0`
    33 
    32 
    34 if [ "$CUSTOM_CONFIG_DIR" = "" ]; then
    33 if [ "$CUSTOM_CONFIG_DIR" = "" ]; then
    35   conf_custom_script_dir="$conf_script_dir/../../closed/autoconf"
    34   conf_custom_script_dir="$conf_script_dir/../../closed/autoconf"
    36 else
    35 else
   108 # Autoconf calls the configure script recursively sometimes.
   107 # Autoconf calls the configure script recursively sometimes.
   109 # Don't start logging twice in that case
   108 # Don't start logging twice in that case
   110 if test "x$conf_debug_configure" = xtrue; then
   109 if test "x$conf_debug_configure" = xtrue; then
   111   conf_debug_configure=recursive
   110   conf_debug_configure=recursive
   112 fi
   111 fi
       
   112 
   113 ###
   113 ###
   114 ### Process command-line arguments
   114 ### Process command-line arguments
   115 ###
   115 ###
       
   116 
       
   117 # Returns a shell-escaped version of the argument given.
       
   118 function shell_quote() {
       
   119   if [[ -n "$1" ]]; then
       
   120     # Uses only shell-safe characters?  No quoting needed.
       
   121     # '=' is a zsh meta-character, but only in word-initial position.
       
   122     if [[ "$1" =~ ^[ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.:,%/+=_-]+$ && ! "$1" =~ ^= ]]; then
       
   123       quoted="$1"
       
   124     else
       
   125       if [[ "$1" =~ [\'!] ]]; then
       
   126         # csh does history expansion within single quotes, but not
       
   127         # when backslash-escaped!
       
   128         local quoted_quote="'\\''" quoted_exclam="'\\!'"
       
   129         word="${1//\'/${quoted_quote}}"
       
   130         word="${1//\!/${quoted_exclam}}"
       
   131       fi
       
   132       quoted="'$1'"
       
   133     fi
       
   134     echo "$quoted"
       
   135   fi
       
   136 }
       
   137 
   116 conf_processed_arguments=()
   138 conf_processed_arguments=()
       
   139 conf_quoted_arguments=()
   117 conf_openjdk_target=
   140 conf_openjdk_target=
   118 
   141 
   119 for conf_option
   142 for conf_option
   120 do
   143 do
       
   144 
       
   145   # Process (and remove) our own extensions that will not be passed to autoconf
   121   case $conf_option in
   146   case $conf_option in
   122     --openjdk-target=*)
   147     --openjdk-target=*)
   123       conf_openjdk_target=`expr "X$conf_option" : '[^=]*=\(.*\)'`
   148       conf_openjdk_target=`expr "X$conf_option" : '[^=]*=\(.*\)'`
   124       ;;
   149       ;;
   125     --debug-configure)
   150     --debug-configure)
   126       if test "x$conf_debug_configure" != xrecursive; then
   151       if test "x$conf_debug_configure" != xrecursive; then
   127         conf_debug_configure=true
   152         conf_debug_configure=true
   128         export conf_debug_configure
   153         export conf_debug_configure
   129       fi
   154       fi
   130       ;;
   155       ;;
       
   156     *)
       
   157       conf_processed_arguments=("${conf_processed_arguments[@]}" "$conf_option")
       
   158       ;;
       
   159   esac
       
   160 
       
   161   # Store all variables overridden on the command line
       
   162   case $conf_option in
   131     [^-]*=*)
   163     [^-]*=*)
   132       # Add name of variable to CONFIGURE_OVERRIDDEN_VARIABLES list inside !...!.
   164       # Add name of variable to CONFIGURE_OVERRIDDEN_VARIABLES list inside !...!.
   133       conf_env_var=`expr "x$conf_option" : 'x\([^=]*\)='`
   165       conf_env_var=`expr "x$conf_option" : 'x\([^=]*\)='`
   134       CONFIGURE_OVERRIDDEN_VARIABLES="$CONFIGURE_OVERRIDDEN_VARIABLES!$conf_env_var!"
   166       CONFIGURE_OVERRIDDEN_VARIABLES="$CONFIGURE_OVERRIDDEN_VARIABLES!$conf_env_var!"
   135       # ... and then process argument as usual
   167       ;;
   136       conf_processed_arguments=("${conf_processed_arguments[@]}" "$conf_option")
   168   esac
       
   169 
       
   170   # Save the arguments, intelligently quoted for CONFIGURE_COMMAND_LINE.
       
   171   case $conf_option in
       
   172     *=*)
       
   173       conf_option_name=`expr "x$conf_option" : 'x\([^=]*\)='`
       
   174       conf_option_name=$(shell_quote "$conf_option_name")
       
   175       conf_option_value=`expr "x$conf_option" : 'x[^=]*=\(.*\)'`
       
   176       conf_option_value=$(shell_quote "$conf_option_value")
       
   177       conf_quoted_arguments=("${conf_quoted_arguments[@]}" "$conf_option_name=$conf_option_value")
   137       ;;
   178       ;;
   138     *)
   179     *)
   139       conf_processed_arguments=("${conf_processed_arguments[@]}" "$conf_option")
   180       conf_quoted_arguments=("${conf_quoted_arguments[@]}" "$(shell_quote "$conf_option")")
   140       ;;
   181       ;;
   141   esac
   182   esac
   142 
   183 
       
   184   # Check for certain autoconf options that require extra action
   143   case $conf_option in
   185   case $conf_option in
   144     -build | --build | --buil | --bui | --bu |-build=* | --build=* | --buil=* | --bui=* | --bu=*)
   186     -build | --build | --buil | --bui | --bu |-build=* | --build=* | --buil=* | --bui=* | --bu=*)
   145       conf_legacy_crosscompile="$conf_legacy_crosscompile $conf_option" ;;
   187       conf_legacy_crosscompile="$conf_legacy_crosscompile $conf_option" ;;
   146     -target | --target | --targe | --targ | --tar | --ta | --t | -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
   188     -target | --target | --targe | --targ | --tar | --ta | --t | -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
   147       conf_legacy_crosscompile="$conf_legacy_crosscompile $conf_option" ;;
   189       conf_legacy_crosscompile="$conf_legacy_crosscompile $conf_option" ;;
   149       conf_legacy_crosscompile="$conf_legacy_crosscompile $conf_option" ;;
   191       conf_legacy_crosscompile="$conf_legacy_crosscompile $conf_option" ;;
   150     -help | --help | --hel | --he | -h)
   192     -help | --help | --hel | --he | -h)
   151       conf_print_help=true ;;
   193       conf_print_help=true ;;
   152   esac
   194   esac
   153 done
   195 done
       
   196 
       
   197 # Save the quoted command line
       
   198 CONFIGURE_COMMAND_LINE="${conf_quoted_arguments[@]}"
   154 
   199 
   155 if test "x$conf_legacy_crosscompile" != "x"; then
   200 if test "x$conf_legacy_crosscompile" != "x"; then
   156   if test "x$conf_openjdk_target" != "x"; then
   201   if test "x$conf_openjdk_target" != "x"; then
   157     echo "Error: Specifying --openjdk-target together with autoconf"
   202     echo "Error: Specifying --openjdk-target together with autoconf"
   158     echo "legacy cross-compilation flags is not supported."
   203     echo "legacy cross-compilation flags is not supported."