3 use File::Compare qw(compare);
4 use File::Copy qw(copy);
6 $name =~ s#^(.*)\.PL$#../$1.SH#;
8 while (@ARGV && $ARGV[0] =~ /^([\w_]+)=(.*)$/)
14 $opt{CONFIG_H} ||= 'config.h';
16 my $patchlevel = $opt{INST_VER};
17 $patchlevel =~ s|^[\\/]||;
18 $patchlevel =~ s|~VERSION~|$Config{version}|g;
19 $patchlevel ||= $Config{version};
20 $patchlevel = qq["$patchlevel"];
22 open(SH,"<$name") || die "Cannot open $name:$!";
27 ($term,$file,$pat) = /^sed\s+<<(\S+)\s+>(\S+)\s+(.*)$/;
28 $file =~ s/^\$(\w+)$/$opt{$1}/g;
30 my $str = "sub munge\n{\n";
32 while ($pat =~ s/-e\s+'([^']*)'\s*//)
35 $e =~ s/\\([\(\)])/$1/g;
36 $e =~ s/\\(\d)/\$$1/g;
45 open(H,">$file.new") || die "Cannot open $file.new:$!";
46 binmode H; # no CRs (which cause a spurious rebuild)
50 s/\$([\w_]+)/Config($1)/eg;
51 s/`([^\`]*)`/BackTick($1)/eg;
55 if (/^\s*#define\s+(SITELIB|VENDORLIB)_EXP/)
57 $_ = "#define ". $1 . "_EXP (nw_get_". lc($1) . "($patchlevel))\t/**/\n";
59 # Added for NetWare and removed PRIVLIB from the above, the same thing might have
60 # to be done for other as well
61 elsif (/^\s*#define\s+(PRIVLIB)_EXP/)
63 $_ = "#define ". $1 . "_EXP (fnNwGetEnvironmentStr(\"PRIVLIB\", PRIVLIB))\t/**/\n";
65 # incpush() handles archlibs, so disable them
66 elsif (/^\s*#define\s+(ARCHLIB|SITEARCH|VENDORARCH)_EXP/)
68 $_ = "/*#define ". $1 . "_EXP \"\"\t/**/\n";
76 chmod(0666,"../lib/CORE/config.h");
77 copy("$file.new","../lib/CORE/config.h") || die "Cannot copy:$!";
78 chmod(0444,"../lib/CORE/config.h");
80 if (compare("$file.new",$file))
82 warn "$file has changed\n";
85 rename("$file.new",$file);
98 my $val = $Config{$var};
99 $val = 'undef' unless defined $val;
107 if ($cmd =~ /^echo\s+(.*?)\s*\|\s+sed\s+'(.*)'\s*$/)
109 local ($data,$pat) = ($1,$2);
111 eval "\$data =~ $pat";
116 die "Cannot handle \`$cmd\`";