1 package ExtUtils::MakeMaker::TieAtt;
2 # this package will go away again, when we don't have modules around
3 # anymore that import %att It ties an empty %att and records in which
4 # object this %att was tied. FETCH and STORE return/store-to the
5 # appropriate value from %$self
7 # the warndirectuse method warns if somebody calls MM->something. It
8 # has nothing to do with the tie'd %att.
13 bless { SECRETHASH => $_[1]};
17 print "Warning (non-fatal): Importing of %att is deprecated [$_[1]]
18 use \$self instead\n" unless ++$Enough>$Enough_limit;
19 print "Further ExtUtils::MakeMaker::TieAtt warnings suppressed\n" if $Enough==$Enough_limit;
20 $_[0]->{SECRETHASH}->{$_[1]};
24 print "Warning (non-fatal): Importing of %att is deprecated [$_[1]][$_[2]]
25 use \$self instead\n" unless ++$Enough>$Enough_limit;
26 print "Further ExtUtils::MakeMaker::TieAtt warnings suppressed\n" if $Enough==$Enough_limit;
27 $_[0]->{SECRETHASH}->{$_[1]} = $_[2];
31 print "Warning (non-fatal): Importing of %att is deprecated [FIRSTKEY]
32 use \$self instead\n" unless ++$Enough>$Enough_limit;
33 print "Further ExtUtils::MakeMaker::TieAtt warnings suppressed\n" if $Enough==$Enough_limit;
34 each %{$_[0]->{SECRETHASH}};
38 each %{$_[0]->{SECRETHASH}};
46 return if $Enough>$Enough_limit;
47 print STDOUT "Warning (non-fatal): Direct use of class methods deprecated; use\n";
48 my($method) = $caller =~ /.*:(\w+)$/;
51 $self->MM::', $method, "();
53 print "Further ExtUtils::MakeMaker::TieAtt warnings suppressed\n"
54 if ++$Enough==$Enough_limit;
57 package ExtUtils::MakeMaker;
59 # Last edited $Date: 1996/01/28 11:33:38 $ by Andreas Koenig
60 # $Id: MakeMaker.pm,v 1.141 1996/01/28 11:33:38 k Exp $
62 $Version = $VERSION = "5.18";
64 $ExtUtils::MakeMaker::Version_OK = "5.05"; # Makefiles older than $Version_OK will die
65 # (Will be checked from MakeMaker version 4.13 onwards)
71 require ExtUtils::Manifest;
72 require ExtUtils::Liblist;
75 eval {require DynaLoader;}; # Get mod2fname, if defined. Will fail
78 # print join "**\n**", "", %INC, "";
84 @EXPORT = qw(&WriteMakefile &writeMakefile $Verbose &prompt);
85 @EXPORT_OK = qw($Version $VERSION &Version_check
86 &help &neatvalue &mkbootstrap &mksymlists
87 %att ## Import of %att is deprecated, please use OO features!
90 if ($Is_VMS = ($Config::Config{osname} eq 'VMS')) {
91 require ExtUtils::MM_VMS;
92 require VMS::Filespec;
93 import VMS::Filespec '&vmsify';
95 $Is_OS2 = $Config::Config{osname} =~ m|^os/?2$|i ;
96 $ENV{EMXSHELL} = 'sh' if $Is_OS2; # to run `commands`
98 $ExtUtils::MakeMaker::Verbose = 0 unless defined $ExtUtils::MakeMaker::Verbose;
100 #$SIG{__DIE__} = sub { print @_, Carp::longmess(); die; };
101 ####$SIG{__WARN__} = sub { print Carp::longmess(); warn @_; };
102 $SIG{__WARN__} = sub {
103 $_[0] =~ /^Use of uninitialized value/ && return;
104 $_[0] =~ /used only once/ && return;
105 $_[0] =~ /^Subroutine\s+[\w:]+\s+redefined/ && return;
109 # Setup dummy package:
110 # MY exists for overriding methods to be defined within
111 unshift(@MY::ISA, qw(MM));
113 # Dummy package MM inherits actual methods from OS-specific
114 # default packages. We use this intermediate package so
115 # MY::XYZ->func() can call MM->func() and get the proper
116 # default routine without having to know under what OS
119 @MM::ISA = qw[ExtUtils::MM_Unix ExtUtils::MakeMaker];
120 unshift @MM::ISA, 'ExtUtils::MM_VMS' if $Is_VMS;
121 unshift @MM::ISA, 'ExtUtils::MM_OS2' if $Is_OS2;
124 @ExtUtils::MakeMaker::MM_Sections_spec = (
125 post_initialize => {},
128 const_loadlibs => {},
129 const_cccmd => {}, # the last but one addition here (CONST_CCCMD)
130 tool_autosplit => {},
136 post_constants => {},
141 top_targets => {}, # currently the last section that adds a key to $self (DIR_TARGET)
165 staticmake => {}, # Sadly this defines more macros
167 postamble => {}, # should always be last the user has hands on
168 selfdocument => {}, # well, he may override it, but he won't do it
170 # loses section ordering
171 %ExtUtils::MakeMaker::MM_Sections = @ExtUtils::MakeMaker::MM_Sections_spec;
173 @ExtUtils::MakeMaker::MM_Sections = grep(!ref, @ExtUtils::MakeMaker::MM_Sections_spec);
175 %ExtUtils::MakeMaker::Recognized_Att_Keys = %ExtUtils::MakeMaker::MM_Sections; # All sections are valid keys.
177 @ExtUtils::MakeMaker::Get_from_Config = qw(
195 foreach $item (split(/\n/,attrib_help())){
196 next unless $item =~ m/^=item\s+(\w+)\s*$/;
197 $ExtUtils::MakeMaker::Recognized_Att_Keys{$1} = $2;
198 print "Attribute '$1' => '$2'\n" if ($ExtUtils::MakeMaker::Verbose >= 2);
200 foreach $item (@ExtUtils::MakeMaker::Get_from_Config) {
201 next unless $Config::Config{$item};
202 $ExtUtils::MakeMaker::Recognized_Att_Keys{uc $item} = $Config::Config{$item};
203 print "Attribute '\U$item\E' => '$Config::Config{$item}'\n"
204 if ($ExtUtils::MakeMaker::Verbose >= 2);
207 %ExtUtils::MakeMaker::Prepend_dot_dot = qw(
208 INST_LIB 1 INST_ARCHLIB 1 INST_EXE 1 MAP_TARGET 1 INST_MAN1DIR 1 INST_MAN3DIR 1
209 PERL_SRC 1 PERL 1 FULLPERL 1
211 $PACKNAME = "PACK000";
216 The extension you are trying to build apparently is rather old and
217 most probably outdated. We detect that from the fact, that a
218 subroutine "writeMakefile" is called, and this subroutine is not
219 supported anymore since about October 1994.
221 Please contact the author or look into CPAN (details about CPAN can be
222 found in the FAQ and at http:/www.perl.com) for a more recent version
223 of the extension. If you're really desperate, you can try to change
224 the subroutine name from writeMakefile to WriteMakefile and rerun
225 'perl Makefile.PL', but you're most probably left alone, when you do
234 Carp::croak "WriteMakefile: Need even number of args" if @_ % 2;
236 MM->new(\%att)->flush;
240 my($class,$self) = @_;
243 print STDOUT "MakeMaker (v$ExtUtils::MakeMaker::VERSION)\n" if $ExtUtils::MakeMaker::Verbose;
244 if (-f "MANIFEST" && ! -f "Makefile"){
248 $self = {} unless (defined $self);
252 my(%initial_att) = %$self; # record initial attributes
254 if (defined $self->{CONFIGURE}) {
255 if (ref $self->{CONFIGURE} eq 'CODE') {
256 $self = { %$self, %{&{$self->{CONFIGURE}}}};
258 croak "Attribute 'CONFIGURE' to WriteMakefile() not a code reference\n";
262 # This is for old Makefiles written pre 5.00, will go away
263 if ( Carp::longmess("") =~ /runsubdirpl/s ){
264 $self->{Correct_relativ_directories}++;
266 $self->{Correct_relativ_directories}=0;
269 my $class = ++$PACKNAME;
272 print "Blessing Object into class [$class]\n" if $ExtUtils::MakeMaker::Verbose;
273 mv_all_methods("MY",$class);
275 ######## tie %::att, ExtUtils::MakeMaker::TieAtt, $self;
276 push @ExtUtils::MakeMaker::Parent, $self;
277 @{"$class\:\:ISA"} = 'MM';
280 if (defined $ExtUtils::MakeMaker::Parent[-2]){
281 $self->{PARENT} = $ExtUtils::MakeMaker::Parent[-2];
283 for $key (keys %ExtUtils::MakeMaker::Prepend_dot_dot) {
284 next unless defined $self->{PARENT}{$key};
285 $self->{$key} = $self->{PARENT}{$key};
286 $self->{$key} = $self->catdir("..",$self->{$key})
287 unless $self->{$key} =~ m!^/!;
289 $self->{PARENT}->{CHILDREN}->{$class} = $self if $self->{PARENT};
291 parse_args($self,@ARGV);
294 $self->{NAME} ||= $self->guess_name;
296 ($self->{NAME_SYM} = $self->{NAME}) =~ s/\W+/_/g;
300 if (! $self->{PERL_SRC} ) {
301 my($pthinks) = $INC{'Config.pm'};
302 $pthinks = vmsify($pthinks) if $Is_VMS;
303 if ($pthinks ne $self->catfile($Config::Config{archlibexp},'Config.pm')){
304 $pthinks =~ s!/Config\.pm$!!;
307 Your perl and your Config.pm seem to have different ideas about the architecture
309 Perl thinks: [$pthinks]
310 Config says: [$Config::Config{archname}]
311 This may or may not cause problems. Please check your installation of perl if you
312 have problems building this extension.
317 $self->init_dirscan();
318 $self->init_others();
320 push @{$self->{RESULT}}, <<END;
321 # This Makefile is for the $self->{NAME} extension to perl.
323 # It was generated automatically by MakeMaker version $ExtUtils::MakeMaker::VERSION from the contents
324 # of Makefile.PL. Don't edit this file, edit Makefile.PL instead.
326 # ANY CHANGES MADE HERE WILL BE LOST!
328 # MakeMaker Parameters:
331 foreach $key (sort keys %initial_att){
332 my($v) = neatvalue($initial_att{$key});
333 $v =~ s/(CODE|HASH|ARRAY|SCALAR)\([\dxa-f]+\)/$1\(...\)/;
335 push @{$self->{RESULT}}, "# $key => $v";
338 # turn the SKIP array into a SKIPHASH hash
340 for $skip (@{$self->{SKIP} || []}) {
341 $self->{SKIPHASH}{$skip} = 1;
344 # We run all the subdirectories now. They don't have much to query
345 # from the parent, but the parent has to query them: if they need linking!
347 unless ($self->{NORECURS}) {
348 foreach $dir (@{$self->{DIR}}){
352 open FH, "Makefile.PL";
359 tie %::att, ExtUtils::MakeMaker::TieAtt, $self;
361 foreach $section ( @ExtUtils::MakeMaker::MM_Sections ){
362 print "Processing Makefile '$section' section\n" if ($ExtUtils::MakeMaker::Verbose >= 2);
363 my($skipit) = $self->skipcheck($section);
365 push @{$self->{RESULT}}, "\n# --- MakeMaker $section section $skipit.";
367 my(%a) = %{$self->{$section} || {}};
368 push @{$self->{RESULT}}, "\n# --- MakeMaker $section section:";
369 push @{$self->{RESULT}}, "# " . join ", ", %a if $ExtUtils::MakeMaker::Verbose && %a;
370 push @{$self->{RESULT}}, $self->nicetext($self->$section( %a ));
374 push @{$self->{RESULT}}, "\n# End.";
375 ######## untie %::att;
376 pop @ExtUtils::MakeMaker::Parent;
382 eval {require ExtUtils::Manifest};
384 print STDOUT "Warning: you have not installed the ExtUtils::Manifest
385 module -- skipping check of the MANIFEST file\n";
387 print STDOUT "Checking if your kit is complete...\n";
388 $ExtUtils::Manifest::Quiet=$ExtUtils::Manifest::Quiet=1; #avoid warning
389 my(@missed)=ExtUtils::Manifest::manicheck();
391 print STDOUT "Warning: the following files are missing in your kit:\n";
392 print "\t", join "\n\t", @missed;
394 print STDOUT "Please inform the author.\n";
396 print STDOUT "Looks good\n";
402 my($self, @args) = @_;
404 unless (m/(.*?)=(.*)/){
405 help(),exit 1 if m/^help$/;
406 ++$ExtUtils::MakeMaker::Verbose if m/^verb/;
409 my($name, $value) = ($1, $2);
410 if ($value =~ m/^~(\w+)?/){ # tilde with optional username
411 $value =~ s [^~(\w*)]
413 ((getpwnam($1))[7] || "~$1") :
417 # This may go away, in mid 1996
418 if ($self->{Correct_relativ_directories}){
419 $value = $self->catdir("..",$value)
420 if $ExtUtils::MakeMaker::Prepend_dot_dot{$name} && ! $value =~ m!^/!;
422 $self->{$name} = $value;
424 # This may go away, in mid 1996
425 delete $self->{Correct_relativ_directories};
427 # catch old-style 'potential_libs' and inform user how to 'upgrade'
428 if (defined $self->{potential_libs}){
429 my($msg)="'potential_libs' => '$self->{potential_libs}' should be";
430 if ($self->{potential_libs}){
431 print STDOUT "$msg changed to:\n\t'LIBS' => ['$self->{potential_libs}']\n";
433 print STDOUT "$msg deleted.\n";
435 $self->{LIBS} = [$self->{potential_libs}];
436 delete $self->{potential_libs};
438 # catch old-style 'ARMAYBE' and inform user how to 'upgrade'
439 if (defined $self->{ARMAYBE}){
440 my($armaybe) = $self->{ARMAYBE};
441 print STDOUT "ARMAYBE => '$armaybe' should be changed to:\n",
442 "\t'dynamic_lib' => {ARMAYBE => '$armaybe'}\n";
443 my(%dl) = %{$self->{dynamic_lib} || {}};
444 $self->{dynamic_lib} = { %dl, ARMAYBE => $armaybe};
445 delete $self->{ARMAYBE};
447 if (defined $self->{LDTARGET}){
448 print STDOUT "LDTARGET should be changed to LDFROM\n";
449 $self->{LDFROM} = $self->{LDTARGET};
450 delete $self->{LDTARGET};
452 # Turn a DIR argument on the command line into an array
453 if (defined $self->{DIR} && ref \$self->{DIR} eq 'SCALAR') {
454 # So they can choose from the command line, which extensions they want
455 # the grep enables them to have some colons too much in case they
456 # have to build a list with the shell
457 $self->{DIR} = [grep $_, split ":", $self->{DIR}];
460 foreach $mmkey (sort keys %$self){
461 print STDOUT " $mmkey => ", neatvalue($self->{$mmkey}), "\n" if $ExtUtils::MakeMaker::Verbose;
462 print STDOUT "'$mmkey' is not a known MakeMaker parameter name.\n"
463 unless exists $ExtUtils::MakeMaker::Recognized_Att_Keys{$mmkey};
469 # We allow extension-specific hints files.
471 return unless -d "hints";
473 # First we look for the best hintsfile we have
475 my($hint)="$Config::Config{osname}_$Config::Config{osvers}";
480 # Also try without trailing minor version numbers.
482 last if -f "hints/$hint.pl"; # found
484 last unless $hint =~ s/_[^_]*$//; # nothing to cut off
486 return unless -f "hints/$hint.pl"; # really there
488 # execute the hintsfile:
490 open HINTS, "hints/$hint.pl";
491 @goodhints = <HINTS>;
493 print STDOUT "Processing hints file hints/$hint.pl\n";
494 eval join('',@goodhints);
495 print STDOUT $@ if $@;
501 my($symtab) = \%{"${from}::"};
504 # Here you see the *current* list of methods that are overridable
505 # from Makefile.PL via MY:: subroutines. As of VERSION 5.07 I'm
506 # still trying to reduce the list to some reasonable minimum --
507 # because I want to make it easier for the user. A.K.
509 foreach $method (@ExtUtils::MakeMaker::MM_Sections, qw[ dir_target
510 exescan fileparse fileparse_set_fstype installpm_x libscan makeaperl
511 mksymlists needs_linking runsubdirpl subdir_x test_via_harness
512 test_via_script writedoc ]) {
514 # We cannot say "next" here. Nick might call MY->makeaperl
515 # which isn't defined right now
517 # next unless defined &{"${from}::$method"};
519 *{"${to}::$method"} = \&{"${from}::$method"};
521 # delete would do, if we were sure, nobody ever called
522 # MY->makeaperl directly
524 # delete $symtab->{$method};
526 # If we delete a method, then it will be undefined and cannot
527 # be called. But as long as we have Makefile.PLs that rely on
528 # %MY:: being intact, we have to fill the hole with an
531 eval "package MY; sub $method {local *$method; shift->MY::$method(\@_); }";
535 # We have to clean out %INC also, because the current directory is
536 # changed frequently and Graham Barr prefers to get his version
537 # out of a History.pl file which is "required" so woudn't get
538 # loaded again in another extension requiring a History.pl
541 foreach $inc (keys %INC) {
542 next if $ExtUtils::MakeMaker::NORMAL_INC{$inc};
543 #warn "***$inc*** deleted";
551 BEGIN { $ISA_TTY = -t STDIN && -t STDOUT }
552 Carp::confess("prompt function called without an argument") unless defined $mess;
553 $def = "" unless defined $def;
554 my $dispdef = "[$def] ";
558 print "$mess $dispdef";
559 chop($ans = <STDIN>);
561 return $ans if defined $ans;
566 return $Attrib_Help if $Attrib_Help;
571 #### local $/ = ""; # bug in 5.001m
572 open POD, $INC{"ExtUtils/MakeMaker.pm"}
573 or die "Open $INC{'ExtUtils/MakeMaker.pm'}: $!";
574 while ($line = <POD>) {
575 $switch ||= $line =~ /^=item C\s*$/;
577 last if $line =~ /^=cut/;
581 $Attrib_Help = $help;
584 sub help {print &attrib_help, "\n";}
589 if ($section eq 'dynamic') {
590 print STDOUT "Warning (non-fatal): Target 'dynamic' depends on targets ",
591 "in skipped section 'dynamic_bs'\n"
592 if $self->{SKIPHASH}{dynamic_bs} && $ExtUtils::MakeMaker::Verbose;
593 print STDOUT "Warning (non-fatal): Target 'dynamic' depends on targets ",
594 "in skipped section 'dynamic_lib'\n"
595 if $self->{SKIPHASH}{dynamic_lib} && $ExtUtils::MakeMaker::Verbose;
597 if ($section eq 'dynamic_lib') {
598 print STDOUT "Warning (non-fatal): Target '\$(INST_DYNAMIC)' depends on ",
599 "targets in skipped section 'dynamic_bs'\n"
600 if $self->{SKIPHASH}{dynamic_bs} && $ExtUtils::MakeMaker::Verbose;
602 if ($section eq 'static') {
603 print STDOUT "Warning (non-fatal): Target 'static' depends on targets ",
604 "in skipped section 'static_lib'\n"
605 if $self->{SKIPHASH}{static_lib} && $ExtUtils::MakeMaker::Verbose;
607 return 'skipped' if $self->{SKIPHASH}{$section};
615 print STDOUT "Writing $self->{MAKEFILE} for $self->{NAME}\n";
617 unlink($self->{MAKEFILE}, "MakeMaker.tmp", $Is_VMS ? 'Descrip.MMS' : '');
618 open MAKE, ">MakeMaker.tmp" or die "Unable to open MakeMaker.tmp: $!";
620 for $chunk (@{$self->{RESULT}}) {
621 print MAKE "$chunk\n";
625 my($finalname) = $self->{MAKEFILE};
626 rename("MakeMaker.tmp", $finalname);
627 chmod 0644, $finalname unless $Is_VMS;
628 system("$Config::Config{eunicefix} $finalname") unless $Config::Config{eunicefix} eq ":";
632 my($checkversion) = @_;
633 die "Your Makefile was built with ExtUtils::MakeMaker v $checkversion.
634 Current Version is $ExtUtils::MakeMaker::VERSION. There have been considerable
635 changes in the meantime.
636 Please rerun 'perl Makefile.PL' to regenerate the Makefile.\n"
637 if $checkversion lt $ExtUtils::MakeMaker::Version_OK;
638 printf STDOUT "%s %s %s %s.\n", "Makefile built with ExtUtils::MakeMaker v",
639 $checkversion, "Current Version is", $ExtUtils::MakeMaker::VERSION
640 unless $checkversion == $ExtUtils::MakeMaker::VERSION;
643 # The following mkbootstrap() is only for installations that are calling
644 # the pre-4.1 mkbootstrap() from their old Makefiles. This MakeMaker
645 # writes Makefiles, that use ExtUtils::Mkbootstrap directly.
648 !!! Your Makefile has been built such a long time ago, !!!
649 !!! that is unlikely to work with current MakeMaker. !!!
650 !!! Please rebuild your Makefile !!!
654 # Ditto for mksymlists() as of MakeMaker 5.17
657 !!! Your Makefile has been built such a long time ago, !!!
658 !!! that is unlikely to work with current MakeMaker. !!!
659 !!! Please rebuild your Makefile !!!
665 return "undef" unless defined $v;
667 return "'$v'" unless $t;
669 my(@m, $elem, @neat);
671 foreach $elem (@$v) {
672 push @neat, "'$elem'";
674 push @m, join ", ", @neat;
678 return "$v" unless $t eq 'HASH';
680 push(@m,"$key=>".neatvalue($val)) while (($key,$val) = each %$v);
681 return "{ ".join(', ',@m)." }";
687 if ($ExtUtils::MakeMaker::Verbose){
688 push @m, "\n# Full list of MakeMaker attribute values:";
689 foreach $key (sort keys %$self){
690 next if $key eq 'RESULT' || $key =~ /^[A-Z][a-z]/;
691 my($v) = neatvalue($self->{$key});
692 $v =~ s/(CODE|HASH|ARRAY|SCALAR)\([\dxa-f]+\)/$1\(...\)/;
694 push @m, "# $key => $v";
702 ## ## ## ## # # # # # # #
703 # # # # # # # # # # ## # # # #
704 # # # # # # # # # # # # ##
705 # # # # # # # # # # ##
706 # # # # # # # ## # # #
707 # # # # ####### ##### # # # # #
709 package ExtUtils::MM_Unix;
716 Exporter::import('ExtUtils::MakeMaker',
717 qw( $Verbose &neatvalue));
719 # These attributes cannot be overridden externally
720 @Other_Att_Keys{qw(EXTRALIBS BSLOADLIBS LDLOADLIBS)} = (1) x 3;
722 if ($Is_VMS = $Config::Config{osname} eq 'VMS') {
723 require VMS::Filespec;
724 import VMS::Filespec qw( &vmsify );
727 $Is_OS2 = $ExtUtils::MakeMaker::Is_OS2;
731 my $name = fastcwd();
732 $name =~ s:.*/:: unless ($name =~ s:^.*/ext/::);
734 $name =~ s#[\-_][\d.\-]+$##; # this is new with MM 5.00
741 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
742 $self = $ExtUtils::MakeMaker::Parent[-1];
745 # --- Initialize Module Name and Paths
747 # NAME = The perl module name for this extension (eg DBD::Oracle).
748 # FULLEXT = Pathname for extension directory (eg DBD/Oracle).
749 # BASEEXT = Basename part of FULLEXT. May be just equal FULLEXT.
750 # ROOTEXT = Directory part of FULLEXT with leading /.
752 $self->{NAME}) =~ s!::!/!g ; #eg. BSD/Foo/Socket
754 # Copied from DynaLoader:
756 my(@modparts) = split(/::/,$self->{NAME});
757 my($modfname) = $modparts[-1];
759 # Some systems have restrictions on files names for DLL's etc.
760 # mod2fname returns appropriate file base name (typically truncated)
761 # It may also edit @modparts if required.
762 if (defined &DynaLoader::mod2fname) {
763 $modfname = &DynaLoader::mod2fname(\@modparts);
764 } elsif ($Is_OS2) { # Need manual correction if run with miniperl:-(
765 $modfname = substr($modfname, 0, 7) . '_';
770 $self->{NAME}) =~ s!.*::!! ; #eg. Socket
772 if (defined &DynaLoader::mod2fname or $Is_OS2) {
773 # As of 5.001m, dl_os2 appends '_'
774 $self->{DLBASE} = $modfname; #eg. Socket_
776 $self->{DLBASE} = '$(BASEEXT)';
780 $self->{FULLEXT}) =~ s#/?\Q$self->{BASEEXT}\E$## ; #eg. /BSD/Foo
782 $self->{ROOTEXT} = ($Is_VMS ? '' : '/') . $self->{ROOTEXT} if $self->{ROOTEXT};
785 # --- Initialize PERL_LIB, INST_LIB, PERL_SRC
787 # *Real* information: where did we get these two from? ...
788 my $inc_config_dir = dirname($INC{'Config.pm'});
789 my $inc_carp_dir = dirname($INC{'Carp.pm'});
791 # Typically PERL_* and INST_* will be identical but that need
792 # not be the case (e.g., installing into project libraries etc).
794 # Perl Macro: With source No source
795 # PERL_SRC ../.. (undefined)
796 # PERL_LIB PERL_SRC/lib $Config{privlibexp}
797 # PERL_ARCHLIB PERL_SRC/lib $Config{archlibexp}
799 # INST Macro: For standard for any other
801 # INST_LIB PERL_SRC/lib ./blib
802 # INST_ARCHLIB PERL_SRC/lib ./blib/<archname>
804 unless ($self->{PERL_SRC}){
806 foreach $dir (qw(.. ../.. ../../..)){
807 if ( -f "$dir/config.sh"
809 && -f "$dir/lib/Exporter.pm") {
810 $self->{PERL_SRC}=$dir ;
815 if ($self->{PERL_SRC}){
816 $self->{PERL_LIB} ||= $self->catdir("$self->{PERL_SRC}","lib");
817 $self->{PERL_ARCHLIB} = $self->{PERL_LIB};
818 $self->{PERL_INC} = $self->{PERL_SRC};
819 # catch a situation that has occurred a few times in the past:
820 warn <<EOM unless -s "$self->{PERL_SRC}/cflags";
821 You cannot build extensions below the perl source tree after executing
822 a 'make clean' in the perl source tree.
824 To rebuild extensions distributed with the perl source you should
825 simply Configure (to include those extensions) and then build perl as
826 normal. After installing perl the source tree can be deleted. It is not
827 needed for building extensions.
829 It is recommended that you unpack and build additional extensions away
830 from the perl source tree.
833 # we should also consider $ENV{PERL5LIB} here
834 $self->{PERL_LIB} = $Config::Config{privlibexp} unless $self->{PERL_LIB};
835 $self->{PERL_ARCHLIB} = $Config::Config{archlibexp} unless $self->{PERL_ARCHLIB};
836 $self->{PERL_INC} = $self->catdir("$self->{PERL_ARCHLIB}","CORE"); # wild guess for now
838 die <<EOM unless (-f ($perl_h = $self->catfile("$self->{PERL_INC}","perl.h")));
839 Error: Unable to locate installed Perl libraries or Perl source code.
841 It is recommended that you install perl in a standard location before
842 building extensions. You can say:
844 $^X Makefile.PL PERL_SRC=/path/to/perl/source/directory
846 if you have not yet installed perl but still want to build this
848 (You get this message, because MakeMaker could not find "$perl_h")
851 # print STDOUT "Using header files found in $self->{PERL_INC}\n"
852 # if $Verbose && $self->needs_linking();
856 # INST_LIB typically pre-set if building an extension after
857 # perl has been built and installed. Setting INST_LIB allows
858 # you to build directly into, say $Config::Config{privlibexp}.
859 unless ($self->{INST_LIB}){
862 ##### XXXXX We have to change this nonsense
864 if (defined $self->{PERL_SRC}) {
865 $self->{INST_LIB} = $self->{PERL_LIB};
867 $self->{INST_LIB} = $self->catdir(".","blib");
870 # Try to work out what INST_ARCHLIB should be if not set:
871 unless ($self->{INST_ARCHLIB}){
873 # our private build lib
874 $self->catdir(".","blib") =>
875 $self->catdir(".","blib",$Config::Config{archname}),
876 $self->{PERL_LIB} => $self->{PERL_ARCHLIB},
877 $Config::Config{privlibexp} => $Config::Config{archlibexp},
878 $inc_carp_dir => $inc_config_dir,
880 $self->{INST_ARCHLIB} = $archmap{$self->{INST_LIB}};
881 unless($self->{INST_ARCHLIB}){
882 # Oh dear, we'll have to default it and warn the user
883 my($archname) = $Config::Config{archname};
884 if (-d "$self->{INST_LIB}/$archname"){
885 $self->{INST_ARCHLIB} = $self->catdir("$self->{INST_LIB}","$archname");
886 print STDOUT "Defaulting INST_ARCHLIB to $self->{INST_ARCHLIB}\n";
888 $self->{INST_ARCHLIB} = $self->{INST_LIB};
892 $self->{INST_EXE} ||= $self->catdir('.','blib',$Config::Config{archname});
894 my($prefix) = $Config{'prefix'};
895 $prefix = VMS::Filespec::unixify($prefix) if $Is_VMS;
896 unless ($self->{PREFIX}){
897 $self->{PREFIX} = $prefix;
899 # With perl5.002 it turns out, that we hardcoded some assumptions in here:
900 # $self->{INSTALLPRIVLIB} = $self->catdir($self->{PREFIX},"lib","perl5");
901 # $self->{INSTALLBIN} = $self->catdir($self->{PREFIX},"bin");
902 # $self->{INSTALLMAN3DIR} = $self->catdir($self->{PREFIX},"perl5","man","man3")
903 # unless defined $self->{INSTALLMAN3DIR};
905 # we have to look at the relation between $Config{prefix} and
906 # the requested values
907 $self->{INSTALLPRIVLIB} = $Config{installprivlib};
908 $self->{INSTALLPRIVLIB} = VMS::Filespec::unixpath($self->{INSTALLPRIVLIB})
910 $self->{INSTALLPRIVLIB} =~ s/\Q$prefix\E/\$(PREFIX)/;
911 $self->{INSTALLBIN} = $Config{installbin};
912 $self->{INSTALLBIN} = VMS::Filespec::unixpath($self->{INSTALLBIN})
914 $self->{INSTALLBIN} =~ s/\Q$prefix\E/\$(PREFIX)/;
915 $self->{INSTALLMAN1DIR} = $Config{installman1dir};
916 $self->{INSTALLMAN1DIR} = VMS::Filespec::unixpath($self->{INSTALLMAN1DIR})
918 $self->{INSTALLMAN1DIR} =~ s/\Q$prefix\E/\$(PREFIX)/;
919 $self->{INSTALLMAN3DIR} = $Config{installman3dir};
920 $self->{INSTALLMAN3DIR} = VMS::Filespec::unixpath($self->{INSTALLMAN3DIR})
922 $self->{INSTALLMAN3DIR} =~ s/\Q$prefix\E/\$(PREFIX)/;
924 if( $self->{INSTALLPRIVLIB} && ! $self->{INSTALLARCHLIB} ){
925 # Same as above here. With the unresolved versioned directory issue, we have to
926 # be more careful to follow Configure
927 # my($archname) = $Config::Config{archname};
928 # if (-d $self->catdir($self->{INSTALLPRIVLIB},$archname)){
929 # $self->{INSTALLARCHLIB} = $self->catdir($self->{INSTALLPRIVLIB},$archname);
930 # print STDOUT "Defaulting INSTALLARCHLIB to $self->{INSTALLARCHLIB}\n";
932 # $self->{INSTALLARCHLIB} = $self->{INSTALLPRIVLIB};
934 my($installprivlib) = $Config{'installprivlib'};
935 $installprivlib = VMS::Filespec::unixify($installprivlib) if $Is_VMS;
936 $self->{INSTALLARCHLIB} = $Config{installarchlib};
937 $self->{INSTALLARCHLIB} = VMS::Filespec::unixpath($self->{INSTALLARCHLIB})
939 $self->{INSTALLARCHLIB} =~ s/\Q$installprivlib\E/$self->{INSTALLPRIVLIB}/;
941 # It's a pain to be so friendly to the user. I wish we wouldn't have been so nice.
942 # Now we have '$(PREFIX)' in the string, and the directory won't exist
944 ($installarchlib = $self->{INSTALLARCHLIB}) =~ s/\$\(PREFIX\)/$self->{PREFIX}/;
945 if (-d $installarchlib) {
947 print STDOUT "Directory $self->{INSTALLARCHLIB} not found, thusly\n" if $Verbose;
948 $self->{INSTALLARCHLIB} = $self->{INSTALLPRIVLIB};
950 print STDOUT "Defaulting INSTALLARCHLIB to $self->{INSTALLARCHLIB}\n" if $Verbose;
953 $self->{INSTALLPRIVLIB} ||= $Config::Config{installprivlib};
954 $self->{INSTALLARCHLIB} ||= $Config::Config{installarchlib};
955 $self->{INSTALLBIN} ||= $Config::Config{installbin};
957 $self->{INSTALLMAN1DIR} = $Config::Config{installman1dir}
958 unless defined $self->{INSTALLMAN1DIR};
959 unless (defined $self->{INST_MAN1DIR}){
960 if ($self->{INSTALLMAN1DIR} =~ /^(none|\s*)$/){
961 $self->{INST_MAN1DIR} = $self->{INSTALLMAN1DIR};
963 $self->{INST_MAN1DIR} = $self->catdir('.','blib','man','man1');
966 $self->{MAN1EXT} ||= $Config::Config{man1ext};
968 $self->{INSTALLMAN3DIR} = $Config::Config{installman3dir}
969 unless defined $self->{INSTALLMAN3DIR};
970 unless (defined $self->{INST_MAN3DIR}){
971 if ($self->{INSTALLMAN3DIR} =~ /^(none|\s*)$/){
972 $self->{INST_MAN3DIR} = $self->{INSTALLMAN3DIR};
974 $self->{INST_MAN3DIR} = $self->catdir('.','blib','man','man3');
977 $self->{MAN3EXT} ||= $Config::Config{man3ext};
979 print STDOUT "CONFIG must be an array ref\n"
980 if ($self->{CONFIG} and ref $self->{CONFIG} ne 'ARRAY');
981 $self->{CONFIG} = [] unless (ref $self->{CONFIG});
982 push(@{$self->{CONFIG}}, @ExtUtils::MakeMaker::Get_from_Config);
983 push(@{$self->{CONFIG}}, 'shellflags') if $Config::Config{shellflags};
985 foreach $m (@{$self->{CONFIG}}){
986 next if $once_only{$m};
987 print STDOUT "CONFIG key '$m' does not exist in Config.pm\n"
988 unless exists $Config::Config{$m};
989 $self->{uc $m} ||= $Config::Config{$m};
993 # These should never be needed
994 $self->{LD} ||= 'ld';
995 $self->{OBJ_EXT} ||= '.o';
996 $self->{LIB_EXT} ||= '.a';
998 $self->{MAP_TARGET} ||= "perl";
1000 unless ($self->{LIBPERL_A}){
1001 $self->{LIBPERL_A} = "libperl$self->{LIB_EXT}";
1004 # make a few simple checks
1005 warn "Warning: PERL_LIB ($self->{PERL_LIB}) seems not to be a perl library directory
1006 (Exporter.pm not found)"
1007 unless (-f $self->catfile("$self->{PERL_LIB}","Exporter.pm"));
1009 ($self->{DISTNAME}=$self->{NAME}) =~ s#(::)#-#g unless $self->{DISTNAME};
1010 if ($self->{VERSION_FROM}){
1012 open PM, $self->{VERSION_FROM} or die "Could not open '$self->{VERSION_FROM}' (attribute VERSION_FROM): $!";
1015 next unless /\$([\w:]*\bVERSION)\b.*=/;
1016 local $ExtUtils::MakeMaker::module_version_variable = $1;
1019 die "Could not eval '$eval': $@" if $@;
1020 if ($self->{VERSION} = $$ExtUtils::MakeMaker::module_version_variable){
1021 print "Setting VERSION to $self->{VERSION}\n" if $Verbose;
1023 print "WARNING: Setting VERSION via file '$self->{VERSION_FROM}' failed\n";
1029 $self->{VERSION} = "0.10" unless $self->{VERSION};
1030 ($self->{VERSION_SYM} = $self->{VERSION}) =~ s/\W/_/g;
1032 # Graham Barr and Paul Marquess had some ideas how to ensure
1033 # version compatibility between the *.pm file and the
1034 # corresponding *.xs file. The bottomline was, that we need an
1035 # XS_VERSION macro that defaults to VERSION:
1036 $self->{XS_VERSION} ||= $self->{VERSION};
1038 # --- Initialize Perl Binary Locations
1040 # Find Perl 5. The only contract here is that both 'PERL' and 'FULLPERL'
1041 # will be working versions of perl 5. miniperl has priority over perl
1042 # for PERL to ensure that $(PERL) is usable while building ./ext/*
1043 my ($component,@defpath);
1044 foreach $component ($self->{PERL_SRC}, $self->path(), $Config::Config{binexp}) {
1045 push @defpath, $component if defined $component;
1048 $self->find_perl(5.0, [ $^X, 'miniperl','perl','perl5',"perl$]" ],
1049 \@defpath, $ExtUtils::MakeMaker::Verbose ) unless ($self->{PERL});
1050 # don't check, if perl is executable, maybe they
1051 # have decided to supply switches with perl
1053 # Define 'FULLPERL' to be a non-miniperl (used in test: target)
1054 ($self->{FULLPERL} = $self->{PERL}) =~ s/miniperl/perl/i
1055 unless ($self->{FULLPERL});
1058 # Ilya's suggestion, will have to go into ExtUtils::MM_OS2 and MM_VMS
1061 my $path_sep = $Is_OS2 ? ";" : $Is_VMS ? "/" : ":";
1062 my $path = $ENV{PATH};
1063 $path =~ s:\\:/:g if $Is_OS2;
1064 my @path = split $path_sep, $path;
1067 sub init_dirscan { # --- File and Directory Lists (.xs .pm .pod etc)
1070 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1071 $self = $ExtUtils::MakeMaker::Parent[-1];
1073 my($name, %dir, %xs, %c, %h, %ignore, %pl_files, %manifypods);
1074 local(%pm); #the sub in find() has to see this hash
1075 $ignore{'test.pl'} = 1;
1076 $ignore{'makefile.pl'} = 1 if $Is_VMS;
1077 foreach $name ($self->lsdir(".")){
1078 next if ($name =~ /^\./ or $ignore{$name});
1080 $dir{$name} = $name if (-f "$name/Makefile.PL");
1081 } elsif ($name =~ /\.xs$/){
1082 my($c); ($c = $name) =~ s/\.xs$/.c/;
1085 } elsif ($name =~ /\.c$/i){
1087 unless $name =~ m/perlmain\.c/; # See MAP_TARGET
1088 } elsif ($name =~ /\.h$/i){
1090 } elsif ($name =~ /\.(p[ml]|pod)$/){
1091 $pm{$name} = $self->catfile('$(INST_LIBDIR)',$name);
1092 } elsif ($name =~ /\.PL$/ && $name ne "Makefile.PL") {
1093 ($pl_files{$name} = $name) =~ s/\.PL$// ;
1094 } elsif ($Is_VMS && $name =~ /\.pl$/ && $name ne 'makefile.pl' &&
1095 $name ne 'test.pl') { # case-insensitive filesystem
1096 ($pl_files{$name} = $name) =~ s/\.pl$// ;
1100 # Some larger extensions often wish to install a number of *.pm/pl
1101 # files into the library in various locations.
1103 # The attribute PMLIBDIRS holds an array reference which lists
1104 # subdirectories which we should search for library files to
1105 # install. PMLIBDIRS defaults to [ 'lib', $self->{BASEEXT} ]. We
1106 # recursively search through the named directories (skipping any
1107 # which don't exist or contain Makefile.PL files).
1109 # For each *.pm or *.pl file found $self->libscan() is called with
1110 # the default installation path in $_[1]. The return value of
1111 # libscan defines the actual installation location. The default
1112 # libscan function simply returns the path. The file is skipped
1113 # if libscan returns false.
1115 # The default installation location passed to libscan in $_[1] is:
1117 # ./*.pm => $(INST_LIBDIR)/*.pm
1118 # ./xyz/... => $(INST_LIBDIR)/xyz/...
1119 # ./lib/... => $(INST_LIB)/...
1121 # In this way the 'lib' directory is seen as the root of the actual
1122 # perl library whereas the others are relative to INST_LIBDIR
1123 # (which includes ROOTEXT). This is a subtle distinction but one
1124 # that's important for nested modules.
1126 $self->{PMLIBDIRS} = ['lib', $self->{BASEEXT}]
1127 unless $self->{PMLIBDIRS};
1129 #only existing directories that aren't in $dir are allowed
1131 # Avoid $_ wherever possible:
1132 # @{$self->{PMLIBDIRS}} = grep -d && !$dir{$_}, @{$self->{PMLIBDIRS}};
1133 my (@pmlibdirs) = @{$self->{PMLIBDIRS}};
1135 @{$self->{PMLIBDIRS}} = ();
1136 foreach $pmlibdir (@pmlibdirs) {
1137 -d $pmlibdir && !$dir{$pmlibdir} && push @{$self->{PMLIBDIRS}}, $pmlibdir;
1140 if (@{$self->{PMLIBDIRS}}){
1141 print "Searching PMLIBDIRS: @{$self->{PMLIBDIRS}}\n"
1142 if ($ExtUtils::MakeMaker::Verbose >= 2);
1143 use File::Find; # try changing to require !
1144 File::Find::find(sub {
1146 if ($_ eq "CVS" || $_ eq "RCS"){
1147 $File::Find::prune = 1;
1151 my($path, $prefix) = ($File::Find::name, '$(INST_LIBDIR)');
1152 my($striplibpath,$striplibname);
1153 $prefix = '$(INST_LIB)' if (($striplibpath = $path) =~ s:^(\W*)lib\W:$1:);
1154 ($striplibname,$striplibpath) = fileparse($striplibpath);
1155 my($inst) = $self->catfile($prefix,$striplibpath,$striplibname);
1156 local($_) = $inst; # for backwards compatibility
1157 $inst = $self->libscan($inst);
1158 print "libscan($path) => '$inst'\n" if ($ExtUtils::MakeMaker::Verbose >= 2);
1159 return unless $inst;
1161 }, @{$self->{PMLIBDIRS}});
1164 $self->{DIR} = [sort keys %dir] unless $self->{DIR};
1165 $self->{XS} = \%xs unless $self->{XS};
1166 $self->{PM} = \%pm unless $self->{PM};
1167 $self->{C} = [sort keys %c] unless $self->{C};
1168 my(@o_files) = @{$self->{C}};
1169 $self->{O_FILES} = [grep s/\.c$/$self->{OBJ_EXT}/i, @o_files] ;
1170 $self->{H} = [sort keys %h] unless $self->{H};
1171 $self->{PL_FILES} = \%pl_files unless $self->{PL_FILES};
1173 # Set up names of manual pages to generate from pods
1174 if ($self->{MAN1PODS}) {
1175 } elsif ( $self->{INST_MAN1DIR} =~ /^(none|\s*)$/ ) {
1176 $self->{MAN1PODS} = {};
1178 my %manifypods = ();
1179 if ( exists $self->{EXE_FILES} ) {
1180 foreach $name (@{$self->{EXE_FILES}}) {
1183 # one day test, if $/ can be set to '' safely (is the bug fixed that was in 5.001m?)
1184 if (open(TESTPOD,"<$name")) {
1186 while ($testpodline = <TESTPOD>) {
1187 if($testpodline =~ /^=head1\s+\w+/) {
1194 # If it doesn't exist yet, we assume, it has pods in it
1198 $manifypods{$name} = $self->catfile('$(INST_MAN1DIR)',basename($name).'.$(MAN1EXT)');
1202 $self->{MAN1PODS} = \%manifypods;
1204 if ($self->{MAN3PODS}) {
1205 } elsif ( $self->{INST_MAN3DIR} =~ /^(none|\s*)$/ ) {
1206 $self->{MAN3PODS} = {};
1208 my %manifypods = (); # we collect the keys first, i.e. the files
1209 # we have to convert to pod
1210 foreach $name (keys %{$self->{PM}}) {
1211 if ($name =~ /\.pod$/ ) {
1212 $manifypods{$name} = $self->{PM}{$name};
1213 } elsif ($name =~ /\.p[ml]$/ ) {
1216 open(TESTPOD,"<$name");
1218 while ($testpodline = <TESTPOD>) {
1219 if($testpodline =~ /^=head/) {
1223 #Speculation on the future (K.A., not A.K. :)
1224 #if(/^=don't\S+install/) { $ispod=0; last}
1229 $manifypods{$name} = $self->{PM}{$name};
1234 # Remove "Configure.pm" and similar, if it's not the only pod listed
1235 # To force inclusion, just name it "Configure.pod", or override MAN3PODS
1236 foreach $name (keys %manifypods) {
1237 if ($name =~ /(config|install|setup).*\.pm/i) {
1238 delete $manifypods{$name};
1241 my($manpagename) = $name;
1242 unless ($manpagename =~ s!^(\W*)lib\W!$1!) {
1243 $manpagename = $self->catfile($self->{ROOTEXT},$manpagename);
1245 $manpagename =~ s/\.p(od|m|l)$//;
1246 # Strip leading slashes
1247 $manpagename =~ s!^/+!!;
1248 # Turn other slashes into colons
1249 # $manpagename =~ s,/+,::,g;
1250 $manpagename = $self->replace_manpage_separator($manpagename);
1251 $manifypods{$name} = $self->catfile("\$(INST_MAN3DIR)","$manpagename.\$(MAN3EXT)");
1253 $self->{MAN3PODS} = \%manifypods;
1259 my($dir, $regex) = @_;
1261 opendir(DIR, $dir || ".") or return ();
1264 @ls = grep(/$regex/, @ls) if $regex;
1268 sub replace_manpage_separator {
1269 my($self,$man) = @_;
1275 my($self,$path) = @_;
1276 return '' if $path =~ m:/(RCS|SCCS)/: ;
1280 sub init_others { # --- Initialize Other Attributes
1283 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1284 $self = $ExtUtils::MakeMaker::Parent[-1];
1287 # Compute EXTRALIBS, BSLOADLIBS and LDLOADLIBS from $self->{LIBS}
1288 # Lets look at $self->{LIBS} carefully: It may be an anon array, a string or
1289 # undefined. In any case we turn it into an anon array:
1291 # May check $Config{libs} too, thus not empty.
1292 $self->{LIBS}=[''] unless $self->{LIBS};
1294 $self->{LIBS}=[$self->{LIBS}] if ref \$self->{LIBS} eq SCALAR;
1295 $self->{LD_RUN_PATH} = "";
1297 foreach $libs ( @{$self->{LIBS}} ){
1298 $libs =~ s/^\s*(.*\S)\s*$/$1/; # remove leading and trailing whitespace
1299 my(@libs) = $self->extliblist($libs);
1300 if ($libs[0] or $libs[1] or $libs[2]){
1301 # LD_RUN_PATH now computed by ExtUtils::Liblist
1302 ($self->{EXTRALIBS}, $self->{BSLOADLIBS}, $self->{LDLOADLIBS}, $self->{LD_RUN_PATH}) = @libs;
1307 unless ( $self->{OBJECT} ){
1308 # init_dirscan should have found out, if we have C files
1309 $self->{OBJECT} = '$(BASEEXT)$(OBJ_EXT)' if @{$self->{C}||[]};
1311 $self->{OBJECT} =~ s/\n+/ \\\n\t/g;
1312 $self->{BOOTDEP} = (-f "$self->{BASEEXT}_BS") ? "$self->{BASEEXT}_BS" : "";
1313 $self->{PERLMAINCC} ||= '$(CC)';
1314 $self->{LDFROM} = '$(OBJECT)' unless $self->{LDFROM};
1316 # Sanity check: don't define LINKTYPE = dynamic if we're skipping
1317 # the 'dynamic' section of MM. We don't have this problem with
1318 # 'static', since we either must use it (%Config says we can't
1319 # use dynamic loading) or the caller asked for it explicitly.
1320 if (!$self->{LINKTYPE}) {
1321 $self->{LINKTYPE} = grep(/dynamic/,@{$self->{SKIP} || []})
1323 : ($Config::Config{usedl} ? 'dynamic' : 'static');
1326 # These get overridden for VMS and maybe some other systems
1327 $self->{NOOP} ||= "";
1328 $self->{FIRST_MAKEFILE} ||= "Makefile";
1329 $self->{MAKEFILE} ||= $self->{FIRST_MAKEFILE};
1330 $self->{MAKE_APERL_FILE} ||= "Makefile.aperl";
1331 $self->{NOECHO} ||= '@';
1332 $self->{RM_F} ||= "rm -f";
1333 $self->{RM_RF} ||= "rm -rf";
1334 $self->{TOUCH} ||= "touch";
1335 $self->{CP} ||= "cp";
1336 $self->{MV} ||= "mv";
1337 $self->{CHMOD} ||= "chmod";
1338 $self->{UMASK_NULL} ||= "umask 0";
1342 my($self, $ver, $names, $dirs, $trace) = @_;
1344 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1345 $self = $ExtUtils::MakeMaker::Parent[-1];
1349 print "Looking for perl $ver by these names:
1355 foreach $dir (@$dirs){
1356 next unless defined $dir; # $self->{PERL_SRC} may be undefined
1357 foreach $name (@$names){
1359 if ($self->file_name_is_absolute($name)) {
1361 } elsif (($name =~ m|/|) && ($name !~ m|^\.{1,2}/|)) {
1362 # name is a path that does not begin with dot or dotdot
1363 $abs = $self->catfile(".", $name);
1365 $abs = $self->catfile($dir, $name);
1367 print "Checking $abs\n" if ($trace >= 2);
1368 next unless $self->maybe_command($abs);
1369 print "Executing $abs\n" if ($trace >= 2);
1370 if (`$abs -e 'require $ver; print "VER_OK\n" ' 2>&1` =~ /VER_OK/) {
1371 print "Using PERL=$abs\n" if $trace;
1376 print STDOUT "Unable to find a perl $ver (by these names: @$names, in these dirs: @$dirs)\n";
1377 0; # false and not empty
1381 # Ilya's suggestion. Not yet used, want to understand it first, but at least the code is here
1382 sub maybe_command_in_dirs { # $ver is optional argument if looking for perl
1383 my($self, $names, $dirs, $trace, $ver) = @_;
1385 foreach $dir (@$dirs){
1386 next unless defined $dir; # $self->{PERL_SRC} may be undefined
1387 foreach $name (@$names){
1389 if ($self->file_name_is_absolute($name)) {
1391 } elsif ($name =~ m|/|) {
1392 $abs = $self->catfile(".", $name); # not absolute
1394 $abs = $self->catfile($dir, $name);
1396 print "Checking $abs for $name\n" if ($trace >= 2);
1397 next unless $tryabs = $self->maybe_command($abs);
1398 print "Substituting $tryabs instead of $abs\n"
1399 if ($trace >= 2 and $tryabs ne $abs);
1402 print "Executing $abs\n" if ($trace >= 2);
1403 if (`$abs -e 'require $ver; print "VER_OK\n" ' 2>&1` =~ /VER_OK/) {
1404 print "Using PERL=$abs\n" if $trace;
1407 } else { # Do not look for perl
1415 my($self,$file) = @_;
1416 return $file if -x $file && ! -d $file;
1421 my($self,$file) = @_;
1422 return 1 if -r $file && ! -d $file;
1426 # Ilya's suggestion, not yet used
1427 sub file_name_is_absolute {
1428 my($self,$file) = @_;
1432 sub post_initialize {
1435 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1436 $self = $ExtUtils::MakeMaker::Parent[-1];
1441 # --- Constants Sections ---
1446 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1447 $self = $ExtUtils::MakeMaker::Parent[-1];
1450 push(@m,"\n# These definitions are from config.sh (via $INC{'Config.pm'})\n");
1451 push(@m,"\n# They may have been overridden via Makefile.PL or on the command line\n");
1453 foreach $m (@{$self->{CONFIG}}){
1454 next if $once_only{$m};
1455 push @m, "\U$m\E = ".$self->{uc $m}."\n";
1464 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1465 $self = $ExtUtils::MakeMaker::Parent[-1];
1470 NAME = $self->{NAME}
1471 DISTNAME = $self->{DISTNAME}
1472 NAME_SYM = $self->{NAME_SYM}
1473 VERSION = $self->{VERSION}
1474 VERSION_SYM = $self->{VERSION_SYM}
1475 VERSION_MACRO = VERSION
1476 DEFINE_VERSION = -D\$(VERSION_MACRO)=\\\"\$(VERSION)\\\"
1477 XS_VERSION = $self->{XS_VERSION}
1478 XS_VERSION_MACRO = XS_VERSION
1479 XS_DEFINE_VERSION = -D\$(XS_VERSION_MACRO)=\\\"\$(XS_VERSION)\\\"
1481 # In which directory should we put this extension during 'make'?
1482 # This is typically ./blib.
1483 # (also see INST_LIBDIR and relationship to ROOTEXT)
1484 INST_LIB = $self->{INST_LIB}
1485 INST_ARCHLIB = $self->{INST_ARCHLIB}
1486 INST_EXE = $self->{INST_EXE}
1488 PREFIX = $self->{PREFIX}
1490 # AFS users will want to set the installation directories for
1491 # the final 'make install' early without setting INST_LIB,
1492 # INST_ARCHLIB, and INST_EXE for the testing phase
1493 INSTALLPRIVLIB = $self->{INSTALLPRIVLIB}
1494 INSTALLARCHLIB = $self->{INSTALLARCHLIB}
1495 INSTALLBIN = $self->{INSTALLBIN}
1497 # Perl library to use when building the extension
1498 PERL_LIB = $self->{PERL_LIB}
1499 PERL_ARCHLIB = $self->{PERL_ARCHLIB}
1500 LIBPERL_A = $self->{LIBPERL_A}
1502 MAKEMAKER = \$(PERL_LIB)/ExtUtils/MakeMaker.pm
1503 MM_VERSION = $ExtUtils::MakeMaker::VERSION
1504 FIRST_MAKEFILE = $self->{FIRST_MAKEFILE}
1505 MAKE_APERL_FILE = $self->{MAKE_APERL_FILE}
1507 PERLMAINCC = $self->{PERLMAINCC}
1511 # Where is the perl source code located?
1512 PERL_SRC = $self->{PERL_SRC}\n" if $self->{PERL_SRC};
1515 # Perl header files (will eventually be under PERL_LIB)
1516 PERL_INC = $self->{PERL_INC}
1518 PERL = $self->{PERL}
1519 FULLPERL = $self->{FULLPERL}
1522 # FULLEXT = Pathname for extension directory (eg DBD/Oracle).
1523 # BASEEXT = Basename part of FULLEXT. May be just equal FULLEXT.
1524 # ROOTEXT = Directory part of FULLEXT with leading slash (eg /DBD)
1525 # DLBASE = Basename part of dynamic library. May be just equal BASEEXT.
1526 FULLEXT = $self->{FULLEXT}
1527 BASEEXT = $self->{BASEEXT}
1528 ROOTEXT = $self->{ROOTEXT}
1529 DLBASE = $self->{DLBASE}
1533 VERSION_FROM = $self->{VERSION_FROM}
1534 " if defined $self->{VERSION_FROM};
1538 DEFINE = $self->{DEFINE}
1539 OBJECT = $self->{OBJECT}
1540 LDFROM = $self->{LDFROM}
1541 LINKTYPE = $self->{LINKTYPE}
1543 # Handy lists of source code files:
1544 XS_FILES= ".join(" \\\n\t", sort keys %{$self->{XS}})."
1545 C_FILES = ".join(" \\\n\t", @{$self->{C}})."
1546 O_FILES = ".join(" \\\n\t", @{$self->{O_FILES}})."
1547 H_FILES = ".join(" \\\n\t", @{$self->{H}})."
1548 MAN1PODS = ".join(" \\\n\t", sort keys %{$self->{MAN1PODS}})."
1549 MAN3PODS = ".join(" \\\n\t", sort keys %{$self->{MAN3PODS}})."
1551 # Man installation stuff:
1552 INST_MAN1DIR = $self->{INST_MAN1DIR}
1553 INSTALLMAN1DIR = $self->{INSTALLMAN1DIR}
1554 MAN1EXT = $self->{MAN1EXT}
1556 INST_MAN3DIR = $self->{INST_MAN3DIR}
1557 INSTALLMAN3DIR = $self->{INSTALLMAN3DIR}
1558 MAN3EXT = $self->{MAN3EXT}
1561 # work around a famous dec-osf make(1) feature(?):
1564 .SUFFIXES: .xs .c .C \$(OBJ_EXT)
1566 # .PRECIOUS: Makefile # seems to be not necessary anymore
1568 .PHONY: all config static dynamic test linkext
1570 # This extension may link to it's own library (see SDBM_File)
1571 MYEXTLIB = $self->{MYEXTLIB}
1573 # Where is the Config information that we are using/depend on
1574 CONFIGDEP = \$(PERL_ARCHLIB)/Config.pm \$(PERL_INC)/config.h \$(VERSION_FROM)
1578 # Where to put things:
1579 INST_LIBDIR = $(INST_LIB)$(ROOTEXT)
1580 INST_ARCHLIBDIR = $(INST_ARCHLIB)$(ROOTEXT)
1582 INST_AUTODIR = $(INST_LIB)/auto/$(FULLEXT)
1583 INST_ARCHAUTODIR = $(INST_ARCHLIB)/auto/$(FULLEXT)
1586 if ($self->has_link_code()) {
1588 INST_STATIC = $(INST_ARCHAUTODIR)/$(BASEEXT)$(LIB_EXT)
1589 INST_DYNAMIC = $(INST_ARCHAUTODIR)/$(DLBASE).$(DLEXT)
1590 INST_BOOT = $(INST_ARCHAUTODIR)/$(BASEEXT).bs
1601 $tmp = "$self->{BASEEXT}.def";
1610 $tmp = "\$(PERL_INC)/libperl.lib";
1619 INST_PM = '.join(" \\\n\t", sort values %{$self->{PM}}).'
1625 sub const_loadlibs {
1628 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1629 $self = $ExtUtils::MakeMaker::Parent[-1];
1631 return "" unless $self->needs_linking;
1632 # This description can be deleted after ExtUtils::Liblist is in
1633 # the perl dist with pods
1635 # $self->{NAME} might depend on some other libraries:
1636 # (These comments may need revising:)
1638 # Dependent libraries can be linked in one of three ways:
1640 # 1. (For static extensions) by the ld command when the perl binary
1641 # is linked with the extension library. See EXTRALIBS below.
1643 # 2. (For dynamic extensions) by the ld command when the shared
1644 # object is built/linked. See LDLOADLIBS below.
1646 # 3. (For dynamic extensions) by the DynaLoader when the shared
1647 # object is loaded. See BSLOADLIBS below.
1649 # EXTRALIBS = List of libraries that need to be linked with when
1650 # linking a perl binary which includes this extension
1651 # Only those libraries that actually exist are included.
1652 # These are written to a file and used when linking perl.
1654 # LDLOADLIBS = List of those libraries which can or must be linked into
1655 # the shared library when created using ld. These may be
1656 # static or dynamic libraries.
1657 # LD_RUN_PATH is a colon separated list of the directories
1658 # in LDLOADLIBS. It is passed as an environment variable to
1659 # the process that links the shared library.
1661 # BSLOADLIBS = List of those libraries that are needed but can be
1662 # linked in dynamically at run time on this platform.
1663 # SunOS/Solaris does not need this because ld records
1664 # the information (from LDLOADLIBS) into the object file.
1665 # This list is used to create a .bs (bootstrap) file.
1667 EXTRALIBS = $self->{EXTRALIBS}
1668 LDLOADLIBS = $self->{LDLOADLIBS}
1669 BSLOADLIBS = $self->{BSLOADLIBS}
1670 LD_RUN_PATH= $self->{LD_RUN_PATH}
1675 my($self,$libperl)=@_;
1677 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1678 $self = $ExtUtils::MakeMaker::Parent[-1];
1680 return $self->{CONST_CCCMD} if $self->{CONST_CCCMD};
1681 return '' unless $self->needs_linking();
1682 $libperl or $libperl = $self->{LIBPERL_A} || "libperl$self->{LIB_EXT}" ;
1683 $libperl =~ s/\.\$\(A\)$/$self->{LIB_EXT}/;
1684 # This is implemented in the same manner as extliblist,
1685 # e.g., do both and compare results during the transition period.
1686 my($cc,$ccflags,$optimize,$large,$split, $shflags)
1687 = @Config{qw(cc ccflags optimize large split shellflags)};
1690 $shflags = '' unless $shflags;
1691 my($prog, $uc, $perltype);
1696 DE => '-DDEBUGGING -DEMBED',
1697 M => '-DEMBED -DMULTIPLICITY',
1698 DM => '-DDEBUGGING -DEMBED -DMULTIPLICITY',
1701 if ($libperl =~ /libperl(\w*)\Q$self->{LIB_EXT}/){
1704 $uc = ""; # avoid warning
1706 $perltype = $map{$uc} ? $map{$uc} : "";
1714 ( $name = $self->{NAME} . "_cflags" ) =~ s/:/_/g ;
1715 if ($prog = $Config::Config{$name}) {
1716 # Expand hints for this extension via the shell
1717 print STDOUT "Processing $name hint:\n" if $ExtUtils::MakeMaker::Verbose;
1719 ccflags=\"$ccflags\"
1720 optimize=\"$optimize\"
1721 perltype=\"$perltype\"
1722 optdebug=\"$optdebug\"
1727 echo ccflags=\$ccflags
1728 echo optimize=\$optimize
1729 echo perltype=\$perltype
1730 echo optdebug=\$optdebug
1737 if ($line =~ /(.*?)=\s*(.*)\s*$/){
1739 print STDOUT " $1 = $2\n" if $ExtUtils::MakeMaker::Verbose;
1741 print STDOUT "Unrecognised result from hint: '$line'\n";
1744 ( $cc,$ccflags,$perltype,$optdebug,$optimize,$large,$split )=@cflags{
1745 qw( cc ccflags perltype optdebug optimize large split)};
1749 $optimize = $optdebug;
1752 my($new) = "$cc -c \$(INC) $ccflags $optimize $perltype $large $split";
1753 $new =~ s/^\s+//; $new =~ s/\s+/ /g; $new =~ s/\s+$//;
1756 $cccmd =~ s/^\s*\Q$Config::Config{cc}\E\s/\$(CC) /;
1757 $cccmd .= " \$(DEFINE_VERSION) \$(XS_DEFINE_VERSION)";
1758 $self->{CONST_CCCMD} = "CCCMD = $cccmd\n";
1761 # --- Tool Sections ---
1763 sub tool_autosplit {
1764 my($self, %attribs) = @_;
1766 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1767 $self = $ExtUtils::MakeMaker::Parent[-1];
1770 $asl = "\$AutoSplit::Maxlen=$attribs{MAXLEN};" if $attribs{MAXLEN};
1772 # Usage: $(AUTOSPLITFILE) FileToSplit AutoDirToSplitInto
1773 AUTOSPLITFILE = $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -e 'use AutoSplit;}.$asl.q{autosplit($$ARGV[0], $$ARGV[1], 0, 1, 1) ;'
1780 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1781 $self = $ExtUtils::MakeMaker::Parent[-1];
1783 my($xsdir) = "$self->{PERL_LIB}/ExtUtils";
1784 # drop back to old location if xsubpp is not in new location yet
1785 $xsdir = "$self->{PERL_SRC}/ext" unless (-f "$self->{PERL_LIB}/ExtUtils/xsubpp");
1786 my(@tmdeps) = ('$(XSUBPPDIR)/typemap');
1787 if( $self->{TYPEMAPS} ){
1789 foreach $typemap (@{$self->{TYPEMAPS}}){
1790 if( ! -f $typemap ){
1791 warn "Typemap $typemap not found.\n";
1794 push(@tmdeps, $typemap);
1798 push(@tmdeps, "typemap") if -f "typemap";
1799 my(@tmargs) = map("-typemap $_", @tmdeps);
1800 if( exists $self->{XSOPT} ){
1801 unshift( @tmargs, $self->{XSOPT} );
1804 my $xsubpp_version = $self->xsubpp_version("$xsdir/xsubpp");
1806 # What are the correct thresholds for version 1 && 2 Paul?
1807 if ( $xsubpp_version > 1.923 ){
1808 $self->{XSPROTOARG} = "" unless defined $self->{XSPROTOARG};
1810 if (defined $self->{XSPROTOARG} && $self->{XSPROTOARG} =~ /\-prototypes/) {
1811 print STDOUT qq{Warning: This extension wants to pass the switch "-prototypes" to xsubpp.
1812 Your version of xsubpp is $xsubpp_version and cannot handle this.
1813 Please upgrade to a more recent version of xsubpp.
1816 $self->{XSPROTOARG} = "";
1822 XSUBPP = \$(XSUBPPDIR)/xsubpp
1823 XSPROTOARG = $self->{XSPROTOARG}
1824 XSUBPPDEPS = @tmdeps
1825 XSUBPPARGS = @tmargs
1831 my($self,$xsubpp) = @_;
1834 # try to figure out the version number of the xsubpp on the system
1836 # first try the -v flag, introduced in 1.921 & 2.000a2
1838 my $command = "$self->{PERL} $xsubpp -v 2>&1";
1839 print "Running: $command\n" if $Verbose;
1840 $version = `$command` ;
1841 warn "Running '$command' exits with status " . ($?>>8) if $?;
1844 return $1 if $version =~ /^xsubpp version (.*)/ ;
1846 # nope, then try something else
1848 my $counter = '000';
1849 my ($file) = 'temp' ;
1850 $counter++ while -e "$file$counter"; # don't overwrite anything
1853 open(F, ">$file") or die "Cannot open file '$file': $!\n" ;
1855 MODULE = fred PACKAGE = fred
1864 $command = "$self->{PERL} $xsubpp $file 2>&1";
1865 print "Running: $command\n" if $Verbose;
1866 my $text = `$command` ;
1867 warn "Running '$command' exits with status " . ($?>>8) if $?;
1870 # gets 1.2 -> 1.92 and 2.000a1
1871 return $1 if $text =~ /automatically by xsubpp version ([\S]+)\s*/ ;
1873 # it is either 1.0 or 1.1
1874 return 1.1 if $text =~ /^Warning: ignored semicolon/ ;
1876 # none of the above, so 1.0
1883 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1884 $self = $ExtUtils::MakeMaker::Parent[-1];
1889 TOUCH = $self->{TOUCH}
1892 RM_F = $self->{RM_F}
1893 RM_RF = $self->{RM_RF}
1894 CHMOD = $self->{CHMOD}
1895 UMASK_NULL = $self->{UMASK_NULL}
1897 # The following is a portable way to say mkdir -p
1898 # To see which directories are created, change the if 0 to if 1
1899 MKPATH = $(PERL) -wle '$$"="/"; foreach $$p (@ARGV){' \\
1900 -e 'next if -d $$p; my(@p); foreach(split(/\//,$$p)){' \\
1901 -e 'push(@p,$$_); next if -d "@p/"; print "mkdir @p" if 0;' \\
1902 -e 'mkdir("@p",0777)||die $$! } } exit 0;'
1904 # This helps us to minimize the effect of the .exists files A yet
1905 # better solution would be to have a stable file in the perl
1906 # distribution with a timestamp of zero. But this solution doesn't
1907 # need any changes to the core distribution and works with older perls
1908 EQUALIZE_TIMESTAMP = $(PERL) -we 'open F, ">$$ARGV[1]"; close F;' \\
1909 -e 'utime ((stat("$$ARGV[0]"))[8,9], $$ARGV[1])'
1914 my($self, %attribs) = @_;
1916 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1917 $self = $ExtUtils::MakeMaker::Parent[-1];
1920 # VERSION should be sanitised before use as a file name
1921 my($name) = $attribs{NAME} || '$(DISTVNAME)';
1922 my($tar) = $attribs{TAR} || 'tar'; # eg /usr/bin/gnutar
1923 my($tarflags) = $attribs{TARFLAGS} || 'cvf';
1924 my($compress) = $attribs{COMPRESS} || 'compress'; # eg gzip
1925 my($suffix) = $attribs{SUFFIX} || 'Z'; # eg gz
1926 my($shar) = $attribs{SHAR} || 'shar'; # eg "shar --gzip"
1927 my($preop) = $attribs{PREOP} || "$self->{NOECHO}true"; # eg update MANIFEST
1928 my($postop) = $attribs{POSTOP} || "$self->{NOECHO}true"; # eg remove the distdir
1929 my($ci) = $attribs{CI} || 'ci -u';
1930 my($rcs_label)= $attribs{RCS_LABEL}|| 'rcs -Nv$(VERSION_SYM): -q';
1931 my($dist_cp) = $attribs{DIST_CP} || 'best';
1932 my($dist_default) = $attribs{DIST_DEFAULT} || 'tardist';
1935 DISTVNAME = \$(DISTNAME)-\$(VERSION)
1937 TARFLAGS = $tarflags
1938 COMPRESS = $compress
1944 RCS_LABEL = $rcs_label
1946 DIST_DEFAULT = $dist_default
1952 my($self,%attribs) = @_;
1954 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1955 $self = $ExtUtils::MakeMaker::Parent[-1];
1958 while (($key,$val) = each %attribs){
1959 push @m, "$key = $val\n";
1965 my($self,%attribs) = @_;
1967 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1968 $self = $ExtUtils::MakeMaker::Parent[-1];
1971 while (($key,$val) = each %attribs){
1972 push @m, "$key: $val\n";
1980 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1981 $self = $ExtUtils::MakeMaker::Parent[-1];
1989 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1990 $self = $ExtUtils::MakeMaker::Parent[-1];
1996 foreach $key (qw(INSTALLPRIVLIB INSTALLARCHLIB INSTALLBIN
1997 INSTALLMAN1DIR INSTALLMAN3DIR LIBPERL_A
1999 push @pasthru, "$key=\"\$($key)\"";
2002 push @m, "\nPASTHRU = ", join ("\\\n\t", @pasthru), "\n";
2006 # --- Translation Sections ---
2011 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
2012 $self = $ExtUtils::MakeMaker::Parent[-1];
2014 return '' unless $self->needs_linking();
2018 $(CCCMD) $(CCCDLFLAGS) -I$(PERL_INC) $(DEFINE) $*.c
2021 $(CCCMD) $(CCCDLFLAGS) -I$(PERL_INC) $(DEFINE) $*.C
2029 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
2030 $self = $ExtUtils::MakeMaker::Parent[-1];
2032 return '' unless $self->needs_linking();
2035 $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) $(XSUBPP) $(XSPROTOARG) $(XSUBPPARGS) $*.xs >$*.tc && mv $*.tc $@
2039 sub xs_o { # many makes are too dumb to use xs_c then c_o
2042 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
2043 $self = $ExtUtils::MakeMaker::Parent[-1];
2045 return '' unless $self->needs_linking();
2048 $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) $(XSUBPP) $(XSPROTOARG) $(XSUBPPARGS) $*.xs >xstmp.c && mv xstmp.c $*.c
2049 $(CCCMD) $(CCCDLFLAGS) -I$(PERL_INC) $(DEFINE) $*.c
2053 # --- Target Sections ---
2058 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
2059 $self = $ExtUtils::MakeMaker::Parent[-1];
2063 all :: config $(INST_PM) subdirs linkext manifypods reorg_packlist
2065 subdirs :: $(MYEXTLIB)
2069 config :: '.$self->{MAKEFILE}.' $(INST_LIBDIR)/.exists
2071 config :: $(INST_ARCHAUTODIR)/.exists Version_check
2073 config :: $(INST_AUTODIR)/.exists
2076 push @m, $self->dir_target(qw[$(INST_AUTODIR) $(INST_LIBDIR) $(INST_ARCHAUTODIR)]);
2078 if (%{$self->{MAN1PODS}}) {
2080 config :: $(INST_MAN1DIR)/.exists
2083 push @m, $self->dir_target(qw[$(INST_MAN1DIR)]);
2085 if (%{$self->{MAN3PODS}}) {
2087 config :: $(INST_MAN3DIR)/.exists
2090 push @m, $self->dir_target(qw[$(INST_MAN3DIR)]);
2094 $(O_FILES): $(H_FILES)
2095 ' if @{$self->{O_FILES} || []} && @{$self->{H} || []};
2099 perldoc ExtUtils::MakeMaker
2104 }.$self->{NOECHO}.q{$(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) \
2105 -e 'use ExtUtils::MakeMaker qw($$Version &Version_check);' \
2106 -e '&Version_check("$(MM_VERSION)")'
2113 my($self, %attribs) = @_;
2115 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
2116 $self = $ExtUtils::MakeMaker::Parent[-1];
2118 # LINKTYPE => static or dynamic or ''
2119 my($linktype) = defined $attribs{LINKTYPE} ?
2120 $attribs{LINKTYPE} : '$(LINKTYPE)';
2122 linkext :: $linktype
2128 my($self,%attribs) = @_;
2130 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
2131 $self = $ExtUtils::MakeMaker::Parent[-1];
2134 return '' unless ($Config::Config{osname} eq 'aix' && $self->needs_linking() );
2136 my($funcs) = $attribs{DL_FUNCS} || $self->{DL_FUNCS} || {};
2137 my($vars) = $attribs{DL_VARS} || $self->{DL_VARS} || [];
2141 dynamic :: $self->{BASEEXT}.exp
2143 ") unless $self->{SKIPHASH}{dynamic};
2146 static :: $self->{BASEEXT}.exp
2148 ") unless $self->{SKIPHASH}{static};
2151 $self->{BASEEXT}.exp: Makefile.PL
2152 ",' $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -e \'use ExtUtils::Mksymlists; \\
2153 Mksymlists("NAME" => "',$self->{NAME},'", "DL_FUNCS" => ',
2154 neatvalue($funcs),', "DL_VARS" => ', neatvalue($vars), ');\'
2160 # --- Dynamic Loading Sections ---
2165 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
2166 $self = $ExtUtils::MakeMaker::Parent[-1];
2169 # $(INST_PM) has been moved to the all: target.
2170 # It remains here for awhile to allow for old usage: "make dynamic"
2171 dynamic :: '.$self->{MAKEFILE}.' $(INST_DYNAMIC) $(INST_BOOT) $(INST_PM)
2177 my($self, %attribs) = @_;
2179 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
2180 $self = $ExtUtils::MakeMaker::Parent[-1];
2184 ' unless $self->has_link_code();
2187 BOOTSTRAP = '."$self->{BASEEXT}.bs".'
2189 # As Mkbootstrap might not write a file (if none is required)
2190 # we use touch to prevent make continually trying to remake it.
2191 # The DynaLoader only reads a non-empty file.
2192 $(BOOTSTRAP): '."$self->{MAKEFILE} $self->{BOOTDEP}".' $(INST_ARCHAUTODIR)/.exists
2193 '.$self->{NOECHO}.'echo "Running Mkbootstrap for $(NAME) ($(BSLOADLIBS))"
2194 '.$self->{NOECHO}.'$(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" \
2195 -e \'use ExtUtils::Mkbootstrap;\' \
2196 -e \'Mkbootstrap("$(BASEEXT)","$(BSLOADLIBS)");\'
2197 '.$self->{NOECHO}.'$(TOUCH) $(BOOTSTRAP)
2199 '.$self->{NOECHO}.'echo $@ >> $(INST_ARCHAUTODIR)/.packlist
2201 $(INST_BOOT): $(BOOTSTRAP) $(INST_ARCHAUTODIR)/.exists
2202 '."$self->{NOECHO}$self->{RM_RF}".' $(INST_BOOT)
2203 -'.$self->{CP}.' $(BOOTSTRAP) $(INST_BOOT)
2205 '.$self->{NOECHO}.'echo $@ >> $(INST_ARCHAUTODIR)/.packlist
2210 my($self, %attribs) = @_;
2212 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
2213 $self = $ExtUtils::MakeMaker::Parent[-1];
2215 return '' unless $self->needs_linking(); #might be because of a subdir
2217 return '' unless $self->has_link_code;
2219 my($otherldflags) = $attribs{OTHERLDFLAGS} || "";
2220 my($inst_dynamic_dep) = $attribs{INST_DYNAMIC_DEP} || "";
2221 my($armaybe) = $attribs{ARMAYBE} || $self->{ARMAYBE} || ":";
2222 my($ldfrom) = '$(LDFROM)';
2223 my($osname) = $Config::Config{osname};
2224 $armaybe = 'ar' if ($osname eq 'dec_osf' and $armaybe eq ':');
2227 # This section creates the dynamically loadable $(INST_DYNAMIC)
2228 # from $(OBJECT) and possibly $(MYEXTLIB).
2229 ARMAYBE = '.$armaybe.'
2230 OTHERLDFLAGS = '.$otherldflags.'
2231 INST_DYNAMIC_DEP = '.$inst_dynamic_dep.'
2233 $(INST_DYNAMIC): $(OBJECT) $(MYEXTLIB) $(BOOTSTRAP) $(INST_ARCHAUTODIR)/.exists $(EXPORT_LIST) $(PERL_ARCHIVE) $(INST_DYNAMIC_DEP)
2235 if ($armaybe ne ':'){
2236 $ldfrom = 'tmp$(LIB_EXT)';
2237 push(@m,' $(ARMAYBE) cr '.$ldfrom.' $(OBJECT)'."\n");
2238 push(@m,' $(RANLIB) '."$ldfrom\n");
2240 $ldfrom = "-all $ldfrom -none" if ($osname eq 'dec_osf');
2241 push(@m,' LD_RUN_PATH="$(LD_RUN_PATH)" $(LD) -o $@ $(LDDLFLAGS) '.$ldfrom.
2242 ' $(OTHERLDFLAGS) $(MYEXTLIB) $(LDLOADLIBS) $(EXPORT_LIST) $(PERL_ARCHIVE)');
2245 '.$self->{NOECHO}.'echo $@ >> $(INST_ARCHAUTODIR)/.packlist
2248 push @m, $self->dir_target('$(INST_ARCHAUTODIR)');
2252 # --- Static Loading Sections ---
2257 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
2258 $self = $ExtUtils::MakeMaker::Parent[-1];
2261 # $(INST_PM) has been moved to the all: target.
2262 # It remains here for awhile to allow for old usage: "make static"
2263 static :: '.$self->{MAKEFILE}.' $(INST_STATIC) $(INST_PM)
2271 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
2272 $self = $ExtUtils::MakeMaker::Parent[-1];
2274 # Come to think of it, if there are subdirs with linkcode, we still have no INST_STATIC
2275 # return '' unless $self->needs_linking(); #might be because of a subdir
2277 return '' unless $self->has_link_code;
2281 $(INST_STATIC): $(OBJECT) $(MYEXTLIB) $(INST_ARCHAUTODIR)/.exists
2283 # If this extension has it's own library (eg SDBM_File)
2284 # then copy that to $(INST_STATIC) and add $(OBJECT) into it.
2285 push(@m, "\t$self->{CP} \$(MYEXTLIB) \$\@\n") if $self->{MYEXTLIB};
2288 q{ $(AR) cr $@ $(OBJECT) && $(RANLIB) $@
2289 }.$self->{NOECHO}.q{echo "$(EXTRALIBS)" > $(INST_ARCHAUTODIR)/extralibs.ld
2291 }.$self->{NOECHO}.q{echo $@ >> $(INST_ARCHAUTODIR)/.packlist
2294 # Old mechanism - still available:
2296 push @m, "\t$self->{NOECHO}".q{echo "$(EXTRALIBS)" >> $(PERL_SRC)/ext.libs}."\n\n"
2297 if $self->{PERL_SRC};
2299 push @m, $self->dir_target('$(INST_ARCHAUTODIR)');
2304 my($self, %attribs) = @_;
2306 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
2307 $self = $ExtUtils::MakeMaker::Parent[-1];
2309 # By default .pm files are split into the architecture independent
2310 # library. This is a good thing. If a specific module requires that
2311 # it's .pm files are split into the architecture specific library
2312 # then it should use: installpm => {SPLITLIB=>'$(INST_ARCHLIB)'}
2313 # Note that installperl currently interferes with this (Config.pm)
2314 # User can disable split by saying: installpm => {SPLITLIB=>''}
2315 my($splitlib) = '$(INST_LIB)'; # NOT arch specific by default
2316 $splitlib = $attribs{SPLITLIB} if exists $attribs{SPLITLIB};
2318 push @m, "inst_pm :: \$(INST_PM)\n\n";
2319 foreach $dist (sort keys %{$self->{PM}}){
2320 my($inst) = $self->{PM}->{$dist};
2321 push(@m, "\n# installpm: $dist => $inst, splitlib=$splitlib\n");
2322 push(@m, $self->installpm_x($dist, $inst, $splitlib));
2328 sub installpm_x { # called by installpm per file
2329 my($self, $dist, $inst, $splitlib) = @_;
2331 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
2332 $self = $ExtUtils::MakeMaker::Parent[-1];
2334 if ($inst =~ m,[:\#],){
2335 warn "Warning: 'make' would have problems processing this file: '$inst', SKIPPED\n";
2338 my($instdir) = $inst =~ m|(.*)/|;
2341 $inst: $dist $self->{MAKEFILE} $instdir/.exists \$(INST_ARCHAUTODIR)/.exists
2342 $self->{NOECHO}$self->{RM_F}".' $@
2343 $(UMASK_NULL) && '."$self->{CP} $dist \$\@
2344 $self->{NOECHO}echo ".'$@ >> $(INST_ARCHAUTODIR)/.packlist
2346 push(@m, "\t$self->{NOECHO}\$(AUTOSPLITFILE) \$@ $splitlib/auto\n")
2347 if ($splitlib and $inst =~ m/\.pm$/);
2349 push @m, $self->dir_target($instdir);
2354 my($self, %attribs) = @_;
2356 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
2357 $self = $ExtUtils::MakeMaker::Parent[-1];
2359 return "\nmanifypods :\n" unless %{$self->{MAN3PODS}};
2362 if (defined $self->{PERL_SRC}) {
2363 $pod2man_exe = $self->catfile($self->{PERL_SRC},'pod','pod2man');
2365 $pod2man_exe = $self->catfile($Config{bin},'pod2man');
2367 unless ($self->perl_script($pod2man_exe)) {
2368 # No pod2man but some MAN3PODS to be installed
2371 Warning: I could not locate your pod2man program. Please make sure,
2372 your pod2man program is in your PATH before you execute 'make'
2375 $pod2man_exe = "-S pod2man";
2379 qq[POD2MAN_EXE = $pod2man_exe\n],
2380 q[POD2MAN = $(PERL) -we '%m=@ARGV;for (keys %m){' \\
2381 -e 'next if -e $$m{$$_} && -M $$m{$$_} < -M $$_ && -M $$m{$$_} < -M "].$self->{MAKEFILE}.q[";' \\
2382 -e 'print "Installing $$m{$$_}\n";' \\
2383 -e 'system("$$^X \\"-I$(PERL_ARCHLIB)\\" \\"-I$(PERL_LIB)\\" $(POD2MAN_EXE) $$_>$$m{$$_}")==0 or warn "Couldn\\047t install $$m{$$_}\n";' \\
2384 -e 'chmod 0644, $$m{$$_} or warn "chmod 644 $$m{$$_}: $$!\n";}'
2386 push @m, "\nmanifypods : ";
2387 push @m, join " \\\n\t", keys %{$self->{MAN1PODS}}, keys %{$self->{MAN3PODS}};
2390 if (%{$self->{MAN1PODS}} || %{$self->{MAN3PODS}}) {
2391 push @m, "\t$self->{NOECHO}\$(POD2MAN) \\\n\t";
2392 push @m, join " \\\n\t", %{$self->{MAN1PODS}}, %{$self->{MAN3PODS}};
2400 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
2401 $self = $ExtUtils::MakeMaker::Parent[-1];
2403 return "" unless $self->{PL_FILES};
2405 foreach $plfile (sort keys %{$self->{PL_FILES}}) {
2407 all :: $self->{PL_FILES}->{$plfile}
2409 $self->{PL_FILES}->{$plfile} :: $plfile
2410 \$(PERL) -I\$(INST_ARCHLIB) -I\$(INST_LIB) -I\$(PERL_ARCHLIB) -I\$(PERL_LIB) $plfile
2418 return "" unless $self->{EXE_FILES} && ref $self->{EXE_FILES} eq "ARRAY";
2419 return "" unless @{$self->{EXE_FILES}};
2420 my(@m, $from, $to, %fromto, @to);
2421 push @m, $self->dir_target(qw[$(INST_EXE)]);
2422 for $from (@{$self->{EXE_FILES}}) {
2423 my($path)= '$(INST_EXE)/' . basename($from);
2424 local($_) = $path; # for backwards compatibility
2425 $to = $self->exescan($path);
2426 print "exescan($from) => '$to'\n" if ($ExtUtils::MakeMaker::Verbose >=2);
2429 @to = values %fromto;
2431 EXE_FILES = @{$self->{EXE_FILES}}
2439 while (($from,$to) = each %fromto) {
2440 my $todir = dirname($to);
2442 $to: $from $self->{MAKEFILE} $todir/.exists
2443 $self->{CP} $from $to
2450 my($self,$path) = @_;
2453 # --- Sub-directory Sections ---
2458 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
2459 $self = $ExtUtils::MakeMaker::Parent[-1];
2462 # This method provides a mechanism to automatically deal with
2463 # subdirectories containing further Makefile.PL scripts.
2464 # It calls the subdir_x() method for each subdirectory.
2465 foreach $dir (@{$self->{DIR}}){
2466 push(@m, $self->subdir_x($dir));
2467 #### print "Including $dir subdirectory\n";
2471 # The default clean, realclean and test targets in this Makefile
2472 # have automatically been given entries for each subdir.
2476 push(@m, "\n# none")
2481 sub runsubdirpl{ # Experimental! See subdir_x section
2482 my($self,$subdir) = @_;
2484 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
2485 $self = $ExtUtils::MakeMaker::Parent[-1];
2487 chdir($subdir) or die "chdir($subdir): $!";
2489 require "Makefile.PL";
2493 my($self, $subdir) = @_;
2495 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
2496 $self = $ExtUtils::MakeMaker::Parent[-1];
2502 $self->{NOECHO}-cd $subdir && \$(MAKE) all \$(PASTHRU)
2507 # --- Cleanup and Distribution Sections ---
2510 my($self, %attribs) = @_;
2512 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
2513 $self = $ExtUtils::MakeMaker::Parent[-1];
2517 # Delete temporary files but do not touch installed files. We don\'t delete
2518 # the Makefile here so a later make realclean still has a makefile to use.
2522 # clean subdirectories first
2523 for $dir (@{$self->{DIR}}) {
2524 push @m, "\t-cd $dir && test -f $self->{MAKEFILE} && \$(MAKE) clean\n";
2527 my(@otherfiles) = values %{$self->{XS}}; # .c files from *.xs files
2528 push(@otherfiles, $attribs{FILES}) if $attribs{FILES};
2529 push(@otherfiles, qw[./blib $(MAKE_APERL_FILE) $(INST_ARCHAUTODIR)/extralibs.all
2530 perlmain.c mon.out core so_locations
2532 *$(OBJ_EXT) *$(LIB_EXT)
2533 perl.exe $(BOOTSTRAP) $(BASEEXT).bso $(BASEEXT).def $(BASEEXT).exp
2535 push @m, "\t-$self->{RM_RF} @otherfiles\n";
2536 # See realclean and ext/utils/make_ext for usage of Makefile.old
2538 "\t-$self->{MV} $self->{MAKEFILE} $self->{MAKEFILE}.old 2>/dev/null\n");
2540 "\t$attribs{POSTOP}\n") if $attribs{POSTOP};
2545 my($self, %attribs) = @_;
2547 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
2548 $self = $ExtUtils::MakeMaker::Parent[-1];
2552 # Delete temporary files (via clean) and also delete installed files
2553 realclean purge :: clean
2555 # realclean subdirectories first (already cleaned)
2556 my $sub = "\t-cd %s && test -f %s && \$(MAKE) %s realclean\n";
2557 foreach(@{$self->{DIR}}){
2558 push(@m, sprintf($sub,$_,"$self->{MAKEFILE}.old","-f $self->{MAKEFILE}.old"));
2559 push(@m, sprintf($sub,$_,"$self->{MAKEFILE}",''));
2561 push(@m, " $self->{RM_RF} \$(INST_AUTODIR) \$(INST_ARCHAUTODIR)\n");
2562 push(@m, " $self->{RM_F} \$(INST_DYNAMIC) \$(INST_BOOT)\n");
2563 push(@m, " $self->{RM_F} \$(INST_STATIC) \$(INST_PM)\n");
2564 my(@otherfiles) = ($self->{MAKEFILE},
2565 "$self->{MAKEFILE}.old"); # Makefiles last
2566 push(@otherfiles, $attribs{FILES}) if $attribs{FILES};
2567 push(@m, " $self->{RM_RF} @otherfiles\n") if @otherfiles;
2568 push(@m, " $attribs{POSTOP}\n") if $attribs{POSTOP};
2575 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
2576 $self = $ExtUtils::MakeMaker::Parent[-1];
2580 distclean :: realclean distcheck
2585 $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -e 'use ExtUtils::Manifest "&fullcheck";' \\
2591 $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -e 'use ExtUtils::Manifest "&skipcheck";' \\
2597 $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -e 'use ExtUtils::Manifest "&mkmanifest";' \\
2606 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
2607 $self = $ExtUtils::MakeMaker::Parent[-1];
2611 dist : $(DIST_DEFAULT)
2613 tardist : $(DISTVNAME).tar.$(SUFFIX)
2615 $(DISTVNAME).tar.$(SUFFIX) : distdir
2617 $(TAR) $(TARFLAGS) $(DISTVNAME).tar $(DISTVNAME)
2618 $(RM_RF) $(DISTVNAME)
2619 $(COMPRESS) $(DISTVNAME).tar
2622 uutardist : $(DISTVNAME).tar.$(SUFFIX)
2623 uuencode $(DISTVNAME).tar.$(SUFFIX) \\
2624 $(DISTVNAME).tar.$(SUFFIX) > \\
2625 $(DISTVNAME).tar.$(SUFFIX).uu
2629 $(SHAR) $(DISTVNAME) > $(DISTVNAME).shar
2630 $(RM_RF) $(DISTVNAME)
2639 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
2640 $self = $ExtUtils::MakeMaker::Parent[-1];
2645 $(RM_RF) $(DISTVNAME)
2646 $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -e 'use ExtUtils::Manifest "/mani/";' \\
2647 -e 'manicopy(maniread(),"$(DISTVNAME)", "$(DIST_CP)");'
2655 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
2656 $self = $ExtUtils::MakeMaker::Parent[-1];
2661 cd $(DISTVNAME) && $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) Makefile.PL
2662 cd $(DISTVNAME) && $(MAKE)
2663 cd $(DISTVNAME) && $(MAKE) test
2671 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
2672 $self = $ExtUtils::MakeMaker::Parent[-1];
2677 $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -e 'use ExtUtils::Manifest "&maniread";' \\
2678 -e '@all = keys %{ maniread() };' \\
2679 -e 'print("Executing $(CI) @all\n"); system("$(CI) @all");' \\
2680 -e 'print("Executing $(RCS_LABEL) ...\n"); system("$(RCS_LABEL) @all");'
2686 my($self, %attribs) = @_;
2688 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
2689 $self = $ExtUtils::MakeMaker::Parent[-1];
2694 }.$self->{NOECHO}.q{echo Appending installation info to $(INSTALLARCHLIB)/perllocal.pod
2695 }.$self->{NOECHO}.q{$(PERL) -I$(INST_ARCHLIB) -I$(INST_LIB) -I$(PERL_ARCHLIB) -I$(PERL_LIB) \\
2696 -e "use ExtUtils::MakeMaker; MY->new({})->writedoc('Module', '$(NAME)', \\
2697 'LINKTYPE=$(LINKTYPE)', 'VERSION=$(VERSION)', 'XS_VERSION=$(XS_VERSION)', \\
2698 'EXE_FILES=$(EXE_FILES)')" >> $(INSTALLARCHLIB)/perllocal.pod
2702 install :: pure_install doc_install
2706 # install subdirectories first
2707 push(@m, map("\tcd $_ && test -f $self->{MAKEFILE} && \$(MAKE) install\n",
2710 push(@m, "\t$self->{NOECHO}".q{$(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -e 'require File::Path;' \
2711 -e '$$message = q[ You do not have permissions to install into];' \
2712 -e 'File::Path::mkpath(@ARGV);' \
2713 -e 'foreach (@ARGV){ die qq{ $$message $$_\\n} unless -w $$_}' \
2714 $(INSTALLPRIVLIB) $(INSTALLARCHLIB)
2715 $(MAKE) INST_LIB=$(INSTALLPRIVLIB) INST_ARCHLIB=$(INSTALLARCHLIB) \
2716 INST_EXE=$(INSTALLBIN) INST_MAN1DIR=$(INSTALLMAN1DIR) \
2717 INST_MAN3DIR=$(INSTALLMAN3DIR) all
2720 }.$self->{NOECHO}.q{$(PERL) -ne 'BEGIN{die "Need 2 arguments to reorg .packlist" unless @ARGV==2;' \
2721 -e '$$out=$$ARGV[1]; shift @ARGV while @ARGV && ! -f $$ARGV[0]; exit unless @ARGV;}' \
2722 -e 'push @lines, $$_ unless $$seen{$$_}++;' \
2723 -e 'END{open STDOUT, ">$$out" or die "Cannot write to $$out: $$!";' \
2724 -e 'print @lines;}' $(PERL_ARCHLIB)/auto/$(FULLEXT)/.packlist \
2725 $(INST_ARCHAUTODIR)/.packlist
2731 # Comment on .packlist rewrite above:
2732 # Read both .packlist files: the old one in PERL_ARCHLIB/auto/FULLEXT, and the new one
2733 # in INSTARCHAUTODIR. Don't croak if they are missing. Write to the one
2734 # in INSTARCHAUTODIR.
2736 #### UNINSTALL IS STILL EXPERIMENTAL ####
2740 push(@m, map("\tcd $_ && test -f $self->{MAKEFILE} && \$(MAKE) uninstall\n",
2742 push @m, "\t".'$(RM_RF) `cat $(PERL_ARCHLIB)/auto/$(FULLEXT)/.packlist`
2752 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
2753 $self = $ExtUtils::MakeMaker::Parent[-1];
2755 '# Phony target to force checking subdirectories.
2764 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
2765 $self = $ExtUtils::MakeMaker::Parent[-1];
2769 PERL_HDRS = $(PERL_INC)/EXTERN.h $(PERL_INC)/INTERN.h \
2770 $(PERL_INC)/XSUB.h $(PERL_INC)/av.h $(PERL_INC)/cop.h \
2771 $(PERL_INC)/cv.h $(PERL_INC)/dosish.h $(PERL_INC)/embed.h \
2772 $(PERL_INC)/form.h $(PERL_INC)/gv.h $(PERL_INC)/handy.h \
2773 $(PERL_INC)/hv.h $(PERL_INC)/keywords.h $(PERL_INC)/mg.h \
2774 $(PERL_INC)/op.h $(PERL_INC)/opcode.h $(PERL_INC)/patchlevel.h \
2775 $(PERL_INC)/perl.h $(PERL_INC)/perly.h $(PERL_INC)/pp.h \
2776 $(PERL_INC)/proto.h $(PERL_INC)/regcomp.h $(PERL_INC)/regexp.h \
2777 $(PERL_INC)/scope.h $(PERL_INC)/sv.h $(PERL_INC)/unixish.h \
2778 $(PERL_INC)/util.h $(PERL_INC)/config.h
2783 $(OBJECT) : $(PERL_HDRS)
2784 ' if $self->{OBJECT};
2787 # Check for unpropogated config.sh changes. Should never happen.
2788 # We do NOT just update config.h because that is not sufficient.
2789 # An out of date config.h is not fatal but complains loudly!
2790 $(PERL_INC)/config.h: $(PERL_SRC)/config.sh
2791 -'.$self->{NOECHO}.'echo "Warning: $(PERL_INC)/config.h out of date with $(PERL_SRC)/config.sh"; false
2793 $(PERL_ARCHLIB)/Config.pm: $(PERL_SRC)/config.sh
2794 '.$self->{NOECHO}.'echo "Warning: $(PERL_ARCHLIB)/Config.pm may be out of date with $(PERL_SRC)/config.sh"
2795 cd $(PERL_SRC) && $(MAKE) lib/Config.pm
2796 ') if $self->{PERL_SRC};
2798 push(@m, join(" ", values %{$self->{XS}})." : \$(XSUBPPDEPS)\n")
2806 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
2807 $self = $ExtUtils::MakeMaker::Parent[-1];
2810 # We do not know what target was originally specified so we
2811 # must force a manual rerun to be sure. But as it should only
2812 # happen very rarely it is not a significant problem.
2814 $(OBJECT) : $(FIRST_MAKEFILE)
2815 ' if $self->{OBJECT};
2818 # We take a very conservative approach here, but it\'s worth it.
2819 # We move Makefile to Makefile.old here to avoid gnu make looping.
2820 '.$self->{MAKEFILE}.' : Makefile.PL $(CONFIGDEP)
2821 '.$self->{NOECHO}.'echo "Makefile out-of-date with respect to $?"
2822 '.$self->{NOECHO}.'echo "Cleaning current config before rebuilding Makefile..."
2823 -'.$self->{NOECHO}.'mv '."$self->{MAKEFILE} $self->{MAKEFILE}.old".'
2824 -$(MAKE) -f '.$self->{MAKEFILE}.'.old clean >/dev/null 2>&1 || true
2825 $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" Makefile.PL '."@ARGV".'
2826 '.$self->{NOECHO}.'echo ">>> Your Makefile has been rebuilt. <<<"
2827 '.$self->{NOECHO}.'echo ">>> Please rerun the make command. <<<"; false
2834 my($self, %attribs) = @_;
2836 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
2837 $self = $ExtUtils::MakeMaker::Parent[-1];
2841 my(%searchdirs)=($self->{PERL_ARCHLIB} => 1, $self->{INST_ARCHLIB} => 1);
2842 my(@searchdirs)=keys %searchdirs;
2844 # And as it's not yet built, we add the current extension
2845 # but only if it has some C code (or XS code, which implies C code)
2846 if (@{$self->{C}}) {
2847 @static="$self->{INST_ARCHLIB}/auto/$self->{FULLEXT}/$self->{BASEEXT}$self->{LIB_EXT}";
2850 # Either we determine now, which libraries we will produce in the
2851 # subdirectories or we do it at runtime of the make.
2853 # We could ask all subdir objects, but I cannot imagine, why it
2854 # would be necessary.
2856 # Instead we determine all libraries for the new perl at
2858 my(@perlinc) = ($self->{INST_ARCHLIB}, $self->{INST_LIB}, $self->{PERL_ARCHLIB}, $self->{PERL_LIB});
2860 $self->makeaperl(MAKE => $self->{MAKEFILE},
2861 DIRS => \@searchdirs,
2864 TARGET => $self->{MAP_TARGET},
2866 LIBPERL => $self->{LIBPERL_A}
2870 # --- Test and Installation Sections ---
2873 my($self, %attribs) = @_;
2875 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
2876 $self = $ExtUtils::MakeMaker::Parent[-1];
2878 my($tests) = $attribs{TESTS} || (-d "t" ? "t/*.t" : "");
2882 TEST_TYPE=test_\$(LINKTYPE)
2884 test :: \$(TEST_TYPE)
2886 push(@m, map("\t$self->{NOECHO}cd $_ && test -f $self->{MAKEFILE} && \$(MAKE) test \$(PASTHRU)\n",
2888 push(@m, "\t$self->{NOECHO}echo 'No tests defined for \$(NAME) extension.'\n")
2889 unless $tests or -f "test.pl" or @{$self->{DIR}};
2892 push(@m, "test_dynamic :: all\n");
2893 push(@m, $self->test_via_harness('$(FULLPERL)', $tests)) if $tests;
2894 push(@m, $self->test_via_script('$(FULLPERL)', 'test.pl')) if -f "test.pl";
2897 # Occasionally we may face this degenerate target:
2898 push @m, "test_ : test_dynamic\n\n";
2900 if ($self->needs_linking()) {
2901 push(@m, "test_static :: all \$(MAP_TARGET)\n");
2902 push(@m, $self->test_via_harness('./$(MAP_TARGET)', $tests)) if $tests;
2903 push(@m, $self->test_via_script('./$(MAP_TARGET)', 'test.pl')) if -f "test.pl";
2906 push @m, "test_static :: test_dynamic\n";
2911 sub test_via_harness {
2912 my($self, $perl, $tests) = @_;
2914 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
2915 $self = $ExtUtils::MakeMaker::Parent[-1];
2917 "\tPERL_DL_NONLAZY=1 $perl".q! -I$(INST_ARCHLIB) -I$(INST_LIB) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -e 'use Test::Harness qw(&runtests $$verbose); $$verbose=$(TEST_VERBOSE); runtests @ARGV;' !."$tests\n";
2920 sub test_via_script {
2921 my($self, $perl, $script) = @_;
2923 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
2924 $self = $ExtUtils::MakeMaker::Parent[-1];
2926 "\tPERL_DL_NONLAZY=1 $perl".' -I$(INST_ARCHLIB) -I$(INST_LIB) -I$(PERL_ARCHLIB) -I$(PERL_LIB) test.pl
2934 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
2935 $self = $ExtUtils::MakeMaker::Parent[-1];
2941 my($self, %attribs) = @_;
2943 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
2944 $self = $ExtUtils::MakeMaker::Parent[-1];
2946 my($makefilename, $searchdirs, $static, $extra, $perlinc, $target, $tmp, $libperl) =
2947 @attribs{qw(MAKE DIRS STAT EXTRA INCL TARGET TMP LIBPERL)};
2950 # --- MakeMaker makeaperl section ---
2951 MAP_TARGET = $target
2952 FULLPERL = $self->{FULLPERL}
2954 return join '', @m if $self->{PARENT};
2956 my($dir) = join ":", @{$self->{DIR}};
2958 unless ($self->{MAKEAPERL}) {
2960 $(MAP_TARGET) :: $(MAKE_APERL_FILE)
2961 $(MAKE) -f $(MAKE_APERL_FILE) static $@
2963 $(MAKE_APERL_FILE) : $(FIRST_MAKEFILE)
2964 }.$self->{NOECHO}.q{echo Writing \"$(MAKE_APERL_FILE)\" for this $(MAP_TARGET)
2965 }.$self->{NOECHO}.q{$(PERL) -I$(INST_ARCHLIB) -I$(INST_LIB) -I$(PERL_ARCHLIB) -I$(PERL_LIB) \
2966 Makefile.PL DIR=}, $dir, q{ \
2967 MAKEFILE=$(MAKE_APERL_FILE) LINKTYPE=static \
2968 MAKEAPERL=1 NORECURS=1 CCCDLFLAGS=};
2970 push @m, map( " \\\n\t\t$_", @ARGV );
2978 my($cccmd, $linkcmd, $lperl);
2981 $cccmd = $self->const_cccmd($libperl);
2982 $cccmd =~ s/^CCCMD\s*=\s*//;
2983 $cccmd =~ s/\$\(INC\)/ -I$self->{PERL_INC} /;
2984 $cccmd .= " $Config::Config{cccdlflags}" if ($Config::Config{d_shrplib});
2985 $cccmd =~ s/\n/ /g; # yes I've seen "\n", don't ask me where it came from. A.K.
2986 $cccmd =~ s/\(CC\)/\(PERLMAINCC\)/;
2988 # The front matter of the linkcommand...
2989 $linkcmd = join ' ', "\$(CC)",
2990 grep($_, @Config{qw(large split ldflags ccdlflags)});
2991 $linkcmd =~ s/\s+/ /g;
2993 # Which *.a files could we make use of...
2995 File::Find::find(sub {
2996 return unless m/\Q$self->{LIB_EXT}\E$/;
2997 return if m/^libperl/;
2998 # don't include the installed version of this extension. I
2999 # leave this line here, although it is not necessary anymore:
3000 # I patched minimod.PL instead, so that Miniperl.pm won't
3001 # enclude duplicates
3003 # Once the patch to minimod.PL is in the distribution, I can
3005 return if $File::Find::name =~ m:auto/$self->{FULLEXT}/$self->{BASEEXT}$self->{LIB_EXT}$:;
3006 $static{fastcwd() . "/" . $_}++;
3007 }, grep( -d $_, @{$searchdirs || []}) );
3009 # We trust that what has been handed in as argument, will be buildable
3010 $static = [] unless $static;
3011 @static{@{$static}} = (1) x @{$static};
3013 $extra = [] unless $extra && ref $extra eq 'ARRAY';
3014 for (sort keys %static) {
3015 next unless /\Q$self->{LIB_EXT}\E$/;
3016 $_ = dirname($_) . "/extralibs.ld";
3020 grep(s/^/-I/, @{$perlinc || []});
3022 $target = "perl" unless $target;
3023 $tmp = "." unless $tmp;
3025 # MAP_STATIC doesn't look into subdirs yet. Once "all" is made and we
3026 # regenerate the Makefiles, MAP_STATIC and the dependencies for
3027 # extralibs.all are computed correctly
3029 MAP_LINKCMD = $linkcmd
3030 MAP_PERLINC = @{$perlinc || []}
3032 join(" \\\n\t", reverse sort keys %static), "
3034 MAP_PRELIBS = $Config::Config{libs} $Config::Config{cryptlib}
3037 if (defined $libperl) {
3038 ($lperl = $libperl) =~ s/\$\(A\)/$self->{LIB_EXT}/;
3040 unless ($libperl && -f $lperl) { # Could quite follow your idea her, Ilya
3041 my $dir = $self->{PERL_SRC} || "$self->{PERL_ARCHLIB}/CORE";
3042 $libperl ||= "libperl$self->{LIB_EXT}";
3043 $libperl = "$dir/$libperl";
3044 $lperl ||= "libperl$self->{LIB_EXT}";
3045 $lperl = "$dir/$lperl";
3046 print STDOUT "Warning: $libperl not found
3047 If you're going to build a static perl binary, make sure perl is installed
3048 otherwise ignore this warning\n"
3049 unless (-f $lperl || defined($self->{PERL_SRC}));
3053 MAP_LIBPERL = $libperl
3057 \$(INST_ARCHAUTODIR)/extralibs.all: \$(INST_ARCHAUTODIR)/.exists ".join(" \\\n\t", @$extra)."
3058 $self->{NOECHO}$self->{RM_F} \$\@
3059 $self->{NOECHO}\$(TOUCH) \$\@
3063 foreach $catfile (@$extra){
3064 push @m, "\tcat $catfile >> \$\@\n";
3068 \$(MAP_TARGET) :: $tmp/perlmain\$(OBJ_EXT) \$(MAP_LIBPERL) \$(MAP_STATIC) \$(INST_ARCHAUTODIR)/extralibs.all
3069 \$(MAP_LINKCMD) -o \$\@ $tmp/perlmain\$(OBJ_EXT) \$(MAP_LIBPERL) \$(MAP_STATIC) `cat \$(INST_ARCHAUTODIR)/extralibs.all` \$(MAP_PRELIBS)
3070 $self->{NOECHO}echo 'To install the new \"\$(MAP_TARGET)\" binary, call'
3071 $self->{NOECHO}echo ' make -f $makefilename inst_perl MAP_TARGET=\$(MAP_TARGET)'
3072 $self->{NOECHO}echo 'To remove the intermediate files say'
3073 $self->{NOECHO}echo ' make -f $makefilename map_clean'
3075 $tmp/perlmain\$(OBJ_EXT): $tmp/perlmain.c
3077 push @m, "\tcd $tmp && $cccmd -I\$(PERL_INC) perlmain.c\n";
3080 $tmp/perlmain.c: $makefilename}, q{
3081 }.$self->{NOECHO}.q{echo Writing $@
3082 }.$self->{NOECHO}.q{$(PERL) $(MAP_PERLINC) -e 'use ExtUtils::Miniperl; \\
3083 writemain(grep s#.*/auto/##, qw|$(MAP_STATIC)|)' > $@.tmp && mv $@.tmp $@
3087 # We write EXTRA outside the perl program to have it eval'd by the shell
3090 }.$self->{NOECHO}.q{echo Appending installation info to $(INSTALLARCHLIB)/perllocal.pod
3091 }.$self->{NOECHO}.q{$(FULLPERL) -e 'use ExtUtils::MakeMaker; MY->new->writedoc("Perl binary",' \\
3092 -e '"$(MAP_TARGET)", "MAP_STATIC=$(MAP_STATIC)",' \\
3093 -e '"MAP_EXTRA=@ARGV", "MAP_LIBPERL=$(MAP_LIBPERL)")' \\
3094 -- `cat $(INST_ARCHAUTODIR)/extralibs.all` >> $(INSTALLARCHLIB)/perllocal.pod
3098 inst_perl: pure_inst_perl doc_inst_perl
3100 pure_inst_perl: \$(MAP_TARGET)
3101 $self->{CP} \$(MAP_TARGET) \$(INSTALLBIN)/\$(MAP_TARGET)
3106 $self->{RM_F} $tmp/perlmain\$(OBJ_EXT) $tmp/perlmain.c \$(MAP_TARGET) $makefilename \$(INST_ARCHAUTODIR)/extralibs.all
3113 my($self,$libs) = @_;
3115 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
3116 $self = $ExtUtils::MakeMaker::Parent[-1];
3118 require ExtUtils::Liblist;
3119 ExtUtils::Liblist::ext($libs, $ExtUtils::MakeMaker::Verbose);
3122 # --- Make-Directories section (internal method) ---
3123 # dir_target(@array) returns a Makefile entry for the file .exists in each
3124 # named directory. Returns nothing, if the entry has already been processed.
3125 # We're helpless though, if the same directory comes as $(FOO) _and_ as "bar".
3126 # Both of them get an entry, that's why we use "::". I chose '$(PERL)' as the
3127 # prerequisite, because there has to be one, something that doesn't change
3131 my($self,@dirs) = @_;
3133 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
3134 $self = $ExtUtils::MakeMaker::Parent[-1];
3137 foreach $dir (@dirs) {
3138 next if $self->{DIR_TARGET}{$self}{$dir}++;
3140 $dir/.exists :: \$(PERL)
3141 $self->{NOECHO}\$(MKPATH) $dir
3142 $self->{NOECHO}\$(EQUALIZE_TIMESTAMP) \$(PERL) $dir/.exists
3143 $self->{NOECHO}-\$(CHMOD) 755 $dir
3149 # --- Output postprocessing section ---
3150 # nicetext is included to make VMS support easier
3151 sub nicetext { # Just return the input - no action needed
3152 my($self,$text) = @_;
3154 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
3155 $self = $ExtUtils::MakeMaker::Parent[-1];
3160 sub needs_linking { # Does this module need linking? Looks into
3161 # subdirectory objects (see also has_link_code()
3164 $caller = (caller(0))[3];
3166 ExtUtils::MakeMaker::TieAtt::warndirectuse($caller);
3167 $self = $ExtUtils::MakeMaker::Parent[-1];
3169 Carp::confess("Needs_linking called too early") if $caller =~ /^ExtUtils::MakeMaker::/;
3170 return $self->{NEEDS_LINKING} if defined $self->{NEEDS_LINKING};
3172 # print Carp::longmess();
3173 # print "EO_DEBUG\n";
3174 if ($self->has_link_code or $self->{MAKEAPERL}){
3175 $self->{NEEDS_LINKING} = 1;
3178 foreach $child (keys %{$self->{CHILDREN}}) {
3179 if ($self->{CHILDREN}->{$child}->needs_linking) {
3180 $self->{NEEDS_LINKING} = 1;
3184 return $self->{NEEDS_LINKING} = 0;
3189 return $self->{HAS_LINK_CODE} if defined $self->{HAS_LINK_CODE};
3190 if ($self->{OBJECT} or @{$self->{C} || []} or $self->{MYEXTLIB}){
3191 $self->{HAS_LINK_CODE} = 1;
3194 return $self->{HAS_LINK_CODE} = 0;
3197 # --- perllocal.pod section ---
3199 my($self,$what,$name,@attribs)=@_;
3201 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
3202 $self = $ExtUtils::MakeMaker::Parent[-1];
3204 my($time) = localtime;
3205 print "=head2 $time: $what C<$name>\n\n=over 4\n\n=item *\n\n";
3206 print join "\n\n=item *\n\n", map("C<$_>",@attribs);
3207 print "\n\n=back\n\n";
3210 sub catdir { shift; my $result = join('/',@_); $result =~ s:/+:/:g; $result; }
3211 sub catfile { shift; my $result = join('/',@_); $result =~ s:/+:/:g; $result; }
3213 package ExtUtils::MM_OS2;
3217 #use File::Basename;
3220 Exporter::import('ExtUtils::MakeMaker',
3221 qw( $Verbose &neatvalue));
3224 my($self,%attribs) = @_;
3226 my($funcs) = $attribs{DL_FUNCS} || $self->{DL_FUNCS} || {};
3227 my($vars) = $attribs{DL_VARS} || $self->{DL_VARS} || [];
3229 (my $boot = $self->{NAME}) =~ s/:/_/g;
3231 if (not $self->{SKIPHASH}{'dynamic'}) {
3233 $self->{BASEEXT}.def: Makefile.PL
3234 ",' $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -e \'use ExtUtils::Mksymlists; \\
3235 Mksymlists("NAME" => "',$self->{NAME},'", "DLBASE" => "',$self->{DLBASE},
3236 '", "DL_FUNCS" => ',neatvalue($funcs),', "DL_VARS" => ', neatvalue($vars), ');\'
3242 sub replace_manpage_separator {
3243 my($self,$man) = @_;
3249 my($self,$file) = @_;
3250 return $file if -x $file && ! -d _;
3251 return "$file.exe" if -x "$file.exe" && ! -d _;
3252 return "$file.cmd" if -x "$file.cmd" && ! -d _;
3256 sub file_name_is_absolute {
3257 my($self,$file) = @_;
3258 $file =~ m{^([a-z]:)?[\\/]}i ;
3262 # the following keeps AutoSplit happy
3263 package ExtUtils::MakeMaker;
3270 ExtUtils::MakeMaker - create an extension Makefile
3274 C<use ExtUtils::MakeMaker;>
3276 C<WriteMakefile( ATTRIBUTE =E<gt> VALUE [, ...] );>
3280 C<MM-E<gt>new(\%att)-E<gt>flush;>
3284 This utility is designed to write a Makefile for an extension module
3285 from a Makefile.PL. It is based on the Makefile.SH model provided by
3286 Andy Dougherty and the perl5-porters.
3288 It splits the task of generating the Makefile into several subroutines
3289 that can be individually overridden. Each subroutine returns the text
3290 it wishes to have written to the Makefile.
3292 =head2 Hintsfile support
3294 MakeMaker.pm uses the architecture specific information from
3295 Config.pm. In addition it evaluates architecture specific hints files
3296 in a C<hints/> directory. The hints files are expected to be named
3297 like their counterparts in C<PERL_SRC/hints>, but with an C<.pl> file
3298 name extension (eg. C<next_3_2.pl>). They are simply C<eval>ed by
3299 MakeMaker within the WriteMakefile() subroutine, and can be used to
3300 execute commands as well as to include special variables. The rules
3301 which hintsfile is chosen are the same as in Configure.
3303 The hintsfile is eval()ed immediately after the arguments given to
3304 WriteMakefile are stuffed into a hash reference $self but before this
3305 reference becomes blessed. So if you want to do the equivalent to
3306 override or create an attribute you would say something like
3308 $self->{LIBS} = ['-ldbm -lucb -lc'];
3310 =head2 What's new in version 5 of MakeMaker
3312 MakeMaker 5 is pure object oriented. This allows us to write an
3313 unlimited number of Makefiles with a single perl process. 'perl
3314 Makefile.PL' with MakeMaker 5 goes through all subdirectories
3315 immediately and evaluates any Makefile.PL found in the next level
3316 subdirectories. The benefit of this approach comes in useful for both
3317 single and multi directories extensions.
3319 Multi directory extensions have an immediately visible speed
3320 advantage, because there's no startup penalty for any single
3321 subdirectory Makefile.
3323 Single directory packages benefit from the much improved
3324 needs_linking() method. As the main Makefile knows everything about
3325 the subdirectories, a needs_linking() method can now query all
3326 subdirectories if there is any linking involved down in the tree. The
3327 speedup for PM-only Makefiles seems to be around 1 second on my
3330 =head2 Incompatibilities between MakeMaker 5.00 and 4.23
3332 There are no incompatibilities in the short term, as all changes are
3333 accompanied by short-term workarounds that guarantee full backwards
3336 You are likely to face a few warnings that expose deprecations which
3337 will result in incompatibilities in the long run:
3339 You should not use %att directly anymore. Instead any subroutine you
3340 override in the MY package will be called by the object method, so you
3341 can access all object attributes directly via the object in $_[0].
3343 You should not call the class methos MM->something anymore. Instead
3344 you should call the superclass. Something like
3348 $self->MM::constants();
3351 Especially the libscan() and exescan() methods should be altered
3352 towards OO programming, that means do not expect that $_ to contain
3353 the path but rather $_[1].
3355 You should program with more care. Watch out for any MakeMaker
3356 variables. Do not try to alter them, somebody else might depend on
3357 them. E.g. do not overwrite the ExtUtils::MakeMaker::VERSION variable
3358 (this happens if you import it and then set it to the version number
3359 of your package), do not expect that the INST_LIB variable will be
3360 ./blib (do not 'unshift @INC, "./blib" and do not use
3361 "blib/FindBin.pm"). Do not croak in your Makefile.PL, let it fail with
3364 Try to build several extensions simultanously to debug your
3365 Makefile.PL. You can unpack a bunch of distributed packages, so your
3366 directory looks like
3368 Alias-1.00/ Net-FTP-1.01a/ Set-Scalar-0.001/
3369 ExtUtils-Peek-0.4/ Net-Ping-1.00/ SetDualVar-1.0/
3370 Filter-1.06/ NetTools-1.01a/ Storable-0.1/
3371 GD-1.00/ Religion-1.04/ Sys-Domain-1.05/
3372 MailTools-1.03/ SNMP-1.5b/ Term-ReadLine-0.7/
3374 and write a dummy Makefile.PL that contains nothing but
3376 use ExtUtils::MakeMaker;
3379 That's actually fun to watch :)
3381 Final suggestion: Try to delete all of your MY:: subroutines and
3382 watch, if you really still need them. MakeMaker might already do what
3383 you want without them. That's all about it.
3386 =head2 Default Makefile Behaviour
3388 The automatically generated Makefile enables the user of the extension
3391 perl Makefile.PL # optionally "perl Makefile.PL verbose"
3393 make test # optionally set TEST_VERBOSE=1
3394 make install # See below
3396 The Makefile to be produced may be altered by adding arguments of the
3397 form C<KEY=VALUE>. If the user wants to work with a different perl
3398 than the default, this can be achieved with
3400 perl Makefile.PL PERL=/tmp/myperl5
3402 Other interesting targets in the generated Makefile are
3404 make config # to check if the Makefile is up-to-date
3405 make clean # delete local temp files (Makefile gets renamed)
3406 make realclean # delete derived files (including ./blib)
3407 make dist # see below the Distribution Support section
3409 =head2 Special case make install
3411 make alone puts all relevant files into directories that are named by
3412 the macros INST_LIB, INST_ARCHLIB, INST_EXE, INST_MAN1DIR, and
3413 INST_MAN3DIR. All these default to ./blib or something below blib if
3414 you are I<not> building below the perl source directory. If you I<are>
3415 building below the perl source, INST_LIB and INST_ARCHLIB default to
3416 ../../lib, and INST_EXE is not defined.
3418 The I<install> target of the generated Makefile is a recursive call to
3421 INST_LIB to INSTALLPRIVLIB
3422 INST_ARCHLIB to INSTALLARCHLIB
3423 INST_EXE to INSTALLBIN
3424 INST_MAN1DIR to INSTALLMAN1DIR
3425 INST_MAN3DIR to INSTALLMAN3DIR
3427 The INSTALL... macros in turn default to their %Config
3428 ($Config{installprivlib}, $Config{installarchlib}, etc.) counterparts.
3430 The recommended way to proceed is to set only the INSTALL* macros, not
3431 the INST_* targets. In doing so, you give room to the compilation
3432 process without affecting important directories. Usually a make
3433 test will succeed after the make, and a make install can finish
3436 MakeMaker gives you much more freedom than needed to configure
3437 internal variables and get different results. It is worth to mention,
3438 that make(1) also lets you configure most of the variables that are
3439 used in the Makefile. But in the majority of situations this will not
3440 be necessary, and should only be done, if the author of a package
3443 The usual relationship between INSTALLPRIVLIB and INSTALLARCHLIB is
3444 that the latter is a subdirectory of the former with the name
3445 C<$Config{archname}>, MakeMaker supports the user who sets
3446 INSTALLPRIVLIB. If INSTALLPRIVLIB is set, but INSTALLARCHLIB not, then
3447 MakeMaker defaults the latter to be INSTALLPRIVLIB/ARCHNAME if that
3448 directory exists, otherwise it defaults to INSTALLPRIVLIB.
3451 =head2 PREFIX attribute
3453 The PREFIX attribute can be used to set the INSTALL* attributes in one
3454 go. The quickest way to install a module in a non-standard place
3456 perl Makefile.PL PREFIX=~
3458 This will replace the string specified by $Config{prefix} in all
3459 $Config{install*} values.
3461 Note, that the tilde expansion is done by MakeMaker, not by perl by
3462 default, nor by make.
3464 It is important to know, that the INSTALL* macros should be absolute
3465 paths, never relativ ones. Packages with multiple Makefile.PLs in
3466 different directories get the contents of the INSTALL* macros
3467 propagated verbatim. (The INST_* macros will be corrected, if they are
3468 relativ paths, but not the INSTALL* macros.)
3470 If the user has superuser privileges, and is not working on AFS
3471 (Andrew File System) or relatives, then the defaults for
3472 INSTALLPRIVLIB, INSTALLARCHLIB, INSTALLBIN, etc. will be appropriate,
3473 and this incantation will be the best:
3475 perl Makefile.PL; make; make test
3478 make install per default writes some documentation of what has been
3479 done into the file C<$(INSTALLARCHLIB)/perllocal.pod>. This is
3480 an experimental feature. It can be bypassed by calling make
3485 will have to specify the installation directories as these most
3486 probably have changed since perl itself has been installed. They will
3487 have to do this by calling
3489 perl Makefile.PL INSTALLPRIVLIB=/afs/here/today \
3490 INSTALLBIN=/afs/there/now INSTALLMAN3DIR=/afs/for/manpages
3493 In nested extensions with many subdirectories, the INSTALL* arguments
3494 will get propagated to the subdirectories. Be careful to repeat this
3495 procedure every time you recompile an extension, unless you are sure
3496 the AFS istallation directories are still valid.
3498 =head2 Static Linking of a new Perl Binary
3500 An extension that is built with the above steps is ready to use on
3501 systems supporting dynamic loading. On systems that do not support
3502 dynamic loading, any newly created extension has to be linked together
3503 with the available resources. MakeMaker supports the linking process
3504 by creating appropriate targets in the Makefile whenever an extension
3505 is built. You can invoke the corresponding section of the makefile with
3509 That produces a new perl binary in the current directory with all
3510 extensions linked in that can be found in INST_ARCHLIB (which usually
3511 is C<./blib>) and PERL_ARCHLIB. To do that, MakeMaker writes a new
3512 Makefile, on UNIX, this is called Makefile.aperl (may be system
3513 dependent). If you want to force the creation of a new perl, it is
3514 recommended, that you delete this Makefile.aperl, so INST_ARCHLIB and
3515 PERL_ARCHLIB are searched-through for linkable libraries again.
3517 The binary can be installed into the directory where perl normally
3518 resides on your machine with
3522 To produce a perl binary with a different name than C<perl>, either say
3524 perl Makefile.PL MAP_TARGET=myperl
3531 make myperl MAP_TARGET=myperl
3532 make inst_perl MAP_TARGET=myperl
3534 In any case you will be prompted with the correct invocation of the
3535 C<inst_perl> target that installs the new binary into INSTALLBIN.
3537 Note, that there is a C<makeaperl> scipt in the perl distribution,
3538 that supports the linking of a new perl binary in a similar fashion,
3539 but with more options.
3541 make inst_perl per default writes some documentation of what has been
3542 done into the file C<$(INSTALLARCHLIB)/perllocal.pod>. This
3543 can be bypassed by calling make pure_inst_perl.
3545 Warning: the inst_perl: target is rather mighty and will probably
3546 overwrite your existing perl binary. Use with care!
3548 Sometimes you might want to build a statically linked perl although
3549 your system supports dynamic loading. In this case you may explicitly
3550 set the linktype with the invocation of the Makefile.PL or make:
3552 perl Makefile.PL LINKTYPE=static # recommended
3556 make LINKTYPE=static # works on most systems
3558 =head2 Determination of Perl Library and Installation Locations
3560 MakeMaker needs to know, or to guess, where certain things are
3561 located. Especially INST_LIB and INST_ARCHLIB (where to install files
3562 into), PERL_LIB and PERL_ARCHLIB (where to read existing modules
3563 from), and PERL_INC (header files and C<libperl*.*>).
3565 Extensions may be built either using the contents of the perl source
3566 directory tree or from an installed copy of the perl library. The
3567 recommended way is to build extensions after you have run 'make
3568 install' on perl itself. Do that in a directory that is not below the
3569 perl source tree. The support for extensions below the ext directory
3570 of the perl distribution is only good for the standard extensions that
3573 If an extension is being built below the C<ext/> directory of the perl
3574 source then MakeMaker will set PERL_SRC automatically (e.g., C<../..>).
3575 If PERL_SRC is defined then other variables default to the following:
3578 PERL_LIB = PERL_SRC/lib
3579 PERL_ARCHLIB = PERL_SRC/lib
3581 INST_ARCHLIB = PERL_ARCHLIB
3583 If an extension is being built away from the perl source then MakeMaker
3584 will leave PERL_SRC undefined and default to using the installed copy
3585 of the perl library. The other variables default to the following:
3587 PERL_INC = $archlib/CORE
3589 PERL_ARCHLIB = $archlib
3591 INST_ARCHLIB = ./blib/<archname>
3593 If perl has not yet been installed then PERL_SRC can be defined on the
3594 command line as shown in the previous section.
3596 =head2 Useful Default Makefile Macros
3598 FULLEXT = Pathname for extension directory (eg DBD/Oracle).
3600 BASEEXT = Basename part of FULLEXT. May be just equal FULLEXT.
3602 ROOTEXT = Directory part of FULLEXT with leading slash (eg /DBD)
3604 INST_LIBDIR = C<$(INST_LIB)$(ROOTEXT)>
3606 INST_AUTODIR = C<$(INST_LIB)/auto/$(FULLEXT)>
3608 INST_ARCHAUTODIR = C<$(INST_ARCHLIB)/auto/$(FULLEXT)>
3610 =head2 Using Attributes (and Parameters)
3612 The following attributes can be specified as arguments to WriteMakefile()
3613 or as NAME=VALUE pairs on the command line:
3617 # The following "=item C" is used by the attrib_help routine
3618 # likewise the "=back" below. So be careful when changing it!
3624 Ref to array of *.c file names. Initialised from a directory scan
3625 and the values portion of the XS attribute hash. This is not
3626 currently used by MakeMaker but may be handy in Makefile.PLs.
3630 Arrayref. E.g. [qw(archname manext)] defines ARCHNAME & MANEXT from
3631 config.sh. MakeMaker will add to CONFIG the following values anyway:
3649 CODE reference. Extension writers are requested to do all their
3650 initializing within that subroutine. The subroutine
3651 should return a hash reference. The hash may contain
3652 further attributes, e.g. {LIBS => ...}, that have to
3653 be determined by some evaluation method.
3657 Something like C<"-DHAVE_UNISTD_H">
3661 Ref to array of subdirectories containing Makefile.PLs e.g. [ 'sdbm'
3666 Your name for distributing the package (by tar file) This defaults to
3671 Hashref of symbol names for routines to be made available as
3672 universal symbols. Each key/value pair consists of the package name
3673 and an array of routine names in that package. Used only under AIX
3674 (export lists) and VMS (linker options) at present. The routine
3675 names supplied will be expanded in the same way as XSUB names are
3676 expanded by the XS() macro. Defaults to
3678 {"$(NAME)" => ["boot_$(NAME)" ] }
3682 {"RPC" => [qw( boot_rpcb rpcb_gettime getnetconfigent )],
3683 "NetconfigPtr" => [ 'DESTROY'] }
3687 Array of symbol names for variables to be made available as
3688 universal symbols. Used only under AIX (export lists) and VMS
3689 (linker options) at present. Defaults to []. (e.g. [ qw(
3690 Foo_version Foo_numstreams Foo_tree ) ])
3694 Ref to array of executable files. The files will be copied to the
3695 INST_EXE directory. Make realclean will delete them from there
3698 =item FIRST_MAKEFILE
3700 The name of the Makefile to be produced. Defaults to the contents of
3701 MAKEFILE, but can be overridden. This is used for the second Makefile
3702 that will be produced for the MAP_TARGET.
3706 Perl binary able to run this extension.
3710 Ref to array of *.h file names. Similar to C.
3714 Include file dirs eg: C<"-I/usr/5include -I/path/to/inc">
3716 =item INSTALLARCHLIB
3718 Used by 'make install', which sets INST_ARCHLIB to this value.
3722 Used by 'make install' which sets INST_EXE to this value.
3724 =item INSTALLMAN1DIR
3726 This directory gets the man pages at 'make install' time. Defaults to
3727 $Config{installman1dir}.
3729 =item INSTALLMAN3DIR
3731 This directory gets the man pages at 'make install' time. Defaults to
3732 $Config{installman3dir}.
3734 =item INSTALLPRIVLIB
3736 Used by 'make install', which sets INST_LIB to this value.
3740 Same as INST_LIB for architecture dependent files.
3744 Directory, where executable scripts should be installed during
3745 'make'. Defaults to "./blib/ARCHNAME", just to have a dummy
3746 location during testing. make install will set
3747 INST_EXE to INSTALLBIN.
3751 Directory where we put library files of this extension while building
3756 Directory to hold the man pages at 'make' time
3760 Directory to hold the man pages at 'make' time
3764 defaults to "$(OBJECT)" and is used in the ld command to specify
3765 what files to link/load from (also see dynamic_lib below for how to
3770 The filename of the perllibrary that will be used together with this
3771 extension. Defaults to libperl.a.
3775 An anonymous array of alternative library
3776 specifications to be searched for (in order) until
3777 at least one library is found. E.g.
3779 'LIBS' => ["-lgdbm", "-ldbm -lfoo", "-L/path -ldbm.nfs"]
3781 Mind, that any element of the array
3782 contains a complete set of arguments for the ld
3783 command. So do not specify
3785 'LIBS' => ["-ltcl", "-ltk", "-lX11"]
3787 See ODBM_File/Makefile.PL for an example, where an array is needed. If
3788 you specify a scalar as in
3790 'LIBS' => "-ltcl -ltk -lX11"
3792 MakeMaker will turn it into an array with one element.
3796 'static' or 'dynamic' (default unless usedl=undef in config.sh) Should
3797 only be used to force static linking (also see
3802 Boolean which tells MakeMaker, that it should include the rules to
3803 make a perl. This is handled automatically as a switch by
3804 MakeMaker. The user normally does not need it.
3808 The name of the Makefile to be produced.
3812 Hashref of pod-containing files. MakeMaker will default this to all
3813 EXE_FILES files that include POD directives. The files listed
3814 here will be converted to man pages and installed as was requested
3819 Hashref of .pm and .pod files. MakeMaker will default this to all
3820 .pod and any .pm files that include POD directives. The files listed
3821 here will be converted to man pages and installed as was requested
3826 If it is intended, that a new perl binary be produced, this variable
3827 may hold a name for that binary. Defaults to perl
3831 If the extension links to a library that it builds set this to the
3832 name of the library (see SDBM_File)
3836 Perl module name for this extension (DBD::Oracle). This will default
3837 to the directory name but should be explicitly defined in the
3842 MakeMaker will figure out, if an extension contains linkable code
3843 anywhere down the directory tree, and will set this variable
3844 accordingly, but you can speed it up a very little bit, if you define
3845 this boolean variable yourself.
3849 Boolean. Experimental attribute to inhibit descending into
3854 List of object files, defaults to '$(BASEEXT)$(OBJ_EXT)', but can be a long
3855 string containing all object files, e.g. "tkpBind.o
3856 tkpButton.o tkpCanvas.o"
3860 Perl binary for tasks that can be done by miniperl
3864 The call to the program that is able to compile perlmain.c. Defaults
3869 Same as above for architecture dependent files
3873 Directory containing the Perl library to use.
3877 Directory containing the Perl source code (use of this should be
3878 avoided, it may be undefined)
3882 Ref to hash of files to be processed as perl programs. MakeMaker
3883 will default to any found *.PL file (except Makefile.PL) being keys
3884 and the basename of the file being the value. E.g.
3886 {'foobar.PL' => 'foobar'}
3888 The *.PL files are expected to produce output to the target files
3893 Hashref of .pm files and *.pl files to be installed. e.g.
3895 {'name_of_file.pm' => '$(INST_LIBDIR)/install_as.pm'}
3897 By default this will include *.pm and *.pl. If a lib directory
3898 exists and is not listed in DIR (above) then any *.pm and *.pl files
3899 it contains will also be included by default. Defining PM in the
3900 Makefile.PL will override PMLIBDIRS.
3904 Ref to array of subdirectories containing library files. Defaults to
3905 [ 'lib', $(BASEEXT) ]. The directories will be scanned and any files
3906 they contain will be installed in the corresponding location in the
3907 library. A libscan() method can be used to alter the behaviour.
3908 Defining PM in the Makefile.PL will override PMLIBDIRS.
3912 Can be used to set the three INSTALL* attributes in one go (except for
3913 INSTALLMAN1DIR). They will have PREFIX as a common directory node and
3914 will branch from that node into lib/, lib/ARCHNAME, and bin/ unless
3915 you override one of them.
3919 Placeholder, not yet implemented. Will eventually be a hashref: Names
3920 of modules that need to be available to run this extension (e.g. Fcntl
3921 for SDBM_File) are the keys of the hash and the desired version is the
3922 value. Needs further evaluation, should probably allow to define
3923 prerequisites among header files, libraries, perl version, etc.
3927 Arryref. E.g. [qw(name1 name2)] skip (do not write) sections of the
3932 Ref to array of typemap file names. Use this when the typemaps are
3933 in some directory other than the current directory or when they are
3934 not named B<typemap>. The last typemap in the list takes
3935 precedence. A typemap in the current directory has highest
3936 precedence, even if it isn't listed in TYPEMAPS. The default system
3937 typemap has lowest precedence.
3941 Your version number for distributing the package. This defaults to
3946 Instead of specifying the VERSION in the Makefile.PL you can let
3947 MakeMaker parse a file to determine the version number. The parsing
3948 routine requires that the file named by VERSION_FROM contains one
3949 single line to compute the version number. The first line in the file
3950 that contains the regular expression
3952 /(\$[\w:]*\bVERSION)\b.*=/
3954 will be evaluated with eval() and the value of the named variable
3955 B<after> the eval() will be assigned to the VERSION attribute of the
3956 MakeMaker object. The following lines will be parsed o.k.:
3959 ( $VERSION ) = '$Revision: 1.141 $ ' =~ /\$Revision:\s+([^\s]+)/;
3960 $FOO::VERSION = '1.10';
3962 but these will fail:
3964 my $VERSION = '1.01';
3965 local $VERSION = '1.02';
3966 local $FOO::VERSION = '1.30';
3968 The file named in VERSION_FROM is added as a dependency to Makefile to
3969 guarantee, that the Makefile contains the correct VERSION macro after
3970 a change of the file.
3974 Hashref of .xs files. MakeMaker will default this. e.g.
3976 {'name_of_file.xs' => 'name_of_file.c'}
3978 The .c files will automatically be included in the list of files
3979 deleted by a make clean.
3983 String of options to pass to xsubpp. This might include C<-C++> or
3984 C<-extern>. Do not include typemaps here; the TYPEMAP parameter exists for
3989 May be set to an empty string, which is identical to C<-prototypes>, or
3990 C<-noprototypes>. See the xsubpp documentation for details. MakeMaker
3991 defaults to the empty string.
3995 Your version number for the .xs file of this package. This defaults
3996 to the value of the VERSION attribute.
4000 =head2 Additional lowercase attributes
4002 can be used to pass parameters to the methods which implement that
4003 part of the Makefile. These are not normally required:
4009 {FILES => "*.xyz foo"}
4013 {ANY_TARGET => ANY_DEPENDECY, ...}
4017 {TARFLAGS => 'cvfF', COMPRESS => 'gzip', SUFFIX => 'gz',
4018 SHAR => 'shar -m', DIST_CP => 'ln'}
4020 If you specify COMPRESS, then SUFFIX should also be altered, as it is
4021 needed to tell make the target file of the compression. Setting
4022 DIST_CP to ln can be useful, if you need to preserve the timestamps on
4023 your files. DIST_CP can take the values 'cp', which copies the file,
4024 'ln', which links the file, and 'best' which copies symbolic links and
4025 links the rest. Default is 'best'.
4029 {ARMAYBE => 'ar', OTHERLDFLAGS => '...', INST_DYNAMIC_DEP => '...'}
4033 {SPLITLIB => '$(INST_LIB)' (default) or '$(INST_ARCHLIB)'}
4037 {LINKTYPE => 'static', 'dynamic' or ''}
4039 NB: Extensions that have nothing but *.pm files had to say
4043 with Pre-5.0 MakeMakers. Since version 5.00 of MakeMaker such a line
4044 can be deleted safely. MakeMaker recognizes, when there's nothing to
4049 {ANY_MACRO => ANY_VALUE, ...}
4053 {FILES => '$(INST_ARCHAUTODIR)/*.xyz'}
4055 =item tool_autosplit
4063 # bug in pod2html, so leave the =back
4065 # Don't delete this cut, MM depends on it!
4067 =head2 Overriding MakeMaker Methods
4069 If you cannot achieve the desired Makefile behaviour by specifying
4070 attributes you may define private subroutines in the Makefile.PL.
4071 Each subroutines returns the text it wishes to have written to
4072 the Makefile. To override a section of the Makefile you can
4075 sub MY::c_o { "new literal text" }
4077 or you can edit the default by saying something like:
4083 s/old text/new text/;
4087 Both methods above are available for backwards compatibility with
4090 If you still need a different solution, try to develop another
4091 subroutine, that fits your needs and submit the diffs to
4092 F<perl5-porters@nicoh.com> or F<comp.lang.perl.misc> as appropriate.
4094 =head2 Distribution Support
4096 For authors of extensions MakeMaker provides several Makefile
4097 targets. Most of the support comes from the ExtUtils::Manifest module,
4098 where additional documentation can be found.
4102 =item make distcheck
4104 reports which files are below the build directory but not in the
4105 MANIFEST file and vice versa. (See ExtUtils::Manifest::fullcheck() for
4108 =item make skipcheck
4110 reports which files are skipped due to the entries in the
4111 C<MANIFEST.SKIP> file (See ExtUtils::Manifest::skipcheck() for
4114 =item make distclean
4116 does a realclean first and then the distcheck. Note that this is not
4117 needed to build a new distribution as long as you are sure, that the
4118 MANIFEST file is ok.
4122 rewrites the MANIFEST file, adding all remaining files found (See
4123 ExtUtils::Manifest::mkmanifest() for details)
4127 Copies all the files that are in the MANIFEST file to a newly created
4128 directory with the name C<$(DISTNAME)-$(VERSION)>. If that directory
4129 exists, it will be removed first.
4133 Makes a distdir first, and runs a C<perl Makefile.PL>, a make, and
4134 a make test in that directory.
4138 First does a command $(PREOP) which defaults to a null command. Does a
4139 distdir next and runs C<tar> on that directory into a tarfile. Then
4140 deletes the distdir. Finishes with a command $(POSTOP) which defaults
4145 Defaults to $(DIST_DEFAULT) which in turn defaults to tardist.
4147 =item make uutardist
4149 Runs a tardist first and uuencodes the tarfile.
4153 First does a command $(PREOP) which defaults to a null command. Does a
4154 distdir next and runs C<shar> on that directory into a sharfile. Then
4155 deletes the distdir. Finishes with a command $(POSTOP) which defaults
4156 to a null command. Note: For shdist to work properly a C<shar>
4157 program that can handle directories is mandatory.
4161 Does a $(CI) and a $(RCS_LABEL) on all files in the MANIFEST file.
4165 Customization of the dist targets can be done by specifying a hash
4166 reference to the dist attribute of the WriteMakefile call. The
4167 following parameters are recognized:
4170 COMPRESS ('compress')
4173 RCS_LABEL ('rcs -q -Nv$(VERSION_SYM):')
4181 WriteMakefile( 'dist' => { COMPRESS=>"gzip", SUFFIX=>"gz" })
4186 Andy Dougherty F<E<lt>doughera@lafcol.lafayette.eduE<gt>>, Andreas
4187 KE<ouml>nig F<E<lt>A.Koenig@franz.ww.TU-Berlin.DEE<gt>>, Tim Bunce
4188 F<E<lt>Tim.Bunce@ig.co.ukE<gt>>. VMS support by Charles Bailey
4189 F<E<lt>bailey@HMIVAX.HUMGEN.UPENN.EDUE<gt>>. Contact the makemaker
4190 mailing list C<mailto:makemaker@franz.ww.tu-berlin.de>, if you have any
4193 =head1 MODIFICATION HISTORY
4195 For a more complete documentation see the file Changes in the
4196 MakeMaker distribution package.
4200 See the file Todo in the MakeMaker distribution package.