Commit | Line | Data |
---|---|---|
522c08cc RGS |
1 | #!/usr/bin/perl -w |
2 | ||
3 | # | |
4 | # Check that the various config.sh-clones have (at least) all the | |
5 | # same symbols as the top-level config_h.SH so that the (potentially) | |
6 | # needed symbols are not lagging after how Configure thinks the world | |
7 | # is laid out. | |
8 | # | |
a0e39d89 AT |
9 | # VMS is probably not handled properly here, due to their own |
10 | # rather elaborate DCL scripting. | |
522c08cc RGS |
11 | # |
12 | ||
13 | use strict; | |
14 | ||
15 | my $MASTER_CFG = "config_h.SH"; | |
16 | my %MASTER_CFG; | |
17 | ||
18 | my @CFG = ( | |
19 | # This list contains both 5.8.x and 5.9.x files, | |
20 | # we check from MANIFEST whether they are expected to be present. | |
21 | "Cross/config.sh-arm-linux", | |
22 | "epoc/config.sh", | |
23 | "NetWare/config.wc", | |
24 | "symbian/config.sh", | |
25 | "uconfig.sh", | |
26 | "plan9/config_sh.sample", | |
27 | "vos/config.alpha.def", | |
28 | "vos/config.ga.def", | |
29 | "win32/config.bc", | |
30 | "win32/config.gc", | |
31 | "win32/config.vc", | |
6ab0e26e | 32 | "win32/config.vc64", |
26d21fa1 | 33 | "win32/config.ce", |
522c08cc | 34 | "wince/config.ce", |
a0e39d89 | 35 | "configure.com", |
522c08cc RGS |
36 | ); |
37 | ||
38 | sub read_file { | |
39 | my ($fn, $sub) = @_; | |
40 | if (open(my $fh, $fn)) { | |
41 | local $_; | |
42 | while (<$fh>) { | |
43 | &$sub; | |
44 | } | |
45 | } else { | |
46 | die "$0: Failed to open '$fn' for reading: $!\n"; | |
47 | } | |
48 | } | |
49 | ||
50 | sub config_h_SH_reader { | |
51 | my $cfg = shift; | |
52 | return sub { | |
53 | return if 1../^echo \"Extracting \$CONFIG_H/; | |
54 | while (/[^\\]\$(\w+)/g) { | |
55 | my $v = $1; | |
56 | next if $v =~ /^(CONFIG_H|CONFIG_SH)$/; | |
57 | $cfg->{$v}++; | |
58 | } | |
59 | } | |
60 | } | |
61 | ||
62 | read_file($MASTER_CFG, | |
63 | config_h_SH_reader(\%MASTER_CFG)); | |
64 | ||
65 | my %MANIFEST; | |
66 | ||
67 | read_file("MANIFEST", | |
68 | sub { | |
69 | $MANIFEST{$1}++ if /^(.+?)\t/; | |
70 | }); | |
71 | ||
72 | my @MASTER_CFG = sort keys %MASTER_CFG; | |
73 | ||
74 | sub check_cfg { | |
75 | my ($fn, $cfg) = @_; | |
76 | for my $v (@MASTER_CFG) { | |
77 | print "$fn: missing '$v'\n" unless exists $cfg->{$v}; | |
78 | } | |
79 | } | |
80 | ||
81 | for my $cfg (@CFG) { | |
82 | unless (exists $MANIFEST{$cfg}) { | |
83 | print "[skipping not-expected '$cfg']\n"; | |
84 | next; | |
85 | } | |
86 | my %cfg; | |
87 | read_file($cfg, | |
88 | sub { | |
89 | return if /^\#/ || /^\s*$/; | |
a0e39d89 | 90 | return if $cfg eq 'configure.com' && |
b89d399a | 91 | ! /^\$\s+WC "(\w+)='(.*)'"$/; |
522c08cc RGS |
92 | # foo='bar' |
93 | # foo=bar | |
94 | # $foo='bar' # VOS 5.8.x specialty | |
95 | # $foo=bar # VOS 5.8.x specialty | |
96 | if (/^\$?(\w+)='(.*)'$/) { | |
97 | $cfg{$1}++; | |
98 | } | |
99 | elsif (/^\$?(\w+)=(.*)$/) { | |
100 | $cfg{$1}++; | |
a0e39d89 | 101 | } |
b89d399a | 102 | elsif (/^\$\s+WC "(\w+)='(.*)'"$/) { |
a0e39d89 | 103 | $cfg{$1}++; |
522c08cc RGS |
104 | } else { |
105 | warn "$cfg:$.:$_"; | |
106 | } | |
107 | }); | |
108 | check_cfg($cfg, \%cfg); | |
109 | } |