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