common/autoconf/configure
changeset 13697 5262b00bc10c
parent 13132 bd88bb8dd3af
child 14111 2a82ecb35fc7
equal deleted inserted replaced
13694:ffe6bce5a521 13697:5262b00bc10c
     1 #!/bin/sh
     1 #!/bin/sh
     2 
     2 
     3 CONFIGURE_COMMAND_LINE="$@"
     3 CONFIGURE_COMMAND_LINE="$@"
     4 conf_script_dir=`dirname $0`
     4 conf_script_dir=`dirname $0`
     5 conf_closed_script_dir="$conf_script_dir/../../jdk/make/closed/autoconf"
     5 
       
     6 if [ "$CUSTOM_CONFIG_DIR" = "" ]; then
       
     7   conf_custom_script_dir="$conf_script_dir/../../jdk/make/closed/autoconf"
       
     8 else
       
     9   conf_custom_script_dir=$CUSTOM_CONFIG_DIR
       
    10 fi
     6 
    11 
     7 ###
    12 ###
     8 ### Test that the generated configure is up-to-date
    13 ### Test that the generated configure is up-to-date
     9 ###
    14 ###
    10 
    15 
    12 TEST=`which test`
    17 TEST=`which test`
    13 
    18 
    14 print_error_not_up_to_date() {
    19 print_error_not_up_to_date() {
    15   echo "Error: The configure source files is newer than the generated files."
    20   echo "Error: The configure source files is newer than the generated files."
    16   echo "Please run 'sh autogen.sh' to update the generated files."
    21   echo "Please run 'sh autogen.sh' to update the generated files."
       
    22   echo "Note that this test might trigger incorrectly sometimes due to hg timestamps".
    17 }
    23 }
    18 
    24 
       
    25 # NOTE: This test can occasionally go wrong due to the way mercurial handles
       
    26 # timestamps. It it supposed to aid during development of build-infra, but should
       
    27 # go away before making this the default build system.
    19 for file in configure.ac *.m4 ; do
    28 for file in configure.ac *.m4 ; do
    20   if $TEST $file -nt generated-configure.sh; then
    29   if $TEST $file -nt generated-configure.sh; then
    21     print_error_not_up_to_date
    30     print_error_not_up_to_date
    22     exit 1
    31     exit 1
    23   fi
    32   fi
    24 done
    33 done
    25 
    34 
    26 if $TEST -e $conf_closed_script_dir/generated-configure.sh; then
    35 if $TEST -e $conf_custom_script_dir/generated-configure.sh; then
    27   # If closed source configure is available, make sure it is up-to-date as well.
    36   # If custom source configure is available, make sure it is up-to-date as well.
    28   for file in configure.ac *.m4 $conf_closed_script_dir/*.m4; do
    37   for file in configure.ac *.m4 $conf_custom_script_dir/*.m4; do
    29     if $TEST $file -nt $conf_closed_script_dir/generated-configure.sh; then
    38     if $TEST $file -nt $conf_custom_script_dir/generated-configure.sh; then
    30       print_error_not_up_to_date
    39       print_error_not_up_to_date
    31       exit 1
    40       exit 1
    32     fi
    41     fi
    33   done
    42   done
    34 
    43 
    35   # Test if open configure is newer than closed configure, if so, closed needs to
    44   # Test if open configure is newer than custom configure, if so, custom needs to
    36   # be regenerated.
    45   # be regenerated. This test is required to ensure consistency with custom source.
    37   conf_open_configure_timestamp=`grep DATE_WHEN_GENERATED: $conf_script_dir/generated-configure.sh  | cut -d" " -f 3`
    46   conf_open_configure_timestamp=`grep DATE_WHEN_GENERATED: $conf_script_dir/generated-configure.sh  | cut -d" " -f 3`
    38   conf_closed_configure_timestamp=`grep DATE_WHEN_GENERATED: $conf_closed_script_dir/generated-configure.sh  | cut -d" " -f 3`
    47   conf_custom_configure_timestamp=`grep DATE_WHEN_GENERATED: $conf_custom_script_dir/generated-configure.sh  | cut -d" " -f 3`
    39   if $TEST $conf_open_configure_timestamp -gt $conf_closed_configure_timestamp; then
    48   if $TEST $conf_open_configure_timestamp -gt $conf_custom_configure_timestamp; then
    40     print_error_not_up_to_date
    49     echo "Error: The generated configure file contains changes not present in the custom generated file."
       
    50     echo "Please run 'sh autogen.sh' to update the generated files."
    41     exit 1
    51     exit 1
    42   fi
    52   fi
    43   
    53   
    44 fi
    54 fi
    45 
    55 
       
    56 # Autoconf calls the configure script recursively sometimes. 
       
    57 # Don't start logging twice in that case
       
    58 if $TEST "x$conf_debug_configure" = xtrue; then
       
    59   conf_debug_configure=recursive
       
    60 fi
    46 ###
    61 ###
    47 ### Process command-line arguments
    62 ### Process command-line arguments
    48 ###
    63 ###
    49 conf_processed_arguments=
    64 conf_processed_arguments=
    50 conf_openjdk_target=
    65 conf_openjdk_target=
    60   --with-extra-cflags=*)
    75   --with-extra-cflags=*)
    61     conf_extra_cflags=`expr "X$conf_option" : '[^=]*=\(.*\)'`
    76     conf_extra_cflags=`expr "X$conf_option" : '[^=]*=\(.*\)'`
    62     continue ;;
    77     continue ;;
    63   --with-extra-cxxflags=*)
    78   --with-extra-cxxflags=*)
    64     conf_extra_cxxflags=`expr "X$conf_option" : '[^=]*=\(.*\)'`
    79     conf_extra_cxxflags=`expr "X$conf_option" : '[^=]*=\(.*\)'`
       
    80     continue ;;
       
    81   --debug-configure)
       
    82     if $TEST "x$conf_debug_configure" != xrecursive; then
       
    83       conf_debug_configure=true
       
    84       export conf_debug_configure
       
    85     fi
    65     continue ;;
    86     continue ;;
    66   *)
    87   *)
    67     conf_processed_arguments="$conf_processed_arguments $conf_option" ;;
    88     conf_processed_arguments="$conf_processed_arguments $conf_option" ;;
    68   esac
    89   esac
    69 
    90 
   102 conf_processed_arguments="--enable-option-checking=fatal $conf_processed_arguments"
   123 conf_processed_arguments="--enable-option-checking=fatal $conf_processed_arguments"
   103 
   124 
   104 ###
   125 ###
   105 ### Call the configure script
   126 ### Call the configure script
   106 ###
   127 ###
   107 if $TEST -e $conf_closed_script_dir/generated-configure.sh; then
   128 if $TEST -e $conf_custom_script_dir/generated-configure.sh; then
   108   # Closed source configure available; run that instead
   129   # Custom source configure available; run that instead
   109   . $conf_closed_script_dir/generated-configure.sh $conf_processed_arguments --with-extra-cflags="$conf_extra_cflags" --with-extra-cxxflags="$conf_extra_cxxflags"
   130   echo Running custom generated-configure.sh
       
   131   conf_script_to_run=$conf_custom_script_dir/generated-configure.sh
   110 else
   132 else
   111   . $conf_script_dir/generated-configure.sh $conf_processed_arguments --with-extra-cflags="$conf_extra_cflags" --with-extra-cxxflags="$conf_extra_cxxflags"
   133   echo Running generated-configure.sh
       
   134   conf_script_to_run=$conf_script_dir/generated-configure.sh
       
   135 fi  
       
   136 
       
   137 if $TEST "x$conf_debug_configure" != x; then
       
   138   # Turn on shell debug output if requested (initial or recursive)
       
   139   set -x
   112 fi
   140 fi
   113 
   141 
       
   142 if $TEST "x$conf_debug_configure" = xtrue; then
       
   143   # Turn on logging, but don't turn on twice when called recursive
       
   144   conf_debug_logfile=./debug-configure.log
       
   145   (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
       
   146 else
       
   147   . $conf_script_to_run $conf_processed_arguments --with-extra-cflags="$conf_extra_cflags" --with-extra-cxxflags="$conf_extra_cxxflags"
       
   148 fi
       
   149 
       
   150 conf_result_code=$?
   114 ###
   151 ###
   115 ### Post-processing
   152 ### Post-processing
   116 ###
   153 ###
   117 
   154 
   118 # Move the log file to the output root, if this was successfully created
   155 # Move the log file to the output root, if this was successfully created
   119 if $TEST -d "$OUTPUT_ROOT"; then
   156 if $TEST -d "$OUTPUT_ROOT"; then
   120   mv -f config.log "$OUTPUT_ROOT" 2> /dev/null
   157   mv -f config.log "$OUTPUT_ROOT" 2> /dev/null
   121 fi
   158 fi
       
   159 
       
   160 exit $conf_result_code