X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=Makefile.PL;h=d05fd2d12e5f6833d0ae7b78a70477f9be7cf7a0;hb=d8cb0a8822a5de6b81f2f8ad890d179f1ee50484;hp=3c510a82b90fc9325639337739b662a6c6eefba6;hpb=2d7facf29733bcbf4b3eee31376d8d4cb439b402;p=perl%2Fmodules%2Fautovivification.git diff --git a/Makefile.PL b/Makefile.PL index 3c510a8..d05fd2d 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -4,7 +4,34 @@ use strict; use warnings; use ExtUtils::MakeMaker; +BEGIN { + local $@; + eval { require Config }; + die 'OS unsupported' if $@; + Config->import(qw/%Config/); +} + my @DEFINES; +my %macro; + +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/(? join ' ', @DEFINES) if @DEFINES; +%macro = (macro => { %macro }) if %macro; # Beware of the circle my $dist = 'autovivification'; @@ -65,4 +93,5 @@ WriteMakefile( clean => { FILES => "$dist-* *.gcov *.gcda *.gcno cover_db Debian_CPANTS.txt" }, + %macro, );