summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorEric Blake <eblake@redhat.com>2011-06-14 07:45:29 -0600
committerEric Blake <eblake@redhat.com>2011-06-14 07:45:29 -0600
commit1a956c4b1e8f52b55a2225ace6422c4739f1e43e (patch)
treedbbe6f0b834df97b036bcfe6edb2b5b88bfa05c9 /doc
parent2105ae97000c7c77442b3a788c90d8fee63bd2b3 (diff)
downloadautoconf-1a956c4b1e8f52b55a2225ace6422c4739f1e43e.tar.gz
doc: update quoting example
The existing example triggers an autoconf warning, due to the change in AC_COMPILE_IFELSE probing for an AC_LANG_SOURCE use. * doc/autoconf.texi (Autoconf Language): Add AC_LANG_SOURCE use. * THANKS: Update. Reported by Křištof Želechovski. Signed-off-by: Eric Blake <eblake@redhat.com>
Diffstat (limited to 'doc')
-rw-r--r--doc/autoconf.texi17
1 files changed, 12 insertions, 5 deletions
diff --git a/doc/autoconf.texi b/doc/autoconf.texi
index 7ff693f5..99b1fd1f 100644
--- a/doc/autoconf.texi
+++ b/doc/autoconf.texi
@@ -1288,19 +1288,26 @@ has been continually misunderstood@enddots{} The rule of thumb is that
i.e., expect one level of quotes to be lost. For instance:
@example
-AC_COMPILE_IFELSE([char b[10];], [], [AC_MSG_ERROR([you lose])])
+AC_COMPILE_IFELSE(AC_LANG_SOURCE([char b[10];]), [],
+ [AC_MSG_ERROR([you lose])])
@end example
@noindent
-is incorrect: here, the first argument of @code{AC_COMPILE_IFELSE} is
+is incorrect: here, the first argument of @code{AC_LANG_SOURCE} is
@samp{char b[10];} and is expanded once, which results in
-@samp{char b10;}. (There was an idiom common in Autoconf's past to
+@samp{char b10;}; and the @code{AC_LANG_SOURCE} is also expanded prior
+to being passed to @code{AC_COMPILE_IFELSE}. (There was an idiom common
+in Autoconf's past to
address this issue via the M4 @code{changequote} primitive, but do not
use it!) Let's take a closer look: the author meant the first argument
-to be understood as a literal, and therefore it must be quoted twice:
+to be understood as a literal, and therefore it must be quoted twice;
+likewise, the intermediate @code{AC_LANG_SOURCE} macro should be quoted
+once so that it is only expanded after the rest of the body of
+@code{AC_COMPILE_IFELSE} is in place:
@example
-AC_COMPILE_IFELSE([[char b[10];]], [], [AC_MSG_ERROR([you lose])])
+AC_COMPILE_IFELSE([AC_LANG_SOURCE([[char b[10];]])], [],
+ [AC_MSG_ERROR([you lose])])
@end example
@noindent