]> git.imager.perl.org - imager.git/commitdiff
retain compatibility with the original Devel::CheckLib, even if it
authorTony Cook <tony@develop=help.com>
Mon, 9 Aug 2010 12:39:30 +0000 (12:39 +0000)
committerTony Cook <tony@develop=help.com>
Mon, 9 Aug 2010 12:39:30 +0000 (12:39 +0000)
doesn't match EU::MM handling of LIBS

inc/Devel/CheckLib.pm

index ead38afbf81d0b85e3778538bd40796c7053b218..92db0c0f74e5b1586dd400ed2c3a5515699680a3 100644 (file)
@@ -204,13 +204,23 @@ sub assert_lib {
     }
     # using special form of split to trim whitespace
     if(defined($args{LIBS})) {
-       my @LIBS = ref $args{LIBS} ? @{$args{LIBS}} : split ' ', $args{LIBS};
-        foreach my $arg (@LIBS) {
-           my @sep = split ' ', $arg;
-           my @libs = map { /^-l(.+)$/ ? $1 : () } @sep;
-           my @paths = map { /^-L(.+)$/ ? $1 : () } @sep;
-           push @link_cfgs, [ \@paths, \@libs ];
-        }
+        if (ref $args{LIBS}) {
+           foreach my $arg (@{$args{LIBS}}) {
+               my @sep = split ' ', $arg;
+               my @libs = map { /^-l(.+)$/ ? $1 : () } @sep;
+               my @paths = map { /^-L(.+)$/ ? $1 : () } @sep;
+               push @link_cfgs, [ \@paths, \@libs ];
+           }
+       }
+       else {
+           my @libs;
+           my @paths;
+           foreach my $arg (split(' ', $args{LIBS})) {
+               die("LIBS argument badly-formed: $arg\n") unless($arg =~ /^-l/i);
+               push @{$arg =~ /^-l/ ? \@libs : \@paths}, substr($arg, 2);
+           }
+           push @link_cfgs, map [ \@paths, [ $_ ] ], @libs;
+       }
     }
     if(defined($args{INC})) {
         foreach my $arg (split(' ', $args{INC})) {