From: Jason Vas Dias (via RT) <perlbug-followup@perl.org>
Message-ID: <rt-3.0.11-37582-123738.12.
3509768746337@perl.org>
p4raw-id: //depot/perl@26074
# non-GCC?) C compilers, but gcc uses an additional include directory.
sub inc_dirs
{
- my $from_gcc = `$Config{cc} -v 2>&1`;
- $from_gcc =~ s:^Reading specs from (.*?)/specs\b.*:$1/include:s;
-
+ my $from_gcc = `LC_ALL=C $Config{cc} -v 2>&1`;
+ if( !( $from_gcc =~ s:^Reading specs from (.*?)/specs\b.*:$1/include:s ) )
+ { # gcc-4+ :
+ $from_gcc = `LC_ALL=C $Config{cc} -print-search-dirs 2>&1`;
+ if ( !($from_gcc =~ s/^install:\s*([^\s]+[^\s\/])([\s\/]*).*$/$1\/include/s) )
+ {
+ $from_gcc = '';
+ };
+ };
length($from_gcc) ? ($from_gcc, $Config{usrinc}) : ($Config{usrinc});
}