| On Thu, Sep 07, 2000 at 02:12:34PM -0400, Pavel Roskin wrote:
| > -------------
| > 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 `>>'.
|
| (not a good recommendation ;-)
Yes, this is a bad recommendation. And in fact you frightened me
Pavel, by current you mean 2.13, right? I could not find this horror
in the CVS documentation. But there is an answer to the above
statement:
> It is frequent to read Autoconf programs with snippets like:
>
> 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)
>
>which is incredibly useless since `AC_TRY_LINK' is _already_ double
>quoting, so you just need:
>
> AC_TRY_LINK(
> [#include <time.h>
> #ifndef tzname /* For SGI. */
> extern char *tzname[]; /* RS6000 and others reject char **tzname. */
> #endif],
> [atoi (*tzname);],
> [ac_cv_var_tzname=yes],
> [ac_cv_var_tzname=no])
>
>The M4 fluent reader noted that these two writings are rigorously
>equivalent, since `m4' swallows both the `changequote(<<, >>)' and `<<'
>`>>' when it "collects" the arguments: these quotes are not part of the
>arguments!
>
> Simplified, the example above is just doing this:
>
> changequote(<<, >>)dnl
> <<[]>>
> changequote([, ])dnl
>
>instead of simply
>
> [[]]
>
> With macros which do not double quote their arguments (which is the
>rule), double quote the (risky) literals:
>
> AC_LINK_IFELSE([AC_LANG_PROGRAM(
> [[#include <time.h>
> #ifndef tzname /* For SGI. */
> extern char *tzname[]; /* RS6000 and others reject char **tzname. */
> #endif]],
> [atoi (*tzname);])],
> [ac_cv_var_tzname=yes],
> [ac_cv_var_tzname=no])
>
So in the case Pavel fixed, I'd suggest to follow the advice of Lars.
Akim