Don't use CPP in Configurations/unix-Makefile.tmpl
[openssl.git] / Configurations / 10-main.conf
index 6b57549..03a53d3 100644 (file)
@@ -13,7 +13,7 @@ sub vc_win64a_info {
         } elsif ($disabled{asm}) {
             # assembler is still used to compile uplink shim
             $vc_win64a_info = { AS        => "ml64",
-                                ASFLAGS   => "/Zi",
+                                ASFLAGS   => "/nologo /Zi",
                                 asflags   => "/c /Cp /Cx",
                                 asoutflag => "/Fo" };
         } else {
@@ -679,6 +679,7 @@ my %targets = (
         shared_cflag     => "-fPIC",
         shared_ldflag    => "-Wl,-znodelete",
         shared_extension => ".so.\$(SHLIB_VERSION_NUMBER)",
+        enable           => [ "afalgeng" ],
     },
     "linux-generic64" => {
         inherit_from     => [ "linux-generic32" ],
@@ -816,7 +817,6 @@ my %targets = (
         inherit_from     => [ "linux-x86" ],
         CC               => "clang",
         CXX              => "clang++",
-        CFLAGS           => add("-Wextra"),
     },
     "linux-x86_64" => {
         inherit_from     => [ "linux-generic64", asm("x86_64_asm") ],
@@ -831,7 +831,6 @@ my %targets = (
         inherit_from     => [ "linux-x86_64" ],
         CC               => "clang",
         CXX              => "clang++",
-        CFLAGS           => add("-Wextra"),
     },
     "linux-x32" => {
         inherit_from     => [ "linux-generic32", asm("x86_64_asm") ],
@@ -940,99 +939,6 @@ my %targets = (
         ranlib           => "true",
     },
 
-#### Android: linux-* but without pointers to headers and libs.
-    #
-    # It takes pair of prior-set environment variables to make it work:
-    #
-    # CROSS_SYSROOT=/some/where/android-ndk-<ver>/platforms/android-<apiver>/arch-<arch>
-    # CROSS_COMPILE=<prefix>
-    #
-    # As well as PATH adjusted to cover ${CROSS_COMPILE}gcc and company.
-    # For example to compile for ICS and ARM with NDK 10d, you'd:
-    #
-    # ANDROID_NDK=/some/where/android-ndk-10d
-    # CROSS_SYSROOT=$ANDROID_NDK/platforms/android-14/arch-arm
-    # CROSS_COMPILE=arm-linux-androideabi-
-    # PATH=$ANDROID_NDK/toolchains/arm-linux-androideabi-4.8/prebuild/linux-x86_64/bin
-    #
-    "android" => {
-        inherit_from     => [ "linux-generic32" ],
-        # Special note about unconditional -fPIC and -pie. The underlying
-        # reason is that Lollipop refuses to run non-PIE. But what about
-        # older systems and NDKs? -fPIC was never problem, so the only
-        # concern is -pie. Older toolchains, e.g. r4, appear to handle it
-        # and binaries turn mostly functional. "Mostly" means that oldest
-        # Androids, such as Froyo, fail to handle executable, but newer
-        # systems are perfectly capable of executing binaries targeting
-        # Froyo. Keep in mind that in the nutshell Android builds are
-        # about JNI, i.e. shared libraries, not applications.
-        cflags           => add("-mandroid -fPIC --sysroot=\$(CROSS_SYSROOT) -Wa,--noexecstack"),
-        cxxflags         => add("-mandroid -fPIC --sysroot=\$(CROSS_SYSROOT) -Wa,--noexecstack"),
-        bin_cflags       => "-pie",
-    },
-    "android-x86" => {
-        inherit_from     => [ "android", asm("x86_asm") ],
-        CFLAGS           => add(picker(release => "-fomit-frame-pointer")),
-        bn_ops           => "BN_LLONG",
-        perlasm_scheme   => "android",
-    },
-    ################################################################
-    # Contemporary Android applications can provide multiple JNI
-    # providers in .apk, targeting multiple architectures. Among
-    # them there is "place" for two ARM flavours: generic eabi and
-    # armv7-a/hard-float. However, it should be noted that OpenSSL's
-    # ability to engage NEON is not constrained by ABI choice, nor
-    # is your ability to call OpenSSL from your application code
-    # compiled with floating-point ABI other than default 'soft'.
-    # [Latter thanks to __attribute__((pcs("aapcs"))) declaration.]
-    # This means that choice of ARM libraries you provide in .apk
-    # is driven by application needs. For example if application
-    # itself benefits from NEON or is floating-point intensive, then
-    # it might be appropriate to provide both libraries. Otherwise
-    # just generic eabi would do. But in latter case it would be
-    # appropriate to
-    #
-    #   ./Configure android-armeabi -D__ARM_MAX_ARCH__=8
-    #
-    # in order to build "universal" binary and allow OpenSSL take
-    # advantage of NEON when it's available.
-    #
-    "android-armeabi" => {
-        inherit_from     => [ "android", asm("armv4_asm") ],
-    },
-    "android-mips" => {
-        inherit_from     => [ "android", asm("mips32_asm") ],
-        perlasm_scheme   => "o32",
-    },
-
-    "android64" => {
-        inherit_from     => [ "linux-generic64" ],
-        cflags           => add("-mandroid -fPIC --sysroot=\$(CROSS_SYSROOT) -Wa,--noexecstack"),
-        cxxflags         => add("-mandroid -fPIC --sysroot=\$(CROSS_SYSROOT) -Wa,--noexecstack"),
-        bin_cflags       => "-pie",
-    },
-    "android64-aarch64" => {
-        inherit_from     => [ "android64", asm("aarch64_asm") ],
-        perlasm_scheme   => "linux64",
-    },
-    "android64-x86_64" => {
-        inherit_from     => [ "android64", asm("x86_64_asm") ],
-        perlasm_scheme   => "elf",
-    },
-    "android64-mips64" => {
-        ############################################################
-        # You are more than likely have to specify target processor
-        # on ./Configure command line. Trouble is that toolchain's
-        # default is MIPS64r6 (at least in r10d), but there are no
-        # such processors around (or they are too rare to spot one).
-        # Actual problem is that MIPS64r6 is binary incompatible
-        # with previous MIPS ISA versions, in sense that unlike
-        # prior versions original MIPS binary code will fail.
-        #
-        inherit_from     => [ "android64", asm("mips64_asm") ],
-        perlasm_scheme   => "64",
-    },
-
 #### *BSD
     "BSD-generic32" => {
         # As for thread cflag. Idea is to maintain "collective" set of
@@ -1134,35 +1040,6 @@ my %targets = (
         thread_scheme    => "(unknown)",
     },
 
-# QNX
-    "qnx4" => {
-        inherit_from     => [ "BASE_unix" ],
-        CC               => "cc",
-        CFLAGS           => "",
-        lib_cppflags     => "-DL_ENDIAN -DTERMIO",
-        thread_scheme    => "(unknown)",
-    },
-    "QNX6" => {
-        inherit_from     => [ "BASE_unix" ],
-        CC               => "gcc",
-        ex_libs          => add("-lsocket"),
-        dso_scheme       => "dlfcn",
-        shared_target    => "bsd-gcc-shared",
-        shared_cflag     => "-fPIC",
-        shared_extension => ".so.\$(SHLIB_VERSION_NUMBER)",
-    },
-    "QNX6-i386" => {
-        inherit_from     => [ "BASE_unix", asm("x86_elf_asm") ],
-        CC               => "gcc",
-        CFLAGS           => "-O2 -Wall",
-        lib_cppflags     => "-DL_ENDIAN",
-        ex_libs          => add("-lsocket"),
-        dso_scheme       => "dlfcn",
-        shared_target    => "bsd-gcc-shared",
-        shared_cflag     => "-fPIC",
-        shared_extension => ".so.\$(SHLIB_VERSION_NUMBER)",
-    },
-
 #### SCO/Caldera targets.
 #
 # Originally we had like unixware-*, unixware-*-pentium, unixware-*-p6, etc.
@@ -1270,7 +1147,8 @@ my %targets = (
         shared_target    => "aix-shared",
         shared_ldflag    => "-shared -static-libgcc -Wl,-G",
         shared_extension => ".so.\$(SHLIB_VERSION_NUMBER)",
-        arflags          => "-X32 r",
+        AR               => add("-X32"),
+        RANLIB           => add("-X32"),
     },
     "aix64-gcc" => {
         inherit_from     => [ "BASE_unix", asm("ppc64_asm") ],
@@ -1288,7 +1166,8 @@ my %targets = (
         shared_target    => "aix-shared",
         shared_ldflag    => "-shared -static-libgcc -Wl,-G",
         shared_extension => ".so.\$(SHLIB_VERSION_NUMBER)",
-        arflags          => "-X64 r",
+        AR               => add("-X64"),
+        RANLIB           => add("-X64"),
     },
     "aix-cc" => {
         inherit_from     => [ "BASE_unix", asm("ppc32_asm") ],
@@ -1306,9 +1185,11 @@ my %targets = (
         perlasm_scheme   => "aix32",
         dso_scheme       => "dlfcn",
         shared_target    => "aix-shared",
+        shared_cflag     => "-qpic",
         shared_ldflag    => "-G",
         shared_extension => ".so.\$(SHLIB_VERSION_NUMBER)",
-        arflags          => "-X32 r",
+        AR               => add("-X32"),
+        RANLIB           => add("-X32"),
     },
     "aix64-cc" => {
         inherit_from     => [ "BASE_unix", asm("ppc64_asm") ],
@@ -1326,9 +1207,11 @@ my %targets = (
         perlasm_scheme   => "aix64",
         dso_scheme       => "dlfcn",
         shared_target    => "aix-shared",
+        shared_cflag     => "-qpic",
         shared_ldflag    => "-G",
         shared_extension => ".so.\$(SHLIB_VERSION_NUMBER)",
-        arflags          => "-X64 r",
+        AR               => add("-X64"),
+        RANLIB           => add("-X64"),
     },
 
 # SIEMENS BS2000/OSD: an EBCDIC-based mainframe
@@ -1346,46 +1229,45 @@ my %targets = (
 
 #### Visual C targets
 #
-# Win64 targets, WIN64I denotes IA-64 and WIN64A - AMD64
+# Win64 targets, WIN64I denotes IA-64/Itanium and WIN64A - AMD64
 #
-# Note about -wd4090, disable warning C4090. This warning returns false
+# Note about /wd4090, disable warning C4090. This warning returns false
 # positives in some situations. Disabling it altogether masks both
 # legitimate and false cases, but as we compile on multiple platforms,
 # we rely on other compilers to catch legitimate cases.
 #
 # Also note that we force threads no matter what.  Configuring "no-threads"
 # is ignored.
+#
+# UNICODE is defined in VC-common and applies to all targets. It used to
+# be an opt-in option for VC-WIN32, but not anymore. The original reason
+# was because ANSI API was *native* system interface for no longer
+# supported Windows 9x. Keep in mind that UNICODE only affects how
+# OpenSSL libraries interact with underlying OS, it doesn't affect API
+# that OpenSSL presents to application.
+
     "VC-common" => {
         inherit_from     => [ "BASE_Windows" ],
         template         => 1,
         CC               => "cl",
         CPP              => '$(CC) /EP /C',
-        CFLAGS           => "-W3 -wd4090 -nologo",
+        CFLAGS           => "/W3 /wd4090 /nologo",
         LDFLAGS          => add("/debug"),
         coutflag         => "/Fo",
-        cflags           => '-Gs0 -GF -Gy',
         defines          => add("OPENSSL_SYS_WIN32", "WIN32_LEAN_AND_MEAN",
+                                "UNICODE", "_UNICODE",
                                 "_CRT_SECURE_NO_DEPRECATE",
                                 "_WINSOCK_DEPRECATED_NO_WARNINGS"),
-        lib_cflags       => add("/Zi /Fdossl_static"),
-        lib_defines      => add([ "L_ENDIAN" ],
-                                sub { my @defs = ();
-                                      unless ($disabled{"zlib-dynamic"}) {
-                                          my $zlib =
-                                              $withargs{zlib_lib} // "ZLIB1";
-                                          push @defs,
-                                              quotify("perl",
-                                                      'LIBZ="' . $zlib . '"');
-                                      }
-                                      return [ @defs ];
-                                  }),
-        dso_cflags       => "/Zi /Fddso",
-        bin_cflags       => "/Zi /Fdapp",
+        lib_cflags       => add("/Zi /Fdossl_static.pdb"),
+        lib_defines      => add("L_ENDIAN"),
+        dso_cflags       => "/Zi /Fddso.pdb",
+        bin_cflags       => "/Zi /Fdapp.pdb",
         shared_ldflag    => "/dll",
         shared_target    => "win-shared", # meaningless except it gives Configure a hint
         thread_scheme    => "winthreads",
         dso_scheme       => "win32",
         apps_aux_src     => add("win32_init.c"),
+        bn_ops           => "EXPORT_VAR_AS_FN",
         # additional parameter to build_scheme denotes install-path "flavour"
         build_scheme     => add("VC-common", { separator => undef }),
     },
@@ -1394,7 +1276,8 @@ my %targets = (
         template         => 1,
         CFLAGS           => add(picker(debug   => '/Od',
                                        release => '/O2')),
-        cflags           => add(picker(debug   =>
+        cflags           => add(picker(default => '/Gs0 /GF /Gy',
+                                       debug   =>
                                        sub {
                                            ($disabled{shared} ? "" : "/MDd");
                                        },
@@ -1402,7 +1285,7 @@ my %targets = (
                                        sub {
                                            ($disabled{shared} ? "" : "/MD");
                                        })),
-        defines          => add(picker(default => [ "UNICODE", "_UNICODE" ],
+        defines          => add(picker(default => [], # works as type cast
                                        debug   => [ "DEBUG", "_DEBUG" ])),
         lib_cflags       => add(sub { $disabled{shared} ? "/MT /Zl" : () }),
         # Following might/should appears controversial, i.e. defining
@@ -1435,14 +1318,14 @@ my %targets = (
             push @ex_libs, 'bufferoverflowu.lib' if (`cl 2>&1` =~ /14\.00\.4[0-9]{4}\./);
             return join(" ", @_, @ex_libs);
         }),
-        bn_ops           => "SIXTY_FOUR_BIT EXPORT_VAR_AS_FN",
+        bn_ops           => add("SIXTY_FOUR_BIT"),
     },
     "VC-WIN64I" => {
         inherit_from     => [ "VC-WIN64-common", asm("ia64_asm"),
                               sub { $disabled{shared} ? () : "ia64_uplink" } ],
         AS               => "ias",
         ASFLAGS          => "-d debug",
-        asoutflag        => "-o",
+        asoutflag        => "-o ",
         sys_id           => "WIN64I",
         bn_asm_src       => sub { return undef unless @_;
                                   my $r=join(" ",@_); $r=~s|bn-ia64.s|bn_asm.c|; $r; },
@@ -1463,27 +1346,15 @@ my %targets = (
         multilib         => "-x64",
     },
     "VC-WIN32" => {
-        # x86 Win32 target used to default to ANSI API, but not anymore,
-        # UNICODE is the only option. The original reason for providing
-        # UNICODE as opt-in option was because ANSI API was *native*
-        # system interface for [no longer supported] Windows 9x.
         inherit_from     => [ "VC-noCE-common", asm("x86_asm"),
                               sub { $disabled{shared} ? () : "uplink_common" } ],
-        CFLAGS           => add("-WX"),
+        CFLAGS           => add("/WX"),
         AS               => sub { vc_win32_info()->{AS} },
         ASFLAGS          => sub { vc_win32_info()->{ASFLAGS} },
         asoutflag        => sub { vc_win32_info()->{asoutflag} },
         asflags          => sub { vc_win32_info()->{asflags} },
-        ex_libs          => add(sub {
-            my @ex_libs = ();
-            # WIN32 UNICODE build gets linked with unicows.lib for
-            # backward compatibility with Win9x.
-            push @ex_libs, 'unicows.lib'
-                if (grep { $_ eq "UNICODE" } @{$user{CPPDEFINES}});
-            return join(" ", @ex_libs, @_);
-        }),
         sys_id           => "WIN32",
-        bn_ops           => "BN_LLONG EXPORT_VAR_AS_FN",
+        bn_ops           => add("BN_LLONG"),
         perlasm_scheme   => sub { vc_win32_info()->{perlasm_scheme} },
         # "WOW" stands for "Windows on Windows", and "VC-WOW" engages
         # some installation path heuristics in windows-makefile.tmpl...
@@ -1491,14 +1362,8 @@ my %targets = (
     },
     "VC-CE" => {
         inherit_from     => [ "VC-common" ],
-        AS               => "ml",
-        ASFLAGS          => "/nologo",
-        asoutflag        => "/Fo",
-        asflags          => "/Cp /coff /c /Cx /Zi",
-        CC               => "cl",
-        CFLAGS           => picker(default => '/W3 /WX /nologo',
-                                   debug   => "/Od",
-                                   release => "/O1i"),
+        CFLAGS           => add(picker(debug   => "/Od",
+                                       release => "/O1i")),
         CPPDEFINES       => picker(debug   => [ "DEBUG", "_DEBUG" ]),
         LDFLAGS          => add("/nologo /opt:ref"),
         cflags           =>
@@ -1508,9 +1373,7 @@ my %targets = (
                               ? ($disabled{shared} ? " /MT" : " /MD")
                               : " /MC"; }),
         cppflags         => sub { vc_wince_info()->{cppflags}; },
-        defines          => [ "WIN32_LEAN_AND_MEAN" ],
-        lib_defines      => [ "L_ENDIAN", "DSO_WIN32", "NO_CHMOD",
-                              "OPENSSL_SMALL_FOOTPRINT" ],
+        lib_defines      => add("NO_CHMOD", "OPENSSL_SMALL_FOOTPRINT"),
         lib_cppflags     => sub { vc_wince_info()->{cppflags}; },
         includes         =>
             add(combine(sub { defined(env('WCECOMPAT'))
@@ -1522,7 +1385,7 @@ my %targets = (
                                         sub { defined(env('PORTSDK_LIBPATH'))
                                                   ? "/entry:mainCRTstartup" : (); })),
         sys_id           => "WINCE",
-        bn_ops           => "BN_LLONG EXPORT_VAR_AS_FN",
+        bn_ops           => add("BN_LLONG"),
         ex_libs          => add(sub {
             my @ex_libs = ();
             push @ex_libs, 'ws2.lib' unless $disabled{sock};