From b92013602b6666314ad200d48e10a1aaa2c5b2fa Mon Sep 17 00:00:00 2001 From: Richard Levitte Date: Thu, 8 Mar 2018 14:16:18 +0100 Subject: [PATCH] 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 (Merged from https://github.com/openssl/openssl/pull/5534) --- Configure | 20 ++++++++++++++++---- INSTALL | 24 +++--------------------- 2 files changed, 19 insertions(+), 25 deletions(-) diff --git a/Configure b/Configure index bb951bdfcd..1b6a7b63c8 100755 --- a/Configure +++ b/Configure @@ -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; diff --git a/INSTALL b/INSTALL index 3c8548dd3b..08758339a2 100644 --- a/INSTALL +++ b/INSTALL @@ -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