Skip to content

Commit

Permalink
util/perl/OpenSSL/config.pm: refactor map_guess()
Browse files Browse the repository at this point in the history
map_guess() is now table driven, just like get_system().
Additionally, it now takes a config hash table and returns one of its
own.  This way, 'Configure' can pass whatever it has already found to
OpenSSL::config::get_platform(), and easily merge the returned hash
table into its %config.

This also gets rid of variables that we no longer need.  That includes
$PERL and all the $__CNF_ environment variables.

Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from #11230)
  • Loading branch information
levitte committed Jun 28, 2020
1 parent 081436b commit e39795a
Show file tree
Hide file tree
Showing 2 changed files with 418 additions and 384 deletions.
20 changes: 18 additions & 2 deletions Configure
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ use File::Path qw/mkpath/;
use OpenSSL::fallback "$FindBin::Bin/external/perl/MODULES.txt";
use OpenSSL::Glob;
use OpenSSL::Template;
use OpenSSL::config;

# see INSTALL.md for instructions.

Expand Down Expand Up @@ -608,8 +609,6 @@ while ((my $first, my $second) = (shift @list, shift @list)) {
# To remove something from %disabled, use "enable-foo".
# For symmetry, "disable-foo" is a synonym for "no-foo".

&usage if ($#ARGV < 0);

# For the "make variables" CPPINCLUDES and CPPDEFINES, we support lists with
# platform specific list separators. Users from those platforms should
# recognise those separators from how you set up the PATH to find executables.
Expand Down Expand Up @@ -1068,6 +1067,23 @@ if (grep { /-rpath\b/ } ($user{LDFLAGS} ? @{$user{LDFLAGS}} : ())
"***** any of asan, msan or ubsan\n";
}

# If no target was given, try guessing.
unless ($target) {
my %system_config = OpenSSL::config::get_platform(%config, %user);

# The $system_config{disable} is used to populate %disabled with
# entries that aren't already there.
foreach ( @{$system_config{disable} // []} ) {
$disabled{$_} = 'system' unless defined $disabled{$_};
}
delete $system_config{disable};

# Override config entries with stuff from the guesser.
# It's assumed that this really is nothing new.
%config = ( %config, %system_config );
$target = $system_config{target};
}

sub disable {
my $disable_type = shift;

Expand Down

0 comments on commit e39795a

Please sign in to comment.