Kitxuuu commited on
Commit
910a777
·
verified ·
1 Parent(s): 3b0a5ae

Upload folder using huggingface_hub

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +2 -0
  2. afc-curl/CHANGES.md +12 -0
  3. afc-curl/CMake/CMakeConfigurableFile.in +24 -0
  4. afc-curl/CMake/CurlSymbolHiding.cmake +66 -0
  5. afc-curl/CMake/CurlTests.c +413 -0
  6. afc-curl/CMake/FindBearSSL.cmake +58 -0
  7. afc-curl/CMake/FindBrotli.cmake +80 -0
  8. afc-curl/CMake/FindCares.cmake +90 -0
  9. afc-curl/CMake/FindGSS.cmake +357 -0
  10. afc-curl/CMake/FindLibgsasl.cmake +79 -0
  11. afc-curl/CMake/FindLibidn2.cmake +79 -0
  12. afc-curl/CMake/FindLibpsl.cmake +80 -0
  13. afc-curl/CMake/FindLibssh.cmake +93 -0
  14. afc-curl/CMake/FindLibssh2.cmake +80 -0
  15. afc-curl/CMake/FindLibuv.cmake +89 -0
  16. afc-curl/CMake/FindMSH3.cmake +69 -0
  17. afc-curl/CMake/FindMbedTLS.cmake +109 -0
  18. afc-curl/CMake/FindNGHTTP2.cmake +80 -0
  19. afc-curl/CMake/FindNGHTTP3.cmake +80 -0
  20. afc-curl/CMake/FindNGTCP2.cmake +122 -0
  21. afc-curl/CMake/FindNettle.cmake +84 -0
  22. afc-curl/CMake/FindQuiche.cmake +67 -0
  23. afc-curl/CMake/FindRustls.cmake +103 -0
  24. afc-curl/CMake/FindWolfSSH.cmake +65 -0
  25. afc-curl/CMake/FindWolfSSL.cmake +96 -0
  26. afc-curl/CMake/FindZstd.cmake +99 -0
  27. afc-curl/CMake/Macros.cmake +82 -0
  28. afc-curl/CMake/OtherTests.cmake +156 -0
  29. afc-curl/CMake/PickyWarnings.cmake +265 -0
  30. afc-curl/CMake/Platforms/WindowsCache.cmake +194 -0
  31. afc-curl/CMake/Utilities.cmake +35 -0
  32. afc-curl/CMake/cmake_uninstall.cmake.in +49 -0
  33. afc-curl/CMake/curl-config.cmake.in +51 -0
  34. afc-curl/CMakeLists.txt +2355 -0
  35. afc-curl/COPYING +22 -0
  36. afc-curl/Dockerfile +41 -0
  37. afc-curl/GIT-INFO.md +32 -0
  38. afc-curl/LICENSES/BSD-3-Clause.txt +11 -0
  39. afc-curl/LICENSES/BSD-4-Clause-UC.txt +15 -0
  40. afc-curl/LICENSES/ISC.txt +12 -0
  41. afc-curl/LICENSES/curl.txt +22 -0
  42. afc-curl/Makefile.am +252 -0
  43. afc-curl/Makefile.dist +71 -0
  44. afc-curl/README +55 -0
  45. afc-curl/README.md +68 -0
  46. afc-curl/RELEASE-NOTES +197 -0
  47. afc-curl/REUSE.toml +57 -0
  48. afc-curl/SECURITY.md +29 -0
  49. afc-curl/acinclude.m4 +1697 -0
  50. afc-curl/appveyor.sh +159 -0
.gitattributes CHANGED
@@ -57,3 +57,5 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
57
  # Video files - compressed
58
  *.mp4 filter=lfs diff=lfs merge=lfs -text
59
  *.webm filter=lfs diff=lfs merge=lfs -text
 
 
 
57
  # Video files - compressed
58
  *.mp4 filter=lfs diff=lfs merge=lfs -text
59
  *.webm filter=lfs diff=lfs merge=lfs -text
60
+ fuzz-tooling/infra/cifuzz/test_data/timeout_fuzzer filter=lfs diff=lfs merge=lfs -text
61
+ fuzz-tooling/projects/curl/pkgs/curl_fuzzer/corpora/curl_fuzzer_rtsp/oss-fuzz-issue-6937 filter=lfs diff=lfs merge=lfs -text
afc-curl/CHANGES.md ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!--
2
+ Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
3
+
4
+ SPDX-License-Identifier: curl
5
+ -->
6
+
7
+ In a release tarball, check the RELEASES-NOTES file for what was done in the
8
+ most recent release. In a git check-out, that file mentions changes that have
9
+ been done since the previous release.
10
+
11
+ See the online [changelog](https://curl.se/changes.html) for the edited and
12
+ human readable version of what has changed in different curl releases.
afc-curl/CMake/CMakeConfigurableFile.in ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #***************************************************************************
2
+ # _ _ ____ _
3
+ # Project ___| | | | _ \| |
4
+ # / __| | | | |_) | |
5
+ # | (__| |_| | _ <| |___
6
+ # \___|\___/|_| \_\_____|
7
+ #
8
+ # Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
9
+ #
10
+ # This software is licensed as described in the file COPYING, which
11
+ # you should have received as part of this distribution. The terms
12
+ # are also available at https://curl.se/docs/copyright.html.
13
+ #
14
+ # You may opt to use, copy, modify, merge, publish, distribute and/or sell
15
+ # copies of the Software, and permit persons to whom the Software is
16
+ # furnished to do so, under the terms of the COPYING file.
17
+ #
18
+ # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19
+ # KIND, either express or implied.
20
+ #
21
+ # SPDX-License-Identifier: curl
22
+ #
23
+ ###########################################################################
24
+ @CMAKE_CONFIGURABLE_FILE_CONTENT@
afc-curl/CMake/CurlSymbolHiding.cmake ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #***************************************************************************
2
+ # _ _ ____ _
3
+ # Project ___| | | | _ \| |
4
+ # / __| | | | |_) | |
5
+ # | (__| |_| | _ <| |___
6
+ # \___|\___/|_| \_\_____|
7
+ #
8
+ # Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
9
+ #
10
+ # This software is licensed as described in the file COPYING, which
11
+ # you should have received as part of this distribution. The terms
12
+ # are also available at https://curl.se/docs/copyright.html.
13
+ #
14
+ # You may opt to use, copy, modify, merge, publish, distribute and/or sell
15
+ # copies of the Software, and permit persons to whom the Software is
16
+ # furnished to do so, under the terms of the COPYING file.
17
+ #
18
+ # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19
+ # KIND, either express or implied.
20
+ #
21
+ # SPDX-License-Identifier: curl
22
+ #
23
+ ###########################################################################
24
+ option(CURL_HIDDEN_SYMBOLS "Hide libcurl internal symbols (=hide all symbols that are not officially external)" ON)
25
+ mark_as_advanced(CURL_HIDDEN_SYMBOLS)
26
+
27
+ if(WIN32 AND (ENABLE_DEBUG OR ENABLE_CURLDEBUG))
28
+ # We need to export internal debug functions,
29
+ # e.g. curl_easy_perform_ev() or curl_dbg_*(),
30
+ # so disable symbol hiding for debug builds and for memory tracking.
31
+ set(CURL_HIDDEN_SYMBOLS OFF)
32
+ endif()
33
+
34
+ set(CURL_HIDES_PRIVATE_SYMBOLS FALSE)
35
+ unset(CURL_EXTERN_SYMBOL)
36
+ unset(CURL_CFLAG_SYMBOLS_HIDE)
37
+
38
+ if(CURL_HIDDEN_SYMBOLS)
39
+ if(CMAKE_C_COMPILER_ID MATCHES "Clang" AND NOT MSVC)
40
+ set(CURL_HIDES_PRIVATE_SYMBOLS TRUE)
41
+ set(CURL_EXTERN_SYMBOL "__attribute__((__visibility__(\"default\")))")
42
+ set(CURL_CFLAG_SYMBOLS_HIDE "-fvisibility=hidden")
43
+ elseif(CMAKE_COMPILER_IS_GNUCC)
44
+ if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 3.4)
45
+ # Note: This is considered buggy prior to 4.0 but the autotools do not care, so let us ignore that fact
46
+ set(CURL_HIDES_PRIVATE_SYMBOLS TRUE)
47
+ set(CURL_EXTERN_SYMBOL "__attribute__((__visibility__(\"default\")))")
48
+ set(CURL_CFLAG_SYMBOLS_HIDE "-fvisibility=hidden")
49
+ endif()
50
+ elseif(CMAKE_C_COMPILER_ID MATCHES "SunPro" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 8.0)
51
+ set(CURL_HIDES_PRIVATE_SYMBOLS TRUE)
52
+ set(CURL_EXTERN_SYMBOL "__global")
53
+ set(CURL_CFLAG_SYMBOLS_HIDE "-xldscope=hidden")
54
+ elseif(CMAKE_C_COMPILER_ID MATCHES "Intel" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 9.0) # Requires 9.1.045
55
+ set(CURL_HIDES_PRIVATE_SYMBOLS TRUE)
56
+ set(CURL_EXTERN_SYMBOL "__attribute__((__visibility__(\"default\")))")
57
+ set(CURL_CFLAG_SYMBOLS_HIDE "-fvisibility=hidden")
58
+ elseif(MSVC)
59
+ set(CURL_HIDES_PRIVATE_SYMBOLS TRUE)
60
+ endif()
61
+ else()
62
+ if(MSVC)
63
+ # Note: This option is prone to export non-curl extra symbols.
64
+ set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
65
+ endif()
66
+ endif()
afc-curl/CMake/CurlTests.c ADDED
@@ -0,0 +1,413 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /***************************************************************************
2
+ * _ _ ____ _
3
+ * Project ___| | | | _ \| |
4
+ * / __| | | | |_) | |
5
+ * | (__| |_| | _ <| |___
6
+ * \___|\___/|_| \_\_____|
7
+ *
8
+ * Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
9
+ *
10
+ * This software is licensed as described in the file COPYING, which
11
+ * you should have received as part of this distribution. The terms
12
+ * are also available at https://curl.se/docs/copyright.html.
13
+ *
14
+ * You may opt to use, copy, modify, merge, publish, distribute and/or sell
15
+ * copies of the Software, and permit persons to whom the Software is
16
+ * furnished to do so, under the terms of the COPYING file.
17
+ *
18
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19
+ * KIND, either express or implied.
20
+ *
21
+ * SPDX-License-Identifier: curl
22
+ *
23
+ ***************************************************************************/
24
+
25
+ #ifdef HAVE_FCNTL_O_NONBLOCK
26
+ /* headers for FCNTL_O_NONBLOCK test */
27
+ #include <sys/types.h>
28
+ #include <unistd.h>
29
+ #include <fcntl.h>
30
+ /* */
31
+ #if defined(sun) || defined(__sun__) || \
32
+ defined(__SUNPRO_C) || defined(__SUNPRO_CC)
33
+ # if defined(__SVR4) || defined(__srv4__)
34
+ # define PLATFORM_SOLARIS
35
+ # else
36
+ # define PLATFORM_SUNOS4
37
+ # endif
38
+ #endif
39
+ #if (defined(_AIX) || defined(__xlC__)) && !defined(_AIX41)
40
+ # define PLATFORM_AIX_V3
41
+ #endif
42
+ /* */
43
+ #if defined(PLATFORM_SUNOS4) || defined(PLATFORM_AIX_V3)
44
+ #error "O_NONBLOCK does not work on this platform"
45
+ #endif
46
+
47
+ int main(void)
48
+ {
49
+ /* O_NONBLOCK source test */
50
+ int flags = 0;
51
+ if(0 != fcntl(0, F_SETFL, flags | O_NONBLOCK))
52
+ return 1;
53
+ ;
54
+ return 0;
55
+ }
56
+ #endif
57
+
58
+ /* tests for gethostbyname_r */
59
+ #if defined(HAVE_GETHOSTBYNAME_R_3_REENTRANT) || \
60
+ defined(HAVE_GETHOSTBYNAME_R_5_REENTRANT) || \
61
+ defined(HAVE_GETHOSTBYNAME_R_6_REENTRANT)
62
+ # define _REENTRANT
63
+ /* no idea whether _REENTRANT is always set, just invent a new flag */
64
+ # define TEST_GETHOSTBYFOO_REENTRANT
65
+ #endif
66
+ #if defined(HAVE_GETHOSTBYNAME_R_3) || \
67
+ defined(HAVE_GETHOSTBYNAME_R_5) || \
68
+ defined(HAVE_GETHOSTBYNAME_R_6) || \
69
+ defined(TEST_GETHOSTBYFOO_REENTRANT)
70
+ #include <sys/types.h>
71
+ #include <netdb.h>
72
+ int main(void)
73
+ {
74
+ char *address = "example.com";
75
+ int length = 0;
76
+ int type = 0;
77
+ struct hostent h;
78
+ int rc = 0;
79
+ #if defined(HAVE_GETHOSTBYNAME_R_3) || \
80
+ defined(HAVE_GETHOSTBYNAME_R_3_REENTRANT)
81
+ struct hostent_data hdata;
82
+ #elif defined(HAVE_GETHOSTBYNAME_R_5) || \
83
+ defined(HAVE_GETHOSTBYNAME_R_5_REENTRANT) || \
84
+ defined(HAVE_GETHOSTBYNAME_R_6) || \
85
+ defined(HAVE_GETHOSTBYNAME_R_6_REENTRANT)
86
+ char buffer[8192];
87
+ int h_errnop;
88
+ struct hostent *hp;
89
+ #endif
90
+
91
+ #if defined(HAVE_GETHOSTBYNAME_R_3) || \
92
+ defined(HAVE_GETHOSTBYNAME_R_3_REENTRANT)
93
+ rc = gethostbyname_r(address, &h, &hdata);
94
+ #elif defined(HAVE_GETHOSTBYNAME_R_5) || \
95
+ defined(HAVE_GETHOSTBYNAME_R_5_REENTRANT)
96
+ rc = gethostbyname_r(address, &h, buffer, 8192, &h_errnop);
97
+ (void)hp; /* not used for test */
98
+ #elif defined(HAVE_GETHOSTBYNAME_R_6) || \
99
+ defined(HAVE_GETHOSTBYNAME_R_6_REENTRANT)
100
+ rc = gethostbyname_r(address, &h, buffer, 8192, &hp, &h_errnop);
101
+ #endif
102
+
103
+ (void)length;
104
+ (void)type;
105
+ (void)rc;
106
+ return 0;
107
+ }
108
+ #endif
109
+
110
+ #ifdef HAVE_IN_ADDR_T
111
+ #include <sys/types.h>
112
+ #include <sys/socket.h>
113
+ #include <arpa/inet.h>
114
+ int main(void)
115
+ {
116
+ if((in_addr_t *) 0)
117
+ return 0;
118
+ if(sizeof(in_addr_t))
119
+ return 0;
120
+ ;
121
+ return 0;
122
+ }
123
+ #endif
124
+
125
+ #ifdef HAVE_BOOL_T
126
+ #ifdef HAVE_SYS_TYPES_H
127
+ #include <sys/types.h>
128
+ #endif
129
+ #ifdef HAVE_STDBOOL_H
130
+ #include <stdbool.h>
131
+ #endif
132
+ int main(void)
133
+ {
134
+ if(sizeof(bool *))
135
+ return 0;
136
+ ;
137
+ return 0;
138
+ }
139
+ #endif
140
+
141
+ #ifdef STDC_HEADERS
142
+ #include <stdlib.h>
143
+ #include <stdarg.h>
144
+ #include <string.h>
145
+ #include <float.h>
146
+ int main(void) { return 0; }
147
+ #endif
148
+
149
+ #ifdef HAVE_FILE_OFFSET_BITS
150
+ #ifdef _FILE_OFFSET_BITS
151
+ #undef _FILE_OFFSET_BITS
152
+ #endif
153
+ #define _FILE_OFFSET_BITS 64
154
+ #include <sys/types.h>
155
+ /* Check that off_t can represent 2**63 - 1 correctly.
156
+ We cannot simply define LARGE_OFF_T to be 9223372036854775807,
157
+ since some C++ compilers masquerading as C compilers
158
+ incorrectly reject 9223372036854775807. */
159
+ #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
160
+ int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
161
+ && LARGE_OFF_T % 2147483647 == 1)
162
+ ? 1 : -1];
163
+ int main(void) { return 0; }
164
+ #endif
165
+
166
+ #ifdef HAVE_IOCTLSOCKET
167
+ /* includes start */
168
+ #ifdef _WIN32
169
+ # include <winsock2.h>
170
+ #endif
171
+ int main(void)
172
+ {
173
+ /* ioctlsocket source code */
174
+ int socket;
175
+ unsigned long flags = ioctlsocket(socket, FIONBIO, &flags);
176
+ ;
177
+ return 0;
178
+ }
179
+
180
+ #endif
181
+
182
+ #ifdef HAVE_IOCTLSOCKET_CAMEL
183
+ /* includes start */
184
+ #ifdef _WIN32
185
+ # include <winsock2.h>
186
+ #endif
187
+ int main(void)
188
+ {
189
+ /* IoctlSocket source code */
190
+ if(0 != IoctlSocket(0, 0, 0))
191
+ return 1;
192
+ ;
193
+ return 0;
194
+ }
195
+ #endif
196
+
197
+ #ifdef HAVE_IOCTLSOCKET_CAMEL_FIONBIO
198
+ /* includes start */
199
+ #ifdef _WIN32
200
+ # include <winsock2.h>
201
+ #endif
202
+ int main(void)
203
+ {
204
+ /* IoctlSocket source code */
205
+ long flags = 0;
206
+ if(0 != IoctlSocket(0, FIONBIO, &flags))
207
+ return 1;
208
+ ;
209
+ return 0;
210
+ }
211
+ #endif
212
+
213
+ #ifdef HAVE_IOCTLSOCKET_FIONBIO
214
+ /* includes start */
215
+ #ifdef _WIN32
216
+ # include <winsock2.h>
217
+ #endif
218
+ int main(void)
219
+ {
220
+ unsigned long flags = 0;
221
+ if(0 != ioctlsocket(0, FIONBIO, &flags))
222
+ return 1;
223
+ ;
224
+ return 0;
225
+ }
226
+ #endif
227
+
228
+ #ifdef HAVE_IOCTL_FIONBIO
229
+ /* headers for FIONBIO test */
230
+ /* includes start */
231
+ #ifdef HAVE_SYS_TYPES_H
232
+ # include <sys/types.h>
233
+ #endif
234
+ #ifdef HAVE_UNISTD_H
235
+ # include <unistd.h>
236
+ #endif
237
+ #ifdef HAVE_SYS_SOCKET_H
238
+ # include <sys/socket.h>
239
+ #endif
240
+ #ifdef HAVE_SYS_IOCTL_H
241
+ # include <sys/ioctl.h>
242
+ #endif
243
+ #ifdef HAVE_STROPTS_H
244
+ # include <stropts.h>
245
+ #endif
246
+ int main(void)
247
+ {
248
+ int flags = 0;
249
+ if(0 != ioctl(0, FIONBIO, &flags))
250
+ return 1;
251
+ ;
252
+ return 0;
253
+ }
254
+ #endif
255
+
256
+ #ifdef HAVE_IOCTL_SIOCGIFADDR
257
+ /* headers for FIONBIO test */
258
+ /* includes start */
259
+ #ifdef HAVE_SYS_TYPES_H
260
+ # include <sys/types.h>
261
+ #endif
262
+ #ifdef HAVE_UNISTD_H
263
+ # include <unistd.h>
264
+ #endif
265
+ #ifdef HAVE_SYS_SOCKET_H
266
+ # include <sys/socket.h>
267
+ #endif
268
+ #ifdef HAVE_SYS_IOCTL_H
269
+ # include <sys/ioctl.h>
270
+ #endif
271
+ #ifdef HAVE_STROPTS_H
272
+ # include <stropts.h>
273
+ #endif
274
+ #include <net/if.h>
275
+ int main(void)
276
+ {
277
+ struct ifreq ifr;
278
+ if(0 != ioctl(0, SIOCGIFADDR, &ifr))
279
+ return 1;
280
+ ;
281
+ return 0;
282
+ }
283
+ #endif
284
+
285
+ #ifdef HAVE_SETSOCKOPT_SO_NONBLOCK
286
+ /* includes start */
287
+ #ifdef _WIN32
288
+ # include <winsock2.h>
289
+ #endif
290
+ /* includes start */
291
+ #ifdef HAVE_SYS_TYPES_H
292
+ # include <sys/types.h>
293
+ #endif
294
+ #ifdef HAVE_SYS_SOCKET_H
295
+ # include <sys/socket.h>
296
+ #endif
297
+ /* includes end */
298
+ int main(void)
299
+ {
300
+ if(0 != setsockopt(0, SOL_SOCKET, SO_NONBLOCK, 0, 0))
301
+ return 1;
302
+ ;
303
+ return 0;
304
+ }
305
+ #endif
306
+
307
+ #ifdef HAVE_GLIBC_STRERROR_R
308
+ #include <string.h>
309
+ #include <errno.h>
310
+
311
+ void check(char c) {}
312
+
313
+ int main(void)
314
+ {
315
+ char buffer[1024];
316
+ /* This will not compile if strerror_r does not return a char* */
317
+ check(strerror_r(EACCES, buffer, sizeof(buffer))[0]);
318
+ return 0;
319
+ }
320
+ #endif
321
+
322
+ #ifdef HAVE_POSIX_STRERROR_R
323
+ #include <string.h>
324
+ #include <errno.h>
325
+
326
+ /* Float, because a pointer cannot be implicitly cast to float */
327
+ void check(float f) {}
328
+
329
+ int main(void)
330
+ {
331
+ char buffer[1024];
332
+ /* This will not compile if strerror_r does not return an int */
333
+ check(strerror_r(EACCES, buffer, sizeof(buffer)));
334
+ return 0;
335
+ }
336
+ #endif
337
+
338
+ #ifdef HAVE_FSETXATTR_6
339
+ #include <sys/xattr.h> /* header from libc, not from libattr */
340
+ int main(void)
341
+ {
342
+ fsetxattr(0, 0, 0, 0, 0, 0);
343
+ return 0;
344
+ }
345
+ #endif
346
+
347
+ #ifdef HAVE_FSETXATTR_5
348
+ #include <sys/xattr.h> /* header from libc, not from libattr */
349
+ int main(void)
350
+ {
351
+ fsetxattr(0, 0, 0, 0, 0);
352
+ return 0;
353
+ }
354
+ #endif
355
+
356
+ #ifdef HAVE_CLOCK_GETTIME_MONOTONIC
357
+ #include <time.h>
358
+ int main(void)
359
+ {
360
+ struct timespec ts = {0, 0};
361
+ clock_gettime(CLOCK_MONOTONIC, &ts);
362
+ return 0;
363
+ }
364
+ #endif
365
+
366
+ #ifdef HAVE_BUILTIN_AVAILABLE
367
+ int main(void)
368
+ {
369
+ if(__builtin_available(macOS 10.12, iOS 5.0, *)) {}
370
+ return 0;
371
+ }
372
+ #endif
373
+
374
+ #ifdef HAVE_ATOMIC
375
+ /* includes start */
376
+ #ifdef HAVE_SYS_TYPES_H
377
+ # include <sys/types.h>
378
+ #endif
379
+ #ifdef HAVE_UNISTD_H
380
+ # include <unistd.h>
381
+ #endif
382
+ #ifdef HAVE_STDATOMIC_H
383
+ # include <stdatomic.h>
384
+ #endif
385
+ /* includes end */
386
+
387
+ int main(void)
388
+ {
389
+ _Atomic int i = 1;
390
+ i = 0; /* Force an atomic-write operation. */
391
+ return i;
392
+ }
393
+ #endif
394
+
395
+ #ifdef HAVE_WIN32_WINNT
396
+ /* includes start */
397
+ #ifdef _WIN32
398
+ # ifndef NOGDI
399
+ # define NOGDI
400
+ # endif
401
+ # include <windows.h>
402
+ #endif
403
+ /* includes end */
404
+
405
+ #define enquote(x) #x
406
+ #define expand(x) enquote(x)
407
+ #pragma message("_WIN32_WINNT=" expand(_WIN32_WINNT))
408
+
409
+ int main(void)
410
+ {
411
+ return 0;
412
+ }
413
+ #endif
afc-curl/CMake/FindBearSSL.cmake ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #***************************************************************************
2
+ # _ _ ____ _
3
+ # Project ___| | | | _ \| |
4
+ # / __| | | | |_) | |
5
+ # | (__| |_| | _ <| |___
6
+ # \___|\___/|_| \_\_____|
7
+ #
8
+ # Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
9
+ #
10
+ # This software is licensed as described in the file COPYING, which
11
+ # you should have received as part of this distribution. The terms
12
+ # are also available at https://curl.se/docs/copyright.html.
13
+ #
14
+ # You may opt to use, copy, modify, merge, publish, distribute and/or sell
15
+ # copies of the Software, and permit persons to whom the Software is
16
+ # furnished to do so, under the terms of the COPYING file.
17
+ #
18
+ # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19
+ # KIND, either express or implied.
20
+ #
21
+ # SPDX-License-Identifier: curl
22
+ #
23
+ ###########################################################################
24
+ # Find the BearSSL library
25
+ #
26
+ # Input variables:
27
+ #
28
+ # - `BEARSSL_INCLUDE_DIR`: The BearSSL include directory.
29
+ # - `BEARSSL_LIBRARY`: Path to `bearssl` library.
30
+ #
31
+ # Result variables:
32
+ #
33
+ # - `BEARSSL_FOUND`: System has BearSSL.
34
+ # - `BEARSSL_INCLUDE_DIRS`: The BearSSL include directories.
35
+ # - `BEARSSL_LIBRARIES`: The BearSSL library names.
36
+
37
+ if(DEFINED BEARSSL_INCLUDE_DIRS AND NOT DEFINED BEARSSL_INCLUDE_DIR)
38
+ message(WARNING "BEARSSL_INCLUDE_DIRS is deprecated, use BEARSSL_INCLUDE_DIR instead.")
39
+ set(BEARSSL_INCLUDE_DIR "${BEARSSL_INCLUDE_DIRS}")
40
+ unset(BEARSSL_INCLUDE_DIRS)
41
+ endif()
42
+
43
+ find_path(BEARSSL_INCLUDE_DIR NAMES "bearssl.h")
44
+ find_library(BEARSSL_LIBRARY NAMES "bearssl")
45
+
46
+ include(FindPackageHandleStandardArgs)
47
+ find_package_handle_standard_args(BearSSL
48
+ REQUIRED_VARS
49
+ BEARSSL_INCLUDE_DIR
50
+ BEARSSL_LIBRARY
51
+ )
52
+
53
+ if(BEARSSL_FOUND)
54
+ set(BEARSSL_INCLUDE_DIRS ${BEARSSL_INCLUDE_DIR})
55
+ set(BEARSSL_LIBRARIES ${BEARSSL_LIBRARY})
56
+ endif()
57
+
58
+ mark_as_advanced(BEARSSL_INCLUDE_DIR BEARSSL_LIBRARY)
afc-curl/CMake/FindBrotli.cmake ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #***************************************************************************
2
+ # _ _ ____ _
3
+ # Project ___| | | | _ \| |
4
+ # / __| | | | |_) | |
5
+ # | (__| |_| | _ <| |___
6
+ # \___|\___/|_| \_\_____|
7
+ #
8
+ # Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
9
+ #
10
+ # This software is licensed as described in the file COPYING, which
11
+ # you should have received as part of this distribution. The terms
12
+ # are also available at https://curl.se/docs/copyright.html.
13
+ #
14
+ # You may opt to use, copy, modify, merge, publish, distribute and/or sell
15
+ # copies of the Software, and permit persons to whom the Software is
16
+ # furnished to do so, under the terms of the COPYING file.
17
+ #
18
+ # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19
+ # KIND, either express or implied.
20
+ #
21
+ # SPDX-License-Identifier: curl
22
+ #
23
+ ###########################################################################
24
+ # Find the brotli library
25
+ #
26
+ # Input variables:
27
+ #
28
+ # - `BROTLI_INCLUDE_DIR`: The brotli include directory.
29
+ # - `BROTLICOMMON_LIBRARY`: Path to `brotlicommon` library.
30
+ # - `BROTLIDEC_LIBRARY`: Path to `brotlidec` library.
31
+ #
32
+ # Result variables:
33
+ #
34
+ # - `BROTLI_FOUND`: System has brotli.
35
+ # - `BROTLI_INCLUDE_DIRS`: The brotli include directories.
36
+ # - `BROTLI_LIBRARIES`: The brotli library names.
37
+ # - `BROTLI_VERSION`: Version of brotli.
38
+
39
+ if(CURL_USE_PKGCONFIG)
40
+ find_package(PkgConfig QUIET)
41
+ pkg_check_modules(PC_BROTLI "libbrotlidec")
42
+ endif()
43
+
44
+ find_path(BROTLI_INCLUDE_DIR "brotli/decode.h"
45
+ HINTS
46
+ ${PC_BROTLI_INCLUDEDIR}
47
+ ${PC_BROTLI_INCLUDE_DIRS}
48
+ )
49
+
50
+ find_library(BROTLICOMMON_LIBRARY NAMES "brotlicommon"
51
+ HINTS
52
+ ${PC_BROTLI_LIBDIR}
53
+ ${PC_BROTLI_LIBRARY_DIRS}
54
+ )
55
+ find_library(BROTLIDEC_LIBRARY NAMES "brotlidec"
56
+ HINTS
57
+ ${PC_BROTLI_LIBDIR}
58
+ ${PC_BROTLI_LIBRARY_DIRS}
59
+ )
60
+
61
+ if(PC_BROTLI_VERSION)
62
+ set(BROTLI_VERSION ${PC_BROTLI_VERSION})
63
+ endif()
64
+
65
+ include(FindPackageHandleStandardArgs)
66
+ find_package_handle_standard_args(Brotli
67
+ REQUIRED_VARS
68
+ BROTLI_INCLUDE_DIR
69
+ BROTLIDEC_LIBRARY
70
+ BROTLICOMMON_LIBRARY
71
+ VERSION_VAR
72
+ BROTLI_VERSION
73
+ )
74
+
75
+ if(BROTLI_FOUND)
76
+ set(BROTLI_INCLUDE_DIRS ${BROTLI_INCLUDE_DIR})
77
+ set(BROTLI_LIBRARIES ${BROTLIDEC_LIBRARY} ${BROTLICOMMON_LIBRARY})
78
+ endif()
79
+
80
+ mark_as_advanced(BROTLI_INCLUDE_DIR BROTLIDEC_LIBRARY BROTLICOMMON_LIBRARY)
afc-curl/CMake/FindCares.cmake ADDED
@@ -0,0 +1,90 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #***************************************************************************
2
+ # _ _ ____ _
3
+ # Project ___| | | | _ \| |
4
+ # / __| | | | |_) | |
5
+ # | (__| |_| | _ <| |___
6
+ # \___|\___/|_| \_\_____|
7
+ #
8
+ # Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
9
+ #
10
+ # This software is licensed as described in the file COPYING, which
11
+ # you should have received as part of this distribution. The terms
12
+ # are also available at https://curl.se/docs/copyright.html.
13
+ #
14
+ # You may opt to use, copy, modify, merge, publish, distribute and/or sell
15
+ # copies of the Software, and permit persons to whom the Software is
16
+ # furnished to do so, under the terms of the COPYING file.
17
+ #
18
+ # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19
+ # KIND, either express or implied.
20
+ #
21
+ # SPDX-License-Identifier: curl
22
+ #
23
+ ###########################################################################
24
+ # Find the c-ares library
25
+ #
26
+ # Input variables:
27
+ #
28
+ # - `CARES_INCLUDE_DIR`: The c-ares include directory.
29
+ # - `CARES_LIBRARY`: Path to `cares` library.
30
+ #
31
+ # Result variables:
32
+ #
33
+ # - `CARES_FOUND`: System has c-ares.
34
+ # - `CARES_INCLUDE_DIRS`: The c-ares include directories.
35
+ # - `CARES_LIBRARIES`: The c-ares library names.
36
+ # - `CARES_VERSION`: Version of c-ares.
37
+
38
+ if(CURL_USE_PKGCONFIG)
39
+ find_package(PkgConfig QUIET)
40
+ pkg_check_modules(PC_CARES "libcares")
41
+ endif()
42
+
43
+ find_path(CARES_INCLUDE_DIR NAMES "ares.h"
44
+ HINTS
45
+ ${PC_CARES_INCLUDEDIR}
46
+ ${PC_CARES_INCLUDE_DIRS}
47
+ )
48
+
49
+ find_library(CARES_LIBRARY NAMES ${CARES_NAMES} "cares"
50
+ HINTS
51
+ ${PC_CARES_LIBDIR}
52
+ ${PC_CARES_LIBRARY_DIRS}
53
+ )
54
+
55
+ if(PC_CARES_VERSION)
56
+ set(CARES_VERSION ${PC_CARES_VERSION})
57
+ elseif(CARES_INCLUDE_DIR AND EXISTS "${CARES_INCLUDE_DIR}/ares_version.h")
58
+ set(_version_regex1 "#[\t ]*define[\t ]+ARES_VERSION_MAJOR[\t ]+([0-9]+).*")
59
+ set(_version_regex2 "#[\t ]*define[\t ]+ARES_VERSION_MINOR[\t ]+([0-9]+).*")
60
+ set(_version_regex3 "#[\t ]*define[\t ]+ARES_VERSION_PATCH[\t ]+([0-9]+).*")
61
+ file(STRINGS "${CARES_INCLUDE_DIR}/ares_version.h" _version_str1 REGEX "${_version_regex1}")
62
+ file(STRINGS "${CARES_INCLUDE_DIR}/ares_version.h" _version_str2 REGEX "${_version_regex2}")
63
+ file(STRINGS "${CARES_INCLUDE_DIR}/ares_version.h" _version_str3 REGEX "${_version_regex3}")
64
+ string(REGEX REPLACE "${_version_regex1}" "\\1" _version_str1 "${_version_str1}")
65
+ string(REGEX REPLACE "${_version_regex2}" "\\1" _version_str2 "${_version_str2}")
66
+ string(REGEX REPLACE "${_version_regex3}" "\\1" _version_str3 "${_version_str3}")
67
+ set(CARES_VERSION "${_version_str1}.${_version_str2}.${_version_str3}")
68
+ unset(_version_regex1)
69
+ unset(_version_regex2)
70
+ unset(_version_regex3)
71
+ unset(_version_str1)
72
+ unset(_version_str2)
73
+ unset(_version_str3)
74
+ endif()
75
+
76
+ include(FindPackageHandleStandardArgs)
77
+ find_package_handle_standard_args(Cares
78
+ REQUIRED_VARS
79
+ CARES_INCLUDE_DIR
80
+ CARES_LIBRARY
81
+ VERSION_VAR
82
+ CARES_VERSION
83
+ )
84
+
85
+ if(CARES_FOUND)
86
+ set(CARES_INCLUDE_DIRS ${CARES_INCLUDE_DIR})
87
+ set(CARES_LIBRARIES ${CARES_LIBRARY})
88
+ endif()
89
+
90
+ mark_as_advanced(CARES_INCLUDE_DIR CARES_LIBRARY)
afc-curl/CMake/FindGSS.cmake ADDED
@@ -0,0 +1,357 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #***************************************************************************
2
+ # _ _ ____ _
3
+ # Project ___| | | | _ \| |
4
+ # / __| | | | |_) | |
5
+ # | (__| |_| | _ <| |___
6
+ # \___|\___/|_| \_\_____|
7
+ #
8
+ # Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
9
+ #
10
+ # This software is licensed as described in the file COPYING, which
11
+ # you should have received as part of this distribution. The terms
12
+ # are also available at https://curl.se/docs/copyright.html.
13
+ #
14
+ # You may opt to use, copy, modify, merge, publish, distribute and/or sell
15
+ # copies of the Software, and permit persons to whom the Software is
16
+ # furnished to do so, under the terms of the COPYING file.
17
+ #
18
+ # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19
+ # KIND, either express or implied.
20
+ #
21
+ # SPDX-License-Identifier: curl
22
+ #
23
+ ###########################################################################
24
+ # Find the GSS Kerberos library
25
+ #
26
+ # Input variables:
27
+ #
28
+ # - `GSS_ROOT_DIR`: Set this variable to the root installation of GSS. (also supported as environment)
29
+ #
30
+ # Result variables:
31
+ #
32
+ # - `GSS_FOUND`: System has the Heimdal library.
33
+ # - `GSS_FLAVOUR`: "GNU", "MIT" or "Heimdal" if anything found.
34
+ # - `GSS_INCLUDE_DIRS`: The GSS include directories.
35
+ # - `GSS_LIBRARIES`: The GSS library names.
36
+ # - `GSS_LIBRARY_DIRS`: The GSS library directories.
37
+ # - `GSS_PC_REQUIRES`: The GSS pkg-config packages.
38
+ # - `GSS_CFLAGS`: Required compiler flags.
39
+ # - `GSS_VERSION`: This is set to version advertised by pkg-config or read from manifest.
40
+ # In case the library is found but no version info available it is set to "unknown"
41
+
42
+ set(_gnu_modname "gss")
43
+ set(_mit_modname "mit-krb5-gssapi")
44
+ set(_heimdal_modname "heimdal-gssapi")
45
+
46
+ include(CheckIncludeFile)
47
+ include(CheckIncludeFiles)
48
+ include(CheckTypeSize)
49
+
50
+ set(_gss_root_hints
51
+ "${GSS_ROOT_DIR}"
52
+ "$ENV{GSS_ROOT_DIR}"
53
+ )
54
+
55
+ # Try to find library using system pkg-config if user did not specify root dir
56
+ if(NOT GSS_ROOT_DIR AND NOT "$ENV{GSS_ROOT_DIR}")
57
+ if(CURL_USE_PKGCONFIG)
58
+ find_package(PkgConfig QUIET)
59
+ pkg_search_module(_GSS ${_gnu_modname} ${_mit_modname} ${_heimdal_modname})
60
+ list(APPEND _gss_root_hints "${_GSS_PREFIX}")
61
+ endif()
62
+ if(WIN32)
63
+ list(APPEND _gss_root_hints "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MIT\\Kerberos;InstallDir]")
64
+ endif()
65
+ endif()
66
+
67
+ if(NOT _GSS_FOUND) # Not found by pkg-config. Let us take more traditional approach.
68
+ find_file(_gss_configure_script
69
+ NAMES
70
+ "krb5-config"
71
+ HINTS
72
+ ${_gss_root_hints}
73
+ PATH_SUFFIXES
74
+ "bin"
75
+ NO_CMAKE_PATH
76
+ NO_CMAKE_ENVIRONMENT_PATH
77
+ )
78
+
79
+ # If not found in user-supplied directories, maybe system knows better
80
+ find_file(_gss_configure_script
81
+ NAMES
82
+ "krb5-config"
83
+ PATH_SUFFIXES
84
+ "bin"
85
+ )
86
+
87
+ if(_gss_configure_script)
88
+ execute_process(
89
+ COMMAND ${_gss_configure_script} "--cflags" "gssapi"
90
+ OUTPUT_VARIABLE _GSS_CFLAGS
91
+ RESULT_VARIABLE _gss_configure_failed
92
+ OUTPUT_STRIP_TRAILING_WHITESPACE
93
+ )
94
+ message(STATUS "FindGSS krb5-config --cflags: ${_GSS_CFLAGS}")
95
+ if(NOT _gss_configure_failed) # 0 means success
96
+ # Should also work in an odd case when multiple directories are given
97
+ string(STRIP "${_GSS_CFLAGS}" _GSS_CFLAGS)
98
+ string(REGEX REPLACE " +-I" ";" _GSS_CFLAGS "${_GSS_CFLAGS}")
99
+ string(REGEX REPLACE " +-([^I][^ \\t;]*)" ";-\\1" _GSS_CFLAGS "${_GSS_CFLAGS}")
100
+
101
+ foreach(_flag IN LISTS _GSS_CFLAGS)
102
+ if(_flag MATCHES "^-I.*")
103
+ string(REGEX REPLACE "^-I" "" _val "${_flag}")
104
+ list(APPEND _GSS_INCLUDE_DIRS "${_val}")
105
+ else()
106
+ list(APPEND _GSS_CFLAGS "${_flag}")
107
+ endif()
108
+ endforeach()
109
+ endif()
110
+
111
+ execute_process(
112
+ COMMAND ${_gss_configure_script} "--libs" "gssapi"
113
+ OUTPUT_VARIABLE _gss_lib_flags
114
+ RESULT_VARIABLE _gss_configure_failed
115
+ OUTPUT_STRIP_TRAILING_WHITESPACE
116
+ )
117
+ message(STATUS "FindGSS krb5-config --libs: ${_gss_lib_flags}")
118
+
119
+ if(NOT _gss_configure_failed) # 0 means success
120
+ # This script gives us libraries and link directories. Blah. We have to deal with it.
121
+ string(STRIP "${_gss_lib_flags}" _gss_lib_flags)
122
+ string(REGEX REPLACE " +-(L|l)" ";-\\1" _gss_lib_flags "${_gss_lib_flags}")
123
+ string(REGEX REPLACE " +-([^Ll][^ \\t;]*)" ";-\\1" _gss_lib_flags "${_gss_lib_flags}")
124
+
125
+ foreach(_flag IN LISTS _gss_lib_flags)
126
+ if(_flag MATCHES "^-l.*")
127
+ string(REGEX REPLACE "^-l" "" _val "${_flag}")
128
+ list(APPEND _GSS_LIBRARIES "${_val}")
129
+ elseif(_flag MATCHES "^-L.*")
130
+ string(REGEX REPLACE "^-L" "" _val "${_flag}")
131
+ list(APPEND _GSS_LIBRARY_DIRS "${_val}")
132
+ endif()
133
+ endforeach()
134
+ endif()
135
+
136
+ execute_process(
137
+ COMMAND ${_gss_configure_script} "--version"
138
+ OUTPUT_VARIABLE _GSS_VERSION
139
+ RESULT_VARIABLE _gss_configure_failed
140
+ OUTPUT_STRIP_TRAILING_WHITESPACE
141
+ )
142
+
143
+ # Older versions may not have the "--version" parameter. In this case we just do not care.
144
+ if(_gss_configure_failed)
145
+ set(_GSS_VERSION 0)
146
+ endif()
147
+
148
+ execute_process(
149
+ COMMAND ${_gss_configure_script} "--vendor"
150
+ OUTPUT_VARIABLE _gss_vendor
151
+ RESULT_VARIABLE _gss_configure_failed
152
+ OUTPUT_STRIP_TRAILING_WHITESPACE
153
+ )
154
+
155
+ # Older versions may not have the "--vendor" parameter. In this case we just do not care.
156
+ if(_gss_configure_failed)
157
+ set(GSS_FLAVOUR "Heimdal") # most probably, should not really matter
158
+ else()
159
+ if(_gss_vendor MATCHES ".*H|heimdal.*")
160
+ set(GSS_FLAVOUR "Heimdal")
161
+ else()
162
+ set(GSS_FLAVOUR "MIT")
163
+ endif()
164
+ endif()
165
+
166
+ else() # Either there is no config script or we are on a platform that does not provide one (Windows?)
167
+
168
+ find_path(_GSS_INCLUDE_DIRS NAMES "gssapi/gssapi.h"
169
+ HINTS
170
+ ${_gss_root_hints}
171
+ PATH_SUFFIXES
172
+ "include"
173
+ "inc"
174
+ )
175
+
176
+ if(_GSS_INCLUDE_DIRS) # jay, we have found something
177
+ cmake_push_check_state()
178
+ set(CMAKE_REQUIRED_INCLUDES "${_GSS_INCLUDE_DIRS}")
179
+ check_include_files("gssapi/gssapi_generic.h;gssapi/gssapi_krb5.h" _gss_have_mit_headers)
180
+
181
+ if(_gss_have_mit_headers)
182
+ set(GSS_FLAVOUR "MIT")
183
+ else()
184
+ # Prevent compiling the header - just check if we can include it
185
+ list(APPEND CMAKE_REQUIRED_DEFINITIONS "-D__ROKEN_H__")
186
+ check_include_file("roken.h" _gss_have_roken_h)
187
+
188
+ check_include_file("heimdal/roken.h" _gss_have_heimdal_roken_h)
189
+ if(_gss_have_roken_h OR _gss_have_heimdal_roken_h)
190
+ set(GSS_FLAVOUR "Heimdal")
191
+ endif()
192
+ endif()
193
+ cmake_pop_check_state()
194
+ else()
195
+ # I am not convinced if this is the right way but this is what autotools do at the moment
196
+ find_path(_GSS_INCLUDE_DIRS NAMES "gssapi.h"
197
+ HINTS
198
+ ${_gss_root_hints}
199
+ PATH_SUFFIXES
200
+ "include"
201
+ "inc"
202
+ )
203
+
204
+ if(_GSS_INCLUDE_DIRS)
205
+ set(GSS_FLAVOUR "Heimdal")
206
+ else()
207
+ find_path(_GSS_INCLUDE_DIRS NAMES "gss.h"
208
+ HINTS
209
+ ${_gss_root_hints}
210
+ PATH_SUFFIXES
211
+ "include"
212
+ )
213
+
214
+ if(_GSS_INCLUDE_DIRS)
215
+ set(GSS_FLAVOUR "GNU")
216
+ set(GSS_PC_REQUIRES "gss")
217
+ endif()
218
+ endif()
219
+ endif()
220
+
221
+ # If we have headers, check if we can link libraries
222
+ if(GSS_FLAVOUR)
223
+ set(_gss_libdir_suffixes "")
224
+ set(_gss_libdir_hints ${_gss_root_hints})
225
+ get_filename_component(_gss_calculated_potential_root "${_GSS_INCLUDE_DIRS}" DIRECTORY)
226
+ list(APPEND _gss_libdir_hints ${_gss_calculated_potential_root})
227
+
228
+ if(WIN32)
229
+ if(CMAKE_SIZEOF_VOID_P EQUAL 8)
230
+ list(APPEND _gss_libdir_suffixes "lib/AMD64")
231
+ if(GSS_FLAVOUR STREQUAL "GNU")
232
+ set(_gss_libname "gss")
233
+ elseif(GSS_FLAVOUR STREQUAL "MIT")
234
+ set(_gss_libname "gssapi64")
235
+ else()
236
+ set(_gss_libname "libgssapi")
237
+ endif()
238
+ else()
239
+ list(APPEND _gss_libdir_suffixes "lib/i386")
240
+ if(GSS_FLAVOUR STREQUAL "GNU")
241
+ set(_gss_libname "gss")
242
+ elseif(GSS_FLAVOUR STREQUAL "MIT")
243
+ set(_gss_libname "gssapi32")
244
+ else()
245
+ set(_gss_libname "libgssapi")
246
+ endif()
247
+ endif()
248
+ else()
249
+ list(APPEND _gss_libdir_suffixes "lib;lib64") # those suffixes are not checked for HINTS
250
+ if(GSS_FLAVOUR STREQUAL "GNU")
251
+ set(_gss_libname "gss")
252
+ elseif(GSS_FLAVOUR STREQUAL "MIT")
253
+ set(_gss_libname "gssapi_krb5")
254
+ else()
255
+ set(_gss_libname "gssapi")
256
+ endif()
257
+ endif()
258
+
259
+ find_library(_GSS_LIBRARIES NAMES ${_gss_libname}
260
+ HINTS
261
+ ${_gss_libdir_hints}
262
+ PATH_SUFFIXES
263
+ ${_gss_libdir_suffixes}
264
+ )
265
+ endif()
266
+ endif()
267
+ else()
268
+ # _GSS_MODULE_NAME set since CMake 3.16
269
+ if(_GSS_MODULE_NAME STREQUAL _gnu_modname OR _GSS_${_gnu_modname}_VERSION)
270
+ set(GSS_FLAVOUR "GNU")
271
+ set(GSS_PC_REQUIRES "gss")
272
+ if(NOT _GSS_VERSION) # for old CMake versions?
273
+ set(_GSS_VERSION ${_GSS_${_gnu_modname}_VERSION})
274
+ endif()
275
+ elseif(_GSS_MODULE_NAME STREQUAL _mit_modname OR _GSS_${_mit_modname}_VERSION)
276
+ set(GSS_FLAVOUR "MIT")
277
+ set(GSS_PC_REQUIRES "mit-krb5-gssapi")
278
+ if(NOT _GSS_VERSION) # for old CMake versions?
279
+ set(_GSS_VERSION ${_GSS_${_mit_modname}_VERSION})
280
+ endif()
281
+ else()
282
+ set(GSS_FLAVOUR "Heimdal")
283
+ set(GSS_PC_REQUIRES "heimdal-gssapi")
284
+ if(NOT _GSS_VERSION) # for old CMake versions?
285
+ set(_GSS_VERSION ${_GSS_${_heimdal_modname}_VERSION})
286
+ endif()
287
+ endif()
288
+ message(STATUS "Found GSS/${GSS_FLAVOUR} (via pkg-config): ${_GSS_INCLUDE_DIRS} (found version \"${_GSS_VERSION}\")")
289
+ endif()
290
+
291
+ string(REPLACE ";" " " _GSS_CFLAGS "${_GSS_CFLAGS}")
292
+
293
+ set(GSS_INCLUDE_DIRS ${_GSS_INCLUDE_DIRS})
294
+ set(GSS_LIBRARIES ${_GSS_LIBRARIES})
295
+ set(GSS_LIBRARY_DIRS ${_GSS_LIBRARY_DIRS})
296
+ set(GSS_CFLAGS ${_GSS_CFLAGS})
297
+ set(GSS_VERSION ${_GSS_VERSION})
298
+
299
+ if(GSS_FLAVOUR)
300
+ if(NOT GSS_VERSION AND GSS_FLAVOUR STREQUAL "Heimdal")
301
+ if(CMAKE_SIZEOF_VOID_P EQUAL 8)
302
+ set(_heimdal_manifest_file "Heimdal.Application.amd64.manifest")
303
+ else()
304
+ set(_heimdal_manifest_file "Heimdal.Application.x86.manifest")
305
+ endif()
306
+
307
+ if(EXISTS "${GSS_INCLUDE_DIRS}/${_heimdal_manifest_file}")
308
+ file(STRINGS "${GSS_INCLUDE_DIRS}/${_heimdal_manifest_file}" _heimdal_version_str
309
+ REGEX "^.*version=\"[0-9]\\.[^\"]+\".*$")
310
+
311
+ string(REGEX MATCH "[0-9]\\.[^\"]+" GSS_VERSION "${_heimdal_version_str}")
312
+ endif()
313
+
314
+ if(NOT GSS_VERSION)
315
+ set(GSS_VERSION "Heimdal Unknown")
316
+ endif()
317
+ elseif(NOT GSS_VERSION AND GSS_FLAVOUR STREQUAL "MIT")
318
+ get_filename_component(_mit_version "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MIT\\Kerberos\\SDK\\CurrentVersion;VersionString]" NAME
319
+ CACHE)
320
+ if(WIN32 AND _mit_version)
321
+ set(GSS_VERSION "${_mit_version}")
322
+ else()
323
+ set(GSS_VERSION "MIT Unknown")
324
+ endif()
325
+ elseif(NOT GSS_VERSION AND GSS_FLAVOUR STREQUAL "GNU")
326
+ if(GSS_INCLUDE_DIRS AND EXISTS "${GSS_INCLUDE_DIRS}/gss.h")
327
+ set(_version_regex "#[\t ]*define[\t ]+GSS_VERSION[\t ]+\"([^\"]*)\"")
328
+ file(STRINGS "${GSS_INCLUDE_DIRS}/gss.h" _version_str REGEX "${_version_regex}")
329
+ string(REGEX REPLACE "${_version_regex}" "\\1" _version_str "${_version_str}")
330
+ set(GSS_VERSION "${_version_str}")
331
+ unset(_version_regex)
332
+ unset(_version_str)
333
+ endif()
334
+ endif()
335
+ endif()
336
+
337
+ include(FindPackageHandleStandardArgs)
338
+ find_package_handle_standard_args(GSS
339
+ REQUIRED_VARS
340
+ GSS_FLAVOUR
341
+ GSS_LIBRARIES
342
+ VERSION_VAR
343
+ GSS_VERSION
344
+ FAIL_MESSAGE
345
+ "Could NOT find GSS, try to set the path to GSS root folder in the system variable GSS_ROOT_DIR"
346
+ )
347
+
348
+ mark_as_advanced(
349
+ _GSS_CFLAGS
350
+ _GSS_FOUND
351
+ _GSS_INCLUDE_DIRS
352
+ _GSS_LIBRARIES
353
+ _GSS_LIBRARY_DIRS
354
+ _GSS_MODULE_NAME
355
+ _GSS_PREFIX
356
+ _GSS_VERSION
357
+ )
afc-curl/CMake/FindLibgsasl.cmake ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #***************************************************************************
2
+ # _ _ ____ _
3
+ # Project ___| | | | _ \| |
4
+ # / __| | | | |_) | |
5
+ # | (__| |_| | _ <| |___
6
+ # \___|\___/|_| \_\_____|
7
+ #
8
+ # Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
9
+ #
10
+ # This software is licensed as described in the file COPYING, which
11
+ # you should have received as part of this distribution. The terms
12
+ # are also available at https://curl.se/docs/copyright.html.
13
+ #
14
+ # You may opt to use, copy, modify, merge, publish, distribute and/or sell
15
+ # copies of the Software, and permit persons to whom the Software is
16
+ # furnished to do so, under the terms of the COPYING file.
17
+ #
18
+ # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19
+ # KIND, either express or implied.
20
+ #
21
+ # SPDX-License-Identifier: curl
22
+ #
23
+ ###########################################################################
24
+ # Find the libgsasl library
25
+ #
26
+ # Input variables:
27
+ #
28
+ # - `LIBGSASL_INCLUDE_DIR`: The libgsasl include directory.
29
+ # - `LIBGSASL_LIBRARY`: Path to `libgsasl` library.
30
+ #
31
+ # Result variables:
32
+ #
33
+ # - `LIBGSASL_FOUND`: System has libgsasl.
34
+ # - `LIBGSASL_INCLUDE_DIRS`: The libgsasl include directories.
35
+ # - `LIBGSASL_LIBRARIES`: The libgsasl library names.
36
+ # - `LIBGSASL_LIBRARY_DIRS`: The libgsasl library directories.
37
+ # - `LIBGSASL_CFLAGS`: Required compiler flags.
38
+ # - `LIBGSASL_VERSION`: Version of libgsasl.
39
+
40
+ if(CURL_USE_PKGCONFIG AND
41
+ NOT DEFINED LIBGSASL_INCLUDE_DIR AND
42
+ NOT DEFINED LIBGSASL_LIBRARY)
43
+ find_package(PkgConfig QUIET)
44
+ pkg_check_modules(LIBGSASL "libgsasl")
45
+ endif()
46
+
47
+ if(LIBGSASL_FOUND)
48
+ string(REPLACE ";" " " LIBGSASL_CFLAGS "${LIBGSASL_CFLAGS}")
49
+ message(STATUS "Found Libgsasl (via pkg-config): ${LIBGSASL_INCLUDE_DIRS} (found version \"${LIBGSASL_VERSION}\")")
50
+ else()
51
+ find_path(LIBGSASL_INCLUDE_DIR NAMES "gsasl.h")
52
+ find_library(LIBGSASL_LIBRARY NAMES "gsasl" "libgsasl")
53
+
54
+ unset(LIBGSASL_VERSION CACHE)
55
+ if(LIBGSASL_INCLUDE_DIR AND EXISTS "${LIBGSASL_INCLUDE_DIR}/gsasl-version.h")
56
+ set(_version_regex "#[\t ]*define[\t ]+GSASL_VERSION[\t ]+\"([^\"]*)\"")
57
+ file(STRINGS "${LIBGSASL_INCLUDE_DIR}/gsasl-version.h" _version_str REGEX "${_version_regex}")
58
+ string(REGEX REPLACE "${_version_regex}" "\\1" _version_str "${_version_str}")
59
+ set(LIBGSASL_VERSION "${_version_str}")
60
+ unset(_version_regex)
61
+ unset(_version_str)
62
+ endif()
63
+
64
+ include(FindPackageHandleStandardArgs)
65
+ find_package_handle_standard_args(Libgsasl
66
+ REQUIRED_VARS
67
+ LIBGSASL_INCLUDE_DIR
68
+ LIBGSASL_LIBRARY
69
+ VERSION_VAR
70
+ LIBGSASL_VERSION
71
+ )
72
+
73
+ if(LIBGSASL_FOUND)
74
+ set(LIBGSASL_INCLUDE_DIRS ${LIBGSASL_INCLUDE_DIR})
75
+ set(LIBGSASL_LIBRARIES ${LIBGSASL_LIBRARY})
76
+ endif()
77
+
78
+ mark_as_advanced(LIBGSASL_INCLUDE_DIR LIBGSASL_LIBRARY)
79
+ endif()
afc-curl/CMake/FindLibidn2.cmake ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #***************************************************************************
2
+ # _ _ ____ _
3
+ # Project ___| | | | _ \| |
4
+ # / __| | | | |_) | |
5
+ # | (__| |_| | _ <| |___
6
+ # \___|\___/|_| \_\_____|
7
+ #
8
+ # Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
9
+ #
10
+ # This software is licensed as described in the file COPYING, which
11
+ # you should have received as part of this distribution. The terms
12
+ # are also available at https://curl.se/docs/copyright.html.
13
+ #
14
+ # You may opt to use, copy, modify, merge, publish, distribute and/or sell
15
+ # copies of the Software, and permit persons to whom the Software is
16
+ # furnished to do so, under the terms of the COPYING file.
17
+ #
18
+ # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19
+ # KIND, either express or implied.
20
+ #
21
+ # SPDX-License-Identifier: curl
22
+ #
23
+ ###########################################################################
24
+ # Find the libidn2 library
25
+ #
26
+ # Input variables:
27
+ #
28
+ # - `LIBIDN2_INCLUDE_DIR`: The libidn2 include directory.
29
+ # - `LIBIDN2_LIBRARY`: Path to `libidn2` library.
30
+ #
31
+ # Result variables:
32
+ #
33
+ # - `LIBIDN2_FOUND`: System has libidn2.
34
+ # - `LIBIDN2_INCLUDE_DIRS`: The libidn2 include directories.
35
+ # - `LIBIDN2_LIBRARIES`: The libidn2 library names.
36
+ # - `LIBIDN2_LIBRARY_DIRS`: The libidn2 library directories.
37
+ # - `LIBIDN2_CFLAGS`: Required compiler flags.
38
+ # - `LIBIDN2_VERSION`: Version of libidn2.
39
+
40
+ if(CURL_USE_PKGCONFIG AND
41
+ NOT DEFINED LIBIDN2_INCLUDE_DIR AND
42
+ NOT DEFINED LIBIDN2_LIBRARY)
43
+ find_package(PkgConfig QUIET)
44
+ pkg_check_modules(LIBIDN2 "libidn2")
45
+ endif()
46
+
47
+ if(LIBIDN2_FOUND)
48
+ string(REPLACE ";" " " LIBIDN2_CFLAGS "${LIBIDN2_CFLAGS}")
49
+ message(STATUS "Found Libidn2 (via pkg-config): ${LIBIDN2_INCLUDE_DIRS} (found version \"${LIBIDN2_VERSION}\")")
50
+ else()
51
+ find_path(LIBIDN2_INCLUDE_DIR NAMES "idn2.h")
52
+ find_library(LIBIDN2_LIBRARY NAMES "idn2" "libidn2")
53
+
54
+ unset(LIBIDN2_VERSION CACHE)
55
+ if(LIBIDN2_INCLUDE_DIR AND EXISTS "${LIBIDN2_INCLUDE_DIR}/idn2.h")
56
+ set(_version_regex "#[\t ]*define[\t ]+IDN2_VERSION[\t ]+\"([^\"]*)\"")
57
+ file(STRINGS "${LIBIDN2_INCLUDE_DIR}/idn2.h" _version_str REGEX "${_version_regex}")
58
+ string(REGEX REPLACE "${_version_regex}" "\\1" _version_str "${_version_str}")
59
+ set(LIBIDN2_VERSION "${_version_str}")
60
+ unset(_version_regex)
61
+ unset(_version_str)
62
+ endif()
63
+
64
+ include(FindPackageHandleStandardArgs)
65
+ find_package_handle_standard_args(Libidn2
66
+ REQUIRED_VARS
67
+ LIBIDN2_INCLUDE_DIR
68
+ LIBIDN2_LIBRARY
69
+ VERSION_VAR
70
+ LIBIDN2_VERSION
71
+ )
72
+
73
+ if(LIBIDN2_FOUND)
74
+ set(LIBIDN2_INCLUDE_DIRS ${LIBIDN2_INCLUDE_DIR})
75
+ set(LIBIDN2_LIBRARIES ${LIBIDN2_LIBRARY})
76
+ endif()
77
+
78
+ mark_as_advanced(LIBIDN2_INCLUDE_DIR LIBIDN2_LIBRARY)
79
+ endif()
afc-curl/CMake/FindLibpsl.cmake ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #***************************************************************************
2
+ # _ _ ____ _
3
+ # Project ___| | | | _ \| |
4
+ # / __| | | | |_) | |
5
+ # | (__| |_| | _ <| |___
6
+ # \___|\___/|_| \_\_____|
7
+ #
8
+ # Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
9
+ #
10
+ # This software is licensed as described in the file COPYING, which
11
+ # you should have received as part of this distribution. The terms
12
+ # are also available at https://curl.se/docs/copyright.html.
13
+ #
14
+ # You may opt to use, copy, modify, merge, publish, distribute and/or sell
15
+ # copies of the Software, and permit persons to whom the Software is
16
+ # furnished to do so, under the terms of the COPYING file.
17
+ #
18
+ # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19
+ # KIND, either express or implied.
20
+ #
21
+ # SPDX-License-Identifier: curl
22
+ #
23
+ ###########################################################################
24
+ # Find the libpsl library
25
+ #
26
+ # Input variables:
27
+ #
28
+ # - `LIBPSL_INCLUDE_DIR`: The libpsl include directory.
29
+ # - `LIBPSL_LIBRARY`: Path to `libpsl` library.
30
+ #
31
+ # Result variables:
32
+ #
33
+ # - `LIBPSL_FOUND`: System has libpsl.
34
+ # - `LIBPSL_INCLUDE_DIRS`: The libpsl include directories.
35
+ # - `LIBPSL_LIBRARIES`: The libpsl library names.
36
+ # - `LIBPSL_VERSION`: Version of libpsl.
37
+
38
+ if(CURL_USE_PKGCONFIG)
39
+ find_package(PkgConfig QUIET)
40
+ pkg_check_modules(PC_LIBPSL "libpsl")
41
+ endif()
42
+
43
+ find_path(LIBPSL_INCLUDE_DIR NAMES "libpsl.h"
44
+ HINTS
45
+ ${PC_LIBPSL_INCLUDEDIR}
46
+ ${PC_LIBPSL_INCLUDE_DIRS}
47
+ )
48
+
49
+ find_library(LIBPSL_LIBRARY NAMES "psl" "libpsl"
50
+ HINTS
51
+ ${PC_LIBPSL_LIBDIR}
52
+ ${PC_LIBPSL_LIBRARY_DIRS}
53
+ )
54
+
55
+ if(PC_LIBPSL_VERSION)
56
+ set(LIBPSL_VERSION ${PC_LIBPSL_VERSION})
57
+ elseif(LIBPSL_INCLUDE_DIR AND EXISTS "${LIBPSL_INCLUDE_DIR}/libpsl.h")
58
+ set(_version_regex "#[\t ]*define[\t ]+PSL_VERSION[\t ]+\"([^\"]*)\"")
59
+ file(STRINGS "${LIBPSL_INCLUDE_DIR}/libpsl.h" _version_str REGEX "${_version_regex}")
60
+ string(REGEX REPLACE "${_version_regex}" "\\1" _version_str "${_version_str}")
61
+ set(LIBPSL_VERSION "${_version_str}")
62
+ unset(_version_regex)
63
+ unset(_version_str)
64
+ endif()
65
+
66
+ include(FindPackageHandleStandardArgs)
67
+ find_package_handle_standard_args(Libpsl
68
+ REQUIRED_VARS
69
+ LIBPSL_INCLUDE_DIR
70
+ LIBPSL_LIBRARY
71
+ VERSION_VAR
72
+ LIBPSL_VERSION
73
+ )
74
+
75
+ if(LIBPSL_FOUND)
76
+ set(LIBPSL_INCLUDE_DIRS ${LIBPSL_INCLUDE_DIR})
77
+ set(LIBPSL_LIBRARIES ${LIBPSL_LIBRARY})
78
+ endif()
79
+
80
+ mark_as_advanced(LIBPSL_INCLUDE_DIR LIBPSL_LIBRARY)
afc-curl/CMake/FindLibssh.cmake ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #***************************************************************************
2
+ # _ _ ____ _
3
+ # Project ___| | | | _ \| |
4
+ # / __| | | | |_) | |
5
+ # | (__| |_| | _ <| |___
6
+ # \___|\___/|_| \_\_____|
7
+ #
8
+ # Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
9
+ #
10
+ # This software is licensed as described in the file COPYING, which
11
+ # you should have received as part of this distribution. The terms
12
+ # are also available at https://curl.se/docs/copyright.html.
13
+ #
14
+ # You may opt to use, copy, modify, merge, publish, distribute and/or sell
15
+ # copies of the Software, and permit persons to whom the Software is
16
+ # furnished to do so, under the terms of the COPYING file.
17
+ #
18
+ # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19
+ # KIND, either express or implied.
20
+ #
21
+ # SPDX-License-Identifier: curl
22
+ #
23
+ ###########################################################################
24
+ # Find the libssh library
25
+ #
26
+ # Input variables:
27
+ #
28
+ # LIBSSH_INCLUDE_DIR The libssh include directory.
29
+ # LIBSSH_LIBRARY Path to libssh library.
30
+ #
31
+ # Result variables:
32
+ #
33
+ # LIBSSH_FOUND System has libssh.
34
+ # LIBSSH_INCLUDE_DIRS The libssh include directories.
35
+ # LIBSSH_LIBRARIES The libssh library names.
36
+ # LIBSSH_LIBRARY_DIRS The libssh library directories.
37
+ # LIBSSH_CFLAGS Required compiler flags.
38
+ # LIBSSH_VERSION Version of libssh.
39
+
40
+ if(CURL_USE_PKGCONFIG AND
41
+ NOT DEFINED LIBSSH_INCLUDE_DIR AND
42
+ NOT DEFINED LIBSSH_LIBRARY)
43
+ find_package(PkgConfig QUIET)
44
+ pkg_check_modules(LIBSSH "libssh")
45
+ endif()
46
+
47
+ if(LIBSSH_FOUND)
48
+ string(REPLACE ";" " " LIBSSH_CFLAGS "${LIBSSH_CFLAGS}")
49
+ message(STATUS "Found Libssh (via pkg-config): ${LIBSSH_INCLUDE_DIRS} (found version \"${LIBSSH_VERSION}\")")
50
+ else()
51
+ find_path(LIBSSH_INCLUDE_DIR NAMES "libssh/libssh.h")
52
+ find_library(LIBSSH_LIBRARY NAMES "ssh" "libssh")
53
+
54
+ unset(LIBSSH_VERSION CACHE)
55
+ if(LIBSSH_INCLUDE_DIR AND EXISTS "${LIBSSH_INCLUDE_DIR}/libssh/libssh_version.h")
56
+ set(_version_regex1 "#[\t ]*define[\t ]+LIBSSH_VERSION_MAJOR[\t ]+([0-9]+).*")
57
+ set(_version_regex2 "#[\t ]*define[\t ]+LIBSSH_VERSION_MINOR[\t ]+([0-9]+).*")
58
+ set(_version_regex3 "#[\t ]*define[\t ]+LIBSSH_VERSION_MICRO[\t ]+([0-9]+).*")
59
+ file(STRINGS "${LIBSSH_INCLUDE_DIR}/libssh/libssh_version.h" _version_str1 REGEX "${_version_regex1}")
60
+ file(STRINGS "${LIBSSH_INCLUDE_DIR}/libssh/libssh_version.h" _version_str2 REGEX "${_version_regex2}")
61
+ file(STRINGS "${LIBSSH_INCLUDE_DIR}/libssh/libssh_version.h" _version_str3 REGEX "${_version_regex3}")
62
+ string(REGEX REPLACE "${_version_regex1}" "\\1" _version_str1 "${_version_str1}")
63
+ string(REGEX REPLACE "${_version_regex2}" "\\1" _version_str2 "${_version_str2}")
64
+ string(REGEX REPLACE "${_version_regex3}" "\\1" _version_str3 "${_version_str3}")
65
+ set(LIBSSH_VERSION "${_version_str1}.${_version_str2}.${_version_str3}")
66
+ unset(_version_regex1)
67
+ unset(_version_regex2)
68
+ unset(_version_regex3)
69
+ unset(_version_str1)
70
+ unset(_version_str2)
71
+ unset(_version_str3)
72
+ endif()
73
+
74
+ include(FindPackageHandleStandardArgs)
75
+ find_package_handle_standard_args(Libssh
76
+ REQUIRED_VARS
77
+ LIBSSH_INCLUDE_DIR
78
+ LIBSSH_LIBRARY
79
+ VERSION_VAR
80
+ LIBSSH_VERSION
81
+ )
82
+
83
+ if(LIBSSH_FOUND)
84
+ set(LIBSSH_INCLUDE_DIRS ${LIBSSH_INCLUDE_DIR})
85
+ set(LIBSSH_LIBRARIES ${LIBSSH_LIBRARY})
86
+ endif()
87
+
88
+ mark_as_advanced(LIBSSH_INCLUDE_DIR LIBSSH_LIBRARY)
89
+ endif()
90
+
91
+ if(LIBSSH_FOUND AND WIN32)
92
+ list(APPEND LIBSSH_LIBRARIES "iphlpapi") # for if_nametoindex
93
+ endif()
afc-curl/CMake/FindLibssh2.cmake ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #***************************************************************************
2
+ # _ _ ____ _
3
+ # Project ___| | | | _ \| |
4
+ # / __| | | | |_) | |
5
+ # | (__| |_| | _ <| |___
6
+ # \___|\___/|_| \_\_____|
7
+ #
8
+ # Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
9
+ #
10
+ # This software is licensed as described in the file COPYING, which
11
+ # you should have received as part of this distribution. The terms
12
+ # are also available at https://curl.se/docs/copyright.html.
13
+ #
14
+ # You may opt to use, copy, modify, merge, publish, distribute and/or sell
15
+ # copies of the Software, and permit persons to whom the Software is
16
+ # furnished to do so, under the terms of the COPYING file.
17
+ #
18
+ # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19
+ # KIND, either express or implied.
20
+ #
21
+ # SPDX-License-Identifier: curl
22
+ #
23
+ ###########################################################################
24
+ # Find the libssh2 library
25
+ #
26
+ # Input variables:
27
+ #
28
+ # - `LIBSSH2_INCLUDE_DIR`: The libssh2 include directory.
29
+ # - `LIBSSH2_LIBRARY`: Path to `libssh2` library.
30
+ #
31
+ # Result variables:
32
+ #
33
+ # - `LIBSSH2_FOUND`: System has libssh2.
34
+ # - `LIBSSH2_INCLUDE_DIRS`: The libssh2 include directories.
35
+ # - `LIBSSH2_LIBRARIES`: The libssh2 library names.
36
+ # - `LIBSSH2_VERSION`: Version of libssh2.
37
+
38
+ if(CURL_USE_PKGCONFIG)
39
+ find_package(PkgConfig QUIET)
40
+ pkg_check_modules(PC_LIBSSH2 "libssh2")
41
+ endif()
42
+
43
+ find_path(LIBSSH2_INCLUDE_DIR NAMES "libssh2.h"
44
+ HINTS
45
+ ${PC_LIBSSH2_INCLUDEDIR}
46
+ ${PC_LIBSSH2_INCLUDE_DIRS}
47
+ )
48
+
49
+ find_library(LIBSSH2_LIBRARY NAMES "ssh2" "libssh2"
50
+ HINTS
51
+ ${PC_LIBSSH2_LIBDIR}
52
+ ${PC_LIBSSH2_LIBRARY_DIRS}
53
+ )
54
+
55
+ if(PC_LIBSSH2_VERSION)
56
+ set(LIBSSH2_VERSION ${PC_LIBSSH2_VERSION})
57
+ elseif(LIBSSH2_INCLUDE_DIR AND EXISTS "${LIBSSH2_INCLUDE_DIR}/libssh2.h")
58
+ set(_version_regex "#[\t ]*define[\t ]+LIBSSH2_VERSION[\t ]+\"([^\"]*)\"")
59
+ file(STRINGS "${LIBSSH2_INCLUDE_DIR}/libssh2.h" _version_str REGEX "${_version_regex}")
60
+ string(REGEX REPLACE "${_version_regex}" "\\1" _version_str "${_version_str}")
61
+ set(LIBSSH2_VERSION "${_version_str}")
62
+ unset(_version_regex)
63
+ unset(_version_str)
64
+ endif()
65
+
66
+ include(FindPackageHandleStandardArgs)
67
+ find_package_handle_standard_args(Libssh2
68
+ REQUIRED_VARS
69
+ LIBSSH2_INCLUDE_DIR
70
+ LIBSSH2_LIBRARY
71
+ VERSION_VAR
72
+ LIBSSH2_VERSION
73
+ )
74
+
75
+ if(LIBSSH2_FOUND)
76
+ set(LIBSSH2_INCLUDE_DIRS ${LIBSSH2_INCLUDE_DIR})
77
+ set(LIBSSH2_LIBRARIES ${LIBSSH2_LIBRARY})
78
+ endif()
79
+
80
+ mark_as_advanced(LIBSSH2_INCLUDE_DIR LIBSSH2_LIBRARY)
afc-curl/CMake/FindLibuv.cmake ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #***************************************************************************
2
+ # _ _ ____ _
3
+ # Project ___| | | | _ \| |
4
+ # / __| | | | |_) | |
5
+ # | (__| |_| | _ <| |___
6
+ # \___|\___/|_| \_\_____|
7
+ #
8
+ # Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
9
+ #
10
+ # This software is licensed as described in the file COPYING, which
11
+ # you should have received as part of this distribution. The terms
12
+ # are also available at https://curl.se/docs/copyright.html.
13
+ #
14
+ # You may opt to use, copy, modify, merge, publish, distribute and/or sell
15
+ # copies of the Software, and permit persons to whom the Software is
16
+ # furnished to do so, under the terms of the COPYING file.
17
+ #
18
+ # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19
+ # KIND, either express or implied.
20
+ #
21
+ # SPDX-License-Identifier: curl
22
+ #
23
+ ###########################################################################
24
+ # Find the libuv library
25
+ #
26
+ # Input variables:
27
+ #
28
+ # - `LIBUV_INCLUDE_DIR`: The libuv include directory.
29
+ # - `LIBUV_LIBRARY`: Path to `libuv` library.
30
+ #
31
+ # Result variables:
32
+ #
33
+ # - `LIBUV_FOUND`: System has libuv.
34
+ # - `LIBUV_INCLUDE_DIRS`: The libuv include directories.
35
+ # - `LIBUV_LIBRARIES`: The libuv library names.
36
+ # - `LIBUV_LIBRARY_DIRS`: The libuv library directories.
37
+ # - `LIBUV_CFLAGS`: Required compiler flags.
38
+ # - `LIBUV_VERSION`: Version of libuv.
39
+
40
+ if(CURL_USE_PKGCONFIG AND
41
+ NOT DEFINED LIBUV_INCLUDE_DIR AND
42
+ NOT DEFINED LIBUV_LIBRARY)
43
+ find_package(PkgConfig QUIET)
44
+ pkg_check_modules(LIBUV "libuv")
45
+ endif()
46
+
47
+ if(LIBUV_FOUND)
48
+ string(REPLACE ";" " " LIBUV_CFLAGS "${LIBUV_CFLAGS}")
49
+ message(STATUS "Found Libuv (via pkg-config): ${LIBUV_INCLUDE_DIRS} (found version \"${LIBUV_VERSION}\")")
50
+ else()
51
+ find_path(LIBUV_INCLUDE_DIR NAMES "uv.h")
52
+ find_library(LIBUV_LIBRARY NAMES "uv" "libuv")
53
+
54
+ unset(LIBUV_VERSION CACHE)
55
+ if(LIBUV_INCLUDE_DIR AND EXISTS "${LIBUV_INCLUDE_DIR}/uv/version.h")
56
+ set(_version_regex1 "#[\t ]*define[\t ]+UV_VERSION_MAJOR[\t ]+([0-9]+).*")
57
+ set(_version_regex2 "#[\t ]*define[\t ]+UV_VERSION_MINOR[\t ]+([0-9]+).*")
58
+ set(_version_regex3 "#[\t ]*define[\t ]+UV_VERSION_PATCH[\t ]+([0-9]+).*")
59
+ file(STRINGS "${LIBUV_INCLUDE_DIR}/uv/version.h" _version_str1 REGEX "${_version_regex1}")
60
+ file(STRINGS "${LIBUV_INCLUDE_DIR}/uv/version.h" _version_str2 REGEX "${_version_regex2}")
61
+ file(STRINGS "${LIBUV_INCLUDE_DIR}/uv/version.h" _version_str3 REGEX "${_version_regex3}")
62
+ string(REGEX REPLACE "${_version_regex1}" "\\1" _version_str1 "${_version_str1}")
63
+ string(REGEX REPLACE "${_version_regex2}" "\\1" _version_str2 "${_version_str2}")
64
+ string(REGEX REPLACE "${_version_regex3}" "\\1" _version_str3 "${_version_str3}")
65
+ set(LIBUV_VERSION "${_version_str1}.${_version_str2}.${_version_str3}")
66
+ unset(_version_regex1)
67
+ unset(_version_regex2)
68
+ unset(_version_regex3)
69
+ unset(_version_str1)
70
+ unset(_version_str2)
71
+ unset(_version_str3)
72
+ endif()
73
+
74
+ include(FindPackageHandleStandardArgs)
75
+ find_package_handle_standard_args(Libuv
76
+ REQUIRED_VARS
77
+ LIBUV_INCLUDE_DIR
78
+ LIBUV_LIBRARY
79
+ VERSION_VAR
80
+ LIBUV_VERSION
81
+ )
82
+
83
+ if(LIBUV_FOUND)
84
+ set(LIBUV_INCLUDE_DIRS ${LIBUV_INCLUDE_DIR})
85
+ set(LIBUV_LIBRARIES ${LIBUV_LIBRARY})
86
+ endif()
87
+
88
+ mark_as_advanced(LIBUV_INCLUDE_DIR LIBUV_LIBRARY)
89
+ endif()
afc-curl/CMake/FindMSH3.cmake ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #***************************************************************************
2
+ # _ _ ____ _
3
+ # Project ___| | | | _ \| |
4
+ # / __| | | | |_) | |
5
+ # | (__| |_| | _ <| |___
6
+ # \___|\___/|_| \_\_____|
7
+ #
8
+ # Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
9
+ #
10
+ # This software is licensed as described in the file COPYING, which
11
+ # you should have received as part of this distribution. The terms
12
+ # are also available at https://curl.se/docs/copyright.html.
13
+ #
14
+ # You may opt to use, copy, modify, merge, publish, distribute and/or sell
15
+ # copies of the Software, and permit persons to whom the Software is
16
+ # furnished to do so, under the terms of the COPYING file.
17
+ #
18
+ # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19
+ # KIND, either express or implied.
20
+ #
21
+ # SPDX-License-Identifier: curl
22
+ #
23
+ ###########################################################################
24
+ # Find the msh3 library
25
+ #
26
+ # Input variables:
27
+ #
28
+ # - `MSH3_INCLUDE_DIR`: The msh3 include directory.
29
+ # - `MSH3_LIBRARY`: Path to `msh3` library.
30
+ #
31
+ # Result variables:
32
+ #
33
+ # - `MSH3_FOUND`: System has msh3.
34
+ # - `MSH3_INCLUDE_DIRS`: The msh3 include directories.
35
+ # - `MSH3_LIBRARIES`: The msh3 library names.
36
+ # - `MSH3_LIBRARY_DIRS`: The msh3 library directories.
37
+ # - `MSH3_PC_REQUIRES`: The msh3 pkg-config packages.
38
+ # - `MSH3_CFLAGS`: Required compiler flags.
39
+ # - `MSH3_VERSION`: Version of msh3.
40
+
41
+ if(CURL_USE_PKGCONFIG AND
42
+ NOT DEFINED MSH3_INCLUDE_DIR AND
43
+ NOT DEFINED MSH3_LIBRARY)
44
+ find_package(PkgConfig QUIET)
45
+ pkg_check_modules(MSH3 "libmsh3")
46
+ endif()
47
+
48
+ if(MSH3_FOUND)
49
+ set(MSH3_PC_REQUIRES "libmsh3")
50
+ string(REPLACE ";" " " MSH3_CFLAGS "${MSH3_CFLAGS}")
51
+ message(STATUS "Found MSH3 (via pkg-config): ${MSH3_INCLUDE_DIRS} (found version \"${MSH3_VERSION}\")")
52
+ else()
53
+ find_path(MSH3_INCLUDE_DIR NAMES "msh3.h")
54
+ find_library(MSH3_LIBRARY NAMES "msh3")
55
+
56
+ include(FindPackageHandleStandardArgs)
57
+ find_package_handle_standard_args(MSH3
58
+ REQUIRED_VARS
59
+ MSH3_INCLUDE_DIR
60
+ MSH3_LIBRARY
61
+ )
62
+
63
+ if(MSH3_FOUND)
64
+ set(MSH3_INCLUDE_DIRS ${MSH3_INCLUDE_DIR})
65
+ set(MSH3_LIBRARIES ${MSH3_LIBRARY})
66
+ endif()
67
+
68
+ mark_as_advanced(MSH3_INCLUDE_DIR MSH3_LIBRARY)
69
+ endif()
afc-curl/CMake/FindMbedTLS.cmake ADDED
@@ -0,0 +1,109 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #***************************************************************************
2
+ # _ _ ____ _
3
+ # Project ___| | | | _ \| |
4
+ # / __| | | | |_) | |
5
+ # | (__| |_| | _ <| |___
6
+ # \___|\___/|_| \_\_____|
7
+ #
8
+ # Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
9
+ #
10
+ # This software is licensed as described in the file COPYING, which
11
+ # you should have received as part of this distribution. The terms
12
+ # are also available at https://curl.se/docs/copyright.html.
13
+ #
14
+ # You may opt to use, copy, modify, merge, publish, distribute and/or sell
15
+ # copies of the Software, and permit persons to whom the Software is
16
+ # furnished to do so, under the terms of the COPYING file.
17
+ #
18
+ # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19
+ # KIND, either express or implied.
20
+ #
21
+ # SPDX-License-Identifier: curl
22
+ #
23
+ ###########################################################################
24
+ # Find the mbedTLS library
25
+ #
26
+ # Input variables:
27
+ #
28
+ # - `MBEDTLS_INCLUDE_DIR`: The mbedTLS include directory.
29
+ # - `MBEDTLS_LIBRARY`: Path to `mbedtls` library.
30
+ # - `MBEDX509_LIBRARY`: Path to `mbedx509` library.
31
+ # - `MBEDCRYPTO_LIBRARY`: Path to `mbedcrypto` library.
32
+ #
33
+ # Result variables:
34
+ #
35
+ # - `MBEDTLS_FOUND`: System has mbedTLS.
36
+ # - `MBEDTLS_INCLUDE_DIRS`: The mbedTLS include directories.
37
+ # - `MBEDTLS_LIBRARIES`: The mbedTLS library names.
38
+ # - `MBEDTLS_LIBRARY_DIRS`: The mbedTLS library directories.
39
+ # - `MBEDTLS_PC_REQUIRES`: The mbedTLS pkg-config packages.
40
+ # - `MBEDTLS_CFLAGS`: Required compiler flags.
41
+ # - `MBEDTLS_VERSION`: Version of mbedTLS.
42
+
43
+ if(DEFINED MBEDTLS_INCLUDE_DIRS AND NOT DEFINED MBEDTLS_INCLUDE_DIR)
44
+ message(WARNING "MBEDTLS_INCLUDE_DIRS is deprecated, use MBEDTLS_INCLUDE_DIR instead.")
45
+ set(MBEDTLS_INCLUDE_DIR "${MBEDTLS_INCLUDE_DIRS}")
46
+ unset(MBEDTLS_INCLUDE_DIRS)
47
+ endif()
48
+
49
+ if(CURL_USE_PKGCONFIG AND
50
+ NOT DEFINED MBEDTLS_INCLUDE_DIR AND
51
+ NOT DEFINED MBEDTLS_LIBRARY AND
52
+ NOT DEFINED MBEDX509_LIBRARY AND
53
+ NOT DEFINED MBEDCRYPTO_LIBRARY)
54
+ find_package(PkgConfig QUIET)
55
+ pkg_check_modules(MBEDTLS "mbedtls")
56
+ pkg_check_modules(MBEDX509 "mbedx509")
57
+ pkg_check_modules(MBEDCRYPTO "mbedcrypto")
58
+ endif()
59
+
60
+ if(MBEDTLS_FOUND AND MBEDX509_FOUND AND MBEDCRYPTO_FOUND)
61
+ list(APPEND MBEDTLS_LIBRARIES ${MBEDX509_LIBRARIES} ${MBEDCRYPTO_LIBRARIES})
62
+ list(REMOVE_DUPLICATES MBEDTLS_LIBRARIES)
63
+ set(MBEDTLS_PC_REQUIRES "mbedtls")
64
+ string(REPLACE ";" " " MBEDTLS_CFLAGS "${MBEDTLS_CFLAGS}")
65
+ message(STATUS "Found MbedTLS (via pkg-config): ${MBEDTLS_INCLUDE_DIRS} (found version \"${MBEDTLS_VERSION}\")")
66
+ else()
67
+ find_path(MBEDTLS_INCLUDE_DIR NAMES "mbedtls/ssl.h")
68
+ find_library(MBEDTLS_LIBRARY NAMES "mbedtls" "libmbedtls")
69
+ find_library(MBEDX509_LIBRARY NAMES "mbedx509" "libmbedx509")
70
+ find_library(MBEDCRYPTO_LIBRARY NAMES "mbedcrypto" "libmbedcrypto")
71
+
72
+ unset(MBEDTLS_VERSION CACHE)
73
+ if(MBEDTLS_INCLUDE_DIR)
74
+ if(EXISTS "${MBEDTLS_INCLUDE_DIR}/mbedtls/build_info.h") # 3.x
75
+ set(_version_header "${MBEDTLS_INCLUDE_DIR}/mbedtls/build_info.h")
76
+ elseif(EXISTS "${MBEDTLS_INCLUDE_DIR}/mbedtls/version.h") # 2.x
77
+ set(_version_header "${MBEDTLS_INCLUDE_DIR}/mbedtls/version.h")
78
+ else()
79
+ unset(_version_header)
80
+ endif()
81
+ if(_version_header)
82
+ set(_version_regex "#[\t ]*define[\t ]+MBEDTLS_VERSION_STRING[\t ]+\"([0-9.]+)\"")
83
+ file(STRINGS "${_version_header}" _version_str REGEX "${_version_regex}")
84
+ string(REGEX REPLACE "${_version_regex}" "\\1" _version_str "${_version_str}")
85
+ set(MBEDTLS_VERSION "${_version_str}")
86
+ unset(_version_regex)
87
+ unset(_version_str)
88
+ unset(_version_header)
89
+ endif()
90
+ endif()
91
+
92
+ include(FindPackageHandleStandardArgs)
93
+ find_package_handle_standard_args(MbedTLS
94
+ REQUIRED_VARS
95
+ MBEDTLS_INCLUDE_DIR
96
+ MBEDTLS_LIBRARY
97
+ MBEDX509_LIBRARY
98
+ MBEDCRYPTO_LIBRARY
99
+ VERSION_VAR
100
+ MBEDTLS_VERSION
101
+ )
102
+
103
+ if(MBEDTLS_FOUND)
104
+ set(MBEDTLS_INCLUDE_DIRS ${MBEDTLS_INCLUDE_DIR})
105
+ set(MBEDTLS_LIBRARIES ${MBEDTLS_LIBRARY} ${MBEDX509_LIBRARY} ${MBEDCRYPTO_LIBRARY})
106
+ endif()
107
+
108
+ mark_as_advanced(MBEDTLS_INCLUDE_DIR MBEDTLS_LIBRARY MBEDX509_LIBRARY MBEDCRYPTO_LIBRARY)
109
+ endif()
afc-curl/CMake/FindNGHTTP2.cmake ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #***************************************************************************
2
+ # _ _ ____ _
3
+ # Project ___| | | | _ \| |
4
+ # / __| | | | |_) | |
5
+ # | (__| |_| | _ <| |___
6
+ # \___|\___/|_| \_\_____|
7
+ #
8
+ # Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
9
+ #
10
+ # This software is licensed as described in the file COPYING, which
11
+ # you should have received as part of this distribution. The terms
12
+ # are also available at https://curl.se/docs/copyright.html.
13
+ #
14
+ # You may opt to use, copy, modify, merge, publish, distribute and/or sell
15
+ # copies of the Software, and permit persons to whom the Software is
16
+ # furnished to do so, under the terms of the COPYING file.
17
+ #
18
+ # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19
+ # KIND, either express or implied.
20
+ #
21
+ # SPDX-License-Identifier: curl
22
+ #
23
+ ###########################################################################
24
+ # Find the nghttp2 library
25
+ #
26
+ # Input variables:
27
+ #
28
+ # - `NGHTTP2_INCLUDE_DIR`: The nghttp2 include directory.
29
+ # - `NGHTTP2_LIBRARY`: Path to `nghttp2` library.
30
+ #
31
+ # Result variables:
32
+ #
33
+ # - `NGHTTP2_FOUND`: System has nghttp2.
34
+ # - `NGHTTP2_INCLUDE_DIRS`: The nghttp2 include directories.
35
+ # - `NGHTTP2_LIBRARIES`: The nghttp2 library names.
36
+ # - `NGHTTP2_VERSION`: Version of nghttp2.
37
+
38
+ if(CURL_USE_PKGCONFIG)
39
+ find_package(PkgConfig QUIET)
40
+ pkg_check_modules(PC_NGHTTP2 "libnghttp2")
41
+ endif()
42
+
43
+ find_path(NGHTTP2_INCLUDE_DIR NAMES "nghttp2/nghttp2.h"
44
+ HINTS
45
+ ${PC_NGHTTP2_INCLUDEDIR}
46
+ ${PC_NGHTTP2_INCLUDE_DIRS}
47
+ )
48
+
49
+ find_library(NGHTTP2_LIBRARY NAMES "nghttp2" "nghttp2_static"
50
+ HINTS
51
+ ${PC_NGHTTP2_LIBDIR}
52
+ ${PC_NGHTTP2_LIBRARY_DIRS}
53
+ )
54
+
55
+ if(PC_NGHTTP2_VERSION)
56
+ set(NGHTTP2_VERSION ${PC_NGHTTP2_VERSION})
57
+ elseif(NGHTTP2_INCLUDE_DIR AND EXISTS "${NGHTTP2_INCLUDE_DIR}/nghttp2/nghttp2ver.h")
58
+ set(_version_regex "#[\t ]*define[\t ]+NGHTTP2_VERSION[\t ]+\"([^\"]*)\"")
59
+ file(STRINGS "${NGHTTP2_INCLUDE_DIR}/nghttp2/nghttp2ver.h" _version_str REGEX "${_version_regex}")
60
+ string(REGEX REPLACE "${_version_regex}" "\\1" _version_str "${_version_str}")
61
+ set(NGHTTP2_VERSION "${_version_str}")
62
+ unset(_version_regex)
63
+ unset(_version_str)
64
+ endif()
65
+
66
+ include(FindPackageHandleStandardArgs)
67
+ find_package_handle_standard_args(NGHTTP2
68
+ REQUIRED_VARS
69
+ NGHTTP2_INCLUDE_DIR
70
+ NGHTTP2_LIBRARY
71
+ VERSION_VAR
72
+ NGHTTP2_VERSION
73
+ )
74
+
75
+ if(NGHTTP2_FOUND)
76
+ set(NGHTTP2_INCLUDE_DIRS ${NGHTTP2_INCLUDE_DIR})
77
+ set(NGHTTP2_LIBRARIES ${NGHTTP2_LIBRARY})
78
+ endif()
79
+
80
+ mark_as_advanced(NGHTTP2_INCLUDE_DIR NGHTTP2_LIBRARY)
afc-curl/CMake/FindNGHTTP3.cmake ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #***************************************************************************
2
+ # _ _ ____ _
3
+ # Project ___| | | | _ \| |
4
+ # / __| | | | |_) | |
5
+ # | (__| |_| | _ <| |___
6
+ # \___|\___/|_| \_\_____|
7
+ #
8
+ # Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
9
+ #
10
+ # This software is licensed as described in the file COPYING, which
11
+ # you should have received as part of this distribution. The terms
12
+ # are also available at https://curl.se/docs/copyright.html.
13
+ #
14
+ # You may opt to use, copy, modify, merge, publish, distribute and/or sell
15
+ # copies of the Software, and permit persons to whom the Software is
16
+ # furnished to do so, under the terms of the COPYING file.
17
+ #
18
+ # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19
+ # KIND, either express or implied.
20
+ #
21
+ # SPDX-License-Identifier: curl
22
+ #
23
+ ###########################################################################
24
+ # Find the nghttp3 library
25
+ #
26
+ # Input variables:
27
+ #
28
+ # - `NGHTTP3_INCLUDE_DIR`: The nghttp3 include directory.
29
+ # - `NGHTTP3_LIBRARY`: Path to `nghttp3` library.
30
+ #
31
+ # Result variables:
32
+ #
33
+ # - `NGHTTP3_FOUND`: System has nghttp3.
34
+ # - `NGHTTP3_INCLUDE_DIRS`: The nghttp3 include directories.
35
+ # - `NGHTTP3_LIBRARIES`: The nghttp3 library names.
36
+ # - `NGHTTP3_VERSION`: Version of nghttp3.
37
+
38
+ if(CURL_USE_PKGCONFIG)
39
+ find_package(PkgConfig QUIET)
40
+ pkg_check_modules(PC_NGHTTP3 "libnghttp3")
41
+ endif()
42
+
43
+ find_path(NGHTTP3_INCLUDE_DIR NAMES "nghttp3/nghttp3.h"
44
+ HINTS
45
+ ${PC_NGHTTP3_INCLUDEDIR}
46
+ ${PC_NGHTTP3_INCLUDE_DIRS}
47
+ )
48
+
49
+ find_library(NGHTTP3_LIBRARY NAMES "nghttp3"
50
+ HINTS
51
+ ${PC_NGHTTP3_LIBDIR}
52
+ ${PC_NGHTTP3_LIBRARY_DIRS}
53
+ )
54
+
55
+ if(PC_NGHTTP3_VERSION)
56
+ set(NGHTTP3_VERSION ${PC_NGHTTP3_VERSION})
57
+ elseif(NGHTTP3_INCLUDE_DIR AND EXISTS "${NGHTTP3_INCLUDE_DIR}/nghttp3/version.h")
58
+ set(_version_regex "#[\t ]*define[\t ]+NGHTTP3_VERSION[\t ]+\"([^\"]*)\"")
59
+ file(STRINGS "${NGHTTP3_INCLUDE_DIR}/nghttp3/version.h" _version_str REGEX "${_version_regex}")
60
+ string(REGEX REPLACE "${_version_regex}" "\\1" _version_str "${_version_str}")
61
+ set(NGHTTP3_VERSION "${_version_str}")
62
+ unset(_version_regex)
63
+ unset(_version_str)
64
+ endif()
65
+
66
+ include(FindPackageHandleStandardArgs)
67
+ find_package_handle_standard_args(NGHTTP3
68
+ REQUIRED_VARS
69
+ NGHTTP3_INCLUDE_DIR
70
+ NGHTTP3_LIBRARY
71
+ VERSION_VAR
72
+ NGHTTP3_VERSION
73
+ )
74
+
75
+ if(NGHTTP3_FOUND)
76
+ set(NGHTTP3_INCLUDE_DIRS ${NGHTTP3_INCLUDE_DIR})
77
+ set(NGHTTP3_LIBRARIES ${NGHTTP3_LIBRARY})
78
+ endif()
79
+
80
+ mark_as_advanced(NGHTTP3_INCLUDE_DIR NGHTTP3_LIBRARY)
afc-curl/CMake/FindNGTCP2.cmake ADDED
@@ -0,0 +1,122 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #***************************************************************************
2
+ # _ _ ____ _
3
+ # Project ___| | | | _ \| |
4
+ # / __| | | | |_) | |
5
+ # | (__| |_| | _ <| |___
6
+ # \___|\___/|_| \_\_____|
7
+ #
8
+ # Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
9
+ #
10
+ # This software is licensed as described in the file COPYING, which
11
+ # you should have received as part of this distribution. The terms
12
+ # are also available at https://curl.se/docs/copyright.html.
13
+ #
14
+ # You may opt to use, copy, modify, merge, publish, distribute and/or sell
15
+ # copies of the Software, and permit persons to whom the Software is
16
+ # furnished to do so, under the terms of the COPYING file.
17
+ #
18
+ # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19
+ # KIND, either express or implied.
20
+ #
21
+ # SPDX-License-Identifier: curl
22
+ #
23
+ ###########################################################################
24
+ # Find the ngtcp2 library
25
+ #
26
+ # This module accepts optional COMPONENTS to control the crypto library (these are
27
+ # mutually exclusive):
28
+ #
29
+ # - quictls: Use `libngtcp2_crypto_quictls`. (choose this for LibreSSL)
30
+ # - BoringSSL: Use `libngtcp2_crypto_boringssl`. (choose this for AWS-LC)
31
+ # - wolfSSL: Use `libngtcp2_crypto_wolfssl`.
32
+ # - GnuTLS: Use `libngtcp2_crypto_gnutls`.
33
+ #
34
+ # Input variables:
35
+ #
36
+ # - `NGTCP2_INCLUDE_DIR`: The ngtcp2 include directory.
37
+ # - `NGTCP2_LIBRARY`: Path to `ngtcp2` library.
38
+ #
39
+ # Result variables:
40
+ #
41
+ # - `NGTCP2_FOUND`: System has ngtcp2.
42
+ # - `NGTCP2_INCLUDE_DIRS`: The ngtcp2 include directories.
43
+ # - `NGTCP2_LIBRARIES`: The ngtcp2 library names.
44
+ # - `NGTCP2_VERSION`: Version of ngtcp2.
45
+
46
+ if(CURL_USE_PKGCONFIG)
47
+ find_package(PkgConfig QUIET)
48
+ pkg_check_modules(PC_NGTCP2 "libngtcp2")
49
+ endif()
50
+
51
+ find_path(NGTCP2_INCLUDE_DIR NAMES "ngtcp2/ngtcp2.h"
52
+ HINTS
53
+ ${PC_NGTCP2_INCLUDEDIR}
54
+ ${PC_NGTCP2_INCLUDE_DIRS}
55
+ )
56
+
57
+ find_library(NGTCP2_LIBRARY NAMES "ngtcp2"
58
+ HINTS
59
+ ${PC_NGTCP2_LIBDIR}
60
+ ${PC_NGTCP2_LIBRARY_DIRS}
61
+ )
62
+
63
+ if(PC_NGTCP2_VERSION)
64
+ set(NGTCP2_VERSION ${PC_NGTCP2_VERSION})
65
+ elseif(NGTCP2_INCLUDE_DIR AND EXISTS "${NGTCP2_INCLUDE_DIR}/ngtcp2/version.h")
66
+ set(_version_regex "#[\t ]*define[\t ]+NGTCP2_VERSION[\t ]+\"([^\"]*)\"")
67
+ file(STRINGS "${NGTCP2_INCLUDE_DIR}/ngtcp2/version.h" _version_str REGEX "${_version_regex}")
68
+ string(REGEX REPLACE "${_version_regex}" "\\1" _version_str "${_version_str}")
69
+ set(NGTCP2_VERSION "${_version_str}")
70
+ unset(_version_regex)
71
+ unset(_version_str)
72
+ endif()
73
+
74
+ if(NGTCP2_FIND_COMPONENTS)
75
+ set(_ngtcp2_crypto_backend "")
76
+ foreach(_component IN LISTS NGTCP2_FIND_COMPONENTS)
77
+ if(_component MATCHES "^(BoringSSL|quictls|wolfSSL|GnuTLS)")
78
+ if(_ngtcp2_crypto_backend)
79
+ message(FATAL_ERROR "NGTCP2: Only one crypto library can be selected")
80
+ endif()
81
+ set(_ngtcp2_crypto_backend ${_component})
82
+ endif()
83
+ endforeach()
84
+
85
+ if(_ngtcp2_crypto_backend)
86
+ string(TOLOWER "ngtcp2_crypto_${_ngtcp2_crypto_backend}" _crypto_library)
87
+
88
+ if(CURL_USE_PKGCONFIG)
89
+ pkg_check_modules(PC_${_crypto_library} "lib${_crypto_library}")
90
+ endif()
91
+
92
+ get_filename_component(_ngtcp2_library_dir "${NGTCP2_LIBRARY}" DIRECTORY)
93
+ find_library(${_crypto_library}_LIBRARY NAMES ${_crypto_library}
94
+ HINTS
95
+ ${_ngtcp2_library_dir}
96
+ ${PC_${_crypto_library}_LIBDIR}
97
+ ${PC_${_crypto_library}_LIBRARY_DIRS}
98
+ )
99
+
100
+ if(${_crypto_library}_LIBRARY)
101
+ set(NGTCP2_${_ngtcp2_crypto_backend}_FOUND TRUE)
102
+ set(NGTCP2_CRYPTO_LIBRARY ${${_crypto_library}_LIBRARY})
103
+ endif()
104
+ endif()
105
+ endif()
106
+
107
+ include(FindPackageHandleStandardArgs)
108
+ find_package_handle_standard_args(NGTCP2
109
+ REQUIRED_VARS
110
+ NGTCP2_INCLUDE_DIR
111
+ NGTCP2_LIBRARY
112
+ VERSION_VAR
113
+ NGTCP2_VERSION
114
+ HANDLE_COMPONENTS
115
+ )
116
+
117
+ if(NGTCP2_FOUND)
118
+ set(NGTCP2_INCLUDE_DIRS ${NGTCP2_INCLUDE_DIR})
119
+ set(NGTCP2_LIBRARIES ${NGTCP2_LIBRARY} ${NGTCP2_CRYPTO_LIBRARY})
120
+ endif()
121
+
122
+ mark_as_advanced(NGTCP2_INCLUDE_DIR NGTCP2_LIBRARY NGTCP2_CRYPTO_LIBRARY)
afc-curl/CMake/FindNettle.cmake ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #***************************************************************************
2
+ # _ _ ____ _
3
+ # Project ___| | | | _ \| |
4
+ # / __| | | | |_) | |
5
+ # | (__| |_| | _ <| |___
6
+ # \___|\___/|_| \_\_____|
7
+ #
8
+ # Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
9
+ #
10
+ # This software is licensed as described in the file COPYING, which
11
+ # you should have received as part of this distribution. The terms
12
+ # are also available at https://curl.se/docs/copyright.html.
13
+ #
14
+ # You may opt to use, copy, modify, merge, publish, distribute and/or sell
15
+ # copies of the Software, and permit persons to whom the Software is
16
+ # furnished to do so, under the terms of the COPYING file.
17
+ #
18
+ # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19
+ # KIND, either express or implied.
20
+ #
21
+ # SPDX-License-Identifier: curl
22
+ #
23
+ ###########################################################################
24
+ # Find the nettle library
25
+ #
26
+ # Input variables:
27
+ #
28
+ # - `NETTLE_INCLUDE_DIR`: The nettle include directory.
29
+ # - `NETTLE_LIBRARY`: Path to `nettle` library.
30
+ #
31
+ # Result variables:
32
+ #
33
+ # - `NETTLE_FOUND`: System has nettle.
34
+ # - `NETTLE_INCLUDE_DIRS`: The nettle include directories.
35
+ # - `NETTLE_LIBRARIES`: The nettle library names.
36
+ # - `NETTLE_LIBRARY_DIRS`: The nettle library directories.
37
+ # - `NETTLE_CFLAGS`: Required compiler flags.
38
+ # - `NETTLE_VERSION`: Version of nettle.
39
+
40
+ if(CURL_USE_PKGCONFIG AND
41
+ NOT DEFINED NETTLE_INCLUDE_DIR AND
42
+ NOT DEFINED NETTLE_LIBRARY)
43
+ find_package(PkgConfig QUIET)
44
+ pkg_check_modules(NETTLE "nettle")
45
+ endif()
46
+
47
+ if(NETTLE_FOUND)
48
+ string(REPLACE ";" " " NETTLE_CFLAGS "${NETTLE_CFLAGS}")
49
+ message(STATUS "Found Nettle (via pkg-config): ${NETTLE_INCLUDE_DIRS} (found version \"${NETTLE_VERSION}\")")
50
+ else()
51
+ find_path(NETTLE_INCLUDE_DIR NAMES "nettle/sha2.h")
52
+ find_library(NETTLE_LIBRARY NAMES "nettle")
53
+
54
+ unset(NETTLE_VERSION CACHE)
55
+ if(NETTLE_INCLUDE_DIR AND EXISTS "${NETTLE_INCLUDE_DIR}/nettle/version.h")
56
+ set(_version_regex1 "#[\t ]*define[ \t]+NETTLE_VERSION_MAJOR[ \t]+([0-9]+).*")
57
+ set(_version_regex2 "#[\t ]*define[ \t]+NETTLE_VERSION_MINOR[ \t]+([0-9]+).*")
58
+ file(STRINGS "${NETTLE_INCLUDE_DIR}/nettle/version.h" _version_str1 REGEX "${_version_regex1}")
59
+ file(STRINGS "${NETTLE_INCLUDE_DIR}/nettle/version.h" _version_str2 REGEX "${_version_regex2}")
60
+ string(REGEX REPLACE "${_version_regex1}" "\\1" _version_str1 "${_version_str1}")
61
+ string(REGEX REPLACE "${_version_regex2}" "\\1" _version_str2 "${_version_str2}")
62
+ set(NETTLE_VERSION "${_version_str1}.${_version_str2}")
63
+ unset(_version_regex1)
64
+ unset(_version_regex2)
65
+ unset(_version_str1)
66
+ unset(_version_str2)
67
+ endif()
68
+
69
+ include(FindPackageHandleStandardArgs)
70
+ find_package_handle_standard_args(Nettle
71
+ REQUIRED_VARS
72
+ NETTLE_INCLUDE_DIR
73
+ NETTLE_LIBRARY
74
+ VERSION_VAR
75
+ NETTLE_VERSION
76
+ )
77
+
78
+ if(NETTLE_FOUND)
79
+ set(NETTLE_INCLUDE_DIRS ${NETTLE_INCLUDE_DIR})
80
+ set(NETTLE_LIBRARIES ${NETTLE_LIBRARY})
81
+ endif()
82
+
83
+ mark_as_advanced(NETTLE_INCLUDE_DIR NETTLE_LIBRARY)
84
+ endif()
afc-curl/CMake/FindQuiche.cmake ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #***************************************************************************
2
+ # _ _ ____ _
3
+ # Project ___| | | | _ \| |
4
+ # / __| | | | |_) | |
5
+ # | (__| |_| | _ <| |___
6
+ # \___|\___/|_| \_\_____|
7
+ #
8
+ # Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
9
+ #
10
+ # This software is licensed as described in the file COPYING, which
11
+ # you should have received as part of this distribution. The terms
12
+ # are also available at https://curl.se/docs/copyright.html.
13
+ #
14
+ # You may opt to use, copy, modify, merge, publish, distribute and/or sell
15
+ # copies of the Software, and permit persons to whom the Software is
16
+ # furnished to do so, under the terms of the COPYING file.
17
+ #
18
+ # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19
+ # KIND, either express or implied.
20
+ #
21
+ # SPDX-License-Identifier: curl
22
+ #
23
+ ###########################################################################
24
+ # Find the quiche library
25
+ #
26
+ # Input variables:
27
+ #
28
+ # - `QUICHE_INCLUDE_DIR`: The quiche include directory.
29
+ # - `QUICHE_LIBRARY`: Path to `quiche` library.
30
+ #
31
+ # Result variables:
32
+ #
33
+ # - `QUICHE_FOUND`: System has quiche.
34
+ # - `QUICHE_INCLUDE_DIRS`: The quiche include directories.
35
+ # - `QUICHE_LIBRARIES`: The quiche library names.
36
+ # - `QUICHE_LIBRARY_DIRS`: The quiche library directories.
37
+ # - `QUICHE_CFLAGS`: Required compiler flags.
38
+ # - `QUICHE_VERSION`: Version of quiche.
39
+
40
+ if(CURL_USE_PKGCONFIG AND
41
+ NOT DEFINED QUICHE_INCLUDE_DIR AND
42
+ NOT DEFINED QUICHE_LIBRARY)
43
+ find_package(PkgConfig QUIET)
44
+ pkg_check_modules(QUICHE "quiche")
45
+ endif()
46
+
47
+ if(QUICHE_FOUND)
48
+ string(REPLACE ";" " " QUICHE_CFLAGS "${QUICHE_CFLAGS}")
49
+ message(STATUS "Found Quiche (via pkg-config): ${QUICHE_INCLUDE_DIRS} (found version \"${QUICHE_VERSION}\")")
50
+ else()
51
+ find_path(QUICHE_INCLUDE_DIR NAMES "quiche.h")
52
+ find_library(QUICHE_LIBRARY NAMES "quiche")
53
+
54
+ include(FindPackageHandleStandardArgs)
55
+ find_package_handle_standard_args(Quiche
56
+ REQUIRED_VARS
57
+ QUICHE_INCLUDE_DIR
58
+ QUICHE_LIBRARY
59
+ )
60
+
61
+ if(QUICHE_FOUND)
62
+ set(QUICHE_INCLUDE_DIRS ${QUICHE_INCLUDE_DIR})
63
+ set(QUICHE_LIBRARIES ${QUICHE_LIBRARY})
64
+ endif()
65
+
66
+ mark_as_advanced(QUICHE_INCLUDE_DIR QUICHE_LIBRARY)
67
+ endif()
afc-curl/CMake/FindRustls.cmake ADDED
@@ -0,0 +1,103 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #***************************************************************************
2
+ # _ _ ____ _
3
+ # Project ___| | | | _ \| |
4
+ # / __| | | | |_) | |
5
+ # | (__| |_| | _ <| |___
6
+ # \___|\___/|_| \_\_____|
7
+ #
8
+ # Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
9
+ #
10
+ # This software is licensed as described in the file COPYING, which
11
+ # you should have received as part of this distribution. The terms
12
+ # are also available at https://curl.se/docs/copyright.html.
13
+ #
14
+ # You may opt to use, copy, modify, merge, publish, distribute and/or sell
15
+ # copies of the Software, and permit persons to whom the Software is
16
+ # furnished to do so, under the terms of the COPYING file.
17
+ #
18
+ # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19
+ # KIND, either express or implied.
20
+ #
21
+ # SPDX-License-Identifier: curl
22
+ #
23
+ ###########################################################################
24
+ # Find the Rustls library
25
+ #
26
+ # Input variables:
27
+ #
28
+ # - `RUSTLS_INCLUDE_DIR`: The Rustls include directory.
29
+ # - `RUSTLS_LIBRARY`: Path to `rustls` library.
30
+ #
31
+ # Result variables:
32
+ #
33
+ # - `RUSTLS_FOUND`: System has Rustls.
34
+ # - `RUSTLS_INCLUDE_DIRS`: The Rustls include directories.
35
+ # - `RUSTLS_LIBRARIES`: The Rustls library names.
36
+ # - `RUSTLS_LIBRARY_DIRS`: The Rustls library directories.
37
+ # - `RUSTLS_PC_REQUIRES`: The Rustls pkg-config packages.
38
+ # - `RUSTLS_CFLAGS`: Required compiler flags.
39
+ # - `RUSTLS_VERSION`: Version of Rustls.
40
+
41
+ if(CURL_USE_PKGCONFIG AND
42
+ NOT DEFINED RUSTLS_INCLUDE_DIR AND
43
+ NOT DEFINED RUSTLS_LIBRARY)
44
+ find_package(PkgConfig QUIET)
45
+ pkg_check_modules(RUSTLS "rustls")
46
+ endif()
47
+
48
+ if(RUSTLS_FOUND)
49
+ set(RUSTLS_PC_REQUIRES "rustls")
50
+ string(REPLACE ";" " " RUSTLS_CFLAGS "${RUSTLS_CFLAGS}")
51
+ message(STATUS "Found Rustls (via pkg-config): ${RUSTLS_INCLUDE_DIRS} (found version \"${RUSTLS_VERSION}\")")
52
+ else()
53
+ find_path(RUSTLS_INCLUDE_DIR NAMES "rustls.h")
54
+ find_library(RUSTLS_LIBRARY NAMES "rustls")
55
+
56
+ include(FindPackageHandleStandardArgs)
57
+ find_package_handle_standard_args(Rustls
58
+ REQUIRED_VARS
59
+ RUSTLS_INCLUDE_DIR
60
+ RUSTLS_LIBRARY
61
+ )
62
+
63
+ if(RUSTLS_FOUND)
64
+ set(RUSTLS_INCLUDE_DIRS ${RUSTLS_INCLUDE_DIR})
65
+ set(RUSTLS_LIBRARIES ${RUSTLS_LIBRARY})
66
+ endif()
67
+
68
+ mark_as_advanced(RUSTLS_INCLUDE_DIR RUSTLS_LIBRARY)
69
+ endif()
70
+
71
+ if(APPLE)
72
+ find_library(SECURITY_FRAMEWORK "Security")
73
+ mark_as_advanced(SECURITY_FRAMEWORK)
74
+ if(NOT SECURITY_FRAMEWORK)
75
+ message(FATAL_ERROR "Security framework not found")
76
+ endif()
77
+ list(APPEND RUSTLS_LIBRARIES "-framework Security")
78
+
79
+ find_library(FOUNDATION_FRAMEWORK "Foundation")
80
+ mark_as_advanced(FOUNDATION_FRAMEWORK)
81
+ if(NOT FOUNDATION_FRAMEWORK)
82
+ message(FATAL_ERROR "Foundation framework not found")
83
+ endif()
84
+ list(APPEND RUSTLS_LIBRARIES "-framework Foundation")
85
+ elseif(NOT WIN32)
86
+ find_library(_pthread_library "pthread")
87
+ if(_pthread_library)
88
+ list(APPEND RUSTLS_LIBRARIES "pthread")
89
+ endif()
90
+ mark_as_advanced(_pthread_library)
91
+
92
+ find_library(_dl_library "dl")
93
+ if(_dl_library)
94
+ list(APPEND RUSTLS_LIBRARIES "dl")
95
+ endif()
96
+ mark_as_advanced(_dl_library)
97
+
98
+ find_library(_math_library "m")
99
+ if(_math_library)
100
+ list(APPEND RUSTLS_LIBRARIES "m")
101
+ endif()
102
+ mark_as_advanced(_math_library)
103
+ endif()
afc-curl/CMake/FindWolfSSH.cmake ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #***************************************************************************
2
+ # _ _ ____ _
3
+ # Project ___| | | | _ \| |
4
+ # / __| | | | |_) | |
5
+ # | (__| |_| | _ <| |___
6
+ # \___|\___/|_| \_\_____|
7
+ #
8
+ # Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
9
+ #
10
+ # This software is licensed as described in the file COPYING, which
11
+ # you should have received as part of this distribution. The terms
12
+ # are also available at https://curl.se/docs/copyright.html.
13
+ #
14
+ # You may opt to use, copy, modify, merge, publish, distribute and/or sell
15
+ # copies of the Software, and permit persons to whom the Software is
16
+ # furnished to do so, under the terms of the COPYING file.
17
+ #
18
+ # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19
+ # KIND, either express or implied.
20
+ #
21
+ # SPDX-License-Identifier: curl
22
+ #
23
+ ###########################################################################
24
+ # Find the wolfSSH library
25
+ #
26
+ # Input variables:
27
+ #
28
+ # - `WOLFSSH_INCLUDE_DIR`: The wolfSSH include directory.
29
+ # - `WOLFSSH_LIBRARY`: Path to `wolfssh` library.
30
+ #
31
+ # Result variables:
32
+ #
33
+ # - `WOLFSSH_FOUND`: System has wolfSSH.
34
+ # - `WOLFSSH_INCLUDE_DIRS`: The wolfSSH include directories.
35
+ # - `WOLFSSH_LIBRARIES`: The wolfSSH library names.
36
+ # - `WOLFSSH_VERSION`: Version of wolfSSH.
37
+
38
+ find_path(WOLFSSH_INCLUDE_DIR NAMES "wolfssh/ssh.h")
39
+ find_library(WOLFSSH_LIBRARY NAMES "wolfssh" "libwolfssh")
40
+
41
+ unset(WOLFSSH_VERSION CACHE)
42
+ if(WOLFSSH_INCLUDE_DIR AND EXISTS "${WOLFSSH_INCLUDE_DIR}/wolfssh/version.h")
43
+ set(_version_regex "#[\t ]*define[\t ]+LIBWOLFSSH_VERSION_STRING[\t ]+\"([^\"]*)\"")
44
+ file(STRINGS "${WOLFSSH_INCLUDE_DIR}/wolfssh/version.h" _version_str REGEX "${_version_regex}")
45
+ string(REGEX REPLACE "${_version_regex}" "\\1" _version_str "${_version_str}")
46
+ set(WOLFSSH_VERSION "${_version_str}")
47
+ unset(_version_regex)
48
+ unset(_version_str)
49
+ endif()
50
+
51
+ include(FindPackageHandleStandardArgs)
52
+ find_package_handle_standard_args(WolfSSH
53
+ REQUIRED_VARS
54
+ WOLFSSH_INCLUDE_DIR
55
+ WOLFSSH_LIBRARY
56
+ VERSION_VAR
57
+ WOLFSSH_VERSION
58
+ )
59
+
60
+ if(WOLFSSH_FOUND)
61
+ set(WOLFSSH_INCLUDE_DIRS ${WOLFSSH_INCLUDE_DIR})
62
+ set(WOLFSSH_LIBRARIES ${WOLFSSH_LIBRARY})
63
+ endif()
64
+
65
+ mark_as_advanced(WOLFSSH_INCLUDE_DIR WOLFSSH_LIBRARY)
afc-curl/CMake/FindWolfSSL.cmake ADDED
@@ -0,0 +1,96 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #***************************************************************************
2
+ # _ _ ____ _
3
+ # Project ___| | | | _ \| |
4
+ # / __| | | | |_) | |
5
+ # | (__| |_| | _ <| |___
6
+ # \___|\___/|_| \_\_____|
7
+ #
8
+ # Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
9
+ #
10
+ # This software is licensed as described in the file COPYING, which
11
+ # you should have received as part of this distribution. The terms
12
+ # are also available at https://curl.se/docs/copyright.html.
13
+ #
14
+ # You may opt to use, copy, modify, merge, publish, distribute and/or sell
15
+ # copies of the Software, and permit persons to whom the Software is
16
+ # furnished to do so, under the terms of the COPYING file.
17
+ #
18
+ # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19
+ # KIND, either express or implied.
20
+ #
21
+ # SPDX-License-Identifier: curl
22
+ #
23
+ ###########################################################################
24
+ # Find the wolfSSL library
25
+ #
26
+ # Input variables:
27
+ #
28
+ # - `WOLFSSL_INCLUDE_DIR`: The wolfSSL include directory.
29
+ # - `WOLFSSL_LIBRARY`: Path to `wolfssl` library.
30
+ #
31
+ # Result variables:
32
+ #
33
+ # - `WOLFSSL_FOUND`: System has wolfSSL.
34
+ # - `WOLFSSL_INCLUDE_DIRS`: The wolfSSL include directories.
35
+ # - `WOLFSSL_LIBRARIES`: The wolfSSL library names.
36
+ # - `WOLFSSL_LIBRARY_DIRS`: The wolfSSL library directories.
37
+ # - `WOLFSSL_CFLAGS`: Required compiler flags.
38
+ # - `WOLFSSL_VERSION`: Version of wolfSSL.
39
+
40
+ if(DEFINED WolfSSL_INCLUDE_DIR AND NOT DEFINED WOLFSSL_INCLUDE_DIR)
41
+ message(WARNING "WolfSSL_INCLUDE_DIR is deprecated, use WOLFSSL_INCLUDE_DIR instead.")
42
+ set(WOLFSSL_INCLUDE_DIR "${WolfSSL_INCLUDE_DIR}")
43
+ endif()
44
+ if(DEFINED WolfSSL_LIBRARY AND NOT DEFINED WOLFSSL_LIBRARY)
45
+ message(WARNING "WolfSSL_LIBRARY is deprecated, use WOLFSSL_LIBRARY instead.")
46
+ set(WOLFSSL_LIBRARY "${WolfSSL_LIBRARY}")
47
+ endif()
48
+
49
+ if(CURL_USE_PKGCONFIG AND
50
+ NOT DEFINED WOLFSSL_INCLUDE_DIR AND
51
+ NOT DEFINED WOLFSSL_LIBRARY)
52
+ find_package(PkgConfig QUIET)
53
+ pkg_check_modules(WOLFSSL "wolfssl")
54
+ endif()
55
+
56
+ if(WOLFSSL_FOUND)
57
+ string(REPLACE ";" " " WOLFSSL_CFLAGS "${WOLFSSL_CFLAGS}")
58
+ message(STATUS "Found WolfSSL (via pkg-config): ${WOLFSSL_INCLUDE_DIRS} (found version \"${WOLFSSL_VERSION}\")")
59
+ else()
60
+ find_path(WOLFSSL_INCLUDE_DIR NAMES "wolfssl/ssl.h")
61
+ find_library(WOLFSSL_LIBRARY NAMES "wolfssl")
62
+
63
+ unset(WOLFSSL_VERSION CACHE)
64
+ if(WOLFSSL_INCLUDE_DIR AND EXISTS "${WOLFSSL_INCLUDE_DIR}/wolfssl/version.h")
65
+ set(_version_regex "#[\t ]*define[\t ]+LIBWOLFSSL_VERSION_STRING[\t ]+\"([^\"]*)\"")
66
+ file(STRINGS "${WOLFSSL_INCLUDE_DIR}/wolfssl/version.h" _version_str REGEX "${_version_regex}")
67
+ string(REGEX REPLACE "${_version_regex}" "\\1" _version_str "${_version_str}")
68
+ set(WOLFSSL_VERSION "${_version_str}")
69
+ unset(_version_regex)
70
+ unset(_version_str)
71
+ endif()
72
+
73
+ include(FindPackageHandleStandardArgs)
74
+ find_package_handle_standard_args(WolfSSL
75
+ REQUIRED_VARS
76
+ WOLFSSL_INCLUDE_DIR
77
+ WOLFSSL_LIBRARY
78
+ VERSION_VAR
79
+ WOLFSSL_VERSION
80
+ )
81
+
82
+ if(WOLFSSL_FOUND)
83
+ set(WOLFSSL_INCLUDE_DIRS ${WOLFSSL_INCLUDE_DIR})
84
+ set(WOLFSSL_LIBRARIES ${WOLFSSL_LIBRARY})
85
+ endif()
86
+
87
+ mark_as_advanced(WOLFSSL_INCLUDE_DIR WOLFSSL_LIBRARY)
88
+ endif()
89
+
90
+ if(NOT WIN32)
91
+ find_library(_math_library "m")
92
+ if(_math_library)
93
+ list(APPEND WOLFSSL_LIBRARIES "m") # for log and pow
94
+ endif()
95
+ mark_as_advanced(_math_library)
96
+ endif()
afc-curl/CMake/FindZstd.cmake ADDED
@@ -0,0 +1,99 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #***************************************************************************
2
+ # _ _ ____ _
3
+ # Project ___| | | | _ \| |
4
+ # / __| | | | |_) | |
5
+ # | (__| |_| | _ <| |___
6
+ # \___|\___/|_| \_\_____|
7
+ #
8
+ # Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
9
+ #
10
+ # This software is licensed as described in the file COPYING, which
11
+ # you should have received as part of this distribution. The terms
12
+ # are also available at https://curl.se/docs/copyright.html.
13
+ #
14
+ # You may opt to use, copy, modify, merge, publish, distribute and/or sell
15
+ # copies of the Software, and permit persons to whom the Software is
16
+ # furnished to do so, under the terms of the COPYING file.
17
+ #
18
+ # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19
+ # KIND, either express or implied.
20
+ #
21
+ # SPDX-License-Identifier: curl
22
+ #
23
+ ###########################################################################
24
+ # Find the zstd library
25
+ #
26
+ # Input variables:
27
+ #
28
+ # - `ZSTD_INCLUDE_DIR`: The zstd include directory.
29
+ # - `ZSTD_LIBRARY`: Path to `zstd` library.
30
+ #
31
+ # Result variables:
32
+ #
33
+ # - `ZSTD_FOUND`: System has zstd.
34
+ # - `ZSTD_INCLUDE_DIRS`: The zstd include directories.
35
+ # - `ZSTD_LIBRARIES`: The zstd library names.
36
+ # - `ZSTD_VERSION`: Version of zstd.
37
+
38
+ if(DEFINED Zstd_INCLUDE_DIR AND NOT DEFINED ZSTD_INCLUDE_DIR)
39
+ message(WARNING "Zstd_INCLUDE_DIR is deprecated, use ZSTD_INCLUDE_DIR instead.")
40
+ set(ZSTD_INCLUDE_DIR "${Zstd_INCLUDE_DIR}")
41
+ endif()
42
+ if(DEFINED Zstd_LIBRARY AND NOT DEFINED ZSTD_LIBRARY)
43
+ message(WARNING "Zstd_LIBRARY is deprecated, use ZSTD_LIBRARY instead.")
44
+ set(ZSTD_LIBRARY "${Zstd_LIBRARY}")
45
+ endif()
46
+
47
+ if(CURL_USE_PKGCONFIG)
48
+ find_package(PkgConfig QUIET)
49
+ pkg_check_modules(PC_ZSTD "libzstd")
50
+ endif()
51
+
52
+ find_path(ZSTD_INCLUDE_DIR NAMES "zstd.h"
53
+ HINTS
54
+ ${PC_ZSTD_INCLUDEDIR}
55
+ ${PC_ZSTD_INCLUDE_DIRS}
56
+ )
57
+
58
+ find_library(ZSTD_LIBRARY NAMES "zstd"
59
+ HINTS
60
+ ${PC_ZSTD_LIBDIR}
61
+ ${PC_ZSTD_LIBRARY_DIRS}
62
+ )
63
+
64
+ if(PC_ZSTD_VERSION)
65
+ set(ZSTD_VERSION ${PC_ZSTD_VERSION})
66
+ elseif(ZSTD_INCLUDE_DIR AND EXISTS "${ZSTD_INCLUDE_DIR}/zstd.h")
67
+ set(_version_regex1 "#[\t ]*define[ \t]+ZSTD_VERSION_MAJOR[ \t]+([0-9]+).*")
68
+ set(_version_regex2 "#[\t ]*define[ \t]+ZSTD_VERSION_MINOR[ \t]+([0-9]+).*")
69
+ set(_version_regex3 "#[\t ]*define[ \t]+ZSTD_VERSION_RELEASE[ \t]+([0-9]+).*")
70
+ file(STRINGS "${ZSTD_INCLUDE_DIR}/zstd.h" _version_str1 REGEX "${_version_regex1}")
71
+ file(STRINGS "${ZSTD_INCLUDE_DIR}/zstd.h" _version_str2 REGEX "${_version_regex2}")
72
+ file(STRINGS "${ZSTD_INCLUDE_DIR}/zstd.h" _version_str3 REGEX "${_version_regex3}")
73
+ string(REGEX REPLACE "${_version_regex1}" "\\1" _version_str1 "${_version_str1}")
74
+ string(REGEX REPLACE "${_version_regex2}" "\\1" _version_str2 "${_version_str2}")
75
+ string(REGEX REPLACE "${_version_regex3}" "\\1" _version_str3 "${_version_str3}")
76
+ set(ZSTD_VERSION "${_version_str1}.${_version_str2}.${_version_str3}")
77
+ unset(_version_regex1)
78
+ unset(_version_regex2)
79
+ unset(_version_regex3)
80
+ unset(_version_str1)
81
+ unset(_version_str2)
82
+ unset(_version_str3)
83
+ endif()
84
+
85
+ include(FindPackageHandleStandardArgs)
86
+ find_package_handle_standard_args(Zstd
87
+ REQUIRED_VARS
88
+ ZSTD_INCLUDE_DIR
89
+ ZSTD_LIBRARY
90
+ VERSION_VAR
91
+ ZSTD_VERSION
92
+ )
93
+
94
+ if(ZSTD_FOUND)
95
+ set(ZSTD_INCLUDE_DIRS ${ZSTD_INCLUDE_DIR})
96
+ set(ZSTD_LIBRARIES ${ZSTD_LIBRARY})
97
+ endif()
98
+
99
+ mark_as_advanced(ZSTD_INCLUDE_DIR ZSTD_LIBRARY)
afc-curl/CMake/Macros.cmake ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #***************************************************************************
2
+ # _ _ ____ _
3
+ # Project ___| | | | _ \| |
4
+ # / __| | | | |_) | |
5
+ # | (__| |_| | _ <| |___
6
+ # \___|\___/|_| \_\_____|
7
+ #
8
+ # Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
9
+ #
10
+ # This software is licensed as described in the file COPYING, which
11
+ # you should have received as part of this distribution. The terms
12
+ # are also available at https://curl.se/docs/copyright.html.
13
+ #
14
+ # You may opt to use, copy, modify, merge, publish, distribute and/or sell
15
+ # copies of the Software, and permit persons to whom the Software is
16
+ # furnished to do so, under the terms of the COPYING file.
17
+ #
18
+ # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19
+ # KIND, either express or implied.
20
+ #
21
+ # SPDX-License-Identifier: curl
22
+ #
23
+ ###########################################################################
24
+ # File defines convenience macros for available feature testing
25
+
26
+ # Check if header file exists and add it to the list.
27
+ # This macro is intended to be called multiple times with a sequence of
28
+ # possibly dependent header files. Some headers depend on others to be
29
+ # compiled correctly.
30
+ macro(check_include_file_concat _file _variable)
31
+ check_include_files("${CURL_INCLUDES};${_file}" ${_variable})
32
+ if(${_variable})
33
+ list(APPEND CURL_INCLUDES ${_file})
34
+ endif()
35
+ endmacro()
36
+
37
+ # For other curl specific tests, use this macro.
38
+ # Return result in variable: CURL_TEST_OUTPUT
39
+ macro(curl_internal_test _curl_test)
40
+ if(NOT DEFINED "${_curl_test}")
41
+ string(REPLACE ";" " " _cmake_required_definitions "${CMAKE_REQUIRED_DEFINITIONS}")
42
+ if(CMAKE_REQUIRED_LIBRARIES)
43
+ set(_curl_test_add_libraries
44
+ "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}")
45
+ endif()
46
+
47
+ message(STATUS "Performing Test ${_curl_test}")
48
+ try_compile(${_curl_test}
49
+ ${PROJECT_BINARY_DIR}
50
+ "${CMAKE_CURRENT_SOURCE_DIR}/CMake/CurlTests.c"
51
+ CMAKE_FLAGS
52
+ "-DCOMPILE_DEFINITIONS:STRING=-D${_curl_test} ${CURL_TEST_DEFINES} ${_cmake_required_definitions}"
53
+ "${_curl_test_add_libraries}"
54
+ OUTPUT_VARIABLE CURL_TEST_OUTPUT)
55
+ if(${_curl_test})
56
+ set(${_curl_test} 1 CACHE INTERNAL "Curl test")
57
+ message(STATUS "Performing Test ${_curl_test} - Success")
58
+ else()
59
+ set(${_curl_test} "" CACHE INTERNAL "Curl test")
60
+ message(STATUS "Performing Test ${_curl_test} - Failed")
61
+ endif()
62
+ endif()
63
+ endmacro()
64
+
65
+ macro(curl_dependency_option _dependency)
66
+ set(CURL_${_dependency} "AUTO" CACHE STRING "Build curl with ${_dependency} support (AUTO, ON or OFF)")
67
+ set_property(CACHE CURL_${_dependency} PROPERTY STRINGS "AUTO" "ON" "OFF")
68
+
69
+ if(CURL_${_dependency} STREQUAL "AUTO")
70
+ find_package(${_dependency})
71
+ elseif(CURL_${_dependency})
72
+ find_package(${_dependency} REQUIRED)
73
+ endif()
74
+ endmacro()
75
+
76
+ # Convert the passed paths to libpath linker options and add them to CMAKE_REQUIRED_LINK_OPTIONS.
77
+ macro(curl_required_libpaths _libpaths_arg)
78
+ set(_libpaths "${_libpaths_arg}")
79
+ foreach(_libpath IN LISTS _libpaths)
80
+ list(APPEND CMAKE_REQUIRED_LINK_OPTIONS "${CMAKE_LIBRARY_PATH_FLAG}${_libpath}")
81
+ endforeach()
82
+ endmacro()
afc-curl/CMake/OtherTests.cmake ADDED
@@ -0,0 +1,156 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #***************************************************************************
2
+ # _ _ ____ _
3
+ # Project ___| | | | _ \| |
4
+ # / __| | | | |_) | |
5
+ # | (__| |_| | _ <| |___
6
+ # \___|\___/|_| \_\_____|
7
+ #
8
+ # Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
9
+ #
10
+ # This software is licensed as described in the file COPYING, which
11
+ # you should have received as part of this distribution. The terms
12
+ # are also available at https://curl.se/docs/copyright.html.
13
+ #
14
+ # You may opt to use, copy, modify, merge, publish, distribute and/or sell
15
+ # copies of the Software, and permit persons to whom the Software is
16
+ # furnished to do so, under the terms of the COPYING file.
17
+ #
18
+ # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19
+ # KIND, either express or implied.
20
+ #
21
+ # SPDX-License-Identifier: curl
22
+ #
23
+ ###########################################################################
24
+ include(CheckCSourceCompiles)
25
+ include(CheckCSourceRuns)
26
+ include(CheckTypeSize)
27
+
28
+ macro(add_header_include _check _header)
29
+ if(${_check})
30
+ set(_source_epilogue "${_source_epilogue}
31
+ #include <${_header}>")
32
+ endif()
33
+ endmacro()
34
+
35
+ set(_cmake_try_compile_target_type_save ${CMAKE_TRY_COMPILE_TARGET_TYPE})
36
+ set(CMAKE_TRY_COMPILE_TARGET_TYPE "STATIC_LIBRARY")
37
+
38
+ if(NOT DEFINED HAVE_STRUCT_SOCKADDR_STORAGE)
39
+ cmake_push_check_state()
40
+ unset(CMAKE_EXTRA_INCLUDE_FILES)
41
+ if(WIN32)
42
+ set(CMAKE_EXTRA_INCLUDE_FILES "winsock2.h")
43
+ set(CMAKE_REQUIRED_LIBRARIES "ws2_32")
44
+ elseif(HAVE_SYS_SOCKET_H)
45
+ set(CMAKE_EXTRA_INCLUDE_FILES "sys/socket.h")
46
+ endif()
47
+ check_type_size("struct sockaddr_storage" SIZEOF_STRUCT_SOCKADDR_STORAGE)
48
+ set(HAVE_STRUCT_SOCKADDR_STORAGE ${HAVE_SIZEOF_STRUCT_SOCKADDR_STORAGE})
49
+ cmake_pop_check_state()
50
+ endif()
51
+
52
+ if(NOT WIN32)
53
+ set(_source_epilogue "#undef inline")
54
+ add_header_include(HAVE_SYS_TYPES_H "sys/types.h")
55
+ add_header_include(HAVE_SYS_SOCKET_H "sys/socket.h")
56
+ check_c_source_compiles("${_source_epilogue}
57
+ int main(void)
58
+ {
59
+ int flag = MSG_NOSIGNAL;
60
+ (void)flag;
61
+ return 0;
62
+ }" HAVE_MSG_NOSIGNAL)
63
+ endif()
64
+
65
+ set(_source_epilogue "#undef inline")
66
+ add_header_include(HAVE_SYS_TIME_H "sys/time.h")
67
+ check_c_source_compiles("${_source_epilogue}
68
+ #include <time.h>
69
+ int main(void)
70
+ {
71
+ struct timeval ts;
72
+ ts.tv_sec = 0;
73
+ ts.tv_usec = 0;
74
+ (void)ts;
75
+ return 0;
76
+ }" HAVE_STRUCT_TIMEVAL)
77
+
78
+ set(CMAKE_TRY_COMPILE_TARGET_TYPE ${_cmake_try_compile_target_type_save})
79
+ unset(_cmake_try_compile_target_type_save)
80
+
81
+ # Detect HAVE_GETADDRINFO_THREADSAFE
82
+
83
+ if(WIN32)
84
+ set(HAVE_GETADDRINFO_THREADSAFE ${HAVE_GETADDRINFO})
85
+ elseif(NOT HAVE_GETADDRINFO)
86
+ set(HAVE_GETADDRINFO_THREADSAFE FALSE)
87
+ elseif(APPLE OR
88
+ CMAKE_SYSTEM_NAME STREQUAL "AIX" OR
89
+ CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" OR
90
+ CMAKE_SYSTEM_NAME STREQUAL "HP-UX" OR
91
+ CMAKE_SYSTEM_NAME STREQUAL "MidnightBSD" OR
92
+ CMAKE_SYSTEM_NAME STREQUAL "NetBSD" OR
93
+ CMAKE_SYSTEM_NAME STREQUAL "SunOS")
94
+ set(HAVE_GETADDRINFO_THREADSAFE TRUE)
95
+ elseif(BSD OR CMAKE_SYSTEM_NAME MATCHES "BSD")
96
+ set(HAVE_GETADDRINFO_THREADSAFE FALSE)
97
+ endif()
98
+
99
+ if(NOT DEFINED HAVE_GETADDRINFO_THREADSAFE)
100
+ set(_source_epilogue "#undef inline")
101
+ add_header_include(HAVE_SYS_SOCKET_H "sys/socket.h")
102
+ add_header_include(HAVE_SYS_TIME_H "sys/time.h")
103
+ add_header_include(HAVE_NETDB_H "netdb.h")
104
+ check_c_source_compiles("${_source_epilogue}
105
+ int main(void)
106
+ {
107
+ #ifdef h_errno
108
+ return 0;
109
+ #else
110
+ #error force compilation error
111
+ #endif
112
+ }" HAVE_H_ERRNO)
113
+
114
+ if(NOT HAVE_H_ERRNO)
115
+ check_c_source_compiles("${_source_epilogue}
116
+ int main(void)
117
+ {
118
+ h_errno = 2;
119
+ return h_errno != 0 ? 1 : 0;
120
+ }" HAVE_H_ERRNO_ASSIGNABLE)
121
+
122
+ if(NOT HAVE_H_ERRNO_ASSIGNABLE)
123
+ check_c_source_compiles("${_source_epilogue}
124
+ int main(void)
125
+ {
126
+ #if defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE >= 200809L)
127
+ return 0;
128
+ #elif defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE >= 700)
129
+ return 0;
130
+ #else
131
+ #error force compilation error
132
+ #endif
133
+ }" HAVE_H_ERRNO_SBS_ISSUE_7)
134
+ endif()
135
+ endif()
136
+
137
+ if(HAVE_H_ERRNO OR HAVE_H_ERRNO_ASSIGNABLE OR HAVE_H_ERRNO_SBS_ISSUE_7)
138
+ set(HAVE_GETADDRINFO_THREADSAFE TRUE)
139
+ endif()
140
+ endif()
141
+
142
+ if(NOT WIN32 AND NOT DEFINED HAVE_CLOCK_GETTIME_MONOTONIC_RAW)
143
+ set(_source_epilogue "#undef inline")
144
+ add_header_include(HAVE_SYS_TYPES_H "sys/types.h")
145
+ add_header_include(HAVE_SYS_TIME_H "sys/time.h")
146
+ check_c_source_compiles("${_source_epilogue}
147
+ #include <time.h>
148
+ int main(void)
149
+ {
150
+ struct timespec ts;
151
+ (void)clock_gettime(CLOCK_MONOTONIC_RAW, &ts);
152
+ return 0;
153
+ }" HAVE_CLOCK_GETTIME_MONOTONIC_RAW)
154
+ endif()
155
+
156
+ unset(_source_epilogue)
afc-curl/CMake/PickyWarnings.cmake ADDED
@@ -0,0 +1,265 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #***************************************************************************
2
+ # _ _ ____ _
3
+ # Project ___| | | | _ \| |
4
+ # / __| | | | |_) | |
5
+ # | (__| |_| | _ <| |___
6
+ # \___|\___/|_| \_\_____|
7
+ #
8
+ # Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
9
+ #
10
+ # This software is licensed as described in the file COPYING, which
11
+ # you should have received as part of this distribution. The terms
12
+ # are also available at https://curl.se/docs/copyright.html.
13
+ #
14
+ # You may opt to use, copy, modify, merge, publish, distribute and/or sell
15
+ # copies of the Software, and permit persons to whom the Software is
16
+ # furnished to do so, under the terms of the COPYING file.
17
+ #
18
+ # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19
+ # KIND, either express or implied.
20
+ #
21
+ # SPDX-License-Identifier: curl
22
+ #
23
+ ###########################################################################
24
+ include(CheckCCompilerFlag)
25
+
26
+ unset(_picky)
27
+
28
+ if(CURL_WERROR AND
29
+ ((CMAKE_COMPILER_IS_GNUCC AND
30
+ NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 5.0 AND
31
+ NOT CMAKE_VERSION VERSION_LESS 3.23.0) OR # to avoid check_symbol_exists() conflicting with GCC -pedantic-errors
32
+ CMAKE_C_COMPILER_ID MATCHES "Clang"))
33
+ list(APPEND _picky "-pedantic-errors")
34
+ if(MSVC) # clang-cl
35
+ list(APPEND _picky "-Wno-language-extension-token") # Override default error to make __int64 size detection pass
36
+ endif()
37
+ endif()
38
+
39
+ if(APPLE AND
40
+ (CMAKE_C_COMPILER_ID STREQUAL "Clang" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 3.6) OR
41
+ (CMAKE_C_COMPILER_ID STREQUAL "AppleClang" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 6.3))
42
+ list(APPEND _picky "-Werror=partial-availability") # clang 3.6 appleclang 6.3
43
+ endif()
44
+
45
+ if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang")
46
+ list(APPEND _picky "-Werror-implicit-function-declaration") # clang 1.0 gcc 2.95
47
+ endif()
48
+
49
+ if(PICKY_COMPILER)
50
+ if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang")
51
+
52
+ # https://clang.llvm.org/docs/DiagnosticsReference.html
53
+ # https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html
54
+
55
+ # _picky_enable = Options we want to enable as-is.
56
+ # _picky_detect = Options we want to test first and enable if available.
57
+
58
+ # Prefer the -Wextra alias with clang.
59
+ if(CMAKE_C_COMPILER_ID MATCHES "Clang")
60
+ set(_picky_enable "-Wextra")
61
+ else()
62
+ set(_picky_enable "-W")
63
+ endif()
64
+
65
+ list(APPEND _picky_enable
66
+ -Wall -pedantic
67
+ )
68
+
69
+ # ----------------------------------
70
+ # Add new options here, if in doubt:
71
+ # ----------------------------------
72
+ set(_picky_detect
73
+ )
74
+
75
+ # Assume these options always exist with both clang and gcc.
76
+ # Require clang 3.0 / gcc 2.95 or later.
77
+ list(APPEND _picky_enable
78
+ -Wbad-function-cast # clang 2.7 gcc 2.95
79
+ -Wconversion # clang 2.7 gcc 2.95
80
+ -Winline # clang 1.0 gcc 1.0
81
+ -Wmissing-declarations # clang 1.0 gcc 2.7
82
+ -Wmissing-prototypes # clang 1.0 gcc 1.0
83
+ -Wnested-externs # clang 1.0 gcc 2.7
84
+ -Wno-long-long # clang 1.0 gcc 2.95
85
+ -Wno-multichar # clang 1.0 gcc 2.95
86
+ -Wpointer-arith # clang 1.0 gcc 1.4
87
+ -Wshadow # clang 1.0 gcc 2.95
88
+ -Wsign-compare # clang 1.0 gcc 2.95
89
+ -Wundef # clang 1.0 gcc 2.95
90
+ -Wunused # clang 1.1 gcc 2.95
91
+ -Wwrite-strings # clang 1.0 gcc 1.4
92
+ )
93
+
94
+ # Always enable with clang, version dependent with gcc
95
+ set(_picky_common_old
96
+ -Waddress # clang 2.7 gcc 4.3
97
+ -Wattributes # clang 2.7 gcc 4.1
98
+ -Wcast-align # clang 1.0 gcc 4.2
99
+ -Wdeclaration-after-statement # clang 1.0 gcc 3.4
100
+ -Wdiv-by-zero # clang 2.7 gcc 4.1
101
+ -Wempty-body # clang 2.7 gcc 4.3
102
+ -Wendif-labels # clang 1.0 gcc 3.3
103
+ -Wfloat-equal # clang 1.0 gcc 2.96 (3.0)
104
+ -Wformat-security # clang 2.7 gcc 4.1
105
+ -Wignored-qualifiers # clang 2.8 gcc 4.3
106
+ -Wmissing-field-initializers # clang 2.7 gcc 4.1
107
+ -Wmissing-noreturn # clang 2.7 gcc 4.1
108
+ -Wno-format-nonliteral # clang 1.0 gcc 2.96 (3.0)
109
+ -Wno-system-headers # clang 1.0 gcc 3.0
110
+ # -Wpadded # clang 2.9 gcc 4.1 # Not used: We cannot change public structs
111
+ -Wold-style-definition # clang 2.7 gcc 3.4
112
+ -Wredundant-decls # clang 2.7 gcc 4.1
113
+ -Wsign-conversion # clang 2.9 gcc 4.3
114
+ -Wno-error=sign-conversion # FIXME
115
+ -Wstrict-prototypes # clang 1.0 gcc 3.3
116
+ # -Wswitch-enum # clang 2.7 gcc 4.1 # Not used: It basically disallows default case
117
+ -Wtype-limits # clang 2.7 gcc 4.3
118
+ -Wunreachable-code # clang 2.7 gcc 4.1
119
+ # -Wunused-macros # clang 2.7 gcc 4.1 # Not practical
120
+ -Wunused-parameter # clang 2.7 gcc 4.1
121
+ -Wvla # clang 2.8 gcc 4.3
122
+ )
123
+
124
+ set(_picky_common
125
+ -Wdouble-promotion # clang 3.6 gcc 4.6 appleclang 6.3
126
+ -Wenum-conversion # clang 3.2 gcc 10.0 appleclang 4.6 g++ 11.0
127
+ -Wpragmas # clang 3.5 gcc 4.1 appleclang 6.0
128
+ -Wunused-const-variable # clang 3.4 gcc 6.0 appleclang 5.1
129
+ )
130
+
131
+ if(CMAKE_C_COMPILER_ID MATCHES "Clang")
132
+ list(APPEND _picky_enable
133
+ ${_picky_common_old}
134
+ -Wshift-sign-overflow # clang 2.9
135
+ -Wshorten-64-to-32 # clang 1.0
136
+ -Wformat=2 # clang 3.0 gcc 4.8
137
+ )
138
+ if(NOT MSVC)
139
+ list(APPEND _picky_enable
140
+ -Wlanguage-extension-token # clang 3.0 # Avoid for clang-cl to allow __int64
141
+ )
142
+ endif()
143
+ # Enable based on compiler version
144
+ if((CMAKE_C_COMPILER_ID STREQUAL "Clang" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 3.6) OR
145
+ (CMAKE_C_COMPILER_ID STREQUAL "AppleClang" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 6.3))
146
+ list(APPEND _picky_enable
147
+ ${_picky_common}
148
+ # -Wunreachable-code-break # clang 3.5 appleclang 6.0 # Not used: Silent in "unity" builds
149
+ -Wheader-guard # clang 3.4 appleclang 5.1
150
+ -Wsometimes-uninitialized # clang 3.2 appleclang 4.6
151
+ )
152
+ endif()
153
+ if((CMAKE_C_COMPILER_ID STREQUAL "Clang" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 3.9) OR
154
+ (CMAKE_C_COMPILER_ID STREQUAL "AppleClang" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 8.3))
155
+ list(APPEND _picky_enable
156
+ -Wcomma # clang 3.9 appleclang 8.3
157
+ -Wmissing-variable-declarations # clang 3.2 appleclang 4.6
158
+ )
159
+ endif()
160
+ if((CMAKE_C_COMPILER_ID STREQUAL "Clang" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 7.0) OR
161
+ (CMAKE_C_COMPILER_ID STREQUAL "AppleClang" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 10.3))
162
+ list(APPEND _picky_enable
163
+ -Wassign-enum # clang 7.0 appleclang 10.3
164
+ -Wextra-semi-stmt # clang 7.0 appleclang 10.3
165
+ )
166
+ endif()
167
+ if((CMAKE_C_COMPILER_ID STREQUAL "Clang" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 10.0) OR
168
+ (CMAKE_C_COMPILER_ID STREQUAL "AppleClang" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 12.4))
169
+ list(APPEND _picky_enable
170
+ -Wimplicit-fallthrough # clang 4.0 gcc 7.0 appleclang 12.4 # We do silencing for clang 10.0 and above only
171
+ )
172
+ endif()
173
+ else() # gcc
174
+ list(APPEND _picky_detect
175
+ ${_picky_common}
176
+ )
177
+ # Enable based on compiler version
178
+ if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.3)
179
+ list(APPEND _picky_enable
180
+ ${_picky_common_old}
181
+ -Wclobbered # gcc 4.3
182
+ -Wmissing-parameter-type # gcc 4.3
183
+ -Wold-style-declaration # gcc 4.3
184
+ -Wstrict-aliasing=3 # gcc 4.0
185
+ -Wtrampolines # gcc 4.3
186
+ )
187
+ endif()
188
+ if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.5 AND MINGW)
189
+ list(APPEND _picky_enable
190
+ -Wno-pedantic-ms-format # gcc 4.5 (MinGW-only)
191
+ )
192
+ endif()
193
+ if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.8)
194
+ list(APPEND _picky_enable
195
+ -Wformat=2 # clang 3.0 gcc 4.8
196
+ )
197
+ endif()
198
+ if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 5.0)
199
+ list(APPEND _picky_enable
200
+ -Warray-bounds=2 -ftree-vrp # clang 3.0 gcc 5.0 (clang default: -Warray-bounds)
201
+ )
202
+ endif()
203
+ if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 6.0)
204
+ list(APPEND _picky_enable
205
+ -Wduplicated-cond # gcc 6.0
206
+ -Wnull-dereference # clang 3.0 gcc 6.0 (clang default)
207
+ -fdelete-null-pointer-checks
208
+ -Wshift-negative-value # clang 3.7 gcc 6.0 (clang default)
209
+ -Wshift-overflow=2 # clang 3.0 gcc 6.0 (clang default: -Wshift-overflow)
210
+ )
211
+ endif()
212
+ if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 7.0)
213
+ list(APPEND _picky_enable
214
+ -Walloc-zero # gcc 7.0
215
+ -Wduplicated-branches # gcc 7.0
216
+ -Wformat-truncation=2 # gcc 7.0
217
+ -Wimplicit-fallthrough # clang 4.0 gcc 7.0
218
+ -Wrestrict # gcc 7.0
219
+ )
220
+ endif()
221
+ if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 10.0)
222
+ list(APPEND _picky_enable
223
+ -Warith-conversion # gcc 10.0
224
+ )
225
+ endif()
226
+ endif()
227
+
228
+ #
229
+
230
+ foreach(_ccopt IN LISTS _picky_enable)
231
+ list(APPEND _picky "${_ccopt}")
232
+ endforeach()
233
+
234
+ foreach(_ccopt IN LISTS _picky_detect)
235
+ # Use a unique variable name 1. for meaningful log output 2. to have a fresh, undefined variable for each detection
236
+ string(MAKE_C_IDENTIFIER "OPT${_ccopt}" _optvarname)
237
+ # GCC only warns about unknown -Wno- options if there are also other diagnostic messages,
238
+ # so test for the positive form instead
239
+ string(REPLACE "-Wno-" "-W" _ccopt_on "${_ccopt}")
240
+ check_c_compiler_flag(${_ccopt_on} ${_optvarname})
241
+ if(${_optvarname})
242
+ list(APPEND _picky "${_ccopt}")
243
+ endif()
244
+ endforeach()
245
+ endif()
246
+ endif()
247
+
248
+ # clang-cl
249
+ if(CMAKE_C_COMPILER_ID STREQUAL "Clang" AND MSVC)
250
+ if(CMAKE_VERSION VERSION_LESS 3.12)
251
+ set(_picky_tmp "")
252
+ foreach(_ccopt IN LISTS _picky)
253
+ list(APPEND _picky_tmp "/clang:${_ccopt}")
254
+ endforeach()
255
+ set(_picky ${_picky_tmp})
256
+ else()
257
+ list(TRANSFORM _picky PREPEND "/clang:")
258
+ endif()
259
+ endif()
260
+
261
+ if(_picky)
262
+ string(REPLACE ";" " " _picky "${_picky}")
263
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${_picky}")
264
+ message(STATUS "Picky compiler options: ${_picky}")
265
+ endif()
afc-curl/CMake/Platforms/WindowsCache.cmake ADDED
@@ -0,0 +1,194 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #***************************************************************************
2
+ # _ _ ____ _
3
+ # Project ___| | | | _ \| |
4
+ # / __| | | | |_) | |
5
+ # | (__| |_| | _ <| |___
6
+ # \___|\___/|_| \_\_____|
7
+ #
8
+ # Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
9
+ #
10
+ # This software is licensed as described in the file COPYING, which
11
+ # you should have received as part of this distribution. The terms
12
+ # are also available at https://curl.se/docs/copyright.html.
13
+ #
14
+ # You may opt to use, copy, modify, merge, publish, distribute and/or sell
15
+ # copies of the Software, and permit persons to whom the Software is
16
+ # furnished to do so, under the terms of the COPYING file.
17
+ #
18
+ # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19
+ # KIND, either express or implied.
20
+ #
21
+ # SPDX-License-Identifier: curl
22
+ #
23
+ ###########################################################################
24
+ if(NOT WIN32)
25
+ message(FATAL_ERROR "This file should be included on Windows platform only")
26
+ endif()
27
+
28
+ set(HAVE_LOCALE_H 1)
29
+
30
+ if(MINGW)
31
+ set(HAVE_SNPRINTF 1)
32
+ set(HAVE_UNISTD_H 1)
33
+ set(HAVE_LIBGEN_H 1)
34
+ set(HAVE_STDDEF_H 1) # detected by CMake internally in check_type_size()
35
+ set(HAVE_STDBOOL_H 1)
36
+ set(HAVE_BOOL_T "${HAVE_STDBOOL_H}")
37
+ set(HAVE_STRTOLL 1)
38
+ set(HAVE_BASENAME 1)
39
+ set(HAVE_STRCASECMP 1)
40
+ set(HAVE_FTRUNCATE 1)
41
+ set(HAVE_SYS_PARAM_H 1)
42
+ set(HAVE_SYS_TIME_H 1)
43
+ set(HAVE_GETTIMEOFDAY 1)
44
+ set(HAVE_STRINGS_H 1) # wrapper to string.h
45
+ set(HAVE_UTIME_H 1) # wrapper to sys/utime.h
46
+ set(HAVE_DIRENT_H 1)
47
+ set(HAVE_OPENDIR 1)
48
+ else()
49
+ set(HAVE_LIBGEN_H 0)
50
+ set(HAVE_STRCASECMP 0)
51
+ set(HAVE_FTRUNCATE 0)
52
+ set(HAVE_SYS_PARAM_H 0)
53
+ set(HAVE_SYS_TIME_H 0)
54
+ set(HAVE_GETTIMEOFDAY 0)
55
+ set(HAVE_STRINGS_H 0)
56
+ set(HAVE_UTIME_H 0)
57
+ set(HAVE_DIRENT_H 0)
58
+ set(HAVE_OPENDIR 0)
59
+ if(MSVC)
60
+ set(HAVE_UNISTD_H 0)
61
+ set(HAVE_LOCALE_H 1)
62
+ set(HAVE_STDDEF_H 1) # detected by CMake internally in check_type_size()
63
+ set(HAVE_STDATOMIC_H 0)
64
+ if(NOT MSVC_VERSION LESS 1800)
65
+ set(HAVE_STDBOOL_H 1)
66
+ set(HAVE_STRTOLL 1)
67
+ else()
68
+ set(HAVE_STDBOOL_H 0)
69
+ set(HAVE_STRTOLL 0)
70
+ endif()
71
+ set(HAVE_BOOL_T "${HAVE_STDBOOL_H}")
72
+ if(NOT MSVC_VERSION LESS 1900)
73
+ set(HAVE_SNPRINTF 1)
74
+ else()
75
+ set(HAVE_SNPRINTF 0)
76
+ endif()
77
+ set(HAVE_BASENAME 0)
78
+ set(HAVE_STRTOK_R 0)
79
+ set(HAVE_FILE_OFFSET_BITS 0)
80
+ set(HAVE_ATOMIC 0)
81
+ endif()
82
+ endif()
83
+
84
+ # Available in Windows XP and newer
85
+ set(HAVE_GETADDRINFO 1)
86
+ set(HAVE_FREEADDRINFO 1)
87
+
88
+ set(HAVE_FCHMOD 0)
89
+ set(HAVE_SOCKETPAIR 0)
90
+ set(HAVE_SENDMSG 0)
91
+ set(HAVE_SENDMMSG 0)
92
+ set(HAVE_ALARM 0)
93
+ set(HAVE_FCNTL 0)
94
+ set(HAVE_GETPPID 0)
95
+ set(HAVE_UTIMES 0)
96
+ set(HAVE_GETPWUID_R 0)
97
+ set(HAVE_STRERROR_R 0)
98
+ set(HAVE_SIGINTERRUPT 0)
99
+ set(HAVE_PIPE 0)
100
+ set(HAVE_EVENTFD 0)
101
+ set(HAVE_IF_NAMETOINDEX 0)
102
+ set(HAVE_GETRLIMIT 0)
103
+ set(HAVE_SETRLIMIT 0)
104
+ set(HAVE_FSETXATTR 0)
105
+ set(HAVE_SETLOCALE 1)
106
+ set(HAVE_SETMODE 1)
107
+ set(HAVE__SETMODE 1)
108
+ set(HAVE_GETPEERNAME 1)
109
+ set(HAVE_GETSOCKNAME 1)
110
+ set(HAVE_GETHOSTNAME 1)
111
+
112
+ set(HAVE_RECV 1)
113
+ set(HAVE_SEND 1)
114
+ set(HAVE_STROPTS_H 0)
115
+ set(HAVE_SYS_XATTR_H 0)
116
+ set(HAVE_ARC4RANDOM 0)
117
+ set(HAVE_FNMATCH 0)
118
+ set(HAVE_SCHED_YIELD 0)
119
+ set(HAVE_ARPA_INET_H 0)
120
+ set(HAVE_FCNTL_H 1)
121
+ set(HAVE_IFADDRS_H 0)
122
+ set(HAVE_IO_H 1)
123
+ set(HAVE_NETDB_H 0)
124
+ set(HAVE_NETINET_IN_H 0)
125
+ set(HAVE_NETINET_IN6_H 0)
126
+ set(HAVE_NETINET_TCP_H 0)
127
+ set(HAVE_NETINET_UDP_H 0)
128
+ set(HAVE_NET_IF_H 0)
129
+ set(HAVE_IOCTL_SIOCGIFADDR 0)
130
+ set(HAVE_POLL_H 0)
131
+ set(HAVE_POLL 0)
132
+ set(HAVE_PWD_H 0)
133
+ set(HAVE_SYS_EVENTFD_H 0)
134
+ set(HAVE_SYS_FILIO_H 0)
135
+ set(HAVE_SYS_WAIT_H 0)
136
+ set(HAVE_SYS_IOCTL_H 0)
137
+ set(HAVE_SYS_POLL_H 0)
138
+ set(HAVE_SYS_RESOURCE_H 0)
139
+ set(HAVE_SYS_SELECT_H 0)
140
+ set(HAVE_SYS_SOCKET_H 0)
141
+ set(HAVE_SYS_SOCKIO_H 0)
142
+ set(HAVE_SYS_STAT_H 1)
143
+ set(HAVE_SYS_TYPES_H 1)
144
+ set(HAVE_SYS_UN_H 0)
145
+ set(HAVE_SYS_UTIME_H 1)
146
+ set(HAVE_TERMIOS_H 0)
147
+ set(HAVE_TERMIO_H 0)
148
+ set(HAVE_LINUX_TCP_H 0)
149
+
150
+ set(HAVE_FSEEKO 0) # mingw-w64 2.0.0 and newer has it
151
+ set(HAVE_SOCKET 1)
152
+ set(HAVE_SELECT 1)
153
+ set(HAVE_STRDUP 1)
154
+ set(HAVE_STRICMP 1)
155
+ set(HAVE_STRCMPI 1)
156
+ set(HAVE_MEMRCHR 0)
157
+ set(HAVE_CLOSESOCKET 1)
158
+ set(HAVE_SIGSETJMP 0)
159
+ set(HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID 1)
160
+ set(HAVE_GETPASS_R 0)
161
+ set(HAVE_GETPWUID 0)
162
+ set(HAVE_GETEUID 0)
163
+ set(HAVE_UTIME 1)
164
+ set(HAVE_GMTIME_R 0)
165
+ set(HAVE_GETHOSTBYNAME_R 0)
166
+ set(HAVE_SIGNAL 1)
167
+ set(HAVE_SIGACTION 0)
168
+ set(HAVE_GLIBC_STRERROR_R 0)
169
+ set(HAVE_GETIFADDRS 0)
170
+ set(HAVE_FCNTL_O_NONBLOCK 0)
171
+ set(HAVE_IOCTLSOCKET 1)
172
+ set(HAVE_IOCTLSOCKET_CAMEL 0)
173
+ set(HAVE_IOCTLSOCKET_CAMEL_FIONBIO 0)
174
+ set(HAVE_IOCTLSOCKET_FIONBIO 1)
175
+ set(HAVE_IOCTL_FIONBIO 0)
176
+ set(HAVE_SETSOCKOPT_SO_NONBLOCK 0)
177
+ set(HAVE_POSIX_STRERROR_R 0)
178
+ set(HAVE_MSG_NOSIGNAL 0)
179
+ set(HAVE_STRUCT_TIMEVAL 1)
180
+ set(HAVE_STRUCT_SOCKADDR_STORAGE 1)
181
+
182
+ set(HAVE_GETHOSTBYNAME_R_3 0)
183
+ set(HAVE_GETHOSTBYNAME_R_3_REENTRANT 0)
184
+ set(HAVE_GETHOSTBYNAME_R_5 0)
185
+ set(HAVE_GETHOSTBYNAME_R_5_REENTRANT 0)
186
+ set(HAVE_GETHOSTBYNAME_R_6 0)
187
+ set(HAVE_GETHOSTBYNAME_R_6_REENTRANT 0)
188
+
189
+ set(HAVE_O_NONBLOCK 0)
190
+ set(HAVE_IN_ADDR_T 0)
191
+ set(STDC_HEADERS 1)
192
+
193
+ set(HAVE_SIZEOF_SUSECONDS_T 0)
194
+ set(HAVE_SIZEOF_SA_FAMILY_T 0)
afc-curl/CMake/Utilities.cmake ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #***************************************************************************
2
+ # _ _ ____ _
3
+ # Project ___| | | | _ \| |
4
+ # / __| | | | |_) | |
5
+ # | (__| |_| | _ <| |___
6
+ # \___|\___/|_| \_\_____|
7
+ #
8
+ # Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
9
+ #
10
+ # This software is licensed as described in the file COPYING, which
11
+ # you should have received as part of this distribution. The terms
12
+ # are also available at https://curl.se/docs/copyright.html.
13
+ #
14
+ # You may opt to use, copy, modify, merge, publish, distribute and/or sell
15
+ # copies of the Software, and permit persons to whom the Software is
16
+ # furnished to do so, under the terms of the COPYING file.
17
+ #
18
+ # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19
+ # KIND, either express or implied.
20
+ #
21
+ # SPDX-License-Identifier: curl
22
+ #
23
+ ###########################################################################
24
+ # File containing various utilities
25
+
26
+ # Returns number of arguments that evaluate to true
27
+ function(count_true _output_count_var)
28
+ set(lst_len 0)
29
+ foreach(option_var IN LISTS ARGN)
30
+ if(${option_var})
31
+ math(EXPR lst_len "${lst_len} + 1")
32
+ endif()
33
+ endforeach()
34
+ set(${_output_count_var} ${lst_len} PARENT_SCOPE)
35
+ endfunction()
afc-curl/CMake/cmake_uninstall.cmake.in ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #***************************************************************************
2
+ # _ _ ____ _
3
+ # Project ___| | | | _ \| |
4
+ # / __| | | | |_) | |
5
+ # | (__| |_| | _ <| |___
6
+ # \___|\___/|_| \_\_____|
7
+ #
8
+ # Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
9
+ #
10
+ # This software is licensed as described in the file COPYING, which
11
+ # you should have received as part of this distribution. The terms
12
+ # are also available at https://curl.se/docs/copyright.html.
13
+ #
14
+ # You may opt to use, copy, modify, merge, publish, distribute and/or sell
15
+ # copies of the Software, and permit persons to whom the Software is
16
+ # furnished to do so, under the terms of the COPYING file.
17
+ #
18
+ # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19
+ # KIND, either express or implied.
20
+ #
21
+ # SPDX-License-Identifier: curl
22
+ #
23
+ ###########################################################################
24
+ if(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
25
+ message(FATAL_ERROR "Cannot find install manifest: @CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
26
+ endif()
27
+
28
+ if(NOT DEFINED CMAKE_INSTALL_PREFIX)
29
+ set(CMAKE_INSTALL_PREFIX "@CMAKE_INSTALL_PREFIX@")
30
+ endif()
31
+ message(${CMAKE_INSTALL_PREFIX})
32
+
33
+ file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" _files)
34
+ string(REGEX REPLACE "\n" ";" _files "${_files}")
35
+ foreach(_file ${_files})
36
+ message(STATUS "Uninstalling $ENV{DESTDIR}${_file}")
37
+ if(IS_SYMLINK "$ENV{DESTDIR}${_file}" OR EXISTS "$ENV{DESTDIR}${_file}")
38
+ exec_program(
39
+ "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${_file}\""
40
+ OUTPUT_VARIABLE rm_out
41
+ RETURN_VALUE rm_retval
42
+ )
43
+ if(NOT "${rm_retval}" STREQUAL 0)
44
+ message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${_file}")
45
+ endif()
46
+ else()
47
+ message(STATUS "File $ENV{DESTDIR}${_file} does not exist.")
48
+ endif()
49
+ endforeach()
afc-curl/CMake/curl-config.cmake.in ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #***************************************************************************
2
+ # _ _ ____ _
3
+ # Project ___| | | | _ \| |
4
+ # / __| | | | |_) | |
5
+ # | (__| |_| | _ <| |___
6
+ # \___|\___/|_| \_\_____|
7
+ #
8
+ # Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
9
+ #
10
+ # This software is licensed as described in the file COPYING, which
11
+ # you should have received as part of this distribution. The terms
12
+ # are also available at https://curl.se/docs/copyright.html.
13
+ #
14
+ # You may opt to use, copy, modify, merge, publish, distribute and/or sell
15
+ # copies of the Software, and permit persons to whom the Software is
16
+ # furnished to do so, under the terms of the COPYING file.
17
+ #
18
+ # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19
+ # KIND, either express or implied.
20
+ #
21
+ # SPDX-License-Identifier: curl
22
+ #
23
+ ###########################################################################
24
+ @PACKAGE_INIT@
25
+
26
+ if(UNIX OR VCPKG_TOOLCHAIN OR (MINGW AND NOT CMAKE_CROSSCOMPILING)) # Keep in sync with root CMakeLists.txt
27
+ set(_curl_use_pkgconfig_default ON)
28
+ else()
29
+ set(_curl_use_pkgconfig_default OFF)
30
+ endif()
31
+ option(CURL_USE_PKGCONFIG "Enable pkg-config to detect @PROJECT_NAME@ dependencies" ${_curl_use_pkgconfig_default})
32
+
33
+ include(CMakeFindDependencyMacro)
34
+ if("@USE_OPENSSL@")
35
+ find_dependency(OpenSSL "@OPENSSL_VERSION_MAJOR@")
36
+ endif()
37
+ if("@HAVE_LIBZ@")
38
+ find_dependency(ZLIB "@ZLIB_VERSION_MAJOR@")
39
+ endif()
40
+
41
+ include("${CMAKE_CURRENT_LIST_DIR}/@TARGETS_EXPORT_NAME@.cmake")
42
+ check_required_components("@PROJECT_NAME@")
43
+
44
+ # Alias for either shared or static library
45
+ if(NOT TARGET @PROJECT_NAME@::libcurl)
46
+ add_library(@PROJECT_NAME@::libcurl ALIAS @PROJECT_NAME@::@LIB_SELECTED@)
47
+ endif()
48
+
49
+ # For compatibility with CMake's FindCURL.cmake
50
+ set(CURL_LIBRARIES @PROJECT_NAME@::libcurl)
51
+ set_and_check(CURL_INCLUDE_DIRS "@PACKAGE_CMAKE_INSTALL_INCLUDEDIR@")
afc-curl/CMakeLists.txt ADDED
@@ -0,0 +1,2355 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #***************************************************************************
2
+ # _ _ ____ _
3
+ # Project ___| | | | _ \| |
4
+ # / __| | | | |_) | |
5
+ # | (__| |_| | _ <| |___
6
+ # \___|\___/|_| \_\_____|
7
+ #
8
+ # Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
9
+ #
10
+ # This software is licensed as described in the file COPYING, which
11
+ # you should have received as part of this distribution. The terms
12
+ # are also available at https://curl.se/docs/copyright.html.
13
+ #
14
+ # You may opt to use, copy, modify, merge, publish, distribute and/or sell
15
+ # copies of the Software, and permit persons to whom the Software is
16
+ # furnished to do so, under the terms of the COPYING file.
17
+ #
18
+ # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19
+ # KIND, either express or implied.
20
+ #
21
+ # SPDX-License-Identifier: curl
22
+ #
23
+ ###########################################################################
24
+ # by Tetetest and Sukender (Benoit Neil)
25
+
26
+ # Note: By default this CMake build script detects the version of some
27
+ # dependencies using `check_symbol_exists`. Those checks do not work in
28
+ # the case that both CURL and its dependency are included as sub-projects
29
+ # in a larger build using `FetchContent`. To support that case, additional
30
+ # variables may be defined by the parent project, ideally in the "extra"
31
+ # find package redirect file:
32
+ # https://cmake.org/cmake/help/latest/module/FetchContent.html#integrating-with-find-package
33
+ #
34
+ # The following variables are available:
35
+ # HAVE_SSL_SET0_WBIO: `SSL_set0_wbio` present in OpenSSL/wolfSSL
36
+ # HAVE_OPENSSL_SRP: `SSL_CTX_set_srp_username` present in OpenSSL/wolfSSL
37
+ # HAVE_GNUTLS_SRP: `gnutls_srp_verifier` present in GnuTLS
38
+ # HAVE_SSL_CTX_SET_QUIC_METHOD: `SSL_CTX_set_quic_method` present in OpenSSL/wolfSSL
39
+ # HAVE_QUICHE_CONN_SET_QLOG_FD: `quiche_conn_set_qlog_fd` present in quiche
40
+ # HAVE_ECH: ECH API checks for OpenSSL, BoringSSL or wolfSSL
41
+ #
42
+ # For each of the above variables, if the variable is DEFINED (either
43
+ # to ON or OFF), the symbol detection is skipped. If the variable is
44
+ # NOT DEFINED, the symbol detection is performed.
45
+
46
+ cmake_minimum_required(VERSION 3.7...3.16 FATAL_ERROR)
47
+ message(STATUS "Using CMake version ${CMAKE_VERSION}")
48
+
49
+ # Collect command-line arguments for buildinfo.txt.
50
+ # Must reside at the top of the script to work as expected.
51
+ set(_cmake_args "")
52
+ if(NOT "$ENV{CURL_BUILDINFO}$ENV{CURL_CI}$ENV{CI}" STREQUAL "")
53
+ get_cmake_property(_cache_vars CACHE_VARIABLES)
54
+ foreach(_cache_var IN ITEMS ${_cache_vars})
55
+ get_property(_cache_var_helpstring CACHE ${_cache_var} PROPERTY HELPSTRING)
56
+ if(_cache_var_helpstring STREQUAL "No help, variable specified on the command line.")
57
+ get_property(_cache_var_type CACHE ${_cache_var} PROPERTY TYPE)
58
+ get_property(_cache_var_value CACHE ${_cache_var} PROPERTY VALUE)
59
+ if(_cache_var_type STREQUAL "UNINITIALIZED")
60
+ set(_cache_var_type)
61
+ else()
62
+ set(_cache_var_type ":${_cache_var_type}")
63
+ endif()
64
+ set(_cmake_args "${_cmake_args} -D${_cache_var}${_cache_var_type}=\"${_cache_var_value}\"")
65
+ endif()
66
+ endforeach()
67
+ endif()
68
+
69
+ function(curl_dumpvars) # Dump all defined variables with their values
70
+ message("::group::CMake Variable Dump")
71
+ get_cmake_property(_vars VARIABLES)
72
+ foreach(_var ${_vars})
73
+ message("${_var} = ${${_var}}")
74
+ endforeach()
75
+ message("::endgroup::")
76
+ endfunction()
77
+
78
+ set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMake;${CMAKE_MODULE_PATH}")
79
+ include(Utilities)
80
+ include(Macros)
81
+ include(CMakeDependentOption)
82
+ include(CheckCCompilerFlag)
83
+
84
+ file(STRINGS "${CMAKE_CURRENT_SOURCE_DIR}/include/curl/curlver.h" _curl_version_h_contents REGEX "#define LIBCURL_VERSION( |_NUM )")
85
+ string(REGEX MATCH "#define LIBCURL_VERSION \"[^\"]*" _curl_version ${_curl_version_h_contents})
86
+ string(REGEX REPLACE "[^\"]+\"" "" _curl_version ${_curl_version})
87
+ string(REGEX MATCH "#define LIBCURL_VERSION_NUM 0x[0-9a-fA-F]+" _curl_version_num ${_curl_version_h_contents})
88
+ string(REGEX REPLACE "[^0]+0x" "" _curl_version_num ${_curl_version_num})
89
+ unset(_curl_version_h_contents)
90
+
91
+ message(STATUS "curl version=[${_curl_version}]")
92
+
93
+ string(REGEX REPLACE "([0-9]+\.[0-9]+\.[0-9]+).+" "\\1" _curl_version_sem "${_curl_version}")
94
+ project(CURL
95
+ VERSION "${_curl_version_sem}"
96
+ LANGUAGES C)
97
+
98
+ unset(_target_flags)
99
+ if(APPLE)
100
+ set(_target_flags "${_target_flags} APPLE")
101
+ endif()
102
+ if(UNIX)
103
+ set(_target_flags "${_target_flags} UNIX")
104
+ endif()
105
+ if(BSD)
106
+ set(_target_flags "${_target_flags} BSD")
107
+ endif()
108
+ if(WIN32)
109
+ set(_target_flags "${_target_flags} WIN32")
110
+ endif()
111
+ if(WINDOWS_STORE)
112
+ set(_target_flags "${_target_flags} UWP")
113
+ endif()
114
+ if(CYGWIN)
115
+ set(_target_flags "${_target_flags} CYGWIN")
116
+ endif()
117
+ if(MSYS)
118
+ set(_target_flags "${_target_flags} MSYS")
119
+ endif()
120
+ if(CMAKE_COMPILER_IS_GNUCC)
121
+ set(_target_flags "${_target_flags} GCC")
122
+ endif()
123
+ if(MINGW)
124
+ set(_target_flags "${_target_flags} MINGW")
125
+ endif()
126
+ if(MSVC)
127
+ set(_target_flags "${_target_flags} MSVC")
128
+ endif()
129
+ if(VCPKG_TOOLCHAIN)
130
+ set(_target_flags "${_target_flags} VCPKG")
131
+ endif()
132
+ if(CMAKE_CROSSCOMPILING)
133
+ set(_target_flags "${_target_flags} CROSS")
134
+ endif()
135
+ message(STATUS "CMake platform flags:${_target_flags}")
136
+
137
+ if(CMAKE_CROSSCOMPILING)
138
+ message(STATUS "Cross-compiling: "
139
+ "${CMAKE_HOST_SYSTEM_NAME}/${CMAKE_HOST_SYSTEM_PROCESSOR} -> "
140
+ "${CMAKE_SYSTEM_NAME}/${CMAKE_SYSTEM_PROCESSOR}")
141
+ endif()
142
+
143
+ if(CMAKE_C_COMPILER_TARGET)
144
+ set(CURL_OS "\"${CMAKE_C_COMPILER_TARGET}\"")
145
+ else()
146
+ set(CURL_OS "\"${CMAKE_SYSTEM_NAME}\"")
147
+ endif()
148
+
149
+ include_directories("${PROJECT_SOURCE_DIR}/include")
150
+
151
+ if(NOT DEFINED CMAKE_UNITY_BUILD_BATCH_SIZE)
152
+ set(CMAKE_UNITY_BUILD_BATCH_SIZE 0)
153
+ endif()
154
+
155
+ # Having CMAKE_TRY_COMPILE_TARGET_TYPE set to STATIC_LIBRARY breaks certain
156
+ # 'check_function_exists()' detections (possibly more), by detecting
157
+ # non-existing features. This happens by default when using 'ios.toolchain.cmake'.
158
+ # Work it around by setting this value to `EXECUTABLE`.
159
+ if(CMAKE_TRY_COMPILE_TARGET_TYPE STREQUAL "STATIC_LIBRARY")
160
+ message(STATUS "CMAKE_TRY_COMPILE_TARGET_TYPE was found set to STATIC_LIBRARY. "
161
+ "Overriding with EXECUTABLE for feature detections to work.")
162
+ set(_cmake_try_compile_target_type_save ${CMAKE_TRY_COMPILE_TARGET_TYPE})
163
+ set(CMAKE_TRY_COMPILE_TARGET_TYPE "EXECUTABLE")
164
+ endif()
165
+
166
+ option(CURL_WERROR "Turn compiler warnings into errors" OFF)
167
+ option(PICKY_COMPILER "Enable picky compiler options" ON)
168
+ option(BUILD_CURL_EXE "Build curl executable" ON)
169
+ option(BUILD_SHARED_LIBS "Build shared libraries" ON)
170
+ option(BUILD_STATIC_LIBS "Build static libraries" OFF)
171
+ option(BUILD_STATIC_CURL "Build curl executable with static libcurl" OFF)
172
+ option(ENABLE_ARES "Enable c-ares support" OFF)
173
+ option(CURL_DISABLE_INSTALL "Disable installation targets" OFF)
174
+
175
+ if(WIN32)
176
+ option(CURL_STATIC_CRT "Build libcurl with static CRT with MSVC (/MT)" OFF)
177
+ if(CURL_STATIC_CRT AND MSVC)
178
+ set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
179
+ set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /MT")
180
+ set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /MTd")
181
+ endif()
182
+
183
+ option(ENABLE_UNICODE "Use the Unicode version of the Windows API functions" OFF)
184
+ if(WINDOWS_STORE)
185
+ set(ENABLE_UNICODE ON)
186
+ endif()
187
+ if(ENABLE_UNICODE)
188
+ add_definitions("-DUNICODE" "-D_UNICODE")
189
+ if(MINGW)
190
+ add_compile_options("-municode")
191
+ endif()
192
+ endif()
193
+
194
+ list(APPEND CMAKE_REQUIRED_DEFINITIONS "-DWIN32_LEAN_AND_MEAN") # Apply to all feature checks
195
+
196
+ set(CURL_TARGET_WINDOWS_VERSION "" CACHE STRING "Minimum target Windows version as hex string")
197
+ if(CURL_TARGET_WINDOWS_VERSION)
198
+ add_definitions("-D_WIN32_WINNT=${CURL_TARGET_WINDOWS_VERSION}")
199
+ list(APPEND CMAKE_REQUIRED_DEFINITIONS "-D_WIN32_WINNT=${CURL_TARGET_WINDOWS_VERSION}") # Apply to all feature checks
200
+ endif()
201
+
202
+ # Detect actual value of _WIN32_WINNT and store as HAVE_WIN32_WINNT
203
+ curl_internal_test(HAVE_WIN32_WINNT)
204
+ if(HAVE_WIN32_WINNT)
205
+ string(REGEX MATCH ".*_WIN32_WINNT=0x[0-9a-fA-F]+" CURL_TEST_OUTPUT "${CURL_TEST_OUTPUT}")
206
+ string(REGEX REPLACE ".*_WIN32_WINNT=" "" CURL_TEST_OUTPUT "${CURL_TEST_OUTPUT}")
207
+ string(REGEX REPLACE "0x([0-9a-f][0-9a-f][0-9a-f])$" "0x0\\1" CURL_TEST_OUTPUT "${CURL_TEST_OUTPUT}") # pad to 4 digits
208
+ string(TOLOWER "${CURL_TEST_OUTPUT}" HAVE_WIN32_WINNT)
209
+ message(STATUS "Found _WIN32_WINNT=${HAVE_WIN32_WINNT}")
210
+ endif()
211
+ # Avoid storing HAVE_WIN32_WINNT in CMake cache
212
+ unset(HAVE_WIN32_WINNT CACHE)
213
+ endif()
214
+ option(CURL_LTO "Enable compiler Link Time Optimizations" OFF)
215
+
216
+ cmake_dependent_option(ENABLE_THREADED_RESOLVER "Enable threaded DNS lookup"
217
+ ON "NOT ENABLE_ARES"
218
+ OFF)
219
+
220
+ include(PickyWarnings)
221
+
222
+ if(CMAKE_SYSTEM_NAME MATCHES "Linux")
223
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_GNU_SOURCE") # Required for sendmmsg()
224
+ endif()
225
+
226
+ option(ENABLE_DEBUG "Enable curl debug features (for developing curl itself)" OFF)
227
+ if(ENABLE_DEBUG)
228
+ message(WARNING "This curl build is Debug-enabled, do not use in production.")
229
+ endif()
230
+ option(ENABLE_CURLDEBUG "Enable TrackMemory debug feature" ${ENABLE_DEBUG})
231
+
232
+ if(MSVC)
233
+ set(ENABLE_CURLDEBUG OFF) # FIXME: TrackMemory + MSVC fails test 558 and 1330. Tested with static build, Debug mode.
234
+ endif()
235
+
236
+ if(ENABLE_DEBUG)
237
+ set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS "DEBUGBUILD")
238
+ endif()
239
+
240
+ if(ENABLE_CURLDEBUG)
241
+ set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS "CURLDEBUG")
242
+ endif()
243
+
244
+ # For debug libs and exes, add "-d" postfix
245
+ if(NOT DEFINED CMAKE_DEBUG_POSTFIX)
246
+ set(CMAKE_DEBUG_POSTFIX "-d")
247
+ endif()
248
+
249
+ set(LIB_STATIC "libcurl_static")
250
+ set(LIB_SHARED "libcurl_shared")
251
+
252
+ if(NOT BUILD_SHARED_LIBS AND NOT BUILD_STATIC_LIBS)
253
+ set(BUILD_STATIC_LIBS ON)
254
+ endif()
255
+ if(NOT BUILD_STATIC_CURL AND NOT BUILD_SHARED_LIBS)
256
+ set(BUILD_STATIC_CURL ON)
257
+ elseif(BUILD_STATIC_CURL AND NOT BUILD_STATIC_LIBS)
258
+ set(BUILD_STATIC_CURL OFF)
259
+ endif()
260
+
261
+ # Lib flavour selected for curl tool
262
+ if(BUILD_STATIC_CURL)
263
+ set(LIB_SELECTED_FOR_EXE ${LIB_STATIC})
264
+ else()
265
+ set(LIB_SELECTED_FOR_EXE ${LIB_SHARED})
266
+ endif()
267
+
268
+ # Lib flavour selected for example and test programs.
269
+ if(BUILD_SHARED_LIBS)
270
+ set(LIB_SELECTED ${LIB_SHARED})
271
+ else()
272
+ set(LIB_SELECTED ${LIB_STATIC})
273
+ endif()
274
+
275
+ # Override to force-disable or force-enable the use of pkg-config.
276
+ if(UNIX OR VCPKG_TOOLCHAIN OR (MINGW AND NOT CMAKE_CROSSCOMPILING)) # Keep in sync with CMake/curl-config.cmake.in
277
+ set(_curl_use_pkgconfig_default ON)
278
+ else()
279
+ set(_curl_use_pkgconfig_default OFF)
280
+ endif()
281
+ option(CURL_USE_PKGCONFIG "Enable pkg-config to detect dependencies" ${_curl_use_pkgconfig_default})
282
+
283
+ # Initialize variables collecting dependency libs, paths, pkg-config names.
284
+ set(CURL_LIBS "")
285
+ set(CURL_LIBDIRS "")
286
+ set(LIBCURL_PC_REQUIRES_PRIVATE "")
287
+
288
+ if(ENABLE_ARES)
289
+ set(USE_ARES 1)
290
+ find_package(Cares REQUIRED)
291
+ list(APPEND CURL_LIBS ${CARES_LIBRARIES})
292
+ list(APPEND LIBCURL_PC_REQUIRES_PRIVATE "libcares")
293
+ add_definitions("-DCARES_NO_DEPRECATED") # Ignore c-ares deprecation warnings
294
+ endif()
295
+
296
+ include(CurlSymbolHiding)
297
+
298
+ option(CURL_ENABLE_EXPORT_TARGET "Enable CMake export target" ON)
299
+ mark_as_advanced(CURL_ENABLE_EXPORT_TARGET)
300
+
301
+ option(CURL_DISABLE_ALTSVC "Disable alt-svc support" OFF)
302
+ mark_as_advanced(CURL_DISABLE_ALTSVC)
303
+ option(CURL_DISABLE_SRP "Disable TLS-SRP support" OFF)
304
+ mark_as_advanced(CURL_DISABLE_SRP)
305
+ option(CURL_DISABLE_COOKIES "Disable cookies support" OFF)
306
+ mark_as_advanced(CURL_DISABLE_COOKIES)
307
+ option(CURL_DISABLE_BASIC_AUTH "Disable Basic authentication" OFF)
308
+ mark_as_advanced(CURL_DISABLE_BASIC_AUTH)
309
+ option(CURL_DISABLE_BEARER_AUTH "Disable Bearer authentication" OFF)
310
+ mark_as_advanced(CURL_DISABLE_BEARER_AUTH)
311
+ option(CURL_DISABLE_DIGEST_AUTH "Disable Digest authentication" OFF)
312
+ mark_as_advanced(CURL_DISABLE_DIGEST_AUTH)
313
+ option(CURL_DISABLE_KERBEROS_AUTH "Disable Kerberos authentication" OFF)
314
+ mark_as_advanced(CURL_DISABLE_KERBEROS_AUTH)
315
+ option(CURL_DISABLE_NEGOTIATE_AUTH "Disable negotiate authentication" OFF)
316
+ mark_as_advanced(CURL_DISABLE_NEGOTIATE_AUTH)
317
+ option(CURL_DISABLE_AWS "Disable aws-sigv4" OFF)
318
+ mark_as_advanced(CURL_DISABLE_AWS)
319
+ option(CURL_DISABLE_DICT "Disable DICT" OFF)
320
+ mark_as_advanced(CURL_DISABLE_DICT)
321
+ option(CURL_DISABLE_DOH "Disable DNS-over-HTTPS" OFF)
322
+ mark_as_advanced(CURL_DISABLE_DOH)
323
+ option(CURL_DISABLE_FILE "Disable FILE" OFF)
324
+ mark_as_advanced(CURL_DISABLE_FILE)
325
+ option(CURL_DISABLE_FTP "Disable FTP" OFF)
326
+ mark_as_advanced(CURL_DISABLE_FTP)
327
+ option(CURL_DISABLE_GETOPTIONS "Disable curl_easy_options API for existing options to curl_easy_setopt" OFF)
328
+ mark_as_advanced(CURL_DISABLE_GETOPTIONS)
329
+ option(CURL_DISABLE_GOPHER "Disable Gopher" OFF)
330
+ mark_as_advanced(CURL_DISABLE_GOPHER)
331
+ option(CURL_DISABLE_HEADERS_API "Disable headers-api support" OFF)
332
+ mark_as_advanced(CURL_DISABLE_HEADERS_API)
333
+ option(CURL_DISABLE_HSTS "Disable HSTS support" OFF)
334
+ mark_as_advanced(CURL_DISABLE_HSTS)
335
+ option(CURL_DISABLE_HTTP "Disable HTTP" OFF)
336
+ mark_as_advanced(CURL_DISABLE_HTTP)
337
+ option(CURL_DISABLE_HTTP_AUTH "Disable all HTTP authentication methods" OFF)
338
+ mark_as_advanced(CURL_DISABLE_HTTP_AUTH)
339
+ option(CURL_DISABLE_IMAP "Disable IMAP" OFF)
340
+ mark_as_advanced(CURL_DISABLE_IMAP)
341
+ option(CURL_DISABLE_LDAP "Disable LDAP" OFF)
342
+ mark_as_advanced(CURL_DISABLE_LDAP)
343
+ option(CURL_DISABLE_LDAPS "Disable LDAPS" ${CURL_DISABLE_LDAP})
344
+ mark_as_advanced(CURL_DISABLE_LDAPS)
345
+ option(CURL_DISABLE_LIBCURL_OPTION "Disable --libcurl option from the curl tool" OFF)
346
+ mark_as_advanced(CURL_DISABLE_LIBCURL_OPTION)
347
+ option(CURL_DISABLE_MIME "Disable MIME support" OFF)
348
+ mark_as_advanced(CURL_DISABLE_MIME)
349
+ cmake_dependent_option(CURL_DISABLE_FORM_API "Disable form-api"
350
+ OFF "NOT CURL_DISABLE_MIME"
351
+ ON)
352
+ mark_as_advanced(CURL_DISABLE_FORM_API)
353
+ option(CURL_DISABLE_MQTT "Disable MQTT" OFF)
354
+ mark_as_advanced(CURL_DISABLE_MQTT)
355
+ option(CURL_DISABLE_BINDLOCAL "Disable local binding support" OFF)
356
+ mark_as_advanced(CURL_DISABLE_BINDLOCAL)
357
+ option(CURL_DISABLE_NETRC "Disable netrc parser" OFF)
358
+ mark_as_advanced(CURL_DISABLE_NETRC)
359
+ option(CURL_DISABLE_NTLM "Disable NTLM support" OFF)
360
+ mark_as_advanced(CURL_DISABLE_NTLM)
361
+ option(CURL_DISABLE_PARSEDATE "Disable date parsing" OFF)
362
+ mark_as_advanced(CURL_DISABLE_PARSEDATE)
363
+ option(CURL_DISABLE_POP3 "Disable POP3" OFF)
364
+ mark_as_advanced(CURL_DISABLE_POP3)
365
+ option(CURL_DISABLE_PROGRESS_METER "Disable built-in progress meter" OFF)
366
+ mark_as_advanced(CURL_DISABLE_PROGRESS_METER)
367
+ option(CURL_DISABLE_PROXY "Disable proxy support" OFF)
368
+ mark_as_advanced(CURL_DISABLE_PROXY)
369
+ option(CURL_DISABLE_IPFS "Disable IPFS" OFF)
370
+ mark_as_advanced(CURL_DISABLE_IPFS)
371
+ option(CURL_DISABLE_RTSP "Disable RTSP" OFF)
372
+ mark_as_advanced(CURL_DISABLE_SHA512_256)
373
+ option(CURL_DISABLE_SHA512_256 "Disable SHA-512/256 hash algorithm" OFF)
374
+ mark_as_advanced(CURL_DISABLE_RTSP)
375
+ option(CURL_DISABLE_SHUFFLE_DNS "Disable shuffle DNS feature" OFF)
376
+ mark_as_advanced(CURL_DISABLE_SHUFFLE_DNS)
377
+ option(CURL_DISABLE_SMB "Disable SMB" OFF)
378
+ mark_as_advanced(CURL_DISABLE_SMB)
379
+ option(CURL_DISABLE_SMTP "Disable SMTP" OFF)
380
+ mark_as_advanced(CURL_DISABLE_SMTP)
381
+ option(CURL_DISABLE_SOCKETPAIR "Disable use of socketpair for curl_multi_poll" OFF)
382
+ mark_as_advanced(CURL_DISABLE_SOCKETPAIR)
383
+ option(CURL_DISABLE_WEBSOCKETS "Disable WebSocket" OFF)
384
+ mark_as_advanced(CURL_DISABLE_WEBSOCKETS)
385
+ option(CURL_DISABLE_TELNET "Disable Telnet" OFF)
386
+ mark_as_advanced(CURL_DISABLE_TELNET)
387
+ option(CURL_DISABLE_TFTP "Disable TFTP" OFF)
388
+ mark_as_advanced(CURL_DISABLE_TFTP)
389
+ option(CURL_DISABLE_VERBOSE_STRINGS "Disable verbose strings" OFF)
390
+ mark_as_advanced(CURL_DISABLE_VERBOSE_STRINGS)
391
+
392
+ if(CURL_DISABLE_HTTP)
393
+ set(CURL_DISABLE_IPFS ON)
394
+ set(CURL_DISABLE_RTSP ON)
395
+ set(CURL_DISABLE_ALTSVC ON)
396
+ set(CURL_DISABLE_HSTS ON)
397
+ endif()
398
+
399
+ # Corresponds to HTTP_ONLY in lib/curl_setup.h
400
+ option(HTTP_ONLY "Disable all protocols except HTTP (This overrides all CURL_DISABLE_* options)" OFF)
401
+ mark_as_advanced(HTTP_ONLY)
402
+
403
+ if(HTTP_ONLY)
404
+ set(CURL_DISABLE_DICT ON)
405
+ set(CURL_DISABLE_FILE ON)
406
+ set(CURL_DISABLE_FTP ON)
407
+ set(CURL_DISABLE_GOPHER ON)
408
+ set(CURL_DISABLE_IMAP ON)
409
+ set(CURL_DISABLE_LDAP ON)
410
+ set(CURL_DISABLE_LDAPS ON)
411
+ set(CURL_DISABLE_MQTT ON)
412
+ set(CURL_DISABLE_POP3 ON)
413
+ set(CURL_DISABLE_IPFS ON)
414
+ set(CURL_DISABLE_RTSP ON)
415
+ set(CURL_DISABLE_SMB ON)
416
+ set(CURL_DISABLE_SMTP ON)
417
+ set(CURL_DISABLE_TELNET ON)
418
+ set(CURL_DISABLE_TFTP ON)
419
+ endif()
420
+
421
+ if(WINDOWS_STORE)
422
+ set(CURL_DISABLE_TELNET ON) # telnet code needs fixing to compile for UWP.
423
+ endif()
424
+
425
+ option(ENABLE_IPV6 "Enable IPv6 support" ON)
426
+ mark_as_advanced(ENABLE_IPV6)
427
+ if(ENABLE_IPV6 AND NOT WIN32)
428
+ include(CheckStructHasMember)
429
+ check_struct_has_member("struct sockaddr_in6" "sin6_addr" "netinet/in.h" HAVE_SOCKADDR_IN6_SIN6_ADDR)
430
+ check_struct_has_member("struct sockaddr_in6" "sin6_scope_id" "netinet/in.h" HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID)
431
+ if(NOT HAVE_SOCKADDR_IN6_SIN6_ADDR)
432
+ message(WARNING "struct sockaddr_in6 not available, disabling IPv6 support")
433
+ # Force the feature off as this name is used as guard macro...
434
+ set(ENABLE_IPV6 OFF CACHE BOOL "Enable IPv6 support" FORCE)
435
+ endif()
436
+
437
+ if(APPLE AND NOT ENABLE_ARES)
438
+ set(_use_core_foundation_and_core_services ON)
439
+
440
+ find_library(SYSTEMCONFIGURATION_FRAMEWORK "SystemConfiguration")
441
+ mark_as_advanced(SYSTEMCONFIGURATION_FRAMEWORK)
442
+ if(NOT SYSTEMCONFIGURATION_FRAMEWORK)
443
+ message(FATAL_ERROR "SystemConfiguration framework not found")
444
+ endif()
445
+
446
+ list(APPEND CURL_LIBS "-framework SystemConfiguration")
447
+ endif()
448
+ endif()
449
+ if(ENABLE_IPV6)
450
+ set(USE_IPV6 ON)
451
+ endif()
452
+
453
+ find_package(Perl)
454
+
455
+ option(BUILD_LIBCURL_DOCS "Build libcurl man pages" ON)
456
+ option(BUILD_MISC_DOCS "Build misc man pages (e.g. curl-config and mk-ca-bundle)" ON)
457
+ option(ENABLE_CURL_MANUAL "Build the man page for curl and enable its -M/--manual option" ON)
458
+
459
+ if(ENABLE_CURL_MANUAL OR BUILD_LIBCURL_DOCS)
460
+ if(PERL_FOUND)
461
+ set(HAVE_MANUAL_TOOLS ON)
462
+ endif()
463
+ if(NOT HAVE_MANUAL_TOOLS)
464
+ message(WARNING "Perl not found. Will not build manuals.")
465
+ endif()
466
+ endif()
467
+
468
+ # Disable warnings on Borland to avoid changing 3rd party code.
469
+ if(BORLAND)
470
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -w-")
471
+ endif()
472
+
473
+ # If we are on AIX, do the _ALL_SOURCE magic
474
+ if(CMAKE_SYSTEM_NAME STREQUAL "AIX")
475
+ add_definitions("-D_ALL_SOURCE")
476
+ endif()
477
+
478
+ # If we are on Haiku, make sure that the network library is brought in.
479
+ if(CMAKE_SYSTEM_NAME STREQUAL "Haiku")
480
+ list(APPEND CURL_LIBS "network")
481
+ endif()
482
+
483
+ # Include all the necessary files for macros
484
+ include(CMakePushCheckState)
485
+ include(CheckFunctionExists)
486
+ include(CheckIncludeFile)
487
+ include(CheckIncludeFiles)
488
+ include(CheckLibraryExists)
489
+ include(CheckSymbolExists)
490
+ include(CheckTypeSize)
491
+ include(CheckCSourceCompiles)
492
+
493
+ # Preload settings on Windows
494
+ if(WIN32)
495
+ include("${CMAKE_CURRENT_SOURCE_DIR}/CMake/Platforms/WindowsCache.cmake")
496
+ elseif(APPLE)
497
+ # Fast-track predictable feature detections
498
+ set(HAVE_EVENTFD 0)
499
+ set(HAVE_GETPASS_R 0)
500
+ set(HAVE_SENDMMSG 0)
501
+ endif()
502
+
503
+ if(ENABLE_THREADED_RESOLVER)
504
+ if(WIN32)
505
+ set(USE_THREADS_WIN32 ON)
506
+ else()
507
+ find_package(Threads REQUIRED)
508
+ set(USE_THREADS_POSIX ${CMAKE_USE_PTHREADS_INIT})
509
+ set(HAVE_PTHREAD_H ${CMAKE_USE_PTHREADS_INIT})
510
+ list(APPEND CURL_LIBS ${CMAKE_THREAD_LIBS_INIT})
511
+ endif()
512
+ endif()
513
+
514
+ # Check for all needed libraries
515
+ if(NOT WIN32 AND NOT APPLE)
516
+ check_library_exists("socket" "connect" "" HAVE_LIBSOCKET)
517
+ if(HAVE_LIBSOCKET)
518
+ set(CURL_LIBS "socket;${CURL_LIBS}")
519
+ endif()
520
+ endif()
521
+
522
+ check_function_exists("gethostname" HAVE_GETHOSTNAME)
523
+
524
+ if(WIN32)
525
+ list(APPEND CURL_LIBS "ws2_32" "bcrypt")
526
+ endif()
527
+
528
+ # Check SSL libraries
529
+ option(CURL_ENABLE_SSL "Enable SSL support" ON)
530
+
531
+ if(CURL_DEFAULT_SSL_BACKEND)
532
+ set(_valid_default_ssl_backend FALSE)
533
+ endif()
534
+
535
+ if(APPLE)
536
+ cmake_dependent_option(CURL_USE_SECTRANSP "Enable Apple OS native SSL/TLS (Secure Transport)" OFF CURL_ENABLE_SSL OFF)
537
+ endif()
538
+ if(WIN32)
539
+ cmake_dependent_option(CURL_USE_SCHANNEL "Enable Windows native SSL/TLS (Schannel)" OFF CURL_ENABLE_SSL OFF)
540
+ option(CURL_WINDOWS_SSPI "Enable SSPI on Windows" ${CURL_USE_SCHANNEL})
541
+ endif()
542
+ cmake_dependent_option(CURL_USE_MBEDTLS "Enable mbedTLS for SSL/TLS" OFF CURL_ENABLE_SSL OFF)
543
+ cmake_dependent_option(CURL_USE_BEARSSL "Enable BearSSL for SSL/TLS" OFF CURL_ENABLE_SSL OFF)
544
+ cmake_dependent_option(CURL_USE_WOLFSSL "Enable wolfSSL for SSL/TLS" OFF CURL_ENABLE_SSL OFF)
545
+ cmake_dependent_option(CURL_USE_GNUTLS "Enable GnuTLS for SSL/TLS" OFF CURL_ENABLE_SSL OFF)
546
+ cmake_dependent_option(CURL_USE_RUSTLS "Enable Rustls for SSL/TLS" OFF CURL_ENABLE_SSL OFF)
547
+
548
+ if(WIN32 OR
549
+ CURL_USE_SECTRANSP OR
550
+ CURL_USE_SCHANNEL OR
551
+ CURL_USE_MBEDTLS OR
552
+ CURL_USE_BEARSSL OR
553
+ CURL_USE_WOLFSSL OR
554
+ CURL_USE_GNUTLS OR
555
+ CURL_USE_RUSTLS)
556
+ set(_openssl_default OFF)
557
+ else()
558
+ set(_openssl_default ON)
559
+ endif()
560
+ cmake_dependent_option(CURL_USE_OPENSSL "Enable OpenSSL for SSL/TLS" ${_openssl_default} CURL_ENABLE_SSL OFF)
561
+ option(USE_OPENSSL_QUIC "Use OpenSSL and nghttp3 libraries for HTTP/3 support" OFF)
562
+ if(USE_OPENSSL_QUIC AND NOT CURL_USE_OPENSSL)
563
+ message(WARNING "OpenSSL QUIC has been requested, but without enabling OpenSSL. Will not enable QUIC.")
564
+ set(USE_OPENSSL_QUIC OFF)
565
+ endif()
566
+ option(CURL_DISABLE_OPENSSL_AUTO_LOAD_CONFIG "Disable automatic loading of OpenSSL configuration" OFF)
567
+
568
+ count_true(_enabled_ssl_options_count
569
+ CURL_USE_SCHANNEL
570
+ CURL_USE_SECTRANSP
571
+ CURL_USE_OPENSSL
572
+ CURL_USE_MBEDTLS
573
+ CURL_USE_BEARSSL
574
+ CURL_USE_WOLFSSL
575
+ CURL_USE_GNUTLS
576
+ CURL_USE_RUSTLS
577
+ )
578
+ if(_enabled_ssl_options_count GREATER 1)
579
+ set(CURL_WITH_MULTI_SSL ON)
580
+ elseif(_enabled_ssl_options_count EQUAL 0)
581
+ set(CURL_DISABLE_HSTS ON)
582
+ endif()
583
+
584
+ if(CURL_USE_SCHANNEL)
585
+ set(_ssl_enabled ON)
586
+ set(USE_SCHANNEL ON) # Windows native SSL/TLS support
587
+ set(USE_WINDOWS_SSPI ON) # CURL_USE_SCHANNEL implies CURL_WINDOWS_SSPI
588
+
589
+ if(CURL_DEFAULT_SSL_BACKEND AND CURL_DEFAULT_SSL_BACKEND STREQUAL "schannel")
590
+ set(_valid_default_ssl_backend TRUE)
591
+ endif()
592
+ endif()
593
+ if(CURL_WINDOWS_SSPI)
594
+ set(USE_WINDOWS_SSPI ON)
595
+ endif()
596
+
597
+ if(CURL_USE_SECTRANSP)
598
+ set(_use_core_foundation_and_core_services ON)
599
+
600
+ find_library(SECURITY_FRAMEWORK "Security")
601
+ mark_as_advanced(SECURITY_FRAMEWORK)
602
+ if(NOT SECURITY_FRAMEWORK)
603
+ message(FATAL_ERROR "Security framework not found")
604
+ endif()
605
+
606
+ set(_ssl_enabled ON)
607
+ set(USE_SECTRANSP ON)
608
+ list(APPEND CURL_LIBS "-framework Security")
609
+
610
+ if(CURL_DEFAULT_SSL_BACKEND AND CURL_DEFAULT_SSL_BACKEND STREQUAL "secure-transport")
611
+ set(_valid_default_ssl_backend TRUE)
612
+ endif()
613
+
614
+ message(WARNING "Secure Transport does not support TLS 1.3.")
615
+ endif()
616
+
617
+ if(_use_core_foundation_and_core_services)
618
+ find_library(COREFOUNDATION_FRAMEWORK "CoreFoundation")
619
+ mark_as_advanced(COREFOUNDATION_FRAMEWORK)
620
+ find_library(CORESERVICES_FRAMEWORK "CoreServices")
621
+ mark_as_advanced(CORESERVICES_FRAMEWORK)
622
+
623
+ if(NOT COREFOUNDATION_FRAMEWORK)
624
+ message(FATAL_ERROR "CoreFoundation framework not found")
625
+ endif()
626
+ if(NOT CORESERVICES_FRAMEWORK)
627
+ message(FATAL_ERROR "CoreServices framework not found")
628
+ endif()
629
+
630
+ list(APPEND CURL_LIBS "-framework CoreFoundation" "-framework CoreServices")
631
+ endif()
632
+
633
+ if(CURL_USE_OPENSSL)
634
+ find_package(OpenSSL REQUIRED)
635
+ set(_ssl_enabled ON)
636
+ set(USE_OPENSSL ON)
637
+
638
+ # Depend on OpenSSL via imported targets. This allows our dependents to
639
+ # get our dependencies transitively.
640
+ list(APPEND CURL_LIBS OpenSSL::SSL OpenSSL::Crypto)
641
+ list(APPEND LIBCURL_PC_REQUIRES_PRIVATE "openssl")
642
+
643
+ if(CURL_DEFAULT_SSL_BACKEND AND CURL_DEFAULT_SSL_BACKEND STREQUAL "openssl")
644
+ set(_valid_default_ssl_backend TRUE)
645
+ endif()
646
+ set(_curl_ca_bundle_supported TRUE)
647
+
648
+ cmake_push_check_state()
649
+ set(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR})
650
+ if(NOT DEFINED HAVE_BORINGSSL)
651
+ check_symbol_exists("OPENSSL_IS_BORINGSSL" "openssl/base.h" HAVE_BORINGSSL)
652
+ endif()
653
+ if(NOT DEFINED HAVE_AWSLC)
654
+ check_symbol_exists("OPENSSL_IS_AWSLC" "openssl/base.h" HAVE_AWSLC)
655
+ endif()
656
+ cmake_pop_check_state()
657
+ endif()
658
+
659
+ if(CURL_USE_MBEDTLS)
660
+ find_package(MbedTLS REQUIRED)
661
+ set(_ssl_enabled ON)
662
+ set(USE_MBEDTLS ON)
663
+ list(APPEND CURL_LIBS ${MBEDTLS_LIBRARIES})
664
+ list(APPEND CURL_LIBDIRS ${MBEDTLS_LIBRARY_DIRS})
665
+ list(APPEND LIBCURL_PC_REQUIRES_PRIVATE ${MBEDTLS_PC_REQUIRES})
666
+ include_directories(SYSTEM ${MBEDTLS_INCLUDE_DIRS})
667
+ link_directories(${MBEDTLS_LIBRARY_DIRS})
668
+ if(MBEDTLS_CFLAGS)
669
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${MBEDTLS_CFLAGS}")
670
+ endif()
671
+
672
+ if(CURL_DEFAULT_SSL_BACKEND AND CURL_DEFAULT_SSL_BACKEND STREQUAL "mbedtls")
673
+ set(_valid_default_ssl_backend TRUE)
674
+ endif()
675
+ set(_curl_ca_bundle_supported TRUE)
676
+ endif()
677
+
678
+ if(CURL_USE_BEARSSL)
679
+ find_package(BearSSL REQUIRED)
680
+ set(_ssl_enabled ON)
681
+ set(USE_BEARSSL ON)
682
+ list(APPEND CURL_LIBS ${BEARSSL_LIBRARIES})
683
+ include_directories(SYSTEM ${BEARSSL_INCLUDE_DIRS})
684
+
685
+ if(CURL_DEFAULT_SSL_BACKEND AND CURL_DEFAULT_SSL_BACKEND STREQUAL "bearssl")
686
+ set(_valid_default_ssl_backend TRUE)
687
+ endif()
688
+ set(_curl_ca_bundle_supported TRUE)
689
+
690
+ message(WARNING "BearSSL does not support TLS 1.3.")
691
+ endif()
692
+
693
+ if(CURL_USE_WOLFSSL)
694
+ find_package(WolfSSL REQUIRED)
695
+ set(_ssl_enabled ON)
696
+ set(USE_WOLFSSL ON)
697
+ list(APPEND CURL_LIBS ${WOLFSSL_LIBRARIES})
698
+ list(APPEND CURL_LIBDIRS ${WOLFSSL_LIBRARY_DIRS})
699
+ list(APPEND LIBCURL_PC_REQUIRES_PRIVATE "wolfssl")
700
+ include_directories(SYSTEM ${WOLFSSL_INCLUDE_DIRS})
701
+ link_directories(${WOLFSSL_LIBRARY_DIRS})
702
+ if(WOLFSSL_CFLAGS)
703
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${WOLFSSL_CFLAGS}")
704
+ endif()
705
+
706
+ if(CURL_DEFAULT_SSL_BACKEND AND CURL_DEFAULT_SSL_BACKEND STREQUAL "wolfssl")
707
+ set(_valid_default_ssl_backend TRUE)
708
+ endif()
709
+ set(_curl_ca_bundle_supported TRUE)
710
+ endif()
711
+
712
+ if(CURL_USE_GNUTLS)
713
+ if(CURL_USE_PKGCONFIG)
714
+ find_package(PkgConfig QUIET)
715
+ pkg_check_modules(GNUTLS "gnutls")
716
+ if(GNUTLS_FOUND)
717
+ set(GNUTLS_LIBRARIES ${GNUTLS_LINK_LIBRARIES})
718
+ endif()
719
+ endif()
720
+ if(NOT GNUTLS_FOUND)
721
+ find_package(GnuTLS REQUIRED)
722
+ endif()
723
+ find_package(Nettle REQUIRED)
724
+ set(_ssl_enabled ON)
725
+ set(USE_GNUTLS ON)
726
+ list(APPEND CURL_LIBS ${GNUTLS_LIBRARIES} ${NETTLE_LIBRARIES})
727
+ list(APPEND CURL_LIBDIRS ${NETTLE_LIBRARY_DIRS})
728
+ list(APPEND LIBCURL_PC_REQUIRES_PRIVATE "gnutls" "nettle")
729
+ include_directories(SYSTEM ${GNUTLS_INCLUDE_DIRS} ${NETTLE_INCLUDE_DIRS})
730
+ link_directories(${NETTLE_LIBRARY_DIRS})
731
+ if(NETTLE_CFLAGS)
732
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${NETTLE_CFLAGS}")
733
+ endif()
734
+
735
+ if(CURL_DEFAULT_SSL_BACKEND AND CURL_DEFAULT_SSL_BACKEND STREQUAL "gnutls")
736
+ set(_valid_default_ssl_backend TRUE)
737
+ endif()
738
+ set(_curl_ca_bundle_supported TRUE)
739
+
740
+ if(NOT DEFINED HAVE_GNUTLS_SRP AND NOT CURL_DISABLE_SRP)
741
+ cmake_push_check_state()
742
+ set(CMAKE_REQUIRED_INCLUDES ${GNUTLS_INCLUDE_DIRS})
743
+ set(CMAKE_REQUIRED_LIBRARIES ${GNUTLS_LIBRARIES})
744
+ check_symbol_exists("gnutls_srp_verifier" "gnutls/gnutls.h" HAVE_GNUTLS_SRP)
745
+ cmake_pop_check_state()
746
+ endif()
747
+ endif()
748
+
749
+ if(CURL_USE_RUSTLS)
750
+ find_package(Rustls REQUIRED)
751
+ set(_ssl_enabled ON)
752
+ set(USE_RUSTLS ON)
753
+ list(APPEND CURL_LIBS ${RUSTLS_LIBRARIES})
754
+ list(APPEND CURL_LIBDIRS ${RUSTLS_LIBRARY_DIRS})
755
+ list(APPEND LIBCURL_PC_REQUIRES_PRIVATE ${RUSTLS_PC_REQUIRES})
756
+ include_directories(SYSTEM ${RUSTLS_INCLUDE_DIRS})
757
+ link_directories(${RUSTLS_LIBRARY_DIRS})
758
+ if(RUSTLS_CFLAGS)
759
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${RUSTLS_CFLAGS}")
760
+ endif()
761
+
762
+ if(CURL_DEFAULT_SSL_BACKEND AND CURL_DEFAULT_SSL_BACKEND STREQUAL "rustls")
763
+ set(_valid_default_ssl_backend TRUE)
764
+ endif()
765
+ set(_curl_ca_bundle_supported TRUE)
766
+ endif()
767
+
768
+ if(CURL_DEFAULT_SSL_BACKEND AND NOT _valid_default_ssl_backend)
769
+ message(FATAL_ERROR "CURL_DEFAULT_SSL_BACKEND '${CURL_DEFAULT_SSL_BACKEND}' not enabled.")
770
+ endif()
771
+
772
+ # Keep ZLIB detection after TLS detection,
773
+ # and before calling openssl_check_symbol_exists().
774
+
775
+ set(HAVE_LIBZ OFF)
776
+ curl_dependency_option(ZLIB)
777
+ if(ZLIB_FOUND)
778
+ set(HAVE_LIBZ ON)
779
+
780
+ # Depend on ZLIB via imported targets. This allows our dependents to
781
+ # get our dependencies transitively.
782
+ list(APPEND CURL_LIBS ZLIB::ZLIB)
783
+ list(APPEND LIBCURL_PC_REQUIRES_PRIVATE "zlib")
784
+ endif()
785
+
786
+ option(CURL_BROTLI "Use brotli" OFF)
787
+ set(HAVE_BROTLI OFF)
788
+ if(CURL_BROTLI)
789
+ find_package(Brotli REQUIRED)
790
+ if(BROTLI_FOUND)
791
+ set(HAVE_BROTLI ON)
792
+ list(APPEND CURL_LIBS ${BROTLI_LIBRARIES})
793
+ list(APPEND LIBCURL_PC_REQUIRES_PRIVATE "libbrotlidec")
794
+ include_directories(SYSTEM ${BROTLI_INCLUDE_DIRS})
795
+ endif()
796
+ endif()
797
+
798
+ option(CURL_ZSTD "Use zstd" OFF)
799
+ set(HAVE_ZSTD OFF)
800
+ if(CURL_ZSTD)
801
+ find_package(Zstd REQUIRED)
802
+ if(ZSTD_FOUND AND NOT ZSTD_VERSION VERSION_LESS 1.0.0)
803
+ set(HAVE_ZSTD ON)
804
+ list(APPEND CURL_LIBS ${ZSTD_LIBRARIES})
805
+ list(APPEND LIBCURL_PC_REQUIRES_PRIVATE "libzstd")
806
+ include_directories(SYSTEM ${ZSTD_INCLUDE_DIRS})
807
+ else()
808
+ message(WARNING "zstd v1.0.0 or newer is required, disabling zstd support.")
809
+ endif()
810
+ endif()
811
+
812
+ # Check symbol in an OpenSSL-like TLS backend, or in _extra_libs depending on it.
813
+ macro(openssl_check_symbol_exists _symbol _files _variable _extra_libs)
814
+ cmake_push_check_state()
815
+ if(USE_OPENSSL)
816
+ set(CMAKE_REQUIRED_INCLUDES "${OPENSSL_INCLUDE_DIR}")
817
+ set(CMAKE_REQUIRED_LIBRARIES "${OPENSSL_LIBRARIES}")
818
+ if(HAVE_LIBZ)
819
+ list(APPEND CMAKE_REQUIRED_LIBRARIES "${ZLIB_LIBRARIES}")
820
+ endif()
821
+ if(WIN32)
822
+ list(APPEND CMAKE_REQUIRED_LIBRARIES "ws2_32")
823
+ list(APPEND CMAKE_REQUIRED_LIBRARIES "bcrypt") # for OpenSSL/LibreSSL
824
+ endif()
825
+ elseif(USE_WOLFSSL)
826
+ set(CMAKE_REQUIRED_INCLUDES "${WOLFSSL_INCLUDE_DIRS}")
827
+ set(CMAKE_REQUIRED_LIBRARIES "${WOLFSSL_LIBRARIES}")
828
+ curl_required_libpaths("${WOLFSSL_LIBRARY_DIRS}")
829
+ if(HAVE_LIBZ)
830
+ list(APPEND CMAKE_REQUIRED_INCLUDES "${ZLIB_INCLUDE_DIRS}") # Public wolfSSL headers require zlib headers
831
+ list(APPEND CMAKE_REQUIRED_LIBRARIES "${ZLIB_LIBRARIES}")
832
+ endif()
833
+ if(WIN32)
834
+ list(APPEND CMAKE_REQUIRED_LIBRARIES "ws2_32" "crypt32")
835
+ endif()
836
+ list(APPEND CMAKE_REQUIRED_DEFINITIONS "-DHAVE_UINTPTR_T") # to pull in stdint.h (as of wolfSSL v5.5.4)
837
+ endif()
838
+ list(APPEND CMAKE_REQUIRED_LIBRARIES "${_extra_libs}")
839
+ check_symbol_exists("${_symbol}" "${_files}" "${_variable}")
840
+ cmake_pop_check_state()
841
+ endmacro()
842
+
843
+ # Ensure that the OpenSSL fork actually supports QUIC.
844
+ macro(openssl_check_quic)
845
+ if(NOT DEFINED HAVE_SSL_CTX_SET_QUIC_METHOD)
846
+ if(USE_OPENSSL)
847
+ openssl_check_symbol_exists("SSL_CTX_set_quic_method" "openssl/ssl.h" HAVE_SSL_CTX_SET_QUIC_METHOD "")
848
+ elseif(USE_WOLFSSL)
849
+ openssl_check_symbol_exists("wolfSSL_set_quic_method" "wolfssl/options.h;wolfssl/openssl/ssl.h"
850
+ HAVE_SSL_CTX_SET_QUIC_METHOD "")
851
+ endif()
852
+ endif()
853
+ if(NOT HAVE_SSL_CTX_SET_QUIC_METHOD)
854
+ message(FATAL_ERROR "QUIC support is missing in OpenSSL fork. Try setting -DOPENSSL_ROOT_DIR")
855
+ endif()
856
+ endmacro()
857
+
858
+ if(USE_WOLFSSL)
859
+ openssl_check_symbol_exists("wolfSSL_DES_ecb_encrypt" "wolfssl/options.h;wolfssl/openssl/des.h" HAVE_WOLFSSL_DES_ECB_ENCRYPT "")
860
+ openssl_check_symbol_exists("wolfSSL_BIO_new" "wolfssl/options.h;wolfssl/ssl.h" HAVE_WOLFSSL_BIO "")
861
+ openssl_check_symbol_exists("wolfSSL_BIO_set_shutdown" "wolfssl/options.h;wolfssl/ssl.h" HAVE_WOLFSSL_FULL_BIO "")
862
+ endif()
863
+
864
+ if(USE_OPENSSL OR USE_WOLFSSL)
865
+ if(NOT DEFINED HAVE_SSL_SET0_WBIO)
866
+ openssl_check_symbol_exists("SSL_set0_wbio" "openssl/ssl.h" HAVE_SSL_SET0_WBIO "")
867
+ endif()
868
+ if(NOT DEFINED HAVE_OPENSSL_SRP AND NOT CURL_DISABLE_SRP)
869
+ openssl_check_symbol_exists("SSL_CTX_set_srp_username" "openssl/ssl.h" HAVE_OPENSSL_SRP "")
870
+ endif()
871
+ endif()
872
+
873
+ option(USE_HTTPSRR "Enable HTTPS RR support" OFF)
874
+ option(USE_ECH "Enable ECH support" OFF)
875
+ if(USE_ECH)
876
+ if(USE_OPENSSL OR USE_WOLFSSL)
877
+ # Be sure that the TLS library actually supports ECH.
878
+ if(NOT DEFINED HAVE_ECH)
879
+ if(USE_OPENSSL AND (HAVE_BORINGSSL OR HAVE_AWSLC))
880
+ openssl_check_symbol_exists("SSL_set1_ech_config_list" "openssl/ssl.h" HAVE_ECH "")
881
+ elseif(USE_OPENSSL)
882
+ openssl_check_symbol_exists("SSL_ech_set1_echconfig" "openssl/ech.h" HAVE_ECH "")
883
+ elseif(USE_WOLFSSL)
884
+ openssl_check_symbol_exists("wolfSSL_CTX_GenerateEchConfig" "wolfssl/options.h;wolfssl/ssl.h" HAVE_ECH "")
885
+ endif()
886
+ endif()
887
+ if(NOT HAVE_ECH)
888
+ message(FATAL_ERROR "ECH support missing in OpenSSL/BoringSSL/AWS-LC/wolfSSL")
889
+ else()
890
+ message(STATUS "ECH enabled.")
891
+ endif()
892
+ else()
893
+ message(FATAL_ERROR "ECH requires ECH-enablded OpenSSL, BoringSSL, AWS-LC or wolfSSL")
894
+ endif()
895
+ endif()
896
+
897
+ option(USE_NGHTTP2 "Use nghttp2 library" ON)
898
+ if(USE_NGHTTP2)
899
+ find_package(NGHTTP2)
900
+ if(NGHTTP2_FOUND)
901
+ include_directories(SYSTEM ${NGHTTP2_INCLUDE_DIRS})
902
+ list(APPEND CURL_LIBS ${NGHTTP2_LIBRARIES})
903
+ list(APPEND LIBCURL_PC_REQUIRES_PRIVATE "libnghttp2")
904
+ else()
905
+ set(USE_NGHTTP2 OFF)
906
+ endif()
907
+ endif()
908
+
909
+ option(USE_NGTCP2 "Use ngtcp2 and nghttp3 libraries for HTTP/3 support" OFF)
910
+ if(USE_NGTCP2)
911
+ if(USE_OPENSSL OR USE_WOLFSSL)
912
+ if(USE_WOLFSSL)
913
+ find_package(NGTCP2 REQUIRED "wolfSSL")
914
+ list(APPEND LIBCURL_PC_REQUIRES_PRIVATE "libngtcp2_crypto_wolfssl")
915
+ elseif(HAVE_BORINGSSL OR HAVE_AWSLC)
916
+ find_package(NGTCP2 REQUIRED "BoringSSL")
917
+ list(APPEND LIBCURL_PC_REQUIRES_PRIVATE "libngtcp2_crypto_boringssl")
918
+ else()
919
+ find_package(NGTCP2 REQUIRED "quictls")
920
+ list(APPEND LIBCURL_PC_REQUIRES_PRIVATE "libngtcp2_crypto_quictls")
921
+ endif()
922
+ openssl_check_quic()
923
+ elseif(USE_GNUTLS)
924
+ find_package(NGTCP2 REQUIRED "GnuTLS")
925
+ list(APPEND LIBCURL_PC_REQUIRES_PRIVATE "libngtcp2_crypto_gnutls")
926
+ else()
927
+ message(FATAL_ERROR "ngtcp2 requires OpenSSL, wolfSSL or GnuTLS")
928
+ endif()
929
+ include_directories(SYSTEM ${NGTCP2_INCLUDE_DIRS})
930
+ list(APPEND CURL_LIBS ${NGTCP2_LIBRARIES})
931
+ list(APPEND LIBCURL_PC_REQUIRES_PRIVATE "libngtcp2")
932
+
933
+ find_package(NGHTTP3 REQUIRED)
934
+ set(USE_NGHTTP3 ON)
935
+ include_directories(SYSTEM ${NGHTTP3_INCLUDE_DIRS})
936
+ list(APPEND CURL_LIBS ${NGHTTP3_LIBRARIES})
937
+ list(APPEND LIBCURL_PC_REQUIRES_PRIVATE "libnghttp3")
938
+ endif()
939
+
940
+ option(USE_QUICHE "Use quiche library for HTTP/3 support" OFF)
941
+ if(USE_QUICHE)
942
+ if(USE_NGTCP2)
943
+ message(FATAL_ERROR "Only one HTTP/3 backend can be selected")
944
+ endif()
945
+ find_package(Quiche REQUIRED)
946
+ if(NOT HAVE_BORINGSSL)
947
+ message(FATAL_ERROR "quiche requires BoringSSL")
948
+ endif()
949
+ openssl_check_quic()
950
+ list(APPEND CURL_LIBS ${QUICHE_LIBRARIES})
951
+ list(APPEND CURL_LIBDIRS ${QUICHE_LIBRARY_DIRS})
952
+ list(APPEND LIBCURL_PC_REQUIRES_PRIVATE "quiche")
953
+ include_directories(SYSTEM ${QUICHE_INCLUDE_DIRS})
954
+ link_directories(${QUICHE_LIBRARY_DIRS})
955
+ if(QUICHE_CFLAGS)
956
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${QUICHE_CFLAGS}")
957
+ endif()
958
+ if(NOT DEFINED HAVE_QUICHE_CONN_SET_QLOG_FD)
959
+ cmake_push_check_state()
960
+ set(CMAKE_REQUIRED_INCLUDES "${QUICHE_INCLUDE_DIRS}")
961
+ set(CMAKE_REQUIRED_LIBRARIES "${QUICHE_LIBRARIES}")
962
+ check_symbol_exists("quiche_conn_set_qlog_fd" "quiche.h" HAVE_QUICHE_CONN_SET_QLOG_FD)
963
+ cmake_pop_check_state()
964
+ endif()
965
+ endif()
966
+
967
+ option(USE_MSH3 "Use msh3/msquic library for HTTP/3 support" OFF)
968
+ if(USE_MSH3)
969
+ if(USE_NGTCP2 OR USE_QUICHE)
970
+ message(FATAL_ERROR "Only one HTTP/3 backend can be selected")
971
+ endif()
972
+ if(NOT WIN32)
973
+ if(NOT USE_OPENSSL)
974
+ message(FATAL_ERROR "msh3/msquic requires OpenSSL fork with QUIC API")
975
+ endif()
976
+ openssl_check_quic()
977
+ endif()
978
+ find_package(MSH3 REQUIRED)
979
+ list(APPEND CURL_LIBS ${MSH3_LIBRARIES})
980
+ list(APPEND CURL_LIBDIRS ${MSH3_LIBRARY_DIRS})
981
+ list(APPEND LIBCURL_PC_REQUIRES_PRIVATE ${MSH3_PC_REQUIRES})
982
+ include_directories(SYSTEM ${MSH3_INCLUDE_DIRS})
983
+ link_directories(${MSH3_LIBRARY_DIRS})
984
+ if(MSH3_CFLAGS)
985
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${MSH3_CFLAGS}")
986
+ endif()
987
+ endif()
988
+
989
+ if(USE_OPENSSL_QUIC)
990
+ if(USE_NGTCP2 OR USE_QUICHE OR USE_MSH3)
991
+ message(FATAL_ERROR "Only one HTTP/3 backend can be selected")
992
+ endif()
993
+ find_package(OpenSSL 3.3.0 REQUIRED)
994
+
995
+ find_package(NGHTTP3 REQUIRED)
996
+ set(USE_NGHTTP3 ON)
997
+ include_directories(SYSTEM ${NGHTTP3_INCLUDE_DIRS})
998
+ list(APPEND CURL_LIBS ${NGHTTP3_LIBRARIES})
999
+ list(APPEND LIBCURL_PC_REQUIRES_PRIVATE "libnghttp3")
1000
+ endif()
1001
+
1002
+ if(CURL_WITH_MULTI_SSL AND (USE_NGTCP2 OR USE_QUICHE OR USE_MSH3 OR USE_OPENSSL_QUIC))
1003
+ message(FATAL_ERROR "MultiSSL cannot be enabled with HTTP/3 and vice versa.")
1004
+ endif()
1005
+
1006
+ if(NOT CURL_DISABLE_SRP AND (HAVE_GNUTLS_SRP OR HAVE_OPENSSL_SRP))
1007
+ set(USE_TLS_SRP 1)
1008
+ endif()
1009
+
1010
+ if(NOT CURL_DISABLE_LDAP)
1011
+ if(WIN32 AND NOT WINDOWS_STORE)
1012
+ option(USE_WIN32_LDAP "Use Windows LDAP implementation" ON)
1013
+ if(USE_WIN32_LDAP)
1014
+ list(APPEND CURL_LIBS "wldap32")
1015
+ if(NOT CURL_DISABLE_LDAPS)
1016
+ set(HAVE_LDAP_SSL ON)
1017
+ endif()
1018
+ endif()
1019
+ endif()
1020
+
1021
+ # Now that we know, we are not using Windows LDAP...
1022
+ if(NOT USE_WIN32_LDAP)
1023
+ if(NOT DEFINED LDAP_LIBRARY)
1024
+ set(LDAP_LIBRARY "ldap" CACHE STRING "Name or full path to ldap library")
1025
+ endif()
1026
+ if(NOT DEFINED LDAP_LBER_LIBRARY)
1027
+ set(LDAP_LBER_LIBRARY "lber" CACHE STRING "Name or full path to lber library")
1028
+ endif()
1029
+ if(NOT DEFINED LDAP_INCLUDE_DIR)
1030
+ set(LDAP_INCLUDE_DIR "" CACHE STRING "Path to LDAP include directory")
1031
+ endif()
1032
+
1033
+ # Check for LDAP
1034
+ cmake_push_check_state()
1035
+ if(USE_OPENSSL)
1036
+ set(CMAKE_REQUIRED_LIBRARIES ${OPENSSL_LIBRARIES})
1037
+ endif()
1038
+ check_library_exists("${LDAP_LIBRARY}" "ldap_init" "" HAVE_LIBLDAP)
1039
+ if(HAVE_LIBLDAP)
1040
+ check_library_exists("${LDAP_LIBRARY};${LDAP_LBER_LIBRARY}" "ber_init" "" HAVE_LIBLBER)
1041
+ else()
1042
+ check_library_exists("${LDAP_LBER_LIBRARY}" "ber_init" "" HAVE_LIBLBER)
1043
+ endif()
1044
+
1045
+ if(LDAP_INCLUDE_DIR)
1046
+ list(APPEND CMAKE_REQUIRED_INCLUDES ${LDAP_INCLUDE_DIR})
1047
+ endif()
1048
+
1049
+ unset(_include_list)
1050
+ check_include_file("lber.h" HAVE_LBER_H)
1051
+ if(HAVE_LBER_H)
1052
+ list(APPEND _include_list "lber.h")
1053
+ endif()
1054
+ check_include_files("${_include_list};ldap.h" HAVE_LDAP_H)
1055
+ unset(_include_list)
1056
+
1057
+ if(NOT HAVE_LDAP_H)
1058
+ message(STATUS "LDAP_H not found CURL_DISABLE_LDAP set ON")
1059
+ set(CURL_DISABLE_LDAP ON CACHE BOOL "" FORCE)
1060
+ elseif(NOT HAVE_LIBLDAP)
1061
+ message(STATUS "LDAP library '${LDAP_LIBRARY}' not found CURL_DISABLE_LDAP set ON")
1062
+ set(CURL_DISABLE_LDAP ON CACHE BOOL "" FORCE)
1063
+ else()
1064
+ if(LDAP_INCLUDE_DIR)
1065
+ include_directories(SYSTEM ${LDAP_INCLUDE_DIR})
1066
+ endif()
1067
+ list(APPEND CMAKE_REQUIRED_DEFINITIONS "-DLDAP_DEPRECATED=1")
1068
+ list(APPEND CMAKE_REQUIRED_LIBRARIES ${LDAP_LIBRARY})
1069
+ set(CURL_LIBS "${LDAP_LIBRARY};${CURL_LIBS}")
1070
+ # FIXME: uncomment once pkg-config-based detection landed: https://github.com/curl/curl/pull/15273
1071
+ # set(LIBCURL_PC_REQUIRES_PRIVATE "${LDAP_PC_REQUIRES};${LIBCURL_PC_REQUIRES_PRIVATE}")
1072
+ if(HAVE_LIBLBER)
1073
+ list(APPEND CMAKE_REQUIRED_LIBRARIES ${LDAP_LBER_LIBRARY})
1074
+ set(CURL_LIBS "${LDAP_LBER_LIBRARY};${CURL_LIBS}")
1075
+ endif()
1076
+
1077
+ check_function_exists("ldap_url_parse" HAVE_LDAP_URL_PARSE)
1078
+ check_function_exists("ldap_init_fd" HAVE_LDAP_INIT_FD)
1079
+
1080
+ check_include_file("ldap_ssl.h" HAVE_LDAP_SSL_H)
1081
+
1082
+ if(HAVE_LDAP_INIT_FD)
1083
+ set(USE_OPENLDAP ON)
1084
+ add_definitions("-DLDAP_DEPRECATED=1")
1085
+ endif()
1086
+ if(NOT CURL_DISABLE_LDAPS)
1087
+ set(HAVE_LDAP_SSL ON)
1088
+ endif()
1089
+ endif()
1090
+ cmake_pop_check_state()
1091
+ endif()
1092
+ endif()
1093
+
1094
+ # No ldap, no ldaps.
1095
+ if(CURL_DISABLE_LDAP)
1096
+ if(NOT CURL_DISABLE_LDAPS)
1097
+ message(STATUS "LDAP needs to be enabled to support LDAPS")
1098
+ set(CURL_DISABLE_LDAPS ON CACHE BOOL "" FORCE)
1099
+ endif()
1100
+ endif()
1101
+
1102
+ if(WIN32)
1103
+ option(USE_WIN32_IDN "Use WinIDN for IDN support" OFF)
1104
+ if(USE_WIN32_IDN)
1105
+ list(APPEND CURL_LIBS "normaliz")
1106
+ endif()
1107
+ else()
1108
+ set(USE_WIN32_IDN OFF)
1109
+ endif()
1110
+
1111
+ if(APPLE)
1112
+ option(USE_APPLE_IDN "Use Apple built-in IDN support" OFF)
1113
+ if(USE_APPLE_IDN)
1114
+ cmake_push_check_state()
1115
+ set(CMAKE_REQUIRED_LIBRARIES "icucore")
1116
+ check_symbol_exists("uidna_openUTS46" "unicode/uidna.h" HAVE_APPLE_IDN)
1117
+ cmake_pop_check_state()
1118
+ if(HAVE_APPLE_IDN)
1119
+ list(APPEND CURL_LIBS "icucore" "iconv")
1120
+ else()
1121
+ set(USE_APPLE_IDN OFF)
1122
+ endif()
1123
+ endif()
1124
+ else()
1125
+ set(USE_APPLE_IDN OFF)
1126
+ endif()
1127
+
1128
+ # Check for libidn2
1129
+ option(USE_LIBIDN2 "Use libidn2 for IDN support" ON)
1130
+ set(HAVE_IDN2_H OFF)
1131
+ set(HAVE_LIBIDN2 OFF)
1132
+ if(USE_LIBIDN2 AND NOT USE_APPLE_IDN AND NOT USE_WIN32_IDN)
1133
+ find_package(Libidn2)
1134
+ if(LIBIDN2_FOUND)
1135
+ set(CURL_LIBS "${LIBIDN2_LIBRARIES};${CURL_LIBS}")
1136
+ list(APPEND CURL_LIBDIRS ${LIBIDN2_LIBRARY_DIRS})
1137
+ set(LIBCURL_PC_REQUIRES_PRIVATE "libidn2;${LIBCURL_PC_REQUIRES_PRIVATE}")
1138
+ include_directories(SYSTEM ${LIBIDN2_INCLUDE_DIRS})
1139
+ link_directories(${LIBIDN2_LIBRARY_DIRS})
1140
+ if(LIBIDN2_CFLAGS)
1141
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${LIBIDN2_CFLAGS}")
1142
+ endif()
1143
+ set(HAVE_IDN2_H 1)
1144
+ set(HAVE_LIBIDN2 1)
1145
+ endif()
1146
+ endif()
1147
+
1148
+ # libpsl
1149
+ option(CURL_USE_LIBPSL "Use libpsl" ON)
1150
+ mark_as_advanced(CURL_USE_LIBPSL)
1151
+ set(USE_LIBPSL OFF)
1152
+
1153
+ if(CURL_USE_LIBPSL)
1154
+ find_package(Libpsl) # TODO: add REQUIRED to match autotools
1155
+ if(LIBPSL_FOUND)
1156
+ list(APPEND CURL_LIBS ${LIBPSL_LIBRARIES})
1157
+ list(APPEND LIBCURL_PC_REQUIRES_PRIVATE "libpsl")
1158
+ include_directories(SYSTEM ${LIBPSL_INCLUDE_DIRS})
1159
+ set(USE_LIBPSL ON)
1160
+ else()
1161
+ message(WARNING "libpsl is enabled, but not found.")
1162
+ endif()
1163
+ endif()
1164
+
1165
+ # libssh2
1166
+ option(CURL_USE_LIBSSH2 "Use libssh2" ON)
1167
+ mark_as_advanced(CURL_USE_LIBSSH2)
1168
+ set(USE_LIBSSH2 OFF)
1169
+
1170
+ if(CURL_USE_LIBSSH2)
1171
+ find_package(Libssh2)
1172
+ if(LIBSSH2_FOUND)
1173
+ list(APPEND CURL_LIBS ${LIBSSH2_LIBRARIES})
1174
+ list(APPEND LIBCURL_PC_REQUIRES_PRIVATE "libssh2")
1175
+ include_directories(SYSTEM ${LIBSSH2_INCLUDE_DIRS})
1176
+ set(USE_LIBSSH2 ON)
1177
+ endif()
1178
+ endif()
1179
+
1180
+ # libssh
1181
+ option(CURL_USE_LIBSSH "Use libssh" OFF)
1182
+ mark_as_advanced(CURL_USE_LIBSSH)
1183
+ if(NOT USE_LIBSSH2 AND CURL_USE_LIBSSH)
1184
+ find_package(Libssh REQUIRED)
1185
+ if(LIBSSH_FOUND)
1186
+ list(APPEND CURL_LIBS ${LIBSSH_LIBRARIES})
1187
+ list(APPEND CURL_LIBDIRS ${LIBSSH_LIBRARY_DIRS})
1188
+ list(APPEND LIBCURL_PC_REQUIRES_PRIVATE "libssh")
1189
+ include_directories(SYSTEM ${LIBSSH_INCLUDE_DIRS})
1190
+ link_directories(${LIBSSH_LIBRARY_DIRS})
1191
+ if(LIBSSH_CFLAGS)
1192
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${LIBSSH_CFLAGS}")
1193
+ endif()
1194
+ set(USE_LIBSSH ON)
1195
+ endif()
1196
+ endif()
1197
+
1198
+ # wolfSSH
1199
+ option(CURL_USE_WOLFSSH "Use wolfSSH" OFF)
1200
+ mark_as_advanced(CURL_USE_WOLFSSH)
1201
+ set(USE_WOLFSSH OFF)
1202
+ if(NOT USE_LIBSSH2 AND NOT USE_LIBSSH AND CURL_USE_WOLFSSH)
1203
+ if(USE_WOLFSSL)
1204
+ find_package(WolfSSH)
1205
+ if(WOLFSSH_FOUND)
1206
+ list(APPEND CURL_LIBS ${WOLFSSH_LIBRARIES})
1207
+ include_directories(SYSTEM ${WOLFSSH_INCLUDE_DIRS})
1208
+ set(USE_WOLFSSH ON)
1209
+ endif()
1210
+ else()
1211
+ message(WARNING "wolfSSH requires wolfSSL. Skipping.")
1212
+ endif()
1213
+ endif()
1214
+
1215
+ option(CURL_USE_GSASL "Use libgsasl" OFF)
1216
+ mark_as_advanced(CURL_USE_GSASL)
1217
+ if(CURL_USE_GSASL)
1218
+ find_package(Libgsasl REQUIRED)
1219
+ if(LIBGSASL_FOUND)
1220
+ list(APPEND CURL_LIBS ${LIBGSASL_LIBRARIES})
1221
+ list(APPEND CURL_LIBDIRS ${LIBGSASL_LIBRARY_DIRS})
1222
+ list(APPEND LIBCURL_PC_REQUIRES_PRIVATE "libgsasl")
1223
+ include_directories(SYSTEM ${LIBGSASL_INCLUDE_DIRS})
1224
+ link_directories(${LIBGSASL_LIBRARY_DIRS})
1225
+ if(LIBGSASL_CFLAGS)
1226
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${LIBGSASL_CFLAGS}")
1227
+ endif()
1228
+ set(USE_GSASL ON)
1229
+ endif()
1230
+ endif()
1231
+
1232
+ option(CURL_USE_GSSAPI "Use GSSAPI implementation" OFF)
1233
+ mark_as_advanced(CURL_USE_GSSAPI)
1234
+
1235
+ if(CURL_USE_GSSAPI)
1236
+ find_package(GSS)
1237
+
1238
+ set(HAVE_GSSAPI ${GSS_FOUND})
1239
+ if(GSS_FOUND)
1240
+ if(GSS_FLAVOUR STREQUAL "GNU")
1241
+ set(HAVE_GSSGNU 1)
1242
+ else()
1243
+ cmake_push_check_state()
1244
+ list(APPEND CMAKE_REQUIRED_INCLUDES ${GSS_INCLUDE_DIRS})
1245
+
1246
+ set(_include_list "")
1247
+ check_include_file("gssapi/gssapi.h" HAVE_GSSAPI_GSSAPI_H)
1248
+ if(HAVE_GSSAPI_GSSAPI_H)
1249
+ list(APPEND _include_list "gssapi/gssapi.h")
1250
+ endif()
1251
+ check_include_files("${_include_list};gssapi/gssapi_generic.h" HAVE_GSSAPI_GSSAPI_GENERIC_H)
1252
+
1253
+ if(GSS_FLAVOUR STREQUAL "MIT")
1254
+ check_include_files("${_include_list};gssapi/gssapi_krb5.h" _have_gssapi_gssapi_krb5_h)
1255
+ if(HAVE_GSSAPI_GSSAPI_GENERIC_H)
1256
+ list(APPEND _include_list "gssapi/gssapi_generic.h")
1257
+ endif()
1258
+ if(_have_gssapi_gssapi_krb5_h)
1259
+ list(APPEND _include_list "gssapi/gssapi_krb5.h")
1260
+ endif()
1261
+
1262
+ if(NOT DEFINED HAVE_GSS_C_NT_HOSTBASED_SERVICE)
1263
+ set(CMAKE_REQUIRED_FLAGS ${GSS_CFLAGS})
1264
+ set(CMAKE_REQUIRED_LIBRARIES ${GSS_LIBRARIES})
1265
+ curl_required_libpaths("${GSS_LIBRARY_DIRS}")
1266
+ check_symbol_exists("GSS_C_NT_HOSTBASED_SERVICE" "${_include_list}" HAVE_GSS_C_NT_HOSTBASED_SERVICE)
1267
+ endif()
1268
+ if(NOT HAVE_GSS_C_NT_HOSTBASED_SERVICE)
1269
+ set(HAVE_OLD_GSSMIT ON)
1270
+ endif()
1271
+ endif()
1272
+ unset(_include_list)
1273
+ cmake_pop_check_state()
1274
+ endif()
1275
+
1276
+ list(APPEND CURL_LIBS ${GSS_LIBRARIES})
1277
+ list(APPEND CURL_LIBDIRS ${GSS_LIBRARY_DIRS})
1278
+ list(APPEND LIBCURL_PC_REQUIRES_PRIVATE ${GSS_PC_REQUIRES})
1279
+ include_directories(SYSTEM ${GSS_INCLUDE_DIRS})
1280
+ link_directories(${GSS_LIBRARY_DIRS})
1281
+ if(GSS_CFLAGS)
1282
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${GSS_CFLAGS}")
1283
+ endif()
1284
+ else()
1285
+ message(WARNING "GSSAPI has been requested, but no supporting libraries found. Skipping.")
1286
+ endif()
1287
+ endif()
1288
+
1289
+ # libuv
1290
+ option(CURL_USE_LIBUV "Use libuv for event-based tests" OFF)
1291
+ if(CURL_USE_LIBUV)
1292
+ if(NOT ENABLE_DEBUG)
1293
+ message(FATAL_ERROR "Using libuv without debug support enabled is useless")
1294
+ endif()
1295
+ find_package(Libuv REQUIRED)
1296
+ if(LIBUV_FOUND)
1297
+ list(APPEND CURL_LIBS ${LIBUV_LIBRARIES})
1298
+ list(APPEND CURL_LIBDIRS ${LIBUV_LIBRARY_DIRS})
1299
+ list(APPEND LIBCURL_PC_REQUIRES_PRIVATE "libuv")
1300
+ include_directories(SYSTEM ${LIBUV_INCLUDE_DIRS})
1301
+ link_directories(${LIBUV_LIBRARY_DIRS})
1302
+ if(LIBUV_CFLAGS)
1303
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${LIBUV_CFLAGS}")
1304
+ endif()
1305
+ set(USE_LIBUV ON)
1306
+ set(HAVE_UV_H ON)
1307
+ endif()
1308
+ endif()
1309
+
1310
+ option(USE_LIBRTMP "Enable librtmp from rtmpdump" OFF)
1311
+ if(USE_LIBRTMP)
1312
+ set(_extra_libs "rtmp")
1313
+ if(WIN32)
1314
+ list(APPEND _extra_libs "winmm")
1315
+ endif()
1316
+ openssl_check_symbol_exists("RTMP_Init" "librtmp/rtmp.h" HAVE_LIBRTMP "${_extra_libs}")
1317
+ if(HAVE_LIBRTMP)
1318
+ list(APPEND CURL_LIBS "rtmp")
1319
+ list(APPEND LIBCURL_PC_REQUIRES_PRIVATE "librtmp")
1320
+ if(WIN32)
1321
+ list(APPEND CURL_LIBS "winmm")
1322
+ endif()
1323
+ else()
1324
+ message(WARNING "librtmp has been requested, but not found or missing OpenSSL. Skipping.")
1325
+ set(USE_LIBRTMP OFF)
1326
+ endif()
1327
+ endif()
1328
+
1329
+ option(ENABLE_UNIX_SOCKETS "Enable Unix domain sockets support" ON)
1330
+ if(ENABLE_UNIX_SOCKETS)
1331
+ if(WIN32)
1332
+ set(USE_UNIX_SOCKETS ON)
1333
+ else()
1334
+ include(CheckStructHasMember)
1335
+ check_struct_has_member("struct sockaddr_un" "sun_path" "sys/un.h" USE_UNIX_SOCKETS)
1336
+ endif()
1337
+ else()
1338
+ unset(USE_UNIX_SOCKETS CACHE)
1339
+ endif()
1340
+
1341
+ #
1342
+ # CA handling
1343
+ #
1344
+ if(_curl_ca_bundle_supported)
1345
+ set(CURL_CA_BUNDLE "auto" CACHE
1346
+ STRING "Path to the CA bundle. Set 'none' to disable or 'auto' for auto-detection. Defaults to 'auto'.")
1347
+ set(CURL_CA_FALLBACK OFF CACHE BOOL
1348
+ "Use built-in CA store of TLS backend. Defaults to OFF")
1349
+ set(CURL_CA_PATH "auto" CACHE
1350
+ STRING "Location of default CA path. Set 'none' to disable or 'auto' for auto-detection. Defaults to 'auto'.")
1351
+ set(CURL_CA_EMBED "" CACHE
1352
+ STRING "Path to the CA bundle to embed in the curl tool.")
1353
+
1354
+ if(CURL_CA_BUNDLE STREQUAL "")
1355
+ message(FATAL_ERROR "Invalid value of CURL_CA_BUNDLE. Use 'none', 'auto' or file path.")
1356
+ elseif(CURL_CA_BUNDLE STREQUAL "none")
1357
+ unset(CURL_CA_BUNDLE CACHE)
1358
+ elseif(CURL_CA_BUNDLE STREQUAL "auto")
1359
+ unset(CURL_CA_BUNDLE CACHE)
1360
+ if(NOT CMAKE_CROSSCOMPILING AND NOT WIN32)
1361
+ set(_curl_ca_bundle_autodetect TRUE)
1362
+ endif()
1363
+ else()
1364
+ set(CURL_CA_BUNDLE_SET TRUE)
1365
+ endif()
1366
+ mark_as_advanced(CURL_CA_BUNDLE_SET)
1367
+
1368
+ if(CURL_CA_PATH STREQUAL "")
1369
+ message(FATAL_ERROR "Invalid value of CURL_CA_PATH. Use 'none', 'auto' or directory path.")
1370
+ elseif(CURL_CA_PATH STREQUAL "none")
1371
+ unset(CURL_CA_PATH CACHE)
1372
+ elseif(CURL_CA_PATH STREQUAL "auto")
1373
+ unset(CURL_CA_PATH CACHE)
1374
+ if(NOT CMAKE_CROSSCOMPILING AND NOT WIN32)
1375
+ set(_curl_ca_path_autodetect TRUE)
1376
+ endif()
1377
+ else()
1378
+ set(CURL_CA_PATH_SET TRUE)
1379
+ endif()
1380
+ mark_as_advanced(CURL_CA_PATH_SET)
1381
+
1382
+ if(CURL_CA_BUNDLE_SET AND _curl_ca_path_autodetect)
1383
+ # Skip auto-detection of unset CA path because CA bundle is set explicitly
1384
+ elseif(CURL_CA_PATH_SET AND _curl_ca_bundle_autodetect)
1385
+ # Skip auto-detection of unset CA bundle because CA path is set explicitly
1386
+ elseif(_curl_ca_bundle_autodetect OR _curl_ca_path_autodetect)
1387
+ # First try auto-detecting a CA bundle, then a CA path
1388
+
1389
+ if(_curl_ca_bundle_autodetect)
1390
+ foreach(_search_ca_bundle_path IN ITEMS
1391
+ "/etc/ssl/certs/ca-certificates.crt"
1392
+ "/etc/pki/tls/certs/ca-bundle.crt"
1393
+ "/usr/share/ssl/certs/ca-bundle.crt"
1394
+ "/usr/local/share/certs/ca-root-nss.crt"
1395
+ "/etc/ssl/cert.pem")
1396
+ if(EXISTS "${_search_ca_bundle_path}")
1397
+ message(STATUS "Found CA bundle: ${_search_ca_bundle_path}")
1398
+ set(CURL_CA_BUNDLE "${_search_ca_bundle_path}" CACHE
1399
+ STRING "Path to the CA bundle. Set 'none' to disable or 'auto' for auto-detection. Defaults to 'auto'.")
1400
+ set(CURL_CA_BUNDLE_SET TRUE CACHE BOOL "Path to the CA bundle has been set")
1401
+ break()
1402
+ endif()
1403
+ endforeach()
1404
+ endif()
1405
+
1406
+ if(_curl_ca_path_autodetect AND NOT CURL_CA_PATH_SET)
1407
+ set(_search_ca_path "/etc/ssl/certs")
1408
+ file(GLOB _curl_ca_files_found "${_search_ca_path}/[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f].0")
1409
+ if(_curl_ca_files_found)
1410
+ unset(_curl_ca_files_found)
1411
+ message(STATUS "Found CA path: ${_search_ca_path}")
1412
+ set(CURL_CA_PATH "${_search_ca_path}" CACHE
1413
+ STRING "Location of default CA path. Set 'none' to disable or 'auto' for auto-detection. Defaults to 'auto'.")
1414
+ set(CURL_CA_PATH_SET TRUE CACHE BOOL "Path to the CA bundle has been set")
1415
+ endif()
1416
+ endif()
1417
+ endif()
1418
+
1419
+ set(CURL_CA_EMBED_SET FALSE)
1420
+ if(BUILD_CURL_EXE AND NOT CURL_CA_EMBED STREQUAL "")
1421
+ if(EXISTS "${CURL_CA_EMBED}")
1422
+ set(CURL_CA_EMBED_SET TRUE)
1423
+ message(STATUS "Found CA bundle to embed: ${CURL_CA_EMBED}")
1424
+ else()
1425
+ message(FATAL_ERROR "CA bundle to embed is missing: '${CURL_CA_EMBED}'")
1426
+ endif()
1427
+ endif()
1428
+ endif()
1429
+
1430
+ if(WIN32)
1431
+ option(CURL_DISABLE_CA_SEARCH "Disable unsafe CA bundle search in PATH on Windows" OFF)
1432
+ option(CURL_CA_SEARCH_SAFE "Enable safe CA bundle search (within the curl tool directory) on Windows" OFF)
1433
+ endif()
1434
+
1435
+ # Check for header files
1436
+ if(WIN32)
1437
+ list(APPEND CURL_INCLUDES "winsock2.h")
1438
+ list(APPEND CURL_INCLUDES "ws2tcpip.h")
1439
+
1440
+ if(HAVE_WIN32_WINNT)
1441
+ if(HAVE_WIN32_WINNT LESS 0x0501)
1442
+ # Windows XP is required for freeaddrinfo, getaddrinfo
1443
+ message(FATAL_ERROR "Building for Windows XP or newer is required.")
1444
+ endif()
1445
+
1446
+ # Pre-fill detection results based on target OS version
1447
+ if(MINGW OR MSVC)
1448
+ if(HAVE_WIN32_WINNT LESS 0x0600)
1449
+ set(HAVE_INET_NTOP 0)
1450
+ set(HAVE_INET_PTON 0)
1451
+ else() # Windows Vista or newer
1452
+ set(HAVE_INET_NTOP 1)
1453
+ set(HAVE_INET_PTON 1)
1454
+ endif()
1455
+ unset(HAVE_INET_NTOP CACHE)
1456
+ unset(HAVE_INET_PTON CACHE)
1457
+ endif()
1458
+ endif()
1459
+ endif()
1460
+
1461
+ # Detect headers
1462
+
1463
+ # Use check_include_file_concat() for headers required by subsequent
1464
+ # check_include_file_concat() or check_symbol_exists() detections.
1465
+ # Order for these is significant.
1466
+ check_include_file("sys/eventfd.h" HAVE_SYS_EVENTFD_H)
1467
+ check_include_file("sys/filio.h" HAVE_SYS_FILIO_H)
1468
+ check_include_file("sys/wait.h" HAVE_SYS_WAIT_H)
1469
+ check_include_file("sys/ioctl.h" HAVE_SYS_IOCTL_H)
1470
+ check_include_file("sys/param.h" HAVE_SYS_PARAM_H)
1471
+ check_include_file("sys/poll.h" HAVE_SYS_POLL_H)
1472
+ check_include_file("sys/resource.h" HAVE_SYS_RESOURCE_H)
1473
+ check_include_file_concat("sys/select.h" HAVE_SYS_SELECT_H)
1474
+ check_include_file_concat("sys/socket.h" HAVE_SYS_SOCKET_H)
1475
+ check_include_file("sys/sockio.h" HAVE_SYS_SOCKIO_H)
1476
+ check_include_file("sys/stat.h" HAVE_SYS_STAT_H)
1477
+ check_include_file_concat("sys/time.h" HAVE_SYS_TIME_H)
1478
+ check_include_file_concat("sys/types.h" HAVE_SYS_TYPES_H)
1479
+ check_include_file("sys/un.h" HAVE_SYS_UN_H)
1480
+ check_include_file("sys/utime.h" HAVE_SYS_UTIME_H)
1481
+ check_include_file("sys/xattr.h" HAVE_SYS_XATTR_H)
1482
+
1483
+ check_include_file_concat("arpa/inet.h" HAVE_ARPA_INET_H)
1484
+ check_include_file("dirent.h" HAVE_DIRENT_H)
1485
+ check_include_file("fcntl.h" HAVE_FCNTL_H)
1486
+ check_include_file_concat("ifaddrs.h" HAVE_IFADDRS_H)
1487
+ check_include_file("io.h" HAVE_IO_H)
1488
+ check_include_file_concat("libgen.h" HAVE_LIBGEN_H)
1489
+ check_include_file("linux/tcp.h" HAVE_LINUX_TCP_H)
1490
+ check_include_file("locale.h" HAVE_LOCALE_H)
1491
+ check_include_file("net/if.h" HAVE_NET_IF_H)
1492
+ check_include_file_concat("netdb.h" HAVE_NETDB_H)
1493
+ check_include_file_concat("netinet/in.h" HAVE_NETINET_IN_H)
1494
+ check_include_file("netinet/in6.h" HAVE_NETINET_IN6_H)
1495
+ check_include_file_concat("netinet/tcp.h" HAVE_NETINET_TCP_H) # sys/types.h (e.g. Cygwin) netinet/in.h
1496
+ check_include_file_concat("netinet/udp.h" HAVE_NETINET_UDP_H) # sys/types.h (e.g. Cygwin)
1497
+ check_include_file("poll.h" HAVE_POLL_H)
1498
+ check_include_file("pwd.h" HAVE_PWD_H)
1499
+ check_include_file("stdatomic.h" HAVE_STDATOMIC_H)
1500
+ check_include_file("stdbool.h" HAVE_STDBOOL_H)
1501
+ check_include_file("strings.h" HAVE_STRINGS_H)
1502
+ check_include_file("stropts.h" HAVE_STROPTS_H)
1503
+ check_include_file("termio.h" HAVE_TERMIO_H)
1504
+ check_include_file("termios.h" HAVE_TERMIOS_H)
1505
+ check_include_file_concat("unistd.h" HAVE_UNISTD_H)
1506
+ check_include_file("utime.h" HAVE_UTIME_H)
1507
+
1508
+ if(CMAKE_SYSTEM_NAME MATCHES "AmigaOS")
1509
+ check_include_file_concat("proto/bsdsocket.h" HAVE_PROTO_BSDSOCKET_H)
1510
+ endif()
1511
+
1512
+ # Pass these detection results to curl_internal_test() for use in CurlTests.c
1513
+ # Add here all feature flags referenced from CurlTests.c
1514
+ foreach(_variable IN ITEMS
1515
+ HAVE_STDATOMIC_H
1516
+ HAVE_STDBOOL_H
1517
+ HAVE_STROPTS_H
1518
+ HAVE_SYS_IOCTL_H
1519
+ HAVE_SYS_SOCKET_H
1520
+ HAVE_SYS_TYPES_H
1521
+ HAVE_UNISTD_H
1522
+ )
1523
+ if(${_variable})
1524
+ set(CURL_TEST_DEFINES "${CURL_TEST_DEFINES} -D${_variable}")
1525
+ endif()
1526
+ endforeach()
1527
+
1528
+ check_type_size("size_t" SIZEOF_SIZE_T)
1529
+ check_type_size("ssize_t" SIZEOF_SSIZE_T)
1530
+ check_type_size("long long" SIZEOF_LONG_LONG)
1531
+ check_type_size("long" SIZEOF_LONG)
1532
+ check_type_size("int" SIZEOF_INT)
1533
+ check_type_size("__int64" SIZEOF___INT64)
1534
+ check_type_size("time_t" SIZEOF_TIME_T)
1535
+ check_type_size("suseconds_t" SIZEOF_SUSECONDS_T)
1536
+ if(NOT HAVE_SIZEOF_SSIZE_T)
1537
+ if(SIZEOF_LONG EQUAL SIZEOF_SIZE_T)
1538
+ set(ssize_t "long")
1539
+ endif()
1540
+ if(NOT ssize_t AND SIZEOF___INT64 EQUAL SIZEOF_SIZE_T)
1541
+ set(ssize_t "__int64")
1542
+ endif()
1543
+ endif()
1544
+ # off_t is sized later, after the HAVE_FILE_OFFSET_BITS test
1545
+
1546
+ if(SIZEOF_LONG_LONG)
1547
+ set(HAVE_LONGLONG 1)
1548
+ endif()
1549
+ if(SIZEOF_SUSECONDS_T)
1550
+ set(HAVE_SUSECONDS_T 1)
1551
+ endif()
1552
+
1553
+ # Check for some functions that are used
1554
+ if(WIN32)
1555
+ list(APPEND CMAKE_REQUIRED_LIBRARIES "ws2_32") # Apply to all feature checks
1556
+ elseif(HAVE_LIBSOCKET)
1557
+ list(APPEND CMAKE_REQUIRED_LIBRARIES "socket") # Apply to all feature checks
1558
+ endif()
1559
+
1560
+ check_function_exists("fnmatch" HAVE_FNMATCH)
1561
+ check_symbol_exists("basename" "${CURL_INCLUDES};string.h" HAVE_BASENAME) # libgen.h unistd.h
1562
+ check_symbol_exists("opendir" "dirent.h" HAVE_OPENDIR)
1563
+ check_function_exists("poll" HAVE_POLL) # poll.h
1564
+ check_symbol_exists("socket" "${CURL_INCLUDES}" HAVE_SOCKET) # winsock2.h sys/socket.h
1565
+ check_function_exists("sched_yield" HAVE_SCHED_YIELD)
1566
+ check_symbol_exists("socketpair" "${CURL_INCLUDES}" HAVE_SOCKETPAIR) # sys/socket.h
1567
+ check_symbol_exists("recv" "${CURL_INCLUDES}" HAVE_RECV) # proto/bsdsocket.h sys/types.h sys/socket.h
1568
+ check_symbol_exists("send" "${CURL_INCLUDES}" HAVE_SEND) # proto/bsdsocket.h sys/types.h sys/socket.h
1569
+ check_function_exists("sendmsg" HAVE_SENDMSG)
1570
+ check_function_exists("sendmmsg" HAVE_SENDMMSG)
1571
+ check_symbol_exists("select" "${CURL_INCLUDES}" HAVE_SELECT) # proto/bsdsocket.h sys/select.h sys/socket.h
1572
+ check_symbol_exists("strdup" "string.h" HAVE_STRDUP)
1573
+ check_symbol_exists("strtok_r" "string.h" HAVE_STRTOK_R)
1574
+ check_symbol_exists("strcasecmp" "string.h" HAVE_STRCASECMP)
1575
+ check_symbol_exists("stricmp" "string.h" HAVE_STRICMP)
1576
+ check_symbol_exists("strcmpi" "string.h" HAVE_STRCMPI)
1577
+ check_symbol_exists("memrchr" "string.h" HAVE_MEMRCHR)
1578
+ check_symbol_exists("alarm" "unistd.h" HAVE_ALARM)
1579
+ check_symbol_exists("fcntl" "fcntl.h" HAVE_FCNTL)
1580
+ check_function_exists("getppid" HAVE_GETPPID)
1581
+ check_function_exists("utimes" HAVE_UTIMES)
1582
+
1583
+ check_function_exists("gettimeofday" HAVE_GETTIMEOFDAY) # sys/time.h
1584
+ check_symbol_exists("closesocket" "${CURL_INCLUDES}" HAVE_CLOSESOCKET) # winsock2.h
1585
+ check_symbol_exists("sigsetjmp" "setjmp.h" HAVE_SIGSETJMP)
1586
+ check_function_exists("getpass_r" HAVE_GETPASS_R)
1587
+ check_function_exists("getpwuid" HAVE_GETPWUID)
1588
+ check_function_exists("getpwuid_r" HAVE_GETPWUID_R)
1589
+ check_function_exists("geteuid" HAVE_GETEUID)
1590
+ check_function_exists("utime" HAVE_UTIME)
1591
+ check_symbol_exists("gmtime_r" "stdlib.h;time.h" HAVE_GMTIME_R)
1592
+
1593
+ check_symbol_exists("gethostbyname_r" "netdb.h" HAVE_GETHOSTBYNAME_R)
1594
+
1595
+ check_symbol_exists("signal" "signal.h" HAVE_SIGNAL)
1596
+ check_symbol_exists("strtoll" "stdlib.h" HAVE_STRTOLL)
1597
+ check_symbol_exists("strerror_r" "stdlib.h;string.h" HAVE_STRERROR_R)
1598
+ check_symbol_exists("sigaction" "signal.h" HAVE_SIGACTION)
1599
+ check_symbol_exists("siginterrupt" "signal.h" HAVE_SIGINTERRUPT)
1600
+ check_symbol_exists("getaddrinfo" "${CURL_INCLUDES};stdlib.h;string.h" HAVE_GETADDRINFO) # ws2tcpip.h sys/socket.h netdb.h
1601
+ check_symbol_exists("getifaddrs" "${CURL_INCLUDES};stdlib.h" HAVE_GETIFADDRS) # ifaddrs.h
1602
+ check_symbol_exists("freeaddrinfo" "${CURL_INCLUDES}" HAVE_FREEADDRINFO) # ws2tcpip.h sys/socket.h netdb.h
1603
+ check_function_exists("pipe" HAVE_PIPE)
1604
+ check_function_exists("eventfd" HAVE_EVENTFD)
1605
+ check_symbol_exists("ftruncate" "unistd.h" HAVE_FTRUNCATE)
1606
+ check_symbol_exists("getpeername" "${CURL_INCLUDES}" HAVE_GETPEERNAME) # winsock2.h unistd.h proto/bsdsocket.h
1607
+ check_symbol_exists("getsockname" "${CURL_INCLUDES}" HAVE_GETSOCKNAME) # winsock2.h unistd.h proto/bsdsocket.h
1608
+ check_function_exists("if_nametoindex" HAVE_IF_NAMETOINDEX) # winsock2.h net/if.h
1609
+ check_function_exists("getrlimit" HAVE_GETRLIMIT)
1610
+ check_function_exists("setlocale" HAVE_SETLOCALE)
1611
+ check_function_exists("setmode" HAVE_SETMODE)
1612
+ check_function_exists("setrlimit" HAVE_SETRLIMIT)
1613
+
1614
+ if(WIN32 OR CYGWIN)
1615
+ check_function_exists("_setmode" HAVE__SETMODE)
1616
+ endif()
1617
+
1618
+ if(CMAKE_SYSTEM_NAME MATCHES "AmigaOS")
1619
+ check_symbol_exists("CloseSocket" "${CURL_INCLUDES}" HAVE_CLOSESOCKET_CAMEL) # sys/socket.h proto/bsdsocket.h
1620
+ endif()
1621
+
1622
+ if(NOT _ssl_enabled)
1623
+ check_symbol_exists("arc4random" "${CURL_INCLUDES};stdlib.h" HAVE_ARC4RANDOM)
1624
+ endif()
1625
+
1626
+ if(NOT MSVC OR (MSVC_VERSION GREATER_EQUAL 1900))
1627
+ # Earlier MSVC compilers had faulty snprintf implementations
1628
+ check_function_exists("snprintf" HAVE_SNPRINTF)
1629
+ endif()
1630
+ if(APPLE)
1631
+ check_function_exists("mach_absolute_time" HAVE_MACH_ABSOLUTE_TIME)
1632
+ endif()
1633
+ check_symbol_exists("inet_ntop" "${CURL_INCLUDES};stdlib.h;string.h" HAVE_INET_NTOP) # arpa/inet.h
1634
+ if(MSVC AND (MSVC_VERSION LESS_EQUAL 1600))
1635
+ set(HAVE_INET_NTOP OFF)
1636
+ endif()
1637
+ check_symbol_exists("inet_pton" "${CURL_INCLUDES};stdlib.h;string.h" HAVE_INET_PTON) # arpa/inet.h
1638
+
1639
+ check_symbol_exists("fsetxattr" "sys/xattr.h" HAVE_FSETXATTR)
1640
+ if(HAVE_FSETXATTR)
1641
+ curl_internal_test(HAVE_FSETXATTR_5)
1642
+ curl_internal_test(HAVE_FSETXATTR_6)
1643
+ endif()
1644
+
1645
+ cmake_push_check_state()
1646
+ if(WIN32)
1647
+ set(CMAKE_EXTRA_INCLUDE_FILES "winsock2.h")
1648
+ check_type_size("ADDRESS_FAMILY" SIZEOF_ADDRESS_FAMILY)
1649
+ set(HAVE_ADDRESS_FAMILY ${HAVE_SIZEOF_ADDRESS_FAMILY})
1650
+ elseif(HAVE_SYS_SOCKET_H)
1651
+ set(CMAKE_EXTRA_INCLUDE_FILES "sys/socket.h")
1652
+ check_type_size("sa_family_t" SIZEOF_SA_FAMILY_T)
1653
+ set(HAVE_SA_FAMILY_T ${HAVE_SIZEOF_SA_FAMILY_T})
1654
+ endif()
1655
+ cmake_pop_check_state()
1656
+
1657
+ # Do curl specific tests
1658
+ foreach(_curl_test IN ITEMS
1659
+ HAVE_FCNTL_O_NONBLOCK
1660
+ HAVE_IOCTLSOCKET
1661
+ HAVE_IOCTLSOCKET_CAMEL
1662
+ HAVE_IOCTLSOCKET_CAMEL_FIONBIO
1663
+ HAVE_IOCTLSOCKET_FIONBIO
1664
+ HAVE_IOCTL_FIONBIO
1665
+ HAVE_IOCTL_SIOCGIFADDR
1666
+ HAVE_SETSOCKOPT_SO_NONBLOCK
1667
+ HAVE_O_NONBLOCK
1668
+ HAVE_GETHOSTBYNAME_R_3
1669
+ HAVE_GETHOSTBYNAME_R_5
1670
+ HAVE_GETHOSTBYNAME_R_6
1671
+ HAVE_GETHOSTBYNAME_R_3_REENTRANT
1672
+ HAVE_GETHOSTBYNAME_R_5_REENTRANT
1673
+ HAVE_GETHOSTBYNAME_R_6_REENTRANT
1674
+ HAVE_IN_ADDR_T
1675
+ HAVE_BOOL_T
1676
+ STDC_HEADERS
1677
+ HAVE_FILE_OFFSET_BITS
1678
+ HAVE_ATOMIC
1679
+ )
1680
+ curl_internal_test(${_curl_test})
1681
+ endforeach()
1682
+
1683
+ cmake_push_check_state()
1684
+ if(HAVE_FILE_OFFSET_BITS)
1685
+ set(_FILE_OFFSET_BITS 64)
1686
+ set(CMAKE_REQUIRED_DEFINITIONS "-D_FILE_OFFSET_BITS=64")
1687
+ endif()
1688
+ check_type_size("off_t" SIZEOF_OFF_T)
1689
+
1690
+ # fseeko may not exist with _FILE_OFFSET_BITS=64 but can exist with
1691
+ # _FILE_OFFSET_BITS unset or 32 (e.g. Android ARMv7 with NDK 26b and API level < 24)
1692
+ # so we need to test fseeko after testing for _FILE_OFFSET_BITS
1693
+ check_symbol_exists("fseeko" "${CURL_INCLUDES};stdio.h" HAVE_FSEEKO)
1694
+
1695
+ if(HAVE_FSEEKO)
1696
+ set(HAVE_DECL_FSEEKO 1)
1697
+ endif()
1698
+
1699
+ # Include this header to get the type
1700
+ cmake_push_check_state()
1701
+ set(CMAKE_REQUIRED_INCLUDES "${PROJECT_SOURCE_DIR}/include")
1702
+ set(CMAKE_EXTRA_INCLUDE_FILES "curl/system.h")
1703
+ check_type_size("curl_off_t" SIZEOF_CURL_OFF_T)
1704
+ set(CMAKE_EXTRA_INCLUDE_FILES "curl/curl.h")
1705
+ check_type_size("curl_socket_t" SIZEOF_CURL_SOCKET_T)
1706
+ cmake_pop_check_state() # pop curl system headers
1707
+ cmake_pop_check_state() # pop -D_FILE_OFFSET_BITS=64
1708
+
1709
+ if(NOT WIN32 AND NOT CMAKE_CROSSCOMPILING)
1710
+ # On non-Windows and not cross-compiling, check for writable argv[]
1711
+ include(CheckCSourceRuns)
1712
+ check_c_source_runs("
1713
+ int main(int argc, char **argv)
1714
+ {
1715
+ (void)argc;
1716
+ argv[0][0] = ' ';
1717
+ return (argv[0][0] == ' ')?0:1;
1718
+ }" HAVE_WRITABLE_ARGV)
1719
+ endif()
1720
+
1721
+ curl_internal_test(HAVE_GLIBC_STRERROR_R)
1722
+ curl_internal_test(HAVE_POSIX_STRERROR_R)
1723
+
1724
+ # Check for reentrant
1725
+ foreach(_curl_test IN ITEMS
1726
+ HAVE_GETHOSTBYNAME_R_3
1727
+ HAVE_GETHOSTBYNAME_R_5
1728
+ HAVE_GETHOSTBYNAME_R_6)
1729
+ if(NOT ${_curl_test})
1730
+ if(${_curl_test}_REENTRANT)
1731
+ set(NEED_REENTRANT 1)
1732
+ endif()
1733
+ endif()
1734
+ endforeach()
1735
+
1736
+ if(NEED_REENTRANT)
1737
+ foreach(_curl_test IN ITEMS
1738
+ HAVE_GETHOSTBYNAME_R_3
1739
+ HAVE_GETHOSTBYNAME_R_5
1740
+ HAVE_GETHOSTBYNAME_R_6)
1741
+ set(${_curl_test} 0)
1742
+ if(${_curl_test}_REENTRANT)
1743
+ set(${_curl_test} 1)
1744
+ endif()
1745
+ endforeach()
1746
+ endif()
1747
+
1748
+ if(NOT WIN32)
1749
+ curl_internal_test(HAVE_CLOCK_GETTIME_MONOTONIC) # Check clock_gettime(CLOCK_MONOTONIC, x) support
1750
+ endif()
1751
+
1752
+ if(APPLE)
1753
+ curl_internal_test(HAVE_BUILTIN_AVAILABLE) # Check compiler support of __builtin_available()
1754
+ endif()
1755
+
1756
+ # Some other minor tests
1757
+
1758
+ if(NOT HAVE_IN_ADDR_T)
1759
+ set(in_addr_t "unsigned long")
1760
+ endif()
1761
+
1762
+ # Check for nonblocking
1763
+ set(HAVE_DISABLED_NONBLOCKING 1)
1764
+ if(HAVE_FIONBIO OR
1765
+ HAVE_IOCTLSOCKET OR
1766
+ HAVE_IOCTLSOCKET_CASE OR
1767
+ HAVE_O_NONBLOCK)
1768
+ unset(HAVE_DISABLED_NONBLOCKING)
1769
+ endif()
1770
+
1771
+ if(CMAKE_COMPILER_IS_GNUCC AND APPLE)
1772
+ include(CheckCCompilerFlag)
1773
+ check_c_compiler_flag("-Wno-long-double" HAVE_C_FLAG_Wno_long_double)
1774
+ if(HAVE_C_FLAG_Wno_long_double)
1775
+ # The Mac version of GCC warns about use of long double. Disable it.
1776
+ get_source_file_property(_mprintf_compile_flags "mprintf.c" COMPILE_FLAGS)
1777
+ if(_mprintf_compile_flags)
1778
+ set(_mprintf_compile_flags "${_mprintf_compile_flags} -Wno-long-double")
1779
+ else()
1780
+ set(_mprintf_compile_flags "-Wno-long-double")
1781
+ endif()
1782
+ set_source_files_properties("mprintf.c" PROPERTIES
1783
+ COMPILE_FLAGS ${_mprintf_compile_flags})
1784
+ endif()
1785
+ endif()
1786
+
1787
+ if(_cmake_try_compile_target_type_save)
1788
+ set(CMAKE_TRY_COMPILE_TARGET_TYPE ${_cmake_try_compile_target_type_save})
1789
+ unset(_cmake_try_compile_target_type_save)
1790
+ endif()
1791
+
1792
+ include(CMake/OtherTests.cmake)
1793
+
1794
+ add_definitions("-DHAVE_CONFIG_H")
1795
+
1796
+ # For Windows, all compilers used by CMake should support large files
1797
+ if(WIN32)
1798
+ set(USE_WIN32_LARGE_FILES ON)
1799
+
1800
+ # Use the manifest embedded in the Windows Resource
1801
+ set(CMAKE_RC_FLAGS "${CMAKE_RC_FLAGS} -DCURL_EMBED_MANIFEST")
1802
+
1803
+ # We use crypto functions that are not available for UWP apps
1804
+ if(NOT WINDOWS_STORE)
1805
+ set(USE_WIN32_CRYPTO ON)
1806
+ endif()
1807
+
1808
+ # Link required libraries for USE_WIN32_CRYPTO or USE_SCHANNEL
1809
+ if(USE_WIN32_CRYPTO OR USE_SCHANNEL)
1810
+ list(APPEND CURL_LIBS "advapi32" "crypt32")
1811
+ endif()
1812
+ endif()
1813
+
1814
+ if(MSVC)
1815
+ # Disable default manifest added by CMake
1816
+ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /MANIFEST:NO")
1817
+
1818
+ add_definitions("-D_CRT_SECURE_NO_DEPRECATE" "-D_CRT_NONSTDC_NO_DEPRECATE")
1819
+ if(CMAKE_C_FLAGS MATCHES "/W[0-4]")
1820
+ string(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
1821
+ else()
1822
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W4")
1823
+ endif()
1824
+
1825
+ # Use multithreaded compilation on VS 2008+
1826
+ if(CMAKE_C_COMPILER_ID STREQUAL "MSVC" AND MSVC_VERSION GREATER_EQUAL 1500)
1827
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP")
1828
+ endif()
1829
+ endif()
1830
+
1831
+ if(CURL_WERROR)
1832
+ if(MSVC)
1833
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /WX")
1834
+ else()
1835
+ # This assumes clang or gcc style options
1836
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror")
1837
+ endif()
1838
+ endif()
1839
+
1840
+ if(CURL_LTO)
1841
+ if(CMAKE_VERSION VERSION_LESS 3.9)
1842
+ message(FATAL_ERROR "LTO has been requested, but your cmake version ${CMAKE_VERSION} is to old. You need at least 3.9")
1843
+ endif()
1844
+
1845
+ cmake_policy(SET CMP0069 NEW)
1846
+
1847
+ include(CheckIPOSupported)
1848
+ check_ipo_supported(RESULT CURL_HAS_LTO OUTPUT _lto_error LANGUAGES C)
1849
+ if(CURL_HAS_LTO)
1850
+ message(STATUS "LTO supported and enabled")
1851
+ else()
1852
+ message(FATAL_ERROR "LTO has been requested, but the compiler does not support it\n${_lto_error}")
1853
+ endif()
1854
+ endif()
1855
+
1856
+
1857
+ # Ugly (but functional) way to include "Makefile.inc" by transforming it
1858
+ # (= regenerate it).
1859
+ function(transform_makefile_inc _input_file _output_file)
1860
+ file(READ ${_input_file} _makefile_inc_text)
1861
+ string(REPLACE "$(top_srcdir)" "\${PROJECT_SOURCE_DIR}" _makefile_inc_text ${_makefile_inc_text})
1862
+ string(REPLACE "$(top_builddir)" "\${PROJECT_BINARY_DIR}" _makefile_inc_text ${_makefile_inc_text})
1863
+
1864
+ string(REGEX REPLACE "\\\\\n" "!π!α!" _makefile_inc_text ${_makefile_inc_text})
1865
+ string(REGEX REPLACE "([a-zA-Z_][a-zA-Z0-9_]*)[\t ]*=[\t ]*([^\n]*)" "set(\\1 \\2)" _makefile_inc_text ${_makefile_inc_text})
1866
+ string(REPLACE "!π!α!" "\n" _makefile_inc_text ${_makefile_inc_text})
1867
+
1868
+ # Replace $() with ${}
1869
+ string(REGEX REPLACE "\\$\\(([a-zA-Z_][a-zA-Z0-9_]*)\\)" "\${\\1}" _makefile_inc_text ${_makefile_inc_text})
1870
+ # Replace @@ with ${}, even if that may not be read by CMake scripts.
1871
+ string(REGEX REPLACE "@([a-zA-Z_][a-zA-Z0-9_]*)@" "\${\\1}" _makefile_inc_text ${_makefile_inc_text})
1872
+
1873
+ file(WRITE ${_output_file} ${_makefile_inc_text})
1874
+ set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS "${_input_file}")
1875
+ endfunction()
1876
+
1877
+ include(GNUInstallDirs)
1878
+
1879
+ set(_install_cmake_dir "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}")
1880
+ set(TARGETS_EXPORT_NAME "${PROJECT_NAME}Targets")
1881
+ set(_generated_dir "${CMAKE_CURRENT_BINARY_DIR}/generated")
1882
+ set(_project_config "${_generated_dir}/${PROJECT_NAME}Config.cmake")
1883
+ set(_version_config "${_generated_dir}/${PROJECT_NAME}ConfigVersion.cmake")
1884
+
1885
+ option(BUILD_TESTING "Build tests" ON)
1886
+ if(BUILD_TESTING AND PERL_FOUND AND NOT CURL_DISABLE_TESTS)
1887
+ set(CURL_BUILD_TESTING ON)
1888
+ else()
1889
+ set(CURL_BUILD_TESTING OFF)
1890
+ endif()
1891
+
1892
+ if(HAVE_MANUAL_TOOLS)
1893
+ set(CURL_MANPAGE "${PROJECT_BINARY_DIR}/docs/cmdline-opts/curl.1")
1894
+ set(CURL_ASCIIPAGE "${PROJECT_BINARY_DIR}/docs/cmdline-opts/curl.txt")
1895
+ add_subdirectory(docs)
1896
+ endif()
1897
+
1898
+ add_subdirectory(lib)
1899
+
1900
+ if(BUILD_CURL_EXE)
1901
+ add_subdirectory(src)
1902
+ endif()
1903
+
1904
+ option(BUILD_EXAMPLES "Build libcurl examples" ON)
1905
+ if(BUILD_EXAMPLES)
1906
+ add_subdirectory(docs/examples)
1907
+ endif()
1908
+
1909
+ if(CURL_BUILD_TESTING)
1910
+ add_subdirectory(tests)
1911
+ endif()
1912
+
1913
+ # Helper to populate a list (_items) with a label when conditions
1914
+ # (the remaining args) are satisfied
1915
+ macro(_add_if _label)
1916
+ # Needs to be a macro to allow this indirection
1917
+ if(${ARGN})
1918
+ set(_items ${_items} "${_label}")
1919
+ endif()
1920
+ endmacro()
1921
+
1922
+ # NTLM support requires crypto functions from various SSL libs.
1923
+ # These conditions must match those in lib/curl_setup.h.
1924
+ if(NOT CURL_DISABLE_NTLM AND
1925
+ (USE_OPENSSL OR
1926
+ USE_MBEDTLS OR
1927
+ USE_GNUTLS OR
1928
+ USE_SECTRANSP OR
1929
+ USE_WIN32_CRYPTO OR
1930
+ (USE_WOLFSSL AND HAVE_WOLFSSL_DES_ECB_ENCRYPT)))
1931
+ set(_use_curl_ntlm_core ON)
1932
+ endif()
1933
+
1934
+ # Clear list and try to detect available protocols
1935
+ unset(_items)
1936
+ _add_if("HTTP" NOT CURL_DISABLE_HTTP)
1937
+ _add_if("HTTPS" NOT CURL_DISABLE_HTTP AND _ssl_enabled)
1938
+ _add_if("FTP" NOT CURL_DISABLE_FTP)
1939
+ _add_if("FTPS" NOT CURL_DISABLE_FTP AND _ssl_enabled)
1940
+ _add_if("FILE" NOT CURL_DISABLE_FILE)
1941
+ _add_if("TELNET" NOT CURL_DISABLE_TELNET)
1942
+ _add_if("LDAP" NOT CURL_DISABLE_LDAP)
1943
+ # CURL_DISABLE_LDAP implies CURL_DISABLE_LDAPS
1944
+ _add_if("LDAPS" NOT CURL_DISABLE_LDAPS AND
1945
+ ((USE_OPENLDAP AND _ssl_enabled) OR
1946
+ (NOT USE_OPENLDAP AND HAVE_LDAP_SSL)))
1947
+ _add_if("DICT" NOT CURL_DISABLE_DICT)
1948
+ _add_if("TFTP" NOT CURL_DISABLE_TFTP)
1949
+ _add_if("GOPHER" NOT CURL_DISABLE_GOPHER)
1950
+ _add_if("GOPHERS" NOT CURL_DISABLE_GOPHER AND _ssl_enabled)
1951
+ _add_if("POP3" NOT CURL_DISABLE_POP3)
1952
+ _add_if("POP3S" NOT CURL_DISABLE_POP3 AND _ssl_enabled)
1953
+ _add_if("IMAP" NOT CURL_DISABLE_IMAP)
1954
+ _add_if("IMAPS" NOT CURL_DISABLE_IMAP AND _ssl_enabled)
1955
+ _add_if("SMB" NOT CURL_DISABLE_SMB AND
1956
+ _use_curl_ntlm_core AND (SIZEOF_CURL_OFF_T GREATER 4))
1957
+ _add_if("SMBS" NOT CURL_DISABLE_SMB AND _ssl_enabled AND
1958
+ _use_curl_ntlm_core AND (SIZEOF_CURL_OFF_T GREATER 4))
1959
+ _add_if("SMTP" NOT CURL_DISABLE_SMTP)
1960
+ _add_if("SMTPS" NOT CURL_DISABLE_SMTP AND _ssl_enabled)
1961
+ _add_if("SCP" USE_LIBSSH2 OR USE_LIBSSH OR USE_WOLFSSH)
1962
+ _add_if("SFTP" USE_LIBSSH2 OR USE_LIBSSH OR USE_WOLFSSH)
1963
+ _add_if("IPFS" NOT CURL_DISABLE_IPFS)
1964
+ _add_if("IPNS" NOT CURL_DISABLE_IPFS)
1965
+ _add_if("RTSP" NOT CURL_DISABLE_RTSP)
1966
+ _add_if("RTMP" USE_LIBRTMP)
1967
+ _add_if("MQTT" NOT CURL_DISABLE_MQTT)
1968
+ _add_if("WS" NOT CURL_DISABLE_WEBSOCKETS)
1969
+ _add_if("WSS" NOT CURL_DISABLE_WEBSOCKETS AND _ssl_enabled)
1970
+ if(_items)
1971
+ list(SORT _items)
1972
+ endif()
1973
+ string(REPLACE ";" " " SUPPORT_PROTOCOLS "${_items}")
1974
+ string(TOLOWER "${SUPPORT_PROTOCOLS}" _support_protocols_lower)
1975
+ message(STATUS "Protocols: ${_support_protocols_lower}")
1976
+
1977
+ # Clear list and try to detect available features
1978
+ unset(_items)
1979
+ _add_if("SSL" _ssl_enabled)
1980
+ _add_if("IPv6" ENABLE_IPV6)
1981
+ _add_if("UnixSockets" USE_UNIX_SOCKETS)
1982
+ _add_if("libz" HAVE_LIBZ)
1983
+ _add_if("brotli" HAVE_BROTLI)
1984
+ _add_if("gsasl" USE_GSASL)
1985
+ _add_if("zstd" HAVE_ZSTD)
1986
+ _add_if("AsynchDNS" USE_ARES OR USE_THREADS_POSIX OR USE_THREADS_WIN32)
1987
+ _add_if("IDN" (HAVE_LIBIDN2 AND HAVE_IDN2_H) OR
1988
+ USE_WIN32_IDN OR
1989
+ USE_APPLE_IDN)
1990
+ _add_if("Largefile" (SIZEOF_CURL_OFF_T GREATER 4) AND
1991
+ ((SIZEOF_OFF_T GREATER 4) OR USE_WIN32_LARGE_FILES))
1992
+ _add_if("SSPI" USE_WINDOWS_SSPI)
1993
+ _add_if("GSS-API" HAVE_GSSAPI)
1994
+ _add_if("alt-svc" NOT CURL_DISABLE_ALTSVC)
1995
+ _add_if("HSTS" NOT CURL_DISABLE_HSTS)
1996
+ _add_if("SPNEGO" NOT CURL_DISABLE_NEGOTIATE_AUTH AND
1997
+ (HAVE_GSSAPI OR USE_WINDOWS_SSPI))
1998
+ _add_if("Kerberos" NOT CURL_DISABLE_KERBEROS_AUTH AND
1999
+ (HAVE_GSSAPI OR USE_WINDOWS_SSPI))
2000
+ _add_if("NTLM" NOT (CURL_DISABLE_NTLM) AND
2001
+ (_use_curl_ntlm_core OR USE_WINDOWS_SSPI))
2002
+ _add_if("TLS-SRP" USE_TLS_SRP)
2003
+ _add_if("HTTP2" USE_NGHTTP2)
2004
+ _add_if("HTTP3" USE_NGTCP2 OR USE_QUICHE OR USE_MSH3 OR USE_OPENSSL_QUIC)
2005
+ _add_if("MultiSSL" CURL_WITH_MULTI_SSL)
2006
+ _add_if("HTTPS-proxy" _ssl_enabled AND (USE_OPENSSL OR USE_GNUTLS
2007
+ OR USE_SCHANNEL OR USE_RUSTLS OR USE_BEARSSL OR
2008
+ USE_MBEDTLS OR USE_SECTRANSP OR
2009
+ (USE_WOLFSSL AND HAVE_WOLFSSL_BIO)))
2010
+ _add_if("Unicode" ENABLE_UNICODE)
2011
+ _add_if("threadsafe" HAVE_ATOMIC OR
2012
+ (USE_THREADS_POSIX AND HAVE_PTHREAD_H) OR
2013
+ (WIN32 AND HAVE_WIN32_WINNT GREATER_EQUAL 0x0600))
2014
+ _add_if("Debug" ENABLE_DEBUG)
2015
+ _add_if("TrackMemory" ENABLE_CURLDEBUG)
2016
+ _add_if("ECH" _ssl_enabled AND HAVE_ECH)
2017
+ _add_if("PSL" USE_LIBPSL)
2018
+ _add_if("CAcert" CURL_CA_EMBED_SET)
2019
+ if(_items)
2020
+ if(NOT CMAKE_VERSION VERSION_LESS 3.13)
2021
+ list(SORT _items CASE INSENSITIVE)
2022
+ else()
2023
+ list(SORT _items)
2024
+ endif()
2025
+ endif()
2026
+ string(REPLACE ";" " " SUPPORT_FEATURES "${_items}")
2027
+ message(STATUS "Features: ${SUPPORT_FEATURES}")
2028
+
2029
+ # Clear list and collect SSL backends
2030
+ unset(_items)
2031
+ _add_if("Schannel" _ssl_enabled AND USE_SCHANNEL)
2032
+ _add_if("OpenSSL" _ssl_enabled AND USE_OPENSSL AND OPENSSL_VERSION VERSION_LESS 3.0.0)
2033
+ _add_if("OpenSSL v3+" _ssl_enabled AND USE_OPENSSL AND NOT OPENSSL_VERSION VERSION_LESS 3.0.0)
2034
+ _add_if("Secure Transport" _ssl_enabled AND USE_SECTRANSP)
2035
+ _add_if("mbedTLS" _ssl_enabled AND USE_MBEDTLS)
2036
+ _add_if("BearSSL" _ssl_enabled AND USE_BEARSSL)
2037
+ _add_if("wolfSSL" _ssl_enabled AND USE_WOLFSSL)
2038
+ _add_if("GnuTLS" _ssl_enabled AND USE_GNUTLS)
2039
+ _add_if("rustls" _ssl_enabled AND USE_RUSTLS)
2040
+
2041
+ if(_items)
2042
+ if(NOT CMAKE_VERSION VERSION_LESS 3.13)
2043
+ list(SORT _items CASE INSENSITIVE)
2044
+ else()
2045
+ list(SORT _items)
2046
+ endif()
2047
+ endif()
2048
+ string(REPLACE ";" " " SSL_BACKENDS "${_items}")
2049
+ message(STATUS "Enabled SSL backends: ${SSL_BACKENDS}")
2050
+ if(CURL_DEFAULT_SSL_BACKEND)
2051
+ message(STATUS "Default SSL backend: ${CURL_DEFAULT_SSL_BACKEND}")
2052
+ endif()
2053
+
2054
+ if(NOT CURL_DISABLE_INSTALL)
2055
+
2056
+ # curl-config needs the following options to be set.
2057
+ set(CC "${CMAKE_C_COMPILER}")
2058
+ # TODO: probably put a -D... options here?
2059
+ set(CONFIGURE_OPTIONS "")
2060
+ set(CURLVERSION "${_curl_version}")
2061
+ set(VERSIONNUM "${_curl_version_num}")
2062
+ set(prefix "${CMAKE_INSTALL_PREFIX}")
2063
+ set(exec_prefix "\${prefix}")
2064
+ if(IS_ABSOLUTE ${CMAKE_INSTALL_INCLUDEDIR})
2065
+ set(includedir "${CMAKE_INSTALL_INCLUDEDIR}")
2066
+ else()
2067
+ set(includedir "\${prefix}/${CMAKE_INSTALL_INCLUDEDIR}")
2068
+ endif()
2069
+ if(IS_ABSOLUTE ${CMAKE_INSTALL_LIBDIR})
2070
+ set(libdir "${CMAKE_INSTALL_LIBDIR}")
2071
+ else()
2072
+ set(libdir "\${exec_prefix}/${CMAKE_INSTALL_LIBDIR}")
2073
+ endif()
2074
+ # "a" (Linux) or "lib" (Windows)
2075
+ string(REPLACE "." "" libext "${CMAKE_STATIC_LIBRARY_SUFFIX}")
2076
+
2077
+ set(_ldflags "")
2078
+ set(LIBCURL_PC_LIBS_PRIVATE "")
2079
+
2080
+ # Filter CMAKE_SHARED_LINKER_FLAGS for libs and libpaths
2081
+ string(STRIP "${CMAKE_SHARED_LINKER_FLAGS}" _custom_ldflags)
2082
+ string(REGEX REPLACE " +-([^ \\t;]*)" ";-\\1" _custom_ldflags "${_custom_ldflags}")
2083
+
2084
+ set(_custom_libs "")
2085
+ set(_custom_libdirs "")
2086
+ foreach(_flag IN LISTS _custom_ldflags)
2087
+ if(_flag MATCHES "^-l")
2088
+ string(REGEX REPLACE "^-l" "" _flag "${_flag}")
2089
+ list(APPEND _custom_libs "${_flag}")
2090
+ elseif(_flag MATCHES "^-framework|^-F")
2091
+ list(APPEND _custom_libs "${_flag}")
2092
+ elseif(_flag MATCHES "^-L")
2093
+ string(REGEX REPLACE "^-L" "" _flag "${_flag}")
2094
+ list(APPEND _custom_libdirs "${_flag}")
2095
+ elseif(_flag MATCHES "^--library-path=")
2096
+ string(REGEX REPLACE "^--library-path=" "" _flag "${_flag}")
2097
+ list(APPEND _custom_libdirs "${_flag}")
2098
+ endif()
2099
+ endforeach()
2100
+
2101
+ # Avoid getting unnecessary -L options for known system directories.
2102
+ unset(_sys_libdirs)
2103
+ foreach(_libdir IN LISTS CMAKE_SYSTEM_PREFIX_PATH)
2104
+ if(_libdir MATCHES "/$")
2105
+ set(_libdir "${_libdir}lib")
2106
+ else()
2107
+ set(_libdir "${_libdir}/lib")
2108
+ endif()
2109
+ if(IS_DIRECTORY "${_libdir}")
2110
+ list(APPEND _sys_libdirs "${_libdir}")
2111
+ endif()
2112
+ if(DEFINED CMAKE_LIBRARY_ARCHITECTURE)
2113
+ set(_libdir "${_libdir}/${CMAKE_LIBRARY_ARCHITECTURE}")
2114
+ if(IS_DIRECTORY "${_libdir}")
2115
+ list(APPEND _sys_libdirs "${_libdir}")
2116
+ endif()
2117
+ endif()
2118
+ endforeach()
2119
+
2120
+ foreach(_libdir IN LISTS _custom_libdirs CURL_LIBDIRS)
2121
+ list(FIND _sys_libdirs "${_libdir}" _libdir_index)
2122
+ if(_libdir_index LESS 0)
2123
+ list(APPEND _ldflags "-L${_libdir}")
2124
+ endif()
2125
+ endforeach()
2126
+
2127
+ unset(_implicit_libs)
2128
+ if(NOT MINGW AND NOT UNIX)
2129
+ set(_implicit_libs ${CMAKE_C_IMPLICIT_LINK_LIBRARIES})
2130
+ endif()
2131
+
2132
+ foreach(_lib IN LISTS _implicit_libs _custom_libs CURL_LIBS)
2133
+ if(TARGET "${_lib}")
2134
+ set(_libname "${_lib}")
2135
+ get_target_property(_imported "${_libname}" IMPORTED)
2136
+ if(NOT _imported)
2137
+ # Reading the LOCATION property on non-imported target will error out.
2138
+ # Assume the user will not need this information in the .pc file.
2139
+ continue()
2140
+ endif()
2141
+ get_target_property(_lib "${_libname}" LOCATION)
2142
+ if(NOT _lib)
2143
+ message(WARNING "Bad lib in library list: ${_libname}")
2144
+ continue()
2145
+ endif()
2146
+ endif()
2147
+ if(_lib MATCHES "^-") # '-framework <name>'
2148
+ list(APPEND _ldflags "${_lib}")
2149
+ elseif(_lib MATCHES ".*/.*")
2150
+ # This gets a bit more complex, because we want to specify the
2151
+ # directory separately, and only once per directory
2152
+ get_filename_component(_libdir ${_lib} DIRECTORY)
2153
+ get_filename_component(_libname ${_lib} NAME_WE)
2154
+ if(_libname MATCHES "^lib")
2155
+ list(FIND _sys_libdirs "${_libdir}" _libdir_index)
2156
+ if(_libdir_index LESS 0)
2157
+ list(APPEND _ldflags "-L${_libdir}")
2158
+ endif()
2159
+ string(REGEX REPLACE "^lib" "" _libname "${_libname}")
2160
+ list(APPEND LIBCURL_PC_LIBS_PRIVATE "-l${_libname}")
2161
+ else()
2162
+ list(APPEND LIBCURL_PC_LIBS_PRIVATE "${_lib}")
2163
+ endif()
2164
+ else()
2165
+ list(APPEND LIBCURL_PC_LIBS_PRIVATE "-l${_lib}")
2166
+ endif()
2167
+ endforeach()
2168
+
2169
+ if(LIBCURL_PC_REQUIRES_PRIVATE)
2170
+ string(REPLACE ";" "," LIBCURL_PC_REQUIRES_PRIVATE "${LIBCURL_PC_REQUIRES_PRIVATE}")
2171
+ endif()
2172
+ if(LIBCURL_PC_LIBS_PRIVATE)
2173
+ string(REPLACE ";" " " LIBCURL_PC_LIBS_PRIVATE "${LIBCURL_PC_LIBS_PRIVATE}")
2174
+ endif()
2175
+ if(_ldflags)
2176
+ list(REMOVE_DUPLICATES _ldflags)
2177
+ string(REPLACE ";" " " _ldflags "${_ldflags}")
2178
+ set(LIBCURL_PC_LDFLAGS_PRIVATE "${_ldflags}")
2179
+ string(STRIP "${LIBCURL_PC_LDFLAGS_PRIVATE}" LIBCURL_PC_LDFLAGS_PRIVATE)
2180
+ else()
2181
+ set(LIBCURL_PC_LDFLAGS_PRIVATE "")
2182
+ endif()
2183
+ set(LIBCURL_PC_CFLAGS_PRIVATE "-DCURL_STATICLIB")
2184
+
2185
+ # Merge pkg-config private fields into public ones when static-only
2186
+ if(BUILD_SHARED_LIBS)
2187
+ set(ENABLE_SHARED "yes")
2188
+ set(LIBCURL_PC_REQUIRES "")
2189
+ set(LIBCURL_PC_LIBS "")
2190
+ set(LIBCURL_PC_CFLAGS "")
2191
+ else()
2192
+ set(ENABLE_SHARED "no")
2193
+ set(LIBCURL_PC_REQUIRES "${LIBCURL_PC_REQUIRES_PRIVATE}")
2194
+ set(LIBCURL_PC_LIBS "${LIBCURL_PC_LIBS_PRIVATE}")
2195
+ set(LIBCURL_PC_CFLAGS "${LIBCURL_PC_CFLAGS_PRIVATE}")
2196
+ endif()
2197
+ if(BUILD_STATIC_LIBS)
2198
+ set(ENABLE_STATIC "yes")
2199
+ else()
2200
+ set(ENABLE_STATIC "no")
2201
+ endif()
2202
+
2203
+ # Generate a "curl-config" matching this config.
2204
+ # Consumed variables:
2205
+ # CC
2206
+ # CONFIGURE_OPTIONS
2207
+ # CURLVERSION
2208
+ # CURL_CA_BUNDLE
2209
+ # ENABLE_SHARED
2210
+ # ENABLE_STATIC
2211
+ # exec_prefix
2212
+ # includedir
2213
+ # LIBCURL_PC_CFLAGS
2214
+ # LIBCURL_PC_LDFLAGS_PRIVATE
2215
+ # LIBCURL_PC_LIBS_PRIVATE
2216
+ # libdir
2217
+ # libext
2218
+ # prefix
2219
+ # SSL_BACKENDS
2220
+ # SUPPORT_FEATURES
2221
+ # SUPPORT_PROTOCOLS
2222
+ # VERSIONNUM
2223
+ configure_file(
2224
+ "${PROJECT_SOURCE_DIR}/curl-config.in"
2225
+ "${PROJECT_BINARY_DIR}/curl-config" @ONLY)
2226
+ install(FILES "${PROJECT_BINARY_DIR}/curl-config"
2227
+ DESTINATION ${CMAKE_INSTALL_BINDIR}
2228
+ PERMISSIONS
2229
+ OWNER_READ OWNER_WRITE OWNER_EXECUTE
2230
+ GROUP_READ GROUP_EXECUTE
2231
+ WORLD_READ WORLD_EXECUTE)
2232
+
2233
+ # Generate a pkg-config file matching this config.
2234
+ # Consumed variables:
2235
+ # CURLVERSION
2236
+ # exec_prefix
2237
+ # includedir
2238
+ # LIBCURL_PC_CFLAGS
2239
+ # LIBCURL_PC_CFLAGS_PRIVATE
2240
+ # LIBCURL_PC_LDFLAGS_PRIVATE
2241
+ # LIBCURL_PC_LIBS
2242
+ # LIBCURL_PC_LIBS_PRIVATE
2243
+ # LIBCURL_PC_REQUIRES
2244
+ # LIBCURL_PC_REQUIRES_PRIVATE
2245
+ # libdir
2246
+ # prefix
2247
+ # SUPPORT_FEATURES
2248
+ # SUPPORT_PROTOCOLS
2249
+ # Documentation:
2250
+ # https://people.freedesktop.org/~dbn/pkg-config-guide.html
2251
+ # https://manpages.debian.org/unstable/pkgconf/pkg-config.1.en.html
2252
+ # https://manpages.debian.org/unstable/pkg-config/pkg-config.1.en.html
2253
+ # https://www.msys2.org/docs/pkgconfig/
2254
+ configure_file(
2255
+ "${PROJECT_SOURCE_DIR}/libcurl.pc.in"
2256
+ "${PROJECT_BINARY_DIR}/libcurl.pc" @ONLY)
2257
+ install(FILES "${PROJECT_BINARY_DIR}/libcurl.pc"
2258
+ DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
2259
+
2260
+ # Install headers
2261
+ install(DIRECTORY "${PROJECT_SOURCE_DIR}/include/curl"
2262
+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
2263
+ FILES_MATCHING PATTERN "*.h")
2264
+
2265
+ include(CMakePackageConfigHelpers)
2266
+ write_basic_package_version_file(
2267
+ "${_version_config}"
2268
+ VERSION ${_curl_version}
2269
+ COMPATIBILITY SameMajorVersion)
2270
+ file(READ "${_version_config}" _generated_version_config)
2271
+ file(WRITE "${_version_config}" "
2272
+ if(NOT PACKAGE_FIND_VERSION_RANGE AND PACKAGE_FIND_VERSION_MAJOR STREQUAL \"7\")
2273
+ # Version 8 satisfies version 7... requirements
2274
+ set(PACKAGE_FIND_VERSION_MAJOR 8)
2275
+ set(PACKAGE_FIND_VERSION_COUNT 1)
2276
+ endif()
2277
+ ${_generated_version_config}")
2278
+
2279
+ # Consumed custom variables:
2280
+ # LIB_SELECTED
2281
+ # TARGETS_EXPORT_NAME
2282
+ # USE_OPENSSL
2283
+ # HAVE_LIBZ
2284
+ configure_package_config_file("CMake/curl-config.cmake.in"
2285
+ "${_project_config}"
2286
+ INSTALL_DESTINATION ${_install_cmake_dir}
2287
+ PATH_VARS CMAKE_INSTALL_INCLUDEDIR)
2288
+
2289
+ if(CURL_ENABLE_EXPORT_TARGET)
2290
+ install(EXPORT "${TARGETS_EXPORT_NAME}"
2291
+ NAMESPACE "${PROJECT_NAME}::"
2292
+ DESTINATION ${_install_cmake_dir})
2293
+ endif()
2294
+
2295
+ install(FILES ${_version_config} ${_project_config}
2296
+ DESTINATION ${_install_cmake_dir})
2297
+
2298
+ # Workaround for MSVS10 to avoid the Dialog Hell
2299
+ # FIXME: This could be removed with future version of CMake.
2300
+ if(MSVC_VERSION EQUAL 1600)
2301
+ set(_curl_sln_filename "${CMAKE_CURRENT_BINARY_DIR}/CURL.sln")
2302
+ if(EXISTS "${_curl_sln_filename}")
2303
+ file(APPEND "${_curl_sln_filename}" "\n# This should be regenerated!\n")
2304
+ endif()
2305
+ endif()
2306
+
2307
+ if(NOT TARGET curl_uninstall)
2308
+ configure_file(
2309
+ "${CMAKE_CURRENT_SOURCE_DIR}/CMake/cmake_uninstall.cmake.in"
2310
+ "${CMAKE_CURRENT_BINARY_DIR}/CMake/cmake_uninstall.cmake"
2311
+ @ONLY)
2312
+
2313
+ add_custom_target(curl_uninstall
2314
+ COMMAND ${CMAKE_COMMAND} -P "${CMAKE_CURRENT_BINARY_DIR}/CMake/cmake_uninstall.cmake")
2315
+ endif()
2316
+
2317
+ install(FILES "${PROJECT_SOURCE_DIR}/scripts/mk-ca-bundle.pl"
2318
+ DESTINATION ${CMAKE_INSTALL_BINDIR}
2319
+ PERMISSIONS
2320
+ OWNER_READ OWNER_WRITE OWNER_EXECUTE
2321
+ GROUP_READ GROUP_EXECUTE
2322
+ WORLD_READ WORLD_EXECUTE)
2323
+
2324
+ # The `-DEV` part is important
2325
+ string(REGEX REPLACE "([0-9]+\.[0-9]+)\.([0-9]+.*)" "\\2" CPACK_PACKAGE_VERSION_PATCH "${_curl_version}")
2326
+ set(CPACK_GENERATOR "TGZ")
2327
+ include(CPack)
2328
+ endif()
2329
+
2330
+ # Save build info for test runner to pick up and log
2331
+ if(CMAKE_OSX_SYSROOT)
2332
+ set(_cmake_sysroot ${CMAKE_OSX_SYSROOT})
2333
+ elseif(CMAKE_SYSROOT)
2334
+ set(_cmake_sysroot ${CMAKE_SYSROOT})
2335
+ endif()
2336
+ set(_buildinfo "\
2337
+ buildinfo.configure.tool: cmake
2338
+ buildinfo.configure.command: ${CMAKE_COMMAND}
2339
+ buildinfo.configure.version: ${CMAKE_VERSION}
2340
+ buildinfo.configure.args:${_cmake_args}
2341
+ buildinfo.configure.generator: ${CMAKE_GENERATOR}
2342
+ buildinfo.configure.make: ${CMAKE_MAKE_PROGRAM}
2343
+ buildinfo.host.cpu: ${CMAKE_HOST_SYSTEM_PROCESSOR}
2344
+ buildinfo.host.os: ${CMAKE_HOST_SYSTEM_NAME}
2345
+ buildinfo.target.cpu: ${CMAKE_SYSTEM_PROCESSOR}
2346
+ buildinfo.target.os: ${CMAKE_SYSTEM_NAME}
2347
+ buildinfo.target.flags:${_target_flags}
2348
+ buildinfo.compiler: ${CMAKE_C_COMPILER_ID}
2349
+ buildinfo.compiler.version: ${CMAKE_C_COMPILER_VERSION}
2350
+ buildinfo.sysroot: ${_cmake_sysroot}
2351
+ ")
2352
+ file(WRITE "${PROJECT_BINARY_DIR}/buildinfo.txt" "# This is a generated file. Do not edit.\n${_buildinfo}")
2353
+ if(NOT "$ENV{CURL_BUILDINFO}$ENV{CURL_CI}$ENV{CI}" STREQUAL "")
2354
+ message(STATUS "\n${_buildinfo}")
2355
+ endif()
afc-curl/COPYING ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ COPYRIGHT AND PERMISSION NOTICE
2
+
3
+ Copyright (c) 1996 - 2024, Daniel Stenberg, <daniel@haxx.se>, and many
4
+ contributors, see the THANKS file.
5
+
6
+ All rights reserved.
7
+
8
+ Permission to use, copy, modify, and distribute this software for any purpose
9
+ with or without fee is hereby granted, provided that the above copyright
10
+ notice and this permission notice appear in all copies.
11
+
12
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
13
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN
15
+ NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
16
+ DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
17
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
18
+ OR OTHER DEALINGS IN THE SOFTWARE.
19
+
20
+ Except as contained in this notice, the name of a copyright holder shall not
21
+ be used in advertising or otherwise to promote the sale, use or other dealings
22
+ in this Software without prior written authorization of the copyright holder.
afc-curl/Dockerfile ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
2
+ #
3
+ # SPDX-License-Identifier: curl
4
+
5
+ # Self-contained build environment to match the release environment.
6
+ #
7
+ # Build and set the timestamp for the date corresponding to the release
8
+ #
9
+ # docker build --build-arg SOURCE_DATE_EPOCH=1711526400 --build-arg UID=$(id -u) --build-arg GID=$(id -g) -t curl/curl .
10
+ #
11
+ # Then run commands from within the build environment, for example
12
+ #
13
+ # docker run --rm -it -u $(id -u):$(id -g) -v $(pwd):/usr/src -w /usr/src curl/curl autoreconf -fi
14
+ # docker run --rm -it -u $(id -u):$(id -g) -v $(pwd):/usr/src -w /usr/src curl/curl ./configure --without-ssl --without-libpsl
15
+ # docker run --rm -it -u $(id -u):$(id -g) -v $(pwd):/usr/src -w /usr/src curl/curl make
16
+ # docker run --rm -it -u $(id -u):$(id -g) -v $(pwd):/usr/src -w /usr/src curl/curl ./scripts/maketgz 8.7.1
17
+ #
18
+ # or get into a shell in the build environment, for example
19
+ #
20
+ # docker run --rm -it -u $(id -u):$(id -g) -v (pwd):/usr/src -w /usr/src curl/curl bash
21
+ # $ autoreconf -fi
22
+ # $ ./configure --without-ssl --without-libpsl
23
+ # $ make
24
+ # $ ./scripts/maketgz 8.7.1
25
+
26
+ # To update, get the latest digest e.g. from https://hub.docker.com/_/debian/tags
27
+ FROM debian:bookworm-slim@sha256:b73bf02f32434c9be21adf83b9aedf33e731784d8d2dacbbd3ce5f4993f2a2de
28
+
29
+ RUN apt-get update -qq && apt-get install -qq -y --no-install-recommends \
30
+ build-essential make autoconf automake libtool git perl zip zlib1g-dev gawk && \
31
+ rm -rf /var/lib/apt/lists/*
32
+
33
+ ARG UID=1000 GID=1000
34
+
35
+ RUN groupadd --gid $UID dev && \
36
+ useradd --uid $UID --gid dev --shell /bin/bash --create-home dev
37
+
38
+ USER dev:dev
39
+
40
+ ARG SOURCE_DATE_EPOCH
41
+ ENV SOURCE_DATE_EPOCH=${SOURCE_DATE_EPOCH:-1}
afc-curl/GIT-INFO.md ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ _ _ ____ _
2
+ ___| | | | _ \| |
3
+ / __| | | | |_) | |
4
+ | (__| |_| | _ <| |___
5
+ \___|\___/|_| \_\_____|
6
+
7
+ # GIT-INFO
8
+
9
+ This file is only present in git - never in release archives. It contains
10
+ information about other files and things that the git repository keeps in its
11
+ inner sanctum.
12
+
13
+ To build in environments that support configure, after having extracted
14
+ everything from git, do this:
15
+
16
+ autoreconf -fi
17
+ ./configure --with-openssl
18
+ make
19
+
20
+ Daniel uses a configure line similar to this for easier development:
21
+
22
+ ./configure --disable-shared --enable-debug --enable-maintainer-mode
23
+
24
+ In environments that don't support configure (i.e. Windows), do this:
25
+
26
+ buildconf.bat
27
+
28
+ ## REQUIREMENTS
29
+
30
+ See [docs/INTERNALS.md][0] for requirement details.
31
+
32
+ [0]: docs/INTERNALS.md
afc-curl/LICENSES/BSD-3-Clause.txt ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Copyright (c) <year> <owner>.
2
+
3
+ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
4
+
5
+ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
6
+
7
+ 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
8
+
9
+ 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
10
+
11
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
afc-curl/LICENSES/BSD-4-Clause-UC.txt ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ BSD-4-Clause (University of California-Specific)
2
+
3
+ Copyright [various years] The Regents of the University of California. All rights reserved.
4
+
5
+ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6
+
7
+ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
8
+
9
+ 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
10
+
11
+ 3. All advertising materials mentioning features or use of this software must display the following acknowledgement: This product includes software developed by the University of California, Berkeley and its contributors.
12
+
13
+ 4. Neither the name of the University nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
14
+
15
+ THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
afc-curl/LICENSES/ISC.txt ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Permission to use, copy, modify, and distribute this software for any
2
+ purpose with or without fee is hereby granted, provided that the above
3
+ copyright notice and this permission notice appear in all copies.
4
+
5
+ THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
6
+ DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
7
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
8
+ INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
9
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
10
+ FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
11
+ NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
12
+ WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
afc-curl/LICENSES/curl.txt ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ COPYRIGHT AND PERMISSION NOTICE
2
+
3
+ Copyright (C) Daniel Stenberg, <daniel@haxx.se>, and many
4
+ contributors, see the THANKS file.
5
+
6
+ All rights reserved.
7
+
8
+ Permission to use, copy, modify, and distribute this software for any purpose
9
+ with or without fee is hereby granted, provided that the above copyright
10
+ notice and this permission notice appear in all copies.
11
+
12
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
13
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN
15
+ NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
16
+ DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
17
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
18
+ OR OTHER DEALINGS IN THE SOFTWARE.
19
+
20
+ Except as contained in this notice, the name of a copyright holder shall not
21
+ be used in advertising or otherwise to promote the sale, use or other dealings
22
+ in this Software without prior written authorization of the copyright holder.
afc-curl/Makefile.am ADDED
@@ -0,0 +1,252 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #***************************************************************************
2
+ # _ _ ____ _
3
+ # Project ___| | | | _ \| |
4
+ # / __| | | | |_) | |
5
+ # | (__| |_| | _ <| |___
6
+ # \___|\___/|_| \_\_____|
7
+ #
8
+ # Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
9
+ #
10
+ # This software is licensed as described in the file COPYING, which
11
+ # you should have received as part of this distribution. The terms
12
+ # are also available at https://curl.se/docs/copyright.html.
13
+ #
14
+ # You may opt to use, copy, modify, merge, publish, distribute and/or sell
15
+ # copies of the Software, and permit persons to whom the Software is
16
+ # furnished to do so, under the terms of the COPYING file.
17
+ #
18
+ # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19
+ # KIND, either express or implied.
20
+ #
21
+ # SPDX-License-Identifier: curl
22
+ #
23
+ ###########################################################################
24
+
25
+ AUTOMAKE_OPTIONS = foreign
26
+
27
+ ACLOCAL_AMFLAGS = -I m4
28
+
29
+ CMAKE_DIST = \
30
+ CMake/cmake_uninstall.cmake.in \
31
+ CMake/CMakeConfigurableFile.in \
32
+ CMake/curl-config.cmake.in \
33
+ CMake/CurlSymbolHiding.cmake \
34
+ CMake/CurlTests.c \
35
+ CMake/FindBearSSL.cmake \
36
+ CMake/FindBrotli.cmake \
37
+ CMake/FindCares.cmake \
38
+ CMake/FindGSS.cmake \
39
+ CMake/FindLibgsasl.cmake \
40
+ CMake/FindLibidn2.cmake \
41
+ CMake/FindLibpsl.cmake \
42
+ CMake/FindLibssh.cmake \
43
+ CMake/FindLibssh2.cmake \
44
+ CMake/FindLibuv.cmake \
45
+ CMake/FindMbedTLS.cmake \
46
+ CMake/FindMSH3.cmake \
47
+ CMake/FindMbedTLS.cmake \
48
+ CMake/FindNGHTTP2.cmake \
49
+ CMake/FindNGHTTP3.cmake \
50
+ CMake/FindNGTCP2.cmake \
51
+ CMake/FindNettle.cmake \
52
+ CMake/FindQuiche.cmake \
53
+ CMake/FindRustls.cmake \
54
+ CMake/FindWolfSSH.cmake \
55
+ CMake/FindWolfSSL.cmake \
56
+ CMake/FindZstd.cmake \
57
+ CMake/Macros.cmake \
58
+ CMake/OtherTests.cmake \
59
+ CMake/PickyWarnings.cmake \
60
+ CMake/Platforms/WindowsCache.cmake \
61
+ CMake/Utilities.cmake \
62
+ CMakeLists.txt
63
+
64
+ VC_DIST = projects/README.md \
65
+ projects/build-openssl.bat \
66
+ projects/build-wolfssl.bat \
67
+ projects/checksrc.bat \
68
+ projects/generate.bat \
69
+ projects/wolfssl_options.h \
70
+ projects/wolfssl_override.props
71
+
72
+ WINBUILD_DIST = winbuild/README.md \
73
+ winbuild/MakefileBuild.vc winbuild/Makefile.vc winbuild/makedebug.bat
74
+
75
+ PLAN9_DIST = plan9/include/mkfile \
76
+ plan9/include/mkfile \
77
+ plan9/mkfile.proto \
78
+ plan9/mkfile \
79
+ plan9/README \
80
+ plan9/lib/mkfile.inc \
81
+ plan9/lib/mkfile \
82
+ plan9/src/mkfile.inc \
83
+ plan9/src/mkfile
84
+
85
+ EXTRA_DIST = CHANGES.md COPYING Makefile.dist \
86
+ RELEASE-NOTES $(CMAKE_DIST) $(VC_DIST) $(WINBUILD_DIST) \
87
+ $(PLAN9_DIST) buildconf.bat Dockerfile
88
+
89
+ CLEANFILES = $(VC14_LIBVCXPROJ) $(VC14_SRCVCXPROJ) \
90
+ $(VC14_10_LIBVCXPROJ) $(VC14_10_SRCVCXPROJ) \
91
+ $(VC14_20_LIBVCXPROJ) $(VC14_20_SRCVCXPROJ) \
92
+ $(VC14_30_LIBVCXPROJ) $(VC14_30_SRCVCXPROJ)
93
+
94
+ DISTCLEANFILES = buildinfo.txt
95
+
96
+ bin_SCRIPTS = curl-config
97
+
98
+ SUBDIRS = lib docs src scripts
99
+ DIST_SUBDIRS = $(SUBDIRS) tests packages include docs
100
+
101
+ pkgconfigdir = $(libdir)/pkgconfig
102
+ pkgconfig_DATA = libcurl.pc
103
+
104
+ # List of files required to generate VC IDE .dsp, .vcproj and .vcxproj files
105
+ include lib/Makefile.inc
106
+ include src/Makefile.inc
107
+
108
+ dist-hook:
109
+ rm -rf $(top_builddir)/tests/log
110
+ find $(distdir) -name "*.dist" -a \! -name Makefile.dist -exec rm {} \;
111
+ (distit=`find $(srcdir) -name "*.dist" | grep -v Makefile`; \
112
+ for file in $$distit; do \
113
+ strip=`echo $$file | sed -e s/^$(srcdir)// -e s/\.dist//`; \
114
+ cp -p $$file $(distdir)$$strip; \
115
+ done)
116
+
117
+ check: test examples check-docs
118
+
119
+ if CROSSCOMPILING
120
+ test-full: test
121
+ test-nonflaky: test
122
+ test-torture: test
123
+ test-event: test
124
+ test-am: test
125
+ test-ci: test
126
+ pytest: test
127
+ pytest-ci: test
128
+
129
+ test:
130
+ @echo "NOTICE: we can't run the tests when cross-compiling!"
131
+
132
+ else
133
+
134
+ test:
135
+ @(cd tests; $(MAKE) all quiet-test)
136
+
137
+ test-full:
138
+ @(cd tests; $(MAKE) all full-test)
139
+
140
+ test-nonflaky:
141
+ @(cd tests; $(MAKE) all nonflaky-test)
142
+
143
+ test-torture:
144
+ @(cd tests; $(MAKE) all torture-test)
145
+
146
+ test-event:
147
+ @(cd tests; $(MAKE) all event-test)
148
+
149
+ test-am:
150
+ @(cd tests; $(MAKE) all am-test)
151
+
152
+ test-ci:
153
+ @(cd tests; $(MAKE) all ci-test)
154
+
155
+ pytest:
156
+ @(cd tests; $(MAKE) all default-pytest)
157
+
158
+ pytest-ci:
159
+ @(cd tests; $(MAKE) all ci-pytest)
160
+
161
+ endif
162
+
163
+ examples:
164
+ @(cd docs/examples; $(MAKE) check)
165
+
166
+ check-docs:
167
+ @(cd docs/libcurl; $(MAKE) check)
168
+
169
+ # Build source and binary rpms. For rpm-3.0 and above, the ~/.rpmmacros
170
+ # must contain the following line:
171
+ # %_topdir /home/loic/local/rpm
172
+ # and that /home/loic/local/rpm contains the directory SOURCES, BUILD etc.
173
+ #
174
+ # cd /home/loic/local/rpm ; mkdir -p SOURCES BUILD RPMS/i386 SPECS SRPMS
175
+ #
176
+ # If additional configure flags are needed to build the package, add the
177
+ # following in ~/.rpmmacros
178
+ # %configure CFLAGS="%{optflags}" ./configure %{_target_platform} --prefix=%{_prefix} ${AM_CONFIGFLAGS}
179
+ # and run make rpm in the following way:
180
+ # AM_CONFIGFLAGS='--with-uri=/home/users/loic/local/RedHat-6.2' make rpm
181
+ #
182
+
183
+ rpms:
184
+ $(MAKE) RPMDIST=curl rpm
185
+ $(MAKE) RPMDIST=curl-ssl rpm
186
+
187
+ rpm:
188
+ RPM_TOPDIR=`rpm --showrc | $(PERL) -n -e 'print if(s/.*_topdir\s+(.*)/$$1/)'` ; \
189
+ cp $(srcdir)/packages/Linux/RPM/$(RPMDIST).spec $$RPM_TOPDIR/SPECS ; \
190
+ cp $(PACKAGE)-$(VERSION).tar.gz $$RPM_TOPDIR/SOURCES ; \
191
+ rpm -ba --clean --rmsource $$RPM_TOPDIR/SPECS/$(RPMDIST).spec ; \
192
+ mv $$RPM_TOPDIR/RPMS/i386/$(RPMDIST)-*.rpm . ; \
193
+ mv $$RPM_TOPDIR/SRPMS/$(RPMDIST)-*.src.rpm .
194
+
195
+ #
196
+ # Build a Solaris pkgadd format file
197
+ # run 'make pkgadd' once you've done './configure' and 'make' to make a Solaris pkgadd format
198
+ # file (which ends up back in this directory).
199
+ # The pkgadd file is in 'pkgtrans' format, so to install on Solaris, do
200
+ # pkgadd -d ./HAXXcurl-*
201
+ #
202
+
203
+ # gak - libtool requires an absolute directory, hence the pwd below...
204
+ pkgadd:
205
+ umask 022 ; \
206
+ $(MAKE) install DESTDIR=`/bin/pwd`/packages/Solaris/root ; \
207
+ cat COPYING > $(srcdir)/packages/Solaris/copyright ; \
208
+ cd $(srcdir)/packages/Solaris && $(MAKE) package
209
+
210
+ #
211
+ # Build a Cygwin binary tarball installation file
212
+ # resulting .tar.bz2 file will end up at packages/Win32/cygwin
213
+ cygwinbin:
214
+ $(MAKE) -C packages/Win32/cygwin cygwinbin
215
+
216
+ # We extend the standard install with a custom hook:
217
+ if BUILD_DOCS
218
+ install-data-hook:
219
+ (cd include && $(MAKE) install)
220
+ (cd docs && $(MAKE) install)
221
+ (cd docs/libcurl && $(MAKE) install)
222
+ else
223
+ install-data-hook:
224
+ (cd include && $(MAKE) install)
225
+ (cd docs && $(MAKE) install)
226
+ endif
227
+
228
+ # We extend the standard uninstall with a custom hook:
229
+ uninstall-hook:
230
+ (cd include && $(MAKE) uninstall)
231
+ (cd docs && $(MAKE) uninstall)
232
+ (cd docs/libcurl && $(MAKE) uninstall)
233
+
234
+ ca-bundle: $(srcdir)/scripts/mk-ca-bundle.pl
235
+ @echo "generating a fresh ca-bundle.crt"
236
+ @perl $(srcdir)/scripts/mk-ca-bundle.pl -b -l -u lib/ca-bundle.crt
237
+
238
+ ca-firefox: $(srcdir)/scripts/firefox-db2pem.sh
239
+ @echo "generating a fresh ca-bundle.crt"
240
+ $(srcdir)/scripts/firefox-db2pem.sh lib/ca-bundle.crt
241
+
242
+ checksrc:
243
+ (cd lib && $(MAKE) checksrc)
244
+ (cd src && $(MAKE) checksrc)
245
+ (cd tests && $(MAKE) checksrc)
246
+ (cd include/curl && $(MAKE) checksrc)
247
+ (cd docs/examples && $(MAKE) checksrc)
248
+ (cd packages && $(MAKE) checksrc)
249
+
250
+ tidy:
251
+ (cd src && $(MAKE) tidy)
252
+ (cd lib && $(MAKE) tidy)
afc-curl/Makefile.dist ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #***************************************************************************
2
+ # _ _ ____ _
3
+ # Project ___| | | | _ \| |
4
+ # / __| | | | |_) | |
5
+ # | (__| |_| | _ <| |___
6
+ # \___|\___/|_| \_\_____|
7
+ #
8
+ # Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
9
+ #
10
+ # This software is licensed as described in the file COPYING, which
11
+ # you should have received as part of this distribution. The terms
12
+ # are also available at https://curl.se/docs/copyright.html.
13
+ #
14
+ # You may opt to use, copy, modify, merge, publish, distribute and/or sell
15
+ # copies of the Software, and permit persons to whom the Software is
16
+ # furnished to do so, under the terms of the COPYING file.
17
+ #
18
+ # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19
+ # KIND, either express or implied.
20
+ #
21
+ # SPDX-License-Identifier: curl
22
+ #
23
+ ###########################################################################
24
+
25
+ all:
26
+ ./configure
27
+ make
28
+
29
+ ssl:
30
+ ./configure --with-openssl
31
+ make
32
+
33
+ vc:
34
+ cd winbuild
35
+ nmake /f Makefile.vc MACHINE=x86
36
+
37
+ vc-x64:
38
+ cd winbuild
39
+ nmake /f Makefile.vc MACHINE=x64
40
+
41
+ djgpp%:
42
+ $(MAKE) -C lib -f Makefile.mk CFG=$@ CROSSPREFIX=i586-pc-msdosdjgpp-
43
+ $(MAKE) -C src -f Makefile.mk CFG=$@ CROSSPREFIX=i586-pc-msdosdjgpp-
44
+
45
+ cygwin:
46
+ ./configure
47
+ make
48
+
49
+ cygwin-ssl:
50
+ ./configure --with-openssl
51
+ make
52
+
53
+ amiga%:
54
+ $(MAKE) -C lib -f Makefile.mk CFG=$@ CROSSPREFIX=m68k-amigaos-
55
+ $(MAKE) -C src -f Makefile.mk CFG=$@ CROSSPREFIX=m68k-amigaos-
56
+
57
+ unix: all
58
+
59
+ unix-ssl: ssl
60
+
61
+ linux: all
62
+
63
+ linux-ssl: ssl
64
+
65
+ ca-bundle: scripts/mk-ca-bundle.pl
66
+ @echo "generate a fresh ca-bundle.crt"
67
+ @perl $< -b -l -u lib/ca-bundle.crt
68
+
69
+ ca-firefox: scripts/firefox-db2pem.sh
70
+ @echo "generate a fresh ca-bundle.crt"
71
+ ./scripts/firefox-db2pem.sh lib/ca-bundle.crt
afc-curl/README ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ _ _ ____ _
2
+ ___| | | | _ \| |
3
+ / __| | | | |_) | |
4
+ | (__| |_| | _ <| |___
5
+ \___|\___/|_| \_\_____|
6
+
7
+ README
8
+
9
+ Curl is a command line tool for transferring data specified with URL
10
+ syntax. Find out how to use curl by reading the curl.1 man page or the
11
+ MANUAL document. Find out how to install Curl by reading the INSTALL
12
+ document.
13
+
14
+ libcurl is the library curl is using to do its job. It is readily
15
+ available to be used by your software. Read the libcurl.3 man page to
16
+ learn how.
17
+
18
+ You find answers to the most frequent questions we get in the FAQ document.
19
+
20
+ Study the COPYING file for distribution terms.
21
+
22
+ Those documents and more can be found in the docs/ directory.
23
+
24
+ CONTACT
25
+
26
+ If you have problems, questions, ideas or suggestions, please contact us
27
+ by posting to a suitable mailing list. See https://curl.se/mail/
28
+
29
+ All contributors to the project are listed in the THANKS document.
30
+
31
+ WEBSITE
32
+
33
+ Visit the curl website for the latest news and downloads:
34
+
35
+ https://curl.se/
36
+
37
+ GIT
38
+
39
+ To download the latest source code off the GIT server, do this:
40
+
41
+ git clone https://github.com/curl/curl.git
42
+
43
+ (you will get a directory named curl created, filled with the source code)
44
+
45
+ SECURITY PROBLEMS
46
+
47
+ Report suspected security problems via our HackerOne page and not in public.
48
+
49
+ https://hackerone.com/curl
50
+
51
+ NOTICE
52
+
53
+ Curl contains pieces of source code that is Copyright (c) 1998, 1999
54
+ Kungliga Tekniska Högskolan. This notice is included here to comply with the
55
+ distribution terms.
afc-curl/README.md ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!--
2
+ Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
3
+
4
+ SPDX-License-Identifier: curl
5
+ -->
6
+
7
+ # [![curl logo](https://curl.se/logo/curl-logo.svg)](https://curl.se/)
8
+
9
+ Curl is a command-line tool for transferring data specified with URL syntax.
10
+ Learn how to use curl by reading [the
11
+ manpage](https://curl.se/docs/manpage.html) or [everything
12
+ curl](https://everything.curl.dev/).
13
+
14
+ Find out how to install curl by reading [the INSTALL
15
+ document](https://curl.se/docs/install.html).
16
+
17
+ libcurl is the library curl is using to do its job. It is readily available to
18
+ be used by your software. Read [the libcurl
19
+ manpage](https://curl.se/libcurl/c/libcurl.html) to learn how.
20
+
21
+ ## Open Source
22
+
23
+ curl is Open Source and is distributed under an MIT-like
24
+ [license](https://curl.se/docs/copyright.html).
25
+
26
+ ## Contact
27
+
28
+ Contact us on a suitable [mailing list](https://curl.se/mail/) or
29
+ use GitHub [issues](https://github.com/curl/curl/issues)/
30
+ [pull requests](https://github.com/curl/curl/pulls)/
31
+ [discussions](https://github.com/curl/curl/discussions).
32
+
33
+ All contributors to the project are listed in [the THANKS
34
+ document](https://curl.se/docs/thanks.html).
35
+
36
+ ## Commercial support
37
+
38
+ For commercial support, maybe private and dedicated help with your problems or
39
+ applications using (lib)curl visit [the support page](https://curl.se/support.html).
40
+
41
+ ## Website
42
+
43
+ Visit the [curl website](https://curl.se/) for the latest news and downloads.
44
+
45
+ ## Source code
46
+
47
+ Download the latest source from the Git server:
48
+
49
+ git clone https://github.com/curl/curl.git
50
+
51
+ ## Security problems
52
+
53
+ Report suspected security problems via [our HackerOne
54
+ page](https://hackerone.com/curl) and not in public.
55
+
56
+ ## Notice
57
+
58
+ Curl contains pieces of source code that is Copyright (c) 1998, 1999 Kungliga
59
+ Tekniska Högskolan. This notice is included here to comply with the
60
+ distribution terms.
61
+
62
+ ## Backers
63
+
64
+ Thank you to all our backers 🙏 [Become a backer](https://opencollective.com/curl#section-contribute).
65
+
66
+ ## Sponsors
67
+
68
+ Support this project by becoming a [sponsor](https://curl.se/sponsors.html).
afc-curl/RELEASE-NOTES ADDED
@@ -0,0 +1,197 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ curl and libcurl 8.11.1
2
+
3
+ Public curl releases: 263
4
+ Command line options: 266
5
+ curl_easy_setopt() options: 306
6
+ Public functions in libcurl: 94
7
+ Contributors: 3298
8
+
9
+ This release includes the following changes:
10
+
11
+
12
+ This release includes the following bugfixes:
13
+
14
+ o build: fix ECH to always enable HTTPS RR [35]
15
+ o build: fix MSVC UWP builds [32]
16
+ o build: omit certain deps from `libcurl.pc` unless found via `pkg-config` [27]
17
+ o build: use `_fseeki64()` on Windows, drop detections [41]
18
+ o cmake: do not echo most inherited `LDFLAGS` to config files [55]
19
+ o cmake: drop cmake args list from `buildinfo.txt` [8]
20
+ o cmake: include `wolfssl/options.h` first [53]
21
+ o cmake: remove legacy unused IMMEDIATE keyword [21]
22
+ o cmake: restore cmake args list in `buildinfo.txt` [26]
23
+ o cmake: set `CURL_STATICLIB` for static lib when `SHARE_LIB_OBJECT=OFF` [64]
24
+ o cmake: sync GSS config code with other deps [28]
25
+ o cmake: typo in comment
26
+ o cmake: work around `ios.toolchain.cmake` breaking feature-detections [37]
27
+ o cmakelint: fix to check root `CMakeLists.txt` [36]
28
+ o cmdline/ech.md: formatting cleanups [13]
29
+ o configure: add FIXMEs for disabled pkg-config references
30
+ o configure: do not echo most inherited `LDFLAGS` to config files [31]
31
+ o configure: replace `$#` shell syntax [25]
32
+ o cookie: treat cookie name case sensitively [4]
33
+ o curl-rustls.m4: keep existing `CPPFLAGS`/`LDFLAGS` when detected [40]
34
+ o curl.h: mark two error codes as obsolete [19]
35
+ o curl: --continue-at is mutually exclusive with --no-clobber [51]
36
+ o curl: --continue-at is mutually exclusive with --range [61]
37
+ o curl: --continue-at is mutually exclusive with --remove-on-error [50]
38
+ o curl: --test-duphandle in debug builds runs "duphandled" [6]
39
+ o curl: do more command line parsing in sub functions [71]
40
+ o curl: rename struct var to fix AIX build [24]
41
+ o curl: use realtime in trace timestamps [52]
42
+ o curl_multi_socket_all.md: soften the deprecation warning [56]
43
+ o CURLOPT_PREREQFUNCTION.md: add result code on failure [23]
44
+ o digest: produce a shorter cnonce in Digest headers [70]
45
+ o DISTROS: update Alt Linux links
46
+ o dmaketgz: use --no-cache when building docker image [66]
47
+ o docs: document default `User-Agent` [57]
48
+ o docs: suggest --ssl-reqd instead of --ftp-ssl [62]
49
+ o duphandle: also init netrc [3]
50
+ o ECH: enable support for the AWS-LC backend [5]
51
+ o hostip: don't use the resolver for FQDN localhost [45]
52
+ o http_negotiate: allow for a one byte larger channel binding buffer [63]
53
+ o http_proxy: move dynhds_add_custom here from http.c [18]
54
+ o KNOWN_BUGS: setting a disabled option should return CURLE_NOT_BUILT_IN [74]
55
+ o krb5: fix socket/sockindex confusion, MSVC compiler warnings [22]
56
+ o lib: fixes for wolfSSL OPENSSL_COEXIST [73]
57
+ o libssh: use libssh sftp_aio to upload file [47]
58
+ o libssh: when using IPv6 numerical address, add brackets [43]
59
+ o macos: disable gcc `availability` workaround as needed [7]
60
+ o mbedtls: call psa_crypt_init() in global init [2]
61
+ o mime: fix reader stall on small read lengths [65]
62
+ o mk-ca-bundle: remove CKA_NSS_SERVER_DISTRUST_AFTER conditions [39]
63
+ o multi: add clarifying comment for wakeup_write() [9]
64
+ o multi: fix callback for `CURLMOPT_TIMERFUNCTION` not being called again when... [48]
65
+ o netrc: address several netrc parser flaws [17]
66
+ o netrc: support large file, longer lines, longer tokens [14]
67
+ o nghttp2: use custom memory functions [1]
68
+ o OpenSSL: improvde error message on expired certificate [59]
69
+ o openssl: remove three "Useless Assignments" [72]
70
+ o openssl: stop using SSL_CTX_ function prefix for our functions [20]
71
+ o os400: Fix IBMi builds [33]
72
+ o os400: Fix IBMi EBCDIC conversion of arguments [34]
73
+ o pytest: add test for use of CURLMOPT_MAX_HOST_CONNECTIONS [60]
74
+ o rtsp: check EOS in the RTSP receive and return an error code [49]
75
+ o schannel: remove TLS 1.3 ciphersuite-list support [54]
76
+ o setopt: fix CURLOPT_HTTP_CONTENT_DECODING [15]
77
+ o setopt: fix missing options for builds without HTTP & MQTT [10]
78
+ o show-headers.md: clarify the headers are saved with the data [58]
79
+ o socket: handle binding to "host!<ip>" [16]
80
+ o socketpair: fix enabling `USE_EVENTFD` [30]
81
+ o strtok: use namespaced `strtok_r` macro instead of redefining it [29]
82
+ o tests: add the ending time stamp in testcurl.pl
83
+ o tests: re-enable 2086, and 472, 1299, 1613 for Windows [38]
84
+ o TODO: consider OCSP stapling by default [11]
85
+ o tool_formparse: remove use of sscanf() [68]
86
+ o tool_getparam: parse --localport without using sscanf [67]
87
+ o tool_getpass: fix UWP `-Wnull-dereference` [46]
88
+ o tool_getpass: replace `getch()` call with `_getch()` on Windows [42]
89
+ o tool_urlglob: parse character globbing range without sscanf [69]
90
+ o vtls: fix compile warning when ALPN is not available [12]
91
+
92
+ This release includes the following known bugs:
93
+
94
+ See docs/KNOWN_BUGS (https://curl.se/docs/knownbugs.html)
95
+
96
+ For all changes ever done in curl:
97
+
98
+ See https://curl.se/changes.html
99
+
100
+ Planned upcoming removals include:
101
+
102
+ o TLS libraries not supporting TLS 1.3
103
+
104
+ See https://curl.se/dev/deprecate.html for details
105
+
106
+ This release would not have looked like this without help, code, reports and
107
+ advice from friends like these:
108
+
109
+ Alexis Savin, Andrew Ayer, Andrew Kirillov, Andy Fiddaman, Ben Greear,
110
+ Bo Anderson, Brendon Smith, chemodax, Dan Fandrich, Daniel Engberg,
111
+ Daniel Pouzzner, Daniel Stenberg, Dan Rosser, delogicsreal on github,
112
+ dengjfzh on github, Ethan Everett, Florian Eckert, galen11 on github,
113
+ Harmen Stoppels, Harry Sintonen, henrikjehgmti on github, hiimmat on github,
114
+ Jacob Champion, Jeroen Ooms, Jesus Malo Poyatos, jethrogb on github,
115
+ Kai Pastor, Logan Buth, Maarten Billemont, marcos-ng on github, Moritz,
116
+ newfunction on hackerone, Nicolas F., Peter Kokot, Peter Marko, Ray Satiro,
117
+ renovate[bot], Samuel Henrique, Stefan Eissing, SuperStormer on github,
118
+ Tal Regev, Thomas, tinyboxvk, tkzv on github, tranzystorekk on github,
119
+ Viktor Szakats, Vladislavs Sokurenko, wxiaoguang on github, Wyatt O'Day,
120
+ xiaofeng, Yoshimasa Ohno
121
+ (51 contributors)
122
+
123
+ References to bug reports and discussions on issues:
124
+
125
+ [1] = https://curl.se/bug/?i=15527
126
+ [2] = https://curl.se/bug/?i=15500
127
+ [3] = https://curl.se/bug/?i=15496
128
+ [4] = https://curl.se/bug/?i=15492
129
+ [5] = https://curl.se/bug/?i=15499
130
+ [6] = https://curl.se/bug/?i=15504
131
+ [7] = https://curl.se/bug/?i=15508
132
+ [8] = https://curl.se/bug/?i=15501
133
+ [9] = https://curl.se/bug/?i=15600
134
+ [10] = https://curl.se/bug/?i=15634
135
+ [11] = https://curl.se/bug/?i=15483
136
+ [12] = https://curl.se/bug/?i=15515
137
+ [13] = https://curl.se/bug/?i=15506
138
+ [14] = https://curl.se/bug/?i=15513
139
+ [15] = https://curl.se/bug/?i=15511
140
+ [16] = https://curl.se/bug/?i=15553
141
+ [17] = https://curl.se/bug/?i=15586
142
+ [18] = https://curl.se/bug/?i=15672
143
+ [19] = https://curl.se/bug/?i=15538
144
+ [20] = https://curl.se/bug/?i=15673
145
+ [21] = https://curl.se/bug/?i=15661
146
+ [22] = https://curl.se/bug/?i=15585
147
+ [23] = https://curl.se/bug/?i=15542
148
+ [24] = https://curl.se/bug/?i=15580
149
+ [25] = https://curl.se/bug/?i=15584
150
+ [26] = https://curl.se/bug/?i=15563
151
+ [27] = https://curl.se/bug/?i=15469
152
+ [28] = https://curl.se/bug/?i=15545
153
+ [29] = https://curl.se/bug/?i=15549
154
+ [30] = https://curl.se/bug/?i=15561
155
+ [31] = https://curl.se/bug/?i=15533
156
+ [32] = https://curl.se/bug/?i=15657
157
+ [33] = https://curl.se/bug/?i=15566
158
+ [34] = https://curl.se/bug/?i=15570
159
+ [35] = https://curl.se/bug/?i=15648
160
+ [36] = https://curl.se/bug/?i=15565
161
+ [37] = https://curl.se/bug/?i=15557
162
+ [38] = https://curl.se/bug/?i=15644
163
+ [39] = https://curl.se/bug/?i=15547
164
+ [40] = https://curl.se/bug/?i=15546
165
+ [41] = https://curl.se/bug/?i=15525
166
+ [42] = https://curl.se/bug/?i=15642
167
+ [43] = https://curl.se/bug/?i=15522
168
+ [45] = https://curl.se/bug/?i=15676
169
+ [46] = https://curl.se/bug/?i=15638
170
+ [47] = https://curl.se/bug/?i=15625
171
+ [48] = https://curl.se/bug/?i=15627
172
+ [49] = https://curl.se/bug/?i=15624
173
+ [50] = https://curl.se/bug/?i=15645
174
+ [51] = https://curl.se/bug/?i=15645
175
+ [52] = https://curl.se/bug/?i=15614
176
+ [53] = https://curl.se/bug/?i=15620
177
+ [54] = https://hackerone.com/reports/2792484
178
+ [55] = https://curl.se/bug/?i=15617
179
+ [56] = https://curl.se/mail/lib-2024-11/0029.html
180
+ [57] = https://curl.se/bug/?i=15608
181
+ [58] = https://curl.se/bug/?i=15605
182
+ [59] = https://curl.se/bug/?i=15612
183
+ [60] = https://curl.se/bug/?i=15494
184
+ [61] = https://curl.se/bug/?i=15646
185
+ [62] = https://curl.se/bug/?i=15658
186
+ [63] = https://curl.se/bug/?i=15685
187
+ [64] = https://curl.se/bug/?i=15695
188
+ [65] = https://curl.se/bug/?i=15688
189
+ [66] = https://curl.se/bug/?i=15689
190
+ [67] = https://curl.se/bug/?i=15681
191
+ [68] = https://curl.se/bug/?i=15683
192
+ [69] = https://curl.se/bug/?i=15682
193
+ [70] = https://curl.se/bug/?i=15653
194
+ [71] = https://curl.se/bug/?i=15680
195
+ [72] = https://curl.se/bug/?i=15679
196
+ [73] = https://curl.se/bug/?i=15650
197
+ [74] = https://curl.se/bug/?i=15472
afc-curl/REUSE.toml ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # SPDX-License-Identifier: curl
2
+ # SPDX-FileCopyrightText: Daniel Stenberg, <daniel@haxx.se>, et al.
3
+
4
+ # This file describes the licensing and copyright situation for files that
5
+ # cannot be annotated directly, for example because of being simply
6
+ # uncommentable. Unless this is the case, a file should be annotated directly.
7
+ #
8
+ # This follows the REUSE specification: https://reuse.software/spec-3.2/#reusetoml
9
+
10
+ version = 1
11
+ SPDX-PackageName = "curl"
12
+ SPDX-PackageDownloadLocation = "https://curl.se/"
13
+
14
+ [[annotations]]
15
+ path = [
16
+ ".mailmap",
17
+ "docs/FAQ",
18
+ "docs/INSTALL",
19
+ "docs/KNOWN_BUGS",
20
+ "docs/libcurl/symbols-in-versions",
21
+ "docs/MAIL-ETIQUETTE",
22
+ "docs/options-in-versions",
23
+ "docs/THANKS",
24
+ "docs/TODO",
25
+ "GIT-INFO.md",
26
+ "lib/libcurl.vers.in",
27
+ "lib/libcurl.def",
28
+ "packages/OS400/README.OS400",
29
+ "packages/vms/build_vms.com",
30
+ "packages/vms/curl_release_note_start.txt",
31
+ "packages/vms/curlmsg.sdl",
32
+ "packages/vms/macro32_exactcase.patch",
33
+ "packages/vms/readme",
34
+ "plan9/README",
35
+ "projects/Windows/**", "projects/wolfssl_override.props",
36
+ "README",
37
+ "RELEASE-NOTES",
38
+ "renovate.json",
39
+ "tests/certs/**",
40
+ "tests/data/test**",
41
+ "tests/stunnel.pem",
42
+ "tests/valgrind.supp",
43
+ # checksrc control files
44
+ "docs/examples/.checksrc",
45
+ "lib/.checksrc",
46
+ "lib/vauth/.checksrc",
47
+ "lib/vquic/.checksrc",
48
+ "lib/vssh/.checksrc",
49
+ "lib/vtls/.checksrc",
50
+ "src/.checksrc",
51
+ "tests/libtest/.checksrc",
52
+ "tests/server/.checksrc",
53
+ ]
54
+ SPDX-FileCopyrightText = "Daniel Stenberg, <daniel@haxx.se>, et al."
55
+ SPDX-License-Identifier = "curl"
56
+ # If there is licensing/copyright information in or next to these files, prefer that
57
+ precedence = "closest"
afc-curl/SECURITY.md ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!--
2
+ Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
3
+
4
+ SPDX-License-Identifier: curl
5
+ -->
6
+
7
+ # Security Policy
8
+
9
+ Read our [Vulnerability Disclosure Policy](docs/VULN-DISCLOSURE-POLICY.md).
10
+
11
+ ## Reporting a Vulnerability
12
+
13
+ If you have found or just suspect a security problem somewhere in curl or
14
+ libcurl, report it on [HackerOne](https://hackerone.com/curl).
15
+
16
+ We treat security issues with confidentiality until controlled and disclosed responsibly.
17
+
18
+ ## OpenSSF Best Practices
19
+
20
+ curl has achieved Gold status on the Open Source Security Foundation (OpenSSF)
21
+ [Best Practices](https://bestpractices.dev/) (formerly Core Infrastructure
22
+ Initiative Best Practices), reflecting its adherence to rigorous
23
+ security and best practice standards. This achievement highlights curl's
24
+ comprehensive documentation, secure development processes, effective change
25
+ control mechanisms, and strong maintenance routines. Meeting these criteria
26
+ demonstrates curl's commitment to security and reliability, ensuring the
27
+ project's sustainability and trustworthiness. This underscores curl's role as
28
+ a leader in open-source software practices. More information can be found on
29
+ [curl's OpenSSF Best Practices project page](https://www.bestpractices.dev/projects/63).
afc-curl/acinclude.m4 ADDED
@@ -0,0 +1,1697 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #***************************************************************************
2
+ # _ _ ____ _
3
+ # Project ___| | | | _ \| |
4
+ # / __| | | | |_) | |
5
+ # | (__| |_| | _ <| |___
6
+ # \___|\___/|_| \_\_____|
7
+ #
8
+ # Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
9
+ #
10
+ # This software is licensed as described in the file COPYING, which
11
+ # you should have received as part of this distribution. The terms
12
+ # are also available at https://curl.se/docs/copyright.html.
13
+ #
14
+ # You may opt to use, copy, modify, merge, publish, distribute and/or sell
15
+ # copies of the Software, and permit persons to whom the Software is
16
+ # furnished to do so, under the terms of the COPYING file.
17
+ #
18
+ # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19
+ # KIND, either express or implied.
20
+ #
21
+ # SPDX-License-Identifier: curl
22
+ #
23
+ #***************************************************************************
24
+
25
+ dnl CURL_CHECK_DEF (SYMBOL, [INCLUDES], [SILENT])
26
+ dnl -------------------------------------------------
27
+ dnl Use the C preprocessor to find out if the given object-style symbol
28
+ dnl is defined and get its expansion. This macro will not use default
29
+ dnl includes even if no INCLUDES argument is given. This macro will run
30
+ dnl silently when invoked with three arguments. If the expansion would
31
+ dnl result in a set of double-quoted strings the returned expansion will
32
+ dnl actually be a single double-quoted string concatenating all them.
33
+
34
+ AC_DEFUN([CURL_CHECK_DEF], [
35
+ AC_REQUIRE([CURL_CPP_P])dnl
36
+ OLDCPPFLAGS=$CPPFLAGS
37
+ # CPPPFLAG comes from CURL_CPP_P
38
+ CPPFLAGS="$CPPFLAGS $CPPPFLAG"
39
+ AS_VAR_PUSHDEF([ac_HaveDef], [curl_cv_have_def_$1])dnl
40
+ AS_VAR_PUSHDEF([ac_Def], [curl_cv_def_$1])dnl
41
+ if test -z "$SED"; then
42
+ AC_MSG_ERROR([SED not set. Cannot continue without SED being set.])
43
+ fi
44
+ if test -z "$GREP"; then
45
+ AC_MSG_ERROR([GREP not set. Cannot continue without GREP being set.])
46
+ fi
47
+ ifelse($3,,[AC_MSG_CHECKING([for preprocessor definition of $1])])
48
+ tmp_exp=""
49
+ AC_PREPROC_IFELSE([
50
+ AC_LANG_SOURCE(
51
+ ifelse($2,,,[$2])[[
52
+ #ifdef $1
53
+ CURL_DEF_TOKEN $1
54
+ #endif
55
+ ]])
56
+ ],[
57
+ tmp_exp=`eval "$ac_cpp conftest.$ac_ext" 2>/dev/null | \
58
+ "$GREP" CURL_DEF_TOKEN 2>/dev/null | \
59
+ "$SED" 's/.*CURL_DEF_TOKEN[[ ]][[ ]]*//' 2>/dev/null | \
60
+ "$SED" 's/[["]][[ ]]*[["]]//g' 2>/dev/null`
61
+ if test -z "$tmp_exp" || test "$tmp_exp" = "$1"; then
62
+ tmp_exp=""
63
+ fi
64
+ ])
65
+ if test -z "$tmp_exp"; then
66
+ AS_VAR_SET(ac_HaveDef, no)
67
+ ifelse($3,,[AC_MSG_RESULT([no])])
68
+ else
69
+ AS_VAR_SET(ac_HaveDef, yes)
70
+ AS_VAR_SET(ac_Def, $tmp_exp)
71
+ ifelse($3,,[AC_MSG_RESULT([$tmp_exp])])
72
+ fi
73
+ AS_VAR_POPDEF([ac_Def])dnl
74
+ AS_VAR_POPDEF([ac_HaveDef])dnl
75
+ CPPFLAGS=$OLDCPPFLAGS
76
+ ])
77
+
78
+
79
+ dnl CURL_CHECK_DEF_CC (SYMBOL, [INCLUDES], [SILENT])
80
+ dnl -------------------------------------------------
81
+ dnl Use the C compiler to find out only if the given symbol is defined
82
+ dnl or not, this can not find out its expansion. This macro will not use
83
+ dnl default includes even if no INCLUDES argument is given. This macro
84
+ dnl will run silently when invoked with three arguments.
85
+
86
+ AC_DEFUN([CURL_CHECK_DEF_CC], [
87
+ AS_VAR_PUSHDEF([ac_HaveDef], [curl_cv_have_def_$1])dnl
88
+ ifelse($3,,[AC_MSG_CHECKING([for compiler definition of $1])])
89
+ AC_COMPILE_IFELSE([
90
+ AC_LANG_SOURCE(
91
+ ifelse($2,,,[$2])[[
92
+ int main(void)
93
+ {
94
+ #ifdef $1
95
+ return 0;
96
+ #else
97
+ #error force compilation error
98
+ #endif
99
+ }
100
+ ]])
101
+ ],[
102
+ tst_symbol_defined="yes"
103
+ ],[
104
+ tst_symbol_defined="no"
105
+ ])
106
+ if test "$tst_symbol_defined" = "yes"; then
107
+ AS_VAR_SET(ac_HaveDef, yes)
108
+ ifelse($3,,[AC_MSG_RESULT([yes])])
109
+ else
110
+ AS_VAR_SET(ac_HaveDef, no)
111
+ ifelse($3,,[AC_MSG_RESULT([no])])
112
+ fi
113
+ AS_VAR_POPDEF([ac_HaveDef])dnl
114
+ ])
115
+
116
+
117
+ dnl CURL_CHECK_LIB_XNET
118
+ dnl -------------------------------------------------
119
+ dnl Verify if X/Open network library is required.
120
+
121
+ AC_DEFUN([CURL_CHECK_LIB_XNET], [
122
+ AC_MSG_CHECKING([if X/Open network library is required])
123
+ tst_lib_xnet_required="no"
124
+ AC_COMPILE_IFELSE([
125
+ AC_LANG_SOURCE([[
126
+ int main(void)
127
+ {
128
+ #if defined(__hpux) && defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE >= 600)
129
+ return 0;
130
+ #elif defined(__hpux) && defined(_XOPEN_SOURCE_EXTENDED)
131
+ return 0;
132
+ #else
133
+ #error force compilation error
134
+ #endif
135
+ }
136
+ ]])
137
+ ],[
138
+ tst_lib_xnet_required="yes"
139
+ LIBS="-lxnet $LIBS"
140
+ ])
141
+ AC_MSG_RESULT([$tst_lib_xnet_required])
142
+ ])
143
+
144
+
145
+ dnl CURL_CHECK_AIX_ALL_SOURCE
146
+ dnl -------------------------------------------------
147
+ dnl Provides a replacement of traditional AC_AIX with
148
+ dnl an uniform behavior across all autoconf versions,
149
+ dnl and with our own placement rules.
150
+
151
+ AC_DEFUN([CURL_CHECK_AIX_ALL_SOURCE], [
152
+ AH_VERBATIM([_ALL_SOURCE],
153
+ [/* Define to 1 if OS is AIX. */
154
+ #ifndef _ALL_SOURCE
155
+ # undef _ALL_SOURCE
156
+ #endif])
157
+ AC_BEFORE([$0], [AC_SYS_LARGEFILE])dnl
158
+ AC_BEFORE([$0], [CURL_CONFIGURE_REENTRANT])dnl
159
+ AC_MSG_CHECKING([if OS is AIX (to define _ALL_SOURCE)])
160
+ AC_EGREP_CPP([yes_this_is_aix],[
161
+ #ifdef _AIX
162
+ yes_this_is_aix
163
+ #endif
164
+ ],[
165
+ AC_MSG_RESULT([yes])
166
+ AC_DEFINE(_ALL_SOURCE)
167
+ ],[
168
+ AC_MSG_RESULT([no])
169
+ ])
170
+ ])
171
+
172
+
173
+ dnl CURL_CHECK_NATIVE_WINDOWS
174
+ dnl -------------------------------------------------
175
+ dnl Check if building a native Windows target
176
+
177
+ AC_DEFUN([CURL_CHECK_NATIVE_WINDOWS], [
178
+ AC_CACHE_CHECK([whether build target is a native Windows one], [curl_cv_native_windows], [
179
+ AC_COMPILE_IFELSE([
180
+ AC_LANG_PROGRAM([[
181
+ ]],[[
182
+ #ifdef _WIN32
183
+ int dummy=1;
184
+ #else
185
+ #error Not a native Windows build target.
186
+ #endif
187
+ ]])
188
+ ],[
189
+ curl_cv_native_windows="yes"
190
+ ],[
191
+ curl_cv_native_windows="no"
192
+ ])
193
+ ])
194
+ AM_CONDITIONAL(DOING_NATIVE_WINDOWS, test "x$curl_cv_native_windows" = xyes)
195
+ ])
196
+
197
+
198
+ dnl CURL_CHECK_HEADER_LBER
199
+ dnl -------------------------------------------------
200
+ dnl Check for compilable and valid lber.h header,
201
+ dnl and check if it is needed even with ldap.h
202
+
203
+ AC_DEFUN([CURL_CHECK_HEADER_LBER], [
204
+ AC_REQUIRE([CURL_CHECK_NATIVE_WINDOWS])dnl
205
+ AC_CACHE_CHECK([for lber.h], [curl_cv_header_lber_h], [
206
+ AC_COMPILE_IFELSE([
207
+ AC_LANG_PROGRAM([[
208
+ #undef inline
209
+ #ifdef _WIN32
210
+ #ifndef WIN32_LEAN_AND_MEAN
211
+ #define WIN32_LEAN_AND_MEAN
212
+ #endif
213
+ #include <windows.h>
214
+ #else
215
+ #ifdef HAVE_SYS_TYPES_H
216
+ #include <sys/types.h>
217
+ #endif
218
+ #endif
219
+ #ifndef NULL
220
+ #define NULL (void *)0
221
+ #endif
222
+ #include <lber.h>
223
+ ]],[[
224
+ BerValue *bvp = NULL;
225
+ BerElement *bep = ber_init(bvp);
226
+ ber_free(bep, 1);
227
+ ]])
228
+ ],[
229
+ curl_cv_header_lber_h="yes"
230
+ ],[
231
+ curl_cv_header_lber_h="no"
232
+ ])
233
+ ])
234
+ if test "$curl_cv_header_lber_h" = "yes"; then
235
+ AC_DEFINE_UNQUOTED(HAVE_LBER_H, 1,
236
+ [Define to 1 if you have the lber.h header file.])
237
+ #
238
+ AC_COMPILE_IFELSE([
239
+ AC_LANG_PROGRAM([[
240
+ #undef inline
241
+ #ifdef _WIN32
242
+ #ifndef WIN32_LEAN_AND_MEAN
243
+ #define WIN32_LEAN_AND_MEAN
244
+ #endif
245
+ #include <windows.h>
246
+ #else
247
+ #ifdef HAVE_SYS_TYPES_H
248
+ #include <sys/types.h>
249
+ #endif
250
+ #endif
251
+ #ifndef NULL
252
+ #define NULL (void *)0
253
+ #endif
254
+ #ifndef LDAP_DEPRECATED
255
+ #define LDAP_DEPRECATED 1
256
+ #endif
257
+ #include <ldap.h>
258
+ ]],[[
259
+ BerValue *bvp = NULL;
260
+ BerElement *bep = ber_init(bvp);
261
+ ber_free(bep, 1);
262
+ ]])
263
+ ],[
264
+ curl_cv_need_header_lber_h="no"
265
+ ],[
266
+ curl_cv_need_header_lber_h="yes"
267
+ ])
268
+ #
269
+ case "$curl_cv_need_header_lber_h" in
270
+ yes)
271
+ AC_DEFINE_UNQUOTED(NEED_LBER_H, 1,
272
+ [Define to 1 if you need the lber.h header file even with ldap.h])
273
+ ;;
274
+ esac
275
+ fi
276
+ ])
277
+
278
+
279
+ dnl CURL_CHECK_HEADER_LDAP
280
+ dnl -------------------------------------------------
281
+ dnl Check for compilable and valid ldap.h header
282
+
283
+ AC_DEFUN([CURL_CHECK_HEADER_LDAP], [
284
+ AC_REQUIRE([CURL_CHECK_HEADER_LBER])dnl
285
+ AC_CACHE_CHECK([for ldap.h], [curl_cv_header_ldap_h], [
286
+ AC_COMPILE_IFELSE([
287
+ AC_LANG_PROGRAM([[
288
+ #undef inline
289
+ #ifdef _WIN32
290
+ #ifndef WIN32_LEAN_AND_MEAN
291
+ #define WIN32_LEAN_AND_MEAN
292
+ #endif
293
+ #include <windows.h>
294
+ #else
295
+ #ifdef HAVE_SYS_TYPES_H
296
+ #include <sys/types.h>
297
+ #endif
298
+ #endif
299
+ #ifndef LDAP_DEPRECATED
300
+ #define LDAP_DEPRECATED 1
301
+ #endif
302
+ #ifdef NEED_LBER_H
303
+ #include <lber.h>
304
+ #endif
305
+ #include <ldap.h>
306
+ ]],[[
307
+ LDAP *ldp = ldap_init("0.0.0.0", LDAP_PORT);
308
+ int res = ldap_unbind(ldp);
309
+ ]])
310
+ ],[
311
+ curl_cv_header_ldap_h="yes"
312
+ ],[
313
+ curl_cv_header_ldap_h="no"
314
+ ])
315
+ ])
316
+ case "$curl_cv_header_ldap_h" in
317
+ yes)
318
+ AC_DEFINE_UNQUOTED(HAVE_LDAP_H, 1,
319
+ [Define to 1 if you have the ldap.h header file.])
320
+ ;;
321
+ esac
322
+ ])
323
+
324
+
325
+ dnl CURL_CHECK_HEADER_LDAP_SSL
326
+ dnl -------------------------------------------------
327
+ dnl Check for compilable and valid ldap_ssl.h header
328
+
329
+ AC_DEFUN([CURL_CHECK_HEADER_LDAP_SSL], [
330
+ AC_REQUIRE([CURL_CHECK_HEADER_LDAP])dnl
331
+ AC_CACHE_CHECK([for ldap_ssl.h], [curl_cv_header_ldap_ssl_h], [
332
+ AC_COMPILE_IFELSE([
333
+ AC_LANG_PROGRAM([[
334
+ #undef inline
335
+ #ifdef _WIN32
336
+ #ifndef WIN32_LEAN_AND_MEAN
337
+ #define WIN32_LEAN_AND_MEAN
338
+ #endif
339
+ #include <windows.h>
340
+ #else
341
+ #ifdef HAVE_SYS_TYPES_H
342
+ #include <sys/types.h>
343
+ #endif
344
+ #endif
345
+ #ifndef LDAP_DEPRECATED
346
+ #define LDAP_DEPRECATED 1
347
+ #endif
348
+ #ifdef NEED_LBER_H
349
+ #include <lber.h>
350
+ #endif
351
+ #ifdef HAVE_LDAP_H
352
+ #include <ldap.h>
353
+ #endif
354
+ #include <ldap_ssl.h>
355
+ ]],[[
356
+ LDAP *ldp = ldapssl_init("0.0.0.0", LDAPS_PORT, 1);
357
+ ]])
358
+ ],[
359
+ curl_cv_header_ldap_ssl_h="yes"
360
+ ],[
361
+ curl_cv_header_ldap_ssl_h="no"
362
+ ])
363
+ ])
364
+ case "$curl_cv_header_ldap_ssl_h" in
365
+ yes)
366
+ AC_DEFINE_UNQUOTED(HAVE_LDAP_SSL_H, 1,
367
+ [Define to 1 if you have the ldap_ssl.h header file.])
368
+ ;;
369
+ esac
370
+ ])
371
+
372
+
373
+ dnl CURL_CHECK_LIBS_WINLDAP
374
+ dnl -------------------------------------------------
375
+ dnl Check for libraries needed for WINLDAP support,
376
+ dnl and prepended to LIBS any needed libraries.
377
+ dnl This macro can take an optional parameter with a
378
+ dnl whitespace separated list of libraries to check
379
+ dnl before the WINLDAP default ones.
380
+
381
+ AC_DEFUN([CURL_CHECK_LIBS_WINLDAP], [
382
+ AC_REQUIRE([CURL_CHECK_HEADER_WINBER])dnl
383
+ #
384
+ AC_MSG_CHECKING([for WINLDAP libraries])
385
+ #
386
+ u_libs=""
387
+ #
388
+ ifelse($1,,,[
389
+ for x_lib in $1; do
390
+ case "$x_lib" in
391
+ -l*)
392
+ l_lib="$x_lib"
393
+ ;;
394
+ *)
395
+ l_lib="-l$x_lib"
396
+ ;;
397
+ esac
398
+ if test -z "$u_libs"; then
399
+ u_libs="$l_lib"
400
+ else
401
+ u_libs="$u_libs $l_lib"
402
+ fi
403
+ done
404
+ ])
405
+ #
406
+ curl_cv_save_LIBS="$LIBS"
407
+ curl_cv_ldap_LIBS="unknown"
408
+ #
409
+ for x_nlibs in '' "$u_libs" \
410
+ '-lwldap32' ; do
411
+ if test "$curl_cv_ldap_LIBS" = "unknown"; then
412
+ if test -z "$x_nlibs"; then
413
+ LIBS="$curl_cv_save_LIBS"
414
+ else
415
+ LIBS="$x_nlibs $curl_cv_save_LIBS"
416
+ fi
417
+ AC_LINK_IFELSE([
418
+ AC_LANG_PROGRAM([[
419
+ #undef inline
420
+ #ifdef _WIN32
421
+ #ifndef WIN32_LEAN_AND_MEAN
422
+ #define WIN32_LEAN_AND_MEAN
423
+ #endif
424
+ #include <windows.h>
425
+ #include <winldap.h>
426
+ #ifdef HAVE_WINBER_H
427
+ #include <winber.h>
428
+ #endif
429
+ #endif
430
+ ]],[[
431
+ BERVAL *bvp = NULL;
432
+ BerElement *bep = ber_init(bvp);
433
+ LDAP *ldp = ldap_init("0.0.0.0", LDAP_PORT);
434
+ ULONG res = ldap_unbind(ldp);
435
+ ber_free(bep, 1);
436
+ ]])
437
+ ],[
438
+ curl_cv_ldap_LIBS="$x_nlibs"
439
+ ])
440
+ fi
441
+ done
442
+ #
443
+ LIBS="$curl_cv_save_LIBS"
444
+ #
445
+ case X-"$curl_cv_ldap_LIBS" in
446
+ X-unknown)
447
+ AC_MSG_RESULT([cannot find WINLDAP libraries])
448
+ ;;
449
+ X-)
450
+ AC_MSG_RESULT([no additional lib required])
451
+ ;;
452
+ *)
453
+ if test -z "$curl_cv_save_LIBS"; then
454
+ LIBS="$curl_cv_ldap_LIBS"
455
+ else
456
+ LIBS="$curl_cv_ldap_LIBS $curl_cv_save_LIBS"
457
+ fi
458
+ AC_MSG_RESULT([$curl_cv_ldap_LIBS])
459
+ ;;
460
+ esac
461
+ #
462
+ ])
463
+
464
+
465
+ dnl CURL_CHECK_LIBS_LDAP
466
+ dnl -------------------------------------------------
467
+ dnl Check for libraries needed for LDAP support,
468
+ dnl and prepended to LIBS any needed libraries.
469
+ dnl This macro can take an optional parameter with a
470
+ dnl whitespace separated list of libraries to check
471
+ dnl before the default ones.
472
+
473
+ AC_DEFUN([CURL_CHECK_LIBS_LDAP], [
474
+ AC_REQUIRE([CURL_CHECK_HEADER_LDAP])dnl
475
+ #
476
+ AC_MSG_CHECKING([for LDAP libraries])
477
+ #
478
+ u_libs=""
479
+ #
480
+ ifelse($1,,,[
481
+ for x_lib in $1; do
482
+ case "$x_lib" in
483
+ -l*)
484
+ l_lib="$x_lib"
485
+ ;;
486
+ *)
487
+ l_lib="-l$x_lib"
488
+ ;;
489
+ esac
490
+ if test -z "$u_libs"; then
491
+ u_libs="$l_lib"
492
+ else
493
+ u_libs="$u_libs $l_lib"
494
+ fi
495
+ done
496
+ ])
497
+ #
498
+ curl_cv_save_LIBS="$LIBS"
499
+ curl_cv_ldap_LIBS="unknown"
500
+ #
501
+ for x_nlibs in '' "$u_libs" \
502
+ '-lldap' \
503
+ '-lldap -llber' \
504
+ '-llber -lldap' \
505
+ '-lldapssl -lldapx -lldapsdk' \
506
+ '-lldapsdk -lldapx -lldapssl' \
507
+ '-lldap -llber -lssl -lcrypto'; do
508
+
509
+ if test "$curl_cv_ldap_LIBS" = "unknown"; then
510
+ if test -z "$x_nlibs"; then
511
+ LIBS="$curl_cv_save_LIBS"
512
+ else
513
+ LIBS="$x_nlibs $curl_cv_save_LIBS"
514
+ fi
515
+ AC_LINK_IFELSE([
516
+ AC_LANG_PROGRAM([[
517
+ #undef inline
518
+ #ifdef _WIN32
519
+ #ifndef WIN32_LEAN_AND_MEAN
520
+ #define WIN32_LEAN_AND_MEAN
521
+ #endif
522
+ #include <windows.h>
523
+ #else
524
+ #ifdef HAVE_SYS_TYPES_H
525
+ #include <sys/types.h>
526
+ #endif
527
+ #endif
528
+ #ifndef NULL
529
+ #define NULL (void *)0
530
+ #endif
531
+ #ifndef LDAP_DEPRECATED
532
+ #define LDAP_DEPRECATED 1
533
+ #endif
534
+ #ifdef NEED_LBER_H
535
+ #include <lber.h>
536
+ #endif
537
+ #ifdef HAVE_LDAP_H
538
+ #include <ldap.h>
539
+ #endif
540
+ ]],[[
541
+ BerValue *bvp = NULL;
542
+ BerElement *bep = ber_init(bvp);
543
+ LDAP *ldp = ldap_init("0.0.0.0", LDAP_PORT);
544
+ int res = ldap_unbind(ldp);
545
+ ber_free(bep, 1);
546
+ ]])
547
+ ],[
548
+ curl_cv_ldap_LIBS="$x_nlibs"
549
+ ])
550
+ fi
551
+ done
552
+ #
553
+ LIBS="$curl_cv_save_LIBS"
554
+ #
555
+ case X-"$curl_cv_ldap_LIBS" in
556
+ X-unknown)
557
+ AC_MSG_RESULT([cannot find LDAP libraries])
558
+ ;;
559
+ X-)
560
+ AC_MSG_RESULT([no additional lib required])
561
+ ;;
562
+ *)
563
+ if test -z "$curl_cv_save_LIBS"; then
564
+ LIBS="$curl_cv_ldap_LIBS"
565
+ else
566
+ LIBS="$curl_cv_ldap_LIBS $curl_cv_save_LIBS"
567
+ fi
568
+ # FIXME: Enable when ldap was detected via pkg-config
569
+ if false; then
570
+ LIBCURL_PC_REQUIRES_PRIVATE="ldap $LIBCURL_PC_REQUIRES_PRIVATE"
571
+ fi
572
+ AC_MSG_RESULT([$curl_cv_ldap_LIBS])
573
+ ;;
574
+ esac
575
+ #
576
+ ])
577
+
578
+
579
+ dnl TYPE_SOCKADDR_STORAGE
580
+ dnl -------------------------------------------------
581
+ dnl Check for struct sockaddr_storage. Most IPv6-enabled
582
+ dnl hosts have it, but AIX 4.3 is one known exception.
583
+
584
+ AC_DEFUN([TYPE_SOCKADDR_STORAGE],
585
+ [
586
+ AC_CHECK_TYPE([struct sockaddr_storage],
587
+ AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE, 1,
588
+ [if struct sockaddr_storage is defined]), ,
589
+ [
590
+ #undef inline
591
+ #ifdef _WIN32
592
+ #ifndef WIN32_LEAN_AND_MEAN
593
+ #define WIN32_LEAN_AND_MEAN
594
+ #endif
595
+ #include <winsock2.h>
596
+ #else
597
+ #ifdef HAVE_SYS_TYPES_H
598
+ #include <sys/types.h>
599
+ #endif
600
+ #ifdef HAVE_SYS_SOCKET_H
601
+ #include <sys/socket.h>
602
+ #endif
603
+ #ifdef HAVE_NETINET_IN_H
604
+ #include <netinet/in.h>
605
+ #endif
606
+ #ifdef HAVE_ARPA_INET_H
607
+ #include <arpa/inet.h>
608
+ #endif
609
+ #endif
610
+ ])
611
+ ])
612
+
613
+ dnl CURL_CHECK_FUNC_RECV
614
+ dnl -------------------------------------------------
615
+ dnl Test if the socket recv() function is available,
616
+
617
+ AC_DEFUN([CURL_CHECK_FUNC_RECV], [
618
+ AC_REQUIRE([CURL_CHECK_NATIVE_WINDOWS])dnl
619
+ AC_REQUIRE([CURL_INCLUDES_BSDSOCKET])dnl
620
+ AC_CHECK_HEADERS(sys/types.h sys/socket.h)
621
+ #
622
+ AC_MSG_CHECKING([for recv])
623
+ AC_LINK_IFELSE([
624
+ AC_LANG_PROGRAM([[
625
+ #undef inline
626
+ #ifdef _WIN32
627
+ #ifndef WIN32_LEAN_AND_MEAN
628
+ #define WIN32_LEAN_AND_MEAN
629
+ #endif
630
+ #include <winsock2.h>
631
+ #else
632
+ $curl_includes_bsdsocket
633
+ #ifdef HAVE_SYS_TYPES_H
634
+ #include <sys/types.h>
635
+ #endif
636
+ #ifdef HAVE_SYS_SOCKET_H
637
+ #include <sys/socket.h>
638
+ #endif
639
+ #endif
640
+ ]],[[
641
+ recv(0, 0, 0, 0);
642
+ ]])
643
+ ],[
644
+ AC_MSG_RESULT([yes])
645
+ curl_cv_recv="yes"
646
+ ],[
647
+ AC_MSG_RESULT([no])
648
+ curl_cv_recv="no"
649
+ ])
650
+ #
651
+ if test "$curl_cv_recv" = "yes"; then
652
+ AC_DEFINE_UNQUOTED(HAVE_RECV, 1,
653
+ [Define to 1 if you have the recv function.])
654
+ curl_cv_func_recv="yes"
655
+ else
656
+ AC_MSG_ERROR([Unable to link function recv])
657
+ fi
658
+ ])
659
+
660
+
661
+ dnl CURL_CHECK_FUNC_SEND
662
+ dnl -------------------------------------------------
663
+ dnl Test if the socket send() function is available,
664
+
665
+ AC_DEFUN([CURL_CHECK_FUNC_SEND], [
666
+ AC_REQUIRE([CURL_CHECK_NATIVE_WINDOWS])dnl
667
+ AC_REQUIRE([CURL_INCLUDES_BSDSOCKET])dnl
668
+ AC_CHECK_HEADERS(sys/types.h sys/socket.h)
669
+ #
670
+ AC_MSG_CHECKING([for send])
671
+ AC_LINK_IFELSE([
672
+ AC_LANG_PROGRAM([[
673
+ #undef inline
674
+ #ifdef _WIN32
675
+ #ifndef WIN32_LEAN_AND_MEAN
676
+ #define WIN32_LEAN_AND_MEAN
677
+ #endif
678
+ #include <winsock2.h>
679
+ #else
680
+ $curl_includes_bsdsocket
681
+ #ifdef HAVE_SYS_TYPES_H
682
+ #include <sys/types.h>
683
+ #endif
684
+ #ifdef HAVE_SYS_SOCKET_H
685
+ #include <sys/socket.h>
686
+ #endif
687
+ #endif
688
+ ]],[[
689
+ send(0, 0, 0, 0);
690
+ ]])
691
+ ],[
692
+ AC_MSG_RESULT([yes])
693
+ curl_cv_send="yes"
694
+ ],[
695
+ AC_MSG_RESULT([no])
696
+ curl_cv_send="no"
697
+ ])
698
+ #
699
+ if test "$curl_cv_send" = "yes"; then
700
+ AC_DEFINE_UNQUOTED(HAVE_SEND, 1,
701
+ [Define to 1 if you have the send function.])
702
+ curl_cv_func_send="yes"
703
+ else
704
+ AC_MSG_ERROR([Unable to link function send])
705
+ fi
706
+ ])
707
+
708
+ dnl CURL_CHECK_MSG_NOSIGNAL
709
+ dnl -------------------------------------------------
710
+ dnl Check for MSG_NOSIGNAL
711
+
712
+ AC_DEFUN([CURL_CHECK_MSG_NOSIGNAL], [
713
+ AC_CHECK_HEADERS(sys/types.h sys/socket.h)
714
+ AC_CACHE_CHECK([for MSG_NOSIGNAL], [curl_cv_msg_nosignal], [
715
+ AC_COMPILE_IFELSE([
716
+ AC_LANG_PROGRAM([[
717
+ #undef inline
718
+ #ifdef _WIN32
719
+ #ifndef WIN32_LEAN_AND_MEAN
720
+ #define WIN32_LEAN_AND_MEAN
721
+ #endif
722
+ #include <winsock2.h>
723
+ #else
724
+ #ifdef HAVE_SYS_TYPES_H
725
+ #include <sys/types.h>
726
+ #endif
727
+ #ifdef HAVE_SYS_SOCKET_H
728
+ #include <sys/socket.h>
729
+ #endif
730
+ #endif
731
+ ]],[[
732
+ int flag=MSG_NOSIGNAL;
733
+ ]])
734
+ ],[
735
+ curl_cv_msg_nosignal="yes"
736
+ ],[
737
+ curl_cv_msg_nosignal="no"
738
+ ])
739
+ ])
740
+ case "$curl_cv_msg_nosignal" in
741
+ yes)
742
+ AC_DEFINE_UNQUOTED(HAVE_MSG_NOSIGNAL, 1,
743
+ [Define to 1 if you have the MSG_NOSIGNAL flag.])
744
+ ;;
745
+ esac
746
+ ])
747
+
748
+
749
+ dnl CURL_CHECK_STRUCT_TIMEVAL
750
+ dnl -------------------------------------------------
751
+ dnl Check for timeval struct
752
+
753
+ AC_DEFUN([CURL_CHECK_STRUCT_TIMEVAL], [
754
+ AC_REQUIRE([CURL_CHECK_NATIVE_WINDOWS])dnl
755
+ AC_CHECK_HEADERS(sys/types.h sys/time.h sys/socket.h)
756
+ AC_CACHE_CHECK([for struct timeval], [curl_cv_struct_timeval], [
757
+ AC_COMPILE_IFELSE([
758
+ AC_LANG_PROGRAM([[
759
+ #undef inline
760
+ #ifdef _WIN32
761
+ #ifndef WIN32_LEAN_AND_MEAN
762
+ #define WIN32_LEAN_AND_MEAN
763
+ #endif
764
+ #include <winsock2.h>
765
+ #endif
766
+ #ifdef HAVE_SYS_TYPES_H
767
+ #include <sys/types.h>
768
+ #endif
769
+ #ifdef HAVE_SYS_TIME_H
770
+ #include <sys/time.h>
771
+ #endif
772
+ #include <time.h>
773
+ #ifdef HAVE_SYS_SOCKET_H
774
+ #include <sys/socket.h>
775
+ #endif
776
+ ]],[[
777
+ struct timeval ts;
778
+ ts.tv_sec = 0;
779
+ ts.tv_usec = 0;
780
+ ]])
781
+ ],[
782
+ curl_cv_struct_timeval="yes"
783
+ ],[
784
+ curl_cv_struct_timeval="no"
785
+ ])
786
+ ])
787
+ case "$curl_cv_struct_timeval" in
788
+ yes)
789
+ AC_DEFINE_UNQUOTED(HAVE_STRUCT_TIMEVAL, 1,
790
+ [Define to 1 if you have the timeval struct.])
791
+ ;;
792
+ esac
793
+ ])
794
+
795
+
796
+ dnl TYPE_IN_ADDR_T
797
+ dnl -------------------------------------------------
798
+ dnl Check for in_addr_t: it is used to receive the return code of inet_addr()
799
+ dnl and a few other things.
800
+
801
+ AC_DEFUN([TYPE_IN_ADDR_T], [
802
+ AC_CHECK_TYPE([in_addr_t], ,[
803
+ dnl in_addr_t not available
804
+ AC_CACHE_CHECK([for in_addr_t equivalent],
805
+ [curl_cv_in_addr_t_equiv], [
806
+ curl_cv_in_addr_t_equiv="unknown"
807
+ for t in "unsigned long" int size_t unsigned long; do
808
+ if test "$curl_cv_in_addr_t_equiv" = "unknown"; then
809
+ AC_LINK_IFELSE([
810
+ AC_LANG_PROGRAM([[
811
+ #undef inline
812
+ #ifdef _WIN32
813
+ #ifndef WIN32_LEAN_AND_MEAN
814
+ #define WIN32_LEAN_AND_MEAN
815
+ #endif
816
+ #include <winsock2.h>
817
+ #else
818
+ #ifdef HAVE_SYS_TYPES_H
819
+ #include <sys/types.h>
820
+ #endif
821
+ #ifdef HAVE_SYS_SOCKET_H
822
+ #include <sys/socket.h>
823
+ #endif
824
+ #ifdef HAVE_NETINET_IN_H
825
+ #include <netinet/in.h>
826
+ #endif
827
+ #ifdef HAVE_ARPA_INET_H
828
+ #include <arpa/inet.h>
829
+ #endif
830
+ #endif
831
+ ]],[[
832
+ $t data = inet_addr ("1.2.3.4");
833
+ ]])
834
+ ],[
835
+ curl_cv_in_addr_t_equiv="$t"
836
+ ])
837
+ fi
838
+ done
839
+ ])
840
+ case "$curl_cv_in_addr_t_equiv" in
841
+ unknown)
842
+ AC_MSG_ERROR([Cannot find a type to use in place of in_addr_t])
843
+ ;;
844
+ *)
845
+ AC_DEFINE_UNQUOTED(in_addr_t, $curl_cv_in_addr_t_equiv,
846
+ [Type to use in place of in_addr_t when system does not provide it.])
847
+ ;;
848
+ esac
849
+ ],[
850
+ #undef inline
851
+ #ifdef _WIN32
852
+ #ifndef WIN32_LEAN_AND_MEAN
853
+ #define WIN32_LEAN_AND_MEAN
854
+ #endif
855
+ #include <winsock2.h>
856
+ #else
857
+ #ifdef HAVE_SYS_TYPES_H
858
+ #include <sys/types.h>
859
+ #endif
860
+ #ifdef HAVE_SYS_SOCKET_H
861
+ #include <sys/socket.h>
862
+ #endif
863
+ #ifdef HAVE_NETINET_IN_H
864
+ #include <netinet/in.h>
865
+ #endif
866
+ #ifdef HAVE_ARPA_INET_H
867
+ #include <arpa/inet.h>
868
+ #endif
869
+ #endif
870
+ ])
871
+ ])
872
+
873
+
874
+ dnl CURL_CHECK_FUNC_CLOCK_GETTIME_MONOTONIC
875
+ dnl -------------------------------------------------
876
+ dnl Check if monotonic clock_gettime is available.
877
+
878
+ AC_DEFUN([CURL_CHECK_FUNC_CLOCK_GETTIME_MONOTONIC], [
879
+ AC_CHECK_HEADERS(sys/types.h sys/time.h)
880
+ AC_MSG_CHECKING([for monotonic clock_gettime])
881
+ #
882
+ if test "x$dontwant_rt" = "xno" ; then
883
+ AC_COMPILE_IFELSE([
884
+ AC_LANG_PROGRAM([[
885
+ #ifdef HAVE_SYS_TYPES_H
886
+ #include <sys/types.h>
887
+ #endif
888
+ #ifdef HAVE_SYS_TIME_H
889
+ #include <sys/time.h>
890
+ #endif
891
+ #include <time.h>
892
+ ]],[[
893
+ struct timespec ts;
894
+ (void)clock_gettime(CLOCK_MONOTONIC, &ts);
895
+ ]])
896
+ ],[
897
+ AC_MSG_RESULT([yes])
898
+ curl_func_clock_gettime="yes"
899
+ ],[
900
+ AC_MSG_RESULT([no])
901
+ curl_func_clock_gettime="no"
902
+ ])
903
+ fi
904
+ dnl Definition of HAVE_CLOCK_GETTIME_MONOTONIC is intentionally postponed
905
+ dnl until library linking and run-time checks for clock_gettime succeed.
906
+ ])
907
+
908
+ dnl CURL_CHECK_FUNC_CLOCK_GETTIME_MONOTONIC_RAW
909
+ dnl -------------------------------------------------
910
+ dnl Check if monotonic clock_gettime is available.
911
+
912
+ AC_DEFUN([CURL_CHECK_FUNC_CLOCK_GETTIME_MONOTONIC_RAW], [
913
+ AC_CHECK_HEADERS(sys/types.h sys/time.h)
914
+ AC_MSG_CHECKING([for raw monotonic clock_gettime])
915
+ #
916
+ if test "x$dontwant_rt" = "xno" ; then
917
+ AC_COMPILE_IFELSE([
918
+ AC_LANG_PROGRAM([[
919
+ #ifdef HAVE_SYS_TYPES_H
920
+ #include <sys/types.h>
921
+ #endif
922
+ #ifdef HAVE_SYS_TIME_H
923
+ #include <sys/time.h>
924
+ #endif
925
+ #include <time.h>
926
+ ]],[[
927
+ struct timespec ts;
928
+ (void)clock_gettime(CLOCK_MONOTONIC_RAW, &ts);
929
+ ]])
930
+ ],[
931
+ AC_MSG_RESULT([yes])
932
+ AC_DEFINE_UNQUOTED(HAVE_CLOCK_GETTIME_MONOTONIC_RAW, 1,
933
+ [Define to 1 if you have the clock_gettime function and raw monotonic timer.])
934
+ ],[
935
+ AC_MSG_RESULT([no])
936
+ ])
937
+ fi
938
+ ])
939
+
940
+
941
+ dnl CURL_CHECK_LIBS_CLOCK_GETTIME_MONOTONIC
942
+ dnl -------------------------------------------------
943
+ dnl If monotonic clock_gettime is available then,
944
+ dnl check and prepended to LIBS any needed libraries.
945
+
946
+ AC_DEFUN([CURL_CHECK_LIBS_CLOCK_GETTIME_MONOTONIC], [
947
+ AC_REQUIRE([CURL_CHECK_FUNC_CLOCK_GETTIME_MONOTONIC])dnl
948
+ #
949
+ if test "$curl_func_clock_gettime" = "yes"; then
950
+ #
951
+ AC_MSG_CHECKING([for clock_gettime in libraries])
952
+ #
953
+ curl_cv_save_LIBS="$LIBS"
954
+ curl_cv_gclk_LIBS="unknown"
955
+ #
956
+ for x_xlibs in '' '-lrt' '-lposix4' ; do
957
+ if test "$curl_cv_gclk_LIBS" = "unknown"; then
958
+ if test -z "$x_xlibs"; then
959
+ LIBS="$curl_cv_save_LIBS"
960
+ else
961
+ LIBS="$x_xlibs $curl_cv_save_LIBS"
962
+ fi
963
+ AC_LINK_IFELSE([
964
+ AC_LANG_PROGRAM([[
965
+ #ifdef HAVE_SYS_TYPES_H
966
+ #include <sys/types.h>
967
+ #endif
968
+ #ifdef HAVE_SYS_TIME_H
969
+ #include <sys/time.h>
970
+ #endif
971
+ #include <time.h>
972
+ ]],[[
973
+ struct timespec ts;
974
+ (void)clock_gettime(CLOCK_MONOTONIC, &ts);
975
+ ]])
976
+ ],[
977
+ curl_cv_gclk_LIBS="$x_xlibs"
978
+ ])
979
+ fi
980
+ done
981
+ #
982
+ LIBS="$curl_cv_save_LIBS"
983
+ #
984
+ case X-"$curl_cv_gclk_LIBS" in
985
+ X-unknown)
986
+ AC_MSG_RESULT([cannot find clock_gettime])
987
+ AC_MSG_WARN([HAVE_CLOCK_GETTIME_MONOTONIC will not be defined])
988
+ curl_func_clock_gettime="no"
989
+ ;;
990
+ X-)
991
+ AC_MSG_RESULT([no additional lib required])
992
+ curl_func_clock_gettime="yes"
993
+ ;;
994
+ *)
995
+ if test -z "$curl_cv_save_LIBS"; then
996
+ LIBS="$curl_cv_gclk_LIBS"
997
+ else
998
+ LIBS="$curl_cv_gclk_LIBS $curl_cv_save_LIBS"
999
+ fi
1000
+ AC_MSG_RESULT([$curl_cv_gclk_LIBS])
1001
+ curl_func_clock_gettime="yes"
1002
+ ;;
1003
+ esac
1004
+ #
1005
+ dnl only do runtime verification when not cross-compiling
1006
+ if test "x$cross_compiling" != "xyes" &&
1007
+ test "$curl_func_clock_gettime" = "yes"; then
1008
+ AC_MSG_CHECKING([if monotonic clock_gettime works])
1009
+ CURL_RUN_IFELSE([
1010
+ AC_LANG_PROGRAM([[
1011
+ #include <stdlib.h>
1012
+ #ifdef HAVE_SYS_TYPES_H
1013
+ #include <sys/types.h>
1014
+ #endif
1015
+ #ifdef HAVE_SYS_TIME_H
1016
+ #include <sys/time.h>
1017
+ #endif
1018
+ #include <time.h>
1019
+ ]],[[
1020
+ struct timespec ts;
1021
+ if (0 == clock_gettime(CLOCK_MONOTONIC, &ts))
1022
+ exit(0);
1023
+ else
1024
+ exit(1);
1025
+ ]])
1026
+ ],[
1027
+ AC_MSG_RESULT([yes])
1028
+ ],[
1029
+ AC_MSG_RESULT([no])
1030
+ AC_MSG_WARN([HAVE_CLOCK_GETTIME_MONOTONIC will not be defined])
1031
+ curl_func_clock_gettime="no"
1032
+ LIBS="$curl_cv_save_LIBS"
1033
+ ])
1034
+ fi
1035
+ #
1036
+ case "$curl_func_clock_gettime" in
1037
+ yes)
1038
+ AC_DEFINE_UNQUOTED(HAVE_CLOCK_GETTIME_MONOTONIC, 1,
1039
+ [Define to 1 if you have the clock_gettime function and monotonic timer.])
1040
+ ;;
1041
+ esac
1042
+ #
1043
+ fi
1044
+ #
1045
+ ])
1046
+
1047
+
1048
+ dnl CURL_CHECK_LIBS_CONNECT
1049
+ dnl -------------------------------------------------
1050
+ dnl Verify if network connect function is already available
1051
+ dnl using current libraries or if another one is required.
1052
+
1053
+ AC_DEFUN([CURL_CHECK_LIBS_CONNECT], [
1054
+ AC_REQUIRE([CURL_INCLUDES_WINSOCK2])dnl
1055
+ AC_REQUIRE([CURL_INCLUDES_BSDSOCKET])dnl
1056
+ AC_MSG_CHECKING([for connect in libraries])
1057
+ tst_connect_save_LIBS="$LIBS"
1058
+ tst_connect_need_LIBS="unknown"
1059
+ for tst_lib in '' '-lsocket' ; do
1060
+ if test "$tst_connect_need_LIBS" = "unknown"; then
1061
+ LIBS="$tst_lib $tst_connect_save_LIBS"
1062
+ AC_LINK_IFELSE([
1063
+ AC_LANG_PROGRAM([[
1064
+ $curl_includes_winsock2
1065
+ $curl_includes_bsdsocket
1066
+ #if !defined(_WIN32) && !defined(HAVE_PROTO_BSDSOCKET_H)
1067
+ int connect(int, void*, int);
1068
+ #endif
1069
+ ]],[[
1070
+ if(0 != connect(0, 0, 0))
1071
+ return 1;
1072
+ ]])
1073
+ ],[
1074
+ tst_connect_need_LIBS="$tst_lib"
1075
+ ])
1076
+ fi
1077
+ done
1078
+ LIBS="$tst_connect_save_LIBS"
1079
+ #
1080
+ case X-"$tst_connect_need_LIBS" in
1081
+ X-unknown)
1082
+ AC_MSG_RESULT([cannot find connect])
1083
+ AC_MSG_ERROR([cannot find connect function in libraries.])
1084
+ ;;
1085
+ X-)
1086
+ AC_MSG_RESULT([yes])
1087
+ ;;
1088
+ *)
1089
+ AC_MSG_RESULT([$tst_connect_need_LIBS])
1090
+ LIBS="$tst_connect_need_LIBS $tst_connect_save_LIBS"
1091
+ ;;
1092
+ esac
1093
+ ])
1094
+
1095
+
1096
+ dnl CURL_CHECK_FUNC_SELECT
1097
+ dnl -------------------------------------------------
1098
+ dnl Test if the socket select() function is available.
1099
+
1100
+ AC_DEFUN([CURL_CHECK_FUNC_SELECT], [
1101
+ AC_REQUIRE([CURL_CHECK_STRUCT_TIMEVAL])dnl
1102
+ AC_REQUIRE([CURL_INCLUDES_BSDSOCKET])dnl
1103
+ AC_CHECK_HEADERS(sys/select.h sys/socket.h)
1104
+ #
1105
+ AC_MSG_CHECKING([for select])
1106
+ AC_LINK_IFELSE([
1107
+ AC_LANG_PROGRAM([[
1108
+ #undef inline
1109
+ #ifdef _WIN32
1110
+ #ifndef WIN32_LEAN_AND_MEAN
1111
+ #define WIN32_LEAN_AND_MEAN
1112
+ #endif
1113
+ #include <winsock2.h>
1114
+ #endif
1115
+ #ifdef HAVE_SYS_TYPES_H
1116
+ #include <sys/types.h>
1117
+ #endif
1118
+ #ifdef HAVE_SYS_TIME_H
1119
+ #include <sys/time.h>
1120
+ #endif
1121
+ #include <time.h>
1122
+ #ifndef _WIN32
1123
+ #ifdef HAVE_SYS_SELECT_H
1124
+ #include <sys/select.h>
1125
+ #elif defined(HAVE_UNISTD_H)
1126
+ #include <unistd.h>
1127
+ #endif
1128
+ #ifdef HAVE_SYS_SOCKET_H
1129
+ #include <sys/socket.h>
1130
+ #endif
1131
+ $curl_includes_bsdsocket
1132
+ #endif
1133
+ ]],[[
1134
+ select(0, 0, 0, 0, 0);
1135
+ ]])
1136
+ ],[
1137
+ AC_MSG_RESULT([yes])
1138
+ curl_cv_select="yes"
1139
+ ],[
1140
+ AC_MSG_RESULT([no])
1141
+ curl_cv_select="no"
1142
+ ])
1143
+ #
1144
+ if test "$curl_cv_select" = "yes"; then
1145
+ AC_DEFINE_UNQUOTED(HAVE_SELECT, 1,
1146
+ [Define to 1 if you have the select function.])
1147
+ curl_cv_func_select="yes"
1148
+ fi
1149
+ ])
1150
+
1151
+
1152
+ dnl CURL_VERIFY_RUNTIMELIBS
1153
+ dnl -------------------------------------------------
1154
+ dnl Verify that the shared libs found so far can be used when running
1155
+ dnl programs, since otherwise the situation will create odd configure errors
1156
+ dnl that are misleading people.
1157
+ dnl
1158
+ dnl Make sure this test is run BEFORE the first test in the script that
1159
+ dnl runs anything, which at the time of this writing is the AC_CHECK_SIZEOF
1160
+ dnl macro. It must also run AFTER all lib-checking macros are complete.
1161
+
1162
+ AC_DEFUN([CURL_VERIFY_RUNTIMELIBS], [
1163
+
1164
+ dnl this test is of course not sensible if we are cross-compiling!
1165
+ if test "x$cross_compiling" != xyes; then
1166
+
1167
+ dnl just run a program to verify that the libs checked for previous to this
1168
+ dnl point also is available run-time!
1169
+ AC_MSG_CHECKING([run-time libs availability])
1170
+ CURL_RUN_IFELSE([
1171
+ int main()
1172
+ {
1173
+ return 0;
1174
+ }
1175
+ ],
1176
+ AC_MSG_RESULT([fine]),
1177
+ AC_MSG_RESULT([failed])
1178
+ AC_MSG_ERROR([one or more libs available at link-time are not available run-time. Libs used at link-time: $LIBS])
1179
+ )
1180
+
1181
+ dnl if this test fails, configure has already stopped
1182
+ fi
1183
+ ])
1184
+
1185
+
1186
+ dnl CURL_CHECK_CA_BUNDLE
1187
+ dnl -------------------------------------------------
1188
+ dnl Check if a default ca-bundle should be used
1189
+ dnl
1190
+ dnl regarding the paths this will scan:
1191
+ dnl /etc/ssl/certs/ca-certificates.crt Debian systems
1192
+ dnl /etc/pki/tls/certs/ca-bundle.crt Redhat and Mandriva
1193
+ dnl /usr/share/ssl/certs/ca-bundle.crt old(er) Redhat
1194
+ dnl /usr/local/share/certs/ca-root-nss.crt MidnightBSD
1195
+ dnl /etc/ssl/cert.pem OpenBSD, MidnightBSD (symlink)
1196
+ dnl /etc/ssl/certs (CA path) SUSE, FreeBSD
1197
+
1198
+ AC_DEFUN([CURL_CHECK_CA_BUNDLE], [
1199
+
1200
+ AC_MSG_CHECKING([default CA cert bundle/path])
1201
+
1202
+ AC_ARG_WITH(ca-bundle,
1203
+ AS_HELP_STRING([--with-ca-bundle=FILE],
1204
+ [Absolute path to a file containing CA certificates (example: /etc/ca-bundle.crt)])
1205
+ AS_HELP_STRING([--without-ca-bundle], [Don't use a default CA bundle]),
1206
+ [
1207
+ want_ca="$withval"
1208
+ if test "x$want_ca" = "xyes"; then
1209
+ AC_MSG_ERROR([--with-ca-bundle=FILE requires a path to the CA bundle])
1210
+ fi
1211
+ ],
1212
+ [ want_ca="unset" ])
1213
+ AC_ARG_WITH(ca-path,
1214
+ AS_HELP_STRING([--with-ca-path=DIRECTORY],
1215
+ [Absolute path to a directory containing CA certificates stored individually, with \
1216
+ their filenames in a hash format. This option can be used with the OpenSSL, \
1217
+ GnuTLS, mbedTLS and wolfSSL backends. Refer to OpenSSL c_rehash for details. \
1218
+ (example: /etc/certificates)])
1219
+ AS_HELP_STRING([--without-ca-path], [Don't use a default CA path]),
1220
+ [
1221
+ want_capath="$withval"
1222
+ if test "x$want_capath" = "xyes"; then
1223
+ AC_MSG_ERROR([--with-ca-path=DIRECTORY requires a path to the CA path directory])
1224
+ fi
1225
+ ],
1226
+ [ want_capath="unset"])
1227
+
1228
+ ca_warning=" (warning: certs not found)"
1229
+ capath_warning=" (warning: certs not found)"
1230
+ check_capath=""
1231
+
1232
+ if test "x$want_ca" != "xno" -a "x$want_ca" != "xunset" -a \
1233
+ "x$want_capath" != "xno" -a "x$want_capath" != "xunset"; then
1234
+ dnl both given
1235
+ ca="$want_ca"
1236
+ capath="$want_capath"
1237
+ elif test "x$want_ca" != "xno" -a "x$want_ca" != "xunset"; then
1238
+ dnl --with-ca-bundle given
1239
+ ca="$want_ca"
1240
+ capath="no"
1241
+ elif test "x$want_capath" != "xno" -a "x$want_capath" != "xunset"; then
1242
+ dnl --with-ca-path given
1243
+ capath="$want_capath"
1244
+ ca="no"
1245
+ else
1246
+ dnl First try auto-detecting a CA bundle, then a CA path.
1247
+ dnl Both auto-detections can be skipped by --without-ca-*
1248
+ ca="no"
1249
+ capath="no"
1250
+ if test "x$cross_compiling" != "xyes" -a \
1251
+ "x$curl_cv_native_windows" != "xyes"; then
1252
+ dnl NOT cross-compiling and...
1253
+ dnl neither of the --with-ca-* options are provided
1254
+ if test "x$want_ca" = "xunset"; then
1255
+ dnl the path we previously would have installed the curl CA bundle
1256
+ dnl to, and thus we now check for an already existing cert in that
1257
+ dnl place in case we find no other
1258
+ if test "x$prefix" != xNONE; then
1259
+ cac="${prefix}/share/curl/curl-ca-bundle.crt"
1260
+ else
1261
+ cac="$ac_default_prefix/share/curl/curl-ca-bundle.crt"
1262
+ fi
1263
+
1264
+ for a in /etc/ssl/certs/ca-certificates.crt \
1265
+ /etc/pki/tls/certs/ca-bundle.crt \
1266
+ /usr/share/ssl/certs/ca-bundle.crt \
1267
+ /usr/local/share/certs/ca-root-nss.crt \
1268
+ /etc/ssl/cert.pem \
1269
+ "$cac"; do
1270
+ if test -f "$a"; then
1271
+ ca="$a"
1272
+ break
1273
+ fi
1274
+ done
1275
+ fi
1276
+ AC_MSG_NOTICE([want $want_capath ca $ca])
1277
+ if test "x$want_capath" = "xunset"; then
1278
+ check_capath="/etc/ssl/certs"
1279
+ fi
1280
+ else
1281
+ dnl no option given and cross-compiling
1282
+ AC_MSG_WARN([skipped the ca-cert path detection when cross-compiling])
1283
+ fi
1284
+ fi
1285
+
1286
+ if test "x$ca" = "xno" || test -f "$ca"; then
1287
+ ca_warning=""
1288
+ fi
1289
+
1290
+ if test "x$capath" != "xno"; then
1291
+ check_capath="$capath"
1292
+ fi
1293
+
1294
+ if test ! -z "$check_capath"; then
1295
+ for a in "$check_capath"; do
1296
+ if test -d "$a" && ls "$a"/[[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]].0 >/dev/null 2>/dev/null; then
1297
+ if test "x$capath" = "xno"; then
1298
+ capath="$a"
1299
+ fi
1300
+ capath_warning=""
1301
+ break
1302
+ fi
1303
+ done
1304
+ fi
1305
+
1306
+ if test "x$capath" = "xno"; then
1307
+ capath_warning=""
1308
+ fi
1309
+
1310
+ if test "x$ca" != "xno"; then
1311
+ CURL_CA_BUNDLE="$ca"
1312
+ AC_DEFINE_UNQUOTED(CURL_CA_BUNDLE, "$ca", [Location of default ca bundle])
1313
+ AC_SUBST(CURL_CA_BUNDLE)
1314
+ AC_MSG_RESULT([$ca])
1315
+ fi
1316
+ if test "x$capath" != "xno"; then
1317
+ CURL_CA_PATH="\"$capath\""
1318
+ AC_DEFINE_UNQUOTED(CURL_CA_PATH, "$capath", [Location of default ca path])
1319
+ AC_MSG_RESULT([$capath (capath)])
1320
+ fi
1321
+ if test "x$ca" = "xno" && test "x$capath" = "xno"; then
1322
+ AC_MSG_RESULT([no])
1323
+ fi
1324
+
1325
+ AC_MSG_CHECKING([whether to use built-in CA store of SSL library])
1326
+ AC_ARG_WITH(ca-fallback,
1327
+ AS_HELP_STRING([--with-ca-fallback], [Use the built-in CA store of the SSL library])
1328
+ AS_HELP_STRING([--without-ca-fallback], [Don't use the built-in CA store of the SSL library]),
1329
+ [
1330
+ if test "x$with_ca_fallback" != "xyes" -a "x$with_ca_fallback" != "xno"; then
1331
+ AC_MSG_ERROR([--with-ca-fallback only allows yes or no as parameter])
1332
+ fi
1333
+ ],
1334
+ [ with_ca_fallback="no"])
1335
+ AC_MSG_RESULT([$with_ca_fallback])
1336
+ if test "x$with_ca_fallback" = "xyes"; then
1337
+ if test "x$OPENSSL_ENABLED" != "x1" -a "x$GNUTLS_ENABLED" != "x1"; then
1338
+ AC_MSG_ERROR([--with-ca-fallback only works with OpenSSL or GnuTLS])
1339
+ fi
1340
+ AC_DEFINE_UNQUOTED(CURL_CA_FALLBACK, 1, [define "1" to use built-in CA store of SSL library])
1341
+ fi
1342
+ ])
1343
+
1344
+
1345
+ dnl CURL_CHECK_CA_EMBED
1346
+ dnl -------------------------------------------------
1347
+ dnl Check if a ca-bundle should be embedded
1348
+
1349
+ AC_DEFUN([CURL_CHECK_CA_EMBED], [
1350
+
1351
+ AC_MSG_CHECKING([CA cert bundle path to embed in the curl tool])
1352
+
1353
+ AC_ARG_WITH(ca-embed,
1354
+ AS_HELP_STRING([--with-ca-embed=FILE],
1355
+ [Absolute path to a file containing CA certificates to embed in the curl tool (example: /etc/ca-bundle.crt)])
1356
+ AS_HELP_STRING([--without-ca-embed], [Don't embed a default CA bundle in the curl tool]),
1357
+ [
1358
+ want_ca_embed="$withval"
1359
+ if test "x$want_ca_embed" = "xyes"; then
1360
+ AC_MSG_ERROR([--with-ca-embed=FILE requires a path to the CA bundle])
1361
+ fi
1362
+ ],
1363
+ [ want_ca_embed="unset" ])
1364
+
1365
+ CURL_CA_EMBED=''
1366
+ if test "x$want_ca_embed" != "xno" -a "x$want_ca_embed" != "xunset" -a -f "$want_ca_embed"; then
1367
+ CURL_CA_EMBED="$want_ca_embed"
1368
+ AC_SUBST(CURL_CA_EMBED)
1369
+ AC_MSG_RESULT([$want_ca_embed])
1370
+ else
1371
+ AC_MSG_RESULT([no])
1372
+ fi
1373
+ ])
1374
+
1375
+ dnl CURL_CHECK_WIN32_LARGEFILE
1376
+ dnl -------------------------------------------------
1377
+ dnl Check if curl's Win32 large file will be used
1378
+
1379
+ AC_DEFUN([CURL_CHECK_WIN32_LARGEFILE], [
1380
+ AC_REQUIRE([CURL_CHECK_NATIVE_WINDOWS])dnl
1381
+ AC_MSG_CHECKING([whether build target supports Win32 file API])
1382
+ curl_win32_file_api="no"
1383
+ if test "$curl_cv_native_windows" = "yes"; then
1384
+ if test x"$enable_largefile" != "xno"; then
1385
+ AC_COMPILE_IFELSE([
1386
+ AC_LANG_PROGRAM([[
1387
+ ]],[[
1388
+ #if !defined(_WIN32_WCE) && (defined(__MINGW32__) || defined(_MSC_VER))
1389
+ int dummy=1;
1390
+ #else
1391
+ #error Win32 large file API not supported.
1392
+ #endif
1393
+ ]])
1394
+ ],[
1395
+ curl_win32_file_api="win32_large_files"
1396
+ ])
1397
+ fi
1398
+ if test "$curl_win32_file_api" = "no"; then
1399
+ AC_COMPILE_IFELSE([
1400
+ AC_LANG_PROGRAM([[
1401
+ ]],[[
1402
+ #if defined(_WIN32_WCE) || defined(__MINGW32__) || defined(_MSC_VER)
1403
+ int dummy=1;
1404
+ #else
1405
+ #error Win32 small file API not supported.
1406
+ #endif
1407
+ ]])
1408
+ ],[
1409
+ curl_win32_file_api="win32_small_files"
1410
+ ])
1411
+ fi
1412
+ fi
1413
+ case "$curl_win32_file_api" in
1414
+ win32_large_files)
1415
+ AC_MSG_RESULT([yes (large file enabled)])
1416
+ AC_DEFINE_UNQUOTED(USE_WIN32_LARGE_FILES, 1,
1417
+ [Define to 1 if you are building a Windows target with large file support.])
1418
+ AC_SUBST(USE_WIN32_LARGE_FILES, [1])
1419
+ ;;
1420
+ win32_small_files)
1421
+ AC_MSG_RESULT([yes (large file disabled)])
1422
+ AC_DEFINE_UNQUOTED(USE_WIN32_SMALL_FILES, 1,
1423
+ [Define to 1 if you are building a Windows target without large file support.])
1424
+ AC_SUBST(USE_WIN32_SMALL_FILES, [1])
1425
+ ;;
1426
+ *)
1427
+ AC_MSG_RESULT([no])
1428
+ ;;
1429
+ esac
1430
+ ])
1431
+
1432
+ dnl CURL_CHECK_WIN32_CRYPTO
1433
+ dnl -------------------------------------------------
1434
+ dnl Check if curl's Win32 crypto lib can be used
1435
+
1436
+ AC_DEFUN([CURL_CHECK_WIN32_CRYPTO], [
1437
+ AC_REQUIRE([CURL_CHECK_NATIVE_WINDOWS])dnl
1438
+ AC_MSG_CHECKING([whether build target supports Win32 crypto API])
1439
+ curl_win32_crypto_api="no"
1440
+ if test "$curl_cv_native_windows" = "yes"; then
1441
+ AC_COMPILE_IFELSE([
1442
+ AC_LANG_PROGRAM([[
1443
+ #undef inline
1444
+ #ifndef WIN32_LEAN_AND_MEAN
1445
+ #define WIN32_LEAN_AND_MEAN
1446
+ #endif
1447
+ #include <windows.h>
1448
+ #include <wincrypt.h>
1449
+ ]],[[
1450
+ HCRYPTPROV hCryptProv;
1451
+ if(CryptAcquireContext(&hCryptProv, NULL, NULL, PROV_RSA_FULL,
1452
+ CRYPT_VERIFYCONTEXT | CRYPT_SILENT)) {
1453
+ CryptReleaseContext(hCryptProv, 0);
1454
+ }
1455
+ ]])
1456
+ ],[
1457
+ curl_win32_crypto_api="yes"
1458
+ ])
1459
+ fi
1460
+ case "$curl_win32_crypto_api" in
1461
+ yes)
1462
+ AC_MSG_RESULT([yes])
1463
+ AC_DEFINE_UNQUOTED(USE_WIN32_CRYPTO, 1,
1464
+ [Define to 1 if you are building a Windows target with crypto API support.])
1465
+ AC_SUBST(USE_WIN32_CRYPTO, [1])
1466
+ ;;
1467
+ *)
1468
+ AC_MSG_RESULT([no])
1469
+ ;;
1470
+ esac
1471
+ ])
1472
+
1473
+ dnl CURL_EXPORT_PCDIR ($pcdir)
1474
+ dnl ------------------------
1475
+ dnl if $pcdir is not empty, set PKG_CONFIG_LIBDIR to $pcdir and export
1476
+ dnl
1477
+ dnl we need this macro since pkg-config distinguishes among empty and unset
1478
+ dnl variable while checking PKG_CONFIG_LIBDIR
1479
+ dnl
1480
+
1481
+ AC_DEFUN([CURL_EXPORT_PCDIR], [
1482
+ if test -n "$1"; then
1483
+ PKG_CONFIG_LIBDIR="$1"
1484
+ export PKG_CONFIG_LIBDIR
1485
+ fi
1486
+ ])
1487
+
1488
+ dnl CURL_CHECK_PKGCONFIG ($module, [$pcdir])
1489
+ dnl ------------------------
1490
+ dnl search for the pkg-config tool. Set the PKGCONFIG variable to hold the
1491
+ dnl path to it, or 'no' if not found/present.
1492
+ dnl
1493
+ dnl If pkg-config is present, check that it has info about the $module or
1494
+ dnl return "no" anyway!
1495
+ dnl
1496
+ dnl Optionally PKG_CONFIG_LIBDIR may be given as $pcdir.
1497
+ dnl
1498
+
1499
+ AC_DEFUN([CURL_CHECK_PKGCONFIG], [
1500
+ if test -n "$PKG_CONFIG"; then
1501
+ PKGCONFIG="$PKG_CONFIG"
1502
+ else
1503
+ AC_PATH_TOOL([PKGCONFIG], [pkg-config], [no],
1504
+ [$PATH:/usr/bin:/usr/local/bin])
1505
+ fi
1506
+
1507
+ if test "x$PKGCONFIG" != "xno"; then
1508
+ AC_MSG_CHECKING([for $1 options with pkg-config])
1509
+ dnl ask pkg-config about $1
1510
+ itexists=`CURL_EXPORT_PCDIR([$2]) dnl
1511
+ $PKGCONFIG --exists $1 >/dev/null 2>&1 && echo 1`
1512
+
1513
+ if test -z "$itexists"; then
1514
+ dnl pkg-config does not have info about the given module! set the
1515
+ dnl variable to 'no'
1516
+ PKGCONFIG="no"
1517
+ AC_MSG_RESULT([no])
1518
+ else
1519
+ AC_MSG_RESULT([found])
1520
+ fi
1521
+ fi
1522
+ ])
1523
+
1524
+
1525
+ dnl CURL_PREPARE_CONFIGUREHELP_PM
1526
+ dnl -------------------------------------------------
1527
+ dnl Prepare test harness configurehelp.pm module, defining and
1528
+ dnl initializing some perl variables with values which are known
1529
+ dnl when the configure script runs. For portability reasons, test
1530
+ dnl harness needs information on how to run the C preprocessor.
1531
+
1532
+ AC_DEFUN([CURL_PREPARE_CONFIGUREHELP_PM], [
1533
+ AC_REQUIRE([AC_PROG_CPP])dnl
1534
+ tmp_cpp=`eval echo "$ac_cpp" 2>/dev/null`
1535
+ if test -z "$tmp_cpp"; then
1536
+ tmp_cpp='cpp'
1537
+ fi
1538
+ AC_SUBST(CURL_CPP, $tmp_cpp)
1539
+ ])
1540
+
1541
+
1542
+ dnl CURL_PREPARE_BUILDINFO
1543
+ dnl -------------------------------------------------
1544
+ dnl Save build info for test runner to pick up and log
1545
+
1546
+ AC_DEFUN([CURL_PREPARE_BUILDINFO], [
1547
+ curl_pflags=""
1548
+ case $host in
1549
+ *-apple-*) curl_pflags="${curl_pflags} APPLE";;
1550
+ esac
1551
+ if test "$curl_cv_native_windows" = 'yes'; then
1552
+ curl_pflags="${curl_pflags} WIN32"
1553
+ else
1554
+ case $host in
1555
+ *-*-*bsd*|*-*-aix*|*-*-hpux*|*-*-interix*|*-*-irix*|*-*-linux*|*-*-solaris*|*-*-sunos*|*-apple-*|*-*-cygwin*|*-*-msys*)
1556
+ curl_pflags="${curl_pflags} UNIX";;
1557
+ esac
1558
+ case $host in
1559
+ *-*-*bsd*)
1560
+ curl_pflags="${curl_pflags} BSD";;
1561
+ esac
1562
+ fi
1563
+ if test "$curl_cv_cygwin" = 'yes'; then
1564
+ curl_pflags="${curl_pflags} CYGWIN"
1565
+ fi
1566
+ case $host_os in
1567
+ msys*) curl_pflags="${curl_pflags} MSYS";;
1568
+ esac
1569
+ if test "x$compiler_id" = 'xGNU_C'; then
1570
+ curl_pflags="${curl_pflags} GCC"
1571
+ fi
1572
+ case $host_os in
1573
+ mingw*) curl_pflags="${curl_pflags} MINGW";;
1574
+ esac
1575
+ if test "x$cross_compiling" = 'xyes'; then
1576
+ curl_pflags="${curl_pflags} CROSS"
1577
+ fi
1578
+ squeeze curl_pflags
1579
+ curl_buildinfo="
1580
+ buildinfo.configure.tool: configure
1581
+ buildinfo.configure.args: $ac_configure_args
1582
+ buildinfo.host: $build
1583
+ buildinfo.host.cpu: $build_cpu
1584
+ buildinfo.host.os: $build_os
1585
+ buildinfo.target: $host
1586
+ buildinfo.target.cpu: $host_cpu
1587
+ buildinfo.target.os: $host_os
1588
+ buildinfo.target.flags: $curl_pflags
1589
+ buildinfo.compiler: $compiler_id
1590
+ buildinfo.compiler.version: $compiler_ver
1591
+ buildinfo.sysroot: $lt_sysroot"
1592
+ ])
1593
+
1594
+
1595
+ dnl CURL_CPP_P
1596
+ dnl
1597
+ dnl Check if $cpp -P should be used for extract define values due to gcc 5
1598
+ dnl splitting up strings and defines between line outputs. gcc by default
1599
+ dnl (without -P) will show TEST EINVAL TEST as
1600
+ dnl
1601
+ dnl # 13 "conftest.c"
1602
+ dnl TEST
1603
+ dnl # 13 "conftest.c" 3 4
1604
+ dnl 22
1605
+ dnl # 13 "conftest.c"
1606
+ dnl TEST
1607
+
1608
+ AC_DEFUN([CURL_CPP_P], [
1609
+ AC_MSG_CHECKING([if cpp -P is needed])
1610
+ AC_EGREP_CPP([TEST.*TEST], [
1611
+ #include <errno.h>
1612
+ TEST EINVAL TEST
1613
+ ], [cpp=no], [cpp=yes])
1614
+ AC_MSG_RESULT([$cpp])
1615
+
1616
+ dnl we need cpp -P so check if it works then
1617
+ if test "x$cpp" = "xyes"; then
1618
+ AC_MSG_CHECKING([if cpp -P works])
1619
+ OLDCPPFLAGS=$CPPFLAGS
1620
+ CPPFLAGS="$CPPFLAGS -P"
1621
+ AC_EGREP_CPP([TEST.*TEST], [
1622
+ #include <errno.h>
1623
+ TEST EINVAL TEST
1624
+ ], [cpp_p=yes], [cpp_p=no])
1625
+ AC_MSG_RESULT([$cpp_p])
1626
+
1627
+ if test "x$cpp_p" = "xno"; then
1628
+ AC_MSG_WARN([failed to figure out cpp -P alternative])
1629
+ # without -P
1630
+ CPPPFLAG=""
1631
+ else
1632
+ # with -P
1633
+ CPPPFLAG="-P"
1634
+ fi
1635
+ dnl restore CPPFLAGS
1636
+ CPPFLAGS=$OLDCPPFLAGS
1637
+ else
1638
+ # without -P
1639
+ CPPPFLAG=""
1640
+ fi
1641
+ ])
1642
+
1643
+
1644
+ dnl CURL_DARWIN_CFLAGS
1645
+ dnl
1646
+ dnl Set -Werror=partial-availability to detect possible breaking code
1647
+ dnl with very low deployment targets.
1648
+ dnl
1649
+
1650
+ AC_DEFUN([CURL_DARWIN_CFLAGS], [
1651
+
1652
+ tst_cflags="no"
1653
+ case $host in
1654
+ *-apple-*)
1655
+ tst_cflags="yes"
1656
+ ;;
1657
+ esac
1658
+
1659
+ AC_MSG_CHECKING([for good-to-use Darwin CFLAGS])
1660
+ AC_MSG_RESULT([$tst_cflags]);
1661
+
1662
+ if test "$tst_cflags" = "yes"; then
1663
+ old_CFLAGS=$CFLAGS
1664
+ CFLAGS="$CFLAGS -Werror=partial-availability"
1665
+ AC_MSG_CHECKING([whether $CC accepts -Werror=partial-availability])
1666
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
1667
+ [AC_MSG_RESULT([yes])],
1668
+ [AC_MSG_RESULT([no])
1669
+ CFLAGS=$old_CFLAGS])
1670
+ fi
1671
+
1672
+ ])
1673
+
1674
+
1675
+ dnl CURL_SUPPORTS_BUILTIN_AVAILABLE
1676
+ dnl
1677
+ dnl Check to see if the compiler supports __builtin_available. This built-in
1678
+ dnl compiler function first appeared in Apple LLVM 9.0.0. It's so new that, at
1679
+ dnl the time this macro was written, the function was not yet documented. Its
1680
+ dnl purpose is to return true if the code is running under a certain OS version
1681
+ dnl or later.
1682
+
1683
+ AC_DEFUN([CURL_SUPPORTS_BUILTIN_AVAILABLE], [
1684
+ AC_MSG_CHECKING([to see if the compiler supports __builtin_available()])
1685
+ AC_COMPILE_IFELSE([
1686
+ AC_LANG_PROGRAM([[
1687
+ ]],[[
1688
+ if(__builtin_available(macOS 10.12, iOS 5.0, *)) {}
1689
+ ]])
1690
+ ],[
1691
+ AC_MSG_RESULT([yes])
1692
+ AC_DEFINE_UNQUOTED(HAVE_BUILTIN_AVAILABLE, 1,
1693
+ [Define to 1 if you have the __builtin_available function.])
1694
+ ],[
1695
+ AC_MSG_RESULT([no])
1696
+ ])
1697
+ ])
afc-curl/appveyor.sh ADDED
@@ -0,0 +1,159 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ #***************************************************************************
3
+ # _ _ ____ _
4
+ # Project ___| | | | _ \| |
5
+ # / __| | | | |_) | |
6
+ # | (__| |_| | _ <| |___
7
+ # \___|\___/|_| \_\_____|
8
+ #
9
+ # Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
10
+ #
11
+ # This software is licensed as described in the file COPYING, which
12
+ # you should have received as part of this distribution. The terms
13
+ # are also available at https://curl.se/docs/copyright.html.
14
+ #
15
+ # You may opt to use, copy, modify, merge, publish, distribute and/or sell
16
+ # copies of the Software, and permit persons to whom the Software is
17
+ # furnished to do so, under the terms of the COPYING file.
18
+ #
19
+ # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
20
+ # KIND, either express or implied.
21
+ #
22
+ # SPDX-License-Identifier: curl
23
+ #
24
+ ###########################################################################
25
+
26
+ # shellcheck disable=SC3040,SC2039
27
+ set -eux; [ -n "${BASH:-}${ZSH_NAME:-}" ] && set -o pipefail
28
+
29
+ # build
30
+
31
+ if [ "${APPVEYOR_BUILD_WORKER_IMAGE}" = 'Visual Studio 2022' ]; then
32
+ openssl_root_win='C:/OpenSSL-v33-Win64'
33
+ else
34
+ openssl_root_win='C:/OpenSSL-v111-Win64'
35
+ fi
36
+ openssl_root="$(cygpath "${openssl_root_win}")"
37
+
38
+ if [ "${BUILD_SYSTEM}" = 'CMake' ]; then
39
+ options=''
40
+ [[ "${TARGET:-}" = *'ARM64'* ]] && SKIP_RUN='ARM64 architecture'
41
+ [ -n "${TOOLSET:-}" ] && options+=" -T ${TOOLSET}"
42
+ [ "${OPENSSL}" = 'ON' ] && options+=" -DOPENSSL_ROOT_DIR=${openssl_root_win}"
43
+ [ -n "${CURLDEBUG:-}" ] && options+=" -DENABLE_CURLDEBUG=${CURLDEBUG}"
44
+ [ "${PRJ_CFG}" = 'Debug' ] && options+=' -DCMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG='
45
+ [ "${PRJ_CFG}" = 'Release' ] && options+=' -DCMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE='
46
+ [[ "${PRJ_GEN}" = *'Visual Studio'* ]] && options+=' -DCMAKE_VS_GLOBALS=TrackFileAccess=false'
47
+ if [ "${PRJ_GEN}" = 'Visual Studio 9 2008' ]; then
48
+ [ "${DEBUG}" = 'ON' ] && [ "${SHARED}" = 'ON' ] && SKIP_RUN='Crash on startup in ENABLE_DEBUG=ON shared builds'
49
+ # Fails to run without this due to missing MSVCR90.dll / MSVCR90D.dll
50
+ options+=' -DCURL_STATIC_CRT=ON'
51
+ fi
52
+ # shellcheck disable=SC2086
53
+ cmake -B _bld "-G${PRJ_GEN}" ${TARGET:-} ${options} \
54
+ "-DCURL_USE_OPENSSL=${OPENSSL}" \
55
+ "-DCURL_USE_SCHANNEL=${SCHANNEL}" \
56
+ "-DHTTP_ONLY=${HTTP_ONLY}" \
57
+ "-DBUILD_SHARED_LIBS=${SHARED}" \
58
+ "-DCMAKE_UNITY_BUILD=${UNITY}" \
59
+ '-DCURL_TEST_BUNDLES=ON' \
60
+ '-DCURL_WERROR=ON' \
61
+ "-DENABLE_DEBUG=${DEBUG}" \
62
+ "-DENABLE_UNICODE=${ENABLE_UNICODE}" \
63
+ '-DCMAKE_INSTALL_PREFIX=C:/curl' \
64
+ "-DCMAKE_BUILD_TYPE=${PRJ_CFG}" \
65
+ '-DCURL_USE_LIBPSL=OFF'
66
+ if false; then
67
+ cat _bld/CMakeFiles/CMakeConfigureLog.yaml 2>/dev/null || true
68
+ fi
69
+ echo 'curl_config.h'; grep -F '#define' _bld/lib/curl_config.h | sort || true
70
+ # shellcheck disable=SC2086
71
+ if ! cmake --build _bld --config "${PRJ_CFG}" --parallel 2 -- ${BUILD_OPT:-}; then
72
+ if [ "${PRJ_GEN}" = 'Visual Studio 9 2008' ]; then
73
+ find . -name BuildLog.htm -exec dos2unix '{}' +
74
+ find . -name BuildLog.htm -exec cat '{}' +
75
+ fi
76
+ false
77
+ fi
78
+ if [ "${SHARED}" = 'ON' ]; then
79
+ PATH="$PWD/_bld/lib:$PATH"
80
+ fi
81
+ if [ "${OPENSSL}" = 'ON' ]; then
82
+ PATH="$PWD/_bld/lib:${openssl_root}:$PATH"
83
+ fi
84
+ curl='_bld/src/curl.exe'
85
+ elif [ "${BUILD_SYSTEM}" = 'VisualStudioSolution' ]; then
86
+ (
87
+ cd projects
88
+ ./generate.bat "${VC_VERSION}"
89
+ msbuild.exe -maxcpucount "-property:Configuration=${PRJ_CFG}" "Windows/${VC_VERSION}/curl-all.sln"
90
+ )
91
+ curl="build/Win32/${VC_VERSION}/${PRJ_CFG}/curld.exe"
92
+ elif [ "${BUILD_SYSTEM}" = 'winbuild_vs2015' ]; then
93
+ ./buildconf.bat
94
+ (
95
+ cd winbuild
96
+ cat << EOF > _make.bat
97
+ call "C:/Program Files/Microsoft SDKs/Windows/v7.1/Bin/SetEnv.cmd" /x64
98
+ call "C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/vcvarsall.bat" x86_amd64
99
+ nmake -f Makefile.vc mode=dll VC=14 "SSL_PATH=${openssl_root_win}" WITH_SSL=dll MACHINE=x64 DEBUG=${DEBUG} ENABLE_UNICODE=${ENABLE_UNICODE}
100
+ EOF
101
+ ./_make.bat
102
+ rm _make.bat
103
+ )
104
+ curl="builds/libcurl-vc14-x64-${PATHPART}-dll-ssl-dll-ipv6-sspi/bin/curl.exe"
105
+ elif [ "${BUILD_SYSTEM}" = 'winbuild_vs2017' ]; then
106
+ ./buildconf.bat
107
+ (
108
+ cd winbuild
109
+ cat << EOF > _make.bat
110
+ call "C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Auxiliary/Build/vcvars64.bat"
111
+ nmake -f Makefile.vc mode=dll VC=14.10 "SSL_PATH=${openssl_root_win}" WITH_SSL=dll MACHINE=x64 DEBUG=${DEBUG} ENABLE_UNICODE=${ENABLE_UNICODE}
112
+ EOF
113
+ ./_make.bat
114
+ rm _make.bat
115
+ )
116
+ curl="builds/libcurl-vc14.10-x64-${PATHPART}-dll-ssl-dll-ipv6-sspi/bin/curl.exe"
117
+ fi
118
+
119
+ find . -name '*.exe' -o -name '*.dll'
120
+ if [ -z "${SKIP_RUN:-}" ]; then
121
+ "${curl}" --disable --version
122
+ else
123
+ echo "Skip running curl.exe. Reason: ${SKIP_RUN}"
124
+ fi
125
+
126
+ # build tests
127
+
128
+ if [[ "${TFLAGS}" != 'skipall' ]] && \
129
+ [ "${BUILD_SYSTEM}" = 'CMake' ]; then
130
+ cmake --build _bld --config "${PRJ_CFG}" --parallel 2 --target testdeps
131
+ fi
132
+
133
+ # run tests
134
+
135
+ if [[ "${TFLAGS}" != 'skipall' ]] && \
136
+ [[ "${TFLAGS}" != 'skiprun' ]]; then
137
+ if [ -x "$(cygpath "${SYSTEMROOT}/System32/curl.exe")" ]; then
138
+ TFLAGS+=" -ac $(cygpath "${SYSTEMROOT}/System32/curl.exe")"
139
+ elif [ -x "$(cygpath 'C:/msys64/usr/bin/curl.exe')" ]; then
140
+ TFLAGS+=" -ac $(cygpath 'C:/msys64/usr/bin/curl.exe')"
141
+ fi
142
+ TFLAGS+=' -j0'
143
+ if [ "${BUILD_SYSTEM}" = 'CMake' ]; then
144
+ cmake --build _bld --config "${PRJ_CFG}" --target test-ci
145
+ else
146
+ (
147
+ TFLAGS="-a -p !flaky -r -rm ${TFLAGS}"
148
+ cd _bld/tests
149
+ ./runtests.pl
150
+ )
151
+ fi
152
+ fi
153
+
154
+ # build examples
155
+
156
+ if [[ "${EXAMPLES}" = 'ON' ]] && \
157
+ [ "${BUILD_SYSTEM}" = 'CMake' ]; then
158
+ cmake --build _bld --config "${PRJ_CFG}" --parallel 2 --target curl-examples
159
+ fi