Munge pseudo-Configure stuff to add -thread to archname as
[p5sagit/p5-mst-13.2.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
acbc2db6 8$opt{'archname'} = 'MSWin32';
9if (defined $ENV{'PROCESSOR_ARCHITECTURE'})
10 {
11 $opt{'archname'} .= '-'.$ENV{'PROCESSOR_ARCHITECTURE'};
12 }
13
14if ($opt{'ccflags'} =~ /USE_THREADS/)
15 {
16 $opt{'archname'} .= '-thread';
17 }
18
c90c0ff4 19if ($] =~ /\.(\d\d\d)?(\d\d)?$/) { # should always be true
20 $opt{PATCHLEVEL} = int($1 || 0);
21 $opt{SUBVERSION} = $2 || '00';
22}
23
d484a829 24$opt{'cf_by'} = $ENV{USERNAME} unless $opt{'cf_by'};
25$opt{'cf_email'} = $opt{'cf_by'} . '@' . (gethostbyname('localhost'))[0]
26 unless $opt{'cf_email'};
27
137443ea 28while (<>)
29 {
30 s/~([\w_]+)~/$opt{$1}/g;
dc050285 31 if (/^([\w_]+)=(.*)$/) {
32 # this depends on cf_time being empty in the template (or we'll get a loop)
33 if ($1 eq 'cf_time') {
34 $_ = "$1='" . localtime(time) . "'\n" if $2 =~ /^\s*'\s*'/;
35 }
36 elsif (exists $opt{$1}) {
37 $_ = "$1='$opt{$1}'\n";
38 }
39 }
137443ea 40 print;
41 }
42