common/autoconf/autogen.sh

changeset 2212
dd97daafa80b
parent 839
174a54ce39c4
child 2316
64a3eeabf6e5
     1.1 --- a/common/autoconf/autogen.sh	Tue Apr 10 07:46:25 2018 -0700
     1.2 +++ b/common/autoconf/autogen.sh	Wed Apr 11 04:42:33 2018 -0700
     1.3 @@ -22,6 +22,23 @@
     1.4  # questions.
     1.5  #
     1.6  
     1.7 +generate_configure_script() {
     1.8 +  # First create a header
     1.9 +  cat > $1 << EOT
    1.10 +#!/bin/bash
    1.11 +#
    1.12 +# ##########################################################
    1.13 +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ###
    1.14 +# ##########################################################
    1.15 +#
    1.16 +EOT
    1.17 +  # Then replace "magic" variables in configure.ac and append the output
    1.18 +  # from autoconf. $2 is either cat (just a no-op) or a filter.
    1.19 +  cat $script_dir/configure.ac | sed -e "s|@DATE_WHEN_GENERATED@|$TIMESTAMP|" | \
    1.20 +      eval $2 | ${AUTOCONF} -W all -I$script_dir - >> $1
    1.21 +  rm -rf autom4te.cache
    1.22 +}
    1.23 +
    1.24  script_dir=`dirname $0`
    1.25  
    1.26  # Create a timestamp as seconds since epoch
    1.27 @@ -36,7 +53,8 @@
    1.28  fi
    1.29  
    1.30  if test "x$CUSTOM_CONFIG_DIR" = "x"; then
    1.31 -  custom_script_dir="$script_dir/../../jdk/make/closed/autoconf"
    1.32 +  topdir=`cd $script_dir/../..  >/dev/null && pwd`
    1.33 +  custom_script_dir="$topdir/jdk/make/closed/autoconf"
    1.34  else
    1.35    custom_script_dir=$CUSTOM_CONFIG_DIR
    1.36  fi
    1.37 @@ -45,25 +63,23 @@
    1.38  
    1.39  AUTOCONF="`which autoconf 2> /dev/null | grep -v '^no autoconf in'`"
    1.40  
    1.41 -echo "Autoconf found: ${AUTOCONF}"
    1.42 -
    1.43  if test "x${AUTOCONF}" = x; then
    1.44 -  echo You need autoconf installed to be able to regenerate the configure script
    1.45 -  echo Error: Cannot find autoconf 1>&2
    1.46 +  echo "You need autoconf installed to be able to regenerate the configure script"
    1.47 +  echo "Error: Cannot find autoconf" 1>&2
    1.48    exit 1
    1.49  fi
    1.50  
    1.51 -echo Generating generated-configure.sh with ${AUTOCONF}
    1.52 -cat $script_dir/configure.ac  | sed -e "s|@DATE_WHEN_GENERATED@|$TIMESTAMP|" | ${AUTOCONF} -W all -I$script_dir - > $script_dir/generated-configure.sh
    1.53 -rm -rf autom4te.cache
    1.54 +autoconf_version=`$AUTOCONF --version | head -1`
    1.55 +echo "Using autoconf at ${AUTOCONF} [$autoconf_version]"
    1.56 +
    1.57 +echo "Generating generated-configure.sh"
    1.58 +generate_configure_script "$script_dir/generated-configure.sh" 'cat'
    1.59  
    1.60  if test -e $custom_hook; then
    1.61 -  echo Generating custom generated-configure.sh
    1.62    # We have custom sources available; also generate configure script
    1.63    # with custom hooks compiled in.
    1.64 -  cat $script_dir/configure.ac | sed -e "s|@DATE_WHEN_GENERATED@|$TIMESTAMP|" | \
    1.65 -      sed -e "s|#CUSTOM_AUTOCONF_INCLUDE|m4_include([$custom_hook])|" | ${AUTOCONF} -W all -I$script_dir - > $custom_script_dir/generated-configure.sh
    1.66 -  rm -rf autom4te.cache
    1.67 +  echo "Generating custom generated-configure.sh"
    1.68 +  generate_configure_script "$custom_script_dir/generated-configure.sh" 'sed -e "s|#CUSTOM_AUTOCONF_INCLUDE|m4_include([$custom_hook])|"'
    1.69  else
    1.70 -  echo No custom hook found:  $custom_hook
    1.71 +  echo "(No custom hook found at $custom_hook)"
    1.72  fi

mercurial