A more general fix to non-threaded static extension build problems
Steve Hay [Wed, 16 May 2007 08:26:09 +0000 (08:26 +0000)]
than #31220 was.

p4raw-id: //depot/perl@31229

ext/Win32CORE/Makefile.PL
lib/ExtUtils/MM_Win32.pm

index c2620e7..0fec306 100644 (file)
@@ -2,6 +2,5 @@ use ExtUtils::MakeMaker;
 
 WriteMakefile(
     'NAME'             => 'Win32CORE',
-    'DEFINE'           => '-DPERLDLL -DPERL_CORE',
     'VERSION_FROM'     => 'Win32CORE.pm',
 );
index 75d01ca..a78bc6c 100644 (file)
@@ -534,6 +534,34 @@ sub os_flavor {
 }
 
 
+=item cflags
+
+Defines the PERLDLL symbol if we are configured for static building since all
+code destined for the perl5xx.dll must be compiled with the PERLDLL symbol
+defined.
+
+=cut
+
+sub cflags {
+    my($self,$libperl)=@_;
+    return $self->{CFLAGS} if $self->{CFLAGS};
+    return '' unless $self->needs_linking();
+
+    my $base = $self->SUPER::cflags($libperl);
+    foreach (split /\n/, $base) {
+        /^(\S*)\s*=\s*(\S*)$/ and $self->{$1} = $2;
+    };
+    $self->{CCFLAGS} .= " -DPERLDLL" if ($self->{LINKTYPE} eq 'static');
+
+    return $self->{CFLAGS} = qq{
+CCFLAGS = $self->{CCFLAGS}
+OPTIMIZE = $self->{OPTIMIZE}
+PERLTYPE = $self->{PERLTYPE}
+};
+
+}
+
+
 1;
 __END__