configpm revision 7c478bd95313f5f23a4c958a745db2134aa03244
592fd47a6245508b79fe6ac819fe6d3b2c1289beSerge Hallyn#!./miniperl -w
592fd47a6245508b79fe6ac819fe6d3b2c1289beSerge Hallyn# list names to put first (and hence lookup fastest)
592fd47a6245508b79fe6ac819fe6d3b2c1289beSerge Hallyn@fast = qw(archname osname osvers prefix libs libpth
592fd47a6245508b79fe6ac819fe6d3b2c1289beSerge Hallyn privlibexp archlibexp installprivlib installarchlib
592fd47a6245508b79fe6ac819fe6d3b2c1289beSerge Hallyn# names of things which may need to have slashes changed to double-colons
592fd47a6245508b79fe6ac819fe6d3b2c1289beSerge Hallyn@extensions = qw(dynamic_ext static_ext extensions known_extensions);
592fd47a6245508b79fe6ac819fe6d3b2c1289beSerge Hallynopen CONFIG, ">$config_pm" or die "Can't open $config_pm: $!\n";
592fd47a6245508b79fe6ac819fe6d3b2c1289beSerge Hallyn@EXPORT_OK = qw(myconfig config_sh config_vars);
592fd47a6245508b79fe6ac819fe6d3b2c1289beSerge Hallyn# Define our own import method to avoid pulling in the full Exporter:
592fd47a6245508b79fe6ac819fe6d3b2c1289beSerge Hallyn return if @func == @_;
592fd47a6245508b79fe6ac819fe6d3b2c1289beSerge Hallyndie "Perl lib version ($myver) doesn't match executable version (\$])"
592fd47a6245508b79fe6ac819fe6d3b2c1289beSerge Hallyn or die "Perl lib version ($myver) doesn't match executable version (" .
592fd47a6245508b79fe6ac819fe6d3b2c1289beSerge Hallyn# This file was created by configpm when Perl was built. Any changes
592fd47a6245508b79fe6ac819fe6d3b2c1289beSerge Hallyn# made to this file will be lost the next time perl is built.
592fd47a6245508b79fe6ac819fe6d3b2c1289beSerge Hallyn # Catch CONFIGDOTSH=true and PERL_VERSION=n line from Configure.
592fd47a6245508b79fe6ac819fe6d3b2c1289beSerge Hallyn # grandfather PATCHLEVEL and SUBVERSION and CONFIG
592fd47a6245508b79fe6ac819fe6d3b2c1289beSerge Hallyn # We can delimit things in config.sh with either ' or ".
592fd47a6245508b79fe6ac819fe6d3b2c1289beSerge Hallyn $quote = $2;
592fd47a6245508b79fe6ac819fe6d3b2c1289beSerge Hallyn if ($in_v) { $val .= $_; }
592fd47a6245508b79fe6ac819fe6d3b2c1289beSerge Hallyn else { ($name,$val) = ($1,$3); }
592fd47a6245508b79fe6ac819fe6d3b2c1289beSerge Hallyn $in_v = $val !~ /$quote\n/;
592fd47a6245508b79fe6ac819fe6d3b2c1289beSerge Hallyn next if $in_v;
592fd47a6245508b79fe6ac819fe6d3b2c1289beSerge Hallyn if ($extensions{$name}) { s,/,::,g }
592fd47a6245508b79fe6ac819fe6d3b2c1289beSerge Hallyn if (!$fast{$name}){ push(@v_others, "$name=$quote$val"); next; }
# copy config summary format from the myconfig.SH script
open(MYCONFIG,"<myconfig.SH") || die "open myconfig.SH failed: $!";
my $t = $Config{ivtype};
my $s = $Config{ivsize};
$value = join('', unpack('a'x$s, pack($f, $i)));
$value = '?'x$s;
my $withlargefiles = $Config{$key};
if ($key =~ /^(?:cc|ld)flags_/) {
$value =~ s/\Q$withlargefiles\E\b//;
} elsif ($key =~ /^libs/) {
my @lflibswanted = split(' ', $Config{libswanted_uselargefiles});
if ($key =~ /^libs_/) {
not exists $lflibswanted{$1} }
split(' ', $Config{libs});
$Config{libs} = join(' ', @libs);
} elsif ($key =~ /^libswanted_/) {
my @libswanted = grep { not exists $lflibswanted{$_} }
split(' ', $Config{libswanted});
$Config{libswanted} = join(' ', @libswanted);
# return undef unless (($value) = $config_sh =~ m/^$_[1]='(.*)'\s*$/m);
$value =~ s/\$/\\\$/g;
$value =~ s/\@/\\\@/g;
return $value;
my $prevpos = 0;
$prevpos = 0;
my $re = shift;
my %preconfig;
# avoid Config..Exporter..UNIVERSAL search for DESTROY then AUTOLOAD
use Config;
=over 4
=back
The values stored in config.sh may be either single-quoted or
$text = 0;
my $c = substr $1, 0, 1;
$text = 1;
(?! e \. g \. ) # Not e.g.
print CONFIG;
=back
=cut
# Now do some simple tests on the Config.pm file we have created
require $config_pm;