+# If any %useradd entry has been set, we must check that the "make
+# variables" haven't been set. We start by checking of any %useradd entry
+# is set.
+if (grep { scalar @$_ > 0 } values %useradd) {
+ # Hash of env / make variables names. The possible values are:
+ # 1 - "make vars"
+ # 2 - %useradd entry set
+ # 3 - both set
+ my %detected_vars =
+ map { my $v = 0;
+ $v += 1 if $cmdvars{$_};
+ $v += 2 if @{$useradd{$_}};
+ $_ => $v }
+ keys %useradd;
+
+ # If any of the corresponding "make variables" is set, we error
+ if (grep { $_ & 1 } values %detected_vars) {
+ my $names = join(', ', grep { $detected_vars{$_} > 0 }
+ sort keys %detected_vars);
+ die <<"_____";
+***** Mixing make variables and additional compiler/linker flags as
+***** configure command line option is not permitted.
+***** Affected make variables: $names
+_____
+ }
+}
+
+# Check through all supported command line variables to see if any of them
+# were set, and canonicalise the values we got. If no compiler or linker
+# flag or anything else that affects %useradd was set, we also check the
+# environment for values.
+my $anyuseradd =
+ grep { defined $_ && (ref $_ ne 'ARRAY' || @$_) } values %useradd;