This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perlexperiment: fix missing POD directive in heading
[perl5.git] / dist / ExtUtils-CBuilder / lib / ExtUtils / CBuilder / Platform / Unix.pm
CommitLineData
6b09c160 1package ExtUtils::CBuilder::Platform::Unix;
c39276c1 2
83dcc064 3use warnings;
6b09c160
YST
4use strict;
5use ExtUtils::CBuilder::Base;
6
4371f648 7our $VERSION = '0.280236'; # VERSION
1a58b39a 8our @ISA = qw(ExtUtils::CBuilder::Base);
6b09c160 9
345dbb93
RGS
10sub link_executable {
11 my $self = shift;
673223b5
DM
12
13 # On some platforms (which ones??) $Config{cc} seems to be a better
14 # bet for linking executables than $Config{ld}. Cygwin is a notable
15 # exception.
345dbb93
RGS
16 local $self->{config}{ld} =
17 $self->{config}{cc} . " " . $self->{config}{ldflags};
18 return $self->SUPER::link_executable(@_);
19}
20
6b09c160
YST
21sub link {
22 my $self = shift;
23 my $cf = $self->{config};
83dcc064 24
6b09c160
YST
25 # Some platforms (notably Mac OS X 10.3, but some others too) expect
26 # the syntax "FOO=BAR /bin/command arg arg" to work in %Config
27 # (notably $Config{ld}). It usually works in system(SCALAR), but we
28 # use system(LIST). We fix it up here with 'env'.
83dcc064 29
6b09c160
YST
30 local $cf->{ld} = $cf->{ld};
31 if (ref $cf->{ld}) {
32 unshift @{$cf->{ld}}, 'env' if $cf->{ld}[0] =~ /^\s*\w+=/;
33 } else {
34 $cf->{ld} =~ s/^(\s*\w+=)/env $1/;
35 }
83dcc064 36
6b09c160
YST
37 return $self->SUPER::link(@_);
38}
39
401;