+
+my %seen_quotes;
+{
+ my ($name, $val);
+ open(CONFIG_SH, 'config.sh') || die "Can't open config.sh: $!";
+ while (<CONFIG_SH>) {
+ next if m:^#!/bin/sh:;
+
+ # Catch PERL_CONFIG_SH=true and PERL_VERSION=n line from Configure.
+ s/^(\w+)=(true|\d+)\s*$/$1='$2'\n/ or m/^(\w+)='(.*)'$/;
+ 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 'PERL_CONFIG_SH') {
+ 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
+ next;
+ }
+ my $quote = $2;
+ if ($in_v) {
+ $val .= $_;
+ }
+ else {
+ ($name,$val) = ($1,$3);
+ }
+ $in_v = $val !~ /$quote\n/;
+ next if $in_v;
+
+ s,/,::,g if $Extensions{$name};
+
+ $val =~ s/$quote\n?\z//;
+
+ my $line = "$name=$quote$val$quote\n";
+ push(@v_others, $line);
+ $seen_quotes{$quote}++;
+ }
+ close CONFIG_SH;
+}
+