This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
integrate ansiperl to get makedef.pl tweak
[perl5.git] / win32 / config_sh.PL
CommitLineData
137443ea 1my %opt;
2while (@ARGV && $ARGV[0] =~ /^([\w_]+)=(.*)$/)
3 {
4 $opt{$1}=$2;
5 shift(@ARGV);
6 }
7bac28a0 7
c90c0ff4 8if ($] =~ /\.(\d\d\d)?(\d\d)?$/) { # should always be true
9 $opt{PATCHLEVEL} = int($1 || 0);
10 $opt{SUBVERSION} = $2 || '00';
11}
12
d484a829
GS
13$opt{'cf_by'} = $ENV{USERNAME} unless $opt{'cf_by'};
14$opt{'cf_email'} = $opt{'cf_by'} . '@' . (gethostbyname('localhost'))[0]
15 unless $opt{'cf_email'};
852c2e52 16$opt{'usemymalloc'} = 'y' if $opt{'d_mymalloc'} eq 'define';
d484a829 17
137443ea 18while (<>)
19 {
20 s/~([\w_]+)~/$opt{$1}/g;
dc050285
GS
21 if (/^([\w_]+)=(.*)$/) {
22 # this depends on cf_time being empty in the template (or we'll get a loop)
23 if ($1 eq 'cf_time') {
24 $_ = "$1='" . localtime(time) . "'\n" if $2 =~ /^\s*'\s*'/;
25 }
26 elsif (exists $opt{$1}) {
27 $_ = "$1='$opt{$1}'\n";
28 }
29 }
137443ea 30 print;
31 }
32