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_COMPILER_HALT_ON_ERROR
26 dnl -------------------------------------------------
27 dnl Verifies if the compiler actually halts after the
28 dnl compilation phase without generating any object
29 dnl code file, when the source compiles with errors.
31 AC_DEFUN([CURL_CHECK_COMPILER_HALT_ON_ERROR], [
32 AC_MSG_CHECKING([if compiler halts on compilation errors])
36 force compilation error
40 AC_MSG_ERROR([compiler does not halt on compilation errors.])
47 dnl CURL_CHECK_COMPILER_ARRAY_SIZE_NEGATIVE
48 dnl -------------------------------------------------
49 dnl Verifies if the compiler actually halts after the
50 dnl compilation phase without generating any object
51 dnl code file, when the source code tries to define a
52 dnl type for a constant array with negative dimension.
54 AC_DEFUN([CURL_CHECK_COMPILER_ARRAY_SIZE_NEGATIVE], [
55 AC_REQUIRE([CURL_CHECK_COMPILER_HALT_ON_ERROR])dnl
56 AC_MSG_CHECKING([if compiler halts on negative sized arrays])
59 typedef char bad_t[sizeof(char) == sizeof(int) ? -1 : -1 ];
65 AC_MSG_ERROR([compiler does not halt on negative sized arrays.])
72 dnl CURL_CHECK_DEF (SYMBOL, [INCLUDES], [SILENT])
73 dnl -------------------------------------------------
74 dnl Use the C preprocessor to find out if the given object-style symbol
75 dnl is defined and get its expansion. This macro will not use default
76 dnl includes even if no INCLUDES argument is given. This macro will run
77 dnl silently when invoked with three arguments.
79 AC_DEFUN([CURL_CHECK_DEF], [
80 AS_VAR_PUSHDEF([ac_HaveDef], [curl_cv_have_def_$1])dnl
81 AS_VAR_PUSHDEF([ac_Def], [curl_cv_def_$1])dnl
82 if test -z "$SED"; then
83 AC_MSG_ERROR([SED not set. Cannot continue without SED being set.])
85 if test -z "$GREP"; then
86 AC_MSG_ERROR([GREP not set. Cannot continue without GREP being set.])
88 ifelse($3,,[AC_MSG_CHECKING([for preprocessor definition of $1])])
98 tmp_exp=`eval "$ac_cpp conftest.$ac_ext" 2>/dev/null | \
99 "$GREP" CURL_DEF_TOKEN 2>/dev/null | \
100 "$SED" 's/.*CURL_DEF_TOKEN[[ ]]//' 2>/dev/null | \
101 "$SED" 'q' 2>/dev/null`
102 if test "$tmp_exp" = "$1"; then
106 if test -z "$tmp_exp"; then
107 AS_VAR_SET([ac_HaveDef], [no])
108 ifelse($3,,[AC_MSG_RESULT([no])])
110 AS_VAR_SET([ac_HaveDef], [yes])
111 AS_VAR_SET([ac_Def], [$tmp_exp])
112 ifelse($3,,[AC_MSG_RESULT([$tmp_exp])])
114 AS_VAR_POPDEF([ac_Def])dnl
115 AS_VAR_POPDEF([ac_HaveDef])dnl
119 dnl CURL_CHECK_HEADER_WINDOWS
120 dnl -------------------------------------------------
121 dnl Check for compilable and valid windows.h header
123 AC_DEFUN([CURL_CHECK_HEADER_WINDOWS], [
124 AC_CACHE_CHECK([for windows.h], [ac_cv_header_windows_h], [
128 #ifndef WIN32_LEAN_AND_MEAN
129 #define WIN32_LEAN_AND_MEAN
133 #if defined(__CYGWIN__) || defined(__CEGCC__)
134 HAVE_WINDOWS_H shall not be defined.
140 ac_cv_header_windows_h="yes"
142 ac_cv_header_windows_h="no"
145 case "$ac_cv_header_windows_h" in
147 AC_DEFINE_UNQUOTED(HAVE_WINDOWS_H, 1,
148 [Define to 1 if you have the windows.h header file.])
149 AC_DEFINE_UNQUOTED(WIN32_LEAN_AND_MEAN, 1,
150 [Define to avoid automatic inclusion of winsock.h])
156 dnl CURL_CHECK_NATIVE_WINDOWS
157 dnl -------------------------------------------------
158 dnl Check if building a native Windows target
160 AC_DEFUN([CURL_CHECK_NATIVE_WINDOWS], [
161 AC_REQUIRE([CURL_CHECK_HEADER_WINDOWS])dnl
162 AC_CACHE_CHECK([whether build target is a native Windows one], [ac_cv_native_windows], [
163 if test "$ac_cv_header_windows_h" = "no"; then
164 ac_cv_native_windows="no"
169 #if defined(__MINGW32__) || defined(__MINGW32CE__) || \
170 (defined(_MSC_VER) && (defined(_WIN32) || defined(_WIN64)))
173 Not a native Windows build target.
177 ac_cv_native_windows="yes"
179 ac_cv_native_windows="no"
183 case "$ac_cv_native_windows" in
185 AC_DEFINE_UNQUOTED(NATIVE_WINDOWS, 1,
186 [Define to 1 if you are building a native Windows target.])
192 dnl CURL_CHECK_HEADER_WINSOCK
193 dnl -------------------------------------------------
194 dnl Check for compilable and valid winsock.h header
196 AC_DEFUN([CURL_CHECK_HEADER_WINSOCK], [
197 AC_REQUIRE([CURL_CHECK_HEADER_WINDOWS])dnl
198 AC_CACHE_CHECK([for winsock.h], [ac_cv_header_winsock_h], [
202 #ifndef WIN32_LEAN_AND_MEAN
203 #define WIN32_LEAN_AND_MEAN
208 #if defined(__CYGWIN__) || defined(__CEGCC__)
209 HAVE_WINSOCK_H shall not be defined.
211 int dummy=WSACleanup();
215 ac_cv_header_winsock_h="yes"
217 ac_cv_header_winsock_h="no"
220 case "$ac_cv_header_winsock_h" in
222 AC_DEFINE_UNQUOTED(HAVE_WINSOCK_H, 1,
223 [Define to 1 if you have the winsock.h header file.])
229 dnl CURL_CHECK_HEADER_WINSOCK2
230 dnl -------------------------------------------------
231 dnl Check for compilable and valid winsock2.h header
233 AC_DEFUN([CURL_CHECK_HEADER_WINSOCK2], [
234 AC_REQUIRE([CURL_CHECK_HEADER_WINDOWS])dnl
235 AC_CACHE_CHECK([for winsock2.h], [ac_cv_header_winsock2_h], [
239 #ifndef WIN32_LEAN_AND_MEAN
240 #define WIN32_LEAN_AND_MEAN
243 #include <winsock2.h>
245 #if defined(__CYGWIN__) || defined(__CEGCC__) || defined(__MINGW32CE__)
246 HAVE_WINSOCK2_H shall not be defined.
248 int dummy=2*IPPROTO_ESP;
252 ac_cv_header_winsock2_h="yes"
254 ac_cv_header_winsock2_h="no"
257 case "$ac_cv_header_winsock2_h" in
259 AC_DEFINE_UNQUOTED(HAVE_WINSOCK2_H, 1,
260 [Define to 1 if you have the winsock2.h header file.])
266 dnl CURL_CHECK_HEADER_WS2TCPIP
267 dnl -------------------------------------------------
268 dnl Check for compilable and valid ws2tcpip.h header
270 AC_DEFUN([CURL_CHECK_HEADER_WS2TCPIP], [
271 AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK2])dnl
272 AC_CACHE_CHECK([for ws2tcpip.h], [ac_cv_header_ws2tcpip_h], [
276 #ifndef WIN32_LEAN_AND_MEAN
277 #define WIN32_LEAN_AND_MEAN
280 #include <winsock2.h>
281 #include <ws2tcpip.h>
283 #if defined(__CYGWIN__) || defined(__CEGCC__) || defined(__MINGW32CE__)
284 HAVE_WS2TCPIP_H shall not be defined.
286 int dummy=2*IP_PKTINFO;
290 ac_cv_header_ws2tcpip_h="yes"
292 ac_cv_header_ws2tcpip_h="no"
295 case "$ac_cv_header_ws2tcpip_h" in
297 AC_DEFINE_UNQUOTED(HAVE_WS2TCPIP_H, 1,
298 [Define to 1 if you have the ws2tcpip.h header file.])
304 dnl CURL_CHECK_HEADER_WINLDAP
305 dnl -------------------------------------------------
306 dnl Check for compilable and valid winldap.h header
308 AC_DEFUN([CURL_CHECK_HEADER_WINLDAP], [
309 AC_REQUIRE([CURL_CHECK_HEADER_WINDOWS])dnl
310 AC_CACHE_CHECK([for winldap.h], [ac_cv_header_winldap_h], [
314 #ifdef HAVE_WINDOWS_H
315 #ifndef WIN32_LEAN_AND_MEAN
316 #define WIN32_LEAN_AND_MEAN
322 #if defined(__CYGWIN__) || defined(__CEGCC__)
323 HAVE_WINLDAP_H shall not be defined.
325 LDAP *ldp = ldap_init("dummy", LDAP_PORT);
326 ULONG res = ldap_unbind(ldp);
330 ac_cv_header_winldap_h="yes"
332 ac_cv_header_winldap_h="no"
335 case "$ac_cv_header_winldap_h" in
337 AC_DEFINE_UNQUOTED(HAVE_WINLDAP_H, 1,
338 [Define to 1 if you have the winldap.h header file.])
344 dnl CURL_CHECK_HEADER_WINBER
345 dnl -------------------------------------------------
346 dnl Check for compilable and valid winber.h header
348 AC_DEFUN([CURL_CHECK_HEADER_WINBER], [
349 AC_REQUIRE([CURL_CHECK_HEADER_WINLDAP])dnl
350 AC_CACHE_CHECK([for winber.h], [ac_cv_header_winber_h], [
354 #ifdef HAVE_WINDOWS_H
355 #ifndef WIN32_LEAN_AND_MEAN
356 #define WIN32_LEAN_AND_MEAN
363 #if defined(__CYGWIN__) || defined(__CEGCC__)
364 HAVE_WINBER_H shall not be defined.
367 BerElement *bep = ber_init(bvp);
372 ac_cv_header_winber_h="yes"
374 ac_cv_header_winber_h="no"
377 case "$ac_cv_header_winber_h" in
379 AC_DEFINE_UNQUOTED(HAVE_WINBER_H, 1,
380 [Define to 1 if you have the winber.h header file.])
386 dnl CURL_CHECK_HEADER_LBER
387 dnl -------------------------------------------------
388 dnl Check for compilable and valid lber.h header,
389 dnl and check if it is needed even with ldap.h
391 AC_DEFUN([CURL_CHECK_HEADER_LBER], [
392 AC_REQUIRE([CURL_CHECK_HEADER_WINDOWS])dnl
393 AC_CACHE_CHECK([for lber.h], [ac_cv_header_lber_h], [
397 #ifdef HAVE_WINDOWS_H
398 #ifndef WIN32_LEAN_AND_MEAN
399 #define WIN32_LEAN_AND_MEAN
403 #ifdef HAVE_SYS_TYPES_H
404 #include <sys/types.h>
408 #define NULL (void *)0
412 BerValue *bvp = NULL;
413 BerElement *bep = ber_init(bvp);
417 ac_cv_header_lber_h="yes"
419 ac_cv_header_lber_h="no"
422 if test "$ac_cv_header_lber_h" = "yes"; then
423 AC_DEFINE_UNQUOTED(HAVE_LBER_H, 1,
424 [Define to 1 if you have the lber.h header file.])
429 #ifdef HAVE_WINDOWS_H
430 #ifndef WIN32_LEAN_AND_MEAN
431 #define WIN32_LEAN_AND_MEAN
435 #ifdef HAVE_SYS_TYPES_H
436 #include <sys/types.h>
440 #define NULL (void *)0
442 #ifndef LDAP_DEPRECATED
443 #define LDAP_DEPRECATED 1
447 BerValue *bvp = NULL;
448 BerElement *bep = ber_init(bvp);
452 curl_cv_need_header_lber_h="no"
454 curl_cv_need_header_lber_h="yes"
457 case "$curl_cv_need_header_lber_h" in
459 AC_DEFINE_UNQUOTED(NEED_LBER_H, 1,
460 [Define to 1 if you need the lber.h header file even with ldap.h])
467 dnl CURL_CHECK_HEADER_LDAP
468 dnl -------------------------------------------------
469 dnl Check for compilable and valid ldap.h header
471 AC_DEFUN([CURL_CHECK_HEADER_LDAP], [
472 AC_REQUIRE([CURL_CHECK_HEADER_LBER])dnl
473 AC_CACHE_CHECK([for ldap.h], [ac_cv_header_ldap_h], [
477 #ifdef HAVE_WINDOWS_H
478 #ifndef WIN32_LEAN_AND_MEAN
479 #define WIN32_LEAN_AND_MEAN
483 #ifdef HAVE_SYS_TYPES_H
484 #include <sys/types.h>
487 #ifndef LDAP_DEPRECATED
488 #define LDAP_DEPRECATED 1
495 LDAP *ldp = ldap_init("dummy", LDAP_PORT);
496 int res = ldap_unbind(ldp);
499 ac_cv_header_ldap_h="yes"
501 ac_cv_header_ldap_h="no"
504 case "$ac_cv_header_ldap_h" in
506 AC_DEFINE_UNQUOTED(HAVE_LDAP_H, 1,
507 [Define to 1 if you have the ldap.h header file.])
513 dnl CURL_CHECK_HEADER_LDAP_SSL
514 dnl -------------------------------------------------
515 dnl Check for compilable and valid ldap_ssl.h header
517 AC_DEFUN([CURL_CHECK_HEADER_LDAP_SSL], [
518 AC_REQUIRE([CURL_CHECK_HEADER_LDAP])dnl
519 AC_CACHE_CHECK([for ldap_ssl.h], [ac_cv_header_ldap_ssl_h], [
523 #ifdef HAVE_WINDOWS_H
524 #ifndef WIN32_LEAN_AND_MEAN
525 #define WIN32_LEAN_AND_MEAN
529 #ifdef HAVE_SYS_TYPES_H
530 #include <sys/types.h>
533 #ifndef LDAP_DEPRECATED
534 #define LDAP_DEPRECATED 1
542 #include <ldap_ssl.h>
544 LDAP *ldp = ldapssl_init("dummy", LDAPS_PORT, 1);
547 ac_cv_header_ldap_ssl_h="yes"
549 ac_cv_header_ldap_ssl_h="no"
552 case "$ac_cv_header_ldap_ssl_h" in
554 AC_DEFINE_UNQUOTED(HAVE_LDAP_SSL_H, 1,
555 [Define to 1 if you have the ldap_ssl.h header file.])
561 dnl CURL_CHECK_HEADER_LDAPSSL
562 dnl -------------------------------------------------
563 dnl Check for compilable and valid ldapssl.h header
565 AC_DEFUN([CURL_CHECK_HEADER_LDAPSSL], [
566 AC_REQUIRE([CURL_CHECK_HEADER_LDAP])dnl
567 AC_CACHE_CHECK([for ldapssl.h], [ac_cv_header_ldapssl_h], [
571 #ifdef HAVE_WINDOWS_H
572 #ifndef WIN32_LEAN_AND_MEAN
573 #define WIN32_LEAN_AND_MEAN
577 #ifdef HAVE_SYS_TYPES_H
578 #include <sys/types.h>
582 #define NULL (void *)0
584 #ifndef LDAP_DEPRECATED
585 #define LDAP_DEPRECATED 1
595 char *cert_label = NULL;
596 LDAP *ldp = ldap_ssl_init("dummy", LDAPS_PORT, cert_label);
599 ac_cv_header_ldapssl_h="yes"
601 ac_cv_header_ldapssl_h="no"
604 case "$ac_cv_header_ldapssl_h" in
606 AC_DEFINE_UNQUOTED(HAVE_LDAPSSL_H, 1,
607 [Define to 1 if you have the ldapssl.h header file.])
613 dnl CURL_CHECK_LIBS_WINLDAP
614 dnl -------------------------------------------------
615 dnl Check for libraries needed for WINLDAP support,
616 dnl and prepended to LIBS any needed libraries.
617 dnl This macro can take an optional parameter with a
618 dnl white space separated list of libraries to check
619 dnl before the WINLDAP default ones.
621 AC_DEFUN([CURL_CHECK_LIBS_WINLDAP], [
622 AC_REQUIRE([CURL_CHECK_HEADER_WINBER])dnl
624 AC_MSG_CHECKING([for WINLDAP libraries])
638 if test -z "$u_libs"; then
641 u_libs="$u_libs $l_lib"
646 curl_cv_save_LIBS="$LIBS"
647 curl_cv_ldap_LIBS="unknown"
649 for x_nlibs in '' "$u_libs" \
651 if test "$curl_cv_ldap_LIBS" = "unknown"; then
652 if test -z "$x_nlibs"; then
653 LIBS="$curl_cv_save_LIBS"
655 LIBS="$x_nlibs $curl_cv_save_LIBS"
660 #ifdef HAVE_WINDOWS_H
661 #ifndef WIN32_LEAN_AND_MEAN
662 #define WIN32_LEAN_AND_MEAN
665 #ifdef HAVE_WINLDAP_H
674 BerElement *bep = ber_init(bvp);
675 LDAP *ldp = ldap_init("dummy", LDAP_PORT);
676 ULONG res = ldap_unbind(ldp);
680 curl_cv_ldap_LIBS="$x_nlibs"
685 LIBS="$curl_cv_save_LIBS"
687 case X-"$curl_cv_ldap_LIBS" in
689 AC_MSG_RESULT([cannot find WINLDAP libraries])
692 AC_MSG_RESULT([no additional lib required])
695 if test -z "$curl_cv_save_LIBS"; then
696 LIBS="$curl_cv_ldap_LIBS"
698 LIBS="$curl_cv_ldap_LIBS $curl_cv_save_LIBS"
700 AC_MSG_RESULT([$curl_cv_ldap_LIBS])
707 dnl CURL_CHECK_LIBS_LDAP
708 dnl -------------------------------------------------
709 dnl Check for libraries needed for LDAP support,
710 dnl and prepended to LIBS any needed libraries.
711 dnl This macro can take an optional parameter with a
712 dnl white space separated list of libraries to check
713 dnl before the default ones.
715 AC_DEFUN([CURL_CHECK_LIBS_LDAP], [
716 AC_REQUIRE([CURL_CHECK_HEADER_LDAP])dnl
718 AC_MSG_CHECKING([for LDAP libraries])
732 if test -z "$u_libs"; then
735 u_libs="$u_libs $l_lib"
740 curl_cv_save_LIBS="$LIBS"
741 curl_cv_ldap_LIBS="unknown"
743 for x_nlibs in '' "$u_libs" \
747 '-lldapssl -lldapx -lldapsdk' \
748 '-lldapsdk -lldapx -lldapssl' ; do
749 if test "$curl_cv_ldap_LIBS" = "unknown"; then
750 if test -z "$x_nlibs"; then
751 LIBS="$curl_cv_save_LIBS"
753 LIBS="$x_nlibs $curl_cv_save_LIBS"
758 #ifdef HAVE_WINDOWS_H
759 #ifndef WIN32_LEAN_AND_MEAN
760 #define WIN32_LEAN_AND_MEAN
764 #ifdef HAVE_SYS_TYPES_H
765 #include <sys/types.h>
769 #define NULL (void *)0
771 #ifndef LDAP_DEPRECATED
772 #define LDAP_DEPRECATED 1
781 BerValue *bvp = NULL;
782 BerElement *bep = ber_init(bvp);
783 LDAP *ldp = ldap_init("dummy", LDAP_PORT);
784 int res = ldap_unbind(ldp);
788 curl_cv_ldap_LIBS="$x_nlibs"
793 LIBS="$curl_cv_save_LIBS"
795 case X-"$curl_cv_ldap_LIBS" in
797 AC_MSG_RESULT([cannot find LDAP libraries])
800 AC_MSG_RESULT([no additional lib required])
803 if test -z "$curl_cv_save_LIBS"; then
804 LIBS="$curl_cv_ldap_LIBS"
806 LIBS="$curl_cv_ldap_LIBS $curl_cv_save_LIBS"
808 AC_MSG_RESULT([$curl_cv_ldap_LIBS])
815 dnl CURL_CHECK_HEADER_MALLOC
816 dnl -------------------------------------------------
817 dnl Check for compilable and valid malloc.h header,
818 dnl and check if it is needed even with stdlib.h
820 AC_DEFUN([CURL_CHECK_HEADER_MALLOC], [
821 AC_CACHE_CHECK([for malloc.h], [ac_cv_header_malloc_h], [
826 void *p = malloc(10);
827 void *q = calloc(10,10);
832 ac_cv_header_malloc_h="yes"
834 ac_cv_header_malloc_h="no"
837 if test "$ac_cv_header_malloc_h" = "yes"; then
838 AC_DEFINE_UNQUOTED(HAVE_MALLOC_H, 1,
839 [Define to 1 if you have the malloc.h header file.])
845 void *p = malloc(10);
846 void *q = calloc(10,10);
851 curl_cv_need_header_malloc_h="no"
853 curl_cv_need_header_malloc_h="yes"
856 case "$curl_cv_need_header_malloc_h" in
858 AC_DEFINE_UNQUOTED(NEED_MALLOC_H, 1,
859 [Define to 1 if you need the malloc.h header file even with stdlib.h])
866 dnl CURL_CHECK_TYPE_SOCKLEN_T
867 dnl -------------------------------------------------
868 dnl Check for existing socklen_t type, and provide
869 dnl an equivalent type if socklen_t not available
871 AC_DEFUN([CURL_CHECK_TYPE_SOCKLEN_T], [
872 AC_REQUIRE([CURL_CHECK_HEADER_WS2TCPIP])dnl
873 AC_CHECK_TYPE([socklen_t], ,[
874 dnl socklen_t not available
875 AC_CACHE_CHECK([for socklen_t equivalent],
876 [curl_cv_socklen_t_equiv], [
877 curl_cv_socklen_t_equiv="unknown"
878 for arg1 in 'int' 'SOCKET'; do
879 for arg2 in "struct sockaddr" void; do
880 for t in int size_t unsigned long "unsigned long"; do
881 if test "$curl_cv_socklen_t_equiv" = "unknown"; then
885 #ifdef HAVE_WINDOWS_H
886 #ifndef WIN32_LEAN_AND_MEAN
887 #define WIN32_LEAN_AND_MEAN
890 #ifdef HAVE_WINSOCK2_H
891 #include <winsock2.h>
893 #ifdef HAVE_WINSOCK_H
897 #define GETPEERNCALLCONV PASCAL
899 #ifdef HAVE_SYS_TYPES_H
900 #include <sys/types.h>
902 #ifdef HAVE_SYS_SOCKET_H
903 #include <sys/socket.h>
905 #define GETPEERNCALLCONV
907 extern int GETPEERNCALLCONV getpeername($arg1, $arg2 *, $t *);
910 getpeername(0,0,&len);
913 curl_cv_socklen_t_equiv="$t"
920 case "$curl_cv_socklen_t_equiv" in
922 AC_MSG_ERROR([Cannot find a type to use in place of socklen_t])
925 AC_DEFINE_UNQUOTED(socklen_t, $curl_cv_socklen_t_equiv,
926 [Type to use in place of socklen_t when system does not provide it.])
931 #ifdef HAVE_WINDOWS_H
932 #ifndef WIN32_LEAN_AND_MEAN
933 #define WIN32_LEAN_AND_MEAN
936 #ifdef HAVE_WINSOCK2_H
937 #include <winsock2.h>
938 #ifdef HAVE_WS2TCPIP_H
939 #include <ws2tcpip.h>
943 #ifdef HAVE_SYS_TYPES_H
944 #include <sys/types.h>
946 #ifdef HAVE_SYS_SOCKET_H
947 #include <sys/socket.h>
954 dnl CURL_CHECK_FUNC_GETNAMEINFO
955 dnl -------------------------------------------------
956 dnl Test if the getnameinfo function is available,
957 dnl and check the types of five of its arguments.
958 dnl If the function succeeds HAVE_GETNAMEINFO will be
959 dnl defined, defining the types of the arguments in
960 dnl GETNAMEINFO_TYPE_ARG1, GETNAMEINFO_TYPE_ARG2,
961 dnl GETNAMEINFO_TYPE_ARG46 and GETNAMEINFO_TYPE_ARG7,
962 dnl and also defining the type qualifier of first
963 dnl argument in GETNAMEINFO_QUAL_ARG1.
965 AC_DEFUN([CURL_CHECK_FUNC_GETNAMEINFO], [
966 AC_REQUIRE([CURL_CHECK_HEADER_WS2TCPIP])dnl
967 AC_REQUIRE([CURL_CHECK_TYPE_SOCKLEN_T])dnl
968 AC_CHECK_HEADERS(sys/types.h sys/socket.h netdb.h)
970 AC_MSG_CHECKING([for getnameinfo])
972 AC_LANG_FUNC_LINK_TRY([getnameinfo])
975 curl_cv_getnameinfo="yes"
978 curl_cv_getnameinfo="no"
981 if test "$curl_cv_getnameinfo" != "yes"; then
982 AC_MSG_CHECKING([deeper for getnameinfo])
990 curl_cv_getnameinfo="yes"
992 AC_MSG_RESULT([but still no])
993 curl_cv_getnameinfo="no"
997 if test "$curl_cv_getnameinfo" != "yes"; then
998 AC_MSG_CHECKING([deeper and deeper for getnameinfo])
1002 #ifdef HAVE_WINDOWS_H
1003 #ifndef WIN32_LEAN_AND_MEAN
1004 #define WIN32_LEAN_AND_MEAN
1006 #include <windows.h>
1007 #ifdef HAVE_WINSOCK2_H
1008 #include <winsock2.h>
1009 #ifdef HAVE_WS2TCPIP_H
1010 #include <ws2tcpip.h>
1014 #ifdef HAVE_SYS_TYPES_H
1015 #include <sys/types.h>
1017 #ifdef HAVE_SYS_SOCKET_H
1018 #include <sys/socket.h>
1025 getnameinfo(0, 0, 0, 0, 0, 0, 0);
1028 AC_MSG_RESULT([yes])
1029 curl_cv_getnameinfo="yes"
1031 AC_MSG_RESULT([but still no])
1032 curl_cv_getnameinfo="no"
1036 if test "$curl_cv_getnameinfo" = "yes"; then
1037 AC_CACHE_CHECK([types of arguments for getnameinfo],
1038 [curl_cv_func_getnameinfo_args], [
1039 curl_cv_func_getnameinfo_args="unknown"
1040 for gni_arg1 in 'struct sockaddr *' 'const struct sockaddr *' 'void *'; do
1041 for gni_arg2 in 'socklen_t' 'size_t' 'int'; do
1042 for gni_arg46 in 'size_t' 'int' 'socklen_t' 'unsigned int' 'DWORD'; do
1043 for gni_arg7 in 'int' 'unsigned int'; do
1044 if test "$curl_cv_func_getnameinfo_args" = "unknown"; then
1048 #ifdef HAVE_WINDOWS_H
1049 #ifndef WIN32_LEAN_AND_MEAN
1050 #define WIN32_LEAN_AND_MEAN
1052 #if (!defined(_WIN32_WINNT)) || (_WIN32_WINNT < 0x0501)
1054 #define _WIN32_WINNT 0x0501
1056 #include <windows.h>
1057 #ifdef HAVE_WINSOCK2_H
1058 #include <winsock2.h>
1059 #ifdef HAVE_WS2TCPIP_H
1060 #include <ws2tcpip.h>
1063 #define GNICALLCONV WSAAPI
1065 #ifdef HAVE_SYS_TYPES_H
1066 #include <sys/types.h>
1068 #ifdef HAVE_SYS_SOCKET_H
1069 #include <sys/socket.h>
1076 extern int GNICALLCONV getnameinfo($gni_arg1, $gni_arg2,
1082 $gni_arg46 hostlen=0;
1083 $gni_arg46 servlen=0;
1085 int res = getnameinfo(0, salen, 0, hostlen, 0, servlen, flags);
1088 curl_cv_func_getnameinfo_args="$gni_arg1,$gni_arg2,$gni_arg46,$gni_arg7"
1096 if test "$curl_cv_func_getnameinfo_args" = "unknown"; then
1097 AC_MSG_WARN([Cannot find proper types to use for getnameinfo args])
1098 AC_MSG_WARN([HAVE_GETNAMEINFO will not be defined])
1100 gni_prev_IFS=$IFS; IFS=','
1101 set dummy `echo "$curl_cv_func_getnameinfo_args" | sed 's/\*/\*/g'`
1105 gni_qual_type_arg1=$[1]
1107 AC_DEFINE_UNQUOTED(GETNAMEINFO_TYPE_ARG2, $[2],
1108 [Define to the type of arg 2 for getnameinfo.])
1109 AC_DEFINE_UNQUOTED(GETNAMEINFO_TYPE_ARG46, $[3],
1110 [Define to the type of args 4 and 6 for getnameinfo.])
1111 AC_DEFINE_UNQUOTED(GETNAMEINFO_TYPE_ARG7, $[4],
1112 [Define to the type of arg 7 for getnameinfo.])
1116 case $prev_sh_opts in
1124 case "$gni_qual_type_arg1" in
1127 gni_type_arg1=`echo $gni_qual_type_arg1 | sed 's/^const //'`
1131 gni_type_arg1=$gni_qual_type_arg1
1135 AC_DEFINE_UNQUOTED(GETNAMEINFO_QUAL_ARG1, $gni_qual_arg1,
1136 [Define to the type qualifier of arg 1 for getnameinfo.])
1137 AC_DEFINE_UNQUOTED(GETNAMEINFO_TYPE_ARG1, $gni_type_arg1,
1138 [Define to the type of arg 1 for getnameinfo.])
1140 case $prev_sh_opts in
1148 AC_DEFINE_UNQUOTED(HAVE_GETNAMEINFO, 1,
1149 [Define to 1 if you have the getnameinfo function.])
1150 ac_cv_func_getnameinfo="yes"
1156 dnl TYPE_SOCKADDR_STORAGE
1157 dnl -------------------------------------------------
1158 dnl Check for struct sockaddr_storage. Most IPv6-enabled
1159 dnl hosts have it, but AIX 4.3 is one known exception.
1161 AC_DEFUN([TYPE_SOCKADDR_STORAGE],
1163 AC_CHECK_TYPE([struct sockaddr_storage],
1164 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE, 1,
1165 [if struct sockaddr_storage is defined]), ,
1168 #ifdef HAVE_WINDOWS_H
1169 #ifndef WIN32_LEAN_AND_MEAN
1170 #define WIN32_LEAN_AND_MEAN
1172 #include <windows.h>
1173 #ifdef HAVE_WINSOCK2_H
1174 #include <winsock2.h>
1177 #ifdef HAVE_SYS_TYPES_H
1178 #include <sys/types.h>
1180 #ifdef HAVE_SYS_SOCKET_H
1181 #include <sys/socket.h>
1183 #ifdef HAVE_NETINET_IN_H
1184 #include <netinet/in.h>
1186 #ifdef HAVE_ARPA_INET_H
1187 #include <arpa/inet.h>
1194 dnl CURL_CHECK_NI_WITHSCOPEID
1195 dnl -------------------------------------------------
1196 dnl Check for working NI_WITHSCOPEID in getnameinfo()
1198 AC_DEFUN([CURL_CHECK_NI_WITHSCOPEID], [
1199 AC_REQUIRE([CURL_CHECK_FUNC_GETNAMEINFO])dnl
1200 AC_REQUIRE([TYPE_SOCKADDR_STORAGE])dnl
1201 AC_CHECK_HEADERS(stdio.h sys/types.h sys/socket.h \
1202 netdb.h netinet/in.h arpa/inet.h)
1204 AC_CACHE_CHECK([for working NI_WITHSCOPEID],
1205 [ac_cv_working_ni_withscopeid], [
1211 #ifdef HAVE_SYS_TYPES_H
1212 #include <sys/types.h>
1214 #ifdef HAVE_SYS_SOCKET_H
1215 #include <sys/socket.h>
1220 #ifdef HAVE_NETINET_IN_H
1221 #include <netinet/in.h>
1223 #ifdef HAVE_ARPA_INET_H
1224 #include <arpa/inet.h>
1227 #if defined(NI_WITHSCOPEID) && defined(HAVE_GETNAMEINFO)
1228 #ifdef HAVE_STRUCT_SOCKADDR_STORAGE
1229 struct sockaddr_storage sa;
1231 unsigned char sa[256];
1233 char hostbuf[NI_MAXHOST];
1235 GETNAMEINFO_TYPE_ARG2 salen = (GETNAMEINFO_TYPE_ARG2)sizeof(sa);
1236 GETNAMEINFO_TYPE_ARG46 hostlen = (GETNAMEINFO_TYPE_ARG46)sizeof(hostbuf);
1237 GETNAMEINFO_TYPE_ARG7 flags = NI_NUMERICHOST | NI_NUMERICSERV | NI_WITHSCOPEID;
1238 int fd = socket(AF_INET6, SOCK_STREAM, 0);
1241 return 1; /* Error creating socket */
1243 rc = getsockname(fd, (GETNAMEINFO_TYPE_ARG1)&sa, &salen);
1245 perror("getsockname()");
1246 return 2; /* Error retrieving socket name */
1248 rc = getnameinfo((GETNAMEINFO_TYPE_ARG1)&sa, salen, hostbuf, hostlen, NULL, 0, flags);
1250 printf("rc = %s\n", gai_strerror(rc));
1251 return 3; /* Error translating socket address */
1253 return 0; /* Ok, NI_WITHSCOPEID works */
1255 return 4; /* Error, NI_WITHSCOPEID not defined or no getnameinfo() */
1257 ]]) # AC-LANG-PROGRAM
1259 # Exit code == 0. Program worked.
1260 ac_cv_working_ni_withscopeid="yes"
1262 # Exit code != 0. Program failed.
1263 ac_cv_working_ni_withscopeid="no"
1265 # Program is not run when cross-compiling. So we assume
1266 # NI_WITHSCOPEID will work if we are able to compile it.
1269 #include <sys/types.h>
1270 #include <sys/socket.h>
1273 unsigned int dummy= NI_NUMERICHOST | NI_NUMERICSERV | NI_WITHSCOPEID;
1276 ac_cv_working_ni_withscopeid="yes"
1278 ac_cv_working_ni_withscopeid="no"
1279 ]) # AC-COMPILE-IFELSE
1282 case "$ac_cv_working_ni_withscopeid" in
1284 AC_DEFINE(HAVE_NI_WITHSCOPEID, 1,
1285 [Define to 1 if NI_WITHSCOPEID exists and works.])
1291 dnl CURL_CHECK_FUNC_RECV
1292 dnl -------------------------------------------------
1293 dnl Test if the socket recv() function is available,
1294 dnl and check its return type and the types of its
1295 dnl arguments. If the function succeeds HAVE_RECV
1296 dnl will be defined, defining the types of the arguments
1297 dnl in RECV_TYPE_ARG1, RECV_TYPE_ARG2, RECV_TYPE_ARG3
1298 dnl and RECV_TYPE_ARG4, defining the type of the function
1299 dnl return value in RECV_TYPE_RETV.
1301 AC_DEFUN([CURL_CHECK_FUNC_RECV], [
1302 AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK])dnl
1303 AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK2])dnl
1304 AC_CHECK_HEADERS(sys/types.h sys/socket.h)
1306 AC_MSG_CHECKING([for recv])
1310 #ifdef HAVE_WINDOWS_H
1311 #ifndef WIN32_LEAN_AND_MEAN
1312 #define WIN32_LEAN_AND_MEAN
1314 #include <windows.h>
1315 #ifdef HAVE_WINSOCK2_H
1316 #include <winsock2.h>
1318 #ifdef HAVE_WINSOCK_H
1319 #include <winsock.h>
1323 #ifdef HAVE_SYS_TYPES_H
1324 #include <sys/types.h>
1326 #ifdef HAVE_SYS_SOCKET_H
1327 #include <sys/socket.h>
1334 AC_MSG_RESULT([yes])
1341 if test "$curl_cv_recv" = "yes"; then
1342 AC_CACHE_CHECK([types of args and return type for recv],
1343 [curl_cv_func_recv_args], [
1344 curl_cv_func_recv_args="unknown"
1345 for recv_retv in 'int' 'ssize_t'; do
1346 for recv_arg1 in 'int' 'ssize_t' 'SOCKET'; do
1347 for recv_arg2 in 'char *' 'void *'; do
1348 for recv_arg3 in 'size_t' 'int' 'socklen_t' 'unsigned int'; do
1349 for recv_arg4 in 'int' 'unsigned int'; do
1350 if test "$curl_cv_func_recv_args" = "unknown"; then
1354 #ifdef HAVE_WINDOWS_H
1355 #ifndef WIN32_LEAN_AND_MEAN
1356 #define WIN32_LEAN_AND_MEAN
1358 #include <windows.h>
1359 #ifdef HAVE_WINSOCK2_H
1360 #include <winsock2.h>
1362 #ifdef HAVE_WINSOCK_H
1363 #include <winsock.h>
1366 #define RECVCALLCONV PASCAL
1368 #ifdef HAVE_SYS_TYPES_H
1369 #include <sys/types.h>
1371 #ifdef HAVE_SYS_SOCKET_H
1372 #include <sys/socket.h>
1374 #define RECVCALLCONV
1376 extern $recv_retv RECVCALLCONV
1377 recv($recv_arg1, $recv_arg2, $recv_arg3, $recv_arg4);
1383 $recv_retv res = recv(s, buf, len, flags);
1386 curl_cv_func_recv_args="$recv_arg1,$recv_arg2,$recv_arg3,$recv_arg4,$recv_retv"
1395 if test "$curl_cv_func_recv_args" = "unknown"; then
1396 AC_MSG_ERROR([Cannot find proper types to use for recv args])
1398 recv_prev_IFS=$IFS; IFS=','
1399 set dummy `echo "$curl_cv_func_recv_args" | sed 's/\*/\*/g'`
1403 AC_DEFINE_UNQUOTED(RECV_TYPE_ARG1, $[1],
1404 [Define to the type of arg 1 for recv.])
1405 AC_DEFINE_UNQUOTED(RECV_TYPE_ARG2, $[2],
1406 [Define to the type of arg 2 for recv.])
1407 AC_DEFINE_UNQUOTED(RECV_TYPE_ARG3, $[3],
1408 [Define to the type of arg 3 for recv.])
1409 AC_DEFINE_UNQUOTED(RECV_TYPE_ARG4, $[4],
1410 [Define to the type of arg 4 for recv.])
1411 AC_DEFINE_UNQUOTED(RECV_TYPE_RETV, $[5],
1412 [Define to the function return type for recv.])
1414 AC_DEFINE_UNQUOTED(HAVE_RECV, 1,
1415 [Define to 1 if you have the recv function.])
1416 ac_cv_func_recv="yes"
1419 AC_MSG_ERROR([Unable to link function recv])
1424 dnl CURL_CHECK_FUNC_SEND
1425 dnl -------------------------------------------------
1426 dnl Test if the socket send() function is available,
1427 dnl and check its return type and the types of its
1428 dnl arguments. If the function succeeds HAVE_SEND
1429 dnl will be defined, defining the types of the arguments
1430 dnl in SEND_TYPE_ARG1, SEND_TYPE_ARG2, SEND_TYPE_ARG3
1431 dnl and SEND_TYPE_ARG4, defining the type of the function
1432 dnl return value in SEND_TYPE_RETV, and also defining the
1433 dnl type qualifier of second argument in SEND_QUAL_ARG2.
1435 AC_DEFUN([CURL_CHECK_FUNC_SEND], [
1436 AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK])dnl
1437 AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK2])dnl
1438 AC_CHECK_HEADERS(sys/types.h sys/socket.h)
1440 AC_MSG_CHECKING([for send])
1444 #ifdef HAVE_WINDOWS_H
1445 #ifndef WIN32_LEAN_AND_MEAN
1446 #define WIN32_LEAN_AND_MEAN
1448 #include <windows.h>
1449 #ifdef HAVE_WINSOCK2_H
1450 #include <winsock2.h>
1452 #ifdef HAVE_WINSOCK_H
1453 #include <winsock.h>
1457 #ifdef HAVE_SYS_TYPES_H
1458 #include <sys/types.h>
1460 #ifdef HAVE_SYS_SOCKET_H
1461 #include <sys/socket.h>
1468 AC_MSG_RESULT([yes])
1475 if test "$curl_cv_send" = "yes"; then
1476 AC_CACHE_CHECK([types of args and return type for send],
1477 [curl_cv_func_send_args], [
1478 curl_cv_func_send_args="unknown"
1479 for send_retv in 'int' 'ssize_t'; do
1480 for send_arg1 in 'int' 'ssize_t' 'SOCKET'; do
1481 for send_arg2 in 'char *' 'void *' 'const char *' 'const void *'; do
1482 for send_arg3 in 'size_t' 'int' 'socklen_t' 'unsigned int'; do
1483 for send_arg4 in 'int' 'unsigned int'; do
1484 if test "$curl_cv_func_send_args" = "unknown"; then
1488 #ifdef HAVE_WINDOWS_H
1489 #ifndef WIN32_LEAN_AND_MEAN
1490 #define WIN32_LEAN_AND_MEAN
1492 #include <windows.h>
1493 #ifdef HAVE_WINSOCK2_H
1494 #include <winsock2.h>
1496 #ifdef HAVE_WINSOCK_H
1497 #include <winsock.h>
1500 #define SENDCALLCONV PASCAL
1502 #ifdef HAVE_SYS_TYPES_H
1503 #include <sys/types.h>
1505 #ifdef HAVE_SYS_SOCKET_H
1506 #include <sys/socket.h>
1508 #define SENDCALLCONV
1510 extern $send_retv SENDCALLCONV
1511 send($send_arg1, $send_arg2, $send_arg3, $send_arg4);
1516 $send_retv res = send(s, 0, len, flags);
1519 curl_cv_func_send_args="$send_arg1,$send_arg2,$send_arg3,$send_arg4,$send_retv"
1528 if test "$curl_cv_func_send_args" = "unknown"; then
1529 AC_MSG_ERROR([Cannot find proper types to use for send args])
1531 send_prev_IFS=$IFS; IFS=','
1532 set dummy `echo "$curl_cv_func_send_args" | sed 's/\*/\*/g'`
1536 send_qual_type_arg2=$[2]
1538 AC_DEFINE_UNQUOTED(SEND_TYPE_ARG1, $[1],
1539 [Define to the type of arg 1 for send.])
1540 AC_DEFINE_UNQUOTED(SEND_TYPE_ARG3, $[3],
1541 [Define to the type of arg 3 for send.])
1542 AC_DEFINE_UNQUOTED(SEND_TYPE_ARG4, $[4],
1543 [Define to the type of arg 4 for send.])
1544 AC_DEFINE_UNQUOTED(SEND_TYPE_RETV, $[5],
1545 [Define to the function return type for send.])
1549 case $prev_sh_opts in
1557 case "$send_qual_type_arg2" in
1559 send_qual_arg2=const
1560 send_type_arg2=`echo $send_qual_type_arg2 | sed 's/^const //'`
1564 send_type_arg2=$send_qual_type_arg2
1568 AC_DEFINE_UNQUOTED(SEND_QUAL_ARG2, $send_qual_arg2,
1569 [Define to the type qualifier of arg 2 for send.])
1570 AC_DEFINE_UNQUOTED(SEND_TYPE_ARG2, $send_type_arg2,
1571 [Define to the type of arg 2 for send.])
1573 case $prev_sh_opts in
1581 AC_DEFINE_UNQUOTED(HAVE_SEND, 1,
1582 [Define to 1 if you have the send function.])
1583 ac_cv_func_send="yes"
1586 AC_MSG_ERROR([Unable to link function send])
1591 dnl CURL_CHECK_FUNC_RECVFROM
1592 dnl -------------------------------------------------
1593 dnl Test if the socket recvfrom() function is available,
1594 dnl and check its return type and the types of its
1595 dnl arguments. If the function succeeds HAVE_RECVFROM
1596 dnl will be defined, defining the types of the arguments
1597 dnl in RECVFROM_TYPE_ARG1, RECVFROM_TYPE_ARG2, and so on
1598 dnl to RECVFROM_TYPE_ARG6, defining also the type of the
1599 dnl function return value in RECVFROM_TYPE_RETV.
1600 dnl Notice that the types returned for pointer arguments
1601 dnl will actually be the type pointed by the pointer.
1603 AC_DEFUN([CURL_CHECK_FUNC_RECVFROM], [
1604 AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK])dnl
1605 AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK2])dnl
1606 AC_CHECK_HEADERS(sys/types.h sys/socket.h)
1608 AC_MSG_CHECKING([for recvfrom])
1612 #ifdef HAVE_WINDOWS_H
1613 #ifndef WIN32_LEAN_AND_MEAN
1614 #define WIN32_LEAN_AND_MEAN
1616 #include <windows.h>
1617 #ifdef HAVE_WINSOCK2_H
1618 #include <winsock2.h>
1620 #ifdef HAVE_WINSOCK_H
1621 #include <winsock.h>
1625 #ifdef HAVE_SYS_TYPES_H
1626 #include <sys/types.h>
1628 #ifdef HAVE_SYS_SOCKET_H
1629 #include <sys/socket.h>
1633 recvfrom(0, 0, 0, 0, 0, 0);
1636 AC_MSG_RESULT([yes])
1637 curl_cv_recvfrom="yes"
1640 curl_cv_recvfrom="no"
1643 if test "$curl_cv_recvfrom" = "yes"; then
1644 AC_CACHE_CHECK([types of args and return type for recvfrom],
1645 [curl_cv_func_recvfrom_args], [
1646 curl_cv_func_recvfrom_args="unknown"
1647 for recvfrom_retv in 'int' 'ssize_t'; do
1648 for recvfrom_arg1 in 'int' 'ssize_t' 'SOCKET'; do
1649 for recvfrom_arg2 in 'char *' 'void *'; do
1650 for recvfrom_arg3 in 'size_t' 'int' 'socklen_t' 'unsigned int'; do
1651 for recvfrom_arg4 in 'int' 'unsigned int'; do
1652 for recvfrom_arg5 in 'struct sockaddr *' 'void *'; do
1653 for recvfrom_arg6 in 'socklen_t *' 'int *' 'unsigned int *' 'size_t *' 'void *'; do
1654 if test "$curl_cv_func_recvfrom_args" = "unknown"; then
1658 #ifdef HAVE_WINDOWS_H
1659 #ifndef WIN32_LEAN_AND_MEAN
1660 #define WIN32_LEAN_AND_MEAN
1662 #include <windows.h>
1663 #ifdef HAVE_WINSOCK2_H
1664 #include <winsock2.h>
1666 #ifdef HAVE_WINSOCK_H
1667 #include <winsock.h>
1670 #define RECVFROMCALLCONV PASCAL
1672 #ifdef HAVE_SYS_TYPES_H
1673 #include <sys/types.h>
1675 #ifdef HAVE_SYS_SOCKET_H
1676 #include <sys/socket.h>
1678 #define RECVFROMCALLCONV
1680 extern $recvfrom_retv RECVFROMCALLCONV
1681 recvfrom($recvfrom_arg1, $recvfrom_arg2,
1682 $recvfrom_arg3, $recvfrom_arg4,
1683 $recvfrom_arg5, $recvfrom_arg6);
1686 $recvfrom_arg2 buf=0;
1687 $recvfrom_arg3 len=0;
1688 $recvfrom_arg4 flags=0;
1689 $recvfrom_arg5 addr=0;
1690 $recvfrom_arg6 addrlen=0;
1691 $recvfrom_retv res=0;
1692 res = recvfrom(s, buf, len, flags, addr, addrlen);
1695 curl_cv_func_recvfrom_args="$recvfrom_arg1,$recvfrom_arg2,$recvfrom_arg3,$recvfrom_arg4,$recvfrom_arg5,$recvfrom_arg6,$recvfrom_retv"
1706 if test "$curl_cv_func_recvfrom_args" = "unknown"; then
1707 AC_MSG_ERROR([Cannot find proper types to use for recvfrom args])
1709 recvfrom_prev_IFS=$IFS; IFS=','
1710 set dummy `echo "$curl_cv_func_recvfrom_args" | sed 's/\*/\*/g'`
1711 IFS=$recvfrom_prev_IFS
1714 recvfrom_ptrt_arg2=$[2]
1715 recvfrom_ptrt_arg5=$[5]
1716 recvfrom_ptrt_arg6=$[6]
1718 AC_DEFINE_UNQUOTED(RECVFROM_TYPE_ARG1, $[1],
1719 [Define to the type of arg 1 for recvfrom.])
1720 AC_DEFINE_UNQUOTED(RECVFROM_TYPE_ARG3, $[3],
1721 [Define to the type of arg 3 for recvfrom.])
1722 AC_DEFINE_UNQUOTED(RECVFROM_TYPE_ARG4, $[4],
1723 [Define to the type of arg 4 for recvfrom.])
1724 AC_DEFINE_UNQUOTED(RECVFROM_TYPE_RETV, $[7],
1725 [Define to the function return type for recvfrom.])
1729 case $prev_sh_opts in
1737 recvfrom_type_arg2=`echo $recvfrom_ptrt_arg2 | sed 's/ \*//'`
1738 recvfrom_type_arg5=`echo $recvfrom_ptrt_arg5 | sed 's/ \*//'`
1739 recvfrom_type_arg6=`echo $recvfrom_ptrt_arg6 | sed 's/ \*//'`
1741 AC_DEFINE_UNQUOTED(RECVFROM_TYPE_ARG2, $recvfrom_type_arg2,
1742 [Define to the type pointed by arg 2 for recvfrom.])
1743 AC_DEFINE_UNQUOTED(RECVFROM_TYPE_ARG5, $recvfrom_type_arg5,
1744 [Define to the type pointed by arg 5 for recvfrom.])
1745 AC_DEFINE_UNQUOTED(RECVFROM_TYPE_ARG6, $recvfrom_type_arg6,
1746 [Define to the type pointed by arg 6 for recvfrom.])
1748 if test "$recvfrom_type_arg2" = "void"; then
1749 AC_DEFINE_UNQUOTED(RECVFROM_TYPE_ARG2_IS_VOID, 1,
1750 [Define to 1 if the type pointed by arg 2 for recvfrom is void.])
1752 if test "$recvfrom_type_arg5" = "void"; then
1753 AC_DEFINE_UNQUOTED(RECVFROM_TYPE_ARG5_IS_VOID, 1,
1754 [Define to 1 if the type pointed by arg 5 for recvfrom is void.])
1756 if test "$recvfrom_type_arg6" = "void"; then
1757 AC_DEFINE_UNQUOTED(RECVFROM_TYPE_ARG6_IS_VOID, 1,
1758 [Define to 1 if the type pointed by arg 6 for recvfrom is void.])
1761 case $prev_sh_opts in
1769 AC_DEFINE_UNQUOTED(HAVE_RECVFROM, 1,
1770 [Define to 1 if you have the recvfrom function.])
1771 ac_cv_func_recvfrom="yes"
1774 AC_MSG_ERROR([Unable to link function recvfrom])
1779 dnl CURL_CHECK_MSG_NOSIGNAL
1780 dnl -------------------------------------------------
1781 dnl Check for MSG_NOSIGNAL
1783 AC_DEFUN([CURL_CHECK_MSG_NOSIGNAL], [
1784 AC_CHECK_HEADERS(sys/types.h sys/socket.h)
1785 AC_CACHE_CHECK([for MSG_NOSIGNAL], [ac_cv_msg_nosignal], [
1789 #ifdef HAVE_WINDOWS_H
1790 #ifndef WIN32_LEAN_AND_MEAN
1791 #define WIN32_LEAN_AND_MEAN
1793 #include <windows.h>
1794 #ifdef HAVE_WINSOCK2_H
1795 #include <winsock2.h>
1797 #ifdef HAVE_WINSOCK_H
1798 #include <winsock.h>
1802 #ifdef HAVE_SYS_TYPES_H
1803 #include <sys/types.h>
1805 #ifdef HAVE_SYS_SOCKET_H
1806 #include <sys/socket.h>
1810 int flag=MSG_NOSIGNAL;
1813 ac_cv_msg_nosignal="yes"
1815 ac_cv_msg_nosignal="no"
1818 case "$ac_cv_msg_nosignal" in
1820 AC_DEFINE_UNQUOTED(HAVE_MSG_NOSIGNAL, 1,
1821 [Define to 1 if you have the MSG_NOSIGNAL flag.])
1827 dnl CURL_CHECK_STRUCT_TIMEVAL
1828 dnl -------------------------------------------------
1829 dnl Check for timeval struct
1831 AC_DEFUN([CURL_CHECK_STRUCT_TIMEVAL], [
1832 AC_REQUIRE([AC_HEADER_TIME])dnl
1833 AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK])dnl
1834 AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK2])dnl
1835 AC_CHECK_HEADERS(sys/types.h sys/time.h time.h)
1836 AC_CACHE_CHECK([for struct timeval], [ac_cv_struct_timeval], [
1840 #ifdef HAVE_WINDOWS_H
1841 #ifndef WIN32_LEAN_AND_MEAN
1842 #define WIN32_LEAN_AND_MEAN
1844 #include <windows.h>
1845 #ifdef HAVE_WINSOCK2_H
1846 #include <winsock2.h>
1848 #ifdef HAVE_WINSOCK_H
1849 #include <winsock.h>
1853 #ifdef HAVE_SYS_TYPES_H
1854 #include <sys/types.h>
1856 #ifdef HAVE_SYS_TIME_H
1857 #include <sys/time.h>
1858 #ifdef TIME_WITH_SYS_TIME
1872 ac_cv_struct_timeval="yes"
1874 ac_cv_struct_timeval="no"
1877 case "$ac_cv_struct_timeval" in
1879 AC_DEFINE_UNQUOTED(HAVE_STRUCT_TIMEVAL, 1,
1880 [Define to 1 if you have the timeval struct.])
1886 dnl TYPE_SIG_ATOMIC_T
1887 dnl -------------------------------------------------
1888 dnl Check if the sig_atomic_t type is available, and
1889 dnl verify if it is already defined as volatile.
1891 AC_DEFUN([TYPE_SIG_ATOMIC_T], [
1892 AC_CHECK_HEADERS(signal.h)
1893 AC_CHECK_TYPE([sig_atomic_t],[
1894 AC_DEFINE(HAVE_SIG_ATOMIC_T, 1,
1895 [Define to 1 if sig_atomic_t is an available typedef.])
1897 #ifdef HAVE_SIGNAL_H
1901 case "$ac_cv_type_sig_atomic_t" in
1904 AC_MSG_CHECKING([if sig_atomic_t is already defined as volatile])
1907 #ifdef HAVE_SIGNAL_H
1911 static volatile sig_atomic_t dummy = 0;
1915 ac_cv_sig_atomic_t_volatile="no"
1917 AC_MSG_RESULT([yes])
1918 ac_cv_sig_atomic_t_volatile="yes"
1921 if test "$ac_cv_sig_atomic_t_volatile" = "yes"; then
1922 AC_DEFINE(HAVE_SIG_ATOMIC_T_VOLATILE, 1,
1923 [Define to 1 if sig_atomic_t is already defined as volatile.])
1930 dnl CURL_CHECK_NONBLOCKING_SOCKET
1931 dnl -------------------------------------------------
1932 dnl Check for how to set a socket to non-blocking state. There seems to exist
1933 dnl four known different ways, with the one used almost everywhere being POSIX
1934 dnl and XPG3, while the other different ways for different systems (old BSD,
1935 dnl Windows and Amiga).
1937 dnl There are two known platforms (AIX 3.x and SunOS 4.1.x) where the
1938 dnl O_NONBLOCK define is found but does not work. This condition is attempted
1939 dnl to get caught in this script by using an excessive number of #ifdefs...
1941 AC_DEFUN([CURL_CHECK_NONBLOCKING_SOCKET], [
1942 AC_MSG_CHECKING([non-blocking sockets style])
1947 /* headers for O_NONBLOCK test */
1948 #include <sys/types.h>
1952 #if defined(sun) || defined(__sun__) || \
1953 defined(__SUNPRO_C) || defined(__SUNPRO_CC)
1954 # if defined(__SVR4) || defined(__srv4__)
1955 # define PLATFORM_SOLARIS
1957 # define PLATFORM_SUNOS4
1960 #if (defined(_AIX) || defined(__xlC__)) && !defined(_AIX41)
1961 # define PLATFORM_AIX_V3
1964 #if defined(PLATFORM_SUNOS4) || defined(PLATFORM_AIX_V3) || defined(__BEOS__)
1965 #error "O_NONBLOCK does not work on this platform"
1968 /* O_NONBLOCK source test */
1970 int flags = fcntl(socket, F_SETFL, flags | O_NONBLOCK);
1973 dnl the O_NONBLOCK test was fine
1974 nonblock="O_NONBLOCK"
1975 AC_DEFINE(HAVE_O_NONBLOCK, 1,
1976 [use O_NONBLOCK for non-blocking sockets])
1979 if test "$nonblock" = "unknown"; then
1982 /* headers for FIONBIO test */
1984 #include <stropts.h>
1986 /* FIONBIO source test (old-style unix) */
1988 int flags = ioctl(socket, FIONBIO, &flags);
1991 dnl FIONBIO test was good
1993 AC_DEFINE(HAVE_FIONBIO, 1,
1994 [use FIONBIO for non-blocking sockets])
1998 if test "$nonblock" = "unknown"; then
2001 /* headers for ioctlsocket test (Windows) */
2003 #ifdef HAVE_WINDOWS_H
2004 #ifndef WIN32_LEAN_AND_MEAN
2005 #define WIN32_LEAN_AND_MEAN
2007 #include <windows.h>
2008 #ifdef HAVE_WINSOCK2_H
2009 #include <winsock2.h>
2011 #ifdef HAVE_WINSOCK_H
2012 #include <winsock.h>
2017 /* ioctlsocket source code (Windows) */
2019 unsigned long flags = 0;
2020 sd = socket(0, 0, 0);
2021 ioctlsocket(sd, FIONBIO, &flags);
2024 dnl ioctlsocket test was good
2025 nonblock="ioctlsocket"
2026 AC_DEFINE(HAVE_IOCTLSOCKET, 1,
2027 [use ioctlsocket() for non-blocking sockets])
2031 if test "$nonblock" = "unknown"; then
2034 /* headers for IoctlSocket test (Amiga?) */
2035 #include <sys/ioctl.h>
2037 /* IoctlSocket source code (Amiga?) */
2039 int flags = IoctlSocket(socket, FIONBIO, (long)1);
2042 dnl Ioctlsocket test was good
2043 nonblock="IoctlSocket"
2044 AC_DEFINE(HAVE_IOCTLSOCKET_CASE, 1,
2045 [use Ioctlsocket() for non-blocking sockets])
2049 if test "$nonblock" = "unknown"; then
2052 /* headers for SO_NONBLOCK test (BeOS) */
2055 /* SO_NONBLOCK source code (BeOS) */
2058 int flags = setsockopt(socket, SOL_SOCKET, SO_NONBLOCK, &b, sizeof(b));
2061 dnl the SO_NONBLOCK test was good
2062 nonblock="SO_NONBLOCK"
2063 AC_DEFINE(HAVE_SO_NONBLOCK, 1,
2064 [use SO_NONBLOCK for non-blocking sockets])
2068 AC_MSG_RESULT($nonblock)
2070 if test "$nonblock" = "unknown"; then
2071 AC_DEFINE(HAVE_DISABLED_NONBLOCKING, 1,
2072 [disabled non-blocking sockets])
2073 AC_MSG_WARN([non-block sockets disabled])
2079 dnl -------------------------------------------------
2080 dnl Check for in_addr_t: it is used to receive the return code of inet_addr()
2081 dnl and a few other things.
2083 AC_DEFUN([TYPE_IN_ADDR_T], [
2084 AC_CHECK_TYPE([in_addr_t], ,[
2085 dnl in_addr_t not available
2086 AC_CACHE_CHECK([for in_addr_t equivalent],
2087 [curl_cv_in_addr_t_equiv], [
2088 curl_cv_in_addr_t_equiv="unknown"
2089 for t in "unsigned long" int size_t unsigned long; do
2090 if test "$curl_cv_in_addr_t_equiv" = "unknown"; then
2094 #ifdef HAVE_WINDOWS_H
2095 #ifndef WIN32_LEAN_AND_MEAN
2096 #define WIN32_LEAN_AND_MEAN
2098 #include <windows.h>
2099 #ifdef HAVE_WINSOCK2_H
2100 #include <winsock2.h>
2102 #ifdef HAVE_WINSOCK_H
2103 #include <winsock.h>
2107 #ifdef HAVE_SYS_TYPES_H
2108 #include <sys/types.h>
2110 #ifdef HAVE_SYS_SOCKET_H
2111 #include <sys/socket.h>
2113 #ifdef HAVE_NETINET_IN_H
2114 #include <netinet/in.h>
2116 #ifdef HAVE_ARPA_INET_H
2117 #include <arpa/inet.h>
2121 $t data = inet_addr ("1.2.3.4");
2124 curl_cv_in_addr_t_equiv="$t"
2129 case "$curl_cv_in_addr_t_equiv" in
2131 AC_MSG_ERROR([Cannot find a type to use in place of in_addr_t])
2134 AC_DEFINE_UNQUOTED(in_addr_t, $curl_cv_in_addr_t_equiv,
2135 [Type to use in place of in_addr_t when system does not provide it.])
2140 #ifdef HAVE_WINDOWS_H
2141 #ifndef WIN32_LEAN_AND_MEAN
2142 #define WIN32_LEAN_AND_MEAN
2144 #include <windows.h>
2145 #ifdef HAVE_WINSOCK2_H
2146 #include <winsock2.h>
2148 #ifdef HAVE_WINSOCK_H
2149 #include <winsock.h>
2153 #ifdef HAVE_SYS_TYPES_H
2154 #include <sys/types.h>
2156 #ifdef HAVE_SYS_SOCKET_H
2157 #include <sys/socket.h>
2159 #ifdef HAVE_NETINET_IN_H
2160 #include <netinet/in.h>
2162 #ifdef HAVE_ARPA_INET_H
2163 #include <arpa/inet.h>
2170 dnl CURL_CHECK_FUNC_CLOCK_GETTIME_MONOTONIC
2171 dnl -------------------------------------------------
2172 dnl Check if monotonic clock_gettime is available.
2174 AC_DEFUN([CURL_CHECK_FUNC_CLOCK_GETTIME_MONOTONIC], [
2175 AC_REQUIRE([AC_HEADER_TIME])dnl
2176 AC_CHECK_HEADERS(sys/types.h sys/time.h time.h)
2177 AC_MSG_CHECKING([for monotonic clock_gettime])
2180 #ifdef HAVE_SYS_TYPES_H
2181 #include <sys/types.h>
2183 #ifdef HAVE_SYS_TIME_H
2184 #include <sys/time.h>
2185 #ifdef TIME_WITH_SYS_TIME
2195 (void)clock_gettime(CLOCK_MONOTONIC, &ts);
2198 AC_MSG_RESULT([yes])
2199 ac_cv_func_clock_gettime="yes"
2202 ac_cv_func_clock_gettime="no"
2204 dnl Definition of HAVE_CLOCK_GETTIME_MONOTONIC is intentionally postponed
2205 dnl until library linking and run-time checks for clock_gettime succeed.
2209 dnl CURL_CHECK_LIBS_CLOCK_GETTIME_MONOTONIC
2210 dnl -------------------------------------------------
2211 dnl If monotonic clock_gettime is available then,
2212 dnl check and prepended to LIBS any needed libraries.
2214 AC_DEFUN([CURL_CHECK_LIBS_CLOCK_GETTIME_MONOTONIC], [
2215 AC_REQUIRE([CURL_CHECK_FUNC_CLOCK_GETTIME_MONOTONIC])dnl
2217 if test "$ac_cv_func_clock_gettime" = "yes"; then
2219 AC_MSG_CHECKING([for clock_gettime in libraries])
2221 curl_cv_save_LIBS="$LIBS"
2222 curl_cv_gclk_LIBS="unknown"
2224 for x_xlibs in '' '-lrt' '-lposix4' ; do
2225 if test "$curl_cv_gclk_LIBS" = "unknown"; then
2226 if test -z "$x_xlibs"; then
2227 LIBS="$curl_cv_save_LIBS"
2229 LIBS="$x_xlibs $curl_cv_save_LIBS"
2233 #ifdef HAVE_SYS_TYPES_H
2234 #include <sys/types.h>
2236 #ifdef HAVE_SYS_TIME_H
2237 #include <sys/time.h>
2238 #ifdef TIME_WITH_SYS_TIME
2248 (void)clock_gettime(CLOCK_MONOTONIC, &ts);
2251 curl_cv_gclk_LIBS="$x_xlibs"
2256 LIBS="$curl_cv_save_LIBS"
2258 case X-"$curl_cv_gclk_LIBS" in
2260 AC_MSG_RESULT([cannot find clock_gettime])
2261 AC_MSG_WARN([HAVE_CLOCK_GETTIME_MONOTONIC will not be defined])
2262 ac_cv_func_clock_gettime="no"
2265 AC_MSG_RESULT([no additional lib required])
2266 ac_cv_func_clock_gettime="yes"
2269 if test -z "$curl_cv_save_LIBS"; then
2270 LIBS="$curl_cv_gclk_LIBS"
2272 LIBS="$curl_cv_gclk_LIBS $curl_cv_save_LIBS"
2274 AC_MSG_RESULT([$curl_cv_gclk_LIBS])
2275 ac_cv_func_clock_gettime="yes"
2279 dnl only do runtime verification when not cross-compiling
2280 if test "x$cross_compiling" != "xyes" &&
2281 test "$ac_cv_func_clock_gettime" = "yes"; then
2282 AC_MSG_CHECKING([if monotonic clock_gettime works])
2285 #ifdef HAVE_SYS_TYPES_H
2286 #include <sys/types.h>
2288 #ifdef HAVE_SYS_TIME_H
2289 #include <sys/time.h>
2290 #ifdef TIME_WITH_SYS_TIME
2300 if (0 == clock_gettime(CLOCK_MONOTONIC, &ts))
2306 AC_MSG_RESULT([yes])
2309 AC_MSG_WARN([HAVE_CLOCK_GETTIME_MONOTONIC will not be defined])
2310 ac_cv_func_clock_gettime="no"
2311 LIBS="$curl_cv_save_LIBS"
2315 case "$ac_cv_func_clock_gettime" in
2317 AC_DEFINE_UNQUOTED(HAVE_CLOCK_GETTIME_MONOTONIC, 1,
2318 [Define to 1 if you have the clock_gettime function and monotonic timer.])
2327 dnl CURL_CHECK_FUNC_SELECT
2328 dnl -------------------------------------------------
2329 dnl Test if the socket select() function is available,
2330 dnl and check its return type and the types of its
2331 dnl arguments. If the function succeeds HAVE_SELECT
2332 dnl will be defined, defining the types of the
2333 dnl arguments in SELECT_TYPE_ARG1, SELECT_TYPE_ARG234
2334 dnl and SELECT_TYPE_ARG5, defining the type of the
2335 dnl function return value in SELECT_TYPE_RETV, and
2336 dnl also defining the type qualifier of fifth argument
2337 dnl in SELECT_QUAL_ARG5.
2339 AC_DEFUN([CURL_CHECK_FUNC_SELECT], [
2340 AC_REQUIRE([CURL_CHECK_STRUCT_TIMEVAL])dnl
2341 AC_CHECK_HEADERS(sys/select.h sys/socket.h)
2343 AC_MSG_CHECKING([for select])
2347 #ifdef HAVE_WINDOWS_H
2348 #ifndef WIN32_LEAN_AND_MEAN
2349 #define WIN32_LEAN_AND_MEAN
2351 #include <windows.h>
2352 #ifdef HAVE_WINSOCK2_H
2353 #include <winsock2.h>
2355 #ifdef HAVE_WINSOCK_H
2356 #include <winsock.h>
2360 #ifdef HAVE_SYS_TYPES_H
2361 #include <sys/types.h>
2363 #ifdef HAVE_SYS_TIME_H
2364 #include <sys/time.h>
2365 #ifdef TIME_WITH_SYS_TIME
2373 #ifndef HAVE_WINDOWS_H
2374 #ifdef HAVE_SYS_SELECT_H
2375 #include <sys/select.h>
2377 #ifdef HAVE_SYS_SOCKET_H
2378 #include <sys/socket.h>
2382 select(0, 0, 0, 0, 0);
2385 AC_MSG_RESULT([yes])
2386 curl_cv_select="yes"
2392 if test "$curl_cv_select" = "yes"; then
2393 AC_CACHE_CHECK([types of args and return type for select],
2394 [curl_cv_func_select_args], [
2395 curl_cv_func_select_args="unknown"
2396 for sel_retv in 'int' 'ssize_t'; do
2397 for sel_arg1 in 'int' 'ssize_t' 'size_t' 'unsigned long int' 'unsigned int'; do
2398 for sel_arg234 in 'fd_set *' 'int *' 'void *'; do
2399 for sel_arg5 in 'struct timeval *' 'const struct timeval *'; do
2400 if test "$curl_cv_func_select_args" = "unknown"; then
2404 #ifdef HAVE_WINDOWS_H
2405 #ifndef WIN32_LEAN_AND_MEAN
2406 #define WIN32_LEAN_AND_MEAN
2408 #include <windows.h>
2409 #ifdef HAVE_WINSOCK2_H
2410 #include <winsock2.h>
2412 #ifdef HAVE_WINSOCK_H
2413 #include <winsock.h>
2416 #define SELECTCALLCONV PASCAL
2418 #ifdef HAVE_SYS_TYPES_H
2419 #include <sys/types.h>
2421 #ifdef HAVE_SYS_TIME_H
2422 #include <sys/time.h>
2423 #ifdef TIME_WITH_SYS_TIME
2431 #ifndef HAVE_WINDOWS_H
2432 #ifdef HAVE_SYS_SELECT_H
2433 #include <sys/select.h>
2435 #ifdef HAVE_SYS_SOCKET_H
2436 #include <sys/socket.h>
2438 #define SELECTCALLCONV
2440 #ifndef HAVE_STRUCT_TIMEVAL
2446 extern $sel_retv SELECTCALLCONV select($sel_arg1,
2456 $sel_retv res = select(nfds, rfds, wfds, efds, 0);
2459 curl_cv_func_select_args="$sel_arg1,$sel_arg234,$sel_arg5,$sel_retv"
2467 if test "$curl_cv_func_select_args" = "unknown"; then
2468 AC_MSG_WARN([Cannot find proper types to use for select args])
2469 AC_MSG_WARN([HAVE_SELECT will not be defined])
2471 select_prev_IFS=$IFS; IFS=','
2472 set dummy `echo "$curl_cv_func_select_args" | sed 's/\*/\*/g'`
2473 IFS=$select_prev_IFS
2476 sel_qual_type_arg5=$[3]
2478 AC_DEFINE_UNQUOTED(SELECT_TYPE_ARG1, $[1],
2479 [Define to the type of arg 1 for select.])
2480 AC_DEFINE_UNQUOTED(SELECT_TYPE_ARG234, $[2],
2481 [Define to the type of args 2, 3 and 4 for select.])
2482 AC_DEFINE_UNQUOTED(SELECT_TYPE_RETV, $[4],
2483 [Define to the function return type for select.])
2487 case $prev_sh_opts in
2495 case "$sel_qual_type_arg5" in
2498 sel_type_arg5=`echo $sel_qual_type_arg5 | sed 's/^const //'`
2502 sel_type_arg5=$sel_qual_type_arg5
2506 AC_DEFINE_UNQUOTED(SELECT_QUAL_ARG5, $sel_qual_arg5,
2507 [Define to the type qualifier of arg 5 for select.])
2508 AC_DEFINE_UNQUOTED(SELECT_TYPE_ARG5, $sel_type_arg5,
2509 [Define to the type of arg 5 for select.])
2511 case $prev_sh_opts in
2519 AC_DEFINE_UNQUOTED(HAVE_SELECT, 1,
2520 [Define to 1 if you have the select function.])
2521 ac_cv_func_select="yes"
2527 dnl ************************************************************
2528 dnl check for working getaddrinfo() that works with AI_NUMERICHOST
2530 AC_DEFUN([CURL_CHECK_WORKING_GETADDRINFO],[
2531 AC_CACHE_CHECK(for working getaddrinfo, ac_cv_working_getaddrinfo,[
2534 #include <sys/types.h>
2535 #include <sys/socket.h>
2539 struct addrinfo hints, *ai;
2542 memset(&hints, 0, sizeof(hints));
2543 hints.ai_flags = AI_NUMERICHOST;
2544 hints.ai_family = AF_UNSPEC;
2545 hints.ai_socktype = SOCK_STREAM;
2546 error = getaddrinfo("127.0.0.1", "8080", &hints, &ai);
2553 ac_cv_working_getaddrinfo="yes"
2555 ac_cv_working_getaddrinfo="no"
2557 ac_cv_working_getaddrinfo="yes"
2559 if test "$ac_cv_working_getaddrinfo" = "yes"; then
2560 AC_DEFINE(HAVE_GETADDRINFO, 1, [Define if getaddrinfo exists and works])
2561 AC_DEFINE(ENABLE_IPV6, 1, [Define if you want to enable IPv6 support])
2564 AC_SUBST(IPV6_ENABLED)
2569 AC_DEFUN([CURL_CHECK_LOCALTIME_R],
2571 dnl check for localtime_r
2572 AC_CHECK_FUNCS(localtime_r,[
2573 AC_MSG_CHECKING(whether localtime_r is declared)
2574 AC_EGREP_CPP(localtime_r,[
2576 #include <time.h>],[
2577 AC_MSG_RESULT(yes)],[
2579 AC_MSG_CHECKING(whether localtime_r with -D_REENTRANT is declared)
2580 AC_EGREP_CPP(localtime_r,[
2583 #include <time.h>],[
2584 AC_MSG_RESULT(yes)],
2585 AC_MSG_RESULT(no))])])
2589 dnl This function checks for strerror_r(). If it isn't found at first, it
2590 dnl retries with _THREAD_SAFE defined, as that is what AIX seems to require
2591 dnl in order to find this function.
2593 dnl If the function is found, it will then proceed to check how the function
2594 dnl actually works: glibc-style or POSIX-style.
2597 dnl char *strerror_r(int errnum, char *buf, size_t n);
2599 dnl What this one does is to return the error string (no surprises there),
2600 dnl but it doesn't usually copy anything into buf! The 'buf' and 'n'
2601 dnl parameters are only meant as an optional working area, in case strerror_r
2602 dnl needs it. A quick test on a few systems shows that it's generally not
2606 dnl int strerror_r(int errnum, char *buf, size_t n);
2608 AC_DEFUN([CURL_CHECK_STRERROR_R],
2610 AC_CHECK_FUNCS(strerror_r)
2612 if test "x$ac_cv_func_strerror_r" = "xyes"; then
2614 AC_MSG_CHECKING(whether strerror_r is declared)
2615 AC_EGREP_CPP(strerror_r,[
2617 #include <string.h>],[
2618 AC_MSG_RESULT(yes)],[
2620 AC_MSG_CHECKING(whether strerror_r with -D_REENTRANT is declared)
2621 AC_EGREP_CPP(strerror_r,[
2624 #include <string.h>],[
2625 AC_MSG_RESULT(yes)],
2627 AC_DEFINE(HAVE_NO_STRERROR_R_DECL, 1, [we have no strerror_r() proto])
2628 ) dnl with _THREAD_SAFE
2629 ]) dnl plain cpp for it
2631 dnl determine if this strerror_r() is glibc or POSIX
2632 AC_MSG_CHECKING([for a glibc strerror_r API])
2638 char buffer[1024]; /* big enough to play with */
2640 strerror_r(EACCES, buffer, sizeof(buffer));
2641 /* this should've returned a string */
2642 if(!string || !string[0])
2647 GLIBC_STRERROR_R="1"
2648 AC_DEFINE(HAVE_GLIBC_STRERROR_R, 1, [we have a glibc-style strerror_r()])
2649 AC_MSG_RESULT([yes]),
2650 AC_MSG_RESULT([no]),
2652 dnl Use an inferior method of strerror_r detection while cross-compiling
2654 #include <features.h>
2659 dnl looks like glibc, so assume a glibc-style strerror_r()
2660 GLIBC_STRERROR_R="1"
2661 AC_DEFINE(HAVE_GLIBC_STRERROR_R, 1, [we have a glibc-style strerror_r()])
2662 AC_MSG_RESULT([yes]),
2663 AC_MSG_NOTICE([cannot determine strerror_r() style: edit lib/config.h manually!])
2664 ) dnl while cross-compiling
2667 if test -z "$GLIBC_STRERROR_R"; then
2669 AC_MSG_CHECKING([for a POSIX strerror_r API])
2675 char buffer[1024]; /* big enough to play with */
2677 strerror_r(EACCES, buffer, sizeof(buffer));
2678 /* This should've returned zero, and written an error string in the
2680 if(!buffer[0] || error)
2685 AC_DEFINE(HAVE_POSIX_STRERROR_R, 1, [we have a POSIX-style strerror_r()])
2686 AC_MSG_RESULT([yes]),
2687 AC_MSG_RESULT([no]) ,
2688 dnl cross-compiling!
2689 AC_MSG_NOTICE([cannot determine strerror_r() style: edit lib/config.h manually!])
2692 fi dnl if not using glibc API
2694 fi dnl we have a strerror_r
2698 AC_DEFUN([CURL_CHECK_INET_NTOA_R],
2700 dnl determine if function definition for inet_ntoa_r exists.
2701 AC_CHECK_FUNCS(inet_ntoa_r,[
2702 AC_MSG_CHECKING(whether inet_ntoa_r is declared)
2703 AC_EGREP_CPP(inet_ntoa_r,[
2705 #include <arpa/inet.h>],[
2706 AC_DEFINE(HAVE_INET_NTOA_R_DECL, 1, [inet_ntoa_r() is declared])
2707 AC_MSG_RESULT(yes)],[
2709 AC_MSG_CHECKING(whether inet_ntoa_r with -D_REENTRANT is declared)
2710 AC_EGREP_CPP(inet_ntoa_r,[
2713 #include <arpa/inet.h>],[
2714 AC_DEFINE(HAVE_INET_NTOA_R_DECL, 1, [inet_ntoa_r() is declared])
2715 AC_MSG_RESULT(yes)],
2716 AC_MSG_RESULT(no))])])
2720 dnl CURL_CHECK_GETHOSTBYADDR_R
2721 dnl -------------------------------------------------
2722 dnl check number of arguments for gethostbyaddr_r, it
2723 dnl might take either 5, 7, or 8 arguments.
2725 AC_DEFUN([CURL_CHECK_GETHOSTBYADDR_R], [
2727 AC_MSG_CHECKING([for gethostbyaddr_r])
2729 AC_LANG_FUNC_LINK_TRY([gethostbyaddr_r])
2731 AC_MSG_RESULT([yes])
2732 tmp_cv_gethostbyaddr_r="yes"
2735 tmp_cv_gethostbyaddr_r="no"
2738 if test "$tmp_cv_gethostbyaddr_r" != "yes"; then
2739 AC_MSG_CHECKING([deeper for gethostbyaddr_r])
2746 AC_MSG_RESULT([yes])
2747 tmp_cv_gethostbyaddr_r="yes"
2749 AC_MSG_RESULT([but still no])
2750 tmp_cv_gethostbyaddr_r="no"
2754 if test "$tmp_cv_gethostbyaddr_r" = "yes"; then
2756 ac_cv_gethostbyaddr_r_args="unknown"
2758 AC_MSG_CHECKING([if gethostbyaddr_r takes 5 arguments])
2762 #include <sys/types.h>
2769 struct hostent_data hdata;
2771 rc = gethostbyaddr_r(address, length, type, &h, &hdata);
2774 AC_MSG_RESULT([yes])
2775 AC_DEFINE(HAVE_GETHOSTBYADDR_R_5, 1, [gethostbyaddr_r() takes 5 args])
2776 ac_cv_gethostbyaddr_r_args="5"
2781 if test "$ac_cv_gethostbyaddr_r_args" = "unknown"; then
2782 AC_MSG_CHECKING([if gethostbyaddr_r with -D_REENTRANT takes 5 arguments])
2787 #include <sys/types.h>
2794 struct hostent_data hdata;
2796 rc = gethostbyaddr_r(address, length, type, &h, &hdata);
2799 AC_MSG_RESULT([yes])
2800 AC_DEFINE(HAVE_GETHOSTBYADDR_R_5, 1, [gethostbyaddr_r() takes 5 args])
2801 ac_cv_gethostbyaddr_r_args="5"
2807 if test "$ac_cv_gethostbyaddr_r_args" = "unknown"; then
2808 AC_MSG_CHECKING([if gethostbyaddr_r takes 7 arguments])
2812 #include <sys/types.h>
2821 struct hostent * hp;
2822 hp = gethostbyaddr_r(address, length, type, &h,
2823 buffer, 8192, &h_errnop);
2826 AC_MSG_RESULT([yes])
2827 AC_DEFINE(HAVE_GETHOSTBYADDR_R_7, 1, [gethostbyaddr_r() takes 7 args])
2828 ac_cv_gethostbyaddr_r_args="7"
2834 if test "$ac_cv_gethostbyaddr_r_args" = "unknown"; then
2835 AC_MSG_CHECKING([if gethostbyaddr_r with -D_REENTRANT takes 7 arguments])
2840 #include <sys/types.h>
2849 struct hostent * hp;
2850 hp = gethostbyaddr_r(address, length, type, &h,
2851 buffer, 8192, &h_errnop);
2854 AC_MSG_RESULT([yes])
2855 AC_DEFINE(HAVE_GETHOSTBYADDR_R_7, 1, [gethostbyaddr_r() takes 7 args])
2856 ac_cv_gethostbyaddr_r_args="7"
2862 if test "$ac_cv_gethostbyaddr_r_args" = "unknown"; then
2863 AC_MSG_CHECKING([if gethostbyaddr_r takes 8 arguments])
2867 #include <sys/types.h>
2876 struct hostent * hp;
2878 rc = gethostbyaddr_r(address, length, type, &h,
2879 buffer, 8192, &hp, &h_errnop);
2882 AC_MSG_RESULT([yes])
2883 AC_DEFINE(HAVE_GETHOSTBYADDR_R_8, 1, [gethostbyaddr_r() takes 8 args])
2884 ac_cv_gethostbyaddr_r_args="8"
2890 if test "$ac_cv_gethostbyaddr_r_args" = "unknown"; then
2891 AC_MSG_CHECKING([if gethostbyaddr_r with -D_REENTRANT takes 8 arguments])
2896 #include <sys/types.h>
2905 struct hostent * hp;
2907 rc = gethostbyaddr_r(address, length, type, &h,
2908 buffer, 8192, &hp, &h_errnop);
2911 AC_MSG_RESULT([yes])
2912 AC_DEFINE(HAVE_GETHOSTBYADDR_R_8, 1, [gethostbyaddr_r() takes 8 args])
2913 ac_cv_gethostbyaddr_r_args="8"
2919 if test "$ac_cv_gethostbyaddr_r_args" = "unknown"; then
2920 AC_MSG_WARN([Cannot find out how to use gethostbyaddr_r])
2921 AC_MSG_WARN([HAVE_GETHOSTBYADDR_R will not be defined])
2922 ac_cv_func_gethostbyaddr_r="no"
2924 AC_DEFINE_UNQUOTED(HAVE_GETHOSTBYADDR_R, 1,
2925 [Define to 1 if you have the gethostbyaddr_r function.])
2926 ac_cv_func_gethostbyaddr_r="yes"
2930 ac_cv_func_gethostbyaddr_r="no"
2935 dnl CURL_CHECK_GETHOSTBYNAME_R
2936 dnl -------------------------------------------------
2937 dnl check number of arguments for gethostbyname_r, it
2938 dnl might take either 3, 5, or 6 arguments.
2940 AC_DEFUN([CURL_CHECK_GETHOSTBYNAME_R], [
2942 AC_MSG_CHECKING([for gethostbyname_r])
2944 AC_LANG_FUNC_LINK_TRY([gethostbyname_r])
2946 AC_MSG_RESULT([yes])
2947 tmp_cv_gethostbyname_r="yes"
2950 tmp_cv_gethostbyname_r="no"
2953 if test "$tmp_cv_gethostbyname_r" != "yes"; then
2954 AC_MSG_CHECKING([deeper for gethostbyname_r])
2961 AC_MSG_RESULT([yes])
2962 tmp_cv_gethostbyname_r="yes"
2964 AC_MSG_RESULT([but still no])
2965 tmp_cv_gethostbyname_r="no"
2969 if test "$tmp_cv_gethostbyname_r" = "yes"; then
2971 ac_cv_gethostbyname_r_args="unknown"
2973 AC_MSG_CHECKING([if gethostbyname_r takes 3 arguments])
2978 #include <sys/types.h>
2981 #define NULL (void *)0
2983 gethostbyname_r(const char *, struct hostent *,
2984 struct hostent_data *);
2986 struct hostent_data data;
2987 gethostbyname_r(NULL, NULL, NULL);
2990 AC_MSG_RESULT([yes])
2991 AC_DEFINE(HAVE_GETHOSTBYNAME_R_3, 1, [gethostbyname_r() takes 3 args])
2992 ac_cv_gethostbyname_r_args="3"
2997 if test "$ac_cv_gethostbyname_r_args" = "unknown"; then
2998 AC_MSG_CHECKING([if gethostbyname_r with -D_REENTRANT takes 3 arguments])
3004 #include <sys/types.h>
3007 #define NULL (void *)0
3009 gethostbyname_r(const char *, struct hostent *,
3010 struct hostent_data *);
3012 struct hostent_data data;
3013 gethostbyname_r(NULL, NULL, NULL);
3016 AC_MSG_RESULT([yes])
3017 AC_DEFINE(HAVE_GETHOSTBYNAME_R_3, 1, [gethostbyname_r() takes 3 args])
3018 ac_cv_gethostbyname_r_args="3"
3024 if test "$ac_cv_gethostbyname_r_args" = "unknown"; then
3025 AC_MSG_CHECKING([if gethostbyname_r takes 5 arguments])
3029 #include <sys/types.h>
3032 #define NULL (void *)0
3034 gethostbyname_r(const char *, struct hostent *,
3035 char *, int, int *);
3037 gethostbyname_r(NULL, NULL, NULL, 0, NULL);
3040 AC_MSG_RESULT([yes])
3041 AC_DEFINE(HAVE_GETHOSTBYNAME_R_5, 1, [gethostbyname_r() takes 5 args])
3042 ac_cv_gethostbyname_r_args="5"
3048 if test "$ac_cv_gethostbyname_r_args" = "unknown"; then
3049 AC_MSG_CHECKING([if gethostbyname_r with -D_REENTRANT takes 5 arguments])
3054 #include <sys/types.h>
3057 #define NULL (void *)0
3059 gethostbyname_r(const char *, struct hostent *,
3060 char *, int, int *);
3062 gethostbyname_r(NULL, NULL, NULL, 0, NULL);
3065 AC_MSG_RESULT([yes])
3066 AC_DEFINE(HAVE_GETHOSTBYNAME_R_5, 1, [gethostbyname_r() takes 5 args])
3067 ac_cv_gethostbyname_r_args="5"
3073 if test "$ac_cv_gethostbyname_r_args" = "unknown"; then
3074 AC_MSG_CHECKING([if gethostbyname_r takes 6 arguments])
3078 #include <sys/types.h>
3081 #define NULL (void *)0
3083 gethostbyname_r(const char *, struct hostent *,
3084 char *, size_t, struct hostent **, int *);
3086 gethostbyname_r(NULL, NULL, NULL, 0, NULL, NULL);
3089 AC_MSG_RESULT([yes])
3090 AC_DEFINE(HAVE_GETHOSTBYNAME_R_6, 1, [gethostbyname_r() takes 6 args])
3091 ac_cv_gethostbyname_r_args="6"
3097 if test "$ac_cv_gethostbyname_r_args" = "unknown"; then
3098 AC_MSG_CHECKING([if gethostbyname_r with -D_REENTRANT takes 6 arguments])
3103 #include <sys/types.h>
3106 #define NULL (void *)0
3108 gethostbyname_r(const char *, struct hostent *,
3109 char *, size_t, struct hostent **, int *);
3111 gethostbyname_r(NULL, NULL, NULL, 0, NULL, NULL);
3114 AC_MSG_RESULT([yes])
3115 AC_DEFINE(HAVE_GETHOSTBYNAME_R_6, 1, [gethostbyname_r() takes 6 args])
3116 ac_cv_gethostbyname_r_args="6"
3122 if test "$ac_cv_gethostbyname_r_args" = "unknown"; then
3123 AC_MSG_WARN([Cannot find out how to use gethostbyname_r])
3124 AC_MSG_WARN([HAVE_GETHOSTBYNAME_R will not be defined])
3125 ac_cv_func_gethostbyname_r="no"
3127 AC_DEFINE_UNQUOTED(HAVE_GETHOSTBYNAME_R, 1,
3128 [Define to 1 if you have the gethostbyname_r function.])
3129 ac_cv_func_gethostbyname_r="yes"
3133 ac_cv_func_gethostbyname_r="no"
3138 dnl **********************************************************************
3139 dnl CURL_DETECT_ICC ([ACTION-IF-YES])
3141 dnl check if this is the Intel ICC compiler, and if so run the ACTION-IF-YES
3142 dnl sets the $ICC variable to "yes" or "no"
3143 dnl **********************************************************************
3144 AC_DEFUN([CURL_DETECT_ICC],
3147 AC_MSG_CHECKING([for icc in use])
3148 if test "$GCC" = "yes"; then
3149 dnl check if this is icc acting as gcc in disguise
3150 AC_EGREP_CPP([^__INTEL_COMPILER], [__INTEL_COMPILER],
3151 dnl action if the text is found, this it has not been replaced by the
3154 dnl the text was not found, it was replaced by the cpp
3156 AC_MSG_RESULT([yes])
3160 if test "$ICC" = "no"; then
3166 dnl We create a function for detecting which compiler we use and then set as
3167 dnl pendantic compiler options as possible for that particular compiler. The
3168 dnl options are only used for debug-builds.
3170 AC_DEFUN([CURL_CC_DEBUG_OPTS],
3172 if test "z$ICC" = "z"; then
3176 if test "$GCC" = "yes"; then
3178 dnl figure out gcc version!
3179 AC_MSG_CHECKING([gcc version])
3180 gccver=`$CC -dumpversion`
3181 num1=`echo $gccver | cut -d . -f1`
3182 num2=`echo $gccver | cut -d . -f2`
3183 gccnum=`(expr $num1 "*" 100 + $num2) 2>/dev/null`
3184 AC_MSG_RESULT($gccver)
3186 if test "$ICC" = "yes"; then
3187 dnl this is icc, not gcc.
3189 dnl ICC warnings we ignore:
3190 dnl * 269 warns on our "%Od" printf formatters for curl_off_t output:
3191 dnl "invalid format string conversion"
3192 dnl * 279 warns on static conditions in while expressions
3193 dnl * 981 warns on "operands are evaluated in unspecified order"
3194 dnl * 1418 "external definition with no prior declaration"
3195 dnl * 1419 warns on "external declaration in primary source file"
3196 dnl which we know and do on purpose.
3198 WARN="-wd279,269,981,1418,1419"
3200 if test "$gccnum" -gt "600"; then
3201 dnl icc 6.0 and older doesn't have the -Wall flag
3205 dnl this is a set of options we believe *ALL* gcc versions support:
3206 WARN="-W -Wall -Wwrite-strings -pedantic -Wpointer-arith -Wnested-externs -Winline -Wmissing-prototypes"
3208 dnl -Wcast-align is a bit too annoying on all gcc versions ;-)
3210 if test "$gccnum" -ge "207"; then
3211 dnl gcc 2.7 or later
3212 WARN="$WARN -Wmissing-declarations"
3215 if test "$gccnum" -gt "295"; then
3216 dnl only if the compiler is newer than 2.95 since we got lots of
3217 dnl "`_POSIX_C_SOURCE' is not defined" in system headers with
3218 dnl gcc 2.95.4 on FreeBSD 4.9!
3219 WARN="$WARN -Wundef -Wno-long-long -Wsign-compare -Wshadow -Wno-multichar"
3222 if test "$gccnum" -ge "296"; then
3223 dnl gcc 2.96 or later
3224 WARN="$WARN -Wfloat-equal"
3227 if test "$gccnum" -gt "296"; then
3228 dnl this option does not exist in 2.96
3229 WARN="$WARN -Wno-format-nonliteral"
3232 dnl -Wunreachable-code seems totally unreliable on my gcc 3.3.2 on
3233 dnl on i686-Linux as it gives us heaps with false positives.
3234 dnl Also, on gcc 4.0.X it is totally unbearable and complains all
3235 dnl over making it unusable for generic purposes. Let's not use it.
3237 if test "$gccnum" -ge "303"; then
3238 dnl gcc 3.3 and later
3239 WARN="$WARN -Wendif-labels -Wstrict-prototypes"
3242 if test "$gccnum" -ge "304"; then
3243 # try these on gcc 3.4
3244 WARN="$WARN -Wdeclaration-after-statement"
3247 for flag in $CPPFLAGS; do
3250 dnl Include path, provide a -isystem option for the same dir
3251 dnl to prevent warnings in those dirs. The -isystem was not very
3252 dnl reliable on earlier gcc versions.
3253 add=`echo $flag | sed 's/^-I/-isystem /g'`
3261 CFLAGS="$CFLAGS $WARN"
3263 AC_MSG_NOTICE([Added this set of compiler options: $WARN])
3267 AC_MSG_NOTICE([Added no extra compiler options])
3271 dnl strip off optimizer flags
3273 for flag in $CFLAGS; do
3276 dnl echo "cut off $flag"
3279 NEWFLAGS="$NEWFLAGS $flag"
3289 # This is only a temporary fix. This macro is here to replace the broken one
3290 # delivered by the automake project (including the 1.9.6 release). As soon as
3291 # they ship a working version we SHOULD remove this work-around.
3293 AC_DEFUN([AM_MISSING_HAS_RUN],
3294 [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
3295 test x"${MISSING+set}" = xset || MISSING="\${SHELL} \"$am_aux_dir/missing\""
3296 # Use eval to expand $SHELL
3297 if eval "$MISSING --run true"; then
3298 am_missing_run="$MISSING --run "
3301 AC_MSG_WARN([`missing' script is too old or missing])
3306 dnl CURL_VERIFY_RUNTIMELIBS
3307 dnl -------------------------------------------------
3308 dnl Verify that the shared libs found so far can be used when running
3309 dnl programs, since otherwise the situation will create odd configure errors
3310 dnl that are misleading people.
3312 dnl Make sure this test is run BEFORE the first test in the script that
3313 dnl runs anything, which at the time of this writing is the AC_CHECK_SIZEOF
3314 dnl macro. It must also run AFTER all lib-checking macros are complete.
3316 AC_DEFUN([CURL_VERIFY_RUNTIMELIBS], [
3318 dnl this test is of course not sensible if we are cross-compiling!
3319 if test "x$cross_compiling" != xyes; then
3321 dnl just run a program to verify that the libs checked for previous to this
3322 dnl point also is available run-time!
3323 AC_MSG_CHECKING([run-time libs availability])
3330 AC_MSG_RESULT([fine]),
3331 AC_MSG_RESULT([failed])
3332 AC_MSG_ERROR([one or more libs available at link-time are not available run-time. Libs used at link-time: $LIBS])
3335 dnl if this test fails, configure has already stopped
3340 dnl CURL_CHECK_VARIADIC_MACROS
3341 dnl -------------------------------------------------
3342 dnl Check compiler support of variadic macros
3344 AC_DEFUN([CURL_CHECK_VARIADIC_MACROS], [
3345 AC_CACHE_CHECK([for compiler support of C99 variadic macro style],
3346 [curl_cv_variadic_macros_c99], [
3349 #define c99_vmacro3(first, ...) fun3(first, __VA_ARGS__)
3350 #define c99_vmacro2(first, ...) fun2(first, __VA_ARGS__)
3351 int fun3(int arg1, int arg2, int arg3);
3352 int fun2(int arg1, int arg2);
3353 int fun3(int arg1, int arg2, int arg3)
3354 { return arg1 + arg2 + arg3; }
3355 int fun2(int arg1, int arg2)
3356 { return arg1 + arg2; }
3358 int res3 = c99_vmacro3(1, 2, 3);
3359 int res2 = c99_vmacro2(1, 2);
3362 curl_cv_variadic_macros_c99="yes"
3364 curl_cv_variadic_macros_c99="no"
3367 case "$curl_cv_variadic_macros_c99" in
3369 AC_DEFINE_UNQUOTED(HAVE_VARIADIC_MACROS_C99, 1,
3370 [Define to 1 if compiler supports C99 variadic macro style.])
3373 AC_CACHE_CHECK([for compiler support of old gcc variadic macro style],
3374 [curl_cv_variadic_macros_gcc], [
3377 #define gcc_vmacro3(first, args...) fun3(first, args)
3378 #define gcc_vmacro2(first, args...) fun2(first, args)
3379 int fun3(int arg1, int arg2, int arg3);
3380 int fun2(int arg1, int arg2);
3381 int fun3(int arg1, int arg2, int arg3)
3382 { return arg1 + arg2 + arg3; }
3383 int fun2(int arg1, int arg2)
3384 { return arg1 + arg2; }
3386 int res3 = gcc_vmacro3(1, 2, 3);
3387 int res2 = gcc_vmacro2(1, 2);
3390 curl_cv_variadic_macros_gcc="yes"
3392 curl_cv_variadic_macros_gcc="no"
3395 case "$curl_cv_variadic_macros_gcc" in
3397 AC_DEFINE_UNQUOTED(HAVE_VARIADIC_MACROS_GCC, 1,
3398 [Define to 1 if compiler supports old gcc variadic macro style.])
3404 dnl CURL_CHECK_CA_BUNDLE
3405 dnl -------------------------------------------------
3406 dnl Check if a default ca-bundle should be used
3408 dnl regarding the paths this will scan:
3409 dnl /etc/ssl/certs/ca-certificates.crt Debian systems
3410 dnl /etc/pki/tls/certs/ca-bundle.crt Redhat and Mandriva
3411 dnl /usr/share/ssl/certs/ca-bundle.crt old(er) Redhat
3412 dnl /etc/ssl/certs/ (ca path) SUSE
3414 AC_DEFUN([CURL_CHECK_CA_BUNDLE], [
3416 AC_MSG_CHECKING([default CA cert bundle/path])
3418 AC_ARG_WITH(ca-bundle,
3419 AC_HELP_STRING([--with-ca-bundle=FILE], [File name to use as CA bundle])
3420 AC_HELP_STRING([--without-ca-bundle], [Don't use a default CA bundle]),
3423 if test "x$want_ca" = "xyes"; then
3424 AC_MSG_ERROR([--with-ca-bundle=FILE requires a path to the CA bundle])
3427 [ want_ca="unset" ])
3428 AC_ARG_WITH(ca-path,
3429 AC_HELP_STRING([--with-ca-path=DIRECTORY], [Directory to use as CA path])
3430 AC_HELP_STRING([--without-ca-path], [Don't use a default CA path]),
3432 want_capath="$withval"
3433 if test "x$want_capath" = "xyes"; then
3434 AC_MSG_ERROR([--with-ca-path=DIRECTORY requires a path to the CA path directory])
3437 [ want_capath="unset"])
3439 if test "x$want_ca" != "xno" -a "x$want_ca" != "xunset" -a \
3440 "x$want_capath" != "xno" -a "x$want_capath" != "xunset"; then
3442 AC_MSG_ERROR([Can't specify both --with-ca-bundle and --with-ca-path.])
3443 elif test "x$want_ca" != "xno" -a "x$want_ca" != "xunset"; then
3444 dnl --with-ca-bundle given
3447 elif test "x$want_capath" != "xno" -a "x$want_capath" != "xunset"; then
3448 dnl --with-ca-path given
3449 if test "x$OPENSSL_ENABLED" != "x1"; then
3450 AC_MSG_ERROR([--with-ca-path only works with openSSL])
3452 capath="$want_capath"
3455 dnl neither of --with-ca-* given
3456 dnl first try autodetecting a CA bundle , then a CA path
3457 dnl both autodetections can be skipped by --without-ca-*
3460 if test "x$want_ca" = "xunset"; then
3461 dnl the path we previously would have installed the curl ca bundle
3462 dnl to, and thus we now check for an already existing cert in that place
3463 dnl in case we find no other
3464 if test "x$prefix" != xNONE; then
3465 cac="${prefix}/share/curl/curl-ca-bundle.crt"
3467 cac="$ac_default_prefix/share/curl/curl-ca-bundle.crt"
3470 for a in /etc/ssl/certs/ca-certificates.crt \
3471 /etc/pki/tls/certs/ca-bundle.crt \
3472 /usr/share/ssl/certs/ca-bundle.crt \
3474 if test -f "$a"; then
3480 if test "x$want_capath" = "xunset" -a "x$ca" = "xno" -a \
3481 "x$OPENSSL_ENABLED" = "x1"; then
3482 for a in /etc/ssl/certs/; do
3483 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
3493 if test "x$ca" != "xno"; then
3494 CURL_CA_BUNDLE='"'$ca'"'
3495 AC_DEFINE_UNQUOTED(CURL_CA_BUNDLE, "$ca", [Location of default ca bundle])
3496 AC_SUBST(CURL_CA_BUNDLE)
3497 AC_MSG_RESULT([$ca])
3498 elif test "x$capath" != "xno"; then
3499 CURL_CA_PATH="\"$capath\""
3500 AC_DEFINE_UNQUOTED(CURL_CA_PATH, "$capath", [Location of default ca path])
3501 AC_MSG_RESULT([$capath (capath)])