X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=gnulib-tool;h=f6c4a1716391ea381af4dadba7bd92fe36d3885d;hb=cbbc0892dc8607978ec55acdd8ef3a124df1ca1f;hp=0810a5953c2654bff47a61e0a18086f0369c57b5;hpb=958d26264a28932d9d094b1c0596bdd7cbcf2336;p=gnulib.git diff --git a/gnulib-tool b/gnulib-tool index 0810a5953..f6c4a1716 100755 --- a/gnulib-tool +++ b/gnulib-tool @@ -22,9 +22,11 @@ progname=$0 package=gnulib -cvsdatestamp='$Date: 2007-09-09 12:17:36 $' +cvsdatestamp='$Date: 2007-09-17 10:26:33 $' last_checkin_date=`echo "$cvsdatestamp" | sed -e 's,^\$[D]ate: ,,'` +# Sometimes last_checkin_date is "YYYY/MM/DD ...", sometimes "YYYY-MM-DD ...". version=`echo "$last_checkin_date" | sed -e 's/ .*$//' -e 's,/,-,g'` +# version is in YYYY-MM-DD format. nl=' ' IFS=" "" $nl" @@ -73,6 +75,17 @@ fi # gnulib-tool generates, since we don't want "sed --posix" to leak # into makefiles. if (alias) > /dev/null 2>&1 && echo | sed --posix -e d >/dev/null 2>&1; then + # Define sed as an alias. + # It is not always possible to use aliases. Aliases are guaranteed to work + # if the executing shell is bash and either it is invoked as /bin/sh or + # is a version >= 2.0, supporting shopt. This is the common case. + # Two other approaches (use of a variable $sed or of a function func_sed + # instead of an alias) require massive, fragile code changes. + # An other approach (use of function sed) requires `which sed` - but 'which' + # is hard to emulate, due to missing "test -x" on some platforms. + if test -n "$BASH_VERSION"; then + shopt -s expand_aliases >/dev/null 2>&1 + fi alias sed='sed --posix' fi @@ -185,7 +198,7 @@ Report bugs to ." # outputs to stdout the --version message. func_version () { - year=`echo "$last_checkin_date" | sed -e 's,/.*$,,'` + year=`echo "$version" | sed -e 's,-.*$,,'` echo "\ $progname (GNU $package) $version Copyright (C) $year Free Software Foundation, Inc.