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 gcc 3.4 on Windows trying to link against an import library... ";
42 if ($^O eq 'MSWin32' and not grep /^LD[A-Z]*=/, @ARGV) {
43 my ($libperl, $gccversion) = map $_ || '', @Config{qw/libperl gccversion/};
44 if ($gccversion =~ /^3\.4\.[0-9]+/ and $libperl =~ s/\.lib$//) {
46 my ($lddlflags, $ldflags) = @Config{qw/lddlflags ldflags/};
47 $_ ||= '', s/-L(?:".*?"|\S+)//g for $lddlflags, $ldflags;
48 $libperl = "-l$libperl";
49 my $libdirs = join ' ',
50 map { s/(?<!\\)((?:\\\\)*")/\\$1/g; qq[-L"$_"] }
51 @Config{qw/bin sitebin/};
52 $macro{LDDLFLAGS} = "$lddlflags $libdirs $libperl";
53 $macro{LDFLAGS} = "$ldflags $libdirs $libperl";
54 $macro{PERL_ARCHIVE} = '',
57 print $is_gcc_34 ? "yes\n" : "no\n";
59 # Threads, Windows and 5.8.x don't seem to be best friends
60 if ($^O eq 'MSWin32' && $^V lt v5.9.0) {
61 push @DEFINES, '-DVMG_MULTIPLICITY=0';
62 print "Thread safety disabled for perl 5.8.x on Windows.\n"
65 # Fork emulation got "fixed" in 5.10.1
66 if ($^O eq 'MSWin32' && $^V lt v5.10.1) {
67 push @DEFINES, '-DVMG_FORKSAFE=0';
68 print "Fork safety not ensured for perl 5.8.x and 5.10.0 on Windows.\n";
71 @DEFINES = (DEFINE => join ' ', @DEFINES) if @DEFINES;
72 %macro = (macro => { %macro }) if %macro; # Beware of the circle
74 my $dist = 'Variable-Magic';
76 (my $name = $dist) =~ s{-}{::}g;
78 (my $file = $dist) =~ s{-}{/}g;
79 $file = "lib/$file.pm";
89 configure_requires => {
91 'ExtUtils::MakeMaker' => 0,
96 'ExtUtils::MakeMaker' => 0,
102 bugtracker => "http://rt.cpan.org/NoAuth/ReportBug.html?Queue=$dist",
103 homepage => "http://search.cpan.org/dist/$dist/",
104 license => 'http://dev.perl.org/licenses/',
105 repository => "http://git.profvince.com/?p=perl%2Fmodules%2F$dist.git",
111 AUTHOR => 'Vincent Pit <perl@profvince.com>',
113 VERSION_FROM => $file,
114 ABSTRACT_FROM => $file,
117 PREREQ_PM => \%PREREQ_PM,
118 MIN_PERL_VERSION => 5.008,
119 META_MERGE => \%META,
121 PREOP => "pod2text $file > \$(DISTVNAME)/README",
122 COMPRESS => 'gzip -9f', SUFFIX => 'gz'
125 FILES => "$dist-* *.gcov *.gcda *.gcno cover_db Debian_CPANTS.txt"