]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
* bin/autoheader.in: Handle the acconfig.h etc. junk files.
authorAkim Demaille <akim@epita.fr>
Fri, 31 Aug 2001 13:32:54 +0000 (13:32 +0000)
committerAkim Demaille <akim@epita.fr>
Fri, 31 Aug 2001 13:32:54 +0000 (13:32 +0000)
Check the completeness of the #template.
* lib/Autom4te/General.pm (&update_file): s/remove/unlink/.
* tests/semantics.at (AC_C_BIGENDIAN): Adjust AT_CHECK_AUTOHEADER
invocation.

ChangeLog
bin/autoheader.in
lib/Autom4te/General.pm
tests/semantics.at
tests/tools.at

index a827377f22d9f6f60988c447151fb5ec81c8f02f..05e863edabb2b52be4c4da947dc2e53b4a288ebb 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2001-08-31  Akim Demaille  <akim@epita.fr>
+
+       * bin/autoheader.in: Handle the acconfig.h etc. junk files.
+       Check the completeness of the #template.
+       * lib/Autom4te/General.pm (&update_file): s/remove/unlink/.
+       * tests/semantics.at (AC_C_BIGENDIAN): Adjust AT_CHECK_AUTOHEADER
+       invocation.
+
 2001-08-31  Akim Demaille  <akim@epita.fr>
 
        * lib/Autom4te/General.pm (&find_file, &update_file): New.
index d3c6ccf54679aa0f2e79a0b599c3da5b3f908b70..52e6712f0dd3f23eb844759eae0e85e73249234a 100644 (file)
@@ -33,9 +33,6 @@ BEGIN
   unshift @INC, "$perllibdir";
 }
 
-use Getopt::Long;
-use File::Basename;
-use IO::File;
 use Autom4te::General;
 use strict;
 
@@ -194,7 +191,7 @@ $autoconf .= ' --debug' if $debug;
 verbose "$me: running $autoconf to trace from $ARGV[0]";
 xsystem ("$autoconf "
         . " --trace AC_CONFIG_HEADERS:'\$\$config_h ||= \"\$1\";'"
-        . " --trace AH_OUTPUT:'\$\$verbatim{\$1} = \"\\\n\$2\";'"
+        . " --trace AH_OUTPUT:'\$\$verbatim{\"\$1\"} = \"\\\n\$2\";'"
         . " --trace AC_DEFINE_TRACE_LITERAL:'\$\$symbol{\"\$1\"} = 1;'"
         . " $ARGV[0] >$tmp/traces.pl");
 
@@ -217,11 +214,26 @@ my $out = new IO::File (">$tmp/config.hin");
 print $out "/* $config_h_in.  Generated from $ARGV[0] by autoheader.  */\n";
 
 # Dump the top.
-# test -r $config_h.top && cat $config_h.top >>$tmp/config.hin
-#
-# # Dump `acconfig.h' but its bottom.
-# test -r $localdir/acconfig.h &&
-#   sed '/@BOTTOM@/,$d;s/@TOP@//' $localdir/acconfig.h >>$tmp/config.hin
+if ($config_h_top)
+  {
+    my $in = new IO::File ($config_h_top);
+    while ($_ = $in->getline)
+      {
+       print $out;
+      }
+  }
+
+# Dump `acconfig.h' but its bottom.
+if ($acconfig_h)
+  {
+    my $in = new IO::File ($acconfig_h);
+    while ($_ = $in->getline)
+      {
+       last if /\@BOTTOM\@/;
+       next if /\@TOP\@/;
+       print $out;
+      }
+  }
 
 # Dump the templates from `configure.ac'.
 foreach (sort keys %verbatim)
@@ -229,29 +241,45 @@ foreach (sort keys %verbatim)
     print $out "$verbatim{$_}\n";
   }
 
+# Dump `acconfig.h' bottom.
+if ($acconfig_h)
+  {
+    my $in = new IO::File ($acconfig_h);
+    my $dump = 0;
+    while ($_ = $in->getline)
+      {
+       print $out if $dump;
+       $dump = 1  if /\@BOTTOM\@/;
+      }
+  }
+
+# Dump the bottom.
+if ($config_h_bot)
+  {
+    my $in = new IO::File ($config_h_bot);
+    while ($_ = $in->getline)
+      {
+       print $out;
+      }
+  }
+
 $out->close;
 
