line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package ILCPPConfig::OldCompilerGuess; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
494
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
30
|
|
4
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
32
|
|
5
|
1
|
|
|
1
|
|
5
|
use Config; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
27
|
|
6
|
1
|
|
|
1
|
|
5
|
use Exporter; |
|
1
|
|
|
|
|
12
|
|
|
1
|
|
|
|
|
578
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our @ISA = 'Exporter'; |
9
|
|
|
|
|
|
|
our @EXPORT_OK = 'guess_compiler'; |
10
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
# This is the logic we used to keep in Makefile.PL that was used to make an |
13
|
|
|
|
|
|
|
# educated guess as to what compiler, compiler flags, standard libraries, and |
14
|
|
|
|
|
|
|
# linker flags to configure into Inline::CPP. |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
# Inline::CPP shifted to using ExtUtils::CppGuess instead, but retains this |
17
|
|
|
|
|
|
|
# logic for testing purposes, as well as for working toward improving |
18
|
|
|
|
|
|
|
# ExtUtils::CppGuess. |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
# my( $cc_guess, $libs_guess ) = guess_compiler(); |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
#============================================================================ |
24
|
|
|
|
|
|
|
# Make an intelligent guess about what compiler to use |
25
|
|
|
|
|
|
|
#============================================================================ |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub guess_compiler { |
28
|
|
|
|
|
|
|
|
29
|
1
|
|
|
1
|
0
|
79
|
my( $cc_guess, $libs_guess ); |
30
|
|
|
|
|
|
|
|
31
|
1
|
50
|
33
|
|
|
110
|
if ( $Config{osname} eq 'darwin' ) { |
|
|
50
|
33
|
|
|
|
|
|
|
50
|
0
|
|
|
|
|
|
|
50
|
0
|
|
|
|
|
|
|
0
|
0
|
|
|
|
|
|
|
0
|
0
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
32
|
0
|
|
|
|
|
0
|
my $stdlib_query |
33
|
|
|
|
|
|
|
= 'find /usr/lib/gcc -name "libstdc++*" | grep $( uname -p )'; |
34
|
0
|
|
|
|
|
0
|
my $stdcpp = `$stdlib_query`; |
35
|
0
|
|
|
|
|
0
|
+$stdcpp =~ s/^(.*)\/[^\/]+$/$1/; |
36
|
0
|
|
|
|
|
0
|
$cc_guess = 'g++'; |
37
|
0
|
|
|
|
|
0
|
$libs_guess = "-L$stdcpp -lstdc++"; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
elsif ( $Config{osname} ne 'darwin' |
40
|
|
|
|
|
|
|
and $Config{gccversion} |
41
|
|
|
|
|
|
|
and $Config{cc} =~ m#\bgcc\b[^/]*$# |
42
|
|
|
|
|
|
|
) { |
43
|
0
|
|
|
|
|
0
|
( $cc_guess = $Config{cc} ) =~ s[\bgcc\b([^/]*)$(?:)][g\+\+$1]; |
44
|
0
|
|
|
|
|
0
|
$libs_guess = '-lstdc++'; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
elsif ( $Config{osname} =~ m/^MSWin/ ) { |
47
|
0
|
|
|
|
|
0
|
$cc_guess = 'cl -TP -EHsc'; |
48
|
0
|
|
|
|
|
0
|
$libs_guess = 'MSVCIRT.LIB'; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
elsif ( $Config{osname} eq 'linux' ) { |
51
|
1
|
|
|
|
|
18
|
$cc_guess = 'g++'; |
52
|
1
|
|
|
|
|
3
|
$libs_guess = '-lstdc++'; |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
# Dragonfly patch is just a hunch... (still doesn't work) |
55
|
|
|
|
|
|
|
elsif ( $Config{osname} eq 'netbsd' || $Config{osname} eq 'dragonfly' ) { |
56
|
0
|
|
|
|
|
0
|
$cc_guess = 'g++'; |
57
|
0
|
|
|
|
|
0
|
$libs_guess = '-lstdc++ -lgcc_s'; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
elsif ( $Config{osname} eq 'cygwin' ) { |
60
|
0
|
|
|
|
|
0
|
$cc_guess = 'g++'; |
61
|
0
|
|
|
|
|
0
|
$libs_guess = '-lstdc++'; |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
elsif ( $Config{osname} eq 'solaris' or $Config{osname} eq 'SunOS' ) { |
64
|
0
|
0
|
0
|
|
|
0
|
if ( $Config{cc} eq 'gcc' |
|
|
|
0
|
|
|
|
|
65
|
|
|
|
|
|
|
|| ( exists( $Config{gccversion} ) && $Config{gccversion} > 0 ) ) |
66
|
|
|
|
|
|
|
{ |
67
|
0
|
|
|
|
|
0
|
$cc_guess = 'g++'; |
68
|
0
|
|
|
|
|
0
|
$libs_guess = '-lstdc++'; |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
else { |
71
|
0
|
|
|
|
|
0
|
$cc_guess = 'CC'; |
72
|
0
|
|
|
|
|
0
|
$libs_guess = '-lCrun'; |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
# MirBSD: Still problematic. |
77
|
|
|
|
|
|
|
elsif ( $Config{osname} eq 'mirbsd' ) { |
78
|
0
|
|
|
|
|
0
|
my $stdlib_query |
79
|
|
|
|
|
|
|
= 'find /usr/lib/gcc -name "libstdc++*" | grep $( uname -p ) | head -1'; |
80
|
0
|
|
|
|
|
0
|
my $stdcpp = `$stdlib_query`; |
81
|
0
|
|
|
|
|
0
|
+$stdcpp =~ s/^(.*)\/[^\/]+$/$1/; |
82
|
0
|
|
|
|
|
0
|
$cc_guess = 'g++'; |
83
|
0
|
|
|
|
|
0
|
$libs_guess = "-L$stdcpp -lstdc++ -lc -lgcc_s"; |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
elsif( $Config{osname} eq 'freebsd' |
86
|
|
|
|
|
|
|
and $Config{osvers} =~ /^(\d+)/ |
87
|
|
|
|
|
|
|
and $1 >= 10 |
88
|
|
|
|
|
|
|
){ |
89
|
0
|
|
|
|
|
0
|
$cc_guess = 'clang++'; |
90
|
0
|
|
|
|
|
0
|
$libs_guess = '-lc++'; |
91
|
|
|
|
|
|
|
} |
92
|
|
|
|
|
|
|
# Sane defaults for other (probably unix-like) operating systems |
93
|
|
|
|
|
|
|
else { |
94
|
0
|
|
|
|
|
0
|
$cc_guess = 'g++'; |
95
|
0
|
|
|
|
|
0
|
$libs_guess = '-lstdc++'; |
96
|
|
|
|
|
|
|
} |
97
|
|
|
|
|
|
|
|
98
|
1
|
50
|
33
|
|
|
11
|
if( $cc_guess eq 'g++' && $Config{cc} eq 'clang') { |
99
|
0
|
|
|
|
|
0
|
$cc_guess = 'clang++'; |
100
|
|
|
|
|
|
|
} |
101
|
|
|
|
|
|
|
|
102
|
1
|
|
|
|
|
5
|
return( $cc_guess, $libs_guess ); |
103
|
|
|
|
|
|
|
} |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
1; |