CC: | bingos [...] cpan.org |
Subject: | Ignores perl's configured cc- and ld-flags |
Date: | Sun, 19 Sep 2010 00:34:08 +0200 |
To: | bug-Devel-CheckLib [...] rt.cpan.org |
From: | Florian Ragwitz <rafl [...] debian.org> |
When checking for includes and libraries, Devel-CheckLib entirely relies
on the default lib- and inc-paths of the compiler, as well as the ones
explicitly configured by its user. Compiler- and linker-flags perl has
been configured to use are entirely ignored.
ExtUtils::MakeMaker and other modules actually compiling code including
certain headers and linking against their libraries use those
flags. Therefore it's possible that Devel::CheckLib claims a library or
header is not be available while it actually is, and compiling and
linking would just work. That's a bug.
The following patch isn't pretty, but fixes the issue. The patch is also
available in the config_ccldflags branch of
git://github.com/rafl/p5-Devel-CheckLib.git.
From 7c22b45a677699209f98fe38b0be5355eb041ce4 Mon Sep 17 00:00:00 2001
From: Florian Ragwitz <rafl@debian.org>
Date: Sun, 19 Sep 2010 00:32:09 +0200
Subject: [PATCH] Honour configured perl {cc,ld}flags
---
lib/Devel/CheckLib.pm | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/lib/Devel/CheckLib.pm b/lib/Devel/CheckLib.pm
index ebf1a87..9ef7b29 100644
--- a/lib/Devel/CheckLib.pm
+++ b/lib/Devel/CheckLib.pm
@@ -7,6 +7,7 @@ use strict;
use vars qw($VERSION @ISA @EXPORT);
$VERSION = '0.8';
use Config;
+use Text::ParseWords 'quotewords';
use File::Spec;
use File::Temp;
@@ -329,12 +330,14 @@ sub _cleanup_exe {
}
sub _findcc {
+ my @flags = grep { length } map { quotewords('\s+', 0, $_) }
+ @Config{qw(ccflags ldflags)};
my @paths = split(/$Config{path_sep}/, $ENV{PATH});
my @cc = split(/\s+/, $Config{cc});
- return @cc if -x $cc[0];
+ return (@cc, @flags) if -x $cc[0];
foreach my $path (@paths) {
my $compiler = File::Spec->catfile($path, $cc[0]) . $Config{_exe};
- return ($compiler, @cc[1 .. $#cc]) if -x $compiler;
+ return ($compiler, @cc[1 .. $#cc], @flags) if -x $compiler;
}
die("Couldn't find your C compiler\n");
}
--
1.7.1
Message body not shown because it is not plain text.