warn "Writing $opt{CONFIG_H}\n";
-open(SH,"<$name") || die "Cannot open $name:$!";
+open(SH, "<", $name) || die "Cannot open $name:$!";
while (<SH>)
{
last if /^\s*sed/;
die "$str:$@" if $@;
-open(H,">$file.new") || die "Cannot open $file.new:$!";
+open(H, ">", "$file.new") || die "Cannot open $file.new:$!";
binmode(H);
while (<SH>)
{
s#(.)/\*\*/#$1/ **/# if(/^\/\*/); #avoid "/*" inside comments
if (/^\s*#define\s+(PRIVLIB|SITELIB|VENDORLIB)_EXP/)
{
- $_ = "#define ". $1 . "_EXP (win32_get_". lc($1) . "(PERL_VERSION_STRING, NULL))\t/**/\n";
+ $_ = '#define '. $1 . '_EXP ('.(
+ $1 eq 'PRIVLIB' ? 'PerlEnv_lib_path' :
+ $1 eq 'SITELIB' ? 'PerlEnv_sitelib_path' :
+ $1 eq 'VENDORLIB' ? 'PerlEnv_vendorlib_path' :
+ die "unknown *LIB_EXP define \"$1\""
+ ). "(PERL_VERSION_STRING, NULL))\t/**/\n";
}
# incpush() handles archlibs, so disable them
elsif (/^\s*#define\s+(ARCHLIB|SITEARCH|VENDORARCH)_EXP/)
close(H);
close(SH);
-
-chmod(0666,"$opt{CORE_DIR}/$opt{CONFIG_H}");
-copy("$file.new","$opt{CORE_DIR}/$opt{CONFIG_H}") || die "Cannot copy:$!";
-chmod(0444,"$opt{CORE_DIR}/$opt{CONFIG_H}");
+my $core_config_h = "$opt{CORE_DIR}/$opt{CONFIG_H}";
+if (compare("$file.new", $core_config_h)) {
+ mkdir $opt{CORE_DIR} unless -d $opt{CORE_DIR};
+ chmod(0666,$core_config_h);
+ copy("$file.new",$core_config_h) || die "Cannot copy:$!";
+ chmod(0444,$core_config_h);
+}
if (compare("$file.new",$file))
{
warn "$file has changed\n";
chmod(0666,$file);
unlink($file);
- rename("$file.new",$file);
- exit(1);
+ rename("$file.new",$file) || die "Cannot rename:$!";
}
else
{
unlink ("$file.new");
- exit(0);
}
sub Config