1 #***************************************************************************
3 # Project ___| | | | _ \| |
5 # | (__| |_| | _ <| |___
6 # \___|\___/|_| \_\_____|
8 # Copyright (C) 1998 - 2008, 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 http://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.
22 ###########################################################################
25 dnl CURL_CHECK_HEADER_WINDOWS
26 dnl -------------------------------------------------
27 dnl Check for compilable and valid windows.h header
29 AC_DEFUN([CURL_CHECK_HEADER_WINDOWS], [
30 AC_CACHE_CHECK([for windows.h], [ac_cv_header_windows_h], [
34 #ifndef WIN32_LEAN_AND_MEAN
35 #define WIN32_LEAN_AND_MEAN
40 HAVE_WINDOWS_H shall not be defined.
46 ac_cv_header_windows_h="yes"
48 ac_cv_header_windows_h="no"
51 case "$ac_cv_header_windows_h" in
53 AC_DEFINE_UNQUOTED(HAVE_WINDOWS_H, 1,
54 [Define to 1 if you have the windows.h header file.])
55 AC_DEFINE_UNQUOTED(WIN32_LEAN_AND_MEAN, 1,
56 [Define to avoid automatic inclusion of winsock.h])
62 dnl CURL_CHECK_HEADER_WINSOCK
63 dnl -------------------------------------------------
64 dnl Check for compilable and valid winsock.h header
66 AC_DEFUN([CURL_CHECK_HEADER_WINSOCK], [
67 AC_REQUIRE([CURL_CHECK_HEADER_WINDOWS])dnl
68 AC_CACHE_CHECK([for winsock.h], [ac_cv_header_winsock_h], [
72 #ifndef WIN32_LEAN_AND_MEAN
73 #define WIN32_LEAN_AND_MEAN
79 HAVE_WINSOCK_H shall not be defined.
81 int dummy=WSACleanup();
85 ac_cv_header_winsock_h="yes"
87 ac_cv_header_winsock_h="no"
90 case "$ac_cv_header_winsock_h" in
92 AC_DEFINE_UNQUOTED(HAVE_WINSOCK_H, 1,
93 [Define to 1 if you have the winsock.h header file.])
99 dnl CURL_CHECK_HEADER_WINSOCK2
100 dnl -------------------------------------------------
101 dnl Check for compilable and valid winsock2.h header
103 AC_DEFUN([CURL_CHECK_HEADER_WINSOCK2], [
104 AC_REQUIRE([CURL_CHECK_HEADER_WINDOWS])dnl
105 AC_CACHE_CHECK([for winsock2.h], [ac_cv_header_winsock2_h], [
109 #ifndef WIN32_LEAN_AND_MEAN
110 #define WIN32_LEAN_AND_MEAN
113 #include <winsock2.h>
116 HAVE_WINSOCK2_H shall not be defined.
118 int dummy=2*IPPROTO_ESP;
122 ac_cv_header_winsock2_h="yes"
124 ac_cv_header_winsock2_h="no"
127 case "$ac_cv_header_winsock2_h" in
129 AC_DEFINE_UNQUOTED(HAVE_WINSOCK2_H, 1,
130 [Define to 1 if you have the winsock2.h header file.])
136 dnl CURL_CHECK_HEADER_WS2TCPIP
137 dnl -------------------------------------------------
138 dnl Check for compilable and valid ws2tcpip.h header
140 AC_DEFUN([CURL_CHECK_HEADER_WS2TCPIP], [
141 AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK2])dnl
142 AC_CACHE_CHECK([for ws2tcpip.h], [ac_cv_header_ws2tcpip_h], [
146 #ifndef WIN32_LEAN_AND_MEAN
147 #define WIN32_LEAN_AND_MEAN
150 #include <winsock2.h>
151 #include <ws2tcpip.h>
154 HAVE_WS2TCPIP_H shall not be defined.
156 int dummy=2*IP_PKTINFO;
160 ac_cv_header_ws2tcpip_h="yes"
162 ac_cv_header_ws2tcpip_h="no"
165 case "$ac_cv_header_ws2tcpip_h" in
167 AC_DEFINE_UNQUOTED(HAVE_WS2TCPIP_H, 1,
168 [Define to 1 if you have the ws2tcpip.h header file.])
174 dnl CURL_CHECK_HEADER_WINLDAP
175 dnl -------------------------------------------------
176 dnl Check for compilable and valid winldap.h header
178 AC_DEFUN([CURL_CHECK_HEADER_WINLDAP], [
179 AC_REQUIRE([CURL_CHECK_HEADER_WINDOWS])dnl
180 AC_CACHE_CHECK([for winldap.h], [ac_cv_header_winldap_h], [
184 #ifdef HAVE_WINDOWS_H
185 #ifndef WIN32_LEAN_AND_MEAN
186 #define WIN32_LEAN_AND_MEAN
193 HAVE_WINLDAP_H shall not be defined.
195 LDAP *ldp = ldap_init("dummy", LDAP_PORT);
196 ULONG res = ldap_unbind(ldp);
200 ac_cv_header_winldap_h="yes"
202 ac_cv_header_winldap_h="no"
205 case "$ac_cv_header_winldap_h" in
207 AC_DEFINE_UNQUOTED(HAVE_WINLDAP_H, 1,
208 [Define to 1 if you have the winldap.h header file.])
214 dnl CURL_CHECK_HEADER_WINBER
215 dnl -------------------------------------------------
216 dnl Check for compilable and valid winber.h header
218 AC_DEFUN([CURL_CHECK_HEADER_WINBER], [
219 AC_REQUIRE([CURL_CHECK_HEADER_WINLDAP])dnl
220 AC_CACHE_CHECK([for winber.h], [ac_cv_header_winber_h], [
224 #ifdef HAVE_WINDOWS_H
225 #ifndef WIN32_LEAN_AND_MEAN
226 #define WIN32_LEAN_AND_MEAN
234 HAVE_WINBER_H shall not be defined.
237 BerElement *bep = ber_init(bvp);
242 ac_cv_header_winber_h="yes"
244 ac_cv_header_winber_h="no"
247 case "$ac_cv_header_winber_h" in
249 AC_DEFINE_UNQUOTED(HAVE_WINBER_H, 1,
250 [Define to 1 if you have the winber.h header file.])
256 dnl CURL_CHECK_HEADER_LBER
257 dnl -------------------------------------------------
258 dnl Check for compilable and valid lber.h header,
259 dnl and check if it is needed even with ldap.h
261 AC_DEFUN([CURL_CHECK_HEADER_LBER], [
262 AC_REQUIRE([CURL_CHECK_HEADER_WINDOWS])dnl
263 AC_CACHE_CHECK([for lber.h], [ac_cv_header_lber_h], [
267 #ifdef HAVE_WINDOWS_H
268 #ifndef WIN32_LEAN_AND_MEAN
269 #define WIN32_LEAN_AND_MEAN
273 #ifdef HAVE_SYS_TYPES_H
274 #include <sys/types.h>
278 #define NULL (void *)0
282 BerValue *bvp = NULL;
283 BerElement *bep = ber_init(bvp);
287 ac_cv_header_lber_h="yes"
289 ac_cv_header_lber_h="no"
292 if test "$ac_cv_header_lber_h" = "yes"; then
293 AC_DEFINE_UNQUOTED(HAVE_LBER_H, 1,
294 [Define to 1 if you have the lber.h header file.])
299 #ifdef HAVE_WINDOWS_H
300 #ifndef WIN32_LEAN_AND_MEAN
301 #define WIN32_LEAN_AND_MEAN
305 #ifdef HAVE_SYS_TYPES_H
306 #include <sys/types.h>
310 #define NULL (void *)0
312 #ifndef LDAP_DEPRECATED
313 #define LDAP_DEPRECATED 1
317 BerValue *bvp = NULL;
318 BerElement *bep = ber_init(bvp);
322 curl_cv_need_header_lber_h="no"
324 curl_cv_need_header_lber_h="yes"
327 case "$curl_cv_need_header_lber_h" in
329 AC_DEFINE_UNQUOTED(NEED_LBER_H, 1,
330 [Define to 1 if you need the lber.h header file even with ldap.h])
337 dnl CURL_CHECK_HEADER_LDAP
338 dnl -------------------------------------------------
339 dnl Check for compilable and valid ldap.h header
341 AC_DEFUN([CURL_CHECK_HEADER_LDAP], [
342 AC_REQUIRE([CURL_CHECK_HEADER_LBER])dnl
343 AC_CACHE_CHECK([for ldap.h], [ac_cv_header_ldap_h], [
347 #ifdef HAVE_WINDOWS_H
348 #ifndef WIN32_LEAN_AND_MEAN
349 #define WIN32_LEAN_AND_MEAN
353 #ifdef HAVE_SYS_TYPES_H
354 #include <sys/types.h>
357 #ifndef LDAP_DEPRECATED
358 #define LDAP_DEPRECATED 1
365 LDAP *ldp = ldap_init("dummy", LDAP_PORT);
366 int res = ldap_unbind(ldp);
369 ac_cv_header_ldap_h="yes"
371 ac_cv_header_ldap_h="no"
374 case "$ac_cv_header_ldap_h" in
376 AC_DEFINE_UNQUOTED(HAVE_LDAP_H, 1,
377 [Define to 1 if you have the ldap.h header file.])
383 dnl CURL_CHECK_HEADER_LDAP_SSL
384 dnl -------------------------------------------------
385 dnl Check for compilable and valid ldap_ssl.h header
387 AC_DEFUN([CURL_CHECK_HEADER_LDAP_SSL], [
388 AC_REQUIRE([CURL_CHECK_HEADER_LDAP])dnl
389 AC_CACHE_CHECK([for ldap_ssl.h], [ac_cv_header_ldap_ssl_h], [
393 #ifdef HAVE_WINDOWS_H
394 #ifndef WIN32_LEAN_AND_MEAN
395 #define WIN32_LEAN_AND_MEAN
399 #ifdef HAVE_SYS_TYPES_H
400 #include <sys/types.h>
403 #ifndef LDAP_DEPRECATED
404 #define LDAP_DEPRECATED 1
412 #include <ldap_ssl.h>
414 LDAP *ldp = ldapssl_init("dummy", LDAPS_PORT, 1);
417 ac_cv_header_ldap_ssl_h="yes"
419 ac_cv_header_ldap_ssl_h="no"
422 case "$ac_cv_header_ldap_ssl_h" in
424 AC_DEFINE_UNQUOTED(HAVE_LDAP_SSL_H, 1,
425 [Define to 1 if you have the ldap_ssl.h header file.])
431 dnl CURL_CHECK_HEADER_LDAPSSL
432 dnl -------------------------------------------------
433 dnl Check for compilable and valid ldapssl.h header
435 AC_DEFUN([CURL_CHECK_HEADER_LDAPSSL], [
436 AC_REQUIRE([CURL_CHECK_HEADER_LDAP])dnl
437 AC_CACHE_CHECK([for ldapssl.h], [ac_cv_header_ldapssl_h], [
441 #ifdef HAVE_WINDOWS_H
442 #ifndef WIN32_LEAN_AND_MEAN
443 #define WIN32_LEAN_AND_MEAN
447 #ifdef HAVE_SYS_TYPES_H
448 #include <sys/types.h>
452 #define NULL (void *)0
454 #ifndef LDAP_DEPRECATED
455 #define LDAP_DEPRECATED 1
465 char *cert_label = NULL;
466 LDAP *ldp = ldap_ssl_init("dummy", LDAPS_PORT, cert_label);
469 ac_cv_header_ldapssl_h="yes"
471 ac_cv_header_ldapssl_h="no"
474 case "$ac_cv_header_ldapssl_h" in
476 AC_DEFINE_UNQUOTED(HAVE_LDAPSSL_H, 1,
477 [Define to 1 if you have the ldapssl.h header file.])
483 dnl CURL_CHECK_LIBS_WINLDAP
484 dnl -------------------------------------------------
485 dnl Check for libraries needed for WINLDAP support,
486 dnl and prepended to LIBS any needed libraries.
487 dnl This macro can take an optional parameter with a
488 dnl white space separated list of libraries to check
489 dnl before the WINLDAP default ones.
491 AC_DEFUN([CURL_CHECK_LIBS_WINLDAP], [
492 AC_REQUIRE([CURL_CHECK_HEADER_WINBER])dnl
494 AC_MSG_CHECKING([for WINLDAP libraries])
508 if test -z "$u_libs"; then
511 u_libs="$u_libs $l_lib"
516 curl_cv_save_LIBS="$LIBS"
517 curl_cv_ldap_LIBS="unknown"
519 for x_nlibs in '' "$u_libs" \
521 if test -z "$x_nlibs"; then
522 LIBS="$curl_cv_save_LIBS"
524 LIBS="$x_nlibs $curl_cv_save_LIBS"
529 #ifdef HAVE_WINDOWS_H
530 #ifndef WIN32_LEAN_AND_MEAN
531 #define WIN32_LEAN_AND_MEAN
534 #ifdef HAVE_WINLDAP_H
543 BerElement *bep = ber_init(bvp);
544 LDAP *ldp = ldap_init("dummy", LDAP_PORT);
545 ULONG res = ldap_unbind(ldp);
549 curl_cv_ldap_LIBS="$x_nlibs"
554 LIBS="$curl_cv_save_LIBS"
556 case X-"$curl_cv_ldap_LIBS" in
558 AC_MSG_RESULT([cannot find WINLDAP libraries])
561 AC_MSG_RESULT([no additional lib required])
564 if test -z "$curl_cv_save_LIBS"; then
565 LIBS="$curl_cv_ldap_LIBS"
567 LIBS="$curl_cv_ldap_LIBS $curl_cv_save_LIBS"
569 AC_MSG_RESULT([$curl_cv_ldap_LIBS])
576 dnl CURL_CHECK_LIBS_LDAP
577 dnl -------------------------------------------------
578 dnl Check for libraries needed for LDAP support,
579 dnl and prepended to LIBS any needed libraries.
580 dnl This macro can take an optional parameter with a
581 dnl white space separated list of libraries to check
582 dnl before the default ones.
584 AC_DEFUN([CURL_CHECK_LIBS_LDAP], [
585 AC_REQUIRE([CURL_CHECK_HEADER_LDAP])dnl
587 AC_MSG_CHECKING([for LDAP libraries])
601 if test -z "$u_libs"; then
604 u_libs="$u_libs $l_lib"
609 curl_cv_save_LIBS="$LIBS"
610 curl_cv_ldap_LIBS="unknown"
612 for x_nlibs in '' "$u_libs" \
616 '-lldapssl -lldapx -lldapsdk' \
617 '-lldapsdk -lldapx -lldapssl' ; do
618 if test -z "$x_nlibs"; then
619 LIBS="$curl_cv_save_LIBS"
621 LIBS="$x_nlibs $curl_cv_save_LIBS"
626 #ifdef HAVE_WINDOWS_H
627 #ifndef WIN32_LEAN_AND_MEAN
628 #define WIN32_LEAN_AND_MEAN
632 #ifdef HAVE_SYS_TYPES_H
633 #include <sys/types.h>
637 #define NULL (void *)0
639 #ifndef LDAP_DEPRECATED
640 #define LDAP_DEPRECATED 1
649 BerValue *bvp = NULL;
650 BerElement *bep = ber_init(bvp);
651 LDAP *ldp = ldap_init("dummy", LDAP_PORT);
652 int res = ldap_unbind(ldp);
656 curl_cv_ldap_LIBS="$x_nlibs"
661 LIBS="$curl_cv_save_LIBS"
663 case X-"$curl_cv_ldap_LIBS" in
665 AC_MSG_RESULT([cannot find LDAP libraries])
668 AC_MSG_RESULT([no additional lib required])
671 if test -z "$curl_cv_save_LIBS"; then
672 LIBS="$curl_cv_ldap_LIBS"
674 LIBS="$curl_cv_ldap_LIBS $curl_cv_save_LIBS"
676 AC_MSG_RESULT([$curl_cv_ldap_LIBS])
683 dnl CURL_CHECK_HEADER_MALLOC
684 dnl -------------------------------------------------
685 dnl Check for compilable and valid malloc.h header,
686 dnl and check if it is needed even with stdlib.h
688 AC_DEFUN([CURL_CHECK_HEADER_MALLOC], [
689 AC_CACHE_CHECK([for malloc.h], [ac_cv_header_malloc_h], [
694 void *p = malloc(10);
695 void *q = calloc(10,10);
700 ac_cv_header_malloc_h="yes"
702 ac_cv_header_malloc_h="no"
705 if test "$ac_cv_header_malloc_h" = "yes"; then
706 AC_DEFINE_UNQUOTED(HAVE_MALLOC_H, 1,
707 [Define to 1 if you have the malloc.h header file.])
713 void *p = malloc(10);
714 void *q = calloc(10,10);
719 curl_cv_need_header_malloc_h="no"
721 curl_cv_need_header_malloc_h="yes"
724 case "$curl_cv_need_header_malloc_h" in
726 AC_DEFINE_UNQUOTED(NEED_MALLOC_H, 1,
727 [Define to 1 if you need the malloc.h header file even with stdlib.h])
734 dnl CURL_CHECK_TYPE_SOCKLEN_T
735 dnl -------------------------------------------------
736 dnl Check for existing socklen_t type, and provide
737 dnl an equivalent type if socklen_t not available
739 AC_DEFUN([CURL_CHECK_TYPE_SOCKLEN_T], [
740 AC_REQUIRE([CURL_CHECK_HEADER_WS2TCPIP])dnl
741 AC_CHECK_TYPE([socklen_t], ,[
742 AC_CACHE_CHECK([for socklen_t equivalent],
743 [curl_cv_socklen_t_equiv], [
744 curl_cv_socklen_t_equiv="unknown"
745 for arg2 in "struct sockaddr" void; do
746 for t in int size_t unsigned long "unsigned long"; do
750 #ifdef HAVE_WINDOWS_H
751 #ifndef WIN32_LEAN_AND_MEAN
752 #define WIN32_LEAN_AND_MEAN
755 #ifdef HAVE_WINSOCK2_H
756 #include <winsock2.h>
758 #ifdef HAVE_WINSOCK_H
763 #ifdef HAVE_SYS_TYPES_H
764 #include <sys/types.h>
766 #ifdef HAVE_SYS_SOCKET_H
767 #include <sys/socket.h>
770 int getpeername (int, $arg2 *, $t *);
773 getpeername(0,0,&len);
776 curl_cv_socklen_t_equiv="$t"
782 case "$curl_cv_socklen_t_equiv" in
784 AC_MSG_ERROR([Cannot find a type to use in place of socklen_t])
787 AC_DEFINE_UNQUOTED(socklen_t, $curl_cv_socklen_t_equiv,
788 [type to use in place of socklen_t if not defined])
793 #ifdef HAVE_WINDOWS_H
794 #ifndef WIN32_LEAN_AND_MEAN
795 #define WIN32_LEAN_AND_MEAN
798 #ifdef HAVE_WINSOCK2_H
799 #include <winsock2.h>
800 #ifdef HAVE_WS2TCPIP_H
801 #include <ws2tcpip.h>
805 #ifdef HAVE_SYS_TYPES_H
806 #include <sys/types.h>
808 #ifdef HAVE_SYS_SOCKET_H
809 #include <sys/socket.h>
816 dnl CURL_CHECK_FUNC_GETNAMEINFO
817 dnl -------------------------------------------------
818 dnl Test if the getnameinfo function is available,
819 dnl and check the types of five of its arguments.
820 dnl If the function succeeds HAVE_GETNAMEINFO will be
821 dnl defined, defining the types of the arguments in
822 dnl GETNAMEINFO_TYPE_ARG1, GETNAMEINFO_TYPE_ARG2,
823 dnl GETNAMEINFO_TYPE_ARG46 and GETNAMEINFO_TYPE_ARG7,
824 dnl and also defining the type qualifier of first
825 dnl argument in GETNAMEINFO_QUAL_ARG1.
827 AC_DEFUN([CURL_CHECK_FUNC_GETNAMEINFO], [
828 AC_REQUIRE([CURL_CHECK_HEADER_WS2TCPIP])dnl
829 AC_REQUIRE([CURL_CHECK_TYPE_SOCKLEN_T])dnl
830 AC_CHECK_HEADERS(sys/types.h sys/socket.h netdb.h)
832 AC_MSG_CHECKING([for getnameinfo])
834 AC_LANG_FUNC_LINK_TRY([getnameinfo])
837 curl_cv_getnameinfo="yes"
840 curl_cv_getnameinfo="no"
843 if test "$curl_cv_getnameinfo" != "yes"; then
844 AC_MSG_CHECKING([deeper for getnameinfo])
850 curl_cv_getnameinfo="yes"
852 AC_MSG_RESULT([but still no])
853 curl_cv_getnameinfo="no"
857 if test "$curl_cv_getnameinfo" != "yes"; then
858 AC_MSG_CHECKING([deeper and deeper for getnameinfo])
861 #ifdef HAVE_WINDOWS_H
862 #ifndef WIN32_LEAN_AND_MEAN
863 #define WIN32_LEAN_AND_MEAN
866 #ifdef HAVE_WINSOCK2_H
867 #include <winsock2.h>
868 #ifdef HAVE_WS2TCPIP_H
869 #include <ws2tcpip.h>
873 #ifdef HAVE_SYS_TYPES_H
874 #include <sys/types.h>
876 #ifdef HAVE_SYS_SOCKET_H
877 #include <sys/socket.h>
884 getnameinfo(0, 0, 0, 0, 0, 0, 0);
887 curl_cv_getnameinfo="yes"
889 AC_MSG_RESULT([but still no])
890 curl_cv_getnameinfo="no"
894 if test "$curl_cv_getnameinfo" = "yes"; then
895 AC_CACHE_CHECK([types of arguments for getnameinfo],
896 [curl_cv_func_getnameinfo_args], [
897 curl_cv_func_getnameinfo_args="unknown"
898 for gni_arg1 in 'struct sockaddr *' 'const struct sockaddr *' 'void *'; do
899 for gni_arg2 in 'socklen_t' 'size_t' 'int'; do
900 for gni_arg46 in 'size_t' 'int' 'socklen_t' 'unsigned int' 'DWORD'; do
901 for gni_arg7 in 'int' 'unsigned int'; do
905 #ifdef HAVE_WINDOWS_H
906 #ifndef WIN32_LEAN_AND_MEAN
907 #define WIN32_LEAN_AND_MEAN
909 #if (!defined(_WIN32_WINNT)) || (_WIN32_WINNT < 0x0501)
911 #define _WIN32_WINNT 0x0501
914 #ifdef HAVE_WINSOCK2_H
915 #include <winsock2.h>
916 #ifdef HAVE_WS2TCPIP_H
917 #include <ws2tcpip.h>
920 #define GNICALLCONV WSAAPI
922 #ifdef HAVE_SYS_TYPES_H
923 #include <sys/types.h>
925 #ifdef HAVE_SYS_SOCKET_H
926 #include <sys/socket.h>
933 extern int GNICALLCONV getnameinfo($gni_arg1, $gni_arg2,
939 $gni_arg46 hostlen=0;
940 $gni_arg46 servlen=0;
942 int res = getnameinfo(0, salen, 0, hostlen, 0, servlen, flags);
945 curl_cv_func_getnameinfo_args="$gni_arg1,$gni_arg2,$gni_arg46,$gni_arg7"
953 if test "$curl_cv_func_getnameinfo_args" = "unknown"; then
954 AC_MSG_WARN([Cannot find proper types to use for getnameinfo args])
955 AC_MSG_WARN([HAVE_GETNAMEINFO will not be defined])
957 gni_prev_IFS=$IFS; IFS=','
958 set dummy `echo "$curl_cv_func_getnameinfo_args" | sed 's/\*/\*/g'`
962 gni_qual_type_arg1=$[1]
964 AC_DEFINE_UNQUOTED(GETNAMEINFO_TYPE_ARG2, $[2],
965 [Define to the type of arg 2 for getnameinfo.])
966 AC_DEFINE_UNQUOTED(GETNAMEINFO_TYPE_ARG46, $[3],
967 [Define to the type of args 4 and 6 for getnameinfo.])
968 AC_DEFINE_UNQUOTED(GETNAMEINFO_TYPE_ARG7, $[4],
969 [Define to the type of arg 7 for getnameinfo.])
973 case $prev_sh_opts in
981 case "$gni_qual_type_arg1" in
984 gni_type_arg1=`echo $gni_qual_type_arg1 | sed 's/^const //'`
988 gni_type_arg1=$gni_qual_type_arg1
992 AC_DEFINE_UNQUOTED(GETNAMEINFO_QUAL_ARG1, $gni_qual_arg1,
993 [Define to the type qualifier of arg 1 for getnameinfo.])
994 AC_DEFINE_UNQUOTED(GETNAMEINFO_TYPE_ARG1, $gni_type_arg1,
995 [Define to the type of arg 1 for getnameinfo.])
997 case $prev_sh_opts in
1005 AC_DEFINE_UNQUOTED(HAVE_GETNAMEINFO, 1,
1006 [Define to 1 if you have the getnameinfo function.])
1007 ac_cv_func_getnameinfo="yes"
1013 dnl TYPE_SOCKADDR_STORAGE
1014 dnl -------------------------------------------------
1015 dnl Check for struct sockaddr_storage. Most IPv6-enabled
1016 dnl hosts have it, but AIX 4.3 is one known exception.
1018 AC_DEFUN([TYPE_SOCKADDR_STORAGE],
1020 AC_CHECK_TYPE([struct sockaddr_storage],
1021 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE, 1,
1022 [if struct sockaddr_storage is defined]), ,
1025 #ifdef HAVE_WINDOWS_H
1026 #ifndef WIN32_LEAN_AND_MEAN
1027 #define WIN32_LEAN_AND_MEAN
1029 #include <windows.h>
1030 #ifdef HAVE_WINSOCK2_H
1031 #include <winsock2.h>
1034 #ifdef HAVE_SYS_TYPES_H
1035 #include <sys/types.h>
1037 #ifdef HAVE_SYS_SOCKET_H
1038 #include <sys/socket.h>
1040 #ifdef HAVE_NETINET_IN_H
1041 #include <netinet/in.h>
1043 #ifdef HAVE_ARPA_INET_H
1044 #include <arpa/inet.h>
1051 dnl CURL_CHECK_NI_WITHSCOPEID
1052 dnl -------------------------------------------------
1053 dnl Check for working NI_WITHSCOPEID in getnameinfo()
1055 AC_DEFUN([CURL_CHECK_NI_WITHSCOPEID], [
1056 AC_REQUIRE([CURL_CHECK_FUNC_GETNAMEINFO])dnl
1057 AC_REQUIRE([TYPE_SOCKADDR_STORAGE])dnl
1058 AC_CHECK_HEADERS(stdio.h sys/types.h sys/socket.h \
1059 netdb.h netinet/in.h arpa/inet.h)
1061 AC_CACHE_CHECK([for working NI_WITHSCOPEID],
1062 [ac_cv_working_ni_withscopeid], [
1068 #ifdef HAVE_SYS_TYPES_H
1069 #include <sys/types.h>
1071 #ifdef HAVE_SYS_SOCKET_H
1072 #include <sys/socket.h>
1077 #ifdef HAVE_NETINET_IN_H
1078 #include <netinet/in.h>
1080 #ifdef HAVE_ARPA_INET_H
1081 #include <arpa/inet.h>
1084 #if defined(NI_WITHSCOPEID) && defined(HAVE_GETNAMEINFO)
1085 #ifdef HAVE_STRUCT_SOCKADDR_STORAGE
1086 struct sockaddr_storage sa;
1088 unsigned char sa[256];
1090 char hostbuf[NI_MAXHOST];
1092 GETNAMEINFO_TYPE_ARG2 salen = (GETNAMEINFO_TYPE_ARG2)sizeof(sa);
1093 GETNAMEINFO_TYPE_ARG46 hostlen = (GETNAMEINFO_TYPE_ARG46)sizeof(hostbuf);
1094 GETNAMEINFO_TYPE_ARG7 flags = NI_NUMERICHOST | NI_NUMERICSERV | NI_WITHSCOPEID;
1095 int fd = socket(AF_INET6, SOCK_STREAM, 0);
1098 return 1; /* Error creating socket */
1100 rc = getsockname(fd, (GETNAMEINFO_TYPE_ARG1)&sa, &salen);
1102 perror("getsockname()");
1103 return 2; /* Error retrieving socket name */
1105 rc = getnameinfo((GETNAMEINFO_TYPE_ARG1)&sa, salen, hostbuf, hostlen, NULL, 0, flags);
1107 printf("rc = %s\n", gai_strerror(rc));
1108 return 3; /* Error translating socket address */
1110 return 0; /* Ok, NI_WITHSCOPEID works */
1112 return 4; /* Error, NI_WITHSCOPEID not defined or no getnameinfo() */
1114 ]) # AC_LANG_PROGRAM
1116 # Exit code == 0. Program worked.
1117 ac_cv_working_ni_withscopeid="yes"
1119 # Exit code != 0. Program failed.
1120 ac_cv_working_ni_withscopeid="no"
1122 # Program is not run when cross-compiling. So we assume
1123 # NI_WITHSCOPEID will work if we are able to compile it.
1126 #include <sys/types.h>
1127 #include <sys/socket.h>
1130 unsigned int dummy= NI_NUMERICHOST | NI_NUMERICSERV | NI_WITHSCOPEID;
1133 ac_cv_working_ni_withscopeid="yes"
1135 ac_cv_working_ni_withscopeid="no"
1136 ]) # AC_COMPILE_IFELSE
1139 case "$ac_cv_working_ni_withscopeid" in
1141 AC_DEFINE(HAVE_NI_WITHSCOPEID, 1,
1142 [Define to 1 if NI_WITHSCOPEID exists and works.])
1148 dnl CURL_CHECK_FUNC_RECV
1149 dnl -------------------------------------------------
1150 dnl Test if the socket recv() function is available,
1151 dnl and check its return type and the types of its
1152 dnl arguments. If the function succeeds HAVE_RECV
1153 dnl will be defined, defining the types of the arguments
1154 dnl in RECV_TYPE_ARG1, RECV_TYPE_ARG2, RECV_TYPE_ARG3
1155 dnl and RECV_TYPE_ARG4, defining the type of the function
1156 dnl return value in RECV_TYPE_RETV.
1158 AC_DEFUN([CURL_CHECK_FUNC_RECV], [
1159 AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK])dnl
1160 AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK2])dnl
1161 AC_CHECK_HEADERS(sys/types.h sys/socket.h)
1163 AC_MSG_CHECKING([for recv])
1166 #ifdef HAVE_WINDOWS_H
1167 #ifndef WIN32_LEAN_AND_MEAN
1168 #define WIN32_LEAN_AND_MEAN
1170 #include <windows.h>
1171 #ifdef HAVE_WINSOCK2_H
1172 #include <winsock2.h>
1174 #ifdef HAVE_WINSOCK_H
1175 #include <winsock.h>
1179 #ifdef HAVE_SYS_TYPES_H
1180 #include <sys/types.h>
1182 #ifdef HAVE_SYS_SOCKET_H
1183 #include <sys/socket.h>
1189 AC_MSG_RESULT([yes])
1196 if test "$curl_cv_recv" = "yes"; then
1197 AC_CACHE_CHECK([types of args and return type for recv],
1198 [curl_cv_func_recv_args], [
1199 curl_cv_func_recv_args="unknown"
1200 for recv_retv in 'int' 'ssize_t'; do
1201 for recv_arg1 in 'int' 'ssize_t' 'SOCKET'; do
1202 for recv_arg2 in 'char *' 'void *'; do
1203 for recv_arg3 in 'size_t' 'int' 'socklen_t' 'unsigned int'; do
1204 for recv_arg4 in 'int' 'unsigned int'; do
1208 #ifdef HAVE_WINDOWS_H
1209 #ifndef WIN32_LEAN_AND_MEAN
1210 #define WIN32_LEAN_AND_MEAN
1212 #include <windows.h>
1213 #ifdef HAVE_WINSOCK2_H
1214 #include <winsock2.h>
1216 #ifdef HAVE_WINSOCK_H
1217 #include <winsock.h>
1220 #define RECVCALLCONV PASCAL
1222 #ifdef HAVE_SYS_TYPES_H
1223 #include <sys/types.h>
1225 #ifdef HAVE_SYS_SOCKET_H
1226 #include <sys/socket.h>
1228 #define RECVCALLCONV
1230 extern $recv_retv RECVCALLCONV recv($recv_arg1, $recv_arg2, $recv_arg3, $recv_arg4);
1236 $recv_retv res = recv(s, buf, len, flags);
1239 curl_cv_func_recv_args="$recv_arg1,$recv_arg2,$recv_arg3,$recv_arg4,$recv_retv"
1248 if test "$curl_cv_func_recv_args" = "unknown"; then
1249 AC_MSG_ERROR([Cannot find proper types to use for recv args])
1251 recv_prev_IFS=$IFS; IFS=','
1252 set dummy `echo "$curl_cv_func_recv_args" | sed 's/\*/\*/g'`
1256 AC_DEFINE_UNQUOTED(RECV_TYPE_ARG1, $[1],
1257 [Define to the type of arg 1 for recv.])
1258 AC_DEFINE_UNQUOTED(RECV_TYPE_ARG2, $[2],
1259 [Define to the type of arg 2 for recv.])
1260 AC_DEFINE_UNQUOTED(RECV_TYPE_ARG3, $[3],
1261 [Define to the type of arg 3 for recv.])
1262 AC_DEFINE_UNQUOTED(RECV_TYPE_ARG4, $[4],
1263 [Define to the type of arg 4 for recv.])
1264 AC_DEFINE_UNQUOTED(RECV_TYPE_RETV, $[5],
1265 [Define to the function return type for recv.])
1267 AC_DEFINE_UNQUOTED(HAVE_RECV, 1,
1268 [Define to 1 if you have the recv function.])
1269 ac_cv_func_recv="yes"
1272 AC_MSG_ERROR([Unable to link function recv])
1277 dnl CURL_CHECK_FUNC_SEND
1278 dnl -------------------------------------------------
1279 dnl Test if the socket send() function is available,
1280 dnl and check its return type and the types of its
1281 dnl arguments. If the function succeeds HAVE_SEND
1282 dnl will be defined, defining the types of the arguments
1283 dnl in SEND_TYPE_ARG1, SEND_TYPE_ARG2, SEND_TYPE_ARG3
1284 dnl and SEND_TYPE_ARG4, defining the type of the function
1285 dnl return value in SEND_TYPE_RETV, and also defining the
1286 dnl type qualifier of second argument in SEND_QUAL_ARG2.
1288 AC_DEFUN([CURL_CHECK_FUNC_SEND], [
1289 AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK])dnl
1290 AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK2])dnl
1291 AC_CHECK_HEADERS(sys/types.h sys/socket.h)
1293 AC_MSG_CHECKING([for send])
1296 #ifdef HAVE_WINDOWS_H
1297 #ifndef WIN32_LEAN_AND_MEAN
1298 #define WIN32_LEAN_AND_MEAN
1300 #include <windows.h>
1301 #ifdef HAVE_WINSOCK2_H
1302 #include <winsock2.h>
1304 #ifdef HAVE_WINSOCK_H
1305 #include <winsock.h>
1309 #ifdef HAVE_SYS_TYPES_H
1310 #include <sys/types.h>
1312 #ifdef HAVE_SYS_SOCKET_H
1313 #include <sys/socket.h>
1319 AC_MSG_RESULT([yes])
1326 if test "$curl_cv_send" = "yes"; then
1327 AC_CACHE_CHECK([types of args and return type for send],
1328 [curl_cv_func_send_args], [
1329 curl_cv_func_send_args="unknown"
1330 for send_retv in 'int' 'ssize_t'; do
1331 for send_arg1 in 'int' 'ssize_t' 'SOCKET'; do
1332 for send_arg2 in 'char *' 'void *' 'const char *' 'const void *'; do
1333 for send_arg3 in 'size_t' 'int' 'socklen_t' 'unsigned int'; do
1334 for send_arg4 in 'int' 'unsigned int'; do
1338 #ifdef HAVE_WINDOWS_H
1339 #ifndef WIN32_LEAN_AND_MEAN
1340 #define WIN32_LEAN_AND_MEAN
1342 #include <windows.h>
1343 #ifdef HAVE_WINSOCK2_H
1344 #include <winsock2.h>
1346 #ifdef HAVE_WINSOCK_H
1347 #include <winsock.h>
1350 #define SENDCALLCONV PASCAL
1352 #ifdef HAVE_SYS_TYPES_H
1353 #include <sys/types.h>
1355 #ifdef HAVE_SYS_SOCKET_H
1356 #include <sys/socket.h>
1358 #define SENDCALLCONV
1360 extern $send_retv SENDCALLCONV send($send_arg1, $send_arg2, $send_arg3, $send_arg4);
1365 $send_retv res = send(s, 0, len, flags);
1368 curl_cv_func_send_args="$send_arg1,$send_arg2,$send_arg3,$send_arg4,$send_retv"
1377 if test "$curl_cv_func_send_args" = "unknown"; then
1378 AC_MSG_ERROR([Cannot find proper types to use for send args])
1380 send_prev_IFS=$IFS; IFS=','
1381 set dummy `echo "$curl_cv_func_send_args" | sed 's/\*/\*/g'`
1385 send_qual_type_arg2=$[2]
1387 AC_DEFINE_UNQUOTED(SEND_TYPE_ARG1, $[1],
1388 [Define to the type of arg 1 for send.])
1389 AC_DEFINE_UNQUOTED(SEND_TYPE_ARG3, $[3],
1390 [Define to the type of arg 3 for send.])
1391 AC_DEFINE_UNQUOTED(SEND_TYPE_ARG4, $[4],
1392 [Define to the type of arg 4 for send.])
1393 AC_DEFINE_UNQUOTED(SEND_TYPE_RETV, $[5],
1394 [Define to the function return type for send.])
1398 case $prev_sh_opts in
1406 case "$send_qual_type_arg2" in
1408 send_qual_arg2=const
1409 send_type_arg2=`echo $send_qual_type_arg2 | sed 's/^const //'`
1413 send_type_arg2=$send_qual_type_arg2
1417 AC_DEFINE_UNQUOTED(SEND_QUAL_ARG2, $send_qual_arg2,
1418 [Define to the type qualifier of arg 2 for send.])
1419 AC_DEFINE_UNQUOTED(SEND_TYPE_ARG2, $send_type_arg2,
1420 [Define to the type of arg 2 for send.])
1422 case $prev_sh_opts in
1430 AC_DEFINE_UNQUOTED(HAVE_SEND, 1,
1431 [Define to 1 if you have the send function.])
1432 ac_cv_func_send="yes"
1435 AC_MSG_ERROR([Unable to link function send])
1440 dnl CURL_CHECK_MSG_NOSIGNAL
1441 dnl -------------------------------------------------
1442 dnl Check for MSG_NOSIGNAL
1444 AC_DEFUN([CURL_CHECK_MSG_NOSIGNAL], [
1445 AC_CHECK_HEADERS(sys/types.h sys/socket.h)
1446 AC_CACHE_CHECK([for MSG_NOSIGNAL], [ac_cv_msg_nosignal], [
1450 #ifdef HAVE_WINDOWS_H
1451 #ifndef WIN32_LEAN_AND_MEAN
1452 #define WIN32_LEAN_AND_MEAN
1454 #include <windows.h>
1455 #ifdef HAVE_WINSOCK2_H
1456 #include <winsock2.h>
1458 #ifdef HAVE_WINSOCK_H
1459 #include <winsock.h>
1463 #ifdef HAVE_SYS_TYPES_H
1464 #include <sys/types.h>
1466 #ifdef HAVE_SYS_SOCKET_H
1467 #include <sys/socket.h>
1471 int flag=MSG_NOSIGNAL;
1474 ac_cv_msg_nosignal="yes"
1476 ac_cv_msg_nosignal="no"
1479 case "$ac_cv_msg_nosignal" in
1481 AC_DEFINE_UNQUOTED(HAVE_MSG_NOSIGNAL, 1,
1482 [Define to 1 if you have the MSG_NOSIGNAL flag.])
1488 dnl CURL_CHECK_STRUCT_TIMEVAL
1489 dnl -------------------------------------------------
1490 dnl Check for timeval struct
1492 AC_DEFUN([CURL_CHECK_STRUCT_TIMEVAL], [
1493 AC_REQUIRE([AC_HEADER_TIME])dnl
1494 AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK])dnl
1495 AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK2])dnl
1496 AC_CHECK_HEADERS(sys/types.h sys/time.h time.h)
1497 AC_CACHE_CHECK([for struct timeval], [ac_cv_struct_timeval], [
1501 #ifdef HAVE_WINDOWS_H
1502 #ifndef WIN32_LEAN_AND_MEAN
1503 #define WIN32_LEAN_AND_MEAN
1505 #include <windows.h>
1506 #ifdef HAVE_WINSOCK2_H
1507 #include <winsock2.h>
1509 #ifdef HAVE_WINSOCK_H
1510 #include <winsock.h>
1514 #ifdef HAVE_SYS_TYPES_H
1515 #include <sys/types.h>
1517 #ifdef HAVE_SYS_TIME_H
1518 #include <sys/time.h>
1519 #ifdef TIME_WITH_SYS_TIME
1533 ac_cv_struct_timeval="yes"
1535 ac_cv_struct_timeval="no"
1538 case "$ac_cv_struct_timeval" in
1540 AC_DEFINE_UNQUOTED(HAVE_STRUCT_TIMEVAL, 1,
1541 [Define to 1 if you have the timeval struct.])
1547 dnl TYPE_SIG_ATOMIC_T
1548 dnl -------------------------------------------------
1549 dnl Check if the sig_atomic_t type is available, and
1550 dnl verify if it is already defined as volatile.
1552 AC_DEFUN([TYPE_SIG_ATOMIC_T], [
1553 AC_CHECK_HEADERS(signal.h)
1554 AC_CHECK_TYPE([sig_atomic_t],[
1555 AC_DEFINE(HAVE_SIG_ATOMIC_T, 1,
1556 [Define to 1 if sig_atomic_t is an available typedef.])
1558 #ifdef HAVE_SIGNAL_H
1562 case "$ac_cv_type_sig_atomic_t" in
1565 AC_MSG_CHECKING([if sig_atomic_t is already defined as volatile])
1567 #ifdef HAVE_SIGNAL_H
1571 static volatile sig_atomic_t dummy = 0;
1574 ac_cv_sig_atomic_t_volatile="no"
1576 AC_MSG_RESULT([yes])
1577 ac_cv_sig_atomic_t_volatile="yes"
1580 if test "$ac_cv_sig_atomic_t_volatile" = "yes"; then
1581 AC_DEFINE(HAVE_SIG_ATOMIC_T_VOLATILE, 1,
1582 [Define to 1 if sig_atomic_t is already defined as volatile.])
1589 dnl CURL_CHECK_NONBLOCKING_SOCKET
1590 dnl -------------------------------------------------
1591 dnl Check for how to set a socket to non-blocking state. There seems to exist
1592 dnl four known different ways, with the one used almost everywhere being POSIX
1593 dnl and XPG3, while the other different ways for different systems (old BSD,
1594 dnl Windows and Amiga).
1596 dnl There are two known platforms (AIX 3.x and SunOS 4.1.x) where the
1597 dnl O_NONBLOCK define is found but does not work. This condition is attempted
1598 dnl to get caught in this script by using an excessive number of #ifdefs...
1600 AC_DEFUN([CURL_CHECK_NONBLOCKING_SOCKET],
1602 AC_MSG_CHECKING([non-blocking sockets style])
1605 /* headers for O_NONBLOCK test */
1606 #include <sys/types.h>
1610 /* try to compile O_NONBLOCK */
1612 #if defined(sun) || defined(__sun__) || defined(__SUNPRO_C) || defined(__SUNPRO_CC)
1613 # if defined(__SVR4) || defined(__srv4__)
1614 # define PLATFORM_SOLARIS
1616 # define PLATFORM_SUNOS4
1619 #if (defined(_AIX) || defined(__xlC__)) && !defined(_AIX41)
1620 # define PLATFORM_AIX_V3
1623 #if defined(PLATFORM_SUNOS4) || defined(PLATFORM_AIX_V3) || defined(__BEOS__)
1624 #error "O_NONBLOCK does not work on this platform"
1627 int flags = fcntl(socket, F_SETFL, flags | O_NONBLOCK);
1629 dnl the O_NONBLOCK test was fine
1630 nonblock="O_NONBLOCK"
1631 AC_DEFINE(HAVE_O_NONBLOCK, 1, [use O_NONBLOCK for non-blocking sockets])
1633 dnl the code was bad, try a different program now, test 2
1636 /* headers for FIONBIO test */
1638 #include <stropts.h>
1640 /* FIONBIO source test (old-style unix) */
1642 int flags = ioctl(socket, FIONBIO, &flags);
1644 dnl FIONBIO test was good
1646 AC_DEFINE(HAVE_FIONBIO, 1, [use FIONBIO for non-blocking sockets])
1648 dnl FIONBIO test was also bad
1649 dnl the code was bad, try a different program now, test 3
1652 /* headers for ioctlsocket test (Windows) */
1654 #ifdef HAVE_WINDOWS_H
1655 #ifndef WIN32_LEAN_AND_MEAN
1656 #define WIN32_LEAN_AND_MEAN
1658 #include <windows.h>
1659 #ifdef HAVE_WINSOCK2_H
1660 #include <winsock2.h>
1662 #ifdef HAVE_WINSOCK_H
1663 #include <winsock.h>
1668 /* ioctlsocket source code */
1670 unsigned long flags = 0;
1671 sd = socket(0, 0, 0);
1672 ioctlsocket(sd, FIONBIO, &flags);
1674 dnl ioctlsocket test was good
1675 nonblock="ioctlsocket"
1676 AC_DEFINE(HAVE_IOCTLSOCKET, 1, [use ioctlsocket() for non-blocking sockets])
1678 dnl ioctlsocket didnt compile!, go to test 4
1681 /* headers for IoctlSocket test (Amiga?) */
1682 #include <sys/ioctl.h>
1684 /* IoctlSocket source code */
1686 int flags = IoctlSocket(socket, FIONBIO, (long)1);
1688 dnl ioctlsocket test was good
1689 nonblock="IoctlSocket"
1690 AC_DEFINE(HAVE_IOCTLSOCKET_CASE, 1, [use Ioctlsocket() for non-blocking sockets])
1692 dnl Ioctlsocket didnt compile, do test 5!
1694 /* headers for SO_NONBLOCK test (BeOS) */
1697 /* SO_NONBLOCK source code */
1700 int flags = setsockopt(socket, SOL_SOCKET, SO_NONBLOCK, &b, sizeof(b));
1702 dnl the SO_NONBLOCK test was good
1703 nonblock="SO_NONBLOCK"
1704 AC_DEFINE(HAVE_SO_NONBLOCK, 1, [use SO_NONBLOCK for non-blocking sockets])
1706 dnl test 5 didnt compile!
1708 AC_DEFINE(HAVE_DISABLED_NONBLOCKING, 1, [disabled non-blocking sockets])
1710 dnl end of fifth test
1713 dnl end of forth test
1716 dnl end of third test
1719 dnl end of second test
1722 dnl end of non-blocking try-compile test
1723 AC_MSG_RESULT($nonblock)
1725 if test "$nonblock" = "nada"; then
1726 AC_MSG_WARN([non-block sockets disabled])
1732 dnl -------------------------------------------------
1733 dnl Check for in_addr_t: it is used to receive the return code of inet_addr()
1734 dnl and a few other things.
1735 AC_DEFUN([TYPE_IN_ADDR_T],
1737 AC_CHECK_TYPE([in_addr_t], ,[
1738 AC_MSG_CHECKING([for in_addr_t equivalent])
1739 AC_CACHE_VAL([curl_cv_in_addr_t_equiv],
1741 curl_cv_in_addr_t_equiv=
1742 for t in "unsigned long" int size_t unsigned long; do
1745 #ifdef HAVE_WINDOWS_H
1746 #ifndef WIN32_LEAN_AND_MEAN
1747 #define WIN32_LEAN_AND_MEAN
1749 #include <windows.h>
1750 #ifdef HAVE_WINSOCK2_H
1751 #include <winsock2.h>
1753 #ifdef HAVE_WINSOCK_H
1754 #include <winsock.h>
1758 #ifdef HAVE_SYS_TYPES_H
1759 #include <sys/types.h>
1761 #ifdef HAVE_SYS_SOCKET_H
1762 #include <sys/socket.h>
1764 #ifdef HAVE_NETINET_IN_H
1765 #include <netinet/in.h>
1767 #ifdef HAVE_ARPA_INET_H
1768 #include <arpa/inet.h>
1772 $t data = inet_addr ("1.2.3.4");
1774 curl_cv_in_addr_t_equiv="$t"
1779 if test "x$curl_cv_in_addr_t_equiv" = x; then
1780 AC_MSG_ERROR([Cannot find a type to use in place of in_addr_t])
1783 AC_MSG_RESULT($curl_cv_in_addr_t_equiv)
1784 AC_DEFINE_UNQUOTED(in_addr_t, $curl_cv_in_addr_t_equiv,
1785 [type to use in place of in_addr_t if not defined])],
1788 #ifdef HAVE_WINDOWS_H
1789 #ifndef WIN32_LEAN_AND_MEAN
1790 #define WIN32_LEAN_AND_MEAN
1792 #include <windows.h>
1793 #ifdef HAVE_WINSOCK2_H
1794 #include <winsock2.h>
1796 #ifdef HAVE_WINSOCK_H
1797 #include <winsock.h>
1801 #ifdef HAVE_SYS_TYPES_H
1802 #include <sys/types.h>
1804 #ifdef HAVE_SYS_SOCKET_H
1805 #include <sys/socket.h>
1807 #ifdef HAVE_NETINET_IN_H
1808 #include <netinet/in.h>
1810 #ifdef HAVE_ARPA_INET_H
1811 #include <arpa/inet.h>
1814 ]) dnl AC_CHECK_TYPE
1817 dnl ************************************************************
1818 dnl check for "localhost", if it doesn't exist, we can't do the
1819 dnl gethostbyname_r tests!
1822 AC_DEFUN([CURL_CHECK_WORKING_RESOLVER],[
1823 AC_MSG_CHECKING([if "localhost" resolves])
1826 #include <sys/types.h>
1829 #define NULL (void *)0
1835 h = gethostbyname("localhost");
1836 exit (h == NULL ? 1 : 0); }],[
1837 AC_MSG_RESULT(yes)],[
1839 AC_MSG_ERROR([can't figure out gethostbyname_r() since localhost doesn't resolve])
1845 dnl ************************************************************
1846 dnl check for working getaddrinfo() that works with AI_NUMERICHOST
1848 AC_DEFUN([CURL_CHECK_WORKING_GETADDRINFO],[
1849 AC_CACHE_CHECK(for working getaddrinfo, ac_cv_working_getaddrinfo,[
1852 #include <sys/types.h>
1853 #include <sys/socket.h>
1857 struct addrinfo hints, *ai;
1860 memset(&hints, 0, sizeof(hints));
1861 hints.ai_flags = AI_NUMERICHOST;
1862 hints.ai_family = AF_UNSPEC;
1863 hints.ai_socktype = SOCK_STREAM;
1864 error = getaddrinfo("127.0.0.1", "8080", &hints, &ai);
1871 ac_cv_working_getaddrinfo="yes"
1873 ac_cv_working_getaddrinfo="no"
1875 ac_cv_working_getaddrinfo="yes"
1877 if test "$ac_cv_working_getaddrinfo" = "yes"; then
1878 AC_DEFINE(HAVE_GETADDRINFO, 1, [Define if getaddrinfo exists and works])
1879 AC_DEFINE(ENABLE_IPV6, 1, [Define if you want to enable IPv6 support])
1882 AC_SUBST(IPV6_ENABLED)
1887 AC_DEFUN([CURL_CHECK_LOCALTIME_R],
1889 dnl check for localtime_r
1890 AC_CHECK_FUNCS(localtime_r,[
1891 AC_MSG_CHECKING(whether localtime_r is declared)
1892 AC_EGREP_CPP(localtime_r,[
1893 #include <time.h>],[
1894 AC_MSG_RESULT(yes)],[
1896 AC_MSG_CHECKING(whether localtime_r with -D_REENTRANT is declared)
1897 AC_EGREP_CPP(localtime_r,[
1899 #include <time.h>],[
1900 AC_DEFINE(NEED_REENTRANT)
1901 AC_MSG_RESULT(yes)],
1902 AC_MSG_RESULT(no))])])
1906 dnl This function checks for strerror_r(). If it isn't found at first, it
1907 dnl retries with _THREAD_SAFE defined, as that is what AIX seems to require
1908 dnl in order to find this function.
1910 dnl If the function is found, it will then proceed to check how the function
1911 dnl actually works: glibc-style or POSIX-style.
1914 dnl char *strerror_r(int errnum, char *buf, size_t n);
1916 dnl What this one does is to return the error string (no surprises there),
1917 dnl but it doesn't usually copy anything into buf! The 'buf' and 'n'
1918 dnl parameters are only meant as an optional working area, in case strerror_r
1919 dnl needs it. A quick test on a few systems shows that it's generally not
1923 dnl int strerror_r(int errnum, char *buf, size_t n);
1925 AC_DEFUN([CURL_CHECK_STRERROR_R],
1927 AC_CHECK_FUNCS(strerror_r)
1929 if test "x$ac_cv_func_strerror_r" = "xyes"; then
1931 AC_MSG_CHECKING(whether strerror_r is declared)
1932 AC_EGREP_CPP(strerror_r,[
1933 #include <string.h>],[
1934 AC_MSG_RESULT(yes)],[
1936 AC_MSG_CHECKING(whether strerror_r with -D_REENTRANT is declared)
1937 AC_EGREP_CPP(strerror_r,[
1939 #include <string.h>],[
1940 CPPFLAGS="-D_REENTRANT $CPPFLAGS"
1941 AC_MSG_RESULT(yes)],
1943 AC_DEFINE(HAVE_NO_STRERROR_R_DECL, 1, [we have no strerror_r() proto])
1944 ) dnl with _THREAD_SAFE
1945 ]) dnl plain cpp for it
1947 dnl determine if this strerror_r() is glibc or POSIX
1948 AC_MSG_CHECKING([for a glibc strerror_r API])
1954 char buffer[1024]; /* big enough to play with */
1956 strerror_r(EACCES, buffer, sizeof(buffer));
1957 /* this should've returned a string */
1958 if(!string || !string[0])
1963 GLIBC_STRERROR_R="1"
1964 AC_DEFINE(HAVE_GLIBC_STRERROR_R, 1, [we have a glibc-style strerror_r()])
1965 AC_MSG_RESULT([yes]),
1966 AC_MSG_RESULT([no]),
1968 dnl Use an inferior method of strerror_r detection while cross-compiling
1970 #include <features.h>
1975 dnl looks like glibc, so assume a glibc-style strerror_r()
1976 GLIBC_STRERROR_R="1"
1977 AC_DEFINE(HAVE_GLIBC_STRERROR_R, 1, [we have a glibc-style strerror_r()])
1978 AC_MSG_RESULT([yes]),
1979 AC_MSG_NOTICE([cannot determine strerror_r() style: edit lib/config.h manually!])
1980 ) dnl while cross-compiling
1983 if test -z "$GLIBC_STRERROR_R"; then
1985 AC_MSG_CHECKING([for a POSIX strerror_r API])
1991 char buffer[1024]; /* big enough to play with */
1993 strerror_r(EACCES, buffer, sizeof(buffer));
1994 /* This should've returned zero, and written an error string in the
1996 if(!buffer[0] || error)
2001 AC_DEFINE(HAVE_POSIX_STRERROR_R, 1, [we have a POSIX-style strerror_r()])
2002 AC_MSG_RESULT([yes]),
2003 AC_MSG_RESULT([no]) ,
2004 dnl cross-compiling!
2005 AC_MSG_NOTICE([cannot determine strerror_r() style: edit lib/config.h manually!])
2008 fi dnl if not using glibc API
2010 fi dnl we have a strerror_r
2014 AC_DEFUN([CURL_CHECK_INET_NTOA_R],
2016 dnl determine if function definition for inet_ntoa_r exists.
2017 AC_CHECK_FUNCS(inet_ntoa_r,[
2018 AC_MSG_CHECKING(whether inet_ntoa_r is declared)
2019 AC_EGREP_CPP(inet_ntoa_r,[
2020 #include <arpa/inet.h>],[
2021 AC_DEFINE(HAVE_INET_NTOA_R_DECL, 1, [inet_ntoa_r() is declared])
2022 AC_MSG_RESULT(yes)],[
2024 AC_MSG_CHECKING(whether inet_ntoa_r with -D_REENTRANT is declared)
2025 AC_EGREP_CPP(inet_ntoa_r,[
2027 #include <arpa/inet.h>],[
2028 AC_DEFINE(HAVE_INET_NTOA_R_DECL, 1, [inet_ntoa_r() is declared])
2029 AC_DEFINE(NEED_REENTRANT, 1, [need REENTRANT defined])
2030 AC_MSG_RESULT(yes)],
2031 AC_MSG_RESULT(no))])])
2034 AC_DEFUN([CURL_CHECK_GETHOSTBYADDR_R],
2036 dnl check for number of arguments to gethostbyaddr_r. it might take
2037 dnl either 5, 7, or 8 arguments.
2038 AC_CHECK_FUNCS(gethostbyaddr_r,[
2039 AC_MSG_CHECKING(if gethostbyaddr_r takes 5 arguments)
2041 #include <sys/types.h>
2042 #include <netdb.h>],[
2047 struct hostent_data hdata;
2049 rc = gethostbyaddr_r(address, length, type, &h, &hdata);],[
2051 AC_DEFINE(HAVE_GETHOSTBYADDR_R_5, 1, [gethostbyaddr_r() takes 5 args])
2052 ac_cv_gethostbyaddr_args=5],[
2054 AC_MSG_CHECKING(if gethostbyaddr_r with -D_REENTRANT takes 5 arguments)
2057 #include <sys/types.h>
2058 #include <netdb.h>],[
2063 struct hostent_data hdata;
2065 rc = gethostbyaddr_r(address, length, type, &h, &hdata);],[
2067 AC_DEFINE(HAVE_GETHOSTBYADDR_R_5, 1, [gethostbyaddr_r() takes 5 args])
2068 AC_DEFINE(NEED_REENTRANT, 1, [need REENTRANT])
2069 ac_cv_gethostbyaddr_args=5],[
2071 AC_MSG_CHECKING(if gethostbyaddr_r takes 7 arguments)
2073 #include <sys/types.h>
2074 #include <netdb.h>],[
2081 struct hostent * hp;
2083 hp = gethostbyaddr_r(address, length, type, &h,
2084 buffer, 8192, &h_errnop);],[
2086 AC_DEFINE(HAVE_GETHOSTBYADDR_R_7, 1, [gethostbyaddr_r() takes 7 args] )
2087 ac_cv_gethostbyaddr_args=7],[
2089 AC_MSG_CHECKING(if gethostbyaddr_r takes 8 arguments)
2091 #include <sys/types.h>
2092 #include <netdb.h>],[
2099 struct hostent * hp;
2102 rc = gethostbyaddr_r(address, length, type, &h,
2103 buffer, 8192, &hp, &h_errnop);],[
2105 AC_DEFINE(HAVE_GETHOSTBYADDR_R_8, 1, [gethostbyaddr_r() takes 8 args])
2106 ac_cv_gethostbyaddr_args=8],[
2108 have_missing_r_funcs="$have_missing_r_funcs gethostbyaddr_r"])])])])])
2111 AC_DEFUN([CURL_CHECK_GETHOSTBYNAME_R],
2113 dnl check for number of arguments to gethostbyname_r. it might take
2114 dnl either 3, 5, or 6 arguments.
2115 AC_CHECK_FUNCS(gethostbyname_r,[
2116 AC_MSG_CHECKING([if gethostbyname_r takes 3 arguments])
2119 #include <sys/types.h>
2122 #define NULL (void *)0
2125 gethostbyname_r(const char *, struct hostent *, struct hostent_data *);],[
2126 struct hostent_data data;
2127 gethostbyname_r(NULL, NULL, NULL);],[
2129 AC_DEFINE(HAVE_GETHOSTBYNAME_R_3, 1, [gethostbyname_r() takes 3 args])
2130 ac_cv_gethostbyname_args=3],[
2132 AC_MSG_CHECKING([if gethostbyname_r with -D_REENTRANT takes 3 arguments])
2137 #include <sys/types.h>
2140 #define NULL (void *)0
2143 gethostbyname_r(const char *,struct hostent *, struct hostent_data *);],[
2144 struct hostent_data data;
2145 gethostbyname_r(NULL, NULL, NULL);],[
2147 AC_DEFINE(HAVE_GETHOSTBYNAME_R_3, 1, [gethostbyname_r() takes 3 args])
2148 AC_DEFINE(NEED_REENTRANT, 1, [needs REENTRANT])
2149 ac_cv_gethostbyname_args=3],[
2151 AC_MSG_CHECKING([if gethostbyname_r takes 5 arguments])
2153 #include <sys/types.h>
2156 #define NULL (void *)0
2159 gethostbyname_r(const char *, struct hostent *, char *, int, int *);],[
2160 gethostbyname_r(NULL, NULL, NULL, 0, NULL);],[
2162 AC_DEFINE(HAVE_GETHOSTBYNAME_R_5, 1, [gethostbyname_r() takes 5 args])
2163 ac_cv_gethostbyname_args=5],[
2165 AC_MSG_CHECKING([if gethostbyname_r takes 6 arguments])
2167 #include <sys/types.h>
2170 #define NULL (void *)0
2173 gethostbyname_r(const char *, struct hostent *, char *, size_t,
2174 struct hostent **, int *);],[
2175 gethostbyname_r(NULL, NULL, NULL, 0, NULL, NULL);],[
2177 AC_DEFINE(HAVE_GETHOSTBYNAME_R_6, 1, [gethostbyname_r() takes 6 args])
2178 ac_cv_gethostbyname_args=6],[
2180 have_missing_r_funcs="$have_missing_r_funcs gethostbyname_r"],
2181 [ac_cv_gethostbyname_args=0])],
2182 [ac_cv_gethostbyname_args=0])],
2183 [ac_cv_gethostbyname_args=0])],
2184 [ac_cv_gethostbyname_args=0])])
2186 if test "$ac_cv_func_gethostbyname_r" = "yes"; then
2187 if test "$ac_cv_gethostbyname_args" = "0"; then
2188 dnl there's a gethostbyname_r() function, but we don't know how
2189 dnl many arguments it wants!
2190 AC_MSG_ERROR([couldn't figure out how to use gethostbyname_r()])
2196 dnl **********************************************************************
2197 dnl CURL_DETECT_ICC ([ACTION-IF-YES])
2199 dnl check if this is the Intel ICC compiler, and if so run the ACTION-IF-YES
2200 dnl sets the $ICC variable to "yes" or "no"
2201 dnl **********************************************************************
2202 AC_DEFUN([CURL_DETECT_ICC],
2205 AC_MSG_CHECKING([for icc in use])
2206 if test "$GCC" = "yes"; then
2207 dnl check if this is icc acting as gcc in disguise
2208 AC_EGREP_CPP([^__INTEL_COMPILER], [__INTEL_COMPILER],
2209 dnl action if the text is found, this it has not been replaced by the
2212 dnl the text was not found, it was replaced by the cpp
2214 AC_MSG_RESULT([yes])
2218 if test "$ICC" = "no"; then
2224 dnl We create a function for detecting which compiler we use and then set as
2225 dnl pendantic compiler options as possible for that particular compiler. The
2226 dnl options are only used for debug-builds.
2228 AC_DEFUN([CURL_CC_DEBUG_OPTS],
2230 if test "z$ICC" = "z"; then
2234 if test "$GCC" = "yes"; then
2236 dnl figure out gcc version!
2237 AC_MSG_CHECKING([gcc version])
2238 gccver=`$CC -dumpversion`
2239 num1=`echo $gccver | cut -d . -f1`
2240 num2=`echo $gccver | cut -d . -f2`
2241 gccnum=`(expr $num1 "*" 100 + $num2) 2>/dev/null`
2242 AC_MSG_RESULT($gccver)
2244 if test "$ICC" = "yes"; then
2245 dnl this is icc, not gcc.
2247 dnl ICC warnings we ignore:
2248 dnl * 269 warns on our "%Od" printf formatters for curl_off_t output:
2249 dnl "invalid format string conversion"
2250 dnl * 279 warns on static conditions in while expressions
2251 dnl * 981 warns on "operands are evaluated in unspecified order"
2252 dnl * 1418 "external definition with no prior declaration"
2253 dnl * 1419 warns on "external declaration in primary source file"
2254 dnl which we know and do on purpose.
2256 WARN="-wd279,269,981,1418,1419"
2258 if test "$gccnum" -gt "600"; then
2259 dnl icc 6.0 and older doesn't have the -Wall flag
2263 dnl this is a set of options we believe *ALL* gcc versions support:
2264 WARN="-W -Wall -Wwrite-strings -pedantic -Wpointer-arith -Wnested-externs -Winline -Wmissing-prototypes"
2266 dnl -Wcast-align is a bit too annoying on all gcc versions ;-)
2268 if test "$gccnum" -ge "207"; then
2269 dnl gcc 2.7 or later
2270 WARN="$WARN -Wmissing-declarations"
2273 if test "$gccnum" -gt "295"; then
2274 dnl only if the compiler is newer than 2.95 since we got lots of
2275 dnl "`_POSIX_C_SOURCE' is not defined" in system headers with
2276 dnl gcc 2.95.4 on FreeBSD 4.9!
2277 WARN="$WARN -Wundef -Wno-long-long -Wsign-compare -Wshadow -Wno-multichar"
2280 if test "$gccnum" -ge "296"; then
2281 dnl gcc 2.96 or later
2282 WARN="$WARN -Wfloat-equal"
2285 if test "$gccnum" -gt "296"; then
2286 dnl this option does not exist in 2.96
2287 WARN="$WARN -Wno-format-nonliteral"
2290 dnl -Wunreachable-code seems totally unreliable on my gcc 3.3.2 on
2291 dnl on i686-Linux as it gives us heaps with false positives.
2292 dnl Also, on gcc 4.0.X it is totally unbearable and complains all
2293 dnl over making it unusable for generic purposes. Let's not use it.
2295 if test "$gccnum" -ge "303"; then
2296 dnl gcc 3.3 and later
2297 WARN="$WARN -Wendif-labels -Wstrict-prototypes"
2300 if test "$gccnum" -ge "304"; then
2301 # try these on gcc 3.4
2302 WARN="$WARN -Wdeclaration-after-statement"
2305 for flag in $CPPFLAGS; do
2308 dnl Include path, provide a -isystem option for the same dir
2309 dnl to prevent warnings in those dirs. The -isystem was not very
2310 dnl reliable on earlier gcc versions.
2311 add=`echo $flag | sed 's/^-I/-isystem /g'`
2319 CFLAGS="$CFLAGS $WARN"
2321 AC_MSG_NOTICE([Added this set of compiler options: $WARN])
2325 AC_MSG_NOTICE([Added no extra compiler options])
2329 dnl strip off optimizer flags
2331 for flag in $CFLAGS; do
2334 dnl echo "cut off $flag"
2337 NEWFLAGS="$NEWFLAGS $flag"
2343 ]) dnl end of AC_DEFUN()
2345 # This is only a temporary fix. This macro is here to replace the broken one
2346 # delivered by the automake project (including the 1.9.6 release). As soon as
2347 # they ship a working version we SHOULD remove this work-around.
2349 AC_DEFUN([AM_MISSING_HAS_RUN],
2350 [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
2351 test x"${MISSING+set}" = xset || MISSING="\${SHELL} \"$am_aux_dir/missing\""
2352 # Use eval to expand $SHELL
2353 if eval "$MISSING --run true"; then
2354 am_missing_run="$MISSING --run "
2357 AC_MSG_WARN([`missing' script is too old or missing])
2362 dnl CURL_VERIFY_RUNTIMELIBS
2363 dnl -------------------------------------------------
2364 dnl Verify that the shared libs found so far can be used when running
2365 dnl programs, since otherwise the situation will create odd configure errors
2366 dnl that are misleading people.
2368 dnl Make sure this test is run BEFORE the first test in the script that
2369 dnl runs anything, which at the time of this writing is the AC_CHECK_SIZEOF
2370 dnl macro. It must also run AFTER all lib-checking macros are complete.
2372 AC_DEFUN([CURL_VERIFY_RUNTIMELIBS], [
2374 dnl this test is of course not sensible if we are cross-compiling!
2375 if test "x$cross_compiling" != xyes; then
2377 dnl just run a program to verify that the libs checked for previous to this
2378 dnl point also is available run-time!
2379 AC_MSG_CHECKING([run-time libs availability])
2386 AC_MSG_RESULT([fine]),
2387 AC_MSG_RESULT([failed])
2388 AC_MSG_ERROR([one or more libs available at link-time are not available run-time. Libs used at link-time: $LIBS])
2391 dnl if this test fails, configure has already stopped
2396 dnl CURL_CHECK_VARIADIC_MACROS
2397 dnl -------------------------------------------------
2398 dnl Check compiler support of variadic macros
2400 AC_DEFUN([CURL_CHECK_VARIADIC_MACROS], [
2401 AC_CACHE_CHECK([for compiler support of C99 variadic macro style],
2402 [curl_cv_variadic_macros_c99], [
2405 #define c99_vmacro3(first, ...) fun3(first, __VA_ARGS__)
2406 #define c99_vmacro2(first, ...) fun2(first, __VA_ARGS__)
2407 int fun3(int arg1, int arg2, int arg3);
2408 int fun2(int arg1, int arg2);
2409 int fun3(int arg1, int arg2, int arg3)
2410 { return arg1 + arg2 + arg3; }
2411 int fun2(int arg1, int arg2)
2412 { return arg1 + arg2; }
2414 int res3 = c99_vmacro3(1, 2, 3);
2415 int res2 = c99_vmacro2(1, 2);
2418 curl_cv_variadic_macros_c99="yes"
2420 curl_cv_variadic_macros_c99="no"
2423 case "$curl_cv_variadic_macros_c99" in
2425 AC_DEFINE_UNQUOTED(HAVE_VARIADIC_MACROS_C99, 1,
2426 [Define to 1 if compiler supports C99 variadic macro style.])
2429 AC_CACHE_CHECK([for compiler support of old gcc variadic macro style],
2430 [curl_cv_variadic_macros_gcc], [
2433 #define gcc_vmacro3(first, args...) fun3(first, args)
2434 #define gcc_vmacro2(first, args...) fun2(first, args)
2435 int fun3(int arg1, int arg2, int arg3);
2436 int fun2(int arg1, int arg2);
2437 int fun3(int arg1, int arg2, int arg3)
2438 { return arg1 + arg2 + arg3; }
2439 int fun2(int arg1, int arg2)
2440 { return arg1 + arg2; }
2442 int res3 = gcc_vmacro3(1, 2, 3);
2443 int res2 = gcc_vmacro2(1, 2);
2446 curl_cv_variadic_macros_gcc="yes"
2448 curl_cv_variadic_macros_gcc="no"
2451 case "$curl_cv_variadic_macros_gcc" in
2453 AC_DEFINE_UNQUOTED(HAVE_VARIADIC_MACROS_GCC, 1,
2454 [Define to 1 if compiler supports old gcc variadic macro style.])
2460 dnl CURL_CHECK_NATIVE_WINDOWS
2461 dnl -------------------------------------------------
2462 dnl Check if building a native Windows target
2464 AC_DEFUN([CURL_CHECK_NATIVE_WINDOWS], [
2465 AC_REQUIRE([CURL_CHECK_HEADER_WINDOWS])dnl
2466 AC_CACHE_CHECK([whether build target is a native Windows one], [ac_cv_native_windows], [
2467 if test "$ac_cv_header_windows_h" = "no"; then
2468 ac_cv_native_windows="no"
2476 Not a native Windows build target.
2480 ac_cv_native_windows="yes"
2482 ac_cv_native_windows="no"
2486 case "$ac_cv_native_windows" in
2488 AC_DEFINE_UNQUOTED(NATIVE_WINDOWS, 1,
2489 [Define to 1 if you are building a native Windows target.])
2495 dnl CURL_CHECK_CA_BUNDLE
2496 dnl -------------------------------------------------
2497 dnl Check if a default ca-bundle should be used
2499 dnl regarding the paths this will scan:
2500 dnl /etc/ssl/certs/ca-certificates.crt Debian systems
2501 dnl /etc/pki/tls/certs/ca-bundle.crt Redhat and Mandriva
2502 dnl /usr/share/ssl/certs/ca-bundle.crt old(er) Redhat
2503 dnl /etc/ssl/certs/ (ca path) SUSE
2505 AC_DEFUN([CURL_CHECK_CA_BUNDLE], [
2507 AC_MSG_CHECKING([default CA cert bundle/path])
2509 AC_ARG_WITH(ca-bundle,
2510 AC_HELP_STRING([--with-ca-bundle=FILE], [File name to use as CA bundle])
2511 AC_HELP_STRING([--without-ca-bundle], [Don't use a default CA bundle]),
2514 if test "x$want_ca" = "xyes"; then
2515 AC_MSG_ERROR([--with-ca-bundle=FILE requires a path to the CA bundle])
2518 [ want_ca="unset" ])
2519 AC_ARG_WITH(ca-path,
2520 AC_HELP_STRING([--with-ca-path=DIRECTORY], [Directory to use as CA path])
2521 AC_HELP_STRING([--without-ca-path], [Don't use a default CA path]),
2523 want_capath="$withval"
2524 if test "x$want_capath" = "xyes"; then
2525 AC_MSG_ERROR([--with-ca-path=DIRECTORY requires a path to the CA path directory])
2528 [ want_capath="unset"])
2530 if test "x$want_ca" != "xno" -a "x$want_ca" != "xunset" -a \
2531 "x$want_capath" != "xno" -a "x$want_capath" != "xunset"; then
2533 AC_MSG_ERROR([Can't specify both --with-ca-bundle and --with-ca-path.])
2534 elif test "x$want_ca" != "xno" -a "x$want_ca" != "xunset"; then
2535 dnl --with-ca-bundle given
2538 elif test "x$want_capath" != "xno" -a "x$want_capath" != "xunset"; then
2539 dnl --with-ca-path given
2540 if test "x$OPENSSL_ENABLED" != "x1"; then
2541 AC_MSG_ERROR([--with-ca-path only works with openSSL])
2543 capath="$want_capath"
2546 dnl neither of --with-ca-* given
2547 dnl first try autodetecting a CA bundle , then a CA path
2548 dnl both autodetections can be skipped by --without-ca-*
2551 if test "x$want_ca" = "xunset"; then
2552 dnl the path we previously would have installed the curl ca bundle
2553 dnl to, and thus we now check for an already existing cert in that place
2554 dnl in case we find no other
2555 if test "x$prefix" != xNONE; then
2556 cac="${prefix}/share/curl/curl-ca-bundle.crt"
2558 cac="$ac_default_prefix/share/curl/curl-ca-bundle.crt"
2561 for a in /etc/ssl/certs/ca-certificates.crt \
2562 /etc/pki/tls/certs/ca-bundle.crt \
2563 /usr/share/ssl/certs/ca-bundle.crt \
2565 if test -f "$a"; then
2571 if test "x$want_capath" = "xunset" -a "x$ca" = "xno" -a \
2572 "x$OPENSSL_ENABLED" = "x1"; then
2573 for a in /etc/ssl/certs/; do
2574 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
2584 if test "x$ca" != "xno"; then
2585 CURL_CA_BUNDLE='"'$ca'"'
2586 AC_DEFINE_UNQUOTED(CURL_CA_BUNDLE, "$ca", [Location of default ca bundle])
2587 AC_MSG_RESULT([$ca])
2588 elif test "x$capath" != "xno"; then
2589 CURL_CA_PATH="\"$capath\""
2590 AC_DEFINE_UNQUOTED(CURL_CA_PATH, "$capath", [Location of default ca path])
2591 AC_MSG_RESULT([$capath (capath)])