I just committed this:

Index: ChangeLog
from  Akim Demaille  <[EMAIL PROTECTED]>

        * autoupdate.sh (sed): Look for GNU sed.
        (usage): Ask for GNU sed.

Index: autoupdate.sh
===================================================================
RCS file: /cvs/autoconf/autoupdate.sh,v
retrieving revision 1.28
diff -u -r1.28 autoupdate.sh
--- autoupdate.sh 2000/07/19 10:15:10 1.28
+++ autoupdate.sh 2000/09/12 10:49:40
@@ -1,6 +1,6 @@
 #! @SHELL@
 # autoupdate - modernize an Autoconf file.
-# Copyright (C) 1994, 99, 2000 Free Software Foundation, Inc.
+# Copyright (C) 1994, 1999, 2000 Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@
 # Originally written by David MacKenzie <[EMAIL PROTECTED]>.
 # This file is documented at its bottom.
 
-me=`echo "$0" | sed -e 's,.*/,,'`
+me=`echo "$0" | sed 's,.*/,,'`
 
 usage="\
 Usage: $0 [OPTION] ...  [TEMPLATE-FILE...]
@@ -39,6 +39,10 @@
   -A, --autoconf-dir=ACDIR  Autoconf's macro files location (rarely needed)
   -l, --localdir=DIR        location of \`aclocal.m4' and \`acconfig.h'
 
+Environment variables:
+  M4    GNU M4 is required.
+  SED   GNU sed is required.
+
 Report bugs to <[EMAIL PROTECTED]>."
 
 version="\
@@ -67,23 +71,30 @@
 if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi
 if test "${LC_CTYPE+set}"    = set; then LC_CTYPE=C;    export LC_CTYPE;    fi
 
-# Find GNU m4.
+# Find GNU M4.
 # Handle the case that m4 has moved since we were configured.
 # It may have been found originally in a build directory.
 : ${M4=@M4@}
-case "$M4" in
-/*) test -f "$M4" || M4=m4 ;;
+case $M4 in
+  /*) test -f "$M4" || M4=m4 ;;
 esac
 # Some non-GNU m4's don't reject the --help option, so give them /dev/null.
 case `$M4 --help < /dev/null 2>&1` in
-*reload-state*);;
-*) echo Autoconf requires GNU m4 1.4 or later >&2; exit 1 ;;
+  *reload-state*);;
+  *) echo Autoconf requires GNU m4 1.4 or later >&2; exit 1 ;;
 esac
 
+# Find GNU Sed.
+# If we don't have GNU Sed, exit 77 so that the test suite just skip
+# this test.
+sed=${SED-sed}
+$sed --version >/dev/null 2>&1 ||
+  { echo autoupdate requires GNU sed >&2; exit 77; }
+
 # Variables.
 : ${autoconf_dir=${AC_MACRODIR=@datadir@}}
 : ${SIMPLE_BACKUP_SUFFIX='~'}
-dir=`echo "$0" | sed -e 's/[^/]*$//'`
+dir=`echo "$0" | sed 's/[^/]*$//'`
 # We test "$dir/autoconf" in case we are in the build tree, in which case
 # the names are not transformed yet.
 for autoconf in "$AUTOCONF" \
@@ -113,7 +124,7 @@
        shift;;
 
     --localdir=* | --l*=* )
-       localdir=`echo "$1" | sed -e 's/^[^=]*=//'`
+       localdir=`echo "$1" | sed 's/^[^=]*=//'`
        shift ;;
     --localdir | --l* | -l )
        test $# = 1 && eval "$exit_missing_arg"
@@ -208,20 +219,20 @@
 done
 
 # m4.m4 -- enable the m4 builtins.
-sed -e 's/^.*$/_au_define([&], _au_defn([_au_&]))/' $tmp/m4.txt >$tmp/m4.m4
+$sed 's/^.*$/_au_define([&], _au_defn([_au_&]))/' $tmp/m4.txt >$tmp/m4.m4
 
 # unm4.m4 -- disable the m4 builtins.
-sed -e 's/^.*$/_au_undefine([&])/' $tmp/m4.txt >$tmp/unm4.m4
+$sed 's/^.*$/_au_undefine([&])/' $tmp/m4.txt >$tmp/unm4.m4
 
 # savem4.m4 -- save the m4 builtins.
-sed -e 's/^.*$/define([_au_&], defn([&]))/' $tmp/m4.txt >$tmp/m4save.m4
+$sed 's/^.*$/define([_au_&], defn([&]))/' $tmp/m4.txt >$tmp/m4save.m4
 
 # au.txt -- list of all the AU macros.
 $autoconf --trace AU_DEFUN:'$1' -i /dev/null | sort -u \
   >$tmp/au.txt
 
 # au-del.sed -- delete the AU macro names.
-sed -e "s,^.*$,/&/d," $tmp/au.txt \
+$sed "s,^.*$,/&/d," $tmp/au.txt \
   >$tmp/au-del.sed
 
 # au.m4 -- definitions the AU macros.
@@ -232,23 +243,23 @@
 # quote.sed -- enable the quote `[', `]' right before any AU macro.
 # Unfortunately, I can't see a solution which does not use `\b', which
 # is a GNU extension :(.  Am I understanding we should use Perl?
-sed -e "s/^.*$/s!\\\\b&\\\\b!_au_changequote([,])\&!/" $tmp/au.txt \
+$sed "s/^.*$/s!\\\\b&\\\\b!_au_changequote([,])\&!/" $tmp/au.txt \
   >$tmp/quote.sed
 
 # ac.txt -- list of all the AC and libm4 macros prefixed by the name
 # of the file which defines it.
 # Be carefull to remove the AU macros.
 $autoconf --trace define:'$f:$1' -i /dev/null |
-  sed -f $tmp/au-del.sed \
+  $sed -f $tmp/au-del.sed \
   >$tmp/ac.txt
 
 # ac.m4 -- autoquoting definitions of the AC macros.
-sed -n -e '/libm4.m4/!s/^[^:]*:\(.*\)$/define([\1], [[$0($@)]])/p' \
+$sed -n -e '/libm4.m4/!s/^[^:]*:\(.*\)$/define([\1], [[$0($@)]])/p' \
   $tmp/ac.txt \
   >$tmp/ac.m4
 
 # disable.m4 -- undefine the macros of AC and libm4.
-sed -e 's/^[^:]*:\(.*\)$/_au_undefine([\1])/' $tmp/ac.txt \
+$sed 's/^[^:]*:\(.*\)$/_au_undefine([\1])/' $tmp/ac.txt \
   >$tmp/disable.m4
 
 # Run m4 on each input file.
@@ -266,7 +277,7 @@
   # input.m4 -- m4 program to produce the updated file.
   # Load the values, the dispatcher, neutralize m4, and the prepared
   # input file.
-  sed 's/^ *//' >$tmp/input.m4 <<EOF
+  $sed 's/^ *//' >$tmp/input.m4 <<EOF
     divert(-1)                                            -*- Autoconf -*-
     changequote([, ])
 
@@ -313,7 +324,7 @@
 EOF
 
   # prepared input -- input, but reenables the quote before each AU macro.
-  sed -f $tmp/quote.sed $file >>$tmp/input.m4
+  $sed -f $tmp/quote.sed $file >>$tmp/input.m4
 
   # Now ask m4 to perform the update.
   $M4 $tmp/input.m4 >$tmp/updated
Index: man/autoupdate.1
===================================================================
RCS file: /cvs/autoconf/man/autoupdate.1,v
retrieving revision 1.13
diff -u -r1.13 autoupdate.1
--- man/autoupdate.1 2000/09/04 12:12:21 1.13
+++ man/autoupdate.1 2000/09/12 10:51:01
@@ -29,6 +29,13 @@
 .TP
 \fB\-l\fR, \fB\-\-localdir\fR=\fIDIR\fR
 location of `aclocal.m4' and `acconfig.h'
+.SS "Environment variables:"
+.TP
+M4
+GNU M4 is required.
+.TP
+SED
+GNU sed is required.
 .SH AUTHOR
 Written by David J. MacKenzie.
 .SH "REPORTING BUGS"

Reply via email to