3 use File::Compare qw(compare);
4 use File::Copy qw(copy);
5 my $OBJ = 1 if $Config{'ccflags'} =~ /PERL_OBJECT/i;
7 $name =~ s#^(.*)\.PL$#../$1.SH#;
9 while (@ARGV && $ARGV[0] =~ /^([\w_]+)=(.*)$/)
14 my $patchlevel = $opt{INST_VER};
15 $patchlevel = s|^[\\/]||;
17 $patchlevel = qq["$patchlevel"];
19 open(SH,"<$name") || die "Cannot open $name:$!";
24 ($term,$file,$pat) = /^sed\s+<<(\S+)\s+>(\S+)\s+(.*)$/;
26 my $str = "sub munge\n{\n";
28 while ($pat =~ s/-e\s+'([^']*)'\s*//)
31 $e =~ s/\\([\(\)])/$1/g;
32 $e =~ s/\\(\d)/\$$1/g;
41 open(H,">$file.new") || die "Cannot open $file.new:$!";
42 binmode H; # no CRs (which cause a spurious rebuild)
46 s/\$([\w_]+)/Config($1)/eg;
47 s/`([^\`]*)`/BackTick($1)/eg;
51 if (/^\s*#define\s+(PRIVLIB|SITELIB)_EXP/)
53 $_ = "#define ". $1 . "_EXP (win32_get_". lc($1) . "($patchlevel))\t/**/\n";
55 # incpush() handles archlibs, so disable them
56 elsif (/^\s*#define\s+(ARCHLIB|SITEARCH)_EXP/)
58 $_ = "/*#define ". $1 . "_EXP \"\"\t/**/\n";
62 print H "#include <win32.h>\n";
67 chmod(0666,"../lib/CORE/config.h");
68 copy("$file.new","../lib/CORE/config.h") || die "Cannot copy:$!";
69 chmod(0444,"../lib/CORE/config.h");
71 if (!$OBJ && compare("$file.new",$file))
73 warn "$file has changed\n";
76 rename("$file.new",$file);
89 my $val = $Config{$var};
90 $val = 'undef' unless defined $val;
98 if ($cmd =~ /^echo\s+(.*?)\s*\|\s+sed\s+'(.*)'\s*$/)
100 local ($data,$pat) = ($1,$2);
102 eval "\$data =~ $pat";
107 die "Cannot handle \`$cmd\`";