MM_Win32::maybe_command() case-insesitivity tweak
[p5sagit/p5-mst-13.2.git] / lib / ExtUtils / MM_Win32.pm
index 299855b..7894ddd 100644 (file)
@@ -67,7 +67,21 @@ sub replace_manpage_separator {
 
 sub maybe_command {
     my($self,$file) = @_;
-    return "$file.exe" if -e "$file.exe";
+    my @e = exists($ENV{'PATHEXT'})
+          ? split(/;/, $ENV{PATHEXT})
+         : qw(.com .exe .bat .cmd);
+    my $e = '';
+    for (@e) { $e .= "\Q$_\E|" }
+    chop $e;
+    # see if file ends in one of the known extensions
+    if ($file =~ /($e)$/i) {
+       return $file if -e $file;
+    }
+    else {
+       for (@e) {
+           return "$file$_" if -e "$file$_";
+       }
+    }
     return;
 }
 
@@ -163,12 +177,12 @@ sub init_others
   {
    $self->{'LDLOADLIBS'}
       ||= ( $BORLAND
-            ? 'import32.lib cw32mti.lib '
+            ? 'import32.lib'
             : # compiler adds msvcrtd?.lib according to debug switches
                'oldnames.lib kernel32.lib comdlg32.lib winspool.lib gdi32.lib '
              .'advapi32.lib user32.lib shell32.lib netapi32.lib ole32.lib '
-             .'oleaut32.lib uuid.lib wsock32.lib mpr.lib winmm.lib version.lib '
-       ) . ' odbc32.lib odbccp32.lib';
+             .'oleaut32.lib uuid.lib wsock32.lib mpr.lib winmm.lib version.lib'
+       ) . ' $(LIBC) odbc32.lib odbccp32.lib';
   }
  $self->{'DEV_NULL'} = '> NUL';
  # $self->{'NOECHO'} = ''; # till we have it working
@@ -452,13 +466,10 @@ sub perl_archive
     my ($self) = @_;
     if($OBJ) {
         if ($self->{CAPI} eq 'TRUE') {
-            return '$(PERL_INC)\PerlCAPI$(LIB_EXT)';
-        }
-        else {
-            return '$(PERL_INC)\perlcore$(LIB_EXT)';
+            return '$(PERL_INC)\perlCAPI$(LIB_EXT)';
         }
     }
-    return '$(PERL_INC)\perl$(LIB_EXT)';
+    return '$(PERL_INC)\\'.$Config{'libperl'};
 }
 
 sub export_list
@@ -721,6 +732,7 @@ We don't want manpage process.  XXX add pod2html support later.
 =cut
 
 sub manifypods {
+    my($self) = shift;
     return "\nmanifypods :\n\t$self->{NOECHO}\$(NOOP)\n";
 }