bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bootstrap: making it slightly more general


From: Jim Meyering
Subject: bootstrap: making it slightly more general
Date: Thu, 08 Mar 2007 00:26:12 +0100

FYI,
This change is useful in a project that does not have a need for its
own build-aux directory.  I.e., it uses it build-aux/, yet maintains
nothing version-controlled therein.  So it needn't exist initially
and ./bootstrap creates it if needed.

diff --git a/ChangeLog b/ChangeLog
index 9bec73d..73e03d0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2007-03-08  Jim Meyering  <address@hidden>
+
+       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  <address@hidden>  (tiny change)
            Paul Eggert  <address@hidden>
 
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/\
-- 
1.5.0.2.279.g4808




reply via email to

[Prev in Thread] Current Thread [Next in Thread]