Re: Autoconf Transforms

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Ralf Wildenhues on 10/15/2008 12:43 PM:
>> e.g., regex classes, where 's/[^0-9]//' becomes 's/^0-9//' unless one
>> doubles the square braces like so 's/[[^0-9]]//' in which case one of
>> each pair is stripped away to get the desired form in the resulting
>> 'configure' file.  But that may not be the correct way to handle it.
> 
> It's a valid way.  You can move the quotes outward:
> 
> $some_normal_code
> [ $double_quoted_code
>   ..
>   sed 's/[^0-9]//' ...
>   $more_double_quoted_code
> ]

In fact, it is considered good style to move the quotes outward, as it
makes it easier to copy and paste blocks of code.

>> I guess the manual is trying to tell me that implicitly by discussing
>> the m4 processor parsing rules, but I haven't yet found an explicit
>> warning to that effect about use of shell commands (except the
>> warnings about portable shell programming and recomended non-use of
>> the negated character class form).

http://www.gnu.org/software/autoconf/manual/autoconf.html#Active-Characters
http://www.gnu.org/software/autoconf/manual/autoconf.html#Quotation-Rule-Of-Thumb

give the best summary.  Basically, use [foo] as a macro argument if you
want foo to be reparsed as a macro name, and [[foo]] as a macro argument
if you want it treated as literal text.  In your case, you want the regex
to be literal text, so

[[
  case $foo in
   [0-9]*) ;;
  esac
]]

is the right quoting.  If you have improvements for the wording in the
manual, please let us know!

- --
Don't work too hard, make some time for fun as well!

Eric Blake             ebb9@xxxxxxx
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkj2ltIACgkQ84KuGfSFAYDZxQCdFf7M9Lu3bNJ8la6TWGgYyqld
8XYAn1rr8zIaWNomsAtc7fSkKlkE1lrR
=jxs0
-----END PGP SIGNATURE-----


_______________________________________________
Autoconf mailing list
Autoconf@xxxxxxx
http://lists.gnu.org/mailman/listinfo/autoconf

[Index of Archives]     [GCC Help]     [Kernel Discussion]     [RPM Discussion]     [Red Hat Development]     [Yosemite News]     [Linux USB]     [Samba]

  Powered by Linux