This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Continue qgcvt work; closer now but not yet there.
[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';
bdf957e2
JH
8# @std_units = glob('/opt/dist/lib/U/*.U');
9# $PWD = '/export/home/doughera/src/perl/p4perl';
959f3c4c
JH
10
11chdir U if -d './U';
12@perl_units = glob("$PWD/U/*/*.U");
13push(@perl_units, @std_units);
14
15# Get the list of config.sh symbols. Be sure this is up to date!
16# (I run the U/mksample script first to be sure.)
17open(WANTED, "sort $PWD/Porting/config.sh|") || die "$0: open $PWD/Wanted: $!\n";
18
19print <<'EOM';
20This file contains a description of all the shell variables whose value is
21determined by the Configure script. Variables intended for use in C
22programs (e.g. I_UNISTD) are already described in config_h.SH. [`configpm'
23generates pod documentation for Config.pm from this file--please try to keep
24the formatting regular.]
25
26EOM
27
28foreach $file (@perl_units) {
29 open(FH, "<$file") || die "$0: open $file: $!";
30 my $base = basename($file);
31 $Loc = $file, next if $base eq 'Loc.U' and not defined $Loc;
32 while (<FH>) {
33 if (/^\?S:\w+[ \t:]/ .. /^\?S:.$/) {
34 if (/^\?S:.$/) {
35 ($var) = ((shift @var) =~ /^(\w+)/);
36 unless (exists $expl{$var}) {
37 $expl{$var} = [ @var, "\n" ];
38 $file{$var} = $base;
39 }
40 @var = ();
41 } else {
42 s/^\?S://; # Remove leading ?S: markers.
43 s/^\s+/\t/; # Ensure all lines begin with tabs.
44 push @var, $_;
45 }
46 }
47 }
48 close(FH) || die "$0: close $file: $!";
49}
50
51die "$0: Couldn't locate Loc.U: $!" unless defined $Loc;
52
53open(FH, "<$Loc") || die "$0: open $Loc: $!";
54while (<FH>) {
55 if (/^\?(\w+):\1$/) {
56 $var = $1;
57 $expl{$var} = 1;
58 $file{$var} = 'Loc.U';
59 }
60}
61close(FH) || die "$0: close $Loc: $!";
62
63symbol: while (defined($var = <WANTED>)) {
64 chomp $var;
65 next symbol if $var =~ /^#/; # Skip comments
66 next symbol if $var =~ /^$/;
67 ($var, $val) = split(/=/, $var, 2);
68 $gotit = 0;
69
70 if (exists $expl{$var}) {
71 if ($file{$var} eq 'Loc.U') {
72 print "$var (Loc.U):\n";
73 if ($val eq "''") {
74 # If we didn't have d_portable, this info might be
75 # useful, but it still won't help with non-standard
76 # stuff if perl is built on one system but installed
77 # on others (this is common with Linux distributions,
78 # for example).
79 print <<EOE;
80 This variable is defined but not used by Configure.
81 The value is a plain '' and is not useful.
82
83EOE
84 } else {
85 print <<EOE;
17784b92 86 This variable is used internally by Configure to determine the
959f3c4c
JH
87 full pathname (if any) of the $var program. After Configure runs,
88 the value is reset to a plain "$var" and is not useful.
89
90EOE
91 }
92 } else {
93 print "$var ($file{$var}):\n";
94 print @{ $expl{$var} };
95 next symbol;
96 }
97 $gotit = 1;
98 }
bdf957e2
JH
99 # Handle special variables from Oldsyms.U. Since these start
100 # with capital letters, metalint considers them to be "special
101 # unit" symbols. It's easier to define them here than to try
102 # to fool metalint any further. --AD 22 Oct 1999
103 elsif ($var eq 'PERL_REVISION') {
104 $gotit = 1;
105 print <<'EOE';
106PERL_REVISION (Oldsyms.U):
107 In a Perl version number such as 5.6.2, this is the 5.
108 This value is manually set in patchlevel.h
109
110EOE
111 }
112 elsif ($var eq 'PERL_VERSION') {
113 $gotit = 1;
114 print <<'EOE';
115PERL_VERSION (Oldsyms.U):
116 In a Perl version number such as 5.6.2, this is the 6.
117 This value is manually set in patchlevel.h
118
119EOE
120 }
121 elsif ($var eq 'PERL_SUBVERSION') {
122 $gotit = 1;
123 print <<'EOE';
124PERL_SUBVERSION (Oldsyms.U):
125 In a Perl version number such as 5.6.2, this is the 2.
126 Values greater than 50 represent potentially unstable
127 development subversions.
128 This value is manually set in patchlevel.h
129
130EOE
131 }
132 elsif ($var eq 'PERL_APIVERSION') {
133 $gotit = 1;
134 print <<'EOE';
135PERL_APIVERSION (Oldsyms.U):
136 This value is manually set in patchlevel.h and is used
137 to set the Configure apiversion variable.
138
139EOE
140 }
141 elsif ($var eq 'CONFIGDOTSH') {
142 $gotit = 1;
143 print <<'EOE';
144CONFIGDOTSH (Oldsyms.U):
145 This is set to 'true' in config.sh so that a shell script
146 sourcing config.sh can tell if it has been sourced already.
147
148EOE
149 }
150
959f3c4c 151 warn "$0: couldn't find $var\n"
bdf957e2 152 if not $gotit and $var !~ /^(Author|Date|Header|Id|Locker|Log|Mcc|RCSfile|Revision|Source|State)$|_cflags$|^config_arg/;
959f3c4c 153}