1 package ExtUtils::MM_Unix;
8 use ExtUtils::MakeMaker::Config;
9 use File::Basename qw(basename dirname);
14 use ExtUtils::MakeMaker qw($Verbose neatvalue);
16 # If we make $VERSION an our variable parse_version() breaks
17 use vars qw($VERSION);
20 require ExtUtils::MM_Any;
21 our @ISA = qw(ExtUtils::MM_Any);
25 $Is{OS2} = $^O eq 'os2';
26 $Is{Win32} = $^O eq 'MSWin32' || $Config{osname} eq 'NetWare';
27 $Is{Dos} = $^O eq 'dos';
28 $Is{VMS} = $^O eq 'VMS';
29 $Is{OSF} = $^O eq 'dec_osf';
30 $Is{IRIX} = $^O eq 'irix';
31 $Is{NetBSD} = $^O eq 'netbsd';
32 $Is{Interix} = $^O eq 'interix';
33 $Is{SunOS4} = $^O eq 'sunos';
34 $Is{Solaris} = $^O eq 'solaris';
35 $Is{SunOS} = $Is{SunOS4} || $Is{Solaris};
36 $Is{BSD} = ($^O =~ /^(?:free|net|open)bsd$/ or
37 grep( $^O eq $_, qw(bsdos interix dragonfly) )
43 # For things like vmsify()
44 require VMS::Filespec;
45 VMS::Filespec->import;
52 ExtUtils::MM_Unix - methods used by ExtUtils::MakeMaker
56 C<require ExtUtils::MM_Unix;>
60 The methods provided by this package are designed to be used in
61 conjunction with ExtUtils::MakeMaker. When MakeMaker writes a
62 Makefile, it creates one or more objects that inherit their methods
63 from a package C<MM>. MM itself doesn't provide any methods, but it
64 ISA ExtUtils::MM_Unix class. The inheritance tree of MM lets operating
65 specific packages take the responsibility for all the methods provided
66 by MM_Unix. We are trying to reduce the number of the necessary
67 overrides by defining rather primitive operations within
70 If you are going to write a platform specific MM package, please try
71 to limit the necessary overrides to primitive methods, and if it is not
72 possible to do so, let's work out how to achieve that gain.
74 If you are overriding any of these methods in your Makefile.PL (in the
75 MY class), please report that to the makemaker mailing list. We are
76 trying to minimize the necessary method overrides and switch to data
77 driven Makefile.PLs wherever possible. In the long run less methods
78 will be overridable via the MY class.
82 The following description of methods is still under
83 development. Please refer to the code for not suitably documented
84 sections and complain loudly to the makemaker@perl.org mailing list.
85 Better yet, provide a patch.
87 Not all of the methods below are overridable in a
88 Makefile.PL. Overridable methods are marked as (o). All methods are
89 overridable by a platform specific MM_*.pm file.
91 Cross-platform methods are being moved into MM_Any. If you can't find
92 something that used to be in here, look in MM_Any.
96 # So we don't have to keep calling the methods over and over again,
97 # we have these globals to cache the values. Faster and shrtr.
98 my $Curdir = __PACKAGE__->curdir;
99 my $Rootdir = __PACKAGE__->rootdir;
100 my $Updir = __PACKAGE__->updir;
109 Simply says that we're Unix.
120 Defines the suffix rules to compile different flavors of C files to
126 # --- Translation Sections ---
129 return '' unless $self->needs_linking();
132 my $command = '$(CCCMD)';
133 my $flags = '$(CCCDLFLAGS) "-I$(PERL_INC)" $(PASTHRU_DEFINE) $(DEFINE)';
135 if (my $cpp = $Config{cpprun}) {
136 my $cpp_cmd = $self->const_cccmd;
137 $cpp_cmd =~ s/^CCCMD\s*=\s*\$\(CC\)/$cpp/;
140 $cpp_cmd $flags \$*.c > \$*.i
146 $command -S $flags \$*.c
149 $command $flags \$*.c
152 $command $flags \$*.cpp
155 $command $flags \$*.cxx
158 $command $flags \$*.cc
163 $command $flags \$*.C
164 } if !$Is{OS2} and !$Is{Win32} and !$Is{Dos}; #Case-specific
171 Does very much the same as the cflags script in the perl
172 distribution. It doesn't return the whole compiler command line, but
173 initializes all of its parts. The const_cccmd method then actually
174 returns the definition of the CCCMD macro which uses these parts.
181 my($self,$libperl)=@_;
182 return $self->{CFLAGS} if $self->{CFLAGS};
183 return '' unless $self->needs_linking();
185 my($prog, $uc, $perltype, %cflags);
186 $libperl ||= $self->{LIBPERL_A} || "libperl$self->{LIB_EXT}" ;
187 $libperl =~ s/\.\$\(A\)$/$self->{LIB_EXT}/;
189 @cflags{qw(cc ccflags optimize shellflags)}
190 = @Config{qw(cc ccflags optimize shellflags)};
193 $cflags{shellflags} ||= '';
198 DE => '-DDEBUGGING -DEMBED',
199 M => '-DEMBED -DMULTIPLICITY',
200 DM => '-DDEBUGGING -DEMBED -DMULTIPLICITY',
203 if ($libperl =~ /libperl(\w*)\Q$self->{LIB_EXT}/){
206 $uc = ""; # avoid warning
208 $perltype = $map{$uc} ? $map{$uc} : "";
216 ( $name = $self->{NAME} . "_cflags" ) =~ s/:/_/g ;
217 if ($prog = $Config{$name}) {
218 # Expand hints for this extension via the shell
219 print STDOUT "Processing $name hint:\n" if $Verbose;
220 my(@o)=`cc=\"$cflags{cc}\"
221 ccflags=\"$cflags{ccflags}\"
222 optimize=\"$cflags{optimize}\"
223 perltype=\"$cflags{perltype}\"
224 optdebug=\"$cflags{optdebug}\"
227 echo ccflags=\$ccflags
228 echo optimize=\$optimize
229 echo perltype=\$perltype
230 echo optdebug=\$optdebug
232 foreach my $line (@o){
234 if ($line =~ /(.*?)=\s*(.*)\s*$/){
236 print STDOUT " $1 = $2\n" if $Verbose;
238 print STDOUT "Unrecognised result from hint: '$line'\n";
244 $cflags{optimize} = $optdebug;
247 for (qw(ccflags optimize perltype)) {
249 $cflags{$_} =~ s/^\s+//;
250 $cflags{$_} =~ s/\s+/ /g;
251 $cflags{$_} =~ s/\s+$//;
252 $self->{uc $_} ||= $cflags{$_};
255 if ($self->{POLLUTE}) {
256 $self->{CCFLAGS} .= ' -DPERL_POLLUTE ';
260 if ($Config{usemymalloc} and not $Config{bincompat5005}
261 and not $Config{ccflags} =~ /-DPERL_POLLUTE_MALLOC\b/
262 and $self->{PERL_MALLOC_OK}) {
263 $pollute = '$(PERL_MALLOC_DEF)';
266 $self->{CCFLAGS} = quote_paren($self->{CCFLAGS});
267 $self->{OPTIMIZE} = quote_paren($self->{OPTIMIZE});
269 return $self->{CFLAGS} = qq{
270 CCFLAGS = $self->{CCFLAGS}
271 OPTIMIZE = $self->{OPTIMIZE}
272 PERLTYPE = $self->{PERLTYPE}
279 =item const_cccmd (o)
281 Returns the full compiler call for C programs and stores the
282 definition in CONST_CCCMD.
287 my($self,$libperl)=@_;
288 return $self->{CONST_CCCMD} if $self->{CONST_CCCMD};
289 return '' unless $self->needs_linking();
290 return $self->{CONST_CCCMD} =
291 q{CCCMD = $(CC) -c $(PASTHRU_INC) $(INC) \\
292 $(CCFLAGS) $(OPTIMIZE) \\
293 $(PERLTYPE) $(MPOLLUTE) $(DEFINE_VERSION) \\
294 $(XS_DEFINE_VERSION)};
297 =item const_config (o)
299 Defines a couple of constants in the Makefile that are imported from
305 # --- Constants Sections ---
310 # These definitions are from config.sh (via $INC{'Config.pm'}).
311 # They may have been overridden via Makefile.PL or on the command line.
315 foreach my $key (@{$self->{CONFIG}}){
316 # SITE*EXP macros are defined in &constants; avoid duplicates here
317 next if $once_only{$key};
318 $self->{uc $key} = quote_paren($self->{uc $key});
319 push @m, uc($key) , ' = ' , $self->{uc $key}, "\n";
320 $once_only{$key} = 1;
325 =item const_loadlibs (o)
327 Defines EXTRALIBS, LDLOADLIBS, BSLOADLIBS, LD_RUN_PATH. See
328 L<ExtUtils::Liblist> for details.
334 return "" unless $self->needs_linking;
337 # $self->{NAME} might depend on some other libraries:
338 # See ExtUtils::Liblist for details
342 EXTRALIBS LDLOADLIBS BSLOADLIBS
344 next unless defined $self->{$tmp};
345 push @m, "$tmp = $self->{$tmp}\n";
347 # don't set LD_RUN_PATH if empty
351 next unless $self->{$tmp};
352 push @m, "$tmp = $self->{$tmp}\n";
359 my $make_frag = $mm->constants;
361 Prints out macros for lots of constants.
369 $self->{DFSEP} = '$(DIRFILESEP)'; # alias for internal use
373 AR_STATIC_ARGS DIRFILESEP DFSEP
375 VERSION VERSION_MACRO VERSION_SYM DEFINE_VERSION
376 XS_VERSION XS_VERSION_MACRO XS_DEFINE_VERSION
377 INST_ARCHLIB INST_SCRIPT INST_BIN INST_LIB
378 INST_MAN1DIR INST_MAN3DIR
380 INSTALLDIRS INSTALL_BASE DESTDIR PREFIX
381 PERLPREFIX SITEPREFIX VENDORPREFIX
383 (map { ("INSTALL".$_,
385 } $self->installvars),
390 FIRST_MAKEFILE MAKEFILE_OLD MAKE_APERL_FILE
391 PERLMAINCC PERL_SRC PERL_INC
392 PERL FULLPERL ABSPERL
393 PERLRUN FULLPERLRUN ABSPERLRUN
394 PERLRUNINST FULLPERLRUNINST ABSPERLRUNINST
396 PERM_DIR PERM_RW PERM_RWX
400 next unless defined $self->{$macro};
402 # pathnames can have sharp signs in them; escape them so
403 # make doesn't think it is a comment-start character.
404 $self->{$macro} =~ s/#/\\#/g;
405 push @m, "$macro = $self->{$macro}\n";
409 MAKEMAKER = $self->{MAKEMAKER}
410 MM_VERSION = $self->{MM_VERSION}
411 MM_REVISION = $self->{MM_REVISION}
415 # FULLEXT = Pathname for extension directory (eg Foo/Bar/Oracle).
416 # BASEEXT = Basename part of FULLEXT. May be just equal FULLEXT. (eg Oracle)
417 # PARENT_NAME = NAME without BASEEXT and no trailing :: (eg Foo::Bar)
418 # DLBASE = Basename part of dynamic library. May be just equal BASEEXT.
423 FULLEXT BASEEXT PARENT_NAME DLBASE VERSION_FROM INC DEFINE OBJECT
424 LDFROM LINKTYPE BOOTDEP
427 next unless defined $self->{$macro};
428 push @m, "$macro = $self->{$macro}\n";
432 # Handy lists of source code files:
433 XS_FILES = ".$self->wraplist(sort keys %{$self->{XS}})."
434 C_FILES = ".$self->wraplist(@{$self->{C}})."
435 O_FILES = ".$self->wraplist(@{$self->{O_FILES}})."
436 H_FILES = ".$self->wraplist(@{$self->{H}})."
437 MAN1PODS = ".$self->wraplist(sort keys %{$self->{MAN1PODS}})."
438 MAN3PODS = ".$self->wraplist(sort keys %{$self->{MAN3PODS}})."
443 # Where is the Config information that we are using/depend on
444 CONFIGDEP = $(PERL_ARCHLIB)$(DFSEP)Config.pm $(PERL_INC)$(DFSEP)config.h
449 # Where to build things
450 INST_LIBDIR = $self->{INST_LIBDIR}
451 INST_ARCHLIBDIR = $self->{INST_ARCHLIBDIR}
453 INST_AUTODIR = $self->{INST_AUTODIR}
454 INST_ARCHAUTODIR = $self->{INST_ARCHAUTODIR}
456 INST_STATIC = $self->{INST_STATIC}
457 INST_DYNAMIC = $self->{INST_DYNAMIC}
458 INST_BOOT = $self->{INST_BOOT}
464 EXPORT_LIST = $self->{EXPORT_LIST}
465 PERL_ARCHIVE = $self->{PERL_ARCHIVE}
466 PERL_ARCHIVE_AFTER = $self->{PERL_ARCHIVE_AFTER}
471 TO_INST_PM = ".$self->wraplist(sort keys %{$self->{PM}})."
473 PM_TO_BLIB = ".$self->wraplist(%{$self->{PM}})."
482 Same as macro for the depend attribute.
487 my($self,%attribs) = @_;
489 while (($key,$val) = each %attribs){
490 last unless defined $key;
491 push @m, "$key : $val\n";
501 Defines the DESTDIR and DEST* variables paralleling the INSTALL*.
509 $self->{DESTDIR} ||= '';
511 # Make DEST variables.
512 foreach my $var ($self->installvars) {
513 my $destvar = 'DESTINSTALL'.$var;
514 $self->{$destvar} ||= '$(DESTDIR)$(INSTALL'.$var.')';
523 Defines a lot of macros for distribution support.
525 macro description default
527 TAR tar command to use tar
528 TARFLAGS flags to pass to TAR cvf
530 ZIP zip command to use zip
531 ZIPFLAGS flags to pass to ZIP -r
533 COMPRESS compression command to gzip --best
535 SUFFIX suffix to put on .gz
538 SHAR shar command to use shar
540 PREOP extra commands to run before
542 POSTOP extra commands to run after
545 TO_UNIX a command to convert linefeeds
546 to Unix style in your archive
548 CI command to checkin your ci -u
549 sources to version control
550 RCS_LABEL command to label your sources rcs -Nv$(VERSION_SYM): -q
553 DIST_CP $how argument to manicopy() best
554 when the distdir is created
556 DIST_DEFAULT default target to use to tardist
557 create a distribution
559 DISTVNAME name of the resulting archive $(DISTNAME)-$(VERSION)
567 $self->{TAR} ||= 'tar';
568 $self->{TARFLAGS} ||= 'cvf';
569 $self->{ZIP} ||= 'zip';
570 $self->{ZIPFLAGS} ||= '-r';
571 $self->{COMPRESS} ||= 'gzip --best';
572 $self->{SUFFIX} ||= '.gz';
573 $self->{SHAR} ||= 'shar';
574 $self->{PREOP} ||= '$(NOECHO) $(NOOP)'; # eg update MANIFEST
575 $self->{POSTOP} ||= '$(NOECHO) $(NOOP)'; # eg remove the distdir
576 $self->{TO_UNIX} ||= '$(NOECHO) $(NOOP)';
578 $self->{CI} ||= 'ci -u';
579 $self->{RCS_LABEL}||= 'rcs -Nv$(VERSION_SYM): -q';
580 $self->{DIST_CP} ||= 'best';
581 $self->{DIST_DEFAULT} ||= 'tardist';
583 ($self->{DISTNAME} = $self->{NAME}) =~ s{::}{-}g unless $self->{DISTNAME};
584 $self->{DISTVNAME} ||= $self->{DISTNAME}.'-'.$self->{VERSION};
590 my $dist_macros = $mm->dist(%overrides);
592 Generates a make fragment defining all the macros initialized in
595 %overrides can be used to override any of the above.
600 my($self, %attribs) = @_;
604 TAR TARFLAGS ZIP ZIPFLAGS COMPRESS SUFFIX SHAR
606 CI RCS_LABEL DIST_CP DIST_DEFAULT
610 my $value = $attribs{$key} || $self->{$key};
611 $make .= "$key = $value\n";
617 =item dist_basics (o)
619 Defines the targets distclean, distcheck, skipcheck, manifest, veryclean.
626 return <<'MAKE_FRAG';
627 distclean :: realclean distcheck
631 $(PERLRUN) "-MExtUtils::Manifest=fullcheck" -e fullcheck
634 $(PERLRUN) "-MExtUtils::Manifest=skipcheck" -e skipcheck
637 $(PERLRUN) "-MExtUtils::Manifest=mkmanifest" -e mkmanifest
639 veryclean : realclean
640 $(RM_F) *~ */*~ *.orig */*.orig *.bak */*.bak *.old */*.old
648 Defines a check in target for RCS.
656 $(PERLRUN) "-MExtUtils::Manifest=maniread" \\
657 -e "@all = keys %{ maniread() };" \\
658 -e "print(qq{Executing $(CI) @all\n}); system(qq{$(CI) @all});" \\
659 -e "print(qq{Executing $(RCS_LABEL) ...\n}); system(qq{$(RCS_LABEL) @all});"
665 my $dist_make_fragment = $MM->dist_core;
667 Puts the targets necessary for 'make dist' together into one make
676 foreach my $target (qw(dist tardist uutardist tarfile zipdist zipfile
679 my $method = $target.'_target';
681 $make_frag .= $self->$method();
690 my $make_frag = $MM->dist_target;
692 Returns the 'dist' target to make an archive for distribution. This
693 target simply checks to make sure the Makefile is up-to-date and
694 depends on $(DIST_DEFAULT).
701 my $date_check = $self->oneliner(<<'CODE', ['-l']);
702 print 'Warning: Makefile possibly out of date with $(VERSION_FROM)'
703 if -e '$(VERSION_FROM)' and -M '$(VERSION_FROM)' < -M '$(FIRST_MAKEFILE)';
706 return sprintf <<'MAKE_FRAG', $date_check;
707 dist : $(DIST_DEFAULT) $(FIRST_MAKEFILE)
712 =item B<tardist_target>
714 my $make_frag = $MM->tardist_target;
716 Returns the 'tardist' target which is simply so 'make tardist' works.
717 The real work is done by the dynamically named tardistfile_target()
718 method, tardist should have that as a dependency.
725 return <<'MAKE_FRAG';
726 tardist : $(DISTVNAME).tar$(SUFFIX)
731 =item B<zipdist_target>
733 my $make_frag = $MM->zipdist_target;
735 Returns the 'zipdist' target which is simply so 'make zipdist' works.
736 The real work is done by the dynamically named zipdistfile_target()
737 method, zipdist should have that as a dependency.
744 return <<'MAKE_FRAG';
745 zipdist : $(DISTVNAME).zip
750 =item B<tarfile_target>
752 my $make_frag = $MM->tarfile_target;
754 The name of this target is the name of the tarball generated by
755 tardist. This target does the actual work of turning the distdir into
763 return <<'MAKE_FRAG';
764 $(DISTVNAME).tar$(SUFFIX) : distdir
767 $(TAR) $(TARFLAGS) $(DISTVNAME).tar $(DISTVNAME)
768 $(RM_RF) $(DISTVNAME)
769 $(COMPRESS) $(DISTVNAME).tar
776 my $make_frag = $MM->zipfile_target;
778 The name of this target is the name of the zip file generated by
779 zipdist. This target does the actual work of turning the distdir into
787 return <<'MAKE_FRAG';
788 $(DISTVNAME).zip : distdir
790 $(ZIP) $(ZIPFLAGS) $(DISTVNAME).zip $(DISTVNAME)
791 $(RM_RF) $(DISTVNAME)
796 =item uutardist_target
798 my $make_frag = $MM->uutardist_target;
800 Converts the tarfile into a uuencoded file
804 sub uutardist_target {
807 return <<'MAKE_FRAG';
808 uutardist : $(DISTVNAME).tar$(SUFFIX)
809 uuencode $(DISTVNAME).tar$(SUFFIX) $(DISTVNAME).tar$(SUFFIX) > $(DISTVNAME).tar$(SUFFIX)_uu
816 my $make_frag = $MM->shdist_target;
818 Converts the distdir into a shell archive.
825 return <<'MAKE_FRAG';
828 $(SHAR) $(DISTVNAME) > $(DISTVNAME).shar
829 $(RM_RF) $(DISTVNAME)
837 Used by some OS' to define DL_FUNCS and DL_VARS and write the *.exp files.
839 Normally just returns an empty string.
850 Defines targets for bootstrap files.
855 my($self, %attribs) = @_;
858 ' unless $self->has_link_code();
860 my $target = $Is{VMS} ? '$(MMS$TARGET)' : '$@';
862 return sprintf <<'MAKE_FRAG', ($target) x 5;
863 BOOTSTRAP = $(BASEEXT).bs
865 # As Mkbootstrap might not write a file (if none is required)
866 # we use touch to prevent make continually trying to remake it.
867 # The DynaLoader only reads a non-empty file.
868 $(BOOTSTRAP) : $(FIRST_MAKEFILE) $(BOOTDEP) $(INST_ARCHAUTODIR)$(DFSEP).exists
869 $(NOECHO) $(ECHO) "Running Mkbootstrap for $(NAME) ($(BSLOADLIBS))"
870 $(NOECHO) $(PERLRUN) \
871 "-MExtUtils::Mkbootstrap" \
872 -e "Mkbootstrap('$(BASEEXT)','$(BSLOADLIBS)');"
873 $(NOECHO) $(TOUCH) %s
874 $(CHMOD) $(PERM_RW) %s
876 $(INST_BOOT) : $(BOOTSTRAP) $(INST_ARCHAUTODIR)$(DFSEP).exists
877 $(NOECHO) $(RM_RF) %s
878 - $(CP) $(BOOTSTRAP) %s
879 $(CHMOD) $(PERM_RW) %s
883 =item dynamic_lib (o)
885 Defines how to produce the *.so (or equivalent) files.
890 my($self, %attribs) = @_;
891 return '' unless $self->needs_linking(); #might be because of a subdir
893 return '' unless $self->has_link_code;
895 my($otherldflags) = $attribs{OTHERLDFLAGS} || "";
896 my($inst_dynamic_dep) = $attribs{INST_DYNAMIC_DEP} || "";
897 my($armaybe) = $attribs{ARMAYBE} || $self->{ARMAYBE} || ":";
898 my($ldfrom) = '$(LDFROM)';
899 $armaybe = 'ar' if ($Is{OSF} and $armaybe eq ':');
901 my $ld_opt = $Is{OS2} ? '$(OPTIMIZE) ' : ''; # Useful on other systems too?
902 my $ld_fix = $Is{OS2} ? '|| ( $(RM_F) $@ && sh -c false )' : '';
904 # This section creates the dynamically loadable $(INST_DYNAMIC)
905 # from $(OBJECT) and possibly $(MYEXTLIB).
906 ARMAYBE = '.$armaybe.'
907 OTHERLDFLAGS = '.$ld_opt.$otherldflags.'
908 INST_DYNAMIC_DEP = '.$inst_dynamic_dep.'
909 INST_DYNAMIC_FIX = '.$ld_fix.'
911 $(INST_DYNAMIC): $(OBJECT) $(MYEXTLIB) $(BOOTSTRAP) $(INST_ARCHAUTODIR)$(DFSEP).exists $(EXPORT_LIST) $(PERL_ARCHIVE) $(PERL_ARCHIVE_AFTER) $(INST_DYNAMIC_DEP)
913 if ($armaybe ne ':'){
914 $ldfrom = 'tmp$(LIB_EXT)';
915 push(@m,' $(ARMAYBE) cr '.$ldfrom.' $(OBJECT)'."\n");
916 push(@m,' $(RANLIB) '."$ldfrom\n");
918 $ldfrom = "-all $ldfrom -none" if $Is{OSF};
920 # The IRIX linker doesn't use LD_RUN_PATH
921 my $ldrun = $Is{IRIX} && $self->{LD_RUN_PATH} ?
922 qq{-rpath "$self->{LD_RUN_PATH}"} : '';
924 # For example in AIX the shared objects/libraries from previous builds
925 # linger quite a while in the shared dynalinker cache even when nobody
926 # is using them. This is painful if one for instance tries to restart
927 # a failed build because the link command will fail unnecessarily 'cos
928 # the shared object/library is 'busy'.
932 my $libs = '$(LDLOADLIBS)';
934 if (($Is{NetBSD} || $Is{Interix}) && $Config{'useshrplib'} eq 'true') {
935 # Use nothing on static perl platforms, and to the flags needed
936 # to link against the shared libperl library on shared perl
937 # platforms. We peek at lddlflags to see if we need -Wl,-R
938 # or -R to add paths to the run-time library search path.
939 if ($Config{'lddlflags'} =~ /-Wl,-R/) {
940 $libs .= ' -L$(PERL_INC) -Wl,-R$(INSTALLARCHLIB)/CORE -Wl,-R$(PERL_ARCHLIB)/CORE -lperl';
941 } elsif ($Config{'lddlflags'} =~ /-R/) {
942 $libs .= ' -L$(PERL_INC) -R$(INSTALLARCHLIB)/CORE -R$(PERL_ARCHLIB)/CORE -lperl';
946 my $ld_run_path_shell = "";
947 if ($self->{LD_RUN_PATH} ne "") {
948 $ld_run_path_shell = 'LD_RUN_PATH="$(LD_RUN_PATH)" ';
951 push @m, sprintf <<'MAKE', $ld_run_path_shell, $ldrun, $ldfrom, $libs;
952 %s$(LD) %s $(LDDLFLAGS) %s $(OTHERLDFLAGS) -o $@ $(MYEXTLIB) \
953 $(PERL_ARCHIVE) %s $(PERL_ARCHIVE_AFTER) $(EXPORT_LIST) \
958 $(CHMOD) $(PERM_RWX) $@
966 Deprecated method. Use libscan instead.
971 my($self,$path) = @_;
977 Called by init_others, and calls ext ExtUtils::Liblist. See
978 L<ExtUtils::Liblist> for details.
983 my($self,$libs) = @_;
984 require ExtUtils::Liblist;
985 $self->ext($libs, $Verbose);
990 Finds the executables PERL and FULLPERL
995 my($self, $ver, $names, $dirs, $trace) = @_;
998 print "Looking for perl $ver by these names:
1005 my $stderr_duped = 0;
1009 # >& and lexical filehandles together give 5.6.2 indigestion
1010 if( open(STDERR_COPY, '>&STDERR') ) { ## no critic
1015 find_perl() can't dup STDERR: $!
1016 You might see some garbage while we search for Perl
1021 foreach my $name (@$names){
1022 foreach my $dir (@$dirs){
1023 next unless defined $dir; # $self->{PERL_SRC} may be undefined
1025 if ($self->file_name_is_absolute($name)) { # /foo/bar
1027 } elsif ($self->canonpath($name) eq
1028 $self->canonpath(basename($name))) { # foo
1029 $abs = $self->catfile($dir, $name);
1031 $abs = $self->catfile($Curdir, $name);
1033 print "Checking $abs\n" if ($trace >= 2);
1034 next unless $self->maybe_command($abs);
1035 print "Executing $abs\n" if ($trace >= 2);
1037 my $version_check = qq{$abs -le "require $ver; print qq{VER_OK}"};
1038 $version_check = "$Config{run} $version_check"
1039 if defined $Config{run} and length $Config{run};
1041 # To avoid using the unportable 2>&1 to suppress STDERR,
1042 # we close it before running the command.
1043 # However, thanks to a thread library bug in many BSDs
1044 # ( http://www.freebsd.org/cgi/query-pr.cgi?pr=51535 )
1045 # we cannot use the fancier more portable way in here
1046 # but instead need to use the traditional 2>&1 construct.
1048 $val = `$version_check 2>&1`;
1050 close STDERR if $stderr_duped;
1051 $val = `$version_check`;
1053 # 5.6.2's 3-arg open doesn't work with >&
1054 open STDERR, ">&STDERR_COPY" ## no critic
1058 if ($val =~ /^VER_OK/m) {
1059 print "Using PERL=$abs\n" if $trace;
1061 } elsif ($trace >= 2) {
1062 print "Result: '$val' ".($? >> 8)."\n";
1066 print STDOUT "Unable to find a perl $ver (by these names: @$names, in these dirs: @$dirs)\n";
1067 0; # false and not empty
1075 Inserts the sharpbang or equivalent magic number to a set of @files.
1079 sub fixin { # stolen from the pink Camel book, more or less
1080 my ( $self, @files ) = @_;
1082 my ($does_shbang) = $Config{'sharpbang'} =~ /^\s*\#\!/;
1083 for my $file (@files) {
1084 my $file_new = "$file.new";
1085 my $file_bak = "$file.bak";
1087 open( my $fixin, '<', $file ) or croak "Can't process '$file': $!";
1089 chomp( my $line = <$fixin> );
1090 next unless $line =~ s/^\s*\#!\s*//; # Not a shbang file.
1091 # Now figure out the interpreter name.
1092 my ( $cmd, $arg ) = split ' ', $line, 2;
1095 # Now look (in reverse) for interpreter in absolute PATH (unless perl).
1097 if ( $cmd =~ m{^perl(?:\z|[^a-z])} ) {
1098 if ( $Config{startperl} =~ m,^\#!.*/perl, ) {
1099 $interpreter = $Config{startperl};
1100 $interpreter =~ s,^\#!,,;
1103 $interpreter = $Config{perlpath};
1108 = reverse grep { $self->file_name_is_absolute($_) } $self->path;
1111 foreach my $dir (@absdirs) {
1112 if ( $self->maybe_command($cmd) ) {
1113 warn "Ignoring $interpreter in $file\n"
1114 if $Verbose && $interpreter;
1115 $interpreter = $self->catfile( $dir, $cmd );
1120 # Figure out how to invoke interpreter on this machine.
1124 print STDOUT "Changing sharpbang in $file to $interpreter"
1127 # this is probably value-free on DOSISH platforms
1129 $shb .= "$Config{'sharpbang'}$interpreter";
1130 $shb .= ' ' . $arg if defined $arg;
1134 eval 'exec $interpreter $arg -S \$0 \${1+"\$\@"}'
1135 if 0; # not running under some shell
1136 } unless $Is{Win32}; # this won't work on win32, so don't
1139 warn "Can't find $cmd in PATH, $file unchanged"
1144 open( my $fixout, ">", "$file_new" ) or do {
1145 warn "Can't create new $file: $!\n";
1149 # Print out the new #! line (or equivalent).
1152 print $fixout $shb, <$fixin>;
1156 chmod 0666, $file_bak;
1158 unless ( _rename( $file, $file_bak ) ) {
1159 warn "Can't rename $file to $file_bak: $!";
1162 unless ( _rename( $file_new, $file ) ) {
1163 warn "Can't rename $file_new to $file: $!";
1164 unless ( _rename( $file_bak, $file ) ) {
1165 warn "Can't rename $file_bak back to $file either: $!";
1166 warn "Leaving $file renamed as $file_bak\n";
1173 system("$Config{'eunicefix'} $file") if $Config{'eunicefix'} ne ':';
1179 my($old, $new) = @_;
1181 foreach my $file ($old, $new) {
1182 if( $Is{VMS} and basename($file) !~ /\./ ) {
1183 # rename() in 5.8.0 on VMS will not rename a file if it
1184 # does not contain a dot yet it returns success.
1189 return rename($old, $new);
1195 Writes an empty FORCE: target.
1201 '# Phony target to force checking subdirectories.
1209 Guess the name of this package by examining the working directory's
1210 name. MakeMaker calls this only if the developer has not supplied a
1220 my $name = basename(cwd());
1221 $name =~ s|[\-_][\d\.\-]+\z||; # this is new with MM 5.00, we
1222 # strip minus or underline
1223 # followed by a float or some such
1224 print "Warning: Guessing NAME [$name] from current directory name.\n";
1230 Returns true if C, XS, MYEXTLIB or similar objects exist within this
1231 object that need a compiler. Does not descend into subdirectories as
1232 needs_linking() does.
1238 return $self->{HAS_LINK_CODE} if defined $self->{HAS_LINK_CODE};
1239 if ($self->{OBJECT} or @{$self->{C} || []} or $self->{MYEXTLIB}){
1240 $self->{HAS_LINK_CODE} = 1;
1243 return $self->{HAS_LINK_CODE} = 0;
1249 Scans the directory structure and initializes DIR, XS, XS_FILES,
1250 C, C_FILES, O_FILES, H, H_FILES, PL_FILES, EXE_FILES.
1252 Called by init_main.
1256 sub init_dirscan { # --- File and Directory Lists (.xs .pm .pod etc)
1258 my(%dir, %xs, %c, %h, %pl_files, %pm);
1260 my %ignore = map {( $_ => 1 )} qw(Makefile.PL Build.PL test.pl t);
1262 # ignore the distdir
1263 $Is{VMS} ? $ignore{"$self->{DISTVNAME}.dir"} = 1
1264 : $ignore{$self->{DISTVNAME}} = 1;
1266 @ignore{map lc, keys %ignore} = values %ignore if $Is{VMS};
1268 foreach my $name ($self->lsdir($Curdir)){
1269 next if $name =~ /\#/;
1270 next if $name eq $Curdir or $name eq $Updir or $ignore{$name};
1271 next unless $self->libscan($name);
1273 next if -l $name; # We do not support symlinks at all
1274 next if $self->{NORECURS};
1275 $dir{$name} = $name if (-f $self->catfile($name,"Makefile.PL"));
1276 } elsif ($name =~ /\.xs\z/){
1277 my($c); ($c = $name) =~ s/\.xs\z/.c/;
1280 } elsif ($name =~ /\.c(pp|xx|c)?\z/i){ # .c .C .cpp .cxx .cc
1282 unless $name =~ m/perlmain\.c/; # See MAP_TARGET
1283 } elsif ($name =~ /\.h\z/i){
1285 } elsif ($name =~ /\.PL\z/) {
1286 ($pl_files{$name} = $name) =~ s/\.PL\z// ;
1287 } elsif (($Is{VMS} || $Is{Dos}) && $name =~ /[._]pl$/i) {
1288 # case-insensitive filesystem, one dot per name, so foo.h.PL
1289 # under Unix appears as foo.h_pl under VMS or fooh.pl on Dos
1290 local($/); open(my $pl, '<', $name); my $txt = <$pl>; close $pl;
1291 if ($txt =~ /Extracting \S+ \(with variable substitutions/) {
1292 ($pl_files{$name} = $name) =~ s/[._]pl\z//i ;
1295 $pm{$name} = $self->catfile($self->{INST_LIBDIR},$name);
1297 } elsif ($name =~ /\.(p[ml]|pod)\z/){
1298 $pm{$name} = $self->catfile($self->{INST_LIBDIR},$name);
1302 $self->{PL_FILES} ||= \%pl_files;
1303 $self->{DIR} ||= [sort keys %dir];
1304 $self->{XS} ||= \%xs;
1305 $self->{C} ||= [sort keys %c];
1306 $self->{H} ||= [sort keys %h];
1307 $self->{PM} ||= \%pm;
1309 my @o_files = @{$self->{C}};
1310 $self->{O_FILES} = [grep s/\.c(pp|xx|c)?\z/$self->{OBJ_EXT}/i, @o_files];
1316 Determines if man pages should be generated and initializes MAN1PODS
1317 and MAN3PODS as appropriate.
1324 # Set up names of manual pages to generate from pods
1325 foreach my $man (qw(MAN1 MAN3)) {
1326 if ( $self->{"${man}PODS"}
1327 or $self->{"INSTALL${man}DIR"} =~ /^(none|\s*)$/
1329 $self->{"${man}PODS"} ||= {};
1332 my $init_method = "init_${man}PODS";
1333 $self->$init_method();
1340 my($self, $file) = @_;
1343 if (open( my $fh, '<', $file )) {
1345 if (/^=(?:head\d+|item|pod)\b/) {
1352 # If it doesn't exist yet, we assume, it has pods in it
1362 Initializes MAN1PODS from the list of EXE_FILES.
1369 if ( exists $self->{EXE_FILES} ) {
1370 foreach my $name (@{$self->{EXE_FILES}}) {
1371 next unless $self->_has_pod($name);
1373 $self->{MAN1PODS}->{$name} =
1374 $self->catfile("\$(INST_MAN1DIR)",
1375 basename($name).".\$(MAN1EXT)");
1383 Initializes MAN3PODS from the list of PM files.
1390 my %manifypods = (); # we collect the keys first, i.e. the files
1391 # we have to convert to pod
1393 foreach my $name (keys %{$self->{PM}}) {
1394 if ($name =~ /\.pod\z/ ) {
1395 $manifypods{$name} = $self->{PM}{$name};
1396 } elsif ($name =~ /\.p[ml]\z/ ) {
1397 if( $self->_has_pod($name) ) {
1398 $manifypods{$name} = $self->{PM}{$name};
1403 my $parentlibs_re = join '|', @{$self->{PMLIBPARENTDIRS}};
1405 # Remove "Configure.pm" and similar, if it's not the only pod listed
1406 # To force inclusion, just name it "Configure.pod", or override
1408 foreach my $name (keys %manifypods) {
1409 if ($self->{PERL_CORE} and $name =~ /(config|setup).*\.pm/is) {
1410 delete $manifypods{$name};
1413 my($manpagename) = $name;
1414 $manpagename =~ s/\.p(od|m|l)\z//;
1415 # everything below lib is ok
1416 unless($manpagename =~ s!^\W*($parentlibs_re)\W+!!s) {
1417 $manpagename = $self->catfile(
1418 split(/::/,$self->{PARENT_NAME}),$manpagename
1421 $manpagename = $self->replace_manpage_separator($manpagename);
1422 $self->{MAN3PODS}->{$name} =
1423 $self->catfile("\$(INST_MAN3DIR)", "$manpagename.\$(MAN3EXT)");
1430 Initializes PMLIBDIRS and PM from PMLIBDIRS.
1437 # Some larger extensions often wish to install a number of *.pm/pl
1438 # files into the library in various locations.
1440 # The attribute PMLIBDIRS holds an array reference which lists
1441 # subdirectories which we should search for library files to
1442 # install. PMLIBDIRS defaults to [ 'lib', $self->{BASEEXT} ]. We
1443 # recursively search through the named directories (skipping any
1444 # which don't exist or contain Makefile.PL files).
1446 # For each *.pm or *.pl file found $self->libscan() is called with
1447 # the default installation path in $_[1]. The return value of
1448 # libscan defines the actual installation location. The default
1449 # libscan function simply returns the path. The file is skipped
1450 # if libscan returns false.
1452 # The default installation location passed to libscan in $_[1] is:
1454 # ./*.pm => $(INST_LIBDIR)/*.pm
1455 # ./xyz/... => $(INST_LIBDIR)/xyz/...
1456 # ./lib/... => $(INST_LIB)/...
1458 # In this way the 'lib' directory is seen as the root of the actual
1459 # perl library whereas the others are relative to INST_LIBDIR
1460 # (which includes PARENT_NAME). This is a subtle distinction but one
1461 # that's important for nested modules.
1463 unless( $self->{PMLIBDIRS} ) {
1465 # Avoid logical name vs directory collisions
1466 $self->{PMLIBDIRS} = ['./lib', "./$self->{BASEEXT}"];
1469 $self->{PMLIBDIRS} = ['lib', $self->{BASEEXT}];
1473 #only existing directories that aren't in $dir are allowed
1475 # Avoid $_ wherever possible:
1476 # @{$self->{PMLIBDIRS}} = grep -d && !$dir{$_}, @{$self->{PMLIBDIRS}};
1477 my (@pmlibdirs) = @{$self->{PMLIBDIRS}};
1478 @{$self->{PMLIBDIRS}} = ();
1479 my %dir = map { ($_ => $_) } @{$self->{DIR}};
1480 foreach my $pmlibdir (@pmlibdirs) {
1481 -d $pmlibdir && !$dir{$pmlibdir} && push @{$self->{PMLIBDIRS}}, $pmlibdir;
1484 unless( $self->{PMLIBPARENTDIRS} ) {
1485 @{$self->{PMLIBPARENTDIRS}} = ('lib');
1488 return if $self->{PM} and $self->{ARGS}{PM};
1490 if (@{$self->{PMLIBDIRS}}){
1491 print "Searching PMLIBDIRS: @{$self->{PMLIBDIRS}}\n"
1494 File::Find::find(sub {
1496 unless ($self->libscan($_)){
1497 $File::Find::prune = 1;
1502 return if /~$/; # emacs temp files
1503 return if /,v$/; # RCS files
1504 return if m{\.swp$}; # vim swap files
1506 my $path = $File::Find::name;
1507 my $prefix = $self->{INST_LIBDIR};
1510 my $parentlibs_re = join '|', @{$self->{PMLIBPARENTDIRS}};
1511 $prefix = $self->{INST_LIB}
1512 if ($striplibpath = $path) =~ s{^(\W*)($parentlibs_re)\W}
1515 my($inst) = $self->catfile($prefix,$striplibpath);
1516 local($_) = $inst; # for backwards compatibility
1517 $inst = $self->libscan($inst);
1518 print "libscan($path) => '$inst'\n" if ($Verbose >= 2);
1519 return unless $inst;
1520 $self->{PM}{$path} = $inst;
1521 }, @{$self->{PMLIBDIRS}});
1526 =item init_DIRFILESEP
1528 Using / for Unix. Called by init_main.
1532 sub init_DIRFILESEP {
1535 $self->{DIRFILESEP} = '/';
1541 Initializes AR, AR_STATIC_ARGS, BASEEXT, CONFIG, DISTNAME, DLBASE,
1542 EXE_EXT, FULLEXT, FULLPERL, FULLPERLRUN, FULLPERLRUNINST, INST_*,
1543 INSTALL*, INSTALLDIRS, LIB_EXT, LIBPERL_A, MAP_TARGET, NAME,
1544 OBJ_EXT, PARENT_NAME, PERL, PERL_ARCHLIB, PERL_INC, PERL_LIB,
1545 PERL_SRC, PERLRUN, PERLRUNINST, PREFIX, VERSION,
1546 VERSION_SYM, XS_VERSION.
1553 # --- Initialize Module Name and Paths
1555 # NAME = Foo::Bar::Oracle
1556 # FULLEXT = Foo/Bar/Oracle
1558 # PARENT_NAME = Foo::Bar
1560 ### ($self->{FULLEXT} =
1561 ### $self->{NAME}) =~ s!::!/!g ; #eg. BSD/Foo/Socket
1562 $self->{FULLEXT} = $self->catdir(split /::/, $self->{NAME});
1565 # Copied from DynaLoader:
1567 my(@modparts) = split(/::/,$self->{NAME});
1568 my($modfname) = $modparts[-1];
1570 # Some systems have restrictions on files names for DLL's etc.
1571 # mod2fname returns appropriate file base name (typically truncated)
1572 # It may also edit @modparts if required.
1573 if (defined &DynaLoader::mod2fname) {
1574 $modfname = &DynaLoader::mod2fname(\@modparts);
1577 ($self->{PARENT_NAME}, $self->{BASEEXT}) = $self->{NAME} =~ m!(?:([\w:]+)::)?(\w+)\z! ;
1578 $self->{PARENT_NAME} ||= '';
1580 if (defined &DynaLoader::mod2fname) {
1581 # As of 5.001m, dl_os2 appends '_'
1582 $self->{DLBASE} = $modfname;
1584 $self->{DLBASE} = '$(BASEEXT)';
1588 # --- Initialize PERL_LIB, PERL_SRC
1590 # *Real* information: where did we get these two from? ...
1591 my $inc_config_dir = dirname($INC{'Config.pm'});
1592 my $inc_carp_dir = dirname($INC{'Carp.pm'});
1594 unless ($self->{PERL_SRC}){
1595 foreach my $dir_count (1..8) { # 8 is the VMS limit for nesting
1596 my $dir = $self->catdir(($Updir) x $dir_count);
1598 if (-f $self->catfile($dir,"config_h.SH") &&
1599 -f $self->catfile($dir,"perl.h") &&
1600 -f $self->catfile($dir,"lib","strict.pm")
1602 $self->{PERL_SRC}=$dir ;
1608 warn "PERL_CORE is set but I can't find your PERL_SRC!\n" if
1609 $self->{PERL_CORE} and !$self->{PERL_SRC};
1611 if ($self->{PERL_SRC}){
1612 $self->{PERL_LIB} ||= $self->catdir("$self->{PERL_SRC}","lib");
1614 if (defined $Cross::platform) {
1615 $self->{PERL_ARCHLIB} =
1616 $self->catdir("$self->{PERL_SRC}","xlib",$Cross::platform);
1618 $self->catdir("$self->{PERL_SRC}","xlib",$Cross::platform,
1619 $Is{Win32}?("CORE"):());
1622 $self->{PERL_ARCHLIB} = $self->{PERL_LIB};
1623 $self->{PERL_INC} = ($Is{Win32}) ?
1624 $self->catdir($self->{PERL_LIB},"CORE") : $self->{PERL_SRC};
1627 # catch a situation that has occurred a few times in the past:
1629 -s $self->catfile($self->{PERL_SRC},'cflags')
1633 -s $self->catfile($self->{PERL_SRC},'vmsish.h')
1638 You cannot build extensions below the perl source tree after executing
1639 a 'make clean' in the perl source tree.
1641 To rebuild extensions distributed with the perl source you should
1642 simply Configure (to include those extensions) and then build perl as
1643 normal. After installing perl the source tree can be deleted. It is
1644 not needed for building extensions by running 'perl Makefile.PL'
1645 usually without extra arguments.
1647 It is recommended that you unpack and build additional extensions away
1648 from the perl source tree.
1652 # we should also consider $ENV{PERL5LIB} here
1653 my $old = $self->{PERL_LIB} || $self->{PERL_ARCHLIB} || $self->{PERL_INC};
1654 $self->{PERL_LIB} ||= $Config{privlibexp};
1655 $self->{PERL_ARCHLIB} ||= $Config{archlibexp};
1656 $self->{PERL_INC} = $self->catdir("$self->{PERL_ARCHLIB}","CORE"); # wild guess for now
1659 if (not -f ($perl_h = $self->catfile($self->{PERL_INC},"perl.h"))
1661 # Maybe somebody tries to build an extension with an
1662 # uninstalled Perl outside of Perl build tree
1664 for my $dir (@INC) {
1665 $lib = $dir, last if -e $self->catfile($dir, "Config.pm");
1668 # Win32 puts its header files in /perl/src/lib/CORE.
1669 # Unix leaves them in /perl/src.
1670 my $inc = $Is{Win32} ? $self->catdir($lib, "CORE" )
1672 if (-e $self->catfile($inc, "perl.h")) {
1673 $self->{PERL_LIB} = $lib;
1674 $self->{PERL_ARCHLIB} = $lib;
1675 $self->{PERL_INC} = $inc;
1676 $self->{UNINSTALLED_PERL} = 1;
1678 ... Detected uninstalled Perl. Trying to continue.
1685 # We get SITELIBEXP and SITEARCHEXP directly via
1686 # Get_from_Config. When we are running standard modules, these
1687 # won't matter, we will set INSTALLDIRS to "perl". Otherwise we
1688 # set it to "site". I prefer that INSTALLDIRS be set from outside
1690 $self->{INSTALLDIRS} ||= "site";
1692 $self->{MAN1EXT} ||= $Config{man1ext};
1693 $self->{MAN3EXT} ||= $Config{man3ext};
1695 # Get some stuff out of %Config if we haven't yet done so
1696 print STDOUT "CONFIG must be an array ref\n"
1697 if ($self->{CONFIG} and ref $self->{CONFIG} ne 'ARRAY');
1698 $self->{CONFIG} = [] unless (ref $self->{CONFIG});
1699 push(@{$self->{CONFIG}}, @ExtUtils::MakeMaker::Get_from_Config);
1700 push(@{$self->{CONFIG}}, 'shellflags') if $Config{shellflags};
1702 foreach my $m (@{$self->{CONFIG}}){
1703 next if $once_only{$m};
1704 print STDOUT "CONFIG key '$m' does not exist in Config.pm\n"
1705 unless exists $Config{$m};
1706 $self->{uc $m} ||= $Config{$m};
1710 # This is too dangerous:
1711 # if ($^O eq "next") {
1712 # $self->{AR} = "libtool";
1713 # $self->{AR_STATIC_ARGS} = "-o";
1715 # But I leave it as a placeholder
1717 $self->{AR_STATIC_ARGS} ||= "cr";
1719 # These should never be needed
1720 $self->{OBJ_EXT} ||= '.o';
1721 $self->{LIB_EXT} ||= '.a';
1723 $self->{MAP_TARGET} ||= "perl";
1725 $self->{LIBPERL_A} ||= "libperl$self->{LIB_EXT}";
1727 # make a simple check if we find strict
1728 warn "Warning: PERL_LIB ($self->{PERL_LIB}) seems not to be a perl library directory
1729 (strict.pm not found)"
1730 unless -f $self->catfile("$self->{PERL_LIB}","strict.pm") ||
1731 $self->{NAME} eq "ExtUtils::MakeMaker";
1736 Initializes EXTRALIBS, BSLOADLIBS, LDLOADLIBS, LIBS, LD_RUN_PATH, LD,
1737 OBJECT, BOOTDEP, PERLMAINCC, LDFROM, LINKTYPE, SHELL, NOOP,
1738 FIRST_MAKEFILE, MAKEFILE_OLD, NOECHO, RM_F, RM_RF, TEST_F,
1739 TOUCH, CP, MV, CHMOD, UMASK_NULL, ECHO, ECHO_N
1743 sub init_others { # --- Initialize Other Attributes
1746 $self->{ECHO} ||= 'echo';
1747 $self->{ECHO_N} ||= 'echo -n';
1748 $self->{RM_F} ||= "rm -f";
1749 $self->{RM_RF} ||= "rm -rf";
1750 $self->{TOUCH} ||= "touch";
1751 $self->{TEST_F} ||= "test -f";
1752 $self->{CP} ||= "cp";
1753 $self->{MV} ||= "mv";
1754 $self->{CHMOD} ||= "chmod";
1755 $self->{FALSE} ||= 'false';
1756 $self->{TRUE} ||= 'true';
1758 $self->{LD} ||= 'ld';
1760 $self->SUPER::init_others(@_);
1762 # After SUPER::init_others so $Config{shell} has a
1763 # chance to get set.
1764 $self->{SHELL} ||= '/bin/sh';
1772 Unix has no need of special linker flags.
1778 $self->{PERL_ARCHIVE} ||= '';
1779 $self->{PERL_ARCHIVE_AFTER} ||= '';
1780 $self->{EXPORT_LIST} ||= '';
1797 # The user who requests an installation directory explicitly
1798 # should not have to tell us an architecture installation directory
1799 # as well. We look if a directory exists that is named after the
1800 # architecture. If not we take it as a sign that it should be the
1801 # same as the requested installation directory. Otherwise we take
1803 for my $libpair ({l=>"privlib", a=>"archlib"},
1804 {l=>"sitelib", a=>"sitearch"},
1805 {l=>"vendorlib", a=>"vendorarch"},
1808 my $lib = "install$libpair->{l}";
1810 my $Arch = uc "install$libpair->{a}";
1811 if( $self->{$Lib} && ! $self->{$Arch} ){
1812 my($ilib) = $Config{$lib};
1814 $self->prefixify($Arch,$ilib,$self->{$Lib});
1816 unless (-d $self->{$Arch}) {
1817 print STDOUT "Directory $self->{$Arch} not found\n"
1819 $self->{$Arch} = $self->{$Lib};
1821 print STDOUT "Defaulting $Arch to $self->{$Arch}\n" if $Verbose;
1831 Called by init_main. Sets up ABSPERL, PERL, FULLPERL and all the
1832 *PERLRUN* permutations.
1834 PERL is allowed to be miniperl
1835 FULLPERL must be a complete perl
1837 ABSPERL is PERL converted to an absolute path
1839 *PERLRUN contains everything necessary to run perl, find it's
1842 *PERLRUNINST is *PERLRUN + everything necessary to find the
1843 modules being built.
1851 foreach my $component ($self->{PERL_SRC}, $self->path(),
1854 push @defpath, $component if defined $component;
1857 # Build up a set of file names (not command names).
1858 my $thisperl = $self->canonpath($^X);
1859 $thisperl .= $Config{exe_ext} unless
1860 # VMS might have a file version # at the end
1861 $Is{VMS} ? $thisperl =~ m/$Config{exe_ext}(;\d+)?$/i
1862 : $thisperl =~ m/$Config{exe_ext}$/i;
1864 # We need a relative path to perl when in the core.
1865 $thisperl = $self->abs2rel($thisperl) if $self->{PERL_CORE};
1867 my @perls = ($thisperl);
1868 push @perls, map { "$_$Config{exe_ext}" }
1869 ('perl', 'perl5', "perl$Config{version}");
1871 # miniperl has priority over all but the cannonical perl when in the
1872 # core. Otherwise its a last resort.
1873 my $miniperl = "miniperl$Config{exe_ext}";
1874 if( $self->{PERL_CORE} ) {
1875 splice @perls, 1, 0, $miniperl;
1878 push @perls, $miniperl;
1882 $self->find_perl(5.0, \@perls, \@defpath, $Verbose );
1883 # don't check if perl is executable, maybe they have decided to
1884 # supply switches with perl
1886 # When built for debugging, VMS doesn't create perl.exe but ndbgperl.exe.
1887 my $perl_name = 'perl';
1888 $perl_name = 'ndbgperl' if $Is{VMS} &&
1889 defined $Config{usevmsdebug} && $Config{usevmsdebug} eq 'define';
1891 # XXX This logic is flawed. If "miniperl" is anywhere in the path
1892 # it will get confused. It should be fixed to work only on the filename.
1893 # Define 'FULLPERL' to be a non-miniperl (used in test: target)
1894 ($self->{FULLPERL} = $self->{PERL}) =~ s/miniperl/$perl_name/i
1895 unless $self->{FULLPERL};
1897 # Little hack to get around VMS's find_perl putting "MCR" in front
1899 $self->{ABSPERL} = $self->{PERL};
1900 my $has_mcr = $self->{ABSPERL} =~ s/^MCR\s*//;
1901 if( $self->file_name_is_absolute($self->{ABSPERL}) ) {
1902 $self->{ABSPERL} = '$(PERL)';
1905 $self->{ABSPERL} = $self->rel2abs($self->{ABSPERL});
1907 # Quote the perl command if it contains whitespace
1908 $self->{ABSPERL} = $self->quote_literal($self->{ABSPERL})
1909 if $self->{ABSPERL} =~ /\s/;
1911 $self->{ABSPERL} = 'MCR '.$self->{ABSPERL} if $has_mcr;
1914 # Are we building the core?
1915 $self->{PERL_CORE} = $ENV{PERL_CORE} unless exists $self->{PERL_CORE};
1916 $self->{PERL_CORE} = 0 unless defined $self->{PERL_CORE};
1918 # How do we run perl?
1919 foreach my $perl (qw(PERL FULLPERL ABSPERL)) {
1920 my $run = $perl.'RUN';
1922 $self->{$run} = "\$($perl)";
1924 # Make sure perl can find itself before it's installed.
1925 $self->{$run} .= q{ "-I$(PERL_LIB)" "-I$(PERL_ARCHLIB)"}
1926 if $self->{UNINSTALLED_PERL} || $self->{PERL_CORE};
1928 $self->{$perl.'RUNINST'} =
1929 sprintf q{$(%sRUN) "-I$(INST_ARCHLIB)" "-I$(INST_LIB)"}, $perl;
1938 =item platform_constants
1940 Add MM_Unix_VERSION.
1947 $self->{MM_Unix_VERSION} = $VERSION;
1948 $self->{PERL_MALLOC_DEF} = '-DPERL_EXTMALLOC_DEF -Dmalloc=Perl_malloc '.
1949 '-Dfree=Perl_mfree -Drealloc=Perl_realloc '.
1950 '-Dcalloc=Perl_calloc';
1954 sub platform_constants {
1958 foreach my $macro (qw(MM_Unix_VERSION PERL_MALLOC_DEF))
1960 next unless defined $self->{$macro};
1961 $make_frag .= "$macro = $self->{$macro}\n";
1972 Called by init_main. Initializes PERL_*
1979 $self->{PERM_DIR} = 755 unless defined $self->{PERM_DIR};
1980 $self->{PERM_RW} = 644 unless defined $self->{PERM_RW};
1981 $self->{PERM_RWX} = 755 unless defined $self->{PERM_RWX};
1991 Sets up macros having to do with XS code. Currently just INST_STATIC,
1992 INST_DYNAMIC and INST_BOOT.
1999 if ($self->has_link_code()) {
2000 $self->{INST_STATIC} =
2001 $self->catfile('$(INST_ARCHAUTODIR)', '$(BASEEXT)$(LIB_EXT)');
2002 $self->{INST_DYNAMIC} =
2003 $self->catfile('$(INST_ARCHAUTODIR)', '$(DLBASE).$(DLEXT)');
2004 $self->{INST_BOOT} =
2005 $self->catfile('$(INST_ARCHAUTODIR)', '$(BASEEXT).bs');
2007 $self->{INST_STATIC} = '';
2008 $self->{INST_DYNAMIC} = '';
2009 $self->{INST_BOOT} = '';
2015 Defines the install target.
2020 my($self, %attribs) = @_;
2024 install :: pure_install doc_install
2027 install_perl :: pure_perl_install doc_perl_install
2030 install_site :: pure_site_install doc_site_install
2033 install_vendor :: pure_vendor_install doc_vendor_install
2036 pure_install :: pure_$(INSTALLDIRS)_install
2039 doc_install :: doc_$(INSTALLDIRS)_install
2042 pure__install : pure_site_install
2043 $(NOECHO) $(ECHO) INSTALLDIRS not defined, defaulting to INSTALLDIRS=site
2045 doc__install : doc_site_install
2046 $(NOECHO) $(ECHO) INSTALLDIRS not defined, defaulting to INSTALLDIRS=site
2048 pure_perl_install :: all
2049 $(NOECHO) $(MOD_INSTALL) \
2050 read }.$self->catfile('$(PERL_ARCHLIB)','auto','$(FULLEXT)','.packlist').q{ \
2051 write }.$self->catfile('$(DESTINSTALLARCHLIB)','auto','$(FULLEXT)','.packlist').q{ \
2052 $(INST_LIB) $(DESTINSTALLPRIVLIB) \
2053 $(INST_ARCHLIB) $(DESTINSTALLARCHLIB) \
2054 $(INST_BIN) $(DESTINSTALLBIN) \
2055 $(INST_SCRIPT) $(DESTINSTALLSCRIPT) \
2056 $(INST_MAN1DIR) $(DESTINSTALLMAN1DIR) \
2057 $(INST_MAN3DIR) $(DESTINSTALLMAN3DIR)
2058 $(NOECHO) $(WARN_IF_OLD_PACKLIST) \
2059 }.$self->catdir('$(SITEARCHEXP)','auto','$(FULLEXT)').q{
2062 pure_site_install :: all
2063 $(NOECHO) $(MOD_INSTALL) \
2064 read }.$self->catfile('$(SITEARCHEXP)','auto','$(FULLEXT)','.packlist').q{ \
2065 write }.$self->catfile('$(DESTINSTALLSITEARCH)','auto','$(FULLEXT)','.packlist').q{ \
2066 $(INST_LIB) $(DESTINSTALLSITELIB) \
2067 $(INST_ARCHLIB) $(DESTINSTALLSITEARCH) \
2068 $(INST_BIN) $(DESTINSTALLSITEBIN) \
2069 $(INST_SCRIPT) $(DESTINSTALLSITESCRIPT) \
2070 $(INST_MAN1DIR) $(DESTINSTALLSITEMAN1DIR) \
2071 $(INST_MAN3DIR) $(DESTINSTALLSITEMAN3DIR)
2072 $(NOECHO) $(WARN_IF_OLD_PACKLIST) \
2073 }.$self->catdir('$(PERL_ARCHLIB)','auto','$(FULLEXT)').q{
2075 pure_vendor_install :: all
2076 $(NOECHO) $(MOD_INSTALL) \
2077 read }.$self->catfile('$(VENDORARCHEXP)','auto','$(FULLEXT)','.packlist').q{ \
2078 write }.$self->catfile('$(DESTINSTALLVENDORARCH)','auto','$(FULLEXT)','.packlist').q{ \
2079 $(INST_LIB) $(DESTINSTALLVENDORLIB) \
2080 $(INST_ARCHLIB) $(DESTINSTALLVENDORARCH) \
2081 $(INST_BIN) $(DESTINSTALLVENDORBIN) \
2082 $(INST_SCRIPT) $(DESTINSTALLVENDORSCRIPT) \
2083 $(INST_MAN1DIR) $(DESTINSTALLVENDORMAN1DIR) \
2084 $(INST_MAN3DIR) $(DESTINSTALLVENDORMAN3DIR)
2086 doc_perl_install :: all
2087 $(NOECHO) $(ECHO) Appending installation info to $(DESTINSTALLARCHLIB)/perllocal.pod
2088 -$(NOECHO) $(MKPATH) $(DESTINSTALLARCHLIB)
2089 -$(NOECHO) $(DOC_INSTALL) \
2090 "Module" "$(NAME)" \
2091 "installed into" "$(INSTALLPRIVLIB)" \
2092 LINKTYPE "$(LINKTYPE)" \
2093 VERSION "$(VERSION)" \
2094 EXE_FILES "$(EXE_FILES)" \
2095 >> }.$self->catfile('$(DESTINSTALLARCHLIB)','perllocal.pod').q{
2097 doc_site_install :: all
2098 $(NOECHO) $(ECHO) Appending installation info to $(DESTINSTALLARCHLIB)/perllocal.pod
2099 -$(NOECHO) $(MKPATH) $(DESTINSTALLARCHLIB)
2100 -$(NOECHO) $(DOC_INSTALL) \
2101 "Module" "$(NAME)" \
2102 "installed into" "$(INSTALLSITELIB)" \
2103 LINKTYPE "$(LINKTYPE)" \
2104 VERSION "$(VERSION)" \
2105 EXE_FILES "$(EXE_FILES)" \
2106 >> }.$self->catfile('$(DESTINSTALLARCHLIB)','perllocal.pod').q{
2108 doc_vendor_install :: all
2109 $(NOECHO) $(ECHO) Appending installation info to $(DESTINSTALLARCHLIB)/perllocal.pod
2110 -$(NOECHO) $(MKPATH) $(DESTINSTALLARCHLIB)
2111 -$(NOECHO) $(DOC_INSTALL) \
2112 "Module" "$(NAME)" \
2113 "installed into" "$(INSTALLVENDORLIB)" \
2114 LINKTYPE "$(LINKTYPE)" \
2115 VERSION "$(VERSION)" \
2116 EXE_FILES "$(EXE_FILES)" \
2117 >> }.$self->catfile('$(DESTINSTALLARCHLIB)','perllocal.pod').q{
2122 uninstall :: uninstall_from_$(INSTALLDIRS)dirs
2125 uninstall_from_perldirs ::
2126 $(NOECHO) $(UNINSTALL) }.$self->catfile('$(PERL_ARCHLIB)','auto','$(FULLEXT)','.packlist').q{
2128 uninstall_from_sitedirs ::
2129 $(NOECHO) $(UNINSTALL) }.$self->catfile('$(SITEARCHEXP)','auto','$(FULLEXT)','.packlist').q{
2131 uninstall_from_vendordirs ::
2132 $(NOECHO) $(UNINSTALL) }.$self->catfile('$(VENDORARCHEXP)','auto','$(FULLEXT)','.packlist').q{
2138 =item installbin (o)
2140 Defines targets to make and to install EXE_FILES.
2147 return "" unless $self->{EXE_FILES} && ref $self->{EXE_FILES} eq "ARRAY";
2148 my @exefiles = @{$self->{EXE_FILES}};
2149 return "" unless @exefiles;
2151 @exefiles = map vmsify($_), @exefiles if $Is{VMS};
2154 for my $from (@exefiles) {
2155 my($path)= $self->catfile('$(INST_SCRIPT)', basename($from));
2157 local($_) = $path; # for backwards compatibility
2158 my $to = $self->libscan($path);
2159 print "libscan($from) => '$to'\n" if ($Verbose >=2);
2161 $to = vmsify($to) if $Is{VMS};
2162 $fromto{$from} = $to;
2164 my @to = values %fromto;
2168 EXE_FILES = @exefiles
2176 # realclean can get rather large.
2177 push @m, map "\t$_\n", $self->split_command('$(RM_F)', @to);
2181 # A target for each exe file.
2182 while (my($from,$to) = each %fromto) {
2183 last unless defined $from;
2185 push @m, sprintf <<'MAKE', $to, $from, $to, $from, $to, $to, $to;
2186 %s : %s $(FIRST_MAKEFILE) $(INST_SCRIPT)$(DFSEP).exists $(INST_BIN)$(DFSEP).exists
2187 $(NOECHO) $(RM_F) %s
2190 -$(NOECHO) $(CHMOD) $(PERM_RWX) %s
2202 Defines the linkext target which in turn defines the LINKTYPE.
2207 my($self, %attribs) = @_;
2208 # LINKTYPE => static or dynamic or ''
2209 my($linktype) = defined $attribs{LINKTYPE} ?
2210 $attribs{LINKTYPE} : '$(LINKTYPE)';
2212 linkext :: $linktype
2219 Takes as arguments a directory name and a regular expression. Returns
2220 all entries in the directory that match the regular expression.
2226 my($dir, $regex) = @_;
2228 my $dh = new DirHandle;
2229 $dh->open($dir || ".") or return ();
2232 @ls = grep(/$regex/, @ls) if $regex;
2238 Simple subroutine to insert the macros defined by the macro attribute
2244 my($self,%attribs) = @_;
2246 while (($key,$val) = each %attribs){
2247 last unless defined $key;
2248 push @m, "$key = $val\n";
2255 Called by staticmake. Defines how to write the Makefile to produce a
2258 By default the Makefile produced includes all the static extensions in
2259 the perl library. (Purified versions of library files, e.g.,
2260 DynaLoader_pure_p1_c0_032.a are automatically ignored to avoid link errors.)
2265 my($self, %attribs) = @_;
2266 my($makefilename, $searchdirs, $static, $extra, $perlinc, $target, $tmp, $libperl) =
2267 @attribs{qw(MAKE DIRS STAT EXTRA INCL TARGET TMP LIBPERL)};
2270 # --- MakeMaker makeaperl section ---
2271 MAP_TARGET = $target
2272 FULLPERL = $self->{FULLPERL}
2274 return join '', @m if $self->{PARENT};
2276 my($dir) = join ":", @{$self->{DIR}};
2278 unless ($self->{MAKEAPERL}) {
2280 $(MAP_TARGET) :: static $(MAKE_APERL_FILE)
2281 $(MAKE) $(USEMAKEFILE) $(MAKE_APERL_FILE) $@
2283 $(MAKE_APERL_FILE) : $(FIRST_MAKEFILE) pm_to_blib
2284 $(NOECHO) $(ECHO) Writing \"$(MAKE_APERL_FILE)\" for this $(MAP_TARGET)
2285 $(NOECHO) $(PERLRUNINST) \
2286 Makefile.PL DIR=}, $dir, q{ \
2287 MAKEFILE=$(MAKE_APERL_FILE) LINKTYPE=static \
2288 MAKEAPERL=1 NORECURS=1 CCCDLFLAGS=};
2294 push @m, " \\\n\t\t$_";
2296 # push @m, map( " \\\n\t\t$_", @ARGV );
2304 my($cccmd, $linkcmd, $lperl);
2307 $cccmd = $self->const_cccmd($libperl);
2308 $cccmd =~ s/^CCCMD\s*=\s*//;
2309 $cccmd =~ s/\$\(INC\)/ "-I$self->{PERL_INC}" /;
2310 $cccmd .= " $Config{cccdlflags}"
2311 if ($Config{useshrplib} eq 'true');
2312 $cccmd =~ s/\(CC\)/\(PERLMAINCC\)/;
2314 # The front matter of the linkcommand...
2315 $linkcmd = join ' ', "\$(CC)",
2316 grep($_, @Config{qw(ldflags ccdlflags)});
2317 $linkcmd =~ s/\s+/ /g;
2318 $linkcmd =~ s,(perl\.exp),\$(PERL_INC)/$1,;
2320 # Which *.a files could we make use of...
2323 File::Find::find(sub {
2324 return unless m/\Q$self->{LIB_EXT}\E$/;
2326 # Skip perl's libraries.
2327 return if m/^libperl/ or m/^perl\Q$self->{LIB_EXT}\E$/;
2329 # Skip purified versions of libraries
2330 # (e.g., DynaLoader_pure_p1_c0_032.a)
2331 return if m/_pure_\w+_\w+_\w+\.\w+$/ and -f "$File::Find::dir/.pure";
2333 if( exists $self->{INCLUDE_EXT} ){
2336 (my $xx = $File::Find::name) =~ s,.*?/auto/,,s;
2340 # Throw away anything not explicitly marked for inclusion.
2341 # DynaLoader is implied.
2342 foreach my $incl ((@{$self->{INCLUDE_EXT}},'DynaLoader')){
2348 return unless $found;
2350 elsif( exists $self->{EXCLUDE_EXT} ){
2351 (my $xx = $File::Find::name) =~ s,.*?/auto/,,s;
2355 # Throw away anything explicitly marked for exclusion
2356 foreach my $excl (@{$self->{EXCLUDE_EXT}}){
2357 return if( $xx eq $excl );
2361 # don't include the installed version of this extension. I
2362 # leave this line here, although it is not necessary anymore:
2363 # I patched minimod.PL instead, so that Miniperl.pm won't
2364 # enclude duplicates
2366 # Once the patch to minimod.PL is in the distribution, I can
2368 return if $File::Find::name =~ m:auto/$self->{FULLEXT}/$self->{BASEEXT}$self->{LIB_EXT}\z:;
2370 $static{cwd() . "/" . $_}++;
2371 }, grep( -d $_, @{$searchdirs || []}) );
2373 # We trust that what has been handed in as argument, will be buildable
2374 $static = [] unless $static;
2375 @static{@{$static}} = (1) x @{$static};
2377 $extra = [] unless $extra && ref $extra eq 'ARRAY';
2378 for (sort keys %static) {
2379 next unless /\Q$self->{LIB_EXT}\E\z/;
2380 $_ = dirname($_) . "/extralibs.ld";
2384 s/^(.*)/"-I$1"/ for @{$perlinc || []};
2389 # MAP_STATIC doesn't look into subdirs yet. Once "all" is made and we
2390 # regenerate the Makefiles, MAP_STATIC and the dependencies for
2391 # extralibs.all are computed correctly
2393 MAP_LINKCMD = $linkcmd
2394 MAP_PERLINC = @{$perlinc || []}
2396 join(" \\\n\t", reverse sort keys %static), "
2398 MAP_PRELIBS = $Config{perllibs} $Config{cryptlib}
2401 if (defined $libperl) {
2402 ($lperl = $libperl) =~ s/\$\(A\)/$self->{LIB_EXT}/;
2404 unless ($libperl && -f $lperl) { # Ilya's code...
2405 my $dir = $self->{PERL_SRC} || "$self->{PERL_ARCHLIB}/CORE";
2406 $dir = "$self->{PERL_ARCHLIB}/.." if $self->{UNINSTALLED_PERL};
2407 $libperl ||= "libperl$self->{LIB_EXT}";
2408 $libperl = "$dir/$libperl";
2409 $lperl ||= "libperl$self->{LIB_EXT}";
2410 $lperl = "$dir/$lperl";
2412 if (! -f $libperl and ! -f $lperl) {
2413 # We did not find a static libperl. Maybe there is a shared one?
2415 $lperl = $libperl = "$dir/$Config{libperl}";
2416 # SUNOS ld does not take the full path to a shared library
2417 $libperl = '' if $Is{SunOS4};
2421 print STDOUT "Warning: $libperl not found
2422 If you're going to build a static perl binary, make sure perl is installed
2423 otherwise ignore this warning\n"
2424 unless (-f $lperl || defined($self->{PERL_SRC}));
2427 # SUNOS ld does not take the full path to a shared library
2428 my $llibperl = $libperl ? '$(MAP_LIBPERL)' : '-lperl';
2431 MAP_LIBPERL = $libperl
2432 LLIBPERL = $llibperl
2436 $(INST_ARCHAUTODIR)/extralibs.all : $(INST_ARCHAUTODIR)$(DFSEP).exists '.join(" \\\n\t", @$extra).'
2437 $(NOECHO) $(RM_F) $@
2438 $(NOECHO) $(TOUCH) $@
2441 foreach my $catfile (@$extra){
2442 push @m, "\tcat $catfile >> \$\@\n";
2446 \$(MAP_TARGET) :: $tmp/perlmain\$(OBJ_EXT) \$(MAP_LIBPERL) \$(MAP_STATIC) \$(INST_ARCHAUTODIR)/extralibs.all
2447 \$(MAP_LINKCMD) -o \$\@ \$(OPTIMIZE) $tmp/perlmain\$(OBJ_EXT) \$(LDFROM) \$(MAP_STATIC) \$(LLIBPERL) `cat \$(INST_ARCHAUTODIR)/extralibs.all` \$(MAP_PRELIBS)
2448 \$(NOECHO) \$(ECHO) 'To install the new \"\$(MAP_TARGET)\" binary, call'
2449 \$(NOECHO) \$(ECHO) ' \$(MAKE) \$(USEMAKEFILE) $makefilename inst_perl MAP_TARGET=\$(MAP_TARGET)'
2450 \$(NOECHO) \$(ECHO) 'To remove the intermediate files say'
2451 \$(NOECHO) \$(ECHO) ' \$(MAKE) \$(USEMAKEFILE) $makefilename map_clean'
2453 $tmp/perlmain\$(OBJ_EXT): $tmp/perlmain.c
2455 push @m, "\t".$self->cd($tmp, qq[$cccmd "-I\$(PERL_INC)" perlmain.c])."\n";
2458 $tmp/perlmain.c: $makefilename}, q{
2459 $(NOECHO) $(ECHO) Writing $@
2460 $(NOECHO) $(PERL) $(MAP_PERLINC) "-MExtUtils::Miniperl" \\
2461 -e "writemain(grep s#.*/auto/##s, split(q| |, q|$(MAP_STATIC)|))" > $@t && $(MV) $@t $@
2464 push @m, "\t", q{$(NOECHO) $(PERL) $(INSTALLSCRIPT)/fixpmain
2465 } if (defined (&Dos::UseLFN) && Dos::UseLFN()==0);
2470 $(NOECHO) $(ECHO) Appending installation info to $(DESTINSTALLARCHLIB)/perllocal.pod
2471 -$(NOECHO) $(MKPATH) $(DESTINSTALLARCHLIB)
2472 -$(NOECHO) $(DOC_INSTALL) \
2473 "Perl binary" "$(MAP_TARGET)" \
2474 MAP_STATIC "$(MAP_STATIC)" \
2475 MAP_EXTRA "`cat $(INST_ARCHAUTODIR)/extralibs.all`" \
2476 MAP_LIBPERL "$(MAP_LIBPERL)" \
2477 >> }.$self->catfile('$(DESTINSTALLARCHLIB)','perllocal.pod').q{
2482 inst_perl : pure_inst_perl doc_inst_perl
2484 pure_inst_perl : $(MAP_TARGET)
2485 }.$self->{CP}.q{ $(MAP_TARGET) }.$self->catfile('$(DESTINSTALLBIN)','$(MAP_TARGET)').q{
2490 }.$self->{RM_F}.qq{ $tmp/perlmain\$(OBJ_EXT) $tmp/perlmain.c \$(MAP_TARGET) $makefilename \$(INST_ARCHAUTODIR)/extralibs.all
2498 Defines how to rewrite the Makefile.
2505 # We do not know what target was originally specified so we
2506 # must force a manual rerun to be sure. But as it should only
2507 # happen very rarely it is not a significant problem.
2509 $(OBJECT) : $(FIRST_MAKEFILE)
2511 ' if $self->{OBJECT};
2513 my $newer_than_target = $Is{VMS} ? '$(MMS$SOURCE_LIST)' : '$?';
2514 my $mpl_args = join " ", map qq["$_"], @ARGV;
2516 $m .= sprintf <<'MAKE_FRAG', $newer_than_target, $mpl_args;
2517 # We take a very conservative approach here, but it's worth it.
2518 # We move Makefile to Makefile.old here to avoid gnu make looping.
2519 $(FIRST_MAKEFILE) : Makefile.PL $(CONFIGDEP)
2520 $(NOECHO) $(ECHO) "Makefile out-of-date with respect to %s"
2521 $(NOECHO) $(ECHO) "Cleaning current config before rebuilding Makefile..."
2522 -$(NOECHO) $(RM_F) $(MAKEFILE_OLD)
2523 -$(NOECHO) $(MV) $(FIRST_MAKEFILE) $(MAKEFILE_OLD)
2524 - $(MAKE) $(USEMAKEFILE) $(MAKEFILE_OLD) clean $(DEV_NULL)
2525 $(PERLRUN) Makefile.PL %s
2526 $(NOECHO) $(ECHO) "==> Your Makefile has been rebuilt. <=="
2527 $(NOECHO) $(ECHO) "==> Please rerun the $(MAKE) command. <=="
2538 Returns true, if the argument is likely to be a command.
2543 my($self,$file) = @_;
2544 return $file if -x $file && ! -d $file;
2549 =item needs_linking (o)
2551 Does this module need linking? Looks into subdirectory objects (see
2552 also has_link_code())
2559 my $caller = (caller(0))[3];
2560 confess("needs_linking called too early") if
2561 $caller =~ /^ExtUtils::MakeMaker::/;
2562 return $self->{NEEDS_LINKING} if defined $self->{NEEDS_LINKING};
2563 if ($self->has_link_code or $self->{MAKEAPERL}){
2564 $self->{NEEDS_LINKING} = 1;
2567 foreach my $child (keys %{$self->{CHILDREN}}) {
2568 if ($self->{CHILDREN}->{$child}->needs_linking) {
2569 $self->{NEEDS_LINKING} = 1;
2573 return $self->{NEEDS_LINKING} = 0;
2577 =item parse_abstract
2579 parse a file and return what you think is the ABSTRACT
2583 sub parse_abstract {
2584 my($self,$parsefile) = @_;
2588 open(my $fh, '<', $parsefile) or die "Could not open '$parsefile': $!";
2590 my $package = $self->{DISTNAME};
2591 $package =~ s/-/::/g;
2593 $inpod = /^=(?!cut)/ ? 1 : /^=cut/ ? 0 : $inpod;
2596 next unless /^($package(?:\.pm)?\s+\-+\s+)(.*)/;
2607 my $version = MM->parse_version($file);
2609 Parse a $file and return what $VERSION is set to by the first assignment.
2610 It will return the string "undef" if it can't figure out what $VERSION
2611 is. $VERSION should be for all to see, so C<our $VERSION> or plain $VERSION
2612 are okay, but C<my $VERSION> is not.
2614 C<<package Foo VERSION>> is also checked for. The first version
2615 declaration found is used, but this may change as it differs from how
2618 parse_version() will try to C<use version> before checking for
2619 C<$VERSION> so the following will work.
2621 $VERSION = qv(1.2.3);
2626 my($self,$parsefile) = @_;
2631 open(my $fh, '<', $parsefile) or die "Could not open '$parsefile': $!";
2634 $inpod = /^=(?!cut)/ ? 1 : /^=cut/ ? 0 : $inpod;
2635 next if $inpod || /^\s*#/;
2637 next if /^\s*(if|unless)/;
2638 if ( m{^ \s* package \s+ \w[\w\:\']* \s+ (v?[0-9._]+) \s* ; }x ) {
2642 elsif ( m{(?<!\\) ([\$*]) (([\w\:\']*) \bVERSION)\b .* =}x ) {
2644 package ExtUtils::MakeMaker::_version;
2647 # Ensure any version() routine which might have leaked
2648 # into this package has been deleted. Interferes with
2663 $result = eval($eval); ## no critic
2664 warn "Could not eval '$eval' in $parsefile: $@" if $@;
2669 last if defined $result;
2673 $result = "undef" unless defined $result;
2680 Defines the string that is passed to recursive make calls in
2690 my($sep) = $Is{VMS} ? ',' : '';
2693 foreach my $key (qw(LIB LIBPERL_A LINKTYPE OPTIMIZE
2694 PREFIX INSTALL_BASE)
2697 next unless defined $self->{$key};
2698 push @pasthru, "$key=\"\$($key)\"";
2701 foreach my $key (qw(DEFINE INC)) {
2702 next unless defined $self->{$key};
2703 push @pasthru, "PASTHRU_$key=\"\$(PASTHRU_$key)\"";
2706 push @m, "\nPASTHRU = ", join ($sep, @pasthru), "\n";
2712 Takes one argument, a file name, and returns the file name, if the
2713 argument is likely to be a perl script. On MM_Unix this is true for
2714 any ordinary, readable file.
2719 my($self,$file) = @_;
2720 return $file if -r $file && -f _;
2724 =item perldepend (o)
2726 Defines the dependency from all *.h files that come with the perl
2735 my $make_config = $self->cd('$(PERL_SRC)', '$(MAKE) lib/Config.pm');
2737 push @m, sprintf <<'MAKE_FRAG', $make_config if $self->{PERL_SRC};
2738 # Check for unpropogated config.sh changes. Should never happen.
2739 # We do NOT just update config.h because that is not sufficient.
2740 # An out of date config.h is not fatal but complains loudly!
2741 $(PERL_INC)/config.h: $(PERL_SRC)/config.sh
2742 -$(NOECHO) $(ECHO) "Warning: $(PERL_INC)/config.h out of date with $(PERL_SRC)/config.sh"; $(FALSE)
2744 $(PERL_ARCHLIB)/Config.pm: $(PERL_SRC)/config.sh
2745 $(NOECHO) $(ECHO) "Warning: $(PERL_ARCHLIB)/Config.pm may be out of date with $(PERL_SRC)/config.sh"
2749 return join "", @m unless $self->needs_linking;
2753 $(PERL_INC)/EXTERN.h \
2754 $(PERL_INC)/INTERN.h \
2755 $(PERL_INC)/XSUB.h \
2757 $(PERL_INC)/cc_runtime.h \
2758 $(PERL_INC)/config.h \
2761 $(PERL_INC)/dosish.h \
2762 $(PERL_INC)/embed.h \
2763 $(PERL_INC)/embedvar.h \
2764 $(PERL_INC)/fakethr.h \
2765 $(PERL_INC)/form.h \
2767 $(PERL_INC)/handy.h \
2769 $(PERL_INC)/intrpvar.h \
2770 $(PERL_INC)/iperlsys.h \
2771 $(PERL_INC)/keywords.h \
2773 $(PERL_INC)/nostdio.h \
2775 $(PERL_INC)/opcode.h \
2776 $(PERL_INC)/patchlevel.h \
2777 $(PERL_INC)/perl.h \
2778 $(PERL_INC)/perlio.h \
2779 $(PERL_INC)/perlsdio.h \
2780 $(PERL_INC)/perlsfio.h \
2781 $(PERL_INC)/perlvars.h \
2782 $(PERL_INC)/perly.h \
2784 $(PERL_INC)/pp_proto.h \
2785 $(PERL_INC)/proto.h \
2786 $(PERL_INC)/regcomp.h \
2787 $(PERL_INC)/regexp.h \
2788 $(PERL_INC)/regnodes.h \
2789 $(PERL_INC)/scope.h \
2791 $(PERL_INC)/thread.h \
2792 $(PERL_INC)/unixish.h \
2795 $(OBJECT) : $(PERL_HDRS)
2796 } if $self->{OBJECT};
2798 push @m, join(" ", values %{$self->{XS}})." : \$(XSUBPPDEPS)\n" if %{$self->{XS}};
2806 Defines target that copies all files in the hash PM to their
2807 destination and autosplits them. See L<ExtUtils::Install/DESCRIPTION>
2813 my($autodir) = $self->catdir('$(INST_LIB)','auto');
2815 pm_to_blib : $(FIRST_MAKEFILE) $(TO_INST_PM)
2818 # VMS will swallow '' and PM_FILTER is often empty. So use q[]
2819 my $pm_to_blib = $self->oneliner(<<CODE, ['-MExtUtils::Install']);
2820 pm_to_blib({\@ARGV}, '$autodir', q[\$(PM_FILTER)], '\$(PERM_DIR)')
2823 my @cmds = $self->split_command($pm_to_blib, %{$self->{PM}});
2825 $r .= join '', map { "\t\$(NOECHO) $_\n" } @cmds;
2826 $r .= qq{\t\$(NOECHO) \$(TOUCH) pm_to_blib\n};
2831 =item post_constants (o)
2833 Returns an empty string per default. Dedicated to overrides from
2834 within Makefile.PL after all constants have been defined.
2842 =item post_initialize (o)
2844 Returns an empty string per default. Used in Makefile.PLs to add some
2845 chunk of text to the Makefile after the object is initialized.
2849 sub post_initialize {
2855 Returns an empty string. Can be used in Makefile.PLs to write some
2856 text to the Makefile at the end.
2864 # transform dot-separated version string into comma-separated quadruple
2865 # examples: '1.2.3.4.5' => '1,2,3,4'
2866 # '1.2.3' => '1,2,3,0'
2868 my ($self, $string) = @_;
2869 return join ',', ((split /\./, $string), (0) x 4)[0..3];
2874 Defines target that creates a PPD (Perl Package Description) file
2875 for a binary distribution.
2882 my $abstract = $self->{ABSTRACT} || '';
2883 $abstract =~ s/\n/\\n/sg;
2884 $abstract =~ s/</</g;
2885 $abstract =~ s/>/>/g;
2887 my $author = $self->{AUTHOR} || '';
2888 $author =~ s/</</g;
2889 $author =~ s/>/>/g;
2891 my $ppd_xml = sprintf <<'PPD_HTML', $self->{VERSION}, $abstract, $author;
2892 <SOFTPKG NAME="$(DISTNAME)" VERSION="%s">
2893 <ABSTRACT>%s</ABSTRACT>
2897 $ppd_xml .= " <IMPLEMENTATION>\n";
2898 if ( $self->{MIN_PERL_VERSION} ) {
2899 my $min_perl_version = $self->_ppd_version($self->{MIN_PERL_VERSION});
2900 $ppd_xml .= sprintf <<'PPD_PERLVERS', $min_perl_version;
2901 <PERLCORE VERSION="%s" />
2906 # Don't add "perl" to requires. perl dependencies are
2907 # handles by ARCHITECTURE.
2908 my %prereqs = %{$self->{PREREQ_PM}};
2909 delete $prereqs{perl};
2912 foreach my $prereq (sort keys %prereqs) {
2914 $name .= '::' unless $name =~ /::/;
2915 my $version = $prereqs{$prereq}+0; # force numification
2917 my %attrs = ( NAME => $name );
2918 $attrs{VERSION} = $version if $version;
2919 my $attrs = join " ", map { qq[$_="$attrs{$_}"] } keys %attrs;
2920 $ppd_xml .= qq( <REQUIRE $attrs />\n);
2923 my $archname = $Config{archname};
2925 # archname did not change from 5.6 to 5.8, but those versions may
2926 # not be not binary compatible so now we append the part of the
2927 # version that changes when binary compatibility may change
2928 $archname .= "-$Config{PERL_REVISION}.$Config{PERL_VERSION}";
2930 $ppd_xml .= sprintf <<'PPD_OUT', $archname;
2931 <ARCHITECTURE NAME="%s" />
2934 if ($self->{PPM_INSTALL_SCRIPT}) {
2935 if ($self->{PPM_INSTALL_EXEC}) {
2936 $ppd_xml .= sprintf qq{ <INSTALL EXEC="%s">%s</INSTALL>\n},
2937 $self->{PPM_INSTALL_EXEC}, $self->{PPM_INSTALL_SCRIPT};
2940 $ppd_xml .= sprintf qq{ <INSTALL>%s</INSTALL>\n},
2941 $self->{PPM_INSTALL_SCRIPT};
2945 my ($bin_location) = $self->{BINARY_LOCATION} || '';
2946 $bin_location =~ s/\\/\\\\/g;
2948 $ppd_xml .= sprintf <<'PPD_XML', $bin_location;
2949 <CODEBASE HREF="%s" />
2954 my @ppd_cmds = $self->echo($ppd_xml, '$(DISTNAME).ppd');
2956 return sprintf <<'PPD_OUT', join "\n\t", @ppd_cmds;
2957 # Creates a PPD (Perl Package Description) for a binary distribution.
2966 $MM->prefixify($var, $prefix, $new_prefix, $default);
2968 Using either $MM->{uc $var} || $Config{lc $var}, it will attempt to
2969 replace it's $prefix with a $new_prefix.
2971 Should the $prefix fail to match I<AND> a PREFIX was given as an
2972 argument to WriteMakefile() it will set it to the $new_prefix +
2973 $default. This is for systems whose file layouts don't neatly fit into
2974 our ideas of prefixes.
2976 This is for heuristics which attempt to create directory structures
2977 that mirror those of the installed perl.
2981 $MM->prefixify('installman1dir', '/usr', '/home/foo', 'man/man1');
2983 this will attempt to remove '/usr' from the front of the
2984 $MM->{INSTALLMAN1DIR} path (initializing it to $Config{installman1dir}
2985 if necessary) and replace it with '/home/foo'. If this fails it will
2986 simply use '/home/foo/man/man1'.
2991 my($self,$var,$sprefix,$rprefix,$default) = @_;
2993 my $path = $self->{uc $var} ||
2994 $Config_Override{lc $var} || $Config{lc $var} || '';
2996 $rprefix .= '/' if $sprefix =~ m|/$|;
2998 print STDERR " prefixify $var => $path\n" if $Verbose >= 2;
2999 print STDERR " from $sprefix to $rprefix\n" if $Verbose >= 2;
3001 if( $self->{ARGS}{PREFIX} &&
3002 $path !~ s{^\Q$sprefix\E\b}{$rprefix}s )
3005 print STDERR " cannot prefix, using default.\n" if $Verbose >= 2;
3006 print STDERR " no default!\n" if !$default && $Verbose >= 2;
3008 $path = $self->catdir($rprefix, $default) if $default;
3011 print " now $path\n" if $Verbose >= 2;
3012 return $self->{uc $var} = $path;
3018 Defines targets to run *.PL files.
3024 my $pl_files = $self->{PL_FILES};
3026 return "" unless $pl_files;
3029 foreach my $plfile (sort keys %$pl_files) {
3030 my $list = ref($pl_files->{$plfile})
3031 ? $pl_files->{$plfile}
3032 : [$pl_files->{$plfile}];
3034 foreach my $target (@$list) {
3036 $plfile = vmsify($self->eliminate_macros($plfile));
3037 $target = vmsify($self->eliminate_macros($target));
3040 # Normally a .PL file runs AFTER pm_to_blib so it can have
3041 # blib in its @INC and load the just built modules. BUT if
3042 # the generated module is something in $(TO_INST_PM) which
3043 # pm_to_blib depends on then it can't depend on pm_to_blib
3044 # else we have a dependency loop.
3047 if( defined $self->{PM}{$target} ) {
3049 $perlrun = 'PERLRUN';
3052 $pm_dep = 'pm_to_blib';
3053 $perlrun = 'PERLRUNINST';
3061 $target :: $plfile $pm_dep
3062 \$($perlrun) $plfile $target
3073 Backslashes parentheses C<()> in command line arguments.
3074 Doesn't handle recursive Makefile C<$(...)> constructs,
3075 but handles simple ones.
3081 $arg =~ s{\$\((.+?)\)}{\$\\\\($1\\\\)}g; # protect $(...)
3082 $arg =~ s{(?<!\\)([()])}{\\$1}g; # quote unprotected
3083 $arg =~ s{\$\\\\\((.+?)\\\\\)}{\$($1)}g; # unprotect $(...)
3087 =item replace_manpage_separator
3089 my $man_name = $MM->replace_manpage_separator($file_path);
3091 Takes the name of a package, which may be a nested package, in the
3092 form 'Foo/Bar.pm' and replaces the slash with C<::> or something else
3093 safe for a man page file name. Returns the replacement.
3097 sub replace_manpage_separator {
3098 my($self,$man) = @_;
3110 my($self, $dir, @cmds) = @_;
3112 # No leading tab and no trailing newline makes for easier embedding
3113 my $make_frag = join "\n\t", map { "cd $dir && $_" } @cmds;
3123 my($self, $cmd, $switches) = @_;
3124 $switches = [] unless defined $switches;
3126 # Strip leading and trailing newlines
3130 my @cmds = split /\n/, $cmd;
3131 $cmd = join " \n\t -e ", map $self->quote_literal($_), @cmds;
3132 $cmd = $self->escape_newlines($cmd);
3134 $switches = join ' ', @$switches;
3136 return qq{\$(ABSPERLRUN) $switches -e $cmd --};
3145 my($self, $text) = @_;
3147 # I think all we have to quote is single quotes and I think
3148 # this is a safe way to do it.
3149 $text =~ s{'}{'\\''}g;
3155 =item escape_newlines
3159 sub escape_newlines {
3160 my($self, $text) = @_;
3162 $text =~ s{\n}{\\\n}g;
3170 Using POSIX::ARG_MAX. Otherwise falling back to 4096.
3177 if (!defined $self->{_MAX_EXEC_LEN}) {
3178 if (my $arg_max = eval { require POSIX; &POSIX::ARG_MAX }) {
3179 $self->{_MAX_EXEC_LEN} = $arg_max;
3181 else { # POSIX minimum exec size
3182 $self->{_MAX_EXEC_LEN} = 4096;
3186 return $self->{_MAX_EXEC_LEN};
3192 Defines the static target.
3197 # --- Static Loading Sections ---
3201 ## $(INST_PM) has been moved to the all: target.
3202 ## It remains here for awhile to allow for old usage: "make static"
3203 static :: $(FIRST_MAKEFILE) $(INST_STATIC)
3208 =item static_lib (o)
3210 Defines how to produce the *.a (or equivalent) files.
3216 return '' unless $self->has_link_code;
3221 $(INST_STATIC) : $(OBJECT) $(MYEXTLIB) $(INST_ARCHAUTODIR)$(DFSEP).exists
3225 # If this extension has its own library (eg SDBM_File)
3226 # then copy that to $(INST_STATIC) and add $(OBJECT) into it.
3227 push(@m, <<'MAKE_FRAG') if $self->{MYEXTLIB};
3228 $(CP) $(MYEXTLIB) $@
3232 if (exists $self->{FULL_AR} && -x $self->{FULL_AR}) {
3233 # Prefer the absolute pathed ar if available so that PATH
3234 # doesn't confuse us. Perl itself is built with the full_ar.
3239 push @m, sprintf <<'MAKE_FRAG', $ar;
3240 $(%s) $(AR_STATIC_ARGS) $@ $(OBJECT) && $(RANLIB) $@
3241 $(CHMOD) $(PERM_RWX) $@
3242 $(NOECHO) $(ECHO) "$(EXTRALIBS)" > $(INST_ARCHAUTODIR)/extralibs.ld
3245 # Old mechanism - still available:
3246 push @m, <<'MAKE_FRAG' if $self->{PERL_SRC} && $self->{EXTRALIBS};
3247 $(NOECHO) $(ECHO) "$(EXTRALIBS)" >> $(PERL_SRC)/ext.libs
3253 =item staticmake (o)
3260 my($self, %attribs) = @_;
3263 my(@searchdirs)=($self->{PERL_ARCHLIB}, $self->{SITEARCHEXP}, $self->{INST_ARCHLIB});
3265 # And as it's not yet built, we add the current extension
3266 # but only if it has some C code (or XS code, which implies C code)
3267 if (@{$self->{C}}) {
3268 @static = $self->catfile($self->{INST_ARCHLIB},
3271 "$self->{BASEEXT}$self->{LIB_EXT}"
3275 # Either we determine now, which libraries we will produce in the
3276 # subdirectories or we do it at runtime of the make.
3278 # We could ask all subdir objects, but I cannot imagine, why it
3279 # would be necessary.
3281 # Instead we determine all libraries for the new perl at
3283 my(@perlinc) = ($self->{INST_ARCHLIB}, $self->{INST_LIB}, $self->{PERL_ARCHLIB}, $self->{PERL_LIB});
3285 $self->makeaperl(MAKE => $self->{MAKEFILE},
3286 DIRS => \@searchdirs,
3289 TARGET => $self->{MAP_TARGET},
3291 LIBPERL => $self->{LIBPERL_A}
3297 Helper subroutine for subdirs
3302 my($self, $subdir) = @_;
3304 my $subdir_cmd = $self->cd($subdir,
3305 '$(MAKE) $(USEMAKEFILE) $(FIRST_MAKEFILE) all $(PASTHRU)'
3307 return sprintf <<'EOT', $subdir_cmd;
3317 Defines targets to process subdirectories.
3322 # --- Sub-directory Sections ---
3325 # This method provides a mechanism to automatically deal with
3326 # subdirectories containing further Makefile.PL scripts.
3327 # It calls the subdir_x() method for each subdirectory.
3328 foreach my $dir (@{$self->{DIR}}){
3329 push(@m, $self->subdir_x($dir));
3330 #### print "Including $dir subdirectory\n";
3334 # The default clean, realclean and test targets in this Makefile
3335 # have automatically been given entries for each subdir.
3339 push(@m, "\n# none")
3346 Defines the test targets.
3351 # --- Test and Installation Sections ---
3353 my($self, %attribs) = @_;
3354 my $tests = $attribs{TESTS} || '';
3355 if (!$tests && -d 't') {
3356 $tests = $self->find_tests;
3358 # note: 'test.pl' name is also hardcoded in init_dirscan()
3362 TEST_TYPE=test_\$(LINKTYPE)
3367 testdb :: testdb_\$(LINKTYPE)
3369 test :: \$(TEST_TYPE) subdirs-test
3376 foreach my $dir (@{ $self->{DIR} }) {
3377 my $test = $self->cd($dir, '$(MAKE) test $(PASTHRU)');
3386 push(@m, "\t\$(NOECHO) \$(ECHO) 'No tests defined for \$(NAME) extension.'\n")
3387 unless $tests or -f "test.pl" or @{$self->{DIR}};
3390 push(@m, "test_dynamic :: pure_all\n");
3391 push(@m, $self->test_via_harness('$(FULLPERLRUN)', '$(TEST_FILES)'))
3393 push(@m, $self->test_via_script('$(FULLPERLRUN)', '$(TEST_FILE)'))
3397 push(@m, "testdb_dynamic :: pure_all\n");
3398 push(@m, $self->test_via_script('$(FULLPERLRUN) $(TESTDB_SW)',
3402 # Occasionally we may face this degenerate target:
3403 push @m, "test_ : test_dynamic\n\n";
3405 if ($self->needs_linking()) {
3406 push(@m, "test_static :: pure_all \$(MAP_TARGET)\n");
3407 push(@m, $self->test_via_harness('./$(MAP_TARGET)', '$(TEST_FILES)')) if $tests;
3408 push(@m, $self->test_via_script('./$(MAP_TARGET)', '$(TEST_FILE)')) if -f "test.pl";
3410 push(@m, "testdb_static :: pure_all \$(MAP_TARGET)\n");
3411 push(@m, $self->test_via_script('./$(MAP_TARGET) $(TESTDB_SW)', '$(TEST_FILE)'));
3414 push @m, "test_static :: test_dynamic\n";
3415 push @m, "testdb_static :: testdb_dynamic\n";
3420 =item test_via_harness (override)
3422 For some reason which I forget, Unix machines like to have
3423 PERL_DL_NONLAZY set for tests.
3427 sub test_via_harness {
3428 my($self, $perl, $tests) = @_;
3429 return $self->SUPER::test_via_harness("PERL_DL_NONLAZY=1 $perl", $tests);
3432 =item test_via_script (override)
3434 Again, the PERL_DL_NONLAZY thing.
3438 sub test_via_script {
3439 my($self, $perl, $script) = @_;
3440 return $self->SUPER::test_via_script("PERL_DL_NONLAZY=1 $perl", $script);
3444 =item tool_xsubpp (o)
3446 Determines typemaps, xsubpp version, prototype behaviour.
3452 return "" unless $self->needs_linking;
3455 my @xsubpp_dirs = @INC;
3457 # Make sure we pick up the new xsubpp if we're building perl.
3458 unshift @xsubpp_dirs, $self->{PERL_LIB} if $self->{PERL_CORE};
3460 foreach my $dir (@xsubpp_dirs) {
3461 $xsdir = $self->catdir($dir, 'ExtUtils');
3462 if( -r $self->catfile($xsdir, "xsubpp") ) {
3467 my $tmdir = File::Spec->catdir($self->{PERL_LIB},"ExtUtils");
3468 my(@tmdeps) = $self->catfile($tmdir,'typemap');
3469 if( $self->{TYPEMAPS} ){
3470 foreach my $typemap (@{$self->{TYPEMAPS}}){
3471 if( ! -f $typemap ) {
3472 warn "Typemap $typemap not found.\n";
3475 push(@tmdeps, $typemap);
3479 push(@tmdeps, "typemap") if -f "typemap";
3480 my(@tmargs) = map("-typemap $_", @tmdeps);
3481 if( exists $self->{XSOPT} ){
3482 unshift( @tmargs, $self->{XSOPT} );
3486 $Config{'ldflags'} &&
3487 $Config{'ldflags'} =~ m!/Debug!i &&
3488 (!exists($self->{XSOPT}) || $self->{XSOPT} !~ /linenumbers/)
3491 unshift(@tmargs,'-nolinenumbers');
3495 $self->{XSPROTOARG} = "" unless defined $self->{XSPROTOARG};
3499 XSUBPP = \$(XSUBPPDIR)\$(DFSEP)xsubpp
3500 XSUBPPRUN = \$(PERLRUN) \$(XSUBPP)
3501 XSPROTOARG = $self->{XSPROTOARG}
3502 XSUBPPDEPS = @tmdeps \$(XSUBPP)
3503 XSUBPPARGS = @tmargs
3511 Build man pages, too
3518 return <<'MAKE_EXT';
3519 all :: pure_all manifypods
3524 =item top_targets (o)
3526 Defines the targets all, subdirs, config, and O_FILES
3531 # --- Target Sections ---
3536 push @m, $self->all_target, "\n" unless $self->{SKIPHASH}{'all'};
3539 pure_all :: config pm_to_blib subdirs linkext
3542 subdirs :: $(MYEXTLIB)
3545 config :: $(FIRST_MAKEFILE) blibdirs
3550 $(O_FILES): $(H_FILES)
3551 ' if @{$self->{O_FILES} || []} && @{$self->{H} || []};
3555 perldoc ExtUtils::MakeMaker
3563 Obsolete, deprecated method. Not used since Version 5.21.
3568 # --- perllocal.pod section ---
3569 my($self,$what,$name,@attribs)=@_;
3570 my $time = localtime;
3571 print "=head2 $time: $what C<$name>\n\n=over 4\n\n=item *\n\n";
3572 print join "\n\n=item *\n\n", map("C<$_>",@attribs);
3573 print "\n\n=back\n\n";
3578 Defines the suffix rules to compile XS files to C.
3584 return '' unless $self->needs_linking();
3587 $(XSUBPPRUN) $(XSPROTOARG) $(XSUBPPARGS) $(XSUBPP_EXTRA_ARGS) $*.xs > $*.xsc && $(MV) $*.xsc $*.c
3593 Defines the suffix rules to compile XS files to C++.
3599 return '' unless $self->needs_linking();
3602 $(XSUBPPRUN) $(XSPROTOARG) $(XSUBPPARGS) $*.xs > $*.xsc && $(MV) $*.xsc $*.cpp
3608 Defines suffix rules to go from XS to object files directly. This is
3609 only intended for broken make implementations.
3613 sub xs_o { # many makes are too dumb to use xs_c then c_o
3615 return '' unless $self->needs_linking();
3618 $(XSUBPPRUN) $(XSPROTOARG) $(XSUBPPARGS) $*.xs > $*.xsc && $(MV) $*.xsc $*.c
3619 $(CCCMD) $(CCCDLFLAGS) "-I$(PERL_INC)" $(PASTHRU_DEFINE) $(DEFINE) $*.c
3630 L<ExtUtils::MakeMaker>