* 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.
This commit is contained in:
Akim Demaille 2001-08-31 13:32:54 +00:00
parent aa8dfa178d
commit e3e7e0a0af
5 changed files with 82 additions and 39 deletions

View File

@ -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.

View 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__

View 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;
}

View 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

View 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