Skip to content

Commit 407b414

Browse files
committed
Test patch proposed for GH #23146
See: #23146 (comment)
1 parent 78544d8 commit 407b414

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Base.pm

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,19 @@ sub new {
4747
if defined $ENV{LDFLAGS};
4848

4949
unless ( exists $self->{config}{cxx} ) {
50+
print STDERR "XXX: inside unless loop line 49\n";
5051

5152
my ($ccbase, $ccpath, $ccsfx ) = fileparse($self->{config}{cc}, qr/\.[^.]*/);
5253

5354
## If the path is just "cc", fileparse returns $ccpath as "./"
5455
$ccpath = "" if $self->{config}{cc} =~ /^\Q$ccbase$ccsfx\E$/;
56+
print STDERR "PPP: ccpath <$ccpath>\n";
5557

5658
foreach my $cxx (@{$cc2cxx{$ccbase}}) {
5759

5860
if ( $ccpath ) {
5961
my $cxx1 = File::Spec->catfile( $ccpath, $cxx . $ccsfx);
62+
print STDERR "AAA: cxx1 $cxx1\n";
6063

6164
if( can_run( $cxx1 ) ) {
6265
$self->{config}{cxx} = $cxx1;
@@ -66,20 +69,23 @@ sub new {
6669
}
6770
else {
6871
my $cxx2 = $cxx . $ccsfx;
72+
print STDERR "BBB: cxx2 $cxx2\n";
6973

7074
if( can_run( $cxx2 ) ) {
7175
$self->{config}{cxx} = $cxx2;
7276
last;
7377
}
7478

7579
if( can_run( $cxx ) ) {
80+
print STDERR "CCC: cxx $cxx\n";
7681
$self->{config}{cxx} = $cxx;
7782
last;
7883
}
7984

8085
}
8186
}
8287
unless ( exists $self->{config}{cxx} ) {
88+
print STDERR "YYY: inside unless loop at line 86\n";
8389
$self->{config}{cxx} = $self->{config}{cc};
8490
my $cflags = $self->{config}{ccflags};
8591
$self->{config}{cxxflags} = '-x c++';

dist/ExtUtils-CBuilder/t/03-cplusplus.t

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,18 @@ else {
2626
plan tests => 7;
2727
}
2828

29-
ok $b, "created EU::CB object";
29+
{
30+
# GH #23146
31+
my $fake_cc = File::Spec->rel2abs(File::Spec->catfile(qw(some directory what doesnt exist), 'cc'));
32+
my $b = ExtUtils::CBuilder->new(
33+
quiet => $quiet,
34+
config => {
35+
cc => $fake_cc,
36+
},
37+
);
38+
39+
is $b->{config}{cxx}, $fake_cc, "did not search PATH for C++ compiler when given absolute path to C compiler";
40+
}
3041

3142
ok $b->have_cplusplus, "have_cplusplus";
3243

0 commit comments

Comments
 (0)