GNU Info

Info Node: (autoconf.info)Quoting

(autoconf.info)Quoting


Next: Dependencies Between Macros Prev: Macro Names Up: Writing Macros
Enter node , (file) or (file)node

Quoting
=======

   Macros that are called by other macros are evaluated by `m4' several
times; each evaluation might require another layer of quotes to prevent
unwanted expansions of macros or `m4' builtins, such as `define' and
`$1'.  Quotes are also required around macro arguments that contain
commas, since commas separate the arguments from each other.  It's a
good idea to quote any macro arguments that contain newlines or calls
to other macros, as well.

   Autoconf changes the `m4' quote characters from the default ``' and
`'' to `[' and `]', because many of the macros use ``' and `'',
mismatched.  However, in a few places the macros need to use brackets
(usually in C program text or regular expressions).  In those places,
they use the `m4' builtin command `changequote' to temporarily change
the quote characters to `<<' and `>>'.  (Sometimes, if they don't need
to quote anything, they disable quoting entirely instead by setting the
quote characters to empty strings.)  Here is an example:

     AC_TRY_LINK(
     changequote(<<, >>)dnl
     <<#include <time.h>
     #ifndef tzname /* For SGI.  */
     extern char *tzname[]; /* RS6000 and others reject char **tzname.  */
     #endif>>,
     changequote([, ])dnl
     [atoi(*tzname);], ac_cv_var_tzname=yes, ac_cv_var_tzname=no)

   When you create a `configure' script using newly written macros,
examine it carefully to check whether you need to add more quotes in
your macros.  If one or more words have disappeared in the `m4' output,
you need more quotes.  When in doubt, quote.

   However, it's also possible to put on too many layers of quotes.  If
this happens, the resulting `configure' script will contain unexpanded
macros.  The `autoconf' program checks for this problem by doing `grep
AC_ configure'.


automatically generated by info2www version 1.2.2.9