summaryrefslogtreecommitdiff
path: root/configpm
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2012-06-19 16:50:47 +0200
committerNicholas Clark <nick@ccl4.org>2012-07-10 13:08:55 +0200
commitf0b0a4d296551cb3df320db39ea6327996961d9c (patch)
tree09f55944a32b01661cf25e497c6054c0a6177d7f /configpm
parentf711619fd1eeb97e4fd8ecb19fb934b351190e86 (diff)
downloadperl-f0b0a4d296551cb3df320db39ea6327996961d9c.tar.gz
Expand $^O at build time when generating Config::_V()
Config::_V() is how perl -V is implemented internally, and is called called directly from the interpreter's switch passing routine. Hence the value of $^O at runtime will always be the same as the value of $^O at build time, so conditionals dependent on the value of $^O will always take the same execution path. So only generate the relevant code, and hence avoid shipping VMS and Cygwin specific code except on those platforms. (But add a sanity test in Config::_V() to ensure that the runtime $^O has the correct value - ie that the Perl code and the perl binary correspond.)
Diffstat (limited to 'configpm')
-rwxr-xr-xconfigpm19
1 files changed, 10 insertions, 9 deletions
diff --git a/configpm b/configpm
index ec81bfc8cf..6ea7419852 100755
--- a/configpm
+++ b/configpm
@@ -149,7 +149,10 @@ die "Can't automatically determine name for Config_heavy.pl from '$Config_PM'"
my $config_txt;
my $heavy_txt;
-$heavy_txt .= sprintf <<'ENDOFBEG';
+my $from = $^O eq 'VMS' ? 'PERLSHR image' : 'binary (from libperl)';
+my $env_cygwin = $^O eq 'cygwin'
+ ? 'push @env, "CYGWIN=\"$ENV{CYGWIN}\"" if $ENV{CYGWIN};' . "\n" : "";
+$heavy_txt .= sprintf <<'ENDOFBEG', $^O, $^O, $from, $^O, $env_cygwin;
# 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.
@@ -176,6 +179,9 @@ sub local_patches {
}
sub _V {
+ die "Perl lib was built for '%s' but is being run on '$^O'"
+ unless "%s" eq $^O;
+
my ($bincompat, $non_bincompat, $date, @patches) = Internals::V();
my $opts = join ' ', sort split ' ', "$bincompat $non_bincompat";
@@ -185,11 +191,7 @@ sub _V {
$opts =~ s/(?=.{53})(.{1,53}) /$1\n /mg;
print Config::myconfig();
- if ($^O eq 'VMS') {
- print "\nCharacteristics of this PERLSHR image: \n";
- } else {
- print "\nCharacteristics of this binary (from libperl): \n";
- }
+ print "\nCharacteristics of this %s: \n";
print " Compile-time options: $opts\n";
@@ -198,13 +200,12 @@ sub _V {
print "\t$_\n" foreach @patches;
}
- print " Built under $^O\n";
+ print " Built under %s\n";
print " $date\n" if defined $date;
my @env = map { "$_=\"$ENV{$_}\"" } sort grep {/^PERL/} keys %%ENV;
- push @env, "CYGWIN=\"$ENV{CYGWIN}\"" if $^O eq 'cygwin' and $ENV{CYGWIN};
-
+%s
if (@env) {
print " \%%ENV:\n";
print " $_\n" foreach @env;