SIGN => 1 support for MakeMaker
[p5sagit/p5-mst-13.2.git] / lib / ExtUtils / MM_Unix.pm
index ef96d3d..43c5098 100644 (file)
@@ -14,13 +14,13 @@ use vars qw($VERSION @ISA
             $Is_Mac $Is_OS2 $Is_VMS $Is_Win32 $Is_Win95  $Is_Dos $Is_VOS
             $Is_QNX $Is_AIX $Is_OSF $Is_IRIX  $Is_NetBSD $Is_BSD
             $Is_SunOS4 $Is_Solaris $Is_SunOS
-            $Verbose %pm %static $Xsubpp_Version
+            $Verbose %pm %static
             %Config_Override
            );
 
 use ExtUtils::MakeMaker qw($Verbose neatvalue);
 
-$VERSION = '1.38';
+$VERSION = '1.42';
 
 require ExtUtils::MM_Any;
 @ISA = qw(ExtUtils::MM_Any);
@@ -294,6 +294,7 @@ clean :: clean_subdirs
     push(@otherfiles, $attribs{FILES}) if $attribs{FILES};
     push(@otherfiles, qw[./blib $(MAKE_APERL_FILE) 
                          $(INST_ARCHAUTODIR)/extralibs.all
+                         $(INST_ARCHAUTODIR)/extralibs.ld
                         perlmain.c tmon.out mon.out so_locations pm_to_blib
                         *$(OBJ_EXT) *$(LIB_EXT) perl.exe perl perl$(EXE_EXT)
                         $(BOOTSTRAP) $(BASEEXT).bso
@@ -952,7 +953,7 @@ sub distdir {
     my($self) = shift;
 
     return <<'MAKE_FRAG';
-distdir : metafile metafile_addtomanifest
+distdir : metafile metafile_addtomanifest signature signature_addtomanifest
        $(RM_RF) $(DISTVNAME)
        $(PERLRUN) "-MExtUtils::Manifest=manicopy,maniread" \
                -e "manicopy(maniread(),'$(DISTVNAME)', '$(DIST_CP)');"
@@ -1030,8 +1031,6 @@ sub dynamic {
 
     my($self) = shift;
     '
-## $(INST_PM) has been moved to the all: target.
-## It remains here for awhile to allow for old usage: "make dynamic"
 dynamic :: $(FIRST_MAKEFILE) $(INST_DYNAMIC) $(INST_BOOT)
        $(NOECHO) $(NOOP)
 ';
@@ -1670,7 +1669,7 @@ sub init_DIRFILESEP {
 
 Initializes AR, AR_STATIC_ARGS, BASEEXT, CONFIG, DISTNAME, DLBASE,
 EXE_EXT, FULLEXT, FULLPERL, FULLPERLRUN, FULLPERLRUNINST, INST_*,
-INSTALL*, INSTALLDIRS, LD, LIB_EXT, LIBPERL_A, MAP_TARGET, NAME,
+INSTALL*, INSTALLDIRS, LIB_EXT, LIBPERL_A, MAP_TARGET, NAME,
 OBJ_EXT, PARENT_NAME, PERL, PERL_ARCHLIB, PERL_INC, PERL_LIB,
 PERL_SRC, PERLRUN, PERLRUNINST, PREFIX, VERSION,
 VERSION_SYM, XS_VERSION.
@@ -1871,7 +1870,6 @@ usually solves this kind of problem.
     $self->{AR_STATIC_ARGS} ||= "cr";
 
     # These should never be needed
-    $self->{LD} ||= 'ld';
     $self->{OBJ_EXT} ||= '.o';
     $self->{LIB_EXT} ||= '.a';
 
@@ -1888,7 +1886,7 @@ usually solves this kind of problem.
 
 =item init_others
 
-Initializes EXTRALIBS, BSLOADLIBS, LDLOADLIBS, LIBS, LD_RUN_PATH,
+Initializes EXTRALIBS, BSLOADLIBS, LDLOADLIBS, LIBS, LD_RUN_PATH, LD,
 OBJECT, BOOTDEP, PERLMAINCC, LDFROM, LINKTYPE, SHELL, NOOP,
 FIRST_MAKEFILE, MAKEFILE_OLD, NOECHO, RM_F, RM_RF, TEST_F,
 TOUCH, CP, MV, CHMOD, UMASK_NULL, ECHO, ECHO_N
@@ -1898,6 +1896,8 @@ TOUCH, CP, MV, CHMOD, UMASK_NULL, ECHO, ECHO_N
 sub init_others {      # --- Initialize Other Attributes
     my($self) = shift;
 
+    $self->{LD} ||= 'ld';
+
     # Compute EXTRALIBS, BSLOADLIBS and LDLOADLIBS from $self->{LIBS}
     # Lets look at $self->{LIBS} carefully: It may be an anon array, a string or
     # undefined. In any case we turn it into an anon array:
@@ -2322,7 +2322,10 @@ sub init_PERL {
 
     # Build up a set of file names (not command names).
     my $thisperl = $self->canonpath($^X);
-    $thisperl .= $Config{exe_ext} unless $thisperl =~ m/$Config{exe_ext}$/i;
+    $thisperl .= $Config{exe_ext} unless 
+                # VMS might have a file version # at the end
+      $Is_VMS ? $thisperl =~ m/$Config{exe_ext}(;\d+)?$/i
+              : $thisperl =~ m/$Config{exe_ext}$/i;
 
     # We need a relative path to perl when in the core.
     $thisperl = $self->abs2rel($thisperl) if $self->{PERL_CORE};
@@ -2346,8 +2349,15 @@ sub init_PERL {
     # don't check if perl is executable, maybe they have decided to
     # supply switches with perl
 
+    # When built for debugging, VMS doesn't create perl.exe but ndbgperl.exe.
+    my $perl_name = 'perl';
+    $perl_name = 'ndbgperl' if $Is_VMS && 
+      defined $Config{usevmsdebug} && $Config{usevmsdebug} eq 'define';
+
+    # XXX This logic is flawed.  If "miniperl" is anywhere in the path
+    # it will get confused.  It should be fixed to work only on the filename.
     # Define 'FULLPERL' to be a non-miniperl (used in test: target)
-    ($self->{FULLPERL} = $self->{PERL}) =~ s/miniperl/perl/i
+    ($self->{FULLPERL} = $self->{PERL}) =~ s/miniperl/$perl_name/i
        unless $self->{FULLPERL};
 
     # Little hack to get around VMS's find_perl putting "MCR" in front
@@ -2597,13 +2607,21 @@ sub installbin {
        $fromto{$from}=$to;
     }
     @to   = values %fromto;
+
+    my $fixin;
+    if( $Is_Win32 ) {
+        $fixin = $self->{PERL_CORE} ? '$(PERLRUN) ../../win32/bin/pl2bat.pl'
+                                    : 'pl2bat.bat';
+    }
+    else {
+        $fixin = q{$(PERLRUN) "-MExtUtils::MY" -e "MY->fixin(shift)"};
+    }
+
     push(@m, qq{
 EXE_FILES = @{$self->{EXE_FILES}}
 
-} . ($Is_Win32
-  ? q{FIXIN = pl2bat.bat
-} : q{FIXIN = $(PERLRUN) "-MExtUtils::MY" -e "MY->fixin(shift)"
-}).qq{
+FIXIN = $fixin
+
 pure_all :: @to
        \$(NOECHO) \$(NOOP)
 
@@ -3406,10 +3424,11 @@ sub prefixify {
     my $path = $self->{uc $var} || 
                $Config_Override{lc $var} || $Config{lc $var} || '';
 
+    $rprefix .= '/' if $sprefix =~ m|/$|;
+
     print STDERR "  prefixify $var => $path\n" if $Verbose >= 2;
     print STDERR "    from $sprefix to $rprefix\n" if $Verbose >= 2;
 
-    $rprefix .= '/' if $sprefix =~ m|/$|; # Compensate for the slash
     if( $path !~ s{^\Q$sprefix\E\b}{$rprefix}s && $self->{ARGS}{PREFIX} ) {
 
         print STDERR "    cannot prefix, using default.\n" if $Verbose >= 2;
@@ -3489,7 +3508,7 @@ realclean purge ::  clean realclean_subdirs
         push(@m, "     \$(RM_F) \$(INST_STATIC)\n");
     }
 
-    my @files = ();
+    my @files = values %{$self->{PM}};
     push @files, $attribs{FILES} if $attribs{FILES};
     push @files, '$(FIRST_MAKEFILE)', '$(MAKEFILE_OLD)';
 
@@ -3952,21 +3971,7 @@ sub tool_xsubpp {
     }
 
 
-    my $xsubpp_version = $self->xsubpp_version($self->catfile($xsdir,"xsubpp"));
-
-    # What are the correct thresholds for version 1 && 2 Paul?
-    if ( $xsubpp_version > 1.923 ){
-       $self->{XSPROTOARG} = "" unless defined $self->{XSPROTOARG};
-    } else {
-       if (defined $self->{XSPROTOARG} && $self->{XSPROTOARG} =~ /\-prototypes/) {
-           print STDOUT qq{Warning: This extension wants to pass the switch "-prototypes" to xsubpp.
-       Your version of xsubpp is $xsubpp_version and cannot handle this.
-       Please upgrade to a more recent version of xsubpp.
-};
-       } else {
-           $self->{XSPROTOARG} = "";
-       }
-    }
+    $self->{XSPROTOARG} = "" unless defined $self->{XSPROTOARG};
 
     return qq{
 XSUBPPDIR = $xsdir
@@ -3978,61 +3983,6 @@ XSUBPP_EXTRA_ARGS =
 };
 };
 
-sub xsubpp_version
-{
-    my($self,$xsubpp) = @_;
-    return $Xsubpp_Version if defined $Xsubpp_Version; # global variable
-
-    my ($version) ;
-
-    # try to figure out the version number of the xsubpp on the system
-
-    # first try the -v flag, introduced in 1.921 & 2.000a2
-
-    return "" unless $self->needs_linking;
-
-    my $command = qq{$self->{PERL} "-I$self->{PERL_LIB}" $xsubpp -v 2>&1};
-    print "Running $command\n" if $Verbose >= 2;
-    $version = `$command` ;
-    warn "Running '$command' exits with status " . ($?>>8) if $?;
-    chop $version ;
-
-    return $Xsubpp_Version = $1 if $version =~ /^xsubpp version (.*)/ ;
-
-    # nope, then try something else
-
-    my $counter = '000';
-    my ($file) = 'temp' ;
-    $counter++ while -e "$file$counter"; # don't overwrite anything
-    $file .= $counter;
-
-    open(F, ">$file") or die "Cannot open file '$file': $!\n" ;
-    print F <<EOM ;
-MODULE = fred PACKAGE = fred
-
-int
-fred(a)
-        int     a;
-EOM
-
-    close F ;
-
-    $command = "$self->{PERL} $xsubpp $file 2>&1";
-    print "Running $command\n" if $Verbose >= 2;
-    my $text = `$command` ;
-    warn "Running '$command' exits with status " . ($?>>8) if $?;
-    unlink $file ;
-
-    # gets 1.2 -> 1.92 and 2.000a1
-    return $Xsubpp_Version = $1 if $text =~ /automatically by xsubpp version ([\S]+)\s*/  ;
-
-    # it is either 1.0 or 1.1
-    return $Xsubpp_Version = 1.1 if $text =~ /^Warning: ignored semicolon/ ;
-
-    # none of the above, so 1.0
-    return $Xsubpp_Version = "1.0" ;
-}
-
 
 =item all_target