Configure: Allow 'DEFINE[]=def'

DEFINE[] definitions end up pushed in @{$config{defines}} instead of
being added to the output file list of defines.  This allows for the
unusual case where we need something to be defined globally, so it
gets picked up by anything using $(CPPFLAGS).

Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
(Merged from https://github.com/openssl/openssl/pull/9679)
This commit is contained in:
Richard Levitte 2019-08-23 17:16:48 +02:00
parent b6b66573bd
commit ef57f7996b
1 changed files with 24 additions and 15 deletions

View File

@ -1908,7 +1908,7 @@ if ($builder eq "unified") {
qr/^\s*INCLUDE\[((?:\\.|[^\\\]])+)\]\s*=\s*(.*)\s*$/ qr/^\s*INCLUDE\[((?:\\.|[^\\\]])+)\]\s*=\s*(.*)\s*$/
=> sub { push @{$includes{$1}}, tokenize($expand_variables->($2)) => sub { push @{$includes{$1}}, tokenize($expand_variables->($2))
if !@skip || $skip[$#skip] > 0 }, if !@skip || $skip[$#skip] > 0 },
qr/^\s*DEFINE\[((?:\\.|[^\\\]])+)\]\s*=\s*(.*)\s*$/ qr/^\s*DEFINE\[((?:\\.|[^\\\]])*)\]\s*=\s*(.*)\s*$/
=> sub { push @{$defines{$1}}, tokenize($expand_variables->($2)) => sub { push @{$defines{$1}}, tokenize($expand_variables->($2))
if !@skip || $skip[$#skip] > 0 }, if !@skip || $skip[$#skip] > 0 },
qr/^\s*DEPEND\[((?:\\.|[^\\\]])*)\]\s*=\s*(.*)\s*$/ qr/^\s*DEPEND\[((?:\\.|[^\\\]])*)\]\s*=\s*(.*)\s*$/
@ -2109,24 +2109,33 @@ EOF
} }
} }
foreach (keys %defines) { foreach my $dest (keys %defines) {
my $dest = $_; my $ddest;
my $ddest = cleanfile($sourced, $_, $blddir);
# If the destination doesn't exist in source, it can only be if ($dest ne "") {
# a generated file in the build tree. $ddest = cleanfile($sourced, $dest, $blddir);
if (! -f $ddest) {
$ddest = cleanfile($buildd, $_, $blddir); # If the destination doesn't exist in source, it can only
if ($unified_info{rename}->{$ddest}) { # be a generated file in the build tree.
$ddest = $unified_info{rename}->{$ddest}; if (! -f $ddest) {
$ddest = cleanfile($buildd, $dest, $blddir);
if ($unified_info{rename}->{$ddest}) {
$ddest = $unified_info{rename}->{$ddest};
}
} }
} }
foreach (@{$defines{$dest}}) { foreach my $v (@{$defines{$dest}}) {
m|^([^=]*)(=.*)?$|; $v =~ m|^([^=]*)(=.*)?$|;
die "0 length macro name not permitted\n" if $1 eq ""; die "0 length macro name not permitted\n" if $1 eq "";
die "$1 defined more than once\n" if ($dest ne "") {
if defined $unified_info{defines}->{$ddest}->{$1}; die "$1 defined more than once\n"
$unified_info{defines}->{$ddest}->{$1} = $2; if defined $unified_info{defines}->{$ddest}->{$1};
$unified_info{defines}->{$ddest}->{$1} = $2;
} else {
die "$1 defined more than once\n"
if grep { $v eq $_ } @{$config{defines}};
push @{$config{defines}}, $v;
}
} }
} }
} }