common/autoconf/configure

Print this page
rev 1062 : 8044733: common/autoconf/configure script doesn't properly detect missing tools
Reviewed-by: duke


  32   # The TOPDIR variable is passed on to configure.ac.
  33   TOPDIR="$2"
  34   # Remove these two arguments to get to the user supplied arguments
  35   shift
  36   shift
  37 fi
  38 
  39 conf_script_dir="$TOPDIR/common/autoconf"
  40 
  41 if [ "$CUSTOM_CONFIG_DIR" = "" ]; then
  42   conf_custom_script_dir="$TOPDIR/closed/autoconf"
  43 else
  44   conf_custom_script_dir="$CUSTOM_CONFIG_DIR"
  45 fi
  46 
  47 ###
  48 ### Test that the generated configure is up-to-date
  49 ###
  50 
  51 run_autogen_or_fail() {
  52   if test "x`which autoconf 2> /dev/null`" = x; then
  53     echo "Cannot locate autoconf, unable to correct situation."
  54     echo "Please install autoconf and run 'bash autogen.sh' to update the generated files."
  55     echo "Error: Cannot continue" 1>&2
  56     exit 1
  57   else
  58     echo "Running autogen.sh to correct the situation"
  59     bash $conf_script_dir/autogen.sh
  60   fi
  61 }
  62 
  63 check_autoconf_timestamps() {
  64   for file in $conf_script_dir/configure.ac $conf_script_dir/*.m4 ; do
  65     if test $file -nt $conf_script_dir/generated-configure.sh; then
  66       echo "Warning: The configure source files is newer than the generated files."
  67       run_autogen_or_fail
  68     fi
  69   done
  70 
  71   if test -e $conf_custom_script_dir/generated-configure.sh; then
  72     # If custom source configure is available, make sure it is up-to-date as well.
  73     for file in $conf_script_dir/configure.ac $conf_script_dir/*.m4 $conf_custom_script_dir/*.m4; do
  74       if test $file -nt $conf_custom_script_dir/generated-configure.sh; then
  75         echo "Warning: The configure source files is newer than the custom generated files."
  76         run_autogen_or_fail
  77       fi
  78     done
  79   fi
  80 }
  81 
  82 check_hg_updates() {
  83   if test "x`which hg 2> /dev/null`" != x; then
  84     conf_updated_autoconf_files=`cd $conf_script_dir && hg status -mard 2> /dev/null | grep autoconf`
  85     if test "x$conf_updated_autoconf_files" != x; then
  86       echo "Configure source code has been updated, checking time stamps"
  87       check_autoconf_timestamps
  88     fi
  89 
  90     if test -e $conf_custom_script_dir; then
  91       # If custom source configure is available, make sure it is up-to-date as well.
  92       conf_custom_updated_autoconf_files=`cd $conf_custom_script_dir && hg status -mard 2> /dev/null | grep autoconf`
  93       if test "x$conf_custom_updated_autoconf_files" != x; then
  94         echo "Configure custom source code has been updated, checking time stamps"
  95         check_autoconf_timestamps
  96       fi
  97     fi
  98   fi
  99 }
 100 
 101 # Check for local changes
 102 check_hg_updates
 103 




  32   # The TOPDIR variable is passed on to configure.ac.
  33   TOPDIR="$2"
  34   # Remove these two arguments to get to the user supplied arguments
  35   shift
  36   shift
  37 fi
  38 
  39 conf_script_dir="$TOPDIR/common/autoconf"
  40 
  41 if [ "$CUSTOM_CONFIG_DIR" = "" ]; then
  42   conf_custom_script_dir="$TOPDIR/closed/autoconf"
  43 else
  44   conf_custom_script_dir="$CUSTOM_CONFIG_DIR"
  45 fi
  46 
  47 ###
  48 ### Test that the generated configure is up-to-date
  49 ###
  50 
  51 run_autogen_or_fail() {
  52   if test "x`which autoconf 2> /dev/null | grep -v '^no autoconf in'`" = x; then
  53     echo "Cannot locate autoconf, unable to correct situation."
  54     echo "Please install autoconf and run 'bash autogen.sh' to update the generated files."
  55     echo "Error: Cannot continue" 1>&2
  56     exit 1
  57   else
  58     echo "Running autogen.sh to correct the situation"
  59     bash $conf_script_dir/autogen.sh
  60   fi
  61 }
  62 
  63 check_autoconf_timestamps() {
  64   for file in $conf_script_dir/configure.ac $conf_script_dir/*.m4 ; do
  65     if test $file -nt $conf_script_dir/generated-configure.sh; then
  66       echo "Warning: The configure source files is newer than the generated files."
  67       run_autogen_or_fail
  68     fi
  69   done
  70 
  71   if test -e $conf_custom_script_dir/generated-configure.sh; then
  72     # If custom source configure is available, make sure it is up-to-date as well.
  73     for file in $conf_script_dir/configure.ac $conf_script_dir/*.m4 $conf_custom_script_dir/*.m4; do
  74       if test $file -nt $conf_custom_script_dir/generated-configure.sh; then
  75         echo "Warning: The configure source files is newer than the custom generated files."
  76         run_autogen_or_fail
  77       fi
  78     done
  79   fi
  80 }
  81 
  82 check_hg_updates() {
  83   if test "x`which hg 2> /dev/null | grep -v '^no hg in'`" != x; then
  84     conf_updated_autoconf_files=`cd $conf_script_dir && hg status -mard 2> /dev/null | grep autoconf`
  85     if test "x$conf_updated_autoconf_files" != x; then
  86       echo "Configure source code has been updated, checking time stamps"
  87       check_autoconf_timestamps
  88     fi
  89 
  90     if test -e $conf_custom_script_dir; then
  91       # If custom source configure is available, make sure it is up-to-date as well.
  92       conf_custom_updated_autoconf_files=`cd $conf_custom_script_dir && hg status -mard 2> /dev/null | grep autoconf`
  93       if test "x$conf_custom_updated_autoconf_files" != x; then
  94         echo "Configure custom source code has been updated, checking time stamps"
  95         check_autoconf_timestamps
  96       fi
  97     fi
  98   fi
  99 }
 100 
 101 # Check for local changes
 102 check_hg_updates
 103