Configure: disallow the mixture of compiling flags and env / make variables

Note that this might give surprising results if someone forgets an environment
variable that has been set previously.

Reviewed-by: Andy Polyakov <appro@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/5534)
This commit is contained in:
Richard Levitte 2018-03-08 14:16:18 +01:00
parent 310f28df2e
commit b92013602b
2 changed files with 19 additions and 25 deletions

View file

@ -621,10 +621,10 @@ while (@argvcopy)
{
$user{$1} = ref $user{$1} eq "ARRAY" ? [] : undef;
}
if (exists $useradd{$1})
{
$useradd{$1} = [];
}
#if (exists $useradd{$1})
# {
# $useradd{$1} = [];
# }
next;
}
@ -891,6 +891,18 @@ while (@argvcopy)
}
}
if (grep { scalar @$_ > 0 } values %useradd) {
my $detected_env = join(', ', grep { @{$useradd{$_}} || env($_) }
sort keys %useradd);
if ($detected_env) {
die <<"_____";
***** Mixing env / make variables and additional compiler/linker flags as
***** configure command line option is not permitted.
***** Affected env / make variables: $detected_env
_____
}
}
foreach (keys %user) {
my $value = env($_);
$value //= defined $user_synonyms{$_} ? env($user_synonyms{$_}) : undef;

24
INSTALL
View file

@ -581,30 +581,12 @@
RCFLAGS Flags for the Windows reources manipulator.
RM The command to remove files and directories.
These can be mixed with flags given on the command line.
Any variable assignment resets any corresponding flags
given before it, so for example:
These cannot be mixed with compiling / linking flags given
on the command line. In other words, something like this
isn't permitted.
./config -DFOO CPPFLAGS=-DBAR -DCOOKIE
Will end up having 'CPPFLAGS=-DBAR -DCOOKIE'.
Here is how the flags documented above are collected as
augmentation of these variables:
-Dxxx xxx is collected in CPPDEFINES
-Ixxx xxx is collected in CPPINCLUDES
-Wp,xxx collected in CPPFLAGS
-Lxxx collected in LDFLAGS
-lxxx collected in LDLIBS
-Wp,xxx collected in LDLIBS
-rpath xxx collected in LDLIBS
-R xxx collected in LDLIBS
-framework xxx collected in LDLIBS
-static collected in LDLIBS
-xxx collected in CFLAGS
+xxx collected in CFLAGS
reconf
reconfigure
Reconfigure from earlier data. This fetches the previous