8034199: Add 'reconfigure' target for re-creating a configuration

Tue, 10 Apr 2018 07:46:25 -0700

author
kevinw
date
Tue, 10 Apr 2018 07:46:25 -0700
changeset 2211
2209644bcac4
parent 2210
a05ed58d5ae0
child 2212
dd97daafa80b

8034199: Add 'reconfigure' target for re-creating a configuration
Reviewed-by: ihse, erikj, tbell

common/autoconf/basics.m4 file | annotate | diff | comparison | revisions
common/autoconf/configure file | annotate | diff | comparison | revisions
common/autoconf/generated-configure.sh file | annotate | diff | comparison | revisions
common/autoconf/spec.gmk.in file | annotate | diff | comparison | revisions
make/Main.gmk file | annotate | diff | comparison | revisions
     1.1 --- a/common/autoconf/basics.m4	Sat Apr 07 03:28:39 2018 -0700
     1.2 +++ b/common/autoconf/basics.m4	Tue Apr 10 07:46:25 2018 -0700
     1.3 @@ -564,9 +564,6 @@
     1.4    # You can run make from the OUTPUT_ROOT, or from the top-level Makefile
     1.5    # which will look for generated configurations
     1.6    AC_CONFIG_FILES([$OUTPUT_ROOT/Makefile:$AUTOCONF_DIR/Makefile.in])
     1.7 -
     1.8 -  # Save the arguments given to us
     1.9 -  echo "$CONFIGURE_COMMAND_LINE" > $OUTPUT_ROOT/configure-arguments
    1.10  ])
    1.11  
    1.12  AC_DEFUN_ONCE([BASIC_SETUP_LOGGING],
     2.1 --- a/common/autoconf/configure	Sat Apr 07 03:28:39 2018 -0700
     2.2 +++ b/common/autoconf/configure	Tue Apr 10 07:46:25 2018 -0700
     2.3 @@ -32,7 +32,6 @@
     2.4  export CONFIG_SHELL=$BASH
     2.5  export _as_can_reexec=no
     2.6  
     2.7 -CONFIGURE_COMMAND_LINE="$@"
     2.8  conf_script_dir=`dirname $0`
     2.9  
    2.10  if [ "$CUSTOM_CONFIG_DIR" = "" ]; then
    2.11 @@ -114,14 +113,40 @@
    2.12  if test "x$conf_debug_configure" = xtrue; then
    2.13    conf_debug_configure=recursive
    2.14  fi
    2.15 +
    2.16  ###
    2.17  ### Process command-line arguments
    2.18  ###
    2.19 +
    2.20 +# Returns a shell-escaped version of the argument given.
    2.21 +function shell_quote() {
    2.22 +  if [[ -n "$1" ]]; then
    2.23 +    # Uses only shell-safe characters?  No quoting needed.
    2.24 +    # '=' is a zsh meta-character, but only in word-initial position.
    2.25 +    if [[ "$1" =~ ^[ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.:,%/+=_-]+$ && ! "$1" =~ ^= ]]; then
    2.26 +      quoted="$1"
    2.27 +    else
    2.28 +      if [[ "$1" =~ [\'!] ]]; then
    2.29 +        # csh does history expansion within single quotes, but not
    2.30 +        # when backslash-escaped!
    2.31 +        local quoted_quote="'\\''" quoted_exclam="'\\!'"
    2.32 +        word="${1//\'/${quoted_quote}}"
    2.33 +        word="${1//\!/${quoted_exclam}}"
    2.34 +      fi
    2.35 +      quoted="'$1'"
    2.36 +    fi
    2.37 +    echo "$quoted"
    2.38 +  fi
    2.39 +}
    2.40 +
    2.41  conf_processed_arguments=()
    2.42 +conf_quoted_arguments=()
    2.43  conf_openjdk_target=
    2.44  
    2.45  for conf_option
    2.46  do
    2.47 +
    2.48 +  # Process (and remove) our own extensions that will not be passed to autoconf
    2.49    case $conf_option in
    2.50      --openjdk-target=*)
    2.51        conf_openjdk_target=`expr "X$conf_option" : '[^=]*=\(.*\)'`
    2.52 @@ -132,18 +157,35 @@
    2.53          export conf_debug_configure
    2.54        fi
    2.55        ;;
    2.56 -    [^-]*=*)
    2.57 -      # Add name of variable to CONFIGURE_OVERRIDDEN_VARIABLES list inside !...!.
    2.58 -      conf_env_var=`expr "x$conf_option" : 'x\([^=]*\)='`
    2.59 -      CONFIGURE_OVERRIDDEN_VARIABLES="$CONFIGURE_OVERRIDDEN_VARIABLES!$conf_env_var!"
    2.60 -      # ... and then process argument as usual
    2.61 -      conf_processed_arguments=("${conf_processed_arguments[@]}" "$conf_option")
    2.62 -      ;;
    2.63      *)
    2.64        conf_processed_arguments=("${conf_processed_arguments[@]}" "$conf_option")
    2.65        ;;
    2.66    esac
    2.67  
    2.68 +  # Store all variables overridden on the command line
    2.69 +  case $conf_option in
    2.70 +    [^-]*=*)
    2.71 +      # Add name of variable to CONFIGURE_OVERRIDDEN_VARIABLES list inside !...!.
    2.72 +      conf_env_var=`expr "x$conf_option" : 'x\([^=]*\)='`
    2.73 +      CONFIGURE_OVERRIDDEN_VARIABLES="$CONFIGURE_OVERRIDDEN_VARIABLES!$conf_env_var!"
    2.74 +      ;;
    2.75 +  esac
    2.76 +
    2.77 +  # Save the arguments, intelligently quoted for CONFIGURE_COMMAND_LINE.
    2.78 +  case $conf_option in
    2.79 +    *=*)
    2.80 +      conf_option_name=`expr "x$conf_option" : 'x\([^=]*\)='`
    2.81 +      conf_option_name=$(shell_quote "$conf_option_name")
    2.82 +      conf_option_value=`expr "x$conf_option" : 'x[^=]*=\(.*\)'`
    2.83 +      conf_option_value=$(shell_quote "$conf_option_value")
    2.84 +      conf_quoted_arguments=("${conf_quoted_arguments[@]}" "$conf_option_name=$conf_option_value")
    2.85 +      ;;
    2.86 +    *)
    2.87 +      conf_quoted_arguments=("${conf_quoted_arguments[@]}" "$(shell_quote "$conf_option")")
    2.88 +      ;;
    2.89 +  esac
    2.90 +
    2.91 +  # Check for certain autoconf options that require extra action
    2.92    case $conf_option in
    2.93      -build | --build | --buil | --bui | --bu |-build=* | --build=* | --buil=* | --bui=* | --bu=*)
    2.94        conf_legacy_crosscompile="$conf_legacy_crosscompile $conf_option" ;;
    2.95 @@ -156,6 +198,9 @@
    2.96    esac
    2.97  done
    2.98  
    2.99 +# Save the quoted command line
   2.100 +CONFIGURE_COMMAND_LINE="${conf_quoted_arguments[@]}"
   2.101 +
   2.102  if test "x$conf_legacy_crosscompile" != "x"; then
   2.103    if test "x$conf_openjdk_target" != "x"; then
   2.104      echo "Error: Specifying --openjdk-target together with autoconf"
     3.1 --- a/common/autoconf/generated-configure.sh	Sat Apr 07 03:28:39 2018 -0700
     3.2 +++ b/common/autoconf/generated-configure.sh	Tue Apr 10 07:46:25 2018 -0700
     3.3 @@ -4219,7 +4219,7 @@
     3.4  #CUSTOM_AUTOCONF_INCLUDE
     3.5  
     3.6  # Do not change or remove the following line, it is needed for consistency checks:
     3.7 -DATE_WHEN_GENERATED=1523096909
     3.8 +DATE_WHEN_GENERATED=1523371497
     3.9  
    3.10  ###############################################################################
    3.11  #
    3.12 @@ -15007,9 +15007,6 @@
    3.13    ac_config_files="$ac_config_files $OUTPUT_ROOT/Makefile:$AUTOCONF_DIR/Makefile.in"
    3.14  
    3.15  
    3.16 -  # Save the arguments given to us
    3.17 -  echo "$CONFIGURE_COMMAND_LINE" > $OUTPUT_ROOT/configure-arguments
    3.18 -
    3.19  
    3.20  # Must be done before we can call HELP_MSG_MISSING_DEPENDENCY.
    3.21  
     4.1 --- a/common/autoconf/spec.gmk.in	Sat Apr 07 03:28:39 2018 -0700
     4.2 +++ b/common/autoconf/spec.gmk.in	Tue Apr 10 07:46:25 2018 -0700
     4.3 @@ -46,6 +46,9 @@
     4.4  
     4.5  endef
     4.6  
     4.7 +# The command line given to configure.
     4.8 +CONFIGURE_COMMAND_LINE:=@CONFIGURE_COMMAND_LINE@
     4.9 +
    4.10  # A self-referential reference to this file.
    4.11  SPEC:=@SPEC@
    4.12  
     5.1 --- a/make/Main.gmk	Sat Apr 07 03:28:39 2018 -0700
     5.2 +++ b/make/Main.gmk	Tue Apr 10 07:46:25 2018 -0700
     5.3 @@ -71,8 +71,9 @@
     5.4  # Setup a rule for SPEC file that fails if executed. This check makes sure the configuration
     5.5  # is up to date after changes to configure
     5.6  $(SPEC): $(wildcard $(SRC_ROOT)/common/autoconf/*)
     5.7 -	@$(ECHO) ERROR: $(SPEC) is not up to date
     5.8 -	@$(ECHO) Please rerun configure!
     5.9 +	@$(ECHO) "ERROR: $(SPEC) is not up to date."
    5.10 +	@$(ECHO) "Please rerun configure! Easiest way to do this is by running"
    5.11 +	@$(ECHO) "'make reconfigure'."
    5.12  	@if test "x$(IGNORE_OLD_CONFIG)" != "xtrue"; then exit 1; fi
    5.13  
    5.14  start-make: $(SPEC)
    5.15 @@ -230,6 +231,14 @@
    5.16  	$(call CleanComponent,docstemp)
    5.17  clean-test:
    5.18  	$(call CleanComponent,testoutput)
    5.19 +	
    5.20 +reconfigure:
    5.21 +        ifneq ($(CONFIGURE_COMMAND_LINE), )
    5.22 +	  @$(ECHO) "Re-running configure using arguments '$(CONFIGURE_COMMAND_LINE)'"
    5.23 +        else
    5.24 +	  @$(ECHO) "Re-running configure using default settings"
    5.25 +        endif
    5.26 +	@( cd $(OUTPUT_ROOT) && $(BASH) $(TOPDIR)/configure "$(CONFIGURE_COMMAND_LINE)" )
    5.27  
    5.28  .PHONY: langtools corba jaxp jaxws hotspot jdk nashorn images overlay-images install test docs
    5.29  .PHONY: langtools-only corba-only jaxp-only jaxws-only hotspot-only jdk-only nashorn-only images-only overlay-images-only install-only test-only docs-only

mercurial