Hi Stepan,

* Stepan Kasal wrote on Wed, Aug 10, 2005 at 05:05:51PM CEST:
> On Wed, Aug 10, 2005 at 03:42:18PM +0200, Ralf Wildenhues wrote:
> > >   no, I don't think using ac_config_headers is a good idea.
> > 
> > I knew it.  ;)
> 
> So I passed the test.  :-)

Other way round.  I tried to make you do the work for me and did not
succeed at first.  :)
(Also, I failed to see the first time that you only wanted me to do the
documentation and not the actual implementation..)

> > Rough draft, with a patch which does not fully work:
*snip*
> Weird, I'd say that your patch is correct.
> 
> Anyway, I'd hook it differently, see the attached patch.

I knew you would do that.  :)
Yours is much nicer, BTW.

> The documentation seems ok, but perhaps it is worth mentioning that
> AH_HEADER should be best used within code registered by
> AC_CONFIG_COMMANDS_PRE.

Hmm.  But this:
| AC_CONFIG_COMMANDS_PRE([dnl
| m4_ifndef([AH_HEADER], [AC_CONFIG_HEADERS([config.h])])
| AC_SUBST([CONFIG_H], ["AH_HEADER"])
| ])

would not be correct, right?
Quoting 'info Autoconf Configuration\ Headers:
| The `AC_CONFIG_HEADERS' macro selects this kind of output.  It should
| be called right after `AC_INIT'.

AC_CONFIG_HEADERS would be called way too late.
(Please remember that some people try to write their configure.ac in a
way to be compatible with more than just the CVS version of Autoconf.)

But maybe I'm just overcautious here, and you have addressed all these
issues already.

> (Do I guess correctly that this is the case with libtool?)

Nope, ATM it isn't.  It's just called from within AC_LIB_LTDL aka
LTDL_INIT.  Guess we should change that, too.

> My biggest doubt is whether the name "AH_HEADER", which I coined without
> any thinking, is teh right one.  But no one has said anything, yet...
> 
> Would you be so kind to combine the things together and test whether it
> works for you?

Works for me.  Below is the patch against Autoconf,
attached the one against Libtool (HEAD, branch-2-0).

Cheers,
Ralf

        * lib/autoconf/status.m4 (_AC_CONFIG_REGISTER_DEST): New macro
        to define AH_HEADER.
        (_AC_CONFIG_FOOS): Use it.
        * doc/autoconf.texi (Configuration Headers): Document it.

Index: doc/autoconf.texi
===================================================================
RCS file: /cvsroot/autoconf/autoconf/doc/autoconf.texi,v
retrieving revision 1.925
diff -u -r1.925 autoconf.texi
--- doc/autoconf.texi   6 Jul 2005 21:39:31 -0000       1.925
+++ doc/autoconf.texi   12 Aug 2005 21:33:11 -0000
@@ -2697,6 +2697,18 @@
 to prepend and/or append boilerplate to the file.
 @end defmac
 
[EMAIL PROTECTED] AH_HEADER
+This macro is defined as the name of the first declared config header
+and undefined if no config headers have been declared up to this point.
+A third-party macro may, for example, require use of a config header
+without invoking AC_CONFIG_HEADERS twice like this:
+
[EMAIL PROTECTED]
+m4_ifndef([AH_HEADER], [AC_CONFIG_HEADERS([config.h])])
[EMAIL PROTECTED] example
+
[EMAIL PROTECTED] defmac
+
 @xref{Configuration Actions}, for more details on @var{header}.
 
 @menu
Index: lib/autoconf/status.m4
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/autoconf/status.m4,v
retrieving revision 1.72
diff -u -r1.72 status.m4
--- lib/autoconf/status.m4      26 Jul 2005 10:14:25 -0000      1.72
+++ lib/autoconf/status.m4      12 Aug 2005 21:33:11 -0000
@@ -258,9 +258,14 @@
 # With CONFIG_LINKS, reject DEST=., because it is makes it hard for 
./config.status
 # to guess the links to establish (`./config.status .').
 #
+# Save the name of the first config header to AH_HEADER.
+#
 m4_define([_AC_CONFIG_REGISTER_DEST],
 [_AC_CONFIG_UNIQUE([$1], [$3])dnl
-m4_if([$1 $3], [LINKS .], [AC_FATAL([invalid destination of a config link: 
`.'])])dnl
+m4_if([$1 $3], [LINKS .],
+      [AC_FATAL([invalid destination of a config link: `.'])])dnl
+m4_if([$1], [HEADERS],
+      [m4_define_default([AH_HEADER], [$3])])dnl
 dnl
 dnl Recognize TAG as an argument to config.status:
 dnl
2005-08-12  Stepan Kasal  <[EMAIL PROTECTED]>,
            Ralf Wildenhues  <[EMAIL PROTECTED]>

        * m4/ltdl.m4 (LTDL_INIT): Use AH_HEADER if defined.
        Compute CONFIG_H only before creating config.status.
        Reported by Peter Ekberg <[EMAIL PROTECTED]>.

Index: m4/ltdl.m4
===================================================================
RCS file: /cvsroot/libtool/libtool/m4/ltdl.m4,v
retrieving revision 1.31
diff -u -r1.31 ltdl.m4
--- m4/ltdl.m4  29 Jul 2005 13:24:13 -0000      1.31
+++ m4/ltdl.m4  12 Aug 2005 21:51:49 -0000
@@ -163,11 +163,13 @@
 # if they did not call it themself.  This is so that ltdl.h can pick up
 # the parent projects config.h file, The first file in AC_CONFIG_HEADERS
 # must contain the definitions required by ltdl.c.
-m4_ifset([_AC_LIST_TAGS],
-    [CONFIG_H=`echo "_AC_LIST_TAGS" | $GREP HEADERS | $SED 's,^[[      
]]*,,;s,[[ :)]].*$,,'`],
-  [m4_ifset([AC_LIST_HEADERS],
-    [CONFIG_H=`echo "AC_LIST_HEADERS" | $SED 's,^[[    ]]*,,;s,[[ :]].*$,,'`],
-  [CONFIG_H=config.h;AC_CONFIG_HEADERS([config.h])]])
+# FIXME: Remove use of undocumented AC_LIST_HEADERS (2.59 compatibility).
+AC_CONFIG_COMMANDS_PRE([dnl
+m4_ifset([AH_HEADER],
+        [CONFIG_H=AH_HEADER],
+        [m4_ifset([AC_LIST_HEADERS],
+                  [CONFIG_H=`echo "AC_LIST_HEADERS" | $SED 's,^[[      
]]*,,;s,[[ :]].*$,,'`],
+                  [CONFIG_H=config.h;AC_CONFIG_HEADERS([config.h])])])])
 AC_SUBST([CONFIG_H])
 
 AC_CHECK_HEADERS([memory.h unistd.h dl.h sys/dl.h dld.h mach-o/dyld.h],

Reply via email to