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:$!";
33 s/\$([\w_]+)/Config($1)/eg;
34 s/`([^\`]*)`/BackTick($1)/eg;
38 if (/^\s*#define\s+ARCHLIB_EXP/)
40 $_ = "#define ARCHLIB_EXP (win32PerlLibPath(ARCHNAME,NULL))\t/**/\n";
42 if (/^\s*#define\s+PRIVLIB_EXP/)
44 $_ = "#define PRIVLIB_EXP (win32PerlLibPath(NULL))\t/**/\n"
46 if (/^\s*#define\s+SITEARCH_EXP/)
48 $_ = "#define SITEARCH_EXP (win32PerlLibPath(\"site\",ARCHNAME,NULL))\t/**/\n";
50 if (/^\s*#define\s+SITELIB_EXP/)
52 $_ = "#define SITELIB_EXP (win32PerlLibPath(\"site\",NULL))\t/**/\n";
56 print H "#include <win32.h>
65 chmod(0666,"../lib/CORE/config.h");
66 copy("$file.new","../lib/CORE/config.h") || die "Cannot copy:$!";
67 chmod(0444,"../lib/CORE/config.h");
69 if (compare("$file.new",$file))
71 warn "$file has changed\n";
74 rename("$file.new",$file);
82 my $val = $Config{$var};
83 $val = 'undef' unless defined $val;
91 if ($cmd =~ /^echo\s+(.*?)\s*\|\s+sed\s+'(.*)'\s*$/)
93 local ($data,$pat) = ($1,$2);
95 eval "\$data =~ $pat";
100 die "Cannot handle \`$cmd\`";