<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
<META NAME="GENERATOR" CONTENT="GtkHTML/3.32.2">
</HEAD>
<BODY>
On Wed, 2011-06-01 at 08:44 -0700, Alan Coopersmith wrote:
<BLOCKQUOTE TYPE=CITE>
<PRE>
On 06/ 1/11 04:42 AM, Gaetan Nadon wrote:
> On Tue, 2011-05-31 at 23:59 -0700, Jeremy Huddleston wrote:
>> AC_LANG_DEFINES_PROVIDED seems to be only in newer, GPLv3, versions of autoconf ... is there a way around this?
>
> I looked at it yesterday, using AC_LANG_SOURCE should be the right thing to do
> (some examples in the server).
For things where we actually compile source, yes, but for the RAW_CPP macro, I
was trying to avoid it, since it adds additional text to the input to cpp, which
may or may not throw off our testing. I'd prefer something more like (untested):
        m4_ifdef([AC_LANG_DEFINES_PROVIDED], [AC_LANG_DEFINES_PROVIDED])
</PRE>
</BLOCKQUOTE>
That's the first thing I tried. Looking up in the doc, they cannot really say why one would need AC_LANG_DEFINES_PROVIDED and that it should be very rare. I just tried with/without AC_LANG_SOURCE and both test files are identical:
<BLOCKQUOTE>
<BLOCKQUOTE>
<PRE>
/* confdefs.h */
#define PACKAGE_NAME "libX11"
#define PACKAGE_TARNAME "libX11"
#define PACKAGE_VERSION "1.4.3"
#define PACKAGE_STRING "libX11 1.4.3"
#define PACKAGE_BUGREPORT "<A HREF="https://bugs.freedesktop.org/enter_bug.cgi?product=xorg">https://bugs.freedesktop.org/enter_bug.cgi?product=xorg</A>"
#define PACKAGE_URL ""
#define STDC_HEADERS 1
#define HAVE_SYS_TYPES_H 1
#define HAVE_SYS_STAT_H 1
#define HAVE_STDLIB_H 1
#define HAVE_STRING_H 1
#define HAVE_MEMORY_H 1
#define HAVE_STRINGS_H 1
#define HAVE_INTTYPES_H 1
#define HAVE_STDINT_H 1
#define HAVE_UNISTD_H 1
#define __EXTENSIONS__ 1
#define _ALL_SOURCE 1
#define _GNU_SOURCE 1
#define _POSIX_PTHREAD_SEMANTICS 1
#define _TANDEM_SOURCE 1
#define PACKAGE "libX11"
#define VERSION "1.4.3"
#define HAVE_DLFCN_H 1
#define LT_OBJDIR ".libs/"
#define PACKAGE_VERSION_MAJOR 1
#define PACKAGE_VERSION_MINOR 4
#define PACKAGE_VERSION_PATCHLEVEL 3
/* end confdefs.h. */
Does cpp redefine unix ?
</PRE>
</BLOCKQUOTE>
</BLOCKQUOTE>
<BR>
lang.m4 in 2.67 (which does not call AC_LANG_DEFINES_PROVIDED):
<BLOCKQUOTE>
<PRE>
# AC_LANG_SOURCE(BODY)
# --------------------
# Produce a valid source for the current language, which includes the
# BODY, and as much as possible `confdefs.h'.
AC_DEFUN([AC_LANG_SOURCE],
[_AC_LANG_DISPATCH([$0], _AC_LANG, $@)])
# AC_LANG_SOURCE()(BODY)
# ----------------------
# Default implementation of AC_LANG_SOURCE.
m4_define([AC_LANG_SOURCE()],
[$1])
</PRE>
</BLOCKQUOTE>
lang.m4 in 2.68. Note the call to AC_LANG_DEFINES_PROVIDED
<BLOCKQUOTE>
<PRE>
# AC_LANG_SOURCE(BODY)
# --------------------
# Produce a valid source for the current language, which includes the
# BODY, and as much as possible `confdefs.h'.
AC_DEFUN([AC_LANG_SOURCE],
[AC_LANG_DEFINES_PROVIDED[]_AC_LANG_DISPATCH([$0], _AC_LANG, $@)])
# AC_LANG_SOURCE()(BODY)
# ----------------------
# Default implementation of AC_LANG_SOURCE.
m4_define([AC_LANG_SOURCE()],
[$1])
</PRE>
</BLOCKQUOTE>
Although not clear in the docs, you should use AC_LANG_DEFINES_PROVIDED if you cannot inline conftest in your test program. In our case, it has always been inlined before when the module was configured with autoconf 2.63b and up:<BR>
<BR>
<BLOCKQUOTE>
<PRE>
<B>As of Autoconf 2.63b, the source file also contains the results of all of the </B><B><TT>AC_DEFINE</TT></B><B> performed so far.</B>
</PRE>
# AC_LANG_CONFTEST(BODY)<BR>
# ----------------------<BR>
# Save the BODY in `conftest.$ac_ext'. Add a trailing new line.<BR>
AC_DEFUN([AC_LANG_CONFTEST],<BR>
[m4_pushdef([_AC_LANG_DEFINES_PROVIDED],<BR>
[m4_warn([syntax], [$0: no AC_LANG_SOURCE call detected in body])])]dnl<BR>
[_AC_LANG_DISPATCH([$0], _AC_LANG, $@)]dnl<BR>
[[]_AC_LANG_DEFINES_PROVIDED[]m4_popdef([_AC_LANG_DEFINES_PROVIDED])])<BR>
<BR>
<BR>
# AC_LANG_CONFTEST()(BODY)<BR>
# ------------------------<BR>
# Default implementation of AC_LANG_CONFTEST.<BR>
# This version assumes that you can't inline confdefs.h into your<BR>
# language, and as such, it is safe to blindly call<BR>
# AC_LANG_DEFINES_PROVIDED. Language-specific overrides should<BR>
# remove this call if AC_LANG_SOURCE does inline confdefs.h.<BR>
m4_define([AC_LANG_CONFTEST()],<BR>
[cat > conftest.$ac_ext <<_ACEOF<BR>
AC_LANG_DEFINES_PROVIDED[]$1<BR>
_ACEOF])<BR>
</BLOCKQUOTE>
<BR>
Had there been an issue with inlining contest, we would have found out quite a while ago. The inlining was introduced in 2.63b, without anyone noticing.<BR>
<BR>
I think it is safe to use AC_LANG_SOURCE. It has the merit of being consistent with other configuration tests and prevents a workaround that always need to be explained.<BR>
<BR>
<BR>
<BR>
<BR>
<BR>
<BR>
</BODY>
</HTML>