/
linux.pm
111 lines (89 loc) · 2.89 KB
/
linux.pm
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# Copyright (C) 2005-2007, The Perl Foundation.
# $Id$
package init::hints::linux;
use strict;
use warnings;
use Config;
sub option_or_data {
my $conf = shift;
my $arg = shift;
my $opt = $conf->options->get( $arg );
return $opt ? $opt : $conf->data->get( $arg );
}
sub runstep {
my ( $self, $conf ) = @_;
my $libs = option_or_data('libs');
my $cflags = option_or_data('cflags');
my $cc = option_or_data('cc');
my $linkflags = option_or_data('linkflags');
# should find g++ in most cases
my $link = $conf->data->get('link') || 'c++';
if ( $libs !~ /-lpthread/ ) {
$libs .= ' -lpthread';
}
my $ld_share_flags = $conf->data->get('ld_share_flags');
my $cc_shared = $conf->data->get('cc_shared');
if ( $cc =~ /icc/ ) {
# Intel C++ compiler has the same name as its C compiler
$link = $cc;
# don't allow icc to pretend it's gcc
$cflags .= ' -no-gcc';
# suppress sprintf warnings that don't apply
$cflags .= ' -wd269';
$cflags .= ' -Wall -Wcheck -w2';
$ld_share_flags = ' -shared -g -pipe -fexceptions -fPIC';
$cc_shared .= ' -fPIC';
}
elsif ( $cc =~ /suncc/ ) {
$link = 'sunCC';
if ( $ld_share_flags !~ /-KPIC/ ) {
$ld_share_flags = '-KPIC';
}
if ( $cc_shared !~ /-KPIC/ ) {
$cc_shared = '-KPIC';
}
}
else {
if ( $ld_share_flags !~ /-fPIC/ ) {
$ld_share_flags .= ' -fPIC';
}
if ( $cc_shared !~ /-fPIC/ ) {
$cc_shared .= ' -fPIC';
}
# --export-dynamic, s. info gcc, ld
$linkflags .= ' -Wl,-E';
}
if ( $cflags !~ /-D_GNU_SOURCE/ ) {
# Request visibility of all POSIX symbols
# _XOPEN_SOURCE=600 doesn't work with glibc 2.1.3
# _XOPEN_SOURCE=500 gives 2 undefined warns (setenv, unsetenv) on 2.1.3
$cflags .= ' -D_GNU_SOURCE';
}
$conf->data->set(
ccflags => $cflags,
libs => $libs,
ld_share_flags => $ld_share_flags,
ld_load_flags => $ld_share_flags,
i_lib_pthread => 1, # RT#43149 fake a header entry
linkflags => $linkflags,
link => $link,
cc_shared => $cc_shared,
rpath => '-Wl,-rpath=',
has_dynamic_linking => 1,
parrot_is_shared => 1,
libparrot_shared => 'libparrot$(SHARE_EXT).$(SOVERSION)',
libparrot_shared_alias => 'libparrot$(SHARE_EXT)',
libparrot_soname => '-Wl,-soname=libparrot$(SHARE_EXT).$(SOVERSION)',
);
if ( ( split( '-', $Config{archname} ) )[0] eq 'ia64' ) {
$conf->data->set( platform_asm => 1 );
}
return;
}
1;
# Local Variables:
# mode: cperl
# cperl-indent-level: 4
# fill-column: 100
# End:
# vim: expandtab shiftwidth=4: