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 ifelse($3,,[AC_MSG_CHECKING([for preprocessor definition of $1])])
92 tmp_exp=`eval "$ac_cpp conftest.$ac_ext" 2>/dev/null | \
93 "$GREP" CURL_DEF_TOKEN 2>/dev/null | \
94 "$SED" 's/.*CURL_DEF_TOKEN[[ ]]//' 2>/dev/null | \
95 "$SED" 'q' 2>/dev/null`
96 if test "$tmp_exp" = "$1"; then
100 if test -z "$tmp_exp"; then
101 AS_VAR_SET([ac_HaveDef], [no])
102 ifelse($3,,[AC_MSG_RESULT([no])])
104 AS_VAR_SET([ac_HaveDef], [yes])
105 AS_VAR_SET([ac_Def], [$tmp_exp])
106 ifelse($3,,[AC_MSG_RESULT([$tmp_exp])])
108 AS_VAR_POPDEF([ac_Def])dnl
109 AS_VAR_POPDEF([ac_HaveDef])dnl
113 dnl CONFIGURE_WITH_REENTRANT
114 dnl -------------------------------------------------
115 dnl This macro ensures that configuration tests done
116 dnl after this will execute with preprocessor symbol
117 dnl _REENTRANT defined. This macro also ensures that
118 dnl the generated config file will equally define it.
120 AC_DEFUN([CONFIGURE_WITH_REENTRANT], [
121 AC_BEFORE([$0], [AC_PREPROC_IFELSE])dnl
122 AC_BEFORE([$0], [AC_COMPILE_IFELSE])dnl
123 AC_BEFORE([$0], [AC_LINK_IFELSE])dnl
124 AC_BEFORE([$0], [AC_RUN_IFELSE])dnl
125 AH_VERBATIM([_REENTRANT],
126 [/* Define _REENTRANT if not already defined */
127 @%:@ifndef _REENTRANT
128 @%:@ define _REENTRANT
130 cat >>confdefs.h <<_ACEOF
131 [@%:@ifndef _REENTRANT
132 @%:@ define _REENTRANT
138 dnl CURL_CHECK_HEADER_WINDOWS
139 dnl -------------------------------------------------
140 dnl Check for compilable and valid windows.h header
142 AC_DEFUN([CURL_CHECK_HEADER_WINDOWS], [
143 AC_CACHE_CHECK([for windows.h], [ac_cv_header_windows_h], [
147 #ifndef WIN32_LEAN_AND_MEAN
148 #define WIN32_LEAN_AND_MEAN
152 #if defined(__CYGWIN__) || defined(__CEGCC__)
153 HAVE_WINDOWS_H shall not be defined.
159 ac_cv_header_windows_h="yes"
161 ac_cv_header_windows_h="no"
164 case "$ac_cv_header_windows_h" in
166 AC_DEFINE_UNQUOTED(HAVE_WINDOWS_H, 1,
167 [Define to 1 if you have the windows.h header file.])
168 AC_DEFINE_UNQUOTED(WIN32_LEAN_AND_MEAN, 1,
169 [Define to avoid automatic inclusion of winsock.h])
175 dnl CURL_CHECK_NATIVE_WINDOWS
176 dnl -------------------------------------------------
177 dnl Check if building a native Windows target
179 AC_DEFUN([CURL_CHECK_NATIVE_WINDOWS], [
180 AC_REQUIRE([CURL_CHECK_HEADER_WINDOWS])dnl
181 AC_CACHE_CHECK([whether build target is a native Windows one], [ac_cv_native_windows], [
182 if test "$ac_cv_header_windows_h" = "no"; then
183 ac_cv_native_windows="no"
188 #if defined(__MINGW32__) || defined(__MINGW32CE__) || \
189 (defined(_MSC_VER) && (defined(_WIN32) || defined(_WIN64)))
192 Not a native Windows build target.
196 ac_cv_native_windows="yes"
198 ac_cv_native_windows="no"
202 case "$ac_cv_native_windows" in
204 AC_DEFINE_UNQUOTED(NATIVE_WINDOWS, 1,
205 [Define to 1 if you are building a native Windows target.])
211 dnl CURL_CHECK_HEADER_WINSOCK
212 dnl -------------------------------------------------
213 dnl Check for compilable and valid winsock.h header
215 AC_DEFUN([CURL_CHECK_HEADER_WINSOCK], [
216 AC_REQUIRE([CURL_CHECK_HEADER_WINDOWS])dnl
217 AC_CACHE_CHECK([for winsock.h], [ac_cv_header_winsock_h], [
221 #ifndef WIN32_LEAN_AND_MEAN
222 #define WIN32_LEAN_AND_MEAN
227 #if defined(__CYGWIN__) || defined(__CEGCC__)
228 HAVE_WINSOCK_H shall not be defined.
230 int dummy=WSACleanup();
234 ac_cv_header_winsock_h="yes"
236 ac_cv_header_winsock_h="no"
239 case "$ac_cv_header_winsock_h" in
241 AC_DEFINE_UNQUOTED(HAVE_WINSOCK_H, 1,
242 [Define to 1 if you have the winsock.h header file.])
248 dnl CURL_CHECK_HEADER_WINSOCK2
249 dnl -------------------------------------------------
250 dnl Check for compilable and valid winsock2.h header
252 AC_DEFUN([CURL_CHECK_HEADER_WINSOCK2], [
253 AC_REQUIRE([CURL_CHECK_HEADER_WINDOWS])dnl
254 AC_CACHE_CHECK([for winsock2.h], [ac_cv_header_winsock2_h], [
258 #ifndef WIN32_LEAN_AND_MEAN
259 #define WIN32_LEAN_AND_MEAN
262 #include <winsock2.h>
264 #if defined(__CYGWIN__) || defined(__CEGCC__) || defined(__MINGW32CE__)
265 HAVE_WINSOCK2_H shall not be defined.
267 int dummy=2*IPPROTO_ESP;
271 ac_cv_header_winsock2_h="yes"
273 ac_cv_header_winsock2_h="no"
276 case "$ac_cv_header_winsock2_h" in
278 AC_DEFINE_UNQUOTED(HAVE_WINSOCK2_H, 1,
279 [Define to 1 if you have the winsock2.h header file.])
285 dnl CURL_CHECK_HEADER_WS2TCPIP
286 dnl -------------------------------------------------
287 dnl Check for compilable and valid ws2tcpip.h header
289 AC_DEFUN([CURL_CHECK_HEADER_WS2TCPIP], [
290 AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK2])dnl
291 AC_CACHE_CHECK([for ws2tcpip.h], [ac_cv_header_ws2tcpip_h], [
295 #ifndef WIN32_LEAN_AND_MEAN
296 #define WIN32_LEAN_AND_MEAN
299 #include <winsock2.h>
300 #include <ws2tcpip.h>
302 #if defined(__CYGWIN__) || defined(__CEGCC__) || defined(__MINGW32CE__)
303 HAVE_WS2TCPIP_H shall not be defined.
305 int dummy=2*IP_PKTINFO;
309 ac_cv_header_ws2tcpip_h="yes"
311 ac_cv_header_ws2tcpip_h="no"
314 case "$ac_cv_header_ws2tcpip_h" in
316 AC_DEFINE_UNQUOTED(HAVE_WS2TCPIP_H, 1,
317 [Define to 1 if you have the ws2tcpip.h header file.])
323 dnl CURL_CHECK_HEADER_WINLDAP
324 dnl -------------------------------------------------
325 dnl Check for compilable and valid winldap.h header
327 AC_DEFUN([CURL_CHECK_HEADER_WINLDAP], [
328 AC_REQUIRE([CURL_CHECK_HEADER_WINDOWS])dnl
329 AC_CACHE_CHECK([for winldap.h], [ac_cv_header_winldap_h], [
333 #ifdef HAVE_WINDOWS_H
334 #ifndef WIN32_LEAN_AND_MEAN
335 #define WIN32_LEAN_AND_MEAN
341 #if defined(__CYGWIN__) || defined(__CEGCC__)
342 HAVE_WINLDAP_H shall not be defined.
344 LDAP *ldp = ldap_init("dummy", LDAP_PORT);
345 ULONG res = ldap_unbind(ldp);
349 ac_cv_header_winldap_h="yes"
351 ac_cv_header_winldap_h="no"
354 case "$ac_cv_header_winldap_h" in
356 AC_DEFINE_UNQUOTED(HAVE_WINLDAP_H, 1,
357 [Define to 1 if you have the winldap.h header file.])
363 dnl CURL_CHECK_HEADER_WINBER
364 dnl -------------------------------------------------
365 dnl Check for compilable and valid winber.h header
367 AC_DEFUN([CURL_CHECK_HEADER_WINBER], [
368 AC_REQUIRE([CURL_CHECK_HEADER_WINLDAP])dnl
369 AC_CACHE_CHECK([for winber.h], [ac_cv_header_winber_h], [
373 #ifdef HAVE_WINDOWS_H
374 #ifndef WIN32_LEAN_AND_MEAN
375 #define WIN32_LEAN_AND_MEAN
382 #if defined(__CYGWIN__) || defined(__CEGCC__)
383 HAVE_WINBER_H shall not be defined.
386 BerElement *bep = ber_init(bvp);
391 ac_cv_header_winber_h="yes"
393 ac_cv_header_winber_h="no"
396 case "$ac_cv_header_winber_h" in
398 AC_DEFINE_UNQUOTED(HAVE_WINBER_H, 1,
399 [Define to 1 if you have the winber.h header file.])
405 dnl CURL_CHECK_HEADER_LBER
406 dnl -------------------------------------------------
407 dnl Check for compilable and valid lber.h header,
408 dnl and check if it is needed even with ldap.h
410 AC_DEFUN([CURL_CHECK_HEADER_LBER], [
411 AC_REQUIRE([CURL_CHECK_HEADER_WINDOWS])dnl
412 AC_CACHE_CHECK([for lber.h], [ac_cv_header_lber_h], [
416 #ifdef HAVE_WINDOWS_H
417 #ifndef WIN32_LEAN_AND_MEAN
418 #define WIN32_LEAN_AND_MEAN
422 #ifdef HAVE_SYS_TYPES_H
423 #include <sys/types.h>
427 #define NULL (void *)0
431 BerValue *bvp = NULL;
432 BerElement *bep = ber_init(bvp);
436 ac_cv_header_lber_h="yes"
438 ac_cv_header_lber_h="no"
441 if test "$ac_cv_header_lber_h" = "yes"; then
442 AC_DEFINE_UNQUOTED(HAVE_LBER_H, 1,
443 [Define to 1 if you have the lber.h header file.])
448 #ifdef HAVE_WINDOWS_H
449 #ifndef WIN32_LEAN_AND_MEAN
450 #define WIN32_LEAN_AND_MEAN
454 #ifdef HAVE_SYS_TYPES_H
455 #include <sys/types.h>
459 #define NULL (void *)0
461 #ifndef LDAP_DEPRECATED
462 #define LDAP_DEPRECATED 1
466 BerValue *bvp = NULL;
467 BerElement *bep = ber_init(bvp);
471 curl_cv_need_header_lber_h="no"
473 curl_cv_need_header_lber_h="yes"
476 case "$curl_cv_need_header_lber_h" in
478 AC_DEFINE_UNQUOTED(NEED_LBER_H, 1,
479 [Define to 1 if you need the lber.h header file even with ldap.h])
486 dnl CURL_CHECK_HEADER_LDAP
487 dnl -------------------------------------------------
488 dnl Check for compilable and valid ldap.h header
490 AC_DEFUN([CURL_CHECK_HEADER_LDAP], [
491 AC_REQUIRE([CURL_CHECK_HEADER_LBER])dnl
492 AC_CACHE_CHECK([for ldap.h], [ac_cv_header_ldap_h], [
496 #ifdef HAVE_WINDOWS_H
497 #ifndef WIN32_LEAN_AND_MEAN
498 #define WIN32_LEAN_AND_MEAN
502 #ifdef HAVE_SYS_TYPES_H
503 #include <sys/types.h>
506 #ifndef LDAP_DEPRECATED
507 #define LDAP_DEPRECATED 1
514 LDAP *ldp = ldap_init("dummy", LDAP_PORT);
515 int res = ldap_unbind(ldp);
518 ac_cv_header_ldap_h="yes"
520 ac_cv_header_ldap_h="no"
523 case "$ac_cv_header_ldap_h" in
525 AC_DEFINE_UNQUOTED(HAVE_LDAP_H, 1,
526 [Define to 1 if you have the ldap.h header file.])
532 dnl CURL_CHECK_HEADER_LDAP_SSL
533 dnl -------------------------------------------------
534 dnl Check for compilable and valid ldap_ssl.h header
536 AC_DEFUN([CURL_CHECK_HEADER_LDAP_SSL], [
537 AC_REQUIRE([CURL_CHECK_HEADER_LDAP])dnl
538 AC_CACHE_CHECK([for ldap_ssl.h], [ac_cv_header_ldap_ssl_h], [
542 #ifdef HAVE_WINDOWS_H
543 #ifndef WIN32_LEAN_AND_MEAN
544 #define WIN32_LEAN_AND_MEAN
548 #ifdef HAVE_SYS_TYPES_H
549 #include <sys/types.h>
552 #ifndef LDAP_DEPRECATED
553 #define LDAP_DEPRECATED 1
561 #include <ldap_ssl.h>
563 LDAP *ldp = ldapssl_init("dummy", LDAPS_PORT, 1);
566 ac_cv_header_ldap_ssl_h="yes"
568 ac_cv_header_ldap_ssl_h="no"
571 case "$ac_cv_header_ldap_ssl_h" in
573 AC_DEFINE_UNQUOTED(HAVE_LDAP_SSL_H, 1,
574 [Define to 1 if you have the ldap_ssl.h header file.])
580 dnl CURL_CHECK_HEADER_LDAPSSL
581 dnl -------------------------------------------------
582 dnl Check for compilable and valid ldapssl.h header
584 AC_DEFUN([CURL_CHECK_HEADER_LDAPSSL], [
585 AC_REQUIRE([CURL_CHECK_HEADER_LDAP])dnl
586 AC_CACHE_CHECK([for ldapssl.h], [ac_cv_header_ldapssl_h], [
590 #ifdef HAVE_WINDOWS_H
591 #ifndef WIN32_LEAN_AND_MEAN
592 #define WIN32_LEAN_AND_MEAN
596 #ifdef HAVE_SYS_TYPES_H
597 #include <sys/types.h>
601 #define NULL (void *)0
603 #ifndef LDAP_DEPRECATED
604 #define LDAP_DEPRECATED 1
614 char *cert_label = NULL;
615 LDAP *ldp = ldap_ssl_init("dummy", LDAPS_PORT, cert_label);
618 ac_cv_header_ldapssl_h="yes"
620 ac_cv_header_ldapssl_h="no"
623 case "$ac_cv_header_ldapssl_h" in
625 AC_DEFINE_UNQUOTED(HAVE_LDAPSSL_H, 1,
626 [Define to 1 if you have the ldapssl.h header file.])
632 dnl CURL_CHECK_LIBS_WINLDAP
633 dnl -------------------------------------------------
634 dnl Check for libraries needed for WINLDAP support,
635 dnl and prepended to LIBS any needed libraries.
636 dnl This macro can take an optional parameter with a
637 dnl white space separated list of libraries to check
638 dnl before the WINLDAP default ones.
640 AC_DEFUN([CURL_CHECK_LIBS_WINLDAP], [
641 AC_REQUIRE([CURL_CHECK_HEADER_WINBER])dnl
643 AC_MSG_CHECKING([for WINLDAP libraries])
657 if test -z "$u_libs"; then
660 u_libs="$u_libs $l_lib"
665 curl_cv_save_LIBS="$LIBS"
666 curl_cv_ldap_LIBS="unknown"
668 for x_nlibs in '' "$u_libs" \
670 if test "$curl_cv_ldap_LIBS" = "unknown"; then
671 if test -z "$x_nlibs"; then
672 LIBS="$curl_cv_save_LIBS"
674 LIBS="$x_nlibs $curl_cv_save_LIBS"
679 #ifdef HAVE_WINDOWS_H
680 #ifndef WIN32_LEAN_AND_MEAN
681 #define WIN32_LEAN_AND_MEAN
684 #ifdef HAVE_WINLDAP_H
693 BerElement *bep = ber_init(bvp);
694 LDAP *ldp = ldap_init("dummy", LDAP_PORT);
695 ULONG res = ldap_unbind(ldp);
699 curl_cv_ldap_LIBS="$x_nlibs"
704 LIBS="$curl_cv_save_LIBS"
706 case X-"$curl_cv_ldap_LIBS" in
708 AC_MSG_RESULT([cannot find WINLDAP libraries])
711 AC_MSG_RESULT([no additional lib required])
714 if test -z "$curl_cv_save_LIBS"; then
715 LIBS="$curl_cv_ldap_LIBS"
717 LIBS="$curl_cv_ldap_LIBS $curl_cv_save_LIBS"
719 AC_MSG_RESULT([$curl_cv_ldap_LIBS])
726 dnl CURL_CHECK_LIBS_LDAP
727 dnl -------------------------------------------------
728 dnl Check for libraries needed for LDAP support,
729 dnl and prepended to LIBS any needed libraries.
730 dnl This macro can take an optional parameter with a
731 dnl white space separated list of libraries to check
732 dnl before the default ones.
734 AC_DEFUN([CURL_CHECK_LIBS_LDAP], [
735 AC_REQUIRE([CURL_CHECK_HEADER_LDAP])dnl
737 AC_MSG_CHECKING([for LDAP libraries])
751 if test -z "$u_libs"; then
754 u_libs="$u_libs $l_lib"
759 curl_cv_save_LIBS="$LIBS"
760 curl_cv_ldap_LIBS="unknown"
762 for x_nlibs in '' "$u_libs" \
766 '-lldapssl -lldapx -lldapsdk' \
767 '-lldapsdk -lldapx -lldapssl' ; do
768 if test "$curl_cv_ldap_LIBS" = "unknown"; then
769 if test -z "$x_nlibs"; then
770 LIBS="$curl_cv_save_LIBS"
772 LIBS="$x_nlibs $curl_cv_save_LIBS"
777 #ifdef HAVE_WINDOWS_H
778 #ifndef WIN32_LEAN_AND_MEAN
779 #define WIN32_LEAN_AND_MEAN
783 #ifdef HAVE_SYS_TYPES_H
784 #include <sys/types.h>
788 #define NULL (void *)0
790 #ifndef LDAP_DEPRECATED
791 #define LDAP_DEPRECATED 1
800 BerValue *bvp = NULL;
801 BerElement *bep = ber_init(bvp);
802 LDAP *ldp = ldap_init("dummy", LDAP_PORT);
803 int res = ldap_unbind(ldp);
807 curl_cv_ldap_LIBS="$x_nlibs"
812 LIBS="$curl_cv_save_LIBS"
814 case X-"$curl_cv_ldap_LIBS" in
816 AC_MSG_RESULT([cannot find LDAP libraries])
819 AC_MSG_RESULT([no additional lib required])
822 if test -z "$curl_cv_save_LIBS"; then
823 LIBS="$curl_cv_ldap_LIBS"
825 LIBS="$curl_cv_ldap_LIBS $curl_cv_save_LIBS"
827 AC_MSG_RESULT([$curl_cv_ldap_LIBS])
834 dnl CURL_CHECK_HEADER_MALLOC
835 dnl -------------------------------------------------
836 dnl Check for compilable and valid malloc.h header,
837 dnl and check if it is needed even with stdlib.h
839 AC_DEFUN([CURL_CHECK_HEADER_MALLOC], [
840 AC_CACHE_CHECK([for malloc.h], [ac_cv_header_malloc_h], [
845 void *p = malloc(10);
846 void *q = calloc(10,10);
851 ac_cv_header_malloc_h="yes"
853 ac_cv_header_malloc_h="no"
856 if test "$ac_cv_header_malloc_h" = "yes"; then
857 AC_DEFINE_UNQUOTED(HAVE_MALLOC_H, 1,
858 [Define to 1 if you have the malloc.h header file.])
864 void *p = malloc(10);
865 void *q = calloc(10,10);
870 curl_cv_need_header_malloc_h="no"
872 curl_cv_need_header_malloc_h="yes"
875 case "$curl_cv_need_header_malloc_h" in
877 AC_DEFINE_UNQUOTED(NEED_MALLOC_H, 1,
878 [Define to 1 if you need the malloc.h header file even with stdlib.h])
885 dnl CURL_CHECK_TYPE_SOCKLEN_T
886 dnl -------------------------------------------------
887 dnl Check for existing socklen_t type, and provide
888 dnl an equivalent type if socklen_t not available
890 AC_DEFUN([CURL_CHECK_TYPE_SOCKLEN_T], [
891 AC_REQUIRE([CURL_CHECK_HEADER_WS2TCPIP])dnl
892 AC_CHECK_TYPE([socklen_t], ,[
893 dnl socklen_t not available
894 AC_CACHE_CHECK([for socklen_t equivalent],
895 [curl_cv_socklen_t_equiv], [
896 curl_cv_socklen_t_equiv="unknown"
897 for arg1 in 'int' 'SOCKET'; do
898 for arg2 in "struct sockaddr" void; do
899 for t in int size_t unsigned long "unsigned long"; do
900 if test "$curl_cv_socklen_t_equiv" = "unknown"; then
904 #ifdef HAVE_WINDOWS_H
905 #ifndef WIN32_LEAN_AND_MEAN
906 #define WIN32_LEAN_AND_MEAN
909 #ifdef HAVE_WINSOCK2_H
910 #include <winsock2.h>
912 #ifdef HAVE_WINSOCK_H
916 #define GETPEERNCALLCONV PASCAL
918 #ifdef HAVE_SYS_TYPES_H
919 #include <sys/types.h>
921 #ifdef HAVE_SYS_SOCKET_H
922 #include <sys/socket.h>
924 #define GETPEERNCALLCONV
926 extern int GETPEERNCALLCONV getpeername($arg1, $arg2 *, $t *);
929 getpeername(0,0,&len);
932 curl_cv_socklen_t_equiv="$t"
939 case "$curl_cv_socklen_t_equiv" in
941 AC_MSG_ERROR([Cannot find a type to use in place of socklen_t])
944 AC_DEFINE_UNQUOTED(socklen_t, $curl_cv_socklen_t_equiv,
945 [Type to use in place of socklen_t when system does not provide it.])
950 #ifdef HAVE_WINDOWS_H
951 #ifndef WIN32_LEAN_AND_MEAN
952 #define WIN32_LEAN_AND_MEAN
955 #ifdef HAVE_WINSOCK2_H
956 #include <winsock2.h>
957 #ifdef HAVE_WS2TCPIP_H
958 #include <ws2tcpip.h>
962 #ifdef HAVE_SYS_TYPES_H
963 #include <sys/types.h>
965 #ifdef HAVE_SYS_SOCKET_H
966 #include <sys/socket.h>
973 dnl CURL_CHECK_FUNC_GETNAMEINFO
974 dnl -------------------------------------------------
975 dnl Test if the getnameinfo function is available,
976 dnl and check the types of five of its arguments.
977 dnl If the function succeeds HAVE_GETNAMEINFO will be
978 dnl defined, defining the types of the arguments in
979 dnl GETNAMEINFO_TYPE_ARG1, GETNAMEINFO_TYPE_ARG2,
980 dnl GETNAMEINFO_TYPE_ARG46 and GETNAMEINFO_TYPE_ARG7,
981 dnl and also defining the type qualifier of first
982 dnl argument in GETNAMEINFO_QUAL_ARG1.
984 AC_DEFUN([CURL_CHECK_FUNC_GETNAMEINFO], [
985 AC_REQUIRE([CURL_CHECK_HEADER_WS2TCPIP])dnl
986 AC_REQUIRE([CURL_CHECK_TYPE_SOCKLEN_T])dnl
987 AC_CHECK_HEADERS(sys/types.h sys/socket.h netdb.h)
989 AC_MSG_CHECKING([for getnameinfo])
991 AC_LANG_FUNC_LINK_TRY([getnameinfo])
994 curl_cv_getnameinfo="yes"
997 curl_cv_getnameinfo="no"
1000 if test "$curl_cv_getnameinfo" != "yes"; then
1001 AC_MSG_CHECKING([deeper for getnameinfo])
1008 AC_MSG_RESULT([yes])
1009 curl_cv_getnameinfo="yes"
1011 AC_MSG_RESULT([but still no])
1012 curl_cv_getnameinfo="no"
1016 if test "$curl_cv_getnameinfo" != "yes"; then
1017 AC_MSG_CHECKING([deeper and deeper for getnameinfo])
1021 #ifdef HAVE_WINDOWS_H
1022 #ifndef WIN32_LEAN_AND_MEAN
1023 #define WIN32_LEAN_AND_MEAN
1025 #include <windows.h>
1026 #ifdef HAVE_WINSOCK2_H
1027 #include <winsock2.h>
1028 #ifdef HAVE_WS2TCPIP_H
1029 #include <ws2tcpip.h>
1033 #ifdef HAVE_SYS_TYPES_H
1034 #include <sys/types.h>
1036 #ifdef HAVE_SYS_SOCKET_H
1037 #include <sys/socket.h>
1044 getnameinfo(0, 0, 0, 0, 0, 0, 0);
1047 AC_MSG_RESULT([yes])
1048 curl_cv_getnameinfo="yes"
1050 AC_MSG_RESULT([but still no])
1051 curl_cv_getnameinfo="no"
1055 if test "$curl_cv_getnameinfo" = "yes"; then
1056 AC_CACHE_CHECK([types of arguments for getnameinfo],
1057 [curl_cv_func_getnameinfo_args], [
1058 curl_cv_func_getnameinfo_args="unknown"
1059 for gni_arg1 in 'struct sockaddr *' 'const struct sockaddr *' 'void *'; do
1060 for gni_arg2 in 'socklen_t' 'size_t' 'int'; do
1061 for gni_arg46 in 'size_t' 'int' 'socklen_t' 'unsigned int' 'DWORD'; do
1062 for gni_arg7 in 'int' 'unsigned int'; do
1063 if test "$curl_cv_func_getnameinfo_args" = "unknown"; then
1067 #ifdef HAVE_WINDOWS_H
1068 #ifndef WIN32_LEAN_AND_MEAN
1069 #define WIN32_LEAN_AND_MEAN
1071 #if (!defined(_WIN32_WINNT)) || (_WIN32_WINNT < 0x0501)
1073 #define _WIN32_WINNT 0x0501
1075 #include <windows.h>
1076 #ifdef HAVE_WINSOCK2_H
1077 #include <winsock2.h>
1078 #ifdef HAVE_WS2TCPIP_H
1079 #include <ws2tcpip.h>
1082 #define GNICALLCONV WSAAPI
1084 #ifdef HAVE_SYS_TYPES_H
1085 #include <sys/types.h>
1087 #ifdef HAVE_SYS_SOCKET_H
1088 #include <sys/socket.h>
1095 extern int GNICALLCONV getnameinfo($gni_arg1, $gni_arg2,
1101 $gni_arg46 hostlen=0;
1102 $gni_arg46 servlen=0;
1104 int res = getnameinfo(0, salen, 0, hostlen, 0, servlen, flags);
1107 curl_cv_func_getnameinfo_args="$gni_arg1,$gni_arg2,$gni_arg46,$gni_arg7"
1115 if test "$curl_cv_func_getnameinfo_args" = "unknown"; then
1116 AC_MSG_WARN([Cannot find proper types to use for getnameinfo args])
1117 AC_MSG_WARN([HAVE_GETNAMEINFO will not be defined])
1119 gni_prev_IFS=$IFS; IFS=','
1120 set dummy `echo "$curl_cv_func_getnameinfo_args" | sed 's/\*/\*/g'`
1124 gni_qual_type_arg1=$[1]
1126 AC_DEFINE_UNQUOTED(GETNAMEINFO_TYPE_ARG2, $[2],
1127 [Define to the type of arg 2 for getnameinfo.])
1128 AC_DEFINE_UNQUOTED(GETNAMEINFO_TYPE_ARG46, $[3],
1129 [Define to the type of args 4 and 6 for getnameinfo.])
1130 AC_DEFINE_UNQUOTED(GETNAMEINFO_TYPE_ARG7, $[4],
1131 [Define to the type of arg 7 for getnameinfo.])
1135 case $prev_sh_opts in
1143 case "$gni_qual_type_arg1" in
1146 gni_type_arg1=`echo $gni_qual_type_arg1 | sed 's/^const //'`
1150 gni_type_arg1=$gni_qual_type_arg1
1154 AC_DEFINE_UNQUOTED(GETNAMEINFO_QUAL_ARG1, $gni_qual_arg1,
1155 [Define to the type qualifier of arg 1 for getnameinfo.])
1156 AC_DEFINE_UNQUOTED(GETNAMEINFO_TYPE_ARG1, $gni_type_arg1,
1157 [Define to the type of arg 1 for getnameinfo.])
1159 case $prev_sh_opts in
1167 AC_DEFINE_UNQUOTED(HAVE_GETNAMEINFO, 1,
1168 [Define to 1 if you have the getnameinfo function.])
1169 ac_cv_func_getnameinfo="yes"
1175 dnl TYPE_SOCKADDR_STORAGE
1176 dnl -------------------------------------------------
1177 dnl Check for struct sockaddr_storage. Most IPv6-enabled
1178 dnl hosts have it, but AIX 4.3 is one known exception.
1180 AC_DEFUN([TYPE_SOCKADDR_STORAGE],
1182 AC_CHECK_TYPE([struct sockaddr_storage],
1183 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE, 1,
1184 [if struct sockaddr_storage is defined]), ,
1187 #ifdef HAVE_WINDOWS_H
1188 #ifndef WIN32_LEAN_AND_MEAN
1189 #define WIN32_LEAN_AND_MEAN
1191 #include <windows.h>
1192 #ifdef HAVE_WINSOCK2_H
1193 #include <winsock2.h>
1196 #ifdef HAVE_SYS_TYPES_H
1197 #include <sys/types.h>
1199 #ifdef HAVE_SYS_SOCKET_H
1200 #include <sys/socket.h>
1202 #ifdef HAVE_NETINET_IN_H
1203 #include <netinet/in.h>
1205 #ifdef HAVE_ARPA_INET_H
1206 #include <arpa/inet.h>
1213 dnl CURL_CHECK_NI_WITHSCOPEID
1214 dnl -------------------------------------------------
1215 dnl Check for working NI_WITHSCOPEID in getnameinfo()
1217 AC_DEFUN([CURL_CHECK_NI_WITHSCOPEID], [
1218 AC_REQUIRE([CURL_CHECK_FUNC_GETNAMEINFO])dnl
1219 AC_REQUIRE([TYPE_SOCKADDR_STORAGE])dnl
1220 AC_CHECK_HEADERS(stdio.h sys/types.h sys/socket.h \
1221 netdb.h netinet/in.h arpa/inet.h)
1223 AC_CACHE_CHECK([for working NI_WITHSCOPEID],
1224 [ac_cv_working_ni_withscopeid], [
1230 #ifdef HAVE_SYS_TYPES_H
1231 #include <sys/types.h>
1233 #ifdef HAVE_SYS_SOCKET_H
1234 #include <sys/socket.h>
1239 #ifdef HAVE_NETINET_IN_H
1240 #include <netinet/in.h>
1242 #ifdef HAVE_ARPA_INET_H
1243 #include <arpa/inet.h>
1246 #if defined(NI_WITHSCOPEID) && defined(HAVE_GETNAMEINFO)
1247 #ifdef HAVE_STRUCT_SOCKADDR_STORAGE
1248 struct sockaddr_storage sa;
1250 unsigned char sa[256];
1252 char hostbuf[NI_MAXHOST];
1254 GETNAMEINFO_TYPE_ARG2 salen = (GETNAMEINFO_TYPE_ARG2)sizeof(sa);
1255 GETNAMEINFO_TYPE_ARG46 hostlen = (GETNAMEINFO_TYPE_ARG46)sizeof(hostbuf);
1256 GETNAMEINFO_TYPE_ARG7 flags = NI_NUMERICHOST | NI_NUMERICSERV | NI_WITHSCOPEID;
1257 int fd = socket(AF_INET6, SOCK_STREAM, 0);
1260 return 1; /* Error creating socket */
1262 rc = getsockname(fd, (GETNAMEINFO_TYPE_ARG1)&sa, &salen);
1264 perror("getsockname()");
1265 return 2; /* Error retrieving socket name */
1267 rc = getnameinfo((GETNAMEINFO_TYPE_ARG1)&sa, salen, hostbuf, hostlen, NULL, 0, flags);
1269 printf("rc = %s\n", gai_strerror(rc));
1270 return 3; /* Error translating socket address */
1272 return 0; /* Ok, NI_WITHSCOPEID works */
1274 return 4; /* Error, NI_WITHSCOPEID not defined or no getnameinfo() */
1276 ]]) # AC_LANG_PROGRAM
1278 # Exit code == 0. Program worked.
1279 ac_cv_working_ni_withscopeid="yes"
1281 # Exit code != 0. Program failed.
1282 ac_cv_working_ni_withscopeid="no"
1284 # Program is not run when cross-compiling. So we assume
1285 # NI_WITHSCOPEID will work if we are able to compile it.
1288 #include <sys/types.h>
1289 #include <sys/socket.h>
1292 unsigned int dummy= NI_NUMERICHOST | NI_NUMERICSERV | NI_WITHSCOPEID;
1295 ac_cv_working_ni_withscopeid="yes"
1297 ac_cv_working_ni_withscopeid="no"
1298 ]) # AC_COMPILE_IFELSE
1301 case "$ac_cv_working_ni_withscopeid" in
1303 AC_DEFINE(HAVE_NI_WITHSCOPEID, 1,
1304 [Define to 1 if NI_WITHSCOPEID exists and works.])
1310 dnl CURL_CHECK_FUNC_RECV
1311 dnl -------------------------------------------------
1312 dnl Test if the socket recv() function is available,
1313 dnl and check its return type and the types of its
1314 dnl arguments. If the function succeeds HAVE_RECV
1315 dnl will be defined, defining the types of the arguments
1316 dnl in RECV_TYPE_ARG1, RECV_TYPE_ARG2, RECV_TYPE_ARG3
1317 dnl and RECV_TYPE_ARG4, defining the type of the function
1318 dnl return value in RECV_TYPE_RETV.
1320 AC_DEFUN([CURL_CHECK_FUNC_RECV], [
1321 AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK])dnl
1322 AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK2])dnl
1323 AC_CHECK_HEADERS(sys/types.h sys/socket.h)
1325 AC_MSG_CHECKING([for recv])
1329 #ifdef HAVE_WINDOWS_H
1330 #ifndef WIN32_LEAN_AND_MEAN
1331 #define WIN32_LEAN_AND_MEAN
1333 #include <windows.h>
1334 #ifdef HAVE_WINSOCK2_H
1335 #include <winsock2.h>
1337 #ifdef HAVE_WINSOCK_H
1338 #include <winsock.h>
1342 #ifdef HAVE_SYS_TYPES_H
1343 #include <sys/types.h>
1345 #ifdef HAVE_SYS_SOCKET_H
1346 #include <sys/socket.h>
1353 AC_MSG_RESULT([yes])
1360 if test "$curl_cv_recv" = "yes"; then
1361 AC_CACHE_CHECK([types of args and return type for recv],
1362 [curl_cv_func_recv_args], [
1363 curl_cv_func_recv_args="unknown"
1364 for recv_retv in 'int' 'ssize_t'; do
1365 for recv_arg1 in 'int' 'ssize_t' 'SOCKET'; do
1366 for recv_arg2 in 'char *' 'void *'; do
1367 for recv_arg3 in 'size_t' 'int' 'socklen_t' 'unsigned int'; do
1368 for recv_arg4 in 'int' 'unsigned int'; do
1369 if test "$curl_cv_func_recv_args" = "unknown"; then
1373 #ifdef HAVE_WINDOWS_H
1374 #ifndef WIN32_LEAN_AND_MEAN
1375 #define WIN32_LEAN_AND_MEAN
1377 #include <windows.h>
1378 #ifdef HAVE_WINSOCK2_H
1379 #include <winsock2.h>
1381 #ifdef HAVE_WINSOCK_H
1382 #include <winsock.h>
1385 #define RECVCALLCONV PASCAL
1387 #ifdef HAVE_SYS_TYPES_H
1388 #include <sys/types.h>
1390 #ifdef HAVE_SYS_SOCKET_H
1391 #include <sys/socket.h>
1393 #define RECVCALLCONV
1395 extern $recv_retv RECVCALLCONV
1396 recv($recv_arg1, $recv_arg2, $recv_arg3, $recv_arg4);
1402 $recv_retv res = recv(s, buf, len, flags);
1405 curl_cv_func_recv_args="$recv_arg1,$recv_arg2,$recv_arg3,$recv_arg4,$recv_retv"
1414 if test "$curl_cv_func_recv_args" = "unknown"; then
1415 AC_MSG_ERROR([Cannot find proper types to use for recv args])
1417 recv_prev_IFS=$IFS; IFS=','
1418 set dummy `echo "$curl_cv_func_recv_args" | sed 's/\*/\*/g'`
1422 AC_DEFINE_UNQUOTED(RECV_TYPE_ARG1, $[1],
1423 [Define to the type of arg 1 for recv.])
1424 AC_DEFINE_UNQUOTED(RECV_TYPE_ARG2, $[2],
1425 [Define to the type of arg 2 for recv.])
1426 AC_DEFINE_UNQUOTED(RECV_TYPE_ARG3, $[3],
1427 [Define to the type of arg 3 for recv.])
1428 AC_DEFINE_UNQUOTED(RECV_TYPE_ARG4, $[4],
1429 [Define to the type of arg 4 for recv.])
1430 AC_DEFINE_UNQUOTED(RECV_TYPE_RETV, $[5],
1431 [Define to the function return type for recv.])
1433 AC_DEFINE_UNQUOTED(HAVE_RECV, 1,
1434 [Define to 1 if you have the recv function.])
1435 ac_cv_func_recv="yes"
1438 AC_MSG_ERROR([Unable to link function recv])
1443 dnl CURL_CHECK_FUNC_SEND
1444 dnl -------------------------------------------------
1445 dnl Test if the socket send() function is available,
1446 dnl and check its return type and the types of its
1447 dnl arguments. If the function succeeds HAVE_SEND
1448 dnl will be defined, defining the types of the arguments
1449 dnl in SEND_TYPE_ARG1, SEND_TYPE_ARG2, SEND_TYPE_ARG3
1450 dnl and SEND_TYPE_ARG4, defining the type of the function
1451 dnl return value in SEND_TYPE_RETV, and also defining the
1452 dnl type qualifier of second argument in SEND_QUAL_ARG2.
1454 AC_DEFUN([CURL_CHECK_FUNC_SEND], [
1455 AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK])dnl
1456 AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK2])dnl
1457 AC_CHECK_HEADERS(sys/types.h sys/socket.h)
1459 AC_MSG_CHECKING([for send])
1463 #ifdef HAVE_WINDOWS_H
1464 #ifndef WIN32_LEAN_AND_MEAN
1465 #define WIN32_LEAN_AND_MEAN
1467 #include <windows.h>
1468 #ifdef HAVE_WINSOCK2_H
1469 #include <winsock2.h>
1471 #ifdef HAVE_WINSOCK_H
1472 #include <winsock.h>
1476 #ifdef HAVE_SYS_TYPES_H
1477 #include <sys/types.h>
1479 #ifdef HAVE_SYS_SOCKET_H
1480 #include <sys/socket.h>
1487 AC_MSG_RESULT([yes])
1494 if test "$curl_cv_send" = "yes"; then
1495 AC_CACHE_CHECK([types of args and return type for send],
1496 [curl_cv_func_send_args], [
1497 curl_cv_func_send_args="unknown"
1498 for send_retv in 'int' 'ssize_t'; do
1499 for send_arg1 in 'int' 'ssize_t' 'SOCKET'; do
1500 for send_arg2 in 'char *' 'void *' 'const char *' 'const void *'; do
1501 for send_arg3 in 'size_t' 'int' 'socklen_t' 'unsigned int'; do
1502 for send_arg4 in 'int' 'unsigned int'; do
1503 if test "$curl_cv_func_send_args" = "unknown"; then
1507 #ifdef HAVE_WINDOWS_H
1508 #ifndef WIN32_LEAN_AND_MEAN
1509 #define WIN32_LEAN_AND_MEAN
1511 #include <windows.h>
1512 #ifdef HAVE_WINSOCK2_H
1513 #include <winsock2.h>
1515 #ifdef HAVE_WINSOCK_H
1516 #include <winsock.h>
1519 #define SENDCALLCONV PASCAL
1521 #ifdef HAVE_SYS_TYPES_H
1522 #include <sys/types.h>
1524 #ifdef HAVE_SYS_SOCKET_H
1525 #include <sys/socket.h>
1527 #define SENDCALLCONV
1529 extern $send_retv SENDCALLCONV
1530 send($send_arg1, $send_arg2, $send_arg3, $send_arg4);
1535 $send_retv res = send(s, 0, len, flags);
1538 curl_cv_func_send_args="$send_arg1,$send_arg2,$send_arg3,$send_arg4,$send_retv"
1547 if test "$curl_cv_func_send_args" = "unknown"; then
1548 AC_MSG_ERROR([Cannot find proper types to use for send args])
1550 send_prev_IFS=$IFS; IFS=','
1551 set dummy `echo "$curl_cv_func_send_args" | sed 's/\*/\*/g'`
1555 send_qual_type_arg2=$[2]
1557 AC_DEFINE_UNQUOTED(SEND_TYPE_ARG1, $[1],
1558 [Define to the type of arg 1 for send.])
1559 AC_DEFINE_UNQUOTED(SEND_TYPE_ARG3, $[3],
1560 [Define to the type of arg 3 for send.])
1561 AC_DEFINE_UNQUOTED(SEND_TYPE_ARG4, $[4],
1562 [Define to the type of arg 4 for send.])
1563 AC_DEFINE_UNQUOTED(SEND_TYPE_RETV, $[5],
1564 [Define to the function return type for send.])
1568 case $prev_sh_opts in
1576 case "$send_qual_type_arg2" in
1578 send_qual_arg2=const
1579 send_type_arg2=`echo $send_qual_type_arg2 | sed 's/^const //'`
1583 send_type_arg2=$send_qual_type_arg2
1587 AC_DEFINE_UNQUOTED(SEND_QUAL_ARG2, $send_qual_arg2,
1588 [Define to the type qualifier of arg 2 for send.])
1589 AC_DEFINE_UNQUOTED(SEND_TYPE_ARG2, $send_type_arg2,
1590 [Define to the type of arg 2 for send.])
1592 case $prev_sh_opts in
1600 AC_DEFINE_UNQUOTED(HAVE_SEND, 1,
1601 [Define to 1 if you have the send function.])
1602 ac_cv_func_send="yes"
1605 AC_MSG_ERROR([Unable to link function send])
1610 dnl CURL_CHECK_FUNC_RECVFROM
1611 dnl -------------------------------------------------
1612 dnl Test if the socket recvfrom() function is available,
1613 dnl and check its return type and the types of its
1614 dnl arguments. If the function succeeds HAVE_RECVFROM
1615 dnl will be defined, defining the types of the arguments
1616 dnl in RECVFROM_TYPE_ARG1, RECVFROM_TYPE_ARG2, and so on
1617 dnl to RECVFROM_TYPE_ARG6, defining also the type of the
1618 dnl function return value in RECVFROM_TYPE_RETV.
1619 dnl Notice that the types returned for pointer arguments
1620 dnl will actually be the type pointed by the pointer.
1622 AC_DEFUN([CURL_CHECK_FUNC_RECVFROM], [
1623 AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK])dnl
1624 AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK2])dnl
1625 AC_CHECK_HEADERS(sys/types.h sys/socket.h)
1627 AC_MSG_CHECKING([for recvfrom])
1631 #ifdef HAVE_WINDOWS_H
1632 #ifndef WIN32_LEAN_AND_MEAN
1633 #define WIN32_LEAN_AND_MEAN
1635 #include <windows.h>
1636 #ifdef HAVE_WINSOCK2_H
1637 #include <winsock2.h>
1639 #ifdef HAVE_WINSOCK_H
1640 #include <winsock.h>
1644 #ifdef HAVE_SYS_TYPES_H
1645 #include <sys/types.h>
1647 #ifdef HAVE_SYS_SOCKET_H
1648 #include <sys/socket.h>
1652 recvfrom(0, 0, 0, 0, 0, 0);
1655 AC_MSG_RESULT([yes])
1656 curl_cv_recvfrom="yes"
1659 curl_cv_recvfrom="no"
1662 if test "$curl_cv_recvfrom" = "yes"; then
1663 AC_CACHE_CHECK([types of args and return type for recvfrom],
1664 [curl_cv_func_recvfrom_args], [
1665 curl_cv_func_recvfrom_args="unknown"
1666 for recvfrom_retv in 'int' 'ssize_t'; do
1667 for recvfrom_arg1 in 'int' 'ssize_t' 'SOCKET'; do
1668 for recvfrom_arg2 in 'char *' 'void *'; do
1669 for recvfrom_arg3 in 'size_t' 'int' 'socklen_t' 'unsigned int'; do
1670 for recvfrom_arg4 in 'int' 'unsigned int'; do
1671 for recvfrom_arg5 in 'struct sockaddr *' 'void *'; do
1672 for recvfrom_arg6 in 'socklen_t *' 'int *' 'unsigned int *' 'size_t *' 'void *'; do
1673 if test "$curl_cv_func_recvfrom_args" = "unknown"; then
1677 #ifdef HAVE_WINDOWS_H
1678 #ifndef WIN32_LEAN_AND_MEAN
1679 #define WIN32_LEAN_AND_MEAN
1681 #include <windows.h>
1682 #ifdef HAVE_WINSOCK2_H
1683 #include <winsock2.h>
1685 #ifdef HAVE_WINSOCK_H
1686 #include <winsock.h>
1689 #define RECVFROMCALLCONV PASCAL
1691 #ifdef HAVE_SYS_TYPES_H
1692 #include <sys/types.h>
1694 #ifdef HAVE_SYS_SOCKET_H
1695 #include <sys/socket.h>
1697 #define RECVFROMCALLCONV
1699 extern $recvfrom_retv RECVFROMCALLCONV
1700 recvfrom($recvfrom_arg1, $recvfrom_arg2,
1701 $recvfrom_arg3, $recvfrom_arg4,
1702 $recvfrom_arg5, $recvfrom_arg6);
1705 $recvfrom_arg2 buf=0;
1706 $recvfrom_arg3 len=0;
1707 $recvfrom_arg4 flags=0;
1708 $recvfrom_arg5 addr=0;
1709 $recvfrom_arg6 addrlen=0;
1710 $recvfrom_retv res=0;
1711 res = recvfrom(s, buf, len, flags, addr, addrlen);
1714 curl_cv_func_recvfrom_args="$recvfrom_arg1,$recvfrom_arg2,$recvfrom_arg3,$recvfrom_arg4,$recvfrom_arg5,$recvfrom_arg6,$recvfrom_retv"
1725 if test "$curl_cv_func_recvfrom_args" = "unknown"; then
1726 AC_MSG_ERROR([Cannot find proper types to use for recvfrom args])
1728 recvfrom_prev_IFS=$IFS; IFS=','
1729 set dummy `echo "$curl_cv_func_recvfrom_args" | sed 's/\*/\*/g'`
1730 IFS=$recvfrom_prev_IFS
1733 recvfrom_ptrt_arg2=$[2]
1734 recvfrom_ptrt_arg5=$[5]
1735 recvfrom_ptrt_arg6=$[6]
1737 AC_DEFINE_UNQUOTED(RECVFROM_TYPE_ARG1, $[1],
1738 [Define to the type of arg 1 for recvfrom.])
1739 AC_DEFINE_UNQUOTED(RECVFROM_TYPE_ARG3, $[3],
1740 [Define to the type of arg 3 for recvfrom.])
1741 AC_DEFINE_UNQUOTED(RECVFROM_TYPE_ARG4, $[4],
1742 [Define to the type of arg 4 for recvfrom.])
1743 AC_DEFINE_UNQUOTED(RECVFROM_TYPE_RETV, $[7],
1744 [Define to the function return type for recvfrom.])
1748 case $prev_sh_opts in
1756 recvfrom_type_arg2=`echo $recvfrom_ptrt_arg2 | sed 's/ \*//'`
1757 recvfrom_type_arg5=`echo $recvfrom_ptrt_arg5 | sed 's/ \*//'`
1758 recvfrom_type_arg6=`echo $recvfrom_ptrt_arg6 | sed 's/ \*//'`
1760 AC_DEFINE_UNQUOTED(RECVFROM_TYPE_ARG2, $recvfrom_type_arg2,
1761 [Define to the type pointed by arg 2 for recvfrom.])
1762 AC_DEFINE_UNQUOTED(RECVFROM_TYPE_ARG5, $recvfrom_type_arg5,
1763 [Define to the type pointed by arg 5 for recvfrom.])
1764 AC_DEFINE_UNQUOTED(RECVFROM_TYPE_ARG6, $recvfrom_type_arg6,
1765 [Define to the type pointed by arg 6 for recvfrom.])
1767 if test "$recvfrom_type_arg2" = "void"; then
1768 AC_DEFINE_UNQUOTED(RECVFROM_TYPE_ARG2_IS_VOID, 1,
1769 [Define to 1 if the type pointed by arg 2 for recvfrom is void.])
1771 if test "$recvfrom_type_arg5" = "void"; then
1772 AC_DEFINE_UNQUOTED(RECVFROM_TYPE_ARG5_IS_VOID, 1,
1773 [Define to 1 if the type pointed by arg 5 for recvfrom is void.])
1775 if test "$recvfrom_type_arg6" = "void"; then
1776 AC_DEFINE_UNQUOTED(RECVFROM_TYPE_ARG6_IS_VOID, 1,
1777 [Define to 1 if the type pointed by arg 6 for recvfrom is void.])
1780 case $prev_sh_opts in
1788 AC_DEFINE_UNQUOTED(HAVE_RECVFROM, 1,
1789 [Define to 1 if you have the recvfrom function.])
1790 ac_cv_func_recvfrom="yes"
1793 AC_MSG_ERROR([Unable to link function recvfrom])
1798 dnl CURL_CHECK_MSG_NOSIGNAL
1799 dnl -------------------------------------------------
1800 dnl Check for MSG_NOSIGNAL
1802 AC_DEFUN([CURL_CHECK_MSG_NOSIGNAL], [
1803 AC_CHECK_HEADERS(sys/types.h sys/socket.h)
1804 AC_CACHE_CHECK([for MSG_NOSIGNAL], [ac_cv_msg_nosignal], [
1808 #ifdef HAVE_WINDOWS_H
1809 #ifndef WIN32_LEAN_AND_MEAN
1810 #define WIN32_LEAN_AND_MEAN
1812 #include <windows.h>
1813 #ifdef HAVE_WINSOCK2_H
1814 #include <winsock2.h>
1816 #ifdef HAVE_WINSOCK_H
1817 #include <winsock.h>
1821 #ifdef HAVE_SYS_TYPES_H
1822 #include <sys/types.h>
1824 #ifdef HAVE_SYS_SOCKET_H
1825 #include <sys/socket.h>
1829 int flag=MSG_NOSIGNAL;
1832 ac_cv_msg_nosignal="yes"
1834 ac_cv_msg_nosignal="no"
1837 case "$ac_cv_msg_nosignal" in
1839 AC_DEFINE_UNQUOTED(HAVE_MSG_NOSIGNAL, 1,
1840 [Define to 1 if you have the MSG_NOSIGNAL flag.])
1846 dnl CURL_CHECK_STRUCT_TIMEVAL
1847 dnl -------------------------------------------------
1848 dnl Check for timeval struct
1850 AC_DEFUN([CURL_CHECK_STRUCT_TIMEVAL], [
1851 AC_REQUIRE([AC_HEADER_TIME])dnl
1852 AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK])dnl
1853 AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK2])dnl
1854 AC_CHECK_HEADERS(sys/types.h sys/time.h time.h)
1855 AC_CACHE_CHECK([for struct timeval], [ac_cv_struct_timeval], [
1859 #ifdef HAVE_WINDOWS_H
1860 #ifndef WIN32_LEAN_AND_MEAN
1861 #define WIN32_LEAN_AND_MEAN
1863 #include <windows.h>
1864 #ifdef HAVE_WINSOCK2_H
1865 #include <winsock2.h>
1867 #ifdef HAVE_WINSOCK_H
1868 #include <winsock.h>
1872 #ifdef HAVE_SYS_TYPES_H
1873 #include <sys/types.h>
1875 #ifdef HAVE_SYS_TIME_H
1876 #include <sys/time.h>
1877 #ifdef TIME_WITH_SYS_TIME
1891 ac_cv_struct_timeval="yes"
1893 ac_cv_struct_timeval="no"
1896 case "$ac_cv_struct_timeval" in
1898 AC_DEFINE_UNQUOTED(HAVE_STRUCT_TIMEVAL, 1,
1899 [Define to 1 if you have the timeval struct.])
1905 dnl TYPE_SIG_ATOMIC_T
1906 dnl -------------------------------------------------
1907 dnl Check if the sig_atomic_t type is available, and
1908 dnl verify if it is already defined as volatile.
1910 AC_DEFUN([TYPE_SIG_ATOMIC_T], [
1911 AC_CHECK_HEADERS(signal.h)
1912 AC_CHECK_TYPE([sig_atomic_t],[
1913 AC_DEFINE(HAVE_SIG_ATOMIC_T, 1,
1914 [Define to 1 if sig_atomic_t is an available typedef.])
1916 #ifdef HAVE_SIGNAL_H
1920 case "$ac_cv_type_sig_atomic_t" in
1923 AC_MSG_CHECKING([if sig_atomic_t is already defined as volatile])
1926 #ifdef HAVE_SIGNAL_H
1930 static volatile sig_atomic_t dummy = 0;
1934 ac_cv_sig_atomic_t_volatile="no"
1936 AC_MSG_RESULT([yes])
1937 ac_cv_sig_atomic_t_volatile="yes"
1940 if test "$ac_cv_sig_atomic_t_volatile" = "yes"; then
1941 AC_DEFINE(HAVE_SIG_ATOMIC_T_VOLATILE, 1,
1942 [Define to 1 if sig_atomic_t is already defined as volatile.])
1949 dnl CURL_CHECK_NONBLOCKING_SOCKET
1950 dnl -------------------------------------------------
1951 dnl Check for how to set a socket to non-blocking state. There seems to exist
1952 dnl four known different ways, with the one used almost everywhere being POSIX
1953 dnl and XPG3, while the other different ways for different systems (old BSD,
1954 dnl Windows and Amiga).
1956 dnl There are two known platforms (AIX 3.x and SunOS 4.1.x) where the
1957 dnl O_NONBLOCK define is found but does not work. This condition is attempted
1958 dnl to get caught in this script by using an excessive number of #ifdefs...
1960 AC_DEFUN([CURL_CHECK_NONBLOCKING_SOCKET], [
1961 AC_MSG_CHECKING([non-blocking sockets style])
1966 /* headers for O_NONBLOCK test */
1967 #include <sys/types.h>
1971 #if defined(sun) || defined(__sun__) || \
1972 defined(__SUNPRO_C) || defined(__SUNPRO_CC)
1973 # if defined(__SVR4) || defined(__srv4__)
1974 # define PLATFORM_SOLARIS
1976 # define PLATFORM_SUNOS4
1979 #if (defined(_AIX) || defined(__xlC__)) && !defined(_AIX41)
1980 # define PLATFORM_AIX_V3
1983 #if defined(PLATFORM_SUNOS4) || defined(PLATFORM_AIX_V3) || defined(__BEOS__)
1984 #error "O_NONBLOCK does not work on this platform"
1987 /* O_NONBLOCK source test */
1989 int flags = fcntl(socket, F_SETFL, flags | O_NONBLOCK);
1992 dnl the O_NONBLOCK test was fine
1993 nonblock="O_NONBLOCK"
1994 AC_DEFINE(HAVE_O_NONBLOCK, 1,
1995 [use O_NONBLOCK for non-blocking sockets])
1998 if test "$nonblock" = "unknown"; then
2001 /* headers for FIONBIO test */
2003 #include <stropts.h>
2005 /* FIONBIO source test (old-style unix) */
2007 int flags = ioctl(socket, FIONBIO, &flags);
2010 dnl FIONBIO test was good
2012 AC_DEFINE(HAVE_FIONBIO, 1,
2013 [use FIONBIO for non-blocking sockets])
2017 if test "$nonblock" = "unknown"; then
2020 /* headers for ioctlsocket test (Windows) */
2022 #ifdef HAVE_WINDOWS_H
2023 #ifndef WIN32_LEAN_AND_MEAN
2024 #define WIN32_LEAN_AND_MEAN
2026 #include <windows.h>
2027 #ifdef HAVE_WINSOCK2_H
2028 #include <winsock2.h>
2030 #ifdef HAVE_WINSOCK_H
2031 #include <winsock.h>
2036 /* ioctlsocket source code (Windows) */
2038 unsigned long flags = 0;
2039 sd = socket(0, 0, 0);
2040 ioctlsocket(sd, FIONBIO, &flags);
2043 dnl ioctlsocket test was good
2044 nonblock="ioctlsocket"
2045 AC_DEFINE(HAVE_IOCTLSOCKET, 1,
2046 [use ioctlsocket() for non-blocking sockets])
2050 if test "$nonblock" = "unknown"; then
2053 /* headers for IoctlSocket test (Amiga?) */
2054 #include <sys/ioctl.h>
2056 /* IoctlSocket source code (Amiga?) */
2058 int flags = IoctlSocket(socket, FIONBIO, (long)1);
2061 dnl Ioctlsocket test was good
2062 nonblock="IoctlSocket"
2063 AC_DEFINE(HAVE_IOCTLSOCKET_CASE, 1,
2064 [use Ioctlsocket() for non-blocking sockets])
2068 if test "$nonblock" = "unknown"; then
2071 /* headers for SO_NONBLOCK test (BeOS) */
2074 /* SO_NONBLOCK source code (BeOS) */
2077 int flags = setsockopt(socket, SOL_SOCKET, SO_NONBLOCK, &b, sizeof(b));
2080 dnl the SO_NONBLOCK test was good
2081 nonblock="SO_NONBLOCK"
2082 AC_DEFINE(HAVE_SO_NONBLOCK, 1,
2083 [use SO_NONBLOCK for non-blocking sockets])
2087 AC_MSG_RESULT($nonblock)
2089 if test "$nonblock" = "unknown"; then
2090 AC_DEFINE(HAVE_DISABLED_NONBLOCKING, 1,
2091 [disabled non-blocking sockets])
2092 AC_MSG_WARN([non-block sockets disabled])
2098 dnl -------------------------------------------------
2099 dnl Check for in_addr_t: it is used to receive the return code of inet_addr()
2100 dnl and a few other things.
2102 AC_DEFUN([TYPE_IN_ADDR_T], [
2103 AC_CHECK_TYPE([in_addr_t], ,[
2104 dnl in_addr_t not available
2105 AC_CACHE_CHECK([for in_addr_t equivalent],
2106 [curl_cv_in_addr_t_equiv], [
2107 curl_cv_in_addr_t_equiv="unknown"
2108 for t in "unsigned long" int size_t unsigned long; do
2109 if test "$curl_cv_in_addr_t_equiv" = "unknown"; then
2113 #ifdef HAVE_WINDOWS_H
2114 #ifndef WIN32_LEAN_AND_MEAN
2115 #define WIN32_LEAN_AND_MEAN
2117 #include <windows.h>
2118 #ifdef HAVE_WINSOCK2_H
2119 #include <winsock2.h>
2121 #ifdef HAVE_WINSOCK_H
2122 #include <winsock.h>
2126 #ifdef HAVE_SYS_TYPES_H
2127 #include <sys/types.h>
2129 #ifdef HAVE_SYS_SOCKET_H
2130 #include <sys/socket.h>
2132 #ifdef HAVE_NETINET_IN_H
2133 #include <netinet/in.h>
2135 #ifdef HAVE_ARPA_INET_H
2136 #include <arpa/inet.h>
2140 $t data = inet_addr ("1.2.3.4");
2143 curl_cv_in_addr_t_equiv="$t"
2148 case "$curl_cv_in_addr_t_equiv" in
2150 AC_MSG_ERROR([Cannot find a type to use in place of in_addr_t])
2153 AC_DEFINE_UNQUOTED(in_addr_t, $curl_cv_in_addr_t_equiv,
2154 [Type to use in place of in_addr_t when system does not provide it.])
2159 #ifdef HAVE_WINDOWS_H
2160 #ifndef WIN32_LEAN_AND_MEAN
2161 #define WIN32_LEAN_AND_MEAN
2163 #include <windows.h>
2164 #ifdef HAVE_WINSOCK2_H
2165 #include <winsock2.h>
2167 #ifdef HAVE_WINSOCK_H
2168 #include <winsock.h>
2172 #ifdef HAVE_SYS_TYPES_H
2173 #include <sys/types.h>
2175 #ifdef HAVE_SYS_SOCKET_H
2176 #include <sys/socket.h>
2178 #ifdef HAVE_NETINET_IN_H
2179 #include <netinet/in.h>
2181 #ifdef HAVE_ARPA_INET_H
2182 #include <arpa/inet.h>
2185 ]) dnl AC_CHECK_TYPE
2189 dnl CURL_CHECK_FUNC_CLOCK_GETTIME_MONOTONIC
2190 dnl -------------------------------------------------
2191 dnl Check if monotonic clock_gettime is available.
2193 AC_DEFUN([CURL_CHECK_FUNC_CLOCK_GETTIME_MONOTONIC], [
2194 AC_REQUIRE([AC_HEADER_TIME])dnl
2195 AC_CHECK_HEADERS(sys/types.h sys/time.h time.h)
2196 AC_MSG_CHECKING([for monotonic clock_gettime])
2199 #ifdef HAVE_SYS_TYPES_H
2200 #include <sys/types.h>
2202 #ifdef HAVE_SYS_TIME_H
2203 #include <sys/time.h>
2204 #ifdef TIME_WITH_SYS_TIME
2214 (void)clock_gettime(CLOCK_MONOTONIC, &ts);
2217 AC_MSG_RESULT([yes])
2218 ac_cv_func_clock_gettime="yes"
2221 ac_cv_func_clock_gettime="no"
2223 dnl Definition of HAVE_CLOCK_GETTIME_MONOTONIC is intentionally postponed
2224 dnl until library linking and run-time checks for clock_gettime succeed.
2228 dnl CURL_CHECK_LIBS_CLOCK_GETTIME_MONOTONIC
2229 dnl -------------------------------------------------
2230 dnl If monotonic clock_gettime is available then,
2231 dnl check and prepended to LIBS any needed libraries.
2233 AC_DEFUN([CURL_CHECK_LIBS_CLOCK_GETTIME_MONOTONIC], [
2234 AC_REQUIRE([CURL_CHECK_FUNC_CLOCK_GETTIME_MONOTONIC])dnl
2236 if test "$ac_cv_func_clock_gettime" = "yes"; then
2238 AC_MSG_CHECKING([for clock_gettime in libraries])
2240 curl_cv_save_LIBS="$LIBS"
2241 curl_cv_gclk_LIBS="unknown"
2243 for x_xlibs in '' '-lrt' '-lposix4' ; do
2244 if test "$curl_cv_gclk_LIBS" = "unknown"; then
2245 if test -z "$x_xlibs"; then
2246 LIBS="$curl_cv_save_LIBS"
2248 LIBS="$x_xlibs $curl_cv_save_LIBS"
2252 #ifdef HAVE_SYS_TYPES_H
2253 #include <sys/types.h>
2255 #ifdef HAVE_SYS_TIME_H
2256 #include <sys/time.h>
2257 #ifdef TIME_WITH_SYS_TIME
2267 (void)clock_gettime(CLOCK_MONOTONIC, &ts);
2270 curl_cv_gclk_LIBS="$x_xlibs"
2275 LIBS="$curl_cv_save_LIBS"
2277 case X-"$curl_cv_gclk_LIBS" in
2279 AC_MSG_RESULT([cannot find clock_gettime])
2280 AC_MSG_WARN([HAVE_CLOCK_GETTIME_MONOTONIC will not be defined])
2281 ac_cv_func_clock_gettime="no"
2284 AC_MSG_RESULT([no additional lib required])
2285 ac_cv_func_clock_gettime="yes"
2288 if test -z "$curl_cv_save_LIBS"; then
2289 LIBS="$curl_cv_gclk_LIBS"
2291 LIBS="$curl_cv_gclk_LIBS $curl_cv_save_LIBS"
2293 AC_MSG_RESULT([$curl_cv_gclk_LIBS])
2294 ac_cv_func_clock_gettime="yes"
2298 dnl only do runtime verification when not cross-compiling
2299 if test "x$cross_compiling" != "xyes" &&
2300 test "$ac_cv_func_clock_gettime" = "yes"; then
2301 AC_MSG_CHECKING([if monotonic clock_gettime works])
2304 #ifdef HAVE_SYS_TYPES_H
2305 #include <sys/types.h>
2307 #ifdef HAVE_SYS_TIME_H
2308 #include <sys/time.h>
2309 #ifdef TIME_WITH_SYS_TIME
2319 if (0 == clock_gettime(CLOCK_MONOTONIC, &ts))
2325 AC_MSG_RESULT([yes])
2328 AC_MSG_WARN([HAVE_CLOCK_GETTIME_MONOTONIC will not be defined])
2329 ac_cv_func_clock_gettime="no"
2330 LIBS="$curl_cv_save_LIBS"
2334 case "$ac_cv_func_clock_gettime" in
2336 AC_DEFINE_UNQUOTED(HAVE_CLOCK_GETTIME_MONOTONIC, 1,
2337 [Define to 1 if you have the clock_gettime function and monotonic timer.])
2346 dnl CURL_CHECK_FUNC_SELECT
2347 dnl -------------------------------------------------
2348 dnl Test if the socket select() function is available,
2349 dnl and check its return type and the types of its
2350 dnl arguments. If the function succeeds HAVE_SELECT
2351 dnl will be defined, defining the types of the
2352 dnl arguments in SELECT_TYPE_ARG1, SELECT_TYPE_ARG234
2353 dnl and SELECT_TYPE_ARG5, defining the type of the
2354 dnl function return value in SELECT_TYPE_RETV, and
2355 dnl also defining the type qualifier of fifth argument
2356 dnl in SELECT_QUAL_ARG5.
2358 AC_DEFUN([CURL_CHECK_FUNC_SELECT], [
2359 AC_REQUIRE([CURL_CHECK_STRUCT_TIMEVAL])dnl
2360 AC_CHECK_HEADERS(sys/select.h sys/socket.h)
2362 AC_MSG_CHECKING([for select])
2366 #ifdef HAVE_WINDOWS_H
2367 #ifndef WIN32_LEAN_AND_MEAN
2368 #define WIN32_LEAN_AND_MEAN
2370 #include <windows.h>
2371 #ifdef HAVE_WINSOCK2_H
2372 #include <winsock2.h>
2374 #ifdef HAVE_WINSOCK_H
2375 #include <winsock.h>
2379 #ifdef HAVE_SYS_TYPES_H
2380 #include <sys/types.h>
2382 #ifdef HAVE_SYS_TIME_H
2383 #include <sys/time.h>
2384 #ifdef TIME_WITH_SYS_TIME
2392 #ifndef HAVE_WINDOWS_H
2393 #ifdef HAVE_SYS_SELECT_H
2394 #include <sys/select.h>
2396 #ifdef HAVE_SYS_SOCKET_H
2397 #include <sys/socket.h>
2401 select(0, 0, 0, 0, 0);
2404 AC_MSG_RESULT([yes])
2405 curl_cv_select="yes"
2411 if test "$curl_cv_select" = "yes"; then
2412 AC_CACHE_CHECK([types of args and return type for select],
2413 [curl_cv_func_select_args], [
2414 curl_cv_func_select_args="unknown"
2415 for sel_retv in 'int' 'ssize_t'; do
2416 for sel_arg1 in 'int' 'ssize_t' 'size_t' 'unsigned long int' 'unsigned int'; do
2417 for sel_arg234 in 'fd_set *' 'int *' 'void *'; do
2418 for sel_arg5 in 'struct timeval *' 'const struct timeval *'; do
2419 if test "$curl_cv_func_select_args" = "unknown"; then
2423 #ifdef HAVE_WINDOWS_H
2424 #ifndef WIN32_LEAN_AND_MEAN
2425 #define WIN32_LEAN_AND_MEAN
2427 #include <windows.h>
2428 #ifdef HAVE_WINSOCK2_H
2429 #include <winsock2.h>
2431 #ifdef HAVE_WINSOCK_H
2432 #include <winsock.h>
2435 #define SELECTCALLCONV PASCAL
2437 #ifdef HAVE_SYS_TYPES_H
2438 #include <sys/types.h>
2440 #ifdef HAVE_SYS_TIME_H
2441 #include <sys/time.h>
2442 #ifdef TIME_WITH_SYS_TIME
2450 #ifndef HAVE_WINDOWS_H
2451 #ifdef HAVE_SYS_SELECT_H
2452 #include <sys/select.h>
2454 #ifdef HAVE_SYS_SOCKET_H
2455 #include <sys/socket.h>
2457 #define SELECTCALLCONV
2459 #ifndef HAVE_STRUCT_TIMEVAL
2465 extern $sel_retv SELECTCALLCONV select($sel_arg1,
2475 $sel_retv res = select(nfds, rfds, wfds, efds, 0);
2478 curl_cv_func_select_args="$sel_arg1,$sel_arg234,$sel_arg5,$sel_retv"
2486 if test "$curl_cv_func_select_args" = "unknown"; then
2487 AC_MSG_WARN([Cannot find proper types to use for select args])
2488 AC_MSG_WARN([HAVE_SELECT will not be defined])
2490 select_prev_IFS=$IFS; IFS=','
2491 set dummy `echo "$curl_cv_func_select_args" | sed 's/\*/\*/g'`
2492 IFS=$select_prev_IFS
2495 sel_qual_type_arg5=$[3]
2497 AC_DEFINE_UNQUOTED(SELECT_TYPE_ARG1, $[1],
2498 [Define to the type of arg 1 for select.])
2499 AC_DEFINE_UNQUOTED(SELECT_TYPE_ARG234, $[2],
2500 [Define to the type of args 2, 3 and 4 for select.])
2501 AC_DEFINE_UNQUOTED(SELECT_TYPE_RETV, $[4],
2502 [Define to the function return type for select.])
2506 case $prev_sh_opts in
2514 case "$sel_qual_type_arg5" in
2517 sel_type_arg5=`echo $sel_qual_type_arg5 | sed 's/^const //'`
2521 sel_type_arg5=$sel_qual_type_arg5
2525 AC_DEFINE_UNQUOTED(SELECT_QUAL_ARG5, $sel_qual_arg5,
2526 [Define to the type qualifier of arg 5 for select.])
2527 AC_DEFINE_UNQUOTED(SELECT_TYPE_ARG5, $sel_type_arg5,
2528 [Define to the type of arg 5 for select.])
2530 case $prev_sh_opts in
2538 AC_DEFINE_UNQUOTED(HAVE_SELECT, 1,
2539 [Define to 1 if you have the select function.])
2540 ac_cv_func_select="yes"
2546 dnl ************************************************************
2547 dnl check for "localhost", if it doesn't exist, we can't do the
2548 dnl gethostbyname_r tests!
2551 AC_DEFUN([CURL_CHECK_WORKING_RESOLVER],[
2552 AC_MSG_CHECKING([if "localhost" resolves])
2555 #include <sys/types.h>
2558 #define NULL (void *)0
2564 h = gethostbyname("localhost");
2565 exit (h == NULL ? 1 : 0); }],[
2566 AC_MSG_RESULT(yes)],[
2568 AC_MSG_ERROR([can't figure out gethostbyname_r() since localhost doesn't resolve])
2574 dnl ************************************************************
2575 dnl check for working getaddrinfo() that works with AI_NUMERICHOST
2577 AC_DEFUN([CURL_CHECK_WORKING_GETADDRINFO],[
2578 AC_CACHE_CHECK(for working getaddrinfo, ac_cv_working_getaddrinfo,[
2581 #include <sys/types.h>
2582 #include <sys/socket.h>
2586 struct addrinfo hints, *ai;
2589 memset(&hints, 0, sizeof(hints));
2590 hints.ai_flags = AI_NUMERICHOST;
2591 hints.ai_family = AF_UNSPEC;
2592 hints.ai_socktype = SOCK_STREAM;
2593 error = getaddrinfo("127.0.0.1", "8080", &hints, &ai);
2600 ac_cv_working_getaddrinfo="yes"
2602 ac_cv_working_getaddrinfo="no"
2604 ac_cv_working_getaddrinfo="yes"
2606 if test "$ac_cv_working_getaddrinfo" = "yes"; then
2607 AC_DEFINE(HAVE_GETADDRINFO, 1, [Define if getaddrinfo exists and works])
2608 AC_DEFINE(ENABLE_IPV6, 1, [Define if you want to enable IPv6 support])
2611 AC_SUBST(IPV6_ENABLED)
2616 AC_DEFUN([CURL_CHECK_LOCALTIME_R],
2618 dnl check for localtime_r
2619 AC_CHECK_FUNCS(localtime_r,[
2620 AC_MSG_CHECKING(whether localtime_r is declared)
2621 AC_EGREP_CPP(localtime_r,[
2623 #include <time.h>],[
2624 AC_MSG_RESULT(yes)],[
2626 AC_MSG_CHECKING(whether localtime_r with -D_REENTRANT is declared)
2627 AC_EGREP_CPP(localtime_r,[
2630 #include <time.h>],[
2631 AC_DEFINE(NEED_REENTRANT, 1, [need REENTRANT defined])
2632 AC_MSG_RESULT(yes)],
2633 AC_MSG_RESULT(no))])])
2637 dnl This function checks for strerror_r(). If it isn't found at first, it
2638 dnl retries with _THREAD_SAFE defined, as that is what AIX seems to require
2639 dnl in order to find this function.
2641 dnl If the function is found, it will then proceed to check how the function
2642 dnl actually works: glibc-style or POSIX-style.
2645 dnl char *strerror_r(int errnum, char *buf, size_t n);
2647 dnl What this one does is to return the error string (no surprises there),
2648 dnl but it doesn't usually copy anything into buf! The 'buf' and 'n'
2649 dnl parameters are only meant as an optional working area, in case strerror_r
2650 dnl needs it. A quick test on a few systems shows that it's generally not
2654 dnl int strerror_r(int errnum, char *buf, size_t n);
2656 AC_DEFUN([CURL_CHECK_STRERROR_R],
2658 AC_CHECK_FUNCS(strerror_r)
2660 if test "x$ac_cv_func_strerror_r" = "xyes"; then
2662 AC_MSG_CHECKING(whether strerror_r is declared)
2663 AC_EGREP_CPP(strerror_r,[
2665 #include <string.h>],[
2666 AC_MSG_RESULT(yes)],[
2668 AC_MSG_CHECKING(whether strerror_r with -D_REENTRANT is declared)
2669 AC_EGREP_CPP(strerror_r,[
2672 #include <string.h>],[
2673 AC_DEFINE(NEED_REENTRANT, 1, [need REENTRANT defined])
2674 AC_MSG_RESULT(yes)],
2676 AC_DEFINE(HAVE_NO_STRERROR_R_DECL, 1, [we have no strerror_r() proto])
2677 ) dnl with _THREAD_SAFE
2678 ]) dnl plain cpp for it
2680 dnl determine if this strerror_r() is glibc or POSIX
2681 AC_MSG_CHECKING([for a glibc strerror_r API])
2687 char buffer[1024]; /* big enough to play with */
2689 strerror_r(EACCES, buffer, sizeof(buffer));
2690 /* this should've returned a string */
2691 if(!string || !string[0])
2696 GLIBC_STRERROR_R="1"
2697 AC_DEFINE(HAVE_GLIBC_STRERROR_R, 1, [we have a glibc-style strerror_r()])
2698 AC_MSG_RESULT([yes]),
2699 AC_MSG_RESULT([no]),
2701 dnl Use an inferior method of strerror_r detection while cross-compiling
2703 #include <features.h>
2708 dnl looks like glibc, so assume a glibc-style strerror_r()
2709 GLIBC_STRERROR_R="1"
2710 AC_DEFINE(HAVE_GLIBC_STRERROR_R, 1, [we have a glibc-style strerror_r()])
2711 AC_MSG_RESULT([yes]),
2712 AC_MSG_NOTICE([cannot determine strerror_r() style: edit lib/config.h manually!])
2713 ) dnl while cross-compiling
2716 if test -z "$GLIBC_STRERROR_R"; then
2718 AC_MSG_CHECKING([for a POSIX strerror_r API])
2724 char buffer[1024]; /* big enough to play with */
2726 strerror_r(EACCES, buffer, sizeof(buffer));
2727 /* This should've returned zero, and written an error string in the
2729 if(!buffer[0] || error)
2734 AC_DEFINE(HAVE_POSIX_STRERROR_R, 1, [we have a POSIX-style strerror_r()])
2735 AC_MSG_RESULT([yes]),
2736 AC_MSG_RESULT([no]) ,
2737 dnl cross-compiling!
2738 AC_MSG_NOTICE([cannot determine strerror_r() style: edit lib/config.h manually!])
2741 fi dnl if not using glibc API
2743 fi dnl we have a strerror_r
2747 AC_DEFUN([CURL_CHECK_INET_NTOA_R],
2749 dnl determine if function definition for inet_ntoa_r exists.
2750 AC_CHECK_FUNCS(inet_ntoa_r,[
2751 AC_MSG_CHECKING(whether inet_ntoa_r is declared)
2752 AC_EGREP_CPP(inet_ntoa_r,[
2754 #include <arpa/inet.h>],[
2755 AC_DEFINE(HAVE_INET_NTOA_R_DECL, 1, [inet_ntoa_r() is declared])
2756 AC_MSG_RESULT(yes)],[
2758 AC_MSG_CHECKING(whether inet_ntoa_r with -D_REENTRANT is declared)
2759 AC_EGREP_CPP(inet_ntoa_r,[
2762 #include <arpa/inet.h>],[
2763 AC_DEFINE(HAVE_INET_NTOA_R_DECL, 1, [inet_ntoa_r() is declared])
2764 AC_DEFINE(NEED_REENTRANT, 1, [need REENTRANT defined])
2765 AC_MSG_RESULT(yes)],
2766 AC_MSG_RESULT(no))])])
2770 dnl CURL_CHECK_GETHOSTBYADDR_R
2771 dnl -------------------------------------------------
2772 dnl check number of arguments for gethostbyaddr_r, it
2773 dnl might take either 5, 7, or 8 arguments.
2775 AC_DEFUN([CURL_CHECK_GETHOSTBYADDR_R], [
2777 AC_MSG_CHECKING([for gethostbyaddr_r])
2779 AC_LANG_FUNC_LINK_TRY([gethostbyaddr_r])
2781 AC_MSG_RESULT([yes])
2782 tmp_cv_gethostbyaddr_r="yes"
2785 tmp_cv_gethostbyaddr_r="no"
2788 if test "$tmp_cv_gethostbyaddr_r" != "yes"; then
2789 AC_MSG_CHECKING([deeper for gethostbyaddr_r])
2796 AC_MSG_RESULT([yes])
2797 tmp_cv_gethostbyaddr_r="yes"
2799 AC_MSG_RESULT([but still no])
2800 tmp_cv_gethostbyaddr_r="no"
2804 if test "$tmp_cv_gethostbyaddr_r" = "yes"; then
2806 ac_cv_gethostbyaddr_r_args="unknown"
2808 AC_MSG_CHECKING([if gethostbyaddr_r takes 5 arguments])
2812 #include <sys/types.h>
2819 struct hostent_data hdata;
2821 rc = gethostbyaddr_r(address, length, type, &h, &hdata);
2824 AC_MSG_RESULT([yes])
2825 AC_DEFINE(HAVE_GETHOSTBYADDR_R_5, 1, [gethostbyaddr_r() takes 5 args])
2826 ac_cv_gethostbyaddr_r_args="5"
2831 if test "$ac_cv_gethostbyaddr_r_args" = "unknown"; then
2832 AC_MSG_CHECKING([if gethostbyaddr_r with -D_REENTRANT takes 5 arguments])
2837 #include <sys/types.h>
2844 struct hostent_data hdata;
2846 rc = gethostbyaddr_r(address, length, type, &h, &hdata);
2849 AC_MSG_RESULT([yes])
2850 AC_DEFINE(HAVE_GETHOSTBYADDR_R_5, 1, [gethostbyaddr_r() takes 5 args])
2851 AC_DEFINE(NEED_REENTRANT, 1, [need REENTRANT])
2852 ac_cv_gethostbyaddr_r_args="5"
2858 if test "$ac_cv_gethostbyaddr_r_args" = "unknown"; then
2859 AC_MSG_CHECKING([if gethostbyaddr_r takes 7 arguments])
2863 #include <sys/types.h>
2872 struct hostent * hp;
2873 hp = gethostbyaddr_r(address, length, type, &h,
2874 buffer, 8192, &h_errnop);
2877 AC_MSG_RESULT([yes])
2878 AC_DEFINE(HAVE_GETHOSTBYADDR_R_7, 1, [gethostbyaddr_r() takes 7 args])
2879 ac_cv_gethostbyaddr_r_args="7"
2885 if test "$ac_cv_gethostbyaddr_r_args" = "unknown"; then
2886 AC_MSG_CHECKING([if gethostbyaddr_r with -D_REENTRANT takes 7 arguments])
2891 #include <sys/types.h>
2900 struct hostent * hp;
2901 hp = gethostbyaddr_r(address, length, type, &h,
2902 buffer, 8192, &h_errnop);
2905 AC_MSG_RESULT([yes])
2906 AC_DEFINE(HAVE_GETHOSTBYADDR_R_7, 1, [gethostbyaddr_r() takes 7 args])
2907 AC_DEFINE(NEED_REENTRANT, 1, [need REENTRANT])
2908 ac_cv_gethostbyaddr_r_args="7"
2914 if test "$ac_cv_gethostbyaddr_r_args" = "unknown"; then
2915 AC_MSG_CHECKING([if gethostbyaddr_r takes 8 arguments])
2919 #include <sys/types.h>
2928 struct hostent * hp;
2930 rc = gethostbyaddr_r(address, length, type, &h,
2931 buffer, 8192, &hp, &h_errnop);
2934 AC_MSG_RESULT([yes])
2935 AC_DEFINE(HAVE_GETHOSTBYADDR_R_8, 1, [gethostbyaddr_r() takes 8 args])
2936 ac_cv_gethostbyaddr_r_args="8"
2942 if test "$ac_cv_gethostbyaddr_r_args" = "unknown"; then
2943 AC_MSG_CHECKING([if gethostbyaddr_r with -D_REENTRANT takes 8 arguments])
2948 #include <sys/types.h>
2957 struct hostent * hp;
2959 rc = gethostbyaddr_r(address, length, type, &h,
2960 buffer, 8192, &hp, &h_errnop);
2963 AC_MSG_RESULT([yes])
2964 AC_DEFINE(HAVE_GETHOSTBYADDR_R_8, 1, [gethostbyaddr_r() takes 8 args])
2965 AC_DEFINE(NEED_REENTRANT, 1, [need REENTRANT])
2966 ac_cv_gethostbyaddr_r_args="8"
2972 if test "$ac_cv_gethostbyaddr_r_args" = "unknown"; then
2973 AC_MSG_WARN([Cannot find out how to use gethostbyaddr_r])
2974 AC_MSG_WARN([HAVE_GETHOSTBYADDR_R will not be defined])
2975 ac_cv_func_gethostbyaddr_r="no"
2977 AC_DEFINE_UNQUOTED(HAVE_GETHOSTBYADDR_R, 1,
2978 [Define to 1 if you have the gethostbyaddr_r function.])
2979 ac_cv_func_gethostbyaddr_r="yes"
2983 ac_cv_func_gethostbyaddr_r="no"
2988 dnl CURL_CHECK_GETHOSTBYNAME_R
2989 dnl -------------------------------------------------
2990 dnl check number of arguments for gethostbyname_r, it
2991 dnl might take either 3, 5, or 6 arguments.
2993 AC_DEFUN([CURL_CHECK_GETHOSTBYNAME_R], [
2995 AC_MSG_CHECKING([for gethostbyname_r])
2997 AC_LANG_FUNC_LINK_TRY([gethostbyname_r])
2999 AC_MSG_RESULT([yes])
3000 tmp_cv_gethostbyname_r="yes"
3003 tmp_cv_gethostbyname_r="no"
3006 if test "$tmp_cv_gethostbyname_r" != "yes"; then
3007 AC_MSG_CHECKING([deeper for gethostbyname_r])
3014 AC_MSG_RESULT([yes])
3015 tmp_cv_gethostbyname_r="yes"
3017 AC_MSG_RESULT([but still no])
3018 tmp_cv_gethostbyname_r="no"
3022 if test "$tmp_cv_gethostbyname_r" = "yes"; then
3024 ac_cv_gethostbyname_r_args="unknown"
3026 AC_MSG_CHECKING([if gethostbyname_r takes 3 arguments])
3031 #include <sys/types.h>
3034 #define NULL (void *)0
3036 gethostbyname_r(const char *, struct hostent *,
3037 struct hostent_data *);
3039 struct hostent_data data;
3040 gethostbyname_r(NULL, NULL, NULL);
3043 AC_MSG_RESULT([yes])
3044 AC_DEFINE(HAVE_GETHOSTBYNAME_R_3, 1, [gethostbyname_r() takes 3 args])
3045 ac_cv_gethostbyname_r_args="3"
3050 if test "$ac_cv_gethostbyname_r_args" = "unknown"; then
3051 AC_MSG_CHECKING([if gethostbyname_r with -D_REENTRANT takes 3 arguments])
3057 #include <sys/types.h>
3060 #define NULL (void *)0
3062 gethostbyname_r(const char *, struct hostent *,
3063 struct hostent_data *);
3065 struct hostent_data data;
3066 gethostbyname_r(NULL, NULL, NULL);
3069 AC_MSG_RESULT([yes])
3070 AC_DEFINE(HAVE_GETHOSTBYNAME_R_3, 1, [gethostbyname_r() takes 3 args])
3071 AC_DEFINE(NEED_REENTRANT, 1, [need REENTRANT])
3072 ac_cv_gethostbyname_r_args="3"
3078 if test "$ac_cv_gethostbyname_r_args" = "unknown"; then
3079 AC_MSG_CHECKING([if gethostbyname_r takes 5 arguments])
3083 #include <sys/types.h>
3086 #define NULL (void *)0
3088 gethostbyname_r(const char *, struct hostent *,
3089 char *, int, int *);
3091 gethostbyname_r(NULL, NULL, NULL, 0, NULL);
3094 AC_MSG_RESULT([yes])
3095 AC_DEFINE(HAVE_GETHOSTBYNAME_R_5, 1, [gethostbyname_r() takes 5 args])
3096 ac_cv_gethostbyname_r_args="5"
3102 if test "$ac_cv_gethostbyname_r_args" = "unknown"; then
3103 AC_MSG_CHECKING([if gethostbyname_r with -D_REENTRANT takes 5 arguments])
3108 #include <sys/types.h>
3111 #define NULL (void *)0
3113 gethostbyname_r(const char *, struct hostent *,
3114 char *, int, int *);
3116 gethostbyname_r(NULL, NULL, NULL, 0, NULL);
3119 AC_MSG_RESULT([yes])
3120 AC_DEFINE(HAVE_GETHOSTBYNAME_R_5, 1, [gethostbyname_r() takes 5 args])
3121 AC_DEFINE(NEED_REENTRANT, 1, [need REENTRANT])
3122 ac_cv_gethostbyname_r_args="5"
3128 if test "$ac_cv_gethostbyname_r_args" = "unknown"; then
3129 AC_MSG_CHECKING([if gethostbyname_r takes 6 arguments])
3133 #include <sys/types.h>
3136 #define NULL (void *)0
3138 gethostbyname_r(const char *, struct hostent *,
3139 char *, size_t, struct hostent **, int *);
3141 gethostbyname_r(NULL, NULL, NULL, 0, NULL, NULL);
3144 AC_MSG_RESULT([yes])
3145 AC_DEFINE(HAVE_GETHOSTBYNAME_R_6, 1, [gethostbyname_r() takes 6 args])
3146 ac_cv_gethostbyname_r_args="6"
3152 if test "$ac_cv_gethostbyname_r_args" = "unknown"; then
3153 AC_MSG_CHECKING([if gethostbyname_r with -D_REENTRANT takes 6 arguments])
3158 #include <sys/types.h>
3161 #define NULL (void *)0
3163 gethostbyname_r(const char *, struct hostent *,
3164 char *, size_t, struct hostent **, int *);
3166 gethostbyname_r(NULL, NULL, NULL, 0, NULL, NULL);
3169 AC_MSG_RESULT([yes])
3170 AC_DEFINE(HAVE_GETHOSTBYNAME_R_6, 1, [gethostbyname_r() takes 6 args])
3171 AC_DEFINE(NEED_REENTRANT, 1, [need REENTRANT])
3172 ac_cv_gethostbyname_r_args="6"
3178 if test "$ac_cv_gethostbyname_r_args" = "unknown"; then
3179 AC_MSG_WARN([Cannot find out how to use gethostbyname_r])
3180 AC_MSG_WARN([HAVE_GETHOSTBYNAME_R will not be defined])
3181 ac_cv_func_gethostbyname_r="no"
3183 AC_DEFINE_UNQUOTED(HAVE_GETHOSTBYNAME_R, 1,
3184 [Define to 1 if you have the gethostbyname_r function.])
3185 ac_cv_func_gethostbyname_r="yes"
3189 ac_cv_func_gethostbyname_r="no"
3194 dnl **********************************************************************
3195 dnl CURL_DETECT_ICC ([ACTION-IF-YES])
3197 dnl check if this is the Intel ICC compiler, and if so run the ACTION-IF-YES
3198 dnl sets the $ICC variable to "yes" or "no"
3199 dnl **********************************************************************
3200 AC_DEFUN([CURL_DETECT_ICC],
3203 AC_MSG_CHECKING([for icc in use])
3204 if test "$GCC" = "yes"; then
3205 dnl check if this is icc acting as gcc in disguise
3206 AC_EGREP_CPP([^__INTEL_COMPILER], [__INTEL_COMPILER],
3207 dnl action if the text is found, this it has not been replaced by the
3210 dnl the text was not found, it was replaced by the cpp
3212 AC_MSG_RESULT([yes])
3216 if test "$ICC" = "no"; then
3222 dnl We create a function for detecting which compiler we use and then set as
3223 dnl pendantic compiler options as possible for that particular compiler. The
3224 dnl options are only used for debug-builds.
3226 AC_DEFUN([CURL_CC_DEBUG_OPTS],
3228 if test "z$ICC" = "z"; then
3232 if test "$GCC" = "yes"; then
3234 dnl figure out gcc version!
3235 AC_MSG_CHECKING([gcc version])
3236 gccver=`$CC -dumpversion`
3237 num1=`echo $gccver | cut -d . -f1`
3238 num2=`echo $gccver | cut -d . -f2`
3239 gccnum=`(expr $num1 "*" 100 + $num2) 2>/dev/null`
3240 AC_MSG_RESULT($gccver)
3242 if test "$ICC" = "yes"; then
3243 dnl this is icc, not gcc.
3245 dnl ICC warnings we ignore:
3246 dnl * 269 warns on our "%Od" printf formatters for curl_off_t output:
3247 dnl "invalid format string conversion"
3248 dnl * 279 warns on static conditions in while expressions
3249 dnl * 981 warns on "operands are evaluated in unspecified order"
3250 dnl * 1418 "external definition with no prior declaration"
3251 dnl * 1419 warns on "external declaration in primary source file"
3252 dnl which we know and do on purpose.
3254 WARN="-wd279,269,981,1418,1419"
3256 if test "$gccnum" -gt "600"; then
3257 dnl icc 6.0 and older doesn't have the -Wall flag
3261 dnl this is a set of options we believe *ALL* gcc versions support:
3262 WARN="-W -Wall -Wwrite-strings -pedantic -Wpointer-arith -Wnested-externs -Winline -Wmissing-prototypes"
3264 dnl -Wcast-align is a bit too annoying on all gcc versions ;-)
3266 if test "$gccnum" -ge "207"; then
3267 dnl gcc 2.7 or later
3268 WARN="$WARN -Wmissing-declarations"
3271 if test "$gccnum" -gt "295"; then
3272 dnl only if the compiler is newer than 2.95 since we got lots of
3273 dnl "`_POSIX_C_SOURCE' is not defined" in system headers with
3274 dnl gcc 2.95.4 on FreeBSD 4.9!
3275 WARN="$WARN -Wundef -Wno-long-long -Wsign-compare -Wshadow -Wno-multichar"
3278 if test "$gccnum" -ge "296"; then
3279 dnl gcc 2.96 or later
3280 WARN="$WARN -Wfloat-equal"
3283 if test "$gccnum" -gt "296"; then
3284 dnl this option does not exist in 2.96
3285 WARN="$WARN -Wno-format-nonliteral"
3288 dnl -Wunreachable-code seems totally unreliable on my gcc 3.3.2 on
3289 dnl on i686-Linux as it gives us heaps with false positives.
3290 dnl Also, on gcc 4.0.X it is totally unbearable and complains all
3291 dnl over making it unusable for generic purposes. Let's not use it.
3293 if test "$gccnum" -ge "303"; then
3294 dnl gcc 3.3 and later
3295 WARN="$WARN -Wendif-labels -Wstrict-prototypes"
3298 if test "$gccnum" -ge "304"; then
3299 # try these on gcc 3.4
3300 WARN="$WARN -Wdeclaration-after-statement"
3303 for flag in $CPPFLAGS; do
3306 dnl Include path, provide a -isystem option for the same dir
3307 dnl to prevent warnings in those dirs. The -isystem was not very
3308 dnl reliable on earlier gcc versions.
3309 add=`echo $flag | sed 's/^-I/-isystem /g'`
3317 CFLAGS="$CFLAGS $WARN"
3319 AC_MSG_NOTICE([Added this set of compiler options: $WARN])
3323 AC_MSG_NOTICE([Added no extra compiler options])
3327 dnl strip off optimizer flags
3329 for flag in $CFLAGS; do
3332 dnl echo "cut off $flag"
3335 NEWFLAGS="$NEWFLAGS $flag"
3341 ]) dnl end of AC_DEFUN()
3343 # This is only a temporary fix. This macro is here to replace the broken one
3344 # delivered by the automake project (including the 1.9.6 release). As soon as
3345 # they ship a working version we SHOULD remove this work-around.
3347 AC_DEFUN([AM_MISSING_HAS_RUN],
3348 [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
3349 test x"${MISSING+set}" = xset || MISSING="\${SHELL} \"$am_aux_dir/missing\""
3350 # Use eval to expand $SHELL
3351 if eval "$MISSING --run true"; then
3352 am_missing_run="$MISSING --run "
3355 AC_MSG_WARN([`missing' script is too old or missing])
3360 dnl CURL_VERIFY_RUNTIMELIBS
3361 dnl -------------------------------------------------
3362 dnl Verify that the shared libs found so far can be used when running
3363 dnl programs, since otherwise the situation will create odd configure errors
3364 dnl that are misleading people.
3366 dnl Make sure this test is run BEFORE the first test in the script that
3367 dnl runs anything, which at the time of this writing is the AC_CHECK_SIZEOF
3368 dnl macro. It must also run AFTER all lib-checking macros are complete.
3370 AC_DEFUN([CURL_VERIFY_RUNTIMELIBS], [
3372 dnl this test is of course not sensible if we are cross-compiling!
3373 if test "x$cross_compiling" != xyes; then
3375 dnl just run a program to verify that the libs checked for previous to this
3376 dnl point also is available run-time!
3377 AC_MSG_CHECKING([run-time libs availability])
3384 AC_MSG_RESULT([fine]),
3385 AC_MSG_RESULT([failed])
3386 AC_MSG_ERROR([one or more libs available at link-time are not available run-time. Libs used at link-time: $LIBS])
3389 dnl if this test fails, configure has already stopped
3394 dnl CURL_CHECK_VARIADIC_MACROS
3395 dnl -------------------------------------------------
3396 dnl Check compiler support of variadic macros
3398 AC_DEFUN([CURL_CHECK_VARIADIC_MACROS], [
3399 AC_CACHE_CHECK([for compiler support of C99 variadic macro style],
3400 [curl_cv_variadic_macros_c99], [
3403 #define c99_vmacro3(first, ...) fun3(first, __VA_ARGS__)
3404 #define c99_vmacro2(first, ...) fun2(first, __VA_ARGS__)
3405 int fun3(int arg1, int arg2, int arg3);
3406 int fun2(int arg1, int arg2);
3407 int fun3(int arg1, int arg2, int arg3)
3408 { return arg1 + arg2 + arg3; }
3409 int fun2(int arg1, int arg2)
3410 { return arg1 + arg2; }
3412 int res3 = c99_vmacro3(1, 2, 3);
3413 int res2 = c99_vmacro2(1, 2);
3416 curl_cv_variadic_macros_c99="yes"
3418 curl_cv_variadic_macros_c99="no"
3421 case "$curl_cv_variadic_macros_c99" in
3423 AC_DEFINE_UNQUOTED(HAVE_VARIADIC_MACROS_C99, 1,
3424 [Define to 1 if compiler supports C99 variadic macro style.])
3427 AC_CACHE_CHECK([for compiler support of old gcc variadic macro style],
3428 [curl_cv_variadic_macros_gcc], [
3431 #define gcc_vmacro3(first, args...) fun3(first, args)
3432 #define gcc_vmacro2(first, args...) fun2(first, args)
3433 int fun3(int arg1, int arg2, int arg3);
3434 int fun2(int arg1, int arg2);
3435 int fun3(int arg1, int arg2, int arg3)
3436 { return arg1 + arg2 + arg3; }
3437 int fun2(int arg1, int arg2)
3438 { return arg1 + arg2; }
3440 int res3 = gcc_vmacro3(1, 2, 3);
3441 int res2 = gcc_vmacro2(1, 2);
3444 curl_cv_variadic_macros_gcc="yes"
3446 curl_cv_variadic_macros_gcc="no"
3449 case "$curl_cv_variadic_macros_gcc" in
3451 AC_DEFINE_UNQUOTED(HAVE_VARIADIC_MACROS_GCC, 1,
3452 [Define to 1 if compiler supports old gcc variadic macro style.])
3458 dnl CURL_CHECK_CA_BUNDLE
3459 dnl -------------------------------------------------
3460 dnl Check if a default ca-bundle should be used
3462 dnl regarding the paths this will scan:
3463 dnl /etc/ssl/certs/ca-certificates.crt Debian systems
3464 dnl /etc/pki/tls/certs/ca-bundle.crt Redhat and Mandriva
3465 dnl /usr/share/ssl/certs/ca-bundle.crt old(er) Redhat
3466 dnl /etc/ssl/certs/ (ca path) SUSE
3468 AC_DEFUN([CURL_CHECK_CA_BUNDLE], [
3470 AC_MSG_CHECKING([default CA cert bundle/path])
3472 AC_ARG_WITH(ca-bundle,
3473 AC_HELP_STRING([--with-ca-bundle=FILE], [File name to use as CA bundle])
3474 AC_HELP_STRING([--without-ca-bundle], [Don't use a default CA bundle]),
3477 if test "x$want_ca" = "xyes"; then
3478 AC_MSG_ERROR([--with-ca-bundle=FILE requires a path to the CA bundle])
3481 [ want_ca="unset" ])
3482 AC_ARG_WITH(ca-path,
3483 AC_HELP_STRING([--with-ca-path=DIRECTORY], [Directory to use as CA path])
3484 AC_HELP_STRING([--without-ca-path], [Don't use a default CA path]),
3486 want_capath="$withval"
3487 if test "x$want_capath" = "xyes"; then
3488 AC_MSG_ERROR([--with-ca-path=DIRECTORY requires a path to the CA path directory])
3491 [ want_capath="unset"])
3493 if test "x$want_ca" != "xno" -a "x$want_ca" != "xunset" -a \
3494 "x$want_capath" != "xno" -a "x$want_capath" != "xunset"; then
3496 AC_MSG_ERROR([Can't specify both --with-ca-bundle and --with-ca-path.])
3497 elif test "x$want_ca" != "xno" -a "x$want_ca" != "xunset"; then
3498 dnl --with-ca-bundle given
3501 elif test "x$want_capath" != "xno" -a "x$want_capath" != "xunset"; then
3502 dnl --with-ca-path given
3503 if test "x$OPENSSL_ENABLED" != "x1"; then
3504 AC_MSG_ERROR([--with-ca-path only works with openSSL])
3506 capath="$want_capath"
3509 dnl neither of --with-ca-* given
3510 dnl first try autodetecting a CA bundle , then a CA path
3511 dnl both autodetections can be skipped by --without-ca-*
3514 if test "x$want_ca" = "xunset"; then
3515 dnl the path we previously would have installed the curl ca bundle
3516 dnl to, and thus we now check for an already existing cert in that place
3517 dnl in case we find no other
3518 if test "x$prefix" != xNONE; then
3519 cac="${prefix}/share/curl/curl-ca-bundle.crt"
3521 cac="$ac_default_prefix/share/curl/curl-ca-bundle.crt"
3524 for a in /etc/ssl/certs/ca-certificates.crt \
3525 /etc/pki/tls/certs/ca-bundle.crt \
3526 /usr/share/ssl/certs/ca-bundle.crt \
3528 if test -f "$a"; then
3534 if test "x$want_capath" = "xunset" -a "x$ca" = "xno" -a \
3535 "x$OPENSSL_ENABLED" = "x1"; then
3536 for a in /etc/ssl/certs/; do
3537 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
3547 if test "x$ca" != "xno"; then
3548 CURL_CA_BUNDLE='"'$ca'"'
3549 AC_DEFINE_UNQUOTED(CURL_CA_BUNDLE, "$ca", [Location of default ca bundle])
3550 AC_SUBST(CURL_CA_BUNDLE)
3551 AC_MSG_RESULT([$ca])
3552 elif test "x$capath" != "xno"; then
3553 CURL_CA_PATH="\"$capath\""
3554 AC_DEFINE_UNQUOTED(CURL_CA_PATH, "$capath", [Location of default ca path])
3555 AC_MSG_RESULT([$capath (capath)])