From: Michael G. Schwern <schwern@pobox.com>
Date: Sun, 16 Dec 2001 17:53:55 +0000 (-0500)
Subject: miniperl found before perl
X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=66929e520036e026099e247dab1737cbf0507b6e;p=p5sagit%2Fp5-mst-13.2.git

miniperl found before perl
Message-ID: <20011216225354.GE8900@blackrider>

p4raw-id: //depot/perl@13731
---

diff --git a/lib/ExtUtils/MM_Unix.pm b/lib/ExtUtils/MM_Unix.pm
index f2b6ef2..2d20314 100644
--- a/lib/ExtUtils/MM_Unix.pm
+++ b/lib/ExtUtils/MM_Unix.pm
@@ -2035,16 +2035,27 @@ usually solves this kind of problem.
     # --- Initialize Perl Binary Locations
 
     # Find Perl 5. The only contract here is that both 'PERL' and 'FULLPERL'
-    # will be working versions of perl 5. miniperl has priority over perl
-    # for PERL to ensure that $(PERL) is usable while building ./ext/*
+    # will be working versions of perl 5.
     my ($component,@defpath);
-    foreach $component ($self->{PERL_SRC}, $self->path(), $Config::Config{binexp}) {
+    foreach $component ($self->{PERL_SRC}, $self->path(), 
+                        $Config::Config{binexp}) 
+    {
 	push @defpath, $component if defined $component;
     }
+
+    my @perls = ($self->canonpath($^X), 'perl', 'perl5', "perl$Config{version}");
+
+    # miniperl has priority over all but the cannonical perl when in the 
+    # core.  Otherwise its a last resort.
+    if( $self->{PERL_CORE} ) {
+        splice @perls, 1, 0, 'miniperl';
+    }
+    else {
+        push @perls, 'miniperl';
+    }
+
     $self->{PERL} ||=
-        $self->find_perl(5.0, [ $self->canonpath($^X), 'miniperl',
-				'perl','perl5',"perl$Config{version}" ],
-	    \@defpath, $Verbose );
+        $self->find_perl(5.0, \@perls, \@defpath, $Verbose );
     # don't check if perl is executable, maybe they have decided to
     # supply switches with perl