6 # (1) finds all the Configure/config symbols
8 # (2) greps for their use in the core files and shows which ones.
20 # (1) aref of filename glob patterns
21 # (2) aref of qr patterns, the submatch $1 is the symbol name
26 qr/^#\$(\w+)\s+(\w+)/,
32 "plan9/config_h.sample",
35 qr{^(?:\Q/*\E)?#(?:define|undef)\s+(\w+)},
41 qr{^(\w+)="(?:define|undef)"},
46 print STDERR "$0: Looking for symbols...\n";
48 for my $fn (map { glob($_) } @{ $pat->[0] }) {
49 if (open(my $fh, '<', $fn)) {
62 printf(STDERR "$0: Found %d symbols\n", scalar keys %SYM);
64 print STDERR "$0: Looking for their uses...\n";
66 # Much too noisy grepping.
70 my $SYM = join("|", sort { length($b) <=> length($a) || $a cmp $b } keys %SYM);
72 open(my $mani, '<', "MANIFEST") or die "$0: Failed to open MANIFEST\n";
78 # Skip matches from the config files themselves,
79 # from metaconfig generated files that refer to
80 # the config symbols, and from pods.
81 next if $fn =~ m{^(?:config_h.SH|Configure|configure\.com|Porting/(?:config|Glossary)|(?:plan9|win32)/(?:config|(?:GNU)?[Mm]akefile)|uconfig)|\.pod$};
82 open my $fh, '<', $fn or die qq[$0: Failed to open $fn: $!];
84 while (/\b($SYM)\b/go) {
91 for my $sym (sort keys %SYM) {
92 if (exists $found{$sym}) {
93 my @found = keys %{$found{$sym}};
94 print "$sym\t", join(" ", sort @found), "\n";