[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: quoting in autoconf
From: |
Eric Blake |
Subject: |
Re: quoting in autoconf |
Date: |
Thu, 10 Dec 2009 05:50:34 -0700 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.23) Gecko/20090812 Thunderbird/2.0.0.23 Mnenhy/0.7.6.666 |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
According to Josef Vukovic on 12/10/2009 5:09 AM:
> Hello,
>
> I am reading the autoconf[1] documentation and come to the topic,
> 3.1.2 The autoconf language where it says " Arguments should
> be enclosed within the m4 quote characters ‘[’ and ‘]’..." but m4
> uses the '`' and ''' as quoting characters. Also defining a Macro
> with:
> define([stdio_h], [HAVE_STDIO_H])dnl
That is the m4sugar/autoconf way.
>
> don't work as expected with defining it like this:
>
> define(`stdio_h', `HAVE_STDIO_H')dnl
That is the raw m4 way.
>
> So I'm know somewhat confused could someone be so friendly
> to explain the issue? Is there a changequote applied during the
> processing of configure.ac wiht autoconf?
Yes, Autoconf uses the m4sugar wrapper around m4, which is documented as
having done a changequote to [] at the very beginning of the input file.
And the autoconf manual even says why:
http://www.gnu.org/software/autoconf/manual/autoconf.html#Changequote-is-Evil
For instance, by default M4 uses ‘`’ and ‘'’ as quotes, but in the context
of shell programming (and actually of most programming languages), that's
about the worst choice one can make: because of strings and back-quoted
expressions in shell code (such as ‘'this'’ and ‘`that`’), and because of
literal characters in usual programming languages (as in ‘'0'’), there are
many unbalanced ‘`’ and ‘'’. Proper M4 quotation then becomes a nightmare,
if not impossible. In order to make M4 useful in such a context, its
designers have equipped it with changequote, which makes it possible to
choose another pair of quotes. M4sugar, M4sh, Autoconf, and Autotest all
have chosen to use ‘[’ and ‘]’. Not especially because they are unlikely
characters, but because they are characters unlikely to be unbalanced.
> If so isn't the manual
> somewhat ambigious?
Which manual (m4 or autoconf), and where? If you found a particular
sentence that confused you, point it out so we can improve it.
- --
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/
iEYEARECAAYFAksg7poACgkQ84KuGfSFAYDXEQCeK0/eaIdZbllXz6AZKA1YIlWM
zgMAn0rw0lS0w/5E4saihYYfYbUjD/gx
=qBE5
-----END PGP SIGNATURE-----