From a51552b2644b9281b65e93c9ea3d80c4369cc682 Mon Sep 17 00:00:00 2001 From: "Gary V. Vaughan" Date: Thu, 7 Jul 2005 12:18:48 +0000 Subject: [PATCH] * bootstrap: Allow user overriding of gnulib-tool location, and correctly determine module source directories whether gnulib-tool is given as a relative or absolute path, or is found by searching PATH. Reported by Eric Blake --- ChangeLog | 8 ++++++ bootstrap | 87 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++------- 2 files changed, 86 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index f833d665..adfb3568 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2005-07-07 Gary V. Vaughan + + * bootstrap: Allow user overriding of gnulib-tool location, and + correctly determine module source directories whether gnulib-tool + is given as a relative or absolute path, or is found by searching + PATH. + Reported by Eric Blake + 2005-07-07 Ralf Wildenhues * ltdl/m4/debug.m4 (m4_CHECK_DEBUGGING): Make sure that both $rm diff --git a/bootstrap b/bootstrap index ae06b647..7ecf0b2d 100755 --- a/bootstrap +++ b/bootstrap @@ -1,17 +1,19 @@ #! /bin/sh # helps bootstrapping M4, when checked out from CVS -# requires GNU Autoconf, GNU Automake, GNU Gettext and GNU Libtool +# requires GNU Gettext and bleeding edge GNU Autoconf, Automake & Libtool +: ${AUTORECONF=autoreconf} : ${AWK=awk} -: ${SED=sed} -: ${RM=rm -f} : ${GNULIB_TOOL=gnulib-tool} -: ${AUTORECONF=autoreconf} +: ${LIBTOOLIZE=libtoolize} +: ${RM=rm -f} +: ${SED=sed} ltdldir=ltdl config_aux_dir=$ltdldir/config config_macro_dir=$ltdldir/m4 +bailout_cb=: # List dependencies here too; we don't extract them, otherwise dependent # modules could end up being imported to src/ *and* gnu/! @@ -37,6 +39,47 @@ func_echo () echo $progname: ${1+"$@"} } +# func_error arg... +# Echo program name prefixed message to standard error. +func_error () +{ + echo $progname: ${1+"$@"} >&2 +} + + +## ---------------------------- ## +## Find the gnulib module tree. ## +## ---------------------------- ## + +case $GNULIB_TOOL in + /* ) gnulibdir=$GNULIB_TOOL ;; # absolute + */* ) gnulibdir=`pwd`/$GNULIB_TOOL ;; # relative + * ) gnulibdir=`which "$GNULIB_TOOL"` ;; # PATH search +esac + +# Follow symlinks +while test -h "$gnulibdir"; do + + # Resolve symbolic link. + sedexpr1='s, -> ,#%%#,' + sedexpr2='s,^.*#%%#\(.*\)$,\1,p' + linkval=`LC_ALL=C ls -l "$gnulibdir" | $SED "$sedexpr1" | $SED -n "$sedexpr2"` + test -n "$linkval" || break + + case "$linkval" in + /* ) gnulibdir="$linkval" ;; + * ) gnulibdir=`echo "$gnulibdir" | sed -e 's,/[^/]*$,,'`/"$linkval" ;; + esac + +done + +gnulibdir=`echo "$gnulibdir" | $SED "$dirname"` + + +## ---------------------- ## +## Import Gnulib modules. ## +## ---------------------- ## + func_echo "running: ${GNULIB_TOOL} --import" ${GNULIB_TOOL} --import @@ -52,8 +95,12 @@ AC_DEFUN([gl_AC_HEADER_STDINT_H], [jm_AC_HEADER_STDINT_H]) AC_DEFUN([gl_AC_TYPE_UINTMAX_T], [jm_AC_TYPE_UINTMAX_T]) EOF + +## --------------------------------- ## +## Copy additional src only modules. ## +## --------------------------------- ## + func_echo "fetching modules for src directory" -gnulibdir=`which gnulib-tool | $SED "$dirname"` for file in `${GNULIB_TOOL} --extract-filelist $src_modules`; do @@ -66,16 +113,38 @@ for file in `${GNULIB_TOOL} --extract-filelist $src_modules`; do ;; esac - func_echo "copying file \`$dest'" - cp $gnulibdir/$file $dest + # Be sure to show all copying errors before bailing out + if test -f $gnulibdir/$file; then + func_echo "copying file \`$dest'" + cp $gnulibdir/$file $dest + else + func_error "$gnulibdir/$file does not exist" + bailout_cb="exit 1" + fi done +$bailout_cb -func_echo "running: libtoolize --ltdl=\"$ltdldir\" --force --copy" -libtoolize --ltdl="$ltdldir" --force --copy + +## ----------- ## +## Libtoolize. ## +## ----------- ## + +func_echo "running: $LIBTOOLIZE --ltdl=\"$ltdldir\" --force --copy" +$LIBTOOLIZE --ltdl="$ltdldir" --force --copy + + +## ----------- ## +## Autoreconf. ## +## ----------- ## func_echo "running: $AUTORECONF --force --verbose --install" $AUTORECONF --force --verbose --install + +## ---------- ## +## testsuite. ## +## ---------- ## + ( func_echo "generating testsuite" cd tests -- 2.11.4.GIT