Major changes to the DOS/djgpp port (including threading):
[p5sagit/p5-mst-13.2.git] / lib / ExtUtils / MM_Unix.pm
index ca952c8..6703245 100644 (file)
@@ -1,18 +1,23 @@
 package ExtUtils::MM_Unix;
 
-$VERSION = substr q$Revision: 1.1.1.1 $, 10;
-# $Id: MM_Unix.pm,v 1.1.1.1 1997/01/11 12:48:52 mbeattie Exp $
-
-require Exporter;
+use Exporter ();
 use Config;
 use File::Basename qw(basename dirname fileparse);
 use DirHandle;
+use strict;
+use vars qw($VERSION $Is_Mac $Is_OS2 $Is_VMS $Is_Win32 $Is_Dos
+           $Verbose %pm %static $Xsubpp_Version);
+
+$VERSION = substr q$Revision: 1.118 $, 10;
+# $Id: MM_Unix.pm,v 1.118 1997/08/01 09:42:52 k Exp $
 
 Exporter::import('ExtUtils::MakeMaker',
        qw( $Verbose &neatvalue));
 
-$Is_OS2 = $^O =~ m|^os/?2$|i;
-$Is_Mac = $^O eq "MacOS";
+$Is_OS2 = $^O eq 'os2';
+$Is_Mac = $^O eq 'MacOS';
+$Is_Win32 = $^O eq 'MSWin32';
+$Is_Dos = $^O eq 'dos';
 
 if ($Is_VMS = $^O eq 'VMS') {
     require VMS::Filespec;
@@ -40,8 +45,8 @@ overrides by defining rather primitive operations within
 ExtUtils::MM_Unix.
 
 If you are going to write a platform specific MM package, please try
-to limit the necessary overrides to primitiv methods, and if it is not
-possible to do so, let's work it out how to achieve that gain.
+to limit the necessary overrides to primitive methods, and if it is not
+possible to do so, let's work out how to achieve that gain.
 
 If you are overriding any of these methods in your Makefile.PL (in the
 MY class), please report that to the makemaker mailing list. We are
@@ -97,12 +102,12 @@ sub catdir {
     my @args = @_;
     for (@args) {
        # append a slash to each argument unless it has one there
-       $_ .= "/" unless substr($_,length($_)-1,1) eq "/";
+       $_ .= "/" if $_ eq '' or substr($_,-1) ne "/";
     }
     my $result = join('', @args);
     # remove a trailing slash unless we are root
-    substr($result,length($result)-1,1) = ""
-       if length($result) > 1 && substr($result,length($result)-1,1) eq "/";
+    substr($result,-1) = ""
+       if length($result) > 1 && substr($result,-1) eq "/";
     $result;
 }
 
@@ -173,9 +178,11 @@ sub ExtUtils::MM_Unix::dynamic ;
 sub ExtUtils::MM_Unix::dynamic_bs ;
 sub ExtUtils::MM_Unix::dynamic_lib ;
 sub ExtUtils::MM_Unix::exescan ;
+sub ExtUtils::MM_Unix::export_list ;
 sub ExtUtils::MM_Unix::extliblist ;
 sub ExtUtils::MM_Unix::file_name_is_absolute ;
 sub ExtUtils::MM_Unix::find_perl ;
+sub ExtUtils::MM_Unix::fixin ;
 sub ExtUtils::MM_Unix::force ;
 sub ExtUtils::MM_Unix::guess_name ;
 sub ExtUtils::MM_Unix::has_link_code ;
@@ -198,6 +205,7 @@ sub ExtUtils::MM_Unix::nicetext ;
 sub ExtUtils::MM_Unix::parse_version ;
 sub ExtUtils::MM_Unix::pasthru ;
 sub ExtUtils::MM_Unix::path ;
+sub ExtUtils::MM_Unix::perl_archive;
 sub ExtUtils::MM_Unix::perl_script ;
 sub ExtUtils::MM_Unix::perldepend ;
 sub ExtUtils::MM_Unix::pm_to_blib ;
@@ -227,13 +235,18 @@ sub ExtUtils::MM_Unix::xsubpp_version ;
 
 package ExtUtils::MM_Unix;
 
-#use SelfLoader;
+use SelfLoader;
 
 1;
-#__DATA__
+
+__DATA__
+
+=back
 
 =head2 SelfLoaded methods
 
+=over 2
+
 =item c_o (o)
 
 Defines the suffix rules to compile different flavors of C files to
@@ -250,10 +263,12 @@ sub c_o {
     push @m, '
 .c$(OBJ_EXT):
        $(CCCMD) $(CCCDLFLAGS) -I$(PERL_INC) $(DEFINE) $*.c
-
+';
+    push @m, '
 .C$(OBJ_EXT):
        $(CCCMD) $(CCCDLFLAGS) -I$(PERL_INC) $(DEFINE) $*.C
-
+' if $^O ne 'os2' and $^O ne 'MSWin32' and $^O ne 'dos'; #Case-specific
+    push @m, '
 .cpp$(OBJ_EXT):
        $(CCCMD) $(CCCDLFLAGS) -I$(PERL_INC) $(DEFINE) $*.cpp
 
@@ -385,7 +400,7 @@ clean ::
 ');
     # clean subdirectories first
     for $dir (@{$self->{DIR}}) {
-       push @m, "\t-cd $dir && test -f $self->{MAKEFILE} && \$(MAKE) clean\n";
+       push @m, "\t-cd $dir && \$(TEST_F) $self->{MAKEFILE} && \$(MAKE) clean\n";
     }
 
     my(@otherfiles) = values %{$self->{XS}}; # .c files from *.xs files
@@ -399,7 +414,7 @@ clean ::
     push @m, "\t-$self->{RM_RF} @otherfiles\n";
     # See realclean and ext/utils/make_ext for usage of Makefile.old
     push(@m,
-        "\t-$self->{MV} $self->{MAKEFILE} $self->{MAKEFILE}.old 2>/dev/null\n");
+        "\t-$self->{MV} $self->{MAKEFILE} $self->{MAKEFILE}.old \$(DEV_NULL)\n");
     push(@m,
         "\t$attribs{POSTOP}\n")   if $attribs{POSTOP};
     join("", @m);
@@ -486,7 +501,7 @@ sub constants {
 
              AR_STATIC_ARGS NAME DISTNAME NAME_SYM VERSION
              VERSION_SYM XS_VERSION INST_BIN INST_EXE INST_LIB
-             INST_ARCHLIB INST_SCRIPT PREFIX INSTALLDIRS
+             INST_ARCHLIB INST_SCRIPT PREFIX  INSTALLDIRS
              INSTALLPRIVLIB INSTALLARCHLIB INSTALLSITELIB
              INSTALLSITEARCH INSTALLBIN INSTALLSCRIPT PERL_LIB
              PERL_ARCHLIB SITELIBEXP SITEARCHEXP LIBPERL_A MYEXTLIB
@@ -590,20 +605,11 @@ INST_BOOT    =
 ';
     }
 
-    if ($Is_OS2) {
-       $tmp = "$self->{BASEEXT}.def";
-    } else {
-       $tmp = "";
-    }
+    $tmp = $self->export_list;
     push @m, "
 EXPORT_LIST = $tmp
 ";
-
-    if ($Is_OS2) {
-       $tmp = "\$(PERL_INC)/libperl\$(LIB_EXT)";
-    } else {
-       $tmp = "";
-    }
+    $tmp = $self->perl_archive;
     push @m, "
 PERL_ARCHIVE = $tmp
 ";
@@ -659,12 +665,17 @@ sub dir_target {
 # too often :)
 
     my($self,@dirs) = @_;
-    my(@m,$dir);
+    my(@m,$dir,$targdir);
     foreach $dir (@dirs) {
        my($src) = $self->catfile($self->{PERL_INC},'perl.h');
        my($targ) = $self->catfile($dir,'.exists');
-       my($targdir) = $targ;       # Necessary because catfile may have
-       $targdir =~ s:/?.exists$::; # adapted syntax of $dir to target OS
+       # catfile may have adapted syntax of $dir to target OS, so...
+       if ($Is_VMS) { # Just remove file name; dirspec is often in macro
+           ($targdir = $targ) =~ s:/?\.exists$::;
+       }
+       else { # while elsewhere we expect to see the dir separator in $targ
+           $targdir = dirname($targ);
+       }
        next if $self->{DIR_TARGET}{$self}{$targdir}++;
        push @m, qq{
 $targ :: $src
@@ -703,7 +714,7 @@ sub dist {
 
     my($to_unix)  = $attribs{TO_UNIX} || ($Is_OS2
                                          ? "$self->{NOECHO}"
-                                         . 'test -f tmp.zip && $(RM) tmp.zip;'
+                                         . '$(TEST_F) tmp.zip && $(RM) tmp.zip;'
                                          . ' $(ZIP) -ll -mr tmp.zip $(DISTVNAME) && unzip -o tmp.zip && $(RM) tmp.zip'
                                          : "$self->{NOECHO}\$(NOOP)");
 
@@ -747,20 +758,20 @@ distclean :: realclean distcheck
 
     push @m, q{
 distcheck :
-       $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -e 'use ExtUtils::Manifest "&fullcheck";' \\
-               -e 'fullcheck();'
+       $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -MExtUtils::Manifest=fullcheck \\
+               -e fullcheck
 };
 
     push @m, q{
 skipcheck :
-       $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -e 'use ExtUtils::Manifest "&skipcheck";' \\
-               -e 'skipcheck();'
+       $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -MExtUtils::Manifest=skipcheck \\
+               -e skipcheck
 };
 
     push @m, q{
 manifest :
-       $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -e 'use ExtUtils::Manifest "&mkmanifest";' \\
-               -e 'mkmanifest();'
+       $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -MExtUtils::Manifest=mkmanifest \\
+               -e mkmanifest
 };
     join "", @m;
 }
@@ -776,8 +787,8 @@ sub dist_ci {
     my @m;
     push @m, q{
 ci :
-       $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -e 'use ExtUtils::Manifest "&maniread";' \\
-               -e '@all = keys %{ maniread() };' \\
+       $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -MExtUtils::Manifest=maniread \\
+               -e "@all = keys %{ maniread() };" \\
                -e 'print("Executing $(CI) @all\n"); system("$(CI) @all");' \\
                -e 'print("Executing $(RCS_LABEL) ...\n"); system("$(RCS_LABEL) @all");'
 };
@@ -844,7 +855,7 @@ sub dist_dir {
 distdir :
        $(RM_RF) $(DISTVNAME)
        $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -MExtUtils::Manifest=manicopy,maniread \\
-               -e 'manicopy(maniread(),"$(DISTVNAME)", "$(DIST_CP)");'
+               -e "manicopy(maniread(),'$(DISTVNAME)', '$(DIST_CP)');"
 };
     join "", @m;
 }
@@ -945,8 +956,8 @@ BOOTSTRAP = '."$self->{BASEEXT}.bs".'
 $(BOOTSTRAP): '."$self->{MAKEFILE} $self->{BOOTDEP}".' $(INST_ARCHAUTODIR)/.exists
        '.$self->{NOECHO}.'echo "Running Mkbootstrap for $(NAME) ($(BSLOADLIBS))"
        '.$self->{NOECHO}.'$(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" \
-               -e \'use ExtUtils::Mkbootstrap;\' \
-               -e \'Mkbootstrap("$(BASEEXT)","$(BSLOADLIBS)");\'
+               -MExtUtils::Mkbootstrap \
+               -e "Mkbootstrap(\'$(BASEEXT)\',\'$(BSLOADLIBS)\');"
        '.$self->{NOECHO}.'$(TOUCH) $(BOOTSTRAP)
        $(CHMOD) 644 $@
 
@@ -990,7 +1001,14 @@ $(INST_DYNAMIC): $(OBJECT) $(MYEXTLIB) $(BOOTSTRAP) $(INST_ARCHAUTODIR)/.exists
        push(@m,'       $(RANLIB) '."$ldfrom\n");
     }
     $ldfrom = "-all $ldfrom -none" if ($^O eq 'dec_osf');
-    push(@m,'  LD_RUN_PATH="$(LD_RUN_PATH)" $(LD) -o $@ $(LDDLFLAGS) '.$ldfrom.
+
+    # Brain dead solaris linker does not use LD_RUN_PATH?
+    # This fixes dynamic extensions which need shared libs
+    my $ldrun = '';
+    $ldrun = join ' ', map "-R$_", split /:/, $self->{LD_RUN_PATH}
+       if ($^O eq 'solaris');
+
+    push(@m,'  LD_RUN_PATH="$(LD_RUN_PATH)" $(LD) -o $@ '.$ldrun.' $(LDDLFLAGS) '.$ldfrom.
                ' $(OTHERLDFLAGS) $(MYEXTLIB) $(PERL_ARCHIVE) $(LDLOADLIBS) $(EXPORT_LIST)');
     push @m, '
        $(CHMOD) 755 $@
@@ -1026,13 +1044,18 @@ sub extliblist {
 
 =item file_name_is_absolute
 
-Takes as argument a path and returns true, it it is an absolute path.
+Takes as argument a path and returns true, if it is an absolute path.
 
 =cut
 
 sub file_name_is_absolute {
     my($self,$file) = @_;
-    $file =~ m:^/: ;
+    if ($Is_Dos){
+        $file =~ m{^([a-z]:)?[\\/]}i ;
+    }
+    else {
+        $file =~ m:^/: ;
+    }
 }
 
 =item find_perl
@@ -1054,7 +1077,7 @@ in these dirs:
     foreach $dir (@$dirs){
        next unless defined $dir; # $self->{PERL_SRC} may be undefined
        foreach $name (@$names){
-           my $abs;
+           my ($abs, $val);
            if ($self->file_name_is_absolute($name)) { # /foo/bar
                $abs = $name;
            } elsif ($self->canonpath($name) eq $self->canonpath(basename($name))) { # foo
@@ -1065,9 +1088,12 @@ in these dirs:
            print "Checking $abs\n" if ($trace >= 2);
            next unless $self->maybe_command($abs);
            print "Executing $abs\n" if ($trace >= 2);
-           if (`$abs -e 'require $ver; print "VER_OK\n" ' 2>&1` =~ /VER_OK/) {
+           $val = `$abs -e 'require $ver; print "VER_OK\n" ' 2>&1`;
+           if ($val =~ /VER_OK/) {
                print "Using PERL=$abs\n" if $trace;
                return $abs;
+           } elsif ($trace >= 2) {
+               print "Result: `$val'\n";
            }
        }
     }
@@ -1075,12 +1101,99 @@ in these dirs:
     0; # false and not empty
 }
 
+=back
+
 =head2 Methods to actually produce chunks of text for the Makefile
 
-The methods here are called in the order specified by
-@ExtUtils::MakeMaker::MM_Sections. This manpage reflects the order as
-well as possible. Some methods call each other, so in doubt refer to
-the code.
+The methods here are called for each MakeMaker object in the order
+specified by @ExtUtils::MakeMaker::MM_Sections.
+
+=over 2
+
+=item fixin
+
+Inserts the sharpbang or equivalent magic number to a script
+
+=cut
+
+sub fixin { # stolen from the pink Camel book, more or less
+    my($self,@files) = @_;
+    my($does_shbang) = $Config::Config{'sharpbang'} =~ /^\s*\#\!/;
+    my($file,$interpreter);
+    for $file (@files) {
+       local(*FIXIN);
+       local(*FIXOUT);
+       open(FIXIN, $file) or Carp::croak "Can't process '$file': $!";
+       local $/ = "\n";
+       chomp(my $line = <FIXIN>);
+       next unless $line =~ s/^\s*\#!\s*//;     # Not a shbang file.
+       # Now figure out the interpreter name.
+       my($cmd,$arg) = split ' ', $line, 2;
+       $cmd =~ s!^.*/!!;
+
+       # Now look (in reverse) for interpreter in absolute PATH (unless perl).
+       if ($cmd eq "perl") {
+            if ($Config{startperl} =~ m,^\#!.*/perl,) {
+                $interpreter = $Config{startperl};
+                $interpreter =~ s,^\#!,,;
+            } else {
+                $interpreter = $Config{perlpath};
+            }
+       } else {
+           my(@absdirs) = reverse grep {$self->file_name_is_absolute} $self->path;
+           $interpreter = '';
+           my($dir);
+           foreach $dir (@absdirs) {
+               if ($self->maybe_command($cmd)) {
+                   warn "Ignoring $interpreter in $file\n" if $Verbose && $interpreter;
+                   $interpreter = $self->catfile($dir,$cmd);
+               }
+           }
+       }
+       # Figure out how to invoke interpreter on this machine.
+
+       my($shb) = "";
+       if ($interpreter) {
+           print STDOUT "Changing sharpbang in $file to $interpreter" if $Verbose;
+           if ($does_shbang) {
+               $shb .= "$Config{'sharpbang'}$interpreter";
+               $shb .= ' ' . $arg if defined $arg;
+               $shb .= "\n";
+           }
+           $shb .= qq{
+eval 'exec $interpreter $arg -S \$0 \${1+"\$\@"}'
+    if 0; # not running under some shell
+};
+       } else {
+           warn "Can't find $cmd in PATH, $file unchanged"
+               if $Verbose;
+           next;
+       }
+
+       unless ( rename($file, "$file.bak") ) { 
+           warn "Can't modify $file";
+           next;
+       }
+       unless ( open(FIXOUT,">$file") ) {
+           warn "Can't create new $file: $!\n";
+           next;
+       }
+       my($dev,$ino,$mode) = stat FIXIN;
+       $mode = 0755 unless $dev;
+       chmod $mode, $file;
+       
+       # Print out the new #! line (or equivalent).
+       local $\;
+       undef $/;
+       print FIXOUT $shb, <FIXIN>;
+       close FIXIN;
+       close FIXOUT;
+       unlink "$file.bak";
+    } continue {
+       chmod 0755, $file or die "Can't reset permissions for $file: $!\n";
+       system("$Config{'eunicefix'} $file") if $Config{'eunicefix'} ne ':';;
+    }
+}
 
 =item force (o)
 
@@ -1092,6 +1205,7 @@ sub force {
     my($self) = shift;
     '# Phony target to force checking subdirectories.
 FORCE:
+       '.$self->{NOECHO}.'$(NOOP)
 ';
 }
 
@@ -1147,6 +1261,7 @@ sub init_dirscan {        # --- File and Directory Lists (.xs .pm .pod etc)
     $ignore{'test.pl'} = 1;
     $ignore{'makefile.pl'} = 1 if $Is_VMS;
     foreach $name ($self->lsdir($self->curdir)){
+       next if $name =~ /\#/;
        next if $name eq $self->curdir or $name eq $self->updir or $ignore{$name};
        next unless $self->libscan($name);
        if (-d $name){
@@ -1222,9 +1337,10 @@ sub init_dirscan {       # --- File and Directory Lists (.xs .pm .pod etc)
                }
                return;
            }
+           return if /\#/;
            my($path, $prefix) = ($File::Find::name, '$(INST_LIBDIR)');
            my($striplibpath,$striplibname);
-           $prefix =  '$(INST_LIB)' if (($striplibpath = $path) =~ s:^(\W*)lib\W:$1:);
+           $prefix =  '$(INST_LIB)' if (($striplibpath = $path) =~ s:^(\W*)lib\W:$1:i);
            ($striplibname,$striplibpath) = fileparse($striplibpath);
            my($inst) = $self->catfile($prefix,$striplibpath,$striplibname);
            local($_) = $inst; # for backwards compatibility
@@ -1256,7 +1372,6 @@ sub init_dirscan {        # --- File and Directory Lists (.xs .pm .pod etc)
 #              my $fh = new FileHandle;
                local *FH;
                my($ispod)=0;
-               # one day test, if $/ can be set to '' safely (is the bug fixed that was in 5.001m?)
 #              if ($fh->open("<$name")) {
                if (open(FH,"<$name")) {
 #                  while (<$fh>) {
@@ -1273,7 +1388,9 @@ sub init_dirscan {        # --- File and Directory Lists (.xs .pm .pod etc)
                    $ispod = 1;
                }
                if( $ispod ) {
-                   $manifypods{$name} = $self->catfile('$(INST_MAN1DIR)',basename($name).'.$(MAN1EXT)');
+                   $manifypods{$name} =
+                       $self->catfile('$(INST_MAN1DIR)',
+                                      basename($name).'.$(MAN1EXT)');
                }
            }
        }
@@ -1336,7 +1453,7 @@ sub init_dirscan {        # --- File and Directory Lists (.xs .pm .pod etc)
 
 Initializes NAME, FULLEXT, BASEEXT, PARENT_NAME, DLBASE, PERL_SRC,
 PERL_LIB, PERL_ARCHLIB, PERL_INC, INSTALLDIRS, INST_*, INSTALL*,
-PREFIX, CONFIG, AR, AR_STATIC_ARGS, LD, OBJ_EXT, LIB_EXT, MAP_TARGET,
+PREFIX, CONFIG, AR, AR_STATIC_ARGS, LD, OBJ_EXT, LIB_EXT, EXE_EXT, MAP_TARGET,
 LIBPERL_A, VERSION_FROM, VERSION, DISTNAME, VERSION_SYM.
 
 =cut
@@ -1367,14 +1484,11 @@ sub init_main {
     # It may also edit @modparts if required.
     if (defined &DynaLoader::mod2fname) {
         $modfname = &DynaLoader::mod2fname(\@modparts);
-    } elsif ($Is_OS2) {                # Need manual correction if run with miniperl:-(
-        $modfname = substr($modfname, 0, 7) . '_';
     }
 
-
     ($self->{PARENT_NAME}, $self->{BASEEXT}) = $self->{NAME} =~ m!([\w:]+::)?(\w+)$! ;
 
-    if (defined &DynaLoader::mod2fname or $Is_OS2) {
+    if (defined &DynaLoader::mod2fname) {
        # As of 5.001m, dl_os2 appends '_'
        $self->{DLBASE} = $modfname;
     } else {
@@ -1412,10 +1526,21 @@ sub init_main {
     if ($self->{PERL_SRC}){
        $self->{PERL_LIB}     ||= $self->catdir("$self->{PERL_SRC}","lib");
        $self->{PERL_ARCHLIB} = $self->{PERL_LIB};
-       $self->{PERL_INC}     = $self->{PERL_SRC};
-       # catch a situation that has occurred a few times in the past:
+       $self->{PERL_INC}     = ($Is_Win32) ? $self->catdir($self->{PERL_LIB},"CORE") : $self->{PERL_SRC};
 
-       warn <<EOM unless (-s $self->catfile($self->{PERL_SRC},'cflags') or $Is_VMS && -s $self->catfile($self->{PERL_SRC},'perlshr_attr.opt') or $Is_Mac);
+       # catch a situation that has occurred a few times in the past:
+       unless (
+               -s $self->catfile($self->{PERL_SRC},'cflags')
+               or
+               $Is_VMS
+               &&
+               -s $self->catfile($self->{PERL_SRC},'perlshr_attr.opt')
+               or
+               $Is_Mac
+               or
+               $Is_Win32
+              ){
+           warn qq{
 You cannot build extensions below the perl source tree after executing
 a 'make clean' in the perl source tree.
 
@@ -1427,26 +1552,27 @@ usually without extra arguments.
 
 It is recommended that you unpack and build additional extensions away
 from the perl source tree.
-EOM
+};
+       }
     } else {
        # we should also consider $ENV{PERL5LIB} here
        $self->{PERL_LIB}     ||= $Config::Config{privlibexp};
        $self->{PERL_ARCHLIB} ||= $Config::Config{archlibexp};
        $self->{PERL_INC}     = $self->catdir("$self->{PERL_ARCHLIB}","CORE"); # wild guess for now
        my $perl_h;
-       die <<EOM unless (-f ($perl_h = $self->catfile($self->{PERL_INC},"perl.h")));
+       unless (-f ($perl_h = $self->catfile($self->{PERL_INC},"perl.h"))){
+           die qq{
 Error: Unable to locate installed Perl libraries or Perl source code.
 
 It is recommended that you install perl in a standard location before
-building extensions. You can say:
-
-    $^X Makefile.PL PERL_SRC=/path/to/perl/source/directory
-
-if you have not yet installed perl but still want to build this
-extension now.
-(You get this message, because MakeMaker could not find "$perl_h")
-EOM
+building extensions. Some precompiled versions of perl do not contain
+these header files, so you cannot build extensions. In such a case,
+please build and install your perl from a fresh perl distribution. It
+usually solves this kind of problem.
 
+\(You get this message, because MakeMaker could not find "$perl_h"\)
+};
+       }
 #       print STDOUT "Using header files found in $self->{PERL_INC}\n"
 #           if $Verbose && $self->needs_linking();
 
@@ -1476,13 +1602,20 @@ EOM
     $self->{INST_ARCHLIB} ||= $self->catdir($self->curdir,"blib","arch");
     $self->{INST_BIN} ||= $self->catdir($self->curdir,'blib','bin');
 
+    # We need to set up INST_LIBDIR before init_libscan() for VMS
+    my @parentdir = split(/::/, $self->{PARENT_NAME});
+    $self->{INST_LIBDIR} = $self->catdir('$(INST_LIB)',@parentdir);
+    $self->{INST_ARCHLIBDIR} = $self->catdir('$(INST_ARCHLIB)',@parentdir);
+    $self->{INST_AUTODIR} = $self->catdir('$(INST_LIB)','auto','$(FULLEXT)');
+    $self->{INST_ARCHAUTODIR} = $self->catdir('$(INST_ARCHLIB)','auto','$(FULLEXT)');
+
     # INST_EXE is deprecated, should go away March '97
     $self->{INST_EXE} ||= $self->catdir($self->curdir,'blib','script');
     $self->{INST_SCRIPT} ||= $self->catdir($self->curdir,'blib','script');
 
     # The user who requests an installation directory explicitly
     # should not have to tell us a architecture installation directory
-    # as well We look if a directory exists that is named after the
+    # as well. We look if a directory exists that is named after the
     # architecture. If not we take it as a sign that it should be the
     # same as the requested installation directory. Otherwise we take
     # the found one.
@@ -1510,23 +1643,67 @@ EOM
     # requested values. We're going to set the $Config{prefix} part of
     # all the installation path variables to literally $(PREFIX), so
     # the user can still say make PREFIX=foo
-    my($prefix) = $Config{'prefix'};
-    $prefix = VMS::Filespec::unixify($prefix) if $Is_VMS;
-    unless ($self->{PREFIX}){
-       $self->{PREFIX} = $prefix;
+    my($configure_prefix) = $Config{'prefix'};
+    $configure_prefix = VMS::Filespec::unixify($configure_prefix) if $Is_VMS;
+    $self->{PREFIX} ||= $configure_prefix;
+
+
+    my($install_variable,$search_prefix,$replace_prefix);
+
+    # The rule, taken from Configure, is that if prefix contains perl,
+    # we shape the tree
+    #    perlprefix/lib/                INSTALLPRIVLIB
+    #    perlprefix/lib/pod/
+    #    perlprefix/lib/site_perl/     INSTALLSITELIB
+    #    perlprefix/bin/               INSTALLBIN
+    #    perlprefix/man/               INSTALLMAN1DIR
+    # else
+    #    prefix/lib/perl5/             INSTALLPRIVLIB
+    #    prefix/lib/perl5/pod/
+    #    prefix/lib/perl5/site_perl/   INSTALLSITELIB
+    #    prefix/bin/                   INSTALLBIN
+    #    prefix/lib/perl5/man/         INSTALLMAN1DIR
+
+    $replace_prefix = qq[\$\(PREFIX\)];
+    for $install_variable (qw/
+                          INSTALLBIN
+                          INSTALLSCRIPT
+                          /) {
+       $self->prefixify($install_variable,$configure_prefix,$replace_prefix);
+    }
+    $search_prefix = $configure_prefix =~ /perl/ ?
+       $self->catdir($configure_prefix,"lib") :
+       $self->catdir($configure_prefix,"lib","perl5");
+    if ($self->{LIB}) {
+       $self->{INSTALLPRIVLIB} = $self->{INSTALLSITELIB} = $self->{LIB};
+       $self->{INSTALLARCHLIB} = $self->{INSTALLSITEARCH} = 
+           $self->catdir($self->{LIB},$Config{'archname'});
+    } else {
+       $replace_prefix = $self->{PREFIX} =~ /perl/ ? 
+           $self->catdir(qq[\$\(PREFIX\)],"lib") :
+               $self->catdir(qq[\$\(PREFIX\)],"lib","perl5");
+       for $install_variable (qw/
+                              INSTALLPRIVLIB
+                              INSTALLARCHLIB
+                              INSTALLSITELIB
+                              INSTALLSITEARCH
+                              /) {
+           $self->prefixify($install_variable,$search_prefix,$replace_prefix);
+       }
     }
-    my($install_variable);
+    $search_prefix = $configure_prefix =~ /perl/ ?
+       $self->catdir($configure_prefix,"man") :
+           $self->catdir($configure_prefix,"lib","perl5","man");
+    $replace_prefix = $self->{PREFIX} =~ /perl/ ? 
+       $self->catdir(qq[\$\(PREFIX\)],"man") :
+           $self->catdir(qq[\$\(PREFIX\)],"lib","perl5","man");
     for $install_variable (qw/
-
-                          INSTALLPRIVLIB INSTALLARCHLIB INSTALLBIN
-                          INSTALLMAN1DIR INSTALLMAN3DIR INSTALLSCRIPT
-                          INSTALLSITELIB INSTALLSITEARCH
-
+                          INSTALLMAN1DIR
+                          INSTALLMAN3DIR
                           /) {
-       $self->prefixify($install_variable,$prefix,q[$(PREFIX)]);
+       $self->prefixify($install_variable,$search_prefix,$replace_prefix);
     }
 
-
     # Now we head at the manpages. Maybe they DO NOT want manpages
     # installed
     $self->{INSTALLMAN1DIR} = $Config::Config{installman1dir}
@@ -1623,9 +1800,9 @@ EOM
     foreach $component ($self->{PERL_SRC}, $self->path(), $Config::Config{binexp}) {
        push @defpath, $component if defined $component;
     }
-    $self->{PERL} =
+    $self->{PERL} ||=
         $self->find_perl(5.0, [ $^X, 'miniperl','perl','perl5',"perl$]" ],
-           \@defpath, $Verbose ) unless ($self->{PERL});
+           \@defpath, $Verbose );
     # don't check if perl is executable, maybe they have decided to
     # supply switches with perl
 
@@ -1638,7 +1815,7 @@ EOM
 
 Initializes EXTRALIBS, BSLOADLIBS, LDLOADLIBS, LIBS, LD_RUN_PATH,
 OBJECT, BOOTDEP, PERLMAINCC, LDFROM, LINKTYPE, NOOP, FIRST_MAKEFILE,
-MAKEFILE, NOECHO, RM_F, RM_RF, TOUCH, CP, MV, CHMOD, UMASK_NULL
+MAKEFILE, NOECHO, RM_F, RM_RF, TEST_F, TOUCH, CP, MV, CHMOD, UMASK_NULL
 
 =cut
 
@@ -1652,7 +1829,7 @@ sub init_others { # --- Initialize Other Attributes
     # May check $Config{libs} too, thus not empty.
     $self->{LIBS}=[''] unless $self->{LIBS};
 
-    $self->{LIBS}=[$self->{LIBS}] if ref \$self->{LIBS} eq SCALAR;
+    $self->{LIBS}=[$self->{LIBS}] if ref \$self->{LIBS} eq 'SCALAR';
     $self->{LD_RUN_PATH} = "";
     my($libs);
     foreach $libs ( @{$self->{LIBS}} ){
@@ -1688,7 +1865,7 @@ sub init_others { # --- Initialize Other Attributes
     };
 
     # These get overridden for VMS and maybe some other systems
-    $self->{NOOP}  ||= "sh -c true";
+    $self->{NOOP}  ||= '$(SHELL) -c true';
     $self->{FIRST_MAKEFILE} ||= "Makefile";
     $self->{MAKEFILE} ||= $self->{FIRST_MAKEFILE};
     $self->{MAKE_APERL_FILE} ||= "Makefile.aperl";
@@ -1696,10 +1873,12 @@ sub init_others {       # --- Initialize Other Attributes
     $self->{RM_F}  ||= "rm -f";
     $self->{RM_RF} ||= "rm -rf";
     $self->{TOUCH} ||= "touch";
+    $self->{TEST_F} ||= "test -f";
     $self->{CP} ||= "cp";
     $self->{MV} ||= "mv";
     $self->{CHMOD} ||= "chmod";
     $self->{UMASK_NULL} ||= "umask 0";
+    $self->{DEV_NULL} ||= "> /dev/null 2>&1";
 }
 
 =item install (o)
@@ -1762,7 +1941,7 @@ pure_site_install ::
 
 doc_perl_install ::
        }.$self->{NOECHO}.q{$(DOC_INSTALL) \
-               "$(NAME)" \
+               "Module" "$(NAME)" \
                "installed into" "$(INSTALLPRIVLIB)" \
                LINKTYPE "$(LINKTYPE)" \
                VERSION "$(VERSION)" \
@@ -1771,7 +1950,7 @@ doc_perl_install ::
 
 doc_site_install ::
        }.$self->{NOECHO}.q{$(DOC_INSTALL) \
-               "Module $(NAME)" \
+               "Module" "$(NAME)" \
                "installed into" "$(INSTALLSITELIB)" \
                LINKTYPE "$(LINKTYPE)" \
                VERSION "$(VERSION)" \
@@ -1815,22 +1994,27 @@ sub installbin {
        $fromto{$from}=$to;
     }
     @to   = values %fromto;
-    push(@m, "
+    push(@m, qq{
 EXE_FILES = @{$self->{EXE_FILES}}
 
+FIXIN = \$(PERL) -I\$(PERL_ARCHLIB) -I\$(PERL_LIB) -MExtUtils::MakeMaker \\
+    -e "MY->fixin(shift)"
+
 all :: @to
+       $self->{NOECHO}\$(NOOP)
 
 realclean ::
        $self->{RM_F} @to
-");
+});
 
     while (($from,$to) = each %fromto) {
        last unless defined $from;
        my $todir = dirname($to);
        push @m, "
-$to: $from $self->{MAKEFILE} $todir/.exists
+$to: $from $self->{MAKEFILE} " . $self->catdir($todir,'.exists') . "
        $self->{NOECHO}$self->{RM_F} $to
        $self->{CP} $from $to
+       \$(FIXIN) $to
 ";
     }
     join "", @m;
@@ -1910,6 +2094,10 @@ sub macro {
 Called by staticmake. Defines how to write the Makefile to produce a
 static new perl.
 
+By default the Makefile produced includes all the static extensions in
+the perl library. (Purified versions of library files, e.g.,
+DynaLoader_pure_p1_c0_032.a are automatically ignored to avoid link errors.)
+
 =cut
 
 sub makeaperl {
@@ -1958,13 +2146,15 @@ $(MAKE_APERL_FILE) : $(FIRST_MAKEFILE)
     $cccmd = $self->const_cccmd($libperl);
     $cccmd =~ s/^CCCMD\s*=\s*//;
     $cccmd =~ s/\$\(INC\)/ -I$self->{PERL_INC} /;
-    $cccmd .= " $Config::Config{cccdlflags}" if ($Config::Config{d_shrplib});
+    $cccmd .= " $Config::Config{cccdlflags}"
+       if ($Config::Config{useshrplib} eq 'true');
     $cccmd =~ s/\(CC\)/\(PERLMAINCC\)/;
 
     # The front matter of the linkcommand...
     $linkcmd = join ' ', "\$(CC)",
            grep($_, @Config{qw(large split ldflags ccdlflags)});
     $linkcmd =~ s/\s+/ /g;
+    $linkcmd =~ s,(perl\.exp),\$(PERL_INC)/$1,;
 
     # Which *.a files could we make use of...
     local(%static);
@@ -1972,6 +2162,8 @@ $(MAKE_APERL_FILE) : $(FIRST_MAKEFILE)
     File::Find::find(sub {
        return unless m/\Q$self->{LIB_EXT}\E$/;
        return if m/^libperl/;
+       # Skip purified versions of libraries (e.g., DynaLoader_pure_p1_c0_032.a)
+       return if m/_pure_\w+_\w+_\w+\.\w+$/ and -f "$File::Find::dir/.pure";
 
        if( exists $self->{INCLUDE_EXT} ){
                my $found = 0;
@@ -2055,6 +2247,16 @@ MAP_PRELIBS   = $Config::Config{libs} $Config::Config{cryptlib}
        $libperl   = "$dir/$libperl";
        $lperl   ||= "libperl$self->{LIB_EXT}";
        $lperl     = "$dir/$lperl";
+
+        if (! -f $libperl and ! -f $lperl) {
+          # We did not find a static libperl. Maybe there is a shared one?
+          if ($^O eq 'solaris' or $^O eq 'sunos') {
+            $lperl  = $libperl = "$dir/$Config::Config{libperl}";
+            # SUNOS ld does not take the full path to a shared library
+            $libperl = '' if $^O eq 'sunos';
+          }
+        }
+
        print STDOUT "Warning: $libperl not found
     If you're going to build a static perl binary, make sure perl is installed
     otherwise ignore this warning\n"
@@ -2075,10 +2277,17 @@ MAP_LIBPERL = $libperl
     foreach $catfile (@$extra){
        push @m, "\tcat $catfile >> \$\@\n";
     }
+    # SUNOS ld does not take the full path to a shared library
+    my $llibperl = ($libperl)?'$(MAP_LIBPERL)':'-lperl';
 
-    push @m, "
+    # Brain dead solaris linker does not use LD_RUN_PATH?
+    # This fixes dynamic extensions which need shared libs
+    my $ldfrom = ($^O eq 'solaris')?
+           join(' ', map "-R$_", split /:/, $self->{LD_RUN_PATH}):'';
+
+push @m, "
 \$(MAP_TARGET) :: $tmp/perlmain\$(OBJ_EXT) \$(MAP_LIBPERL) \$(MAP_STATIC) \$(INST_ARCHAUTODIR)/extralibs.all
-       \$(MAP_LINKCMD) -o \$\@ \$(OPTIMIZE) $tmp/perlmain\$(OBJ_EXT) \$(MAP_LIBPERL) \$(MAP_STATIC) `cat \$(INST_ARCHAUTODIR)/extralibs.all` \$(MAP_PRELIBS)
+       \$(MAP_LINKCMD) -o \$\@ \$(OPTIMIZE) $tmp/perlmain\$(OBJ_EXT) $ldfrom $llibperl \$(MAP_STATIC) `cat \$(INST_ARCHAUTODIR)/extralibs.all` \$(MAP_PRELIBS)
        $self->{NOECHO}echo 'To install the new \"\$(MAP_TARGET)\" binary, call'
        $self->{NOECHO}echo '    make -f $makefilename inst_perl MAP_TARGET=\$(MAP_TARGET)'
        $self->{NOECHO}echo 'To remove the intermediate files say'
@@ -2091,16 +2300,19 @@ $tmp/perlmain\$(OBJ_EXT): $tmp/perlmain.c
     push @m, qq{
 $tmp/perlmain.c: $makefilename}, q{
        }.$self->{NOECHO}.q{echo Writing $@
-       }.$self->{NOECHO}.q{$(PERL) $(MAP_PERLINC) -e 'use ExtUtils::Miniperl; \\
-               writemain(grep s#.*/auto/##, qw|$(MAP_STATIC)|)' > $@.tmp && mv $@.tmp $@
+       }.$self->{NOECHO}.q{$(PERL) $(MAP_PERLINC) -MExtUtils::Miniperl \\
+               -e "writemain(grep s#.*/auto/##, qw|$(MAP_STATIC)|)" > $@t && $(MV) $@t $@
 
 };
+    push @m, "\t",$self->{NOECHO}.q{$(PERL) $(INSTALLSCRIPT)/fixpmain
+} if (defined (&Dos::UseLFN) && Dos::UseLFN()==0);
+
 
     push @m, q{
 doc_inst_perl:
        }.$self->{NOECHO}.q{echo Appending installation info to $(INSTALLARCHLIB)/perllocal.pod
        }.$self->{NOECHO}.q{$(DOC_INSTALL) \
-               "Perl binary $(MAP_TARGET)" \
+               "Perl binary" "$(MAP_TARGET)" \
                MAP_STATIC "$(MAP_STATIC)" \
                MAP_EXTRA "`cat $(INST_ARCHAUTODIR)/extralibs.all`" \
                MAP_LIBPERL "$(MAP_LIBPERL)" \
@@ -2145,11 +2357,12 @@ $(OBJECT) : $(FIRST_MAKEFILE)
 }.$self->{MAKEFILE}.q{ : Makefile.PL $(CONFIGDEP)
        }.$self->{NOECHO}.q{echo "Makefile out-of-date with respect to $?"
        }.$self->{NOECHO}.q{echo "Cleaning current config before rebuilding Makefile..."
-       -}.$self->{NOECHO}.q{mv }."$self->{MAKEFILE} $self->{MAKEFILE}.old".q{
-       -$(MAKE) -f }.$self->{MAKEFILE}.q{.old clean >/dev/null 2>&1 || true
+       -}.$self->{NOECHO}.q{$(MV) }."$self->{MAKEFILE} $self->{MAKEFILE}.old".q{
+       -$(MAKE) -f }.$self->{MAKEFILE}.q{.old clean $(DEV_NULL) || $(NOOP)
        $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" Makefile.PL }.join(" ",map(qq["$_"],@ARGV)).q{
-       }.$self->{NOECHO}.q{echo ">>> Your Makefile has been rebuilt. <<<"
-       }.$self->{NOECHO}.q{echo ">>> Please rerun the make command.  <<<"; false
+       }.$self->{NOECHO}.q{echo "==> Your Makefile has been rebuilt. <=="
+       }.$self->{NOECHO}.q{echo "==> Please rerun the make command.  <=="
+       false
 
 # To change behavior to :: would be nice, but would break Tk b9.02
 # so you find such a warning below the dist target.
@@ -2318,14 +2531,21 @@ sub parse_version {
        $inpod = /^=(?!cut)/ ? 1 : /^=cut/ ? 0 : $inpod;
        next if $inpod;
        chop;
-       next unless /\$(([\w\:\']*)\bVERSION)\b.*\=/;
-       local $ExtUtils::MakeMaker::module_version_variable = $1;
-       my($thispackage) = $2 || $current_package;
-       $thispackage =~ s/:+$//;
-       my($eval) = "$_;";
-       eval $eval;
+       # next unless /\$(([\w\:\']*)\bVERSION)\b.*\=/;
+       next unless /([\$*])(([\w\:\']*)\bVERSION)\b.*\=/;
+       my $eval = qq{
+           package ExtUtils::MakeMaker::_version;
+           no strict;
+
+           local $1$2;
+           \$$2=undef; do {
+               $_
+           }; \$$2
+       };
+       local($^W) = 0;
+       $result = eval($eval);
        die "Could not eval '$eval' in $parsefile: $@" if $@;
-       $result = $ {$ExtUtils::MakeMaker::module_version_variable} || 0;
+       $result = "undef" unless defined $result;
        last;
     }
     close FH;
@@ -2345,12 +2565,14 @@ sub pasthru {
     my(@m,$key);
 
     my(@pasthru);
+    my($sep) = $Is_VMS ? ',' : '';
+    $sep .= "\\\n\t";
 
-    foreach $key (qw(LIBPERL_A LINKTYPE PREFIX OPTIMIZE)){
+    foreach $key (qw(LIB LIBPERL_A LINKTYPE PREFIX OPTIMIZE)){
        push @pasthru, "$key=\"\$($key)\"";
     }
 
-    push @m, "\nPASTHRU = ", join ("\\\n\t", @pasthru), "\n";
+    push @m, "\nPASTHRU = ", join ($sep, @pasthru), "\n";
     join "", @m;
 }
 
@@ -2362,10 +2584,12 @@ Takes no argument, returns the environment variable PATH as an array.
 
 sub path {
     my($self) = @_;
-    my $path_sep = $Is_OS2 ? ";" : ":";
+    my $path_sep = ($Is_OS2 || $Is_Dos) ? ";" : ":";
     my $path = $ENV{PATH};
     $path =~ s:\\:/:g if $Is_OS2;
     my @path = split $path_sep, $path;
+    foreach(@path) { $_ = '.' if $_ eq '' }
+    @path;
 }
 
 =item perl_script
@@ -2430,7 +2654,7 @@ $(OBJECT) : $(PERL_HDRS)
 =item pm_to_blib
 
 Defines target that copies all files in the hash PM to their
-destination and autosplits them. See L<ExtUtils::Install/pm_to_blib>
+destination and autosplits them. See L<ExtUtils::Install/DESCRIPTION>
 
 =cut
 
@@ -2441,7 +2665,7 @@ sub pm_to_blib {
 pm_to_blib: $(TO_INST_PM)
        }.$self->{NOECHO}.q{$(PERL) "-I$(INST_ARCHLIB)" "-I$(INST_LIB)" \
        "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -MExtUtils::Install \
-        -e 'pm_to_blib({qw{$(PM_TO_BLIB)}},"}.$autodir.q{")'
+        -e "pm_to_blib({qw{$(PM_TO_BLIB)}},'}.$autodir.q{')"
        }.$self->{NOECHO}.q{$(TOUCH) $@
 };
 }
@@ -2460,7 +2684,7 @@ sub post_constants{
 
 =item post_initialize (o)
 
-Returns an ampty string per default. Used in Makefile.PLs to add some
+Returns an empty string per default. Used in Makefile.PLs to add some
 chunk of text to the Makefile after the object is initialized.
 
 =cut
@@ -2512,6 +2736,7 @@ sub processPL {
     foreach $plfile (sort keys %{$self->{PL_FILES}}) {
        push @m, "
 all :: $self->{PL_FILES}->{$plfile}
+       $self->{NOECHO}\$(NOOP)
 
 $self->{PL_FILES}->{$plfile} :: $plfile
        \$(PERL) -I\$(INST_ARCHLIB) -I\$(INST_LIB) -I\$(PERL_ARCHLIB) -I\$(PERL_LIB) $plfile
@@ -2534,7 +2759,7 @@ sub realclean {
 realclean purge ::  clean
 ');
     # realclean subdirectories first (already cleaned)
-    my $sub = "\t-cd %s && test -f %s && \$(MAKE) %s realclean\n";
+    my $sub = "\t-cd %s && \$(TEST_F) %s && \$(MAKE) %s realclean\n";
     foreach(@{$self->{DIR}}){
        push(@m, sprintf($sub,$_,"$self->{MAKEFILE}.old","-f $self->{MAKEFILE}.old"));
        push(@m, sprintf($sub,$_,"$self->{MAKEFILE}",''));
@@ -2609,14 +2834,14 @@ END
 
     push @m,
 q{     $(AR) $(AR_STATIC_ARGS) $@ $(OBJECT) && $(RANLIB) $@
-       }.$self->{NOECHO}.q{echo "$(EXTRALIBS)" > $(INST_ARCHAUTODIR)/extralibs.ld
        $(CHMOD) 755 $@
+       }.$self->{NOECHO}.q{echo "$(EXTRALIBS)" > $(INST_ARCHAUTODIR)/extralibs.ld
 };
-
-# Old mechanism - still available:
-
-    push @m, "\t$self->{NOECHO}".q{echo "$(EXTRALIBS)" >> $(PERL_SRC)/ext.libs}."\n\n"
-       if $self->{PERL_SRC};
+    # Old mechanism - still available:
+    push @m,
+"\t$self->{NOECHO}".q{echo "$(EXTRALIBS)" >> $(PERL_SRC)/ext.libs
+}      if $self->{PERL_SRC} && $self->{EXTRALIBS};
+    push @m, "\n";
 
     push @m, $self->dir_target('$(INST_ARCHAUTODIR)');
     join('', "\n",@m);
@@ -2720,27 +2945,32 @@ sub test {
 # --- Test and Installation Sections ---
 
     my($self, %attribs) = @_;
-    my($tests) = $attribs{TESTS} || (-d "t" ? "t/*.t" : "");
+    my $tests = $attribs{TESTS};
+    if (!$tests && -d 't') {
+       $tests = $Is_Win32 ? join(' ', <t\\*.t>) : 't/*.t';
+    }
+    # note: 'test.pl' name is also hardcoded in init_dirscan()
     my(@m);
     push(@m,"
 TEST_VERBOSE=0
 TEST_TYPE=test_\$(LINKTYPE)
 TEST_FILE = test.pl
+TEST_FILES = $tests
 TESTDB_SW = -d
 
 testdb :: testdb_\$(LINKTYPE)
 
 test :: \$(TEST_TYPE)
 ");
-    push(@m, map("\t$self->{NOECHO}cd $_ && test -f $self->{MAKEFILE} && \$(MAKE) test \$(PASTHRU)\n",
+    push(@m, map("\t$self->{NOECHO}cd $_ && \$(TEST_F) $self->{MAKEFILE} && \$(MAKE) test \$(PASTHRU)\n",
                 @{$self->{DIR}}));
     push(@m, "\t$self->{NOECHO}echo 'No tests defined for \$(NAME) extension.'\n")
        unless $tests or -f "test.pl" or @{$self->{DIR}};
     push(@m, "\n");
 
     push(@m, "test_dynamic :: pure_all\n");
-    push(@m, $self->test_via_harness('$(FULLPERL)', $tests)) if $tests;
-    push(@m, $self->test_via_script('$(FULLPERL)', 'test.pl')) if -f "test.pl";
+    push(@m, $self->test_via_harness('$(FULLPERL)', '$(TEST_FILES)')) if $tests;
+    push(@m, $self->test_via_script('$(FULLPERL)', '$(TEST_FILE)')) if -f "test.pl";
     push(@m, "\n");
 
     push(@m, "testdb_dynamic :: pure_all\n");
@@ -2752,8 +2982,8 @@ test :: \$(TEST_TYPE)
 
     if ($self->needs_linking()) {
        push(@m, "test_static :: pure_all \$(MAP_TARGET)\n");
-       push(@m, $self->test_via_harness('./$(MAP_TARGET)', $tests)) if $tests;
-       push(@m, $self->test_via_script('./$(MAP_TARGET)', 'test.pl')) if -f "test.pl";
+       push(@m, $self->test_via_harness('./$(MAP_TARGET)', '$(TEST_FILES)')) if $tests;
+       push(@m, $self->test_via_script('./$(MAP_TARGET)', '$(TEST_FILE)')) if -f "test.pl";
        push(@m, "\n");
        push(@m, "testdb_static :: pure_all \$(MAP_TARGET)\n");
        push(@m, $self->test_via_script('./$(MAP_TARGET) $(TESTDB_SW)', '$(TEST_FILE)'));
@@ -2773,7 +3003,8 @@ Helper method to write the test targets
 
 sub test_via_harness {
     my($self, $perl, $tests) = @_;
-    "\tPERL_DL_NONLAZY=1 $perl".q! -I$(INST_ARCHLIB) -I$(INST_LIB) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -e 'use Test::Harness qw(&runtests $$verbose); $$verbose=$(TEST_VERBOSE); runtests @ARGV;' !."$tests\n";
+    $perl = "PERL_DL_NONLAZY=1 $perl" unless $Is_Win32;
+    "\t$perl".q! -I$(INST_ARCHLIB) -I$(INST_LIB) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -e 'use Test::Harness qw(&runtests $$verbose); $$verbose=$(TEST_VERBOSE); runtests @ARGV;' !."$tests\n";
 }
 
 =item test_via_script (o)
@@ -2784,7 +3015,8 @@ Other helper method for test.
 
 sub test_via_script {
     my($self, $perl, $script) = @_;
-    qq{\tPERL_DL_NONLAZY=1 $perl}.q{ -I$(INST_ARCHLIB) -I$(INST_LIB) -I$(PERL_ARCHLIB) -I$(PERL_LIB) }.qq{$script
+    $perl = "PERL_DL_NONLAZY=1 $perl" unless $Is_Win32;
+    qq{\t$perl}.q{ -I$(INST_ARCHLIB) -I$(INST_LIB) -I$(PERL_ARCHLIB) -I$(PERL_LIB) }.qq{$script
 };
 }
 
@@ -2823,27 +3055,23 @@ sub tools_other {
 SHELL = $bin_sh
 };
 
-    for (qw/ CHMOD CP LD MV NOOP RM_F RM_RF TOUCH UMASK_NULL / ) {
+    for (qw/ CHMOD CP LD MV NOOP RM_F RM_RF TEST_F TOUCH UMASK_NULL DEV_NULL/ ) {
        push @m, "$_ = $self->{$_}\n";
     }
 
-
     push @m, q{
 # The following is a portable way to say mkdir -p
 # To see which directories are created, change the if 0 to if 1
-MKPATH = $(PERL) -wle '$$"="/"; foreach $$p (@ARGV){' \\
--e 'next if -d $$p; my(@p); foreach(split(/\//,$$p)){' \\
--e 'push(@p,$$_); next if -d "@p/"; print "mkdir @p" if 0;' \\
--e 'mkdir("@p",0777)||die $$! } } exit 0;'
+MKPATH = $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -MExtUtils::Command -e mkpath
 
 # This helps us to minimize the effect of the .exists files A yet
 # better solution would be to have a stable file in the perl
 # distribution with a timestamp of zero. But this solution doesn't
 # need any changes to the core distribution and works with older perls
-EQUALIZE_TIMESTAMP = $(PERL) -we 'open F, ">$$ARGV[1]"; close F;' \\
--e 'utime ((stat("$$ARGV[0]"))[8,9], $$ARGV[1])'
+EQUALIZE_TIMESTAMP = $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -MExtUtils::Command -e eqtime
 };
 
+
     return join "", @m if $self->{PARENT};
 
     push @m, q{
@@ -2858,16 +3086,18 @@ UNINST=0
 VERBINST=1
 
 MOD_INSTALL = $(PERL) -I$(INST_LIB) -I$(PERL_LIB) -MExtUtils::Install \
--e 'install({@ARGV},"$(VERBINST)",0,"$(UNINST)");'
+-e "install({@ARGV},'$(VERBINST)',0,'$(UNINST)');"
 
-DOC_INSTALL = $(PERL) -e '$$\="\n\n";print "=head3 ", scalar(localtime), ": C<", shift, ">";' \
+DOC_INSTALL = $(PERL) -e '$$\="\n\n";' \
+-e 'print "=head2 ", scalar(localtime), ": C<", shift, ">", " L<", shift, ">";' \
 -e 'print "=over 4";' \
 -e 'while (defined($$key = shift) and defined($$val = shift)){print "=item *";print "C<$$key: $$val>";}' \
 -e 'print "=back";'
 
 UNINSTALL =   $(PERL) -MExtUtils::Install \
--e 'uninstall($$ARGV[0],1);'
-
+-e 'uninstall($$ARGV[0],1,1); print "\nUninstall is deprecated. Please check the";' \
+-e 'print " packlist above carefully.\n  There may be errors. Remove the";' \
+-e 'print " appropriate files manually.\n  Sorry for the inconveniences.\n"'
 };
 
     return join "", @m;
@@ -2995,10 +3225,15 @@ sub top_targets {
     my(@m);
     push @m, '
 #all ::        config $(INST_PM) subdirs linkext manifypods
+';
 
+    push @m, '
 all :: pure_all manifypods
        '.$self->{NOECHO}.'$(NOOP)
-
+' 
+         unless $self->{SKIPHASH}{'all'};
+    
+    push @m, '
 pure_all :: config pm_to_blib subdirs linkext
        '.$self->{NOECHO}.'$(NOOP)
 
@@ -3053,7 +3288,7 @@ help:
 Version_check:
        }.$self->{NOECHO}.q{$(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) \
                -MExtUtils::MakeMaker=Version_check \
-               -e 'Version_check("$(MM_VERSION)")'
+               -e "Version_check('$(MM_VERSION)')"
 };
 
     join('',@m);
@@ -3085,7 +3320,7 @@ sub xs_c {
     return '' unless $self->needs_linking();
     '
 .xs.c:
-       $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) $(XSUBPP) $(XSPROTOARG) $(XSUBPPARGS) $*.xs >$*.tc && mv $*.tc $@
+       $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) $(XSUBPP) $(XSPROTOARG) $(XSUBPPARGS) $*.xs >$*.tc && $(MV) $*.tc $@
 ';
 }
 
@@ -3101,13 +3336,41 @@ sub xs_o {      # many makes are too dumb to use xs_c then c_o
     return '' unless $self->needs_linking();
     '
 .xs$(OBJ_EXT):
-       $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) $(XSUBPP) $(XSPROTOARG) $(XSUBPPARGS) $*.xs >xstmp.c && mv xstmp.c $*.c
+       $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) $(XSUBPP) $(XSPROTOARG) $(XSUBPPARGS) $*.xs >xstmp.c && $(MV) xstmp.c $*.c
        $(CCCMD) $(CCCDLFLAGS) -I$(PERL_INC) $(DEFINE) $*.c
 ';
 }
 
+=item perl_archive
+
+This is internal method that returns path to libperl.a equivalent
+to be linked to dynamic extensions. UNIX does not have one but OS2
+and Win32 do.
+
+=cut 
+
+sub perl_archive
+{
+ return "";
+}
+
+=item export_list
+
+This is internal method that returns name of a file that is
+passed to linker to define symbols to be exported.
+UNIX does not have one but OS2 and Win32 do.
+
+=cut 
+
+sub export_list
+{
+ return "";
+}
+
+
 1;
 
+=back
 
 =head1 SEE ALSO