lib/ExtUtils/Liblist/Kid.pm

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