1.1 --- a/common/autoconf/configure Thu Sep 06 17:27:20 2012 -0700 1.2 +++ b/common/autoconf/configure Tue Sep 18 11:29:16 2012 -0700 1.3 @@ -2,7 +2,12 @@ 1.4 1.5 CONFIGURE_COMMAND_LINE="$@" 1.6 conf_script_dir=`dirname $0` 1.7 -conf_closed_script_dir="$conf_script_dir/../../jdk/make/closed/autoconf" 1.8 + 1.9 +if [ "$CUSTOM_CONFIG_DIR" = "" ]; then 1.10 + conf_custom_script_dir="$conf_script_dir/../../jdk/make/closed/autoconf" 1.11 +else 1.12 + conf_custom_script_dir=$CUSTOM_CONFIG_DIR 1.13 +fi 1.14 1.15 ### 1.16 ### Test that the generated configure is up-to-date 1.17 @@ -14,8 +19,12 @@ 1.18 print_error_not_up_to_date() { 1.19 echo "Error: The configure source files is newer than the generated files." 1.20 echo "Please run 'sh autogen.sh' to update the generated files." 1.21 + echo "Note that this test might trigger incorrectly sometimes due to hg timestamps". 1.22 } 1.23 1.24 +# NOTE: This test can occasionally go wrong due to the way mercurial handles 1.25 +# timestamps. It it supposed to aid during development of build-infra, but should 1.26 +# go away before making this the default build system. 1.27 for file in configure.ac *.m4 ; do 1.28 if $TEST $file -nt generated-configure.sh; then 1.29 print_error_not_up_to_date 1.30 @@ -23,26 +32,32 @@ 1.31 fi 1.32 done 1.33 1.34 -if $TEST -e $conf_closed_script_dir/generated-configure.sh; then 1.35 - # If closed source configure is available, make sure it is up-to-date as well. 1.36 - for file in configure.ac *.m4 $conf_closed_script_dir/*.m4; do 1.37 - if $TEST $file -nt $conf_closed_script_dir/generated-configure.sh; then 1.38 +if $TEST -e $conf_custom_script_dir/generated-configure.sh; then 1.39 + # If custom source configure is available, make sure it is up-to-date as well. 1.40 + for file in configure.ac *.m4 $conf_custom_script_dir/*.m4; do 1.41 + if $TEST $file -nt $conf_custom_script_dir/generated-configure.sh; then 1.42 print_error_not_up_to_date 1.43 exit 1 1.44 fi 1.45 done 1.46 1.47 - # Test if open configure is newer than closed configure, if so, closed needs to 1.48 - # be regenerated. 1.49 + # Test if open configure is newer than custom configure, if so, custom needs to 1.50 + # be regenerated. This test is required to ensure consistency with custom source. 1.51 conf_open_configure_timestamp=`grep DATE_WHEN_GENERATED: $conf_script_dir/generated-configure.sh | cut -d" " -f 3` 1.52 - conf_closed_configure_timestamp=`grep DATE_WHEN_GENERATED: $conf_closed_script_dir/generated-configure.sh | cut -d" " -f 3` 1.53 - if $TEST $conf_open_configure_timestamp -gt $conf_closed_configure_timestamp; then 1.54 - print_error_not_up_to_date 1.55 + conf_custom_configure_timestamp=`grep DATE_WHEN_GENERATED: $conf_custom_script_dir/generated-configure.sh | cut -d" " -f 3` 1.56 + if $TEST $conf_open_configure_timestamp -gt $conf_custom_configure_timestamp; then 1.57 + echo "Error: The generated configure file contains changes not present in the custom generated file." 1.58 + echo "Please run 'sh autogen.sh' to update the generated files." 1.59 exit 1 1.60 fi 1.61 1.62 fi 1.63 1.64 +# Autoconf calls the configure script recursively sometimes. 1.65 +# Don't start logging twice in that case 1.66 +if $TEST "x$conf_debug_configure" = xtrue; then 1.67 + conf_debug_configure=recursive 1.68 +fi 1.69 ### 1.70 ### Process command-line arguments 1.71 ### 1.72 @@ -63,6 +78,12 @@ 1.73 --with-extra-cxxflags=*) 1.74 conf_extra_cxxflags=`expr "X$conf_option" : '[^=]*=\(.*\)'` 1.75 continue ;; 1.76 + --debug-configure) 1.77 + if $TEST "x$conf_debug_configure" != xrecursive; then 1.78 + conf_debug_configure=true 1.79 + export conf_debug_configure 1.80 + fi 1.81 + continue ;; 1.82 *) 1.83 conf_processed_arguments="$conf_processed_arguments $conf_option" ;; 1.84 esac 1.85 @@ -104,13 +125,29 @@ 1.86 ### 1.87 ### Call the configure script 1.88 ### 1.89 -if $TEST -e $conf_closed_script_dir/generated-configure.sh; then 1.90 - # Closed source configure available; run that instead 1.91 - . $conf_closed_script_dir/generated-configure.sh $conf_processed_arguments --with-extra-cflags="$conf_extra_cflags" --with-extra-cxxflags="$conf_extra_cxxflags" 1.92 +if $TEST -e $conf_custom_script_dir/generated-configure.sh; then 1.93 + # Custom source configure available; run that instead 1.94 + echo Running custom generated-configure.sh 1.95 + conf_script_to_run=$conf_custom_script_dir/generated-configure.sh 1.96 else 1.97 - . $conf_script_dir/generated-configure.sh $conf_processed_arguments --with-extra-cflags="$conf_extra_cflags" --with-extra-cxxflags="$conf_extra_cxxflags" 1.98 + echo Running generated-configure.sh 1.99 + conf_script_to_run=$conf_script_dir/generated-configure.sh 1.100 +fi 1.101 + 1.102 +if $TEST "x$conf_debug_configure" != x; then 1.103 + # Turn on shell debug output if requested (initial or recursive) 1.104 + set -x 1.105 fi 1.106 1.107 +if $TEST "x$conf_debug_configure" = xtrue; then 1.108 + # Turn on logging, but don't turn on twice when called recursive 1.109 + conf_debug_logfile=./debug-configure.log 1.110 + (exec 3>&1 ; (. $conf_script_to_run $conf_processed_arguments --with-extra-cflags="$conf_extra_cflags" --with-extra-cxxflags="$conf_extra_cxxflags" 2>&1 1>&3 ) | tee -a $conf_debug_logfile 1>&2 ; exec 3>&-) | tee -a $conf_debug_logfile 1.111 +else 1.112 + . $conf_script_to_run $conf_processed_arguments --with-extra-cflags="$conf_extra_cflags" --with-extra-cxxflags="$conf_extra_cxxflags" 1.113 +fi 1.114 + 1.115 +conf_result_code=$? 1.116 ### 1.117 ### Post-processing 1.118 ### 1.119 @@ -119,3 +156,5 @@ 1.120 if $TEST -d "$OUTPUT_ROOT"; then 1.121 mv -f config.log "$OUTPUT_ROOT" 2> /dev/null 1.122 fi 1.123 + 1.124 +exit $conf_result_code