Configuration: Simplify the way vms information is retrieved
authorRichard Levitte <levitte@openssl.org>
Tue, 12 Apr 2016 14:03:02 +0000 (16:03 +0200)
committerRichard Levitte <levitte@openssl.org>
Wed, 13 Apr 2016 09:36:46 +0000 (11:36 +0200)
Reviewed-by: Matt Caswell <matt@openssl.org>
Configurations/10-main.conf

index 52953a7..8c6ee7f 100644 (file)
@@ -78,23 +78,26 @@ sub vc_wince_info {
 my $vms_info = {};
 sub vms_info {
     unless (%$vms_info) {
-       $vms_info->{disable_warns} = [ ];
-       $vms_info->{disable_warns_p32} = [ ];
-       $vms_info->{disable_warns_p64} = [ ];
-       `PIPE CC /NOCROSS_REFERENCE /NOLIST /NOOBJECT /WARNINGS = DISABLE = ( MAYLOSEDATA3, EMPTYFILE ) NL: 2> NL:`;
-       if ($? == 0) {
-           push @{$vms_info->{disable_warns_p64}}, "MAYLOSEDATA3";
-       }
+        my $pointer_size = shift;
+        my $pointer_size_str = $pointer_size == 0 ? "" : "$pointer_size";
+
+        $vms_info->{disable_warns} = [ ];
+        if ($pointer_size == 64) {
+            `PIPE CC /NOCROSS_REFERENCE /NOLIST /NOOBJECT /WARNINGS = DISABLE = ( MAYLOSEDATA3, EMPTYFILE ) NL: 2> NL:`;
+            if ($? == 0) {
+                push @{$vms_info->{disable_warns}}, "MAYLOSEDATA3";
+            }
+        }
 
         unless ($disabled{zlib}) {
+            my $default_zlib = 'GNV$LIBZSHR' . $pointer_size_str;
             if (defined($disabled{"zlib-dynamic"})) {
-                $vms_info->{zlib} = $withargs{zlib_lib} || 'GNV$LIBZSHR/SHARE';
-                $vms_info->{zlib_p32} = $withargs{zlib_lib} || 'GNV$LIBZSHR32/SHARE';
-                $vms_info->{zlib_p64} = $withargs{zlib_lib} || 'GNV$LIBZSHR64/SHARE';
+                $vms_info->{zlib} = $withargs{zlib_lib} || "$default_zlib/SHARE";
             } else {
-                $vms_info->{def_zlib} = $withargs{zlib_lib} || 'GNV$LIBZSHR';
-                $vms_info->{def_zlib_p32} = $withargs{zlib_lib} || 'GNV$LIBZSHR32';
-                $vms_info->{def_zlib_p64} = $withargs{zlib_lib} || 'GNV$LIBZSHR64';
+                $vms_info->{def_zlib} = $withargs{zlib_lib} || $default_zlib;
+                # In case the --with-zlib-lib value contains something like
+                # /SHARE or /LIB or so at the end, remove it.
+                $vms_info->{def_zlib} =~ s|/.*$||g;
             }
         }
     }
@@ -1764,100 +1767,100 @@ sub vms_info {
     "vms-alpha" => {
         inherit_from     => [ "vms-generic" ],
         cflags           => add(sub { my @warnings =
-                                          @{vms_info()->{disable_warns}};
+                                          @{vms_info(0)->{disable_warns}};
                                       @warnings
                                           ? "/WARNINGS=DISABLE=(".join(",",@warnings).")" : (); }),
         defines          =>
                     add(sub {
-                            return vms_info()->{def_zlib}
-                                ? "LIBZ=\"\"\"".vms_info()->{def_zlib}."\"\"\"" : ();
+                            return vms_info(0)->{def_zlib}
+                                ? "LIBZ=\"\"\"".vms_info(0)->{def_zlib}."\"\"\"" : ();
                             }),
-        ex_libs          => add(sub { return vms_info()->{zlib} || (); }),
+        ex_libs          => add(sub { return vms_info(0)->{zlib} || (); }),
         #as               => "???",
         #debug_aflags     => "/NOOPTIMIZE/DEBUG",
         #release_aflags   => "/OPTIMIZE/NODEBUG",
         bn_opts          => "SIXTY_FOUR_BIT RC4_INT RC4_CHUNK_LL DES_PTR BF_PTR",
     },
     "vms-alpha-p32" => {
-        inherit_from     => [ "vms-alpha" ],
+        inherit_from     => [ "vms-generic" ],
         cflags           =>
             add("/POINTER_SIZE=32",
                 sub { my @warnings =
-                          @{vms_info()->{disable_warns_p32}};
+                          @{vms_info(32)->{disable_warns}};
                       @warnings
                           ? "/WARNINGS=DISABLE=(".join(",",@warnings).")" : ();
                 } ),
         defines          =>
                     add(sub {
-                            return vms_info()->{def_zlib_p32}
-                                ? "LIBZ=\"\"\"".vms_info()->{def_zlib_p32}."\"\"\"" : ();
+                            return vms_info(32)->{def_zlib}
+                                ? "LIBZ=\"\"\"".vms_info(32)->{def_zlib}."\"\"\"" : ();
                             }),
-        ex_libs          => add(sub { return vms_info()->{zlib_p32} || (); }),
+        ex_libs          => add(sub { return vms_info(32)->{zlib} || (); }),
     },
     "vms-alpha-p64" => {
-        inherit_from     => [ "vms-alpha" ],
+        inherit_from     => [ "vms-generic" ],
         cflags           =>
             add("/POINTER_SIZE=64=ARGV",
                 sub { my @warnings =
-                          @{vms_info()->{disable_warns_p64}};
+                          @{vms_info(64)->{disable_warns}};
                       @warnings
                           ? "/WARNINGS=DISABLE=(".join(",",@warnings).")" : ();
                 } ),
         defines          =>
                     add(sub {
-                            return vms_info()->{def_zlib_p64}
-                                ? "LIBZ=\"\"\"".vms_info()->{def_zlib_p64}."\"\"\"" : ();
+                            return vms_info(64)->{def_zlib}
+                                ? "LIBZ=\"\"\"".vms_info(64)->{def_zlib}."\"\"\"" : ();
                             }),
-        ex_libs          => add(sub { return vms_info()->{zlib_p64} || (); }),
+        ex_libs          => add(sub { return vms_info(64)->{zlib} || (); }),
     },
     "vms-ia64" => {
         inherit_from     => [ "vms-generic" ],
         cflags           => add(sub { my @warnings =
-                                          @{vms_info()->{disable_warns}};
+                                          @{vms_info(0)->{disable_warns}};
                                       @warnings
                                           ? "/WARNINGS=DISABLE=(".join(",",@warnings).")" : (); }),
         defines          =>
                     add(sub {
-                            return vms_info()->{def_zlib}
-                                ? "LIBZ=\"\"\"".vms_info()->{def_zlib}."\"\"\"" : ();
+                            return vms_info(0)->{def_zlib}
+                                ? "LIBZ=\"\"\"".vms_info(0)->{def_zlib}."\"\"\"" : ();
                             }),
-        ex_libs          => add(sub { return vms_info()->{zlib} || (); }),
+        ex_libs          => add(sub { return vms_info(0)->{zlib} || (); }),
         #as               => "I4S",
         #debug_aflags     => "/NOOPTIMIZE/DEBUG",
         #release_aflags   => "/OPTIMIZE/NODEBUG",
         bn_opts          => "SIXTY_FOUR_BIT RC4_INT RC4_CHUNK_LL DES_PTR BF_PTR",
     },
     "vms-ia64-p32" => {
-        inherit_from     => [ "vms-ia64" ],
+        inherit_from     => [ "vms-generic" ],
         cflags           =>
             add("/POINTER_SIZE=32",
                 sub { my @warnings =
-                          @{vms_info()->{disable_warns_p32}};
+                          @{vms_info(32)->{disable_warns}};
                       @warnings
                           ? "/WARNINGS=DISABLE=(".join(",",@warnings).")" : ();
                 } ),
         defines          =>
                     add(sub {
-                            return vms_info()->{def_zlib_p32}
-                                ? "LIBZ=\"\"\"".vms_info()->{def_zlib_p32}."\"\"\"" : ();
+                            return vms_info(32)->{def_zlib}
+                                ? "LIBZ=\"\"\"".vms_info(32)->{def_zlib}."\"\"\"" : ();
                             }),
-        ex_libs          => add(sub { return vms_info()->{zlib_p32} || (); }),
+        ex_libs          => add(sub { return vms_info(32)->{zlib} || (); }),
     },
     "vms-ia64-p64" => {
-        inherit_from     => [ "vms-ia64" ],
+        inherit_from     => [ "vms-generic" ],
         cflags           =>
             add("/POINTER_SIZE=64=ARGV",
                 sub { my @warnings =
-                          @{vms_info()->{disable_warns_p64}};
+                          @{vms_info(64)->{disable_warns}};
                       @warnings
                           ? "/WARNINGS=DISABLE=(".join(",",@warnings).")" : ();
                 } ),
         defines          =>
                     add(sub {
-                            return vms_info()->{def_zlib_p64}
-                                ? "LIBZ=\"\"\"".vms_info()->{def_zlib_p64}."\"\"\"" : ();
+                            return vms_info(64)->{def_zlib}
+                                ? "LIBZ=\"\"\"".vms_info(64)->{def_zlib}."\"\"\"" : ();
                             }),
-        ex_libs          => add(sub { return vms_info()->{zlib_p64} || (); }),
+        ex_libs          => add(sub { return vms_info(64)->{zlib} || (); }),
     },
 
 );