summaryrefslogtreecommitdiff
path: root/gnu/usr.bin/perl/configpm
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2000-04-06 17:09:19 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2000-04-06 17:09:19 +0000
commit4512cea31c94e21bbf22ca99a5bb525ea7a8c84c (patch)
tree628d1180baf59ff2cf578562cdd942fc008cf06b /gnu/usr.bin/perl/configpm
parente852ed17d905386f3bbad057fda2f07926227f89 (diff)
perl-5.6.0 + local changes
Diffstat (limited to 'gnu/usr.bin/perl/configpm')
-rw-r--r--gnu/usr.bin/perl/configpm60
1 files changed, 45 insertions, 15 deletions
diff --git a/gnu/usr.bin/perl/configpm b/gnu/usr.bin/perl/configpm
index 7dedb9c6af8..3c05a7a8bf3 100644
--- a/gnu/usr.bin/perl/configpm
+++ b/gnu/usr.bin/perl/configpm
@@ -17,21 +17,38 @@ my $glossary = $ARGV[1] || 'Porting/Glossary';
# name of lib paths that should be truncated on ':'
@libpathtrunc = qw(archlib archlibexp privlib privlibexp sitearch sitearchexp
- sitelib sitelibexp);
-
-
+ sitelib sitelibexp);
+# name of lib paths that should be truncated on ':'
+@libpathtrunc = qw(archlib archlibexp privlib privlibexp sitearch sitearchexp
+ sitelib sitelibexp);
open CONFIG, ">$config_pm" or die "Can't open $config_pm: $!\n";
-$myver = $];
+$myver = sprintf "v%vd", $^V;
-print CONFIG <<"ENDOFBEG";
+print CONFIG <<'ENDOFBEG_NOQ', <<"ENDOFBEG";
package Config;
use Exporter ();
-\@ISA = (Exporter);
-\@EXPORT = qw(%Config);
-\@EXPORT_OK = qw(myconfig config_sh config_vars);
+@EXPORT = qw(%Config);
+@EXPORT_OK = qw(myconfig config_sh config_vars);
+
+# Define our own import method to avoid pulling in the full Exporter:
+sub import {
+ my $pkg = shift;
+ @_ = @EXPORT unless @_;
+ my @func = grep {$_ ne '%Config'} @_;
+ local $Exporter::ExportLevel = 1;
+ Exporter::import('Config', @func) if @func;
+ return if @func == @_;
+ my $callpkg = caller(0);
+ *{"$callpkg\::Config"} = \%Config;
+}
+
+ENDOFBEG_NOQ
+die "Perl lib version ($myver) doesn't match executable version (\$])"
+ unless \$^V;
-\$] == $myver
- or die "Perl lib version ($myver) doesn't match executable version (\$])";
+\$^V eq $myver
+ or die "Perl lib version ($myver) doesn't match executable version (" .
+ (sprintf "v%vd",\$^V) . ")";
# This file was created by configpm when Perl was built. Any changes
# made to this file will be lost the next time perl is built.
@@ -49,8 +66,21 @@ $in_v = 0;
while (<>) {
next if m:^#!/bin/sh:;
- # Catch CONFIG=true and PATCHLEVEL=n line from Configure.
+ # Catch CONFIGDOTSH=true and PERL_VERSION=n line from Configure.
s/^(\w+)=(true|\d+)\s*$/$1='$2'\n/;
+ my ($k,$v) = ($1,$2);
+ # grandfather PATCHLEVEL and SUBVERSION and CONFIG
+ if ($k) {
+ if ($k eq 'PERL_VERSION') {
+ push @v_others, "PATCHLEVEL='$v'\n";
+ }
+ elsif ($k eq 'PERL_SUBVERSION') {
+ push @v_others, "SUBVERSION='$v'\n";
+ }
+ elsif ($k eq 'CONFIGDOTSH') {
+ push @v_others, "CONFIG='$v'\n";
+ }
+ }
# We can delimit things in config.sh with either ' or ".
unless ($in_v or m/^(\w+)=(['"])(.*\n)/){
push(@non_v, "#$_"); # not a name='value' line
@@ -75,11 +105,11 @@ print CONFIG "\n",
join("", @v_fast, sort @v_others),
"!END!\n\n";
-# copy config summary format from the myconfig script
+# copy config summary format from the myconfig.SH script
print CONFIG "my \$summary = <<'!END!';\n";
-open(MYCONFIG,"<myconfig") || die "open myconfig failed: $!";
+open(MYCONFIG,"<myconfig.SH") || die "open myconfig.SH failed: $!";
1 while defined($_ = <MYCONFIG>) && !/^Summary of/;
do { print CONFIG $_ } until !defined($_ = <MYCONFIG>) || /^\s*$/;
close(MYCONFIG);
@@ -408,11 +438,11 @@ require $config_pm;
import Config;
die "$0: $config_pm not valid"
- unless $Config{'CONFIG'} eq 'true';
+ unless $Config{'CONFIGDOTSH'} eq 'true';
die "$0: error processing $config_pm"
if defined($Config{'an impossible name'})
- or $Config{'CONFIG'} ne 'true' # test cache
+ or $Config{'CONFIGDOTSH'} ne 'true' # test cache
;
die "$0: error processing $config_pm"