Added an explicit yield (OP_SLEEP) to QUIC testing for cooperative threading.
[openssl.git] / Configurations / 00-base-templates.conf
1 # -*- Mode: perl -*-
2 my %targets=(
3     DEFAULTS => {
4         template        => 1,
5
6         cflags          => "",
7         cppflags        => "",
8         lflags          => "",
9         defines         => [],
10         includes        => [],
11         lib_cflags      => "",
12         lib_cppflags    => "",
13         lib_defines     => [],
14         thread_scheme   => "(unknown)", # Assume we don't know
15         thread_defines  => [],
16
17         unistd          => "<unistd.h>",
18         shared_target   => "",
19         shared_cflag    => "",
20         shared_defines  => [],
21         shared_ldflag   => "",
22         shared_rcflag   => "",
23
24         #### Defaults for the benefit of the config targets who don't inherit
25         #### a BASE and assume Unix defaults
26         #### THESE WILL DISAPPEAR IN OpenSSL 1.2
27         build_scheme    => [ "unified", "unix" ],
28         build_file      => "Makefile",
29
30         AR              => "(unused)",
31         ARFLAGS         => "(unused)",
32         CC              => "cc",
33         HASHBANGPERL    => "/usr/bin/env perl",
34         RANLIB          => sub { which("$config{cross_compile_prefix}ranlib")
35                                      ? "ranlib" : "" },
36         RC              => "windres",
37
38         #### THESE WILL BE ENABLED IN OpenSSL 1.2
39         #HASHBANGPERL   => "PERL", # Only Unix actually cares
40     },
41
42     BASE_common => {
43         template        => 1,
44
45         enable          => [],
46         disable         => [],
47
48         defines         =>
49             sub {
50                 my @defs = ( 'OPENSSL_BUILDING_OPENSSL' );
51                 push @defs, "BROTLI" unless $disabled{brotli};
52                 push @defs, "BROTLI_SHARED" unless $disabled{"brotli-dynamic"};
53                 push @defs, "ZLIB" unless $disabled{zlib};
54                 push @defs, "ZLIB_SHARED" unless $disabled{"zlib-dynamic"};
55                 push @defs, "ZSTD" unless $disabled{zstd};
56                 push @defs, "ZSTD_SHARED" unless $disabled{"zstd-dynamic"};
57                 return [ @defs ];
58             },
59         includes        =>
60             sub {
61                 my @incs = ();
62                 push @incs, $withargs{brotli_include}
63                     if !$disabled{brotli} && $withargs{brotli_include};
64                 push @incs, $withargs{zlib_include}
65                     if !$disabled{zlib} && $withargs{zlib_include};
66                 push @incs, $withargs{zstd_include}
67                     if !$disabled{zstd} && $withargs{zstd_include};
68                 return [ @incs ];
69             },
70     },
71
72     BASE_unix => {
73         inherit_from    => [ "BASE_common" ],
74         template        => 1,
75
76         AR              => "ar",
77         ARFLAGS         => "qc",
78         CC              => "cc",
79         bin_cflags      =>
80             sub {
81                 my @flags = ();
82                 if (!defined($disabled{pie})) {
83                     push(@flags, "-fPIE");
84                 }
85                 return join(" ", @flags);
86             },
87         bin_lflags      =>
88             sub {
89                 my @flags = ();
90                 if (!defined($disabled{pie})) {
91                     push(@flags, "-pie");
92                 }
93                 return join(" ", @flags);
94             },
95         lflags          =>
96             sub {
97                 my @libs = ();
98                 push(@libs, "-L".$withargs{zlib_lib}) if $withargs{zlib_lib};
99                 push(@libs, "-L".$withargs{brotli_lib}) if $withargs{brotli_lib};
100                 push(@libs, "-L".$withargs{zstd_lib}) if $withargs{zstd_lib};
101                 return join(" ", @libs);
102             },
103         ex_libs         =>
104             sub {
105                 my @libs = ();
106                 push(@libs, "-lz") if !defined($disabled{zlib}) && defined($disabled{"zlib-dynamic"});
107                 if (!defined($disabled{brotli}) && defined($disabled{"brotli-dynamic"})) {
108                     push(@libs, "-lbrotlienc");
109                     push(@libs, "-lbrotlidec");
110                     push(@libs, "-lbrotlicommon");
111                     push(@libs, "-lm");
112                 }
113                 push(@libs, "-lzstd") if !defined($disabled{zstd}) && defined($disabled{"zstd-dynamic"});
114                 return join(" ", @libs);
115             },
116         HASHBANGPERL    => "/usr/bin/env perl", # Only Unix actually cares
117         RANLIB          => sub { which("$config{cross_compile_prefix}ranlib")
118                                      ? "ranlib" : "" },
119         RC              => "windres",
120
121         build_scheme    => [ "unified", "unix" ],
122         build_file      => "Makefile",
123
124         perl_platform   => 'Unix',
125     },
126
127     BASE_Windows => {
128         inherit_from    => [ "BASE_common" ],
129         template        => 1,
130
131         lib_defines      =>
132             sub {
133                 my @defs = ();
134                 unless ($disabled{"zlib-dynamic"}) {
135                     my $zlib = $withargs{zlib_lib} // "ZLIB1";
136                     push @defs, 'LIBZ=' . (quotify("perl", $zlib))[0];
137                 }
138                 return [ @defs ];
139             },
140         ex_libs         =>
141             sub {
142                 my @libs = ();
143                 unless ($disabled{zlib}) {
144                     if (defined($disabled{"zlib-dynamic"})) {
145                         push(@libs, $withargs{zlib_lib} // "ZLIB1");
146                     }
147                 }
148                 unless ($disabled{zstd}) {
149                     if (defined($disabled{"zstd-dynamic"})) {
150                         push(@libs, $withargs{zstd_lib} // "libzstd");
151                     }
152                 }
153                 unless ($disabled{brotli}) {
154                     if (defined($disabled{"brotli-dynamic"})) {
155                         my $path = "";
156                         if (defined($withargs{brotli_lib})) {
157                             $path = $withargs{brotli_lib} . "\\";
158                         }
159                         push(@libs, $path . "brotlicommon.lib");
160                         push(@libs, $path . "brotlidec.lib");
161                         push(@libs, $path . "brotlienc.lib");
162                     }
163                 }
164                 return join(" ", @libs);
165             },
166
167         MT              => "mt",
168         MTFLAGS         => "-nologo",
169         mtinflag        => "-manifest ",
170         mtoutflag       => "-outputresource:",
171
172         build_file      => "makefile",
173         build_scheme    => [ "unified", "windows" ],
174
175         perl_platform   => 'Windows',
176     },
177
178     BASE_VMS => {
179         inherit_from    => [ "BASE_common" ],
180         template        => 1,
181
182         includes        =>
183             add(sub {
184                     my @incs = ();
185                     # GNV$ZLIB_INCLUDE is the standard logical name for later
186                     # zlib incarnations.
187                     push @incs, 'GNV$ZLIB_INCLUDE:'
188                         if !$disabled{zlib} && !$withargs{zlib_include};
189                     return [ @incs ];
190                 }),
191
192         build_file       => "descrip.mms",
193         build_scheme     => [ "unified", "VMS" ],
194
195         perl_platform    => 'VMS',
196     },
197 );