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