lib/ExtUtils/Liblist/Kid.pm

filter: Statementstmt 31.9% 110 / 344 Branchbran 23.8% 63 / 264 Conditioncond 23.9% 23 / 96 MC/DCmcdc 3.7% 2 / 54 Subroutinesub 47.6% 10 / 21 Podpod 0.0% 0 / 1 totaltotal 26.6% 208 / 780 CC 179 SCAR 72.6
CC
179
Cov
28%
_vms_ext
3906.0
_win32_ext
552.0
_unix_os2_ext
395.4
CRAP 1422.5
« lib/ExtUtils/MakeMaker/version/vpp.pm ↑ Summary lib/ExtUtils/MakeMaker/Locale.pm »
1 package ExtUtils::Liblist::Kid;
2  
3 # XXX Splitting this out into its own .pm is a temporary solution.
4  
5 # This kid package is to be used by MakeMaker. It will not work if
6 # $self is not a Makemaker.
7  
8 97 ▶use 5.006;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 # Broken out of MakeMaker from version 4.11
11  
12 97 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 97 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 97 our $VERSION = '7.78';
15 97 $VERSION =~ tr/_//d;
16  
17 97 ▶use ExtUtils::MakeMaker::Config;
Subroutine BEGIN: called CC=1 SCAR=0.0
18 97 ▶use Cwd 'cwd';
Subroutine BEGIN: called CC=1 SCAR=0.0
19 97 ▶use File::Basename;
Subroutine BEGIN: called CC=1 SCAR=0.0
20 97 ▶use File::Spec;
Subroutine BEGIN: called CC=1 SCAR=0.0
21  
22 229 ▶sub ext {
Subroutine ext: called CC=3 SCAR=14.2
Pod undocumented
23 0 ▶ if ( $^O eq 'VMS' ) { goto &_vms_ext; }
Branch: 2 branches
BranchTrueFalseTotal
if ($^O eq 'VMS') { } 0 229 229
elsif ($^O eq 'MSWin32') { } 0 229 229
24 0 elsif ( $^O eq 'MSWin32' ) { goto &_win32_ext; }
25 229 else { goto &_unix_os2_ext; }
26 }
27  
28 17 ▶sub _space_dirs_split {
Subroutine _space_dirs_split: called CC=7 SCAR=19.5
29 17 my ($libpth) = @_;
30 17 ▶ return if !length $libpth;
Branch: 1 branch
BranchTrueFalseTotal
unless length $libpth 8 9 17
31 9 my (@chunks, @ret);
32 9 ▶ push @chunks, [$1,$2] while $libpth =~ /(\S+)(\s*)/g;
Branch: 1 branch
BranchTrueFalseTotal
$libpth =~ /(\S+)(\s*)/g and do { push @chunks, [$1, $2] } 34 9 43
33 9 ▶ CHUNK: while (@chunks) {
Branch: 1 branch
BranchTrueFalseTotal
if (@chunks) 34 9 43
34 34 my ($c, $ind) = (shift(@chunks), 0);
35 34 ▶ if (-d $c->[0]) { push @ret, $c->[0]; next CHUNK; }
Branch: 1 branch
BranchTrueFalseTotal
if (-d $c->[0]) 32 2 34
36 2 my $sofar = join '', @$c;
37 2 ▶ while ($ind < @chunks) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ind < @chunks) 1 1 2
38 1 my ($this_word, $this_space) = @{ $chunks[$ind] };
39 1 $sofar .= $this_word;
40 1 ▶ if (-d $sofar) { push @ret, $sofar; next CHUNK; }
Branch: 1 branch
BranchTrueFalseTotal
if (-d $sofar) 1 0 1
41 0 $sofar .= $this_space;
42 0 $ind++;
43 }
44 }
45 9 @ret;
46 }
47  
48 229 ▶sub _unix_os2_ext {
Subroutine _unix_os2_ext: called CC=69 SCAR=59.8
49 229 my ( $self, $potential_libs, $verbose, $give_libs ) = @_;
50 229 ▶ $verbose ||= 0;
Condition50%1/2
$verbose ||= 0
l!l
0229
MC/DC0%0/1
$verbose ||= 0
$verbose
Truth table50%1/2
A
A= $verbose
Aresult
11
00
51  
52 229 ▶ if ( $^O =~ /os2|android/ and $Config{perllibs} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($^O =~ /os2|android/ and $ExtUtils::Liblist::Kid::Config{"perllibs"}) 0 229 229
Condition33%1/3
$^O =~ /os2|android/ and $ExtUtils::Liblist::Kid::Config{"perllibs"}
!ll&&!rl&&r
22900
MC/DC0%0/2
$^O =~ /os2|android/ and $ExtUtils::Liblist::Kid::Config{"perllibs"}
$^O =~ /os2|android/ $ExtUtils::Liblist::Kid::Config{"perllibs"}
Truth table33%1/3
A and B
A= $^O =~ /os2|android/B= $ExtUtils::Liblist::Kid::Config{"perllibs"}
ABresult
0X0
100
111
53  
54 # Dynamic libraries are not transitive, so we may need including
55 # the libraries linked against perl.dll/libperl.so again.
56  
57 0 ▶ $potential_libs .= " " if $potential_libs;
Branch: 1 branch
BranchTrueFalseTotal
if $potential_libs 0 0 0
58 0 $potential_libs .= $Config{perllibs};
59 }
60 229 ▶ return ( "", "", "", "", ( $give_libs ? [] : () ) ) unless $potential_libs;
Branch: 2 branches
BranchTrueFalseTotal
unless $potential_libs 212 17 229
$give_libs ? : 1 211 212
61 17 ▶ warn "Potential libraries are '$potential_libs':\n" if $verbose;
Branch: 1 branch
BranchTrueFalseTotal
if $verbose 0 17 17
62  
63 17 my ( $so ) = $Config{so};
64 17 ▶ my ( $libs ) = defined $Config{perllibs} ? $Config{perllibs} : $Config{libs};
Branch: 1 branch
BranchTrueFalseTotal
defined $ExtUtils::Liblist::Kid::Config{'perllibs'} ? : 17 0 17
65 17 ▶ my $Config_libext = $Config{lib_ext} || ".a";
Condition100%2/2
$ExtUtils::Liblist::Kid::Config{'lib_ext'} || '.a'
l!l
89
MC/DC100%1/1
$ExtUtils::Liblist::Kid::Config{'lib_ext'} || '.a'
$ExtUtils::Liblist::Kid::Config{'lib_ext'}
Truth table100%2/2
A
A= $ExtUtils::Liblist::Kid::Config{'lib_ext'}
Aresult
11
00
66 17 my $Config_dlext = $Config{dlext};
67  
68 # compute $extralibs, $bsloadlibs and $ldloadlibs from
69 # $potential_libs
70 # this is a rewrite of Andy Dougherty's extliblist in perl
71  
72 17 require Text::ParseWords;
73  
74 17 my @searchpath; # from "-L/path" entries in $potential_libs
75 17 ▶ my @libpath = _space_dirs_split($Config{libpth} || '');
Condition100%2/2
$ExtUtils::Liblist::Kid::Config{'libpth'} || ''
l!l
98
MC/DC100%1/1
$ExtUtils::Liblist::Kid::Config{'libpth'} || ''
$ExtUtils::Liblist::Kid::Config{'libpth'}
Truth table100%2/2
A
A= $ExtUtils::Liblist::Kid::Config{'libpth'}
Aresult
11
00
76 17 my ( @ldloadlibs, @bsloadlibs, @extralibs, @ld_run_path, %ld_run_path_seen );
77 17 my ( @libs, %libs_seen );
78 17 my ( $fullname, @fullname );
79 17 my ( $pwd ) = cwd(); # from Cwd.pm
80 17 my ( $found ) = 0;
81 17 ▶ if ($Config{gccversion}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ExtUtils::Liblist::Kid::Config{"gccversion"}) 8 9 17
82 8 chomp(my @incpath = grep s/^ //, grep { /^#include </ .. /^End of search / } `$Config{cc} -E -v - </dev/null 2>&1 >/dev/null`);
83 8 unshift @libpath, map { s{/include[^/]*}{/lib}; $_ } @incpath
84 }
85 17 @libpath = grep -d, @libpath;
86  
87 17 ▶ if ($^O eq 'darwin') {
Branch: 1 branch
BranchTrueFalseTotal
if ($^O eq "darwin") 0 17 17
88 # 'escape' Mach-O ld -framework and -F flags, so they aren't dropped later on
89 0 ▶ $found++ if $potential_libs =~ s/(^|\s)(-(?:weak_|reexport_|lazy_)?framework)\s+(\S+)/$1-Wl,$2 -Wl,$3/g;
Branch: 1 branch
BranchTrueFalseTotal
if $potential_libs =~ s/(^|\s)(-(?:weak_|reexport_|lazy_)?framework)\s+(\S+)/$1-Wl,$2 -Wl,$3/g 0 0 0
90 0 ▶ $found++ if $potential_libs =~ s/(^|\s)(-F)\s*(\S+)/$1-Wl,$2 -Wl,$3/g;
Branch: 1 branch
BranchTrueFalseTotal
if $potential_libs =~ s/(^|\s)(-F)\s*(\S+)/$1-Wl,$2 -Wl,$3/g 0 0 0
91 }
92  
93 17 foreach my $thislib ( Text::ParseWords::shellwords($potential_libs) ) {
94 26 my ( $custom_name ) = '';
95  
96 # Handle possible linker path arguments.
97 26 ▶ if ( $thislib =~ s/^(-[LR]|-Wl,-R|-Wl,-rpath,)// ) { # save path flag type
Branch: 1 branch
BranchTrueFalseTotal
if ($thislib =~ s/^(-[LR]|-Wl,-R|-Wl,-rpath,)//) 9 17 26
98 9 my ( $ptype ) = $1;
99 9 ▶ unless ( -d $thislib ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (-d $thislib) 2 7 9
100 2 ▶ warn "$ptype$thislib ignored, directory does not exist\n"
Branch: 1 branch
BranchTrueFalseTotal
if $verbose 0 2 2
101 if $verbose;
102 2 next;
103 }
104 7 my ( $rtype ) = $ptype;
105 7 ▶ if ( ( $ptype eq '-R' ) or ( $ptype =~ m!^-Wl,-[Rr]! ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ptype eq "-R" or $ptype =~ /^-Wl,-[Rr]/) 0 7 7
Condition33%1/3
$ptype eq "-R" or $ptype =~ /^-Wl,-[Rr]/
l!l&&r!l&&!r
007
MC/DC0%0/2
$ptype eq "-R" or $ptype =~ /^-Wl,-[Rr]/
$ptype eq "-R" $ptype =~ /^-Wl,-[Rr]/
Truth table33%1/3
A or B
A= $ptype eq "-R"B= $ptype =~ /^-Wl,-[Rr]/
ABresult
1X1
011
000
106 0 ▶ if ( $Config{'lddlflags'} =~ /-Wl,-[Rr]/ ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($ExtUtils::Liblist::Kid::Config{'lddlflags'} =~ /-Wl,-[Rr]/) { } 0 0 0
elsif ($ExtUtils::Liblist::Kid::Config{'lddlflags'} =~ /-R/) { } 0 0 0
107 0 $rtype = '-Wl,-R';
108 }
109 elsif ( $Config{'lddlflags'} =~ /-R/ ) {
110 0 $rtype = '-R';
111 }
112 }
113 7 ▶ unless ( File::Spec->file_name_is_absolute( $thislib ) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ("File::Spec"->file_name_is_absolute($thislib)) 7 0 7
114 7 warn "Warning: $ptype$thislib changed to $ptype$pwd/$thislib\n";
115 7 $thislib = $self->catdir( $pwd, $thislib );
116 }
117 7 push( @searchpath, $thislib );
118 7 ▶ $thislib = qq{"$thislib"} if $thislib =~ / /; # protect spaces if there
Branch: 1 branch
BranchTrueFalseTotal
if $thislib =~ / / 1 6 7
119 7 push( @extralibs, "$ptype$thislib" );
120 7 push( @ldloadlibs, "$rtype$thislib" );
121 7 next;
122 }
123  
124 17 ▶ if ( $thislib =~ m!^-Wl,! ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($thislib =~ /^-Wl,/) 0 17 17
125 0 push( @extralibs, $thislib );
126 0 push( @ldloadlibs, $thislib );
127 0 next;
128 }
129  
130 # Handle possible library arguments.
131 17 ▶ if ( $thislib =~ s/^-l(:)?// ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($thislib =~ s/^-l(:)?//) { } 15 2 17
132 # Handle -l:foo.so, which means that the library will
133 # actually be called foo.so, not libfoo.so. This
134 # is used in Android by ExtUtils::Depends to allow one XS
135 # module to link to another.
136 15 ▶ $custom_name = $1 || '';
Condition50%1/2
$1 || ''
l!l
015
MC/DC0%0/1
$1 || ''
$1
Truth table50%1/2
A
A= $1
Aresult
11
00
137 }
138 else {
139 2 warn "Unrecognized argument in LIBS ignored: '$thislib'\n";
140 2 next;
141 }
142  
143 15 my ( $found_lib ) = 0;
144 15 foreach my $thispth ( @searchpath, @libpath ) {
145  
146 # Try to find the full name of the library. We need this to
147 # determine whether it's a dynamically-loadable library or not.
148 # This tends to be subject to various os-specific quirks.
149 # For gcc-2.6.2 on linux (March 1995), DLD can not load
150 # .sa libraries, with the exception of libm.sa, so we
151 # deliberately skip them.
152 64 ▶ if ((@fullname =
Branch: 12 branches
BranchTrueFalseTotal
if (@fullname = $self->lsdir($thispth, "^\Qlib$thislib.$so.\E[0-9]+") or @fullname = $self->lsdir($thispth, "^\Qlib$thislib.\E[0-9]+\Q.$so\E")) { } 0 64 64
elsif (-f ($fullname = "$thispth/lib$thislib.$so")) { } 5 59 64
elsif (-f ($fullname = "$thispth/lib${thislib}_s$Config_libext") and not $ExtUtils::Liblist::Kid::Config{'archname'} =~ /RM\d\d\d-svr4/ and $thislib .= '_s') { } 0 59 59
elsif (-f ($fullname = "$thispth/lib$thislib$Config_libext")) { } 0 59 59
elsif (defined $Config_dlext and -f ($fullname = "$thispth/lib$thislib.$Config_dlext")) { } 0 59 59
elsif ($^O eq 'darwin' and require DynaLoader and defined &DynaLoader::dl_load_file and DynaLoader::dl_load_file($fullname = "$thispth/lib$thislib.$so", 0)) { } 0 59 59
elsif (-f ($fullname = "$thispth/$thislib$Config_libext")) { } 0 59 59
elsif (-f ($fullname = "$thispth/lib$thislib.dll$Config_libext")) { } 0 59 59
elsif ($^O eq 'cygwin' and -f ($fullname = "$thispth/$thislib.dll")) { } 0 59 59
elsif (-f ($fullname = "$thispth/Slib$thislib$Config_libext")) { } 0 59 59
elsif ($^O eq 'dgux' and -l ($fullname = "$thispth/lib$thislib$Config_libext") and readlink($fullname) =~ /^elink:/s) { } 0 59 59
elsif ($custom_name and -f ($fullname = "$thispth/$thislib")) { } 0 59 59
Condition33%1/3
@fullname = $self->lsdir($thispth, "^\Qlib$thislib.$so.\E[0-9]+") or @fullname = $self->lsdir($thispth, "^\Qlib$thislib.\E[0-9]+\Q.$so\E")
l!l&&r!l&&!r
0064
MC/DC0%0/2
@fullname = $self->lsdir($thispth, "^\Qlib$thislib.$so.\E[0-9]+") or @fullname = $self->lsdir($thispth, "^\Qlib$thislib.\E[0-9]+\Q.$so\E")
@fullname = $self->lsdir($thispth, "^\Qlib$thislib.$so.\E[0-9]+") @fullname = $self->lsdir($thispth, "^\Qlib$thislib.\E[0-9]+\Q.$so\E")
Truth table33%1/3
A or B
A= @fullname = $self->lsdir($thispth, "^\Qlib$thislib.$so.\E[0-9]+")B= @fullname = $self->lsdir($thispth, "^\Qlib$thislib.\E[0-9]+\Q.$so\E")
ABresult
1X1
011
000
153 $self->lsdir($thispth, "^\Qlib$thislib.$so.\E[0-9]+")) ||
154 (@fullname =
155 $self->lsdir($thispth, "^\Qlib$thislib.\E[0-9]+\Q\.$so"))) {
156 # Take care that libfoo.so.10 wins against libfoo.so.9.
157 # Compare two libraries to find the most recent version
158 # number. E.g. if you have libfoo.so.9.0.7 and
159 # libfoo.so.10.1, first convert all digits into two
160 # decimal places. Then we'll add ".00" to the shorter
161 # strings so that we're comparing strings of equal length
162 # Thus we'll compare libfoo.so.09.07.00 with
163 # libfoo.so.10.01.00. Some libraries might have letters
164 # in the version. We don't know what they mean, but will
165 # try to skip them gracefully -- we'll set any letter to
166 # '0'. Finally, sort in reverse so we can take the
167 # first element.
168  
169 #TODO: iterate through the directory instead of sorting
170  
171 $fullname = "$thispth/" . (
172 sort {
173 0 my ( $ma ) = $a;
174 0 my ( $mb ) = $b;
175 0 $ma =~ tr/A-Za-z/0/s;
176 0 $ma =~ s/\b(\d)\b/0$1/g;
177 0 $mb =~ tr/A-Za-z/0/s;
178 0 $mb =~ s/\b(\d)\b/0$1/g;
179 0 ▶ while ( length( $ma ) < length( $mb ) ) { $ma .= ".00"; }
Branch: 1 branch
BranchTrueFalseTotal
if (length $ma < length $mb) 0 0 0
180 0 ▶ while ( length( $mb ) < length( $ma ) ) { $mb .= ".00"; }
Branch: 1 branch
BranchTrueFalseTotal
if (length $mb < length $ma) 0 0 0
181  
182 # Comparison deliberately backwards
183 0 $mb cmp $ma;
184 } @fullname
185 )[0];
186 }
187 elsif ( -f ( $fullname = "$thispth/lib$thislib.$so" ) )
188 {
189 }
190 ▶ elsif (-f ( $fullname = "$thispth/lib${thislib}_s$Config_libext" )
Condition40%2/5
-f ($fullname = "$thispth/lib${thislib}_s$Config_libext") and not $ExtUtils::Liblist::Kid::Config{"archname"} =~ /RM\d\d\d-svr4/ and $thislib .= '_s'
!ll
590
-f ($fullname = "$thispth/lib${thislib}_s$Config_libext") and not $ExtUtils::Liblist::Kid::Config{"archname"} =~ /RM\d\d\d-svr4/
!ll&&!rl&&r
5900
MC/DC0%0/2
-f ($fullname = "$thispth/lib${thislib}_s$Config_libext") and not $ExtUtils::Liblist::Kid::Config{"archname"} =~ /RM\d\d\d-svr4/ and $thislib .= '_s'
-f ($fullname = "$thispth/lib${thislib}_s$Config_libext") not $ExtUtils::Liblist::Kid::Config{"archname"} =~ /RM\d\d\d-svr4/
Truth table33%1/3
A and not(B)
A= -f ($fullname = "$thispth/lib${thislib}_s$Config_libext")B= not $ExtUtils::Liblist::Kid::Config{"archname"} =~ /RM\d\d\d-svr4/
ABresult
0X0
100
111
191 && ( $Config{'archname'} !~ /RM\d\d\d-svr4/ )
192 && ( $thislib .= "_s" ) )
193 { # we must explicitly use _s version
194 }
195 elsif ( -f ( $fullname = "$thispth/lib$thislib$Config_libext" ) ) {
196 }
197 ▶ elsif ( defined( $Config_dlext )
Condition66%2/3
defined $Config_dlext and -f ($fullname = "$thispth/lib$thislib.$Config_dlext")
!ll&&!rl&&r
2570
MC/DC0%0/2
defined $Config_dlext and -f ($fullname = "$thispth/lib$thislib.$Config_dlext")
defined $Config_dlext -f ($fullname = "$thispth/lib$thislib.$Config_dlext")
Truth table66%2/3
A and B
A= defined $Config_dlextB= -f ($fullname = "$thispth/lib$thislib.$Config_dlext")
ABresult
0X0
100
111
198 && -f ( $fullname = "$thispth/lib$thislib.$Config_dlext" ) )
199 {
200 }
201 ▶ elsif ( $^O eq 'darwin' && require DynaLoader && defined &DynaLoader::dl_load_file
Condition33%3/9
$^O eq "darwin" and require DynaLoader and defined &DynaLoader::dl_load_file and DynaLoader::dl_load_file($fullname = "$thispth/lib$thislib.$so", 0)
!ll&&!rl&&r
5900
$^O eq "darwin" and require DynaLoader and defined &DynaLoader::dl_load_file
!ll&&!rl&&r
5900
$^O eq "darwin" and require DynaLoader
!ll&&!rl&&r
5900
MC/DC0%0/4
$^O eq "darwin" and require DynaLoader and defined &DynaLoader::dl_load_file and DynaLoader::dl_load_file($fullname = "$thispth/lib$thislib.$so", 0)
$^O eq "darwin" require DynaLoader defined &DynaLoader::dl_load_file DynaLoader::dl_load_file($fullname = "$thispth/lib$thislib.$so", 0)
Truth table20%1/5
A and B and C and D
A= $^O eq "darwin"B= require DynaLoaderC= defined &DynaLoader::dl_load_fileD= DynaLoader::dl_load_file($fullname = "$thispth/lib$thislib.$so", 0)
ABCDresult
0XXX0
10XX0
110X0
11100
11111
202 && DynaLoader::dl_load_file( $fullname = "$thispth/lib$thislib.$so", 0 ) )
203 {
204 }
205 elsif ( -f ( $fullname = "$thispth/$thislib$Config_libext" ) ) {
206 }
207 elsif ( -f ( $fullname = "$thispth/lib$thislib.dll$Config_libext" ) ) {
208 }
209 ▶ elsif ( $^O eq 'cygwin' && -f ( $fullname = "$thispth/$thislib.dll" ) ) {
Condition33%1/3
$^O eq "cygwin" and -f ($fullname = "$thispth/$thislib.dll")
!ll&&!rl&&r
5900
MC/DC0%0/2
$^O eq "cygwin" and -f ($fullname = "$thispth/$thislib.dll")
$^O eq "cygwin" -f ($fullname = "$thispth/$thislib.dll")
Truth table33%1/3
A and B
A= $^O eq "cygwin"B= -f ($fullname = "$thispth/$thislib.dll")
ABresult
0X0
100
111
210 }
211 elsif ( -f ( $fullname = "$thispth/Slib$thislib$Config_libext" ) ) {
212 }
213 ▶ elsif ($^O eq 'dgux'
Condition33%2/6
$^O eq "dgux" and -l ($fullname = "$thispth/lib$thislib$Config_libext") and readlink($fullname) =~ /^elink:/s
!ll&&!rl&&r
5900
$^O eq "dgux" and -l ($fullname = "$thispth/lib$thislib$Config_libext")
!ll&&!rl&&r
5900
MC/DC0%0/3
$^O eq "dgux" and -l ($fullname = "$thispth/lib$thislib$Config_libext") and readlink($fullname) =~ /^elink:/s
$^O eq "dgux" -l ($fullname = "$thispth/lib$thislib$Config_libext") readlink($fullname) =~ /^elink:/s
Truth table25%1/4
A and B and C
A= $^O eq "dgux"B= -l ($fullname = "$thispth/lib$thislib$Config_libext")C= readlink($fullname) =~ /^elink:/s
ABCresult
0XX0
10X0
1100
1111
214 && -l ( $fullname = "$thispth/lib$thislib$Config_libext" )
215 && readlink( $fullname ) =~ /^elink:/s )
216 {
217  
218 # Some of DG's libraries look like misconnected symbolic
219 # links, but development tools can follow them. (They
220 # look like this:
221 #
222 # libm.a -> elink:${SDE_PATH:-/usr}/sde/\
223 # ${TARGET_BINARY_INTERFACE:-m88kdgux}/usr/lib/libm.a
224 #
225 # , the compilation tools expand the environment variables.)
226 }
227 ▶ elsif ( $custom_name && -f ( $fullname = "$thispth/$thislib" ) ) {
Condition33%1/3
$custom_name and -f ($fullname = "$thispth/$thislib")
!ll&&!rl&&r
5900
MC/DC0%0/2
$custom_name and -f ($fullname = "$thispth/$thislib")
$custom_name -f ($fullname = "$thispth/$thislib")
Truth table33%1/3
A and B
A= $custom_nameB= -f ($fullname = "$thispth/$thislib")
ABresult
0X0
100
111
228 }
229 else {
230 59 ▶ warn "$thislib not found in $thispth\n" if $verbose;
Branch: 1 branch
BranchTrueFalseTotal
if $verbose 0 59 59
231 59 next;
232 }
233 5 ▶ warn "'-l$thislib' found at $fullname\n" if $verbose;
Branch: 1 branch
BranchTrueFalseTotal
if $verbose 0 5 5
234 5 ▶ push @libs, $fullname unless $libs_seen{$fullname}++;
Branch: 1 branch
BranchTrueFalseTotal
unless $libs_seen{$fullname}++ 5 0 5
235 5 $found++;
236 5 $found_lib++;
237  
238 # Now update library lists
239  
240 # what do we know about this library...
241 # "Sounds like we should always assume it's a dynamic library on AIX."
242 5 ▶ my $is_dyna = $^O eq 'aix' ? 1 : ( $fullname !~ /\Q$Config_libext\E\z/ );
Branch: 1 branch
BranchTrueFalseTotal
$^O eq 'aix' ? : 0 5 5
243 5 my $in_perl = ( $libs =~ /\B-l:?\Q${thislib}\E\b/s );
244  
245 # include the path to the lib once in the dynamic linker path
246 # but only if it is a dynamic lib and not in Perl itself
247 5 my ( $fullnamedir ) = dirname( $fullname );
248 push @ld_run_path, $fullnamedir
249 if $is_dyna
250 && !$in_perl
251 5 ▶ && !$ld_run_path_seen{$fullnamedir}++;
Branch: 1 branch
BranchTrueFalseTotal
if $is_dyna and not $in_perl and not $ld_run_path_seen{$fullnamedir}++ 5 0 5
Condition33%2/6
$is_dyna and not $in_perl and not $ld_run_path_seen{$fullnamedir}++
!ll&&!rl&&r
005
$is_dyna and not $in_perl
!ll&&!rl&&r
005
MC/DC0%0/3
$is_dyna and not $in_perl and not $ld_run_path_seen{$fullnamedir}++
$is_dyna not $in_perl not $ld_run_path_seen{$fullnamedir}++
Truth table25%1/4
A and not(B) and not(C)
A= $is_dynaB= not $in_perlC= not $ld_run_path_seen{$fullnamedir}++
ABCresult
0XX0
10X0
1100
1111
252  
253 # Do not add it into the list if it is already linked in
254 # with the main perl executable.
255 5 ▶ push( @extralibs, "-l$custom_name$thislib" )
Branch: 1 branch
BranchTrueFalseTotal
unless $in_perl 5 0 5
256 unless $in_perl;
257  
258 5 ▶ if ( $is_dyna ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($is_dyna) { } 5 0 5
259  
260 # For SunOS4, do not add in this shared library if
261 # it is already linked in the main perl executable
262 5 ▶ push( @ldloadlibs, "-l$custom_name$thislib" )
Branch: 1 branch
BranchTrueFalseTotal
unless $in_perl and $^O eq "sunos" 5 0 5
Condition33%1/3
$in_perl and $^O eq "sunos"
!ll&&!rl&&r
500
MC/DC0%0/2
$in_perl and $^O eq "sunos"
$in_perl $^O eq "sunos"
Truth table33%1/3
A and B
A= $in_perlB= $^O eq "sunos"
ABresult
0X0
100
111
263 unless ( $in_perl and $^O eq 'sunos' );
264 }
265 else {
266 0 push( @ldloadlibs, "-l$custom_name$thislib" );
267 }
268 5 last; # found one here so don't bother looking further
269 }
270 15 ▶ warn "Warning (mostly harmless): " . "No library found for -l$thislib\n"
Branch: 1 branch
BranchTrueFalseTotal
unless $found_lib > 0 10 5 15
271 unless $found_lib > 0;
272 }
273  
274 17 ▶ return ( '', '', '', '', ( $give_libs ? \@libs : () ) ) unless $found;
Branch: 2 branches
BranchTrueFalseTotal
unless $found 12 5 17
$give_libs ? : 1 11 12
275 5 ▶ ( "@extralibs", "@bsloadlibs", "@ldloadlibs", join( ":", @ld_run_path ), ( $give_libs ? \@libs : () ) );
Branch: 1 branch
BranchTrueFalseTotal
$give_libs ? : 0 5 5
276 }
277  
278 0 ▶sub _win32_ext {
Subroutine _win32_ext: not called CC=23 SCAR=63.1
279  
280 0 require Text::ParseWords;
281  
282 0 my ( $self, $potential_libs, $verbose, $give_libs ) = @_;
283 0 ▶ $verbose ||= 0;
Condition0%0/2
$verbose ||= 0
l!l
00
MC/DC0%0/1
$verbose ||= 0
$verbose
Truth table0%0/2
A
A= $verbose
Aresult
11
00
284  
285 # If user did not supply a list, we punt.
286 # (caller should probably use the list in $Config{libs})
287 0 ▶ return ( "", "", "", "", ( $give_libs ? [] : () ) ) unless $potential_libs;
Branch: 2 branches
BranchTrueFalseTotal
unless $potential_libs 0 0 0
$give_libs ? : 0 0 0
288  
289 # TODO: make this use MM_Win32.pm's compiler detection
290 0 my %libs_seen;
291 my @extralibs;
292 0 ▶ my $cc = $Config{cc} || '';
Condition0%0/2
$ExtUtils::Liblist::Kid::Config{'cc'} || ''
l!l
00
MC/DC0%0/1
$ExtUtils::Liblist::Kid::Config{'cc'} || ''
$ExtUtils::Liblist::Kid::Config{'cc'}
Truth table0%0/2
A
A= $ExtUtils::Liblist::Kid::Config{'cc'}
Aresult
11
00
293 0 my $VC = $cc =~ /\bcl\b/i;
294 0 my $GC = $cc =~ /\bgcc\b/i;
295  
296 0 my $libext = _win32_lib_extensions();
297 0 my @searchpath = ( '' ); # from "-L/path" entries in $potential_libs
298 0 my @libpath = _win32_default_search_paths( $VC, $GC );
299 0 my $pwd = cwd(); # from Cwd.pm
300 0 my $search = 1;
301  
302 # compute @extralibs from $potential_libs
303 0 my @lib_search_list = _win32_make_lib_search_list( $potential_libs, $verbose );
304 0 for ( @lib_search_list ) {
305  
306 0 my $thislib = $_;
307  
308 # see if entry is a flag
309 0 ▶ if ( /^:\w+$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if (/^:\w+$/) 0 0 0
310 0 ▶ $search = 0 if lc eq ':nosearch';
Branch: 1 branch
BranchTrueFalseTotal
if lc $_ eq ":nosearch" 0 0 0
311 0 ▶ $search = 1 if lc eq ':search';
Branch: 1 branch
BranchTrueFalseTotal
if lc $_ eq ":search" 0 0 0
312 0 ▶ _debug( "Ignoring unknown flag '$thislib'\n", $verbose ) if !/^:(no)?(search|default)$/i;
Branch: 1 branch
BranchTrueFalseTotal
unless /^:(no)?(search|default)$/i 0 0 0
313 0 next;
314 }
315  
316 # if searching is disabled, do compiler-specific translations
317 0 ▶ unless ( $search ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($search) 0 0 0
318 0 ▶ s/^-l(.+)$/$1.lib/ unless $GC;
Branch: 1 branch
BranchTrueFalseTotal
unless $GC 0 0 0
319 0 ▶ s/^-L/-libpath:/ if $VC;
Branch: 1 branch
BranchTrueFalseTotal
if $VC 0 0 0
320 0 push( @extralibs, $_ );
321 0 next;
322 }
323  
324 # handle possible linker path arguments
325 0 ▶ if ( s/^-L// and not -d ) {
Branch: 2 branches
BranchTrueFalseTotal
if (s/^-L// and not -d $_) { } 0 0 0
elsif (-d $_) { } 0 0 0
Condition0%0/3
s/^-L// and not -d $_
!ll&&!rl&&r
000
MC/DC0%0/2
s/^-L// and not -d $_
s/^-L// not -d $_
Truth table0%0/3
A and not(B)
A= s/^-L//B= not -d $_
ABresult
0X0
100
111
326 0 _debug( "$thislib ignored, directory does not exist\n", $verbose );
327 0 next;
328 }
329 elsif ( -d ) {
330 0 ▶ unless ( File::Spec->file_name_is_absolute( $_ ) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ("File::Spec"->file_name_is_absolute($_)) 0 0 0
331 0 warn "Warning: '$thislib' changed to '-L$pwd/$_'\n";
332 0 $_ = $self->catdir( $pwd, $_ );
333 }
334 0 push( @searchpath, $_ );
335 0 next;
336 }
337  
338 0 my @paths = ( @searchpath, @libpath );
339 0 my ( $fullname, $path ) = _win32_search_file( $thislib, $libext, \@paths, $verbose, $GC );
340  
341 0 ▶ if ( !$fullname ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($fullname) 0 0 0
342 0 warn "Warning (mostly harmless): No library found for $thislib\n";
343 0 next;
344 }
345  
346 0 _debug( "'$thislib' found as '$fullname'\n", $verbose );
347 0 push( @extralibs, $fullname );
348 0 ▶ $libs_seen{$fullname} = 1 if $path; # why is this a special case?
Branch: 1 branch
BranchTrueFalseTotal
if $path 0 0 0
349 }
350  
351 0 my @libs = sort keys %libs_seen;
352  
353 0 ▶ return ( '', '', '', '', ( $give_libs ? \@libs : () ) ) unless @extralibs;
Branch: 2 branches
BranchTrueFalseTotal
unless @extralibs 0 0 0
$give_libs ? : 0 0 0
354  
355 # make sure paths with spaces are properly quoted
356 0 @extralibs = map { qq["$_"] } @extralibs;
357 0 @libs = map { qq["$_"] } @libs;
358  
359 0 my $lib = join( ' ', @extralibs );
360  
361 # normalize back to backward slashes (to help braindead tools)
362 # XXX this may break equally braindead GNU tools that don't understand
363 # backslashes, either. Seems like one can't win here. Cursed be CP/M.
364 0 $lib =~ s,/,\\,g;
365  
366 0 _debug( "Result: $lib\n", $verbose );
367 0 ▶ wantarray ? ( $lib, '', $lib, '', ( $give_libs ? \@libs : () ) ) : $lib;
Branch: 2 branches
BranchTrueFalseTotal
wantarray ? : 0 0 0
$give_libs ? : 0 0 0
368 }
369  
370 0 ▶sub _win32_make_lib_search_list {
Subroutine _win32_make_lib_search_list: not called CC=1 SCAR=6.9
371 0 my ( $potential_libs, $verbose ) = @_;
372 0 _debug( "Potential libraries are '$potential_libs':\n", $verbose );
373 0 $potential_libs =~ s,\\,/,g; # normalize to forward slashes
374 0 Text::ParseWords::quotewords( '\s+', 0, $potential_libs );
375 }
376  
377 0 ▶sub _win32_default_search_paths {
Subroutine _win32_default_search_paths: not called CC=7 SCAR=40.3
378 0 my ( $VC, $GC ) = @_;
379  
380 0 ▶ my $libpth = $Config{'libpth'} || '';
Condition0%0/2
$ExtUtils::Liblist::Kid::Config{'libpth'} || ''
l!l
00
MC/DC0%0/1
$ExtUtils::Liblist::Kid::Config{'libpth'} || ''
$ExtUtils::Liblist::Kid::Config{'libpth'}
Truth table0%0/2
A
A= $ExtUtils::Liblist::Kid::Config{'libpth'}
Aresult
11
00
381 0 $libpth =~ s,\\,/,g; # normalize to forward slashes
382  
383 0 my @libpath = _space_dirs_split($libpth);
384 0 push @libpath, "$Config{installarchlib}/CORE"; # add "$Config{installarchlib}/CORE" to default search path
385  
386 0 ▶ push @libpath, split /;/, $ENV{LIB} if $VC and $ENV{LIB};
Branch: 1 branch
BranchTrueFalseTotal
if $VC and $ENV{"LIB"} 0 0 0
Condition0%0/3
$VC and $ENV{"LIB"}
!ll&&!rl&&r
000
MC/DC0%0/2
$VC and $ENV{"LIB"}
$VC $ENV{"LIB"}
Truth table0%0/3
A and B
A= $VCB= $ENV{"LIB"}
ABresult
0X0
100
111
387 0 ▶ push @libpath, split /;/, $ENV{LIBRARY_PATH} if $GC and $ENV{LIBRARY_PATH};
Branch: 1 branch
BranchTrueFalseTotal
if $GC and $ENV{"LIBRARY_PATH"} 0 0 0
Condition0%0/3
$GC and $ENV{"LIBRARY_PATH"}
!ll&&!rl&&r
000
MC/DC0%0/2
$GC and $ENV{"LIBRARY_PATH"}
$GC $ENV{"LIBRARY_PATH"}
Truth table0%0/3
A and B
A= $GCB= $ENV{"LIBRARY_PATH"}
ABresult
0X0
100
111
388 0 ▶ push @libpath, "$ENV{SYSTEMROOT}\\system32" if $ENV{SYSTEMROOT};
Branch: 1 branch
BranchTrueFalseTotal
if $ENV{"SYSTEMROOT"} 0 0 0
389  
390 0 return @libpath;
391 }
392  
393 0 ▶sub _win32_search_file {
Subroutine _win32_search_file: not called CC=5 SCAR=34.0
394 0 my ( $thislib, $libext, $paths, $verbose, $GC ) = @_;
395  
396 0 my @file_list = _win32_build_file_list( $thislib, $GC, $libext );
397  
398 0 for my $lib_file ( @file_list ) {
399 0 for my $path ( @{$paths} ) {
400 0 my $fullname = $lib_file;
401 0 ▶ $fullname = "$path\\$fullname" if $path;
Branch: 1 branch
BranchTrueFalseTotal
if $path 0 0 0
402  
403 0 ▶ return ( $fullname, $path ) if -f $fullname;
Branch: 1 branch
BranchTrueFalseTotal
if -f $fullname 0 0 0
404  
405 0 _debug( "'$thislib' not found as '$fullname'\n", $verbose );
406 }
407 }
408  
409 0 return;
410 }
411  
412 0 ▶sub _win32_build_file_list {
Subroutine _win32_build_file_list: not called CC=1 SCAR=6.9
413 0 my ( $lib, $GC, $extensions ) = @_;
414  
415 0 my @pre_fixed = _win32_build_prefixed_list( $lib, $GC );
416 0 return map _win32_attach_extensions( $_, $extensions ), @pre_fixed;
417 }
418  
419 0 ▶sub _win32_build_prefixed_list {
Subroutine _win32_build_prefixed_list: not called CC=6 SCAR=37.4
420 0 my ( $lib, $GC ) = @_;
421  
422 0 ▶ return $lib if $lib !~ s/^-l//;
Branch: 1 branch
BranchTrueFalseTotal
unless $lib =~ s/^-l// 0 0 0
423 0 ▶ return $lib if $lib =~ /^lib/ and !$GC;
Branch: 1 branch
BranchTrueFalseTotal
if $lib =~ /^lib/ and not $GC 0 0 0
Condition0%0/3
$lib =~ /^lib/ and not $GC
!ll&&!rl&&r
000
MC/DC0%0/2
$lib =~ /^lib/ and not $GC
$lib =~ /^lib/ not $GC
Truth table0%0/3
A and not(B)
A= $lib =~ /^lib/B= not $GC
ABresult
0X0
100
111
424  
425 0 ( my $no_prefix = $lib ) =~ s/^lib//i;
426 0 ▶ $lib = "lib$lib" if $no_prefix eq $lib;
Branch: 1 branch
BranchTrueFalseTotal
if $no_prefix eq $lib 0 0 0
427  
428 0 ▶ return ( $lib, $no_prefix ) if $GC;
Branch: 1 branch
BranchTrueFalseTotal
if $GC 0 0 0
429 0 return ( $no_prefix, $lib );
430 }
431  
432 0 ▶sub _win32_attach_extensions {
Subroutine _win32_attach_extensions: not called CC=1 SCAR=6.9
433 0 my ( $lib, $extensions ) = @_;
434 0 return map _win32_try_attach_extension( $lib, $_ ), @{$extensions};
435 }
436  
437 0 ▶sub _win32_try_attach_extension {
Subroutine _win32_try_attach_extension: not called CC=2 SCAR=17.9
438 0 my ( $lib, $extension ) = @_;
439  
440 0 ▶ return $lib if $lib =~ /\Q$extension\E$/i;
Branch: 1 branch
BranchTrueFalseTotal
if $lib =~ /\Q$extension\E$/i 0 0 0
441 0 return "$lib$extension";
442 }
443  
444 0 ▶sub _win32_lib_extensions {
Subroutine _win32_lib_extensions: not called CC=3 SCAR=24.8
445 0 my @extensions = grep $_, @Config{qw(lib_ext)};
446 0 push @extensions, map ".$_", grep $_, @Config{qw(dlext so)};
447 0 ▶ push @extensions, '.dll.a' if grep { m!^\.a$! } @extensions;
Branch: 1 branch
BranchTrueFalseTotal
if grep {/^\.a$/;} @extensions 0 0 0
448 0 ▶ push @extensions, '.lib' unless grep { m!^\.lib$! } @extensions;
Branch: 1 branch
BranchTrueFalseTotal
unless grep {/^\.lib$/;} @extensions 0 0 0
449 0 return \@extensions;
450 }
451  
452 0 ▶sub _debug {
Subroutine _debug: not called CC=2 SCAR=17.9
453 0 my ( $message, $verbose ) = @_;
454 0 ▶ return if !$verbose;
Branch: 1 branch
BranchTrueFalseTotal
unless $verbose 0 0 0
455 0 warn $message;
456 0 return;
457 }
458  
459 0 ▶sub _vms_ext {
Subroutine _vms_ext: not called CC=62 SCAR=82.7
460 0 my ( $self, $potential_libs, $verbose, $give_libs ) = @_;
461 0 ▶ $verbose ||= 0;
Condition0%0/2
$verbose ||= 0
l!l
00
MC/DC0%0/1
$verbose ||= 0
$verbose
Truth table0%0/2
A
A= $verbose
Aresult
11
00
462  
463 0 my ( @crtls, $crtlstr );
464 0 ▶ @crtls = ( ( $Config{'ldflags'} =~ m-/Debug-i ? $Config{'dbgprefix'} : '' ) . 'PerlShr/Share' );
Branch: 1 branch
BranchTrueFalseTotal
$ExtUtils::Liblist::Kid::Config{'ldflags'} =~ m[/Debug]i ? : 0 0 0
465 0 push( @crtls, grep { not /\(/ } split /\s+/, $Config{'perllibs'} );
466 0 push( @crtls, grep { not /\(/ } split /\s+/, $Config{'libc'} );
467  
468 # In general, we pass through the basic libraries from %Config unchanged.
469 # The one exception is that if we're building in the Perl source tree, and
470 # a library spec could be resolved via a logical name, we go to some trouble
471 # to insure that the copy in the local tree is used, rather than one to
472 # which a system-wide logical may point.
473 0 ▶ if ( $self->{PERL_SRC} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"PERL_SRC"}) 0 0 0
474 0 my ( $locspec, $type );
475 0 foreach my $lib ( @crtls ) {
476 0 ▶ if ( ( $locspec, $type ) = $lib =~ m{^([\w\$-]+)(/\w+)?} and $locspec =~ /perl/i ) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = $lib =~ m[^([\w\$-]+)(/\w+)?] and $locspec =~ /perl/i) 0 0 0
Condition0%0/3
() = $lib =~ m[^([\w\$-]+)(/\w+)?] and $locspec =~ /perl/i
!ll&&!rl&&r
000
MC/DC0%0/2
() = $lib =~ m[^([\w\$-]+)(/\w+)?] and $locspec =~ /perl/i
() = $lib =~ m[^([\w\$-]+)(/\w+)?] $locspec =~ /perl/i
Truth table0%0/3
A and B
A= () = $lib =~ m[^([\w\$-]+)(/\w+)?]B= $locspec =~ /perl/i
ABresult
0X0
100
111
477 0 ▶ if ( lc $type eq '/share' ) { $locspec .= $Config{'exe_ext'}; }
Branch: 2 branches
BranchTrueFalseTotal
if (lc $type eq '/share') { } 0 0 0
elsif (lc $type eq '/library') { } 0 0 0
478 0 elsif ( lc $type eq '/library' ) { $locspec .= $Config{'lib_ext'}; }
479 0 else { $locspec .= $Config{'obj_ext'}; }
480 0 $locspec = $self->catfile( $self->{PERL_SRC}, $locspec );
481 0 ▶ $lib = "$locspec$type" if -e $locspec;
Branch: 1 branch
BranchTrueFalseTotal
if -e $locspec 0 0 0
482 }
483 }
484 }
485 0 ▶ $crtlstr = @crtls ? join( ' ', @crtls ) : '';
Branch: 1 branch
BranchTrueFalseTotal
@crtls ? : 0 0 0
486  
487 0 ▶ unless ( $potential_libs ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($potential_libs) 0 0 0
488 0 ▶ warn "Result:\n\tEXTRALIBS: \n\tLDLOADLIBS: $crtlstr\n" if $verbose;
Branch: 1 branch
BranchTrueFalseTotal
if $verbose 0 0 0
489 0 ▶ return ( '', '', $crtlstr, '', ( $give_libs ? [] : () ) );
Branch: 1 branch
BranchTrueFalseTotal
$give_libs ? : 0 0 0
490 }
491  
492 0 my ( %found, @fndlibs, $ldlib );
493 0 my $cwd = cwd();
494 0 my ( $so, $lib_ext, $obj_ext ) = @Config{ 'so', 'lib_ext', 'obj_ext' };
495  
496 # List of common Unix library names and their VMS equivalents
497 # (VMS equivalent of '' indicates that the library is automatically
498 # searched by the linker, and should be skipped here.)
499 0 my ( @flibs, %libs_seen );
500 0 my %libmap = (
501 'm' => '',
502 'f77' => '',
503 'F77' => '',
504 'V77' => '',
505 'c' => '',
506 'malloc' => '',
507 'crypt' => '',
508 'resolv' => '',
509 'c_s' => '',
510 'socket' => '',
511 'X11' => 'DECW$XLIBSHR',
512 'Xt' => 'DECW$XTSHR',
513 'Xm' => 'DECW$XMLIBSHR',
514 'Xmu' => 'DECW$XMULIBSHR'
515 );
516  
517 0 ▶ warn "Potential libraries are '$potential_libs'\n" if $verbose;
Branch: 1 branch
BranchTrueFalseTotal
if $verbose 0 0 0
518  
519 # First, sort out directories and library names in the input
520 0 my ( @dirs, @libs );
521 0 foreach my $lib ( split ' ', $potential_libs ) {
522 0 ▶ push( @dirs, $1 ), next if $lib =~ /^-L(.*)/;
Branch: 1 branch
BranchTrueFalseTotal
if $lib =~ /^-L(.*)/ 0 0 0
523 0 ▶ push( @dirs, $lib ), next if $lib =~ /[:>\]]$/;
Branch: 1 branch
BranchTrueFalseTotal
if $lib =~ /[:>\]]$/ 0 0 0
524 0 ▶ push( @dirs, $lib ), next if -d $lib;
Branch: 1 branch
BranchTrueFalseTotal
if -d $lib 0 0 0
525 0 ▶ push( @libs, $1 ), next if $lib =~ /^-l(.*)/;
Branch: 1 branch
BranchTrueFalseTotal
if $lib =~ /^-l(.*)/ 0 0 0
526 0 push( @libs, $lib );
527 }
528 0 push( @dirs, split( ' ', $Config{'libpth'} ) );
529  
530 # Now make sure we've got VMS-syntax absolute directory specs
531 # (We don't, however, check whether someone's hidden a relative
532 # path in a logical name.)
533 0 foreach my $dir ( @dirs ) {
534 0 ▶ unless ( -d $dir ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (-d $dir) 0 0 0
535 0 ▶ warn "Skipping nonexistent Directory $dir\n" if $verbose > 1;
Branch: 1 branch
BranchTrueFalseTotal
if $verbose > 1 0 0 0
536 0 $dir = '';
537 0 next;
538 }
539 0 ▶ warn "Resolving directory $dir\n" if $verbose;
Branch: 1 branch
BranchTrueFalseTotal
if $verbose 0 0 0
540 0 ▶ if ( File::Spec->file_name_is_absolute( $dir ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ('File::Spec'->file_name_is_absolute($dir)) { } 0 0 0
541 0 $dir = VMS::Filespec::vmspath( $dir );
542 }
543 else {
544 0 $dir = $self->catdir( $cwd, $dir );
545 }
546 }
547 0 @dirs = grep { length( $_ ) } @dirs;
548 0 unshift( @dirs, '' ); # Check each $lib without additions first
549  
550 0 LIB: foreach my $lib ( @libs ) {
551 0 ▶ if ( exists $libmap{$lib} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $libmap{$lib}) 0 0 0
552 0 ▶ next unless length $libmap{$lib};
Branch: 1 branch
BranchTrueFalseTotal
unless length $libmap{$lib} 0 0 0
553 0 $lib = $libmap{$lib};
554 }
555  
556 0 my ( @variants, $cand );
557 0 my ( $ctype ) = '';
558  
559 # If we don't have a file type, consider it a possibly abbreviated name and
560 # check for common variants. We try these first to grab libraries before
561 # a like-named executable image (e.g. -lperl resolves to perlshr.exe
562 # before perl.exe).
563 0 ▶ if ( $lib !~ /\.[^:>\]]*$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($lib =~ /\.[^:>\]]*$/) 0 0 0
564 0 push( @variants, "${lib}shr", "${lib}rtl", "${lib}lib" );
565 0 ▶ push( @variants, "lib$lib" ) if $lib !~ /[:>\]]/;
Branch: 1 branch
BranchTrueFalseTotal
unless $lib =~ /[:>\]]/ 0 0 0
566 }
567 0 push( @variants, $lib );
568 0 ▶ warn "Looking for $lib\n" if $verbose;
Branch: 1 branch
BranchTrueFalseTotal
if $verbose 0 0 0
569 0 foreach my $variant ( @variants ) {
570 0 my ( $fullname, $name );
571  
572 0 foreach my $dir ( @dirs ) {
573 0 my ( $type );
574  
575 0 $name = "$dir$variant";
576 0 ▶ warn "\tChecking $name\n" if $verbose > 2;
Branch: 1 branch
BranchTrueFalseTotal
if $verbose > 2 0 0 0
577 0 $fullname = VMS::Filespec::rmsexpand( $name );
578 0 ▶ if ( defined $fullname and -f $fullname ) {
Branch: 4 branches
BranchTrueFalseTotal
if (defined $fullname and -f $fullname) { } 0 0 0
elsif (-f ($fullname = VMS::Filespec::rmsexpand($name, $so)) or -f ($fullname = VMS::Filespec::rmsexpand($name, '.exe'))) { } 0 0 0
elsif (not length $ctype and -f ($fullname = VMS::Filespec::rmsexpand($name, $lib_ext)) || -f ($fullname = VMS::Filespec::rmsexpand($name, '.olb'))) { } 0 0 0
elsif (not length $ctype and -f ($fullname = VMS::Filespec::rmsexpand($name, $obj_ext)) || -f ($fullname = VMS::Filespec::rmsexpand($name, '.obj'))) { } 0 0 0
Condition0%0/3
defined $fullname and -f $fullname
!ll&&!rl&&r
000
MC/DC0%0/2
defined $fullname and -f $fullname
defined $fullname -f $fullname
Truth table0%0/3
A and B
A= defined $fullnameB= -f $fullname
ABresult
0X0
100
111
579  
580 # It's got its own suffix, so we'll have to figure out the type
581 0 ▶ if ( $fullname =~ /(?:$so|exe)$/i ) { $type = 'SHR'; }
Branch: 3 branches
BranchTrueFalseTotal
if ($fullname =~ /(?:$so|exe)$/i) { } 0 0 0
elsif ($fullname =~ /(?:$lib_ext|olb)$/i) { } 0 0 0
elsif ($fullname =~ /(?:$obj_ext|obj)$/i) { } 0 0 0
582 0 elsif ( $fullname =~ /(?:$lib_ext|olb)$/i ) { $type = 'OLB'; }
583 elsif ( $fullname =~ /(?:$obj_ext|obj)$/i ) {
584 0 warn "Warning (mostly harmless): " . "Plain object file $fullname found in library list\n";
585 0 $type = 'OBJ';
586 }
587 else {
588 0 warn "Warning (mostly harmless): " . "Unknown library type for $fullname; assuming shared\n";
589 0 $type = 'SHR';
590 }
591 }
592 ▶ elsif (-f ( $fullname = VMS::Filespec::rmsexpand( $name, $so ) )
Condition0%0/3
-f ($fullname = VMS::Filespec::rmsexpand($name, $so)) or -f ($fullname = VMS::Filespec::rmsexpand($name, ".exe"))
l!l&&r!l&&!r
000
MC/DC0%0/2
-f ($fullname = VMS::Filespec::rmsexpand($name, $so)) or -f ($fullname = VMS::Filespec::rmsexpand($name, ".exe"))
-f ($fullname = VMS::Filespec::rmsexpand($name, $so)) -f ($fullname = VMS::Filespec::rmsexpand($name, ".exe"))
Truth table0%0/3
A or B
A= -f ($fullname = VMS::Filespec::rmsexpand($name, $so))B= -f ($fullname = VMS::Filespec::rmsexpand($name, ".exe"))
ABresult
1X1
011
000
593 or -f ( $fullname = VMS::Filespec::rmsexpand( $name, '.exe' ) ) )
594 {
595 0 $type = 'SHR';
596 0 ▶ $name = $fullname unless $fullname =~ /exe;?\d*$/i;
Branch: 1 branch
BranchTrueFalseTotal
unless $fullname =~ /exe;?\d*$/i 0 0 0
597 }
598 ▶ elsif (
Condition0%0/6
not length $ctype and -f ($fullname = VMS::Filespec::rmsexpand($name, $lib_ext)) || -f ($fullname = VMS::Filespec::rmsexpand($name, ".olb"))
!ll&&!rl&&r
000
-f ($fullname = VMS::Filespec::rmsexpand($name, $lib_ext)) or -f ($fullname = VMS::Filespec::rmsexpand($name, ".olb"))
l!l&&r!l&&!r
000
MC/DC0%0/3
not length $ctype and -f ($fullname = VMS::Filespec::rmsexpand($name, $lib_ext)) || -f ($fullname = VMS::Filespec::rmsexpand($name, ".olb"))
not length $ctype -f ($fullname = VMS::Filespec::rmsexpand($name, $lib_ext)) -f ($fullname = VMS::Filespec::rmsexpand($name, ".olb"))
Truth table0%0/4
not(A) and B or C
A= not length $ctypeB= -f ($fullname = VMS::Filespec::rmsexpand($name, $lib_ext))C= -f ($fullname = VMS::Filespec::rmsexpand($name, ".olb"))
ABCresult
0XX0
1000
11X1
1011
599 not length( $ctype ) and # If we've got a lib already,
600 # don't bother
601 ( -f ( $fullname = VMS::Filespec::rmsexpand( $name, $lib_ext ) ) or -f ( $fullname = VMS::Filespec::rmsexpand( $name, '.olb' ) ) )
602 )
603 {
604 0 $type = 'OLB';
605 0 ▶ $name = $fullname unless $fullname =~ /olb;?\d*$/i;
Branch: 1 branch
BranchTrueFalseTotal
unless $fullname =~ /olb;?\d*$/i 0 0 0
606 }
607 ▶ elsif (
Condition0%0/6
not length $ctype and -f ($fullname = VMS::Filespec::rmsexpand($name, $obj_ext)) || -f ($fullname = VMS::Filespec::rmsexpand($name, ".obj"))
!ll&&!rl&&r
000
-f ($fullname = VMS::Filespec::rmsexpand($name, $obj_ext)) or -f ($fullname = VMS::Filespec::rmsexpand($name, ".obj"))
l!l&&r!l&&!r
000
MC/DC0%0/3
not length $ctype and -f ($fullname = VMS::Filespec::rmsexpand($name, $obj_ext)) || -f ($fullname = VMS::Filespec::rmsexpand($name, ".obj"))
not length $ctype -f ($fullname = VMS::Filespec::rmsexpand($name, $obj_ext)) -f ($fullname = VMS::Filespec::rmsexpand($name, ".obj"))
Truth table0%0/4
not(A) and B or C
A= not length $ctypeB= -f ($fullname = VMS::Filespec::rmsexpand($name, $obj_ext))C= -f ($fullname = VMS::Filespec::rmsexpand($name, ".obj"))
ABCresult
0XX0
1000
11X1
1011
608 not length( $ctype ) and # If we've got a lib already,
609 # don't bother
610 ( -f ( $fullname = VMS::Filespec::rmsexpand( $name, $obj_ext ) ) or -f ( $fullname = VMS::Filespec::rmsexpand( $name, '.obj' ) ) )
611 )
612 {
613 0 warn "Warning (mostly harmless): " . "Plain object file $fullname found in library list\n";
614 0 $type = 'OBJ';
615 0 ▶ $name = $fullname unless $fullname =~ /obj;?\d*$/i;
Branch: 1 branch
BranchTrueFalseTotal
unless $fullname =~ /obj;?\d*$/i 0 0 0
616 }
617 0 ▶ if ( defined $type ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $type) 0 0 0
618 0 $ctype = $type;
619 0 $cand = $name;
620 0 ▶ last if $ctype eq 'SHR';
Branch: 1 branch
BranchTrueFalseTotal
if $ctype eq "SHR" 0 0 0
621 }
622 }
623 0 ▶ if ( $ctype ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ctype) 0 0 0
624  
625 0 push @{ $found{$ctype} }, $cand;
626 0 ▶ warn "\tFound as $cand (really $fullname), type $ctype\n"
Branch: 1 branch
BranchTrueFalseTotal
if $verbose > 1 0 0 0
627 if $verbose > 1;
628 0 ▶ push @flibs, $name unless $libs_seen{$fullname}++;
Branch: 1 branch
BranchTrueFalseTotal
unless $libs_seen{$fullname}++ 0 0 0
629 0 next LIB;
630 }
631 }
632 0 warn "Warning (mostly harmless): " . "No library found for $lib\n";
633 }
634  
635 0 ▶ push @fndlibs, @{ $found{OBJ} } if exists $found{OBJ};
Branch: 1 branch
BranchTrueFalseTotal
if exists $found{"OBJ"} 0 0 0
636 0 ▶ push @fndlibs, map { "$_/Library" } @{ $found{OLB} } if exists $found{OLB};
Branch: 1 branch
BranchTrueFalseTotal
if exists $found{"OLB"} 0 0 0
637 0 ▶ push @fndlibs, map { "$_/Share" } @{ $found{SHR} } if exists $found{SHR};
Branch: 1 branch
BranchTrueFalseTotal
if exists $found{"SHR"} 0 0 0
638 0 my $lib = join( ' ', @fndlibs );
639  
640 0 ▶ $ldlib = $crtlstr ? "$lib $crtlstr" : $lib;
Branch: 1 branch
BranchTrueFalseTotal
$crtlstr ? : 0 0 0
641 0 $ldlib =~ s/^\s+|\s+$//g;
642 0 ▶ warn "Result:\n\tEXTRALIBS: $lib\n\tLDLOADLIBS: $ldlib\n" if $verbose;
Branch: 1 branch
BranchTrueFalseTotal
if $verbose 0 0 0
643 0 ▶ wantarray ? ( $lib, '', $ldlib, '', ( $give_libs ? \@flibs : () ) ) : $lib;
Branch: 2 branches
BranchTrueFalseTotal
wantarray ? : 0 0 0
$give_libs ? : 0 0 0
644 }
645  
646 97 1;
« lib/ExtUtils/MakeMaker/version/vpp.pm ↑ Summary lib/ExtUtils/MakeMaker/Locale.pm »