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)
diff --git a/Configure b/Configure
index bb951bd..1b6a7b6 100755
--- a/Configure
+++ b/Configure
@@ -621,10 +621,10 @@
 			{
 			$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 @@
 		}
 	}
 
+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;