| 1 | package Imager::Probe; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | 1 | ▶ | use 5.006; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 1 | ▶ | use File::Spec; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 1 | ▶ | use Config; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 1 | ▶ | use Cwd (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 1 | ▶ | use File::Temp (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 1 | ▶ | use Carp (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 1 | our $VERSION = "1.012"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 1 | my @alt_transfer = qw/altname incsuffix libbase/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 0 | ▶ | sub probe { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
probe: not called CC=25 SCAR=64.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 0 | my ($class, $req) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 0 | _populate_defaults($req); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 0 | my $name = $req->{name}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 0 | my $result; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 0 | ▶ | if ($req->{code}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 0 | $result = _probe_code($req); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 0 | ▶ | if (!$result && $req->{pkg}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not $result and $req->{"pkg"}
MC/DC0%0/2
not $result and $req->{"pkg"}
not $result
$req->{"pkg"}
Truth table0%0/3
not(A) and B
A= not $resultB= $req->{"pkg"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 0 | $result = _probe_pkg($req); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 0 | ▶ | if (!$result && $req->{inccheck} && ($req->{libcheck} || $req->{libbase})) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/9
not $result and $req->{"inccheck"} and $req->{"libcheck"} || $req->{"libbase"}
not $result and $req->{"inccheck"}
$req->{"libcheck"} or $req->{"libbase"}
MC/DC0%0/4
not $result and $req->{"inccheck"} and $req->{"libcheck"} || $req->{"libbase"}
not $result
$req->{"inccheck"}
$req->{"libcheck"}
$req->{"libbase"}
Truth table0%0/5
not(A) and B and C or D
A= not $resultB= $req->{"inccheck"}C= $req->{"libcheck"}D= $req->{"libbase"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 0 | ▶ | $req->{altname} ||= "main"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$req->{"altname"} ||= "main"
MC/DC0%0/1
$req->{"altname"} ||= "main"
$req->{"altname"}
Truth table0%0/2
A
A= $req->{"altname"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 0 | $result = _probe_check($req); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 0 | ▶ | if ($result && $req->{testcode}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$result and $req->{"testcode"}
MC/DC0%0/2
$result and $req->{"testcode"}
$result
$req->{"testcode"}
Truth table0%0/3
A and B
A= $resultB= $req->{"testcode"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 0 | $result = _probe_test($req, $result); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 0 | ▶ | if (!$result && $req->{alternatives}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not $result and $req->{"alternatives"}
MC/DC0%0/2
not $result and $req->{"alternatives"}
not $result
$req->{"alternatives"}
Truth table0%0/3
not(A) and B
A= not $resultB= $req->{"alternatives"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 0 | ALTCHECK: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | my $index = 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 0 | for my $alt (@{$req->{alternatives}}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 0 | ▶ | $req->{altname} = $alt->{altname} || "alt $index"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$alt->{'altname'} || "alt $index"
MC/DC0%0/1
$alt->{'altname'} || "alt $index"
$alt->{'altname'}
Truth table0%0/2
A
A= $alt->{'altname'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | $req->{verbose} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 0 | ▶ | and print "$req->{name}: Trying alternative $index\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 0 | my %work = %$req; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 0 | for my $key (@alt_transfer) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 0 | ▶ | exists $alt->{$key} and $work{$key} = $alt->{$key}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 0 | $result = _probe_check(\%work); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 0 | ▶ | if ($result && $req->{testcode}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$result and $req->{"testcode"}
MC/DC0%0/2
$result and $req->{"testcode"}
$result
$req->{"testcode"}
Truth table0%0/3
A and B
A= $resultB= $req->{"testcode"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 0 | $result = _probe_test(\%work, $result); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | $result | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 0 | ▶ | and last; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 0 | ++$index; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 0 | ▶ | if (!$result && $req->{testcode}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not $result and $req->{"testcode"}
MC/DC0%0/2
not $result and $req->{"testcode"}
not $result
$req->{"testcode"}
Truth table0%0/3
not(A) and B
A= not $resultB= $req->{"testcode"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 0 | $result = _probe_fake($req); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 0 | ▶ | $result or return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 0 | $result = _probe_test($req, $result); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | 0 | ▶ | $result or return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | 0 | return $result; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 1 | my @default_argv_names = | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | qw(ccflags optimize cc ldflags) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 0 | ▶ | sub _populate_defaults { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_populate_defaults: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 0 | my ($req) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 0 | ▶ | $req->{verbose} ||= $ENV{IM_VERBOSE}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$req->{"verbose"} ||= $ENV{"IM_VERBOSE"}
MC/DC0%0/2
$req->{"verbose"} ||= $ENV{"IM_VERBOSE"}
$req->{"verbose"}
$ENV{"IM_VERBOSE"}
Truth table0%0/3
A ||= B
A= $req->{"verbose"}B= $ENV{"IM_VERBOSE"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 0 | my %names = map {; $_ => 1 } @default_argv_names; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 0 | @$req{@default_argv_names} = @Config{@default_argv_names}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 0 | for my $arg (@ARGV) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 0 | ▶ | if ($arg =~ /^\U\Q$arg\E=(.*)$/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 0 | $req->{$arg} = $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 0 | ▶ | sub _probe_code { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_probe_code: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 0 | my ($req) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 0 | my $code = $req->{code}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | 0 | ▶ | my @probes = ref $code eq "ARRAY" ? @$code : $code; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 0 | my $result; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 0 | for my $probe (@probes) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 0 | ▶ | $result = $probe->($req) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | and return $result; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 0 | ▶ | sub is_exe { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_exe: not called CC=6 SCAR=37.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | 0 | my ($name) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 0 | my @exe_suffix = $Config{_exe}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 0 | ▶ | if ($^O eq 'MSWin32') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 0 | push @exe_suffix, qw/.bat .cmd/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | elsif ($^O eq 'cygwin') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 0 | push @exe_suffix, ""; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 0 | for my $dir (File::Spec->path) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 0 | for my $suffix (@exe_suffix) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 0 | ▶ | -x File::Spec->catfile($dir, "$name$suffix") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | and return 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | 0 | ▶ | sub _probe_pkg { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_probe_pkg: not called CC=16 SCAR=56.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 0 | my ($req) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | # Setup pkg-config's environment variable to search non-standard paths | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | # which may be provided by --libdirs. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 0 | my @pkgcfg_paths = map { "$_/pkgconfig" } _lib_paths( $req ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | 0 | ▶ | unshift @pkgcfg_paths, $ENV{ 'PKG_CONFIG_PATH' } if $ENV{ 'PKG_CONFIG_PATH' }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | 0 | local $ENV{ 'PKG_CONFIG_PATH' } = join $Config{path_sep}, @pkgcfg_paths; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | 0 | ▶ | print "PKG_CONFIG_PATH=$ENV{PKG_CONFIG_PATH}\n" if $req->{verbose}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 0 | ▶ | is_exe('pkg-config') or return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 0 | ▶ | my $redir = $^O eq 'MSWin32' ? '' : '2>/dev/null'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | 0 | my @pkgs = @{$req->{pkg}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 0 | for my $pkg (@pkgs) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 0 | ▶ | if (!system("pkg-config $pkg --exists $redir")) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | # if we find it, but the following fail, then pkg-config is too | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | # broken to be useful | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 0 | ▶ | my $cflags = `pkg-config $pkg --cflags` | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
my $cflags = `pkg-config $pkg --cflags` and not $?
MC/DC0%0/2
my $cflags = `pkg-config $pkg --cflags` and not $?
my $cflags = `pkg-config $pkg --cflags`
not $?
Truth table0%0/3
A and not(B)
A= my $cflags = `pkg-config $pkg --cflags`B= not $?
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | and !$? or return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | 0 | ▶ | my $lflags = `pkg-config $pkg --libs` | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
my $lflags = `pkg-config $pkg --libs` and not $?
MC/DC0%0/2
my $lflags = `pkg-config $pkg --libs` and not $?
my $lflags = `pkg-config $pkg --libs`
not $?
Truth table0%0/3
A and not(B)
A= my $lflags = `pkg-config $pkg --libs`B= not $?
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | and !$? or return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 0 | my $defines = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 0 | $cflags =~ s/(-D\S+)/$defines .= " $1"; ''/ge; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 0 | chomp $cflags; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | 0 | chomp $lflags; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | 0 | print "$req->{name}: Found via pkg-config $pkg\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 0 | ▶ | print <<EOS if $req->{verbose}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | cflags: $cflags | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | defines: $defines | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | lflags: $lflags | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | EOS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | # rt 75869 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | # if Win32 doesn't provide this information, too bad | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | 0 | ▶ | if (!grep(/^-L/, split " ", $lflags) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not grep(/^-L/, split(' ', $lflags, 0)) and $^O ne "MSWin32"
MC/DC0%0/2
not grep(/^-L/, split(' ', $lflags, 0)) and $^O ne "MSWin32"
not grep(/^-L/, split(' ', $lflags, 0))
$^O ne "MSWin32"
Truth table0%0/3
not(A) and B
A= not grep(/^-L/, split(' ', $lflags, 0))B= $^O ne "MSWin32"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | && $^O ne 'MSWin32') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | # pkg-config told us about the library, make sure it's | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | # somewhere EU::MM can find it | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | 0 | ▶ | print "Checking if EU::MM can find $lflags\n" if $req->{verbose}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | my ($extra, $bs_load, $ld_load, $ld_run_path) = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | 0 | ExtUtils::Liblist->ext($lflags, $req->{verbose}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | 0 | ▶ | unless ($ld_run_path) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | # search our standard places | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 0 | $lflags = _resolve_libs($req, $lflags); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | return | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | 0 | INC => $cflags, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | LIBS => $lflags, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | DEFINE => $defines, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | 0 | print "$req->{name}: Not found via pkg-config\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | 0 | ▶ | sub _is_msvc { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_is_msvc: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | 0 | return $Config{cc} eq "cl"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | 0 | ▶ | sub _lib_basename { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_lib_basename: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | 0 | my ($base) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | 0 | ▶ | if (_is_msvc()) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | 0 | return $base; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | 0 | return "lib$base"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | 0 | ▶ | sub _lib_option { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_lib_option: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | 0 | my ($base) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | 0 | ▶ | if (_is_msvc()) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | 0 | return $base . $Config{_a}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | 0 | return "-l$base"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | 0 | ▶ | sub _quotearg { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_quotearg: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | 0 | my ($opt) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | 0 | ▶ | return $opt =~ /\s/ ? qq("$opt") : $opt; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | 0 | ▶ | sub _probe_check { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_probe_check: not called CC=25 SCAR=64.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | 0 | my ($req) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | 0 | my @libcheck; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | my @libbase; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | 0 | ▶ | if ($req->{libcheck}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | 0 | ▶ | if (ref $req->{libcheck} eq "ARRAY") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | 0 | push @libcheck, @{$req->{libcheck}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | 0 | push @libcheck, $req->{libcheck}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | elsif ($req->{libbase}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | 0 | ▶ | @libbase = ref $req->{libbase} ? @{$req->{libbase}} : $req->{libbase}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | 0 | my $lext=$Config{'so'}; # Get extensions of libraries | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | 0 | my $aext=$Config{'_a'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | 0 | for my $libbase (@libbase) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | 0 | my $basename = _lib_basename($libbase); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | 0 | ▶ | push @libcheck, sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | 0 | ▶ | -e File::Spec->catfile($_[0], "$basename$aext") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | || -e File::Spec->catfile($_[0], "$basename.$lext") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | 0 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | print "$req->{name}: No libcheck or libbase, nothing to search for\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | 0 | ▶ | if $req->{verbose}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | 0 | my @found_libpath; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | 0 | my @lib_search = _lib_paths($req); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | print "$req->{name}: Searching directories for libraries:\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | 0 | ▶ | if $req->{verbose}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | 0 | for my $libcheck (@libcheck) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | 0 | for my $path (@lib_search) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | 0 | ▶ | print "$req->{name}: $path\n" if $req->{verbose}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | 0 | ▶ | if ($libcheck->($path)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | 0 | ▶ | print "$req->{name}: Found!\n" if $req->{verbose}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | 0 | push @found_libpath, $path; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | 0 | my $found_incpath; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | 0 | my $inccheck = $req->{inccheck}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | 0 | my @inc_search = _inc_paths($req); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | print "$req->{name}: Searching directories for headers:\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | 0 | ▶ | if $req->{verbose}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | 0 | for my $path (@inc_search) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | 0 | ▶ | print "$req->{name}: $path\n" if $req->{verbose}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | 0 | ▶ | if ($inccheck->($path)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | 0 | ▶ | print "$req->{name}: Found!\n" if $req->{verbose}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | 0 | $found_incpath = $path; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | 0 | my $alt = ""; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | 0 | ▶ | if ($req->{altname}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | 0 | $alt = " $req->{altname}:"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | 0 | ▶ | print "$req->{name}:$alt includes ", $found_incpath ? "" : "not ", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | "found - libraries ", @found_libpath == @libcheck ? "" : "not ", "found\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | 0 | ▶ | @found_libpath == @libcheck && $found_incpath | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
@found_libpath == @libcheck and $found_incpath
MC/DC0%0/2
@found_libpath == @libcheck and $found_incpath
@found_libpath == @libcheck
$found_incpath
Truth table0%0/3
A and B
A= @found_libpath == @libcheckB= $found_incpath
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | or return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | 0 | my @libs = map "-L$_", @found_libpath; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | 0 | ▶ | if ($req->{libopts}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | 0 | push @libs, $req->{libopts}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | elsif (@libbase) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | 0 | push @libs, map _lib_option($_), @libbase; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | 0 | die "$req->{altname}: inccheck but no libbase or libopts"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | return | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | 0 | INC => _quotearg("-I$found_incpath"), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | LIBS => join(" ", map _quotearg($_), @libs), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | DEFINE => "", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | 0 | ▶ | sub _probe_fake { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_probe_fake: not called CC=7 SCAR=40.3
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | 0 | my ($req) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | # the caller provided test code, and the compiler may look in | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | # places we don't, see Imager-Screenshot ticket 56793, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | # so fake up a result so the test code can | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | 0 | my $lopts; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | 0 | ▶ | if ($req->{libopts}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | 0 | $lopts = $req->{libopts}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | elsif (defined $req->{libbase}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | # might not need extra libraries, eg. Win32 perl already links | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | # everything | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | my @libs = $req->{libbase} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | 0 | ? ( ref $req->{libbase} ? @{$req->{libbase}} : $req->{libbase} ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | 0 | ▶ | : (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | 0 | $lopts = join " ", map _lib_option($_), @libs; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | 0 | ▶ | if (defined $lopts) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | 0 | print "$req->{name}: Checking if the compiler can find them on its own\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | return | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | 0 | INC => "", | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | LIBS => $lopts, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | DEFINE => "", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | print "$req->{name}: Can't fake it - no libbase or libopts\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | 0 | ▶ | if $req->{verbose}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | 0 | ▶ | sub _probe_test { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_probe_test: not called CC=7 SCAR=40.3
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | 0 | my ($req, $result) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | # setup LD_RUN_PATH to match link time | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | 0 | ▶ | print "Asking liblist for LD_RUN_PATH:\n" if $req->{verbose}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | my ($extra, $bs_load, $ld_load, $ld_run_path) = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | 0 | ExtUtils::Liblist->ext($result->{LIBS}, $req->{verbose}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | 0 | local $ENV{LD_RUN_PATH}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | 0 | ▶ | if ($ld_run_path) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | print "Setting LD_RUN_PATH=$ld_run_path for $req->{name} probe\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | 0 | ▶ | if $req->{verbose}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | 0 | $ENV{LD_RUN_PATH} = $ld_run_path; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | 0 | ▶ | if ($Config{lddlflags} =~ /([^ ]*-(?:rpath|R)[,=]?)([^ ]+)/ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$Imager::Probe::Config{"lddlflags"} =~ /([^ ]*-(?:rpath|R)[,=]?)([^ ]+)/ and -d $2
MC/DC0%0/2
$Imager::Probe::Config{"lddlflags"} =~ /([^ ]*-(?:rpath|R)[,=]?)([^ ]+)/ and -d $2
$Imager::Probe::Config{"lddlflags"} =~ /([^ ]*-(?:rpath|R)[,=]?)([^ ]+)/
-d $2
Truth table0%0/3
A and B
A= $Imager::Probe::Config{"lddlflags"} =~ /([^ ]*-(?:rpath|R)[,=]?)([^ ]+)/B= -d $2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | && -d $2) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | # hackety, hackety | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | # LD_RUN_PATH is ignored when there's already an -rpath option | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | # so provide one | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | 0 | my $prefix = $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | $result->{LDDLFLAGS} = $Config{lddlflags} . " " . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | 0 | join " ", map "$prefix$_", split $Config{path_sep}, $ld_run_path; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | my $good = _check_lib( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | $req, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | LIBS => $result->{LIBS}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | INC => $result->{INC}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | header => $req->{testcodeheaders}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | function => $req->{testcode}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | prologue => $req->{testcodeprologue}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | 0 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | 0 | ▶ | unless ($good) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | 0 | print "$req->{name}: Test code failed: $@"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | 0 | print "$req->{name}: Passed code check\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | 0 | return $result; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | 0 | ▶ | sub _check_lib { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_check_lib: not called CC=6 SCAR=37.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | 0 | my ($req, %args) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | 0 | my $code = ""; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | 0 | ▶ | if (my $hdrs = $args{header}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | 0 | ▶ | ref $hdrs or $hdrs = [ $hdrs ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | 0 | $code .= "#include <$_>\n" for @$hdrs; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | 0 | ▶ | $code .= $args{prologue} if $args{prologue}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | 0 | ▶ | $args{function} or Carp::confess "Missing function"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | 0 | $code .= "int main(int argc, char **argv) {\n$args{function}\n}\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | return _try_compile_and_link | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | $code, $req, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | name => $req->{name}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | ccflags => $args{INC}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | run => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | libs => $args{LIBS}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | 0 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | 0 | ▶ | sub _resolve_libs { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_resolve_libs: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | 0 | my ($req, $lflags) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | 0 | my @libs = grep /^-l/, split ' ', $lflags; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | 0 | my %paths; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | 0 | my @paths = _lib_paths($req); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | 0 | my $so = $Config{so}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | 0 | my $libext = $Config{_a}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | 0 | for my $lib (@libs) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | 0 | $lib =~ s/^-l/lib/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | 0 | for my $path (@paths) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | 0 | ▶ | if (-e "$path/$lib.$so" || -e "$path/$lib$libext") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
-e "$path/$lib.$so" or -e "$path/$lib$libext"
MC/DC0%0/2
-e "$path/$lib.$so" or -e "$path/$lib$libext"
-e "$path/$lib.$so"
-e "$path/$lib$libext"
Truth table0%0/3
A or B
A= -e "$path/$lib.$so"B= -e "$path/$lib$libext"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | 0 | $paths{$path} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | 0 | return join(" ", ( map "-L$_", keys %paths ), $lflags ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | 0 | ▶ | sub _lib_paths { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_lib_paths: not called CC=11 SCAR=48.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | 0 | my ($req) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | print "$req->{name} IM_LIBPATH: $ENV{IM_LIBPATH}\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | 0 | ▶ | if $req->{verbose} && defined $ENV{IM_LIBPATH}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$req->{"verbose"} and defined $ENV{"IM_LIBPATH"}
MC/DC0%0/2
$req->{"verbose"} and defined $ENV{"IM_LIBPATH"}
$req->{"verbose"}
defined $ENV{"IM_LIBPATH"}
Truth table0%0/3
A and B
A= $req->{"verbose"}B= defined $ENV{"IM_LIBPATH"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | print "$req->{name} LIB: $ENV{IM_LIBPATH}\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | 0 | ▶ | if $req->{verbose} && defined $ENV{LIB} && $^O eq "MSWin32"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$req->{"verbose"} and defined $ENV{"LIB"} and $^O eq "MSWin32"
$req->{"verbose"} and defined $ENV{"LIB"}
MC/DC0%0/3
$req->{"verbose"} and defined $ENV{"LIB"} and $^O eq "MSWin32"
$req->{"verbose"}
defined $ENV{"LIB"}
$^O eq "MSWin32"
Truth table0%0/4
A and B and C
A= $req->{"verbose"}B= defined $ENV{"LIB"}C= $^O eq "MSWin32"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | 0 | my $lp = $req->{libpath}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | print "$req->{name} libpath: ", ref $lp ? join($Config{path_sep}, @$lp) : $lp, "\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | 0 | ▶ | if $req->{verbose} && defined $lp; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/3
$req->{"verbose"} and defined $lp
MC/DC0%0/2
$req->{"verbose"} and defined $lp
$req->{"verbose"}
defined $lp
Truth table0%0/3
A and B
A= $req->{"verbose"}B= defined $lp
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | return _paths | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | $ENV{IM_LIBPATH}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | $req->{libpath}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | 0 | ▶ | map { split ' ' } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | grep $_, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | @Config{qw/loclibpth libpth libspath/} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 450 | ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 451 | 0 | $^O eq "MSWin32" ? $ENV{LIB} : "", | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 452 | $^O eq "cygwin" ? "/usr/lib/w32api" : "", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 453 | "/usr/lib", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 454 | "/usr/local/lib", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 455 | _gcc_lib_paths(), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 456 | _dyn_lib_paths(), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 457 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 458 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 459 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 460 | 0 | ▶ | sub _gcc_lib_paths { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_gcc_lib_paths: not called CC=6 SCAR=37.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 461 | $Config{gccversion} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 462 | 0 | ▶ | or return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 463 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 464 | 0 | ▶ | my ($base_version) = $Config{gccversion} =~ /^([0-9]+)/ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 465 | or return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 466 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 467 | 0 | ▶ | $base_version >= 4 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 468 | or return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 469 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 470 | 0 | local $ENV{LANG} = "C"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 471 | 0 | local $ENV{LC_ALL} = "C"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 472 | 0 | ▶ | my ($lib_line) = grep /^libraries:/, `$Config{cc} -print-search-dirs` | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 473 | or return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 474 | 0 | $lib_line =~ s/^libraries: =//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 475 | 0 | chomp $lib_line; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 476 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 477 | 0 | ▶ | return grep !/gcc/ && -d, split /:/, $lib_line; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
!/gcc/ && -d $_
MC/DC0%0/2
!/gcc/ && -d $_
!/gcc/
-d $_
Truth table0%0/3
not(A) && B
A= !/gcc/B= -d $_
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 478 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 479 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 480 | 0 | ▶ | sub _dyn_lib_paths { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_dyn_lib_paths: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 481 | 0 | ▶ | return map { defined() ? split /\Q$Config{path_sep}/ : () } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 482 | 0 | map $ENV{$_}, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 483 | qw(LD_RUN_PATH LD_LIBRARY_PATH DYLD_LIBRARY_PATH LIBRARY_PATH); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 484 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 485 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 486 | 0 | ▶ | sub _inc_paths { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_inc_paths: not called CC=12 SCAR=50.5
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 487 | 0 | my ($req) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 488 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 489 | print "$req->{name} IM_INCPATH: $ENV{IM_INCPATH}\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 490 | 0 | ▶ | if $req->{verbose} && defined $ENV{IM_INCPATH}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$req->{"verbose"} and defined $ENV{"IM_INCPATH"}
MC/DC0%0/2
$req->{"verbose"} and defined $ENV{"IM_INCPATH"}
$req->{"verbose"}
defined $ENV{"IM_INCPATH"}
Truth table0%0/3
A and B
A= $req->{"verbose"}B= defined $ENV{"IM_INCPATH"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 491 | print "$req->{name} INCLUDE: $ENV{INCLUDE}\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 492 | 0 | ▶ | if $req->{verbose} && defined $ENV{INCLUDE} && $^O eq "MSWin32"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$req->{"verbose"} and defined $ENV{"INCLUDE"} and $^O eq "MSWin32"
$req->{"verbose"} and defined $ENV{"INCLUDE"}
MC/DC0%0/3
$req->{"verbose"} and defined $ENV{"INCLUDE"} and $^O eq "MSWin32"
$req->{"verbose"}
defined $ENV{"INCLUDE"}
$^O eq "MSWin32"
Truth table0%0/4
A and B and C
A= $req->{"verbose"}B= defined $ENV{"INCLUDE"}C= $^O eq "MSWin32"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 493 | 0 | my $ip = $req->{incpath}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 494 | print "$req->{name} incpath: ", ref $ip ? join($Config{path_sep}, @$ip) : $ip, "\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 495 | 0 | ▶ | if $req->{verbose} && defined $req->{incpath}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/3
$req->{"verbose"} and defined $req->{"incpath"}
MC/DC0%0/2
$req->{"verbose"} and defined $req->{"incpath"}
$req->{"verbose"}
defined $req->{"incpath"}
Truth table0%0/3
A and B
A= $req->{"verbose"}B= defined $req->{"incpath"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 496 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 497 | my @paths = _paths | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 498 | ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 499 | $ENV{IM_INCPATH}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 500 | $req->{incpath}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 501 | $^O eq "MSWin32" ? $ENV{INCLUDE} : "", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 502 | $^O eq "cygwin" ? "/usr/include/w32api" : "", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 503 | ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 504 | 0 | map { split ' ' } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 505 | grep $_, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 506 | 0 | ▶ | @Config{qw/locincpth incpath/} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 507 | ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 508 | "/usr/include", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 509 | "/usr/local/include", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 510 | _gcc_inc_paths(), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 511 | _dyn_inc_paths(), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 512 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 513 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 514 | 0 | ▶ | if ($req->{incsuffix}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 515 | 0 | @paths = map File::Spec->catdir($_, $req->{incsuffix}), @paths; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 516 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 517 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 518 | 0 | return @paths; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 519 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 520 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 521 | 0 | ▶ | sub _gcc_inc_paths { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_gcc_inc_paths: not called CC=10 SCAR=47.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 522 | $Config{gccversion} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 523 | 0 | ▶ | or return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 524 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 525 | 0 | ▶ | my ($base_version) = $Config{gccversion} =~ /^([0-9]+)/ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 526 | or return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 527 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 528 | 0 | ▶ | $base_version >= 4 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 529 | or return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 530 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 531 | 0 | local $ENV{LANG} = "C"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 532 | 0 | local $ENV{LC_ALL} = "C"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 533 | 0 | my $devnull = File::Spec->devnull; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 534 | 0 | my @spam = `$Config{cc} -E -v - <$devnull 2>&1`; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 535 | # output includes lines like: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 536 | # ... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 537 | # ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../../x86_64-linux-gnu/include" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 538 | # #include "..." search starts here: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 539 | # #include <...> search starts here: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 540 | # /usr/lib/gcc/x86_64-linux-gnu/4.9/include | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 541 | # /usr/local/include | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 542 | # /usr/lib/gcc/x86_64-linux-gnu/4.9/include-fixed | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 543 | # /usr/include/x86_64-linux-gnu | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 544 | # /usr/include | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 545 | # End of search list. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 546 | # # 1 "<stdin>" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 547 | # # 1 "<built-in>" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 548 | # ... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 549 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 550 | 0 | ▶ | while (@spam && $spam[0] !~ /^#include /) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
@spam and not $spam[0] =~ /^#include /
MC/DC0%0/2
@spam and not $spam[0] =~ /^#include /
@spam
not $spam[0] =~ /^#include /
Truth table0%0/3
A and not(B)
A= @spamB= not $spam[0] =~ /^#include /
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 551 | 0 | shift @spam; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 552 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 553 | 0 | my @inc; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 554 | 0 | ▶ | while (@spam && $spam[0] !~ /^End of search/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
@spam and not $spam[0] =~ /^End of search/
MC/DC0%0/2
@spam and not $spam[0] =~ /^End of search/
@spam
not $spam[0] =~ /^End of search/
Truth table0%0/3
A and not(B)
A= @spamB= not $spam[0] =~ /^End of search/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 555 | 0 | my $line = shift @spam; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 556 | 0 | chomp $line; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 557 | 0 | ▶ | next if $line =~ /^#include /; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 558 | 0 | ▶ | next unless $line =~ s/^\s+//; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 559 | 0 | push @inc, $line; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 560 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 561 | 0 | return @inc; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 562 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 563 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 564 | 0 | ▶ | sub _dyn_inc_paths { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_dyn_inc_paths: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 565 | return map { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 566 | 0 | my $tmp = $_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 567 | 0 | ▶ | $tmp =~ s/\blib$/include/ ? $tmp : () | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 568 | } _dyn_lib_paths(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 569 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 570 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 571 | 0 | ▶ | sub _paths { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_paths: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 572 | 0 | my (@in) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 573 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 574 | 0 | my @out; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 575 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 576 | # expand any array refs | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 577 | 0 | ▶ | @in = map { ref() ? @$_ : $_ } @in; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 578 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 579 | 0 | for my $path (@in) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 580 | 0 | ▶ | $path or next; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 581 | 0 | $path = _tilde_expand($path); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 582 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 583 | 0 | push @out, grep -d $_, split /\Q$Config{path_sep}/, $path; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 584 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 585 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 586 | 0 | @out = map Cwd::realpath($_), @out; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 587 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 588 | 0 | my %seen; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 589 | 0 | @out = grep !$seen{$_}++, @out; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 590 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 591 | 0 | return @out; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 592 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 593 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 594 | 1 | my $home; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 595 | 0 | ▶ | sub _tilde_expand { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_tilde_expand: not called CC=9 SCAR=45.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 596 | 0 | my ($path) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 597 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 598 | 0 | ▶ | if ($path =~ m!^~[/\\]!) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 599 | 0 | ▶ | defined $home or $home = $ENV{HOME}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 600 | 0 | ▶ | if (!defined $home && $^O eq 'MSWin32' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/9
not defined $home and $^O eq "MSWin32" and defined $ENV{"HOMEDRIVE"} and defined $ENV{"HOMEPATH"}
not defined $home and $^O eq "MSWin32" and defined $ENV{"HOMEDRIVE"}
not defined $home and $^O eq "MSWin32"
MC/DC0%0/4
not defined $home and $^O eq "MSWin32" and defined $ENV{"HOMEDRIVE"} and defined $ENV{"HOMEPATH"}
not defined $home
$^O eq "MSWin32"
defined $ENV{"HOMEDRIVE"}
defined $ENV{"HOMEPATH"}
Truth table0%0/5
not(A) and B and C and D
A= not defined $homeB= $^O eq "MSWin32"C= defined $ENV{"HOMEDRIVE"}D= defined $ENV{"HOMEPATH"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 601 | && defined $ENV{HOMEDRIVE} && defined $ENV{HOMEPATH}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 602 | 0 | $home = $ENV{HOMEDRIVE} . $ENV{HOMEPATH}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 603 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 604 | 0 | ▶ | unless (defined $home) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 605 | 0 | $home = eval { (getpwuid($<))[7] }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 606 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 607 | 0 | ▶ | defined $home or die "You supplied $path, but I can't find your home directory\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 608 | 0 | $path =~ s/^~//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 609 | 0 | $path = File::Spec->catdir($home, $path); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 610 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 611 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 612 | 0 | return $path; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 613 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 614 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 615 | 0 | ▶ | sub _tcal_state { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_tcal_state: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 616 | 0 | my ($req) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 617 | 0 | my %state; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 618 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 619 | 0 | ▶ | $state{start_dir} = Cwd::getcwd() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 620 | or die "Cannot save current directory: $!\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 621 | 0 | $state{keep} = !!$ENV{IMAGER_PROBE_KEEP_FILES}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 622 | $state{tmpdir} = File::Temp->newdir(CLEANUP => !$state{keep}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 623 | 0 | ▶ | or Carp::confess("panic: cannot create temp directory"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 624 | 0 | $state{num} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 625 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 626 | 0 | \%state; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 627 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 628 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 629 | 0 | ▶ | sub _sort_std { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_sort_std: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 630 | 0 | my @stds = grep defined, @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 631 | # we don't support -std=iso9899:1999 etc | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 632 | 0 | ▶ | my $std_map = sub { my $std = shift; return $std > 80 ? $std-100 : $std }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 633 | 0 | return sort { $std_map->($b) <=> $std_map->($a) } grep defined, @stds; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 634 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 635 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 636 | # _try_compile_and_link | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 637 | # adapted from Time::HiRes and then adapted some more. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 638 | # This is not part of the Imager::Probe API | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 639 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 640 | # $code - code to test | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 641 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 642 | # %args - options to control this test | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 643 | # name - required description of what we're testing, used for verbose | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 644 | # cc - optional C compiler (overrides $req->{cc} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 645 | # ccflags - optional extra compiler flags | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 646 | # ccflags_only - only use ccflags and don't use $req->{ccflags} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 647 | # libs - extra libraries to link to | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 648 | # std - C standard, needs stdflag set in $req per by probe_std() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 649 | # nolink - only test compilation success | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 650 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 651 | # $req contains probing state, used here: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 652 | # verbose - print messages if true | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 653 | # stdflag - compiler option used to select a C standard, by probe_std | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 654 | # minstd - minimum standard (default: 99) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 655 | # ccflags - base ccflags | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 656 | # cc - base cc | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 657 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 658 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 659 | 0 | ▶ | sub _try_compile_and_link { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_try_compile_and_link: not called CC=32 SCAR=69.6
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 660 | 0 | my ($code, $req, %args) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 661 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 662 | 0 | ▶ | my $verbose = $req->{verbose} || 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$req->{'verbose'} || 0
MC/DC0%0/1
$req->{'verbose'} || 0
$req->{'verbose'}
Truth table0%0/2
A
A= $req->{'verbose'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 663 | 0 | ▶ | my $indent = $req->{indent} || ""; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$req->{'indent'} || ''
MC/DC0%0/1
$req->{'indent'} || ''
$req->{'indent'}
Truth table0%0/2
A
A= $req->{'indent'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 664 | my $name = $args{name} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 665 | 0 | ▶ | or Carp::confess("panic: no name supplied to _try_compile_and_link"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 666 | 0 | ▶ | my $state = $req->{tcal_state} ||= _tcal_state($req); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$req->{"tcal_state"} ||= _tcal_state($req)
MC/DC0%0/2
$req->{"tcal_state"} ||= _tcal_state($req)
$req->{"tcal_state"}
_tcal_state($req)
Truth table0%0/3
A ||= B
A= $req->{"tcal_state"}B= _tcal_state($req)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 667 | chdir $state->{tmpdir} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 668 | 0 | ▶ | or die "Cannot chdir to $state->{tmpdir}: $!"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 669 | 0 | my $ok = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 670 | 0 | my $base = "test$state->{num}"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 671 | 0 | ++$state->{num}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 672 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 673 | 0 | ▶ | my $obj_ext = $Config{obj_ext} || ".o"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$Imager::Probe::Config{'obj_ext'} || '.o'
MC/DC0%0/1
$Imager::Probe::Config{'obj_ext'} || '.o'
$Imager::Probe::Config{'obj_ext'}
Truth table0%0/2
A
A= $Imager::Probe::Config{'obj_ext'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 674 | 0 | unlink("$base.c", "$base$obj_ext"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 675 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 676 | 0 | ▶ | if (open(my $tmpc, '>', "$base.c")) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 677 | 0 | print $tmpc $code; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 678 | 0 | close($tmpc); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 679 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 680 | # we don't need this for our probes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 681 | #my $COREincdir = File::Spec->catdir($Config{'archlibexp'}, 'CORE'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 682 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 683 | 0 | my $cc = $req->{cc}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 684 | 0 | my $ccflags = ""; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 685 | 0 | ▶ | $ccflags = $req->{ccflags} unless $args{ccflags_only}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 686 | 0 | ▶ | $ccflags .= " $args{ccflags}" if $args{ccflags}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 687 | 0 | $ccflags .= " $req->{'optimize'}"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 688 | # we want the maximum std | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 689 | 0 | my ($std) = _sort_std($args{std}, $req->{minstd}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 690 | 0 | ▶ | my $stdflag = $args{stdflag} || $req->{stdflag}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$args{'stdflag'} || $req->{'stdflag'}
MC/DC0%0/2
$args{'stdflag'} || $req->{'stdflag'}
$args{'stdflag'}
$req->{'stdflag'}
Truth table0%0/3
A || B
A= $args{'stdflag'}B= $req->{'stdflag'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 691 | 0 | ▶ | if ($std && $stdflag) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$std and $stdflag
MC/DC0%0/2
$std and $stdflag
$std
$stdflag
Truth table0%0/3
A and B
A= $stdB= $stdflag
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 692 | 0 | $ccflags .= " $stdflag$std"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 693 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 694 | # we don't need this (yet) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 695 | #. ' ' . "-I$COREincdir" . ' -DPERL_NO_INLINE_FUNCTIONS'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 696 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 697 | 0 | ▶ | my $errornull = $verbose ? '' : "2>" . File::Spec->devnull; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 698 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 699 | 0 | my $cccmd; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 700 | my $base_out; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 701 | 0 | ▶ | if ($args{nolink}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 702 | 0 | $base_out = "$base$obj_ext"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 703 | 0 | $cccmd = "$cc -c -o $base_out $ccflags $base.c $errornull"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 704 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 705 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 706 | 0 | ▶ | my $libs = $args{libs} || ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$args{'libs'} || ''
MC/DC0%0/1
$args{'libs'} || ''
$args{'libs'}
Truth table0%0/2
A
A= $args{'libs'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 707 | 0 | $base_out = "$base$Config{_exe}"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 708 | 0 | $cccmd = "$cc -o $base_out $ccflags $base.c $libs $errornull"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 709 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 710 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 711 | 0 | ▶ | printf "${indent}cccmd = $cccmd\n" if $verbose; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 712 | 0 | my $res = system($cccmd); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 713 | 0 | ▶ | $ok = defined($res) && $res == 0 && -s $base_out; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/6
defined $res && $res == 0 && -s $base_out
defined $res and $res == 0
MC/DC0%0/3
defined $res && $res == 0 && -s $base_out
defined $res
$res == 0
-s $base_out
Truth table0%0/4
A and B && C
A= defined $resB= $res == 0C= -s $base_out
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 714 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 715 | 0 | ▶ | if ($ok && !$args{nolink} && !-x $base_out) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$ok and not $args{"nolink"} and not -x $base_out
$ok and not $args{"nolink"}
MC/DC0%0/3
$ok and not $args{"nolink"} and not -x $base_out
$ok
not $args{"nolink"}
not -x $base_out
Truth table0%0/4
A and not(B) and not(C)
A= $okB= not $args{"nolink"}C= not -x $base_out
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 716 | 0 | $ok = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 717 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 718 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 719 | 0 | ▶ | if ( $ok && $args{run} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$ok and $args{"run"}
MC/DC0%0/2
$ok and $args{"run"}
$ok
$args{"run"}
Truth table0%0/3
A and B
A= $okB= $args{"run"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 720 | # some Imager module probes use files shipped with the module | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 721 | # so run from the original directory so they're visible | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 722 | chdir $state->{start_dir} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 723 | 0 | ▶ | or die "Cannot return to original current directory $state->{start_dir}: $!\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 724 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 725 | my $tmp_exe = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 726 | 0 | File::Spec->catfile($state->{tmpdir}, $base_out); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 727 | 0 | my @run = $tmp_exe; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 728 | 0 | ▶ | unshift @run, $Config{run} if $Config{run} && -e $Config{run}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$Imager::Probe::Config{"run"} and -e $Imager::Probe::Config{"run"}
MC/DC0%0/2
$Imager::Probe::Config{"run"} and -e $Imager::Probe::Config{"run"}
$Imager::Probe::Config{"run"}
-e $Imager::Probe::Config{"run"}
Truth table0%0/3
A and B
A= $Imager::Probe::Config{"run"}B= -e $Imager::Probe::Config{"run"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 729 | 0 | ▶ | printf "${indent}Running $tmp_exe..." if $verbose; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 730 | 0 | ▶ | if (system(@run) == 0) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 731 | 0 | $ok = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 732 | 0 | ▶ | print "${indent} success\n" if $verbose; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 733 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 734 | 0 | $ok = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 735 | 0 | my $errno = $? >> 8; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 736 | 0 | local $! = $errno; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 737 | 0 | ▶ | printf <<EOF if $verbose; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 738 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 739 | ${indent}*** The test run of '$tmp_exe' failed: status $? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 740 | ${indent}*** (the status means: errno = $errno or '$!') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 741 | EOF | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 742 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 743 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 744 | # now cleaned up with the temp dir | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 745 | # unlink("$tmp.c", $tmp_out); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 746 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 747 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 748 | # redundant but harmless if we ran the test executable | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 749 | chdir $state->{start_dir} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 750 | 0 | ▶ | or die "Cannot return to original current directory $state->{start_dir}: $!\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 751 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 752 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 753 | 0 | return $ok; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 754 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 755 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 756 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 757 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 758 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||