Configure: pass more suitable argument to compiler_predefined().

Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6174)
This commit is contained in:
Andy Polyakov 2018-05-04 14:25:45 +02:00
parent 0ad4078cd6
commit 41d6e0f36e
1 changed files with 8 additions and 9 deletions

View File

@ -1407,7 +1407,7 @@ unless ($disabled{asm}) {
} }
} }
my %predefined = compiler_predefined($config{CC}); my %predefined = compiler_predefined($config{CROSS_COMPILE}.$config{CC});
# Check for makedepend capabilities. # Check for makedepend capabilities.
if (!$disabled{makedepend}) { if (!$disabled{makedepend}) {
@ -3068,28 +3068,27 @@ sub run_dofile
sub compiler_predefined { sub compiler_predefined {
state %predefined; state %predefined;
my $default_compiler = shift; my $cc = shift;
return () if $^O eq 'VMS'; return () if $^O eq 'VMS';
die 'compiler_predefined called without a default compiler' die 'compiler_predefined called without a compiler command'
unless $default_compiler; unless $cc;
if (! $predefined{$default_compiler}) { if (! $predefined{$cc}) {
my $cc = "$config{CROSS_COMPILE}$default_compiler";
$predefined{$default_compiler} = {}; $predefined{$cc} = {};
# collect compiler pre-defines from gcc or gcc-alike... # collect compiler pre-defines from gcc or gcc-alike...
open(PIPE, "$cc -dM -E -x c /dev/null 2>&1 |"); open(PIPE, "$cc -dM -E -x c /dev/null 2>&1 |");
while (my $l = <PIPE>) { while (my $l = <PIPE>) {
$l =~ m/^#define\s+(\w+(?:\(\w+\))?)(?:\s+(.+))?/ or last; $l =~ m/^#define\s+(\w+(?:\(\w+\))?)(?:\s+(.+))?/ or last;
$predefined{$default_compiler}->{$1} = $2 // ''; $predefined{$cc}->{$1} = $2 // '';
} }
close(PIPE); close(PIPE);
} }
return %{$predefined{$default_compiler}}; return %{$predefined{$cc}};
} }
sub which sub which