1 #***************************************************************************
3 # Project ___| | | | _ \| |
5 # | (__| |_| | _ <| |___
6 # \___|\___/|_| \_\_____|
8 # Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
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.haxx.se/docs/copyright.html.
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.
18 # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19 # KIND, either express or implied.
21 #***************************************************************************
23 dnl CURL_CHECK_DEF (SYMBOL, [INCLUDES], [SILENT])
24 dnl -------------------------------------------------
25 dnl Use the C preprocessor to find out if the given object-style symbol
26 dnl is defined and get its expansion. This macro will not use default
27 dnl includes even if no INCLUDES argument is given. This macro will run
28 dnl silently when invoked with three arguments. If the expansion would
29 dnl result in a set of double-quoted strings the returned expansion will
30 dnl actually be a single double-quoted string concatenating all them.
32 AC_DEFUN([CURL_CHECK_DEF], [
33 AC_REQUIRE([CURL_CPP_P])dnl
35 # CPPPFLAG comes from CURL_CPP_P
36 CPPFLAGS="$CPPFLAGS $CPPPFLAG"
37 AS_VAR_PUSHDEF([ac_HaveDef], [curl_cv_have_def_$1])dnl
38 AS_VAR_PUSHDEF([ac_Def], [curl_cv_def_$1])dnl
39 if test -z "$SED"; then
40 AC_MSG_ERROR([SED not set. Cannot continue without SED being set.])
42 if test -z "$GREP"; then
43 AC_MSG_ERROR([GREP not set. Cannot continue without GREP being set.])
45 ifelse($3,,[AC_MSG_CHECKING([for preprocessor definition of $1])])
55 tmp_exp=`eval "$ac_cpp conftest.$ac_ext" 2>/dev/null | \
56 "$GREP" CURL_DEF_TOKEN 2>/dev/null | \
57 "$SED" 's/.*CURL_DEF_TOKEN[[ ]][[ ]]*//' 2>/dev/null | \
58 "$SED" 's/[["]][[ ]]*[["]]//g' 2>/dev/null`
59 if test -z "$tmp_exp" || test "$tmp_exp" = "$1"; then
63 if test -z "$tmp_exp"; then
64 AS_VAR_SET(ac_HaveDef, no)
65 ifelse($3,,[AC_MSG_RESULT([no])])
67 AS_VAR_SET(ac_HaveDef, yes)
68 AS_VAR_SET(ac_Def, $tmp_exp)
69 ifelse($3,,[AC_MSG_RESULT([$tmp_exp])])
71 AS_VAR_POPDEF([ac_Def])dnl
72 AS_VAR_POPDEF([ac_HaveDef])dnl
77 dnl CURL_CHECK_DEF_CC (SYMBOL, [INCLUDES], [SILENT])
78 dnl -------------------------------------------------
79 dnl Use the C compiler to find out only if the given symbol is defined
80 dnl or not, this can not find out its expansion. This macro will not use
81 dnl default includes even if no INCLUDES argument is given. This macro
82 dnl will run silently when invoked with three arguments.
84 AC_DEFUN([CURL_CHECK_DEF_CC], [
85 AS_VAR_PUSHDEF([ac_HaveDef], [curl_cv_have_def_$1])dnl
86 ifelse($3,,[AC_MSG_CHECKING([for compiler definition of $1])])
95 force compilation error
100 tst_symbol_defined="yes"
102 tst_symbol_defined="no"
104 if test "$tst_symbol_defined" = "yes"; then
105 AS_VAR_SET(ac_HaveDef, yes)
106 ifelse($3,,[AC_MSG_RESULT([yes])])
108 AS_VAR_SET(ac_HaveDef, no)
109 ifelse($3,,[AC_MSG_RESULT([no])])
111 AS_VAR_POPDEF([ac_HaveDef])dnl
115 dnl CURL_CHECK_LIB_XNET
116 dnl -------------------------------------------------
117 dnl Verify if X/Open network library is required.
119 AC_DEFUN([CURL_CHECK_LIB_XNET], [
120 AC_MSG_CHECKING([if X/Open network library is required])
121 tst_lib_xnet_required="no"
126 #if defined(__hpux) && defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE >= 600)
128 #elif defined(__hpux) && defined(_XOPEN_SOURCE_EXTENDED)
131 force compilation error
136 tst_lib_xnet_required="yes"
139 AC_MSG_RESULT([$tst_lib_xnet_required])
143 dnl CURL_CHECK_AIX_ALL_SOURCE
144 dnl -------------------------------------------------
145 dnl Provides a replacement of traditional AC_AIX with
146 dnl an uniform behaviour across all autoconf versions,
147 dnl and with our own placement rules.
149 AC_DEFUN([CURL_CHECK_AIX_ALL_SOURCE], [
150 AH_VERBATIM([_ALL_SOURCE],
151 [/* Define to 1 if OS is AIX. */
155 AC_BEFORE([$0], [AC_SYS_LARGEFILE])dnl
156 AC_BEFORE([$0], [CURL_CONFIGURE_REENTRANT])dnl
157 AC_BEFORE([$0], [CURL_CONFIGURE_PULL_SYS_POLL])dnl
158 AC_MSG_CHECKING([if OS is AIX (to define _ALL_SOURCE)])
159 AC_EGREP_CPP([yes_this_is_aix],[
165 AC_DEFINE(_ALL_SOURCE)
172 dnl CURL_CHECK_HEADER_WINDOWS
173 dnl -------------------------------------------------
174 dnl Check for compilable and valid windows.h header
176 AC_DEFUN([CURL_CHECK_HEADER_WINDOWS], [
177 AC_CACHE_CHECK([for windows.h], [curl_cv_header_windows_h], [
181 #ifndef WIN32_LEAN_AND_MEAN
182 #define WIN32_LEAN_AND_MEAN
186 #if defined(__CYGWIN__) || defined(__CEGCC__)
187 HAVE_WINDOWS_H shall not be defined.
193 curl_cv_header_windows_h="yes"
195 curl_cv_header_windows_h="no"
198 case "$curl_cv_header_windows_h" in
200 AC_DEFINE_UNQUOTED(HAVE_WINDOWS_H, 1,
201 [Define to 1 if you have the windows.h header file.])
207 dnl CURL_CHECK_NATIVE_WINDOWS
208 dnl -------------------------------------------------
209 dnl Check if building a native Windows target
211 AC_DEFUN([CURL_CHECK_NATIVE_WINDOWS], [
212 AC_REQUIRE([CURL_CHECK_HEADER_WINDOWS])dnl
213 AC_CACHE_CHECK([whether build target is a native Windows one], [curl_cv_native_windows], [
214 if test "$curl_cv_header_windows_h" = "no"; then
215 curl_cv_native_windows="no"
220 #if defined(__MINGW32__) || defined(__MINGW32CE__) || \
221 (defined(_MSC_VER) && (defined(_WIN32) || defined(_WIN64)))
224 Not a native Windows build target.
228 curl_cv_native_windows="yes"
230 curl_cv_native_windows="no"
234 AM_CONDITIONAL(DOING_NATIVE_WINDOWS, test "x$curl_cv_native_windows" = xyes)
238 dnl CURL_CHECK_HEADER_WINSOCK
239 dnl -------------------------------------------------
240 dnl Check for compilable and valid winsock.h header
242 AC_DEFUN([CURL_CHECK_HEADER_WINSOCK], [
243 AC_REQUIRE([CURL_CHECK_HEADER_WINDOWS])dnl
244 AC_CACHE_CHECK([for winsock.h], [curl_cv_header_winsock_h], [
248 #ifndef WIN32_LEAN_AND_MEAN
249 #define WIN32_LEAN_AND_MEAN
254 #if defined(__CYGWIN__) || defined(__CEGCC__)
255 HAVE_WINSOCK_H shall not be defined.
257 int dummy=WSACleanup();
261 curl_cv_header_winsock_h="yes"
263 curl_cv_header_winsock_h="no"
266 case "$curl_cv_header_winsock_h" in
268 AC_DEFINE_UNQUOTED(HAVE_WINSOCK_H, 1,
269 [Define to 1 if you have the winsock.h header file.])
275 dnl CURL_CHECK_HEADER_WINSOCK2
276 dnl -------------------------------------------------
277 dnl Check for compilable and valid winsock2.h header
279 AC_DEFUN([CURL_CHECK_HEADER_WINSOCK2], [
280 AC_REQUIRE([CURL_CHECK_HEADER_WINDOWS])dnl
281 AC_CACHE_CHECK([for winsock2.h], [curl_cv_header_winsock2_h], [
285 #ifndef WIN32_LEAN_AND_MEAN
286 #define WIN32_LEAN_AND_MEAN
289 #include <winsock2.h>
291 #if defined(__CYGWIN__) || defined(__CEGCC__) || defined(__MINGW32CE__)
292 HAVE_WINSOCK2_H shall not be defined.
294 int dummy=2*IPPROTO_ESP;
298 curl_cv_header_winsock2_h="yes"
300 curl_cv_header_winsock2_h="no"
303 case "$curl_cv_header_winsock2_h" in
305 AC_DEFINE_UNQUOTED(HAVE_WINSOCK2_H, 1,
306 [Define to 1 if you have the winsock2.h header file.])
312 dnl CURL_CHECK_HEADER_WS2TCPIP
313 dnl -------------------------------------------------
314 dnl Check for compilable and valid ws2tcpip.h header
316 AC_DEFUN([CURL_CHECK_HEADER_WS2TCPIP], [
317 AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK2])dnl
318 AC_CACHE_CHECK([for ws2tcpip.h], [curl_cv_header_ws2tcpip_h], [
322 #ifndef WIN32_LEAN_AND_MEAN
323 #define WIN32_LEAN_AND_MEAN
326 #include <winsock2.h>
327 #include <ws2tcpip.h>
329 #if defined(__CYGWIN__) || defined(__CEGCC__) || defined(__MINGW32CE__)
330 HAVE_WS2TCPIP_H shall not be defined.
332 int dummy=2*IP_PKTINFO;
336 curl_cv_header_ws2tcpip_h="yes"
338 curl_cv_header_ws2tcpip_h="no"
341 case "$curl_cv_header_ws2tcpip_h" in
343 AC_DEFINE_UNQUOTED(HAVE_WS2TCPIP_H, 1,
344 [Define to 1 if you have the ws2tcpip.h header file.])
350 dnl CURL_CHECK_HEADER_WINLDAP
351 dnl -------------------------------------------------
352 dnl Check for compilable and valid winldap.h header
354 AC_DEFUN([CURL_CHECK_HEADER_WINLDAP], [
355 AC_REQUIRE([CURL_CHECK_HEADER_WINDOWS])dnl
356 AC_CACHE_CHECK([for winldap.h], [curl_cv_header_winldap_h], [
360 #ifdef HAVE_WINDOWS_H
361 #ifndef WIN32_LEAN_AND_MEAN
362 #define WIN32_LEAN_AND_MEAN
368 #if defined(__CYGWIN__) || defined(__CEGCC__)
369 HAVE_WINLDAP_H shall not be defined.
371 LDAP *ldp = ldap_init("dummy", LDAP_PORT);
372 ULONG res = ldap_unbind(ldp);
376 curl_cv_header_winldap_h="yes"
378 curl_cv_header_winldap_h="no"
381 case "$curl_cv_header_winldap_h" in
383 AC_DEFINE_UNQUOTED(HAVE_WINLDAP_H, 1,
384 [Define to 1 if you have the winldap.h header file.])
390 dnl CURL_CHECK_HEADER_WINBER
391 dnl -------------------------------------------------
392 dnl Check for compilable and valid winber.h header
394 AC_DEFUN([CURL_CHECK_HEADER_WINBER], [
395 AC_REQUIRE([CURL_CHECK_HEADER_WINLDAP])dnl
396 AC_CACHE_CHECK([for winber.h], [curl_cv_header_winber_h], [
400 #ifdef HAVE_WINDOWS_H
401 #ifndef WIN32_LEAN_AND_MEAN
402 #define WIN32_LEAN_AND_MEAN
409 #if defined(__CYGWIN__) || defined(__CEGCC__)
410 HAVE_WINBER_H shall not be defined.
413 BerElement *bep = ber_init(bvp);
418 curl_cv_header_winber_h="yes"
420 curl_cv_header_winber_h="no"
423 case "$curl_cv_header_winber_h" in
425 AC_DEFINE_UNQUOTED(HAVE_WINBER_H, 1,
426 [Define to 1 if you have the winber.h header file.])
432 dnl CURL_CHECK_HEADER_LBER
433 dnl -------------------------------------------------
434 dnl Check for compilable and valid lber.h header,
435 dnl and check if it is needed even with ldap.h
437 AC_DEFUN([CURL_CHECK_HEADER_LBER], [
438 AC_REQUIRE([CURL_CHECK_HEADER_WINDOWS])dnl
439 AC_CACHE_CHECK([for lber.h], [curl_cv_header_lber_h], [
443 #ifdef HAVE_WINDOWS_H
444 #ifndef WIN32_LEAN_AND_MEAN
445 #define WIN32_LEAN_AND_MEAN
449 #ifdef HAVE_SYS_TYPES_H
450 #include <sys/types.h>
454 #define NULL (void *)0
458 BerValue *bvp = NULL;
459 BerElement *bep = ber_init(bvp);
463 curl_cv_header_lber_h="yes"
465 curl_cv_header_lber_h="no"
468 if test "$curl_cv_header_lber_h" = "yes"; then
469 AC_DEFINE_UNQUOTED(HAVE_LBER_H, 1,
470 [Define to 1 if you have the lber.h header file.])
475 #ifdef HAVE_WINDOWS_H
476 #ifndef WIN32_LEAN_AND_MEAN
477 #define WIN32_LEAN_AND_MEAN
481 #ifdef HAVE_SYS_TYPES_H
482 #include <sys/types.h>
486 #define NULL (void *)0
488 #ifndef LDAP_DEPRECATED
489 #define LDAP_DEPRECATED 1
493 BerValue *bvp = NULL;
494 BerElement *bep = ber_init(bvp);
498 curl_cv_need_header_lber_h="no"
500 curl_cv_need_header_lber_h="yes"
503 case "$curl_cv_need_header_lber_h" in
505 AC_DEFINE_UNQUOTED(NEED_LBER_H, 1,
506 [Define to 1 if you need the lber.h header file even with ldap.h])
513 dnl CURL_CHECK_HEADER_LDAP
514 dnl -------------------------------------------------
515 dnl Check for compilable and valid ldap.h header
517 AC_DEFUN([CURL_CHECK_HEADER_LDAP], [
518 AC_REQUIRE([CURL_CHECK_HEADER_LBER])dnl
519 AC_CACHE_CHECK([for ldap.h], [curl_cv_header_ldap_h], [
523 #ifdef HAVE_WINDOWS_H
524 #ifndef WIN32_LEAN_AND_MEAN
525 #define WIN32_LEAN_AND_MEAN
529 #ifdef HAVE_SYS_TYPES_H
530 #include <sys/types.h>
533 #ifndef LDAP_DEPRECATED
534 #define LDAP_DEPRECATED 1
541 LDAP *ldp = ldap_init("dummy", LDAP_PORT);
542 int res = ldap_unbind(ldp);
545 curl_cv_header_ldap_h="yes"
547 curl_cv_header_ldap_h="no"
550 case "$curl_cv_header_ldap_h" in
552 AC_DEFINE_UNQUOTED(HAVE_LDAP_H, 1,
553 [Define to 1 if you have the ldap.h header file.])
559 dnl CURL_CHECK_HEADER_LDAP_SSL
560 dnl -------------------------------------------------
561 dnl Check for compilable and valid ldap_ssl.h header
563 AC_DEFUN([CURL_CHECK_HEADER_LDAP_SSL], [
564 AC_REQUIRE([CURL_CHECK_HEADER_LDAP])dnl
565 AC_CACHE_CHECK([for ldap_ssl.h], [curl_cv_header_ldap_ssl_h], [
569 #ifdef HAVE_WINDOWS_H
570 #ifndef WIN32_LEAN_AND_MEAN
571 #define WIN32_LEAN_AND_MEAN
575 #ifdef HAVE_SYS_TYPES_H
576 #include <sys/types.h>
579 #ifndef LDAP_DEPRECATED
580 #define LDAP_DEPRECATED 1
588 #include <ldap_ssl.h>
590 LDAP *ldp = ldapssl_init("dummy", LDAPS_PORT, 1);
593 curl_cv_header_ldap_ssl_h="yes"
595 curl_cv_header_ldap_ssl_h="no"
598 case "$curl_cv_header_ldap_ssl_h" in
600 AC_DEFINE_UNQUOTED(HAVE_LDAP_SSL_H, 1,
601 [Define to 1 if you have the ldap_ssl.h header file.])
607 dnl CURL_CHECK_HEADER_LDAPSSL
608 dnl -------------------------------------------------
609 dnl Check for compilable and valid ldapssl.h header
611 AC_DEFUN([CURL_CHECK_HEADER_LDAPSSL], [
612 AC_REQUIRE([CURL_CHECK_HEADER_LDAP])dnl
613 AC_CACHE_CHECK([for ldapssl.h], [curl_cv_header_ldapssl_h], [
617 #ifdef HAVE_WINDOWS_H
618 #ifndef WIN32_LEAN_AND_MEAN
619 #define WIN32_LEAN_AND_MEAN
623 #ifdef HAVE_SYS_TYPES_H
624 #include <sys/types.h>
628 #define NULL (void *)0
630 #ifndef LDAP_DEPRECATED
631 #define LDAP_DEPRECATED 1
641 char *cert_label = NULL;
642 LDAP *ldp = ldap_ssl_init("dummy", LDAPS_PORT, cert_label);
645 curl_cv_header_ldapssl_h="yes"
647 curl_cv_header_ldapssl_h="no"
650 case "$curl_cv_header_ldapssl_h" in
652 AC_DEFINE_UNQUOTED(HAVE_LDAPSSL_H, 1,
653 [Define to 1 if you have the ldapssl.h header file.])
659 dnl CURL_CHECK_LIBS_WINLDAP
660 dnl -------------------------------------------------
661 dnl Check for libraries needed for WINLDAP support,
662 dnl and prepended to LIBS any needed libraries.
663 dnl This macro can take an optional parameter with a
664 dnl whitespace separated list of libraries to check
665 dnl before the WINLDAP default ones.
667 AC_DEFUN([CURL_CHECK_LIBS_WINLDAP], [
668 AC_REQUIRE([CURL_CHECK_HEADER_WINBER])dnl
670 AC_MSG_CHECKING([for WINLDAP libraries])
684 if test -z "$u_libs"; then
687 u_libs="$u_libs $l_lib"
692 curl_cv_save_LIBS="$LIBS"
693 curl_cv_ldap_LIBS="unknown"
695 for x_nlibs in '' "$u_libs" \
697 if test "$curl_cv_ldap_LIBS" = "unknown"; then
698 if test -z "$x_nlibs"; then
699 LIBS="$curl_cv_save_LIBS"
701 LIBS="$x_nlibs $curl_cv_save_LIBS"
706 #ifdef HAVE_WINDOWS_H
707 #ifndef WIN32_LEAN_AND_MEAN
708 #define WIN32_LEAN_AND_MEAN
711 #ifdef HAVE_WINLDAP_H
720 BerElement *bep = ber_init(bvp);
721 LDAP *ldp = ldap_init("dummy", LDAP_PORT);
722 ULONG res = ldap_unbind(ldp);
726 curl_cv_ldap_LIBS="$x_nlibs"
731 LIBS="$curl_cv_save_LIBS"
733 case X-"$curl_cv_ldap_LIBS" in
735 AC_MSG_RESULT([cannot find WINLDAP libraries])
738 AC_MSG_RESULT([no additional lib required])
741 if test -z "$curl_cv_save_LIBS"; then
742 LIBS="$curl_cv_ldap_LIBS"
744 LIBS="$curl_cv_ldap_LIBS $curl_cv_save_LIBS"
746 AC_MSG_RESULT([$curl_cv_ldap_LIBS])
753 dnl CURL_CHECK_LIBS_LDAP
754 dnl -------------------------------------------------
755 dnl Check for libraries needed for LDAP support,
756 dnl and prepended to LIBS any needed libraries.
757 dnl This macro can take an optional parameter with a
758 dnl whitespace separated list of libraries to check
759 dnl before the default ones.
761 AC_DEFUN([CURL_CHECK_LIBS_LDAP], [
762 AC_REQUIRE([CURL_CHECK_HEADER_LDAP])dnl
764 AC_MSG_CHECKING([for LDAP libraries])
778 if test -z "$u_libs"; then
781 u_libs="$u_libs $l_lib"
786 curl_cv_save_LIBS="$LIBS"
787 curl_cv_ldap_LIBS="unknown"
789 for x_nlibs in '' "$u_libs" \
793 '-lldapssl -lldapx -lldapsdk' \
794 '-lldapsdk -lldapx -lldapssl' \
795 '-lldap -llber -lssl -lcrypto' ; do
797 if test "$curl_cv_ldap_LIBS" = "unknown"; then
798 if test -z "$x_nlibs"; then
799 LIBS="$curl_cv_save_LIBS"
801 LIBS="$x_nlibs $curl_cv_save_LIBS"
806 #ifdef HAVE_WINDOWS_H
807 #ifndef WIN32_LEAN_AND_MEAN
808 #define WIN32_LEAN_AND_MEAN
812 #ifdef HAVE_SYS_TYPES_H
813 #include <sys/types.h>
817 #define NULL (void *)0
819 #ifndef LDAP_DEPRECATED
820 #define LDAP_DEPRECATED 1
829 BerValue *bvp = NULL;
830 BerElement *bep = ber_init(bvp);
831 LDAP *ldp = ldap_init("dummy", LDAP_PORT);
832 int res = ldap_unbind(ldp);
836 curl_cv_ldap_LIBS="$x_nlibs"
841 LIBS="$curl_cv_save_LIBS"
843 case X-"$curl_cv_ldap_LIBS" in
845 AC_MSG_RESULT([cannot find LDAP libraries])
848 AC_MSG_RESULT([no additional lib required])
851 if test -z "$curl_cv_save_LIBS"; then
852 LIBS="$curl_cv_ldap_LIBS"
854 LIBS="$curl_cv_ldap_LIBS $curl_cv_save_LIBS"
856 AC_MSG_RESULT([$curl_cv_ldap_LIBS])
863 dnl CURL_CHECK_HEADER_MALLOC
864 dnl -------------------------------------------------
865 dnl Check for compilable and valid malloc.h header,
866 dnl and check if it is needed even with stdlib.h
868 AC_DEFUN([CURL_CHECK_HEADER_MALLOC], [
869 AC_CACHE_CHECK([for malloc.h], [curl_cv_header_malloc_h], [
874 void *p = malloc(10);
875 void *q = calloc(10,10);
880 curl_cv_header_malloc_h="yes"
882 curl_cv_header_malloc_h="no"
885 if test "$curl_cv_header_malloc_h" = "yes"; then
886 AC_DEFINE_UNQUOTED(HAVE_MALLOC_H, 1,
887 [Define to 1 if you have the malloc.h header file.])
893 void *p = malloc(10);
894 void *q = calloc(10,10);
899 curl_cv_need_header_malloc_h="no"
901 curl_cv_need_header_malloc_h="yes"
904 case "$curl_cv_need_header_malloc_h" in
906 AC_DEFINE_UNQUOTED(NEED_MALLOC_H, 1,
907 [Define to 1 if you need the malloc.h header file even with stdlib.h])
914 dnl CURL_CHECK_HEADER_MEMORY
915 dnl -------------------------------------------------
916 dnl Check for compilable and valid memory.h header,
917 dnl and check if it is needed even with stdlib.h for
918 dnl memory related functions.
920 AC_DEFUN([CURL_CHECK_HEADER_MEMORY], [
921 AC_CACHE_CHECK([for memory.h], [curl_cv_header_memory_h], [
926 void *p = malloc(10);
927 void *q = calloc(10,10);
932 curl_cv_header_memory_h="yes"
934 curl_cv_header_memory_h="no"
937 if test "$curl_cv_header_memory_h" = "yes"; then
938 AC_DEFINE_UNQUOTED(HAVE_MEMORY_H, 1,
939 [Define to 1 if you have the memory.h header file.])
945 void *p = malloc(10);
946 void *q = calloc(10,10);
951 curl_cv_need_header_memory_h="no"
953 curl_cv_need_header_memory_h="yes"
956 case "$curl_cv_need_header_memory_h" in
958 AC_DEFINE_UNQUOTED(NEED_MEMORY_H, 1,
959 [Define to 1 if you need the memory.h header file even with stdlib.h])
965 dnl TYPE_SOCKADDR_STORAGE
966 dnl -------------------------------------------------
967 dnl Check for struct sockaddr_storage. Most IPv6-enabled
968 dnl hosts have it, but AIX 4.3 is one known exception.
970 AC_DEFUN([TYPE_SOCKADDR_STORAGE],
972 AC_CHECK_TYPE([struct sockaddr_storage],
973 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE, 1,
974 [if struct sockaddr_storage is defined]), ,
977 #ifdef HAVE_WINDOWS_H
978 #ifndef WIN32_LEAN_AND_MEAN
979 #define WIN32_LEAN_AND_MEAN
982 #ifdef HAVE_WINSOCK2_H
983 #include <winsock2.h>
986 #ifdef HAVE_SYS_TYPES_H
987 #include <sys/types.h>
989 #ifdef HAVE_SYS_SOCKET_H
990 #include <sys/socket.h>
992 #ifdef HAVE_NETINET_IN_H
993 #include <netinet/in.h>
995 #ifdef HAVE_ARPA_INET_H
996 #include <arpa/inet.h>
1002 dnl CURL_CHECK_FUNC_RECV
1003 dnl -------------------------------------------------
1004 dnl Test if the socket recv() function is available,
1005 dnl and check its return type and the types of its
1006 dnl arguments. If the function succeeds HAVE_RECV
1007 dnl will be defined, defining the types of the arguments
1008 dnl in RECV_TYPE_ARG1, RECV_TYPE_ARG2, RECV_TYPE_ARG3
1009 dnl and RECV_TYPE_ARG4, defining the type of the function
1010 dnl return value in RECV_TYPE_RETV.
1012 AC_DEFUN([CURL_CHECK_FUNC_RECV], [
1013 AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK])dnl
1014 AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK2])dnl
1015 AC_CHECK_HEADERS(sys/types.h sys/socket.h)
1017 AC_MSG_CHECKING([for recv])
1021 #ifdef HAVE_WINDOWS_H
1022 #ifndef WIN32_LEAN_AND_MEAN
1023 #define WIN32_LEAN_AND_MEAN
1025 #include <windows.h>
1026 #ifdef HAVE_WINSOCK2_H
1027 #include <winsock2.h>
1029 #ifdef HAVE_WINSOCK_H
1030 #include <winsock.h>
1034 #ifdef HAVE_PROTO_BSDSOCKET_H
1035 #include <proto/bsdsocket.h>
1036 struct Library *SocketBase = NULL;
1038 #ifdef HAVE_SYS_TYPES_H
1039 #include <sys/types.h>
1041 #ifdef HAVE_SYS_SOCKET_H
1042 #include <sys/socket.h>
1049 AC_MSG_RESULT([yes])
1056 if test "$curl_cv_recv" = "yes"; then
1057 AC_CACHE_CHECK([types of args and return type for recv],
1058 [curl_cv_func_recv_args], [
1059 curl_cv_func_recv_args="unknown"
1060 for recv_retv in 'int' 'ssize_t'; do
1061 for recv_arg1 in 'int' 'ssize_t' 'SOCKET'; do
1062 for recv_arg2 in 'char *' 'void *'; do
1063 for recv_arg3 in 'size_t' 'int' 'socklen_t' 'unsigned int'; do
1064 for recv_arg4 in 'int' 'unsigned int'; do
1065 if test "$curl_cv_func_recv_args" = "unknown"; then
1069 #ifdef HAVE_WINDOWS_H
1070 #ifndef WIN32_LEAN_AND_MEAN
1071 #define WIN32_LEAN_AND_MEAN
1073 #include <windows.h>
1074 #ifdef HAVE_WINSOCK2_H
1075 #include <winsock2.h>
1077 #ifdef HAVE_WINSOCK_H
1078 #include <winsock.h>
1081 #define RECVCALLCONV PASCAL
1083 #ifdef HAVE_PROTO_BSDSOCKET_H
1084 #include <proto/bsdsocket.h>
1085 struct Library *SocketBase = NULL;
1087 #ifdef HAVE_SYS_TYPES_H
1088 #include <sys/types.h>
1090 #ifdef HAVE_SYS_SOCKET_H
1091 #include <sys/socket.h>
1093 #define RECVCALLCONV
1095 #ifndef HAVE_PROTO_BSDSOCKET_H
1096 extern $recv_retv RECVCALLCONV
1097 recv($recv_arg1, $recv_arg2, $recv_arg3, $recv_arg4);
1104 $recv_retv res = recv(s, buf, len, flags);
1107 curl_cv_func_recv_args="$recv_arg1,$recv_arg2,$recv_arg3,$recv_arg4,$recv_retv"
1116 if test "$curl_cv_func_recv_args" = "unknown"; then
1117 AC_MSG_ERROR([Cannot find proper types to use for recv args])
1119 recv_prev_IFS=$IFS; IFS=','
1120 set dummy `echo "$curl_cv_func_recv_args" | sed 's/\*/\*/g'`
1124 AC_DEFINE_UNQUOTED(RECV_TYPE_ARG1, $[1],
1125 [Define to the type of arg 1 for recv.])
1126 AC_DEFINE_UNQUOTED(RECV_TYPE_ARG2, $[2],
1127 [Define to the type of arg 2 for recv.])
1128 AC_DEFINE_UNQUOTED(RECV_TYPE_ARG3, $[3],
1129 [Define to the type of arg 3 for recv.])
1130 AC_DEFINE_UNQUOTED(RECV_TYPE_ARG4, $[4],
1131 [Define to the type of arg 4 for recv.])
1132 AC_DEFINE_UNQUOTED(RECV_TYPE_RETV, $[5],
1133 [Define to the function return type for recv.])
1135 AC_DEFINE_UNQUOTED(HAVE_RECV, 1,
1136 [Define to 1 if you have the recv function.])
1137 curl_cv_func_recv="yes"
1140 AC_MSG_ERROR([Unable to link function recv])
1145 dnl CURL_CHECK_FUNC_SEND
1146 dnl -------------------------------------------------
1147 dnl Test if the socket send() function is available,
1148 dnl and check its return type and the types of its
1149 dnl arguments. If the function succeeds HAVE_SEND
1150 dnl will be defined, defining the types of the arguments
1151 dnl in SEND_TYPE_ARG1, SEND_TYPE_ARG2, SEND_TYPE_ARG3
1152 dnl and SEND_TYPE_ARG4, defining the type of the function
1153 dnl return value in SEND_TYPE_RETV, and also defining the
1154 dnl type qualifier of second argument in SEND_QUAL_ARG2.
1156 AC_DEFUN([CURL_CHECK_FUNC_SEND], [
1157 AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK])dnl
1158 AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK2])dnl
1159 AC_CHECK_HEADERS(sys/types.h sys/socket.h)
1161 AC_MSG_CHECKING([for send])
1165 #ifdef HAVE_WINDOWS_H
1166 #ifndef WIN32_LEAN_AND_MEAN
1167 #define WIN32_LEAN_AND_MEAN
1169 #include <windows.h>
1170 #ifdef HAVE_WINSOCK2_H
1171 #include <winsock2.h>
1173 #ifdef HAVE_WINSOCK_H
1174 #include <winsock.h>
1178 #ifdef HAVE_PROTO_BSDSOCKET_H
1179 #include <proto/bsdsocket.h>
1180 struct Library *SocketBase = NULL;
1182 #ifdef HAVE_SYS_TYPES_H
1183 #include <sys/types.h>
1185 #ifdef HAVE_SYS_SOCKET_H
1186 #include <sys/socket.h>
1193 AC_MSG_RESULT([yes])
1200 if test "$curl_cv_send" = "yes"; then
1201 AC_CACHE_CHECK([types of args and return type for send],
1202 [curl_cv_func_send_args], [
1203 curl_cv_func_send_args="unknown"
1204 for send_retv in 'int' 'ssize_t'; do
1205 for send_arg1 in 'int' 'ssize_t' 'SOCKET'; do
1206 for send_arg2 in 'char *' 'void *' 'const char *' 'const void *'; do
1207 for send_arg3 in 'size_t' 'int' 'socklen_t' 'unsigned int'; do
1208 for send_arg4 in 'int' 'unsigned int'; do
1209 if test "$curl_cv_func_send_args" = "unknown"; then
1213 #ifdef HAVE_WINDOWS_H
1214 #ifndef WIN32_LEAN_AND_MEAN
1215 #define WIN32_LEAN_AND_MEAN
1217 #include <windows.h>
1218 #ifdef HAVE_WINSOCK2_H
1219 #include <winsock2.h>
1221 #ifdef HAVE_WINSOCK_H
1222 #include <winsock.h>
1225 #define SENDCALLCONV PASCAL
1227 #ifdef HAVE_PROTO_BSDSOCKET_H
1228 #include <proto/bsdsocket.h>
1229 struct Library *SocketBase = NULL;
1231 #ifdef HAVE_SYS_TYPES_H
1232 #include <sys/types.h>
1234 #ifdef HAVE_SYS_SOCKET_H
1235 #include <sys/socket.h>
1237 #define SENDCALLCONV
1239 #ifndef HAVE_PROTO_BSDSOCKET_H
1240 extern $send_retv SENDCALLCONV
1241 send($send_arg1, $send_arg2, $send_arg3, $send_arg4);
1247 $send_retv res = send(s, 0, len, flags);
1250 curl_cv_func_send_args="$send_arg1,$send_arg2,$send_arg3,$send_arg4,$send_retv"
1259 if test "$curl_cv_func_send_args" = "unknown"; then
1260 AC_MSG_ERROR([Cannot find proper types to use for send args])
1262 send_prev_IFS=$IFS; IFS=','
1263 set dummy `echo "$curl_cv_func_send_args" | sed 's/\*/\*/g'`
1267 send_qual_type_arg2=$[2]
1269 AC_DEFINE_UNQUOTED(SEND_TYPE_ARG1, $[1],
1270 [Define to the type of arg 1 for send.])
1271 AC_DEFINE_UNQUOTED(SEND_TYPE_ARG3, $[3],
1272 [Define to the type of arg 3 for send.])
1273 AC_DEFINE_UNQUOTED(SEND_TYPE_ARG4, $[4],
1274 [Define to the type of arg 4 for send.])
1275 AC_DEFINE_UNQUOTED(SEND_TYPE_RETV, $[5],
1276 [Define to the function return type for send.])
1280 case $prev_sh_opts in
1288 case "$send_qual_type_arg2" in
1290 send_qual_arg2=const
1291 send_type_arg2=`echo $send_qual_type_arg2 | sed 's/^const //'`
1295 send_type_arg2=$send_qual_type_arg2
1299 AC_DEFINE_UNQUOTED(SEND_QUAL_ARG2, $send_qual_arg2,
1300 [Define to the type qualifier of arg 2 for send.])
1301 AC_DEFINE_UNQUOTED(SEND_TYPE_ARG2, $send_type_arg2,
1302 [Define to the type of arg 2 for send.])
1304 case $prev_sh_opts in
1312 AC_DEFINE_UNQUOTED(HAVE_SEND, 1,
1313 [Define to 1 if you have the send function.])
1314 curl_cv_func_send="yes"
1317 AC_MSG_ERROR([Unable to link function send])
1321 dnl CURL_CHECK_MSG_NOSIGNAL
1322 dnl -------------------------------------------------
1323 dnl Check for MSG_NOSIGNAL
1325 AC_DEFUN([CURL_CHECK_MSG_NOSIGNAL], [
1326 AC_CHECK_HEADERS(sys/types.h sys/socket.h)
1327 AC_CACHE_CHECK([for MSG_NOSIGNAL], [curl_cv_msg_nosignal], [
1331 #ifdef HAVE_WINDOWS_H
1332 #ifndef WIN32_LEAN_AND_MEAN
1333 #define WIN32_LEAN_AND_MEAN
1335 #include <windows.h>
1336 #ifdef HAVE_WINSOCK2_H
1337 #include <winsock2.h>
1339 #ifdef HAVE_WINSOCK_H
1340 #include <winsock.h>
1344 #ifdef HAVE_PROTO_BSDSOCKET_H
1345 #include <proto/bsdsocket.h>
1346 struct Library *SocketBase = NULL;
1348 #ifdef HAVE_SYS_TYPES_H
1349 #include <sys/types.h>
1351 #ifdef HAVE_SYS_SOCKET_H
1352 #include <sys/socket.h>
1356 int flag=MSG_NOSIGNAL;
1359 curl_cv_msg_nosignal="yes"
1361 curl_cv_msg_nosignal="no"
1364 case "$curl_cv_msg_nosignal" in
1366 AC_DEFINE_UNQUOTED(HAVE_MSG_NOSIGNAL, 1,
1367 [Define to 1 if you have the MSG_NOSIGNAL flag.])
1373 dnl CURL_CHECK_STRUCT_TIMEVAL
1374 dnl -------------------------------------------------
1375 dnl Check for timeval struct
1377 AC_DEFUN([CURL_CHECK_STRUCT_TIMEVAL], [
1378 AC_REQUIRE([AC_HEADER_TIME])dnl
1379 AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK])dnl
1380 AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK2])dnl
1381 AC_CHECK_HEADERS(sys/types.h sys/time.h time.h sys/socket.h)
1382 AC_CACHE_CHECK([for struct timeval], [curl_cv_struct_timeval], [
1386 #ifdef HAVE_WINDOWS_H
1387 #ifndef WIN32_LEAN_AND_MEAN
1388 #define WIN32_LEAN_AND_MEAN
1390 #include <windows.h>
1391 #ifdef HAVE_WINSOCK2_H
1392 #include <winsock2.h>
1394 #ifdef HAVE_WINSOCK_H
1395 #include <winsock.h>
1399 #ifdef HAVE_SYS_TYPES_H
1400 #include <sys/types.h>
1402 #ifdef HAVE_SYS_TIME_H
1403 #include <sys/time.h>
1404 #ifdef TIME_WITH_SYS_TIME
1412 #ifdef HAVE_SYS_SOCKET_H
1413 #include <sys/socket.h>
1421 curl_cv_struct_timeval="yes"
1423 curl_cv_struct_timeval="no"
1426 case "$curl_cv_struct_timeval" in
1428 AC_DEFINE_UNQUOTED(HAVE_STRUCT_TIMEVAL, 1,
1429 [Define to 1 if you have the timeval struct.])
1435 dnl TYPE_SIG_ATOMIC_T
1436 dnl -------------------------------------------------
1437 dnl Check if the sig_atomic_t type is available, and
1438 dnl verify if it is already defined as volatile.
1440 AC_DEFUN([TYPE_SIG_ATOMIC_T], [
1441 AC_CHECK_HEADERS(signal.h)
1442 AC_CHECK_TYPE([sig_atomic_t],[
1443 AC_DEFINE(HAVE_SIG_ATOMIC_T, 1,
1444 [Define to 1 if sig_atomic_t is an available typedef.])
1446 #ifdef HAVE_SIGNAL_H
1450 case "$ac_cv_type_sig_atomic_t" in
1453 AC_MSG_CHECKING([if sig_atomic_t is already defined as volatile])
1456 #ifdef HAVE_SIGNAL_H
1460 static volatile sig_atomic_t dummy = 0;
1464 curl_cv_sig_atomic_t_volatile="no"
1466 AC_MSG_RESULT([yes])
1467 curl_cv_sig_atomic_t_volatile="yes"
1470 if test "$curl_cv_sig_atomic_t_volatile" = "yes"; then
1471 AC_DEFINE(HAVE_SIG_ATOMIC_T_VOLATILE, 1,
1472 [Define to 1 if sig_atomic_t is already defined as volatile.])
1480 dnl -------------------------------------------------
1481 dnl Check for in_addr_t: it is used to receive the return code of inet_addr()
1482 dnl and a few other things.
1484 AC_DEFUN([TYPE_IN_ADDR_T], [
1485 AC_CHECK_TYPE([in_addr_t], ,[
1486 dnl in_addr_t not available
1487 AC_CACHE_CHECK([for in_addr_t equivalent],
1488 [curl_cv_in_addr_t_equiv], [
1489 curl_cv_in_addr_t_equiv="unknown"
1490 for t in "unsigned long" int size_t unsigned long; do
1491 if test "$curl_cv_in_addr_t_equiv" = "unknown"; then
1495 #ifdef HAVE_WINDOWS_H
1496 #ifndef WIN32_LEAN_AND_MEAN
1497 #define WIN32_LEAN_AND_MEAN
1499 #include <windows.h>
1500 #ifdef HAVE_WINSOCK2_H
1501 #include <winsock2.h>
1503 #ifdef HAVE_WINSOCK_H
1504 #include <winsock.h>
1508 #ifdef HAVE_SYS_TYPES_H
1509 #include <sys/types.h>
1511 #ifdef HAVE_SYS_SOCKET_H
1512 #include <sys/socket.h>
1514 #ifdef HAVE_NETINET_IN_H
1515 #include <netinet/in.h>
1517 #ifdef HAVE_ARPA_INET_H
1518 #include <arpa/inet.h>
1522 $t data = inet_addr ("1.2.3.4");
1525 curl_cv_in_addr_t_equiv="$t"
1530 case "$curl_cv_in_addr_t_equiv" in
1532 AC_MSG_ERROR([Cannot find a type to use in place of in_addr_t])
1535 AC_DEFINE_UNQUOTED(in_addr_t, $curl_cv_in_addr_t_equiv,
1536 [Type to use in place of in_addr_t when system does not provide it.])
1541 #ifdef HAVE_WINDOWS_H
1542 #ifndef WIN32_LEAN_AND_MEAN
1543 #define WIN32_LEAN_AND_MEAN
1545 #include <windows.h>
1546 #ifdef HAVE_WINSOCK2_H
1547 #include <winsock2.h>
1549 #ifdef HAVE_WINSOCK_H
1550 #include <winsock.h>
1554 #ifdef HAVE_SYS_TYPES_H
1555 #include <sys/types.h>
1557 #ifdef HAVE_SYS_SOCKET_H
1558 #include <sys/socket.h>
1560 #ifdef HAVE_NETINET_IN_H
1561 #include <netinet/in.h>
1563 #ifdef HAVE_ARPA_INET_H
1564 #include <arpa/inet.h>
1571 dnl CURL_CHECK_FUNC_CLOCK_GETTIME_MONOTONIC
1572 dnl -------------------------------------------------
1573 dnl Check if monotonic clock_gettime is available.
1575 AC_DEFUN([CURL_CHECK_FUNC_CLOCK_GETTIME_MONOTONIC], [
1576 AC_REQUIRE([AC_HEADER_TIME])dnl
1577 AC_CHECK_HEADERS(sys/types.h sys/time.h time.h)
1578 AC_MSG_CHECKING([for monotonic clock_gettime])
1580 if test "x$dontwant_rt" = "xno" ; then
1583 #ifdef HAVE_SYS_TYPES_H
1584 #include <sys/types.h>
1586 #ifdef HAVE_SYS_TIME_H
1587 #include <sys/time.h>
1588 #ifdef TIME_WITH_SYS_TIME
1598 (void)clock_gettime(CLOCK_MONOTONIC, &ts);
1601 AC_MSG_RESULT([yes])
1602 curl_func_clock_gettime="yes"
1605 curl_func_clock_gettime="no"
1608 dnl Definition of HAVE_CLOCK_GETTIME_MONOTONIC is intentionally postponed
1609 dnl until library linking and run-time checks for clock_gettime succeed.
1613 dnl CURL_CHECK_LIBS_CLOCK_GETTIME_MONOTONIC
1614 dnl -------------------------------------------------
1615 dnl If monotonic clock_gettime is available then,
1616 dnl check and prepended to LIBS any needed libraries.
1618 AC_DEFUN([CURL_CHECK_LIBS_CLOCK_GETTIME_MONOTONIC], [
1619 AC_REQUIRE([CURL_CHECK_FUNC_CLOCK_GETTIME_MONOTONIC])dnl
1621 if test "$curl_func_clock_gettime" = "yes"; then
1623 AC_MSG_CHECKING([for clock_gettime in libraries])
1625 curl_cv_save_LIBS="$LIBS"
1626 curl_cv_gclk_LIBS="unknown"
1628 for x_xlibs in '' '-lrt' '-lposix4' ; do
1629 if test "$curl_cv_gclk_LIBS" = "unknown"; then
1630 if test -z "$x_xlibs"; then
1631 LIBS="$curl_cv_save_LIBS"
1633 LIBS="$x_xlibs $curl_cv_save_LIBS"
1637 #ifdef HAVE_SYS_TYPES_H
1638 #include <sys/types.h>
1640 #ifdef HAVE_SYS_TIME_H
1641 #include <sys/time.h>
1642 #ifdef TIME_WITH_SYS_TIME
1652 (void)clock_gettime(CLOCK_MONOTONIC, &ts);
1655 curl_cv_gclk_LIBS="$x_xlibs"
1660 LIBS="$curl_cv_save_LIBS"
1662 case X-"$curl_cv_gclk_LIBS" in
1664 AC_MSG_RESULT([cannot find clock_gettime])
1665 AC_MSG_WARN([HAVE_CLOCK_GETTIME_MONOTONIC will not be defined])
1666 curl_func_clock_gettime="no"
1669 AC_MSG_RESULT([no additional lib required])
1670 curl_func_clock_gettime="yes"
1673 if test -z "$curl_cv_save_LIBS"; then
1674 LIBS="$curl_cv_gclk_LIBS"
1676 LIBS="$curl_cv_gclk_LIBS $curl_cv_save_LIBS"
1678 AC_MSG_RESULT([$curl_cv_gclk_LIBS])
1679 curl_func_clock_gettime="yes"
1683 dnl only do runtime verification when not cross-compiling
1684 if test "x$cross_compiling" != "xyes" &&
1685 test "$curl_func_clock_gettime" = "yes"; then
1686 AC_MSG_CHECKING([if monotonic clock_gettime works])
1689 #ifdef HAVE_STDLIB_H
1692 #ifdef HAVE_SYS_TYPES_H
1693 #include <sys/types.h>
1695 #ifdef HAVE_SYS_TIME_H
1696 #include <sys/time.h>
1697 #ifdef TIME_WITH_SYS_TIME
1707 if (0 == clock_gettime(CLOCK_MONOTONIC, &ts))
1713 AC_MSG_RESULT([yes])
1716 AC_MSG_WARN([HAVE_CLOCK_GETTIME_MONOTONIC will not be defined])
1717 curl_func_clock_gettime="no"
1718 LIBS="$curl_cv_save_LIBS"
1722 case "$curl_func_clock_gettime" in
1724 AC_DEFINE_UNQUOTED(HAVE_CLOCK_GETTIME_MONOTONIC, 1,
1725 [Define to 1 if you have the clock_gettime function and monotonic timer.])
1734 dnl CURL_CHECK_LIBS_CONNECT
1735 dnl -------------------------------------------------
1736 dnl Verify if network connect function is already available
1737 dnl using current libraries or if another one is required.
1739 AC_DEFUN([CURL_CHECK_LIBS_CONNECT], [
1740 AC_REQUIRE([CURL_INCLUDES_WINSOCK2])dnl
1741 AC_REQUIRE([CURL_INCLUDES_BSDSOCKET])dnl
1742 AC_MSG_CHECKING([for connect in libraries])
1743 tst_connect_save_LIBS="$LIBS"
1744 tst_connect_need_LIBS="unknown"
1745 for tst_lib in '' '-lsocket' ; do
1746 if test "$tst_connect_need_LIBS" = "unknown"; then
1747 LIBS="$tst_lib $tst_connect_save_LIBS"
1750 $curl_includes_winsock2
1751 $curl_includes_bsdsocket
1752 #if !defined(HAVE_WINDOWS_H) && !defined(HAVE_PROTO_BSDSOCKET_H)
1753 int connect(int, void*, int);
1756 if(0 != connect(0, 0, 0))
1760 tst_connect_need_LIBS="$tst_lib"
1764 LIBS="$tst_connect_save_LIBS"
1766 case X-"$tst_connect_need_LIBS" in
1768 AC_MSG_RESULT([cannot find connect])
1769 AC_MSG_ERROR([cannot find connect function in libraries.])
1772 AC_MSG_RESULT([yes])
1775 AC_MSG_RESULT([$tst_connect_need_LIBS])
1776 LIBS="$tst_connect_need_LIBS $tst_connect_save_LIBS"
1782 dnl CURL_DEFINE_UNQUOTED (VARIABLE, [VALUE])
1783 dnl -------------------------------------------------
1784 dnl Like AC_DEFINE_UNQUOTED this macro will define a C preprocessor
1785 dnl symbol that can be further used in custom template configuration
1786 dnl files. This macro, unlike AC_DEFINE_UNQUOTED, does not use a third
1787 dnl argument for the description. Symbol definitions done with this
1788 dnl macro are intended to be exclusively used in handcrafted *.h.in
1789 dnl template files. Contrary to what AC_DEFINE_UNQUOTED does, this one
1790 dnl prevents autoheader generation and insertion of symbol template
1791 dnl stub and definition into the first configuration header file. Do
1792 dnl not use this macro as a replacement for AC_DEFINE_UNQUOTED, each
1793 dnl one serves different functional needs.
1795 AC_DEFUN([CURL_DEFINE_UNQUOTED], [
1796 cat >>confdefs.h <<_EOF
1797 [@%:@define] $1 ifelse($#, 2, [$2], 1)
1801 dnl CURL_CONFIGURE_PULL_SYS_POLL
1802 dnl -------------------------------------------------
1803 dnl The need for the sys/poll.h inclusion arises mainly to properly
1804 dnl interface AIX systems which define macros 'events' and 'revents'.
1806 AC_DEFUN([CURL_CONFIGURE_PULL_SYS_POLL], [
1807 AC_REQUIRE([CURL_INCLUDES_POLL])dnl
1809 tst_poll_events_macro_defined="unknown"
1815 #if defined(events) || defined(revents)
1818 force compilation error
1822 tst_poll_events_macro_defined="yes"
1824 tst_poll_events_macro_defined="no"
1827 if test "$tst_poll_events_macro_defined" = "yes"; then
1828 if test "x$ac_cv_header_sys_poll_h" = "xyes"; then
1829 CURL_DEFINE_UNQUOTED([CURL_PULL_SYS_POLL_H])
1836 dnl CURL_CHECK_FUNC_SELECT
1837 dnl -------------------------------------------------
1838 dnl Test if the socket select() function is available,
1839 dnl and check its return type and the types of its
1840 dnl arguments. If the function succeeds HAVE_SELECT
1841 dnl will be defined, defining the types of the
1842 dnl arguments in SELECT_TYPE_ARG1, SELECT_TYPE_ARG234
1843 dnl and SELECT_TYPE_ARG5, defining the type of the
1844 dnl function return value in SELECT_TYPE_RETV, and
1845 dnl also defining the type qualifier of fifth argument
1846 dnl in SELECT_QUAL_ARG5.
1848 AC_DEFUN([CURL_CHECK_FUNC_SELECT], [
1849 AC_REQUIRE([CURL_CHECK_STRUCT_TIMEVAL])dnl
1850 AC_CHECK_HEADERS(sys/select.h sys/socket.h)
1852 AC_MSG_CHECKING([for select])
1856 #ifdef HAVE_WINDOWS_H
1857 #ifndef WIN32_LEAN_AND_MEAN
1858 #define WIN32_LEAN_AND_MEAN
1860 #include <windows.h>
1861 #ifdef HAVE_WINSOCK2_H
1862 #include <winsock2.h>
1864 #ifdef HAVE_WINSOCK_H
1865 #include <winsock.h>
1869 #ifdef HAVE_SYS_TYPES_H
1870 #include <sys/types.h>
1872 #ifdef HAVE_SYS_TIME_H
1873 #include <sys/time.h>
1874 #ifdef TIME_WITH_SYS_TIME
1882 #ifndef HAVE_WINDOWS_H
1883 #ifdef HAVE_PROTO_BSDSOCKET_H
1884 #include <proto/bsdsocket.h>
1885 struct Library *SocketBase = NULL;
1886 #define select(a,b,c,d,e) WaitSelect(a,b,c,d,e,0)
1888 #ifdef HAVE_SYS_SELECT_H
1889 #include <sys/select.h>
1890 #elif defined(HAVE_UNISTD_H)
1893 #ifdef HAVE_SYS_SOCKET_H
1894 #include <sys/socket.h>
1898 select(0, 0, 0, 0, 0);
1901 AC_MSG_RESULT([yes])
1902 curl_cv_select="yes"
1908 if test "$curl_cv_select" = "yes"; then
1909 AC_CACHE_CHECK([types of args and return type for select],
1910 [curl_cv_func_select_args], [
1911 curl_cv_func_select_args="unknown"
1912 for sel_retv in 'int' 'ssize_t'; do
1913 for sel_arg1 in 'int' 'ssize_t' 'size_t' 'unsigned long int' 'unsigned int'; do
1914 for sel_arg234 in 'fd_set *' 'int *' 'void *'; do
1915 for sel_arg5 in 'struct timeval *' 'const struct timeval *'; do
1916 if test "$curl_cv_func_select_args" = "unknown"; then
1920 #ifdef HAVE_WINDOWS_H
1921 #ifndef WIN32_LEAN_AND_MEAN
1922 #define WIN32_LEAN_AND_MEAN
1924 #include <windows.h>
1925 #ifdef HAVE_WINSOCK2_H
1926 #include <winsock2.h>
1928 #ifdef HAVE_WINSOCK_H
1929 #include <winsock.h>
1932 #define SELECTCALLCONV PASCAL
1934 #ifdef HAVE_SYS_TYPES_H
1935 #include <sys/types.h>
1937 #ifdef HAVE_SYS_TIME_H
1938 #include <sys/time.h>
1939 #ifdef TIME_WITH_SYS_TIME
1947 #ifndef HAVE_WINDOWS_H
1948 #ifdef HAVE_PROTO_BSDSOCKET_H
1949 #include <proto/bsdsocket.h>
1950 struct Library *SocketBase = NULL;
1951 #define select(a,b,c,d,e) WaitSelect(a,b,c,d,e,0)
1953 #ifdef HAVE_SYS_SELECT_H
1954 #include <sys/select.h>
1955 #elif defined(HAVE_UNISTD_H)
1958 #ifdef HAVE_SYS_SOCKET_H
1959 #include <sys/socket.h>
1961 #define SELECTCALLCONV
1963 #ifndef HAVE_STRUCT_TIMEVAL
1969 #ifndef HAVE_PROTO_BSDSOCKET_H
1970 extern $sel_retv SELECTCALLCONV
1982 $sel_retv res = select(nfds, rfds, wfds, efds, 0);
1985 curl_cv_func_select_args="$sel_arg1,$sel_arg234,$sel_arg5,$sel_retv"
1993 if test "$curl_cv_func_select_args" = "unknown"; then
1994 AC_MSG_WARN([Cannot find proper types to use for select args])
1995 AC_MSG_WARN([HAVE_SELECT will not be defined])
1997 select_prev_IFS=$IFS; IFS=','
1998 set dummy `echo "$curl_cv_func_select_args" | sed 's/\*/\*/g'`
1999 IFS=$select_prev_IFS
2002 sel_qual_type_arg5=$[3]
2004 AC_DEFINE_UNQUOTED(SELECT_TYPE_ARG1, $[1],
2005 [Define to the type of arg 1 for select.])
2006 AC_DEFINE_UNQUOTED(SELECT_TYPE_ARG234, $[2],
2007 [Define to the type of args 2, 3 and 4 for select.])
2008 AC_DEFINE_UNQUOTED(SELECT_TYPE_RETV, $[4],
2009 [Define to the function return type for select.])
2013 case $prev_sh_opts in
2021 case "$sel_qual_type_arg5" in
2024 sel_type_arg5=`echo $sel_qual_type_arg5 | sed 's/^const //'`
2028 sel_type_arg5=$sel_qual_type_arg5
2032 AC_DEFINE_UNQUOTED(SELECT_QUAL_ARG5, $sel_qual_arg5,
2033 [Define to the type qualifier of arg 5 for select.])
2034 AC_DEFINE_UNQUOTED(SELECT_TYPE_ARG5, $sel_type_arg5,
2035 [Define to the type of arg 5 for select.])
2037 case $prev_sh_opts in
2045 AC_DEFINE_UNQUOTED(HAVE_SELECT, 1,
2046 [Define to 1 if you have the select function.])
2047 curl_cv_func_select="yes"
2053 dnl CURL_VERIFY_RUNTIMELIBS
2054 dnl -------------------------------------------------
2055 dnl Verify that the shared libs found so far can be used when running
2056 dnl programs, since otherwise the situation will create odd configure errors
2057 dnl that are misleading people.
2059 dnl Make sure this test is run BEFORE the first test in the script that
2060 dnl runs anything, which at the time of this writing is the AC_CHECK_SIZEOF
2061 dnl macro. It must also run AFTER all lib-checking macros are complete.
2063 AC_DEFUN([CURL_VERIFY_RUNTIMELIBS], [
2065 dnl this test is of course not sensible if we are cross-compiling!
2066 if test "x$cross_compiling" != xyes; then
2068 dnl just run a program to verify that the libs checked for previous to this
2069 dnl point also is available run-time!
2070 AC_MSG_CHECKING([run-time libs availability])
2077 AC_MSG_RESULT([fine]),
2078 AC_MSG_RESULT([failed])
2079 AC_MSG_ERROR([one or more libs available at link-time are not available run-time. Libs used at link-time: $LIBS])
2082 dnl if this test fails, configure has already stopped
2087 dnl CURL_CHECK_VARIADIC_MACROS
2088 dnl -------------------------------------------------
2089 dnl Check compiler support of variadic macros
2091 AC_DEFUN([CURL_CHECK_VARIADIC_MACROS], [
2092 AC_CACHE_CHECK([for compiler support of C99 variadic macro style],
2093 [curl_cv_variadic_macros_c99], [
2096 #define c99_vmacro3(first, ...) fun3(first, __VA_ARGS__)
2097 #define c99_vmacro2(first, ...) fun2(first, __VA_ARGS__)
2098 int fun3(int arg1, int arg2, int arg3);
2099 int fun2(int arg1, int arg2);
2100 int fun3(int arg1, int arg2, int arg3)
2101 { return arg1 + arg2 + arg3; }
2102 int fun2(int arg1, int arg2)
2103 { return arg1 + arg2; }
2105 int res3 = c99_vmacro3(1, 2, 3);
2106 int res2 = c99_vmacro2(1, 2);
2109 curl_cv_variadic_macros_c99="yes"
2111 curl_cv_variadic_macros_c99="no"
2114 case "$curl_cv_variadic_macros_c99" in
2116 AC_DEFINE_UNQUOTED(HAVE_VARIADIC_MACROS_C99, 1,
2117 [Define to 1 if compiler supports C99 variadic macro style.])
2120 AC_CACHE_CHECK([for compiler support of old gcc variadic macro style],
2121 [curl_cv_variadic_macros_gcc], [
2124 #define gcc_vmacro3(first, args...) fun3(first, args)
2125 #define gcc_vmacro2(first, args...) fun2(first, args)
2126 int fun3(int arg1, int arg2, int arg3);
2127 int fun2(int arg1, int arg2);
2128 int fun3(int arg1, int arg2, int arg3)
2129 { return arg1 + arg2 + arg3; }
2130 int fun2(int arg1, int arg2)
2131 { return arg1 + arg2; }
2133 int res3 = gcc_vmacro3(1, 2, 3);
2134 int res2 = gcc_vmacro2(1, 2);
2137 curl_cv_variadic_macros_gcc="yes"
2139 curl_cv_variadic_macros_gcc="no"
2142 case "$curl_cv_variadic_macros_gcc" in
2144 AC_DEFINE_UNQUOTED(HAVE_VARIADIC_MACROS_GCC, 1,
2145 [Define to 1 if compiler supports old gcc variadic macro style.])
2151 dnl CURL_CHECK_CA_BUNDLE
2152 dnl -------------------------------------------------
2153 dnl Check if a default ca-bundle should be used
2155 dnl regarding the paths this will scan:
2156 dnl /etc/ssl/certs/ca-certificates.crt Debian systems
2157 dnl /etc/pki/tls/certs/ca-bundle.crt Redhat and Mandriva
2158 dnl /usr/share/ssl/certs/ca-bundle.crt old(er) Redhat
2159 dnl /usr/local/share/certs/ca-root-nss.crt FreeBSD
2160 dnl /etc/ssl/cert.pem OpenBSD, FreeBSD (symlink)
2161 dnl /etc/ssl/certs/ (ca path) SUSE
2163 AC_DEFUN([CURL_CHECK_CA_BUNDLE], [
2165 AC_MSG_CHECKING([default CA cert bundle/path])
2167 AC_ARG_WITH(ca-bundle,
2168 AC_HELP_STRING([--with-ca-bundle=FILE],
2169 [Path to a file containing CA certificates (example: /etc/ca-bundle.crt)])
2170 AC_HELP_STRING([--without-ca-bundle], [Don't use a default CA bundle]),
2173 if test "x$want_ca" = "xyes"; then
2174 AC_MSG_ERROR([--with-ca-bundle=FILE requires a path to the CA bundle])
2177 [ want_ca="unset" ])
2178 AC_ARG_WITH(ca-path,
2179 AC_HELP_STRING([--with-ca-path=DIRECTORY],
2180 [Path to a directory containing CA certificates stored individually, with \
2181 their filenames in a hash format. This option can be used with the OpenSSL, \
2182 GnuTLS and mbedTLS backends. Refer to OpenSSL c_rehash for details. \
2183 (example: /etc/certificates)])
2184 AC_HELP_STRING([--without-ca-path], [Don't use a default CA path]),
2186 want_capath="$withval"
2187 if test "x$want_capath" = "xyes"; then
2188 AC_MSG_ERROR([--with-ca-path=DIRECTORY requires a path to the CA path directory])
2191 [ want_capath="unset"])
2193 ca_warning=" (warning: certs not found)"
2194 capath_warning=" (warning: certs not found)"
2197 if test "x$want_ca" != "xno" -a "x$want_ca" != "xunset" -a \
2198 "x$want_capath" != "xno" -a "x$want_capath" != "xunset"; then
2201 capath="$want_capath"
2202 elif test "x$want_ca" != "xno" -a "x$want_ca" != "xunset"; then
2203 dnl --with-ca-bundle given
2206 elif test "x$want_capath" != "xno" -a "x$want_capath" != "xunset"; then
2207 dnl --with-ca-path given
2208 if test "x$OPENSSL_ENABLED" != "x1" -a "x$GNUTLS_ENABLED" != "x1" -a "x$MBEDTLS_ENABLED" != "x1"; then
2209 AC_MSG_ERROR([--with-ca-path only works with OpenSSL, GnuTLS or mbedTLS])
2211 capath="$want_capath"
2214 dnl first try autodetecting a CA bundle , then a CA path
2215 dnl both autodetections can be skipped by --without-ca-*
2218 if test "x$cross_compiling" != "xyes"; then
2219 dnl NOT cross-compiling and...
2220 dnl neither of the --with-ca-* options are provided
2221 if test "x$want_ca" = "xunset"; then
2222 dnl the path we previously would have installed the curl ca bundle
2223 dnl to, and thus we now check for an already existing cert in that
2224 dnl place in case we find no other
2225 if test "x$prefix" != xNONE; then
2226 cac="${prefix}/share/curl/curl-ca-bundle.crt"
2228 cac="$ac_default_prefix/share/curl/curl-ca-bundle.crt"
2231 for a in /etc/ssl/certs/ca-certificates.crt \
2232 /etc/pki/tls/certs/ca-bundle.crt \
2233 /usr/share/ssl/certs/ca-bundle.crt \
2234 /usr/local/share/certs/ca-root-nss.crt \
2237 if test -f "$a"; then
2243 if test "x$want_capath" = "xunset" -a "x$ca" = "xno" -a \
2244 "x$OPENSSL_ENABLED" = "x1"; then
2245 check_capath="/etc/ssl/certs/"
2248 dnl no option given and cross-compiling
2249 AC_MSG_WARN([skipped the ca-cert path detection when cross-compiling])
2253 if test "x$ca" = "xno" || test -f "$ca"; then
2257 if test "x$capath" != "xno"; then
2258 check_capath="$capath"
2261 if test ! -z "$check_capath"; then
2262 for a in "$check_capath"; do
2263 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
2264 if test "x$capath" = "xno"; then
2273 if test "x$capath" = "xno"; then
2277 if test "x$ca" != "xno"; then
2278 CURL_CA_BUNDLE='"'$ca'"'
2279 AC_DEFINE_UNQUOTED(CURL_CA_BUNDLE, "$ca", [Location of default ca bundle])
2280 AC_SUBST(CURL_CA_BUNDLE)
2281 AC_MSG_RESULT([$ca])
2283 if test "x$capath" != "xno"; then
2284 CURL_CA_PATH="\"$capath\""
2285 AC_DEFINE_UNQUOTED(CURL_CA_PATH, "$capath", [Location of default ca path])
2286 AC_MSG_RESULT([$capath (capath)])
2288 if test "x$ca" = "xno" && test "x$capath" = "xno"; then
2292 AC_MSG_CHECKING([whether to use builtin CA store of SSL library])
2293 AC_ARG_WITH(ca-fallback,
2294 AC_HELP_STRING([--with-ca-fallback], [Use the built in CA store of the SSL library])
2295 AC_HELP_STRING([--without-ca-fallback], [Don't use the built in CA store of the SSL library]),
2297 if test "x$with_ca_fallback" != "xyes" -a "x$with_ca_fallback" != "xno"; then
2298 AC_MSG_ERROR([--with-ca-fallback only allows yes or no as parameter])
2301 [ with_ca_fallback="no"])
2302 AC_MSG_RESULT([$with_ca_fallback])
2303 if test "x$with_ca_fallback" = "xyes"; then
2304 if test "x$OPENSSL_ENABLED" != "x1" -a "x$GNUTLS_ENABLED" != "x1"; then
2305 AC_MSG_ERROR([--with-ca-fallback only works with OpenSSL or GnuTLS])
2307 AC_DEFINE_UNQUOTED(CURL_CA_FALLBACK, 1, [define "1" to use built in CA store of SSL library ])
2311 dnl CURL_CHECK_WIN32_LARGEFILE
2312 dnl -------------------------------------------------
2313 dnl Check if curl's WIN32 large file will be used
2315 AC_DEFUN([CURL_CHECK_WIN32_LARGEFILE], [
2316 AC_REQUIRE([CURL_CHECK_HEADER_WINDOWS])dnl
2317 AC_MSG_CHECKING([whether build target supports WIN32 file API])
2318 curl_win32_file_api="no"
2319 if test "$curl_cv_header_windows_h" = "yes"; then
2320 if test x"$enable_largefile" != "xno"; then
2324 #if !defined(_WIN32_WCE) && \
2325 (defined(__MINGW32__) || \
2326 (defined(_MSC_VER) && (defined(_WIN32) || defined(_WIN64))))
2329 WIN32 large file API not supported.
2333 curl_win32_file_api="win32_large_files"
2336 if test "$curl_win32_file_api" = "no"; then
2340 #if defined(_WIN32_WCE) || defined(__MINGW32__) || defined(_MSC_VER)
2343 WIN32 small file API not supported.
2347 curl_win32_file_api="win32_small_files"
2351 case "$curl_win32_file_api" in
2353 AC_MSG_RESULT([yes (large file enabled)])
2354 AC_DEFINE_UNQUOTED(USE_WIN32_LARGE_FILES, 1,
2355 [Define to 1 if you are building a Windows target with large file support.])
2358 AC_MSG_RESULT([yes (large file disabled)])
2359 AC_DEFINE_UNQUOTED(USE_WIN32_SMALL_FILES, 1,
2360 [Define to 1 if you are building a Windows target without large file support.])
2368 dnl CURL_EXPORT_PCDIR ($pcdir)
2369 dnl ------------------------
2370 dnl if $pcdir is not empty, set PKG_CONFIG_LIBDIR to $pcdir and export
2372 dnl we need this macro since pkg-config distinguishes among empty and unset
2373 dnl variable while checking PKG_CONFIG_LIBDIR
2376 AC_DEFUN([CURL_EXPORT_PCDIR], [
2377 if test -n "$1"; then
2378 PKG_CONFIG_LIBDIR="$1"
2379 export PKG_CONFIG_LIBDIR
2383 dnl CURL_CHECK_PKGCONFIG ($module, [$pcdir])
2384 dnl ------------------------
2385 dnl search for the pkg-config tool. Set the PKGCONFIG variable to hold the
2386 dnl path to it, or 'no' if not found/present.
2388 dnl If pkg-config is present, check that it has info about the $module or
2389 dnl return "no" anyway!
2391 dnl Optionally PKG_CONFIG_LIBDIR may be given as $pcdir.
2394 AC_DEFUN([CURL_CHECK_PKGCONFIG], [
2395 if test -n "$PKG_CONFIG"; then
2396 PKGCONFIG="$PKG_CONFIG"
2398 AC_PATH_TOOL([PKGCONFIG], [pkg-config], [no],
2399 [$PATH:/usr/bin:/usr/local/bin])
2402 if test "x$PKGCONFIG" != "xno"; then
2403 AC_MSG_CHECKING([for $1 options with pkg-config])
2404 dnl ask pkg-config about $1
2405 itexists=`CURL_EXPORT_PCDIR([$2]) dnl
2406 $PKGCONFIG --exists $1 >/dev/null 2>&1 && echo 1`
2408 if test -z "$itexists"; then
2409 dnl pkg-config does not have info about the given module! set the
2410 dnl variable to 'no'
2414 AC_MSG_RESULT([found])
2420 dnl CURL_GENERATE_CONFIGUREHELP_PM
2421 dnl -------------------------------------------------
2422 dnl Generate test harness configurehelp.pm module, defining and
2423 dnl initializing some perl variables with values which are known
2424 dnl when the configure script runs. For portability reasons, test
2425 dnl harness needs information on how to run the C preprocessor.
2427 AC_DEFUN([CURL_GENERATE_CONFIGUREHELP_PM], [
2428 AC_REQUIRE([AC_PROG_CPP])dnl
2429 tmp_cpp=`eval echo "$ac_cpp" 2>/dev/null`
2430 if test -z "$tmp_cpp"; then
2433 cat >./tests/configurehelp.pm <<_EOF
2434 [@%:@] This is a generated file. Do not edit.
2436 package configurehelp;
2448 @ISA = qw(Exporter);
2454 \$Cpreprocessor = '$tmp_cpp';
2462 dnl Check if $cpp -P should be used for extract define values due to gcc 5
2463 dnl splitting up strings and defines between line outputs. gcc by default
2464 dnl (without -P) will show TEST EINVAL TEST as
2466 dnl # 13 "conftest.c"
2468 dnl # 13 "conftest.c" 3 4
2470 dnl # 13 "conftest.c"
2473 AC_DEFUN([CURL_CPP_P], [
2474 AC_MSG_CHECKING([if cpp -P is needed])
2475 AC_EGREP_CPP([TEST.*TEST], [
2478 ], [cpp=no], [cpp=yes])
2479 AC_MSG_RESULT([$cpp])
2481 dnl we need cpp -P so check if it works then
2482 if test "x$cpp" = "xyes"; then
2483 AC_MSG_CHECKING([if cpp -P works])
2484 OLDCPPFLAGS=$CPPFLAGS
2485 CPPFLAGS="$CPPFLAGS -P"
2486 AC_EGREP_CPP([TEST.*TEST], [
2489 ], [cpp_p=yes], [cpp_p=no])
2490 AC_MSG_RESULT([$cpp_p])
2492 if test "x$cpp_p" = "xno"; then
2493 AC_MSG_WARN([failed to figure out cpp -P alternative])
2500 dnl restore CPPFLAGS
2501 CPPFLAGS=$OLDCPPFLAGS
2511 dnl Check if -mmacosx-version-min, -miphoneos-version-min or any
2512 dnl similar are set manually, otherwise do. And set
2513 dnl -Werror=partial-availability.
2516 AC_DEFUN([CURL_MAC_CFLAGS], [
2525 AC_MSG_CHECKING([for good-to-use Mac CFLAGS])
2526 AC_MSG_RESULT([$tst_cflags]);
2528 if test "$tst_cflags" = "yes"; then
2529 AC_MSG_CHECKING([for *version-min in CFLAGS])
2531 if test -z "$(echo $CFLAGS | grep m.*os.*-version-min)"; then
2532 min="-mmacosx-version-min=10.8"
2533 CFLAGS="$CFLAGS $min"
2535 if test -z "$min"; then
2536 AC_MSG_RESULT([set by user])
2538 AC_MSG_RESULT([$min set])
2542 CFLAGS="$CFLAGS -Werror=partial-availability"
2543 AC_MSG_CHECKING([whether $CC accepts -Werror=partial-availability])
2544 AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
2545 [AC_MSG_RESULT([yes])],
2546 [AC_MSG_RESULT([no])
2547 CFLAGS=$old_CFLAGS])
2553 dnl CURL_SUPPORTS_BUILTIN_AVAILABLE
2555 dnl Check to see if the compiler supports __builtin_available. This built-in
2556 dnl compiler function first appeared in Apple LLVM 9.0.0. It's so new that, at
2557 dnl the time this macro was written, the function was not yet documented. Its
2558 dnl purpose is to return true if the code is running under a certain OS version
2561 AC_DEFUN([CURL_SUPPORTS_BUILTIN_AVAILABLE], [
2562 AC_MSG_CHECKING([to see if the compiler supports __builtin_available()])
2567 if (__builtin_available(macOS 10.8, iOS 5.0, *)) {}
2570 AC_MSG_RESULT([yes])
2571 AC_DEFINE_UNQUOTED(HAVE_BUILTIN_AVAILABLE, 1,
2572 [Define to 1 if you have the __builtin_available function.])