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