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