Hello,
> Stepan Kasal wrote:
> On Tue, Jun 07, 2005 at 07:28:11PM +0200, Ralf Menzel wrote:
>> - { $GREP -v \
>> + { $EGREP -v \
>> '^\(ac\|as\)_
>> ^\(PPID\|RANDOM\|SECONDS\|'\'\\\$\''\)=
>> ^[[^=]]*=$' $act_file
>> --- snip ---
>
> no, this means you are cheating: in egrep, regexp \(ac\|as\)_
> would match string (ac|as)_ -- but that's not what we want to check.
> You have to adapt the regular expressions for egrep.
>
> See macro AT_CHECK_ENV for an interesting example related to this.
OK, let me have another try:
--- snip ---
RCS file: /cvsroot/autoconf/autoconf/tests/local.at,v
retrieving revision 1.16
diff -u -p -r1.16 local.at
--- tests/local.at 25 May 2005 18:35:05 -0000 1.16
+++ tests/local.at 8 Jun 2005 13:20:41 -0000
@@ -323,9 +323,9 @@ fi
m4_define([AT_CONFIG_CMP],
[for act_file in $1 $2
do
- { $GREP -v \
-'^\(ac\|as\)_
-^\(PPID\|RANDOM\|SECONDS\|'\'\\\$\''\)=
+ { $GREP -E -v \
+'^(ac|as)_
+^(PPID|RANDOM|SECONDS|'\'\\\$\'')=
^[[^=]]*=$' $act_file
$GREP ^ac_cv $act_file ; } |
# Lines that do not look like `foo=bar' are probably latter lines of
--- snip ---
> BTW: AT_CHECK_ENV uses $GREP -E, not $EGREP. Do you know why?
> Shouldn't $EGREP be more portable?
Ah, I see. $EGREP isn't know in the given context. Instead of the
patch above we could add `AC_PROG_EGREP' to configure.ac, modify
atlocal.in and arrive at the following patch:
DIFF5
Description: Patch to use egrep where appropriate
Last time I didn't give an example for the behaviour of the Solaris grep. Here is one: --- snip --- bash> cat greptest #!/bin/sh for GREP in /usr/bin/grep /usr/xpg4/bin/grep /home/menzel/sw/bin/grep ; do echo $GREP: echo 'aa a|ba|b' | $GREP '\(a\|b\)\1' done bash> ./greptest /usr/bin/grep: a|ba|b /usr/xpg4/bin/grep: a|ba|b /home/menzel/sw/bin/grep: aa bash> /home/menzel/sw/bin/grep --version | sed 1q grep (GNU grep) 2.5.1 --- snip --- Bye, Ralf Menzel
