Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
mattn committed Dec 12, 2010
1 parent 141901d commit 5ae7c10
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 4 deletions.
5 changes: 3 additions & 2 deletions lib/Devel/CheckLib.pm
Expand Up @@ -330,8 +330,9 @@ sub _cleanup_exe {
}

sub _findcc {
my @flags = grep { length } map { quotewords('\s+', 0, $_ || ()) }
@Config{qw(ccflags ldflags)};
# Need to use $keep=1 to work with MSWin32 backslashes and quotes
my @Config_ccflags_ldflags = @Config{qw(ccflags ldflags)}; # use copy so ASPerl will compile
my @flags = grep { length } map { quotewords('\s+', 1, $_ || ()) } @Config_ccflags_ldflags;
my @paths = split(/$Config{path_sep}/, $ENV{PATH});
my @cc = split(/\s+/, $Config{cc});
return (@cc, @flags) if -x $cc[0];
Expand Down
11 changes: 10 additions & 1 deletion t/bad-single-word-compiler.t
Expand Up @@ -10,9 +10,18 @@ plan tests => 1;
use Config;
BEGIN {
BEGIN { if (not $] < 5.006 ) { warnings->unimport('redefine') } }
*Config::STORE = sub { $_[0]->{$_[1]} = $_[2] } unless *Config::STORE
unless(defined($ActivePerl::VERSION) && $Config{cc} =~ /\bgcc\b/) {
*Config::STORE = sub { $_[0]->{$_[1]} = $_[2] }
}
}

if(defined($ActivePerl::VERSION) && $Config{cc} =~ /\bgcc\b/) {
my $obj = tied %Config::Config;
$obj->{cc} = "$^X $Config{cc}";
}
else {
$Config{cc} = "$^X $Config{cc}";
}

eval { $Config{cc} = 'flibbertigibbet' };
SKIP: {
Expand Down
12 changes: 11 additions & 1 deletion t/multi-word-compiler.t
Expand Up @@ -10,9 +10,19 @@ plan tests => 1;
use Config;
BEGIN {
BEGIN { if (not $] < 5.006 ) { warnings->unimport('redefine') } }
*Config::STORE = sub { $_[0]->{$_[1]} = $_[2] } unless *Config::STORE
unless(defined($ActivePerl::VERSION) && $Config{cc} =~ /\bgcc\b/) {
*Config::STORE = sub { $_[0]->{$_[1]} = $_[2] }
}
}

if(defined($ActivePerl::VERSION) && $Config{cc} =~ /\bgcc\b/) {
my $obj = tied %Config::Config;
$obj->{cc} = "$^X $Config{cc}";
}
else {
$Config{cc} = "$^X $Config{cc}";
}

eval { $Config{cc} = "$^X $Config{cc}" };
SKIP: {
skip "Couldn't update %Config", 1 if $@ =~ /%Config::Config is read-only/;
Expand Down

0 comments on commit 5ae7c10

Please sign in to comment.