manpagez: man pages & more
info autoconf
Home | html | info | man
[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

8.1.2 One Macro Call

Let’s proceed on the interaction between active characters and macros with this small macro, which just returns its first argument:

define([car], [$1])

The two pairs of quotes above are not part of the arguments of define; rather, they are understood by the top level when it tries to find the arguments of define. Therefore, assuming car is not already defined, it is equivalent to write:

define(car, $1)

But, while it is acceptable for a ‘’ to avoid unnecessary quotes, it is bad practice for Autoconf macros which must both be more robust and also advocate perfect style.

At the top level, there are only two possibilities: either you quote or you don’t:

car(foo, bar, baz)
[car(foo, bar, baz)]
⇒car(foo, bar, baz)

Let’s pay attention to the special characters:

error-->EOF in argument list

The closing parenthesis is hidden in the comment; with a hypothetical quoting, the top level understood it this way:


Proper quotation, of course, fixes the problem:


Here are more examples:

car(foo, bar)
car([foo, bar])
⇒foo, bar
car((foo, bar))
⇒(foo, bar)
car([(foo], [bar)])
define([a], [b])

[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated on April 26, 2012 using texi2html 5.0.

© 2000-2018
Individual documents may contain additional copyright information.