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