Regen Unicode tables to include a warning:
[p5sagit/p5-mst-13.2.git] / win32 / config_sh.PL
CommitLineData
80252599 1# take a semicolon separated path list and turn it into a quoted
2# list of paths that Text::Parsewords will grok
3sub mungepath {
4 my $p = shift;
5 # remove leading/trailing semis/spaces
6 $p =~ s/^[ ;]+//;
7 $p =~ s/[ ;]+$//;
8 $p =~ s/'/"/g;
9 my @p = map { $_ = "\"$_\"" if /\s/ and !/^".*"$/; $_ } split /;/, $p;
10 return join(' ', @p);
11}
12
137443ea 13my %opt;
14while (@ARGV && $ARGV[0] =~ /^([\w_]+)=(.*)$/)
15 {
16 $opt{$1}=$2;
17 shift(@ARGV);
18 }
7bac28a0 19
52b0428e 20my $pl_h = '../patchlevel.h';
21
10609e9a 22$opt{VERSION} = $];
23$opt{INST_VER} =~ s|~VERSION~|$]|g;
52b0428e 24if (-e $pl_h) {
25 open PL, "<$pl_h" or die "Can't open $pl_h: $!";
26 while (<PL>) {
27 if (/^#\s*define\s+(PERL_\w+)\s+([\d.]+)/) {
28 $opt{$1} = $2;
29 }
30 }
31 close PL;
32}
33elsif ($] =~ /^(\d+)\.(\d\d\d)?(\d\d)?$/) { # should always be true
e1f15930 34 $opt{PERL_REVISION} = $1;
35 $opt{PERL_VERSION} = int($2 || 0);
52b0428e 36 $opt{PERL_SUBVERSION} = $3;
37 $opt{PERL_APIVERSION} = $];
e1f15930 38}
39else {
40 die "Can't parse perl version ($])";
c90c0ff4 41}
42
52b0428e 43$opt{PERL_SUBVERSION} ||= '00';
44
d484a829 45$opt{'cf_by'} = $ENV{USERNAME} unless $opt{'cf_by'};
46$opt{'cf_email'} = $opt{'cf_by'} . '@' . (gethostbyname('localhost'))[0]
47 unless $opt{'cf_email'};
852c2e52 48$opt{'usemymalloc'} = 'y' if $opt{'d_mymalloc'} eq 'define';
d484a829 49
80252599 50$opt{libpth} = mungepath($opt{libpth}) if exists $opt{libpth};
51$opt{incpath} = mungepath($opt{incpath}) if exists $opt{incpath};
52
137443ea 53while (<>)
54 {
55 s/~([\w_]+)~/$opt{$1}/g;
dc050285 56 if (/^([\w_]+)=(.*)$/) {
691c0cce 57 my($k,$v) = ($1,$2);
dc050285 58 # this depends on cf_time being empty in the template (or we'll get a loop)
691c0cce 59 if ($k eq 'cf_time') {
60 $_ = "$k='" . localtime(time) . "'\n" if $v =~ /^\s*'\s*'/;
dc050285 61 }
691c0cce 62 elsif (exists $opt{$k}) {
63 $_ = "$k='$opt{$k}'\n";
dc050285 64 }
65 }
137443ea 66 print;
67 }
68