applied suggested patch, adapted for all platforms
[p5sagit/p5-mst-13.2.git] / lib / ExtUtils / MakeMaker.pm
index 168c98d..f370640 100644 (file)
@@ -2,10 +2,10 @@ BEGIN {require 5.002;} # MakeMaker 5.17 was the last MakeMaker that was compatib
 
 package ExtUtils::MakeMaker;
 
-$Version = $VERSION = "5.42";
+$Version = $VERSION = "5.4301";
 $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.216 $, 10)) =~ s/\s+$//;
+($Revision = substr(q$Revision: 1.222 $, 10)) =~ s/\s+$//;
 
 
 
@@ -73,6 +73,10 @@ $Is_OS2   = $^O eq 'os2';
 $Is_Mac   = $^O eq 'MacOS';
 $Is_Win32 = $^O eq 'MSWin32';
 
+# This is for module authors to query, so they can enable 'CAPI' => 'TRUE'
+# in their Makefile.pl
+$CAPI_support = 1;
+
 require ExtUtils::MM_Unix;
 
 if ($Is_VMS) {
@@ -176,17 +180,19 @@ sub WriteMakefile {
 
 sub prompt ($;$) {
     my($mess,$def)=@_;
-    $ISA_TTY = -t STDIN && -t STDOUT ;
+    $ISA_TTY = -t STDIN && (-t STDOUT || !(-f STDOUT || -c STDOUT)) ;  # Pipe?
     Carp::confess("prompt function called without an argument") unless defined $mess;
     my $dispdef = defined $def ? "[$def] " : " ";
     $def = defined $def ? $def : "";
     my $ans;
+    local $|=1;
+    print "$mess $dispdef";
     if ($ISA_TTY) {
-       local $|=1;
-       print "$mess $dispdef";
        chomp($ans = <STDIN>);
+    } else {
+       print "$def\n";
     }
-    return $ans || $def;
+    return ($ans ne '') ? $ans : $def;
 }
 
 sub eval_in_subdirs {
@@ -235,16 +241,17 @@ sub full_setup {
 
     @Attrib_help = qw/
 
-    AUTHOR ABSTRACT ABSTRACT_FROM BINARY_LOCATION LICENSE_HREF CAPI
-    C CCFLAGS CONFIG CONFIGURE DEFINE DIR DISTNAME DL_FUNCS DL_VARS
-    EXE_FILES EXCLUDE_EXT INCLUDE_EXT NO_VC FIRST_MAKEFILE FULLPERL H
-    INC INSTALLARCHLIB INSTALLBIN INSTALLDIRS INSTALLMAN1DIR
+    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
+    INC INCLUDE_EXT INSTALLARCHLIB INSTALLBIN INSTALLDIRS INSTALLMAN1DIR
     INSTALLMAN3DIR INSTALLPRIVLIB INSTALLSCRIPT INSTALLSITEARCH
     INSTALLSITELIB INST_ARCHLIB INST_BIN INST_EXE INST_LIB
-    INST_MAN1DIR INST_MAN3DIR INST_SCRIPT LDFROM LIBPERL_A LIB LIBS
+    INST_MAN1DIR INST_MAN3DIR INST_SCRIPT LDFROM LIB LIBPERL_A LIBS LICENSE_HREF
     LINKTYPE MAKEAPERL MAKEFILE MAN1PODS MAN3PODS MAP_TARGET MYEXTLIB
-    NAME NEEDS_LINKING NOECHO NORECURS OBJECT OPTIMIZE PERL PERLMAINCC
-    PERL_ARCHLIB PERL_LIB PERL_SRC PL_FILES PM PMLIBDIRS PREFIX
+    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 PPM_INSTALL_SCRIPT PPM_INSTALL_EXEC PREFIX
     PREREQ_PM SKIP TYPEMAPS VERSION VERSION_FROM XS XSOPT XSPROTOARG
     XS_VERSION clean depend dist dynamic_lib linkext macro realclean
     tool_autosplit
@@ -286,8 +293,8 @@ sub full_setup {
     @Overridable = @MM_Sections;
     push @Overridable, qw[
 
- dir_target libscan makeaperl needs_linking subdir_x test_via_harness
- test_via_script
+ dir_target libscan makeaperl needs_linking perm_rw perm_rwx
+ subdir_x test_via_harness test_via_script
 
                         ];
 
@@ -382,7 +389,7 @@ sub ExtUtils::MakeMaker::new {
        eval $eval;
        if ($@){
            warn "Warning: prerequisite $prereq $self->{PREREQ_PM}->{$prereq} not found";
-# mjn
+# Why is/was this 'delete' here?  We need PREREQ_PM later to make PPDs.
 #      } else {
 #          delete $self->{PREREQ_PM}{$prereq};
        }
@@ -445,7 +452,7 @@ sub ExtUtils::MakeMaker::new {
        }
        $self->{PARENT}->{CHILDREN}->{$newclass} = $self if $self->{PARENT};
     } else {
-       parse_args($self,@ARGV);
+       parse_args($self,split(' ', $ENV{MAKEMAKEROPT} || ''),@ARGV);
     }
 
     $self->{NAME} ||= $self->guess_name;
@@ -1266,13 +1273,6 @@ Ref to array of executable files. The files will be copied to the
 INST_SCRIPT directory. Make realclean will delete them from there
 again.
 
-=item NO_VC
-
-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.
-
 =item FIRST_MAKEFILE
 
 The name of the Makefile to be produced. Defaults to the contents of
@@ -1283,6 +1283,13 @@ that will be produced for the MAP_TARGET.
 
 Perl binary able to run this extension.
 
+=item FUNCLIST
+
+This provides an alternate means to specify function names to be
+exported from the extension.  Its value is a reference to an
+array of function names to be exported by the extension.  These
+names are passed through unaltered to the linker options file.
+
 =item H
 
 Ref to array of *.h file names. Similar to C.
@@ -1396,16 +1403,16 @@ defaults to "$(OBJECT)" and is used in the ld command to specify
 what files to link/load from (also see dynamic_lib below for how to
 specify ld flags)
 
-=item LIBPERL_A
-
-The filename of the perllibrary that will be used together with this
-extension. Defaults to libperl.a.
-
 =item LIB
 
 LIB can only be set at C<perl Makefile.PL> time. It has the effect of
 setting both INSTALLPRIVLIB and INSTALLSITELIB to that value regardless any
 
+=item LIBPERL_A
+
+The filename of the perllibrary that will be used together with this
+extension. Defaults to libperl.a.
+
 =item LIBS
 
 An anonymous array of alternative library
@@ -1490,6 +1497,13 @@ itself.
 
 Boolean.  Attribute to inhibit descending into subdirectories.
 
+=item NO_VC
+
+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.
+
 =item OBJECT
 
 List of object files, defaults to '$(BASEEXT)$(OBJ_EXT)', but can be a long
@@ -1523,6 +1537,16 @@ Directory containing the Perl library to use.
 Directory containing the Perl source code (use of this should be
 avoided, it may be undefined)
 
+=item PERM_RW
+
+Desired Permission for read/writable files. Defaults to C<644>.
+See also L<MM_Unix/perm_rw>.
+
+=item PERM_RWX
+
+Desired permission for executable files. Defaults to C<755>.
+See also L<MM_Unix/perm_rwx>.
+
 =item PL_FILES
 
 Ref to hash of files to be processed as perl programs. MakeMaker
@@ -1605,7 +1629,7 @@ MakeMaker object. The following lines will be parsed o.k.:
 
     $VERSION = '1.00';
     *VERSION = \'1.01';
-    ( $VERSION ) = '$Revision: 1.216 $ ' =~ /\$Revision:\s+([^\s]+)/;
+    ( $VERSION ) = '$Revision: 1.222 $ ' =~ /\$Revision:\s+([^\s]+)/;
     $FOO::VERSION = '1.10';
     *FOO::VERSION = \'1.11';
 
@@ -1671,7 +1695,7 @@ part of the Makefile.
 
 =item dist
 
-  {TARFLAGS => 'cvfF', COMPRESS => 'gzip', SUFFIX => 'gz',
+  {TARFLAGS => 'cvfF', COMPRESS => 'gzip', SUFFIX => '.gz',
   SHAR => 'shar -m', DIST_CP => 'ln', ZIP => '/bin/zip',
   ZIPFLAGS => '-rl', DIST_DEFAULT => 'private tardist' }
 
@@ -1741,14 +1765,14 @@ or you can edit the default by saying something like:
            $inherited;
        }
 
-If you running experiments with embedding perl as a library into other
-applications, you might find MakeMaker not sufficient. You'd better
-have a look at ExtUtils::embed which is a collection of utilities for
-embedding.
+If you are running experiments with embedding perl as a library into
+other applications, you might find MakeMaker is not sufficient. You'd
+better have a look at ExtUtils::Embed which is a collection of utilities
+for embedding.
 
 If you still need a different solution, try to develop another
-subroutine, that fits your needs and submit the diffs to
-F<perl5-porters@nicoh.com> or F<comp.lang.perl.misc> as appropriate.
+subroutine that fits your needs and submit the diffs to
+F<perl5-porters@perl.org> or F<comp.lang.perl.moderated> as appropriate.
 
 For a complete description of all MakeMaker methods see L<ExtUtils::MM_Unix>.
 
@@ -1866,13 +1890,13 @@ reference to the dist attribute of the WriteMakefile call. The
 following parameters are recognized:
 
     CI           ('ci -u')
-    COMPRESS     ('compress')
+    COMPRESS     ('gzip --best')
     POSTOP       ('@ :')
     PREOP        ('@ :')
     TO_UNIX      (depends on the system)
     RCS_LABEL    ('rcs -q -Nv$(VERSION_SYM):')
     SHAR         ('shar')
-    SUFFIX       ('Z')
+    SUFFIX       ('.gz')
     TAR          ('tar')
     TARFLAGS     ('cvf')
     ZIP          ('zip')
@@ -1880,7 +1904,7 @@ following parameters are recognized:
 
 An example:
 
-    WriteMakefile( 'dist' => { COMPRESS=>"gzip", SUFFIX=>"gz" })
+    WriteMakefile( 'dist' => { COMPRESS=>"bzip2", SUFFIX=>".bz2" })
 
 =head2 Disabling an extension
 
@@ -1899,16 +1923,28 @@ in a subdirectory of some other distribution, or is listed as a
 dependency in a CPAN::Bundle, but the functionality is supported by
 different means on the current architecture).
 
+=head1 ENVIRONMENT
+
+=over 8
+
+=item MAKEMAKEROPT
+
+Command line options used by C<MakeMaker-E<gt>new()>, and thus by
+C<WriteMakefile()>.  The string is split on whitespace, and the result
+is processed before any actual command line arguments are processed.
+
+=back
+
 =head1 SEE ALSO
 
 ExtUtils::MM_Unix, ExtUtils::Manifest, ExtUtils::testlib,
-ExtUtils::Install, ExtUtils::embed
+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@genetics.upenn.edu>>.  OS/2
+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.