1
0
mirror of https://github.com/moparisthebest/wget synced 2024-07-03 16:38:41 -04:00

build_info.pl improvements, advertise large-file support.

This commit is contained in:
Micah Cowan 2009-10-09 02:02:39 -07:00
parent 3648b91197
commit 186ee6d0ff
5 changed files with 103 additions and 63 deletions

View File

@ -1,3 +1,11 @@
2009-10-09 Micah Cowan <micah@cowan.name>
* build_aux/build_info.pl: Reworked the input format. Eliminated
support, and need, for arbitrary #if blocks. Introduced
"choices", and explicitly open the .c file rather than print to
STDOUT, so we avoid creating the file if we find problems with
the input. Options are advertised in alphabetical order.
2009-09-24 Micah Cowan <micah@cowan.name> 2009-09-24 Micah Cowan <micah@cowan.name>
* vms/vms.c: Moved to src/src.c. * vms/vms.c: Moved to src/src.c.

View File

@ -20,8 +20,7 @@
use strict; use strict;
use warnings; use warnings;
use FindBin qw($Bin); use Carp qw(croak);
use File::Spec ();
my $file = shift @ARGV; my $file = shift @ARGV;
@ -32,59 +31,92 @@ my $file = shift @ARGV;
sub parse_config sub parse_config
{ {
my (%block, @defines, %feature); my $features = [];
my $choice_key;
my $choice = [];
my $list = $features;
open(my $fh, '<', "$file.in") or die "Cannot open $file.in: $!";
while (<$fh>) {
next if /^\s*$/;
if ($list eq $choice) {
unless (s/^\s+//) {
$list = $features;
push @$features, [$choice_key, $choice];
$choice = [];
undef $choice_key;
}
} elsif (/^([A-Za-z0-9_-]+) \s+ choice:\s*$/x) {
$choice_key = $1;
$list = $choice;
next;
}
if (/^([A-Za-z0-9_-]+) \s+ (.*)$/x) {
push @$list, [$1, $2];
} else {
croak "Can't parse line: $_";
}
}
if ($list eq $choice) {
push @$features, [$choice_key, $choice];
}
open(my $fh, '<', $file) or die "Cannot open $file: $!";
my $cfg = do { local $/; <$fh> };
close($fh); close($fh);
while ($cfg =~ /^\ *? (\w+) (?:\s+?)? (\w+?)? \s*$/gmx) { return $features;
$feature{$1} = $2 || '_MISSING';
push @defines, $1;
}
while ($cfg =~ /^(\ *? \#\w+? \s+? (\w+) .+ \#\w+)/gmsx) {
$block{$2} = $1;
}
my %data = (
block => \%block,
defines => \@defines,
feature => \%feature,
);
return \%data;
} }
sub output_code sub output_code
{ {
my ($block, $defines, $feature) = my $features = shift;
map $_[0]->{$_}, qw(block defines feature);
print do { local $/; <DATA> }, "\n"; open(my $fh, '>', "$file") or die "Cannot open $file: $!";
print <<EOC;
print $fh do { local $/; <DATA> }, "\n";
print $fh <<EOC;
const char* (compiled_features[]) = const char* (compiled_features[]) =
{ {
EOC EOC
my @output; foreach my $feature (sort { $a->[0] cmp $b->[0] } @$features) {
foreach my $define (@$defines) { my ($name, $check) = @$feature;
if (!exists $block->{$define}) {
push @output, <<EOC; if (ref $check eq 'ARRAY') {
#ifdef $define my ($ch_name, $ch_check) = @{ shift @$check };
"+$feature->{$define}", print $fh <<EOC;
#else #if $ch_check
"-$feature->{$define}", "+$name/$ch_name",
#endif
EOC EOC
} foreach my $choice (@$check) {
else { ($ch_name, $ch_check) = @$choice;
push @output, <<EOC;
$block->{$define} print $fh <<EOC;
#elif $ch_check
"+$name/$ch_name",
EOC
}
print $fh <<EOC;
#else
"-$name",
#endif
EOC
} else {
print $fh <<EOC;
#if $check
"+$name",
#else
"-$name",
#endif
EOC EOC
} }
} }
print join "\n", @output; print $fh <<EOC;
print <<EOC;
/* sentinel value */ /* sentinel value */
NULL NULL

View File

@ -1,3 +1,9 @@
2009-10-09 Micah Cowan <micah@cowan.name>
* build_info.c.in: Adapt to new input format. Added a check for
large-file support. Replaced the "openssl" and "gnutls"
advertisements with a single "ssl/foo" advertisement.
2009-09-30 Micah Cowan <micah@cowan.name> 2009-09-30 Micah Cowan <micah@cowan.name>
* sysdep.h: Unconditionally include stdbool.h (gnulib has it for * sysdep.h: Unconditionally include stdbool.h (gnulib has it for

View File

@ -65,7 +65,7 @@ MD5_LDADD = @MD5_LDADD@
build_info.c: $(srcdir)/Makefile.am $(srcdir)/build_info.c.in build_info.c: $(srcdir)/Makefile.am $(srcdir)/build_info.c.in
$(PERL) $(top_srcdir)/build-aux/build_info.pl \ $(PERL) $(top_srcdir)/build-aux/build_info.pl \
$(srcdir)/build_info.c.in > $@ $(srcdir)/build_info.c
ESCAPEQUOTE = sed -e 's/[\\"]/\\&/g' -e 's/\\"/"/' -e 's/\\";$$/";/' ESCAPEQUOTE = sed -e 's/[\\"]/\\&/g' -e 's/\\"/"/' -e 's/\\";$$/";/'
version.c: $(wget_SOURCES) ../lib/libgnu.a $(MD5_LDADD) \ version.c: $(wget_SOURCES) ../lib/libgnu.a $(MD5_LDADD) \

View File

@ -1,24 +1,18 @@
ENABLE_DIGEST digest digest defined ENABLE_DIGEST
ENABLE_IPV6 ipv6 https defined HAVE_SSL
ENABLE_NLS nls ipv6 defined ENABLE_IPV6
ENABLE_NTLM ntlm iri defined ENABLE_IRI
ENABLE_OPIE opie large-file SIZEOF_OFF_T >= 8
HAVE_MD5
HAVE_SSL https
HAVE_LIBGNUTLS gnutls
HAVE_LIBSSL openssl
ENABLE_IRI iri
#ifdef HAVE_MD5 md5 choice:
#ifdef HAVE_BUILTIN_MD5 builtin defined HAVE_BUILTIN_MD5
"+md5/builtin", openssl defined HAVE_OPENSSL_MD5
#elif HAVE_OPENSSL_MD5 solaris defined HAVE_SOLARIS_MD5
"+md5/openssl",
#elif HAVE_SOLARIS_MD5 nls defined ENABLE_NLS
"+md5/solaris", ntlm defined ENABLE_NTLM
#else opie defined ENABLE_OPIE
#error "md5 set, but no library found!",
#endif ssl choice:
#else openssl defined HAVE_LIBSSL
"-md5", gnutls defined HAVE_LIBGNUTLS
#endif