*** /Library/Perl/ExtUtils/MM_Unix.pm	Wed Aug 21 18:19:49 2002
--- ExtUtils/MM_Unix.pm	Thu Oct 31 15:23:22 2002
***************
*** 6,12 ****
  
  use Exporter ();
  use Carp;
! use Config;
  use File::Basename qw(basename dirname fileparse);
  use File::Spec;
  use DirHandle;
--- 6,12 ----
  
  use Exporter ();
  use Carp;
! use Config         qw(%Config);
  use File::Basename qw(basename dirname fileparse);
  use File::Spec;
  use DirHandle;
***************
*** 2711,2716 ****
--- 2711,2717 ----
      join "", @m;
  }
  
+ 
  =item manifypods (o)
  
  Defines targets and routines to translate the pods into manpages and
***************
*** 2719,2768 ****
  =cut
  
  sub manifypods {
!     my($self, %attribs) = @_;
!     return "\nmanifypods : pure_all\n\t$self->{NOECHO}\$(NOOP)\n" unless
! 	%{$self->{MAN3PODS}} or %{$self->{MAN1PODS}};
!     my($dist);
!     my($pod2man_exe);
      if (defined $self->{PERL_SRC}) {
  	$pod2man_exe = File::Spec->catfile($self->{PERL_SRC},'pod','pod2man');
      } else {
  	$pod2man_exe = File::Spec->catfile($Config{scriptdirexp},'pod2man');
      }
      unless ($pod2man_exe = $self->perl_script($pod2man_exe)) {
!       # Maybe a build by uninstalled Perl?
!       $pod2man_exe = File::Spec->catfile($self->{PERL_INC}, "pod", "pod2man");
      }
      unless ($pod2man_exe = $self->perl_script($pod2man_exe)) {
  	# No pod2man but some MAN3PODS to be installed
! 	print <<END;
  
  Warning: I could not locate your pod2man program. Please make sure,
           your pod2man program is in your PATH before you execute 'make'
  
! END
!         $pod2man_exe = "-S pod2man";
      }
!     my(@m);
!     push @m,
! qq[POD2MAN_EXE = $pod2man_exe\n],
! qq[POD2MAN = \$(PERL) -we '%m=\@ARGV;for (keys %m){' \\\n],
! q[-e 'next if -e $$m{$$_} && -M $$m{$$_} < -M $$_ && -M $$m{$$_} < -M "],
!  $self->{MAKEFILE}, q[";' \\
! -e 'print "Manifying $$m{$$_}\n";' \\
! -e 'system(q[$(PERLRUN) $(POD2MAN_EXE) ].qq[$$_>$$m{$$_}])==0 or warn "Couldn\\047t install $$m{$$_}\n";' \\
! -e 'chmod(oct($(PERM_RW)), $$m{$$_}) or warn "chmod $(PERM_RW) $$m{$$_}: $$!\n";}'
! ];
!     push @m, "\nmanifypods : pure_all ";
!     push @m, join " \\\n\t", keys %{$self->{MAN1PODS}}, keys %{$self->{MAN3PODS}};
! 
!     push(@m,"\n");
!     if (%{$self->{MAN1PODS}} || %{$self->{MAN3PODS}}) {
! 	push @m, "\t$self->{NOECHO}\$(POD2MAN) \\\n\t";
! 	push @m, join " \\\n\t", %{$self->{MAN1PODS}}, %{$self->{MAN3PODS}};
!     }
!     join('', @m);
  }
  
  =item maybe_command
  
--- 2720,2844 ----
  =cut
  
  sub manifypods {
!     my $self    = shift;
!     my $targets = '';
! 
!     warn "  +  using spurkis' manifypods!\n";
! 
!     return "\nmanifypods : pure_all\n\t$self->{NOECHO}\$(NOOP)\n"
!       unless ( %{$self->{MAN3PODS}} or %{$self->{MAN1PODS}} );
! 
!     $targets .= $self->manifypods_target;
! 
!     return $targets;
! }
! 
! 
! #
! # This returns a make target that enables you to do a "make manifypods"
! # to convert documents containing POD to man pages.
! #
! sub manifypods_target {
!     my $self          = shift;
!     my $pod2man_files = '';
!     my $dependencies  = '';
! 
!     # populate pod2man_files & dependencies:
!     foreach my $name (keys %{$self->{MAN1PODS}}) {
! 	$pod2man_files .= " \\\n\t  $name \\\n\t    $self->{MAN1PODS}->{$name}";
! 	$dependencies  .= " \\\n\t$name";
!     }
! 
!     foreach my $name (keys %{$self->{MAN3PODS}}) {
! 	$pod2man_files .= " \\\n\t  $name \\\n\t    $self->{MAN3PODS}->{$name}";
! 	$dependencies  .= " \\\n\t$name"
!     }
! 
!     # generate target:
!     my $pod2man  = $self->MY::pod2man();
!     my $target   = <<END_OF_TARGET;
! 
! # --- Begin manifypods section:
! $pod2man
! 
! manifypods : pure_all $dependencies
! 	$self->{NOECHO}\$(POD2MAN) $pod2man_files
! 
! # --- End of manifypods section --- #
! 
! END_OF_TARGET
! }
! 
! 
! #
! # This returns a pod-to-man make variable that contains a perl script
! # that is used as such:
! #
! #    $(POD2MAN) <infile> <outfile> [ <infile> <outfile> ... ]
! #
! # (originally from manifypods() )
! #
! sub pod2man {
!     my $self        = shift;
!     my $pod2man_exe = $self->MY::find_pod2man_exe;
! 
!     my $make_vars   = <<END_OF_VAR1;
! POD2MAN_EXE = $pod2man_exe
! END_OF_VAR1
! 
!     $make_vars     .= <<'END_OF_PROGRAM';
! POD2MAN     = $(PERL) -we 'my %files = @ARGV;                           \
! foreach my $$infile (keys %files) {                                     \
!     my $$outfile = $$files{$$infile};                                   \
!     next if ((-e $$outfile) &&                                          \
! 	     (-M $$outfile < -M $$infile) &&                            \
! 	     (-M $$outfile < -M "Makefile"));                           \
!     print "Podifying $$outfile\n";                                      \
!     system("$(PERLRUN) $(POD2MAN_EXE) " . "$$infile > $$outfile") == 0  \
! 	or warn "Could not install $$outfile\n";                        \
!     chmod(oct($(PERM_RW)), $$outfile)                                   \
! 	or warn "chmod $(PERM_RW) $$outfile: $$!\n";                    \
! }'
! END_OF_PROGRAM
! 
!     return $make_vars;
! }
! 
! 
! #
! # Finds and returns the pod2man binary.
! # (originally from manifypods() )
! #
! sub find_pod2man_exe {
!     my $self = shift;
!     my $pod2man_exe;
! 
      if (defined $self->{PERL_SRC}) {
  	$pod2man_exe = File::Spec->catfile($self->{PERL_SRC},'pod','pod2man');
      } else {
  	$pod2man_exe = File::Spec->catfile($Config{scriptdirexp},'pod2man');
      }
+ 
      unless ($pod2man_exe = $self->perl_script($pod2man_exe)) {
! 	# Maybe a build by uninstalled Perl?
! 	$pod2man_exe = File::Spec->catfile($self->{PERL_INC}, "pod", "pod2man");
      }
+ 
      unless ($pod2man_exe = $self->perl_script($pod2man_exe)) {
  	# No pod2man but some MAN3PODS to be installed
!         $pod2man_exe = "-S pod2man";
! 	print <<END_OF_MESSAGE;
  
  Warning: I could not locate your pod2man program. Please make sure,
           your pod2man program is in your PATH before you execute 'make'
  
! END_OF_MESSAGE
      }
! 
!     return $pod2man_exe;
  }
+ 
+ 
  
  =item maybe_command
  
