]> git.vpit.fr Git - perl/modules/Variable-Magic.git/blobdiff - Makefile.PL
Skip NULL values when walking a table
[perl/modules/Variable-Magic.git] / Makefile.PL
index cef05b243960677eb4be4031f21aff54c6cd4086..57d8b81816c4242d993eeef3a867d2180b1a4173 100644 (file)
@@ -11,17 +11,7 @@ BEGIN {
 }
 
 my @DEFINES;
-
-my $pl = $Config{perl_patchlevel};
-print "Checking perl patchlevel... ";
-if (defined $pl && length $pl) {
- $pl = int $pl;
- push @DEFINES, '-DVMG_PERL_PATCHLEVEL=' . $pl;
- print $pl, "\n";
-} else {
- $pl = undef;
- print "none\n";
-}
+my %macro;
 
 my $as_perl = eval {
  require ActivePerl;
@@ -36,17 +26,24 @@ if ($^V eq v5.8.8 and defined $as_perl and $as_perl >= 822) {
 }
 print $is_as_822 ? "yes\n" : "no\n";
 
-my $is_5110rel = 0;
-print "Checking if this is a released perl 5.11.0 or higher... ";
-if ($^V ge v5.11.0 and not defined $pl) {
- my $describe = $Config{git_describe};
- # An empty 'describe' is fine
- if (defined $describe and $describe !~ /^GitLive-/) {
-  $is_5110rel = 1;
-  push @DEFINES, '-DVMG_COMPAT_ARRAY_PUSH_NOLEN=0';
+my $is_gcc_34 = 0;
+print "Checking if this is gcc 3.4 on Windows trying to link against an import library... ";
+if ($^O eq 'MSWin32' and not grep /^LD[A-Z]*=/, @ARGV) {
+ my ($libperl, $gccversion) = map $_ || '', @Config{qw/libperl gccversion/};
+ if ($gccversion =~ /^3\.4\.[0-9]+/ and $libperl =~ s/\.lib$//) {
+  $is_gcc_34 = 1;
+  my ($lddlflags, $ldflags) = @Config{qw/lddlflags ldflags/};
+  $_ ||= '', s/-L(?:".*?"|\S+)//g for $lddlflags, $ldflags;
+  $libperl = "-l$libperl";
+  my $libdirs = join ' ',
+                 map { s/(?<!\\)((?:\\\\)*")/\\$1/g; qq[-L"$_"] }
+                  @Config{qw/bin sitebin/};
+  $macro{LDDLFLAGS}    = "$lddlflags $libdirs $libperl";
+  $macro{LDFLAGS}      = "$ldflags $libdirs $libperl";
+  $macro{PERL_ARCHIVE} = '',
  }
 }
-print $is_5110rel ? "yes\n" : "no\n";
+print $is_gcc_34 ? "yes\n" : "no\n";
 
 # Threads, Windows and 5.8.x don't seem to be best friends
 if ($^O eq 'MSWin32' && $^V lt v5.9.0) {
@@ -61,6 +58,7 @@ if ($^O eq 'MSWin32' && $^V lt v5.10.1) {
 }
 
 @DEFINES = (DEFINE => join ' ', @DEFINES) if @DEFINES;
+%macro   = (macro  => { %macro })         if %macro; # Beware of the circle
 
 my $dist = 'Variable-Magic';
 
@@ -115,4 +113,5 @@ WriteMakefile(
  clean            => {
   FILES => "$dist-* *.gcov *.gcda *.gcno cover_db Debian_CPANTS.txt"
  },
+ %macro,
 );