5 use ExtUtils::MakeMaker;
8 eval { require Config };
9 die 'OS unsupported' if $@;
10 Config->import(qw/%Config/);
16 my $pl = $Config{perl_patchlevel};
17 print "Checking perl patchlevel... ";
18 if (defined $pl && length $pl) {
20 push @DEFINES, '-DVMG_PERL_PATCHLEVEL=' . $pl;
29 defined &ActivePerl::BUILD ? ActivePerl::BUILD() : undef
33 print "Checking if this is ActiveState Perl 5.8.8 build 822 or higher... ";
34 if ($^V eq v5.8.8 and defined $as_perl and $as_perl >= 822) {
36 push @DEFINES, '-DVMG_COMPAT_ARRAY_PUSH_NOLEN=1';
38 print $is_as_822 ? "yes\n" : "no\n";
41 print "Checking if this is a released perl 5.11.0 or higher... ";
42 if ($^V ge v5.11.0 and not defined $pl) {
43 my $describe = $Config{git_describe};
44 # An empty 'describe' is fine
45 if (defined $describe and $describe !~ /^GitLive-/) {
47 push @DEFINES, '-DVMG_COMPAT_ARRAY_PUSH_NOLEN=0';
50 print $is_5110rel ? "yes\n" : "no\n";
53 print "Checking if this is gcc 3.4 on Windows trying to link against an import library... ";
54 if ($^O eq 'MSWin32' and not grep /^LD[A-Z]*=/, @ARGV) {
55 my ($libperl, $gccversion) = map $_ || '', @Config{qw/libperl gccversion/};
56 if ($gccversion =~ /^3\.4\.[0-9]+/ and $libperl =~ s/\.lib$//) {
58 my ($lddlflags, $ldflags) = @Config{qw/lddlflags ldflags/};
59 $_ ||= '', s/-L(?:".*?"|\S+)//g for $lddlflags, $ldflags;
60 $libperl = "-l$libperl";
61 my $libdirs = join ' ',
62 map { s/(?<!\\)((?:\\\\)*")/\\$1/g; qq[-L"$_"] }
63 @Config{qw/bin sitebin/};
64 $macro{LDDLFLAGS} = "$lddlflags $libdirs $libperl";
65 $macro{LDFLAGS} = "$ldflags $libdirs $libperl";
66 $macro{PERL_ARCHIVE} = '',
69 print $is_gcc_34 ? "yes\n" : "no\n";
71 # Threads, Windows and 5.8.x don't seem to be best friends
72 if ($^O eq 'MSWin32' && $^V lt v5.9.0) {
73 push @DEFINES, '-DVMG_MULTIPLICITY=0';
74 print "Thread safety disabled for perl 5.8.x on Windows.\n"
77 # Fork emulation got "fixed" in 5.10.1
78 if ($^O eq 'MSWin32' && $^V lt v5.10.1) {
79 push @DEFINES, '-DVMG_FORKSAFE=0';
80 print "Fork safety not ensured for perl 5.8.x and 5.10.0 on Windows.\n";
83 @DEFINES = (DEFINE => join ' ', @DEFINES) if @DEFINES;
84 %macro = (macro => { %macro }) if %macro; # Beware of the circle
86 my $dist = 'Variable-Magic';
88 (my $name = $dist) =~ s{-}{::}g;
90 (my $file = $dist) =~ s{-}{/}g;
91 $file = "lib/$file.pm";
101 configure_requires => {
103 'ExtUtils::MakeMaker' => 0,
108 'ExtUtils::MakeMaker' => 0,
114 bugtracker => "http://rt.cpan.org/NoAuth/ReportBug.html?Queue=$dist",
115 homepage => "http://search.cpan.org/dist/$dist/",
116 license => 'http://dev.perl.org/licenses/',
117 repository => "http://git.profvince.com/?p=perl%2Fmodules%2F$dist.git",
123 AUTHOR => 'Vincent Pit <perl@profvince.com>',
125 VERSION_FROM => $file,
126 ABSTRACT_FROM => $file,
129 PREREQ_PM => \%PREREQ_PM,
130 MIN_PERL_VERSION => 5.008,
131 META_MERGE => \%META,
133 PREOP => "pod2text $file > \$(DISTVNAME)/README",
134 COMPRESS => 'gzip -9f', SUFFIX => 'gz'
137 FILES => "$dist-* *.gcov *.gcda *.gcno cover_db Debian_CPANTS.txt"