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+)/,
31 "NetWare/config_H.??",
33 "plan9/config_h.sample",
36 qr{^(?:\Q/*\E)?#(?:define|undef)\s+(\w+)},
42 qr{^(\w+)="(?:define|undef)"},
47 print STDERR "$0: Looking for symbols...\n";
49 for my $fn (map { glob($_) } @{ $pat->[0] }) {
50 if (open(my $fh, '<', $fn)) {
63 printf(STDERR "$0: Found %d symbols\n", scalar keys %SYM);
65 print STDERR "$0: Looking for their uses...\n";
67 # Much too noisy grepping.
71 my $SYM = join("|", sort { length($b) <=> length($a) || $a cmp $b } keys %SYM);
73 open(my $mani, '<', "MANIFEST") or die "$0: Failed to open MANIFEST\n";
79 # Skip matches from the config files themselves,
80 # from metaconfig generated files that refer to
81 # the config symbols, and from pods.
82 next if $fn =~ m{^(?:config_h.SH|Configure|configure\.com|Porting/(?:config|Glossary)|(?:NetWare|plan9|win32)/(?:config|(?:GNU)?[Mm]akefile)|uconfig)|\.pod$};
83 open my $fh, '<', $fn or die qq[$0: Failed to open $fn: $!];
85 while (/\b($SYM)\b/go) {
92 for my $sym (sort keys %SYM) {
93 if (exists $found{$sym}) {
94 my @found = keys %{$found{$sym}};
95 print "$sym\t", join(" ", sort @found), "\n";