-# # Handle the case where @BOTTOM@ is the first line of acconfig.h.
-# test -r $localdir/acconfig.h &&
-#   grep @BOTTOM@ $localdir/acconfig.h >/dev/null &&
-#   sed -n '/@BOTTOM@/,${/@BOTTOM@/!p;}' $localdir/acconfig.h >>$tmp/config.hin
-# test -f $config_h.bot && cat $config_h.bot >>$tmp/config.hin
-
-# # Check that all the symbols have a template.
-# $verbose $me: checking completeness of the template >&2
-# # Regexp for a white space.
-# w='[         ]'
-# if test -n "$syms"; then
-#   for sym in $syms; do
-#     if egrep "^#$w*[a-z]*$w$w*$sym($w*|$w.*)$" $tmp/config.hin >/dev/null; then
-#        : # All is well.
-#     else
-#        echo "$me: No template for symbol \`$sym'" >&2
-#        status=1
-#     fi
-#   done
-# fi
+# Check that all the symbols have a template.
+{
+  my $in = new IO::File ("$tmp/config.hin");
+  while ($_ = $in->getline)
+    {
+      my ($symbol) = /^\#\s*\w+\s+(\w+)/
+       or next;
+      delete $symbol{$symbol};
+    }
+  foreach (sort keys %symbol)
+    {
+      print STDERR "$me: missing template: $_\n";
+    }
+  exit 1
+    if keys %symbol;
+}
 
 update_file ("$tmp/config.hin", "$config_h_in");
-
-__END__
index dead90686280675c4723fd22a4765c3abcdf8976..f0b22cf388d76599184b99707d0168f90cd82c1e 100644 (file)
@@ -20,8 +20,10 @@ package Autom4te::General;
 
 use 5.005;
 use Exporter;
+use Getopt::Long;
 use File::Basename;
 use File::stat;
+use IO::File;
 use Carp;
 use strict;
 
@@ -230,7 +232,7 @@ sub update_file ($$)
          print $out $_;
        }
       $in->close;
-      remove ($from)
+      unlink ($from)
        or die "$me: cannot not remove $from: $!\n";
       return;
     }
index 174a54373b25b1f0d8a10a59cd1f15a9b60e6c18..db66b04fe3b15fcaebf3f660d4064265cd029889 100644 (file)
@@ -322,11 +322,13 @@ AT_CHECK_CONFIGURE
 
 AT_CLEANUP(path)
 
-# -------------- #
-# AC_C_BIGENDIAN #
-# -------------- #
 
-AT_SETUP(AC_C_BIGENDIAN)
+
+## ---------------- ##
+## AC_C_BIGENDIAN.  ##
+## ---------------- ##
+
+AT_SETUP([[AC_C_BIGENDIAN]])
 
 # Make sure that AC_C_BIGENDIAN behave the same whether we are
 # cross-compiling or not.
@@ -352,16 +354,17 @@ _AT_CHECK_AC_MACRO(
 
 # Make sure AC_C_BIGENDIAN with no argument will define WORDS_BIGENDIAN
 AT_CONFIGURE_AC([AC_C_BIGENDIAN])
-AT_CHECK_AUTOHEADER
+AT_CHECK_AUTOHEADER([], [], [], [autoheader: `config.hin' is updated])
 AT_CHECK([grep WORDS_BIGENDIAN config.hin], [], [ignore])
 
 AT_CLEANUP(at-endian)
 
+
 # ------------------------------ #
 # AC_PATH_PROG & AC_PATH_PROGS.  #
 # ------------------------------ #
 
-AT_SETUP(AC_PATH_PROG & AC_PATH_PROGS)
+AT_SETUP([[AC_PATH_PROG & AC_PATH_PROGS]])
 
 AT_CHECK_PROGS_PREPARE
 
index aad110c4f20b7d131672c7fa16dc6b0b0fb30aff..ac1de13e7bfb06741da27fde0234ed44a3050907 100644 (file)
@@ -432,6 +432,8 @@ AH_BOTTOM([Bottom2 from configure.ac.])
 # Yes, that's right: the `middle' part of `acconfig.h' is still before
 # the AH_TOP part.  But so what, you're not supposed to use the two
 # together.
+# Ignore STDERR which is the longuish complaint against autoheader junk
+# files.
 AT_CHECK([autoheader -<configure.ac], 0,
 [[/* config.h.in.  Generated automatically from Standard input by autoheader.  */
 /* Top from acconfig.h. */
@@ -448,7 +450,7 @@ Bottom1 from configure.ac.
 
 Bottom2 from configure.ac.
 /* Bottom from acconfig.h. */
-]], [])
+]], [ignore])
 
 
 AT_CLEANUP