autoconf: Active Characters

1 
1 8.1.1 Active Characters
1 -----------------------
1 
1 To fully understand where proper quotation is important, you first need
1 to know what the special characters are in Autoconf: `#' introduces a
1 comment inside which no macro expansion is performed, `,' separates
1 arguments, `[' and `]' are the quotes themselves(1), `(' and `)' (which
1 M4 tries to match by pairs), and finally `$' inside a macro definition.
1 
1    In order to understand the delicate case of macro calls, we first
1 have to present some obvious failures.  Below they are "obvious-ified",
1 but when you find them in real life, they are usually in disguise.
1 
1    Comments, introduced by a hash and running up to the newline, are
1 opaque tokens to the top level: active characters are turned off, and
1 there is no macro expansion:
1 
1      # define([def], ine)
1      =># define([def], ine)
1 
1    Each time there can be a macro expansion, there is a quotation
1 expansion, i.e., one level of quotes is stripped:
1 
1      int tab[10];
1      =>int tab10;
1      [int tab[10];]
1      =>int tab[10];
1 
1    Without this in mind, the reader might try hopelessly to use her
1 macro `array':
1 
1      define([array], [int tab[10];])
1      array
1      =>int tab10;
1      [array]
1      =>array
1 
1 How can you correctly output the intended results(2)?
1 
1    ---------- Footnotes ----------
1 
1    (1) By itself, M4 uses ``' and `''; it is the M4sugar layer that
1 sets up the preferred quotes of `[' and `]'.
1 
1    (2) Using `defn'.
1