.1]; as Re: [PATCH 5.6.1-TRIAL1 and @8223]; was Re: Perlbug 20000322.006 status update
[p5sagit/p5-mst-13.2.git] / lib / ExtUtils / MakeMaker.pm
index 6fe9339..78175f9 100644 (file)
@@ -2,7 +2,7 @@ BEGIN {require 5.002;} # MakeMaker 5.17 was the last MakeMaker that was compatib
 
 package ExtUtils::MakeMaker;
 
-$VERSION = "5.4302";
+$VERSION = "5.45";
 $Version_OK = "5.17";  # Makefiles older than $Version_OK will die
                        # (Will be checked from MakeMaker version 4.13 onwards)
 ($Revision = substr(q$Revision: 1.222 $, 10)) =~ s/\s+$//;
@@ -17,7 +17,7 @@ use Carp ();
 use vars qw(
 
            @ISA @EXPORT @EXPORT_OK $AUTOLOAD
-           $ISA_TTY $Is_Mac $Is_OS2 $Is_VMS $Revision $Setup_done
+           $ISA_TTY $Is_Mac $Is_OS2 $Is_VMS $Revision
            $VERSION $Verbose $Version_OK %Config %Keep_after_flush
            %MM_Sections %Prepend_dot_dot %Recognized_Att_Keys
            @Get_from_Config @MM_Sections @Overridable @Parent
@@ -44,7 +44,7 @@ use vars qw(
 # default routine without having to know under what OS
 # it's running.
 #
-@MM::ISA = qw[ExtUtils::MM_Unix ExtUtils::Liblist ExtUtils::MakeMaker];
+@MM::ISA = qw[ExtUtils::MM_Unix ExtUtils::Liblist::Kid ExtUtils::MakeMaker];
 
 #
 # Setup dummy package:
@@ -60,7 +60,7 @@ use vars qw(
 
 # "predeclare the package: we only load it via AUTOLOAD
 # but we have already mentioned it in @ISA
-package ExtUtils::Liblist;
+package ExtUtils::Liblist::Kid;
 
 package ExtUtils::MakeMaker;
 #
@@ -70,7 +70,7 @@ $Is_VMS   = $^O eq 'VMS';
 $Is_OS2   = $^O eq 'os2';
 $Is_Mac   = $^O eq 'MacOS';
 $Is_Win32 = $^O eq 'MSWin32';
-$Is_Cygwin= $^O =~ /cygwin/i;
+$Is_Cygwin= $^O eq 'cygwin';
 
 require ExtUtils::MM_Unix;
 
@@ -82,7 +82,7 @@ if ($Is_OS2) {
     require ExtUtils::MM_OS2;
 }
 if ($Is_Mac) {
-    require ExtUtils::MM_Mac;
+    require ExtUtils::MM_MacOS;
 }
 if ($Is_Win32) {
     require ExtUtils::MM_Win32;
@@ -91,35 +91,11 @@ if ($Is_Cygwin) {
     require ExtUtils::MM_Cygwin;
 }
 
-# The SelfLoader would bring a lot of overhead for MakeMaker, because
-# we know for sure we will use most of the autoloaded functions once
-# we have to use one of them. So we write our own loader
-
-sub AUTOLOAD {
-    my $code;
-    if (defined fileno(DATA)) {
-       my $fh = select DATA;
-       my $o = $/;                     # For future reads from the file.
-       $/ = "\n__END__\n";
-       $code = <DATA>;
-       $/ = $o;
-       select $fh;
-       close DATA;
-       eval $code;
-       if ($@) {
-           $@ =~ s/ at .*\n//;
-           Carp::croak $@;
-       }
-    } else {
-       warn "AUTOLOAD called unexpectedly for $AUTOLOAD"; 
-    }
-    defined(&$AUTOLOAD) or die "Myloader inconsistency error";
-    goto &$AUTOLOAD;
-}
+full_setup();
 
-# The only subroutine we do not SelfLoad is Version_Check because it's
-# called so often. Loading this minimum still requires 1.2 secs on my
-# Indy :-(
+# The use of the Version_check target has been dropped between perl
+# 5.5.63 and 5.5.64. We must keep the subroutine for a while so that
+# old Makefiles can satisfy the Version_check target.
 
 sub Version_check {
     my($checkversion) = @_;
@@ -140,38 +116,10 @@ sub warnhandler {
     warn @_;
 }
 
-sub ExtUtils::MakeMaker::eval_in_subdirs ;
-sub ExtUtils::MakeMaker::eval_in_x ;
-sub ExtUtils::MakeMaker::full_setup ;
-sub ExtUtils::MakeMaker::writeMakefile ;
-sub ExtUtils::MakeMaker::new ;
-sub ExtUtils::MakeMaker::check_manifest ;
-sub ExtUtils::MakeMaker::parse_args ;
-sub ExtUtils::MakeMaker::check_hints ;
-sub ExtUtils::MakeMaker::mv_all_methods ;
-sub ExtUtils::MakeMaker::skipcheck ;
-sub ExtUtils::MakeMaker::flush ;
-sub ExtUtils::MakeMaker::mkbootstrap ;
-sub ExtUtils::MakeMaker::mksymlists ;
-sub ExtUtils::MakeMaker::neatvalue ;
-sub ExtUtils::MakeMaker::selfdocument ;
-sub ExtUtils::MakeMaker::WriteMakefile ;
-sub ExtUtils::MakeMaker::prompt ($;$) ;
-
-1;
-
-__DATA__
-
-package ExtUtils::MakeMaker;
-
 sub WriteMakefile {
     Carp::croak "WriteMakefile: Need even number of args" if @_ % 2;
     local $SIG{__WARN__} = \&warnhandler;
 
-    unless ($Setup_done++){
-       full_setup();
-       undef &ExtUtils::MakeMaker::full_setup; #safe memory
-    }
     my %att = @_;
     MM->new(\%att)->flush;
 }
@@ -232,7 +180,6 @@ sub eval_in_x {
 
 sub full_setup {
     $Verbose ||= 0;
-    $^W=1;
 
     # package name for the classes into which the first object will be blessed
     $PACKNAME = "PACK000";
@@ -242,7 +189,7 @@ sub full_setup {
     AUTHOR ABSTRACT ABSTRACT_FROM BINARY_LOCATION
     C CAPI CCFLAGS CONFIG CONFIGURE DEFINE DIR DISTNAME DL_FUNCS DL_VARS
     EXCLUDE_EXT EXE_FILES FIRST_MAKEFILE FULLPERL FUNCLIST H 
-    HTMLLIBPODS HTMLSCRIPTPOD IMPORTS
+    HTMLLIBPODS HTMLSCRIPTPODS IMPORTS
     INC INCLUDE_EXT INSTALLARCHLIB INSTALLBIN INSTALLDIRS INSTALLHTMLPRIVLIBDIR
     INSTALLHTMLSCRIPTDIR INSTALLHTMLSITELIBDIR INSTALLMAN1DIR
     INSTALLMAN3DIR INSTALLPRIVLIB INSTALLSCRIPT INSTALLSITEARCH
@@ -250,6 +197,7 @@ sub full_setup {
     INST_HTMLLIBDIR INST_HTMLSCRIPTDIR
     INST_MAN1DIR INST_MAN3DIR INST_SCRIPT LDFROM LIB LIBPERL_A LIBS
     LINKTYPE MAKEAPERL MAKEFILE MAN1PODS MAN3PODS MAP_TARGET MYEXTLIB
+    PERL_MALLOC_OK
     NAME NEEDS_LINKING NOECHO NORECURS NO_VC OBJECT OPTIMIZE PERL PERLMAINCC
     PERL_ARCHLIB PERL_LIB PERL_SRC PERM_RW PERM_RWX
     PL_FILES PM PMLIBDIRS POLLUTE PPM_INSTALL_EXEC PPM_INSTALL_SCRIPT PREFIX
@@ -311,7 +259,8 @@ sub full_setup {
     @Get_from_Config = 
        qw(
           ar cc cccdlflags ccdlflags dlext dlsrc ld lddlflags ldflags libc
-          lib_ext obj_ext osname osvers ranlib sitelibexp sitearchexp so exe_ext
+          lib_ext obj_ext osname osvers ranlib sitelibexp sitearchexp so
+          exe_ext full_ar
          );
 
     my $item;
@@ -381,9 +330,13 @@ sub ExtUtils::MakeMaker::new {
 
     my($prereq);
     foreach $prereq (sort keys %{$self->{PREREQ_PM}}) {
-       my $eval = "use $prereq $self->{PREREQ_PM}->{$prereq}";
+       my $eval = "require $prereq";
        eval $eval;
-       if ($@){
+
+       if ($@) {
+           warn "Warning: prerequisite $prereq failed to load: $@";
+       }
+       elsif ($prereq->VERSION < $self->{PREREQ_PM}->{$prereq} ){
            warn "Warning: prerequisite $prereq $self->{PREREQ_PM}->{$prereq} not found";
 # Why is/was this 'delete' here?  We need PREREQ_PM later to make PPDs.
 #      } else {
@@ -481,7 +434,7 @@ sub ExtUtils::MakeMaker::new {
            else {
                $pthinks =~ s!/Config\.pm$!!; $pthinks =~ s!.*/!!;
            }
-           print STDOUT <<END;
+           print STDOUT <<END unless $self->{UNINSTALLED_PERL};
 Your perl and your Config.pm seem to have different ideas about the architecture
 they are running on.
 Perl thinks: [$pthinks]
@@ -1029,23 +982,39 @@ be
     perl Makefile.PL LIB=~/lib
 
 This will install the module's architecture-independent files into
-~/lib, the architecture-dependent files into ~/lib/$archname/auto.
+~/lib, the architecture-dependent files into ~/lib/$archname.
 
 Another way to specify many INSTALL directories with a single
 parameter is PREFIX.
 
     perl Makefile.PL PREFIX=~
 
-This will replace the string specified by $Config{prefix} in all
-$Config{install*} values.
+This will replace the string specified by C<$Config{prefix}> in all
+C<$Config{install*}> values.
 
 Note, that in both cases the tilde expansion is done by MakeMaker, not
-by perl by default, nor by make. Conflicts between parameters LIB,
-PREFIX and the various INSTALL* arguments are resolved so that 
-XXX
+by perl by default, nor by make.
+
+Conflicts between parameters LIB,
+PREFIX and the various INSTALL* arguments are resolved so that:
+
+=over 4
+
+=item *
+
+setting LIB overrides any setting of INSTALLPRIVLIB, INSTALLARCHLIB,
+INSTALLSITELIB, INSTALLSITEARCH (and they are not affected by PREFIX);
+
+=item *
+
+without LIB, setting PREFIX replaces the initial C<$Config{prefix}>
+part of those INSTALL* arguments, even if the latter are explicitly
+set (but are set to still start with C<$Config{prefix}>).
+
+=back
 
 If the user has superuser privileges, and is not working on AFS
-(Andrew File System) or relatives, then the defaults for
+or relatives, then the defaults for
 INSTALLPRIVLIB, INSTALLARCHLIB, INSTALLSCRIPT, etc. will be appropriate,
 and this incantation will be the best:
 
@@ -1182,7 +1151,7 @@ MakeMaker gives you much more freedom than needed to configure
 internal variables and get different results. It is worth to mention,
 that make(1) also lets you configure most of the variables that are
 used in the Makefile. But in the majority of situations this will not
-be necessary, and should only be done, if the author of a package
+be necessary, and should only be done if the author of a package
 recommends it (or you know what you're doing).
 
 =head2 Using Attributes and Parameters
@@ -1192,11 +1161,6 @@ or as NAME=VALUE pairs on the command line:
 
 =over 2
 
-=item AUTHOR
-
-String containing name (and email address) of package author(s). Is used
-in PPD (Perl Package Description) files for PPM (Perl Package Manager).
-
 =item ABSTRACT
 
 One line description of the module. Will be included in PPD file.
@@ -1207,6 +1171,11 @@ Name of the file that contains the package description. MakeMaker looks
 for a line in the POD matching /^($package\s-\s)(.*)/. This is typically
 the first line in the "=head1 NAME" section. $2 becomes the abstract.
 
+=item AUTHOR
+
+String containing name (and email address) of package author(s). Is used
+in PPD (Perl Package Description) files for PPM (Perl Package Manager).
+
 =item BINARY_LOCATION
 
 Used when creating PPD files for binary packages.  It can be set to a
@@ -1456,11 +1425,6 @@ to INSTALLBIN during 'make install'
 Old name for INST_SCRIPT. Deprecated. Please use INST_SCRIPT if you
 need to use it.
 
-=item INST_LIB
-
-Directory where we put library files of this extension while building
-it.
-
 =item INST_HTMLLIBDIR
 
 Directory to hold the man pages in HTML format at 'make' time
@@ -1469,6 +1433,11 @@ Directory to hold the man pages in HTML format at 'make' time
 
 Directory to hold the man pages in HTML format at 'make' time
 
+=item INST_LIB
+
+Directory where we put library files of this extension while building
+it.
+
 =item INST_MAN1DIR
 
 Directory to hold the man pages at 'make' time
@@ -1480,7 +1449,7 @@ Directory to hold the man pages at 'make' time
 =item INST_SCRIPT
 
 Directory, where executable files should be installed during
-'make'. Defaults to "./blib/bin", just to have a dummy location during
+'make'. Defaults to "./blib/script", just to have a dummy location during
 testing. make install will copy the files in INST_SCRIPT to
 INSTALLSCRIPT.
 
@@ -1492,8 +1461,12 @@ specify ld flags)
 
 =item LIB
 
-LIB can only be set at C<perl Makefile.PL> time. It has the effect of
+LIB should only be set at C<perl Makefile.PL> time but is allowed as a
+MakeMaker argument. It has the effect of
 setting both INSTALLPRIVLIB and INSTALLSITELIB to that value regardless any
+explicit setting of those arguments (or of PREFIX).  
+INSTALLARCHLIB and INSTALLSITEARCH are set to the corresponding 
+architecture subdirectory.
 
 =item LIBPERL_A
 
@@ -1546,10 +1519,11 @@ at Configure time.
 
 =item MAN3PODS
 
-Hashref of .pm and .pod files. MakeMaker will default this to all
- .pod and any .pm files that include POD directives. The files listed
-here will be converted to man pages and installed as was requested
-at Configure time.
+Hashref that assigns to *.pm and *.pod files the files into which the
+manpages are to be written. MakeMaker parses all *.pod and *.pm files
+for POD directives. Files that contain POD will be the default keys of
+the MAN3PODS hashref. These will then be converted to man pages during
+C<make> and will be installed during C<make install>.
 
 =item MAP_TARGET
 
@@ -1569,9 +1543,9 @@ Makefile.PL.
 
 =item NEEDS_LINKING
 
-MakeMaker will figure out, if an extension contains linkable code
+MakeMaker will figure out if an extension contains linkable code
 anywhere down the directory tree, and will set this variable
-accordingly, but you can speed it up a very little bit, if you define
+accordingly, but you can speed it up a very little bit if you define
 this boolean variable yourself.
 
 =item NOECHO
@@ -1586,7 +1560,7 @@ Boolean.  Attribute to inhibit descending into subdirectories.
 
 =item NO_VC
 
-In general any generated Makefile checks for the current version of
+In general, any generated Makefile checks for the current version of
 MakeMaker and the version the Makefile was built under. If NO_VC is
 set, the version check is neglected. Do not write this into your
 Makefile.PL, use it interactively instead.
@@ -1597,6 +1571,8 @@ List of object files, defaults to '$(BASEEXT)$(OBJ_EXT)', but can be a long
 string containing all object files, e.g. "tkpBind.o
 tkpButton.o tkpCanvas.o"
 
+(Where BASEEXT is the last component of NAME, and OBJ_EXT is $Config{obj_ext}.)
+
 =item OPTIMIZE
 
 Defaults to C<-O>. Set it to C<-g> to turn debugging on. The flag is
@@ -1613,12 +1589,40 @@ to $(CC).
 
 =item PERL_ARCHLIB
 
-Same as above for architecture dependent files
+Same as below, but for architecture dependent files.
 
 =item PERL_LIB
 
 Directory containing the Perl library to use.
 
+=item PERL_MALLOC_OK
+
+defaults to 0.  Should be set to TRUE if the extension can work with
+the memory allocation routines substituted by the Perl malloc() subsystem.
+This should be applicable to most extensions with exceptions of those
+
+=over 4
+
+=item *
+
+with bugs in memory allocations which are caught by Perl's malloc();
+
+=item *
+
+which interact with the memory allocator in other ways than via
+malloc(), realloc(), free(), calloc(), sbrk() and brk();
+
+=item *
+
+which rely on special alignment which is not provided by Perl's malloc().
+
+=back
+
+B<NOTE.>  Negligence to set this flag in I<any one> of loaded extension
+nullifies many advantages of Perl's malloc(), such as better usage of
+system resources, error detection, memory usage reporting, catchable failure
+of memory allocations, etc.
+
 =item PERL_SRC
 
 Directory containing the Perl source code (use of this should be
@@ -1667,17 +1671,19 @@ they contain will be installed in the corresponding location in the
 library.  A libscan() method can be used to alter the behaviour.
 Defining PM in the Makefile.PL will override PMLIBDIRS.
 
+(Where BASEEXT is the last component of NAME.)
+
 =item POLLUTE
 
 Release 5.005 grandfathered old global symbol names by providing preprocessor
-macros for extension source compatibility.  As of release 5.006, these
+macros for extension source compatibility.  As of release 5.6, these
 preprocessor definitions are not available by default.  The POLLUTE flag
 specifies that the old names should still be defined:
 
   perl Makefile.PL POLLUTE=1
 
 Please inform the module author if this is necessary to successfully install
-a module under 5.006 or later.
+a module under 5.6 or later.
 
 =item PPM_INSTALL_EXEC
 
@@ -1707,8 +1713,8 @@ only check if any version is installed already.
 =item SKIP
 
 Arryref. E.g. [qw(name1 name2)] skip (do not write) sections of the
-Makefile. Caution! Do not use the SKIP attribute for the neglectible
-speedup. It may seriously damage the resulting Makefile. Only use it,
+Makefile. Caution! Do not use the SKIP attribute for the negligible
+speedup. It may seriously damage the resulting Makefile. Only use it
 if you really need it.
 
 =item TYPEMAPS
@@ -1744,6 +1750,7 @@ MakeMaker object. The following lines will be parsed o.k.:
     ( $VERSION ) = '$Revision: 1.222 $ ' =~ /\$Revision:\s+([^\s]+)/;
     $FOO::VERSION = '1.10';
     *FOO::VERSION = \'1.11';
+    our $VERSION = 1.2.3;      # new for perl5.6.0 
 
 but these will fail:
 
@@ -1751,6 +1758,8 @@ but these will fail:
     local $VERSION = '1.02';
     local $FOO::VERSION = '1.30';
 
+(Putting C<my> or C<local> on the preceding line will work o.k.)
+
 The file named in VERSION_FROM is not added as a dependency to
 Makefile. This is not really correct, but it would be a major pain
 during development to have to rewrite the Makefile for any smallish
@@ -1805,6 +1814,8 @@ part of the Makefile.
 
   {ANY_TARGET => ANY_DEPENDECY, ...}
 
+(ANY_TARGET must not be given a double-colon rule by MakeMaker.)
+
 =item dist
 
   {TARFLAGS => 'cvfF', COMPRESS => 'gzip', SUFFIX => '.gz',
@@ -1831,7 +1842,7 @@ NB: Extensions that have nothing but *.pm files had to say
   {LINKTYPE => ''}
 
 with Pre-5.0 MakeMakers. Since version 5.00 of MakeMaker such a line
-can be deleted safely. MakeMaker recognizes, when there's nothing to
+can be deleted safely. MakeMaker recognizes when there's nothing to
 be linked.
 
 =item macro
@@ -1934,7 +1945,7 @@ details)
 =item    make distclean
 
 does a realclean first and then the distcheck. Note that this is not
-needed to build a new distribution as long as you are sure, that the
+needed to build a new distribution as long as you are sure that the
 MANIFEST file is ok.
 
 =item    make manifest
@@ -2049,10 +2060,10 @@ ExtUtils::Install, ExtUtils::Embed
 =head1 AUTHORS
 
 Andy Dougherty <F<doughera@lafcol.lafayette.edu>>, Andreas KE<ouml>nig
-<F<A.Koenig@franz.ww.TU-Berlin.DE>>, Tim Bunce <F<Tim.Bunce@ig.co.uk>>.
-VMS support by Charles Bailey <F<bailey@newman.upenn.edu>>.  OS/2
-support by Ilya Zakharevich <F<ilya@math.ohio-state.edu>>.  Contact the
-makemaker mailing list C<mailto:makemaker@franz.ww.tu-berlin.de>, if
-you have any questions.
+<F<andreas.koenig@mind.de>>, Tim Bunce <F<Tim.Bunce@ig.co.uk>>.  VMS
+support by Charles Bailey <F<bailey@newman.upenn.edu>>.  OS/2 support
+by Ilya Zakharevich <F<ilya@math.ohio-state.edu>>.
+
+Send patches and bug reports to <F<perlbug@perl.org>>.
 
 =cut