[Top][All Lists]

[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: Gecko/20090812 Thunderbird/ Mnenhy/

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 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:

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
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at
Comment: Using GnuPG with Mozilla -


reply via email to

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