A tweak from Alan Burlison for MM 6.10_07 that makes Solaris
[p5sagit/p5-mst-13.2.git] / lib / ExtUtils / MM_VMS.pm
index 422f864..c261957 100644 (file)
@@ -20,8 +20,8 @@ BEGIN {
 
 use File::Basename;
 use vars qw($Revision @ISA $VERSION);
-($VERSION) = '5.66';
-($Revision = substr(q$Revision: 1.82 $, 10)) =~ s/\s+$//;
+($VERSION) = '5.67';
+($Revision) = q$Revision: 1.97 $ =~ /Revision:\s+(\S+)/;
 
 require ExtUtils::MM_Any;
 require ExtUtils::MM_Unix;
@@ -707,11 +707,17 @@ Use VMS-style quoting on xsubpp command line.
 sub tool_xsubpp {
     my($self) = @_;
     return '' unless $self->needs_linking;
-    my($xsdir) = $self->catdir($self->{PERL_LIB},'ExtUtils');
-    # drop back to old location if xsubpp is not in new location yet
-    $xsdir = $self->catdir($self->{PERL_SRC},'ext') 
-      unless (-f $self->catfile($xsdir,'xsubpp'));
-    my(@tmdeps) = '$(XSUBPPDIR)typemap';
+
+    my $xsdir;
+    foreach my $dir (@INC) {
+        $xsdir = $self->catdir($dir, 'ExtUtils');
+        if( -r $self->catfile($xsdir, "xsubpp") ) {
+            last;
+        }
+    }
+
+    my $tmdir   = File::Spec->catdir($self->{PERL_LIB},"ExtUtils");
+    my(@tmdeps) = $self->catfile($tmdir,'typemap');
     if( $self->{TYPEMAPS} ){
        my $typemap;
        foreach $typemap (@{$self->{TYPEMAPS}}){
@@ -840,7 +846,7 @@ sub tools_other {
     # than just typing the literal string.
     my $extra_tools = <<'EXTRA_TOOLS';
 
-# Assumes \$(MMS) invokes MMS or MMK
+# Assumes $(MMS) invokes MMS or MMK
 # (It is assumed in some cases later that the default makefile name
 # (Descrip.MMS for MM[SK]) is used.)
 USEMAKEFILE = /Descrip=
@@ -848,7 +854,7 @@ USEMACROS = /Macro=(
 MACROEND = )
 
 # Just in case anyone is using the old macro.
-SAY = $ECHO
+SAY = $(ECHO)
 
 EXTRA_TOOLS
 
@@ -1190,6 +1196,9 @@ sub installbin {
     push @m, "
 EXE_FILES = @exefiles
 
+pure_all :: @to
+       \$(NOECHO) \$(NOOP)
+
 realclean ::
 ";
 
@@ -1206,8 +1215,12 @@ realclean ::
     while (($from,$to) = each %fromto) {
        last unless defined $from;
        my $todir;
-       if ($to =~ m#[/>:\]]#) { $todir = dirname($to); }
-       else                   { ($todir = $to) =~ s/[^\)]+$//; }
+       if ($to =~ m#[/>:\]]#) {
+            $todir = dirname($to); 
+        }
+       else { 
+            ($todir = $to) =~ s/[^\)]+$//; 
+        }
        $todir = $self->fixpath($todir,1);
        push @m, "
 $to : $from \$(FIRST_MAKEFILE) ${todir}\$(DIRFILESEP).exists
@@ -1597,7 +1610,7 @@ uninstall_from_perldirs ::
        $(NOECHO) $(ECHO) "the appropriate files.  Sorry for the inconvenience."
 
 uninstall_from_sitedirs ::
-       $(NOECHO) $(UNINSTALL) ],$self->catfile($self->{SITEARCHEXP},'auto',$self->{FULLEXT},'.packlist'),"\n",q[
+       $(NOECHO) $(UNINSTALL) ].$self->catfile($self->{SITEARCHEXP},'auto',$self->{FULLEXT},'.packlist').q[
        $(NOECHO) $(ECHO) "Uninstall is now deprecated and makes no actual changes."
        $(NOECHO) $(ECHO) "Please check the list above carefully for errors, and manually remove"
        $(NOECHO) $(ECHO) "the appropriate files.  Sorry for the inconvenience."
@@ -1622,18 +1635,18 @@ sub perldepend {
 $(OBJECT) : $(PERL_INC)EXTERN.h, $(PERL_INC)INTERN.h, $(PERL_INC)XSUB.h
 $(OBJECT) : $(PERL_INC)av.h, $(PERL_INC)cc_runtime.h, $(PERL_INC)config.h
 $(OBJECT) : $(PERL_INC)cop.h, $(PERL_INC)cv.h, $(PERL_INC)embed.h
-$(OBJECT) : $(PERL_INC)embedvar.h, $(PERL_INC)fakethr.h, $(PERL_INC)form.h
+$(OBJECT) : $(PERL_INC)embedvar.h, $(PERL_INC)form.h
 $(OBJECT) : $(PERL_INC)gv.h, $(PERL_INC)handy.h, $(PERL_INC)hv.h
 $(OBJECT) : $(PERL_INC)intrpvar.h, $(PERL_INC)iperlsys.h, $(PERL_INC)keywords.h
 $(OBJECT) : $(PERL_INC)mg.h, $(PERL_INC)nostdio.h, $(PERL_INC)op.h
-$(OBJECT) : $(PERL_INC)opcode.h, $(PERL_INC)opnames.h, $(PERL_INC)patchlevel.h
-$(OBJECT) : $(PERL_INC)perl.h, $(PERL_INC)perlapi.h, $(PERL_INC)perlio.h
-$(OBJECT) : $(PERL_INC)perlsdio.h, $(PERL_INC)perlsfio.h, $(PERL_INC)perlvars.h
+$(OBJECT) : $(PERL_INC)opcode.h, $(PERL_INC)patchlevel.h
+$(OBJECT) : $(PERL_INC)perl.h, $(PERL_INC)perlio.h
+$(OBJECT) : $(PERL_INC)perlsdio.h, $(PERL_INC)perlvars.h
 $(OBJECT) : $(PERL_INC)perly.h, $(PERL_INC)pp.h, $(PERL_INC)pp_proto.h
 $(OBJECT) : $(PERL_INC)proto.h, $(PERL_INC)regcomp.h, $(PERL_INC)regexp.h
 $(OBJECT) : $(PERL_INC)regnodes.h, $(PERL_INC)scope.h, $(PERL_INC)sv.h
-$(OBJECT) : $(PERL_INC)thrdvar.h, $(PERL_INC)thread.h, $(PERL_INC)utf8.h
-$(OBJECT) : $(PERL_INC)util.h, $(PERL_INC)vmsish.h, $(PERL_INC)warnings.h
+$(OBJECT) : $(PERL_INC)thrdvar.h, $(PERL_INC)thread.h
+$(OBJECT) : $(PERL_INC)util.h, $(PERL_INC)vmsish.h
 
 ' if $self->{OBJECT}; 
 
@@ -2161,8 +2174,8 @@ sub oneliner {
 
 =item B<echo> (o)
 
-perl trips up on "<foo>" thinking its an input redirect.  So we use the
-native Write sys$output instead.
+perl trips up on "<foo>" thinking it's an input redirect.  So we use the
+native Write command instead.  Besides, its faster.
 
 =cut
 
@@ -2170,12 +2183,12 @@ sub echo {
     my($self, $text, $file, $appending) = @_;
     $appending ||= 0;
 
-    die "The VMS version of echo() cannot currently append" if $appending;
+    my $opencmd = $appending ? 'Open/Append' : 'Open/Write';
 
-    my @cmds = ("\$(NOECHO) Assign $file Sys\$Output");
-    push @cmds, map { '$(NOECHO) Write Sys$Output '.$self->quote_literal($_) } 
+    my @cmds = ("\$(NOECHO) $opencmd MMECHOFILE $file ");
+    push @cmds, map { '$(NOECHO) Write MMECHOFILE '.$self->quote_literal($_) } 
                 split /\n/, $text;
-    push @cmds, '$(NOECHO) Deassign Sys$Output';
+    push @cmds, '$(NOECHO) Close MMECHOFILE';
     return @cmds;
 }
 
@@ -2226,7 +2239,14 @@ sub init_linker {
     $self->{EXPORT_LIST} ||= '$(BASEEXT).opt';
 
     my $shr = $Config{dbgprefix} . 'PERLSHR';
-    $self->{PERL_ARCHIVE} ||= $self->catfile($self->{PERL_SRC},"$shr.$Config{'dlext'}");
+    if ($self->{PERL_SRC}) {
+        $self->{PERL_ARCHIVE} ||=
+          $self->catfile($self->{PERL_SRC}, "$shr.$Config{'dlext'}");
+    }
+    else {
+        $self->{PERL_ARCHIVE} ||=
+          $ENV{$shr} ? $ENV{$shr} : "Sys\$Share:$shr.$Config{'dlext'}";
+    }
 
     $self->{PERL_ARCHIVE_AFTER} ||= '';
 }
@@ -2237,7 +2257,7 @@ Expands MM[KS]/Make macros in a text string, using the contents of
 identically named elements of C<%$self>, and returns the result
 as a file specification in Unix syntax.
 
-NOTE:  This is the cannonical version of the method.  The version in
+NOTE:  This is the canonical version of the method.  The version in
 File::Spec::VMS is deprecated.
 
 =cut
@@ -2295,7 +2315,7 @@ is a VMS-syntax file specification, and if it is not specified, fixpath()
 checks to see whether it matches the name of a directory in the current
 default directory, and returns a directory or file specification accordingly.
 
-NOTE:  This is the cannonical version of the method.  The version in
+NOTE:  This is the canonical version of the method.  The version in
 File::Spec::VMS is deprecated.
 
 =cut
@@ -2348,6 +2368,16 @@ sub fixpath {
 }
 
 
+=item os_flavor
+
+VMS is VMS.
+
+=cut
+
+sub os_flavor {
+    return('VMS');
+}
+
 =back
 
 =cut