bootstrap: accommodate older libtool
[gnulib.git] / build-aux / bootstrap
index 13ec5ae..5aa73cc 100755 (executable)
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Print a version string.
-scriptversion=2012-01-16.20; # UTC
+scriptversion=2012-04-19.22; # UTC
 
 # Bootstrap this package from checked-out sources.
 
@@ -36,6 +36,10 @@ nl='
 LC_ALL=C
 export LC_ALL
 
+# Ensure that CDPATH is not set.  Otherwise, the output from cd
+# would cause trouble in at least one use below.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
 local_gl_dir=gl
 
 me=$0
@@ -87,9 +91,9 @@ gnulib_files=
 : ${AUTOPOINT=autopoint}
 : ${AUTORECONF=autoreconf}
 
-# A function to be called to edit gnulib.mk right after it's created.
+# A function to be called right after gnulib-tool is run.
 # Override it via your own definition in bootstrap.conf.
-gnulib_mk_hook() { :; }
+bootstrap_post_import_hook() { :; }
 
 # A function to be called after everything else in this script.
 # Override it via your own definition in bootstrap.conf.
@@ -423,7 +427,7 @@ check_versions() {
       $use_git || continue
     fi
     # Honor $APP variables ($TAR, $AUTOCONF, etc.)
-    appvar=`echo $app | tr '[a-z]-' '[A-Z]_'`
+    appvar=`echo $app | LC_ALL=C tr '[a-z]-' '[A-Z]_'`
     test "$appvar" = TAR && appvar=AMTAR
     case $appvar in
         GZIP) ;; # Do not use $GZIP:  it contains gzip options.
@@ -604,7 +608,7 @@ if $bootstrap_sync; then
 fi
 
 gnulib_tool=$GNULIB_SRCDIR/gnulib-tool
-<$gnulib_tool || exit
+<$gnulib_tool || exit $?
 
 # Get translations.
 
@@ -758,9 +762,15 @@ fi
 # Autoreconf runs aclocal before libtoolize, which causes spurious
 # warnings if the initial aclocal is confused by the libtoolized
 # (or worse out-of-date) macro directory.
+# libtoolize 1.9b added the --install option; but we support back
+# to libtoolize 1.5.22, where the install action was default.
 if test $use_libtool = 1; then
-  echo "running: $LIBTOOLIZE --copy --install"
-  $LIBTOOLIZE --copy --install
+  install=
+  case $($LIBTOOLIZE --help) in
+    *--install*) install=--install ;;
+  esac
+  echo "running: $LIBTOOLIZE $install --copy"
+  $LIBTOOLIZE $install --copy
 fi
 
 version_controlled_file() {
@@ -807,6 +817,9 @@ for file in $gnulib_files; do
   symlink_to_dir "$GNULIB_SRCDIR" $file || exit
 done
 
+bootstrap_post_import_hook \
+  || { echo >&2 "$me: bootstrap_post_import_hook failed"; exit 1; }
+
 # Remove any dangling symlink matching "*.m4" or "*.[ch]" in some
 # gnulib-populated directories.  Such .m4 files would cause aclocal to fail.
 # The following requires GNU find 4.2.3 or newer.  Considering the usual
@@ -860,6 +873,8 @@ if test $with_gettext = yes; then
     }
   ' po/Makevars.template >po/Makevars || exit 1
 
+  cat $GNULIB_SRCDIR/build-aux/po/Makefile.in.in > po/Makefile.in.in || exit 1
+
   if test -d runtime-po; then
     # Similarly for runtime-po/Makevars, but not quite the same.
     rm -f runtime-po/Makevars