1 #***************************************************************************
3 # Project ___| | | | _ \| |
5 # | (__| |_| | _ <| |___
6 # \___|\___/|_| \_\_____|
8 # Copyright (C) 1998 - 2009, 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. If the expansion would
78 dnl result in a set of double-quoted strings the returned expansion will
79 dnl actually be a single double-quoted string concatenating all them.
81 AC_DEFUN([CURL_CHECK_DEF], [
82 AS_VAR_PUSHDEF([ac_HaveDef], [curl_cv_have_def_$1])dnl
83 AS_VAR_PUSHDEF([ac_Def], [curl_cv_def_$1])dnl
84 if test -z "$SED"; then
85 AC_MSG_ERROR([SED not set. Cannot continue without SED being set.])
87 if test -z "$GREP"; then
88 AC_MSG_ERROR([GREP not set. Cannot continue without GREP being set.])
90 ifelse($3,,[AC_MSG_CHECKING([for preprocessor definition of $1])])
100 tmp_exp=`eval "$ac_cpp conftest.$ac_ext" 2>/dev/null | \
101 "$GREP" CURL_DEF_TOKEN 2>/dev/null | \
102 "$SED" 's/.*CURL_DEF_TOKEN[[ ]]//' 2>/dev/null | \
103 "$SED" 's/[["]][[ ]]*[["]]//g' 2>/dev/null`
104 if test -z "$tmp_exp" || test "$tmp_exp" = "$1"; then
108 if test -z "$tmp_exp"; then
109 AS_VAR_SET(ac_HaveDef, no)
110 ifelse($3,,[AC_MSG_RESULT([no])])
112 AS_VAR_SET(ac_HaveDef, yes)
113 AS_VAR_SET(ac_Def, $tmp_exp)
114 ifelse($3,,[AC_MSG_RESULT([$tmp_exp])])
116 AS_VAR_POPDEF([ac_Def])dnl
117 AS_VAR_POPDEF([ac_HaveDef])dnl
121 dnl CURL_CHECK_DEF_CC (SYMBOL, [INCLUDES], [SILENT])
122 dnl -------------------------------------------------
123 dnl Use the C compiler to find out only if the given symbol is defined
124 dnl or not, this can not find out its expansion. This macro will not use
125 dnl default includes even if no INCLUDES argument is given. This macro
126 dnl will run silently when invoked with three arguments.
128 AC_DEFUN([CURL_CHECK_DEF_CC], [
129 AS_VAR_PUSHDEF([ac_HaveDef], [curl_cv_have_def_$1])dnl
130 ifelse($3,,[AC_MSG_CHECKING([for compiler definition of $1])])
139 force compilation error
144 tst_symbol_defined="yes"
146 tst_symbol_defined="no"
148 if test "$tst_symbol_defined" = "yes"; then
149 AS_VAR_SET(ac_HaveDef, yes)
150 ifelse($3,,[AC_MSG_RESULT([yes])])
152 AS_VAR_SET(ac_HaveDef, no)
153 ifelse($3,,[AC_MSG_RESULT([no])])
155 AS_VAR_POPDEF([ac_HaveDef])dnl
159 dnl CURL_CHECK_AIX_ALL_SOURCE
160 dnl -------------------------------------------------
161 dnl Provides a replacement of traditional AC_AIX with
162 dnl an uniform behaviour across all autoconf versions,
163 dnl and with our own placement rules.
165 AC_DEFUN([CURL_CHECK_AIX_ALL_SOURCE], [
166 AH_VERBATIM([_ALL_SOURCE],
167 [/* Define to 1 if OS is AIX. */
171 AC_BEFORE([$0], [AC_SYS_LARGEFILE])dnl
172 AC_BEFORE([$0], [CURL_CONFIGURE_REENTRANT])dnl
173 AC_MSG_CHECKING([if OS is AIX (to define _ALL_SOURCE)])
174 AC_EGREP_CPP([yes_this_is_aix],[
180 AC_DEFINE(_ALL_SOURCE)
187 dnl CURL_CHECK_HEADER_WINDOWS
188 dnl -------------------------------------------------
189 dnl Check for compilable and valid windows.h header
191 AC_DEFUN([CURL_CHECK_HEADER_WINDOWS], [
192 AC_CACHE_CHECK([for windows.h], [ac_cv_header_windows_h], [
196 #ifndef WIN32_LEAN_AND_MEAN
197 #define WIN32_LEAN_AND_MEAN
201 #if defined(__CYGWIN__) || defined(__CEGCC__)
202 HAVE_WINDOWS_H shall not be defined.
208 ac_cv_header_windows_h="yes"
210 ac_cv_header_windows_h="no"
213 case "$ac_cv_header_windows_h" in
215 AC_DEFINE_UNQUOTED(HAVE_WINDOWS_H, 1,
216 [Define to 1 if you have the windows.h header file.])
217 AC_DEFINE_UNQUOTED(WIN32_LEAN_AND_MEAN, 1,
218 [Define to avoid automatic inclusion of winsock.h])
224 dnl CURL_CHECK_NATIVE_WINDOWS
225 dnl -------------------------------------------------
226 dnl Check if building a native Windows target
228 AC_DEFUN([CURL_CHECK_NATIVE_WINDOWS], [
229 AC_REQUIRE([CURL_CHECK_HEADER_WINDOWS])dnl
230 AC_CACHE_CHECK([whether build target is a native Windows one], [ac_cv_native_windows], [
231 if test "$ac_cv_header_windows_h" = "no"; then
232 ac_cv_native_windows="no"
237 #if defined(__MINGW32__) || defined(__MINGW32CE__) || \
238 (defined(_MSC_VER) && (defined(_WIN32) || defined(_WIN64)))
241 Not a native Windows build target.
245 ac_cv_native_windows="yes"
247 ac_cv_native_windows="no"
251 case "$ac_cv_native_windows" in
253 AC_DEFINE_UNQUOTED(NATIVE_WINDOWS, 1,
254 [Define to 1 if you are building a native Windows target.])
260 dnl CURL_CHECK_HEADER_WINSOCK
261 dnl -------------------------------------------------
262 dnl Check for compilable and valid winsock.h header
264 AC_DEFUN([CURL_CHECK_HEADER_WINSOCK], [
265 AC_REQUIRE([CURL_CHECK_HEADER_WINDOWS])dnl
266 AC_CACHE_CHECK([for winsock.h], [ac_cv_header_winsock_h], [
270 #ifndef WIN32_LEAN_AND_MEAN
271 #define WIN32_LEAN_AND_MEAN
276 #if defined(__CYGWIN__) || defined(__CEGCC__)
277 HAVE_WINSOCK_H shall not be defined.
279 int dummy=WSACleanup();
283 ac_cv_header_winsock_h="yes"
285 ac_cv_header_winsock_h="no"
288 case "$ac_cv_header_winsock_h" in
290 AC_DEFINE_UNQUOTED(HAVE_WINSOCK_H, 1,
291 [Define to 1 if you have the winsock.h header file.])
297 dnl CURL_CHECK_HEADER_WINSOCK2
298 dnl -------------------------------------------------
299 dnl Check for compilable and valid winsock2.h header
301 AC_DEFUN([CURL_CHECK_HEADER_WINSOCK2], [
302 AC_REQUIRE([CURL_CHECK_HEADER_WINDOWS])dnl
303 AC_CACHE_CHECK([for winsock2.h], [ac_cv_header_winsock2_h], [
307 #ifndef WIN32_LEAN_AND_MEAN
308 #define WIN32_LEAN_AND_MEAN
311 #include <winsock2.h>
313 #if defined(__CYGWIN__) || defined(__CEGCC__) || defined(__MINGW32CE__)
314 HAVE_WINSOCK2_H shall not be defined.
316 int dummy=2*IPPROTO_ESP;
320 ac_cv_header_winsock2_h="yes"
322 ac_cv_header_winsock2_h="no"
325 case "$ac_cv_header_winsock2_h" in
327 AC_DEFINE_UNQUOTED(HAVE_WINSOCK2_H, 1,
328 [Define to 1 if you have the winsock2.h header file.])
334 dnl CURL_CHECK_HEADER_WS2TCPIP
335 dnl -------------------------------------------------
336 dnl Check for compilable and valid ws2tcpip.h header
338 AC_DEFUN([CURL_CHECK_HEADER_WS2TCPIP], [
339 AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK2])dnl
340 AC_CACHE_CHECK([for ws2tcpip.h], [ac_cv_header_ws2tcpip_h], [
344 #ifndef WIN32_LEAN_AND_MEAN
345 #define WIN32_LEAN_AND_MEAN
348 #include <winsock2.h>
349 #include <ws2tcpip.h>
351 #if defined(__CYGWIN__) || defined(__CEGCC__) || defined(__MINGW32CE__)
352 HAVE_WS2TCPIP_H shall not be defined.
354 int dummy=2*IP_PKTINFO;
358 ac_cv_header_ws2tcpip_h="yes"
360 ac_cv_header_ws2tcpip_h="no"
363 case "$ac_cv_header_ws2tcpip_h" in
365 AC_DEFINE_UNQUOTED(HAVE_WS2TCPIP_H, 1,
366 [Define to 1 if you have the ws2tcpip.h header file.])
372 dnl CURL_CHECK_HEADER_WINLDAP
373 dnl -------------------------------------------------
374 dnl Check for compilable and valid winldap.h header
376 AC_DEFUN([CURL_CHECK_HEADER_WINLDAP], [
377 AC_REQUIRE([CURL_CHECK_HEADER_WINDOWS])dnl
378 AC_CACHE_CHECK([for winldap.h], [ac_cv_header_winldap_h], [
382 #ifdef HAVE_WINDOWS_H
383 #ifndef WIN32_LEAN_AND_MEAN
384 #define WIN32_LEAN_AND_MEAN
390 #if defined(__CYGWIN__) || defined(__CEGCC__)
391 HAVE_WINLDAP_H shall not be defined.
393 LDAP *ldp = ldap_init("dummy", LDAP_PORT);
394 ULONG res = ldap_unbind(ldp);
398 ac_cv_header_winldap_h="yes"
400 ac_cv_header_winldap_h="no"
403 case "$ac_cv_header_winldap_h" in
405 AC_DEFINE_UNQUOTED(HAVE_WINLDAP_H, 1,
406 [Define to 1 if you have the winldap.h header file.])
412 dnl CURL_CHECK_HEADER_WINBER
413 dnl -------------------------------------------------
414 dnl Check for compilable and valid winber.h header
416 AC_DEFUN([CURL_CHECK_HEADER_WINBER], [
417 AC_REQUIRE([CURL_CHECK_HEADER_WINLDAP])dnl
418 AC_CACHE_CHECK([for winber.h], [ac_cv_header_winber_h], [
422 #ifdef HAVE_WINDOWS_H
423 #ifndef WIN32_LEAN_AND_MEAN
424 #define WIN32_LEAN_AND_MEAN
431 #if defined(__CYGWIN__) || defined(__CEGCC__)
432 HAVE_WINBER_H shall not be defined.
435 BerElement *bep = ber_init(bvp);
440 ac_cv_header_winber_h="yes"
442 ac_cv_header_winber_h="no"
445 case "$ac_cv_header_winber_h" in
447 AC_DEFINE_UNQUOTED(HAVE_WINBER_H, 1,
448 [Define to 1 if you have the winber.h header file.])
454 dnl CURL_CHECK_HEADER_LBER
455 dnl -------------------------------------------------
456 dnl Check for compilable and valid lber.h header,
457 dnl and check if it is needed even with ldap.h
459 AC_DEFUN([CURL_CHECK_HEADER_LBER], [
460 AC_REQUIRE([CURL_CHECK_HEADER_WINDOWS])dnl
461 AC_CACHE_CHECK([for lber.h], [ac_cv_header_lber_h], [
465 #ifdef HAVE_WINDOWS_H
466 #ifndef WIN32_LEAN_AND_MEAN
467 #define WIN32_LEAN_AND_MEAN
471 #ifdef HAVE_SYS_TYPES_H
472 #include <sys/types.h>
476 #define NULL (void *)0
480 BerValue *bvp = NULL;
481 BerElement *bep = ber_init(bvp);
485 ac_cv_header_lber_h="yes"
487 ac_cv_header_lber_h="no"
490 if test "$ac_cv_header_lber_h" = "yes"; then
491 AC_DEFINE_UNQUOTED(HAVE_LBER_H, 1,
492 [Define to 1 if you have the lber.h header file.])
497 #ifdef HAVE_WINDOWS_H
498 #ifndef WIN32_LEAN_AND_MEAN
499 #define WIN32_LEAN_AND_MEAN
503 #ifdef HAVE_SYS_TYPES_H
504 #include <sys/types.h>
508 #define NULL (void *)0
510 #ifndef LDAP_DEPRECATED
511 #define LDAP_DEPRECATED 1
515 BerValue *bvp = NULL;
516 BerElement *bep = ber_init(bvp);
520 curl_cv_need_header_lber_h="no"
522 curl_cv_need_header_lber_h="yes"
525 case "$curl_cv_need_header_lber_h" in
527 AC_DEFINE_UNQUOTED(NEED_LBER_H, 1,
528 [Define to 1 if you need the lber.h header file even with ldap.h])
535 dnl CURL_CHECK_HEADER_LDAP
536 dnl -------------------------------------------------
537 dnl Check for compilable and valid ldap.h header
539 AC_DEFUN([CURL_CHECK_HEADER_LDAP], [
540 AC_REQUIRE([CURL_CHECK_HEADER_LBER])dnl
541 AC_CACHE_CHECK([for ldap.h], [ac_cv_header_ldap_h], [
545 #ifdef HAVE_WINDOWS_H
546 #ifndef WIN32_LEAN_AND_MEAN
547 #define WIN32_LEAN_AND_MEAN
551 #ifdef HAVE_SYS_TYPES_H
552 #include <sys/types.h>
555 #ifndef LDAP_DEPRECATED
556 #define LDAP_DEPRECATED 1
563 LDAP *ldp = ldap_init("dummy", LDAP_PORT);
564 int res = ldap_unbind(ldp);
567 ac_cv_header_ldap_h="yes"
569 ac_cv_header_ldap_h="no"
572 case "$ac_cv_header_ldap_h" in
574 AC_DEFINE_UNQUOTED(HAVE_LDAP_H, 1,
575 [Define to 1 if you have the ldap.h header file.])
581 dnl CURL_CHECK_HEADER_LDAP_SSL
582 dnl -------------------------------------------------
583 dnl Check for compilable and valid ldap_ssl.h header
585 AC_DEFUN([CURL_CHECK_HEADER_LDAP_SSL], [
586 AC_REQUIRE([CURL_CHECK_HEADER_LDAP])dnl
587 AC_CACHE_CHECK([for ldap_ssl.h], [ac_cv_header_ldap_ssl_h], [
591 #ifdef HAVE_WINDOWS_H
592 #ifndef WIN32_LEAN_AND_MEAN
593 #define WIN32_LEAN_AND_MEAN
597 #ifdef HAVE_SYS_TYPES_H
598 #include <sys/types.h>
601 #ifndef LDAP_DEPRECATED
602 #define LDAP_DEPRECATED 1
610 #include <ldap_ssl.h>
612 LDAP *ldp = ldapssl_init("dummy", LDAPS_PORT, 1);
615 ac_cv_header_ldap_ssl_h="yes"
617 ac_cv_header_ldap_ssl_h="no"
620 case "$ac_cv_header_ldap_ssl_h" in
622 AC_DEFINE_UNQUOTED(HAVE_LDAP_SSL_H, 1,
623 [Define to 1 if you have the ldap_ssl.h header file.])
629 dnl CURL_CHECK_HEADER_LDAPSSL
630 dnl -------------------------------------------------
631 dnl Check for compilable and valid ldapssl.h header
633 AC_DEFUN([CURL_CHECK_HEADER_LDAPSSL], [
634 AC_REQUIRE([CURL_CHECK_HEADER_LDAP])dnl
635 AC_CACHE_CHECK([for ldapssl.h], [ac_cv_header_ldapssl_h], [
639 #ifdef HAVE_WINDOWS_H
640 #ifndef WIN32_LEAN_AND_MEAN
641 #define WIN32_LEAN_AND_MEAN
645 #ifdef HAVE_SYS_TYPES_H
646 #include <sys/types.h>
650 #define NULL (void *)0
652 #ifndef LDAP_DEPRECATED
653 #define LDAP_DEPRECATED 1
663 char *cert_label = NULL;
664 LDAP *ldp = ldap_ssl_init("dummy", LDAPS_PORT, cert_label);
667 ac_cv_header_ldapssl_h="yes"
669 ac_cv_header_ldapssl_h="no"
672 case "$ac_cv_header_ldapssl_h" in
674 AC_DEFINE_UNQUOTED(HAVE_LDAPSSL_H, 1,
675 [Define to 1 if you have the ldapssl.h header file.])
681 dnl CURL_CHECK_LIBS_WINLDAP
682 dnl -------------------------------------------------
683 dnl Check for libraries needed for WINLDAP support,
684 dnl and prepended to LIBS any needed libraries.
685 dnl This macro can take an optional parameter with a
686 dnl white space separated list of libraries to check
687 dnl before the WINLDAP default ones.
689 AC_DEFUN([CURL_CHECK_LIBS_WINLDAP], [
690 AC_REQUIRE([CURL_CHECK_HEADER_WINBER])dnl
692 AC_MSG_CHECKING([for WINLDAP libraries])
706 if test -z "$u_libs"; then
709 u_libs="$u_libs $l_lib"
714 curl_cv_save_LIBS="$LIBS"
715 curl_cv_ldap_LIBS="unknown"
717 for x_nlibs in '' "$u_libs" \
719 if test "$curl_cv_ldap_LIBS" = "unknown"; then
720 if test -z "$x_nlibs"; then
721 LIBS="$curl_cv_save_LIBS"
723 LIBS="$x_nlibs $curl_cv_save_LIBS"
728 #ifdef HAVE_WINDOWS_H
729 #ifndef WIN32_LEAN_AND_MEAN
730 #define WIN32_LEAN_AND_MEAN
733 #ifdef HAVE_WINLDAP_H
742 BerElement *bep = ber_init(bvp);
743 LDAP *ldp = ldap_init("dummy", LDAP_PORT);
744 ULONG res = ldap_unbind(ldp);
748 curl_cv_ldap_LIBS="$x_nlibs"
753 LIBS="$curl_cv_save_LIBS"
755 case X-"$curl_cv_ldap_LIBS" in
757 AC_MSG_RESULT([cannot find WINLDAP libraries])
760 AC_MSG_RESULT([no additional lib required])
763 if test -z "$curl_cv_save_LIBS"; then
764 LIBS="$curl_cv_ldap_LIBS"
766 LIBS="$curl_cv_ldap_LIBS $curl_cv_save_LIBS"
768 AC_MSG_RESULT([$curl_cv_ldap_LIBS])
775 dnl CURL_CHECK_LIBS_LDAP
776 dnl -------------------------------------------------
777 dnl Check for libraries needed for LDAP support,
778 dnl and prepended to LIBS any needed libraries.
779 dnl This macro can take an optional parameter with a
780 dnl white space separated list of libraries to check
781 dnl before the default ones.
783 AC_DEFUN([CURL_CHECK_LIBS_LDAP], [
784 AC_REQUIRE([CURL_CHECK_HEADER_LDAP])dnl
786 AC_MSG_CHECKING([for LDAP libraries])
800 if test -z "$u_libs"; then
803 u_libs="$u_libs $l_lib"
808 curl_cv_save_LIBS="$LIBS"
809 curl_cv_ldap_LIBS="unknown"
811 for x_nlibs in '' "$u_libs" \
815 '-lldapssl -lldapx -lldapsdk' \
816 '-lldapsdk -lldapx -lldapssl' ; do
817 if test "$curl_cv_ldap_LIBS" = "unknown"; then
818 if test -z "$x_nlibs"; then
819 LIBS="$curl_cv_save_LIBS"
821 LIBS="$x_nlibs $curl_cv_save_LIBS"
826 #ifdef HAVE_WINDOWS_H
827 #ifndef WIN32_LEAN_AND_MEAN
828 #define WIN32_LEAN_AND_MEAN
832 #ifdef HAVE_SYS_TYPES_H
833 #include <sys/types.h>
837 #define NULL (void *)0
839 #ifndef LDAP_DEPRECATED
840 #define LDAP_DEPRECATED 1
849 BerValue *bvp = NULL;
850 BerElement *bep = ber_init(bvp);
851 LDAP *ldp = ldap_init("dummy", LDAP_PORT);
852 int res = ldap_unbind(ldp);
856 curl_cv_ldap_LIBS="$x_nlibs"
861 LIBS="$curl_cv_save_LIBS"
863 case X-"$curl_cv_ldap_LIBS" in
865 AC_MSG_RESULT([cannot find LDAP libraries])
868 AC_MSG_RESULT([no additional lib required])
871 if test -z "$curl_cv_save_LIBS"; then
872 LIBS="$curl_cv_ldap_LIBS"
874 LIBS="$curl_cv_ldap_LIBS $curl_cv_save_LIBS"
876 AC_MSG_RESULT([$curl_cv_ldap_LIBS])
883 dnl CURL_CHECK_HEADER_MALLOC
884 dnl -------------------------------------------------
885 dnl Check for compilable and valid malloc.h header,
886 dnl and check if it is needed even with stdlib.h
888 AC_DEFUN([CURL_CHECK_HEADER_MALLOC], [
889 AC_CACHE_CHECK([for malloc.h], [ac_cv_header_malloc_h], [
894 void *p = malloc(10);
895 void *q = calloc(10,10);
900 ac_cv_header_malloc_h="yes"
902 ac_cv_header_malloc_h="no"
905 if test "$ac_cv_header_malloc_h" = "yes"; then
906 AC_DEFINE_UNQUOTED(HAVE_MALLOC_H, 1,
907 [Define to 1 if you have the malloc.h header file.])
913 void *p = malloc(10);
914 void *q = calloc(10,10);
919 curl_cv_need_header_malloc_h="no"
921 curl_cv_need_header_malloc_h="yes"
924 case "$curl_cv_need_header_malloc_h" in
926 AC_DEFINE_UNQUOTED(NEED_MALLOC_H, 1,
927 [Define to 1 if you need the malloc.h header file even with stdlib.h])
934 dnl CURL_CHECK_HEADER_MEMORY
935 dnl -------------------------------------------------
936 dnl Check for compilable and valid memory.h header,
937 dnl and check if it is needed even with stdlib.h for
938 dnl memory related functions.
940 AC_DEFUN([CURL_CHECK_HEADER_MEMORY], [
941 AC_CACHE_CHECK([for memory.h], [ac_cv_header_memory_h], [
946 void *p = malloc(10);
947 void *q = calloc(10,10);
952 ac_cv_header_memory_h="yes"
954 ac_cv_header_memory_h="no"
957 if test "$ac_cv_header_memory_h" = "yes"; then
958 AC_DEFINE_UNQUOTED(HAVE_MEMORY_H, 1,
959 [Define to 1 if you have the memory.h header file.])
965 void *p = malloc(10);
966 void *q = calloc(10,10);
971 curl_cv_need_header_memory_h="no"
973 curl_cv_need_header_memory_h="yes"
976 case "$curl_cv_need_header_memory_h" in
978 AC_DEFINE_UNQUOTED(NEED_MEMORY_H, 1,
979 [Define to 1 if you need the memory.h header file even with stdlib.h])
986 dnl CURL_CHECK_TYPE_SOCKLEN_T
987 dnl -------------------------------------------------
988 dnl Check for existing socklen_t type, and provide
989 dnl an equivalent type if socklen_t not available
991 AC_DEFUN([CURL_CHECK_TYPE_SOCKLEN_T], [
992 AC_REQUIRE([CURL_CHECK_HEADER_WS2TCPIP])dnl
993 AC_CHECK_TYPE([socklen_t], ,[
994 dnl socklen_t not available
995 AC_CACHE_CHECK([for socklen_t equivalent],
996 [curl_cv_socklen_t_equiv], [
997 curl_cv_socklen_t_equiv="unknown"
998 for arg1 in 'int' 'SOCKET'; do
999 for arg2 in "struct sockaddr" void; do
1000 for t in int size_t unsigned long "unsigned long"; do
1001 if test "$curl_cv_socklen_t_equiv" = "unknown"; then
1005 #ifdef HAVE_WINDOWS_H
1006 #ifndef WIN32_LEAN_AND_MEAN
1007 #define WIN32_LEAN_AND_MEAN
1009 #include <windows.h>
1010 #ifdef HAVE_WINSOCK2_H
1011 #include <winsock2.h>
1013 #ifdef HAVE_WINSOCK_H
1014 #include <winsock.h>
1017 #define GETPEERNCALLCONV PASCAL
1019 #ifdef HAVE_SYS_TYPES_H
1020 #include <sys/types.h>
1022 #ifdef HAVE_SYS_SOCKET_H
1023 #include <sys/socket.h>
1025 #define GETPEERNCALLCONV
1027 extern int GETPEERNCALLCONV getpeername($arg1, $arg2 *, $t *);
1030 getpeername(0,0,&len);
1033 curl_cv_socklen_t_equiv="$t"
1040 case "$curl_cv_socklen_t_equiv" in
1042 AC_MSG_ERROR([Cannot find a type to use in place of socklen_t])
1045 AC_DEFINE_UNQUOTED(socklen_t, $curl_cv_socklen_t_equiv,
1046 [Type to use in place of socklen_t when system does not provide it.])
1051 #ifdef HAVE_WINDOWS_H
1052 #ifndef WIN32_LEAN_AND_MEAN
1053 #define WIN32_LEAN_AND_MEAN
1055 #include <windows.h>
1056 #ifdef HAVE_WINSOCK2_H
1057 #include <winsock2.h>
1058 #ifdef HAVE_WS2TCPIP_H
1059 #include <ws2tcpip.h>
1063 #ifdef HAVE_SYS_TYPES_H
1064 #include <sys/types.h>
1066 #ifdef HAVE_SYS_SOCKET_H
1067 #include <sys/socket.h>
1074 dnl CURL_CHECK_FUNC_GETNAMEINFO
1075 dnl -------------------------------------------------
1076 dnl Test if the getnameinfo function is available,
1077 dnl and check the types of five of its arguments.
1078 dnl If the function succeeds HAVE_GETNAMEINFO will be
1079 dnl defined, defining the types of the arguments in
1080 dnl GETNAMEINFO_TYPE_ARG1, GETNAMEINFO_TYPE_ARG2,
1081 dnl GETNAMEINFO_TYPE_ARG46 and GETNAMEINFO_TYPE_ARG7,
1082 dnl and also defining the type qualifier of first
1083 dnl argument in GETNAMEINFO_QUAL_ARG1.
1085 AC_DEFUN([CURL_CHECK_FUNC_GETNAMEINFO], [
1086 AC_REQUIRE([CURL_CHECK_HEADER_WS2TCPIP])dnl
1087 AC_REQUIRE([CURL_CHECK_TYPE_SOCKLEN_T])dnl
1088 AC_CHECK_HEADERS(sys/types.h sys/socket.h netdb.h)
1090 AC_MSG_CHECKING([for getnameinfo])
1092 AC_LANG_FUNC_LINK_TRY([getnameinfo])
1094 AC_MSG_RESULT([yes])
1095 curl_cv_getnameinfo="yes"
1098 curl_cv_getnameinfo="no"
1101 if test "$curl_cv_getnameinfo" != "yes"; then
1102 AC_MSG_CHECKING([deeper for getnameinfo])
1109 AC_MSG_RESULT([yes])
1110 curl_cv_getnameinfo="yes"
1112 AC_MSG_RESULT([but still no])
1113 curl_cv_getnameinfo="no"
1117 if test "$curl_cv_getnameinfo" != "yes"; then
1118 AC_MSG_CHECKING([deeper and deeper for getnameinfo])
1122 #ifdef HAVE_WINDOWS_H
1123 #ifndef WIN32_LEAN_AND_MEAN
1124 #define WIN32_LEAN_AND_MEAN
1126 #include <windows.h>
1127 #ifdef HAVE_WINSOCK2_H
1128 #include <winsock2.h>
1129 #ifdef HAVE_WS2TCPIP_H
1130 #include <ws2tcpip.h>
1134 #ifdef HAVE_SYS_TYPES_H
1135 #include <sys/types.h>
1137 #ifdef HAVE_SYS_SOCKET_H
1138 #include <sys/socket.h>
1145 getnameinfo(0, 0, 0, 0, 0, 0, 0);
1148 AC_MSG_RESULT([yes])
1149 curl_cv_getnameinfo="yes"
1151 AC_MSG_RESULT([but still no])
1152 curl_cv_getnameinfo="no"
1156 if test "$curl_cv_getnameinfo" = "yes"; then
1157 AC_CACHE_CHECK([types of arguments for getnameinfo],
1158 [curl_cv_func_getnameinfo_args], [
1159 curl_cv_func_getnameinfo_args="unknown"
1160 for gni_arg1 in 'struct sockaddr *' 'const struct sockaddr *' 'void *'; do
1161 for gni_arg2 in 'socklen_t' 'size_t' 'int'; do
1162 for gni_arg46 in 'size_t' 'int' 'socklen_t' 'unsigned int' 'DWORD'; do
1163 for gni_arg7 in 'int' 'unsigned int'; do
1164 if test "$curl_cv_func_getnameinfo_args" = "unknown"; then
1168 #ifdef HAVE_WINDOWS_H
1169 #ifndef WIN32_LEAN_AND_MEAN
1170 #define WIN32_LEAN_AND_MEAN
1172 #if (!defined(_WIN32_WINNT)) || (_WIN32_WINNT < 0x0501)
1174 #define _WIN32_WINNT 0x0501
1176 #include <windows.h>
1177 #ifdef HAVE_WINSOCK2_H
1178 #include <winsock2.h>
1179 #ifdef HAVE_WS2TCPIP_H
1180 #include <ws2tcpip.h>
1183 #define GNICALLCONV WSAAPI
1185 #ifdef HAVE_SYS_TYPES_H
1186 #include <sys/types.h>
1188 #ifdef HAVE_SYS_SOCKET_H
1189 #include <sys/socket.h>
1196 extern int GNICALLCONV getnameinfo($gni_arg1, $gni_arg2,
1202 $gni_arg46 hostlen=0;
1203 $gni_arg46 servlen=0;
1205 int res = getnameinfo(0, salen, 0, hostlen, 0, servlen, flags);
1208 curl_cv_func_getnameinfo_args="$gni_arg1,$gni_arg2,$gni_arg46,$gni_arg7"
1216 if test "$curl_cv_func_getnameinfo_args" = "unknown"; then
1217 AC_MSG_WARN([Cannot find proper types to use for getnameinfo args])
1218 AC_MSG_WARN([HAVE_GETNAMEINFO will not be defined])
1220 gni_prev_IFS=$IFS; IFS=','
1221 set dummy `echo "$curl_cv_func_getnameinfo_args" | sed 's/\*/\*/g'`
1225 gni_qual_type_arg1=$[1]
1227 AC_DEFINE_UNQUOTED(GETNAMEINFO_TYPE_ARG2, $[2],
1228 [Define to the type of arg 2 for getnameinfo.])
1229 AC_DEFINE_UNQUOTED(GETNAMEINFO_TYPE_ARG46, $[3],
1230 [Define to the type of args 4 and 6 for getnameinfo.])
1231 AC_DEFINE_UNQUOTED(GETNAMEINFO_TYPE_ARG7, $[4],
1232 [Define to the type of arg 7 for getnameinfo.])
1236 case $prev_sh_opts in
1244 case "$gni_qual_type_arg1" in
1247 gni_type_arg1=`echo $gni_qual_type_arg1 | sed 's/^const //'`
1251 gni_type_arg1=$gni_qual_type_arg1
1255 AC_DEFINE_UNQUOTED(GETNAMEINFO_QUAL_ARG1, $gni_qual_arg1,
1256 [Define to the type qualifier of arg 1 for getnameinfo.])
1257 AC_DEFINE_UNQUOTED(GETNAMEINFO_TYPE_ARG1, $gni_type_arg1,
1258 [Define to the type of arg 1 for getnameinfo.])
1260 case $prev_sh_opts in
1268 AC_DEFINE_UNQUOTED(HAVE_GETNAMEINFO, 1,
1269 [Define to 1 if you have the getnameinfo function.])
1270 ac_cv_func_getnameinfo="yes"
1276 dnl TYPE_SOCKADDR_STORAGE
1277 dnl -------------------------------------------------
1278 dnl Check for struct sockaddr_storage. Most IPv6-enabled
1279 dnl hosts have it, but AIX 4.3 is one known exception.
1281 AC_DEFUN([TYPE_SOCKADDR_STORAGE],
1283 AC_CHECK_TYPE([struct sockaddr_storage],
1284 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE, 1,
1285 [if struct sockaddr_storage is defined]), ,
1288 #ifdef HAVE_WINDOWS_H
1289 #ifndef WIN32_LEAN_AND_MEAN
1290 #define WIN32_LEAN_AND_MEAN
1292 #include <windows.h>
1293 #ifdef HAVE_WINSOCK2_H
1294 #include <winsock2.h>
1297 #ifdef HAVE_SYS_TYPES_H
1298 #include <sys/types.h>
1300 #ifdef HAVE_SYS_SOCKET_H
1301 #include <sys/socket.h>
1303 #ifdef HAVE_NETINET_IN_H
1304 #include <netinet/in.h>
1306 #ifdef HAVE_ARPA_INET_H
1307 #include <arpa/inet.h>
1314 dnl CURL_CHECK_NI_WITHSCOPEID
1315 dnl -------------------------------------------------
1316 dnl Check for working NI_WITHSCOPEID in getnameinfo()
1318 AC_DEFUN([CURL_CHECK_NI_WITHSCOPEID], [
1319 AC_REQUIRE([CURL_CHECK_FUNC_GETNAMEINFO])dnl
1320 AC_REQUIRE([TYPE_SOCKADDR_STORAGE])dnl
1321 AC_CHECK_HEADERS(stdio.h sys/types.h sys/socket.h \
1322 netdb.h netinet/in.h arpa/inet.h)
1324 AC_CACHE_CHECK([for working NI_WITHSCOPEID],
1325 [ac_cv_working_ni_withscopeid], [
1328 #ifdef HAVE_STDLIB_H
1334 #ifdef HAVE_SYS_TYPES_H
1335 #include <sys/types.h>
1337 #ifdef HAVE_SYS_SOCKET_H
1338 #include <sys/socket.h>
1343 #ifdef HAVE_NETINET_IN_H
1344 #include <netinet/in.h>
1346 #ifdef HAVE_ARPA_INET_H
1347 #include <arpa/inet.h>
1350 #if defined(NI_WITHSCOPEID) && defined(HAVE_GETNAMEINFO)
1351 #ifdef HAVE_STRUCT_SOCKADDR_STORAGE
1352 struct sockaddr_storage sa;
1354 unsigned char sa[256];
1356 char hostbuf[NI_MAXHOST];
1358 GETNAMEINFO_TYPE_ARG2 salen = (GETNAMEINFO_TYPE_ARG2)sizeof(sa);
1359 GETNAMEINFO_TYPE_ARG46 hostlen = (GETNAMEINFO_TYPE_ARG46)sizeof(hostbuf);
1360 GETNAMEINFO_TYPE_ARG7 flags = NI_NUMERICHOST | NI_NUMERICSERV | NI_WITHSCOPEID;
1361 int fd = socket(AF_INET6, SOCK_STREAM, 0);
1364 return 1; /* Error creating socket */
1366 rc = getsockname(fd, (GETNAMEINFO_TYPE_ARG1)&sa, &salen);
1368 perror("getsockname()");
1369 return 2; /* Error retrieving socket name */
1371 rc = getnameinfo((GETNAMEINFO_TYPE_ARG1)&sa, salen, hostbuf, hostlen, NULL, 0, flags);
1373 printf("rc = %s\n", gai_strerror(rc));
1374 return 3; /* Error translating socket address */
1376 return 0; /* Ok, NI_WITHSCOPEID works */
1378 return 4; /* Error, NI_WITHSCOPEID not defined or no getnameinfo() */
1380 ]]) # AC-LANG-PROGRAM
1382 # Exit code == 0. Program worked.
1383 ac_cv_working_ni_withscopeid="yes"
1385 # Exit code != 0. Program failed.
1386 ac_cv_working_ni_withscopeid="no"
1388 # Program is not run when cross-compiling. So we assume
1389 # NI_WITHSCOPEID will work if we are able to compile it.
1392 #include <sys/types.h>
1393 #include <sys/socket.h>
1396 unsigned int dummy= NI_NUMERICHOST | NI_NUMERICSERV | NI_WITHSCOPEID;
1399 ac_cv_working_ni_withscopeid="yes"
1401 ac_cv_working_ni_withscopeid="no"
1402 ]) # AC-COMPILE-IFELSE
1405 case "$ac_cv_working_ni_withscopeid" in
1407 AC_DEFINE(HAVE_NI_WITHSCOPEID, 1,
1408 [Define to 1 if NI_WITHSCOPEID exists and works.])
1414 dnl CURL_CHECK_FUNC_RECV
1415 dnl -------------------------------------------------
1416 dnl Test if the socket recv() function is available,
1417 dnl and check its return type and the types of its
1418 dnl arguments. If the function succeeds HAVE_RECV
1419 dnl will be defined, defining the types of the arguments
1420 dnl in RECV_TYPE_ARG1, RECV_TYPE_ARG2, RECV_TYPE_ARG3
1421 dnl and RECV_TYPE_ARG4, defining the type of the function
1422 dnl return value in RECV_TYPE_RETV.
1424 AC_DEFUN([CURL_CHECK_FUNC_RECV], [
1425 AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK])dnl
1426 AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK2])dnl
1427 AC_CHECK_HEADERS(sys/types.h sys/socket.h)
1429 AC_MSG_CHECKING([for recv])
1433 #ifdef HAVE_WINDOWS_H
1434 #ifndef WIN32_LEAN_AND_MEAN
1435 #define WIN32_LEAN_AND_MEAN
1437 #include <windows.h>
1438 #ifdef HAVE_WINSOCK2_H
1439 #include <winsock2.h>
1441 #ifdef HAVE_WINSOCK_H
1442 #include <winsock.h>
1446 #ifdef HAVE_SYS_TYPES_H
1447 #include <sys/types.h>
1449 #ifdef HAVE_SYS_SOCKET_H
1450 #include <sys/socket.h>
1457 AC_MSG_RESULT([yes])
1464 if test "$curl_cv_recv" = "yes"; then
1465 AC_CACHE_CHECK([types of args and return type for recv],
1466 [curl_cv_func_recv_args], [
1467 curl_cv_func_recv_args="unknown"
1468 for recv_retv in 'int' 'ssize_t'; do
1469 for recv_arg1 in 'int' 'ssize_t' 'SOCKET'; do
1470 for recv_arg2 in 'char *' 'void *'; do
1471 for recv_arg3 in 'size_t' 'int' 'socklen_t' 'unsigned int'; do
1472 for recv_arg4 in 'int' 'unsigned int'; do
1473 if test "$curl_cv_func_recv_args" = "unknown"; then
1477 #ifdef HAVE_WINDOWS_H
1478 #ifndef WIN32_LEAN_AND_MEAN
1479 #define WIN32_LEAN_AND_MEAN
1481 #include <windows.h>
1482 #ifdef HAVE_WINSOCK2_H
1483 #include <winsock2.h>
1485 #ifdef HAVE_WINSOCK_H
1486 #include <winsock.h>
1489 #define RECVCALLCONV PASCAL
1491 #ifdef HAVE_SYS_TYPES_H
1492 #include <sys/types.h>
1494 #ifdef HAVE_SYS_SOCKET_H
1495 #include <sys/socket.h>
1497 #define RECVCALLCONV
1499 extern $recv_retv RECVCALLCONV
1500 recv($recv_arg1, $recv_arg2, $recv_arg3, $recv_arg4);
1506 $recv_retv res = recv(s, buf, len, flags);
1509 curl_cv_func_recv_args="$recv_arg1,$recv_arg2,$recv_arg3,$recv_arg4,$recv_retv"
1518 if test "$curl_cv_func_recv_args" = "unknown"; then
1519 AC_MSG_ERROR([Cannot find proper types to use for recv args])
1521 recv_prev_IFS=$IFS; IFS=','
1522 set dummy `echo "$curl_cv_func_recv_args" | sed 's/\*/\*/g'`
1526 AC_DEFINE_UNQUOTED(RECV_TYPE_ARG1, $[1],
1527 [Define to the type of arg 1 for recv.])
1528 AC_DEFINE_UNQUOTED(RECV_TYPE_ARG2, $[2],
1529 [Define to the type of arg 2 for recv.])
1530 AC_DEFINE_UNQUOTED(RECV_TYPE_ARG3, $[3],
1531 [Define to the type of arg 3 for recv.])
1532 AC_DEFINE_UNQUOTED(RECV_TYPE_ARG4, $[4],
1533 [Define to the type of arg 4 for recv.])
1534 AC_DEFINE_UNQUOTED(RECV_TYPE_RETV, $[5],
1535 [Define to the function return type for recv.])
1537 AC_DEFINE_UNQUOTED(HAVE_RECV, 1,
1538 [Define to 1 if you have the recv function.])
1539 ac_cv_func_recv="yes"
1542 AC_MSG_ERROR([Unable to link function recv])
1547 dnl CURL_CHECK_FUNC_SEND
1548 dnl -------------------------------------------------
1549 dnl Test if the socket send() function is available,
1550 dnl and check its return type and the types of its
1551 dnl arguments. If the function succeeds HAVE_SEND
1552 dnl will be defined, defining the types of the arguments
1553 dnl in SEND_TYPE_ARG1, SEND_TYPE_ARG2, SEND_TYPE_ARG3
1554 dnl and SEND_TYPE_ARG4, defining the type of the function
1555 dnl return value in SEND_TYPE_RETV, and also defining the
1556 dnl type qualifier of second argument in SEND_QUAL_ARG2.
1558 AC_DEFUN([CURL_CHECK_FUNC_SEND], [
1559 AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK])dnl
1560 AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK2])dnl
1561 AC_CHECK_HEADERS(sys/types.h sys/socket.h)
1563 AC_MSG_CHECKING([for send])
1567 #ifdef HAVE_WINDOWS_H
1568 #ifndef WIN32_LEAN_AND_MEAN
1569 #define WIN32_LEAN_AND_MEAN
1571 #include <windows.h>
1572 #ifdef HAVE_WINSOCK2_H
1573 #include <winsock2.h>
1575 #ifdef HAVE_WINSOCK_H
1576 #include <winsock.h>
1580 #ifdef HAVE_SYS_TYPES_H
1581 #include <sys/types.h>
1583 #ifdef HAVE_SYS_SOCKET_H
1584 #include <sys/socket.h>
1591 AC_MSG_RESULT([yes])
1598 if test "$curl_cv_send" = "yes"; then
1599 AC_CACHE_CHECK([types of args and return type for send],
1600 [curl_cv_func_send_args], [
1601 curl_cv_func_send_args="unknown"
1602 for send_retv in 'int' 'ssize_t'; do
1603 for send_arg1 in 'int' 'ssize_t' 'SOCKET'; do
1604 for send_arg2 in 'char *' 'void *' 'const char *' 'const void *'; do
1605 for send_arg3 in 'size_t' 'int' 'socklen_t' 'unsigned int'; do
1606 for send_arg4 in 'int' 'unsigned int'; do
1607 if test "$curl_cv_func_send_args" = "unknown"; then
1611 #ifdef HAVE_WINDOWS_H
1612 #ifndef WIN32_LEAN_AND_MEAN
1613 #define WIN32_LEAN_AND_MEAN
1615 #include <windows.h>
1616 #ifdef HAVE_WINSOCK2_H
1617 #include <winsock2.h>
1619 #ifdef HAVE_WINSOCK_H
1620 #include <winsock.h>
1623 #define SENDCALLCONV PASCAL
1625 #ifdef HAVE_SYS_TYPES_H
1626 #include <sys/types.h>
1628 #ifdef HAVE_SYS_SOCKET_H
1629 #include <sys/socket.h>
1631 #define SENDCALLCONV
1633 extern $send_retv SENDCALLCONV
1634 send($send_arg1, $send_arg2, $send_arg3, $send_arg4);
1639 $send_retv res = send(s, 0, len, flags);
1642 curl_cv_func_send_args="$send_arg1,$send_arg2,$send_arg3,$send_arg4,$send_retv"
1651 if test "$curl_cv_func_send_args" = "unknown"; then
1652 AC_MSG_ERROR([Cannot find proper types to use for send args])
1654 send_prev_IFS=$IFS; IFS=','
1655 set dummy `echo "$curl_cv_func_send_args" | sed 's/\*/\*/g'`
1659 send_qual_type_arg2=$[2]
1661 AC_DEFINE_UNQUOTED(SEND_TYPE_ARG1, $[1],
1662 [Define to the type of arg 1 for send.])
1663 AC_DEFINE_UNQUOTED(SEND_TYPE_ARG3, $[3],
1664 [Define to the type of arg 3 for send.])
1665 AC_DEFINE_UNQUOTED(SEND_TYPE_ARG4, $[4],
1666 [Define to the type of arg 4 for send.])
1667 AC_DEFINE_UNQUOTED(SEND_TYPE_RETV, $[5],
1668 [Define to the function return type for send.])
1672 case $prev_sh_opts in
1680 case "$send_qual_type_arg2" in
1682 send_qual_arg2=const
1683 send_type_arg2=`echo $send_qual_type_arg2 | sed 's/^const //'`
1687 send_type_arg2=$send_qual_type_arg2
1691 AC_DEFINE_UNQUOTED(SEND_QUAL_ARG2, $send_qual_arg2,
1692 [Define to the type qualifier of arg 2 for send.])
1693 AC_DEFINE_UNQUOTED(SEND_TYPE_ARG2, $send_type_arg2,
1694 [Define to the type of arg 2 for send.])
1696 case $prev_sh_opts in
1704 AC_DEFINE_UNQUOTED(HAVE_SEND, 1,
1705 [Define to 1 if you have the send function.])
1706 ac_cv_func_send="yes"
1709 AC_MSG_ERROR([Unable to link function send])
1714 dnl CURL_CHECK_FUNC_RECVFROM
1715 dnl -------------------------------------------------
1716 dnl Test if the socket recvfrom() function is available,
1717 dnl and check its return type and the types of its
1718 dnl arguments. If the function succeeds HAVE_RECVFROM
1719 dnl will be defined, defining the types of the arguments
1720 dnl in RECVFROM_TYPE_ARG1, RECVFROM_TYPE_ARG2, and so on
1721 dnl to RECVFROM_TYPE_ARG6, defining also the type of the
1722 dnl function return value in RECVFROM_TYPE_RETV.
1723 dnl Notice that the types returned for pointer arguments
1724 dnl will actually be the type pointed by the pointer.
1726 AC_DEFUN([CURL_CHECK_FUNC_RECVFROM], [
1727 AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK])dnl
1728 AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK2])dnl
1729 AC_CHECK_HEADERS(sys/types.h sys/socket.h)
1731 AC_MSG_CHECKING([for recvfrom])
1735 #ifdef HAVE_WINDOWS_H
1736 #ifndef WIN32_LEAN_AND_MEAN
1737 #define WIN32_LEAN_AND_MEAN
1739 #include <windows.h>
1740 #ifdef HAVE_WINSOCK2_H
1741 #include <winsock2.h>
1743 #ifdef HAVE_WINSOCK_H
1744 #include <winsock.h>
1748 #ifdef HAVE_SYS_TYPES_H
1749 #include <sys/types.h>
1751 #ifdef HAVE_SYS_SOCKET_H
1752 #include <sys/socket.h>
1756 recvfrom(0, 0, 0, 0, 0, 0);
1759 AC_MSG_RESULT([yes])
1760 curl_cv_recvfrom="yes"
1763 curl_cv_recvfrom="no"
1766 if test "$curl_cv_recvfrom" = "yes"; then
1767 AC_CACHE_CHECK([types of args and return type for recvfrom],
1768 [curl_cv_func_recvfrom_args], [
1769 curl_cv_func_recvfrom_args="unknown"
1770 for recvfrom_retv in 'int' 'ssize_t'; do
1771 for recvfrom_arg1 in 'int' 'ssize_t' 'SOCKET'; do
1772 for recvfrom_arg2 in 'char *' 'void *'; do
1773 for recvfrom_arg3 in 'size_t' 'int' 'socklen_t' 'unsigned int'; do
1774 for recvfrom_arg4 in 'int' 'unsigned int'; do
1775 for recvfrom_arg5 in 'struct sockaddr *' 'void *'; do
1776 for recvfrom_arg6 in 'socklen_t *' 'int *' 'unsigned int *' 'size_t *' 'void *'; do
1777 if test "$curl_cv_func_recvfrom_args" = "unknown"; then
1781 #ifdef HAVE_WINDOWS_H
1782 #ifndef WIN32_LEAN_AND_MEAN
1783 #define WIN32_LEAN_AND_MEAN
1785 #include <windows.h>
1786 #ifdef HAVE_WINSOCK2_H
1787 #include <winsock2.h>
1789 #ifdef HAVE_WINSOCK_H
1790 #include <winsock.h>
1793 #define RECVFROMCALLCONV PASCAL
1795 #ifdef HAVE_SYS_TYPES_H
1796 #include <sys/types.h>
1798 #ifdef HAVE_SYS_SOCKET_H
1799 #include <sys/socket.h>
1801 #define RECVFROMCALLCONV
1803 extern $recvfrom_retv RECVFROMCALLCONV
1804 recvfrom($recvfrom_arg1, $recvfrom_arg2,
1805 $recvfrom_arg3, $recvfrom_arg4,
1806 $recvfrom_arg5, $recvfrom_arg6);
1809 $recvfrom_arg2 buf=0;
1810 $recvfrom_arg3 len=0;
1811 $recvfrom_arg4 flags=0;
1812 $recvfrom_arg5 addr=0;
1813 $recvfrom_arg6 addrlen=0;
1814 $recvfrom_retv res=0;
1815 res = recvfrom(s, buf, len, flags, addr, addrlen);
1818 curl_cv_func_recvfrom_args="$recvfrom_arg1,$recvfrom_arg2,$recvfrom_arg3,$recvfrom_arg4,$recvfrom_arg5,$recvfrom_arg6,$recvfrom_retv"
1829 # Nearly last minute change for this release starts here
1830 AC_DEFINE_UNQUOTED(HAVE_RECVFROM, 1,
1831 [Define to 1 if you have the recvfrom function.])
1832 ac_cv_func_recvfrom="yes"
1833 # Nearly last minute change for this release ends here
1834 if test "$curl_cv_func_recvfrom_args" = "unknown"; then
1835 AC_MSG_WARN([Cannot find proper types to use for recvfrom args])
1837 recvfrom_prev_IFS=$IFS; IFS=','
1838 set dummy `echo "$curl_cv_func_recvfrom_args" | sed 's/\*/\*/g'`
1839 IFS=$recvfrom_prev_IFS
1842 recvfrom_ptrt_arg2=$[2]
1843 recvfrom_ptrt_arg5=$[5]
1844 recvfrom_ptrt_arg6=$[6]
1846 AC_DEFINE_UNQUOTED(RECVFROM_TYPE_ARG1, $[1],
1847 [Define to the type of arg 1 for recvfrom.])
1848 AC_DEFINE_UNQUOTED(RECVFROM_TYPE_ARG3, $[3],
1849 [Define to the type of arg 3 for recvfrom.])
1850 AC_DEFINE_UNQUOTED(RECVFROM_TYPE_ARG4, $[4],
1851 [Define to the type of arg 4 for recvfrom.])
1852 AC_DEFINE_UNQUOTED(RECVFROM_TYPE_RETV, $[7],
1853 [Define to the function return type for recvfrom.])
1857 case $prev_sh_opts in
1865 recvfrom_type_arg2=`echo $recvfrom_ptrt_arg2 | sed 's/ \*//'`
1866 recvfrom_type_arg5=`echo $recvfrom_ptrt_arg5 | sed 's/ \*//'`
1867 recvfrom_type_arg6=`echo $recvfrom_ptrt_arg6 | sed 's/ \*//'`
1869 AC_DEFINE_UNQUOTED(RECVFROM_TYPE_ARG2, $recvfrom_type_arg2,
1870 [Define to the type pointed by arg 2 for recvfrom.])
1871 AC_DEFINE_UNQUOTED(RECVFROM_TYPE_ARG5, $recvfrom_type_arg5,
1872 [Define to the type pointed by arg 5 for recvfrom.])
1873 AC_DEFINE_UNQUOTED(RECVFROM_TYPE_ARG6, $recvfrom_type_arg6,
1874 [Define to the type pointed by arg 6 for recvfrom.])
1876 if test "$recvfrom_type_arg2" = "void"; then
1877 AC_DEFINE_UNQUOTED(RECVFROM_TYPE_ARG2_IS_VOID, 1,
1878 [Define to 1 if the type pointed by arg 2 for recvfrom is void.])
1880 if test "$recvfrom_type_arg5" = "void"; then
1881 AC_DEFINE_UNQUOTED(RECVFROM_TYPE_ARG5_IS_VOID, 1,
1882 [Define to 1 if the type pointed by arg 5 for recvfrom is void.])
1884 if test "$recvfrom_type_arg6" = "void"; then
1885 AC_DEFINE_UNQUOTED(RECVFROM_TYPE_ARG6_IS_VOID, 1,
1886 [Define to 1 if the type pointed by arg 6 for recvfrom is void.])
1889 case $prev_sh_opts in
1897 AC_DEFINE_UNQUOTED(HAVE_RECVFROM, 1,
1898 [Define to 1 if you have the recvfrom function.])
1899 ac_cv_func_recvfrom="yes"
1902 AC_MSG_WARN([Unable to link function recvfrom])
1907 dnl CURL_CHECK_MSG_NOSIGNAL
1908 dnl -------------------------------------------------
1909 dnl Check for MSG_NOSIGNAL
1911 AC_DEFUN([CURL_CHECK_MSG_NOSIGNAL], [
1912 AC_CHECK_HEADERS(sys/types.h sys/socket.h)
1913 AC_CACHE_CHECK([for MSG_NOSIGNAL], [ac_cv_msg_nosignal], [
1917 #ifdef HAVE_WINDOWS_H
1918 #ifndef WIN32_LEAN_AND_MEAN
1919 #define WIN32_LEAN_AND_MEAN
1921 #include <windows.h>
1922 #ifdef HAVE_WINSOCK2_H
1923 #include <winsock2.h>
1925 #ifdef HAVE_WINSOCK_H
1926 #include <winsock.h>
1930 #ifdef HAVE_SYS_TYPES_H
1931 #include <sys/types.h>
1933 #ifdef HAVE_SYS_SOCKET_H
1934 #include <sys/socket.h>
1938 int flag=MSG_NOSIGNAL;
1941 ac_cv_msg_nosignal="yes"
1943 ac_cv_msg_nosignal="no"
1946 case "$ac_cv_msg_nosignal" in
1948 AC_DEFINE_UNQUOTED(HAVE_MSG_NOSIGNAL, 1,
1949 [Define to 1 if you have the MSG_NOSIGNAL flag.])
1955 dnl CURL_CHECK_STRUCT_TIMEVAL
1956 dnl -------------------------------------------------
1957 dnl Check for timeval struct
1959 AC_DEFUN([CURL_CHECK_STRUCT_TIMEVAL], [
1960 AC_REQUIRE([AC_HEADER_TIME])dnl
1961 AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK])dnl
1962 AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK2])dnl
1963 AC_CHECK_HEADERS(sys/types.h sys/time.h time.h)
1964 AC_CACHE_CHECK([for struct timeval], [ac_cv_struct_timeval], [
1968 #ifdef HAVE_WINDOWS_H
1969 #ifndef WIN32_LEAN_AND_MEAN
1970 #define WIN32_LEAN_AND_MEAN
1972 #include <windows.h>
1973 #ifdef HAVE_WINSOCK2_H
1974 #include <winsock2.h>
1976 #ifdef HAVE_WINSOCK_H
1977 #include <winsock.h>
1981 #ifdef HAVE_SYS_TYPES_H
1982 #include <sys/types.h>
1984 #ifdef HAVE_SYS_TIME_H
1985 #include <sys/time.h>
1986 #ifdef TIME_WITH_SYS_TIME
2000 ac_cv_struct_timeval="yes"
2002 ac_cv_struct_timeval="no"
2005 case "$ac_cv_struct_timeval" in
2007 AC_DEFINE_UNQUOTED(HAVE_STRUCT_TIMEVAL, 1,
2008 [Define to 1 if you have the timeval struct.])
2014 dnl TYPE_SIG_ATOMIC_T
2015 dnl -------------------------------------------------
2016 dnl Check if the sig_atomic_t type is available, and
2017 dnl verify if it is already defined as volatile.
2019 AC_DEFUN([TYPE_SIG_ATOMIC_T], [
2020 AC_CHECK_HEADERS(signal.h)
2021 AC_CHECK_TYPE([sig_atomic_t],[
2022 AC_DEFINE(HAVE_SIG_ATOMIC_T, 1,
2023 [Define to 1 if sig_atomic_t is an available typedef.])
2025 #ifdef HAVE_SIGNAL_H
2029 case "$ac_cv_type_sig_atomic_t" in
2032 AC_MSG_CHECKING([if sig_atomic_t is already defined as volatile])
2035 #ifdef HAVE_SIGNAL_H
2039 static volatile sig_atomic_t dummy = 0;
2043 ac_cv_sig_atomic_t_volatile="no"
2045 AC_MSG_RESULT([yes])
2046 ac_cv_sig_atomic_t_volatile="yes"
2049 if test "$ac_cv_sig_atomic_t_volatile" = "yes"; then
2050 AC_DEFINE(HAVE_SIG_ATOMIC_T_VOLATILE, 1,
2051 [Define to 1 if sig_atomic_t is already defined as volatile.])
2059 dnl -------------------------------------------------
2060 dnl Check for in_addr_t: it is used to receive the return code of inet_addr()
2061 dnl and a few other things.
2063 AC_DEFUN([TYPE_IN_ADDR_T], [
2064 AC_CHECK_TYPE([in_addr_t], ,[
2065 dnl in_addr_t not available
2066 AC_CACHE_CHECK([for in_addr_t equivalent],
2067 [curl_cv_in_addr_t_equiv], [
2068 curl_cv_in_addr_t_equiv="unknown"
2069 for t in "unsigned long" int size_t unsigned long; do
2070 if test "$curl_cv_in_addr_t_equiv" = "unknown"; then
2074 #ifdef HAVE_WINDOWS_H
2075 #ifndef WIN32_LEAN_AND_MEAN
2076 #define WIN32_LEAN_AND_MEAN
2078 #include <windows.h>
2079 #ifdef HAVE_WINSOCK2_H
2080 #include <winsock2.h>
2082 #ifdef HAVE_WINSOCK_H
2083 #include <winsock.h>
2087 #ifdef HAVE_SYS_TYPES_H
2088 #include <sys/types.h>
2090 #ifdef HAVE_SYS_SOCKET_H
2091 #include <sys/socket.h>
2093 #ifdef HAVE_NETINET_IN_H
2094 #include <netinet/in.h>
2096 #ifdef HAVE_ARPA_INET_H
2097 #include <arpa/inet.h>
2101 $t data = inet_addr ("1.2.3.4");
2104 curl_cv_in_addr_t_equiv="$t"
2109 case "$curl_cv_in_addr_t_equiv" in
2111 AC_MSG_ERROR([Cannot find a type to use in place of in_addr_t])
2114 AC_DEFINE_UNQUOTED(in_addr_t, $curl_cv_in_addr_t_equiv,
2115 [Type to use in place of in_addr_t when system does not provide it.])
2120 #ifdef HAVE_WINDOWS_H
2121 #ifndef WIN32_LEAN_AND_MEAN
2122 #define WIN32_LEAN_AND_MEAN
2124 #include <windows.h>
2125 #ifdef HAVE_WINSOCK2_H
2126 #include <winsock2.h>
2128 #ifdef HAVE_WINSOCK_H
2129 #include <winsock.h>
2133 #ifdef HAVE_SYS_TYPES_H
2134 #include <sys/types.h>
2136 #ifdef HAVE_SYS_SOCKET_H
2137 #include <sys/socket.h>
2139 #ifdef HAVE_NETINET_IN_H
2140 #include <netinet/in.h>
2142 #ifdef HAVE_ARPA_INET_H
2143 #include <arpa/inet.h>
2150 dnl CURL_CHECK_FUNC_CLOCK_GETTIME_MONOTONIC
2151 dnl -------------------------------------------------
2152 dnl Check if monotonic clock_gettime is available.
2154 AC_DEFUN([CURL_CHECK_FUNC_CLOCK_GETTIME_MONOTONIC], [
2155 AC_REQUIRE([AC_HEADER_TIME])dnl
2156 AC_CHECK_HEADERS(sys/types.h sys/time.h time.h)
2157 AC_MSG_CHECKING([for monotonic clock_gettime])
2160 #ifdef HAVE_SYS_TYPES_H
2161 #include <sys/types.h>
2163 #ifdef HAVE_SYS_TIME_H
2164 #include <sys/time.h>
2165 #ifdef TIME_WITH_SYS_TIME
2175 (void)clock_gettime(CLOCK_MONOTONIC, &ts);
2178 AC_MSG_RESULT([yes])
2179 ac_cv_func_clock_gettime="yes"
2182 ac_cv_func_clock_gettime="no"
2184 dnl Definition of HAVE_CLOCK_GETTIME_MONOTONIC is intentionally postponed
2185 dnl until library linking and run-time checks for clock_gettime succeed.
2189 dnl CURL_CHECK_LIBS_CLOCK_GETTIME_MONOTONIC
2190 dnl -------------------------------------------------
2191 dnl If monotonic clock_gettime is available then,
2192 dnl check and prepended to LIBS any needed libraries.
2194 AC_DEFUN([CURL_CHECK_LIBS_CLOCK_GETTIME_MONOTONIC], [
2195 AC_REQUIRE([CURL_CHECK_FUNC_CLOCK_GETTIME_MONOTONIC])dnl
2197 if test "$ac_cv_func_clock_gettime" = "yes"; then
2199 AC_MSG_CHECKING([for clock_gettime in libraries])
2201 curl_cv_save_LIBS="$LIBS"
2202 curl_cv_gclk_LIBS="unknown"
2204 for x_xlibs in '' '-lrt' '-lposix4' ; do
2205 if test "$curl_cv_gclk_LIBS" = "unknown"; then
2206 if test -z "$x_xlibs"; then
2207 LIBS="$curl_cv_save_LIBS"
2209 LIBS="$x_xlibs $curl_cv_save_LIBS"
2213 #ifdef HAVE_SYS_TYPES_H
2214 #include <sys/types.h>
2216 #ifdef HAVE_SYS_TIME_H
2217 #include <sys/time.h>
2218 #ifdef TIME_WITH_SYS_TIME
2228 (void)clock_gettime(CLOCK_MONOTONIC, &ts);
2231 curl_cv_gclk_LIBS="$x_xlibs"
2236 LIBS="$curl_cv_save_LIBS"
2238 case X-"$curl_cv_gclk_LIBS" in
2240 AC_MSG_RESULT([cannot find clock_gettime])
2241 AC_MSG_WARN([HAVE_CLOCK_GETTIME_MONOTONIC will not be defined])
2242 ac_cv_func_clock_gettime="no"
2245 AC_MSG_RESULT([no additional lib required])
2246 ac_cv_func_clock_gettime="yes"
2249 if test -z "$curl_cv_save_LIBS"; then
2250 LIBS="$curl_cv_gclk_LIBS"
2252 LIBS="$curl_cv_gclk_LIBS $curl_cv_save_LIBS"
2254 AC_MSG_RESULT([$curl_cv_gclk_LIBS])
2255 ac_cv_func_clock_gettime="yes"
2259 dnl only do runtime verification when not cross-compiling
2260 if test "x$cross_compiling" != "xyes" &&
2261 test "$ac_cv_func_clock_gettime" = "yes"; then
2262 AC_MSG_CHECKING([if monotonic clock_gettime works])
2265 #ifdef HAVE_STDLIB_H
2268 #ifdef HAVE_SYS_TYPES_H
2269 #include <sys/types.h>
2271 #ifdef HAVE_SYS_TIME_H
2272 #include <sys/time.h>
2273 #ifdef TIME_WITH_SYS_TIME
2283 if (0 == clock_gettime(CLOCK_MONOTONIC, &ts))
2289 AC_MSG_RESULT([yes])
2292 AC_MSG_WARN([HAVE_CLOCK_GETTIME_MONOTONIC will not be defined])
2293 ac_cv_func_clock_gettime="no"
2294 LIBS="$curl_cv_save_LIBS"
2298 case "$ac_cv_func_clock_gettime" in
2300 AC_DEFINE_UNQUOTED(HAVE_CLOCK_GETTIME_MONOTONIC, 1,
2301 [Define to 1 if you have the clock_gettime function and monotonic timer.])
2310 dnl CURL_DEFINE_UNQUOTED (VARIABLE, [VALUE])
2311 dnl -------------------------------------------------
2312 dnl Like AC_DEFINE_UNQUOTED this macro will define a C preprocessor
2313 dnl symbol that can be further used in custom template configuration
2314 dnl files. This macro, unlike AC_DEFINE_UNQUOTED, does not use a third
2315 dnl argument for the description. Symbol definitions done with this
2316 dnl macro are intended to be exclusively used in handcrafted *.h.in
2317 dnl template files. Contrary to what AC_DEFINE_UNQUOTED does, this one
2318 dnl prevents autoheader generation and insertion of symbol template
2319 dnl stub and definition into the first configuration header file. Do
2320 dnl not use this macro as a replacement for AC_DEFINE_UNQUOTED, each
2321 dnl one serves different functional needs.
2323 AC_DEFUN([CURL_DEFINE_UNQUOTED], [
2324 cat >>confdefs.h <<_EOF
2325 [@%:@define] $1 ifelse($#, 2, [$2], 1)
2330 dnl CURL_CONFIGURE_LONG
2331 dnl -------------------------------------------------
2332 dnl Find out the size of long as reported by sizeof() and define
2333 dnl CURL_SIZEOF_LONG as appropriate to be used in template file
2334 dnl include/curl/curlbuild.h.in to properly configure the library.
2335 dnl The size of long is a build time characteristic and as such
2336 dnl must be recorded in curlbuild.h
2338 AC_DEFUN([CURL_CONFIGURE_LONG], [
2339 if test -z "$ac_cv_sizeof_long" ||
2340 test "$ac_cv_sizeof_long" -eq "0"; then
2341 AC_MSG_ERROR([cannot find out size of long.])
2343 CURL_DEFINE_UNQUOTED([CURL_SIZEOF_LONG], [$ac_cv_sizeof_long])
2347 dnl CURL_CONFIGURE_CURL_SOCKLEN_T
2348 dnl -------------------------------------------------
2349 dnl Find out suitable curl_socklen_t data type definition and size, making
2350 dnl appropriate definitions for template file include/curl/curlbuild.h.in
2351 dnl to properly configure and use the library.
2353 dnl The need for the curl_socklen_t definition arises mainly to properly
2354 dnl interface HP-UX systems which on one hand have a typedef'ed socklen_t
2355 dnl data type which is 32 or 64-Bit wide depending on the data model being
2356 dnl used, and that on the other hand is only actually used when interfacing
2357 dnl the X/Open sockets provided in the xnet library.
2359 AC_DEFUN([CURL_CONFIGURE_CURL_SOCKLEN_T], [
2360 AC_REQUIRE([CURL_INCLUDES_WS2TCPIP])dnl
2361 AC_REQUIRE([CURL_INCLUDES_SYS_SOCKET])dnl
2362 AC_REQUIRE([CURL_PREPROCESS_CALLCONV])dnl
2364 AC_MSG_CHECKING([for curl_socklen_t data type])
2365 curl_typeof_curl_socklen_t="unknown"
2366 for arg1 in int SOCKET; do
2367 for arg2 in 'struct sockaddr' void; do
2368 for t in socklen_t int size_t 'unsigned int' long 'unsigned long' void; do
2369 if test "$curl_typeof_curl_socklen_t" = "unknown"; then
2372 $curl_includes_ws2tcpip
2373 $curl_includes_sys_socket
2374 $curl_preprocess_callconv
2375 extern int FUNCALLCONV getpeername($arg1, $arg2 *, $t *);
2378 if(0 != getpeername(0, 0, lenptr))
2382 curl_typeof_curl_socklen_t="$t"
2388 for t in socklen_t int; do
2389 if test "$curl_typeof_curl_socklen_t" = "void"; then
2392 $curl_includes_sys_socket
2393 typedef $t curl_socklen_t;
2395 curl_socklen_t dummy;
2398 curl_typeof_curl_socklen_t="$t"
2402 AC_MSG_RESULT([$curl_typeof_curl_socklen_t])
2403 if test "$curl_typeof_curl_socklen_t" = "void" ||
2404 test "$curl_typeof_curl_socklen_t" = "unknown"; then
2405 AC_MSG_ERROR([cannot find data type for curl_socklen_t.])
2408 AC_MSG_CHECKING([size of curl_socklen_t])
2409 curl_sizeof_curl_socklen_t="unknown"
2410 curl_pull_headers_socklen_t="unknown"
2411 if test "$ac_cv_header_ws2tcpip_h" = "yes"; then
2412 tst_pull_header_checks='none ws2tcpip'
2415 tst_pull_header_checks='none systypes syssocket'
2416 tst_size_checks='4 8 2'
2418 for tst_size in $tst_size_checks; do
2419 for tst_pull_headers in $tst_pull_header_checks; do
2420 if test "$curl_sizeof_curl_socklen_t" = "unknown"; then
2421 case $tst_pull_headers in
2423 tmp_includes="$curl_includes_ws2tcpip"
2426 tmp_includes="$curl_includes_sys_types"
2429 tmp_includes="$curl_includes_sys_socket"
2438 typedef $curl_typeof_curl_socklen_t curl_socklen_t;
2439 typedef char dummy_arr[sizeof(curl_socklen_t) == $tst_size ? 1 : -1];
2441 curl_socklen_t dummy;
2444 curl_sizeof_curl_socklen_t="$tst_size"
2445 curl_pull_headers_socklen_t="$tst_pull_headers"
2450 AC_MSG_RESULT([$curl_sizeof_curl_socklen_t])
2451 if test "$curl_sizeof_curl_socklen_t" = "unknown"; then
2452 AC_MSG_ERROR([cannot find out size of curl_socklen_t.])
2455 case $curl_pull_headers_socklen_t in
2457 CURL_DEFINE_UNQUOTED([CURL_PULL_WS2TCPIP_H])
2460 CURL_DEFINE_UNQUOTED([CURL_PULL_SYS_TYPES_H])
2463 CURL_DEFINE_UNQUOTED([CURL_PULL_SYS_TYPES_H])
2464 CURL_DEFINE_UNQUOTED([CURL_PULL_SYS_SOCKET_H])
2467 CURL_DEFINE_UNQUOTED([CURL_TYPEOF_CURL_SOCKLEN_T], [$curl_typeof_curl_socklen_t])
2468 CURL_DEFINE_UNQUOTED([CURL_SIZEOF_CURL_SOCKLEN_T], [$curl_sizeof_curl_socklen_t])
2472 dnl CURL_CHECK_FUNC_SELECT
2473 dnl -------------------------------------------------
2474 dnl Test if the socket select() function is available,
2475 dnl and check its return type and the types of its
2476 dnl arguments. If the function succeeds HAVE_SELECT
2477 dnl will be defined, defining the types of the
2478 dnl arguments in SELECT_TYPE_ARG1, SELECT_TYPE_ARG234
2479 dnl and SELECT_TYPE_ARG5, defining the type of the
2480 dnl function return value in SELECT_TYPE_RETV, and
2481 dnl also defining the type qualifier of fifth argument
2482 dnl in SELECT_QUAL_ARG5.
2484 AC_DEFUN([CURL_CHECK_FUNC_SELECT], [
2485 AC_REQUIRE([CURL_CHECK_STRUCT_TIMEVAL])dnl
2486 AC_CHECK_HEADERS(sys/select.h sys/socket.h)
2488 AC_MSG_CHECKING([for select])
2492 #ifdef HAVE_WINDOWS_H
2493 #ifndef WIN32_LEAN_AND_MEAN
2494 #define WIN32_LEAN_AND_MEAN
2496 #include <windows.h>
2497 #ifdef HAVE_WINSOCK2_H
2498 #include <winsock2.h>
2500 #ifdef HAVE_WINSOCK_H
2501 #include <winsock.h>
2505 #ifdef HAVE_SYS_TYPES_H
2506 #include <sys/types.h>
2508 #ifdef HAVE_SYS_TIME_H
2509 #include <sys/time.h>
2510 #ifdef TIME_WITH_SYS_TIME
2518 #ifndef HAVE_WINDOWS_H
2519 #ifdef HAVE_SYS_SELECT_H
2520 #include <sys/select.h>
2522 #ifdef HAVE_SYS_SOCKET_H
2523 #include <sys/socket.h>
2527 select(0, 0, 0, 0, 0);
2530 AC_MSG_RESULT([yes])
2531 curl_cv_select="yes"
2537 if test "$curl_cv_select" = "yes"; then
2538 AC_CACHE_CHECK([types of args and return type for select],
2539 [curl_cv_func_select_args], [
2540 curl_cv_func_select_args="unknown"
2541 for sel_retv in 'int' 'ssize_t'; do
2542 for sel_arg1 in 'int' 'ssize_t' 'size_t' 'unsigned long int' 'unsigned int'; do
2543 for sel_arg234 in 'fd_set *' 'int *' 'void *'; do
2544 for sel_arg5 in 'struct timeval *' 'const struct timeval *'; do
2545 if test "$curl_cv_func_select_args" = "unknown"; then
2549 #ifdef HAVE_WINDOWS_H
2550 #ifndef WIN32_LEAN_AND_MEAN
2551 #define WIN32_LEAN_AND_MEAN
2553 #include <windows.h>
2554 #ifdef HAVE_WINSOCK2_H
2555 #include <winsock2.h>
2557 #ifdef HAVE_WINSOCK_H
2558 #include <winsock.h>
2561 #define SELECTCALLCONV PASCAL
2563 #ifdef HAVE_SYS_TYPES_H
2564 #include <sys/types.h>
2566 #ifdef HAVE_SYS_TIME_H
2567 #include <sys/time.h>
2568 #ifdef TIME_WITH_SYS_TIME
2576 #ifndef HAVE_WINDOWS_H
2577 #ifdef HAVE_SYS_SELECT_H
2578 #include <sys/select.h>
2580 #ifdef HAVE_SYS_SOCKET_H
2581 #include <sys/socket.h>
2583 #define SELECTCALLCONV
2585 #ifndef HAVE_STRUCT_TIMEVAL
2591 extern $sel_retv SELECTCALLCONV select($sel_arg1,
2601 $sel_retv res = select(nfds, rfds, wfds, efds, 0);
2604 curl_cv_func_select_args="$sel_arg1,$sel_arg234,$sel_arg5,$sel_retv"
2612 if test "$curl_cv_func_select_args" = "unknown"; then
2613 AC_MSG_WARN([Cannot find proper types to use for select args])
2614 AC_MSG_WARN([HAVE_SELECT will not be defined])
2616 select_prev_IFS=$IFS; IFS=','
2617 set dummy `echo "$curl_cv_func_select_args" | sed 's/\*/\*/g'`
2618 IFS=$select_prev_IFS
2621 sel_qual_type_arg5=$[3]
2623 AC_DEFINE_UNQUOTED(SELECT_TYPE_ARG1, $[1],
2624 [Define to the type of arg 1 for select.])
2625 AC_DEFINE_UNQUOTED(SELECT_TYPE_ARG234, $[2],
2626 [Define to the type of args 2, 3 and 4 for select.])
2627 AC_DEFINE_UNQUOTED(SELECT_TYPE_RETV, $[4],
2628 [Define to the function return type for select.])
2632 case $prev_sh_opts in
2640 case "$sel_qual_type_arg5" in
2643 sel_type_arg5=`echo $sel_qual_type_arg5 | sed 's/^const //'`
2647 sel_type_arg5=$sel_qual_type_arg5
2651 AC_DEFINE_UNQUOTED(SELECT_QUAL_ARG5, $sel_qual_arg5,
2652 [Define to the type qualifier of arg 5 for select.])
2653 AC_DEFINE_UNQUOTED(SELECT_TYPE_ARG5, $sel_type_arg5,
2654 [Define to the type of arg 5 for select.])
2656 case $prev_sh_opts in
2664 AC_DEFINE_UNQUOTED(HAVE_SELECT, 1,
2665 [Define to 1 if you have the select function.])
2666 ac_cv_func_select="yes"
2672 # This is only a temporary fix. This macro is here to replace the broken one
2673 # delivered by the automake project (including the 1.9.6 release). As soon as
2674 # they ship a working version we SHOULD remove this work-around.
2676 AC_DEFUN([AM_MISSING_HAS_RUN],
2677 [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
2678 test x"${MISSING+set}" = xset || MISSING="\${SHELL} \"$am_aux_dir/missing\""
2679 # Use eval to expand $SHELL
2680 if eval "$MISSING --run true"; then
2681 am_missing_run="$MISSING --run "
2684 AC_MSG_WARN([`missing' script is too old or missing])
2689 dnl CURL_VERIFY_RUNTIMELIBS
2690 dnl -------------------------------------------------
2691 dnl Verify that the shared libs found so far can be used when running
2692 dnl programs, since otherwise the situation will create odd configure errors
2693 dnl that are misleading people.
2695 dnl Make sure this test is run BEFORE the first test in the script that
2696 dnl runs anything, which at the time of this writing is the AC_CHECK_SIZEOF
2697 dnl macro. It must also run AFTER all lib-checking macros are complete.
2699 AC_DEFUN([CURL_VERIFY_RUNTIMELIBS], [
2701 dnl this test is of course not sensible if we are cross-compiling!
2702 if test "x$cross_compiling" != xyes; then
2704 dnl just run a program to verify that the libs checked for previous to this
2705 dnl point also is available run-time!
2706 AC_MSG_CHECKING([run-time libs availability])
2713 AC_MSG_RESULT([fine]),
2714 AC_MSG_RESULT([failed])
2715 AC_MSG_ERROR([one or more libs available at link-time are not available run-time. Libs used at link-time: $LIBS])
2718 dnl if this test fails, configure has already stopped
2723 dnl CURL_CHECK_VARIADIC_MACROS
2724 dnl -------------------------------------------------
2725 dnl Check compiler support of variadic macros
2727 AC_DEFUN([CURL_CHECK_VARIADIC_MACROS], [
2728 AC_CACHE_CHECK([for compiler support of C99 variadic macro style],
2729 [curl_cv_variadic_macros_c99], [
2732 #define c99_vmacro3(first, ...) fun3(first, __VA_ARGS__)
2733 #define c99_vmacro2(first, ...) fun2(first, __VA_ARGS__)
2734 int fun3(int arg1, int arg2, int arg3);
2735 int fun2(int arg1, int arg2);
2736 int fun3(int arg1, int arg2, int arg3)
2737 { return arg1 + arg2 + arg3; }
2738 int fun2(int arg1, int arg2)
2739 { return arg1 + arg2; }
2741 int res3 = c99_vmacro3(1, 2, 3);
2742 int res2 = c99_vmacro2(1, 2);
2745 curl_cv_variadic_macros_c99="yes"
2747 curl_cv_variadic_macros_c99="no"
2750 case "$curl_cv_variadic_macros_c99" in
2752 AC_DEFINE_UNQUOTED(HAVE_VARIADIC_MACROS_C99, 1,
2753 [Define to 1 if compiler supports C99 variadic macro style.])
2756 AC_CACHE_CHECK([for compiler support of old gcc variadic macro style],
2757 [curl_cv_variadic_macros_gcc], [
2760 #define gcc_vmacro3(first, args...) fun3(first, args)
2761 #define gcc_vmacro2(first, args...) fun2(first, args)
2762 int fun3(int arg1, int arg2, int arg3);
2763 int fun2(int arg1, int arg2);
2764 int fun3(int arg1, int arg2, int arg3)
2765 { return arg1 + arg2 + arg3; }
2766 int fun2(int arg1, int arg2)
2767 { return arg1 + arg2; }
2769 int res3 = gcc_vmacro3(1, 2, 3);
2770 int res2 = gcc_vmacro2(1, 2);
2773 curl_cv_variadic_macros_gcc="yes"
2775 curl_cv_variadic_macros_gcc="no"
2778 case "$curl_cv_variadic_macros_gcc" in
2780 AC_DEFINE_UNQUOTED(HAVE_VARIADIC_MACROS_GCC, 1,
2781 [Define to 1 if compiler supports old gcc variadic macro style.])
2787 dnl CURL_CHECK_CA_BUNDLE
2788 dnl -------------------------------------------------
2789 dnl Check if a default ca-bundle should be used
2791 dnl regarding the paths this will scan:
2792 dnl /etc/ssl/certs/ca-certificates.crt Debian systems
2793 dnl /etc/pki/tls/certs/ca-bundle.crt Redhat and Mandriva
2794 dnl /usr/share/ssl/certs/ca-bundle.crt old(er) Redhat
2795 dnl /usr/local/share/certs/ca-root.crt FreeBSD
2796 dnl /etc/ssl/cert.pem OpenBSD
2797 dnl /etc/ssl/certs/ (ca path) SUSE
2799 AC_DEFUN([CURL_CHECK_CA_BUNDLE], [
2801 AC_MSG_CHECKING([default CA cert bundle/path])
2803 AC_ARG_WITH(ca-bundle,
2804 AC_HELP_STRING([--with-ca-bundle=FILE], [File name to use as CA bundle])
2805 AC_HELP_STRING([--without-ca-bundle], [Don't use a default CA bundle]),
2808 if test "x$want_ca" = "xyes"; then
2809 AC_MSG_ERROR([--with-ca-bundle=FILE requires a path to the CA bundle])
2812 [ want_ca="unset" ])
2813 AC_ARG_WITH(ca-path,
2814 AC_HELP_STRING([--with-ca-path=DIRECTORY], [Directory to use as CA path])
2815 AC_HELP_STRING([--without-ca-path], [Don't use a default CA path]),
2817 want_capath="$withval"
2818 if test "x$want_capath" = "xyes"; then
2819 AC_MSG_ERROR([--with-ca-path=DIRECTORY requires a path to the CA path directory])
2822 [ want_capath="unset"])
2824 if test "x$want_ca" != "xno" -a "x$want_ca" != "xunset" -a \
2825 "x$want_capath" != "xno" -a "x$want_capath" != "xunset"; then
2827 AC_MSG_ERROR([Can't specify both --with-ca-bundle and --with-ca-path.])
2828 elif test "x$want_ca" != "xno" -a "x$want_ca" != "xunset"; then
2829 dnl --with-ca-bundle given
2832 elif test "x$want_capath" != "xno" -a "x$want_capath" != "xunset"; then
2833 dnl --with-ca-path given
2834 if test "x$OPENSSL_ENABLED" != "x1"; then
2835 AC_MSG_ERROR([--with-ca-path only works with openSSL])
2837 capath="$want_capath"
2840 dnl neither of --with-ca-* given
2841 dnl first try autodetecting a CA bundle , then a CA path
2842 dnl both autodetections can be skipped by --without-ca-*
2845 if test "x$want_ca" = "xunset"; then
2846 dnl the path we previously would have installed the curl ca bundle
2847 dnl to, and thus we now check for an already existing cert in that place
2848 dnl in case we find no other
2849 if test "x$prefix" != xNONE; then
2850 cac="${prefix}/share/curl/curl-ca-bundle.crt"
2852 cac="$ac_default_prefix/share/curl/curl-ca-bundle.crt"
2855 for a in /etc/ssl/certs/ca-certificates.crt \
2856 /etc/pki/tls/certs/ca-bundle.crt \
2857 /usr/share/ssl/certs/ca-bundle.crt \
2858 /usr/local/share/certs/ca-root.crt \
2861 if test -f "$a"; then
2867 if test "x$want_capath" = "xunset" -a "x$ca" = "xno" -a \
2868 "x$OPENSSL_ENABLED" = "x1"; then
2869 for a in /etc/ssl/certs/; do
2870 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
2880 if test "x$ca" != "xno"; then
2881 CURL_CA_BUNDLE='"'$ca'"'
2882 AC_DEFINE_UNQUOTED(CURL_CA_BUNDLE, "$ca", [Location of default ca bundle])
2883 AC_SUBST(CURL_CA_BUNDLE)
2884 AC_MSG_RESULT([$ca])
2885 elif test "x$capath" != "xno"; then
2886 CURL_CA_PATH="\"$capath\""
2887 AC_DEFINE_UNQUOTED(CURL_CA_PATH, "$capath", [Location of default ca path])
2888 AC_MSG_RESULT([$capath (capath)])
2895 dnl DO_CURL_OFF_T_CHECK (TYPE, SIZE)
2896 dnl -------------------------------------------------
2897 dnl Internal macro for CURL_CONFIGURE_CURL_OFF_T
2899 AC_DEFUN([DO_CURL_OFF_T_CHECK], [
2900 AC_REQUIRE([CURL_INCLUDES_INTTYPES])dnl
2901 if test "$curl_typeof_curl_off_t" = "unknown" && test ! -z "$1"; then
2905 case AS_TR_SH([$1]) in
2907 tmp_includes="$curl_includes_inttypes"
2908 tmp_source="char f@<:@@:>@ = PRId64;"
2912 tmp_includes="$curl_includes_inttypes"
2913 tmp_source="char f@<:@@:>@ = PRId32;"
2917 tmp_includes="$curl_includes_inttypes"
2918 tmp_source="char f@<:@@:>@ = PRId16;"
2925 typedef $1 curl_off_t;
2926 typedef char dummy_arr[sizeof(curl_off_t) == $2 ? 1 : -1];
2932 if test -z "$tmp_fmt"; then
2933 curl_typeof_curl_off_t="$1"
2934 curl_sizeof_curl_off_t="$2"
2936 CURL_CHECK_DEF([$tmp_fmt], [$curl_includes_inttypes], [silent])
2937 AS_VAR_PUSHDEF([tmp_HaveFmtDef], [curl_cv_have_def_$tmp_fmt])dnl
2938 AS_VAR_PUSHDEF([tmp_FmtDef], [curl_cv_def_$tmp_fmt])dnl
2939 if test AS_VAR_GET(tmp_HaveFmtDef) = "yes"; then
2940 curl_format_curl_off_t=AS_VAR_GET(tmp_FmtDef)
2941 curl_typeof_curl_off_t="$1"
2942 curl_sizeof_curl_off_t="$2"
2944 AS_VAR_POPDEF([tmp_FmtDef])dnl
2945 AS_VAR_POPDEF([tmp_HaveFmtDef])dnl
2952 dnl DO_CURL_OFF_T_SUFFIX_CHECK (TYPE)
2953 dnl -------------------------------------------------
2954 dnl Internal macro for CURL_CONFIGURE_CURL_OFF_T
2956 AC_DEFUN([DO_CURL_OFF_T_SUFFIX_CHECK], [
2957 AC_REQUIRE([CURL_INCLUDES_INTTYPES])dnl
2958 AC_MSG_CHECKING([constant suffix string for curl_off_t])
2960 curl_suffix_curl_off_t="unknown"
2961 curl_suffix_curl_off_tu="unknown"
2963 case AS_TR_SH([$1]) in
2964 long_long | __longlong | __longlong_t)
2974 tst_suffixes="LL:i64::"
2977 tst_suffixes="L:i32::"
2980 tst_suffixes="L:i16::"
2983 AC_MSG_ERROR([unexpected data type $1])
2987 old_IFS=$IFS; IFS=':'
2988 for tmp_ssuf in $tst_suffixes ; do
2990 if test "x$curl_suffix_curl_off_t" = "xunknown"; then
2993 tmp_usuf="u$tmp_ssuf"
2996 tmp_usuf="U$tmp_ssuf"
3004 $curl_includes_inttypes
3015 curl_suffix_curl_off_t="$tmp_ssuf"
3016 curl_suffix_curl_off_tu="$tmp_usuf"
3022 if test "x$curl_suffix_curl_off_t" = "xunknown"; then
3023 AC_MSG_ERROR([cannot find constant suffix string for curl_off_t.])
3025 AC_MSG_RESULT([$curl_suffix_curl_off_t])
3026 AC_MSG_CHECKING([constant suffix string for unsigned curl_off_t])
3027 AC_MSG_RESULT([$curl_suffix_curl_off_tu])
3033 dnl CURL_CONFIGURE_CURL_OFF_T
3034 dnl -------------------------------------------------
3035 dnl Find out suitable curl_off_t data type definition and associated
3036 dnl items, and make the appropriate definitions used in template file
3037 dnl include/curl/curlbuild.h.in to properly configure the library.
3039 AC_DEFUN([CURL_CONFIGURE_CURL_OFF_T], [
3040 AC_REQUIRE([CURL_INCLUDES_INTTYPES])dnl
3042 AC_BEFORE([$0],[AC_SYS_LARGEFILE])dnl
3043 AC_BEFORE([$0],[CURL_CONFIGURE_REENTRANT])dnl
3044 AC_BEFORE([$0],[CURL_CHECK_AIX_ALL_SOURCE])dnl
3046 if test -z "$SED"; then
3047 AC_MSG_ERROR([SED not set. Cannot continue without SED being set.])
3050 AC_CHECK_SIZEOF(long)
3051 AC_CHECK_SIZEOF(void*)
3053 if test -z "$ac_cv_sizeof_long" ||
3054 test "$ac_cv_sizeof_long" -eq "0"; then
3055 AC_MSG_ERROR([cannot find out size of long.])
3057 if test -z "$ac_cv_sizeof_voidp" ||
3058 test "$ac_cv_sizeof_voidp" -eq "0"; then
3059 AC_MSG_ERROR([cannot find out size of void*.])
3066 if test "$ac_cv_sizeof_long" -eq "8" &&
3067 test "$ac_cv_sizeof_voidp" -ge "8"; then
3069 elif test "$ac_cv_sizeof_long" -eq "4" &&
3070 test "$ac_cv_sizeof_voidp" -ge "4"; then
3072 elif test "$ac_cv_sizeof_long" -eq "2" &&
3073 test "$ac_cv_sizeof_voidp" -ge "2"; then
3077 dnl DO_CURL_OFF_T_CHECK results are stored in next 3 vars
3079 curl_typeof_curl_off_t="unknown"
3080 curl_sizeof_curl_off_t="unknown"
3081 curl_format_curl_off_t="unknown"
3082 curl_format_curl_off_tu="unknown"
3084 if test "$curl_typeof_curl_off_t" = "unknown"; then
3085 AC_MSG_CHECKING([for 64-bit curl_off_t data type])
3093 DO_CURL_OFF_T_CHECK([$t8], [8])
3095 AC_MSG_RESULT([$curl_typeof_curl_off_t])
3097 if test "$curl_typeof_curl_off_t" = "unknown"; then
3098 AC_MSG_CHECKING([for 32-bit curl_off_t data type])
3104 DO_CURL_OFF_T_CHECK([$t4], [4])
3106 AC_MSG_RESULT([$curl_typeof_curl_off_t])
3108 if test "$curl_typeof_curl_off_t" = "unknown"; then
3109 AC_MSG_CHECKING([for 16-bit curl_off_t data type])
3115 DO_CURL_OFF_T_CHECK([$t2], [2])
3117 AC_MSG_RESULT([$curl_typeof_curl_off_t])
3119 if test "$curl_typeof_curl_off_t" = "unknown"; then
3120 AC_MSG_ERROR([cannot find data type for curl_off_t.])
3123 AC_MSG_CHECKING([size of curl_off_t])
3124 AC_MSG_RESULT([$curl_sizeof_curl_off_t])
3126 AC_MSG_CHECKING([formatting string directive for curl_off_t])
3127 if test "$curl_format_curl_off_t" != "unknown"; then
3128 x_pull_headers="yes"
3129 curl_format_curl_off_t=`echo "$curl_format_curl_off_t" | "$SED" 's/[["]]//g'`
3130 curl_format_curl_off_tu=`echo "$curl_format_curl_off_t" | "$SED" 's/i$/u/'`
3131 curl_format_curl_off_tu=`echo "$curl_format_curl_off_tu" | "$SED" 's/d$/u/'`
3132 curl_format_curl_off_tu=`echo "$curl_format_curl_off_tu" | "$SED" 's/D$/U/'`
3135 case AS_TR_SH([$curl_typeof_curl_off_t]) in
3136 long_long | __longlong | __longlong_t)
3137 curl_format_curl_off_t="lld"
3138 curl_format_curl_off_tu="llu"
3141 curl_format_curl_off_t="ld"
3142 curl_format_curl_off_tu="lu"
3145 curl_format_curl_off_t="d"
3146 curl_format_curl_off_tu="u"
3149 curl_format_curl_off_t="I64d"
3150 curl_format_curl_off_tu="I64u"
3153 curl_format_curl_off_t="I32d"
3154 curl_format_curl_off_tu="I32u"
3157 curl_format_curl_off_t="I16d"
3158 curl_format_curl_off_tu="I16u"
3161 AC_MSG_ERROR([cannot find print format string for curl_off_t.])
3165 AC_MSG_RESULT(["$curl_format_curl_off_t"])
3167 AC_MSG_CHECKING([formatting string directive for unsigned curl_off_t])
3168 AC_MSG_RESULT(["$curl_format_curl_off_tu"])
3170 DO_CURL_OFF_T_SUFFIX_CHECK([$curl_typeof_curl_off_t])
3172 if test "$x_pull_headers" = "yes"; then
3173 if test "x$ac_cv_header_sys_types_h" = "xyes"; then
3174 CURL_DEFINE_UNQUOTED([CURL_PULL_SYS_TYPES_H])
3176 if test "x$ac_cv_header_stdint_h" = "xyes"; then
3177 CURL_DEFINE_UNQUOTED([CURL_PULL_STDINT_H])
3179 if test "x$ac_cv_header_inttypes_h" = "xyes"; then
3180 CURL_DEFINE_UNQUOTED([CURL_PULL_INTTYPES_H])
3184 CURL_DEFINE_UNQUOTED([CURL_TYPEOF_CURL_OFF_T], [$curl_typeof_curl_off_t])
3185 CURL_DEFINE_UNQUOTED([CURL_FORMAT_CURL_OFF_T], ["$curl_format_curl_off_t"])
3186 CURL_DEFINE_UNQUOTED([CURL_FORMAT_CURL_OFF_TU], ["$curl_format_curl_off_tu"])
3187 CURL_DEFINE_UNQUOTED([CURL_FORMAT_OFF_T], ["%$curl_format_curl_off_t"])
3188 CURL_DEFINE_UNQUOTED([CURL_SIZEOF_CURL_OFF_T], [$curl_sizeof_curl_off_t])
3189 CURL_DEFINE_UNQUOTED([CURL_SUFFIX_CURL_OFF_T], [$curl_suffix_curl_off_t])
3190 CURL_DEFINE_UNQUOTED([CURL_SUFFIX_CURL_OFF_TU], [$curl_suffix_curl_off_tu])
3195 dnl CURL_CHECK_WIN32_LARGEFILE
3196 dnl -------------------------------------------------
3197 dnl Check if curl's WIN32 large file will be used
3199 AC_DEFUN([CURL_CHECK_WIN32_LARGEFILE], [
3200 AC_REQUIRE([CURL_CHECK_HEADER_WINDOWS])dnl
3201 AC_MSG_CHECKING([whether build target supports WIN32 file API])
3202 curl_win32_file_api="no"
3203 if test "$ac_cv_header_windows_h" = "yes"; then
3204 if test x"$enable_largefile" != "xno"; then
3208 #if !defined(_WIN32_WCE) && \
3209 (defined(__MINGW32__) || \
3210 (defined(_MSC_VER) && (defined(_WIN32) || defined(_WIN64))))
3213 WIN32 large file API not supported.
3217 curl_win32_file_api="win32_large_files"
3220 if test "$curl_win32_file_api" = "no"; then
3224 #if defined(_WIN32_WCE) || defined(__MINGW32__) || defined(_MSC_VER)
3227 WIN32 small file API not supported.
3231 curl_win32_file_api="win32_small_files"
3235 case "$curl_win32_file_api" in
3237 AC_MSG_RESULT([yes (large file enabled)])
3238 AC_DEFINE_UNQUOTED(USE_WIN32_LARGE_FILES, 1,
3239 [Define to 1 if you are building a Windows target with large file support.])
3242 AC_MSG_RESULT([yes (large file disabled)])
3243 AC_DEFINE_UNQUOTED(USE_WIN32_LARGE_FILES, 1,
3244 [Define to 1 if you are building a Windows target without large file support.])
3252 dnl CURL_CHECK_PKGCONFIG ($module)
3253 dnl ------------------------
3254 dnl search for the pkg-config tool (if not cross-compiling). Set the PKGCONFIG
3255 dnl variable to hold the path to it, or 'no' if not found/present.
3257 dnl If pkg-config is present, check that it has info about the $module or return
3261 AC_DEFUN([CURL_CHECK_PKGCONFIG], [
3262 if test x$cross_compiling != xyes; then
3263 dnl only do pkg-config magic when not cross-compiling
3264 AC_PATH_PROG( PKGCONFIG, pkg-config, no, $PATH:/usr/bin:/usr/local/bin)
3266 if test x$PKGCONFIG != xno; then
3267 AC_MSG_CHECKING([for $1 options with pkg-config])
3268 dnl ask pkg-config about $1
3269 $PKGCONFIG --exists $1
3270 if test "$?" -ne "0"; then
3271 dnl pkg-config does not have info about the given module! set the
3272 dnl variable to 'no'
3276 AC_MSG_RESULT([found])