diff options
author | Daniel Elstner <danielk@openismus.com> | 2009-08-07 23:03:28 +0200 |
---|---|---|
committer | Daniel Elstner <danielk@openismus.com> | 2009-08-08 13:54:18 +0200 |
commit | 70ed1e7ff3a17168fc9a14ac140b158159f78b5b (patch) | |
tree | b340615f5fca48b9398b949a19dc8d32ca921e33 /util | |
parent | 6c4330af6e942be8a1a0ebc169f3dfd8f88d5cd3 (diff) | |
download | mm-common-70ed1e7ff3a17168fc9a14ac140b158159f78b5b.tar.gz |
Fix handling of mm-common-prepare --force
* util/mm-common-prepare.in: Simply check whether $forceflag is empty
instead of doing a string comparison and getting it wrong. Also, for
improved robustness, use a fixed list of files to install instead of
a wildcard pattern. Make the sed expression to extract the auxiliary
build directory skip over both spaces and tabs.
Diffstat (limited to 'util')
-rw-r--r-- | util/mm-common-prepare.in | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/util/mm-common-prepare.in b/util/mm-common-prepare.in index 4c33b70..460380a 100644 --- a/util/mm-common-prepare.in +++ b/util/mm-common-prepare.in @@ -24,13 +24,14 @@ pkgdatadir="${datadir}/@PACKAGE_TARNAME@" progname="${0##*/}" installcmd='ln -s' +instaction=symlinking forceflag= srcdir=. for arg do case $arg in - --help) + '-?'|--help) cat <<EOF Usage: $progname [OPTION]... [DIRECTORY] @@ -49,16 +50,18 @@ EOF ;; -c|--copy) installcmd=cp + instaction=copying ;; -f|--force) forceflag=' -f' ;; -cf|-fc) installcmd=cp + instaction=copying forceflag=' -f' ;; -*) - echo "$progname: unrecognized option '$arg'" >&2 + echo "$progname: error: unrecognized option '$arg'" >&2 exit 1 ;; ?*) @@ -67,22 +70,23 @@ EOF esac done -if test -f "$srcdir/configure.ac"; then :; else - echo "$progname: $srcdir/configure.ac not found" >&2 - exit 1 -fi +acfile=$srcdir/configure.ac -auxdir=`sed -n 's/^ *AC_CONFIG_AUX_DIR([[ ]*\([^]),$ ]*\).*/\1/p' "$srcdir/configure.ac"` -auxdir=$srcdir${auxdir:+"/$auxdir"} +test -f "$acfile" || { + echo "$progname: error: $acfile not found" >&2 + exit 1 +} +# The sed expression contains literal tab characters for portability +auxdir=`sed -n 's/^[ ]*AC_CONFIG_AUX_DIR([[ ]*\([^]),$ ]*\).*/\1/p' "$acfile"` +auxdir=$srcdir${auxdir:+/}$auxdir -echo "Build support directory: $auxdir" +echo "$progname: putting auxiliary files into $auxdir" -for file in "$pkgdatadir"/build/*.am +for file in compile-binding.am dist-changelog.am doc-reference.am generate-binding.am do - basename="${file##*/}" - if test " $forceflag" = ' -f' || test ! -f "$auxdir/$basename"; then - echo "$progname: Copying $basename to $auxdir" - $installcmd$forceflag "$file" "$auxdir/$basename" + if test -n "$forceflag" || test ! -f "$auxdir/$file"; then + echo "$progname: $instaction file $file" + $installcmd$forceflag "$pkgdatadir/build/$file" "$auxdir/$file" fi done |