summaryrefslogtreecommitdiffstats
path: root/Configure
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2016-08-29 21:48:12 +0200
committerRichard Levitte <levitte@openssl.org>2016-08-30 05:13:11 +0200
commit79822c3cd55b9241187123fd016cb3c9a3beffbb (patch)
tree55f0e316bb21acddc509f326c7d64c463ca0b905 /Configure
parentacc63c7d6d4ea28497a6192a3445b40f2af88133 (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>
Diffstat (limited to 'Configure')
-rwxr-xr-xConfigure47
1 files changed, 30 insertions, 17 deletions
diff --git a/Configure b/Configure
index dda0ae7df1..b65a4ce5cf 100755
--- a/Configure
+++ b/Configure
@@ -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;