]> git.ipfire.org Git - thirdparty/openssl.git/blame - Configurations/10-main.conf
Configurations/10-main.conf: amend out-dated comments.
[thirdparty/openssl.git] / Configurations / 10-main.conf
CommitLineData
f4d8f037 1## -*- mode: perl; -*-
f09e7ca9 2## Standard openssl configuration targets.
f09e7ca9 3
2fe73036
RL
4# Helper functions for the Windows configs
5my $vc_win64a_info = {};
6sub vc_win64a_info {
7 unless (%$vc_win64a_info) {
8 if (`nasm -v 2>NUL` =~ /NASM version ([0-9]+\.[0-9]+)/ && $1 >= 2.0) {
abe256e7
RL
9 $vc_win64a_info = { AS => "nasm",
10 ASFLAGS => "-g",
11 asflags => "-Ox -f win64 -DNEAR",
b6954f3b 12 asoutflag => "-o " };
43800958 13 } elsif ($disabled{asm}) {
c059564a 14 # assembler is still used to compile uplink shim
abe256e7
RL
15 $vc_win64a_info = { AS => "ml64",
16 ASFLAGS => "/Zi",
17 asflags => "/c /Cp /Cx",
2fe73036 18 asoutflag => "/Fo" };
43800958 19 } else {
d63c12c6 20 $die->("NASM not found - please read INSTALL and NOTES.WIN for further details\n");
abe256e7
RL
21 $vc_win64a_info = { AS => "{unknown}",
22 ASFLAGS => "",
d63c12c6
RL
23 asflags => "",
24 asoutflag => "" };
2fe73036
RL
25 }
26 }
27 return $vc_win64a_info;
28}
29
43800958
RL
30my $vc_win32_info = {};
31sub vc_win32_info {
32 unless (%$vc_win32_info) {
33 my $ver=`nasm -v 2>NUL`;
34 my $vew=`nasmw -v 2>NUL`;
35 if ($ver ne "" || $vew ne "") {
abe256e7
RL
36 $vc_win32_info = { AS => $ver ge $vew ? "nasm" : "nasmw",
37 ASFLAGS => "",
43800958 38 asflags => "-f win32",
b6954f3b 39 asoutflag => "-o ",
43800958
RL
40 perlasm_scheme => "win32n" };
41 } elsif ($disabled{asm}) {
c059564a 42 # not actually used, uplink shim is inlined into C code
abe256e7
RL
43 $vc_win32_info = { AS => "ml",
44 ASFLAGS => "/nologo /Zi",
45 asflags => "/Cp /coff /c /Cx",
43800958
RL
46 asoutflag => "/Fo",
47 perlasm_scheme => "win32" };
48 } else {
d63c12c6 49 $die->("NASM not found - please read INSTALL and NOTES.WIN for further details\n");
abe256e7
RL
50 $vc_win32_info = { AS => "{unknown}",
51 ASFLAGS => "",
d63c12c6
RL
52 asflags => "",
53 asoutflag => "",
54 perlasm_scheme => "win32" };
43800958
RL
55 }
56 }
57 return $vc_win32_info;
58}
59
2fe73036
RL
60my $vc_wince_info = {};
61sub vc_wince_info {
62 unless (%$vc_wince_info) {
63 # sanity check
17f16617
RL
64 $die->('%OSVERSION% is not defined') if (!defined(env('OSVERSION')));
65 $die->('%PLATFORM% is not defined') if (!defined(env('PLATFORM')));
66 $die->('%TARGETCPU% is not defined') if (!defined(env('TARGETCPU')));
2fe73036
RL
67
68 #
69 # Idea behind this is to mimic flags set by eVC++ IDE...
70 #
17f16617 71 my $wcevers = env('OSVERSION'); # WCENNN
d63c12c6
RL
72 my $wcevernum;
73 my $wceverdotnum;
74 if ($wcevers =~ /^WCE([1-9])([0-9]{2})$/) {
75 $wcevernum = "$1$2";
76 $wceverdotnum = "$1.$2";
77 } else {
78 $die->('%OSVERSION% value is insane');
79 $wcevernum = "{unknown}";
80 $wceverdotnum = "{unknown}";
81 }
82 my $wcecdefs = "-D_WIN32_WCE=$wcevernum -DUNDER_CE=$wcevernum"; # -D_WIN32_WCE=NNN
83 my $wcelflag = "/subsystem:windowsce,$wceverdotnum"; # ...,N.NN
2fe73036 84
17f16617 85 my $wceplatf = env('PLATFORM');
01d99976
RL
86
87 $wceplatf =~ tr/a-z0-9 /A-Z0-9_/;
88 $wcecdefs .= " -DWCE_PLATFORM_$wceplatf";
2fe73036 89
17f16617 90 my $wcetgt = env('TARGETCPU'); # just shorter name...
2fe73036
RL
91 SWITCH: for($wcetgt) {
92 /^X86/ && do { $wcecdefs.=" -Dx86 -D_X86_ -D_i386_ -Di_386_";
93 $wcelflag.=" /machine:X86"; last; };
94 /^ARMV4[IT]/ && do { $wcecdefs.=" -DARM -D_ARM_ -D$wcetgt";
95 $wcecdefs.=" -DTHUMB -D_THUMB_" if($wcetgt=~/T$/);
96 $wcecdefs.=" -QRarch4T -QRinterwork-return";
97 $wcelflag.=" /machine:THUMB"; last; };
98 /^ARM/ && do { $wcecdefs.=" -DARM -D_ARM_ -D$wcetgt";
99 $wcelflag.=" /machine:ARM"; last; };
100 /^MIPSIV/ && do { $wcecdefs.=" -DMIPS -D_MIPS_ -DR4000 -D$wcetgt";
101 $wcecdefs.=" -D_MIPS64 -QMmips4 -QMn32";
102 $wcelflag.=" /machine:MIPSFPU"; last; };
103 /^MIPS16/ && do { $wcecdefs.=" -DMIPS -D_MIPS_ -DR4000 -D$wcetgt";
104 $wcecdefs.=" -DMIPSII -QMmips16";
105 $wcelflag.=" /machine:MIPS16"; last; };
106 /^MIPSII/ && do { $wcecdefs.=" -DMIPS -D_MIPS_ -DR4000 -D$wcetgt";
107 $wcecdefs.=" -QMmips2";
108 $wcelflag.=" /machine:MIPS"; last; };
109 /^R4[0-9]{3}/ && do { $wcecdefs.=" -DMIPS -D_MIPS_ -DR4000";
110 $wcelflag.=" /machine:MIPS"; last; };
111 /^SH[0-9]/ && do { $wcecdefs.=" -D$wcetgt -D_${wcetgt}_ -DSHx";
112 $wcecdefs.=" -Qsh4" if ($wcetgt =~ /^SH4/);
113 $wcelflag.=" /machine:$wcetgt"; last; };
114 { $wcecdefs.=" -D$wcetgt -D_${wcetgt}_";
115 $wcelflag.=" /machine:$wcetgt"; last; };
116 }
117
8c3bc594 118 $vc_wince_info = { cppflags => $wcecdefs,
2fe73036
RL
119 lflags => $wcelflag };
120 }
121 return $vc_wince_info;
122}
123
5fe5bc30
RL
124# Helper functions for the VMS configs
125my $vms_info = {};
126sub vms_info {
ab907189
RL
127 my $pointer_size_str = $config{target} =~ m|-p(\d+)$| ? $1 : "";
128
129 # For the case where Configure iterate through all config targets, such
130 # as when listing them and their details, we reset info if the pointer
131 # size changes.
132 if (%$vms_info && $vms_info->{pointer_size} ne $pointer_size_str) {
133 $vms_info = {};
134 }
0c9b1534 135
ab907189 136 unless (%$vms_info) {
0c9b1534 137 $vms_info->{disable_warns} = [ ];
7878e536 138 $vms_info->{pointer_size} = $pointer_size_str;
ab907189 139 if ($pointer_size_str eq "64") {
0c9b1534
RL
140 `PIPE CC /NOCROSS_REFERENCE /NOLIST /NOOBJECT /WARNINGS = DISABLE = ( MAYLOSEDATA3, EMPTYFILE ) NL: 2> NL:`;
141 if ($? == 0) {
142 push @{$vms_info->{disable_warns}}, "MAYLOSEDATA3";
143 }
144 }
62890f47
RL
145
146 unless ($disabled{zlib}) {
0c9b1534 147 my $default_zlib = 'GNV$LIBZSHR' . $pointer_size_str;
62890f47 148 if (defined($disabled{"zlib-dynamic"})) {
0c9b1534 149 $vms_info->{zlib} = $withargs{zlib_lib} || "$default_zlib/SHARE";
62890f47 150 } else {
0c9b1534
RL
151 $vms_info->{def_zlib} = $withargs{zlib_lib} || $default_zlib;
152 # In case the --with-zlib-lib value contains something like
153 # /SHARE or /LIB or so at the end, remove it.
154 $vms_info->{def_zlib} =~ s|/.*$||g;
62890f47
RL
155 }
156 }
ab7134ef
RL
157
158 if ($config{target} =~ /-ia64/) {
159 `PIPE ias -H 2> NL:`;
160 if ($? == 0) {
abe256e7
RL
161 $vms_info->{AS} = "ias";
162 $vms_info->{ASFLAGS} = '-d debug';
163 $vms_info->{asflags} = '"-N" vms_upcase';
b6954f3b 164 $vms_info->{asoutflag} = "-o ";
ab7134ef
RL
165 $vms_info->{perlasm_scheme} = "ias";
166 }
167 }
5fe5bc30
RL
168 }
169 return $vms_info;
170}
2fe73036 171
3b6c4b07 172my %targets = (
f09e7ca9 173
7ead0c89 174#### Basic configs that should work on any 32-bit box
5e1b2353 175 "gcc" => {
d76117b9 176 inherit_from => [ "BASE_unix" ],
abe256e7
RL
177 CC => "gcc",
178 CFLAGS => picker(debug => "-O0 -g",
8864f0de 179 release => "-O3"),
9c62a279 180 thread_scheme => "(unknown)",
5e1b2353
RL
181 bn_ops => "BN_LLONG",
182 },
183 "cc" => {
d76117b9 184 inherit_from => [ "BASE_unix" ],
abe256e7
RL
185 CC => "cc",
186 CFLAGS => "-O",
9c62a279 187 thread_scheme => "(unknown)",
5e1b2353 188 },
f09e7ca9 189
7ead0c89 190#### VOS Configurations
5e1b2353 191 "vos-gcc" => {
d2b2221a 192 inherit_from => [ "BASE_unix" ],
abe256e7
RL
193 CC => "gcc",
194 CFLAGS => picker(default => "-Wall",
463a7b8c 195 debug => "-O0 -g",
8864f0de 196 release => "-O3"),
68b8bcf4
RL
197 cppflags => "-D_POSIX_C_SOURCE=200112L -D_BSD -D_VOS_EXTENDED_NAMES",
198 lib_cppflags => "-DB_ENDIAN",
9c62a279 199 thread_scheme => "(unknown)",
5e1b2353 200 sys_id => "VOS",
47eeaf45 201 lflags => add("-Wl,-map"),
5e1b2353
RL
202 bn_ops => "BN_LLONG",
203 shared_extension => ".so",
204 },
f09e7ca9 205
29d09327 206#### Solaris configurations
f6739c3d 207 "solaris-common" => {
d2b2221a 208 inherit_from => [ "BASE_unix" ],
f6739c3d 209 template => 1,
68b8bcf4 210 lib_cppflags => "-DFILIO_H",
8cfc21f5 211 ex_libs => add("-lsocket -lnsl -ldl"),
f6739c3d 212 dso_scheme => "dlfcn",
9c62a279 213 thread_scheme => "pthreads",
f6739c3d 214 shared_target => "solaris-shared",
d4453024 215 shared_extension => ".so.\$(SHLIB_VERSION_NUMBER)",
f6739c3d 216 },
f09e7ca9 217#### Solaris x86 with GNU C setups
5e1b2353 218 "solaris-x86-gcc" => {
fe9e5b9c
AP
219 # NB. GNU C has to be configured to use GNU assembler, and not
220 # /usr/ccs/bin/as. Failure to comply will result in compile
221 # failures [at least] in 32-bit build.
f6739c3d 222 inherit_from => [ "solaris-common", asm("x86_elf_asm") ],
abe256e7
RL
223 CC => "gcc",
224 CFLAGS => add_before(picker(default => "-Wall",
8864f0de 225 debug => "-O0 -g",
abe256e7
RL
226 release => "-O3 -fomit-frame-pointer")),
227 cflags => add(threads("-pthread")),
68b8bcf4 228 lib_cppflags => add("-DL_ENDIAN"),
fcd2ac80 229 ex_libs => add(threads("-pthread")),
a01dab94 230 bn_ops => "BN_LLONG",
5e1b2353 231 shared_cflag => "-fPIC",
216a0cc4 232 shared_ldflag => "-shared -static-libgcc",
5e1b2353 233 },
5e1b2353 234 "solaris64-x86_64-gcc" => {
7ead0c89
AP
235 # -shared -static-libgcc might appear controversial, but modules
236 # taken from static libgcc do not have relocations and linking
237 # them into our shared objects doesn't have any negative side
238 # effects. On the contrary, doing so makes it possible to use
239 # gcc shared build with Sun C. Given that gcc generates faster
240 # code [thanks to inline assembler], I would actually recommend
241 # to consider using gcc shared build even with vendor compiler:-)
e3713c36 242 # -- <appro@openssl.org>
f6739c3d 243 inherit_from => [ "solaris-common", asm("x86_64_asm") ],
abe256e7
RL
244 CC => "gcc",
245 CFLAGS => add_before(picker(default => "-Wall",
8864f0de 246 debug => "-O0 -g",
abe256e7
RL
247 release => "-O3")),
248 cflags => add_before("-m64", threads("-pthread")),
68b8bcf4 249 lib_cppflags => add("-DL_ENDIAN"),
fcd2ac80 250 ex_libs => add(threads("-pthread")),
3e9e810f 251 bn_ops => "SIXTY_FOUR_BIT_LONG",
5e1b2353 252 perlasm_scheme => "elf",
5e1b2353 253 shared_cflag => "-fPIC",
8dd0ff1c 254 shared_ldflag => "-shared -static-libgcc",
5e1b2353
RL
255 multilib => "/64",
256 },
f09e7ca9
RS
257
258#### Solaris x86 with Sun C setups
216a0cc4
AP
259 # There used to be solaris-x86-cc target, but it was removed,
260 # primarily because vendor assembler can't assemble our modules
261 # with -KPIC flag. As result it, assembly support, was not even
262 # available as option. But its lack means lack of side-channel
263 # resistant code, which is incompatible with security by todays
264 # standards. Fortunately gcc is readily available prepackaged
265 # option, which we can firmly point at...
266 #
267 # On related note, solaris64-x86_64-cc target won't compile code
268 # paths utilizing AVX and post-Haswell instruction extensions.
269 # Consider switching to solaris64-x86_64-gcc even here...
270 #
5e1b2353 271 "solaris64-x86_64-cc" => {
f6739c3d 272 inherit_from => [ "solaris-common", asm("x86_64_asm") ],
abe256e7
RL
273 CC => "cc",
274 CFLAGS => add_before(picker(debug => "-g",
8c3bc594 275 release => "-xO5 -xdepend -xbuiltin")),
abe256e7 276 cflags => add_before("-xarch=generic64 -xstrconst -Xa"),
68b8bcf4
RL
277 cppflags => add(threads("-D_REENTRANT")),
278 lib_cppflags => add("-DL_ENDIAN"),
9c62a279 279 thread_scheme => "pthreads",
8dd0ff1c 280 lflags => add(threads("-mt")),
9c62a279 281 ex_libs => add(threads("-lpthread")),
3e9e810f 282 bn_ops => "SIXTY_FOUR_BIT_LONG",
5e1b2353 283 perlasm_scheme => "elf",
5e1b2353 284 shared_cflag => "-KPIC",
8dd0ff1c 285 shared_ldflag => "-G -dy -z text",
5e1b2353
RL
286 multilib => "/64",
287 },
f09e7ca9
RS
288
289#### SPARC Solaris with GNU C setups
5e1b2353 290 "solaris-sparcv7-gcc" => {
f6739c3d 291 inherit_from => [ "solaris-common" ],
abe256e7
RL
292 CC => "gcc",
293 CFLAGS => add_before(picker(default => "-Wall",
8864f0de 294 debug => "-O0 -g",
abe256e7
RL
295 release => "-O3")),
296 cflags => add(threads("-pthread")),
68b8bcf4 297 lib_cppflags => add("-DB_ENDIAN -DBN_DIV2W"),
fcd2ac80 298 ex_libs => add(threads("-pthread")),
3e9e810f 299 bn_ops => "BN_LLONG RC4_CHAR",
5e1b2353
RL
300 shared_cflag => "-fPIC",
301 shared_ldflag => "-shared",
5e1b2353 302 },
5e1b2353 303 "solaris-sparcv8-gcc" => {
7ead0c89 304 inherit_from => [ "solaris-sparcv7-gcc", asm("sparcv8_asm") ],
bdcd83e1 305 cflags => add_before("-mcpu=v8"),
5e1b2353 306 },
5e1b2353 307 "solaris-sparcv9-gcc" => {
7ead0c89 308 # -m32 should be safe to add as long as driver recognizes
f6739c3d 309 # -mcpu=ultrasparc
7ead0c89 310 inherit_from => [ "solaris-sparcv7-gcc", asm("sparcv9_asm") ],
463a7b8c 311 cflags => add_before("-m32 -mcpu=ultrasparc"),
5e1b2353
RL
312 },
313 "solaris64-sparcv9-gcc" => {
7ead0c89 314 inherit_from => [ "solaris-sparcv9-gcc" ],
f6739c3d 315 cflags => sub { my $f=join(" ",@_); $f =~ s/\-m32/-m64/; $f; },
3e9e810f 316 bn_ops => "BN_LLONG RC4_CHAR",
5e1b2353
RL
317 multilib => "/64",
318 },
f09e7ca9
RS
319
320#### SPARC Solaris with Sun C setups
321# SC4.0 doesn't pass 'make test', upgrade to SC5.0 or SC4.2.
322# SC4.2 is ok, better than gcc even on bn as long as you tell it -xarch=v8
323# SC5.0 note: Compiler common patch 107357-01 or later is required!
5e1b2353 324 "solaris-sparcv7-cc" => {
f6739c3d 325 inherit_from => [ "solaris-common" ],
abe256e7
RL
326 CC => "cc",
327 CFLAGS => add_before(picker(debug => "-g",
8c3bc594 328 release => "-xO5 -xdepend")),
abe256e7 329 cflags => add_before("-xstrconst -Xa"),
68b8bcf4
RL
330 cppflags => add(threads("-D_REENTRANT")),
331 lib_cppflags => add("-DB_ENDIAN -DBN_DIV2W"),
9c62a279
RL
332 lflags => add(threads("-mt")),
333 ex_libs => add(threads("-lpthread")),
3e9e810f 334 bn_ops => "BN_LLONG RC4_CHAR",
5e1b2353
RL
335 shared_cflag => "-KPIC",
336 shared_ldflag => "-G -dy -z text",
5e1b2353 337 },
f09e7ca9 338####
5e1b2353 339 "solaris-sparcv8-cc" => {
7ead0c89 340 inherit_from => [ "solaris-sparcv7-cc", asm("sparcv8_asm") ],
bdcd83e1 341 cflags => add_before("-xarch=v8"),
5e1b2353
RL
342 },
343 "solaris-sparcv9-cc" => {
7ead0c89 344 inherit_from => [ "solaris-sparcv7-cc", asm("sparcv9_asm") ],
fa4618a2 345 cflags => add_before("-xarch=v8plus"),
5e1b2353
RL
346 },
347 "solaris64-sparcv9-cc" => {
7ead0c89 348 inherit_from => [ "solaris-sparcv7-cc", asm("sparcv9_asm") ],
fa4618a2 349 cflags => add_before("-xarch=v9"),
3e9e810f 350 bn_ops => "BN_LLONG RC4_CHAR",
5e1b2353
RL
351 multilib => "/64",
352 },
f09e7ca9 353
f09e7ca9 354#### IRIX 6.x configs
c21c7830 355# Only N32 and N64 ABIs are supported.
5e1b2353 356 "irix-mips3-gcc" => {
d2b2221a 357 inherit_from => [ "BASE_unix", asm("mips64_asm") ],
abe256e7
RL
358 CC => "gcc",
359 CFLAGS => picker(debug => "-g -O0",
360 release => "-O3"),
361 cflags => "-mabi=n32",
34c74bfc 362 cppflags => combine("-DB_ENDIAN -DBN_DIV3W",
c21c7830 363 threads("-D_SGI_MP_SOURCE")),
68b8bcf4
RL
364 cppflags => threads("-D_SGI_MP_SOURCE"),
365 lib_cppflags => "-DB_ENDIAN -DBN_DIV3W",
c21c7830 366 ex_libs => add(threads("-lpthread")),
3e9e810f 367 bn_ops => "RC4_CHAR SIXTY_FOUR_BIT",
9c62a279 368 thread_scheme => "pthreads",
5e1b2353
RL
369 perlasm_scheme => "n32",
370 dso_scheme => "dlfcn",
371 shared_target => "irix-shared",
d4453024 372 shared_extension => ".so.\$(SHLIB_VERSION_NUMBER)",
5e1b2353
RL
373 multilib => "32",
374 },
375 "irix-mips3-cc" => {
d2b2221a 376 inherit_from => [ "BASE_unix", asm("mips64_asm") ],
abe256e7
RL
377 CC => "cc",
378 CFLAGS => picker(debug => "-g -O0",
379 release => "-O2"),
380 cflags => "-n32 -mips3 -use_readonly_const -G0 -rdata_shared",
68b8bcf4
RL
381 cppflags => threads("-D_SGI_MP_SOURCE"),
382 lib_cppflags => "-DB_ENDIAN -DBN_DIV3W",
9c62a279 383 ex_libs => add(threads("-lpthread")),
3e9e810f 384 bn_ops => "RC4_CHAR SIXTY_FOUR_BIT",
9c62a279 385 thread_scheme => "pthreads",
5e1b2353
RL
386 perlasm_scheme => "n32",
387 dso_scheme => "dlfcn",
388 shared_target => "irix-shared",
d4453024 389 shared_extension => ".so.\$(SHLIB_VERSION_NUMBER)",
5e1b2353
RL
390 multilib => "32",
391 },
7ead0c89 392 # N64 ABI builds.
5e1b2353 393 "irix64-mips4-gcc" => {
d2b2221a 394 inherit_from => [ "BASE_unix", asm("mips64_asm") ],
abe256e7
RL
395 CC => "gcc",
396 CFLAGS => picker(debug => "-g -O0",
397 release => "-O3"),
398 cflags => "-mabi=64 -mips4",
68b8bcf4
RL
399 cppflags => threads("-D_SGI_MP_SOURCE"),
400 lib_cppflags => "-DB_ENDIAN -DBN_DIV3W",
c21c7830 401 ex_libs => add(threads("-lpthread")),
3e9e810f 402 bn_ops => "RC4_CHAR SIXTY_FOUR_BIT_LONG",
9c62a279 403 thread_scheme => "pthreads",
5e1b2353
RL
404 perlasm_scheme => "64",
405 dso_scheme => "dlfcn",
406 shared_target => "irix-shared",
d4453024 407 shared_extension => ".so.\$(SHLIB_VERSION_NUMBER)",
5e1b2353
RL
408 multilib => "64",
409 },
410 "irix64-mips4-cc" => {
d2b2221a 411 inherit_from => [ "BASE_unix", asm("mips64_asm") ],
abe256e7
RL
412 CC => "cc",
413 CFLAGS => picker(debug => "-g -O0",
414 release => "-O2"),
abe256e7 415 cflags => "-64 -mips4 -use_readonly_const -G0 -rdata_shared",
68b8bcf4
RL
416 cppflags => threads("-D_SGI_MP_SOURCE"),
417 lib_cppflags => "-DB_ENDIAN -DBN_DIV3W",
abe256e7 418 ex_libs => threads("-lpthread"),
3e9e810f 419 bn_ops => "RC4_CHAR SIXTY_FOUR_BIT_LONG",
9c62a279 420 thread_scheme => "pthreads",
5e1b2353
RL
421 perlasm_scheme => "64",
422 dso_scheme => "dlfcn",
423 shared_target => "irix-shared",
d4453024 424 shared_extension => ".so.\$(SHLIB_VERSION_NUMBER)",
5e1b2353
RL
425 multilib => "64",
426 },
f09e7ca9
RS
427
428#### Unified HP-UX ANSI C configs.
429# Special notes:
430# - Originally we were optimizing at +O4 level. It should be noted
431# that the only difference between +O3 and +O4 is global inter-
432# procedural analysis. As it has to be performed during the link
433# stage the compiler leaves behind certain pseudo-code in lib*.a
434# which might be release or even patch level specific. Generating
435# the machine code for and analyzing the *whole* program appears
436# to be *extremely* memory demanding while the performance gain is
437# actually questionable. The situation is intensified by the default
438# HP-UX data set size limit (infamous 'maxdsiz' tunable) of 64MB
439# which is way too low for +O4. In other words, doesn't +O3 make
440# more sense?
441# - Keep in mind that the HP compiler by default generates code
442# suitable for execution on the host you're currently compiling at.
b6453a68 443# If the toolkit is meant to be used on various PA-RISC processors
7ead0c89 444# consider './Configure hpux-parisc-[g]cc +DAportable'.
f09e7ca9
RS
445# - -DMD32_XARRAY triggers workaround for compiler bug we ran into in
446# 32-bit message digests. (For the moment of this writing) HP C
447# doesn't seem to "digest" too many local variables (they make "him"
448# chew forever:-). For more details look-up MD32_XARRAY comment in
449# crypto/sha/sha_lcl.h.
7ead0c89 450# - originally there were 32-bit hpux-parisc2-* targets. They were
b6453a68 451# scrapped, because a) they were not interchangeable with other 32-bit
0b919cc5
AP
452# targets; b) performance-critical 32-bit assembly modules implement
453# even PA-RISC 2.0-specific code paths, which are chosen at run-time,
454# thus adequate performance is provided even with PA-RISC 1.1 build.
5e1b2353 455 "hpux-parisc-gcc" => {
d2b2221a 456 inherit_from => [ "BASE_unix" ],
abe256e7
RL
457 CC => "gcc",
458 CFLAGS => picker(debug => "-O0 -g",
459 release => "-O3"),
460 cflags => add(threads("-pthread")),
68b8bcf4 461 lib_cppflags => "-DB_ENDIAN -DBN_DIV2W",
fcd2ac80 462 ex_libs => add("-Wl,+s -ldld", threads("-pthread")),
3e9e810f 463 bn_ops => "BN_LLONG",
9c62a279 464 thread_scheme => "pthreads",
5e1b2353
RL
465 dso_scheme => "dl",
466 shared_target => "hpux-shared",
467 shared_cflag => "-fPIC",
468 shared_ldflag => "-shared",
d4453024 469 shared_extension => ".sl.\$(SHLIB_VERSION_NUMBER)",
5e1b2353
RL
470 },
471 "hpux-parisc1_1-gcc" => {
7ead0c89 472 inherit_from => [ "hpux-parisc-gcc", asm("parisc11_asm") ],
5e1b2353
RL
473 multilib => "/pa1.1",
474 },
5e1b2353 475 "hpux64-parisc2-gcc" => {
d2b2221a 476 inherit_from => [ "BASE_unix", asm("parisc20_64_asm") ],
abe256e7
RL
477 CC => "gcc",
478 CFLAGS => combine(picker(debug => "-O0 -g",
8c3bc594 479 release => "-O3")),
68b8bcf4
RL
480 cppflags => threads("-D_REENTRANT"),
481 lib_cppflags => "-DB_ENDIAN",
98fdbce0 482 ex_libs => add("-ldl"),
3e9e810f 483 bn_ops => "SIXTY_FOUR_BIT_LONG RC4_CHAR",
9c62a279 484 thread_scheme => "pthreads",
5e1b2353
RL
485 dso_scheme => "dlfcn",
486 shared_target => "hpux-shared",
487 shared_cflag => "-fpic",
488 shared_ldflag => "-shared",
d4453024 489 shared_extension => ".sl.\$(SHLIB_VERSION_NUMBER)",
5e1b2353
RL
490 multilib => "/pa20_64",
491 },
f09e7ca9 492
7ead0c89 493 # More attempts at unified 10.X and 11.X targets for HP C compiler.
5e1b2353 494 "hpux-parisc-cc" => {
d2b2221a 495 inherit_from => [ "BASE_unix" ],
abe256e7
RL
496 CC => "cc",
497 CFLAGS => picker(debug => "+O0 +d -g",
498 release => "+O3"),
499 cflags => "+Optrs_strongly_typed -Ae +ESlit",
68b8bcf4
RL
500 cppflags => threads("-D_REENTRANT"),
501 lib_cppflags => "-DB_ENDIAN -DBN_DIV2W -DMD32_XARRAY",
9c62a279 502 ex_libs => add("-Wl,+s -ldld",threads("-lpthread")),
3e9e810f 503 bn_ops => "RC4_CHAR",
9c62a279 504 thread_scheme => "pthreads",
5e1b2353
RL
505 dso_scheme => "dl",
506 shared_target => "hpux-shared",
507 shared_cflag => "+Z",
508 shared_ldflag => "-b",
d4453024 509 shared_extension => ".sl.\$(SHLIB_VERSION_NUMBER)",
5e1b2353
RL
510 },
511 "hpux-parisc1_1-cc" => {
7ead0c89 512 inherit_from => [ "hpux-parisc-cc", asm("parisc11_asm") ],
bdcd83e1 513 cflags => add_before("+DA1.1"),
5e1b2353
RL
514 multilib => "/pa1.1",
515 },
5e1b2353 516 "hpux64-parisc2-cc" => {
d2b2221a 517 inherit_from => [ "BASE_unix", asm("parisc20_64_asm") ],
abe256e7
RL
518 CC => "cc",
519 CFLAGS => picker(debug => "+O0 +d -g",
520 release => "+O3") ,
521 cflags => "+DD64 +Optrs_strongly_typed -Ae +ESlit",
68b8bcf4
RL
522 cppflags => threads("-D_REENTRANT") ,
523 lib_cppflags => "-DB_ENDIAN -DMD32_XARRAY",
9c62a279 524 ex_libs => add("-ldl",threads("-lpthread")),
3e9e810f 525 bn_ops => "SIXTY_FOUR_BIT_LONG RC4_CHAR",
9c62a279 526 thread_scheme => "pthreads",
5e1b2353
RL
527 dso_scheme => "dlfcn",
528 shared_target => "hpux-shared",
529 shared_cflag => "+Z",
8dd0ff1c 530 shared_ldflag => "-b",
d4453024 531 shared_extension => ".sl.\$(SHLIB_VERSION_NUMBER)",
5e1b2353
RL
532 multilib => "/pa20_64",
533 },
f09e7ca9 534
7ead0c89 535 # HP/UX IA-64 targets
5e1b2353 536 "hpux-ia64-cc" => {
d2b2221a 537 inherit_from => [ "BASE_unix", asm("ia64_asm") ],
abe256e7
RL
538 CC => "cc",
539 CFLAGS => picker(debug => "+O0 +d -g",
540 release => "+O2"),
541 cflags => "-Ae +DD32 +Olit=all -z",
68b8bcf4
RL
542 cppflags => add(threads("-D_REENTRANT")),
543 lib_cppflags => "-DB_ENDIAN",
9c62a279 544 ex_libs => add("-ldl",threads("-lpthread")),
3e9e810f 545 bn_ops => "SIXTY_FOUR_BIT",
9c62a279 546 thread_scheme => "pthreads",
5e1b2353
RL
547 dso_scheme => "dlfcn",
548 shared_target => "hpux-shared",
549 shared_cflag => "+Z",
8dd0ff1c 550 shared_ldflag => "-b",
d4453024 551 shared_extension => ".so.\$(SHLIB_VERSION_NUMBER)",
5e1b2353
RL
552 multilib => "/hpux32",
553 },
5e1b2353 554 "hpux64-ia64-cc" => {
d2b2221a 555 inherit_from => [ "BASE_unix", asm("ia64_asm") ],
abe256e7
RL
556 CC => "cc",
557 CFLAGS => picker(debug => "+O0 +d -g",
558 release => "+O3"),
559 cflags => "-Ae +DD64 +Olit=all -z",
68b8bcf4
RL
560 cppflags => threads("-D_REENTRANT"),
561 lib_cppflags => "-DB_ENDIAN",
9c62a279 562 ex_libs => add("-ldl", threads("-lpthread")),
3e9e810f 563 bn_ops => "SIXTY_FOUR_BIT_LONG",
9c62a279 564 thread_scheme => "pthreads",
5e1b2353
RL
565 dso_scheme => "dlfcn",
566 shared_target => "hpux-shared",
567 shared_cflag => "+Z",
8dd0ff1c 568 shared_ldflag => "-b",
d4453024 569 shared_extension => ".so.\$(SHLIB_VERSION_NUMBER)",
5e1b2353
RL
570 multilib => "/hpux64",
571 },
7ead0c89 572 # GCC builds...
5e1b2353 573 "hpux-ia64-gcc" => {
d2b2221a 574 inherit_from => [ "BASE_unix", asm("ia64_asm") ],
abe256e7
RL
575 CC => "gcc",
576 CFLAGS => picker(debug => "-O0 -g",
577 release => "-O3"),
578 cflags => add(threads("-pthread")),
68b8bcf4 579 lib_cppflags => "-DB_ENDIAN",
fcd2ac80 580 ex_libs => add("-ldl", threads("-pthread")),
3e9e810f 581 bn_ops => "SIXTY_FOUR_BIT",
9c62a279 582 thread_scheme => "pthreads",
5e1b2353
RL
583 dso_scheme => "dlfcn",
584 shared_target => "hpux-shared",
585 shared_cflag => "-fpic",
586 shared_ldflag => "-shared",
d4453024 587 shared_extension => ".so.\$(SHLIB_VERSION_NUMBER)",
5e1b2353
RL
588 multilib => "/hpux32",
589 },
590 "hpux64-ia64-gcc" => {
d2b2221a 591 inherit_from => [ "BASE_unix", asm("ia64_asm") ],
abe256e7
RL
592 CC => "gcc",
593 CFLAGS => picker(debug => "-O0 -g",
594 release => "-O3"),
595 cflags => combine("-mlp64", threads("-pthread")),
68b8bcf4 596 lib_cppflags => "-DB_ENDIAN",
fcd2ac80 597 ex_libs => add("-ldl", threads("-pthread")),
3e9e810f 598 bn_ops => "SIXTY_FOUR_BIT_LONG",
9c62a279 599 thread_scheme => "pthreads",
5e1b2353
RL
600 dso_scheme => "dlfcn",
601 shared_target => "hpux-shared",
602 shared_cflag => "-fpic",
8dd0ff1c 603 shared_ldflag => "-shared",
d4453024 604 shared_extension => ".so.\$(SHLIB_VERSION_NUMBER)",
5e1b2353
RL
605 multilib => "/hpux64",
606 },
f09e7ca9 607
f09e7ca9 608#### HP MPE/iX http://jazz.external.hp.com/src/openssl/
5e1b2353 609 "MPE/iX-gcc" => {
d2b2221a 610 inherit_from => [ "BASE_unix" ],
abe256e7
RL
611 CC => "gcc",
612 CFLAGS => "-O3",
68b8bcf4
RL
613 cppflags => "-D_POSIX_SOURCE -D_SOCKET_SOURCE",
614 includes => [ "/SYSLOG/PUB" ],
615 lib_cppflags => "-DBN_DIV2W",
5e1b2353 616 sys_id => "MPE",
47eeaf45
RL
617 lflags => add("-L/SYSLOG/PUB"),
618 ex_libs => add("-lsyslog -lsocket -lcurses"),
9c62a279 619 thread_scheme => "(unknown)",
3e9e810f 620 bn_ops => "BN_LLONG",
5e1b2353 621 },
f09e7ca9 622
b4de72bf
AP
623#### DEC Alpha Tru64 targets. Tru64 is marketing name for OSF/1 version 4
624#### and forward. In reality 'uname -s' still returns "OSF1". Originally
625#### there were even osf1-* configs targeting prior versions provided,
626#### but not anymore...
627 "tru64-alpha-gcc" => {
d2b2221a 628 inherit_from => [ "BASE_unix", asm("alpha_asm") ],
abe256e7
RL
629 CC => "gcc",
630 CFLAGS => "-O3",
631 cflags => add("-std=c9x", threads("-pthread")),
8c3bc594 632 cppflags => "-D_XOPEN_SOURCE=500 -D_OSF_SOURCE",
fcd2ac80 633 ex_libs => add("-lrt", threads("-pthread")), # for mlock(2)
3e9e810f 634 bn_ops => "SIXTY_FOUR_BIT_LONG",
b4de72bf 635 thread_scheme => "pthreads",
5e1b2353
RL
636 dso_scheme => "dlfcn",
637 shared_target => "alpha-osf1-shared",
638 shared_extension => ".so",
639 },
640 "tru64-alpha-cc" => {
d2b2221a 641 inherit_from => [ "BASE_unix", asm("alpha_asm") ],
abe256e7
RL
642 CC => "cc",
643 CFLAGS => "-tune host -fast",
644 cflags => add("-std1 -readonly_strings",
645 threads("-pthread")),
8c3bc594 646 cppflags => "-D_XOPEN_SOURCE=500 -D_OSF_SOURCE",
fcd2ac80 647 ex_libs => add("-lrt", threads("-pthread")), # for mlock(2)
3e9e810f 648 bn_ops => "SIXTY_FOUR_BIT_LONG",
9c62a279 649 thread_scheme => "pthreads",
5e1b2353
RL
650 dso_scheme => "dlfcn",
651 shared_target => "alpha-osf1-shared",
652 shared_ldflag => "-msym",
653 shared_extension => ".so",
654 },
f09e7ca9
RS
655
656####
657#### Variety of LINUX:-)
658####
659# *-generic* is endian-neutral target, but ./config is free to
660# throw in -D[BL]_ENDIAN, whichever appropriate...
5e1b2353 661 "linux-generic32" => {
d2b2221a 662 inherit_from => [ "BASE_unix" ],
abe256e7
RL
663 CC => "gcc",
664 CXX => "g++",
665 CFLAGS => picker(default => "-Wall",
666 debug => "-O0 -g",
667 release => "-O3"),
668 CXXFLAGS => picker(default => "-Wall",
669 debug => "-O0 -g",
670 release => "-O3"),
671 cflags => threads("-pthread"),
672 cxxflags => combine("-std=c++11", threads("-pthread")),
68b8bcf4 673 lib_cppflags => "-DOPENSSL_USE_NODELETE",
fcd2ac80 674 ex_libs => add("-ldl", threads("-pthread")),
3e9e810f 675 bn_ops => "BN_LLONG RC4_CHAR",
9c62a279 676 thread_scheme => "pthreads",
5e1b2353
RL
677 dso_scheme => "dlfcn",
678 shared_target => "linux-shared",
8c3bc594 679 shared_cflag => "-fPIC",
075e9da0 680 shared_ldflag => "-Wl,-znodelete",
d4453024 681 shared_extension => ".so.\$(SHLIB_VERSION_NUMBER)",
5e1b2353 682 },
7ead0c89
AP
683 "linux-generic64" => {
684 inherit_from => [ "linux-generic32" ],
3e9e810f 685 bn_ops => "SIXTY_FOUR_BIT_LONG RC4_CHAR",
7ead0c89
AP
686 },
687
5e1b2353 688 "linux-ppc" => {
7ead0c89 689 inherit_from => [ "linux-generic32", asm("ppc32_asm") ],
5e1b2353 690 perlasm_scheme => "linux32",
7ead0c89
AP
691 },
692 "linux-ppc64" => {
693 inherit_from => [ "linux-generic64", asm("ppc64_asm") ],
8c3bc594 694 cflags => add("-m64"),
72d7f221 695 cxxflags => add("-m64"),
68b8bcf4 696 lib_cppflags => add("-DB_ENDIAN"),
7ead0c89 697 perlasm_scheme => "linux64",
7ead0c89
AP
698 multilib => "64",
699 },
700 "linux-ppc64le" => {
701 inherit_from => [ "linux-generic64", asm("ppc64_asm") ],
8c3bc594 702 cflags => add("-m64"),
72d7f221 703 cxxflags => add("-m64"),
68b8bcf4 704 lib_cppflags => add("-DL_ENDIAN"),
7ead0c89 705 perlasm_scheme => "linux64le",
5e1b2353 706 },
f09e7ca9 707
5e1b2353 708 "linux-armv4" => {
7ead0c89
AP
709 ################################################################
710 # Note that -march is not among compiler options in linux-armv4
711 # target description. Not specifying one is intentional to give
712 # you choice to:
713 #
714 # a) rely on your compiler default by not specifying one;
715 # b) specify your target platform explicitly for optimal
716 # performance, e.g. -march=armv6 or -march=armv7-a;
717 # c) build "universal" binary that targets *range* of platforms
718 # by specifying minimum and maximum supported architecture;
719 #
720 # As for c) option. It actually makes no sense to specify
721 # maximum to be less than ARMv7, because it's the least
722 # requirement for run-time switch between platform-specific
723 # code paths. And without run-time switch performance would be
724 # equivalent to one for minimum. Secondly, there are some
725 # natural limitations that you'd have to accept and respect.
726 # Most notably you can *not* build "universal" binary for
727 # big-endian platform. This is because ARMv7 processor always
728 # picks instructions in little-endian order. Another similar
729 # limitation is that -mthumb can't "cross" -march=armv6t2
730 # boundary, because that's where it became Thumb-2. Well, this
731 # limitation is a bit artificial, because it's not really
732 # impossible, but it's deemed too tricky to support. And of
733 # course you have to be sure that your binutils are actually
734 # up to the task of handling maximum target platform. With all
735 # this in mind here is an example of how to configure
736 # "universal" build:
737 #
738 # ./Configure linux-armv4 -march=armv6 -D__ARM_MAX_ARCH__=8
739 #
740 inherit_from => [ "linux-generic32", asm("armv4_asm") ],
741 perlasm_scheme => "linux32",
5e1b2353
RL
742 },
743 "linux-aarch64" => {
7ead0c89 744 inherit_from => [ "linux-generic64", asm("aarch64_asm") ],
5e1b2353 745 perlasm_scheme => "linux64",
5e1b2353 746 },
a93d3e06
AP
747 "linux-arm64ilp32" => { # https://wiki.linaro.org/Platform/arm64-ilp32
748 inherit_from => [ "linux-generic32", asm("aarch64_asm") ],
8864f0de 749 cflags => add("-mabi=ilp32"),
72d7f221 750 cxxflags => add("-mabi=ilp32"),
3e9e810f 751 bn_ops => "SIXTY_FOUR_BIT RC4_CHAR",
a93d3e06 752 perlasm_scheme => "linux64",
a93d3e06 753 },
7ead0c89 754
5e1b2353 755 "linux-mips32" => {
7ead0c89
AP
756 # Configure script adds minimally required -march for assembly
757 # support, if no -march was specified at command line.
758 inherit_from => [ "linux-generic32", asm("mips32_asm") ],
8c3bc594 759 cflags => add("-mabi=32"),
72d7f221 760 cxxflags => add("-mabi=32"),
68b8bcf4 761 lib_cppflags => add("-DBN_DIV3W"),
5e1b2353 762 perlasm_scheme => "o32",
5e1b2353 763 },
7ead0c89
AP
764 # mips32 and mips64 below refer to contemporary MIPS Architecture
765 # specifications, MIPS32 and MIPS64, rather than to kernel bitness.
5e1b2353 766 "linux-mips64" => {
7ead0c89 767 inherit_from => [ "linux-generic32", asm("mips64_asm") ],
8c3bc594 768 cflags => add("-mabi=n32"),
72d7f221 769 cxxflags => add("-mabi=n32"),
68b8bcf4 770 lib_cppflags => add("-DBN_DIV3W"),
3e9e810f 771 bn_ops => "SIXTY_FOUR_BIT RC4_CHAR",
5e1b2353 772 perlasm_scheme => "n32",
5e1b2353
RL
773 multilib => "32",
774 },
775 "linux64-mips64" => {
7ead0c89 776 inherit_from => [ "linux-generic64", asm("mips64_asm") ],
8c3bc594 777 cflags => add("-mabi=64"),
72d7f221 778 cxxflags => add("-mabi=64"),
68b8bcf4 779 lib_cppflags => add("-DBN_DIV3W"),
5e1b2353 780 perlasm_scheme => "64",
5e1b2353
RL
781 multilib => "64",
782 },
7ead0c89
AP
783
784 #### IA-32 targets...
7fbc0bfd
RL
785 #### These two targets are a bit aged and are to be used on older Linux
786 #### machines where gcc doesn't understand -m32 and -m64
5e1b2353 787 "linux-elf" => {
7ead0c89 788 inherit_from => [ "linux-generic32", asm("x86_elf_asm") ],
abe256e7 789 CFLAGS => add(picker(release => "-fomit-frame-pointer")),
68b8bcf4 790 lib_cppflags => add("-DL_ENDIAN"),
a01dab94 791 bn_ops => "BN_LLONG",
5e1b2353
RL
792 },
793 "linux-aout" => {
d2b2221a 794 inherit_from => [ "BASE_unix", asm("x86_asm") ],
abe256e7
RL
795 CC => "gcc",
796 CFLAGS => add(picker(default => "-Wall",
8864f0de
RL
797 debug => "-O0 -g",
798 release => "-O3 -fomit-frame-pointer")),
68b8bcf4 799 lib_cppflags => add("-DL_ENDIAN"),
a01dab94 800 bn_ops => "BN_LLONG",
9c62a279 801 thread_scheme => "(unknown)",
5e1b2353
RL
802 perlasm_scheme => "a.out",
803 },
7ead0c89 804
7fbc0bfd
RL
805 #### X86 / X86_64 targets
806 "linux-x86" => {
807 inherit_from => [ "linux-generic32", asm("x86_asm") ],
abe256e7
RL
808 CFLAGS => add(picker(release => "-fomit-frame-pointer")),
809 cflags => add("-m32"),
72d7f221 810 cxxflags => add("-m32"),
68b8bcf4 811 lib_cppflags => add("-DL_ENDIAN"),
7fbc0bfd
RL
812 bn_ops => "BN_LLONG",
813 perlasm_scheme => "elf",
7fbc0bfd
RL
814 },
815 "linux-x86-clang" => {
816 inherit_from => [ "linux-x86" ],
abe256e7
RL
817 CC => "clang",
818 CXX => "clang++",
819 CFLAGS => add("-Wextra"),
7fbc0bfd 820 },
5e1b2353 821 "linux-x86_64" => {
7ead0c89 822 inherit_from => [ "linux-generic64", asm("x86_64_asm") ],
8c3bc594 823 cflags => add("-m64"),
72d7f221 824 cxxflags => add("-m64"),
68b8bcf4 825 lib_cppflags => add("-DL_ENDIAN"),
3e9e810f 826 bn_ops => "SIXTY_FOUR_BIT_LONG",
5e1b2353 827 perlasm_scheme => "elf",
5e1b2353
RL
828 multilib => "64",
829 },
7ead0c89
AP
830 "linux-x86_64-clang" => {
831 inherit_from => [ "linux-x86_64" ],
abe256e7
RL
832 CC => "clang",
833 CXX => "clang++",
834 CFLAGS => add("-Wextra"),
7ead0c89 835 },
5e1b2353 836 "linux-x32" => {
7ead0c89 837 inherit_from => [ "linux-generic32", asm("x86_64_asm") ],
8c3bc594 838 cflags => add("-mx32"),
72d7f221 839 cxxflags => add("-mx32"),
68b8bcf4 840 lib_cppflags => add("-DL_ENDIAN"),
3e9e810f 841 bn_ops => "SIXTY_FOUR_BIT",
2460c7f1 842 perlasm_scheme => "elf32",
5e1b2353
RL
843 multilib => "x32",
844 },
7ead0c89
AP
845
846 "linux-ia64" => {
847 inherit_from => [ "linux-generic64", asm("ia64_asm") ],
3e9e810f 848 bn_ops => "SIXTY_FOUR_BIT_LONG",
7ead0c89
AP
849 },
850
5e1b2353 851 "linux64-s390x" => {
7ead0c89 852 inherit_from => [ "linux-generic64", asm("s390x_asm") ],
8c3bc594 853 cflags => add("-m64"),
72d7f221 854 cxxflags => add("-m64"),
68b8bcf4 855 lib_cppflags => add("-DB_ENDIAN"),
5e1b2353 856 perlasm_scheme => "64",
5e1b2353
RL
857 multilib => "64",
858 },
5e1b2353 859 "linux32-s390x" => {
7ead0c89
AP
860 #### So called "highgprs" target for z/Architecture CPUs
861 # "Highgprs" is kernel feature first implemented in Linux
862 # 2.6.32, see /proc/cpuinfo. The idea is to preserve most
863 # significant bits of general purpose registers not only
864 # upon 32-bit process context switch, but even on
865 # asynchronous signal delivery to such process. This makes
866 # it possible to deploy 64-bit instructions even in legacy
867 # application context and achieve better [or should we say
868 # adequate] performance. The build is binary compatible with
869 # linux-generic32, and the idea is to be able to install the
870 # resulting libcrypto.so alongside generic one, e.g. as
871 # /lib/highgprs/libcrypto.so.x.y, for ldconfig and run-time
872 # linker to autodiscover. Unfortunately it doesn't work just
873 # yet, because of couple of bugs in glibc
874 # sysdeps/s390/dl-procinfo.c affecting ldconfig and ld.so.1...
875 #
876 inherit_from => [ "linux-generic32", asm("s390x_asm") ],
8c3bc594 877 cflags => add("-m31 -Wa,-mzarch"),
72d7f221 878 cxxflags => add("-m31 -Wa,-mzarch"),
68b8bcf4 879 lib_cppflags => add("-DB_ENDIAN"),
8d51db86 880 bn_asm_src => sub { my $r=join(" ",@_); $r=~s|asm/s390x\.S|bn_asm.c|; $r; },
5e1b2353 881 perlasm_scheme => "31",
5e1b2353
RL
882 multilib => "/highgprs",
883 },
7ead0c89
AP
884
885 #### SPARC Linux setups
5e1b2353 886 "linux-sparcv8" => {
7ead0c89 887 inherit_from => [ "linux-generic32", asm("sparcv8_asm") ],
8c3bc594 888 cflags => add("-mcpu=v8"),
72d7f221 889 cxxflags => add("-mcpu=v8"),
abe256e7 890 lib_cppflags => add("-DB_ENDIAN -DBN_DIV2W"),
5e1b2353 891 },
5e1b2353 892 "linux-sparcv9" => {
7ead0c89
AP
893 # it's a real mess with -mcpu=ultrasparc option under Linux,
894 # but -Wa,-Av8plus should do the trick no matter what.
895 inherit_from => [ "linux-generic32", asm("sparcv9_asm") ],
8c3bc594 896 cflags => add("-m32 -mcpu=ultrasparc -Wa,-Av8plus"),
72d7f221 897 cxxflags => add("-m32 -mcpu=ultrasparc -Wa,-Av8plus"),
abe256e7 898 lib_cppflags => add("-DB_ENDIAN -DBN_DIV2W"),
5e1b2353 899 },
5e1b2353 900 "linux64-sparcv9" => {
7ead0c89
AP
901 # GCC 3.1 is a requirement
902 inherit_from => [ "linux-generic64", asm("sparcv9_asm") ],
8c3bc594 903 cflags => add("-m64 -mcpu=ultrasparc"),
72d7f221 904 cxxflags => add("-m64 -mcpu=ultrasparc"),
abe256e7 905 lib_cppflags => add("-DB_ENDIAN"),
3e9e810f 906 bn_ops => "BN_LLONG RC4_CHAR",
5e1b2353
RL
907 multilib => "64",
908 },
7ead0c89 909
5e1b2353 910 "linux-alpha-gcc" => {
7ead0c89 911 inherit_from => [ "linux-generic64", asm("alpha_asm") ],
abe256e7 912 lib_cppflags => add("-DL_ENDIAN"),
3e9e810f 913 bn_ops => "SIXTY_FOUR_BIT_LONG",
5e1b2353 914 },
5e1b2353 915 "linux-c64xplus" => {
d2b2221a 916 inherit_from => [ "BASE_unix" ],
7ead0c89 917 # TI_CGT_C6000_7.3.x is a requirement
abe256e7
RL
918 CC => "cl6x",
919 CFLAGS => "-o2 -ox -ms",
920 cflags => "--linux -ea=.s -eo=.o -mv6400+ -pden",
72d7f221 921 cxxflags => "--linux -ea=.s -eo=.o -mv6400+ -pden",
8c3bc594 922 cppflags => combine("-DOPENSSL_SMALL_FOOTPRINT",
9c62a279 923 threads("-D_REENTRANT")),
5e1b2353 924 bn_ops => "BN_LLONG",
f4e175e4
AP
925 cpuid_asm_src => "c64xpluscpuid.s",
926 bn_asm_src => "asm/bn-c64xplus.asm c64xplus-gf2m.s",
927 aes_asm_src => "aes-c64xplus.s aes_cbc.c aes-ctr.fake",
928 sha1_asm_src => "sha1-c64xplus.s sha256-c64xplus.s sha512-c64xplus.s",
929 rc4_asm_src => "rc4-c64xplus.s",
930 modes_asm_src => "ghash-c64xplus.s",
931 chacha_asm_src => "chacha-c64xplus.s",
932 poly1305_asm_src => "poly1305-c64xplus.s",
9c62a279 933 thread_scheme => "pthreads",
5e1b2353
RL
934 perlasm_scheme => "void",
935 dso_scheme => "dlfcn",
936 shared_target => "linux-shared",
937 shared_cflag => "--pic",
b6d5ba1a 938 shared_ldflag => add("-z --sysv --shared"),
d4453024 939 shared_extension => ".so.\$(SHLIB_VERSION_NUMBER)",
5e1b2353
RL
940 ranlib => "true",
941 },
f09e7ca9 942
7ead0c89 943#### Android: linux-* but without pointers to headers and libs.
449e3f26
AP
944 #
945 # It takes pair of prior-set environment variables to make it work:
946 #
d5a39c12 947 # CROSS_SYSROOT=/some/where/android-ndk-<ver>/platforms/android-<apiver>/arch-<arch>
449e3f26
AP
948 # CROSS_COMPILE=<prefix>
949 #
950 # As well as PATH adjusted to cover ${CROSS_COMPILE}gcc and company.
951 # For example to compile for ICS and ARM with NDK 10d, you'd:
952 #
953 # ANDROID_NDK=/some/where/android-ndk-10d
954 # CROSS_SYSROOT=$ANDROID_NDK/platforms/android-14/arch-arm
bebef673 955 # CROSS_COMPILE=arm-linux-androideabi-
d5a39c12 956 # PATH=$ANDROID_NDK/toolchains/arm-linux-androideabi-4.8/prebuild/linux-x86_64/bin
449e3f26 957 #
5e1b2353 958 "android" => {
7ead0c89 959 inherit_from => [ "linux-generic32" ],
449e3f26
AP
960 # Special note about unconditional -fPIC and -pie. The underlying
961 # reason is that Lollipop refuses to run non-PIE. But what about
962 # older systems and NDKs? -fPIC was never problem, so the only
cba792a1 963 # concern is -pie. Older toolchains, e.g. r4, appear to handle it
449e3f26
AP
964 # and binaries turn mostly functional. "Mostly" means that oldest
965 # Androids, such as Froyo, fail to handle executable, but newer
966 # systems are perfectly capable of executing binaries targeting
967 # Froyo. Keep in mind that in the nutshell Android builds are
968 # about JNI, i.e. shared libraries, not applications.
72d7f221
RL
969 cflags => add("-mandroid -fPIC --sysroot=\$(CROSS_SYSROOT) -Wa,--noexecstack"),
970 cxxflags => add("-mandroid -fPIC --sysroot=\$(CROSS_SYSROOT) -Wa,--noexecstack"),
cba792a1 971 bin_cflags => "-pie",
5e1b2353
RL
972 },
973 "android-x86" => {
7ead0c89 974 inherit_from => [ "android", asm("x86_asm") ],
abe256e7 975 CFLAGS => add(picker(release => "-fomit-frame-pointer")),
a01dab94 976 bn_ops => "BN_LLONG",
7ead0c89 977 perlasm_scheme => "android",
5e1b2353 978 },
449e3f26
AP
979 ################################################################
980 # Contemporary Android applications can provide multiple JNI
981 # providers in .apk, targeting multiple architectures. Among
982 # them there is "place" for two ARM flavours: generic eabi and
983 # armv7-a/hard-float. However, it should be noted that OpenSSL's
984 # ability to engage NEON is not constrained by ABI choice, nor
985 # is your ability to call OpenSSL from your application code
986 # compiled with floating-point ABI other than default 'soft'.
987 # [Latter thanks to __attribute__((pcs("aapcs"))) declaration.]
988 # This means that choice of ARM libraries you provide in .apk
989 # is driven by application needs. For example if application
990 # itself benefits from NEON or is floating-point intensive, then
991 # it might be appropriate to provide both libraries. Otherwise
992 # just generic eabi would do. But in latter case it would be
993 # appropriate to
994 #
995 # ./Configure android-armeabi -D__ARM_MAX_ARCH__=8
996 #
997 # in order to build "universal" binary and allow OpenSSL take
998 # advantage of NEON when it's available.
999 #
1000 "android-armeabi" => {
7ead0c89 1001 inherit_from => [ "android", asm("armv4_asm") ],
449e3f26 1002 },
5e1b2353 1003 "android-mips" => {
7ead0c89 1004 inherit_from => [ "android", asm("mips32_asm") ],
5e1b2353 1005 perlasm_scheme => "o32",
5e1b2353 1006 },
f09e7ca9 1007
5a3d915d
AP
1008 "android64" => {
1009 inherit_from => [ "linux-generic64" ],
72d7f221
RL
1010 cflags => add("-mandroid -fPIC --sysroot=\$(CROSS_SYSROOT) -Wa,--noexecstack"),
1011 cxxflags => add("-mandroid -fPIC --sysroot=\$(CROSS_SYSROOT) -Wa,--noexecstack"),
cba792a1 1012 bin_cflags => "-pie",
5a3d915d
AP
1013 },
1014 "android64-aarch64" => {
1015 inherit_from => [ "android64", asm("aarch64_asm") ],
1016 perlasm_scheme => "linux64",
a4324912
AP
1017 },
1018 "android64-x86_64" => {
1019 inherit_from => [ "android64", asm("x86_64_asm") ],
1020 perlasm_scheme => "elf",
c1ec40ef
AP
1021 },
1022 "android64-mips64" => {
1023 ############################################################
1024 # You are more than likely have to specify target processor
1025 # on ./Configure command line. Trouble is that toolchain's
1026 # default is MIPS64r6 (at least in r10d), but there are no
1027 # such processors around (or they are too rare to spot one).
1028 # Actual problem is that MIPS64r6 is binary incompatible
1029 # with previous MIPS ISA versions, in sense that unlike
1030 # prior versions original MIPS binary code will fail.
1031 #
1032 inherit_from => [ "android64", asm("mips64_asm") ],
1033 perlasm_scheme => "64",
5a3d915d
AP
1034 },
1035
1818572d 1036#### *BSD
5e1b2353 1037 "BSD-generic32" => {
9c62a279 1038 # As for thread cflag. Idea is to maintain "collective" set of
1818572d
AP
1039 # flags, which would cover all BSD flavors. -pthread applies
1040 # to them all, but is treated differently. OpenBSD expands is
1041 # as -D_POSIX_THREAD -lc_r, which is sufficient. FreeBSD 4.x
1042 # expands it as -lc_r, which has to be accompanied by explicit
1043 # -D_THREAD_SAFE and sometimes -D_REENTRANT. FreeBSD 5.x
1044 # expands it as -lc_r, which seems to be sufficient?
d2b2221a 1045 inherit_from => [ "BASE_unix" ],
abe256e7
RL
1046 CC => "cc",
1047 CFLAGS => picker(default => "-Wall",
1048 debug => "-O0 -g",
1049 release => "-O3"),
1050 cflags => threads("-pthread"),
8c3bc594 1051 cppflags => threads("-D_THREAD_SAFE -D_REENTRANT"),
fcd2ac80 1052 ex_libs => add(threads("-pthread")),
619eb33a 1053 enable => add("devcryptoeng"),
3e9e810f 1054 bn_ops => "BN_LLONG",
9c62a279 1055 thread_scheme => "pthreads",
5e1b2353
RL
1056 dso_scheme => "dlfcn",
1057 shared_target => "bsd-gcc-shared",
1058 shared_cflag => "-fPIC",
d4453024 1059 shared_extension => ".so.\$(SHLIB_VERSION_NUMBER)",
5e1b2353 1060 },
7ead0c89
AP
1061 "BSD-generic64" => {
1062 inherit_from => [ "BSD-generic32" ],
3e9e810f 1063 bn_ops => "SIXTY_FOUR_BIT_LONG",
5e1b2353 1064 },
7ead0c89
AP
1065
1066 "BSD-x86" => {
1067 inherit_from => [ "BSD-generic32", asm("x86_asm") ],
abe256e7 1068 CFLAGS => add(picker(release => "-fomit-frame-pointer")),
68b8bcf4 1069 lib_cppflags => add("-DL_ENDIAN"),
a01dab94 1070 bn_ops => "BN_LLONG",
5e1b2353 1071 shared_target => "bsd-shared",
7ead0c89 1072 perlasm_scheme => "a.out",
5e1b2353 1073 },
7ead0c89
AP
1074 "BSD-x86-elf" => {
1075 inherit_from => [ "BSD-x86" ],
1076 perlasm_scheme => "elf",
5e1b2353 1077 },
f09e7ca9 1078
7ead0c89
AP
1079 "BSD-sparcv8" => {
1080 inherit_from => [ "BSD-generic32", asm("sparcv8_asm") ],
8c3bc594 1081 cflags => add("-mcpu=v8"),
68b8bcf4 1082 lib_cppflags => add("-DB_ENDIAN"),
5e1b2353 1083 },
5e1b2353 1084 "BSD-sparc64" => {
7ead0c89
AP
1085 # -DMD32_REG_T=int doesn't actually belong in sparc64 target, it
1086 # simply *happens* to work around a compiler bug in gcc 3.3.3,
1087 # triggered by RIPEMD160 code.
1088 inherit_from => [ "BSD-generic64", asm("sparcv9_asm") ],
68b8bcf4 1089 lib_cppflags => add("-DB_ENDIAN -DMD32_REG_T=int"),
3e9e810f 1090 bn_ops => "BN_LLONG",
5e1b2353 1091 },
7ead0c89 1092
5e1b2353 1093 "BSD-ia64" => {
7ead0c89 1094 inherit_from => [ "BSD-generic64", asm("ia64_asm") ],
68b8bcf4 1095 lib_cppflags => add("-DL_ENDIAN"),
3e9e810f 1096 bn_ops => "SIXTY_FOUR_BIT_LONG",
5e1b2353 1097 },
7ead0c89 1098
5e1b2353 1099 "BSD-x86_64" => {
7ead0c89 1100 inherit_from => [ "BSD-generic64", asm("x86_64_asm") ],
68b8bcf4 1101 lib_cppflags => add("-DL_ENDIAN"),
3e9e810f 1102 bn_ops => "SIXTY_FOUR_BIT_LONG",
5e1b2353 1103 perlasm_scheme => "elf",
5e1b2353 1104 },
f09e7ca9 1105
5e1b2353 1106 "bsdi-elf-gcc" => {
d2b2221a 1107 inherit_from => [ "BASE_unix", asm("x86_elf_asm") ],
abe256e7
RL
1108 CC => "gcc",
1109 CFLAGS => "-fomit-frame-pointer -O3 -Wall",
68b8bcf4 1110 lib_cppflags => "-DPERL5 -DL_ENDIAN",
98fdbce0 1111 ex_libs => add("-ldl"),
a01dab94 1112 bn_ops => "BN_LLONG",
9c62a279 1113 thread_scheme => "(unknown)",
5e1b2353
RL
1114 dso_scheme => "dlfcn",
1115 shared_target => "bsd-gcc-shared",
1116 shared_cflag => "-fPIC",
d4453024 1117 shared_extension => ".so.\$(SHLIB_VERSION_NUMBER)",
5e1b2353 1118 },
f09e7ca9 1119
5e1b2353 1120 "nextstep" => {
d2b2221a 1121 inherit_from => [ "BASE_unix" ],
abe256e7
RL
1122 CC => "cc",
1123 CFLAGS => "-O -Wall",
5e1b2353 1124 unistd => "<libc.h>",
a01dab94 1125 bn_ops => "BN_LLONG",
9c62a279 1126 thread_scheme => "(unknown)",
5e1b2353
RL
1127 },
1128 "nextstep3.3" => {
d2b2221a 1129 inherit_from => [ "BASE_unix" ],
abe256e7
RL
1130 CC => "cc",
1131 CFLAGS => "-O3 -Wall",
5e1b2353 1132 unistd => "<libc.h>",
a01dab94 1133 bn_ops => "BN_LLONG",
9c62a279 1134 thread_scheme => "(unknown)",
5e1b2353 1135 },
f09e7ca9
RS
1136
1137# QNX
5e1b2353 1138 "qnx4" => {
d2b2221a 1139 inherit_from => [ "BASE_unix" ],
abe256e7
RL
1140 CC => "cc",
1141 CFLAGS => "",
68b8bcf4 1142 lib_cppflags => "-DL_ENDIAN -DTERMIO",
9c62a279 1143 thread_scheme => "(unknown)",
5e1b2353
RL
1144 },
1145 "QNX6" => {
d2b2221a 1146 inherit_from => [ "BASE_unix" ],
abe256e7 1147 CC => "gcc",
98fdbce0 1148 ex_libs => add("-lsocket"),
5e1b2353
RL
1149 dso_scheme => "dlfcn",
1150 shared_target => "bsd-gcc-shared",
1151 shared_cflag => "-fPIC",
d4453024 1152 shared_extension => ".so.\$(SHLIB_VERSION_NUMBER)",
5e1b2353
RL
1153 },
1154 "QNX6-i386" => {
d2b2221a 1155 inherit_from => [ "BASE_unix", asm("x86_elf_asm") ],
abe256e7
RL
1156 CC => "gcc",
1157 CFLAGS => "-O2 -Wall",
68b8bcf4 1158 lib_cppflags => "-DL_ENDIAN",
98fdbce0 1159 ex_libs => add("-lsocket"),
5e1b2353
RL
1160 dso_scheme => "dlfcn",
1161 shared_target => "bsd-gcc-shared",
1162 shared_cflag => "-fPIC",
d4453024 1163 shared_extension => ".so.\$(SHLIB_VERSION_NUMBER)",
5e1b2353 1164 },
f09e7ca9
RS
1165
1166#### SCO/Caldera targets.
1167#
1168# Originally we had like unixware-*, unixware-*-pentium, unixware-*-p6, etc.
1169# Now we only have blended unixware-* as it's the only one used by ./config.
1170# If you want to optimize for particular microarchitecture, bypass ./config
1171# and './Configure unixware-7 -Kpentium_pro' or whatever appropriate.
1172# Note that not all targets include assembler support. Mostly because of
1173# lack of motivation to support out-of-date platforms with out-of-date
e3713c36 1174# compiler drivers and assemblers.
f09e7ca9
RS
1175#
1176# UnixWare 2.0x fails destest with -O.
5e1b2353 1177 "unixware-2.0" => {
d2b2221a 1178 inherit_from => [ "BASE_unix" ],
abe256e7
RL
1179 CC => "cc",
1180 cflags => threads("-Kthread"),
68b8bcf4 1181 lib_cppflags => "-DFILIO_H -DNO_STRINGS_H",
98fdbce0 1182 ex_libs => add("-lsocket -lnsl -lresolv -lx"),
9c62a279 1183 thread_scheme => "uithreads",
5e1b2353
RL
1184 },
1185 "unixware-2.1" => {
d2b2221a 1186 inherit_from => [ "BASE_unix" ],
abe256e7
RL
1187 CC => "cc",
1188 CFLAGS => "-O",
1189 cflags => threads("-Kthread"),
68b8bcf4 1190 lib_cppflags => "-DFILIO_H",
98fdbce0 1191 ex_libs => add("-lsocket -lnsl -lresolv -lx"),
9c62a279 1192 thread_scheme => "uithreads",
5e1b2353
RL
1193 },
1194 "unixware-7" => {
d2b2221a 1195 inherit_from => [ "BASE_unix", asm("x86_elf_asm") ],
abe256e7
RL
1196 CC => "cc",
1197 CFLAGS => "-O",
1198 cflags => combine("-Kalloca", threads("-Kthread")),
68b8bcf4 1199 lib_cppflags => "-DFILIO_H",
98fdbce0 1200 ex_libs => add("-lsocket -lnsl"),
9c62a279 1201 thread_scheme => "uithreads",
a01dab94 1202 bn_ops => "BN_LLONG",
5e1b2353
RL
1203 perlasm_scheme => "elf-1",
1204 dso_scheme => "dlfcn",
1205 shared_target => "svr5-shared",
1206 shared_cflag => "-Kpic",
d4453024 1207 shared_extension => ".so.\$(SHLIB_VERSION_NUMBER)",
5e1b2353
RL
1208 },
1209 "unixware-7-gcc" => {
d2b2221a 1210 inherit_from => [ "BASE_unix", asm("x86_elf_asm") ],
abe256e7
RL
1211 CC => "gcc",
1212 CFLAGS => "-O3 -fomit-frame-pointer -Wall",
68b8bcf4
RL
1213 cppflags => add(threads("-D_REENTRANT")),
1214 lib_cppflags => add("-DL_ENDIAN -DFILIO_H"),
98fdbce0 1215 ex_libs => add("-lsocket -lnsl"),
a01dab94 1216 bn_ops => "BN_LLONG",
9c62a279 1217 thread_scheme => "pthreads",
5e1b2353
RL
1218 perlasm_scheme => "elf-1",
1219 dso_scheme => "dlfcn",
1220 shared_target => "gnu-shared",
1221 shared_cflag => "-fPIC",
d4453024 1222 shared_extension => ".so.\$(SHLIB_VERSION_NUMBER)",
5e1b2353 1223 },
e3713c36 1224# SCO 5 - Ben Laurie says the -O breaks the SCO cc.
5e1b2353 1225 "sco5-cc" => {
d2b2221a 1226 inherit_from => [ "BASE_unix", asm("x86_elf_asm") ],
5e1b2353
RL
1227 cc => "cc",
1228 cflags => "-belf",
98fdbce0 1229 ex_libs => add("-lsocket -lnsl"),
9c62a279 1230 thread_scheme => "(unknown)",
5e1b2353
RL
1231 perlasm_scheme => "elf-1",
1232 dso_scheme => "dlfcn",
1233 shared_target => "svr3-shared",
1234 shared_cflag => "-Kpic",
d4453024 1235 shared_extension => ".so.\$(SHLIB_VERSION_NUMBER)",
5e1b2353
RL
1236 },
1237 "sco5-gcc" => {
d2b2221a 1238 inherit_from => [ "BASE_unix", asm("x86_elf_asm") ],
5e1b2353
RL
1239 cc => "gcc",
1240 cflags => "-O3 -fomit-frame-pointer",
98fdbce0 1241 ex_libs => add("-lsocket -lnsl"),
a01dab94 1242 bn_ops => "BN_LLONG",
9c62a279 1243 thread_scheme => "(unknown)",
5e1b2353
RL
1244 perlasm_scheme => "elf-1",
1245 dso_scheme => "dlfcn",
1246 shared_target => "svr3-shared",
1247 shared_cflag => "-fPIC",
d4453024 1248 shared_extension => ".so.\$(SHLIB_VERSION_NUMBER)",
5e1b2353 1249 },
f09e7ca9
RS
1250
1251#### IBM's AIX.
f780eaad
AP
1252 # Below targets assume AIX >=5. Caveat lector. If you are accustomed
1253 # to control compilation "bitness" by setting $OBJECT_MODE environment
1254 # variable, then you should know that in OpenSSL case it's considered
1255 # only in ./config. Once configured, build procedure remains "deaf" to
1256 # current value of $OBJECT_MODE.
5e1b2353 1257 "aix-gcc" => {
d2b2221a 1258 inherit_from => [ "BASE_unix", asm("ppc32_asm") ],
abe256e7
RL
1259 CC => "gcc",
1260 CFLAGS => picker(debug => "-O0 -g",
1261 release => "-O"),
1262 cflags => add(threads("-pthread")),
68b8bcf4 1263 lib_cppflags => "-DB_ENDIAN",
fcd2ac80 1264 ex_libs => add(threads("-pthread")),
5e1b2353
RL
1265 sys_id => "AIX",
1266 bn_ops => "BN_LLONG RC4_CHAR",
9c62a279 1267 thread_scheme => "pthreads",
5e1b2353
RL
1268 perlasm_scheme => "aix32",
1269 dso_scheme => "dlfcn",
1270 shared_target => "aix-shared",
f780eaad 1271 shared_ldflag => "-shared -static-libgcc -Wl,-G",
d4453024 1272 shared_extension => ".so.\$(SHLIB_VERSION_NUMBER)",
6475b649 1273 arflags => "-X32 r",
5e1b2353
RL
1274 },
1275 "aix64-gcc" => {
d2b2221a 1276 inherit_from => [ "BASE_unix", asm("ppc64_asm") ],
abe256e7
RL
1277 CC => "gcc",
1278 CFLAGS => picker(debug => "-O0 -g",
1279 release => "-O"),
1280 cflags => combine("-maix64", threads("-pthread")),
68b8bcf4 1281 lib_cppflags => "-DB_ENDIAN",
fcd2ac80 1282 ex_libs => add(threads("-pthread")),
5e1b2353
RL
1283 sys_id => "AIX",
1284 bn_ops => "SIXTY_FOUR_BIT_LONG RC4_CHAR",
9c62a279 1285 thread_scheme => "pthreads",
5e1b2353
RL
1286 perlasm_scheme => "aix64",
1287 dso_scheme => "dlfcn",
1288 shared_target => "aix-shared",
8dd0ff1c 1289 shared_ldflag => "-shared -static-libgcc -Wl,-G",
d4453024 1290 shared_extension => ".so.\$(SHLIB_VERSION_NUMBER)",
6475b649 1291 arflags => "-X64 r",
5e1b2353 1292 },
5e1b2353 1293 "aix-cc" => {
d2b2221a 1294 inherit_from => [ "BASE_unix", asm("ppc32_asm") ],
abe256e7
RL
1295 CC => "cc",
1296 CFLAGS => picker(debug => "-O0 -g",
1297 release => "-O"),
1298 cflags => combine("-q32 -qmaxmem=16384 -qro -qroconst",
8c3bc594 1299 threads("-qthreaded")),
68b8bcf4
RL
1300 cppflags => threads("-D_THREAD_SAFE"),
1301 lib_cppflags => "-DB_ENDIAN",
5e1b2353
RL
1302 sys_id => "AIX",
1303 bn_ops => "BN_LLONG RC4_CHAR",
9c62a279 1304 thread_scheme => "pthreads",
f780eaad 1305 ex_libs => threads("-lpthreads"),
5e1b2353
RL
1306 perlasm_scheme => "aix32",
1307 dso_scheme => "dlfcn",
1308 shared_target => "aix-shared",
8dd0ff1c 1309 shared_ldflag => "-G",
d4453024 1310 shared_extension => ".so.\$(SHLIB_VERSION_NUMBER)",
6475b649 1311 arflags => "-X32 r",
5e1b2353
RL
1312 },
1313 "aix64-cc" => {
d2b2221a 1314 inherit_from => [ "BASE_unix", asm("ppc64_asm") ],
abe256e7
RL
1315 CC => "cc",
1316 CFLAGS => picker(debug => "-O0 -g",
1317 release => "-O"),
1318 cflags => combine("-q64 -qmaxmem=16384 -qro -qroconst",
8c3bc594 1319 threads("-qthreaded")),
68b8bcf4
RL
1320 cppflags => threads("-D_THREAD_SAFE"),
1321 lib_cppflags => "-DB_ENDIAN",
5e1b2353
RL
1322 sys_id => "AIX",
1323 bn_ops => "SIXTY_FOUR_BIT_LONG RC4_CHAR",
9c62a279 1324 thread_scheme => "pthreads",
f780eaad 1325 ex_libs => threads("-lpthreads"),
5e1b2353
RL
1326 perlasm_scheme => "aix64",
1327 dso_scheme => "dlfcn",
1328 shared_target => "aix-shared",
8dd0ff1c 1329 shared_ldflag => "-G",
d4453024 1330 shared_extension => ".so.\$(SHLIB_VERSION_NUMBER)",
6475b649 1331 arflags => "-X64 r",
5e1b2353 1332 },
f09e7ca9
RS
1333
1334# SIEMENS BS2000/OSD: an EBCDIC-based mainframe
5e1b2353 1335 "BS2000-OSD" => {
d2b2221a 1336 inherit_from => [ "BASE_unix" ],
abe256e7
RL
1337 CC => "c89",
1338 CFLAGS => "-O",
1339 cflags => "-XLLML -XLLMK -XL",
68b8bcf4
RL
1340 cppflags => "-DCHARSET_EBCDIC",
1341 lib_cppflags => "-DB_ENDIAN",
98fdbce0 1342 ex_libs => add("-lsocket -lnsl"),
3e9e810f 1343 bn_ops => "THIRTY_TWO_BIT RC4_CHAR",
9c62a279 1344 thread_scheme => "(unknown)",
5e1b2353 1345 },
f09e7ca9 1346
7ead0c89 1347#### Visual C targets
f09e7ca9
RS
1348#
1349# Win64 targets, WIN64I denotes IA-64 and WIN64A - AMD64
1350#
1351# Note about -wd4090, disable warning C4090. This warning returns false
1352# positives in some situations. Disabling it altogether masks both
1353# legitimate and false cases, but as we compile on multiple platforms,
1354# we rely on other compilers to catch legitimate cases.
2fe73036
RL
1355#
1356# Also note that we force threads no matter what. Configuring "no-threads"
1357# is ignored.
7ead0c89 1358 "VC-common" => {
d2b2221a 1359 inherit_from => [ "BASE_Windows" ],
7ead0c89 1360 template => 1,
abe256e7
RL
1361 CC => "cl",
1362 CPP => '$(CC) /EP /C',
1363 CFLAGS => "-W3 -wd4090 -nologo",
1364 LDFLAGS => add("/debug"),
1365 coutflag => "/Fo",
1366 cflags => '-Gs0 -GF -Gy',
8c3bc594 1367 defines => add("OPENSSL_SYS_WIN32", "WIN32_LEAN_AND_MEAN",
68b8bcf4
RL
1368 "_CRT_SECURE_NO_DEPRECATE",
1369 "_WINSOCK_DEPRECATED_NO_WARNINGS"),
1370 lib_cflags => add("/Zi /Fdossl_static"),
1371 lib_defines => add([ "L_ENDIAN" ],
8c3bc594 1372 sub { my @defs = ();
5a5c0b95 1373 unless ($disabled{"zlib-dynamic"}) {
111b234c
RL
1374 my $zlib =
1375 $withargs{zlib_lib} // "ZLIB1";
5a5c0b95
RL
1376 push @defs,
1377 quotify("perl",
111b234c 1378 'LIBZ="' . $zlib . '"');
5a5c0b95
RL
1379 }
1380 return [ @defs ];
8c3bc594 1381 }),
3ec8a1cf 1382 dso_cflags => "/Zi /Fddso",
2fe73036 1383 bin_cflags => "/Zi /Fdapp",
2fe73036 1384 shared_ldflag => "/dll",
e9abfc3a 1385 shared_target => "win-shared", # meaningless except it gives Configure a hint
2fe73036 1386 thread_scheme => "winthreads",
5e1b2353 1387 dso_scheme => "win32",
4e155ec4 1388 apps_aux_src => add("win32_init.c"),
5e1b2353 1389 },
2fe73036 1390 "VC-noCE-common" => {
acf15259 1391 inherit_from => [ "VC-common" ],
be1f4812 1392 template => 1,
abe256e7
RL
1393 CFLAGS => add(picker(debug => '/Od',
1394 release => '/O2')),
8c3bc594 1395 cflags => add(picker(debug =>
2fe73036 1396 sub {
abe256e7 1397 ($disabled{shared} ? "" : "/MDd");
2fe73036
RL
1398 },
1399 release =>
1400 sub {
abe256e7 1401 ($disabled{shared} ? "" : "/MD");
2fe73036 1402 })),
8c3bc594
RL
1403 defines => add(picker(default => [ "UNICODE", "_UNICODE" ],
1404 debug => [ "DEBUG", "_DEBUG" ])),
c32cbe97
AP
1405 lib_cflags => add(sub { $disabled{shared} ? "/MT /Zl" : () }),
1406 # Following might/should appears controversial, i.e. defining
1407 # /MDd without evaluating $disabled{shared}. It works in
1408 # non-shared build because static library is compiled with /Zl
1409 # and bares no reference to specific RTL. And it works in
1410 # shared build because multiple /MDd options are not prohibited.
1411 # But why /MDd in static build? Well, basically this is just a
1412 # reference point, which allows to catch eventual errors that
1413 # would prevent those who want to wrap OpenSSL into own .DLL.
1414 # Why not /MD in release build then? Well, some are likely to
1415 # prefer [non-debug] openssl.exe to be free from Micorosoft RTL
1416 # redistributable.
1417 bin_cflags => add(picker(debug => "/MDd",
1418 release => sub { $disabled{shared} ? "/MT" : () },
1419 )),
2fe73036 1420 bin_lflags => add("/subsystem:console /opt:ref"),
ef5b8296 1421 ex_libs => add(sub {
2fe73036
RL
1422 my @ex_libs = ();
1423 push @ex_libs, 'ws2_32.lib' unless $disabled{sock};
1424 push @ex_libs, 'gdi32.lib advapi32.lib crypt32.lib user32.lib';
1425 return join(" ", @ex_libs);
ef5b8296 1426 }),
2fe73036
RL
1427 },
1428 "VC-WIN64-common" => {
1429 inherit_from => [ "VC-noCE-common" ],
be1f4812 1430 template => 1,
ef5b8296 1431 ex_libs => add(sub {
2fe73036
RL
1432 my @ex_libs = ();
1433 push @ex_libs, 'bufferoverflowu.lib' if (`cl 2>&1` =~ /14\.00\.4[0-9]{4}\./);
1434 return join(" ", @_, @ex_libs);
ef5b8296 1435 }),
2fe73036
RL
1436 bn_ops => "SIXTY_FOUR_BIT EXPORT_VAR_AS_FN",
1437 build_scheme => add("VC-W64", { separator => undef }),
1438 },
7ead0c89 1439 "VC-WIN64I" => {
acf15259
AP
1440 inherit_from => [ "VC-WIN64-common", asm("ia64_asm"),
1441 sub { $disabled{shared} ? () : "ia64_uplink" } ],
abe256e7
RL
1442 AS => "ias",
1443 ASFLAGS => "-d debug",
2fe73036 1444 asoutflag => "-o",
5e1b2353 1445 sys_id => "WIN64I",
6ddb62a5
AP
1446 bn_asm_src => sub { return undef unless @_;
1447 my $r=join(" ",@_); $r=~s|bn-ia64.s|bn_asm.c|; $r; },
5e1b2353 1448 perlasm_scheme => "ias",
6ddb62a5 1449 multilib => "-ia64",
5e1b2353
RL
1450 },
1451 "VC-WIN64A" => {
acf15259
AP
1452 inherit_from => [ "VC-WIN64-common", asm("x86_64_asm"),
1453 sub { $disabled{shared} ? () : "x86_64_uplink" } ],
abe256e7
RL
1454 AS => sub { vc_win64a_info()->{AS} },
1455 ASFLAGS => sub { vc_win64a_info()->{ASFLAGS} },
2fe73036 1456 asoutflag => sub { vc_win64a_info()->{asoutflag} },
abe256e7 1457 asflags => sub { vc_win64a_info()->{asflags} },
5e1b2353 1458 sys_id => "WIN64A",
2fe73036
RL
1459 bn_asm_src => sub { return undef unless @_;
1460 my $r=join(" ",@_); $r=~s|asm/x86_64-gcc|bn_asm|; $r; },
5e1b2353 1461 perlasm_scheme => "auto",
6ddb62a5 1462 multilib => "-x64",
5e1b2353 1463 },
5e1b2353 1464 "VC-WIN32" => {
c059564a
AP
1465 # x86 Win32 target used to default to ANSI API, but not anymore,
1466 # UNICODE is the only option. The original reason for providing
1467 # UNICODE as opt-in option was because ANSI API was *native*
1468 # system interface for [no longer supported] Windows 9x.
acf15259 1469 inherit_from => [ "VC-noCE-common", asm("x86_asm"),
fdf6f73e 1470 sub { $disabled{shared} ? () : "uplink_common" } ],
abe256e7
RL
1471 CFLAGS => add("-WX"),
1472 AS => sub { vc_win32_info()->{AS} },
1473 ASFLAGS => sub { vc_win32_info()->{ASFLAGS} },
43800958 1474 asoutflag => sub { vc_win32_info()->{asoutflag} },
abe256e7 1475 asflags => sub { vc_win32_info()->{asflags} },
ef5b8296 1476 ex_libs => add(sub {
2fe73036
RL
1477 my @ex_libs = ();
1478 # WIN32 UNICODE build gets linked with unicows.lib for
1479 # backward compatibility with Win9x.
1480 push @ex_libs, 'unicows.lib'
5b18235a 1481 if (grep { $_ eq "UNICODE" } @{$user{CPPDEFINES}});
2fe73036 1482 return join(" ", @ex_libs, @_);
ef5b8296 1483 }),
5e1b2353 1484 sys_id => "WIN32",
a01dab94 1485 bn_ops => "BN_LLONG EXPORT_VAR_AS_FN",
f0d484fc 1486 perlasm_scheme => sub { vc_win32_info()->{perlasm_scheme} },
d2b2221a 1487 build_scheme => add("VC-W32", { separator => undef }),
5e1b2353 1488 },
5e1b2353 1489 "VC-CE" => {
2fe73036 1490 inherit_from => [ "VC-common" ],
abe256e7
RL
1491 AS => "ml",
1492 ASFLAGS => "/nologo",
2fe73036 1493 asoutflag => "/Fo",
abe256e7
RL
1494 asflags => "/Cp /coff /c /Cx /Zi",
1495 CC => "cl",
1496 CFLAGS => picker(default => '/W3 /WX /nologo',
1497 debug => "/Od",
1498 release => "/O1i"),
1499 CPPDEFINES => picker(debug => [ "DEBUG", "_DEBUG" ]),
1500 LDFLAGS => add("/nologo /opt:ref"),
2fe73036 1501 cflags =>
abe256e7
RL
1502 combine('/GF /Gy',
1503 sub { vc_wince_info()->{cflags}; },
1504 sub { `cl 2>&1` =~ /Version ([0-9]+)\./ && $1>=14
1505 ? ($disabled{shared} ? " /MT" : " /MD")
1506 : " /MC"; }),
e548c1fe 1507 cppflags => sub { vc_wince_info()->{cppflags}; },
68b8bcf4
RL
1508 defines => [ "WIN32_LEAN_AND_MEAN" ],
1509 lib_defines => [ "L_ENDIAN", "DSO_WIN32", "NO_CHMOD",
1510 "OPENSSL_SMALL_FOOTPRINT" ],
1511 lib_cppflags => sub { vc_wince_info()->{cppflags}; },
8c3bc594 1512 includes =>
368297d1
RL
1513 add(combine(sub { defined(env('WCECOMPAT'))
1514 ? '$(WCECOMPAT)/include' : (); },
1515 sub { defined(env('PORTSDK_LIBPATH'))
1516 ? '$(PORTSDK_LIBPATH)/../../include'
1517 : (); })),
abe256e7 1518 lflags => add(combine(sub { vc_wince_info()->{lflags}; },
47eeaf45
RL
1519 sub { defined(env('PORTSDK_LIBPATH'))
1520 ? "/entry:mainCRTstartup" : (); })),
5e1b2353 1521 sys_id => "WINCE",
a01dab94 1522 bn_ops => "BN_LLONG EXPORT_VAR_AS_FN",
ef5b8296 1523 ex_libs => add(sub {
2fe73036
RL
1524 my @ex_libs = ();
1525 push @ex_libs, 'ws2.lib' unless $disabled{sock};
1526 push @ex_libs, 'crypt32.lib';
17f16617 1527 if (defined(env('WCECOMPAT'))) {
2fe73036 1528 my $x = '$(WCECOMPAT)/lib';
17f16617 1529 if (-f "$x/env('TARGETCPU')/wcecompatex.lib") {
2fe73036
RL
1530 $x .= '/$(TARGETCPU)/wcecompatex.lib';
1531 } else {
1532 $x .= '/wcecompatex.lib';
1533 }
1534 push @ex_libs, $x;
1535 }
1536 push @ex_libs, '$(PORTSDK_LIBPATH)/portlib.lib'
17f16617 1537 if (defined(env('PORTSDK_LIBPATH')));
2fe73036 1538 push @ex_libs, ' /nodefaultlib coredll.lib corelibc.lib'
17f16617 1539 if (env('TARGETCPU') eq "X86");
2fe73036 1540 return @ex_libs;
ef5b8296 1541 }),
d2b2221a 1542 build_scheme => add("VC-WCE", { separator => undef }),
5e1b2353 1543 },
f09e7ca9 1544
7ead0c89 1545#### MinGW
5e1b2353 1546 "mingw" => {
d2b2221a 1547 inherit_from => [ "BASE_unix", asm("x86_asm"),
84af1bae 1548 sub { $disabled{shared} ? () : "x86_uplink" } ],
abe256e7
RL
1549 CC => "gcc",
1550 CFLAGS => picker(default => "-Wall",
8c3bc594
RL
1551 debug => "-g -O0",
1552 release => "-O3 -fomit-frame-pointer"),
abe256e7 1553 cflags => "-m32",
68b8bcf4 1554 cppflags => combine("-DUNICODE -D_UNICODE -DWIN32_LEAN_AND_MEAN",
abe256e7 1555 threads("-D_MT")),
68b8bcf4 1556 lib_cppflags => "-DL_ENDIAN",
5e1b2353 1557 sys_id => "MINGW32",
98fdbce0 1558 ex_libs => add("-lws2_32 -lgdi32 -lcrypt32"),
a01dab94 1559 bn_ops => "BN_LLONG EXPORT_VAR_AS_FN",
9c62a279 1560 thread_scheme => "winthreads",
5e1b2353
RL
1561 perlasm_scheme => "coff",
1562 dso_scheme => "win32",
520f434b 1563 shared_target => "mingw-shared",
8c3bc594 1564 shared_cppflags => add("_WINDLL"),
68ab559a 1565 shared_ldflag => "-static-libgcc",
64c443e3 1566 shared_rcflag => "--target=pe-i386",
fcf80c46 1567 shared_extension => ".dll",
520f434b 1568 multilib => "",
4e155ec4 1569 apps_aux_src => add("win32_init.c"),
5e1b2353 1570 },
5e1b2353 1571 "mingw64" => {
7ead0c89
AP
1572 # As for OPENSSL_USE_APPLINK. Applink makes it possible to use
1573 # .dll compiled with one compiler with application compiled with
1574 # another compiler. It's possible to engage Applink support in
1575 # mingw64 build, but it's not done, because till mingw64
1576 # supports structured exception handling, one can't seriously
1577 # consider its binaries for using with non-mingw64 run-time
1578 # environment. And as mingw64 is always consistent with itself,
1579 # Applink is never engaged and can as well be omitted.
d2b2221a 1580 inherit_from => [ "BASE_unix", asm("x86_64_asm") ],
abe256e7
RL
1581 CC => "gcc",
1582 CFLAGS => picker(default => "-Wall",
8c3bc594
RL
1583 debug => "-g -O0",
1584 release => "-O3"),
abe256e7 1585 cflags => "-m64",
68b8bcf4 1586 cppflags => combine("-DUNICODE -D_UNICODE -DWIN32_LEAN_AND_MEAN",
abe256e7 1587 threads("-D_MT")),
68b8bcf4 1588 lib_cppflags => "-DL_ENDIAN",
5e1b2353 1589 sys_id => "MINGW64",
98fdbce0 1590 ex_libs => add("-lws2_32 -lgdi32 -lcrypt32"),
3e9e810f 1591 bn_ops => "SIXTY_FOUR_BIT EXPORT_VAR_AS_FN",
9c62a279 1592 thread_scheme => "winthreads",
5e1b2353
RL
1593 perlasm_scheme => "mingw64",
1594 dso_scheme => "win32",
520f434b 1595 shared_target => "mingw-shared",
8c3bc594 1596 shared_cppflags => add("_WINDLL"),
68ab559a 1597 shared_ldflag => "-static-libgcc",
64c443e3 1598 shared_rcflag => "--target=pe-x86-64",
fcf80c46 1599 shared_extension => ".dll",
520f434b 1600 multilib => "64",
4e155ec4 1601 apps_aux_src => add("win32_init.c"),
5e1b2353 1602 },
f09e7ca9 1603
4d60c7e1
DW
1604#### UEFI
1605 "UEFI" => {
d2b2221a 1606 inherit_from => [ "BASE_unix" ],
abe256e7
RL
1607 CC => "cc",
1608 CFLAGS => "-O",
68b8bcf4 1609 lib_cppflags => "-DL_ENDIAN",
4d60c7e1
DW
1610 sys_id => "UEFI",
1611 },
1612
7ead0c89 1613#### UWIN
5e1b2353 1614 "UWIN" => {
d2b2221a 1615 inherit_from => [ "BASE_unix" ],
abe256e7
RL
1616 CC => "cc",
1617 CFLAGS => "-O -Wall",
1618 lib_cppflags => "-DTERMIOS -DL_ENDIAN",
5e1b2353 1619 sys_id => "UWIN",
a01dab94 1620 bn_ops => "BN_LLONG",
5e1b2353
RL
1621 dso_scheme => "win32",
1622 },
f09e7ca9 1623
7ead0c89 1624#### Cygwin
3f542969 1625 "Cygwin-x86" => {
d2b2221a 1626 inherit_from => [ "BASE_unix", asm("x86_asm") ],
abe256e7
RL
1627 CC => "gcc",
1628 CFLAGS => picker(default => "-Wall",
8864f0de
RL
1629 debug => "-g -O0",
1630 release => "-O3 -fomit-frame-pointer"),
68b8bcf4 1631 lib_cppflags => "-DTERMIOS -DL_ENDIAN",
5e1b2353 1632 sys_id => "CYGWIN",
a01dab94 1633 bn_ops => "BN_LLONG",
e58d9102 1634 thread_scheme => "pthread",
5e1b2353
RL
1635 perlasm_scheme => "coff",
1636 dso_scheme => "dlfcn",
1637 shared_target => "cygwin-shared",
8c3bc594 1638 shared_cppflags => "-D_WINDLL",
fcf80c46 1639 shared_extension => ".dll",
5e1b2353
RL
1640 },
1641 "Cygwin-x86_64" => {
d2b2221a 1642 inherit_from => [ "BASE_unix", asm("x86_64_asm") ],
abe256e7
RL
1643 CC => "gcc",
1644 CFLAGS => picker(default => "-Wall",
8864f0de
RL
1645 debug => "-g -O0",
1646 release => "-O3"),
68b8bcf4 1647 lib_cppflags => "-DTERMIOS -DL_ENDIAN",
5e1b2353 1648 sys_id => "CYGWIN",
3e9e810f 1649 bn_ops => "SIXTY_FOUR_BIT_LONG",
e58d9102 1650 thread_scheme => "pthread",
5e1b2353
RL
1651 perlasm_scheme => "mingw64",
1652 dso_scheme => "dlfcn",
1653 shared_target => "cygwin-shared",
8c3bc594 1654 shared_cppflags => "-D_WINDLL",
fcf80c46 1655 shared_extension => ".dll",
5e1b2353 1656 },
b9ee2dac
RL
1657 # Backward compatibility for those using this target
1658 "Cygwin" => {
1659 inherit_from => [ "Cygwin-x86" ]
1660 },
1661 # In case someone constructs the Cygwin target name themself
1662 "Cygwin-i386" => {
1663 inherit_from => [ "Cygwin-x86" ]
1664 },
1665 "Cygwin-i486" => {
1666 inherit_from => [ "Cygwin-x86" ]
1667 },
1668 "Cygwin-i586" => {
1669 inherit_from => [ "Cygwin-x86" ]
1670 },
1671 "Cygwin-i686" => {
1672 inherit_from => [ "Cygwin-x86" ]
1673 },
f09e7ca9 1674
f09e7ca9 1675##### MacOS X (a.k.a. Darwin) setup
7ead0c89 1676 "darwin-common" => {
d2b2221a 1677 inherit_from => [ "BASE_unix" ],
7ead0c89 1678 template => 1,
abe256e7
RL
1679 CC => "cc",
1680 CFLAGS => picker(debug => "-g -O0",
8c3bc594
RL
1681 release => "-O3"),
1682 cppflags => threads("-D_REENTRANT"),
abe256e7 1683 lflags => "-Wl,-search_paths_first",
5e1b2353 1684 sys_id => "MACOSX",
3e9e810f 1685 bn_ops => "BN_LLONG RC4_CHAR",
9c62a279 1686 thread_scheme => "pthreads",
5e1b2353
RL
1687 perlasm_scheme => "osx32",
1688 dso_scheme => "dlfcn",
0c873419 1689 ranlib => "ranlib -c",
5e1b2353 1690 shared_target => "darwin-shared",
0c873419 1691 shared_cflag => "-fPIC",
d4453024 1692 shared_extension => ".\$(SHLIB_VERSION_NUMBER).dylib",
5e1b2353 1693 },
c75065e1
AP
1694 # Option "freeze" such as -std=gnu9x can't negatively interfere
1695 # with future defaults for below two targets, because MacOS X
1696 # for PPC has no future, it was discontinued by vendor in 2009.
7ead0c89
AP
1697 "darwin-ppc-cc" => {
1698 inherit_from => [ "darwin-common", asm("ppc32_asm") ],
8c3bc594 1699 cflags => add("-arch ppc -std=gnu9x -Wa,-force_cpusubtype_ALL"),
68b8bcf4 1700 lib_cppflags => add("-DB_ENDIAN"),
107783d9 1701 shared_cflag => add("-fno-common"),
7ead0c89 1702 perlasm_scheme => "osx32",
7ead0c89 1703 },
5e1b2353 1704 "darwin64-ppc-cc" => {
7ead0c89 1705 inherit_from => [ "darwin-common", asm("ppc64_asm") ],
8c3bc594 1706 cflags => add("-arch ppc64 -std=gnu9x"),
68b8bcf4 1707 lib_cppflags => add("-DB_ENDIAN"),
3e9e810f 1708 bn_ops => "SIXTY_FOUR_BIT_LONG RC4_CHAR",
5e1b2353 1709 perlasm_scheme => "osx64",
5e1b2353
RL
1710 },
1711 "darwin-i386-cc" => {
7ead0c89 1712 inherit_from => [ "darwin-common", asm("x86_asm") ],
abe256e7
RL
1713 CFLAGS => add(picker(release => "-fomit-frame-pointer")),
1714 cflags => add("-arch i386"),
68b8bcf4 1715 lib_cppflags => add("-DL_ENDIAN"),
3e9e810f 1716 bn_ops => "BN_LLONG RC4_INT",
5e1b2353 1717 perlasm_scheme => "macosx",
5e1b2353
RL
1718 },
1719 "darwin64-x86_64-cc" => {
7ead0c89 1720 inherit_from => [ "darwin-common", asm("x86_64_asm") ],
abe256e7
RL
1721 CFLAGS => add("-Wall"),
1722 cflags => add("-arch x86_64"),
68b8bcf4 1723 lib_cppflags => add("-DL_ENDIAN"),
3e9e810f 1724 bn_ops => "SIXTY_FOUR_BIT_LONG",
5e1b2353 1725 perlasm_scheme => "macosx",
5e1b2353 1726 },
7ead0c89
AP
1727
1728#### iPhoneOS/iOS
f09e7ca9
RS
1729#
1730# It takes three prior-set environment variables to make it work:
1731#
1732# CROSS_COMPILE=/where/toolchain/is/usr/bin/ [note ending slash]
1733# CROSS_TOP=/where/SDKs/are
1734# CROSS_SDK=iPhoneOSx.y.sdk
1735#
1736# Exact paths vary with Xcode releases, but for couple of last ones
1737# they would look like this:
1738#
1739# CROSS_COMPILE=`xcode-select --print-path`/Toolchains/XcodeDefault.xctoolchain/usr/bin/
1740# CROSS_TOP=`xcode-select --print-path`/Platforms/iPhoneOS.platform/Developer
7ead0c89 1741# CROSS_SDK=iPhoneOS.sdk
f09e7ca9 1742#
5e1b2353 1743 "iphoneos-cross" => {
7ead0c89 1744 inherit_from => [ "darwin-common" ],
8864f0de 1745 cflags => add("-isysroot \$(CROSS_TOP)/SDKs/\$(CROSS_SDK) -fno-common"),
5e1b2353 1746 sys_id => "iOS",
5e1b2353 1747 },
313e6ec1
AP
1748 "ios-cross" => {
1749 inherit_from => [ "darwin-common", asm("armv4_asm") ],
1750 # It should be possible to go below iOS 6 and even add -arch armv6,
1751 # thus targeting iPhone pre-3GS, but it's assumed to be irrelevant
d11582f1 1752 # at this point.
8864f0de 1753 cflags => add("-arch armv7 -mios-version-min=6.0.0 -isysroot \$(CROSS_TOP)/SDKs/\$(CROSS_SDK) -fno-common"),
313e6ec1
AP
1754 sys_id => "iOS",
1755 perlasm_scheme => "ios32",
1756 },
5e1b2353 1757 "ios64-cross" => {
7ead0c89 1758 inherit_from => [ "darwin-common", asm("aarch64_asm") ],
8864f0de 1759 cflags => add("-arch arm64 -mios-version-min=7.0.0 -isysroot \$(CROSS_TOP)/SDKs/\$(CROSS_SDK) -fno-common"),
5e1b2353 1760 sys_id => "iOS",
3e9e810f 1761 bn_ops => "SIXTY_FOUR_BIT_LONG RC4_CHAR",
5e1b2353 1762 perlasm_scheme => "ios64",
5e1b2353 1763 },
f09e7ca9
RS
1764
1765##### GNU Hurd
5e1b2353 1766 "hurd-x86" => {
d2b2221a 1767 inherit_from => [ "BASE_unix" ],
7ead0c89 1768 inherit_from => [ asm("x86_elf_asm") ],
abe256e7
RL
1769 CC => "gcc",
1770 CFLAGS => "-O3 -fomit-frame-pointer -Wall",
1771 cflags => threads("-pthread"),
68b8bcf4 1772 lib_cppflags => "-DL_ENDIAN",
fcd2ac80 1773 ex_libs => add("-ldl", threads("-pthread")),
a01dab94 1774 bn_ops => "BN_LLONG",
9c62a279 1775 thread_scheme => "pthreads",
5e1b2353
RL
1776 dso_scheme => "dlfcn",
1777 shared_target => "linux-shared",
1778 shared_cflag => "-fPIC",
d4453024 1779 shared_extension => ".so.\$(SHLIB_VERSION_NUMBER)",
5e1b2353 1780 },
f09e7ca9 1781
f09e7ca9 1782##### VxWorks for various targets
5e1b2353 1783 "vxworks-ppc60x" => {
d2b2221a 1784 inherit_from => [ "BASE_unix" ],
abe256e7
RL
1785 CC => "ccppc",
1786 CFLAGS => "-O2 -Wall -fstrength-reduce",
1787 cflags => "-mrtp -mhard-float -mstrict-align -fno-implicit-fp -fno-builtin -fno-strict-aliasing",
8c3bc594
RL
1788 cppflags => combine("-D_REENTRANT -DPPC32_fp60x -DCPU=PPC32",
1789 "_DTOOL_FAMILY=gnu -DTOOL=gnu",
1790 "-I\$(WIND_BASE)/target/usr/h",
1791 "-I\$(WIND_BASE)/target/usr/h/wrn/coreip"),
5e1b2353 1792 sys_id => "VXWORKS",
47eeaf45
RL
1793 lflags => add("-L \$(WIND_BASE)/target/usr/lib/ppc/PPC32/common"),
1794 ex_libs => add("-Wl,--defsym,__wrs_rtp_base=0xe0000000"),
5e1b2353
RL
1795 },
1796 "vxworks-ppcgen" => {
d2b2221a 1797 inherit_from => [ "BASE_unix" ],
abe256e7
RL
1798 CC => "ccppc",
1799 CFLAGS => "-O1 -Wall",
1800 cflags => "-mrtp -msoft-float -mstrict-align -fno-builtin -fno-strict-aliasing",
8c3bc594
RL
1801 cppflags => combine("-D_REENTRANT -DPPC32 -DCPU=PPC32",
1802 "-DTOOL_FAMILY=gnu -DTOOL=gnu",
1803 "-I\$(WIND_BASE)/target/usr/h",
1804 "-I\$(WIND_BASE)/target/usr/h/wrn/coreip"),
5e1b2353 1805 sys_id => "VXWORKS",
47eeaf45
RL
1806 lflags => add("-L \$(WIND_BASE)/target/usr/lib/ppc/PPC32/sfcommon"),
1807 ex_libs => add("-Wl,--defsym,__wrs_rtp_base=0xe0000000"),
5e1b2353
RL
1808 },
1809 "vxworks-ppc405" => {
d2b2221a 1810 inherit_from => [ "BASE_unix" ],
abe256e7
RL
1811 CC => "ccppc",
1812 CFLAGS => "-g",
1813 cflags => "-msoft-float -mlongcall",
8c3bc594
RL
1814 cppflags => combine("-D_REENTRANT -DPPC32 -DCPU=PPC405",
1815 "-DTOOL_FAMILY=gnu -DTOOL=gnu",
1816 "-I\$(WIND_BASE)/target/h"),
5e1b2353 1817 sys_id => "VXWORKS",
47eeaf45 1818 lflags => add("-r"),
5e1b2353
RL
1819 },
1820 "vxworks-ppc750" => {
d2b2221a 1821 inherit_from => [ "BASE_unix" ],
abe256e7
RL
1822 CC => "ccppc",
1823 CFLAGS => "-ansi -fvolatile -Wall \$(DEBUG_FLAG)",
1824 cflags => "-nostdinc -fno-builtin -fno-for-scope -fsigned-char -msoft-float -mlongcall",
8c3bc594
RL
1825 cppflags => combine("-DPPC750 -D_REENTRANT -DCPU=PPC604",
1826 "-I\$(WIND_BASE)/target/h"),
5e1b2353 1827 sys_id => "VXWORKS",
47eeaf45 1828 lflags => add("-r"),
5e1b2353
RL
1829 },
1830 "vxworks-ppc750-debug" => {
d2b2221a 1831 inherit_from => [ "BASE_unix" ],
abe256e7
RL
1832 CC => "ccppc",
1833 CFLAGS => "-ansi -fvolatile -Wall -g",
1834 cflags => "-nostdinc -fno-builtin -fno-for-scope -fsigned-char -msoft-float -mlongcall",
8c3bc594
RL
1835 cppflags => combine("-DPPC750 -D_REENTRANT -DCPU=PPC604",
1836 "-DPEDANTIC -DDEBUG",
1837 "-I\$(WIND_BASE)/target/h"),
5e1b2353 1838 sys_id => "VXWORKS",
47eeaf45 1839 lflags => add("-r"),
5e1b2353
RL
1840 },
1841 "vxworks-ppc860" => {
d2b2221a 1842 inherit_from => [ "BASE_unix" ],
abe256e7 1843 CC => "ccppc",
8c3bc594
RL
1844 cflags => "-nostdinc -msoft-float",
1845 cppflags => combine("-DCPU=PPC860 -DNO_STRINGS_H",
1846 "-I\$(WIND_BASE)/target/h"),
5e1b2353 1847 sys_id => "VXWORKS",
47eeaf45 1848 lflags => add("-r"),
5e1b2353
RL
1849 },
1850 "vxworks-simlinux" => {
d2b2221a 1851 inherit_from => [ "BASE_unix" ],
abe256e7 1852 CC => "ccpentium",
8c3bc594
RL
1853 cflags => "-B\$(WIND_BASE)/host/\$(WIND_HOST_TYPE)/lib/gcc-lib/ -fno-builtin -fno-defer-pop",
1854 cppflags => combine("-D_VSB_CONFIG_FILE=\"\$(WIND_BASE)/target/lib/h/config/vsbConfig.h\"",
1855 "-DL_ENDIAN -DCPU=SIMLINUX -DNO_STRINGS_H",
1856 "-DTOOL_FAMILY=gnu -DTOOL=gnu",
1857 "-DOPENSSL_NO_HW_PADLOCK",
1858 "-I\$(WIND_BASE)/target/h",
1859 "-I\$(WIND_BASE)/target/h/wrn/coreip"),
5e1b2353 1860 sys_id => "VXWORKS",
47eeaf45 1861 lflags => add("-r"),
5e1b2353
RL
1862 ranlib => "ranlibpentium",
1863 },
1864 "vxworks-mips" => {
d2b2221a 1865 inherit_from => [ "BASE_unix", asm("mips32_asm") ],
abe256e7
RL
1866 CC => "ccmips",
1867 CFLAGS => "-O -G 0",
1868 cflags => "-mrtp -mips2 -B\$(WIND_BASE)/host/\$(WIND_HOST_TYPE)/lib/gcc-lib/ -msoft-float -mno-branch-likely -fno-builtin -fno-defer-pop",
8c3bc594
RL
1869 cppflags => combine("-D_VSB_CONFIG_FILE=\"\$(WIND_BASE)/target/lib/h/config/vsbConfig.h\"",
1870 "-DCPU=MIPS32 -DNO_STRINGS_H",
1871 "-DTOOL_FAMILY=gnu -DTOOL=gnu",
1872 "-DOPENSSL_NO_HW_PADLOCK",
1873 threads("-D_REENTRANT"),
1874 "-I\$(WIND_BASE)/target/h",
1875 "-I\$(WIND_BASE)/target/h/wrn/coreip"),
5e1b2353 1876 sys_id => "VXWORKS",
47eeaf45
RL
1877 lflags => add("-L \$(WIND_BASE)/target/usr/lib/mips/MIPSI32/sfcommon"),
1878 ex_libs => add("-Wl,--defsym,__wrs_rtp_base=0xe0000000"),
9c62a279 1879 thread_scheme => "pthreads",
5e1b2353
RL
1880 perlasm_scheme => "o32",
1881 ranlib => "ranlibmips",
1882 },
f09e7ca9 1883
7ead0c89 1884#### uClinux
5e1b2353 1885 "uClinux-dist" => {
d2b2221a 1886 inherit_from => [ "BASE_unix" ],
abe256e7 1887 CC => sub { env('CC') },
8c3bc594 1888 cppflags => threads("-D_REENTRANT"),
98fdbce0 1889 ex_libs => add("\$(LDLIBS)"),
5e1b2353 1890 bn_ops => "BN_LLONG",
9c62a279 1891 thread_scheme => "pthreads",
17f16617 1892 dso_scheme => sub { env('LIBSSL_dlfcn') },
5e1b2353
RL
1893 shared_target => "linux-shared",
1894 shared_cflag => "-fPIC",
d4453024 1895 shared_extension => ".so.\$(SHLIB_VERSION_NUMBER)",
17f16617 1896 ranlib => sub { env('RANLIB') },
5e1b2353
RL
1897 },
1898 "uClinux-dist64" => {
d2b2221a 1899 inherit_from => [ "BASE_unix" ],
abe256e7 1900 CC => sub { env('CC') },
8c3bc594 1901 cppflags => threads("-D_REENTRANT"),
98fdbce0 1902 ex_libs => add("\$(LDLIBS)"),
5e1b2353 1903 bn_ops => "SIXTY_FOUR_BIT_LONG",
9c62a279 1904 thread_scheme => "pthreads",
17f16617 1905 dso_scheme => sub { env('LIBSSL_dlfcn') },
5e1b2353
RL
1906 shared_target => "linux-shared",
1907 shared_cflag => "-fPIC",
d4453024 1908 shared_extension => ".so.\$(SHLIB_VERSION_NUMBER)",
17f16617 1909 ranlib => sub { env('RANLIB') },
5e1b2353 1910 },
f09e7ca9 1911
e84193e4 1912 ##### VMS
ab907189
RL
1913 # Most things happen in vms-generic.
1914 # Note that vms_info extracts the pointer size from the end of
1915 # the target name, and will assume that anything matching /-p\d+$/
1916 # indicates the pointer size setting for the desired target.
e84193e4 1917 "vms-generic" => {
d2b2221a 1918 inherit_from => [ "BASE_VMS" ],
e84193e4 1919 template => 1,
abe256e7
RL
1920 CC => "CC/DECC",
1921 CPP => '$(CC)/PREPROCESS_ONLY=SYS$OUTPUT:',
1922 CFLAGS =>
ab907189
RL
1923 combine(picker(default => "/STANDARD=(ISOC94,RELAXED)/NOLIST/PREFIX=ALL",
1924 debug => "/NOOPTIMIZE/DEBUG",
1925 release => "/OPTIMIZE/NODEBUG"),
1926 sub { my @warnings =
1927 @{vms_info()->{disable_warns}};
1928 @warnings
1929 ? "/WARNINGS=DISABLE=(".join(",",@warnings).")" : (); }),
68b8bcf4 1930 lib_defines =>
ab907189
RL
1931 add("OPENSSL_USE_NODELETE",
1932 sub {
1933 return vms_info()->{def_zlib}
1934 ? "LIBZ=\"\"\"".vms_info()->{def_zlib}."\"\"\"" : ();
1935 }),
2de2df7f 1936 lflags => picker(default => "/MAP='F\$PARSE(\".MAP\",\"\$\@\")'",
1ae4c07e 1937 debug => "/DEBUG/TRACEBACK",
8864f0de 1938 release => "/NODEBUG/NOTRACEBACK"),
68a39960 1939 lib_cflags => add("/NAMES=(AS_IS,SHORTENED)/EXTERN_MODEL=STRICT_REFDEF"),
19eaee74
RL
1940 # no_inst_lib_cflags is used instead of lib_cflags by descrip.mms.tmpl
1941 # for object files belonging to selected internal libraries
1942 no_inst_lib_cflags => "",
ab907189 1943 ex_libs => add(sub { return vms_info()->{zlib} || (); }),
e84193e4 1944 shared_target => "vms-shared",
ac722c9a 1945 dso_scheme => "vms",
9c62a279 1946 thread_scheme => "pthreads",
e84193e4 1947
abe256e7
RL
1948 AS => sub { vms_info()->{AS} },
1949 ASFLAGS => sub { vms_info()->{ASFLAGS} },
ab7134ef 1950 asoutflag => sub { vms_info()->{asoutflag} },
abe256e7 1951 asflags => sub { vms_info()->{asflags} },
ab7134ef
RL
1952 perlasm_scheme => sub { vms_info()->{perlasm_scheme} },
1953
d6baf09f
RL
1954 apps_aux_src => "vms_term_sock.c",
1955 apps_init_src => "vms_decc_init.c",
e84193e4
RL
1956 },
1957
ab907189
RL
1958 # From HELP CC/POINTER_SIZE:
1959 #
1960 # ----------
1961 # LONG[=ARGV] The compiler assumes 64-bit pointers. If the ARGV option to
1962 # LONG or 64 is present, the main argument argv will be an
1963 # array of long pointers instead of an array of short pointers.
1964 #
1965 # 64[=ARGV] Same as LONG.
1966 # ----------
1967 #
1968 # We don't want the hassle of dealing with 32-bit pointers with argv, so
1969 # we force it to have 64-bit pointers, see the added cflags in the -p64
1970 # config targets below.
1971
e84193e4
RL
1972 "vms-alpha" => {
1973 inherit_from => [ "vms-generic" ],
ab907189
RL
1974 bn_ops => "SIXTY_FOUR_BIT RC4_INT",
1975 pointer_size => "",
e84193e4 1976 },
52d86d9b 1977 "vms-alpha-p32" => {
ab907189
RL
1978 inherit_from => [ "vms-alpha" ],
1979 cflags => add("/POINTER_SIZE=32"),
1980 pointer_size => "32",
e84193e4 1981 },
52d86d9b 1982 "vms-alpha-p64" => {
ab907189
RL
1983 inherit_from => [ "vms-alpha" ],
1984 cflags => add("/POINTER_SIZE=64=ARGV"),
1985 pointer_size => "64",
e84193e4
RL
1986 },
1987 "vms-ia64" => {
0f4844a9
RL
1988 inherit_from => [ "vms-generic",
1989 sub { vms_info()->{as}
1990 ? asm("ia64_asm")->() : () } ],
ab907189
RL
1991 bn_ops => "SIXTY_FOUR_BIT RC4_INT",
1992 pointer_size => "",
0f4844a9
RL
1993
1994 modes_asm_src => "", # Because ghash-ia64.s doesn't work on VMS
e84193e4 1995 },
52d86d9b 1996 "vms-ia64-p32" => {
ab907189
RL
1997 inherit_from => [ "vms-ia64" ],
1998 cflags => add("/POINTER_SIZE=32"),
1999 pointer_size => "32",
e84193e4 2000 },
52d86d9b 2001 "vms-ia64-p64" => {
ab907189
RL
2002 inherit_from => [ "vms-ia64" ],
2003 cflags => add("/POINTER_SIZE=64=ARGV"),
2004 pointer_size => "64",
e84193e4
RL
2005 },
2006
f09e7ca9 2007);