Bruno Haible <[EMAIL PROTECTED]> wrote: > Jim Meyering wrote: >> Unfortunate, but true. >> Thanks. How about this? >> ... >> + grep '^[ ]*A[CM]_PROG_LIBTOOL\>' configure.ac >/dev/null \ > > \> is also not a portable piece of regular expression: not in a basic regex, > and not in an extended regex. It is a GNU extension.
It works with Solaris 10's grep, so maybe it works with some others, too. To tell the truth, I'm not overly concerned about absolute portability of this script, since it's for the build-from-clone case in which we already require quite a few tools. It might be more productive (and more maintainable in the long run) simply to require a grep program that honors -E. Hmm... it'd be easy to automatically provide a perl-based grep replacement when Perl is available. Or better still, just use awk. Then we get alternation back, and can kludge around the lack of a portable end-of-word abbreviation: diff --git a/build-aux/bootstrap b/build-aux/bootstrap index 1ad154f..ae746b8 100755 --- a/build-aux/bootstrap +++ b/build-aux/bootstrap @@ -597,16 +597,13 @@ for command in \ 'automake --add-missing --copy --force-missing'; do if test "$command" = libtool; then - use_libtool=0 - # We'd like to use grep -E, to see if any of LT_INIT, - # AC_PROG_LIBTOOL, AM_PROG_LIBTOOL is used in configure.ac, - # but that's not portable enough (e.g., for Solaris). - grep '^[ ]*A[CM]_PROG_LIBTOOL\>' configure.ac >/dev/null \ - && use_libtool=1 - grep '^[ ]*LT_INIT\>' configure.ac >/dev/null \ - && use_libtool=1 - test $use_libtool = 0 \ - && continue + # Run libtoolize only if needed. + # We'd like to use grep -E, to see if any of LT_INIT, AC_PROG_LIBTOOL, + # AM_PROG_LIBTOOL is used in configure.ac, but that's not portable + # enough (e.g., for Solaris), so use awk instead. + awk '/^[ \t]*(LT_INIT|A[CM]_PROG_LIBTOOL)([ (\t#]|$)/{f=1} END{exit 1-f}' \ + configure.ac >/dev/null \ + || continue command='libtoolize -c -f' fi echo "$0: $command ..."