Subject: | Imager::Probe should parse -D option from pkgconfig |
On my machine(ubuntu hardy), pkg-config libpng --cflags returns "-DPNG_NO_MMX_CODE
-I/usr/include/libpng12". It breaks the distribution.
The result of Makefile.PL is:
{{{
% perl Makefile.PL
PNG: building independently
PNG: Found via pkg-config libpng12
PNG: Test code failed: INC argument badly-formed: -DPNG_NO_MMX_CODE
OS unsupported: PNG libraries or headers not found
}}}
I think this is a issue in Imager::Probe.
The patch is here:
{{{
diff --git a/perlbrew/perls/perl-5.12.2/lib/site_perl/5.12.2/x86_64-
linux/Imager/Probe.pm b/perlbrew/perls/perl-5
index fe160f9..37b3460 100644
--- a/perlbrew/perls/perl-5.12.2/lib/site_perl/5.12.2/x86_64-linux/Imager/Probe.pm
+++ b/perlbrew/perls/perl-5.12.2/lib/site_perl/5.12.2/x86_64-linux/Imager/Probe.pm
@@ -106,6 +106,8 @@ sub _probe_pkg {
# broken to be useful
my $cflags = `pkg-config $pkg --cflags`
and !$? or return;
+ my $ccflags = '';
+ $cflags =~ s/(-D\S+)/$ccflags .= " $1"; ''/ge;
my $lflags = `pkg-config $pkg --libs`
and !$? or return;
@@ -117,6 +119,7 @@ sub _probe_pkg {
{
INC => $cflags,
LIBS => $lflags,
+ CCFLAGS => $ccflags,
};
}
}
}}}