This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
metaconfig maintenance; fix Hasfield, statfs;
[metaconfig.git] / U / mkglossary
CommitLineData
959f3c4c
JH
1#!/usr/local/bin/perl -w
2use File::Basename;
3
4# WARNING: This is site-specific. Change to the location
5# where you have installed dist-3.0PL70.
6@std_units = glob('/u/vieraat/vieraat/jhi/Perl/lib/dist/U/*.U');
7$PWD = '/u/vieraat/vieraat/jhi/pp4/cfgperl';
8
9chdir U if -d './U';
10@perl_units = glob("$PWD/U/*/*.U");
11push(@perl_units, @std_units);
12
13# Get the list of config.sh symbols. Be sure this is up to date!
14# (I run the U/mksample script first to be sure.)
15open(WANTED, "sort $PWD/Porting/config.sh|") || die "$0: open $PWD/Wanted: $!\n";
16
17print <<'EOM';
18This file contains a description of all the shell variables whose value is
19determined by the Configure script. Variables intended for use in C
20programs (e.g. I_UNISTD) are already described in config_h.SH. [`configpm'
21generates pod documentation for Config.pm from this file--please try to keep
22the formatting regular.]
23
24EOM
25
26foreach $file (@perl_units) {
27 open(FH, "<$file") || die "$0: open $file: $!";
28 my $base = basename($file);
29 $Loc = $file, next if $base eq 'Loc.U' and not defined $Loc;
30 while (<FH>) {
31 if (/^\?S:\w+[ \t:]/ .. /^\?S:.$/) {
32 if (/^\?S:.$/) {
33 ($var) = ((shift @var) =~ /^(\w+)/);
34 unless (exists $expl{$var}) {
35 $expl{$var} = [ @var, "\n" ];
36 $file{$var} = $base;
37 }
38 @var = ();
39 } else {
40 s/^\?S://; # Remove leading ?S: markers.
41 s/^\s+/\t/; # Ensure all lines begin with tabs.
42 push @var, $_;
43 }
44 }
45 }
46 close(FH) || die "$0: close $file: $!";
47}
48
49die "$0: Couldn't locate Loc.U: $!" unless defined $Loc;
50
51open(FH, "<$Loc") || die "$0: open $Loc: $!";
52while (<FH>) {
53 if (/^\?(\w+):\1$/) {
54 $var = $1;
55 $expl{$var} = 1;
56 $file{$var} = 'Loc.U';
57 }
58}
59close(FH) || die "$0: close $Loc: $!";
60
61symbol: while (defined($var = <WANTED>)) {
62 chomp $var;
63 next symbol if $var =~ /^#/; # Skip comments
64 next symbol if $var =~ /^$/;
65 ($var, $val) = split(/=/, $var, 2);
66 $gotit = 0;
67
68 if (exists $expl{$var}) {
69 if ($file{$var} eq 'Loc.U') {
70 print "$var (Loc.U):\n";
71 if ($val eq "''") {
72 # If we didn't have d_portable, this info might be
73 # useful, but it still won't help with non-standard
74 # stuff if perl is built on one system but installed
75 # on others (this is common with Linux distributions,
76 # for example).
77 print <<EOE;
78 This variable is defined but not used by Configure.
79 The value is a plain '' and is not useful.
80
81EOE
82 } else {
83 print <<EOE;
17784b92 84 This variable is used internally by Configure to determine the
959f3c4c
JH
85 full pathname (if any) of the $var program. After Configure runs,
86 the value is reset to a plain "$var" and is not useful.
87
88EOE
89 }
90 } else {
91 print "$var ($file{$var}):\n";
92 print @{ $expl{$var} };
93 next symbol;
94 }
95 $gotit = 1;
96 }
97 warn "$0: couldn't find $var\n"
98 if not $gotit and $var !~ /^(Author|Date|Header|Id|Locker|Log|Mcc|RCSfile|Revision|Source|State)$|_cflags$|^config_arg|^PERL_(REVISION|VERSION|SUBVERSION)$/;
99}