[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: autoconf-2.68: no AC_LANG_SOURCE call detected in body
From: |
Eric Blake |
Subject: |
Re: autoconf-2.68: no AC_LANG_SOURCE call detected in body |
Date: |
Tue, 14 Jun 2011 07:45:18 -0600 |
User-agent: |
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110428 Fedora/3.1.10-1.fc14 Lightning/1.0b3pre Mnenhy/0.8.3 Thunderbird/3.1.10 |
On 06/14/2011 01:02 AM, Křištof Želechovski wrote:
> Please observe that the following code from 3.1.2 "The Autoconf Language" is
> obsolete and should be updated:
Not so much obsolete, but out of date with best practice. At any rate,
thanks for the report!
>
> AC_COMPILE_IFELSE([[char b[10];]], [], [AC_MSG_ERROR([you lose])])
>
> Running this snippet through autoconf produces the warning:
>
> no AC_LANG_SOURCE call detected in body
>
> It seems the following syntax is required instead:
>
> AC_COMPILE_IFELSE([AC_LANG_SOURCE([[char b[10];]])], [],
> [AC_MSG_ERROR([you lose])])
Indeed. Here's what I'm pushing:
diff --git i/ChangeLog w/ChangeLog
index 1fca7bb..03541e0 100644
--- i/ChangeLog
+++ w/ChangeLog
@@ -1,3 +1,10 @@
+2011-06-14 Eric Blake <address@hidden>
+
+ doc: update quoting example
+ * doc/autoconf.texi (Autoconf Language): Add AC_LANG_SOURCE use.
+ * THANKS: Update.
+ Reported by Křištof Želechovski.
+
2011-05-05 Eric Blake <address@hidden>
doc: document dash bug with positional parameters
diff --git i/THANKS w/THANKS
index 7679b05..e125ebe 100644
--- i/THANKS
+++ w/THANKS
diff --git i/doc/autoconf.texi w/doc/autoconf.texi
index 7ff693f..99b1fd1 100644
--- i/doc/autoconf.texi
+++ w/doc/autoconf.texi
@@ -1288,19 +1288,26 @@ Autoconf Language
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
address@hidden b10;}. (There was an idiom common in Autoconf's past to
address@hidden 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
address@hidden 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
--
Eric Blake address@hidden +1-801-349-2682
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature