]>
Commit | Line | Data |
---|---|---|
d551412a DS |
1 | #*************************************************************************** |
2 | # _ _ ____ _ | |
3 | # Project ___| | | | _ \| | | |
4 | # / __| | | | |_) | | | |
5 | # | (__| |_| | _ <| |___ | |
6 | # \___|\___/|_| \_\_____| | |
7 | # | |
2bc1d775 | 8 | # Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. |
d551412a DS |
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 | |
4d2f8006 | 12 | # are also available at https://curl.se/docs/copyright.html. |
d551412a DS |
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 | # | |
ad9bc597 MM |
21 | # SPDX-License-Identifier: curl |
22 | # | |
b377e857 | 23 | #*************************************************************************** |
51581c03 | 24 | |
9cef14df | 25 | dnl CURL_CHECK_DEF (SYMBOL, [INCLUDES], [SILENT]) |
2c61e9c7 YT |
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 | |
ddfa33be YT |
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. | |
2c61e9c7 YT |
33 | |
34 | AC_DEFUN([CURL_CHECK_DEF], [ | |
ecf95343 DS |
35 | AC_REQUIRE([CURL_CPP_P])dnl |
36 | OLDCPPFLAGS=$CPPFLAGS | |
46398941 CD |
37 | # CPPPFLAG comes from CURL_CPP_P |
38 | CPPFLAGS="$CPPFLAGS $CPPPFLAG" | |
2c61e9c7 YT |
39 | AS_VAR_PUSHDEF([ac_HaveDef], [curl_cv_have_def_$1])dnl |
40 | AS_VAR_PUSHDEF([ac_Def], [curl_cv_def_$1])dnl | |
9b0110f5 YT |
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 | |
2c61e9c7 YT |
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 | \ | |
a2d4a98d | 59 | "$SED" 's/.*CURL_DEF_TOKEN[[ ]][[ ]]*//' 2>/dev/null | \ |
ddfa33be | 60 | "$SED" 's/[["]][[ ]]*[["]]//g' 2>/dev/null` |
45941877 | 61 | if test -z "$tmp_exp" || test "$tmp_exp" = "$1"; then |
2c61e9c7 YT |
62 | tmp_exp="" |
63 | fi | |
64 | ]) | |
65 | if test -z "$tmp_exp"; then | |
46876997 | 66 | AS_VAR_SET(ac_HaveDef, no) |
2c61e9c7 YT |
67 | ifelse($3,,[AC_MSG_RESULT([no])]) |
68 | else | |
46876997 YT |
69 | AS_VAR_SET(ac_HaveDef, yes) |
70 | AS_VAR_SET(ac_Def, $tmp_exp) | |
2c61e9c7 YT |
71 | ifelse($3,,[AC_MSG_RESULT([$tmp_exp])]) |
72 | fi | |
73 | AS_VAR_POPDEF([ac_Def])dnl | |
74 | AS_VAR_POPDEF([ac_HaveDef])dnl | |
ecf95343 | 75 | CPPFLAGS=$OLDCPPFLAGS |
2c61e9c7 YT |
76 | ]) |
77 | ||
78 | ||
8469db01 YT |
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 | 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 | ||
9b4253fe YT |
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 | { | |
3ae470ee | 128 | #if defined(__hpux) && defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE >= 600) |
9b4253fe | 129 | return 0; |
4dbc7850 | 130 | #elif defined(__hpux) && defined(_XOPEN_SOURCE_EXTENDED) |
9b4253fe YT |
131 | return 0; |
132 | #else | |
133 | force compilation error | |
134 | #endif | |
135 | } | |
136 | ]]) | |
137 | ],[ | |
138 | tst_lib_xnet_required="yes" | |
068f7ae2 | 139 | LIBS="-lxnet $LIBS" |
9b4253fe YT |
140 | ]) |
141 | AC_MSG_RESULT([$tst_lib_xnet_required]) | |
142 | ]) | |
143 | ||
144 | ||
b4fdccf8 YT |
145 | dnl CURL_CHECK_AIX_ALL_SOURCE |
146 | dnl ------------------------------------------------- | |
147 | dnl Provides a replacement of traditional AC_AIX with | |
725ec470 | 148 | dnl an uniform behavior across all autoconf versions, |
b4fdccf8 YT |
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 | |
665adcd4 | 159 | AC_BEFORE([$0], [CURL_CONFIGURE_PULL_SYS_POLL])dnl |
b4fdccf8 YT |
160 | AC_MSG_CHECKING([if OS is AIX (to define _ALL_SOURCE)]) |
161 | AC_EGREP_CPP([yes_this_is_aix],[ | |
162 | #ifdef _AIX | |
163 | yes_this_is_aix | |
164 | #endif | |
165 | ],[ | |
166 | AC_MSG_RESULT([yes]) | |
167 | AC_DEFINE(_ALL_SOURCE) | |
168 | ],[ | |
169 | AC_MSG_RESULT([no]) | |
170 | ]) | |
171 | ]) | |
172 | ||
173 | ||
51581c03 YT |
174 | dnl CURL_CHECK_HEADER_WINDOWS |
175 | dnl ------------------------------------------------- | |
a07bc791 | 176 | dnl Check for compilable and valid windows.h header |
51581c03 YT |
177 | |
178 | AC_DEFUN([CURL_CHECK_HEADER_WINDOWS], [ | |
14c8b455 | 179 | AC_CACHE_CHECK([for windows.h], [curl_cv_header_windows_h], [ |
51581c03 | 180 | AC_COMPILE_IFELSE([ |
862049c4 | 181 | AC_LANG_PROGRAM([[ |
a6a5bba0 | 182 | #undef inline |
74ed5b5e | 183 | #ifndef WIN32_LEAN_AND_MEAN |
51581c03 | 184 | #define WIN32_LEAN_AND_MEAN |
74ed5b5e | 185 | #endif |
51581c03 | 186 | #include <windows.h> |
862049c4 | 187 | ]],[[ |
2748c64d | 188 | #if defined(__CYGWIN__) || defined(__CEGCC__) |
bc2f0c7d YT |
189 | HAVE_WINDOWS_H shall not be defined. |
190 | #else | |
51581c03 | 191 | int dummy=2*WINVER; |
bc2f0c7d | 192 | #endif |
862049c4 | 193 | ]]) |
51581c03 | 194 | ],[ |
14c8b455 | 195 | curl_cv_header_windows_h="yes" |
51581c03 | 196 | ],[ |
14c8b455 | 197 | curl_cv_header_windows_h="no" |
51581c03 YT |
198 | ]) |
199 | ]) | |
14c8b455 | 200 | case "$curl_cv_header_windows_h" in |
8ef454dc YT |
201 | yes) |
202 | AC_DEFINE_UNQUOTED(HAVE_WINDOWS_H, 1, | |
203 | [Define to 1 if you have the windows.h header file.]) | |
8ef454dc YT |
204 | ;; |
205 | esac | |
51581c03 YT |
206 | ]) |
207 | ||
208 | ||
5e06ec84 YT |
209 | dnl CURL_CHECK_NATIVE_WINDOWS |
210 | dnl ------------------------------------------------- | |
211 | dnl Check if building a native Windows target | |
212 | ||
213 | AC_DEFUN([CURL_CHECK_NATIVE_WINDOWS], [ | |
214 | AC_REQUIRE([CURL_CHECK_HEADER_WINDOWS])dnl | |
14c8b455 IA |
215 | AC_CACHE_CHECK([whether build target is a native Windows one], [curl_cv_native_windows], [ |
216 | if test "$curl_cv_header_windows_h" = "no"; then | |
217 | curl_cv_native_windows="no" | |
5e06ec84 YT |
218 | else |
219 | AC_COMPILE_IFELSE([ | |
862049c4 YT |
220 | AC_LANG_PROGRAM([[ |
221 | ]],[[ | |
b39d1e9b YT |
222 | #if defined(__MINGW32__) || defined(__MINGW32CE__) || \ |
223 | (defined(_MSC_VER) && (defined(_WIN32) || defined(_WIN64))) | |
5e06ec84 YT |
224 | int dummy=1; |
225 | #else | |
226 | Not a native Windows build target. | |
227 | #endif | |
862049c4 | 228 | ]]) |
5e06ec84 | 229 | ],[ |
14c8b455 | 230 | curl_cv_native_windows="yes" |
5e06ec84 | 231 | ],[ |
14c8b455 | 232 | curl_cv_native_windows="no" |
5e06ec84 YT |
233 | ]) |
234 | fi | |
235 | ]) | |
14c8b455 | 236 | AM_CONDITIONAL(DOING_NATIVE_WINDOWS, test "x$curl_cv_native_windows" = xyes) |
5e06ec84 YT |
237 | ]) |
238 | ||
239 | ||
51581c03 YT |
240 | dnl CURL_CHECK_HEADER_WINSOCK2 |
241 | dnl ------------------------------------------------- | |
a07bc791 | 242 | dnl Check for compilable and valid winsock2.h header |
51581c03 YT |
243 | |
244 | AC_DEFUN([CURL_CHECK_HEADER_WINSOCK2], [ | |
245 | AC_REQUIRE([CURL_CHECK_HEADER_WINDOWS])dnl | |
14c8b455 | 246 | AC_CACHE_CHECK([for winsock2.h], [curl_cv_header_winsock2_h], [ |
51581c03 | 247 | AC_COMPILE_IFELSE([ |
862049c4 | 248 | AC_LANG_PROGRAM([[ |
a6a5bba0 | 249 | #undef inline |
74ed5b5e | 250 | #ifndef WIN32_LEAN_AND_MEAN |
51581c03 | 251 | #define WIN32_LEAN_AND_MEAN |
74ed5b5e | 252 | #endif |
51581c03 YT |
253 | #include <windows.h> |
254 | #include <winsock2.h> | |
862049c4 | 255 | ]],[[ |
2748c64d | 256 | #if defined(__CYGWIN__) || defined(__CEGCC__) || defined(__MINGW32CE__) |
bc2f0c7d YT |
257 | HAVE_WINSOCK2_H shall not be defined. |
258 | #else | |
51581c03 | 259 | int dummy=2*IPPROTO_ESP; |
bc2f0c7d | 260 | #endif |
862049c4 | 261 | ]]) |
51581c03 | 262 | ],[ |
14c8b455 | 263 | curl_cv_header_winsock2_h="yes" |
51581c03 | 264 | ],[ |
14c8b455 | 265 | curl_cv_header_winsock2_h="no" |
51581c03 YT |
266 | ]) |
267 | ]) | |
14c8b455 | 268 | case "$curl_cv_header_winsock2_h" in |
8ef454dc YT |
269 | yes) |
270 | AC_DEFINE_UNQUOTED(HAVE_WINSOCK2_H, 1, | |
271 | [Define to 1 if you have the winsock2.h header file.]) | |
272 | ;; | |
273 | esac | |
51581c03 YT |
274 | ]) |
275 | ||
276 | ||
277 | dnl CURL_CHECK_HEADER_WS2TCPIP | |
278 | dnl ------------------------------------------------- | |
b9f39c27 | 279 | dnl Check for compilable and valid ws2tcpip.h header |
51581c03 YT |
280 | |
281 | AC_DEFUN([CURL_CHECK_HEADER_WS2TCPIP], [ | |
282 | AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK2])dnl | |
14c8b455 | 283 | AC_CACHE_CHECK([for ws2tcpip.h], [curl_cv_header_ws2tcpip_h], [ |
51581c03 | 284 | AC_COMPILE_IFELSE([ |
862049c4 | 285 | AC_LANG_PROGRAM([[ |
a6a5bba0 | 286 | #undef inline |
74ed5b5e | 287 | #ifndef WIN32_LEAN_AND_MEAN |
51581c03 | 288 | #define WIN32_LEAN_AND_MEAN |
74ed5b5e | 289 | #endif |
51581c03 YT |
290 | #include <windows.h> |
291 | #include <winsock2.h> | |
292 | #include <ws2tcpip.h> | |
862049c4 | 293 | ]],[[ |
2748c64d | 294 | #if defined(__CYGWIN__) || defined(__CEGCC__) || defined(__MINGW32CE__) |
bc2f0c7d YT |
295 | HAVE_WS2TCPIP_H shall not be defined. |
296 | #else | |
51581c03 | 297 | int dummy=2*IP_PKTINFO; |
bc2f0c7d | 298 | #endif |
862049c4 | 299 | ]]) |
51581c03 | 300 | ],[ |
14c8b455 | 301 | curl_cv_header_ws2tcpip_h="yes" |
51581c03 | 302 | ],[ |
14c8b455 | 303 | curl_cv_header_ws2tcpip_h="no" |
51581c03 YT |
304 | ]) |
305 | ]) | |
14c8b455 | 306 | case "$curl_cv_header_ws2tcpip_h" in |
8ef454dc YT |
307 | yes) |
308 | AC_DEFINE_UNQUOTED(HAVE_WS2TCPIP_H, 1, | |
309 | [Define to 1 if you have the ws2tcpip.h header file.]) | |
310 | ;; | |
311 | esac | |
51581c03 YT |
312 | ]) |
313 | ||
314 | ||
cc615f48 MH |
315 | dnl CURL_CHECK_HEADER_WINCRYPT |
316 | dnl ------------------------------------------------- | |
317 | dnl Check for compilable and valid wincrypt.h header | |
318 | ||
319 | AC_DEFUN([CURL_CHECK_HEADER_WINCRYPT], [ | |
320 | AC_REQUIRE([CURL_CHECK_HEADER_WINDOWS])dnl | |
321 | AC_CACHE_CHECK([for wincrypt.h], [curl_cv_header_wincrypt_h], [ | |
322 | AC_COMPILE_IFELSE([ | |
323 | AC_LANG_PROGRAM([[ | |
324 | #undef inline | |
325 | #ifndef WIN32_LEAN_AND_MEAN | |
326 | #define WIN32_LEAN_AND_MEAN | |
327 | #endif | |
328 | #include <windows.h> | |
329 | #include <wincrypt.h> | |
330 | ]],[[ | |
331 | int dummy=2*PROV_RSA_FULL; | |
332 | ]]) | |
333 | ],[ | |
334 | curl_cv_header_wincrypt_h="yes" | |
335 | ],[ | |
336 | curl_cv_header_wincrypt_h="no" | |
337 | ]) | |
338 | ]) | |
339 | case "$curl_cv_header_wincrypt_h" in | |
340 | yes) | |
341 | AC_DEFINE_UNQUOTED(HAVE_WINCRYPT_H, 1, | |
342 | [Define to 1 if you have the wincrypt.h header file.]) | |
343 | ;; | |
344 | esac | |
345 | ]) | |
346 | ||
347 | ||
07625fe2 YT |
348 | dnl CURL_CHECK_HEADER_WINLDAP |
349 | dnl ------------------------------------------------- | |
350 | dnl Check for compilable and valid winldap.h header | |
351 | ||
352 | AC_DEFUN([CURL_CHECK_HEADER_WINLDAP], [ | |
353 | AC_REQUIRE([CURL_CHECK_HEADER_WINDOWS])dnl | |
14c8b455 | 354 | AC_CACHE_CHECK([for winldap.h], [curl_cv_header_winldap_h], [ |
07625fe2 | 355 | AC_COMPILE_IFELSE([ |
862049c4 | 356 | AC_LANG_PROGRAM([[ |
07625fe2 | 357 | #undef inline |
fbb5518a | 358 | #ifdef HAVE_WINDOWS_H |
07625fe2 YT |
359 | #ifndef WIN32_LEAN_AND_MEAN |
360 | #define WIN32_LEAN_AND_MEAN | |
361 | #endif | |
362 | #include <windows.h> | |
fbb5518a | 363 | #endif |
07625fe2 | 364 | #include <winldap.h> |
862049c4 | 365 | ]],[[ |
7358db5c | 366 | #if defined(__CYGWIN__) || defined(__CEGCC__) |
07625fe2 YT |
367 | HAVE_WINLDAP_H shall not be defined. |
368 | #else | |
369 | LDAP *ldp = ldap_init("dummy", LDAP_PORT); | |
370 | ULONG res = ldap_unbind(ldp); | |
371 | #endif | |
862049c4 | 372 | ]]) |
07625fe2 | 373 | ],[ |
14c8b455 | 374 | curl_cv_header_winldap_h="yes" |
07625fe2 | 375 | ],[ |
14c8b455 | 376 | curl_cv_header_winldap_h="no" |
07625fe2 YT |
377 | ]) |
378 | ]) | |
14c8b455 | 379 | case "$curl_cv_header_winldap_h" in |
07625fe2 YT |
380 | yes) |
381 | AC_DEFINE_UNQUOTED(HAVE_WINLDAP_H, 1, | |
382 | [Define to 1 if you have the winldap.h header file.]) | |
383 | ;; | |
384 | esac | |
385 | ]) | |
386 | ||
387 | ||
a171f60b YT |
388 | dnl CURL_CHECK_HEADER_LBER |
389 | dnl ------------------------------------------------- | |
390 | dnl Check for compilable and valid lber.h header, | |
391 | dnl and check if it is needed even with ldap.h | |
392 | ||
393 | AC_DEFUN([CURL_CHECK_HEADER_LBER], [ | |
394 | AC_REQUIRE([CURL_CHECK_HEADER_WINDOWS])dnl | |
14c8b455 | 395 | AC_CACHE_CHECK([for lber.h], [curl_cv_header_lber_h], [ |
a171f60b | 396 | AC_COMPILE_IFELSE([ |
862049c4 | 397 | AC_LANG_PROGRAM([[ |
a171f60b YT |
398 | #undef inline |
399 | #ifdef HAVE_WINDOWS_H | |
400 | #ifndef WIN32_LEAN_AND_MEAN | |
401 | #define WIN32_LEAN_AND_MEAN | |
402 | #endif | |
403 | #include <windows.h> | |
404 | #else | |
405 | #ifdef HAVE_SYS_TYPES_H | |
406 | #include <sys/types.h> | |
407 | #endif | |
408 | #endif | |
fbb5518a YT |
409 | #ifndef NULL |
410 | #define NULL (void *)0 | |
411 | #endif | |
a171f60b | 412 | #include <lber.h> |
862049c4 | 413 | ]],[[ |
a171f60b YT |
414 | BerValue *bvp = NULL; |
415 | BerElement *bep = ber_init(bvp); | |
416 | ber_free(bep, 1); | |
862049c4 | 417 | ]]) |
a171f60b | 418 | ],[ |
14c8b455 | 419 | curl_cv_header_lber_h="yes" |
a171f60b | 420 | ],[ |
14c8b455 | 421 | curl_cv_header_lber_h="no" |
a171f60b YT |
422 | ]) |
423 | ]) | |
14c8b455 | 424 | if test "$curl_cv_header_lber_h" = "yes"; then |
a171f60b YT |
425 | AC_DEFINE_UNQUOTED(HAVE_LBER_H, 1, |
426 | [Define to 1 if you have the lber.h header file.]) | |
427 | # | |
428 | AC_COMPILE_IFELSE([ | |
862049c4 | 429 | AC_LANG_PROGRAM([[ |
a171f60b YT |
430 | #undef inline |
431 | #ifdef HAVE_WINDOWS_H | |
432 | #ifndef WIN32_LEAN_AND_MEAN | |
433 | #define WIN32_LEAN_AND_MEAN | |
434 | #endif | |
435 | #include <windows.h> | |
436 | #else | |
437 | #ifdef HAVE_SYS_TYPES_H | |
438 | #include <sys/types.h> | |
439 | #endif | |
440 | #endif | |
fbb5518a YT |
441 | #ifndef NULL |
442 | #define NULL (void *)0 | |
443 | #endif | |
a171f60b YT |
444 | #ifndef LDAP_DEPRECATED |
445 | #define LDAP_DEPRECATED 1 | |
446 | #endif | |
447 | #include <ldap.h> | |
862049c4 | 448 | ]],[[ |
a171f60b YT |
449 | BerValue *bvp = NULL; |
450 | BerElement *bep = ber_init(bvp); | |
451 | ber_free(bep, 1); | |
862049c4 | 452 | ]]) |
a171f60b YT |
453 | ],[ |
454 | curl_cv_need_header_lber_h="no" | |
455 | ],[ | |
456 | curl_cv_need_header_lber_h="yes" | |
457 | ]) | |
458 | # | |
459 | case "$curl_cv_need_header_lber_h" in | |
460 | yes) | |
461 | AC_DEFINE_UNQUOTED(NEED_LBER_H, 1, | |
462 | [Define to 1 if you need the lber.h header file even with ldap.h]) | |
463 | ;; | |
464 | esac | |
465 | fi | |
466 | ]) | |
467 | ||
468 | ||
469 | dnl CURL_CHECK_HEADER_LDAP | |
470 | dnl ------------------------------------------------- | |
471 | dnl Check for compilable and valid ldap.h header | |
472 | ||
473 | AC_DEFUN([CURL_CHECK_HEADER_LDAP], [ | |
474 | AC_REQUIRE([CURL_CHECK_HEADER_LBER])dnl | |
14c8b455 | 475 | AC_CACHE_CHECK([for ldap.h], [curl_cv_header_ldap_h], [ |
a171f60b | 476 | AC_COMPILE_IFELSE([ |
862049c4 | 477 | AC_LANG_PROGRAM([[ |
a171f60b YT |
478 | #undef inline |
479 | #ifdef HAVE_WINDOWS_H | |
480 | #ifndef WIN32_LEAN_AND_MEAN | |
481 | #define WIN32_LEAN_AND_MEAN | |
482 | #endif | |
483 | #include <windows.h> | |
484 | #else | |
485 | #ifdef HAVE_SYS_TYPES_H | |
486 | #include <sys/types.h> | |
487 | #endif | |
488 | #endif | |
489 | #ifndef LDAP_DEPRECATED | |
490 | #define LDAP_DEPRECATED 1 | |
491 | #endif | |
492 | #ifdef NEED_LBER_H | |
493 | #include <lber.h> | |
494 | #endif | |
495 | #include <ldap.h> | |
862049c4 | 496 | ]],[[ |
a171f60b YT |
497 | LDAP *ldp = ldap_init("dummy", LDAP_PORT); |
498 | int res = ldap_unbind(ldp); | |
862049c4 | 499 | ]]) |
a171f60b | 500 | ],[ |
14c8b455 | 501 | curl_cv_header_ldap_h="yes" |
a171f60b | 502 | ],[ |
14c8b455 | 503 | curl_cv_header_ldap_h="no" |
a171f60b YT |
504 | ]) |
505 | ]) | |
14c8b455 | 506 | case "$curl_cv_header_ldap_h" in |
a171f60b YT |
507 | yes) |
508 | AC_DEFINE_UNQUOTED(HAVE_LDAP_H, 1, | |
509 | [Define to 1 if you have the ldap.h header file.]) | |
510 | ;; | |
511 | esac | |
512 | ]) | |
513 | ||
514 | ||
515 | dnl CURL_CHECK_HEADER_LDAP_SSL | |
516 | dnl ------------------------------------------------- | |
517 | dnl Check for compilable and valid ldap_ssl.h header | |
518 | ||
519 | AC_DEFUN([CURL_CHECK_HEADER_LDAP_SSL], [ | |
520 | AC_REQUIRE([CURL_CHECK_HEADER_LDAP])dnl | |
14c8b455 | 521 | AC_CACHE_CHECK([for ldap_ssl.h], [curl_cv_header_ldap_ssl_h], [ |
a171f60b | 522 | AC_COMPILE_IFELSE([ |
862049c4 | 523 | AC_LANG_PROGRAM([[ |
a171f60b YT |
524 | #undef inline |
525 | #ifdef HAVE_WINDOWS_H | |
526 | #ifndef WIN32_LEAN_AND_MEAN | |
527 | #define WIN32_LEAN_AND_MEAN | |
528 | #endif | |
529 | #include <windows.h> | |
530 | #else | |
531 | #ifdef HAVE_SYS_TYPES_H | |
532 | #include <sys/types.h> | |
533 | #endif | |
534 | #endif | |
535 | #ifndef LDAP_DEPRECATED | |
536 | #define LDAP_DEPRECATED 1 | |
537 | #endif | |
538 | #ifdef NEED_LBER_H | |
539 | #include <lber.h> | |
540 | #endif | |
541 | #ifdef HAVE_LDAP_H | |
542 | #include <ldap.h> | |
543 | #endif | |
544 | #include <ldap_ssl.h> | |
862049c4 | 545 | ]],[[ |
a171f60b | 546 | LDAP *ldp = ldapssl_init("dummy", LDAPS_PORT, 1); |
862049c4 | 547 | ]]) |
a171f60b | 548 | ],[ |
14c8b455 | 549 | curl_cv_header_ldap_ssl_h="yes" |
a171f60b | 550 | ],[ |
14c8b455 | 551 | curl_cv_header_ldap_ssl_h="no" |
a171f60b YT |
552 | ]) |
553 | ]) | |
14c8b455 | 554 | case "$curl_cv_header_ldap_ssl_h" in |
a171f60b YT |
555 | yes) |
556 | AC_DEFINE_UNQUOTED(HAVE_LDAP_SSL_H, 1, | |
557 | [Define to 1 if you have the ldap_ssl.h header file.]) | |
558 | ;; | |
559 | esac | |
560 | ]) | |
561 | ||
562 | ||
e8d3710a YT |
563 | dnl CURL_CHECK_LIBS_WINLDAP |
564 | dnl ------------------------------------------------- | |
565 | dnl Check for libraries needed for WINLDAP support, | |
566 | dnl and prepended to LIBS any needed libraries. | |
567 | dnl This macro can take an optional parameter with a | |
2aac895f | 568 | dnl whitespace separated list of libraries to check |
e8d3710a YT |
569 | dnl before the WINLDAP default ones. |
570 | ||
571 | AC_DEFUN([CURL_CHECK_LIBS_WINLDAP], [ | |
572 | AC_REQUIRE([CURL_CHECK_HEADER_WINBER])dnl | |
573 | # | |
574 | AC_MSG_CHECKING([for WINLDAP libraries]) | |
575 | # | |
576 | u_libs="" | |
577 | # | |
578 | ifelse($1,,,[ | |
579 | for x_lib in $1; do | |
580 | case "$x_lib" in | |
581 | -l*) | |
582 | l_lib="$x_lib" | |
583 | ;; | |
584 | *) | |
585 | l_lib="-l$x_lib" | |
586 | ;; | |
587 | esac | |
588 | if test -z "$u_libs"; then | |
589 | u_libs="$l_lib" | |
590 | else | |
591 | u_libs="$u_libs $l_lib" | |
592 | fi | |
593 | done | |
594 | ]) | |
595 | # | |
edef367e | 596 | curl_cv_save_LIBS="$LIBS" |
e8d3710a YT |
597 | curl_cv_ldap_LIBS="unknown" |
598 | # | |
599 | for x_nlibs in '' "$u_libs" \ | |
600 | '-lwldap32' ; do | |
24d41452 YT |
601 | if test "$curl_cv_ldap_LIBS" = "unknown"; then |
602 | if test -z "$x_nlibs"; then | |
603 | LIBS="$curl_cv_save_LIBS" | |
604 | else | |
605 | LIBS="$x_nlibs $curl_cv_save_LIBS" | |
606 | fi | |
607 | AC_LINK_IFELSE([ | |
608 | AC_LANG_PROGRAM([[ | |
e8d3710a YT |
609 | #undef inline |
610 | #ifdef HAVE_WINDOWS_H | |
611 | #ifndef WIN32_LEAN_AND_MEAN | |
612 | #define WIN32_LEAN_AND_MEAN | |
613 | #endif | |
614 | #include <windows.h> | |
615 | #ifdef HAVE_WINLDAP_H | |
616 | #include <winldap.h> | |
617 | #endif | |
618 | #ifdef HAVE_WINBER_H | |
619 | #include <winber.h> | |
620 | #endif | |
621 | #endif | |
24d41452 YT |
622 | ]],[[ |
623 | BERVAL *bvp = NULL; | |
624 | BerElement *bep = ber_init(bvp); | |
625 | LDAP *ldp = ldap_init("dummy", LDAP_PORT); | |
626 | ULONG res = ldap_unbind(ldp); | |
627 | ber_free(bep, 1); | |
628 | ]]) | |
629 | ],[ | |
630 | curl_cv_ldap_LIBS="$x_nlibs" | |
631 | ]) | |
632 | fi | |
e8d3710a YT |
633 | done |
634 | # | |
edef367e | 635 | LIBS="$curl_cv_save_LIBS" |
e8d3710a YT |
636 | # |
637 | case X-"$curl_cv_ldap_LIBS" in | |
638 | X-unknown) | |
639 | AC_MSG_RESULT([cannot find WINLDAP libraries]) | |
640 | ;; | |
641 | X-) | |
642 | AC_MSG_RESULT([no additional lib required]) | |
643 | ;; | |
644 | *) | |
645 | if test -z "$curl_cv_save_LIBS"; then | |
646 | LIBS="$curl_cv_ldap_LIBS" | |
647 | else | |
648 | LIBS="$curl_cv_ldap_LIBS $curl_cv_save_LIBS" | |
649 | fi | |
650 | AC_MSG_RESULT([$curl_cv_ldap_LIBS]) | |
651 | ;; | |
652 | esac | |
653 | # | |
654 | ]) | |
655 | ||
656 | ||
4db954f8 YT |
657 | dnl CURL_CHECK_LIBS_LDAP |
658 | dnl ------------------------------------------------- | |
659 | dnl Check for libraries needed for LDAP support, | |
660 | dnl and prepended to LIBS any needed libraries. | |
5360f883 | 661 | dnl This macro can take an optional parameter with a |
2aac895f | 662 | dnl whitespace separated list of libraries to check |
5360f883 | 663 | dnl before the default ones. |
4db954f8 YT |
664 | |
665 | AC_DEFUN([CURL_CHECK_LIBS_LDAP], [ | |
666 | AC_REQUIRE([CURL_CHECK_HEADER_LDAP])dnl | |
667 | # | |
e8d3710a YT |
668 | AC_MSG_CHECKING([for LDAP libraries]) |
669 | # | |
5360f883 | 670 | u_libs="" |
420ea83e YT |
671 | # |
672 | ifelse($1,,,[ | |
673 | for x_lib in $1; do | |
674 | case "$x_lib" in | |
675 | -l*) | |
676 | l_lib="$x_lib" | |
677 | ;; | |
678 | *) | |
679 | l_lib="-l$x_lib" | |
680 | ;; | |
681 | esac | |
682 | if test -z "$u_libs"; then | |
683 | u_libs="$l_lib" | |
684 | else | |
685 | u_libs="$u_libs $l_lib" | |
686 | fi | |
687 | done | |
688 | ]) | |
5360f883 | 689 | # |
edef367e | 690 | curl_cv_save_LIBS="$LIBS" |
4db954f8 YT |
691 | curl_cv_ldap_LIBS="unknown" |
692 | # | |
e8d3710a | 693 | for x_nlibs in '' "$u_libs" \ |
5360f883 | 694 | '-lldap' \ |
5360f883 | 695 | '-lldap -llber' \ |
c5343848 | 696 | '-llber -lldap' \ |
5360f883 | 697 | '-lldapssl -lldapx -lldapsdk' \ |
66637b4d MF |
698 | '-lldapsdk -lldapx -lldapssl' \ |
699 | '-lldap -llber -lssl -lcrypto' ; do | |
700 | ||
24d41452 YT |
701 | if test "$curl_cv_ldap_LIBS" = "unknown"; then |
702 | if test -z "$x_nlibs"; then | |
703 | LIBS="$curl_cv_save_LIBS" | |
704 | else | |
705 | LIBS="$x_nlibs $curl_cv_save_LIBS" | |
706 | fi | |
707 | AC_LINK_IFELSE([ | |
708 | AC_LANG_PROGRAM([[ | |
4db954f8 YT |
709 | #undef inline |
710 | #ifdef HAVE_WINDOWS_H | |
711 | #ifndef WIN32_LEAN_AND_MEAN | |
712 | #define WIN32_LEAN_AND_MEAN | |
713 | #endif | |
714 | #include <windows.h> | |
715 | #else | |
716 | #ifdef HAVE_SYS_TYPES_H | |
717 | #include <sys/types.h> | |
718 | #endif | |
719 | #endif | |
fbb5518a YT |
720 | #ifndef NULL |
721 | #define NULL (void *)0 | |
722 | #endif | |
4db954f8 YT |
723 | #ifndef LDAP_DEPRECATED |
724 | #define LDAP_DEPRECATED 1 | |
725 | #endif | |
726 | #ifdef NEED_LBER_H | |
727 | #include <lber.h> | |
728 | #endif | |
729 | #ifdef HAVE_LDAP_H | |
730 | #include <ldap.h> | |
001a2d9b | 731 | #endif |
24d41452 YT |
732 | ]],[[ |
733 | BerValue *bvp = NULL; | |
734 | BerElement *bep = ber_init(bvp); | |
735 | LDAP *ldp = ldap_init("dummy", LDAP_PORT); | |
736 | int res = ldap_unbind(ldp); | |
737 | ber_free(bep, 1); | |
738 | ]]) | |
739 | ],[ | |
740 | curl_cv_ldap_LIBS="$x_nlibs" | |
741 | ]) | |
742 | fi | |
4db954f8 YT |
743 | done |
744 | # | |
edef367e | 745 | LIBS="$curl_cv_save_LIBS" |
4db954f8 YT |
746 | # |
747 | case X-"$curl_cv_ldap_LIBS" in | |
748 | X-unknown) | |
95446f69 | 749 | AC_MSG_RESULT([cannot find LDAP libraries]) |
4db954f8 YT |
750 | ;; |
751 | X-) | |
752 | AC_MSG_RESULT([no additional lib required]) | |
753 | ;; | |
754 | *) | |
755 | if test -z "$curl_cv_save_LIBS"; then | |
756 | LIBS="$curl_cv_ldap_LIBS" | |
757 | else | |
758 | LIBS="$curl_cv_ldap_LIBS $curl_cv_save_LIBS" | |
759 | fi | |
760 | AC_MSG_RESULT([$curl_cv_ldap_LIBS]) | |
761 | ;; | |
762 | esac | |
763 | # | |
764 | ]) | |
765 | ||
766 | ||
bec19771 YT |
767 | dnl TYPE_SOCKADDR_STORAGE |
768 | dnl ------------------------------------------------- | |
a07bc791 | 769 | dnl Check for struct sockaddr_storage. Most IPv6-enabled |
bec19771 YT |
770 | dnl hosts have it, but AIX 4.3 is one known exception. |
771 | ||
772 | AC_DEFUN([TYPE_SOCKADDR_STORAGE], | |
773 | [ | |
774 | AC_CHECK_TYPE([struct sockaddr_storage], | |
775 | AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE, 1, | |
776 | [if struct sockaddr_storage is defined]), , | |
777 | [ | |
778 | #undef inline | |
779 | #ifdef HAVE_WINDOWS_H | |
780 | #ifndef WIN32_LEAN_AND_MEAN | |
781 | #define WIN32_LEAN_AND_MEAN | |
782 | #endif | |
783 | #include <windows.h> | |
784 | #ifdef HAVE_WINSOCK2_H | |
785 | #include <winsock2.h> | |
786 | #endif | |
787 | #else | |
788 | #ifdef HAVE_SYS_TYPES_H | |
789 | #include <sys/types.h> | |
790 | #endif | |
791 | #ifdef HAVE_SYS_SOCKET_H | |
792 | #include <sys/socket.h> | |
793 | #endif | |
794 | #ifdef HAVE_NETINET_IN_H | |
795 | #include <netinet/in.h> | |
796 | #endif | |
797 | #ifdef HAVE_ARPA_INET_H | |
798 | #include <arpa/inet.h> | |
799 | #endif | |
800 | #endif | |
801 | ]) | |
802 | ]) | |
803 | ||
01fa02d0 YT |
804 | dnl CURL_CHECK_FUNC_RECV |
805 | dnl ------------------------------------------------- | |
a07bc791 | 806 | dnl Test if the socket recv() function is available, |
01fa02d0 YT |
807 | |
808 | AC_DEFUN([CURL_CHECK_FUNC_RECV], [ | |
bc2f0c7d | 809 | AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK2])dnl |
c6631e82 | 810 | AC_REQUIRE([CURL_INCLUDES_BSDSOCKET])dnl |
8ef454dc | 811 | AC_CHECK_HEADERS(sys/types.h sys/socket.h) |
01fa02d0 YT |
812 | # |
813 | AC_MSG_CHECKING([for recv]) | |
d70f3374 | 814 | AC_LINK_IFELSE([ |
862049c4 | 815 | AC_LANG_PROGRAM([[ |
a07bc791 | 816 | #undef inline |
bc2f0c7d YT |
817 | #ifdef HAVE_WINDOWS_H |
818 | #ifndef WIN32_LEAN_AND_MEAN | |
819 | #define WIN32_LEAN_AND_MEAN | |
820 | #endif | |
821 | #include <windows.h> | |
822 | #ifdef HAVE_WINSOCK2_H | |
823 | #include <winsock2.h> | |
bc2f0c7d YT |
824 | #endif |
825 | #else | |
c6631e82 | 826 | $curl_includes_bsdsocket |
01fa02d0 YT |
827 | #ifdef HAVE_SYS_TYPES_H |
828 | #include <sys/types.h> | |
829 | #endif | |
830 | #ifdef HAVE_SYS_SOCKET_H | |
831 | #include <sys/socket.h> | |
bc2f0c7d | 832 | #endif |
01fa02d0 | 833 | #endif |
862049c4 | 834 | ]],[[ |
01fa02d0 | 835 | recv(0, 0, 0, 0); |
862049c4 | 836 | ]]) |
d70f3374 YT |
837 | ],[ |
838 | AC_MSG_RESULT([yes]) | |
839 | curl_cv_recv="yes" | |
840 | ],[ | |
841 | AC_MSG_RESULT([no]) | |
842 | curl_cv_recv="no" | |
01fa02d0 YT |
843 | ]) |
844 | # | |
845 | if test "$curl_cv_recv" = "yes"; then | |
01fa02d0 YT |
846 | AC_DEFINE_UNQUOTED(HAVE_RECV, 1, |
847 | [Define to 1 if you have the recv function.]) | |
d9f3b365 | 848 | curl_cv_func_recv="yes" |
7240acde YT |
849 | else |
850 | AC_MSG_ERROR([Unable to link function recv]) | |
01fa02d0 | 851 | fi |
2d15d84a | 852 | ]) |
01fa02d0 YT |
853 | |
854 | ||
855 | dnl CURL_CHECK_FUNC_SEND | |
856 | dnl ------------------------------------------------- | |
a07bc791 | 857 | dnl Test if the socket send() function is available, |
01fa02d0 YT |
858 | |
859 | AC_DEFUN([CURL_CHECK_FUNC_SEND], [ | |
bc2f0c7d | 860 | AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK2])dnl |
c6631e82 | 861 | AC_REQUIRE([CURL_INCLUDES_BSDSOCKET])dnl |
8ef454dc | 862 | AC_CHECK_HEADERS(sys/types.h sys/socket.h) |
01fa02d0 YT |
863 | # |
864 | AC_MSG_CHECKING([for send]) | |
d70f3374 | 865 | AC_LINK_IFELSE([ |
862049c4 | 866 | AC_LANG_PROGRAM([[ |
a07bc791 | 867 | #undef inline |
bc2f0c7d YT |
868 | #ifdef HAVE_WINDOWS_H |
869 | #ifndef WIN32_LEAN_AND_MEAN | |
870 | #define WIN32_LEAN_AND_MEAN | |
871 | #endif | |
872 | #include <windows.h> | |
873 | #ifdef HAVE_WINSOCK2_H | |
874 | #include <winsock2.h> | |
bc2f0c7d YT |
875 | #endif |
876 | #else | |
c6631e82 | 877 | $curl_includes_bsdsocket |
01fa02d0 YT |
878 | #ifdef HAVE_SYS_TYPES_H |
879 | #include <sys/types.h> | |
880 | #endif | |
881 | #ifdef HAVE_SYS_SOCKET_H | |
882 | #include <sys/socket.h> | |
bc2f0c7d | 883 | #endif |
01fa02d0 | 884 | #endif |
862049c4 | 885 | ]],[[ |
01fa02d0 | 886 | send(0, 0, 0, 0); |
862049c4 | 887 | ]]) |
d70f3374 YT |
888 | ],[ |
889 | AC_MSG_RESULT([yes]) | |
890 | curl_cv_send="yes" | |
891 | ],[ | |
892 | AC_MSG_RESULT([no]) | |
893 | curl_cv_send="no" | |
01fa02d0 YT |
894 | ]) |
895 | # | |
896 | if test "$curl_cv_send" = "yes"; then | |
eb33ccd5 DS |
897 | AC_DEFINE_UNQUOTED(HAVE_SEND, 1, |
898 | [Define to 1 if you have the send function.]) | |
899 | curl_cv_func_send="yes" | |
7240acde YT |
900 | else |
901 | AC_MSG_ERROR([Unable to link function send]) | |
01fa02d0 | 902 | fi |
2d15d84a | 903 | ]) |
01fa02d0 | 904 | |
77b3bc23 YT |
905 | dnl CURL_CHECK_MSG_NOSIGNAL |
906 | dnl ------------------------------------------------- | |
907 | dnl Check for MSG_NOSIGNAL | |
908 | ||
909 | AC_DEFUN([CURL_CHECK_MSG_NOSIGNAL], [ | |
910 | AC_CHECK_HEADERS(sys/types.h sys/socket.h) | |
14c8b455 | 911 | AC_CACHE_CHECK([for MSG_NOSIGNAL], [curl_cv_msg_nosignal], [ |
77b3bc23 | 912 | AC_COMPILE_IFELSE([ |
862049c4 | 913 | AC_LANG_PROGRAM([[ |
a07bc791 | 914 | #undef inline |
ae8a01ea YT |
915 | #ifdef HAVE_WINDOWS_H |
916 | #ifndef WIN32_LEAN_AND_MEAN | |
917 | #define WIN32_LEAN_AND_MEAN | |
918 | #endif | |
919 | #include <windows.h> | |
920 | #ifdef HAVE_WINSOCK2_H | |
921 | #include <winsock2.h> | |
ae8a01ea YT |
922 | #endif |
923 | #else | |
77b3bc23 YT |
924 | #ifdef HAVE_SYS_TYPES_H |
925 | #include <sys/types.h> | |
926 | #endif | |
927 | #ifdef HAVE_SYS_SOCKET_H | |
928 | #include <sys/socket.h> | |
ae8a01ea | 929 | #endif |
77b3bc23 | 930 | #endif |
862049c4 | 931 | ]],[[ |
77b3bc23 | 932 | int flag=MSG_NOSIGNAL; |
862049c4 | 933 | ]]) |
77b3bc23 | 934 | ],[ |
14c8b455 | 935 | curl_cv_msg_nosignal="yes" |
77b3bc23 | 936 | ],[ |
14c8b455 | 937 | curl_cv_msg_nosignal="no" |
77b3bc23 YT |
938 | ]) |
939 | ]) | |
14c8b455 | 940 | case "$curl_cv_msg_nosignal" in |
77b3bc23 YT |
941 | yes) |
942 | AC_DEFINE_UNQUOTED(HAVE_MSG_NOSIGNAL, 1, | |
943 | [Define to 1 if you have the MSG_NOSIGNAL flag.]) | |
944 | ;; | |
945 | esac | |
2d15d84a | 946 | ]) |
77b3bc23 YT |
947 | |
948 | ||
32ac4ede YT |
949 | dnl CURL_CHECK_STRUCT_TIMEVAL |
950 | dnl ------------------------------------------------- | |
951 | dnl Check for timeval struct | |
952 | ||
953 | AC_DEFUN([CURL_CHECK_STRUCT_TIMEVAL], [ | |
32ac4ede | 954 | AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK2])dnl |
eaa1d732 | 955 | AC_CHECK_HEADERS(sys/types.h sys/time.h sys/socket.h) |
14c8b455 | 956 | AC_CACHE_CHECK([for struct timeval], [curl_cv_struct_timeval], [ |
32ac4ede | 957 | AC_COMPILE_IFELSE([ |
862049c4 | 958 | AC_LANG_PROGRAM([[ |
a07bc791 | 959 | #undef inline |
32ac4ede YT |
960 | #ifdef HAVE_WINDOWS_H |
961 | #ifndef WIN32_LEAN_AND_MEAN | |
962 | #define WIN32_LEAN_AND_MEAN | |
963 | #endif | |
964 | #include <windows.h> | |
965 | #ifdef HAVE_WINSOCK2_H | |
966 | #include <winsock2.h> | |
32ac4ede YT |
967 | #endif |
968 | #endif | |
969 | #ifdef HAVE_SYS_TYPES_H | |
970 | #include <sys/types.h> | |
971 | #endif | |
972 | #ifdef HAVE_SYS_TIME_H | |
973 | #include <sys/time.h> | |
32ac4ede | 974 | #endif |
32ac4ede | 975 | #include <time.h> |
61a96709 YT |
976 | #ifdef HAVE_SYS_SOCKET_H |
977 | #include <sys/socket.h> | |
32ac4ede | 978 | #endif |
862049c4 | 979 | ]],[[ |
32ac4ede YT |
980 | struct timeval ts; |
981 | ts.tv_sec = 0; | |
982 | ts.tv_usec = 0; | |
862049c4 | 983 | ]]) |
32ac4ede | 984 | ],[ |
14c8b455 | 985 | curl_cv_struct_timeval="yes" |
32ac4ede | 986 | ],[ |
14c8b455 | 987 | curl_cv_struct_timeval="no" |
32ac4ede YT |
988 | ]) |
989 | ]) | |
14c8b455 | 990 | case "$curl_cv_struct_timeval" in |
32ac4ede YT |
991 | yes) |
992 | AC_DEFINE_UNQUOTED(HAVE_STRUCT_TIMEVAL, 1, | |
993 | [Define to 1 if you have the timeval struct.]) | |
994 | ;; | |
995 | esac | |
2d15d84a | 996 | ]) |
73226415 YT |
997 | |
998 | ||
74ed5b5e YT |
999 | dnl TYPE_IN_ADDR_T |
1000 | dnl ------------------------------------------------- | |
d09b4369 | 1001 | dnl Check for in_addr_t: it is used to receive the return code of inet_addr() |
ef355196 | 1002 | dnl and a few other things. |
24d41452 YT |
1003 | |
1004 | AC_DEFUN([TYPE_IN_ADDR_T], [ | |
1005 | AC_CHECK_TYPE([in_addr_t], ,[ | |
1006 | dnl in_addr_t not available | |
1007 | AC_CACHE_CHECK([for in_addr_t equivalent], | |
1008 | [curl_cv_in_addr_t_equiv], [ | |
1009 | curl_cv_in_addr_t_equiv="unknown" | |
1010 | for t in "unsigned long" int size_t unsigned long; do | |
1011 | if test "$curl_cv_in_addr_t_equiv" = "unknown"; then | |
1012 | AC_LINK_IFELSE([ | |
1013 | AC_LANG_PROGRAM([[ | |
74ed5b5e YT |
1014 | #undef inline |
1015 | #ifdef HAVE_WINDOWS_H | |
1016 | #ifndef WIN32_LEAN_AND_MEAN | |
1017 | #define WIN32_LEAN_AND_MEAN | |
1018 | #endif | |
1019 | #include <windows.h> | |
1020 | #ifdef HAVE_WINSOCK2_H | |
1021 | #include <winsock2.h> | |
74ed5b5e YT |
1022 | #endif |
1023 | #else | |
1024 | #ifdef HAVE_SYS_TYPES_H | |
1025 | #include <sys/types.h> | |
1026 | #endif | |
1027 | #ifdef HAVE_SYS_SOCKET_H | |
1028 | #include <sys/socket.h> | |
1029 | #endif | |
1030 | #ifdef HAVE_NETINET_IN_H | |
1031 | #include <netinet/in.h> | |
1032 | #endif | |
f4481685 YT |
1033 | #ifdef HAVE_ARPA_INET_H |
1034 | #include <arpa/inet.h> | |
1035 | #endif | |
74ed5b5e | 1036 | #endif |
24d41452 YT |
1037 | ]],[[ |
1038 | $t data = inet_addr ("1.2.3.4"); | |
1039 | ]]) | |
1040 | ],[ | |
1041 | curl_cv_in_addr_t_equiv="$t" | |
1042 | ]) | |
1043 | fi | |
1044 | done | |
1045 | ]) | |
1046 | case "$curl_cv_in_addr_t_equiv" in | |
1047 | unknown) | |
1048 | AC_MSG_ERROR([Cannot find a type to use in place of in_addr_t]) | |
1049 | ;; | |
1050 | *) | |
1051 | AC_DEFINE_UNQUOTED(in_addr_t, $curl_cv_in_addr_t_equiv, | |
1052 | [Type to use in place of in_addr_t when system does not provide it.]) | |
1053 | ;; | |
1054 | esac | |
1055 | ],[ | |
74ed5b5e YT |
1056 | #undef inline |
1057 | #ifdef HAVE_WINDOWS_H | |
1058 | #ifndef WIN32_LEAN_AND_MEAN | |
1059 | #define WIN32_LEAN_AND_MEAN | |
1060 | #endif | |
1061 | #include <windows.h> | |
1062 | #ifdef HAVE_WINSOCK2_H | |
1063 | #include <winsock2.h> | |
74ed5b5e YT |
1064 | #endif |
1065 | #else | |
1066 | #ifdef HAVE_SYS_TYPES_H | |
1067 | #include <sys/types.h> | |
1068 | #endif | |
1069 | #ifdef HAVE_SYS_SOCKET_H | |
d2203896 | 1070 | #include <sys/socket.h> |
74ed5b5e YT |
1071 | #endif |
1072 | #ifdef HAVE_NETINET_IN_H | |
1073 | #include <netinet/in.h> | |
1074 | #endif | |
f4481685 YT |
1075 | #ifdef HAVE_ARPA_INET_H |
1076 | #include <arpa/inet.h> | |
1077 | #endif | |
74ed5b5e | 1078 | #endif |
2d15d84a YT |
1079 | ]) |
1080 | ]) | |
d09b4369 | 1081 | |
24d41452 | 1082 | |
ed80eb5b | 1083 | dnl CURL_CHECK_FUNC_CLOCK_GETTIME_MONOTONIC |
b380dd03 | 1084 | dnl ------------------------------------------------- |
ed80eb5b | 1085 | dnl Check if monotonic clock_gettime is available. |
b380dd03 | 1086 | |
ed80eb5b | 1087 | AC_DEFUN([CURL_CHECK_FUNC_CLOCK_GETTIME_MONOTONIC], [ |
eaa1d732 | 1088 | AC_CHECK_HEADERS(sys/types.h sys/time.h) |
97333deb | 1089 | AC_MSG_CHECKING([for monotonic clock_gettime]) |
cee21eb6 | 1090 | # |
905f493b | 1091 | if test "x$dontwant_rt" = "xno" ; then |
cee21eb6 MF |
1092 | AC_COMPILE_IFELSE([ |
1093 | AC_LANG_PROGRAM([[ | |
b380dd03 YT |
1094 | #ifdef HAVE_SYS_TYPES_H |
1095 | #include <sys/types.h> | |
1096 | #endif | |
1097 | #ifdef HAVE_SYS_TIME_H | |
1098 | #include <sys/time.h> | |
b380dd03 | 1099 | #endif |
b380dd03 | 1100 | #include <time.h> |
cee21eb6 MF |
1101 | ]],[[ |
1102 | struct timespec ts; | |
1103 | (void)clock_gettime(CLOCK_MONOTONIC, &ts); | |
1104 | ]]) | |
1105 | ],[ | |
1106 | AC_MSG_RESULT([yes]) | |
68c83b46 | 1107 | curl_func_clock_gettime="yes" |
cee21eb6 MF |
1108 | ],[ |
1109 | AC_MSG_RESULT([no]) | |
68c83b46 | 1110 | curl_func_clock_gettime="no" |
cee21eb6 MF |
1111 | ]) |
1112 | fi | |
97333deb YT |
1113 | dnl Definition of HAVE_CLOCK_GETTIME_MONOTONIC is intentionally postponed |
1114 | dnl until library linking and run-time checks for clock_gettime succeed. | |
2d15d84a | 1115 | ]) |
ed80eb5b | 1116 | |
24d41452 | 1117 | |
ed80eb5b YT |
1118 | dnl CURL_CHECK_LIBS_CLOCK_GETTIME_MONOTONIC |
1119 | dnl ------------------------------------------------- | |
1120 | dnl If monotonic clock_gettime is available then, | |
1121 | dnl check and prepended to LIBS any needed libraries. | |
1122 | ||
1123 | AC_DEFUN([CURL_CHECK_LIBS_CLOCK_GETTIME_MONOTONIC], [ | |
1124 | AC_REQUIRE([CURL_CHECK_FUNC_CLOCK_GETTIME_MONOTONIC])dnl | |
b380dd03 | 1125 | # |
68c83b46 | 1126 | if test "$curl_func_clock_gettime" = "yes"; then |
ed80eb5b YT |
1127 | # |
1128 | AC_MSG_CHECKING([for clock_gettime in libraries]) | |
1129 | # | |
1130 | curl_cv_save_LIBS="$LIBS" | |
1131 | curl_cv_gclk_LIBS="unknown" | |
1132 | # | |
1133 | for x_xlibs in '' '-lrt' '-lposix4' ; do | |
24d41452 YT |
1134 | if test "$curl_cv_gclk_LIBS" = "unknown"; then |
1135 | if test -z "$x_xlibs"; then | |
1136 | LIBS="$curl_cv_save_LIBS" | |
1137 | else | |
1138 | LIBS="$x_xlibs $curl_cv_save_LIBS" | |
1139 | fi | |
1140 | AC_LINK_IFELSE([ | |
1141 | AC_LANG_PROGRAM([[ | |
ed80eb5b YT |
1142 | #ifdef HAVE_SYS_TYPES_H |
1143 | #include <sys/types.h> | |
1144 | #endif | |
1145 | #ifdef HAVE_SYS_TIME_H | |
1146 | #include <sys/time.h> | |
ed80eb5b | 1147 | #endif |
ed80eb5b | 1148 | #include <time.h> |
24d41452 YT |
1149 | ]],[[ |
1150 | struct timespec ts; | |
1151 | (void)clock_gettime(CLOCK_MONOTONIC, &ts); | |
1152 | ]]) | |
1153 | ],[ | |
1154 | curl_cv_gclk_LIBS="$x_xlibs" | |
1155 | ]) | |
1156 | fi | |
ed80eb5b YT |
1157 | done |
1158 | # | |
1159 | LIBS="$curl_cv_save_LIBS" | |
1160 | # | |
1161 | case X-"$curl_cv_gclk_LIBS" in | |
1162 | X-unknown) | |
1163 | AC_MSG_RESULT([cannot find clock_gettime]) | |
1164 | AC_MSG_WARN([HAVE_CLOCK_GETTIME_MONOTONIC will not be defined]) | |
68c83b46 | 1165 | curl_func_clock_gettime="no" |
ed80eb5b YT |
1166 | ;; |
1167 | X-) | |
1168 | AC_MSG_RESULT([no additional lib required]) | |
68c83b46 | 1169 | curl_func_clock_gettime="yes" |
ed80eb5b YT |
1170 | ;; |
1171 | *) | |
1172 | if test -z "$curl_cv_save_LIBS"; then | |
1173 | LIBS="$curl_cv_gclk_LIBS" | |
1174 | else | |
1175 | LIBS="$curl_cv_gclk_LIBS $curl_cv_save_LIBS" | |
1176 | fi | |
1177 | AC_MSG_RESULT([$curl_cv_gclk_LIBS]) | |
68c83b46 | 1178 | curl_func_clock_gettime="yes" |
ed80eb5b YT |
1179 | ;; |
1180 | esac | |
1181 | # | |
1058e5fd YT |
1182 | dnl only do runtime verification when not cross-compiling |
1183 | if test "x$cross_compiling" != "xyes" && | |
68c83b46 | 1184 | test "$curl_func_clock_gettime" = "yes"; then |
1058e5fd | 1185 | AC_MSG_CHECKING([if monotonic clock_gettime works]) |
5616c1df | 1186 | CURL_RUN_IFELSE([ |
1058e5fd | 1187 | AC_LANG_PROGRAM([[ |
0abaf224 YT |
1188 | #ifdef HAVE_STDLIB_H |
1189 | #include <stdlib.h> | |
1190 | #endif | |
1058e5fd YT |
1191 | #ifdef HAVE_SYS_TYPES_H |
1192 | #include <sys/types.h> | |
1193 | #endif | |
1058e5fd YT |
1194 | #ifdef HAVE_SYS_TIME_H |
1195 | #include <sys/time.h> | |
1058e5fd | 1196 | #endif |
1058e5fd | 1197 | #include <time.h> |
1058e5fd | 1198 | ]],[[ |
1058e5fd YT |
1199 | struct timespec ts; |
1200 | if (0 == clock_gettime(CLOCK_MONOTONIC, &ts)) | |
1201 | exit(0); | |
97333deb YT |
1202 | else |
1203 | exit(1); | |
1058e5fd YT |
1204 | ]]) |
1205 | ],[ | |
1206 | AC_MSG_RESULT([yes]) | |
1207 | ],[ | |
1208 | AC_MSG_RESULT([no]) | |
1209 | AC_MSG_WARN([HAVE_CLOCK_GETTIME_MONOTONIC will not be defined]) | |
68c83b46 | 1210 | curl_func_clock_gettime="no" |
1058e5fd YT |
1211 | LIBS="$curl_cv_save_LIBS" |
1212 | ]) | |
1213 | fi | |
1214 | # | |
68c83b46 | 1215 | case "$curl_func_clock_gettime" in |
ed80eb5b YT |
1216 | yes) |
1217 | AC_DEFINE_UNQUOTED(HAVE_CLOCK_GETTIME_MONOTONIC, 1, | |
1218 | [Define to 1 if you have the clock_gettime function and monotonic timer.]) | |
1219 | ;; | |
1220 | esac | |
1221 | # | |
1222 | fi | |
b380dd03 | 1223 | # |
2d15d84a | 1224 | ]) |
b380dd03 | 1225 | |
9346e55d | 1226 | |
1ff4e900 YT |
1227 | dnl CURL_CHECK_LIBS_CONNECT |
1228 | dnl ------------------------------------------------- | |
1229 | dnl Verify if network connect function is already available | |
1230 | dnl using current libraries or if another one is required. | |
1231 | ||
1232 | AC_DEFUN([CURL_CHECK_LIBS_CONNECT], [ | |
e96a9190 | 1233 | AC_REQUIRE([CURL_INCLUDES_WINSOCK2])dnl |
1e853653 | 1234 | AC_REQUIRE([CURL_INCLUDES_BSDSOCKET])dnl |
1ff4e900 YT |
1235 | AC_MSG_CHECKING([for connect in libraries]) |
1236 | tst_connect_save_LIBS="$LIBS" | |
1237 | tst_connect_need_LIBS="unknown" | |
1238 | for tst_lib in '' '-lsocket' ; do | |
1239 | if test "$tst_connect_need_LIBS" = "unknown"; then | |
1240 | LIBS="$tst_lib $tst_connect_save_LIBS" | |
1241 | AC_LINK_IFELSE([ | |
1242 | AC_LANG_PROGRAM([[ | |
e96a9190 | 1243 | $curl_includes_winsock2 |
1e853653 CY |
1244 | $curl_includes_bsdsocket |
1245 | #if !defined(HAVE_WINDOWS_H) && !defined(HAVE_PROTO_BSDSOCKET_H) | |
e96a9190 YT |
1246 | int connect(int, void*, int); |
1247 | #endif | |
1ff4e900 YT |
1248 | ]],[[ |
1249 | if(0 != connect(0, 0, 0)) | |
1250 | return 1; | |
1251 | ]]) | |
1252 | ],[ | |
1253 | tst_connect_need_LIBS="$tst_lib" | |
1254 | ]) | |
1255 | fi | |
1256 | done | |
1257 | LIBS="$tst_connect_save_LIBS" | |
1258 | # | |
1259 | case X-"$tst_connect_need_LIBS" in | |
1260 | X-unknown) | |
1261 | AC_MSG_RESULT([cannot find connect]) | |
1262 | AC_MSG_ERROR([cannot find connect function in libraries.]) | |
1263 | ;; | |
1264 | X-) | |
1265 | AC_MSG_RESULT([yes]) | |
1266 | ;; | |
1267 | *) | |
1268 | AC_MSG_RESULT([$tst_connect_need_LIBS]) | |
1269 | LIBS="$tst_connect_need_LIBS $tst_connect_save_LIBS" | |
1270 | ;; | |
1271 | esac | |
1272 | ]) | |
1273 | ||
1274 | ||
25648963 YT |
1275 | dnl CURL_DEFINE_UNQUOTED (VARIABLE, [VALUE]) |
1276 | dnl ------------------------------------------------- | |
1277 | dnl Like AC_DEFINE_UNQUOTED this macro will define a C preprocessor | |
1278 | dnl symbol that can be further used in custom template configuration | |
1279 | dnl files. This macro, unlike AC_DEFINE_UNQUOTED, does not use a third | |
1280 | dnl argument for the description. Symbol definitions done with this | |
1281 | dnl macro are intended to be exclusively used in handcrafted *.h.in | |
1282 | dnl template files. Contrary to what AC_DEFINE_UNQUOTED does, this one | |
1283 | dnl prevents autoheader generation and insertion of symbol template | |
1284 | dnl stub and definition into the first configuration header file. Do | |
1285 | dnl not use this macro as a replacement for AC_DEFINE_UNQUOTED, each | |
1286 | dnl one serves different functional needs. | |
1287 | ||
1288 | AC_DEFUN([CURL_DEFINE_UNQUOTED], [ | |
1289 | cat >>confdefs.h <<_EOF | |
1290 | [@%:@define] $1 ifelse($#, 2, [$2], 1) | |
1291 | _EOF | |
1292 | ]) | |
1293 | ||
665adcd4 YT |
1294 | dnl CURL_CONFIGURE_PULL_SYS_POLL |
1295 | dnl ------------------------------------------------- | |
665adcd4 YT |
1296 | dnl The need for the sys/poll.h inclusion arises mainly to properly |
1297 | dnl interface AIX systems which define macros 'events' and 'revents'. | |
1298 | ||
1299 | AC_DEFUN([CURL_CONFIGURE_PULL_SYS_POLL], [ | |
1300 | AC_REQUIRE([CURL_INCLUDES_POLL])dnl | |
1301 | # | |
1302 | tst_poll_events_macro_defined="unknown" | |
1303 | # | |
1304 | AC_COMPILE_IFELSE([ | |
1305 | AC_LANG_PROGRAM([[ | |
1306 | $curl_includes_poll | |
1307 | ]],[[ | |
1308 | #if defined(events) || defined(revents) | |
1309 | return 0; | |
1310 | #else | |
1311 | force compilation error | |
1312 | #endif | |
1313 | ]]) | |
1314 | ],[ | |
1315 | tst_poll_events_macro_defined="yes" | |
1316 | ],[ | |
1317 | tst_poll_events_macro_defined="no" | |
1318 | ]) | |
1319 | # | |
1320 | if test "$tst_poll_events_macro_defined" = "yes"; then | |
1321 | if test "x$ac_cv_header_sys_poll_h" = "xyes"; then | |
1322 | CURL_DEFINE_UNQUOTED([CURL_PULL_SYS_POLL_H]) | |
1323 | fi | |
1324 | fi | |
1325 | # | |
1326 | ]) | |
1327 | ||
1328 | ||
9346e55d YT |
1329 | dnl CURL_CHECK_FUNC_SELECT |
1330 | dnl ------------------------------------------------- | |
eb33ccd5 | 1331 | dnl Test if the socket select() function is available. |
9346e55d YT |
1332 | |
1333 | AC_DEFUN([CURL_CHECK_FUNC_SELECT], [ | |
1334 | AC_REQUIRE([CURL_CHECK_STRUCT_TIMEVAL])dnl | |
c6631e82 | 1335 | AC_REQUIRE([CURL_INCLUDES_BSDSOCKET])dnl |
9346e55d YT |
1336 | AC_CHECK_HEADERS(sys/select.h sys/socket.h) |
1337 | # | |
1338 | AC_MSG_CHECKING([for select]) | |
d70f3374 | 1339 | AC_LINK_IFELSE([ |
862049c4 | 1340 | AC_LANG_PROGRAM([[ |
9346e55d YT |
1341 | #undef inline |
1342 | #ifdef HAVE_WINDOWS_H | |
1343 | #ifndef WIN32_LEAN_AND_MEAN | |
1344 | #define WIN32_LEAN_AND_MEAN | |
1345 | #endif | |
1346 | #include <windows.h> | |
1347 | #ifdef HAVE_WINSOCK2_H | |
1348 | #include <winsock2.h> | |
9346e55d YT |
1349 | #endif |
1350 | #endif | |
1351 | #ifdef HAVE_SYS_TYPES_H | |
1352 | #include <sys/types.h> | |
1353 | #endif | |
1354 | #ifdef HAVE_SYS_TIME_H | |
1355 | #include <sys/time.h> | |
9346e55d | 1356 | #endif |
9346e55d | 1357 | #include <time.h> |
9346e55d YT |
1358 | #ifndef HAVE_WINDOWS_H |
1359 | #ifdef HAVE_SYS_SELECT_H | |
1360 | #include <sys/select.h> | |
7a71965e HS |
1361 | #elif defined(HAVE_UNISTD_H) |
1362 | #include <unistd.h> | |
9346e55d YT |
1363 | #endif |
1364 | #ifdef HAVE_SYS_SOCKET_H | |
1365 | #include <sys/socket.h> | |
1366 | #endif | |
c6631e82 | 1367 | $curl_includes_bsdsocket |
9346e55d | 1368 | #endif |
862049c4 | 1369 | ]],[[ |
9346e55d | 1370 | select(0, 0, 0, 0, 0); |
862049c4 | 1371 | ]]) |
d70f3374 YT |
1372 | ],[ |
1373 | AC_MSG_RESULT([yes]) | |
1374 | curl_cv_select="yes" | |
1375 | ],[ | |
1376 | AC_MSG_RESULT([no]) | |
1377 | curl_cv_select="no" | |
9346e55d YT |
1378 | ]) |
1379 | # | |
1380 | if test "$curl_cv_select" = "yes"; then | |
eb33ccd5 DS |
1381 | AC_DEFINE_UNQUOTED(HAVE_SELECT, 1, |
1382 | [Define to 1 if you have the select function.]) | |
1383 | curl_cv_func_select="yes" | |
9346e55d | 1384 | fi |
2d15d84a | 1385 | ]) |
9346e55d YT |
1386 | |
1387 | ||
67e8d229 DS |
1388 | dnl CURL_VERIFY_RUNTIMELIBS |
1389 | dnl ------------------------------------------------- | |
1390 | dnl Verify that the shared libs found so far can be used when running | |
1391 | dnl programs, since otherwise the situation will create odd configure errors | |
1392 | dnl that are misleading people. | |
1393 | dnl | |
1394 | dnl Make sure this test is run BEFORE the first test in the script that | |
1395 | dnl runs anything, which at the time of this writing is the AC_CHECK_SIZEOF | |
1396 | dnl macro. It must also run AFTER all lib-checking macros are complete. | |
1397 | ||
1398 | AC_DEFUN([CURL_VERIFY_RUNTIMELIBS], [ | |
1399 | ||
1400 | dnl this test is of course not sensible if we are cross-compiling! | |
1401 | if test "x$cross_compiling" != xyes; then | |
1402 | ||
1403 | dnl just run a program to verify that the libs checked for previous to this | |
1404 | dnl point also is available run-time! | |
1405 | AC_MSG_CHECKING([run-time libs availability]) | |
302d5374 | 1406 | CURL_RUN_IFELSE([ |
d5c03510 | 1407 | int main() |
67e8d229 DS |
1408 | { |
1409 | return 0; | |
1410 | } | |
1411 | ], | |
1412 | AC_MSG_RESULT([fine]), | |
1413 | AC_MSG_RESULT([failed]) | |
1414 | AC_MSG_ERROR([one or more libs available at link-time are not available run-time. Libs used at link-time: $LIBS]) | |
1415 | ) | |
1416 | ||
1417 | dnl if this test fails, configure has already stopped | |
1418 | fi | |
1419 | ]) | |
273b2b23 YT |
1420 | |
1421 | ||
1422 | dnl CURL_CHECK_VARIADIC_MACROS | |
1423 | dnl ------------------------------------------------- | |
1424 | dnl Check compiler support of variadic macros | |
1425 | ||
1426 | AC_DEFUN([CURL_CHECK_VARIADIC_MACROS], [ | |
1427 | AC_CACHE_CHECK([for compiler support of C99 variadic macro style], | |
1428 | [curl_cv_variadic_macros_c99], [ | |
1429 | AC_COMPILE_IFELSE([ | |
862049c4 | 1430 | AC_LANG_PROGRAM([[ |
273b2b23 YT |
1431 | #define c99_vmacro3(first, ...) fun3(first, __VA_ARGS__) |
1432 | #define c99_vmacro2(first, ...) fun2(first, __VA_ARGS__) | |
1433 | int fun3(int arg1, int arg2, int arg3); | |
1434 | int fun2(int arg1, int arg2); | |
1435 | int fun3(int arg1, int arg2, int arg3) | |
1436 | { return arg1 + arg2 + arg3; } | |
1437 | int fun2(int arg1, int arg2) | |
1438 | { return arg1 + arg2; } | |
862049c4 | 1439 | ]],[[ |
273b2b23 YT |
1440 | int res3 = c99_vmacro3(1, 2, 3); |
1441 | int res2 = c99_vmacro2(1, 2); | |
862049c4 | 1442 | ]]) |
273b2b23 YT |
1443 | ],[ |
1444 | curl_cv_variadic_macros_c99="yes" | |
1445 | ],[ | |
1446 | curl_cv_variadic_macros_c99="no" | |
1447 | ]) | |
1448 | ]) | |
1449 | case "$curl_cv_variadic_macros_c99" in | |
1450 | yes) | |
1451 | AC_DEFINE_UNQUOTED(HAVE_VARIADIC_MACROS_C99, 1, | |
1452 | [Define to 1 if compiler supports C99 variadic macro style.]) | |
1453 | ;; | |
1454 | esac | |
1455 | AC_CACHE_CHECK([for compiler support of old gcc variadic macro style], | |
1456 | [curl_cv_variadic_macros_gcc], [ | |
1457 | AC_COMPILE_IFELSE([ | |
862049c4 | 1458 | AC_LANG_PROGRAM([[ |
273b2b23 YT |
1459 | #define gcc_vmacro3(first, args...) fun3(first, args) |
1460 | #define gcc_vmacro2(first, args...) fun2(first, args) | |
1461 | int fun3(int arg1, int arg2, int arg3); | |
1462 | int fun2(int arg1, int arg2); | |
1463 | int fun3(int arg1, int arg2, int arg3) | |
1464 | { return arg1 + arg2 + arg3; } | |
1465 | int fun2(int arg1, int arg2) | |
1466 | { return arg1 + arg2; } | |
862049c4 | 1467 | ]],[[ |
2288094b YT |
1468 | int res3 = gcc_vmacro3(1, 2, 3); |
1469 | int res2 = gcc_vmacro2(1, 2); | |
862049c4 | 1470 | ]]) |
273b2b23 YT |
1471 | ],[ |
1472 | curl_cv_variadic_macros_gcc="yes" | |
1473 | ],[ | |
1474 | curl_cv_variadic_macros_gcc="no" | |
1475 | ]) | |
1476 | ]) | |
1477 | case "$curl_cv_variadic_macros_gcc" in | |
1478 | yes) | |
1479 | AC_DEFINE_UNQUOTED(HAVE_VARIADIC_MACROS_GCC, 1, | |
1480 | [Define to 1 if compiler supports old gcc variadic macro style.]) | |
1481 | ;; | |
1482 | esac | |
1483 | ]) | |
d8d3dc93 YT |
1484 | |
1485 | ||
fb23b857 DS |
1486 | dnl CURL_CHECK_CA_BUNDLE |
1487 | dnl ------------------------------------------------- | |
1488 | dnl Check if a default ca-bundle should be used | |
1489 | dnl | |
1490 | dnl regarding the paths this will scan: | |
1491 | dnl /etc/ssl/certs/ca-certificates.crt Debian systems | |
1492 | dnl /etc/pki/tls/certs/ca-bundle.crt Redhat and Mandriva | |
1493 | dnl /usr/share/ssl/certs/ca-bundle.crt old(er) Redhat | |
18480f71 LH |
1494 | dnl /usr/local/share/certs/ca-root-nss.crt FreeBSD, MidnightBSD |
1495 | dnl /etc/ssl/cert.pem OpenBSD, FreeBSD, MidnightBSD (symlink) | |
86cbb232 | 1496 | dnl /etc/ssl/certs/ (ca path) SUSE |
fb23b857 DS |
1497 | |
1498 | AC_DEFUN([CURL_CHECK_CA_BUNDLE], [ | |
1499 | ||
86cbb232 | 1500 | AC_MSG_CHECKING([default CA cert bundle/path]) |
fb23b857 DS |
1501 | |
1502 | AC_ARG_WITH(ca-bundle, | |
a59f0461 | 1503 | AS_HELP_STRING([--with-ca-bundle=FILE], |
3ae77f07 | 1504 | [Path to a file containing CA certificates (example: /etc/ca-bundle.crt)]) |
a59f0461 | 1505 | AS_HELP_STRING([--without-ca-bundle], [Don't use a default CA bundle]), |
fb23b857 | 1506 | [ |
86cbb232 MM |
1507 | want_ca="$withval" |
1508 | if test "x$want_ca" = "xyes"; then | |
1509 | AC_MSG_ERROR([--with-ca-bundle=FILE requires a path to the CA bundle]) | |
fb23b857 | 1510 | fi |
86cbb232 MM |
1511 | ], |
1512 | [ want_ca="unset" ]) | |
1513 | AC_ARG_WITH(ca-path, | |
a59f0461 | 1514 | AS_HELP_STRING([--with-ca-path=DIRECTORY], |
3ae77f07 | 1515 | [Path to a directory containing CA certificates stored individually, with \ |
52d302ed DS |
1516 | their filenames in a hash format. This option can be used with the OpenSSL, \ |
1517 | GnuTLS and mbedTLS backends. Refer to OpenSSL c_rehash for details. \ | |
3ae77f07 | 1518 | (example: /etc/certificates)]) |
a59f0461 | 1519 | AS_HELP_STRING([--without-ca-path], [Don't use a default CA path]), |
86cbb232 MM |
1520 | [ |
1521 | want_capath="$withval" | |
1522 | if test "x$want_capath" = "xyes"; then | |
1523 | AC_MSG_ERROR([--with-ca-path=DIRECTORY requires a path to the CA path directory]) | |
1524 | fi | |
1525 | ], | |
1526 | [ want_capath="unset"]) | |
1527 | ||
3ae77f07 JS |
1528 | ca_warning=" (warning: certs not found)" |
1529 | capath_warning=" (warning: certs not found)" | |
1530 | check_capath="" | |
1531 | ||
86cbb232 MM |
1532 | if test "x$want_ca" != "xno" -a "x$want_ca" != "xunset" -a \ |
1533 | "x$want_capath" != "xno" -a "x$want_capath" != "xunset"; then | |
1534 | dnl both given | |
90314100 JO |
1535 | ca="$want_ca" |
1536 | capath="$want_capath" | |
86cbb232 MM |
1537 | elif test "x$want_ca" != "xno" -a "x$want_ca" != "xunset"; then |
1538 | dnl --with-ca-bundle given | |
1539 | ca="$want_ca" | |
1540 | capath="no" | |
1541 | elif test "x$want_capath" != "xno" -a "x$want_capath" != "xunset"; then | |
1542 | dnl --with-ca-path given | |
52d302ed DS |
1543 | if test "x$OPENSSL_ENABLED" != "x1" -a "x$GNUTLS_ENABLED" != "x1" -a "x$MBEDTLS_ENABLED" != "x1"; then |
1544 | AC_MSG_ERROR([--with-ca-path only works with OpenSSL, GnuTLS or mbedTLS]) | |
86cbb232 MM |
1545 | fi |
1546 | capath="$want_capath" | |
1547 | ca="no" | |
073b03fa | 1548 | else |
86cbb232 MM |
1549 | dnl first try autodetecting a CA bundle , then a CA path |
1550 | dnl both autodetections can be skipped by --without-ca-* | |
1551 | ca="no" | |
1552 | capath="no" | |
073b03fa DS |
1553 | if test "x$cross_compiling" != "xyes"; then |
1554 | dnl NOT cross-compiling and... | |
1555 | dnl neither of the --with-ca-* options are provided | |
1556 | if test "x$want_ca" = "xunset"; then | |
1557 | dnl the path we previously would have installed the curl ca bundle | |
1558 | dnl to, and thus we now check for an already existing cert in that | |
1559 | dnl place in case we find no other | |
1560 | if test "x$prefix" != xNONE; then | |
1561 | cac="${prefix}/share/curl/curl-ca-bundle.crt" | |
1562 | else | |
1563 | cac="$ac_default_prefix/share/curl/curl-ca-bundle.crt" | |
86cbb232 | 1564 | fi |
073b03fa DS |
1565 | |
1566 | for a in /etc/ssl/certs/ca-certificates.crt \ | |
1567 | /etc/pki/tls/certs/ca-bundle.crt \ | |
1568 | /usr/share/ssl/certs/ca-bundle.crt \ | |
d61c8051 | 1569 | /usr/local/share/certs/ca-root-nss.crt \ |
073b03fa DS |
1570 | /etc/ssl/cert.pem \ |
1571 | "$cac"; do | |
1572 | if test -f "$a"; then | |
1573 | ca="$a" | |
1574 | break | |
1575 | fi | |
1576 | done | |
1577 | fi | |
1578 | if test "x$want_capath" = "xunset" -a "x$ca" = "xno" -a \ | |
1579 | "x$OPENSSL_ENABLED" = "x1"; then | |
3ae77f07 | 1580 | check_capath="/etc/ssl/certs/" |
073b03fa DS |
1581 | fi |
1582 | else | |
1583 | dnl no option given and cross-compiling | |
1584 | AC_MSG_WARN([skipped the ca-cert path detection when cross-compiling]) | |
86cbb232 MM |
1585 | fi |
1586 | fi | |
a07bc791 | 1587 | |
3ae77f07 JS |
1588 | if test "x$ca" = "xno" || test -f "$ca"; then |
1589 | ca_warning="" | |
1590 | fi | |
1591 | ||
1592 | if test "x$capath" != "xno"; then | |
1593 | check_capath="$capath" | |
1594 | fi | |
1595 | ||
1596 | if test ! -z "$check_capath"; then | |
1597 | for a in "$check_capath"; do | |
1598 | 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 | |
1599 | if test "x$capath" = "xno"; then | |
1600 | capath="$a" | |
1601 | fi | |
1602 | capath_warning="" | |
1603 | break | |
1604 | fi | |
1605 | done | |
1606 | fi | |
1607 | ||
1608 | if test "x$capath" = "xno"; then | |
1609 | capath_warning="" | |
1610 | fi | |
1611 | ||
fb23b857 DS |
1612 | if test "x$ca" != "xno"; then |
1613 | CURL_CA_BUNDLE='"'$ca'"' | |
d13be06a | 1614 | AC_DEFINE_UNQUOTED(CURL_CA_BUNDLE, "$ca", [Location of default ca bundle]) |
c1a71ad1 | 1615 | AC_SUBST(CURL_CA_BUNDLE) |
86cbb232 | 1616 | AC_MSG_RESULT([$ca]) |
90314100 JO |
1617 | fi |
1618 | if test "x$capath" != "xno"; then | |
86cbb232 | 1619 | CURL_CA_PATH="\"$capath\"" |
d13be06a | 1620 | AC_DEFINE_UNQUOTED(CURL_CA_PATH, "$capath", [Location of default ca path]) |
86cbb232 | 1621 | AC_MSG_RESULT([$capath (capath)]) |
90314100 | 1622 | fi |
4335b86a | 1623 | if test "x$ca" = "xno" && test "x$capath" = "xno"; then |
86cbb232 | 1624 | AC_MSG_RESULT([no]) |
fb23b857 | 1625 | fi |
7b55279d LN |
1626 | |
1627 | AC_MSG_CHECKING([whether to use builtin CA store of SSL library]) | |
1628 | AC_ARG_WITH(ca-fallback, | |
a59f0461 DS |
1629 | AS_HELP_STRING([--with-ca-fallback], [Use the built in CA store of the SSL library]) |
1630 | AS_HELP_STRING([--without-ca-fallback], [Don't use the built in CA store of the SSL library]), | |
7b55279d LN |
1631 | [ |
1632 | if test "x$with_ca_fallback" != "xyes" -a "x$with_ca_fallback" != "xno"; then | |
1633 | AC_MSG_ERROR([--with-ca-fallback only allows yes or no as parameter]) | |
1634 | fi | |
1635 | ], | |
1636 | [ with_ca_fallback="no"]) | |
1637 | AC_MSG_RESULT([$with_ca_fallback]) | |
1638 | if test "x$with_ca_fallback" = "xyes"; then | |
1639 | if test "x$OPENSSL_ENABLED" != "x1" -a "x$GNUTLS_ENABLED" != "x1"; then | |
1640 | AC_MSG_ERROR([--with-ca-fallback only works with OpenSSL or GnuTLS]) | |
1641 | fi | |
1642 | AC_DEFINE_UNQUOTED(CURL_CA_FALLBACK, 1, [define "1" to use built in CA store of SSL library ]) | |
1643 | fi | |
fb23b857 | 1644 | ]) |
9cef14df | 1645 | |
fef60d9d YT |
1646 | dnl CURL_CHECK_WIN32_LARGEFILE |
1647 | dnl ------------------------------------------------- | |
1648 | dnl Check if curl's WIN32 large file will be used | |
1649 | ||
1650 | AC_DEFUN([CURL_CHECK_WIN32_LARGEFILE], [ | |
1651 | AC_REQUIRE([CURL_CHECK_HEADER_WINDOWS])dnl | |
1652 | AC_MSG_CHECKING([whether build target supports WIN32 file API]) | |
1653 | curl_win32_file_api="no" | |
14c8b455 | 1654 | if test "$curl_cv_header_windows_h" = "yes"; then |
fef60d9d YT |
1655 | if test x"$enable_largefile" != "xno"; then |
1656 | AC_COMPILE_IFELSE([ | |
1657 | AC_LANG_PROGRAM([[ | |
1658 | ]],[[ | |
1659 | #if !defined(_WIN32_WCE) && \ | |
1660 | (defined(__MINGW32__) || \ | |
1661 | (defined(_MSC_VER) && (defined(_WIN32) || defined(_WIN64)))) | |
1662 | int dummy=1; | |
1663 | #else | |
1664 | WIN32 large file API not supported. | |
1665 | #endif | |
1666 | ]]) | |
1667 | ],[ | |
1668 | curl_win32_file_api="win32_large_files" | |
1669 | ]) | |
1670 | fi | |
1671 | if test "$curl_win32_file_api" = "no"; then | |
1672 | AC_COMPILE_IFELSE([ | |
1673 | AC_LANG_PROGRAM([[ | |
1674 | ]],[[ | |
1675 | #if defined(_WIN32_WCE) || defined(__MINGW32__) || defined(_MSC_VER) | |
1676 | int dummy=1; | |
1677 | #else | |
1678 | WIN32 small file API not supported. | |
1679 | #endif | |
1680 | ]]) | |
1681 | ],[ | |
1682 | curl_win32_file_api="win32_small_files" | |
1683 | ]) | |
1684 | fi | |
1685 | fi | |
1686 | case "$curl_win32_file_api" in | |
1687 | win32_large_files) | |
1688 | AC_MSG_RESULT([yes (large file enabled)]) | |
1689 | AC_DEFINE_UNQUOTED(USE_WIN32_LARGE_FILES, 1, | |
1690 | [Define to 1 if you are building a Windows target with large file support.]) | |
cc615f48 | 1691 | AC_SUBST(USE_WIN32_LARGE_FILES, [1]) |
fef60d9d YT |
1692 | ;; |
1693 | win32_small_files) | |
1694 | AC_MSG_RESULT([yes (large file disabled)]) | |
7fcbdd68 | 1695 | AC_DEFINE_UNQUOTED(USE_WIN32_SMALL_FILES, 1, |
fef60d9d | 1696 | [Define to 1 if you are building a Windows target without large file support.]) |
cc615f48 MH |
1697 | AC_SUBST(USE_WIN32_SMALL_FILES, [1]) |
1698 | ;; | |
1699 | *) | |
1700 | AC_MSG_RESULT([no]) | |
1701 | ;; | |
1702 | esac | |
1703 | ]) | |
1704 | ||
1705 | dnl CURL_CHECK_WIN32_CRYPTO | |
1706 | dnl ------------------------------------------------- | |
1707 | dnl Check if curl's WIN32 crypto lib can be used | |
1708 | ||
1709 | AC_DEFUN([CURL_CHECK_WIN32_CRYPTO], [ | |
1710 | AC_REQUIRE([CURL_CHECK_HEADER_WINCRYPT])dnl | |
1711 | AC_MSG_CHECKING([whether build target supports WIN32 crypto API]) | |
1712 | curl_win32_crypto_api="no" | |
1713 | if test "$curl_cv_header_wincrypt_h" = "yes"; then | |
1714 | AC_COMPILE_IFELSE([ | |
1715 | AC_LANG_PROGRAM([[ | |
1716 | #undef inline | |
1717 | #ifndef WIN32_LEAN_AND_MEAN | |
1718 | #define WIN32_LEAN_AND_MEAN | |
1719 | #endif | |
1720 | #include <windows.h> | |
1721 | #include <wincrypt.h> | |
1722 | ]],[[ | |
1723 | HCRYPTPROV hCryptProv; | |
1724 | if(CryptAcquireContext(&hCryptProv, NULL, NULL, PROV_RSA_FULL, | |
1725 | CRYPT_VERIFYCONTEXT | CRYPT_SILENT)) { | |
1726 | CryptReleaseContext(hCryptProv, 0); | |
1727 | } | |
1728 | ]]) | |
1729 | ],[ | |
1730 | curl_win32_crypto_api="yes" | |
1731 | ]) | |
1732 | fi | |
1733 | case "$curl_win32_crypto_api" in | |
1734 | yes) | |
1735 | AC_MSG_RESULT([yes]) | |
1736 | AC_DEFINE_UNQUOTED(USE_WIN32_CRYPTO, 1, | |
1737 | [Define to 1 if you are building a Windows target with crypto API support.]) | |
1738 | AC_SUBST(USE_WIN32_CRYPTO, [1]) | |
fef60d9d YT |
1739 | ;; |
1740 | *) | |
1741 | AC_MSG_RESULT([no]) | |
1742 | ;; | |
1743 | esac | |
304537c2 | 1744 | ]) |
b9fdc0c2 | 1745 | |
383bf1e4 KD |
1746 | dnl CURL_EXPORT_PCDIR ($pcdir) |
1747 | dnl ------------------------ | |
1748 | dnl if $pcdir is not empty, set PKG_CONFIG_LIBDIR to $pcdir and export | |
1749 | dnl | |
1750 | dnl we need this macro since pkg-config distinguishes among empty and unset | |
1751 | dnl variable while checking PKG_CONFIG_LIBDIR | |
1752 | dnl | |
1753 | ||
1754 | AC_DEFUN([CURL_EXPORT_PCDIR], [ | |
1755 | if test -n "$1"; then | |
1756 | PKG_CONFIG_LIBDIR="$1" | |
1757 | export PKG_CONFIG_LIBDIR | |
1758 | fi | |
1759 | ]) | |
1760 | ||
1761 | dnl CURL_CHECK_PKGCONFIG ($module, [$pcdir]) | |
b9fdc0c2 | 1762 | dnl ------------------------ |
c07a6f3f CW |
1763 | dnl search for the pkg-config tool. Set the PKGCONFIG variable to hold the |
1764 | dnl path to it, or 'no' if not found/present. | |
b9fdc0c2 | 1765 | dnl |
e47c9398 DS |
1766 | dnl If pkg-config is present, check that it has info about the $module or |
1767 | dnl return "no" anyway! | |
b9fdc0c2 | 1768 | dnl |
383bf1e4 KD |
1769 | dnl Optionally PKG_CONFIG_LIBDIR may be given as $pcdir. |
1770 | dnl | |
b9fdc0c2 DS |
1771 | |
1772 | AC_DEFUN([CURL_CHECK_PKGCONFIG], [ | |
d9a1776b | 1773 | if test -n "$PKG_CONFIG"; then |
72d99f2e | 1774 | PKGCONFIG="$PKG_CONFIG" |
d9a1776b | 1775 | else |
72d99f2e JS |
1776 | AC_PATH_TOOL([PKGCONFIG], [pkg-config], [no], |
1777 | [$PATH:/usr/bin:/usr/local/bin]) | |
1778 | fi | |
1779 | ||
1780 | if test "x$PKGCONFIG" != "xno"; then | |
b9fdc0c2 DS |
1781 | AC_MSG_CHECKING([for $1 options with pkg-config]) |
1782 | dnl ask pkg-config about $1 | |
383bf1e4 KD |
1783 | itexists=`CURL_EXPORT_PCDIR([$2]) dnl |
1784 | $PKGCONFIG --exists $1 >/dev/null 2>&1 && echo 1` | |
1785 | ||
1786 | if test -z "$itexists"; then | |
b9fdc0c2 DS |
1787 | dnl pkg-config does not have info about the given module! set the |
1788 | dnl variable to 'no' | |
1789 | PKGCONFIG="no" | |
1790 | AC_MSG_RESULT([no]) | |
1791 | else | |
1792 | AC_MSG_RESULT([found]) | |
1793 | fi | |
1794 | fi | |
b9fdc0c2 | 1795 | ]) |
ef24ecde YT |
1796 | |
1797 | ||
1798 | dnl CURL_GENERATE_CONFIGUREHELP_PM | |
1799 | dnl ------------------------------------------------- | |
1800 | dnl Generate test harness configurehelp.pm module, defining and | |
1801 | dnl initializing some perl variables with values which are known | |
1802 | dnl when the configure script runs. For portability reasons, test | |
1803 | dnl harness needs information on how to run the C preprocessor. | |
1804 | ||
1805 | AC_DEFUN([CURL_GENERATE_CONFIGUREHELP_PM], [ | |
1806 | AC_REQUIRE([AC_PROG_CPP])dnl | |
1807 | tmp_cpp=`eval echo "$ac_cpp" 2>/dev/null` | |
1808 | if test -z "$tmp_cpp"; then | |
1809 | tmp_cpp='cpp' | |
1810 | fi | |
1811 | cat >./tests/configurehelp.pm <<_EOF | |
1812 | [@%:@] This is a generated file. Do not edit. | |
1813 | ||
1814 | package configurehelp; | |
1815 | ||
1816 | use strict; | |
1817 | use warnings; | |
1818 | use Exporter; | |
1819 | ||
1820 | use vars qw( | |
1821 | @ISA | |
1822 | @EXPORT_OK | |
1823 | \$Cpreprocessor | |
1824 | ); | |
1825 | ||
1826 | @ISA = qw(Exporter); | |
1827 | ||
1828 | @EXPORT_OK = qw( | |
1829 | \$Cpreprocessor | |
1830 | ); | |
1831 | ||
1832 | \$Cpreprocessor = '$tmp_cpp'; | |
1833 | ||
1834 | 1; | |
1835 | _EOF | |
1836 | ]) | |
ecf95343 DS |
1837 | |
1838 | dnl CURL_CPP_P | |
1839 | dnl | |
1840 | dnl Check if $cpp -P should be used for extract define values due to gcc 5 | |
1841 | dnl splitting up strings and defines between line outputs. gcc by default | |
1842 | dnl (without -P) will show TEST EINVAL TEST as | |
1843 | dnl | |
1844 | dnl # 13 "conftest.c" | |
1845 | dnl TEST | |
1846 | dnl # 13 "conftest.c" 3 4 | |
1847 | dnl 22 | |
1848 | dnl # 13 "conftest.c" | |
1849 | dnl TEST | |
1850 | ||
1851 | AC_DEFUN([CURL_CPP_P], [ | |
1852 | AC_MSG_CHECKING([if cpp -P is needed]) | |
1853 | AC_EGREP_CPP([TEST.*TEST], [ | |
1854 | #include <errno.h> | |
1855 | TEST EINVAL TEST | |
1856 | ], [cpp=no], [cpp=yes]) | |
1857 | AC_MSG_RESULT([$cpp]) | |
1858 | ||
1859 | dnl we need cpp -P so check if it works then | |
1860 | if test "x$cpp" = "xyes"; then | |
1861 | AC_MSG_CHECKING([if cpp -P works]) | |
1862 | OLDCPPFLAGS=$CPPFLAGS | |
1863 | CPPFLAGS="$CPPFLAGS -P" | |
1864 | AC_EGREP_CPP([TEST.*TEST], [ | |
1865 | #include <errno.h> | |
1866 | TEST EINVAL TEST | |
1867 | ], [cpp_p=yes], [cpp_p=no]) | |
1868 | AC_MSG_RESULT([$cpp_p]) | |
1869 | ||
1870 | if test "x$cpp_p" = "xno"; then | |
1871 | AC_MSG_WARN([failed to figure out cpp -P alternative]) | |
1872 | # without -P | |
46398941 | 1873 | CPPPFLAG="" |
ecf95343 DS |
1874 | else |
1875 | # with -P | |
46398941 | 1876 | CPPPFLAG="-P" |
ecf95343 DS |
1877 | fi |
1878 | dnl restore CPPFLAGS | |
1879 | CPPFLAGS=$OLDCPPFLAGS | |
46398941 CD |
1880 | else |
1881 | # without -P | |
1882 | CPPPFLAG="" | |
ecf95343 DS |
1883 | fi |
1884 | ]) | |
4f8d0b6f DS |
1885 | |
1886 | ||
5d2c3844 | 1887 | dnl CURL_DARWIN_CFLAGS |
4f8d0b6f | 1888 | dnl |
5d2c3844 MYN |
1889 | dnl Set -Werror=partial-availability to detect possible breaking code |
1890 | dnl with very low deployment targets. | |
4f8d0b6f DS |
1891 | dnl |
1892 | ||
5d2c3844 | 1893 | AC_DEFUN([CURL_DARWIN_CFLAGS], [ |
4f8d0b6f DS |
1894 | |
1895 | tst_cflags="no" | |
1896 | case $host_os in | |
1897 | darwin*) | |
1898 | tst_cflags="yes" | |
1899 | ;; | |
1900 | esac | |
1901 | ||
5d2c3844 | 1902 | AC_MSG_CHECKING([for good-to-use Darwin CFLAGS]) |
4f8d0b6f DS |
1903 | AC_MSG_RESULT([$tst_cflags]); |
1904 | ||
1905 | if test "$tst_cflags" = "yes"; then | |
6724242c | 1906 | old_CFLAGS=$CFLAGS |
4f8d0b6f | 1907 | CFLAGS="$CFLAGS -Werror=partial-availability" |
6724242c DS |
1908 | AC_MSG_CHECKING([whether $CC accepts -Werror=partial-availability]) |
1909 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], | |
1910 | [AC_MSG_RESULT([yes])], | |
1911 | [AC_MSG_RESULT([no]) | |
1912 | CFLAGS=$old_CFLAGS]) | |
4f8d0b6f DS |
1913 | fi |
1914 | ||
1915 | ]) | |
870d849d NZ |
1916 | |
1917 | ||
1918 | dnl CURL_SUPPORTS_BUILTIN_AVAILABLE | |
1919 | dnl | |
1920 | dnl Check to see if the compiler supports __builtin_available. This built-in | |
1921 | dnl compiler function first appeared in Apple LLVM 9.0.0. It's so new that, at | |
1922 | dnl the time this macro was written, the function was not yet documented. Its | |
1923 | dnl purpose is to return true if the code is running under a certain OS version | |
1924 | dnl or later. | |
1925 | ||
1926 | AC_DEFUN([CURL_SUPPORTS_BUILTIN_AVAILABLE], [ | |
1927 | AC_MSG_CHECKING([to see if the compiler supports __builtin_available()]) | |
1928 | AC_COMPILE_IFELSE([ | |
1929 | AC_LANG_PROGRAM([[ | |
1930 | #include <stdlib.h> | |
1931 | ]],[[ | |
1932 | if (__builtin_available(macOS 10.8, iOS 5.0, *)) {} | |
1933 | ]]) | |
1934 | ],[ | |
1935 | AC_MSG_RESULT([yes]) | |
1936 | AC_DEFINE_UNQUOTED(HAVE_BUILTIN_AVAILABLE, 1, | |
1937 | [Define to 1 if you have the __builtin_available function.]) | |
1938 | ],[ | |
1939 | AC_MSG_RESULT([no]) | |
1940 | ]) | |
1941 | ]) |