Debian Codegraph @

debian/rust-vendor/openssl-src/openssl/Configurations/10-main.conf

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