Hello Andreas,

On Mon, Jun 30, 2008 at 03:30:19PM +0200, Andreas Schwab wrote:
> $ cat configure.ac
> AC_INIT
> AC_AIX
> AC_DEFINE(__EXTENSIONS__, 1, [Defined on Solaris to see additional function 
> prototypes.])
> AC_CONFIG_HEADERS([config.h])
> AC_OUTPUT
> $ autoheader
> autoheader: warning: missing template: _ALL_SOURCE
> autoheader: Use AC_DEFINE([_ALL_SOURCE], [], [Description])
> autoheader: warning: missing template: _GNU_SOURCE
> autoheader: warning: missing template: _POSIX_PTHREAD_SEMANTICS
> autoheader: warning: missing template: _TANDEM_SOURCE
> 
> The same works when moving AC_AIX down after the AC_DEFINE.

AC_AIX is an alias for AC_USE_SYSTEM_EXTENSIONS these days.

The config.h.in fragment in AC_USE_SYSTEM_EXTENSIONS takes care of
all the above cpp macros, including __EXTENSIONS__, and is "indexed"
by the string __EXTENSIONS__.  This means that the autoheader script
saves it into a hash under index "__EXTENSIONS__".

So it clashes with the config.h.in fragment created from your
AC_DEFINE.  Whoever comes last, wins.  That's why the order matters.

The problem you observe did not happen with Autoconf versions before
the commit from 2007-09-11 which merged AC_AIX into
AC_USE_SYSTEM_EXTENSIONS and the config.h.in fragment there, indexed by
"_ALL_SOURCE" became part of the fragment indexed by __EXTENSIONS__.

An easy fix is to remove AC_DEFINE(__EXTENSIONS_, ...) from
configure.ac, AC_USE_SYSTEM_EXTENSIONS takes care about it.

This problem could be fixed in autoheader by breaking that
config.h.in fragment into more parts, so that your
AC_DEFINE(__EXTENSIONS__, clashes only with one part of it.
But I'm not sure this is worth it.


But I see another problem here:
autoheader calls this "warning", but it does not create
config.h.in then.  Even worse, if config.h.in existed, it's not
updated.
The mistake was introduced by a change almost
5 years old!  The attached diff documents it.

Possible solutions:
- update the template anyway
- call it an error, removing the obsolete template.
- call it an error, leaving template as it is

In my opinion, the above are in decreasing order of preference.

Comments welcome,
        Stepan
diff --git a/ChangeLog b/ChangeLog
index 5ca29ed..3d9ba44 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2003-08-27  Akim Demaille  <[EMAIL PROTECTED]>
 
+       * bin/autoheader.in: Issue the "Using auxiliary..." message only
+       when -Wobsolete is set.
+       Set it on by default.
+       Suggested by Klee Dienes.
+
+2003-08-27  Akim Demaille  <[EMAIL PROTECTED]>
+
        * doc/autoconf.texi (AC_FUNC_FSEEKO, AC_SYS_LARGEFILE): More
        documentation.
        From Guido Draheim.
diff --git a/NEWS b/NEWS
index ca44b27..1bc0160 100644
--- a/NEWS
+++ b/NEWS
@@ -12,6 +12,11 @@
   This became a significant problem since aclocal and automake can
   run autoconf behind the scene.
 
+** autoheader warnings
+  The warnings of autoheader can be turned off, using --warning.
+  For instance, -Wno-obsolete disables the complaints about acconfig.h
+  and other deprecated constructs.
+
 * Major changes in Autoconf 2.57a
 
   Released 2003-06-20 by Akim Demaille.
diff --git a/bin/autoheader.in b/bin/autoheader.in
index caafa27..46faefe 100644
--- a/bin/autoheader.in
+++ b/bin/autoheader.in
@@ -126,6 +126,7 @@ sub parse_args ()
 ## -------------- ##
 
 mktmpdir ('ah');
+switch_warning 'obsolete';
 parse_args;
 
 # Preach.
@@ -146,14 +147,14 @@ if ($config_h_top || $config_h_bot || $acconfig_h)
     \`AC_DEFINE_UNQUOTED\' allows to define a template without
     \`acconfig.h\':
 
-      AC_DEFINE([NEED_MAIN], 1,
+      AC_DEFINE([NEED_FUNC_MAIN], 1,
                [Define if a function \`main\' is needed.])
 
     More sophisticated templates can also be produced, see the
     documentation.
 END
     $msg =~ s/^    /WARNING: /gm;
-    print STDERR $msg;
+    msg 'obsolete', $msg;
   }
 
 # Set up autoconf.
@@ -265,10 +266,10 @@ $out->close;
     }
   foreach (sort keys %symbol)
     {
-      print STDERR "$me: missing template: $_\n";
+      msg 'syntax', "warning: missing template: $_";
       if ($suggest_ac_define)
        {
-         print STDERR "Use AC_DEFINE([$_], [], [Description])\n";
+         msg 'syntax',  "Use AC_DEFINE([$_], [], [Description])";
          $suggest_ac_define = 0;
        }
 
diff --git a/bin/autoupdate.in b/bin/autoupdate.in
index e7eb8f8..f2fea3d 100644
--- a/bin/autoupdate.in
+++ b/bin/autoupdate.in
@@ -172,9 +172,9 @@ my (%ac_macros, %au_macros);
 sub handle_autoconf_macros ()
 {
   my $macros = new Autom4te::XFile ("$autoconf"
-                            . " --trace AU_DEFUN:'AU:\$f:\$1'"
-                            . " --trace define:'AC:\$f:\$1'"
-                            . " --melt /dev/null |");
+                                   . " --trace AU_DEFUN:'AU:\$f:\$1'"
+                                   . " --trace define:'AC:\$f:\$1'"
+                                   . " --melt /dev/null |");
   while ($_ = $macros->getline)
     {
       chomp;

Reply via email to