1 #***************************************************************************
3 # Project ___| | | | _ \| |
5 # | (__| |_| | _ <| |___
6 # \___|\___/|_| \_\_____|
8 # Copyright (C) 1998 - 2022, 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.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 # SPDX-License-Identifier: curl
23 #***************************************************************************
25 dnl CURL_CHECK_DEF (SYMBOL, [INCLUDES], [SILENT])
26 dnl -------------------------------------------------
27 dnl Use the C preprocessor to find out if the given object-style symbol
28 dnl is defined and get its expansion. This macro will not use default
29 dnl includes even if no INCLUDES argument is given. This macro will run
30 dnl silently when invoked with three arguments. If the expansion would
31 dnl result in a set of double-quoted strings the returned expansion will
32 dnl actually be a single double-quoted string concatenating all them.
34 AC_DEFUN([CURL_CHECK_DEF], [
35 AC_REQUIRE([CURL_CPP_P])dnl
37 # CPPPFLAG comes from CURL_CPP_P
38 CPPFLAGS="$CPPFLAGS $CPPPFLAG"
39 AS_VAR_PUSHDEF([ac_HaveDef], [curl_cv_have_def_$1])dnl
40 AS_VAR_PUSHDEF([ac_Def], [curl_cv_def_$1])dnl
41 if test -z "$SED"; then
42 AC_MSG_ERROR([SED not set. Cannot continue without SED being set.])
44 if test -z "$GREP"; then
45 AC_MSG_ERROR([GREP not set. Cannot continue without GREP being set.])
47 ifelse($3,,[AC_MSG_CHECKING([for preprocessor definition of $1])])
57 tmp_exp=`eval "$ac_cpp conftest.$ac_ext" 2>/dev/null | \
58 "$GREP" CURL_DEF_TOKEN 2>/dev/null | \
59 "$SED" 's/.*CURL_DEF_TOKEN[[ ]][[ ]]*//' 2>/dev/null | \
60 "$SED" 's/[["]][[ ]]*[["]]//g' 2>/dev/null`
61 if test -z "$tmp_exp" || test "$tmp_exp" = "$1"; then
65 if test -z "$tmp_exp"; then
66 AS_VAR_SET(ac_HaveDef, no)
67 ifelse($3,,[AC_MSG_RESULT([no])])
69 AS_VAR_SET(ac_HaveDef, yes)
70 AS_VAR_SET(ac_Def, $tmp_exp)
71 ifelse($3,,[AC_MSG_RESULT([$tmp_exp])])
73 AS_VAR_POPDEF([ac_Def])dnl
74 AS_VAR_POPDEF([ac_HaveDef])dnl
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.
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])])
97 force compilation error
102 tst_symbol_defined="yes"
104 tst_symbol_defined="no"
106 if test "$tst_symbol_defined" = "yes"; then
107 AS_VAR_SET(ac_HaveDef, yes)
108 ifelse($3,,[AC_MSG_RESULT([yes])])
110 AS_VAR_SET(ac_HaveDef, no)
111 ifelse($3,,[AC_MSG_RESULT([no])])
113 AS_VAR_POPDEF([ac_HaveDef])dnl
117 dnl CURL_CHECK_LIB_XNET
118 dnl -------------------------------------------------
119 dnl Verify if X/Open network library is required.
121 AC_DEFUN([CURL_CHECK_LIB_XNET], [
122 AC_MSG_CHECKING([if X/Open network library is required])
123 tst_lib_xnet_required="no"
128 #if defined(__hpux) && defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE >= 600)
130 #elif defined(__hpux) && defined(_XOPEN_SOURCE_EXTENDED)
133 force compilation error
138 tst_lib_xnet_required="yes"
141 AC_MSG_RESULT([$tst_lib_xnet_required])
145 dnl CURL_CHECK_AIX_ALL_SOURCE
146 dnl -------------------------------------------------
147 dnl Provides a replacement of traditional AC_AIX with
148 dnl an uniform behavior across all autoconf versions,
149 dnl and with our own placement rules.
151 AC_DEFUN([CURL_CHECK_AIX_ALL_SOURCE], [
152 AH_VERBATIM([_ALL_SOURCE],
153 [/* Define to 1 if OS is AIX. */
157 AC_BEFORE([$0], [AC_SYS_LARGEFILE])dnl
158 AC_BEFORE([$0], [CURL_CONFIGURE_REENTRANT])dnl
159 AC_BEFORE([$0], [CURL_CONFIGURE_PULL_SYS_POLL])dnl
160 AC_MSG_CHECKING([if OS is AIX (to define _ALL_SOURCE)])
161 AC_EGREP_CPP([yes_this_is_aix],[
167 AC_DEFINE(_ALL_SOURCE)
174 dnl CURL_CHECK_HEADER_WINDOWS
175 dnl -------------------------------------------------
176 dnl Check for compilable and valid windows.h header
178 AC_DEFUN([CURL_CHECK_HEADER_WINDOWS], [
179 AC_CACHE_CHECK([for windows.h], [curl_cv_header_windows_h], [
183 #ifndef WIN32_LEAN_AND_MEAN
184 #define WIN32_LEAN_AND_MEAN
188 #if defined(__CYGWIN__) || defined(__CEGCC__)
189 HAVE_WINDOWS_H shall not be defined.
195 curl_cv_header_windows_h="yes"
197 curl_cv_header_windows_h="no"
200 case "$curl_cv_header_windows_h" in
202 AC_DEFINE_UNQUOTED(HAVE_WINDOWS_H, 1,
203 [Define to 1 if you have the windows.h header file.])
209 dnl CURL_CHECK_NATIVE_WINDOWS
210 dnl -------------------------------------------------
211 dnl Check if building a native Windows target
213 AC_DEFUN([CURL_CHECK_NATIVE_WINDOWS], [
214 AC_REQUIRE([CURL_CHECK_HEADER_WINDOWS])dnl
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"
222 #if defined(__MINGW32__) || defined(__MINGW32CE__) || \
223 (defined(_MSC_VER) && (defined(_WIN32) || defined(_WIN64)))
226 Not a native Windows build target.
230 curl_cv_native_windows="yes"
232 curl_cv_native_windows="no"
236 AM_CONDITIONAL(DOING_NATIVE_WINDOWS, test "x$curl_cv_native_windows" = xyes)
240 dnl CURL_CHECK_HEADER_WINSOCK2
241 dnl -------------------------------------------------
242 dnl Check for compilable and valid winsock2.h header
244 AC_DEFUN([CURL_CHECK_HEADER_WINSOCK2], [
245 AC_REQUIRE([CURL_CHECK_HEADER_WINDOWS])dnl
246 AC_CACHE_CHECK([for winsock2.h], [curl_cv_header_winsock2_h], [
250 #ifndef WIN32_LEAN_AND_MEAN
251 #define WIN32_LEAN_AND_MEAN
254 #include <winsock2.h>
256 #if defined(__CYGWIN__) || defined(__CEGCC__) || defined(__MINGW32CE__)
257 HAVE_WINSOCK2_H shall not be defined.
259 int dummy=2*IPPROTO_ESP;
263 curl_cv_header_winsock2_h="yes"
265 curl_cv_header_winsock2_h="no"
268 case "$curl_cv_header_winsock2_h" in
270 AC_DEFINE_UNQUOTED(HAVE_WINSOCK2_H, 1,
271 [Define to 1 if you have the winsock2.h header file.])
277 dnl CURL_CHECK_HEADER_WS2TCPIP
278 dnl -------------------------------------------------
279 dnl Check for compilable and valid ws2tcpip.h header
281 AC_DEFUN([CURL_CHECK_HEADER_WS2TCPIP], [
282 AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK2])dnl
283 AC_CACHE_CHECK([for ws2tcpip.h], [curl_cv_header_ws2tcpip_h], [
287 #ifndef WIN32_LEAN_AND_MEAN
288 #define WIN32_LEAN_AND_MEAN
291 #include <winsock2.h>
292 #include <ws2tcpip.h>
294 #if defined(__CYGWIN__) || defined(__CEGCC__) || defined(__MINGW32CE__)
295 HAVE_WS2TCPIP_H shall not be defined.
297 int dummy=2*IP_PKTINFO;
301 curl_cv_header_ws2tcpip_h="yes"
303 curl_cv_header_ws2tcpip_h="no"
306 case "$curl_cv_header_ws2tcpip_h" in
308 AC_DEFINE_UNQUOTED(HAVE_WS2TCPIP_H, 1,
309 [Define to 1 if you have the ws2tcpip.h header file.])
315 dnl CURL_CHECK_HEADER_WINCRYPT
316 dnl -------------------------------------------------
317 dnl Check for compilable and valid wincrypt.h header
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], [
325 #ifndef WIN32_LEAN_AND_MEAN
326 #define WIN32_LEAN_AND_MEAN
329 #include <wincrypt.h>
331 int dummy=2*PROV_RSA_FULL;
334 curl_cv_header_wincrypt_h="yes"
336 curl_cv_header_wincrypt_h="no"
339 case "$curl_cv_header_wincrypt_h" in
341 AC_DEFINE_UNQUOTED(HAVE_WINCRYPT_H, 1,
342 [Define to 1 if you have the wincrypt.h header file.])
348 dnl CURL_CHECK_HEADER_WINLDAP
349 dnl -------------------------------------------------
350 dnl Check for compilable and valid winldap.h header
352 AC_DEFUN([CURL_CHECK_HEADER_WINLDAP], [
353 AC_REQUIRE([CURL_CHECK_HEADER_WINDOWS])dnl
354 AC_CACHE_CHECK([for winldap.h], [curl_cv_header_winldap_h], [
358 #ifdef HAVE_WINDOWS_H
359 #ifndef WIN32_LEAN_AND_MEAN
360 #define WIN32_LEAN_AND_MEAN
366 #if defined(__CYGWIN__) || defined(__CEGCC__)
367 HAVE_WINLDAP_H shall not be defined.
369 LDAP *ldp = ldap_init("dummy", LDAP_PORT);
370 ULONG res = ldap_unbind(ldp);
374 curl_cv_header_winldap_h="yes"
376 curl_cv_header_winldap_h="no"
379 case "$curl_cv_header_winldap_h" in
381 AC_DEFINE_UNQUOTED(HAVE_WINLDAP_H, 1,
382 [Define to 1 if you have the winldap.h header file.])
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
393 AC_DEFUN([CURL_CHECK_HEADER_LBER], [
394 AC_REQUIRE([CURL_CHECK_HEADER_WINDOWS])dnl
395 AC_CACHE_CHECK([for lber.h], [curl_cv_header_lber_h], [
399 #ifdef HAVE_WINDOWS_H
400 #ifndef WIN32_LEAN_AND_MEAN
401 #define WIN32_LEAN_AND_MEAN
405 #ifdef HAVE_SYS_TYPES_H
406 #include <sys/types.h>
410 #define NULL (void *)0
414 BerValue *bvp = NULL;
415 BerElement *bep = ber_init(bvp);
419 curl_cv_header_lber_h="yes"
421 curl_cv_header_lber_h="no"
424 if test "$curl_cv_header_lber_h" = "yes"; then
425 AC_DEFINE_UNQUOTED(HAVE_LBER_H, 1,
426 [Define to 1 if you have the lber.h header file.])
431 #ifdef HAVE_WINDOWS_H
432 #ifndef WIN32_LEAN_AND_MEAN
433 #define WIN32_LEAN_AND_MEAN
437 #ifdef HAVE_SYS_TYPES_H
438 #include <sys/types.h>
442 #define NULL (void *)0
444 #ifndef LDAP_DEPRECATED
445 #define LDAP_DEPRECATED 1
449 BerValue *bvp = NULL;
450 BerElement *bep = ber_init(bvp);
454 curl_cv_need_header_lber_h="no"
456 curl_cv_need_header_lber_h="yes"
459 case "$curl_cv_need_header_lber_h" in
461 AC_DEFINE_UNQUOTED(NEED_LBER_H, 1,
462 [Define to 1 if you need the lber.h header file even with ldap.h])
469 dnl CURL_CHECK_HEADER_LDAP
470 dnl -------------------------------------------------
471 dnl Check for compilable and valid ldap.h header
473 AC_DEFUN([CURL_CHECK_HEADER_LDAP], [
474 AC_REQUIRE([CURL_CHECK_HEADER_LBER])dnl
475 AC_CACHE_CHECK([for ldap.h], [curl_cv_header_ldap_h], [
479 #ifdef HAVE_WINDOWS_H
480 #ifndef WIN32_LEAN_AND_MEAN
481 #define WIN32_LEAN_AND_MEAN
485 #ifdef HAVE_SYS_TYPES_H
486 #include <sys/types.h>
489 #ifndef LDAP_DEPRECATED
490 #define LDAP_DEPRECATED 1
497 LDAP *ldp = ldap_init("dummy", LDAP_PORT);
498 int res = ldap_unbind(ldp);
501 curl_cv_header_ldap_h="yes"
503 curl_cv_header_ldap_h="no"
506 case "$curl_cv_header_ldap_h" in
508 AC_DEFINE_UNQUOTED(HAVE_LDAP_H, 1,
509 [Define to 1 if you have the ldap.h header file.])
515 dnl CURL_CHECK_HEADER_LDAP_SSL
516 dnl -------------------------------------------------
517 dnl Check for compilable and valid ldap_ssl.h header
519 AC_DEFUN([CURL_CHECK_HEADER_LDAP_SSL], [
520 AC_REQUIRE([CURL_CHECK_HEADER_LDAP])dnl
521 AC_CACHE_CHECK([for ldap_ssl.h], [curl_cv_header_ldap_ssl_h], [
525 #ifdef HAVE_WINDOWS_H
526 #ifndef WIN32_LEAN_AND_MEAN
527 #define WIN32_LEAN_AND_MEAN
531 #ifdef HAVE_SYS_TYPES_H
532 #include <sys/types.h>
535 #ifndef LDAP_DEPRECATED
536 #define LDAP_DEPRECATED 1
544 #include <ldap_ssl.h>
546 LDAP *ldp = ldapssl_init("dummy", LDAPS_PORT, 1);
549 curl_cv_header_ldap_ssl_h="yes"
551 curl_cv_header_ldap_ssl_h="no"
554 case "$curl_cv_header_ldap_ssl_h" in
556 AC_DEFINE_UNQUOTED(HAVE_LDAP_SSL_H, 1,
557 [Define to 1 if you have the ldap_ssl.h header file.])
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
568 dnl whitespace separated list of libraries to check
569 dnl before the WINLDAP default ones.
571 AC_DEFUN([CURL_CHECK_LIBS_WINLDAP], [
572 AC_REQUIRE([CURL_CHECK_HEADER_WINBER])dnl
574 AC_MSG_CHECKING([for WINLDAP libraries])
588 if test -z "$u_libs"; then
591 u_libs="$u_libs $l_lib"
596 curl_cv_save_LIBS="$LIBS"
597 curl_cv_ldap_LIBS="unknown"
599 for x_nlibs in '' "$u_libs" \
601 if test "$curl_cv_ldap_LIBS" = "unknown"; then
602 if test -z "$x_nlibs"; then
603 LIBS="$curl_cv_save_LIBS"
605 LIBS="$x_nlibs $curl_cv_save_LIBS"
610 #ifdef HAVE_WINDOWS_H
611 #ifndef WIN32_LEAN_AND_MEAN
612 #define WIN32_LEAN_AND_MEAN
615 #ifdef HAVE_WINLDAP_H
624 BerElement *bep = ber_init(bvp);
625 LDAP *ldp = ldap_init("dummy", LDAP_PORT);
626 ULONG res = ldap_unbind(ldp);
630 curl_cv_ldap_LIBS="$x_nlibs"
635 LIBS="$curl_cv_save_LIBS"
637 case X-"$curl_cv_ldap_LIBS" in
639 AC_MSG_RESULT([cannot find WINLDAP libraries])
642 AC_MSG_RESULT([no additional lib required])
645 if test -z "$curl_cv_save_LIBS"; then
646 LIBS="$curl_cv_ldap_LIBS"
648 LIBS="$curl_cv_ldap_LIBS $curl_cv_save_LIBS"
650 AC_MSG_RESULT([$curl_cv_ldap_LIBS])
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.
661 dnl This macro can take an optional parameter with a
662 dnl whitespace separated list of libraries to check
663 dnl before the default ones.
665 AC_DEFUN([CURL_CHECK_LIBS_LDAP], [
666 AC_REQUIRE([CURL_CHECK_HEADER_LDAP])dnl
668 AC_MSG_CHECKING([for LDAP libraries])
682 if test -z "$u_libs"; then
685 u_libs="$u_libs $l_lib"
690 curl_cv_save_LIBS="$LIBS"
691 curl_cv_ldap_LIBS="unknown"
693 for x_nlibs in '' "$u_libs" \
697 '-lldapssl -lldapx -lldapsdk' \
698 '-lldapsdk -lldapx -lldapssl' \
699 '-lldap -llber -lssl -lcrypto' ; do
701 if test "$curl_cv_ldap_LIBS" = "unknown"; then
702 if test -z "$x_nlibs"; then
703 LIBS="$curl_cv_save_LIBS"
705 LIBS="$x_nlibs $curl_cv_save_LIBS"
710 #ifdef HAVE_WINDOWS_H
711 #ifndef WIN32_LEAN_AND_MEAN
712 #define WIN32_LEAN_AND_MEAN
716 #ifdef HAVE_SYS_TYPES_H
717 #include <sys/types.h>
721 #define NULL (void *)0
723 #ifndef LDAP_DEPRECATED
724 #define LDAP_DEPRECATED 1
733 BerValue *bvp = NULL;
734 BerElement *bep = ber_init(bvp);
735 LDAP *ldp = ldap_init("dummy", LDAP_PORT);
736 int res = ldap_unbind(ldp);
740 curl_cv_ldap_LIBS="$x_nlibs"
745 LIBS="$curl_cv_save_LIBS"
747 case X-"$curl_cv_ldap_LIBS" in
749 AC_MSG_RESULT([cannot find LDAP libraries])
752 AC_MSG_RESULT([no additional lib required])
755 if test -z "$curl_cv_save_LIBS"; then
756 LIBS="$curl_cv_ldap_LIBS"
758 LIBS="$curl_cv_ldap_LIBS $curl_cv_save_LIBS"
760 AC_MSG_RESULT([$curl_cv_ldap_LIBS])
767 dnl TYPE_SOCKADDR_STORAGE
768 dnl -------------------------------------------------
769 dnl Check for struct sockaddr_storage. Most IPv6-enabled
770 dnl hosts have it, but AIX 4.3 is one known exception.
772 AC_DEFUN([TYPE_SOCKADDR_STORAGE],
774 AC_CHECK_TYPE([struct sockaddr_storage],
775 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE, 1,
776 [if struct sockaddr_storage is defined]), ,
779 #ifdef HAVE_WINDOWS_H
780 #ifndef WIN32_LEAN_AND_MEAN
781 #define WIN32_LEAN_AND_MEAN
784 #ifdef HAVE_WINSOCK2_H
785 #include <winsock2.h>
788 #ifdef HAVE_SYS_TYPES_H
789 #include <sys/types.h>
791 #ifdef HAVE_SYS_SOCKET_H
792 #include <sys/socket.h>
794 #ifdef HAVE_NETINET_IN_H
795 #include <netinet/in.h>
797 #ifdef HAVE_ARPA_INET_H
798 #include <arpa/inet.h>
804 dnl CURL_CHECK_FUNC_RECV
805 dnl -------------------------------------------------
806 dnl Test if the socket recv() function is available,
808 AC_DEFUN([CURL_CHECK_FUNC_RECV], [
809 AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK2])dnl
810 AC_REQUIRE([CURL_INCLUDES_BSDSOCKET])dnl
811 AC_CHECK_HEADERS(sys/types.h sys/socket.h)
813 AC_MSG_CHECKING([for recv])
817 #ifdef HAVE_WINDOWS_H
818 #ifndef WIN32_LEAN_AND_MEAN
819 #define WIN32_LEAN_AND_MEAN
822 #ifdef HAVE_WINSOCK2_H
823 #include <winsock2.h>
826 $curl_includes_bsdsocket
827 #ifdef HAVE_SYS_TYPES_H
828 #include <sys/types.h>
830 #ifdef HAVE_SYS_SOCKET_H
831 #include <sys/socket.h>
845 if test "$curl_cv_recv" = "yes"; then
846 AC_DEFINE_UNQUOTED(HAVE_RECV, 1,
847 [Define to 1 if you have the recv function.])
848 curl_cv_func_recv="yes"
850 AC_MSG_ERROR([Unable to link function recv])
855 dnl CURL_CHECK_FUNC_SEND
856 dnl -------------------------------------------------
857 dnl Test if the socket send() function is available,
859 AC_DEFUN([CURL_CHECK_FUNC_SEND], [
860 AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK2])dnl
861 AC_REQUIRE([CURL_INCLUDES_BSDSOCKET])dnl
862 AC_CHECK_HEADERS(sys/types.h sys/socket.h)
864 AC_MSG_CHECKING([for send])
868 #ifdef HAVE_WINDOWS_H
869 #ifndef WIN32_LEAN_AND_MEAN
870 #define WIN32_LEAN_AND_MEAN
873 #ifdef HAVE_WINSOCK2_H
874 #include <winsock2.h>
877 $curl_includes_bsdsocket
878 #ifdef HAVE_SYS_TYPES_H
879 #include <sys/types.h>
881 #ifdef HAVE_SYS_SOCKET_H
882 #include <sys/socket.h>
896 if test "$curl_cv_send" = "yes"; then
897 AC_DEFINE_UNQUOTED(HAVE_SEND, 1,
898 [Define to 1 if you have the send function.])
899 curl_cv_func_send="yes"
901 AC_MSG_ERROR([Unable to link function send])
905 dnl CURL_CHECK_MSG_NOSIGNAL
906 dnl -------------------------------------------------
907 dnl Check for MSG_NOSIGNAL
909 AC_DEFUN([CURL_CHECK_MSG_NOSIGNAL], [
910 AC_CHECK_HEADERS(sys/types.h sys/socket.h)
911 AC_CACHE_CHECK([for MSG_NOSIGNAL], [curl_cv_msg_nosignal], [
915 #ifdef HAVE_WINDOWS_H
916 #ifndef WIN32_LEAN_AND_MEAN
917 #define WIN32_LEAN_AND_MEAN
920 #ifdef HAVE_WINSOCK2_H
921 #include <winsock2.h>
924 #ifdef HAVE_SYS_TYPES_H
925 #include <sys/types.h>
927 #ifdef HAVE_SYS_SOCKET_H
928 #include <sys/socket.h>
932 int flag=MSG_NOSIGNAL;
935 curl_cv_msg_nosignal="yes"
937 curl_cv_msg_nosignal="no"
940 case "$curl_cv_msg_nosignal" in
942 AC_DEFINE_UNQUOTED(HAVE_MSG_NOSIGNAL, 1,
943 [Define to 1 if you have the MSG_NOSIGNAL flag.])
949 dnl CURL_CHECK_STRUCT_TIMEVAL
950 dnl -------------------------------------------------
951 dnl Check for timeval struct
953 AC_DEFUN([CURL_CHECK_STRUCT_TIMEVAL], [
954 AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK2])dnl
955 AC_CHECK_HEADERS(sys/types.h sys/time.h sys/socket.h)
956 AC_CACHE_CHECK([for struct timeval], [curl_cv_struct_timeval], [
960 #ifdef HAVE_WINDOWS_H
961 #ifndef WIN32_LEAN_AND_MEAN
962 #define WIN32_LEAN_AND_MEAN
965 #ifdef HAVE_WINSOCK2_H
966 #include <winsock2.h>
969 #ifdef HAVE_SYS_TYPES_H
970 #include <sys/types.h>
972 #ifdef HAVE_SYS_TIME_H
973 #include <sys/time.h>
976 #ifdef HAVE_SYS_SOCKET_H
977 #include <sys/socket.h>
985 curl_cv_struct_timeval="yes"
987 curl_cv_struct_timeval="no"
990 case "$curl_cv_struct_timeval" in
992 AC_DEFINE_UNQUOTED(HAVE_STRUCT_TIMEVAL, 1,
993 [Define to 1 if you have the timeval struct.])
1000 dnl -------------------------------------------------
1001 dnl Check for in_addr_t: it is used to receive the return code of inet_addr()
1002 dnl and a few other things.
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
1015 #ifdef HAVE_WINDOWS_H
1016 #ifndef WIN32_LEAN_AND_MEAN
1017 #define WIN32_LEAN_AND_MEAN
1019 #include <windows.h>
1020 #ifdef HAVE_WINSOCK2_H
1021 #include <winsock2.h>
1024 #ifdef HAVE_SYS_TYPES_H
1025 #include <sys/types.h>
1027 #ifdef HAVE_SYS_SOCKET_H
1028 #include <sys/socket.h>
1030 #ifdef HAVE_NETINET_IN_H
1031 #include <netinet/in.h>
1033 #ifdef HAVE_ARPA_INET_H
1034 #include <arpa/inet.h>
1038 $t data = inet_addr ("1.2.3.4");
1041 curl_cv_in_addr_t_equiv="$t"
1046 case "$curl_cv_in_addr_t_equiv" in
1048 AC_MSG_ERROR([Cannot find a type to use in place of in_addr_t])
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.])
1057 #ifdef HAVE_WINDOWS_H
1058 #ifndef WIN32_LEAN_AND_MEAN
1059 #define WIN32_LEAN_AND_MEAN
1061 #include <windows.h>
1062 #ifdef HAVE_WINSOCK2_H
1063 #include <winsock2.h>
1066 #ifdef HAVE_SYS_TYPES_H
1067 #include <sys/types.h>
1069 #ifdef HAVE_SYS_SOCKET_H
1070 #include <sys/socket.h>
1072 #ifdef HAVE_NETINET_IN_H
1073 #include <netinet/in.h>
1075 #ifdef HAVE_ARPA_INET_H
1076 #include <arpa/inet.h>
1083 dnl CURL_CHECK_FUNC_CLOCK_GETTIME_MONOTONIC
1084 dnl -------------------------------------------------
1085 dnl Check if monotonic clock_gettime is available.
1087 AC_DEFUN([CURL_CHECK_FUNC_CLOCK_GETTIME_MONOTONIC], [
1088 AC_CHECK_HEADERS(sys/types.h sys/time.h)
1089 AC_MSG_CHECKING([for monotonic clock_gettime])
1091 if test "x$dontwant_rt" = "xno" ; then
1094 #ifdef HAVE_SYS_TYPES_H
1095 #include <sys/types.h>
1097 #ifdef HAVE_SYS_TIME_H
1098 #include <sys/time.h>
1103 (void)clock_gettime(CLOCK_MONOTONIC, &ts);
1106 AC_MSG_RESULT([yes])
1107 curl_func_clock_gettime="yes"
1110 curl_func_clock_gettime="no"
1113 dnl Definition of HAVE_CLOCK_GETTIME_MONOTONIC is intentionally postponed
1114 dnl until library linking and run-time checks for clock_gettime succeed.
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.
1123 AC_DEFUN([CURL_CHECK_LIBS_CLOCK_GETTIME_MONOTONIC], [
1124 AC_REQUIRE([CURL_CHECK_FUNC_CLOCK_GETTIME_MONOTONIC])dnl
1126 if test "$curl_func_clock_gettime" = "yes"; then
1128 AC_MSG_CHECKING([for clock_gettime in libraries])
1130 curl_cv_save_LIBS="$LIBS"
1131 curl_cv_gclk_LIBS="unknown"
1133 for x_xlibs in '' '-lrt' '-lposix4' ; do
1134 if test "$curl_cv_gclk_LIBS" = "unknown"; then
1135 if test -z "$x_xlibs"; then
1136 LIBS="$curl_cv_save_LIBS"
1138 LIBS="$x_xlibs $curl_cv_save_LIBS"
1142 #ifdef HAVE_SYS_TYPES_H
1143 #include <sys/types.h>
1145 #ifdef HAVE_SYS_TIME_H
1146 #include <sys/time.h>
1151 (void)clock_gettime(CLOCK_MONOTONIC, &ts);
1154 curl_cv_gclk_LIBS="$x_xlibs"
1159 LIBS="$curl_cv_save_LIBS"
1161 case X-"$curl_cv_gclk_LIBS" in
1163 AC_MSG_RESULT([cannot find clock_gettime])
1164 AC_MSG_WARN([HAVE_CLOCK_GETTIME_MONOTONIC will not be defined])
1165 curl_func_clock_gettime="no"
1168 AC_MSG_RESULT([no additional lib required])
1169 curl_func_clock_gettime="yes"
1172 if test -z "$curl_cv_save_LIBS"; then
1173 LIBS="$curl_cv_gclk_LIBS"
1175 LIBS="$curl_cv_gclk_LIBS $curl_cv_save_LIBS"
1177 AC_MSG_RESULT([$curl_cv_gclk_LIBS])
1178 curl_func_clock_gettime="yes"
1182 dnl only do runtime verification when not cross-compiling
1183 if test "x$cross_compiling" != "xyes" &&
1184 test "$curl_func_clock_gettime" = "yes"; then
1185 AC_MSG_CHECKING([if monotonic clock_gettime works])
1188 #ifdef HAVE_STDLIB_H
1191 #ifdef HAVE_SYS_TYPES_H
1192 #include <sys/types.h>
1194 #ifdef HAVE_SYS_TIME_H
1195 #include <sys/time.h>
1200 if (0 == clock_gettime(CLOCK_MONOTONIC, &ts))
1206 AC_MSG_RESULT([yes])
1209 AC_MSG_WARN([HAVE_CLOCK_GETTIME_MONOTONIC will not be defined])
1210 curl_func_clock_gettime="no"
1211 LIBS="$curl_cv_save_LIBS"
1215 case "$curl_func_clock_gettime" in
1217 AC_DEFINE_UNQUOTED(HAVE_CLOCK_GETTIME_MONOTONIC, 1,
1218 [Define to 1 if you have the clock_gettime function and monotonic timer.])
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.
1232 AC_DEFUN([CURL_CHECK_LIBS_CONNECT], [
1233 AC_REQUIRE([CURL_INCLUDES_WINSOCK2])dnl
1234 AC_REQUIRE([CURL_INCLUDES_BSDSOCKET])dnl
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"
1243 $curl_includes_winsock2
1244 $curl_includes_bsdsocket
1245 #if !defined(HAVE_WINDOWS_H) && !defined(HAVE_PROTO_BSDSOCKET_H)
1246 int connect(int, void*, int);
1249 if(0 != connect(0, 0, 0))
1253 tst_connect_need_LIBS="$tst_lib"
1257 LIBS="$tst_connect_save_LIBS"
1259 case X-"$tst_connect_need_LIBS" in
1261 AC_MSG_RESULT([cannot find connect])
1262 AC_MSG_ERROR([cannot find connect function in libraries.])
1265 AC_MSG_RESULT([yes])
1268 AC_MSG_RESULT([$tst_connect_need_LIBS])
1269 LIBS="$tst_connect_need_LIBS $tst_connect_save_LIBS"
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.
1288 AC_DEFUN([CURL_DEFINE_UNQUOTED], [
1289 cat >>confdefs.h <<_EOF
1290 [@%:@define] $1 ifelse($#, 2, [$2], 1)
1294 dnl CURL_CONFIGURE_PULL_SYS_POLL
1295 dnl -------------------------------------------------
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'.
1299 AC_DEFUN([CURL_CONFIGURE_PULL_SYS_POLL], [
1300 AC_REQUIRE([CURL_INCLUDES_POLL])dnl
1302 tst_poll_events_macro_defined="unknown"
1308 #if defined(events) || defined(revents)
1311 force compilation error
1315 tst_poll_events_macro_defined="yes"
1317 tst_poll_events_macro_defined="no"
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])
1329 dnl CURL_CHECK_FUNC_SELECT
1330 dnl -------------------------------------------------
1331 dnl Test if the socket select() function is available.
1333 AC_DEFUN([CURL_CHECK_FUNC_SELECT], [
1334 AC_REQUIRE([CURL_CHECK_STRUCT_TIMEVAL])dnl
1335 AC_REQUIRE([CURL_INCLUDES_BSDSOCKET])dnl
1336 AC_CHECK_HEADERS(sys/select.h sys/socket.h)
1338 AC_MSG_CHECKING([for select])
1342 #ifdef HAVE_WINDOWS_H
1343 #ifndef WIN32_LEAN_AND_MEAN
1344 #define WIN32_LEAN_AND_MEAN
1346 #include <windows.h>
1347 #ifdef HAVE_WINSOCK2_H
1348 #include <winsock2.h>
1351 #ifdef HAVE_SYS_TYPES_H
1352 #include <sys/types.h>
1354 #ifdef HAVE_SYS_TIME_H
1355 #include <sys/time.h>
1358 #ifndef HAVE_WINDOWS_H
1359 #ifdef HAVE_SYS_SELECT_H
1360 #include <sys/select.h>
1361 #elif defined(HAVE_UNISTD_H)
1364 #ifdef HAVE_SYS_SOCKET_H
1365 #include <sys/socket.h>
1367 $curl_includes_bsdsocket
1370 select(0, 0, 0, 0, 0);
1373 AC_MSG_RESULT([yes])
1374 curl_cv_select="yes"
1380 if test "$curl_cv_select" = "yes"; then
1381 AC_DEFINE_UNQUOTED(HAVE_SELECT, 1,
1382 [Define to 1 if you have the select function.])
1383 curl_cv_func_select="yes"
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.
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.
1398 AC_DEFUN([CURL_VERIFY_RUNTIMELIBS], [
1400 dnl this test is of course not sensible if we are cross-compiling!
1401 if test "x$cross_compiling" != xyes; then
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])
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])
1417 dnl if this test fails, configure has already stopped
1422 dnl CURL_CHECK_VARIADIC_MACROS
1423 dnl -------------------------------------------------
1424 dnl Check compiler support of variadic macros
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], [
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; }
1440 int res3 = c99_vmacro3(1, 2, 3);
1441 int res2 = c99_vmacro2(1, 2);
1444 curl_cv_variadic_macros_c99="yes"
1446 curl_cv_variadic_macros_c99="no"
1449 case "$curl_cv_variadic_macros_c99" in
1451 AC_DEFINE_UNQUOTED(HAVE_VARIADIC_MACROS_C99, 1,
1452 [Define to 1 if compiler supports C99 variadic macro style.])
1455 AC_CACHE_CHECK([for compiler support of old gcc variadic macro style],
1456 [curl_cv_variadic_macros_gcc], [
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; }
1468 int res3 = gcc_vmacro3(1, 2, 3);
1469 int res2 = gcc_vmacro2(1, 2);
1472 curl_cv_variadic_macros_gcc="yes"
1474 curl_cv_variadic_macros_gcc="no"
1477 case "$curl_cv_variadic_macros_gcc" in
1479 AC_DEFINE_UNQUOTED(HAVE_VARIADIC_MACROS_GCC, 1,
1480 [Define to 1 if compiler supports old gcc variadic macro style.])
1486 dnl CURL_CHECK_CA_BUNDLE
1487 dnl -------------------------------------------------
1488 dnl Check if a default ca-bundle should be used
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
1494 dnl /usr/local/share/certs/ca-root-nss.crt FreeBSD, MidnightBSD
1495 dnl /etc/ssl/cert.pem OpenBSD, FreeBSD, MidnightBSD (symlink)
1496 dnl /etc/ssl/certs/ (ca path) SUSE
1498 AC_DEFUN([CURL_CHECK_CA_BUNDLE], [
1500 AC_MSG_CHECKING([default CA cert bundle/path])
1502 AC_ARG_WITH(ca-bundle,
1503 AS_HELP_STRING([--with-ca-bundle=FILE],
1504 [Path to a file containing CA certificates (example: /etc/ca-bundle.crt)])
1505 AS_HELP_STRING([--without-ca-bundle], [Don't use a default CA bundle]),
1508 if test "x$want_ca" = "xyes"; then
1509 AC_MSG_ERROR([--with-ca-bundle=FILE requires a path to the CA bundle])
1512 [ want_ca="unset" ])
1513 AC_ARG_WITH(ca-path,
1514 AS_HELP_STRING([--with-ca-path=DIRECTORY],
1515 [Path to a directory containing CA certificates stored individually, with \
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. \
1518 (example: /etc/certificates)])
1519 AS_HELP_STRING([--without-ca-path], [Don't use a default CA path]),
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])
1526 [ want_capath="unset"])
1528 ca_warning=" (warning: certs not found)"
1529 capath_warning=" (warning: certs not found)"
1532 if test "x$want_ca" != "xno" -a "x$want_ca" != "xunset" -a \
1533 "x$want_capath" != "xno" -a "x$want_capath" != "xunset"; then
1536 capath="$want_capath"
1537 elif test "x$want_ca" != "xno" -a "x$want_ca" != "xunset"; then
1538 dnl --with-ca-bundle given
1541 elif test "x$want_capath" != "xno" -a "x$want_capath" != "xunset"; then
1542 dnl --with-ca-path given
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])
1546 capath="$want_capath"
1549 dnl first try autodetecting a CA bundle , then a CA path
1550 dnl both autodetections can be skipped by --without-ca-*
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"
1563 cac="$ac_default_prefix/share/curl/curl-ca-bundle.crt"
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 \
1569 /usr/local/share/certs/ca-root-nss.crt \
1572 if test -f "$a"; then
1578 if test "x$want_capath" = "xunset" -a "x$ca" = "xno" -a \
1579 "x$OPENSSL_ENABLED" = "x1"; then
1580 check_capath="/etc/ssl/certs/"
1583 dnl no option given and cross-compiling
1584 AC_MSG_WARN([skipped the ca-cert path detection when cross-compiling])
1588 if test "x$ca" = "xno" || test -f "$ca"; then
1592 if test "x$capath" != "xno"; then
1593 check_capath="$capath"
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
1608 if test "x$capath" = "xno"; then
1612 if test "x$ca" != "xno"; then
1613 CURL_CA_BUNDLE='"'$ca'"'
1614 AC_DEFINE_UNQUOTED(CURL_CA_BUNDLE, "$ca", [Location of default ca bundle])
1615 AC_SUBST(CURL_CA_BUNDLE)
1616 AC_MSG_RESULT([$ca])
1618 if test "x$capath" != "xno"; then
1619 CURL_CA_PATH="\"$capath\""
1620 AC_DEFINE_UNQUOTED(CURL_CA_PATH, "$capath", [Location of default ca path])
1621 AC_MSG_RESULT([$capath (capath)])
1623 if test "x$ca" = "xno" && test "x$capath" = "xno"; then
1627 AC_MSG_CHECKING([whether to use builtin CA store of SSL library])
1628 AC_ARG_WITH(ca-fallback,
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]),
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])
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])
1642 AC_DEFINE_UNQUOTED(CURL_CA_FALLBACK, 1, [define "1" to use built in CA store of SSL library ])
1646 dnl CURL_CHECK_WIN32_LARGEFILE
1647 dnl -------------------------------------------------
1648 dnl Check if curl's WIN32 large file will be used
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"
1654 if test "$curl_cv_header_windows_h" = "yes"; then
1655 if test x"$enable_largefile" != "xno"; then
1659 #if !defined(_WIN32_WCE) && \
1660 (defined(__MINGW32__) || \
1661 (defined(_MSC_VER) && (defined(_WIN32) || defined(_WIN64))))
1664 WIN32 large file API not supported.
1668 curl_win32_file_api="win32_large_files"
1671 if test "$curl_win32_file_api" = "no"; then
1675 #if defined(_WIN32_WCE) || defined(__MINGW32__) || defined(_MSC_VER)
1678 WIN32 small file API not supported.
1682 curl_win32_file_api="win32_small_files"
1686 case "$curl_win32_file_api" in
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.])
1691 AC_SUBST(USE_WIN32_LARGE_FILES, [1])
1694 AC_MSG_RESULT([yes (large file disabled)])
1695 AC_DEFINE_UNQUOTED(USE_WIN32_SMALL_FILES, 1,
1696 [Define to 1 if you are building a Windows target without large file support.])
1697 AC_SUBST(USE_WIN32_SMALL_FILES, [1])
1705 dnl CURL_CHECK_WIN32_CRYPTO
1706 dnl -------------------------------------------------
1707 dnl Check if curl's WIN32 crypto lib can be used
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
1717 #ifndef WIN32_LEAN_AND_MEAN
1718 #define WIN32_LEAN_AND_MEAN
1720 #include <windows.h>
1721 #include <wincrypt.h>
1723 HCRYPTPROV hCryptProv;
1724 if(CryptAcquireContext(&hCryptProv, NULL, NULL, PROV_RSA_FULL,
1725 CRYPT_VERIFYCONTEXT | CRYPT_SILENT)) {
1726 CryptReleaseContext(hCryptProv, 0);
1730 curl_win32_crypto_api="yes"
1733 case "$curl_win32_crypto_api" in
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])
1746 dnl CURL_EXPORT_PCDIR ($pcdir)
1747 dnl ------------------------
1748 dnl if $pcdir is not empty, set PKG_CONFIG_LIBDIR to $pcdir and export
1750 dnl we need this macro since pkg-config distinguishes among empty and unset
1751 dnl variable while checking PKG_CONFIG_LIBDIR
1754 AC_DEFUN([CURL_EXPORT_PCDIR], [
1755 if test -n "$1"; then
1756 PKG_CONFIG_LIBDIR="$1"
1757 export PKG_CONFIG_LIBDIR
1761 dnl CURL_CHECK_PKGCONFIG ($module, [$pcdir])
1762 dnl ------------------------
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.
1766 dnl If pkg-config is present, check that it has info about the $module or
1767 dnl return "no" anyway!
1769 dnl Optionally PKG_CONFIG_LIBDIR may be given as $pcdir.
1772 AC_DEFUN([CURL_CHECK_PKGCONFIG], [
1773 if test -n "$PKG_CONFIG"; then
1774 PKGCONFIG="$PKG_CONFIG"
1776 AC_PATH_TOOL([PKGCONFIG], [pkg-config], [no],
1777 [$PATH:/usr/bin:/usr/local/bin])
1780 if test "x$PKGCONFIG" != "xno"; then
1781 AC_MSG_CHECKING([for $1 options with pkg-config])
1782 dnl ask pkg-config about $1
1783 itexists=`CURL_EXPORT_PCDIR([$2]) dnl
1784 $PKGCONFIG --exists $1 >/dev/null 2>&1 && echo 1`
1786 if test -z "$itexists"; then
1787 dnl pkg-config does not have info about the given module! set the
1788 dnl variable to 'no'
1792 AC_MSG_RESULT([found])
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.
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
1811 cat >./tests/configurehelp.pm <<_EOF
1812 [@%:@] This is a generated file. Do not edit.
1814 package configurehelp;
1826 @ISA = qw(Exporter);
1832 \$Cpreprocessor = '$tmp_cpp';
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
1844 dnl # 13 "conftest.c"
1846 dnl # 13 "conftest.c" 3 4
1848 dnl # 13 "conftest.c"
1851 AC_DEFUN([CURL_CPP_P], [
1852 AC_MSG_CHECKING([if cpp -P is needed])
1853 AC_EGREP_CPP([TEST.*TEST], [
1856 ], [cpp=no], [cpp=yes])
1857 AC_MSG_RESULT([$cpp])
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], [
1867 ], [cpp_p=yes], [cpp_p=no])
1868 AC_MSG_RESULT([$cpp_p])
1870 if test "x$cpp_p" = "xno"; then
1871 AC_MSG_WARN([failed to figure out cpp -P alternative])
1878 dnl restore CPPFLAGS
1879 CPPFLAGS=$OLDCPPFLAGS
1887 dnl CURL_DARWIN_CFLAGS
1889 dnl Set -Werror=partial-availability to detect possible breaking code
1890 dnl with very low deployment targets.
1893 AC_DEFUN([CURL_DARWIN_CFLAGS], [
1902 AC_MSG_CHECKING([for good-to-use Darwin CFLAGS])
1903 AC_MSG_RESULT([$tst_cflags]);
1905 if test "$tst_cflags" = "yes"; then
1907 CFLAGS="$CFLAGS -Werror=partial-availability"
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])
1918 dnl CURL_SUPPORTS_BUILTIN_AVAILABLE
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
1926 AC_DEFUN([CURL_SUPPORTS_BUILTIN_AVAILABLE], [
1927 AC_MSG_CHECKING([to see if the compiler supports __builtin_available()])
1932 if (__builtin_available(macOS 10.8, iOS 5.0, *)) {}
1935 AC_MSG_RESULT([yes])
1936 AC_DEFINE_UNQUOTED(HAVE_BUILTIN_AVAILABLE, 1,
1937 [Define to 1 if you have the __builtin_available function.])