This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
use a better prefixify() heuristic than m/perl/ (prefix/lib/perl5
authorGurusamy Sarathy <gsar@cpan.org>
Sat, 17 Jul 1999 20:04:17 +0000 (20:04 +0000)
committerGurusamy Sarathy <gsar@cpan.org>
Sat, 17 Jul 1999 20:04:17 +0000 (20:04 +0000)
and prefix/lib/perl5/man are ass_u_med only if those directories
actually exist; else prefix/{lib,man} are used)

p4raw-id: //depot/perl@3682

lib/ExtUtils/MM_Unix.pm

index 0e4712c..282d471 100644 (file)
@@ -11,8 +11,7 @@ use vars qw($VERSION $Is_Mac $Is_OS2 $Is_VMS $Is_Win32 $Is_Dos $Is_PERL_OBJECT
 $VERSION = substr q$Revision: 1.12602 $, 10;
 # $Id: MM_Unix.pm,v 1.126 1998/06/28 21:32:49 k Exp k $
 
-Exporter::import('ExtUtils::MakeMaker',
-       qw( $Verbose &neatvalue));
+Exporter::import('ExtUtils::MakeMaker', qw($Verbose &neatvalue));
 
 $Is_OS2 = $^O eq 'os2';
 $Is_Mac = $^O eq 'MacOS';
@@ -1760,8 +1759,7 @@ usually solves this kind of problem.
 
     my($install_variable,$search_prefix,$replace_prefix);
 
-    # The rule, taken from Configure, is that if prefix contains perl,
-    # we shape the tree
+    # If the prefix contains perl, Configure shapes the tree as follows:
     #    perlprefix/lib/                INSTALLPRIVLIB
     #    perlprefix/lib/pod/
     #    perlprefix/lib/site_perl/     INSTALLSITELIB
@@ -1773,6 +1771,11 @@ usually solves this kind of problem.
     #    prefix/lib/perl5/site_perl/   INSTALLSITELIB
     #    prefix/bin/                   INSTALLBIN
     #    prefix/lib/perl5/man/         INSTALLMAN1DIR
+    #
+    # The above results in various kinds of breakage on various
+    # platforms, so we cope with it as follows: if prefix/lib/perl5
+    # or prefix/lib/perl5/man exist, we'll replace those instead
+    # of /prefix/{lib,man}
 
     $replace_prefix = qq[\$\(PREFIX\)];
     for $install_variable (qw/
@@ -1781,36 +1784,45 @@ usually solves this kind of problem.
                           /) {
        $self->prefixify($install_variable,$configure_prefix,$replace_prefix);
     }
-    $search_prefix = $configure_prefix =~ /perl/ ?
-       $self->catdir($configure_prefix,"lib") :
-       $self->catdir($configure_prefix,"lib","perl5");
+    my $funkylibdir = $self->catdir($configure_prefix,"lib","perl5");
+    $funkylibdir = '' unless -d $funklibdir;
+    $search_prefix = $funkylibdir || $self->catdir($configure_prefix,"lib");
     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");
+    }
+    else {
+       if (-d $self->catdir($self->{PREFIX},"lib","perl5")) {
+           $replace_prefix = $self->catdir(qq[\$\(PREFIX\)],"lib", "perl5");
+       }
+       else {
+           $replace_prefix = $self->catdir(qq[\$\(PREFIX\)],"lib");
+       }
        for $install_variable (qw/
                               INSTALLPRIVLIB
                               INSTALLARCHLIB
                               INSTALLSITELIB
                               INSTALLSITEARCH
-                              /) {
+                              /)
+       {
            $self->prefixify($install_variable,$search_prefix,$replace_prefix);
        }
     }
-    $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");
+    my $funkymandir = $self->catdir($configure_prefix,"lib","perl5","man");
+    $funkymandir = '' unless -d $funkmandir;
+    $search_prefix = $funkymandir || $self->catdir($configure_prefix,"man");
+    if (-d $self->catdir($self->{PREFIX},"lib","perl5", "man")) {
+       $replace_prefix = $self->catdir(qq[\$\(PREFIX\)],"lib", "perl5", "man");
+    }
+    else {
+       $replace_prefix = $self->catdir(qq[\$\(PREFIX\)],"man");
+    }
     for $install_variable (qw/
                           INSTALLMAN1DIR
                           INSTALLMAN3DIR
-                          /) {
+                          /)
+    {
        $self->prefixify($install_variable,$search_prefix,$replace_prefix);
     }