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
34my $meta_merge = {
35    META_MERGE => {
36        resources => {
37            repository  => 'http://github.com/mschilli/log4perl',
38            MailingList => 'mailto:log4perl-devel@lists.sourceforge.net',
39        },
40    }
41};
42
43WriteMakefile(
44    'NAME'		=> 'Log::Log4perl',
45    'VERSION_FROM'	=> 'lib/Log/Log4perl.pm', # finds $VERSION
46    'PREREQ_PM'		=> { Test::More    => 0.45,
47                             File::Spec    => 0.82,
48                           }, # e.g., Module::Name => 1.1
49    ($] >= 5.005 ?    ## Add these new keywords supported since 5.005
50      (ABSTRACT_FROM => 'lib/Log/Log4perl.pm', # retrieve abstract from module
51       AUTHOR     => 'Mike Schilli <m@perlmeister.com>') : ()),
52    'LIBS'		=> [''], # e.g., '-lm'
53    'DEFINE'		=> '', # e.g., '-DHAVE_SOMETHING'
54	# Insert -I. if you add *.h files later:
55    'INC'		=> '', # e.g., '-I/usr/include/other'
56	# Un-comment this if you add C files to link with later:
57    # 'OBJECT'		=> '$(O_FILES)', # link all the C files too
58    'clean'             => {FILES => "*.tar.gz *.ppd pod2htm*"},
59    EXE_FILES           => ["eg/l4p-tmpl"],
60    $ExtUtils::MakeMaker::VERSION >= 6.50 ? (%$meta_merge) : (),
61    get_man3pods(),
62);
63
64##########################################
65sub get_man3pods {
66##########################################
67        # Only done for versions < 5.8.0
68    return () if $] >= 5.008;
69
70    print <<EOT;
71##################################################
72# Detected buggy MakeMaker version, creating man #
73# pages manually                                 #
74##################################################
75EOT
76    require File::Find;
77
78    my @pms = ();
79
80    File::Find::find(sub {
81        push @pms, $File::Find::name if /\.pm$/
82    }, "lib");
83
84    return('MAN3PODS', {
85        map { my @comps = split /\//, $_;
86              shift @comps;
87              my $csep = join '::', @comps;
88              $csep =~ s/\.pm$//;
89              ($_, "\$(INST_MAN3DIR)/$csep.\$(MAN3EXT)");
90            } @pms
91    });
92}
93