| 1 | package ExtUtils::HasCompiler; | ||||||||||||||||||||||||||||||||||
| 2 | 1 | $ExtUtils::HasCompiler::VERSION = '0.023'; | |||||||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 4 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||
| 6 | 1 | ▶ | use base 'Exporter'; | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 7 | 1 | our @EXPORT_OK = qw/can_compile_loadable_object can_compile_static_library can_compile_extension/; | |||||||||||||||||||||||||||||||||
| 8 | 1 | our %EXPORT_TAGS = (all => \@EXPORT_OK); | |||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||
| 10 | 1 | ▶ | use Config; | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 11 | 1 | ▶ | use Carp 'carp'; | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 12 | 1 | ▶ | use File::Basename 'basename'; | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 13 | 1 | ▶ | use File::Spec::Functions qw/catfile catdir rel2abs/; | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 14 | 1 | ▶ | use File::Temp qw/tempdir tempfile/; | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||
| 16 | 1 | my $tempdir = tempdir('HASCOMPILERXXXX', CLEANUP => 1, DIR => '.'); | |||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||
| 18 | 1 | my $loadable_object_format = <<'END'; | |||||||||||||||||||||||||||||||||
| 19 | #define PERL_NO_GET_CONTEXT | ||||||||||||||||||||||||||||||||||
| 20 | #include "EXTERN.h" | ||||||||||||||||||||||||||||||||||
| 21 | #include "perl.h" | ||||||||||||||||||||||||||||||||||
| 22 | #include "XSUB.h" | ||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||
| 24 | #ifndef PERL_UNUSED_VAR | ||||||||||||||||||||||||||||||||||
| 25 | #define PERL_UNUSED_VAR(var) | ||||||||||||||||||||||||||||||||||
| 26 | #endif | ||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||
| 28 | XS(exported) { | ||||||||||||||||||||||||||||||||||
| 29 | #ifdef dVAR | ||||||||||||||||||||||||||||||||||
| 30 | dVAR; | ||||||||||||||||||||||||||||||||||
| 31 | #endif | ||||||||||||||||||||||||||||||||||
| 32 | dXSARGS; | ||||||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||||
| 34 | PERL_UNUSED_VAR(cv); /* -W */ | ||||||||||||||||||||||||||||||||||
| 35 | PERL_UNUSED_VAR(items); /* -W */ | ||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||
| 37 | XSRETURN_IV(42); | ||||||||||||||||||||||||||||||||||
| 38 | } | ||||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||||
| 40 | #ifndef XS_EXTERNAL | ||||||||||||||||||||||||||||||||||
| 41 | #define XS_EXTERNAL(foo) XS(foo) | ||||||||||||||||||||||||||||||||||
| 42 | #endif | ||||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||||
| 44 | /* we don't want to mess with .def files on mingw */ | ||||||||||||||||||||||||||||||||||
| 45 | #if defined(WIN32) && defined(__GNUC__) | ||||||||||||||||||||||||||||||||||
| 46 | # define EXPORT __declspec(dllexport) | ||||||||||||||||||||||||||||||||||
| 47 | #else | ||||||||||||||||||||||||||||||||||
| 48 | # define EXPORT | ||||||||||||||||||||||||||||||||||
| 49 | #endif | ||||||||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||||||||
| 51 | EXPORT XS_EXTERNAL(boot_%s) { | ||||||||||||||||||||||||||||||||||
| 52 | #ifdef dVAR | ||||||||||||||||||||||||||||||||||
| 53 | dVAR; | ||||||||||||||||||||||||||||||||||
| 54 | #endif | ||||||||||||||||||||||||||||||||||
| 55 | dXSARGS; | ||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||
| 57 | PERL_UNUSED_VAR(cv); /* -W */ | ||||||||||||||||||||||||||||||||||
| 58 | PERL_UNUSED_VAR(items); /* -W */ | ||||||||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||||||||
| 60 | newXS("%s::exported", exported, __FILE__); | ||||||||||||||||||||||||||||||||||
| 61 | } | ||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||
| 63 | END | ||||||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||||
| 65 | 1 | my $counter = 1; | |||||||||||||||||||||||||||||||||
| 66 | 1 | my %prelinking = map { $_ => 1 } qw/MSWin32 VMS aix/; | |||||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||||
| 68 | sub can_compile_loadable_object { | ||||||||||||||||||||||||||||||||||
| 69 | 2 | ▶ | my %args = @_; | ||||||||||||||||||||||||||||||||
|
Subroutine
can_compile_loadable_object: called CC=30 SCAR=52.8
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||
| 71 | 2 | ▶ | my $output = $args{output} || \*STDOUT; | ||||||||||||||||||||||||||||||||
|
Condition50%1/2
$args{'output'} || \*STDOUT
MC/DC0%0/1
$args{'output'} || \*STDOUT
$args{'output'}
Truth table50%1/2
A
A= $args{'output'}
| |||||||||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||||||||
| 73 | 2 | ▶ | my $config = $args{config} || 'ExtUtils::HasCompiler::Config'; | ||||||||||||||||||||||||||||||||
|
Condition100%2/2
$args{'config'} || 'ExtUtils::HasCompiler::Config'
MC/DC100%1/1
$args{'config'} || 'ExtUtils::HasCompiler::Config'
$args{'config'}
Truth table100%2/2
A
A= $args{'config'}
| |||||||||||||||||||||||||||||||||||
| 74 | 2 | ▶ | return if not $config->get('usedl'); | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||||||
| 76 | 2 | my ($source_handle, $source_name) = tempfile('TESTXXXX', DIR => $tempdir, SUFFIX => '.c', UNLINK => 1); | |||||||||||||||||||||||||||||||||
| 77 | 2 | my $basename = basename($source_name, '.c'); | |||||||||||||||||||||||||||||||||
| 78 | 2 | my $abs_basename = catfile($tempdir, $basename); | |||||||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||||||||
| 80 | 2 | my ($cc, $ccflags, $optimize, $cccdlflags, $ld, $ldflags, $lddlflags, $libperl, $perllibs, $archlibexp, $_o, $dlext) = map { $config->get($_) } qw/cc ccflags optimize cccdlflags ld ldflags lddlflags libperl perllibs archlibexp _o dlext/; | |||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||||
| 82 | 2 | my $incdir = catdir($archlibexp, 'CORE'); | |||||||||||||||||||||||||||||||||
| 83 | 2 | my $object_file = $abs_basename.$_o; | |||||||||||||||||||||||||||||||||
| 84 | 2 | my $loadable_object = "$abs_basename.$dlext"; | |||||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||||
| 86 | 2 | my @commands; | |||||||||||||||||||||||||||||||||
| 87 | 2 | ▶ | if ($^O eq 'MSWin32' && $cc =~ /^cl/) { | ||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition33%1/3
$^O eq "MSWin32" and $cc =~ /^cl/
MC/DC0%0/2
$^O eq "MSWin32" and $cc =~ /^cl/
$^O eq "MSWin32"
$cc =~ /^cl/
Truth table33%1/3
A and B
A= $^O eq "MSWin32"B= $cc =~ /^cl/
| |||||||||||||||||||||||||||||||||||
| 88 | 0 | push @commands, qq{$cc $ccflags $cccdlflags $optimize /I "$incdir" /c $source_name /Fo$object_file}; | |||||||||||||||||||||||||||||||||
| 89 | 0 | push @commands, qq{$ld $object_file $lddlflags $libperl $perllibs /out:$loadable_object /def:$abs_basename.def /pdb:$abs_basename.pdb}; | |||||||||||||||||||||||||||||||||
| 90 | } | ||||||||||||||||||||||||||||||||||
| 91 | elsif ($^O eq 'VMS') { | ||||||||||||||||||||||||||||||||||
| 92 | # Mksymlists is only the beginning of the story. | ||||||||||||||||||||||||||||||||||
| 93 | 0 | ▶ | open my $opt_fh, '>>', "$abs_basename.opt" or do { carp "Couldn't append to '$abs_basename.opt'"; return }; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 94 | 0 | print $opt_fh "PerlShr/Share\n"; | |||||||||||||||||||||||||||||||||
| 95 | 0 | close $opt_fh; | |||||||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||||||||
| 97 | 0 | ▶ | my $incdirs = $ccflags =~ s{ /inc[^=]+ (?:=)+ (?:\()? ( [^\/\)]* ) }{}xi ? "$1,$incdir" : $incdir; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 98 | 0 | push @commands, qq{$cc $ccflags $optimize /include=($incdirs) $cccdlflags $source_name /obj=$object_file}; | |||||||||||||||||||||||||||||||||
| 99 | 0 | push @commands, qq{$ld $ldflags $lddlflags=$loadable_object $object_file,$abs_basename.opt/OPTIONS,${incdir}perlshr_attr.opt/OPTIONS' $perllibs}; | |||||||||||||||||||||||||||||||||
| 100 | } | ||||||||||||||||||||||||||||||||||
| 101 | else { | ||||||||||||||||||||||||||||||||||
| 102 | 2 | my @extra; | |||||||||||||||||||||||||||||||||
| 103 | 2 | my $inc = qq{"-I$incdir"}; | |||||||||||||||||||||||||||||||||
| 104 | 2 | ▶ | if ($^O eq 'MSWin32') { | ||||||||||||||||||||||||||||||||
|
Branch: 5 branches
| |||||||||||||||||||||||||||||||||||
| 105 | 0 | my $lib = '-l' . ($libperl =~ /lib([^.]+)\./)[0]; | |||||||||||||||||||||||||||||||||
| 106 | 0 | push @extra, "$abs_basename.def", $lib, $perllibs; | |||||||||||||||||||||||||||||||||
| 107 | } | ||||||||||||||||||||||||||||||||||
| 108 | elsif ($^O =~ /^(cygwin|msys)$/) { | ||||||||||||||||||||||||||||||||||
| 109 | 0 | ▶ | push @extra, catfile($incdir, $config->get('useshrplib') ? 'libperl.dll.a' : 'libperl.a'); | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 110 | } | ||||||||||||||||||||||||||||||||||
| 111 | elsif ($^O eq 'aix') { | ||||||||||||||||||||||||||||||||||
| 112 | 0 | $lddlflags =~ s/\Q$(BASEEXT)\E/$abs_basename/; | |||||||||||||||||||||||||||||||||
| 113 | 0 | $lddlflags =~ s/\Q$(PERL_INC)\E/$incdir/; | |||||||||||||||||||||||||||||||||
| 114 | } | ||||||||||||||||||||||||||||||||||
| 115 | elsif ($^O eq 'android') { | ||||||||||||||||||||||||||||||||||
| 116 | 0 | push @extra, qq{"-L$incdir"}, '-lperl', $perllibs; | |||||||||||||||||||||||||||||||||
| 117 | } | ||||||||||||||||||||||||||||||||||
| 118 | ▶ | elsif ($^O eq 'darwin' && $config->get('perlpath') eq '/usr/bin/perl' && ($config->get('osvers') =~ /(\d+)/)[0] >= 18) { | |||||||||||||||||||||||||||||||||
|
Condition33%2/6
$^O eq "darwin" and $config->get("perlpath") eq "/usr/bin/perl" and ($config->get("osvers") =~ /(\d+)/)[0] >= 18
$^O eq "darwin" and $config->get("perlpath") eq "/usr/bin/perl"
MC/DC0%0/3
$^O eq "darwin" and $config->get("perlpath") eq "/usr/bin/perl" and ($config->get("osvers") =~ /(\d+)/)[0] >= 18
$^O eq "darwin"
$config->get("perlpath") eq "/usr/bin/perl"
($config->get("osvers") =~ /(\d+)/)[0] >= 18
Truth table25%1/4
A and B and C
A= $^O eq "darwin"B= $config->get("perlpath") eq "/usr/bin/perl"C= ($config->get("osvers") =~ /(\d+)/)[0] >= 18
| |||||||||||||||||||||||||||||||||||
| 119 | 0 | $inc = qq{-iwithsysroot "$incdir"}; | |||||||||||||||||||||||||||||||||
| 120 | } | ||||||||||||||||||||||||||||||||||
| 121 | 2 | push @commands, qq{$cc $ccflags $optimize $inc $cccdlflags -c $source_name -o $object_file}; | |||||||||||||||||||||||||||||||||
| 122 | 2 | push @commands, qq{$ld $object_file -o $loadable_object $lddlflags @extra}; | |||||||||||||||||||||||||||||||||
| 123 | } | ||||||||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||||||||
| 125 | 2 | ▶ | if ($prelinking{$^O}) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 126 | 0 | require ExtUtils::Mksymlists; | |||||||||||||||||||||||||||||||||
| 127 | 0 | ExtUtils::Mksymlists::Mksymlists(NAME => $basename, FILE => $abs_basename, IMPORTS => {}); | |||||||||||||||||||||||||||||||||
| 128 | } | ||||||||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||||||||
| 130 | 2 | my $shortname = '_Loadable' . $counter++; | |||||||||||||||||||||||||||||||||
| 131 | 2 | my $package = "ExtUtils::HasCompiler::$shortname"; | |||||||||||||||||||||||||||||||||
| 132 | 2 | ▶ | printf $source_handle $loadable_object_format, $basename, $package or do { carp "Couldn't write to $source_name: $!"; return }; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 133 | 2 | ▶ | close $source_handle or do { carp "Couldn't close $source_name: $!"; return }; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||||||||
| 135 | 2 | for my $command (@commands) { | |||||||||||||||||||||||||||||||||
| 136 | 4 | ▶ | print $output "$command\n" if not $args{quiet}; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 137 | 4 | ▶ | system $command and do { carp "Couldn't execute $command: $!"; return }; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 138 | } | ||||||||||||||||||||||||||||||||||
| 139 | |||||||||||||||||||||||||||||||||||
| 140 | # Skip loading when cross-compiling | ||||||||||||||||||||||||||||||||||
| 141 | 2 | ▶ | return 1 if exists $args{skip_load} ? $args{skip_load} : $config->get('usecrosscompile'); | ||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||||||||
| 143 | 2 | require DynaLoader; | |||||||||||||||||||||||||||||||||
| 144 | 2 | local @DynaLoader::dl_require_symbols = "boot_$basename"; | |||||||||||||||||||||||||||||||||
| 145 | 2 | my $handle = DynaLoader::dl_load_file(rel2abs($loadable_object), 0); | |||||||||||||||||||||||||||||||||
| 146 | 2 | ▶ | if ($handle) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 147 | 0 | ▶ | my $symbol = DynaLoader::dl_find_symbol($handle, "boot_$basename") or do { carp "Couldn't find boot symbol for $basename"; return }; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 148 | 0 | my $compilet = DynaLoader::dl_install_xsub('__ANON__::__ANON__', $symbol, $source_name); | |||||||||||||||||||||||||||||||||
| 149 | 0 | ▶ | my $ret = eval { $compilet->(); $package->exported } or carp $@; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 150 | 0 | delete $ExtUtils::HasCompiler::{"$shortname\::"}; | |||||||||||||||||||||||||||||||||
| 151 | 0 | ▶ | eval { DynaLoader::dl_unload_file($handle) } or carp $@; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 152 | 0 | ▶ | return defined $ret && $ret == 42; | ||||||||||||||||||||||||||||||||
|
Condition0%0/3
defined $ret && $ret == 42
MC/DC0%0/2
defined $ret && $ret == 42
defined $ret
$ret == 42
Truth table0%0/3
A && B
A= defined $retB= $ret == 42
| |||||||||||||||||||||||||||||||||||
| 153 | } | ||||||||||||||||||||||||||||||||||
| 154 | else { | ||||||||||||||||||||||||||||||||||
| 155 | 2 | carp "Couldn't load $loadable_object: " . DynaLoader::dl_error(); | |||||||||||||||||||||||||||||||||
| 156 | 2 | return; | |||||||||||||||||||||||||||||||||
| 157 | } | ||||||||||||||||||||||||||||||||||
| 158 | } | ||||||||||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||||||||
| 160 | 1 | my %static_unsupported_on = map { $_ => 1 } qw/VMS aix MSWin32 cygwin/; | |||||||||||||||||||||||||||||||||
| 161 | sub can_compile_static_library { | ||||||||||||||||||||||||||||||||||
| 162 | 1 | ▶ | my %args = @_; | ||||||||||||||||||||||||||||||||
|
Subroutine
can_compile_static_library: called CC=12 SCAR=28.2
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 163 | |||||||||||||||||||||||||||||||||||
| 164 | 1 | ▶ | my $output = $args{output} || \*STDOUT; | ||||||||||||||||||||||||||||||||
|
Condition50%1/2
$args{'output'} || \*STDOUT
MC/DC0%0/1
$args{'output'} || \*STDOUT
$args{'output'}
Truth table50%1/2
A
A= $args{'output'}
| |||||||||||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||||||||
| 166 | 1 | ▶ | my $config = $args{config} || 'ExtUtils::HasCompiler::Config'; | ||||||||||||||||||||||||||||||||
|
Condition50%1/2
$args{'config'} || 'ExtUtils::HasCompiler::Config'
MC/DC0%0/1
$args{'config'} || 'ExtUtils::HasCompiler::Config'
$args{'config'}
Truth table50%1/2
A
A= $args{'config'}
| |||||||||||||||||||||||||||||||||||
| 167 | 1 | ▶ | return if $config->get('useshrplib') eq 'true'; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 168 | |||||||||||||||||||||||||||||||||||
| 169 | 1 | my ($source_handle, $source_name) = tempfile('TESTXXXX', DIR => $tempdir, SUFFIX => '.c', UNLINK => 1); | |||||||||||||||||||||||||||||||||
| 170 | 1 | my $basename = basename($source_name, '.c'); | |||||||||||||||||||||||||||||||||
| 171 | 1 | my $abs_basename = catfile($tempdir, $basename); | |||||||||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||||||||
| 173 | 1 | my ($cc, $ccflags, $optimize, $ar, $full_ar, $ranlib, $archlibexp, $_o, $lib_ext) = map { $config->get($_) } qw/cc ccflags optimize ar full_ar ranlib archlibexp _o lib_ext/; | |||||||||||||||||||||||||||||||||
| 174 | 1 | my $incdir = catdir($archlibexp, 'CORE'); | |||||||||||||||||||||||||||||||||
| 175 | 1 | my $object_file = "$abs_basename$_o"; | |||||||||||||||||||||||||||||||||
| 176 | 1 | my $static_library = $abs_basename.$lib_ext; | |||||||||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||||||||
| 178 | 1 | my @commands; | |||||||||||||||||||||||||||||||||
| 179 | 1 | ▶ | if ($static_unsupported_on{$^O}) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 180 | 0 | return; | |||||||||||||||||||||||||||||||||
| 181 | } | ||||||||||||||||||||||||||||||||||
| 182 | else { | ||||||||||||||||||||||||||||||||||
| 183 | 1 | ▶ | my $my_ar = length $full_ar ? $full_ar : $ar; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 184 | 1 | push @commands, qq{$cc $ccflags $optimize "-I$incdir" -c $source_name -o $object_file}; | |||||||||||||||||||||||||||||||||
| 185 | 1 | push @commands, qq{$my_ar cr $static_library $object_file}; | |||||||||||||||||||||||||||||||||
| 186 | 1 | ▶ | push @commands, qq{$ranlib $static_library} if $ranlib ne ':'; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 187 | } | ||||||||||||||||||||||||||||||||||
| 188 | |||||||||||||||||||||||||||||||||||
| 189 | 1 | my $shortname = '_Loadable' . $counter++; | |||||||||||||||||||||||||||||||||
| 190 | 1 | my $package = "ExtUtils::HasCompiler::$shortname"; | |||||||||||||||||||||||||||||||||
| 191 | 1 | ▶ | printf $source_handle $loadable_object_format, $basename, $package or do { carp "Couldn't write to $source_name: $!"; return }; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 192 | 1 | ▶ | close $source_handle or do { carp "Couldn't close $source_name: $!"; return }; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 193 | |||||||||||||||||||||||||||||||||||
| 194 | 1 | for my $command (@commands) { | |||||||||||||||||||||||||||||||||
| 195 | 2 | ▶ | print $output "$command\n" if not $args{quiet}; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 196 | 2 | ▶ | system $command and do { carp "Couldn't execute $command: $!"; return }; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 197 | } | ||||||||||||||||||||||||||||||||||
| 198 | 1 | return 1; | |||||||||||||||||||||||||||||||||
| 199 | } | ||||||||||||||||||||||||||||||||||
| 200 | |||||||||||||||||||||||||||||||||||
| 201 | sub can_compile_extension { | ||||||||||||||||||||||||||||||||||
| 202 | 1 | ▶ | my %args = @_; | ||||||||||||||||||||||||||||||||
|
Subroutine
can_compile_extension: called CC=5 SCAR=18.6
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 203 | 1 | ▶ | $args{config} ||= 'ExtUtils::HasCompiler::Config'; | ||||||||||||||||||||||||||||||||
|
Condition50%1/2
$args{"config"} ||= "ExtUtils::HasCompiler::Config"
MC/DC0%0/1
$args{"config"} ||= "ExtUtils::HasCompiler::Config"
$args{"config"}
Truth table50%1/2
A
A= $args{"config"}
| |||||||||||||||||||||||||||||||||||
| 204 | 1 | ▶ | my $linktype = $args{linktype} || ($args{config}->get('usedl') ? 'dynamic' : 'static'); | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$args{'linktype'} || ($args{'config'}->get('usedl') ? 'dynamic' : 'static')
MC/DC0%0/2
$args{'linktype'} || ($args{'config'}->get('usedl') ? 'dynamic' : 'static')
$args{'linktype'}
($args{'config'}->get('usedl') ? 'dynamic' : 'static')
Truth table33%1/3
A || B
A= $args{'linktype'}B= ($args{'config'}->get('usedl') ? 'dynamic' : 'static')
| |||||||||||||||||||||||||||||||||||
| 205 | 1 | ▶ | return $linktype eq 'static' ? can_compile_static_library(%args) : can_compile_loadable_object(%args); | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 206 | } | ||||||||||||||||||||||||||||||||||
| 207 | |||||||||||||||||||||||||||||||||||
| 208 | sub ExtUtils::HasCompiler::Config::get { | ||||||||||||||||||||||||||||||||||
| 209 | 39 | ▶ | my (undef, $key) = @_; | ||||||||||||||||||||||||||||||||
|
Subroutine
get: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||
| 210 | 39 | ▶ | return $ENV{uc $key} || $Config{$key}; | ||||||||||||||||||||||||||||||||
|
Condition100%3/3
$ENV{uc $key} || $ExtUtils::HasCompiler::Config{$key}
MC/DC100%2/2
$ENV{uc $key} || $ExtUtils::HasCompiler::Config{$key}
$ENV{uc $key}
$ExtUtils::HasCompiler::Config{$key}
Truth table100%3/3
A || B
A= $ENV{uc $key}B= $ExtUtils::HasCompiler::Config{$key}
| |||||||||||||||||||||||||||||||||||
| 211 | } | ||||||||||||||||||||||||||||||||||
| 212 | |||||||||||||||||||||||||||||||||||
| 213 | 1 | 1; | |||||||||||||||||||||||||||||||||
| 214 | |||||||||||||||||||||||||||||||||||
| 215 | # ABSTRACT: Check for the presence of a compiler | ||||||||||||||||||||||||||||||||||
| 216 | |||||||||||||||||||||||||||||||||||
| 217 | __END__ | ||||||||||||||||||||||||||||||||||