make/autoconf/configure
changeset 47313 eb28be8f935d
parent 47217 72e3ae9a25eb
child 47346 ea082b202a23
equal deleted inserted replaced
47312:d4f959806fe9 47313:eb28be8f935d
     1 #!/bin/bash
     1 #!/bin/bash
     2 #
     2 #
     3 # Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
     3 # Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
     4 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     5 #
     5 #
     6 # This code is free software; you can redistribute it and/or modify it
     6 # This code is free software; you can redistribute it and/or modify it
     7 # under the terms of the GNU General Public License version 2 only, as
     7 # under the terms of the GNU General Public License version 2 only, as
     8 # published by the Free Software Foundation.
     8 # published by the Free Software Foundation.
    44 export CONFIG_SHELL=$BASH
    44 export CONFIG_SHELL=$BASH
    45 export _as_can_reexec=no
    45 export _as_can_reexec=no
    46 
    46 
    47 conf_script_dir="$TOPDIR/make/autoconf"
    47 conf_script_dir="$TOPDIR/make/autoconf"
    48 
    48 
    49 if [ "$CUSTOM_CONFIG_DIR" = "" ]; then
    49 if test "x$CUSTOM_CONFIG_DIR" != x; then
    50   conf_custom_script_dir="$TOPDIR/closed/autoconf"
    50   if test ! -e $CUSTOM_CONFIG_DIR/generated-configure.sh; then
    51 else
    51     echo "CUSTOM_CONFIG_DIR not pointing to a proper custom config dir."
    52   conf_custom_script_dir="$CUSTOM_CONFIG_DIR"
    52     echo "Error: Cannot continue" 1>&2
       
    53     exit 1
       
    54   fi
    53 fi
    55 fi
    54 
    56 
    55 ###
    57 ###
    56 ### Test that the generated configure is up-to-date
    58 ### Test that the generated configure is up-to-date
    57 ###
    59 ###
    74       echo "Warning: The configure source files is newer than the generated files."
    76       echo "Warning: The configure source files is newer than the generated files."
    75       run_autogen_or_fail
    77       run_autogen_or_fail
    76     fi
    78     fi
    77   done
    79   done
    78 
    80 
    79   if test -e $conf_custom_script_dir/generated-configure.sh; then
    81   if test "x$CUSTOM_CONFIG_DIR" != x; then
    80     # If custom source configure is available, make sure it is up-to-date as well.
    82     # If custom source configure is available, make sure it is up-to-date as well.
    81     for file in $conf_script_dir/configure.ac $conf_script_dir/*.m4 $conf_custom_script_dir/*.m4; do
    83     for file in $conf_script_dir/configure.ac $conf_script_dir/*.m4 $CUSTOM_CONFIG_DIR/*.m4; do
    82       if test $file -nt $conf_custom_script_dir/generated-configure.sh; then
    84       if test $file -nt $CUSTOM_CONFIG_DIR/generated-configure.sh; then
    83         echo "Warning: The configure source files is newer than the custom generated files."
    85         echo "Warning: The configure source files is newer than the custom generated files."
    84         run_autogen_or_fail
    86         run_autogen_or_fail
    85       fi
    87       fi
    86     done
    88     done
    87   fi
    89   fi
    91   if test "x`which hg 2> /dev/null | grep -v '^no hg in'`" != x; then
    93   if test "x`which hg 2> /dev/null | grep -v '^no hg in'`" != x; then
    92     conf_updated_autoconf_files=`cd $conf_script_dir && hg status -mard 2> /dev/null | grep autoconf`
    94     conf_updated_autoconf_files=`cd $conf_script_dir && hg status -mard 2> /dev/null | grep autoconf`
    93     if test "x$conf_updated_autoconf_files" != x; then
    95     if test "x$conf_updated_autoconf_files" != x; then
    94       echo "Configure source code has been updated, checking time stamps"
    96       echo "Configure source code has been updated, checking time stamps"
    95       check_autoconf_timestamps
    97       check_autoconf_timestamps
    96     fi
    98     elif test "x$CUSTOM_CONFIG_DIR" != x; then
    97 
       
    98     if test -e $conf_custom_script_dir; then
       
    99       # If custom source configure is available, make sure it is up-to-date as well.
    99       # If custom source configure is available, make sure it is up-to-date as well.
   100       conf_custom_updated_autoconf_files=`cd $conf_custom_script_dir && hg status -mard 2> /dev/null | grep autoconf`
   100       conf_custom_updated_autoconf_files=`cd $CUSTOM_CONFIG_DIR && hg status -mard 2> /dev/null | grep autoconf`
   101       if test "x$conf_custom_updated_autoconf_files" != x; then
   101       if test "x$conf_custom_updated_autoconf_files" != x; then
   102         echo "Configure custom source code has been updated, checking time stamps"
   102         echo "Configure custom source code has been updated, checking time stamps"
   103         check_autoconf_timestamps
   103         check_autoconf_timestamps
   104       fi
   104       fi
   105     fi
   105     fi
   107 }
   107 }
   108 
   108 
   109 # Check for local changes
   109 # Check for local changes
   110 check_hg_updates
   110 check_hg_updates
   111 
   111 
   112 if test -e $conf_custom_script_dir/generated-configure.sh; then
   112 if test "x$CUSTOM_CONFIG_DIR" != x; then
   113   # Test if open configure is newer than custom configure, if so, custom needs to
   113   # Test if open configure is newer than custom configure, if so, custom needs to
   114   # be regenerated. This test is required to ensure consistency with custom source.
   114   # be regenerated. This test is required to ensure consistency with custom source.
   115   conf_open_configure_timestamp=`grep DATE_WHEN_GENERATED= $conf_script_dir/generated-configure.sh  | cut -d"=" -f 2`
   115   conf_open_configure_timestamp=`grep DATE_WHEN_GENERATED= $conf_script_dir/generated-configure.sh  | cut -d"=" -f 2`
   116   conf_custom_configure_timestamp=`grep DATE_WHEN_GENERATED= $conf_custom_script_dir/generated-configure.sh  | cut -d"=" -f 2`
   116   conf_custom_configure_timestamp=`grep DATE_WHEN_GENERATED= $CUSTOM_CONFIG_DIR/generated-configure.sh  | cut -d"=" -f 2`
   117   if test $conf_open_configure_timestamp -gt $conf_custom_configure_timestamp; then
   117   if test $conf_open_configure_timestamp -gt $conf_custom_configure_timestamp; then
   118     echo "Warning: The generated configure file contains changes not present in the custom generated file."
   118     echo "Warning: The generated configure file contains changes not present in the custom generated file."
   119     run_autogen_or_fail
   119     run_autogen_or_fail
   120   fi
   120   fi
   121 fi
   121 fi
   239 conf_processed_arguments=("--enable-option-checking=fatal" "${conf_processed_arguments[@]}")
   239 conf_processed_arguments=("--enable-option-checking=fatal" "${conf_processed_arguments[@]}")
   240 
   240 
   241 ###
   241 ###
   242 ### Call the configure script
   242 ### Call the configure script
   243 ###
   243 ###
   244 if test -e $conf_custom_script_dir/generated-configure.sh; then
   244 if test "x$CUSTOM_CONFIG_DIR" != x; then
   245   # Custom source configure available; run that instead
   245   # Custom source configure available; run that instead
   246   echo "Running custom generated-configure.sh"
   246   echo "Running custom generated-configure.sh"
   247   conf_script_to_run=$conf_custom_script_dir/generated-configure.sh
   247   conf_script_to_run=$CUSTOM_CONFIG_DIR/generated-configure.sh
   248 else
   248 else
   249   echo "Running generated-configure.sh"
   249   echo "Running generated-configure.sh"
   250   conf_script_to_run=$conf_script_dir/generated-configure.sh
   250   conf_script_to_run=$conf_script_dir/generated-configure.sh
   251 fi
   251 fi
   252 
   252