macros: Changes to 'master'

Gaetan Nadon memsize at videotron.ca
Wed Jun 1 11:14:26 PDT 2011


On Wed, 2011-06-01 at 08:44 -0700, Alan Coopersmith wrote:

> 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])
> 

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:

                /* 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 "https://bugs.freedesktop.org/enter_bug.cgi?product=xorg"
                #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 ?


lang.m4 in 2.67 (which does not call AC_LANG_DEFINES_PROVIDED):

        # 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])

lang.m4 in 2.68. Note the call to AC_LANG_DEFINES_PROVIDED

        # 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])

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:


        As of Autoconf 2.63b, the source file also contains the results of all of the AC_DEFINE performed so far.
        
        # AC_LANG_CONFTEST(BODY)
        # ----------------------
        # Save the BODY in `conftest.$ac_ext'.  Add a trailing new line.
        AC_DEFUN([AC_LANG_CONFTEST],
        [m4_pushdef([_AC_LANG_DEFINES_PROVIDED],
          [m4_warn([syntax], [$0: no AC_LANG_SOURCE call detected in
        body])])]dnl
        [_AC_LANG_DISPATCH([$0], _AC_LANG, $@)]dnl
        [[]_AC_LANG_DEFINES_PROVIDED[]m4_popdef([_AC_LANG_DEFINES_PROVIDED])])
        
        
        # AC_LANG_CONFTEST()(BODY)
        # ------------------------
        # Default implementation of AC_LANG_CONFTEST.
        # This version assumes that you can't inline confdefs.h into
        your
        # language, and as such, it is safe to blindly call
        # AC_LANG_DEFINES_PROVIDED.  Language-specific overrides should
        # remove this call if AC_LANG_SOURCE does inline confdefs.h.
        m4_define([AC_LANG_CONFTEST()],
        [cat > conftest.$ac_ext <<_ACEOF
        AC_LANG_DEFINES_PROVIDED[]$1
        _ACEOF])


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.

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.






-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.x.org/archives/xorg-devel/attachments/20110601/37ab7399/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: <http://lists.x.org/archives/xorg-devel/attachments/20110601/37ab7399/attachment.pgp>


More information about the xorg-devel mailing list