diff options
author | Richard Levitte <levitte@openssl.org> | 2016-08-29 21:48:12 +0200 |
---|---|---|
committer | Richard Levitte <richard@levitte.org> | 2016-08-30 06:07:06 +0200 |
commit | b9b364488169e2f6b9508003a7eb2907cc2598be (patch) | |
tree | fb0583277f3b1850735a200ccea0582a4fd1d847 /Configure | |
parent | eac33e1cd3a45ab0d66be20a01ee9a5c0634781b (diff) |
Configure: Redo the logic for finding build file templates
Build file templates would be looked up like this if the user gave us
an additional directory to look for configuration files and build file
templates:
$OPENSSL_LOCAL_CONFIG_DIR/$OSTYPE-Makefile.tmpl
$SOURCEDIR/Configurations/$OSTYPE-Makefile.tmpl
$OPENSSL_LOCAL_CONFIG_DIR/Makefile.tmpl
$SOURCEDIR/Configurations/Makefile.tmpl
So for example, if the user created his own Makefile.tmpl and tried to
use it with a unixly config, it would never be user because we have a
unix-Makefile.tmpl in our Configurations directory. This is clearly
wrong, and this change makes it look in this order instead:
$OPENSSL_LOCAL_CONFIG_DIR/$OSTYPE-Makefile.tmpl
$OPENSSL_LOCAL_CONFIG_DIR/Makefile.tmpl
$SOURCEDIR/Configurations/$OSTYPE-Makefile.tmpl
$SOURCEDIR/Configurations/Makefile.tmpl
Reviewed-by: Rich Salz <rsalz@openssl.org>
(cherry picked from commit 79822c3cd55b9241187123fd016cb3c9a3beffbb)
Diffstat (limited to 'Configure')
-rwxr-xr-x | Configure | 47 |
1 files changed, 30 insertions, 17 deletions
@@ -1283,26 +1283,39 @@ my $buildinfo_debug = defined($ENV{CONFIGURE_DEBUG_BUILDINFO}); if ($builder eq "unified") { # Store the name of the template file we will build the build file from # in %config. This may be useful for the build file itself. - my $build_file_template; - - for my $filename (( $builder_platform."-".$target{build_file}.".tmpl", - $target{build_file}.".tmpl" )) { - if (defined $ENV{$local_config_envname}) { - if ($^O eq 'VMS') { - # VMS environment variables are logical names, - # which can be used as is - $build_file_template = $local_config_envname . ':' . $filename; - } else { - $build_file_template = catfile($ENV{$local_config_envname}, - $filename); - } - } + my @build_file_template_names = + ( $builder_platform."-".$target{build_file}.".tmpl", + $target{build_file}.".tmpl" ); + my @build_file_templates = (); + + # First, look in the user provided directory, if given + if (defined $ENV{$local_config_envname}) { + @build_file_templates = + map { + if ($^O eq 'VMS') { + # VMS environment variables are logical names, + # which can be used as is + $local_config_envname . ':' . $_; + } else { + catfile($ENV{$local_config_envname}, $_); + } + } + @build_file_template_names; + } + # Then, look in our standard directory + push @build_file_templates, + ( map { catfile($srcdir, "Configurations", $_) } + @build_file_template_names ); + my $build_file_template; + for $_ (@build_file_templates) { + $build_file_template = $_; last if -f $build_file_template; - $build_file_template = catfile($srcdir, "Configurations", $filename); - - last if -f $build_file_template; + $build_file_template = undef; + } + if (!defined $build_file_template) { + die "*** Couldn't find any of:\n", join("\n", @build_file_templates), "\n"; } $config{build_file_template} = $build_file_template; |