autoconf
[Top][All Lists]
Advanced

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

Re: Autoconf Transforms


From: Eric Blake
Subject: Re: Autoconf Transforms
Date: Wed, 15 Oct 2008 19:20:18 -0600
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.17) Gecko/20080914 Thunderbird/2.0.0.17 Mnenhy/0.7.5.666

-----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             address@hidden
-----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-----




reply via email to

[Prev in Thread] Current Thread [Next in Thread]