1use ExtUtils::MakeMaker;
2# See lib/ExtUtils/MakeMaker.pm for details of how to influence
3# the contents of the Makefile that is written.
4
5    # That's the minimum.
6use 5.00503;
7
8    # If we're not 5.6.0, there's some corrections we need to make: Use
9    # 'use vars' instead of 'our' variables, get rid of 'use warnings'
10    # and other stuff. The eg/5005it.pl script takes care of it.
11if($] < 5.006) {
12    require "eg/5005it.pl";
13
14    print <<EOT;
15########################################################
16# Hm, you're still using perl 5.005. Although I don't  #
17# condone that, I'll let it slip this time:            #
18# Changing distribution to be backwards compatible ... #
19EOT
20    mk5005("t", "lib");
21    print <<EOT;
22# Done. But do me a favour and upgrade soon.           #
23########################################################
24EOT
25}
26
27# Check for Time::HiRes;
28eval { require Time::HiRes; };
29if($@) {
30    print "Warning: Time::HiRes not installed, but that's ok, " .
31          "%r will use full seconds\n";
32}
33
34WriteMakefile(
35    'NAME'		=> 'Log::Log4perl',
36    'VERSION_FROM'	=> 'lib/Log/Log4perl.pm', # finds $VERSION
37    'PREREQ_PM'		=> { Test::More    => 0.45,
38                             File::Spec    => 0.82,
39                           }, # e.g., Module::Name => 1.1
40    ($] >= 5.005 ?    ## Add these new keywords supported since 5.005
41      (ABSTRACT_FROM => 'lib/Log/Log4perl.pm', # retrieve abstract from module
42       AUTHOR     => 'Mike Schilli <m@perlmeister.com>') : ()),
43    'LIBS'		=> [''], # e.g., '-lm'
44    'DEFINE'		=> '', # e.g., '-DHAVE_SOMETHING'
45	# Insert -I. if you add *.h files later:
46    'INC'		=> '', # e.g., '-I/usr/include/other'
47	# Un-comment this if you add C files to link with later:
48    # 'OBJECT'		=> '$(O_FILES)', # link all the C files too
49    'clean'             => {FILES => "*.tar.gz *.ppd pod2htm*"},
50    get_man3pods(),
51);
52
53##########################################
54sub get_man3pods {
55##########################################
56        # Only done for versions < 5.8.0
57    return () if $] >= 5.008;
58
59    print <<EOT;
60##################################################
61# Detected buggy MakeMaker version, creating man #
62# pages manually                                 #
63##################################################
64EOT
65    require File::Find;
66
67    my @pms = ();
68
69    File::Find::find(sub {
70        push @pms, $File::Find::name if /\.pm$/
71    }, "lib");
72
73    return('MAN3PODS', {
74        map { my @comps = split /\//, $_;
75              shift @comps;
76              my $csep = join '::', @comps;
77              $csep =~ s/\.pm$//;
78              ($_, "\$(INST_MAN3DIR)/$csep.\$(MAN3EXT)");
79            } @pms
80    });
81}
82