3 use File::Compare qw(compare);
4 use File::Copy qw(copy);
6 $name =~ s#^(.*)\.PL$#../$1.SH#;
7 open(SH,"<$name") || die "Cannot open $name:$!";
12 ($term,$file,$pat) = /^sed\s+<<(\S+)\s+>(\S+)\s+(.*)$/;
14 my $str = "sub munge\n{\n";
16 while ($pat =~ s/-e\s+'([^']*)'\s*//)
19 $e =~ s/\\([\(\)])/$1/g;
20 $e =~ s/\\(\d)/\$$1/g;
29 open(H,">$file.new") || die "Cannot open $file.new:$!";
30 binmode H; # no CRs (which cause a spurious rebuild)
34 s/\$([\w_]+)/Config($1)/eg;
35 s/`([^\`]*)`/BackTick($1)/eg;
39 if (/^\s*#define\s+ARCHLIB_EXP/)
41 $_ = "#define ARCHLIB_EXP (win32_perllib_path(ARCHNAME,NULL))\t/**/\n";
43 if (/^\s*#define\s+PRIVLIB_EXP/)
45 $_ = "#define PRIVLIB_EXP (win32_perllib_path(NULL))\t/**/\n"
47 if (/^\s*#define\s+SITEARCH_EXP/)
49 $_ = "#define SITEARCH_EXP (win32_perllib_path(\"site\",ARCHNAME,NULL))\t/**/\n";
51 if (/^\s*#define\s+SITELIB_EXP/)
53 $_ = "#define SITELIB_EXP (win32_perllib_path(\"site\",NULL))\t/**/\n";
57 print H "#include <win32.h>
63 chmod(0666,"../lib/CORE/config.h");
64 copy("$file.new","../lib/CORE/config.h") || die "Cannot copy:$!";
65 chmod(0444,"../lib/CORE/config.h");
67 if (compare("$file.new",$file))
69 warn "$file has changed\n";
72 rename("$file.new",$file);
80 my $val = $Config{$var};
81 $val = 'undef' unless defined $val;
89 if ($cmd =~ /^echo\s+(.*?)\s*\|\s+sed\s+'(.*)'\s*$/)
91 local ($data,$pat) = ($1,$2);
93 eval "\$data =~ $pat";
98 die "Cannot handle \`$cmd\`";