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|^[\\/]||;
16 $patchlevel =~ s|~VERSION~|$Config{version}|g;
17 $patchlevel ||= $Config{version};
18 $patchlevel = qq["$patchlevel"];
20 open(SH,"<$name") || die "Cannot open $name:$!";
25 ($term,$file,$pat) = /^sed\s+<<(\S+)\s+>(\S+)\s+(.*)$/;
27 my $str = "sub munge\n{\n";
29 while ($pat =~ s/-e\s+'([^']*)'\s*//)
32 $e =~ s/\\([\(\)])/$1/g;
33 $e =~ s/\\(\d)/\$$1/g;
42 open(H,">$file.new") || die "Cannot open $file.new:$!";
43 binmode H; # no CRs (which cause a spurious rebuild)
47 s/\$([\w_]+)/Config($1)/eg;
48 s/`([^\`]*)`/BackTick($1)/eg;
52 if (/^\s*#define\s+(PRIVLIB|SITELIB)_EXP/)
54 $_ = "#define ". $1 . "_EXP (win32_get_". lc($1) . "($patchlevel))\t/**/\n";
56 # incpush() handles archlibs, so disable them
57 elsif (/^\s*#define\s+(ARCHLIB|SITEARCH)_EXP/)
59 $_ = "/*#define ". $1 . "_EXP \"\"\t/**/\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\`";