Configure: try to make sure every config target name is unique
authorRichard Levitte <levitte@openssl.org>
Tue, 9 Jan 2018 18:51:19 +0000 (19:51 +0100)
committerRichard Levitte <levitte@openssl.org>
Tue, 9 Jan 2018 18:51:19 +0000 (19:51 +0100)
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/5047)

Configurations/README
Configure

index 9f31dfcd9eb445f0bad464a8a05cc1d0f0dc79eb..9d5dc5c55ceb18be32a8179d320b89b07c9b1b50 100644 (file)
@@ -18,10 +18,14 @@ configuration in diverse ways:
 Configurations of OpenSSL target platforms
 ==========================================
 
 Configurations of OpenSSL target platforms
 ==========================================
 
-Target configurations are a collection of facts that we know about
+Configuration targets are a collection of facts that we know about
 different platforms and their capabilities.  We organise them in a
 hash table, where each entry represent a specific target.
 
 different platforms and their capabilities.  We organise them in a
 hash table, where each entry represent a specific target.
 
+Note that configuration target names must be unique across all config
+files.  The Configure script does check that a config file doesn't
+have config targets that shadow config targets from other files.
+
 In each table entry, the following keys are significant:
 
         inherit_from    => Other targets to inherit values from.
 In each table entry, the following keys are significant:
 
         inherit_from    => Other targets to inherit values from.
index b172595ece131c6c61cf0f843e9c025e7dc0a3a6..67e59a252daa0c61805fc6b41898033eb2ceee81 100755 (executable)
--- a/Configure
+++ b/Configure
@@ -2381,6 +2381,17 @@ sub read_config {
 
        %targets = read_eval_file($fname);
     }
 
        %targets = read_eval_file($fname);
     }
+    my %preexisting = ();
+    foreach (sort keys %targets) {
+        $preexisting{$_} = 1 if $table{$_};
+    }
+    die <<"EOF",
+The following config targets from $fname
+shadow pre-existing config targets with the same name:
+EOF
+        map { "  $_\n" } sort keys %preexisting
+        if %preexisting;
+
 
     # For each target, check that it's configured with a hash table.
     foreach (keys %targets) {
 
     # For each target, check that it's configured with a hash table.
     foreach (keys %targets) {