From 551bed87fabb20dab9164a529aeca7d9665c25ff Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Thu, 8 Mar 2007 00:23:00 +0100 Subject: [PATCH] Make bootstrap a little more general. * bootstrap (build_aux): Factor out/use this definition. Formally require a "AC_CONFIG_AUX_DIR($build_aux)" line in configure.ac. (insert_sorted_if_absent): Move function definition "up", to precede new first use. If $build_aux/ doesn't exist initially, create it, and mark it as ignored. --- ChangeLog | 10 ++++++++++ bootstrap | 57 +++++++++++++++++++++++++++++++++++++-------------------- 2 files changed, 47 insertions(+), 20 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9bec73d..73e03d0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2007-03-08 Jim Meyering + + Make bootstrap a little more general. + * bootstrap (build_aux): Factor out/use this definition. + Formally require a "AC_CONFIG_AUX_DIR($build_aux)" line in configure.ac. + (insert_sorted_if_absent): Move function definition "up", to + precede new first use. + If $build_aux/ doesn't exist initially, create it, and + mark it as ignored. + 2007-03-03 Andrew Church (tiny change) Paul Eggert diff --git a/bootstrap b/bootstrap index bf94f9b..887ec53 100755 --- a/bootstrap +++ b/bootstrap @@ -90,17 +90,18 @@ extract_package_name=' ' package=`sed -n "$extract_package_name" configure.ac` || exit +build_aux=build-aux # Extra files from gnulib, which override files from other sources. -gnulib_extra_files=' - build-aux/install-sh - build-aux/missing - build-aux/mdate-sh - build-aux/texinfo.tex - build-aux/depcomp - build-aux/config.guess - build-aux/config.sub +gnulib_extra_files=" + $build_aux/install-sh + $build_aux/missing + $build_aux/mdate-sh + $build_aux/texinfo.tex + $build_aux/depcomp + $build_aux/config.guess + $build_aux/config.sub doc/INSTALL -' +" # Other locale categories that need message catalogs. EXTRA_LOCALE_CATEGORIES= @@ -156,6 +157,32 @@ if test -n "$CVS_only_file" && test ! -r "$CVS_only_file"; then exit 1 fi +# If $STR is not already on a line by itself in $FILE, insert it, +# sorting the new contents of the file and replacing $FILE with the result. +insert_sorted_if_absent() { + file=$1 + str=$2 + echo "$str" | sort -u - $file | cmp -s - $file \ + || echo "$str" | sort -u - $file -o $file \ + || exit 1 +} + +# Die if there is no AC_CONFIG_AUX_DIR($build_aux) line in configure.ac. +grep '^[ ]*AC_CONFIG_AUX_DIR('$build_aux')' configure.ac >/dev/null || + { + echo "$0: expected line not found in configure.ac. Add the following:" >&2 + echo " AC_CONFIG_AUX_DIR($build_aux)" >&2. + } + +# If $build_aux doesn't exist, create it now, otherwise some bits +# below will malfunction. If creating it, also mark it as ignored. +if test ! -d $build_aux; then + mkdir $build_aux + for ig in .cvsignore .gitignore; do + test -f $ig && insert_sorted_if_absent $ig $build_aux + done +fi + echo "$0: Bootstrapping CVS $package..." cleanup_gnulib() { @@ -358,16 +385,6 @@ version_controlled_file() { test $found = yes } -# If $STR is not already on a line by itself in $FILE, insert it, -# sorting the new contents of the file and replacing $FILE with the result. -insert_sorted_if_absent() { - file=$1 - str=$2 - echo "$str" | sort -u - $file | cmp -s - $file \ - || echo "$str" | sort -u - $file -o $file \ - || exit -} - slurp() { for dir in . `(cd $1 && find * -type d -print)`; do copied= @@ -431,7 +448,7 @@ mkdir $bt $bt2 || exit gnulib_tool_options="\ --import\ --no-changelog\ - --aux-dir $bt/build-aux\ + --aux-dir $bt/$build_aux\ --doc-base $bt/doc\ --lib lib$package\ --m4-base $bt/m4/\ -- 2.7.4