Configure et al: Move the definition of library only flags
authorRichard Levitte <levitte@openssl.org>
Tue, 6 Mar 2018 20:09:05 +0000 (21:09 +0100)
committerRichard Levitte <levitte@openssl.org>
Fri, 9 Mar 2018 13:07:59 +0000 (14:07 +0100)
We're currently using the attributes 'defines', 'cppflags', 'cflags'
etc quite liberally, with no regard for where that ends up.  Quite a
few of those flags are actually only relevant for the libraries
(mostly libcrypto), so it's safe to say that those could be applied to
the libraries only.

So, we move some of those flags to 'lib_defines', 'lib_cppflags',
'lib_cflags', etc.

Reviewed-by: Andy Polyakov <appro@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/5560)

Configurations/00-base-templates.conf
Configurations/10-main.conf
Configure

index 310a370..a1837ca 100644 (file)
@@ -8,6 +8,9 @@ my %targets=(
        lflags          => "",
        defines         => [],
        includes        => [],
+       lib_cflags      => "",
+       lib_cppflags    => "",
+       lib_defines     => [],
        thread_scheme   => "(unknown)", # Assume we don't know
        thread_defines  => [],
 
index 6e7f2d1..65f08b0 100644 (file)
@@ -192,7 +192,8 @@ my %targets = (
         CFLAGS           => picker(default => "-Wall",
                                    debug   => "-O0 -g",
                                    release => "-O3"),
-        cppflags         => "-D_POSIX_C_SOURCE=200112L -D_BSD -D_VOS_EXTENDED_NAMES -DB_ENDIAN",
+        cppflags         => "-D_POSIX_C_SOURCE=200112L -D_BSD -D_VOS_EXTENDED_NAMES",
+        lib_cppflags     => "-DB_ENDIAN",
         thread_scheme    => "(unknown)",
         sys_id           => "VOS",
         lflags           => add("-Wl,-map"),
@@ -204,7 +205,7 @@ my %targets = (
     "solaris-common" => {
         inherit_from     => [ "BASE_unix" ],
         template         => 1,
-        cppflags         => "-DFILIO_H",
+        lib_cppflags     => "-DFILIO_H",
         ex_libs          => add("-lsocket -lnsl -ldl"),
         dso_scheme       => "dlfcn",
         thread_scheme    => "pthreads",
@@ -222,7 +223,7 @@ my %targets = (
                                               debug   => "-O0 -g",
                                               release => "-O3 -fomit-frame-pointer")),
         cflags           => add(threads("-pthread")),
-        cppflags         => add("-DL_ENDIAN"),
+        lib_cppflags     => add("-DL_ENDIAN"),
         ex_libs          => add(threads("-pthread")),
         bn_ops           => "BN_LLONG",
         shared_cflag     => "-fPIC",
@@ -243,7 +244,7 @@ my %targets = (
                                               debug   => "-O0 -g",
                                               release => "-O3")),
         cflags           => add_before("-m64", threads("-pthread")),
-        cppflags         => add("-DL_ENDIAN"),
+        lib_cppflags     => add("-DL_ENDIAN"),
         ex_libs          => add(threads("-pthread")),
         bn_ops           => "SIXTY_FOUR_BIT_LONG",
         perlasm_scheme   => "elf",
@@ -271,7 +272,8 @@ my %targets = (
         CFLAGS           => add_before(picker(debug   => "-g",
                                               release => "-xO5 -xdepend -xbuiltin")),
         cflags           => add_before("-xarch=generic64 -xstrconst -Xa"),
-        cppflags         => add("-DL_ENDIAN", threads("-D_REENTRANT")),
+        cppflags         => add(threads("-D_REENTRANT")),
+        lib_cppflags     => add("-DL_ENDIAN"),
         thread_scheme    => "pthreads",
         lflags           => add(threads("-mt")),
         ex_libs          => add(threads("-lpthread")),
@@ -290,7 +292,7 @@ my %targets = (
                                               debug   => "-O0 -g",
                                               release => "-O3")),
         cflags           => add(threads("-pthread")),
-        cppflags         => add("-DB_ENDIAN -DBN_DIV2W"),
+        lib_cppflags     => add("-DB_ENDIAN -DBN_DIV2W"),
         ex_libs          => add(threads("-pthread")),
         bn_ops           => "BN_LLONG RC4_CHAR",
         shared_cflag     => "-fPIC",
@@ -323,8 +325,8 @@ my %targets = (
         CFLAGS           => add_before(picker(debug   => "-g",
                                               release => "-xO5 -xdepend")),
         cflags           => add_before("-xstrconst -Xa"),
-        cppflags         => add("-DB_ENDIAN -DBN_DIV2W",
-                                threads("-D_REENTRANT")),
+        cppflags         => add(threads("-D_REENTRANT")),
+        lib_cppflags     => add("-DB_ENDIAN -DBN_DIV2W"),
         lflags           => add(threads("-mt")),
         ex_libs          => add(threads("-lpthread")),
         bn_ops           => "BN_LLONG RC4_CHAR",
@@ -357,6 +359,8 @@ my %targets = (
         cflags           => "-mabi=n32",
         cppflags         => combine("-DB_ENDIAN -DBN_DIV3W",
                                     threads("-D_SGI_MP_SOURCE")),
+        cppflags         => threads("-D_SGI_MP_SOURCE"),
+        lib_cppflags     => "-DB_ENDIAN -DBN_DIV3W",
         ex_libs          => add(threads("-lpthread")),
         bn_ops           => "RC4_CHAR SIXTY_FOUR_BIT",
         thread_scheme    => "pthreads",
@@ -372,8 +376,8 @@ my %targets = (
         CFLAGS           => picker(debug   => "-g -O0",
                                    release => "-O2"),
         cflags           => "-n32 -mips3 -use_readonly_const -G0 -rdata_shared",
-        cppflags         => combine("-DB_ENDIAN -DBN_DIV3W",
-                                    threads("-D_SGI_MP_SOURCE")),
+        cppflags         => threads("-D_SGI_MP_SOURCE"),
+        lib_cppflags     => "-DB_ENDIAN -DBN_DIV3W",
         ex_libs          => add(threads("-lpthread")),
         bn_ops           => "RC4_CHAR SIXTY_FOUR_BIT",
         thread_scheme    => "pthreads",
@@ -390,8 +394,8 @@ my %targets = (
         CFLAGS           => picker(debug   => "-g -O0",
                                    release => "-O3"),
         cflags           => "-mabi=64 -mips4",
-        cppflags         => combine("-DB_ENDIAN -DBN_DIV3W",
-                                    threads("-D_SGI_MP_SOURCE")),
+        cppflags         => threads("-D_SGI_MP_SOURCE"),
+        lib_cppflags     => "-DB_ENDIAN -DBN_DIV3W",
         ex_libs          => add(threads("-lpthread")),
         bn_ops           => "RC4_CHAR SIXTY_FOUR_BIT_LONG",
         thread_scheme    => "pthreads",
@@ -406,10 +410,9 @@ my %targets = (
         CC               => "cc",
         CFLAGS           => picker(debug   => "-g -O0",
                                    release => "-O2"),
-        cppflags         => threads("-D_SGI_MP_SOURCE"),
         cflags           => "-64 -mips4 -use_readonly_const -G0 -rdata_shared",
-        cppflags         => combine("-DB_ENDIAN -DBN_DIV3W",
-                                    threads("-D_SGI_MP_SOURCE")),
+        cppflags         => threads("-D_SGI_MP_SOURCE"),
+        lib_cppflags     => "-DB_ENDIAN -DBN_DIV3W",
         ex_libs          => threads("-lpthread"),
         bn_ops           => "RC4_CHAR SIXTY_FOUR_BIT_LONG",
         thread_scheme    => "pthreads",
@@ -453,7 +456,7 @@ my %targets = (
         CFLAGS           => picker(debug   => "-O0 -g",
                                    release => "-O3"),
         cflags           => add(threads("-pthread")),
-        cppflags         => "-DB_ENDIAN -DBN_DIV2W",
+        lib_cppflags     => "-DB_ENDIAN -DBN_DIV2W",
         ex_libs          => add("-Wl,+s -ldld", threads("-pthread")),
         bn_ops           => "BN_LLONG",
         thread_scheme    => "pthreads",
@@ -472,7 +475,8 @@ my %targets = (
         CC               => "gcc",
         CFLAGS           => combine(picker(debug   => "-O0 -g",
                                            release => "-O3")),
-        cppflags         => combine("-DB_ENDIAN", threads("-D_REENTRANT")),
+        cppflags         => threads("-D_REENTRANT"),
+        lib_cppflags     => "-DB_ENDIAN",
         ex_libs          => add("-ldl"),
         bn_ops           => "SIXTY_FOUR_BIT_LONG RC4_CHAR",
         thread_scheme    => "pthreads",
@@ -491,8 +495,8 @@ my %targets = (
         CFLAGS           => picker(debug   => "+O0 +d -g",
                                    release => "+O3"),
         cflags           => "+Optrs_strongly_typed -Ae +ESlit",
-        cppflags         => combine("-DB_ENDIAN -DBN_DIV2W -DMD32_XARRAY",
-                                    threads("-D_REENTRANT")),
+        cppflags         => threads("-D_REENTRANT"),
+        lib_cppflags     => "-DB_ENDIAN -DBN_DIV2W -DMD32_XARRAY",
         ex_libs          => add("-Wl,+s -ldld",threads("-lpthread")),
         bn_ops           => "RC4_CHAR",
         thread_scheme    => "pthreads",
@@ -513,8 +517,8 @@ my %targets = (
         CFLAGS           => picker(debug   => "+O0 +d -g",
                                    release => "+O3") ,
         cflags           => "+DD64 +Optrs_strongly_typed -Ae +ESlit",
-        cppflags         => combine("-DB_ENDIAN -DMD32_XARRAY",
-                                    threads("-D_REENTRANT")),
+        cppflags         => threads("-D_REENTRANT") ,
+        lib_cppflags     => "-DB_ENDIAN -DMD32_XARRAY",
         ex_libs          => add("-ldl",threads("-lpthread")),
         bn_ops           => "SIXTY_FOUR_BIT_LONG RC4_CHAR",
         thread_scheme    => "pthreads",
@@ -533,7 +537,8 @@ my %targets = (
         CFLAGS           => picker(debug   => "+O0 +d -g",
                                    release => "+O2"),
         cflags           => "-Ae +DD32 +Olit=all -z",
-        cppflags         => combine("-DB_ENDIAN", threads("-D_REENTRANT")),
+        cppflags         => add(threads("-D_REENTRANT")),
+        lib_cppflags     => "-DB_ENDIAN",
         ex_libs          => add("-ldl",threads("-lpthread")),
         bn_ops           => "SIXTY_FOUR_BIT",
         thread_scheme    => "pthreads",
@@ -550,7 +555,8 @@ my %targets = (
         CFLAGS           => picker(debug   => "+O0 +d -g",
                                    release => "+O3"),
         cflags           => "-Ae +DD64 +Olit=all -z",
-        cppflags         => combine("-DB_ENDIAN", threads("-D_REENTRANT")),
+        cppflags         => threads("-D_REENTRANT"),
+        lib_cppflags     => "-DB_ENDIAN",
         ex_libs          => add("-ldl", threads("-lpthread")),
         bn_ops           => "SIXTY_FOUR_BIT_LONG",
         thread_scheme    => "pthreads",
@@ -568,7 +574,7 @@ my %targets = (
         CFLAGS           => picker(debug   => "-O0 -g",
                                    release => "-O3"),
         cflags           => add(threads("-pthread")),
-        cppflags         => "-DB_ENDIAN",
+        lib_cppflags     => "-DB_ENDIAN",
         ex_libs          => add("-ldl", threads("-pthread")),
         bn_ops           => "SIXTY_FOUR_BIT",
         thread_scheme    => "pthreads",
@@ -585,7 +591,7 @@ my %targets = (
         CFLAGS           => picker(debug   => "-O0 -g",
                                    release => "-O3"),
         cflags           => combine("-mlp64", threads("-pthread")),
-        cppflags         => "-DB_ENDIAN",
+        lib_cppflags     => "-DB_ENDIAN",
         ex_libs          => add("-ldl", threads("-pthread")),
         bn_ops           => "SIXTY_FOUR_BIT_LONG",
         thread_scheme    => "pthreads",
@@ -602,8 +608,9 @@ my %targets = (
         inherit_from     => [ "BASE_unix" ],
         CC               => "gcc",
         CFLAGS           => "-O3",
-        cppflags         => "-DBN_DIV2W -D_POSIX_SOURCE -D_SOCKET_SOURCE",
-        includes         => add("/SYSLOG/PUB"),
+        cppflags         => "-D_POSIX_SOURCE -D_SOCKET_SOURCE",
+        includes         => [ "/SYSLOG/PUB" ],
+        lib_cppflags     => "-DBN_DIV2W",
         sys_id           => "MPE",
         lflags           => add("-L/SYSLOG/PUB"),
         ex_libs          => add("-lsyslog -lsocket -lcurses"),
@@ -661,7 +668,7 @@ my %targets = (
                                    release => "-O3"),
         cflags           => threads("-pthread"),
         cxxflags         => combine("-std=c++11", threads("-pthread")),
-        cppflags         => "-DOPENSSL_USE_NODELETE",
+        lib_cppflags     => "-DOPENSSL_USE_NODELETE",
         ex_libs          => add("-ldl", threads("-pthread")),
         bn_ops           => "BN_LLONG RC4_CHAR",
         thread_scheme    => "pthreads",
@@ -684,7 +691,7 @@ my %targets = (
         inherit_from     => [ "linux-generic64", asm("ppc64_asm") ],
         cflags           => add("-m64"),
         cxxflags         => add("-m64"),
-        cppflags         => add("-DB_ENDIAN"),
+        lib_cppflags     => add("-DB_ENDIAN"),
         perlasm_scheme   => "linux64",
         multilib         => "64",
     },
@@ -692,7 +699,7 @@ my %targets = (
         inherit_from     => [ "linux-generic64", asm("ppc64_asm") ],
         cflags           => add("-m64"),
         cxxflags         => add("-m64"),
-        cppflags         => add("-DL_ENDIAN"),
+        lib_cppflags     => add("-DL_ENDIAN"),
         perlasm_scheme   => "linux64le",
     },
 
@@ -749,7 +756,7 @@ my %targets = (
         inherit_from     => [ "linux-generic32", asm("mips32_asm") ],
         cflags           => add("-mabi=32"),
         cxxflags         => add("-mabi=32"),
-        cppflags         => add("-DBN_DIV3W"),
+        lib_cppflags     => add("-DBN_DIV3W"),
         perlasm_scheme   => "o32",
     },
     # mips32 and mips64 below refer to contemporary MIPS Architecture
@@ -758,7 +765,7 @@ my %targets = (
         inherit_from     => [ "linux-generic32", asm("mips64_asm") ],
         cflags           => add("-mabi=n32"),
         cxxflags         => add("-mabi=n32"),
-        cppflags         => add("-DBN_DIV3W"),
+        lib_cppflags     => add("-DBN_DIV3W"),
         bn_ops           => "SIXTY_FOUR_BIT RC4_CHAR",
         perlasm_scheme   => "n32",
         multilib         => "32",
@@ -767,7 +774,7 @@ my %targets = (
         inherit_from     => [ "linux-generic64", asm("mips64_asm") ],
         cflags           => add("-mabi=64"),
         cxxflags         => add("-mabi=64"),
-        cppflags         => add("-DBN_DIV3W"),
+        lib_cppflags     => add("-DBN_DIV3W"),
         perlasm_scheme   => "64",
         multilib         => "64",
     },
@@ -778,7 +785,7 @@ my %targets = (
     "linux-elf" => {
         inherit_from     => [ "linux-generic32", asm("x86_elf_asm") ],
         CFLAGS           => add(picker(release => "-fomit-frame-pointer")),
-        cppflags         => add("-DL_ENDIAN"),
+        lib_cppflags     => add("-DL_ENDIAN"),
         bn_ops           => "BN_LLONG",
     },
     "linux-aout" => {
@@ -787,7 +794,7 @@ my %targets = (
         CFLAGS           => add(picker(default => "-Wall",
                                        debug   => "-O0 -g",
                                        release => "-O3 -fomit-frame-pointer")),
-        cppflags         => add("-DL_ENDIAN"),
+        lib_cppflags     => add("-DL_ENDIAN"),
         bn_ops           => "BN_LLONG",
         thread_scheme    => "(unknown)",
         perlasm_scheme   => "a.out",
@@ -799,7 +806,7 @@ my %targets = (
         CFLAGS           => add(picker(release => "-fomit-frame-pointer")),
         cflags           => add("-m32"),
         cxxflags         => add("-m32"),
-        cppflags         => add("-DL_ENDIAN"),
+        lib_cppflags     => add("-DL_ENDIAN"),
         bn_ops           => "BN_LLONG",
         perlasm_scheme   => "elf",
     },
@@ -813,7 +820,7 @@ my %targets = (
         inherit_from     => [ "linux-generic64", asm("x86_64_asm") ],
         cflags           => add("-m64"),
         cxxflags         => add("-m64"),
-        cppflags         => add("-DL_ENDIAN"),
+        lib_cppflags     => add("-DL_ENDIAN"),
         bn_ops           => "SIXTY_FOUR_BIT_LONG",
         perlasm_scheme   => "elf",
         multilib         => "64",
@@ -828,7 +835,7 @@ my %targets = (
         inherit_from     => [ "linux-generic32", asm("x86_64_asm") ],
         cflags           => add("-mx32"),
         cxxflags         => add("-mx32"),
-        cppflags         => add("-DL_ENDIAN"),
+        lib_cppflags     => add("-DL_ENDIAN"),
         bn_ops           => "SIXTY_FOUR_BIT",
         perlasm_scheme   => "elf32",
         multilib         => "x32",
@@ -843,7 +850,7 @@ my %targets = (
         inherit_from     => [ "linux-generic64", asm("s390x_asm") ],
         cflags           => add("-m64"),
         cxxflags         => add("-m64"),
-        cppflags         => add("-DB_ENDIAN"),
+        lib_cppflags     => add("-DB_ENDIAN"),
         perlasm_scheme   => "64",
         multilib         => "64",
     },
@@ -867,7 +874,7 @@ my %targets = (
         inherit_from     => [ "linux-generic32", asm("s390x_asm") ],
         cflags           => add("-m31 -Wa,-mzarch"),
         cxxflags         => add("-m31 -Wa,-mzarch"),
-        cppflags         => add("-DB_ENDIAN"),
+        lib_cppflags     => add("-DB_ENDIAN"),
         bn_asm_src       => sub { my $r=join(" ",@_); $r=~s|asm/s390x\.S|bn_asm.c|; $r; },
         perlasm_scheme   => "31",
         multilib         => "/highgprs",
@@ -1057,7 +1064,7 @@ my %targets = (
     "BSD-x86" => {
         inherit_from     => [ "BSD-generic32", asm("x86_asm") ],
         CFLAGS           => add(picker(release => "-fomit-frame-pointer")),
-        cppflags         => add("-DL_ENDIAN"),
+        lib_cppflags     => add("-DL_ENDIAN"),
         bn_ops           => "BN_LLONG",
         shared_target    => "bsd-shared",
         perlasm_scheme   => "a.out",
@@ -1070,26 +1077,26 @@ my %targets = (
     "BSD-sparcv8" => {
         inherit_from     => [ "BSD-generic32", asm("sparcv8_asm") ],
         cflags           => add("-mcpu=v8"),
-        cppflags         => add("-DB_ENDIAN"),
+        lib_cppflags     => add("-DB_ENDIAN"),
     },
     "BSD-sparc64" => {
         # -DMD32_REG_T=int doesn't actually belong in sparc64 target, it
         # simply *happens* to work around a compiler bug in gcc 3.3.3,
         # triggered by RIPEMD160 code.
         inherit_from     => [ "BSD-generic64", asm("sparcv9_asm") ],
-        cppflags         => add("-DB_ENDIAN -DMD32_REG_T=int"),
+        lib_cppflags     => add("-DB_ENDIAN -DMD32_REG_T=int"),
         bn_ops           => "BN_LLONG",
     },
 
     "BSD-ia64" => {
         inherit_from     => [ "BSD-generic64", asm("ia64_asm") ],
-        cppflags         => add("-DL_ENDIAN"),
+        lib_cppflags     => add("-DL_ENDIAN"),
         bn_ops           => "SIXTY_FOUR_BIT_LONG",
     },
 
     "BSD-x86_64" => {
         inherit_from     => [ "BSD-generic64", asm("x86_64_asm") ],
-        cppflags         => add("-DL_ENDIAN"),
+        lib_cppflags     => add("-DL_ENDIAN"),
         bn_ops           => "SIXTY_FOUR_BIT_LONG",
         perlasm_scheme   => "elf",
     },
@@ -1098,7 +1105,7 @@ my %targets = (
         inherit_from     => [ "BASE_unix", asm("x86_elf_asm") ],
         CC               => "gcc",
         CFLAGS           => "-fomit-frame-pointer -O3 -Wall",
-        cppflags         => "-DPERL5 -DL_ENDIAN",
+        lib_cppflags     => "-DPERL5 -DL_ENDIAN",
         ex_libs          => add("-ldl"),
         bn_ops           => "BN_LLONG",
         thread_scheme    => "(unknown)",
@@ -1130,7 +1137,7 @@ my %targets = (
         inherit_from     => [ "BASE_unix" ],
         CC               => "cc",
         CFLAGS           => "",
-        cppflags         => "-DL_ENDIAN -DTERMIO",
+        lib_cppflags     => "-DL_ENDIAN -DTERMIO",
         thread_scheme    => "(unknown)",
     },
     "QNX6" => {
@@ -1146,7 +1153,7 @@ my %targets = (
         inherit_from     => [ "BASE_unix", asm("x86_elf_asm") ],
         CC               => "gcc",
         CFLAGS           => "-O2 -Wall",
-        cppflags         => "-DL_ENDIAN",
+        lib_cppflags     => "-DL_ENDIAN",
         ex_libs          => add("-lsocket"),
         dso_scheme       => "dlfcn",
         shared_target    => "bsd-gcc-shared",
@@ -1169,7 +1176,7 @@ my %targets = (
         inherit_from     => [ "BASE_unix" ],
         CC               => "cc",
         cflags           => threads("-Kthread"),
-        cppflags         => "-DFILIO_H -DNO_STRINGS_H",
+        lib_cppflags     => "-DFILIO_H -DNO_STRINGS_H",
         ex_libs          => add("-lsocket -lnsl -lresolv -lx"),
         thread_scheme    => "uithreads",
     },
@@ -1178,7 +1185,7 @@ my %targets = (
         CC               => "cc",
         CFLAGS           => "-O",
         cflags           => threads("-Kthread"),
-        cppflags         => "-DFILIO_H",
+        lib_cppflags     => "-DFILIO_H",
         ex_libs          => add("-lsocket -lnsl -lresolv -lx"),
         thread_scheme    => "uithreads",
     },
@@ -1187,7 +1194,7 @@ my %targets = (
         CC               => "cc",
         CFLAGS           => "-O",
         cflags           => combine("-Kalloca", threads("-Kthread")),
-        cppflags         => "-DFILIO_H",
+        lib_cppflags     => "-DFILIO_H",
         ex_libs          => add("-lsocket -lnsl"),
         thread_scheme    => "uithreads",
         bn_ops           => "BN_LLONG",
@@ -1201,8 +1208,8 @@ my %targets = (
         inherit_from     => [ "BASE_unix", asm("x86_elf_asm") ],
         CC               => "gcc",
         CFLAGS           => "-O3 -fomit-frame-pointer -Wall",
-        cppflags         => add("-DL_ENDIAN -DFILIO_H",
-                                threads("-D_REENTRANT")),
+        cppflags         => add(threads("-D_REENTRANT")),
+        lib_cppflags     => add("-DL_ENDIAN -DFILIO_H"),
         ex_libs          => add("-lsocket -lnsl"),
         bn_ops           => "BN_LLONG",
         thread_scheme    => "pthreads",
@@ -1251,7 +1258,7 @@ my %targets = (
         CFLAGS           => picker(debug   => "-O0 -g",
                                    release => "-O"),
         cflags           => add(threads("-pthread")),
-        cppflags         => "-DB_ENDIAN",
+        lib_cppflags     => "-DB_ENDIAN",
         ex_libs          => add(threads("-pthread")),
         sys_id           => "AIX",
         bn_ops           => "BN_LLONG RC4_CHAR",
@@ -1269,7 +1276,7 @@ my %targets = (
         CFLAGS           => picker(debug   => "-O0 -g",
                                    release => "-O"),
         cflags           => combine("-maix64", threads("-pthread")),
-        cppflags         => "-DB_ENDIAN",
+        lib_cppflags     => "-DB_ENDIAN",
         ex_libs          => add(threads("-pthread")),
         sys_id           => "AIX",
         bn_ops           => "SIXTY_FOUR_BIT_LONG RC4_CHAR",
@@ -1288,7 +1295,8 @@ my %targets = (
                                    release => "-O"),
         cflags           => combine("-q32 -qmaxmem=16384 -qro -qroconst",
                                     threads("-qthreaded")),
-        cppflags         => combine("-DB_ENDIAN", threads("-D_THREAD_SAFE")),
+        cppflags         => threads("-D_THREAD_SAFE"),
+        lib_cppflags     => "-DB_ENDIAN",
         sys_id           => "AIX",
         bn_ops           => "BN_LLONG RC4_CHAR",
         thread_scheme    => "pthreads",
@@ -1307,7 +1315,8 @@ my %targets = (
                                    release => "-O"),
         cflags           => combine("-q64 -qmaxmem=16384 -qro -qroconst",
                                     threads("-qthreaded")),
-        cppflags         => combine("-DB_ENDIAN", threads("-D_THREAD_SAFE")),
+        cppflags         => threads("-D_THREAD_SAFE"),
+        lib_cppflags     => "-DB_ENDIAN",
         sys_id           => "AIX",
         bn_ops           => "SIXTY_FOUR_BIT_LONG RC4_CHAR",
         thread_scheme    => "pthreads",
@@ -1326,7 +1335,8 @@ my %targets = (
         CC               => "c89",
         CFLAGS           => "-O",
         cflags           => "-XLLML -XLLMK -XL",
-        cppflags         => "-DB_ENDIAN -DCHARSET_EBCDIC",
+        cppflags         => "-DCHARSET_EBCDIC",
+        lib_cppflags     => "-DB_ENDIAN",
         ex_libs          => add("-lsocket -lnsl"),
         bn_ops           => "THIRTY_TWO_BIT RC4_CHAR",
         thread_scheme    => "(unknown)",
@@ -1353,8 +1363,10 @@ my %targets = (
         coutflag         => "/Fo",
         cflags           => '-Gs0 -GF -Gy',
         defines          => add("OPENSSL_SYS_WIN32", "WIN32_LEAN_AND_MEAN",
-                                "L_ENDIAN", "_CRT_SECURE_NO_DEPRECATE",
-                                "_WINSOCK_DEPRECATED_NO_WARNINGS",
+                                "_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 =
@@ -1365,7 +1377,6 @@ my %targets = (
                                       }
                                       return [ @defs ];
                                   }),
-        lib_cflags       => add("/Zi /Fdossl_static"),
         dso_cflags       => "/Zi /Fddso",
         bin_cflags       => "/Zi /Fdapp",
         shared_ldflag    => "/dll",
@@ -1490,9 +1501,10 @@ my %targets = (
                               ? ($disabled{shared} ? " /MT" : " /MD")
                               : " /MC"; }),
         cppflags         => sub { vc_wince_info()->{cppflags}; },
-        defines          => [ "UNICODE", "_UNICODE", "L_ENDIAN", "DSO_WIN32",
-                              "NO_CHMOD", "OPENSSL_SMALL_FOOTPRINT",
-                              "WIN32_LEAN_AND_MEAN" ],
+        defines          => [ "WIN32_LEAN_AND_MEAN" ],
+        lib_defines      => [ "L_ENDIAN", "DSO_WIN32", "NO_CHMOD",
+                              "OPENSSL_SMALL_FOOTPRINT" ],
+        lib_cppflags     => sub { vc_wince_info()->{cppflags}; },
         includes         =>
             add(combine(sub { defined(env('WCECOMPAT'))
                               ? '$(WCECOMPAT)/include' : (); },
@@ -1535,9 +1547,9 @@ my %targets = (
                                    debug   => "-g -O0",
                                    release => "-O3 -fomit-frame-pointer"),
         cflags           => "-m32",
-        cppflags         => combine("-DL_ENDIAN -DUNICODE -D_UNICODE",
-                                    "-DWIN32_LEAN_AND_MEAN",
+        cppflags         => combine("-DUNICODE -D_UNICODE -DWIN32_LEAN_AND_MEAN",
                                     threads("-D_MT")),
+        lib_cppflags     => "-DL_ENDIAN",
         sys_id           => "MINGW32",
         ex_libs          => add("-lws2_32 -lgdi32 -lcrypt32"),
         bn_ops           => "BN_LLONG EXPORT_VAR_AS_FN",
@@ -1567,9 +1579,9 @@ my %targets = (
                                    debug   => "-g -O0",
                                    release => "-O3"),
         cflags           => "-m64",
-        cppflags         => combine("-DL_ENDIAN -DUNICODE -D_UNICODE",
-                                    "-DWIN32_LEAN_AND_MEAN",
+        cppflags         => combine("-DUNICODE -D_UNICODE -DWIN32_LEAN_AND_MEAN",
                                     threads("-D_MT")),
+        lib_cppflags     => "-DL_ENDIAN",
         sys_id           => "MINGW64",
         ex_libs          => add("-lws2_32 -lgdi32 -lcrypt32"),
         bn_ops           => "SIXTY_FOUR_BIT EXPORT_VAR_AS_FN",
@@ -1590,7 +1602,7 @@ my %targets = (
         inherit_from     => [ "BASE_unix" ],
         CC               => "cc",
         CFLAGS           => "-O",
-        cppflags         => "-DL_ENDIAN",
+        lib_cppflags     => "-DL_ENDIAN",
         sys_id           => "UEFI",
     },
 
@@ -1612,7 +1624,7 @@ my %targets = (
         CFLAGS           => picker(default => "-Wall",
                                    debug   => "-g -O0",
                                    release => "-O3 -fomit-frame-pointer"),
-        cppflags         => "-DTERMIOS -DL_ENDIAN",
+        lib_cppflags     => "-DTERMIOS -DL_ENDIAN",
         sys_id           => "CYGWIN",
         bn_ops           => "BN_LLONG",
         thread_scheme    => "pthread",
@@ -1628,7 +1640,7 @@ my %targets = (
         CFLAGS           => picker(default => "-Wall",
                                    debug   => "-g -O0",
                                    release => "-O3"),
-        cppflags         => "-DTERMIOS -DL_ENDIAN",
+        lib_cppflags     => "-DTERMIOS -DL_ENDIAN",
         sys_id           => "CYGWIN",
         bn_ops           => "SIXTY_FOUR_BIT_LONG",
         thread_scheme    => "pthread",
@@ -1681,14 +1693,14 @@ my %targets = (
     "darwin-ppc-cc" => {
         inherit_from     => [ "darwin-common", asm("ppc32_asm") ],
         cflags           => add("-arch ppc -std=gnu9x -Wa,-force_cpusubtype_ALL"),
-        cppflags         => add("-DB_ENDIAN"),
+        lib_cppflags     => add("-DB_ENDIAN"),
         shared_cflag     => add("-fno-common"),
         perlasm_scheme   => "osx32",
     },
     "darwin64-ppc-cc" => {
         inherit_from     => [ "darwin-common", asm("ppc64_asm") ],
         cflags           => add("-arch ppc64 -std=gnu9x"),
-        cppflags         => add("-DB_ENDIAN"),
+        lib_cppflags     => add("-DB_ENDIAN"),
         bn_ops           => "SIXTY_FOUR_BIT_LONG RC4_CHAR",
         perlasm_scheme   => "osx64",
     },
@@ -1696,7 +1708,7 @@ my %targets = (
         inherit_from     => [ "darwin-common", asm("x86_asm") ],
         CFLAGS           => add(picker(release => "-fomit-frame-pointer")),
         cflags           => add("-arch i386"),
-        cppflags         => add("-DL_ENDIAN"),
+        lib_cppflags     => add("-DL_ENDIAN"),
         bn_ops           => "BN_LLONG RC4_INT",
         perlasm_scheme   => "macosx",
     },
@@ -1704,7 +1716,7 @@ my %targets = (
         inherit_from     => [ "darwin-common", asm("x86_64_asm") ],
         CFLAGS           => add("-Wall"),
         cflags           => add("-arch x86_64"),
-        cppflags         => add("-DL_ENDIAN"),
+        lib_cppflags     => add("-DL_ENDIAN"),
         bn_ops           => "SIXTY_FOUR_BIT_LONG",
         perlasm_scheme   => "macosx",
     },
@@ -1753,7 +1765,7 @@ my %targets = (
         CC               => "gcc",
         CFLAGS           => "-O3 -fomit-frame-pointer -Wall",
         cflags           => threads("-pthread"),
-        cppflags         => "-DL_ENDIAN",
+        lib_cppflags     => "-DL_ENDIAN",
         ex_libs          => add("-ldl", threads("-pthread")),
         bn_ops           => "BN_LLONG",
         thread_scheme    => "pthreads",
@@ -1911,7 +1923,7 @@ my %targets = (
                               @{vms_info()->{disable_warns}};
                           @warnings
                               ? "/WARNINGS=DISABLE=(".join(",",@warnings).")" : (); }),
-        defines          =>
+        lib_defines      =>
             add("OPENSSL_USE_NODELETE",
                 sub {
                     return vms_info()->{def_zlib}
index 9cf3d75..016a9f3 100755 (executable)
--- a/Configure
+++ b/Configure
@@ -1226,15 +1226,15 @@ if (!$disabled{dso} && $target{dso_scheme} ne "")
        $target{dso_scheme} =~ tr/[a-z]/[A-Z]/;
        if ($target{dso_scheme} eq "DLFCN")
                {
-               unshift @{$config{defines}}, "DSO_DLFCN", "HAVE_DLFCN_H";
+               unshift @{$config{lib_defines}}, "DSO_DLFCN", "HAVE_DLFCN_H";
                }
        elsif ($target{dso_scheme} eq "DLFCN_NO_H")
                {
-               unshift @{$config{defines}}, "DSO_DLFCN";
+               unshift @{$config{lib_defines}}, "DSO_DLFCN";
                }
        else
                {
-               unshift @{$config{defines}}, "DSO_$target{dso_scheme}";
+               unshift @{$config{lib_defines}}, "DSO_$target{dso_scheme}";
                }
        }
 
@@ -1285,10 +1285,10 @@ if ($target{shared_target} eq "")
        }
 
 if ($disabled{"dynamic-engine"}) {
-        push @{$config{defines}}, "OPENSSL_NO_DYNAMIC_ENGINE";
+        push @{$config{openssl_other_defines}}, "OPENSSL_NO_DYNAMIC_ENGINE";
         $config{dynamic_engines} = 0;
 } else {
-        push @{$config{defines}}, "OPENSSL_NO_STATIC_ENGINE";
+        push @{$config{openssl_other_defines}}, "OPENSSL_NO_STATIC_ENGINE";
         $config{dynamic_engines} = 1;
 }
 
@@ -1333,7 +1333,7 @@ if ($disabled{pic})
        }
 else
        {
-       push @{$config{defines}}, "OPENSSL_PIC";
+       push @{$config{lib_defines}}, "OPENSSL_PIC";
        }
 
 if ($target{sys_id} ne "")
@@ -1343,65 +1343,65 @@ if ($target{sys_id} ne "")
 
 unless ($disabled{asm}) {
     $target{cpuid_asm_src}=$table{DEFAULTS}->{cpuid_asm_src} if ($config{processor} eq "386");
-    push @{$config{defines}}, "OPENSSL_CPUID_OBJ" if ($target{cpuid_asm_src} ne "mem_clr.c");
+    push @{$config{lib_defines}}, "OPENSSL_CPUID_OBJ" if ($target{cpuid_asm_src} ne "mem_clr.c");
 
     $target{bn_asm_src} =~ s/\w+-gf2m.c// if (defined($disabled{ec2m}));
 
     # bn-586 is the only one implementing bn_*_part_words
-    push @{$config{defines}}, "OPENSSL_BN_ASM_PART_WORDS" if ($target{bn_asm_src} =~ /bn-586/);
-    push @{$config{defines}}, "OPENSSL_IA32_SSE2" if (!$disabled{sse2} && $target{bn_asm_src} =~ /86/);
+    push @{$config{lib_defines}}, "OPENSSL_BN_ASM_PART_WORDS" if ($target{bn_asm_src} =~ /bn-586/);
+    push @{$config{lib_defines}}, "OPENSSL_IA32_SSE2" if (!$disabled{sse2} && $target{bn_asm_src} =~ /86/);
 
-    push @{$config{defines}}, "OPENSSL_BN_ASM_MONT" if ($target{bn_asm_src} =~ /-mont/);
-    push @{$config{defines}}, "OPENSSL_BN_ASM_MONT5" if ($target{bn_asm_src} =~ /-mont5/);
-    push @{$config{defines}}, "OPENSSL_BN_ASM_GF2m" if ($target{bn_asm_src} =~ /-gf2m/);
+    push @{$config{lib_defines}}, "OPENSSL_BN_ASM_MONT" if ($target{bn_asm_src} =~ /-mont/);
+    push @{$config{lib_defines}}, "OPENSSL_BN_ASM_MONT5" if ($target{bn_asm_src} =~ /-mont5/);
+    push @{$config{lib_defines}}, "OPENSSL_BN_ASM_GF2m" if ($target{bn_asm_src} =~ /-gf2m/);
 
     if ($target{sha1_asm_src}) {
-       push @{$config{defines}}, "SHA1_ASM"   if ($target{sha1_asm_src} =~ /sx86/ || $target{sha1_asm_src} =~ /sha1/);
-       push @{$config{defines}}, "SHA256_ASM" if ($target{sha1_asm_src} =~ /sha256/);
-       push @{$config{defines}}, "SHA512_ASM" if ($target{sha1_asm_src} =~ /sha512/);
+       push @{$config{lib_defines}}, "SHA1_ASM"   if ($target{sha1_asm_src} =~ /sx86/ || $target{sha1_asm_src} =~ /sha1/);
+       push @{$config{lib_defines}}, "SHA256_ASM" if ($target{sha1_asm_src} =~ /sha256/);
+       push @{$config{lib_defines}}, "SHA512_ASM" if ($target{sha1_asm_src} =~ /sha512/);
     }
     if ($target{rc4_asm_src} ne $table{DEFAULTS}->{rc4_asm_src}) {
-       push @{$config{defines}}, "RC4_ASM";
+       push @{$config{lib_defines}}, "RC4_ASM";
     }
     if ($target{md5_asm_src}) {
-       push @{$config{defines}}, "MD5_ASM";
+       push @{$config{lib_defines}}, "MD5_ASM";
     }
     $target{cast_asm_src}=$table{DEFAULTS}->{cast_asm_src} unless $disabled{pic}; # CAST assembler is not PIC
     if ($target{rmd160_asm_src}) {
-       push @{$config{defines}}, "RMD160_ASM";
+       push @{$config{lib_defines}}, "RMD160_ASM";
     }
     if ($target{aes_asm_src}) {
-       push @{$config{defines}}, "AES_ASM" if ($target{aes_asm_src} =~ m/\baes-/);;
+       push @{$config{lib_defines}}, "AES_ASM" if ($target{aes_asm_src} =~ m/\baes-/);;
        # aes-ctr.fake is not a real file, only indication that assembler
        # module implements AES_ctr32_encrypt...
-       push @{$config{defines}}, "AES_CTR_ASM" if ($target{aes_asm_src} =~ s/\s*aes-ctr\.fake//);
+       push @{$config{lib_defines}}, "AES_CTR_ASM" if ($target{aes_asm_src} =~ s/\s*aes-ctr\.fake//);
        # aes-xts.fake indicates presence of AES_xts_[en|de]crypt...
-       push @{$config{defines}}, "AES_XTS_ASM" if ($target{aes_asm_src} =~ s/\s*aes-xts\.fake//);
+       push @{$config{lib_defines}}, "AES_XTS_ASM" if ($target{aes_asm_src} =~ s/\s*aes-xts\.fake//);
        $target{aes_asm_src} =~ s/\s*(vpaes|aesni)-x86\.s//g if ($disabled{sse2});
-       push @{$config{defines}}, "VPAES_ASM" if ($target{aes_asm_src} =~ m/vpaes/);
-       push @{$config{defines}}, "BSAES_ASM" if ($target{aes_asm_src} =~ m/bsaes/);
+       push @{$config{lib_defines}}, "VPAES_ASM" if ($target{aes_asm_src} =~ m/vpaes/);
+       push @{$config{lib_defines}}, "BSAES_ASM" if ($target{aes_asm_src} =~ m/bsaes/);
     }
     if ($target{wp_asm_src} =~ /mmx/) {
         if ($config{processor} eq "386") {
            $target{wp_asm_src}=$table{DEFAULTS}->{wp_asm_src};
        } elsif (!$disabled{"whirlpool"}) {
-           push @{$config{defines}}, "WHIRLPOOL_ASM";
+           push @{$config{lib_defines}}, "WHIRLPOOL_ASM";
        }
     }
     if ($target{modes_asm_src} =~ /ghash-/) {
-       push @{$config{defines}}, "GHASH_ASM";
+       push @{$config{lib_defines}}, "GHASH_ASM";
     }
     if ($target{ec_asm_src} =~ /ecp_nistz256/) {
-       push @{$config{defines}}, "ECP_NISTZ256_ASM";
+       push @{$config{lib_defines}}, "ECP_NISTZ256_ASM";
     }
     if ($target{ec_asm_src} =~ /x25519/) {
-       push @{$config{defines}}, "X25519_ASM";
+       push @{$config{lib_defines}}, "X25519_ASM";
     }
     if ($target{padlock_asm_src} ne $table{DEFAULTS}->{padlock_asm_src}) {
-       push @{$config{defines}}, "PADLOCK_ASM";
+       push @{$config{lib_defines}}, "PADLOCK_ASM";
     }
     if ($target{poly1305_asm_src} ne "") {
-       push @{$config{defines}}, "POLY1305_ASM";
+       push @{$config{lib_defines}}, "POLY1305_ASM";
     }
 }