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