This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Now I can haz make_set_make back :)
[metaconfig.git] / U / mkglossary
CommitLineData
bc84095b
MB
1#!/usr/bin/perl
2
3use strict;
4use warnings;
9f8747e5 5
959f3c4c
JH
6use File::Basename;
7
8# WARNING: This is site-specific. Change to the location
9# where you have installed dist-3.0PL70.
bc84095b
MB
10my @std_units = glob ("/pro/3gl/CPAN/lib/dist/U/*.U");
11my $PWD = "/pro/3gl/CPAN/perl";
959f3c4c 12
bc84095b
MB
13-d "U" and chdir "U";
14my @perl_units = glob ("$PWD/U/*/*.U");
15push (@perl_units, @std_units);
959f3c4c
JH
16
17# Get the list of config.sh symbols. Be sure this is up to date!
18# (I run the U/mksample script first to be sure.)
bc84095b 19open my $wanted, "< $PWD/Porting/config.sh" or die "$0: open $PWD/Wanted: $!\n";
9f8747e5
MB
20my @WANTED = map { $_->[0] }
21 sort { $a->[1] cmp $b->[1] }
bc84095b
MB
22 map { [ $_, lc $_ ] } <$wanted>;
23close $wanted;
53068161 24
959f3c4c 25print <<'EOM';
cfaaf7e8
JH
26
27!!!!!!! DO NOT EDIT THIS FILE !!!!!!!
28This file is built by metaconfig.
29
959f3c4c
JH
30This file contains a description of all the shell variables whose value is
31determined by the Configure script. Variables intended for use in C
32programs (e.g. I_UNISTD) are already described in config_h.SH. [`configpm'
33generates pod documentation for Config.pm from this file--please try to keep
34the formatting regular.]
35
36EOM
37
bc84095b
MB
38my ($Loc, %expl, %file, %predef);
39foreach my $file (@perl_units) {
40 open my $fh, "< $file" or die "$0: open $file: $!";
41 my $base = basename ($file);
42 $Loc = $file, next if $base eq "Loc.U" and not defined $Loc;
43 my @var;
44 while (<$fh>) {
53068161 45 if (m/^\?S:\w+[ \t:]/ .. m/^\?S:\.$/) {
bc84095b
MB
46 s/[ \t]+$//;
47 if (m/^\?S:.$/) {
48 my ($var) = ((shift @var) =~ /^(\w+)/);
49 unless (exists $expl{$var}) {
50 $expl{$var} = [ @var, "\n" ];
51 $file{$var} = $base;
52 }
53 @var = ();
54 }
55 else {
56 s/^\?S://; # Remove leading ?S: markers.
57 s/^\s+(?=.)/\t/; # Ensure all lines begin with tabs.
58 push @var, $_;
59 }
60 }
959f3c4c 61 }
bc84095b 62 close $fh or die "$0: close $file: $!";
959f3c4c 63 }
959f3c4c 64
bc84095b
MB
65defined $Loc or die "$0: Couldn't locate Loc.U: $!";
66
67open my $fh, "< $Loc" or die "$0: open $Loc: $!";
68while (<$fh>) {
69 m/^\?(\w+):\1$/ and ($expl{$1}, $file{$1}) = (1, "Loc.U");
70 }
71close $fh or die "$0: close $Loc: $!";
959f3c4c 72
bc84095b
MB
73{ local $/ = "\n\n";
74 for (<DATA>) {
75 m/^(\w+)/;
76 $predef{$1} = $_;
77 }
959f3c4c 78 }
959f3c4c 79
bc84095b
MB
80for (@WANTED) {
81 chomp;
82 m/^#/ and next; # Skip comments
83 m/^$/ and next; # Skip empty sections
84 my ($var, $val) = split /=/, $_, 2;
959f3c4c
JH
85
86 if (exists $expl{$var}) {
bc84095b
MB
87 if ($file{$var} eq "Loc.U") {
88 print "$var (Loc.U):\n";
89 if ($val eq "''") {
90 # If we didn't have d_portable, this info might be
91 # useful, but it still won't help with non-standard
92 # stuff if perl is built on one system but installed
93 # on others (this is common with Linux distributions,
94 # for example).
95 print <<EOE;
959f3c4c
JH
96 This variable is defined but not used by Configure.
97 The value is a plain '' and is not useful.
98
99EOE
bc84095b
MB
100 }
101 else {
102 print <<EOE;
17784b92 103 This variable is used internally by Configure to determine the
959f3c4c
JH
104 full pathname (if any) of the $var program. After Configure runs,
105 the value is reset to a plain "$var" and is not useful.
106
107EOE
bc84095b
MB
108 }
109 }
110 else {
111 print "$var ($file{$var}):\n";
112 print @{$expl{$var}};
113 }
114 next;
115 }
116
bdf957e2
JH
117 # Handle special variables from Oldsyms.U. Since these start
118 # with capital letters, metalint considers them to be "special
119 # unit" symbols. It's easier to define them here than to try
120 # to fool metalint any further. --AD 22 Oct 1999
bc84095b
MB
121 if (exists $predef{$var}) {
122 print $predef{$var};
123 next;
124 }
125
126 $var =~ /^(Author|Date|Header|Id|Locker|Log|Mcc|RCSfile|Revision|Source|State)$|_cflags$|^config_arg/
127 or warn "$0: couldn't find $var\n"
128 }
129__END__
bdf957e2
JH
130PERL_REVISION (Oldsyms.U):
131 In a Perl version number such as 5.6.2, this is the 5.
132 This value is manually set in patchlevel.h
133
bdf957e2
JH
134PERL_VERSION (Oldsyms.U):
135 In a Perl version number such as 5.6.2, this is the 6.
136 This value is manually set in patchlevel.h
137
bdf957e2
JH
138PERL_SUBVERSION (Oldsyms.U):
139 In a Perl version number such as 5.6.2, this is the 2.
140 Values greater than 50 represent potentially unstable
141 development subversions.
142 This value is manually set in patchlevel.h
143
bdf957e2
JH
144PERL_APIVERSION (Oldsyms.U):
145 This value is manually set in patchlevel.h and is used
146 to set the Configure apiversion variable.
147
bdf957e2
JH
148CONFIGDOTSH (Oldsyms.U):
149 This is set to 'true' in config.sh so that a shell script
150 sourcing config.sh can tell if it has been sourced already.
151
bc84095b
MB
152PERL_CONFIG_SH (Oldsyms.U):
153 This is set to 'true' in config.sh so that a shell script
154 sourcing config.sh can tell if it has been sourced already.
155
156PERL_API_REVISION (patchlevel.h):
157 This number describes the earliest compatible PERL_REVISION of
158 Perl ("compatibility" here being defined as sufficient binary/API
159 compatibility to run XS code built with the older version).
160 Normally this does not change across maintenance releases.
161 Please read the comment in patchlevel.h.
162
163PERL_API_VERSION (patchlevel.h):
164 This number describes the earliest compatible PERL_VERSION of
165 Perl ("compatibility" here being defined as sufficient binary/API
166 compatibility to run XS code built with the older version).
167 Normally this does not change across maintenance releases.
168 Please read the comment in patchlevel.h.
169
170PERL_API_SUBVERSION (patchlevel.h):
171 This number describes the earliest compatible PERL_SUBVERSION of
172 Perl ("compatibility" here being defined as sufficient binary/API
173 compatibility to run XS code built with the older version).
174 Normally this does not change across maintenance releases.
175 Please read the comment in patchlevel.h.
176
177PERL_PATCHLEVEL (Oldsyms.U):
178 This symbol reflects the patchlevel, if available. Will usually
179 come from the .patch file, which is available when the perl
180 source tree was fetched with rsync.
bdf957e2 181