VMS: add the possibility to use Itanium assembler with 'ias'
[openssl.git] / Configurations / 10-main.conf
index e773563dabee870a35c391e75f3e7fbb966e89b2..c9e4fd2e0f72ac531a33aad5fd0060f1c622eeee 100644 (file)
@@ -116,13 +116,19 @@ sub vc_wince_info {
 # Helper functions for the VMS configs
 my $vms_info = {};
 sub vms_info {
-    unless (%$vms_info) {
-        my $pointer_size = shift;
-        my $pointer_size_str = $pointer_size == 0 ? "" : "$pointer_size";
+    my $pointer_size_str = $config{target} =~ m|-p(\d+)$| ? $1 : "";
+
+    # For the case where Configure iterate through all config targets, such
+    # as when listing them and their details, we reset info if the pointer
+    # size changes.
+    if (%$vms_info && $vms_info->{pointer_size} ne $pointer_size_str) {
+        $vms_info = {};
+    }
 
+    unless (%$vms_info) {
         $vms_info->{disable_warns} = [ ];
         $vms_info->{pointer_size} = $pointer_size_str;
-        if ($pointer_size == 64) {
+        if ($pointer_size_str eq "64") {
             `PIPE CC /NOCROSS_REFERENCE /NOLIST /NOOBJECT /WARNINGS = DISABLE = ( MAYLOSEDATA3, EMPTYFILE ) NL: 2> NL:`;
             if ($? == 0) {
                 push @{$vms_info->{disable_warns}}, "MAYLOSEDATA3";
@@ -140,6 +146,16 @@ sub vms_info {
                 $vms_info->{def_zlib} =~ s|/.*$||g;
             }
         }
+
+        if ($config{target} =~ /-ia64/) {
+            `PIPE ias -H 2> NL:`;
+            if ($? == 0) {
+                $vms_info->{as} = "ias";
+                $vms_info->{asflags} = '-d debug "-N" vms_upcase';
+                $vms_info->{asoutflag} = "-o";
+                $vms_info->{perlasm_scheme} = "ias";
+            }
+        }
     }
     return $vms_info;
 }
@@ -148,6 +164,7 @@ my %targets = (
 
 #### Basic configs that should work on any 32-bit box
     "gcc" => {
+        inherit_from     => [ "BASE_unix" ],
         cc               => "gcc",
         cflags           => picker(debug   => "-O0 -g",
                                    release => "-O3"),
@@ -155,6 +172,7 @@ my %targets = (
         bn_ops           => "BN_LLONG",
     },
     "cc" => {
+        inherit_from     => [ "BASE_unix" ],
         cc               => "cc",
         cflags           => "-O",
         thread_scheme    => "(unknown)",
@@ -197,7 +215,7 @@ my %targets = (
                                               debug   => "-O0 -g",
                                               release => "-O3 -fomit-frame-pointer"),
                                        threads("-pthread")),
-        cppflags         => add("-DL_DEBIAN"),
+        cppflags         => add("-DL_ENDIAN"),
         ex_libs          => add(threads("-pthread")),
         bn_ops           => "BN_LLONG",
         shared_cflag     => "-fPIC",
@@ -218,7 +236,7 @@ my %targets = (
                                               debug   => "-O0 -g",
                                               release => "-O3"),
                                        threads("-pthread")),
-        cppflags         => add("-DL_DEBIAN"),
+        cppflags         => add("-DL_ENDIAN"),
         ex_libs          => add(threads("-pthread")),
         bn_ops           => "SIXTY_FOUR_BIT_LONG",
         perlasm_scheme   => "elf",
@@ -246,7 +264,7 @@ my %targets = (
         cflags           => add_before(picker(default => "-xarch=generic64 -xstrconst -Xa",
                                               debug   => "-g",
                                               release => "-xO5 -xdepend -xbuiltin")),
-        cppflags         => add("-DL_DEBIAN", threads("-D_REENTRANT")),
+        cppflags         => add("-DL_ENDIAN", threads("-D_REENTRANT")),
         thread_scheme    => "pthreads",
         lflags           => add(threads("-mt")),
         ex_libs          => add(threads("-lpthread")),
@@ -265,7 +283,7 @@ my %targets = (
                                               debug   => "-O0 -g",
                                               release => "-O3"),
                                        threads("-pthread")),
-        cppflags         => add("-DB_DEBIAN -DBN_DIV2W"),
+        cppflags         => add("-DB_ENDIAN -DBN_DIV2W"),
         ex_libs          => add(threads("-pthread")),
         bn_ops           => "BN_LLONG RC4_CHAR",
         shared_cflag     => "-fPIC",
@@ -298,7 +316,7 @@ my %targets = (
         cflags           => add_before(picker(default => "-xstrconst -Xa",
                                               debug   => "-g",
                                               release => "-xO5 -xdepend")),
-        cppflags         => add("-DB_DEBIAN -DBN_DIV2W",
+        cppflags         => add("-DB_ENDIAN -DBN_DIV2W",
                                 threads("-D_REENTRANT")),
         lflags           => add(threads("-mt")),
         ex_libs          => add(threads("-lpthread")),
@@ -330,7 +348,7 @@ my %targets = (
         cflags           => combine(picker(default => "-mabi=n32",
                                            debug   => "-g -O0",
                                            release => "-O3")),
-        cppflags         => combine("-DB_DEBIAN -DBN_DIV3W",
+        cppflags         => combine("-DB_ENDIAN -DBN_DIV3W",
                                     threads("-D_SGI_MP_SOURCE")),
         ex_libs          => add(threads("-lpthread")),
         bn_ops           => "RC4_CHAR SIXTY_FOUR_BIT",
@@ -347,7 +365,7 @@ my %targets = (
         cflags           => combine(picker(default => "-n32 -mips3 -use_readonly_const -G0 -rdata_shared",
                                            debug   => "-g -O0",
                                            release => "-O2")),
-        cppflags         => combine("-DB_DEBIAN -DBN_DIV3W",
+        cppflags         => combine("-DB_ENDIAN -DBN_DIV3W",
                                     threads("-D_SGI_MP_SOURCE")),
         ex_libs          => add(threads("-lpthread")),
         bn_ops           => "RC4_CHAR SIXTY_FOUR_BIT",
@@ -365,7 +383,7 @@ my %targets = (
         cflags           => combine(picker(default => "-mabi=64 -mips4",
                                            debug   => "-g -O0",
                                            release => "-O3")),
-        cppflags         => combine("-DB_DEBIAN -DBN_DIV3W",
+        cppflags         => combine("-DB_ENDIAN -DBN_DIV3W",
                                     threads("-D_SGI_MP_SOURCE")),
         ex_libs          => add(threads("-lpthread")),
         bn_ops           => "RC4_CHAR SIXTY_FOUR_BIT_LONG",
@@ -382,7 +400,7 @@ my %targets = (
         cflags           => combine(picker(default => "-64 -mips4 -use_readonly_const -G0 -rdata_shared",
                                            debug   => "-g -O0",
                                            release => "-O2")),
-        cppflags         => combine("-DB_DEBIAN -DBN_DIV3W",
+        cppflags         => combine("-DB_ENDIAN -DBN_DIV3W",
                                     threads("-D_SGI_MP_SOURCE")),
         ex_libs          => add(threads("-lpthread")),
         bn_ops           => "RC4_CHAR SIXTY_FOUR_BIT_LONG",
@@ -427,7 +445,7 @@ my %targets = (
         cflags           => combine(picker(debug   => "-O0 -g",
                                            release => "-O3"),
                                     threads("-pthread")),
-        cppflags         => "-DB_DEBIAN -DBN_DIV2W",
+        cppflags         => "-DB_ENDIAN -DBN_DIV2W",
         ex_libs          => add("-Wl,+s -ldld", threads("-pthread")),
         bn_ops           => "BN_LLONG",
         thread_scheme    => "pthreads",
@@ -446,7 +464,7 @@ my %targets = (
         cc               => "gcc",
         cflags           => combine(picker(debug   => "-O0 -g",
                                            release => "-O3")),
-        cppflags         => combine("-DB_DEBIAN", threads("-D_REENTRANT")),
+        cppflags         => combine("-DB_ENDIAN", threads("-D_REENTRANT")),
         ex_libs          => add("-ldl"),
         bn_ops           => "SIXTY_FOUR_BIT_LONG RC4_CHAR",
         thread_scheme    => "pthreads",
@@ -465,7 +483,7 @@ my %targets = (
         cflags           => combine(picker(default => "+Optrs_strongly_typed -Ae +ESlit",
                                            debug   => "+O0 +d -g",
                                            release => "+O3")),
-        cppflags         => combine("-DB_DEBIAN -DBN_DIV2W -DMD32_XARRAY",
+        cppflags         => combine("-DB_ENDIAN -DBN_DIV2W -DMD32_XARRAY",
                                     threads("-D_REENTRANT")),
         ex_libs          => add("-Wl,+s -ldld",threads("-lpthread")),
         bn_ops           => "RC4_CHAR",
@@ -487,7 +505,7 @@ my %targets = (
         cflags           => combine(picker(default => "+DD64 +Optrs_strongly_typed -Ae +ESlit",
                                            debug   => "+O0 +d -g",
                                            release => "+O3")),
-        cppflags         => combine("-DB_DEBIAN -DMD32_XARRAY",
+        cppflags         => combine("-DB_ENDIAN -DMD32_XARRAY",
                                     threads("-D_REENTRANT")),
         ex_libs          => add("-ldl",threads("-lpthread")),
         bn_ops           => "SIXTY_FOUR_BIT_LONG RC4_CHAR",
@@ -507,7 +525,7 @@ my %targets = (
         cflags           => combine(picker(default => "-Ae +DD32 +Olit=all -z",
                                            debug   => "+O0 +d -g",
                                            release => "+O2")),
-        cppflags         => combine("-DB_DEBIAN", threads("-D_REENTRANT")),
+        cppflags         => combine("-DB_ENDIAN", threads("-D_REENTRANT")),
         ex_libs          => add("-ldl",threads("-lpthread")),
         bn_ops           => "SIXTY_FOUR_BIT",
         thread_scheme    => "pthreads",
@@ -524,7 +542,7 @@ my %targets = (
         cflags           => combine(picker(default => "-Ae +DD64 +Olit=all -z",
                                            debug   => "+O0 +d -g",
                                            release => "+O3")),
-        cppflags         => combine("-DB_DEBIAN", threads("-D_REENTRANT")),
+        cppflags         => combine("-DB_ENDIAN", threads("-D_REENTRANT")),
         ex_libs          => add("-ldl", threads("-lpthread")),
         bn_ops           => "SIXTY_FOUR_BIT_LONG",
         thread_scheme    => "pthreads",
@@ -542,7 +560,7 @@ my %targets = (
         cflags           => combine(picker(debug   => "-O0 -g",
                                            release => "-O3"),
                                     threads("-pthread")),
-        cppflags         => "-DB_DEBIAN",
+        cppflags         => "-DB_ENDIAN",
         ex_libs          => add("-ldl", threads("-pthread")),
         bn_ops           => "SIXTY_FOUR_BIT",
         thread_scheme    => "pthreads",
@@ -560,7 +578,7 @@ my %targets = (
                                            debug   => "-O0 -g",
                                            release => "-O3"),
                                     threads("-pthread")),
-        cppflags         => "-DB_DEBIAN",
+        cppflags         => "-DB_ENDIAN",
         ex_libs          => add("-ldl", threads("-pthread")),
         bn_ops           => "SIXTY_FOUR_BIT_LONG",
         thread_scheme    => "pthreads",
@@ -578,7 +596,7 @@ my %targets = (
         cc               => "gcc",
         cflags           => "-O3",
         cppflags         => "-D_ENDIAN -DBN_DIV2W -D_POSIX_SOURCE -D_SOCKET_SOURCE",
-        includes         => [ "/SYSLOG/PUB" ],
+        includes         => add("/SYSLOG/PUB"),
         sys_id           => "MPE",
         lflags           => add("-L/SYSLOG/PUB"),
         ex_libs          => add("-lsyslog -lsocket -lcurses"),
@@ -630,6 +648,10 @@ my %targets = (
                                            debug   => "-O0 -g",
                                            release => "-O3"),
                                     threads("-pthread")),
+        cxxflags         => combine(picker(default => "-std=c++11 -Wall",
+                                           debug   => "-O0 -g",
+                                           release => "-O3"),
+                                    threads("-pthread")),
         cppflags         => "-DOPENSSL_USE_NODELETE",
         ex_libs          => add("-ldl", threads("-pthread")),
         bn_ops           => "BN_LLONG RC4_CHAR",
@@ -1296,6 +1318,7 @@ my %targets = (
         inherit_from     => [ "BASE_Windows" ],
         template         => 1,
         cc               => "cl",
+        cpp              => '$(CC) /EP /C',
         cflags           => "-W3 -wd4090 -Gs0 -GF -Gy -nologo",
         defines          => add("OPENSSL_SYS_WIN32", "WIN32_LEAN_AND_MEAN",
                                 "L_ENDIAN", "_CRT_SECURE_NO_DEPRECATE",
@@ -1431,17 +1454,18 @@ my %targets = (
                                      : " /MC"; }),
                    debug   => "/Od",
                    release => "/O1i"),
-        cppflags         => sub { vc_wince_info()->{defines}; },
+        cppflags         => sub { vc_wince_info()->{cppflags}; },
         defines          =>
             picker(default => [ "UNICODE", "_UNICODE", "OPENSSL_SYS_WINCE",
                                 "WIN32_LEAN_AND_MEAN", "L_ENDIAN", "DSO_WIN32",
                                 "NO_CHMOD", "OPENSSL_SMALL_FOOTPRINT" ],
                    debug   => [ "DEBUG", "_DEBUG" ]),
         includes         =>
-            combine(sub { defined(env('WCECOMPAT'))
-                          ? '$(WCECOMPAT)/include' : (); },
-                    sub { defined(env('PORTSDK_LIBPATH'))
-                          ? '$(PORTSDK_LIBPATH)/../../include' : (); }),
+            add(combine(sub { defined(env('WCECOMPAT'))
+                              ? '$(WCECOMPAT)/include' : (); },
+                        sub { defined(env('PORTSDK_LIBPATH'))
+                                  ? '$(PORTSDK_LIBPATH)/../../include'
+                                  : (); })),
         lflags           => add(combine("/nologo /opt:ref",
                                         sub { vc_wince_info()->{lflags}; },
                                         sub { defined(env('PORTSDK_LIBPATH'))
@@ -1827,14 +1851,29 @@ my %targets = (
     },
 
     ##### VMS
+    # Most things happen in vms-generic.
+    # Note that vms_info extracts the pointer size from the end of
+    # the target name, and will assume that anything matching /-p\d+$/
+    # indicates the pointer size setting for the desired target.
     "vms-generic" => {
         inherit_from     => [ "BASE_VMS" ],
         template         => 1,
         cc               => "CC/DECC",
-        cflags           => picker(default => "/STANDARD=(ISOC94,RELAXED)/NOLIST/PREFIX=ALL",
-                                   debug   => "/NOOPTIMIZE/DEBUG",
-                                   release => "/OPTIMIZE/NODEBUG"),
-        defines          => add("OPENSSL_USE_NODELETE"),
+        cpp              => '$(CC)/PREPROCESS_ONLY=SYS$OUTPUT:',
+        cflags           =>
+            combine(picker(default => "/STANDARD=(ISOC94,RELAXED)/NOLIST/PREFIX=ALL",
+                           debug   => "/NOOPTIMIZE/DEBUG",
+                           release => "/OPTIMIZE/NODEBUG"),
+                    sub { my @warnings =
+                              @{vms_info()->{disable_warns}};
+                          @warnings
+                              ? "/WARNINGS=DISABLE=(".join(",",@warnings).")" : (); }),
+        defines          =>
+            add("OPENSSL_USE_NODELETE",
+                sub {
+                    return vms_info()->{def_zlib}
+                        ? "LIBZ=\"\"\"".vms_info()->{def_zlib}."\"\"\"" : ();
+                }),
         lflags           => picker(default => "/MAP='F\$PARSE(\".MAP\",\"\$\@\")'",
                                    debug   => "/DEBUG/TRACEBACK",
                                    release => "/NODEBUG/NOTRACEBACK"),
@@ -1842,116 +1881,63 @@ my %targets = (
         # no_inst_lib_cflags is used instead of lib_cflags by descrip.mms.tmpl
         # for object files belonging to selected internal libraries
         no_inst_lib_cflags => "",
+        ex_libs          => add(sub { return vms_info()->{zlib} || (); }),
         shared_target    => "vms-shared",
         dso_scheme       => "vms",
         thread_scheme    => "pthreads",
 
-        apps_aux_src     => "vms_decc_init.c vms_term_sock.c",
+        as               => sub { vms_info()->{as} },
+        asflags          => sub { vms_info()->{asflags} },
+        asoutflag        => sub { vms_info()->{asoutflag} },
+        perlasm_scheme   => sub { vms_info()->{perlasm_scheme} },
+
+        apps_aux_src     => "vms_term_sock.c",
+        apps_init_src    => "vms_decc_init.c",
     },
 
+    # From HELP CC/POINTER_SIZE:
+    #
+    # ----------
+    # LONG[=ARGV] The compiler assumes 64-bit pointers. If the ARGV option to
+    #             LONG or 64 is present, the main argument argv will be an
+    #             array of long pointers instead of an array of short pointers.
+    #
+    # 64[=ARGV]   Same as LONG.
+    # ----------
+    #
+    # We don't want the hassle of dealing with 32-bit pointers with argv, so
+    # we force it to have 64-bit pointers, see the added cflags in the -p64
+    # config targets below.
+
     "vms-alpha" => {
         inherit_from     => [ "vms-generic" ],
-        cflags           => add(sub { my @warnings =
-                                          @{vms_info(0)->{disable_warns}};
-                                      @warnings
-                                          ? "/WARNINGS=DISABLE=(".join(",",@warnings).")" : (); }),
-        defines          =>
-                    add(sub {
-                            return vms_info(0)->{def_zlib}
-                                ? "LIBZ=\"\"\"".vms_info(0)->{def_zlib}."\"\"\"" : ();
-                            }),
-        ex_libs          => add(sub { return vms_info(0)->{zlib} || (); }),
-        pointer_size     => sub { return vms_info(0)->{pointer_size} },
-        #as               => "???",
-        #debug_aflags     => "/NOOPTIMIZE/DEBUG",
-        #release_aflags   => "/OPTIMIZE/NODEBUG",
-        bn_opts          => "SIXTY_FOUR_BIT RC4_INT",
+        bn_ops           => "SIXTY_FOUR_BIT RC4_INT",
+        pointer_size     => "",
     },
     "vms-alpha-p32" => {
-        inherit_from     => [ "vms-generic" ],
-        cflags           =>
-            add("/POINTER_SIZE=32",
-                sub { my @warnings =
-                          @{vms_info(32)->{disable_warns}};
-                      @warnings
-                          ? "/WARNINGS=DISABLE=(".join(",",@warnings).")" : ();
-                } ),
-        defines          =>
-                    add(sub {
-                            return vms_info(32)->{def_zlib}
-                                ? "LIBZ=\"\"\"".vms_info(32)->{def_zlib}."\"\"\"" : ();
-                            }),
-        ex_libs          => add(sub { return vms_info(32)->{zlib} || (); }),
-        pointer_size     => sub { return vms_info(32)->{pointer_size} },
+        inherit_from     => [ "vms-alpha" ],
+        cflags           => add("/POINTER_SIZE=32"),
+        pointer_size     => "32",
     },
     "vms-alpha-p64" => {
-        inherit_from     => [ "vms-generic" ],
-        cflags           =>
-            add("/POINTER_SIZE=64=ARGV",
-                sub { my @warnings =
-                          @{vms_info(64)->{disable_warns}};
-                      @warnings
-                          ? "/WARNINGS=DISABLE=(".join(",",@warnings).")" : ();
-                } ),
-        defines          =>
-                    add(sub {
-                            return vms_info(64)->{def_zlib}
-                                ? "LIBZ=\"\"\"".vms_info(64)->{def_zlib}."\"\"\"" : ();
-                            }),
-        ex_libs          => add(sub { return vms_info(64)->{zlib} || (); }),
-        pointer_size     => sub { return vms_info(64)->{pointer_size} },
+        inherit_from     => [ "vms-alpha" ],
+        cflags           => add("/POINTER_SIZE=64=ARGV"),
+        pointer_size     => "64",
     },
     "vms-ia64" => {
         inherit_from     => [ "vms-generic" ],
-        cflags           => add(sub { my @warnings =
-                                          @{vms_info(0)->{disable_warns}};
-                                      @warnings
-                                          ? "/WARNINGS=DISABLE=(".join(",",@warnings).")" : (); }),
-        defines          =>
-                    add(sub {
-                            return vms_info(0)->{def_zlib}
-                                ? "LIBZ=\"\"\"".vms_info(0)->{def_zlib}."\"\"\"" : ();
-                            }),
-        ex_libs          => add(sub { return vms_info(0)->{zlib} || (); }),
-        pointer_size     => sub { return vms_info(0)->{pointer_size} },
-        #as               => "I4S",
-        #debug_aflags     => "/NOOPTIMIZE/DEBUG",
-        #release_aflags   => "/OPTIMIZE/NODEBUG",
-        bn_opts          => "SIXTY_FOUR_BIT RC4_INT",
+        bn_ops           => "SIXTY_FOUR_BIT RC4_INT",
+        pointer_size     => "",
     },
     "vms-ia64-p32" => {
-        inherit_from     => [ "vms-generic" ],
-        cflags           =>
-            add("/POINTER_SIZE=32",
-                sub { my @warnings =
-                          @{vms_info(32)->{disable_warns}};
-                      @warnings
-                          ? "/WARNINGS=DISABLE=(".join(",",@warnings).")" : ();
-                } ),
-        defines          =>
-                    add(sub {
-                            return vms_info(32)->{def_zlib}
-                                ? "LIBZ=\"\"\"".vms_info(32)->{def_zlib}."\"\"\"" : ();
-                            }),
-        ex_libs          => add(sub { return vms_info(32)->{zlib} || (); }),
-        pointer_size     => sub { return vms_info(32)->{pointer_size} },
+        inherit_from     => [ "vms-ia64" ],
+        cflags           => add("/POINTER_SIZE=32"),
+        pointer_size     => "32",
     },
     "vms-ia64-p64" => {
-        inherit_from     => [ "vms-generic" ],
-        cflags           =>
-            add("/POINTER_SIZE=64=ARGV",
-                sub { my @warnings =
-                          @{vms_info(64)->{disable_warns}};
-                      @warnings
-                          ? "/WARNINGS=DISABLE=(".join(",",@warnings).")" : ();
-                } ),
-        defines          =>
-                    add(sub {
-                            return vms_info(64)->{def_zlib}
-                                ? "LIBZ=\"\"\"".vms_info(64)->{def_zlib}."\"\"\"" : ();
-                            }),
-        ex_libs          => add(sub { return vms_info(64)->{zlib} || (); }),
-        pointer_size     => sub { return vms_info(64)->{pointer_size} },
+        inherit_from     => [ "vms-ia64" ],
+        cflags           => add("/POINTER_SIZE=64=ARGV"),
+        pointer_size     => "64",
     },
 
 );