This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
fix RT#88840, don't terminate a child fork psuedo process in DLL Loader Lock
[perl5.git] / make_ext.pl
index 399bd41..3254628 100644 (file)
@@ -281,6 +281,28 @@ sub build_extension {
        $makefile = 'Makefile';
     }
     
+    if (-f $makefile) {
+       open my $mfh, $makefile or die "Cannot open $makefile: $!";
+       while (<$mfh>) {
+           # Plagiarised from CPAN::Distribution
+           last if /MakeMaker post_initialize section/;
+           next unless /^#\s+VERSION_FROM\s+=>\s+(.+)/;
+           my $vmod = eval $1;
+           my $oldv;
+           while (<$mfh>) {
+               next unless /^XS_VERSION = (\S+)/;
+               $oldv = $1;
+               last;
+           }
+           last unless defined $oldv;
+           require ExtUtils::MM_Unix;
+           defined (my $newv = parse_version MM $vmod) or last;
+           if ($newv ne $oldv) {
+               1 while unlink $makefile
+           }
+       }
+    }
+
     if (!-f $makefile) {
        if (!-f 'Makefile.PL') {
            print "\nCreating Makefile.PL in $ext_dir for $mname\n";
@@ -449,8 +471,11 @@ EOS
     }
 
     if ($is_VMS) {
-       _macroify_passthrough($pass_through);
-       unshift @$pass_through, "/DESCRIPTION=$makefile";
+       _quote_args($pass_through);
+       @$pass_through = (
+                         "/DESCRIPTION=$makefile",
+                         '/MACRO=(' . join(',',@$pass_through) . ')'
+                        );
     }
 
     if (!$target or $target !~ /clean$/) {
@@ -478,11 +503,3 @@ sub _quote_args {
     } @{$args}
     ;
 }
-
-sub _macroify_passthrough {
-    my $passthrough = shift;
-    _quote_args($passthrough);
-    my $macro = '/MACRO=(' . join(',',@$passthrough) . ')';
-    @$passthrough = ();
-    @$passthrough[0] = $macro;  
-}