X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=gnulib-tool;h=d47bb8123d60a07ab4a967d3ecb7116936791320;hb=45a1421304b3f60b91e2ab5fc191573f9d090a40;hp=a870a0067806d76f2970f03fcc553e50822dd870;hpb=6c6a6e00e0ff48216395f8525800c571d6a785b9;p=gnulib.git diff --git a/gnulib-tool b/gnulib-tool index a870a0067..d47bb8123 100755 --- a/gnulib-tool +++ b/gnulib-tool @@ -63,28 +63,32 @@ if test -z "${AUTOPOINT}" || test -n "${GETTEXTPATH}"; then AUTOPOINT="${GETTEXTPATH}autopoint" fi -# Disabled because "sed --posix" is buggy in GNU sed 4.1.5, see +# When using GNU sed, turn off as many GNU extensions as possible, +# to minimize the risk of accidentally using non-portable features. +# However, do this only for gnulib-tool itself, not for the code that +# gnulib-tool generates, since we don't want "sed --posix" to leak +# into makefiles. And do it only for sed versions 4.2 or newer, +# because "sed --posix" is buggy in GNU sed 4.1.5, see # . -if false; then - # When using GNU sed, turn off as many GNU extensions as possible, - # to minimize the risk of accidentally using non-portable features. - # However, do this only for gnulib-tool itself, not for the code that - # 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' +if (alias) > /dev/null 2>&1 \ + && echo | sed --posix -e d >/dev/null 2>&1 \ + && case `sed --version | sed -e 's/^[^0-9]*//' -e 1q` in \ + [1-3]* | 4.[01]*) false;; \ + *) true;; \ + esac \ + ; 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 # sed_noop is a sed expression that does nothing. @@ -1928,6 +1932,7 @@ func_emit_lib_Makefile_am () if test -z "$makefile_name"; then echo echo "AM_CPPFLAGS =" + echo "AM_CFLAGS =" fi echo if LC_ALL=C grep "^[a-zA-Z0-9_]*_${perhapsLT}LIBRARIES *+\{0,1\}= *$libname\\.$libext\$" allsnippets.tmp > /dev/null; then @@ -3571,7 +3576,7 @@ s,//*$,/,' echo "Updating $destdir/$dir$ignore (backup in $destdir/$dir${ignore}~)" mv -f "$destdir/$dir$ignore" "$destdir/$dir$ignore"~ { sed -e 's,/,\\/,g' -e 's,^,/^,' -e 's,$,\$/d,' < "$tmp"/ignore-removed - if test -n "$anchor"; then sed -e 's,/,\\/,g' -e "s,^,/^${doubly_escaped_anchor}," -e 's,$,\$/d,' < "$tmp"/ignore-removed; fi + if test -n "$anchor"; then sed -e 's,/,\\/,g' -e "s,^,/^${doubly_escaped_anchor}," -e 's,$,$/d,' < "$tmp"/ignore-removed; fi } > "$tmp"/sed-ignore-removed { cat "$destdir/$dir$ignore"~ sed -e "s|^|$anchor|" < "$tmp"/ignore-added