use $Config{version} rather than $] where appropriate
[p5sagit/p5-mst-13.2.git] / lib / ExtUtils / MM_Win32.pm
index f6d19a2..534f26d 100644 (file)
@@ -36,6 +36,49 @@ $NMAKE = 1 if $Config{'make'} =~ /^nmake/i;
 $PERLMAKE = 1 if $Config{'make'} =~ /^pmake/i;
 $OBJ   = 1 if $Config{'ccflags'} =~ /PERL_OBJECT/i;
 
+# a few workarounds for command.com (very basic)
+{
+    package ExtUtils::MM_Win95;
+
+    # the $^O test may be overkill, but we want to be sure Win32::IsWin95()
+    # exists before we try it
+
+    unshift @MM::ISA, 'ExtUtils::MM_Win95'
+       if ($^O =~ /Win32/ && Win32::IsWin95());
+
+    sub xs_c {
+       my($self) = shift;
+       return '' unless $self->needs_linking();
+       '
+.xs.c:
+       $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) $(XSUBPP) \\
+           $(XSPROTOARG) $(XSUBPPARGS) $*.xs > $*.c
+       '
+    }
+
+    sub xs_cpp {
+       my($self) = shift;
+       return '' unless $self->needs_linking();
+       '
+.xs.cpp:
+       $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) $(XSUBPP) \\
+           $(XSPROTOARG) $(XSUBPPARGS) $*.xs > $*.cpp
+       ';
+    }
+
+    # many makes are too dumb to use xs_c then c_o
+    sub xs_o {
+       my($self) = shift;
+       return '' unless $self->needs_linking();
+       '
+.xs$(OBJ_EXT):
+       $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) $(XSUBPP) \\
+           $(XSPROTOARG) $(XSUBPPARGS) $*.xs > $*.c
+       $(CCCMD) $(CCCDLFLAGS) -I$(PERL_INC) $(DEFINE) $*.c
+       ';
+    }
+}      # end of command.com workarounds
+
 sub dlsyms {
     my($self,%attribs) = @_;
 
@@ -441,6 +484,18 @@ sub dynamic_lib {
     my($inst_dynamic_dep) = $attribs{INST_DYNAMIC_DEP} || "";
     my($ldfrom) = '$(LDFROM)';
     my(@m);
+
+# one thing for GCC/Mingw32:
+# we try to overcome non-relocateable-DLL problems by generating
+#    a (hopefully unique) image-base from the dll's name
+# -- BKS, 10-19-1999
+    if ($GCC) { 
+       my $dllname = $self->{BASEEXT} . "." . $self->{DLEXT};
+       $dllname =~ /(....)(.{0,4})/;
+       my $baseaddr = unpack("n", $1 ^ $2);
+       $otherldflags .= sprintf("-Wl,--image-base,0x%x0000 ", $baseaddr);
+    }
+
     push(@m,'
 # This section creates the dynamically loadable $(INST_DYNAMIC)
 # from $(OBJECT) and possibly $(MYEXTLIB).
@@ -694,12 +749,6 @@ config :: $(INST_AUTODIR)\.exists
        '.$self->{NOECHO}.'$(NOOP)
 ';
 
-    push @m, qq{
-config :: Version_check
-       $self->{NOECHO}\$(NOOP)
-
-} unless $self->{PARENT} or ($self->{PERL_SRC} && $self->{INSTALLDIRS} eq "perl") or $self->{NO_VC};
-
     push @m, $self->dir_target(qw[$(INST_AUTODIR) $(INST_LIBDIR) $(INST_ARCHAUTODIR)]);
 
     if (%{$self->{HTMLLIBPODS}}) {