1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
Fix MSVC detection. I don't know why I did this, either.
Ref: #1174
--- ExtUtils-CppGuess-0.27/lib/ExtUtils/CppGuess.pm.old 2023-11-19 13:19:51.000000000 -0600
+++ ExtUtils-CppGuess-0.27/lib/ExtUtils/CppGuess.pm 2024-07-10 11:26:59.221777726 -0500
@@ -257,6 +257,12 @@
compiler_command => 'clang++',
extra_lflags => '-lc++',
);
+ } elsif ( $self->_cc_is_msvc( $c_compiler ) ) {
+ %guess = (
+ compiler_command => 'cl',
+ extra_cflags => '-TP -EHsc',
+ extra_lflags => 'msvcprt.lib',
+ );
} elsif( $self->_cc_is_sunstudio( $c_compiler ) ) {
%guess = (
compiler_command => 'CC',
@@ -277,12 +283,6 @@
# Don't use -lstdc++ if Perl was linked with -static-libstdc++ (ActivePerl 5.18+ on Windows)
$guess{extra_lflags} = '-lstdc++'
unless ($self->_config->{ldflags} || '') =~ /static-libstdc\+\+/;
- } elsif ( $self->_cc_is_msvc( $c_compiler ) ) {
- %guess = (
- compiler_command => 'cl',
- extra_cflags => '-TP -EHsc',
- extra_lflags => 'msvcprt.lib',
- );
}
$guess{$ENV2VAL{$_}} = $ENV{$_} for grep defined $ENV{$_}, keys %ENV2VAL;
if (!%guess) {
@@ -383,8 +383,12 @@
sub _cc_is_msvc {
my( $self, $cc ) = @_;
- $self->{is_msvc}
- = ($self->_os =~ /MSWin32/ and File::Basename::basename($cc) =~ /^cl/i);
+ $self->{is_msvc} = undef;
+ if (
+ ($self->_os =~ /MSWin32/ and File::Basename::basename($cc) =~ /^cl/i)
+ ) {
+ $self->{is_msvc} = 1;
+ }
return $self->{is_msvc};
}
--- ExtUtils-CppGuess-0.27/t/002_icpp.t.old 2023-11-19 13:11:06.000000000 -0600
+++ ExtUtils-CppGuess-0.27/t/002_icpp.t 2024-07-10 11:27:48.506428703 -0500
@@ -9,8 +9,8 @@
[
{ os => 'MSWin32', cc => 'cl', config => {ccflags => ''} },
{
- is_sunstudio => 0,
- is_msvc => 1, is_gcc => 0, is_clang => 0,
+ is_sunstudio => undef,
+ is_msvc => 1, is_gcc => undef, is_clang => undef,
compiler_command => 'cl -TP -EHsc',
linker_flags => 'msvcprt.lib',
},
|