grab the current development Devel::CheckLib, it has the fixes I use
authorTony Cook <tony@develop=help.com>
Thu, 5 Aug 2010 12:42:19 +0000 (12:42 +0000)
committerTony Cook <tony@develop=help.com>
Thu, 5 Aug 2010 12:42:19 +0000 (12:42 +0000)
inc/Devel/CheckLib.pm

index 5d6ec52df66cda96a68025871bf413f3d5b50171..6e7f0af4768fb8c9247f74b56549f8da8959c379 100644 (file)
@@ -5,7 +5,7 @@ Devel::CheckLib;
 
 use strict;
 use vars qw($VERSION @ISA @EXPORT);
-$VERSION = '0.699_001';
+$VERSION = '0.699_002';
 use Config;
 
 use File::Spec;
@@ -13,7 +13,7 @@ use File::Temp;
 
 require Exporter;
 @ISA = qw(Exporter);
-@EXPORT = qw(assert_lib check_lib_or_exit);
+@EXPORT = qw(assert_lib check_lib_or_exit check_lib);
 
 # localising prevents the warningness leaking out of this module
 local $^W = 1;    # use warnings is a 5.6-ism
@@ -151,6 +151,11 @@ causing a CPAN Testers 'FAIL' report.  CPAN Testers should ignore this
 result -- which is what you want if an external library dependency is not
 available.
 
+=head2 check_lib
+
+This behaves exactly the same as C<assert_lib()> except that it is silent,
+returning false instead of dieing, or true otherwise.
+
 =cut
 
 sub check_lib_or_exit {
@@ -161,6 +166,11 @@ sub check_lib_or_exit {
     }
 }
 
+sub check_lib {
+    eval 'assert_lib(@_)';
+    return $@ ? 0 : 1;
+}
+
 sub assert_lib {
     my %args = @_;
     my (@libs, @libpaths, @headers, @incpaths);
@@ -261,6 +271,7 @@ sub assert_lib {
             my @libpath = map { 
                 q{/libpath:} . Win32::GetShortPathName($_)
             } @libpaths; 
+            # this is horribly sensitive to the order of arguments
             @sys_cmd = (
                 @cc,
                 $cfile,