1 #***************************************************************************
3 # Project ___| | | | _ \| |
5 # | (__| |_| | _ <| |___
6 # \___|\___/|_| \_\_____|
8 # Copyright (C) 1998 - 2013, 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.
21 #***************************************************************************
24 dnl CURL_CHECK_DEF (SYMBOL, [INCLUDES], [SILENT])
25 dnl -------------------------------------------------
26 dnl Use the C preprocessor to find out if the given object-style symbol
27 dnl is defined and get its expansion. This macro will not use default
28 dnl includes even if no INCLUDES argument is given. This macro will run
29 dnl silently when invoked with three arguments. If the expansion would
30 dnl result in a set of double-quoted strings the returned expansion will
31 dnl actually be a single double-quoted string concatenating all them.
33 AC_DEFUN([CURL_CHECK_DEF], [
34 AS_VAR_PUSHDEF([ac_HaveDef], [curl_cv_have_def_$1])dnl
35 AS_VAR_PUSHDEF([ac_Def], [curl_cv_def_$1])dnl
36 if test -z "$SED"; then
37 AC_MSG_ERROR([SED not set. Cannot continue without SED being set.])
39 if test -z "$GREP"; then
40 AC_MSG_ERROR([GREP not set. Cannot continue without GREP being set.])
42 ifelse($3,,[AC_MSG_CHECKING([for preprocessor definition of $1])])
52 tmp_exp=`eval "$ac_cpp conftest.$ac_ext" 2>/dev/null | \
53 "$GREP" CURL_DEF_TOKEN 2>/dev/null | \
54 "$SED" 's/.*CURL_DEF_TOKEN[[ ]][[ ]]*//' 2>/dev/null | \
55 "$SED" 's/[["]][[ ]]*[["]]//g' 2>/dev/null`
56 if test -z "$tmp_exp" || test "$tmp_exp" = "$1"; then
60 if test -z "$tmp_exp"; then
61 AS_VAR_SET(ac_HaveDef, no)
62 ifelse($3,,[AC_MSG_RESULT([no])])
64 AS_VAR_SET(ac_HaveDef, yes)
65 AS_VAR_SET(ac_Def, $tmp_exp)
66 ifelse($3,,[AC_MSG_RESULT([$tmp_exp])])
68 AS_VAR_POPDEF([ac_Def])dnl
69 AS_VAR_POPDEF([ac_HaveDef])dnl
73 dnl CURL_CHECK_DEF_CC (SYMBOL, [INCLUDES], [SILENT])
74 dnl -------------------------------------------------
75 dnl Use the C compiler to find out only if the given symbol is defined
76 dnl or not, this can not find out its expansion. This macro will not use
77 dnl default includes even if no INCLUDES argument is given. This macro
78 dnl will run silently when invoked with three arguments.
80 AC_DEFUN([CURL_CHECK_DEF_CC], [
81 AS_VAR_PUSHDEF([ac_HaveDef], [curl_cv_have_def_$1])dnl
82 ifelse($3,,[AC_MSG_CHECKING([for compiler definition of $1])])
91 force compilation error
96 tst_symbol_defined="yes"
98 tst_symbol_defined="no"
100 if test "$tst_symbol_defined" = "yes"; then
101 AS_VAR_SET(ac_HaveDef, yes)
102 ifelse($3,,[AC_MSG_RESULT([yes])])
104 AS_VAR_SET(ac_HaveDef, no)
105 ifelse($3,,[AC_MSG_RESULT([no])])
107 AS_VAR_POPDEF([ac_HaveDef])dnl
111 dnl CURL_CHECK_LIB_XNET
112 dnl -------------------------------------------------
113 dnl Verify if X/Open network library is required.
115 AC_DEFUN([CURL_CHECK_LIB_XNET], [
116 AC_MSG_CHECKING([if X/Open network library is required])
117 tst_lib_xnet_required="no"
122 #if defined(__hpux) && defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE >= 600)
124 #elif defined(__hpux) && defined(_XOPEN_SOURCE_EXTENDED)
127 force compilation error
132 tst_lib_xnet_required="yes"
135 AC_MSG_RESULT([$tst_lib_xnet_required])
139 dnl CURL_CHECK_AIX_ALL_SOURCE
140 dnl -------------------------------------------------
141 dnl Provides a replacement of traditional AC_AIX with
142 dnl an uniform behaviour across all autoconf versions,
143 dnl and with our own placement rules.
145 AC_DEFUN([CURL_CHECK_AIX_ALL_SOURCE], [
146 AH_VERBATIM([_ALL_SOURCE],
147 [/* Define to 1 if OS is AIX. */
151 AC_BEFORE([$0], [AC_SYS_LARGEFILE])dnl
152 AC_BEFORE([$0], [CURL_CONFIGURE_REENTRANT])dnl
153 AC_BEFORE([$0], [CURL_CONFIGURE_PULL_SYS_POLL])dnl
154 AC_MSG_CHECKING([if OS is AIX (to define _ALL_SOURCE)])
155 AC_EGREP_CPP([yes_this_is_aix],[
161 AC_DEFINE(_ALL_SOURCE)
168 dnl CURL_CHECK_HEADER_WINDOWS
169 dnl -------------------------------------------------
170 dnl Check for compilable and valid windows.h header
172 AC_DEFUN([CURL_CHECK_HEADER_WINDOWS], [
173 AC_CACHE_CHECK([for windows.h], [ac_cv_header_windows_h], [
177 #ifndef WIN32_LEAN_AND_MEAN
178 #define WIN32_LEAN_AND_MEAN
182 #if defined(__CYGWIN__) || defined(__CEGCC__)
183 HAVE_WINDOWS_H shall not be defined.
189 ac_cv_header_windows_h="yes"
191 ac_cv_header_windows_h="no"
194 case "$ac_cv_header_windows_h" in
196 AC_DEFINE_UNQUOTED(HAVE_WINDOWS_H, 1,
197 [Define to 1 if you have the windows.h header file.])
198 AC_DEFINE_UNQUOTED(WIN32_LEAN_AND_MEAN, 1,
199 [Define to avoid automatic inclusion of winsock.h])
205 dnl CURL_CHECK_NATIVE_WINDOWS
206 dnl -------------------------------------------------
207 dnl Check if building a native Windows target
209 AC_DEFUN([CURL_CHECK_NATIVE_WINDOWS], [
210 AC_REQUIRE([CURL_CHECK_HEADER_WINDOWS])dnl
211 AC_CACHE_CHECK([whether build target is a native Windows one], [ac_cv_native_windows], [
212 if test "$ac_cv_header_windows_h" = "no"; then
213 ac_cv_native_windows="no"
218 #if defined(__MINGW32__) || defined(__MINGW32CE__) || \
219 (defined(_MSC_VER) && (defined(_WIN32) || defined(_WIN64)))
222 Not a native Windows build target.
226 ac_cv_native_windows="yes"
228 ac_cv_native_windows="no"
232 AM_CONDITIONAL(DOING_NATIVE_WINDOWS, test "x$ac_cv_native_windows" = xyes)
236 dnl CURL_CHECK_HEADER_WINSOCK
237 dnl -------------------------------------------------
238 dnl Check for compilable and valid winsock.h header
240 AC_DEFUN([CURL_CHECK_HEADER_WINSOCK], [
241 AC_REQUIRE([CURL_CHECK_HEADER_WINDOWS])dnl
242 AC_CACHE_CHECK([for winsock.h], [ac_cv_header_winsock_h], [
246 #ifndef WIN32_LEAN_AND_MEAN
247 #define WIN32_LEAN_AND_MEAN
252 #if defined(__CYGWIN__) || defined(__CEGCC__)
253 HAVE_WINSOCK_H shall not be defined.
255 int dummy=WSACleanup();
259 ac_cv_header_winsock_h="yes"
261 ac_cv_header_winsock_h="no"
264 case "$ac_cv_header_winsock_h" in
266 AC_DEFINE_UNQUOTED(HAVE_WINSOCK_H, 1,
267 [Define to 1 if you have the winsock.h header file.])
273 dnl CURL_CHECK_HEADER_WINSOCK2
274 dnl -------------------------------------------------
275 dnl Check for compilable and valid winsock2.h header
277 AC_DEFUN([CURL_CHECK_HEADER_WINSOCK2], [
278 AC_REQUIRE([CURL_CHECK_HEADER_WINDOWS])dnl
279 AC_CACHE_CHECK([for winsock2.h], [ac_cv_header_winsock2_h], [
283 #ifndef WIN32_LEAN_AND_MEAN
284 #define WIN32_LEAN_AND_MEAN
287 #include <winsock2.h>
289 #if defined(__CYGWIN__) || defined(__CEGCC__) || defined(__MINGW32CE__)
290 HAVE_WINSOCK2_H shall not be defined.
292 int dummy=2*IPPROTO_ESP;
296 ac_cv_header_winsock2_h="yes"
298 ac_cv_header_winsock2_h="no"
301 case "$ac_cv_header_winsock2_h" in
303 AC_DEFINE_UNQUOTED(HAVE_WINSOCK2_H, 1,
304 [Define to 1 if you have the winsock2.h header file.])
310 dnl CURL_CHECK_HEADER_WS2TCPIP
311 dnl -------------------------------------------------
312 dnl Check for compilable and valid ws2tcpip.h header
314 AC_DEFUN([CURL_CHECK_HEADER_WS2TCPIP], [
315 AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK2])dnl
316 AC_CACHE_CHECK([for ws2tcpip.h], [ac_cv_header_ws2tcpip_h], [
320 #ifndef WIN32_LEAN_AND_MEAN
321 #define WIN32_LEAN_AND_MEAN
324 #include <winsock2.h>
325 #include <ws2tcpip.h>
327 #if defined(__CYGWIN__) || defined(__CEGCC__) || defined(__MINGW32CE__)
328 HAVE_WS2TCPIP_H shall not be defined.
330 int dummy=2*IP_PKTINFO;
334 ac_cv_header_ws2tcpip_h="yes"
336 ac_cv_header_ws2tcpip_h="no"
339 case "$ac_cv_header_ws2tcpip_h" in
341 AC_DEFINE_UNQUOTED(HAVE_WS2TCPIP_H, 1,
342 [Define to 1 if you have the ws2tcpip.h header file.])
348 dnl CURL_CHECK_HEADER_WINLDAP
349 dnl -------------------------------------------------
350 dnl Check for compilable and valid winldap.h header
352 AC_DEFUN([CURL_CHECK_HEADER_WINLDAP], [
353 AC_REQUIRE([CURL_CHECK_HEADER_WINDOWS])dnl
354 AC_CACHE_CHECK([for winldap.h], [ac_cv_header_winldap_h], [
358 #ifdef HAVE_WINDOWS_H
359 #ifndef WIN32_LEAN_AND_MEAN
360 #define WIN32_LEAN_AND_MEAN
366 #if defined(__CYGWIN__) || defined(__CEGCC__)
367 HAVE_WINLDAP_H shall not be defined.
369 LDAP *ldp = ldap_init("dummy", LDAP_PORT);
370 ULONG res = ldap_unbind(ldp);
374 ac_cv_header_winldap_h="yes"
376 ac_cv_header_winldap_h="no"
379 case "$ac_cv_header_winldap_h" in
381 AC_DEFINE_UNQUOTED(HAVE_WINLDAP_H, 1,
382 [Define to 1 if you have the winldap.h header file.])
388 dnl CURL_CHECK_HEADER_WINBER
389 dnl -------------------------------------------------
390 dnl Check for compilable and valid winber.h header
392 AC_DEFUN([CURL_CHECK_HEADER_WINBER], [
393 AC_REQUIRE([CURL_CHECK_HEADER_WINLDAP])dnl
394 AC_CACHE_CHECK([for winber.h], [ac_cv_header_winber_h], [
398 #ifdef HAVE_WINDOWS_H
399 #ifndef WIN32_LEAN_AND_MEAN
400 #define WIN32_LEAN_AND_MEAN
407 #if defined(__CYGWIN__) || defined(__CEGCC__)
408 HAVE_WINBER_H shall not be defined.
411 BerElement *bep = ber_init(bvp);
416 ac_cv_header_winber_h="yes"
418 ac_cv_header_winber_h="no"
421 case "$ac_cv_header_winber_h" in
423 AC_DEFINE_UNQUOTED(HAVE_WINBER_H, 1,
424 [Define to 1 if you have the winber.h header file.])
430 dnl CURL_CHECK_HEADER_LBER
431 dnl -------------------------------------------------
432 dnl Check for compilable and valid lber.h header,
433 dnl and check if it is needed even with ldap.h
435 AC_DEFUN([CURL_CHECK_HEADER_LBER], [
436 AC_REQUIRE([CURL_CHECK_HEADER_WINDOWS])dnl
437 AC_CACHE_CHECK([for lber.h], [ac_cv_header_lber_h], [
441 #ifdef HAVE_WINDOWS_H
442 #ifndef WIN32_LEAN_AND_MEAN
443 #define WIN32_LEAN_AND_MEAN
447 #ifdef HAVE_SYS_TYPES_H
448 #include <sys/types.h>
452 #define NULL (void *)0
456 BerValue *bvp = NULL;
457 BerElement *bep = ber_init(bvp);
461 ac_cv_header_lber_h="yes"
463 ac_cv_header_lber_h="no"
466 if test "$ac_cv_header_lber_h" = "yes"; then
467 AC_DEFINE_UNQUOTED(HAVE_LBER_H, 1,
468 [Define to 1 if you have the lber.h header file.])
473 #ifdef HAVE_WINDOWS_H
474 #ifndef WIN32_LEAN_AND_MEAN
475 #define WIN32_LEAN_AND_MEAN
479 #ifdef HAVE_SYS_TYPES_H
480 #include <sys/types.h>
484 #define NULL (void *)0
486 #ifndef LDAP_DEPRECATED
487 #define LDAP_DEPRECATED 1
491 BerValue *bvp = NULL;
492 BerElement *bep = ber_init(bvp);
496 curl_cv_need_header_lber_h="no"
498 curl_cv_need_header_lber_h="yes"
501 case "$curl_cv_need_header_lber_h" in
503 AC_DEFINE_UNQUOTED(NEED_LBER_H, 1,
504 [Define to 1 if you need the lber.h header file even with ldap.h])
511 dnl CURL_CHECK_HEADER_LDAP
512 dnl -------------------------------------------------
513 dnl Check for compilable and valid ldap.h header
515 AC_DEFUN([CURL_CHECK_HEADER_LDAP], [
516 AC_REQUIRE([CURL_CHECK_HEADER_LBER])dnl
517 AC_CACHE_CHECK([for ldap.h], [ac_cv_header_ldap_h], [
521 #ifdef HAVE_WINDOWS_H
522 #ifndef WIN32_LEAN_AND_MEAN
523 #define WIN32_LEAN_AND_MEAN
527 #ifdef HAVE_SYS_TYPES_H
528 #include <sys/types.h>
531 #ifndef LDAP_DEPRECATED
532 #define LDAP_DEPRECATED 1
539 LDAP *ldp = ldap_init("dummy", LDAP_PORT);
540 int res = ldap_unbind(ldp);
543 ac_cv_header_ldap_h="yes"
545 ac_cv_header_ldap_h="no"
548 case "$ac_cv_header_ldap_h" in
550 AC_DEFINE_UNQUOTED(HAVE_LDAP_H, 1,
551 [Define to 1 if you have the ldap.h header file.])
557 dnl CURL_CHECK_HEADER_LDAP_SSL
558 dnl -------------------------------------------------
559 dnl Check for compilable and valid ldap_ssl.h header
561 AC_DEFUN([CURL_CHECK_HEADER_LDAP_SSL], [
562 AC_REQUIRE([CURL_CHECK_HEADER_LDAP])dnl
563 AC_CACHE_CHECK([for ldap_ssl.h], [ac_cv_header_ldap_ssl_h], [
567 #ifdef HAVE_WINDOWS_H
568 #ifndef WIN32_LEAN_AND_MEAN
569 #define WIN32_LEAN_AND_MEAN
573 #ifdef HAVE_SYS_TYPES_H
574 #include <sys/types.h>
577 #ifndef LDAP_DEPRECATED
578 #define LDAP_DEPRECATED 1
586 #include <ldap_ssl.h>
588 LDAP *ldp = ldapssl_init("dummy", LDAPS_PORT, 1);
591 ac_cv_header_ldap_ssl_h="yes"
593 ac_cv_header_ldap_ssl_h="no"
596 case "$ac_cv_header_ldap_ssl_h" in
598 AC_DEFINE_UNQUOTED(HAVE_LDAP_SSL_H, 1,
599 [Define to 1 if you have the ldap_ssl.h header file.])
605 dnl CURL_CHECK_HEADER_LDAPSSL
606 dnl -------------------------------------------------
607 dnl Check for compilable and valid ldapssl.h header
609 AC_DEFUN([CURL_CHECK_HEADER_LDAPSSL], [
610 AC_REQUIRE([CURL_CHECK_HEADER_LDAP])dnl
611 AC_CACHE_CHECK([for ldapssl.h], [ac_cv_header_ldapssl_h], [
615 #ifdef HAVE_WINDOWS_H
616 #ifndef WIN32_LEAN_AND_MEAN
617 #define WIN32_LEAN_AND_MEAN
621 #ifdef HAVE_SYS_TYPES_H
622 #include <sys/types.h>
626 #define NULL (void *)0
628 #ifndef LDAP_DEPRECATED
629 #define LDAP_DEPRECATED 1
639 char *cert_label = NULL;
640 LDAP *ldp = ldap_ssl_init("dummy", LDAPS_PORT, cert_label);
643 ac_cv_header_ldapssl_h="yes"
645 ac_cv_header_ldapssl_h="no"
648 case "$ac_cv_header_ldapssl_h" in
650 AC_DEFINE_UNQUOTED(HAVE_LDAPSSL_H, 1,
651 [Define to 1 if you have the ldapssl.h header file.])
657 dnl CURL_CHECK_LIBS_WINLDAP
658 dnl -------------------------------------------------
659 dnl Check for libraries needed for WINLDAP support,
660 dnl and prepended to LIBS any needed libraries.
661 dnl This macro can take an optional parameter with a
662 dnl white space separated list of libraries to check
663 dnl before the WINLDAP default ones.
665 AC_DEFUN([CURL_CHECK_LIBS_WINLDAP], [
666 AC_REQUIRE([CURL_CHECK_HEADER_WINBER])dnl
668 AC_MSG_CHECKING([for WINLDAP libraries])
682 if test -z "$u_libs"; then
685 u_libs="$u_libs $l_lib"
690 curl_cv_save_LIBS="$LIBS"
691 curl_cv_ldap_LIBS="unknown"
693 for x_nlibs in '' "$u_libs" \
695 if test "$curl_cv_ldap_LIBS" = "unknown"; then
696 if test -z "$x_nlibs"; then
697 LIBS="$curl_cv_save_LIBS"
699 LIBS="$x_nlibs $curl_cv_save_LIBS"
704 #ifdef HAVE_WINDOWS_H
705 #ifndef WIN32_LEAN_AND_MEAN
706 #define WIN32_LEAN_AND_MEAN
709 #ifdef HAVE_WINLDAP_H
718 BerElement *bep = ber_init(bvp);
719 LDAP *ldp = ldap_init("dummy", LDAP_PORT);
720 ULONG res = ldap_unbind(ldp);
724 curl_cv_ldap_LIBS="$x_nlibs"
729 LIBS="$curl_cv_save_LIBS"
731 case X-"$curl_cv_ldap_LIBS" in
733 AC_MSG_RESULT([cannot find WINLDAP libraries])
736 AC_MSG_RESULT([no additional lib required])
739 if test -z "$curl_cv_save_LIBS"; then
740 LIBS="$curl_cv_ldap_LIBS"
742 LIBS="$curl_cv_ldap_LIBS $curl_cv_save_LIBS"
744 AC_MSG_RESULT([$curl_cv_ldap_LIBS])
751 dnl CURL_CHECK_LIBS_LDAP
752 dnl -------------------------------------------------
753 dnl Check for libraries needed for LDAP support,
754 dnl and prepended to LIBS any needed libraries.
755 dnl This macro can take an optional parameter with a
756 dnl white space separated list of libraries to check
757 dnl before the default ones.
759 AC_DEFUN([CURL_CHECK_LIBS_LDAP], [
760 AC_REQUIRE([CURL_CHECK_HEADER_LDAP])dnl
762 AC_MSG_CHECKING([for LDAP libraries])
776 if test -z "$u_libs"; then
779 u_libs="$u_libs $l_lib"
784 curl_cv_save_LIBS="$LIBS"
785 curl_cv_ldap_LIBS="unknown"
787 for x_nlibs in '' "$u_libs" \
791 '-lldapssl -lldapx -lldapsdk' \
792 '-lldapsdk -lldapx -lldapssl' ; do
793 if test "$curl_cv_ldap_LIBS" = "unknown"; then
794 if test -z "$x_nlibs"; then
795 LIBS="$curl_cv_save_LIBS"
797 LIBS="$x_nlibs $curl_cv_save_LIBS"
802 #ifdef HAVE_WINDOWS_H
803 #ifndef WIN32_LEAN_AND_MEAN
804 #define WIN32_LEAN_AND_MEAN
808 #ifdef HAVE_SYS_TYPES_H
809 #include <sys/types.h>
813 #define NULL (void *)0
815 #ifndef LDAP_DEPRECATED
816 #define LDAP_DEPRECATED 1
825 BerValue *bvp = NULL;
826 BerElement *bep = ber_init(bvp);
827 LDAP *ldp = ldap_init("dummy", LDAP_PORT);
828 int res = ldap_unbind(ldp);
832 curl_cv_ldap_LIBS="$x_nlibs"
837 LIBS="$curl_cv_save_LIBS"
839 case X-"$curl_cv_ldap_LIBS" in
841 AC_MSG_RESULT([cannot find LDAP libraries])
844 AC_MSG_RESULT([no additional lib required])
847 if test -z "$curl_cv_save_LIBS"; then
848 LIBS="$curl_cv_ldap_LIBS"
850 LIBS="$curl_cv_ldap_LIBS $curl_cv_save_LIBS"
852 AC_MSG_RESULT([$curl_cv_ldap_LIBS])
859 dnl CURL_CHECK_HEADER_MALLOC
860 dnl -------------------------------------------------
861 dnl Check for compilable and valid malloc.h header,
862 dnl and check if it is needed even with stdlib.h
864 AC_DEFUN([CURL_CHECK_HEADER_MALLOC], [
865 AC_CACHE_CHECK([for malloc.h], [ac_cv_header_malloc_h], [
870 void *p = malloc(10);
871 void *q = calloc(10,10);
876 ac_cv_header_malloc_h="yes"
878 ac_cv_header_malloc_h="no"
881 if test "$ac_cv_header_malloc_h" = "yes"; then
882 AC_DEFINE_UNQUOTED(HAVE_MALLOC_H, 1,
883 [Define to 1 if you have the malloc.h header file.])
889 void *p = malloc(10);
890 void *q = calloc(10,10);
895 curl_cv_need_header_malloc_h="no"
897 curl_cv_need_header_malloc_h="yes"
900 case "$curl_cv_need_header_malloc_h" in
902 AC_DEFINE_UNQUOTED(NEED_MALLOC_H, 1,
903 [Define to 1 if you need the malloc.h header file even with stdlib.h])
910 dnl CURL_CHECK_HEADER_MEMORY
911 dnl -------------------------------------------------
912 dnl Check for compilable and valid memory.h header,
913 dnl and check if it is needed even with stdlib.h for
914 dnl memory related functions.
916 AC_DEFUN([CURL_CHECK_HEADER_MEMORY], [
917 AC_CACHE_CHECK([for memory.h], [ac_cv_header_memory_h], [
922 void *p = malloc(10);
923 void *q = calloc(10,10);
928 ac_cv_header_memory_h="yes"
930 ac_cv_header_memory_h="no"
933 if test "$ac_cv_header_memory_h" = "yes"; then
934 AC_DEFINE_UNQUOTED(HAVE_MEMORY_H, 1,
935 [Define to 1 if you have the memory.h header file.])
941 void *p = malloc(10);
942 void *q = calloc(10,10);
947 curl_cv_need_header_memory_h="no"
949 curl_cv_need_header_memory_h="yes"
952 case "$curl_cv_need_header_memory_h" in
954 AC_DEFINE_UNQUOTED(NEED_MEMORY_H, 1,
955 [Define to 1 if you need the memory.h header file even with stdlib.h])
962 dnl CURL_CHECK_FUNC_GETNAMEINFO
963 dnl -------------------------------------------------
964 dnl Test if the getnameinfo function is available,
965 dnl and check the types of five of its arguments.
966 dnl If the function succeeds HAVE_GETNAMEINFO will be
967 dnl defined, defining the types of the arguments in
968 dnl GETNAMEINFO_TYPE_ARG1, GETNAMEINFO_TYPE_ARG2,
969 dnl GETNAMEINFO_TYPE_ARG46 and GETNAMEINFO_TYPE_ARG7,
970 dnl and also defining the type qualifier of first
971 dnl argument in GETNAMEINFO_QUAL_ARG1.
973 AC_DEFUN([CURL_CHECK_FUNC_GETNAMEINFO], [
974 AC_REQUIRE([CURL_CHECK_HEADER_WS2TCPIP])dnl
975 AC_CHECK_HEADERS(sys/types.h sys/socket.h netdb.h)
977 AC_MSG_CHECKING([for getnameinfo])
979 AC_LANG_FUNC_LINK_TRY([getnameinfo])
982 curl_cv_getnameinfo="yes"
985 curl_cv_getnameinfo="no"
988 if test "$curl_cv_getnameinfo" != "yes"; then
989 AC_MSG_CHECKING([deeper for getnameinfo])
997 curl_cv_getnameinfo="yes"
999 AC_MSG_RESULT([but still no])
1000 curl_cv_getnameinfo="no"
1004 if test "$curl_cv_getnameinfo" != "yes"; then
1005 AC_MSG_CHECKING([deeper and deeper for getnameinfo])
1009 #ifdef HAVE_WINDOWS_H
1010 #ifndef WIN32_LEAN_AND_MEAN
1011 #define WIN32_LEAN_AND_MEAN
1013 #include <windows.h>
1014 #ifdef HAVE_WINSOCK2_H
1015 #include <winsock2.h>
1016 #ifdef HAVE_WS2TCPIP_H
1017 #include <ws2tcpip.h>
1021 #ifdef HAVE_SYS_TYPES_H
1022 #include <sys/types.h>
1024 #ifdef HAVE_SYS_SOCKET_H
1025 #include <sys/socket.h>
1032 getnameinfo(0, 0, 0, 0, 0, 0, 0);
1035 AC_MSG_RESULT([yes])
1036 curl_cv_getnameinfo="yes"
1038 AC_MSG_RESULT([but still no])
1039 curl_cv_getnameinfo="no"
1043 if test "$curl_cv_getnameinfo" = "yes"; then
1044 AC_CACHE_CHECK([types of arguments for getnameinfo],
1045 [curl_cv_func_getnameinfo_args], [
1046 curl_cv_func_getnameinfo_args="unknown"
1047 for gni_arg1 in 'struct sockaddr *' 'const struct sockaddr *' 'void *'; do
1048 for gni_arg2 in 'socklen_t' 'size_t' 'int'; do
1049 for gni_arg46 in 'size_t' 'int' 'socklen_t' 'unsigned int' 'DWORD'; do
1050 for gni_arg7 in 'int' 'unsigned int'; do
1051 if test "$curl_cv_func_getnameinfo_args" = "unknown"; then
1055 #ifdef HAVE_WINDOWS_H
1056 #ifndef WIN32_LEAN_AND_MEAN
1057 #define WIN32_LEAN_AND_MEAN
1059 #if (!defined(_WIN32_WINNT)) || (_WIN32_WINNT < 0x0501)
1061 #define _WIN32_WINNT 0x0501
1063 #include <windows.h>
1064 #ifdef HAVE_WINSOCK2_H
1065 #include <winsock2.h>
1066 #ifdef HAVE_WS2TCPIP_H
1067 #include <ws2tcpip.h>
1070 #define GNICALLCONV WSAAPI
1072 #ifdef HAVE_SYS_TYPES_H
1073 #include <sys/types.h>
1075 #ifdef HAVE_SYS_SOCKET_H
1076 #include <sys/socket.h>
1083 extern int GNICALLCONV getnameinfo($gni_arg1, $gni_arg2,
1089 $gni_arg46 hostlen=0;
1090 $gni_arg46 servlen=0;
1092 int res = getnameinfo(0, salen, 0, hostlen, 0, servlen, flags);
1095 curl_cv_func_getnameinfo_args="$gni_arg1,$gni_arg2,$gni_arg46,$gni_arg7"
1103 if test "$curl_cv_func_getnameinfo_args" = "unknown"; then
1104 AC_MSG_WARN([Cannot find proper types to use for getnameinfo args])
1105 AC_MSG_WARN([HAVE_GETNAMEINFO will not be defined])
1107 gni_prev_IFS=$IFS; IFS=','
1108 set dummy `echo "$curl_cv_func_getnameinfo_args" | sed 's/\*/\*/g'`
1112 gni_qual_type_arg1=$[1]
1114 AC_DEFINE_UNQUOTED(GETNAMEINFO_TYPE_ARG2, $[2],
1115 [Define to the type of arg 2 for getnameinfo.])
1116 AC_DEFINE_UNQUOTED(GETNAMEINFO_TYPE_ARG46, $[3],
1117 [Define to the type of args 4 and 6 for getnameinfo.])
1118 AC_DEFINE_UNQUOTED(GETNAMEINFO_TYPE_ARG7, $[4],
1119 [Define to the type of arg 7 for getnameinfo.])
1123 case $prev_sh_opts in
1131 case "$gni_qual_type_arg1" in
1134 gni_type_arg1=`echo $gni_qual_type_arg1 | sed 's/^const //'`
1138 gni_type_arg1=$gni_qual_type_arg1
1142 AC_DEFINE_UNQUOTED(GETNAMEINFO_QUAL_ARG1, $gni_qual_arg1,
1143 [Define to the type qualifier of arg 1 for getnameinfo.])
1144 AC_DEFINE_UNQUOTED(GETNAMEINFO_TYPE_ARG1, $gni_type_arg1,
1145 [Define to the type of arg 1 for getnameinfo.])
1147 case $prev_sh_opts in
1155 AC_DEFINE_UNQUOTED(HAVE_GETNAMEINFO, 1,
1156 [Define to 1 if you have the getnameinfo function.])
1157 ac_cv_func_getnameinfo="yes"
1163 dnl TYPE_SOCKADDR_STORAGE
1164 dnl -------------------------------------------------
1165 dnl Check for struct sockaddr_storage. Most IPv6-enabled
1166 dnl hosts have it, but AIX 4.3 is one known exception.
1168 AC_DEFUN([TYPE_SOCKADDR_STORAGE],
1170 AC_CHECK_TYPE([struct sockaddr_storage],
1171 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE, 1,
1172 [if struct sockaddr_storage is defined]), ,
1175 #ifdef HAVE_WINDOWS_H
1176 #ifndef WIN32_LEAN_AND_MEAN
1177 #define WIN32_LEAN_AND_MEAN
1179 #include <windows.h>
1180 #ifdef HAVE_WINSOCK2_H
1181 #include <winsock2.h>
1184 #ifdef HAVE_SYS_TYPES_H
1185 #include <sys/types.h>
1187 #ifdef HAVE_SYS_SOCKET_H
1188 #include <sys/socket.h>
1190 #ifdef HAVE_NETINET_IN_H
1191 #include <netinet/in.h>
1193 #ifdef HAVE_ARPA_INET_H
1194 #include <arpa/inet.h>
1201 dnl CURL_CHECK_NI_WITHSCOPEID
1202 dnl -------------------------------------------------
1203 dnl Check for working NI_WITHSCOPEID in getnameinfo()
1205 AC_DEFUN([CURL_CHECK_NI_WITHSCOPEID], [
1206 AC_REQUIRE([CURL_CHECK_FUNC_GETNAMEINFO])dnl
1207 AC_REQUIRE([TYPE_SOCKADDR_STORAGE])dnl
1208 AC_CHECK_HEADERS(stdio.h sys/types.h sys/socket.h \
1209 netdb.h netinet/in.h arpa/inet.h)
1211 AC_CACHE_CHECK([for working NI_WITHSCOPEID],
1212 [ac_cv_working_ni_withscopeid], [
1215 #ifdef HAVE_STDLIB_H
1221 #ifdef HAVE_SYS_TYPES_H
1222 #include <sys/types.h>
1224 #ifdef HAVE_SYS_SOCKET_H
1225 #include <sys/socket.h>
1230 #ifdef HAVE_NETINET_IN_H
1231 #include <netinet/in.h>
1233 #ifdef HAVE_ARPA_INET_H
1234 #include <arpa/inet.h>
1237 #if defined(NI_WITHSCOPEID) && defined(HAVE_GETNAMEINFO)
1238 #ifdef HAVE_STRUCT_SOCKADDR_STORAGE
1239 struct sockaddr_storage sa;
1241 unsigned char sa[256];
1243 char hostbuf[NI_MAXHOST];
1245 GETNAMEINFO_TYPE_ARG2 salen = (GETNAMEINFO_TYPE_ARG2)sizeof(sa);
1246 GETNAMEINFO_TYPE_ARG46 hostlen = (GETNAMEINFO_TYPE_ARG46)sizeof(hostbuf);
1247 GETNAMEINFO_TYPE_ARG7 flags = NI_NUMERICHOST | NI_NUMERICSERV | NI_WITHSCOPEID;
1248 int fd = socket(AF_INET6, SOCK_STREAM, 0);
1251 return 1; /* Error creating socket */
1253 rc = getsockname(fd, (GETNAMEINFO_TYPE_ARG1)&sa, &salen);
1255 perror("getsockname()");
1256 return 2; /* Error retrieving socket name */
1258 rc = getnameinfo((GETNAMEINFO_TYPE_ARG1)&sa, salen, hostbuf, hostlen, NULL, 0, flags);
1260 printf("rc = %s\n", gai_strerror(rc));
1261 return 3; /* Error translating socket address */
1263 return 0; /* Ok, NI_WITHSCOPEID works */
1265 return 4; /* Error, NI_WITHSCOPEID not defined or no getnameinfo() */
1267 ]]) # AC-LANG-PROGRAM
1269 # Exit code == 0. Program worked.
1270 ac_cv_working_ni_withscopeid="yes"
1272 # Exit code != 0. Program failed.
1273 ac_cv_working_ni_withscopeid="no"
1275 # Program is not run when cross-compiling. So we assume
1276 # NI_WITHSCOPEID will work if we are able to compile it.
1279 #include <sys/types.h>
1280 #include <sys/socket.h>
1283 unsigned int dummy= NI_NUMERICHOST | NI_NUMERICSERV | NI_WITHSCOPEID;
1286 ac_cv_working_ni_withscopeid="yes"
1288 ac_cv_working_ni_withscopeid="no"
1289 ]) # AC-COMPILE-IFELSE
1292 case "$ac_cv_working_ni_withscopeid" in
1294 AC_DEFINE(HAVE_NI_WITHSCOPEID, 1,
1295 [Define to 1 if NI_WITHSCOPEID exists and works.])
1301 dnl CURL_CHECK_FUNC_RECV
1302 dnl -------------------------------------------------
1303 dnl Test if the socket recv() function is available,
1304 dnl and check its return type and the types of its
1305 dnl arguments. If the function succeeds HAVE_RECV
1306 dnl will be defined, defining the types of the arguments
1307 dnl in RECV_TYPE_ARG1, RECV_TYPE_ARG2, RECV_TYPE_ARG3
1308 dnl and RECV_TYPE_ARG4, defining the type of the function
1309 dnl return value in RECV_TYPE_RETV.
1311 AC_DEFUN([CURL_CHECK_FUNC_RECV], [
1312 AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK])dnl
1313 AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK2])dnl
1314 AC_CHECK_HEADERS(sys/types.h sys/socket.h)
1316 AC_MSG_CHECKING([for recv])
1320 #ifdef HAVE_WINDOWS_H
1321 #ifndef WIN32_LEAN_AND_MEAN
1322 #define WIN32_LEAN_AND_MEAN
1324 #include <windows.h>
1325 #ifdef HAVE_WINSOCK2_H
1326 #include <winsock2.h>
1328 #ifdef HAVE_WINSOCK_H
1329 #include <winsock.h>
1333 #ifdef HAVE_SYS_TYPES_H
1334 #include <sys/types.h>
1336 #ifdef HAVE_SYS_SOCKET_H
1337 #include <sys/socket.h>
1344 AC_MSG_RESULT([yes])
1351 if test "$curl_cv_recv" = "yes"; then
1352 AC_CACHE_CHECK([types of args and return type for recv],
1353 [curl_cv_func_recv_args], [
1354 curl_cv_func_recv_args="unknown"
1355 for recv_retv in 'int' 'ssize_t'; do
1356 for recv_arg1 in 'int' 'ssize_t' 'SOCKET'; do
1357 for recv_arg2 in 'char *' 'void *'; do
1358 for recv_arg3 in 'size_t' 'int' 'socklen_t' 'unsigned int'; do
1359 for recv_arg4 in 'int' 'unsigned int'; do
1360 if test "$curl_cv_func_recv_args" = "unknown"; then
1364 #ifdef HAVE_WINDOWS_H
1365 #ifndef WIN32_LEAN_AND_MEAN
1366 #define WIN32_LEAN_AND_MEAN
1368 #include <windows.h>
1369 #ifdef HAVE_WINSOCK2_H
1370 #include <winsock2.h>
1372 #ifdef HAVE_WINSOCK_H
1373 #include <winsock.h>
1376 #define RECVCALLCONV PASCAL
1378 #ifdef HAVE_SYS_TYPES_H
1379 #include <sys/types.h>
1381 #ifdef HAVE_SYS_SOCKET_H
1382 #include <sys/socket.h>
1384 #define RECVCALLCONV
1386 extern $recv_retv RECVCALLCONV
1387 recv($recv_arg1, $recv_arg2, $recv_arg3, $recv_arg4);
1393 $recv_retv res = recv(s, buf, len, flags);
1396 curl_cv_func_recv_args="$recv_arg1,$recv_arg2,$recv_arg3,$recv_arg4,$recv_retv"
1405 if test "$curl_cv_func_recv_args" = "unknown"; then
1406 AC_MSG_ERROR([Cannot find proper types to use for recv args])
1408 recv_prev_IFS=$IFS; IFS=','
1409 set dummy `echo "$curl_cv_func_recv_args" | sed 's/\*/\*/g'`
1413 AC_DEFINE_UNQUOTED(RECV_TYPE_ARG1, $[1],
1414 [Define to the type of arg 1 for recv.])
1415 AC_DEFINE_UNQUOTED(RECV_TYPE_ARG2, $[2],
1416 [Define to the type of arg 2 for recv.])
1417 AC_DEFINE_UNQUOTED(RECV_TYPE_ARG3, $[3],
1418 [Define to the type of arg 3 for recv.])
1419 AC_DEFINE_UNQUOTED(RECV_TYPE_ARG4, $[4],
1420 [Define to the type of arg 4 for recv.])
1421 AC_DEFINE_UNQUOTED(RECV_TYPE_RETV, $[5],
1422 [Define to the function return type for recv.])
1424 AC_DEFINE_UNQUOTED(HAVE_RECV, 1,
1425 [Define to 1 if you have the recv function.])
1426 ac_cv_func_recv="yes"
1429 AC_MSG_ERROR([Unable to link function recv])
1434 dnl CURL_CHECK_FUNC_SEND
1435 dnl -------------------------------------------------
1436 dnl Test if the socket send() function is available,
1437 dnl and check its return type and the types of its
1438 dnl arguments. If the function succeeds HAVE_SEND
1439 dnl will be defined, defining the types of the arguments
1440 dnl in SEND_TYPE_ARG1, SEND_TYPE_ARG2, SEND_TYPE_ARG3
1441 dnl and SEND_TYPE_ARG4, defining the type of the function
1442 dnl return value in SEND_TYPE_RETV, and also defining the
1443 dnl type qualifier of second argument in SEND_QUAL_ARG2.
1445 AC_DEFUN([CURL_CHECK_FUNC_SEND], [
1446 AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK])dnl
1447 AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK2])dnl
1448 AC_CHECK_HEADERS(sys/types.h sys/socket.h)
1450 AC_MSG_CHECKING([for send])
1454 #ifdef HAVE_WINDOWS_H
1455 #ifndef WIN32_LEAN_AND_MEAN
1456 #define WIN32_LEAN_AND_MEAN
1458 #include <windows.h>
1459 #ifdef HAVE_WINSOCK2_H
1460 #include <winsock2.h>
1462 #ifdef HAVE_WINSOCK_H
1463 #include <winsock.h>
1467 #ifdef HAVE_SYS_TYPES_H
1468 #include <sys/types.h>
1470 #ifdef HAVE_SYS_SOCKET_H
1471 #include <sys/socket.h>
1478 AC_MSG_RESULT([yes])
1485 if test "$curl_cv_send" = "yes"; then
1486 AC_CACHE_CHECK([types of args and return type for send],
1487 [curl_cv_func_send_args], [
1488 curl_cv_func_send_args="unknown"
1489 for send_retv in 'int' 'ssize_t'; do
1490 for send_arg1 in 'int' 'ssize_t' 'SOCKET'; do
1491 for send_arg2 in 'char *' 'void *' 'const char *' 'const void *'; do
1492 for send_arg3 in 'size_t' 'int' 'socklen_t' 'unsigned int'; do
1493 for send_arg4 in 'int' 'unsigned int'; do
1494 if test "$curl_cv_func_send_args" = "unknown"; then
1498 #ifdef HAVE_WINDOWS_H
1499 #ifndef WIN32_LEAN_AND_MEAN
1500 #define WIN32_LEAN_AND_MEAN
1502 #include <windows.h>
1503 #ifdef HAVE_WINSOCK2_H
1504 #include <winsock2.h>
1506 #ifdef HAVE_WINSOCK_H
1507 #include <winsock.h>
1510 #define SENDCALLCONV PASCAL
1512 #ifdef HAVE_SYS_TYPES_H
1513 #include <sys/types.h>
1515 #ifdef HAVE_SYS_SOCKET_H
1516 #include <sys/socket.h>
1518 #define SENDCALLCONV
1520 extern $send_retv SENDCALLCONV
1521 send($send_arg1, $send_arg2, $send_arg3, $send_arg4);
1526 $send_retv res = send(s, 0, len, flags);
1529 curl_cv_func_send_args="$send_arg1,$send_arg2,$send_arg3,$send_arg4,$send_retv"
1538 if test "$curl_cv_func_send_args" = "unknown"; then
1539 AC_MSG_ERROR([Cannot find proper types to use for send args])
1541 send_prev_IFS=$IFS; IFS=','
1542 set dummy `echo "$curl_cv_func_send_args" | sed 's/\*/\*/g'`
1546 send_qual_type_arg2=$[2]
1548 AC_DEFINE_UNQUOTED(SEND_TYPE_ARG1, $[1],
1549 [Define to the type of arg 1 for send.])
1550 AC_DEFINE_UNQUOTED(SEND_TYPE_ARG3, $[3],
1551 [Define to the type of arg 3 for send.])
1552 AC_DEFINE_UNQUOTED(SEND_TYPE_ARG4, $[4],
1553 [Define to the type of arg 4 for send.])
1554 AC_DEFINE_UNQUOTED(SEND_TYPE_RETV, $[5],
1555 [Define to the function return type for send.])
1559 case $prev_sh_opts in
1567 case "$send_qual_type_arg2" in
1569 send_qual_arg2=const
1570 send_type_arg2=`echo $send_qual_type_arg2 | sed 's/^const //'`
1574 send_type_arg2=$send_qual_type_arg2
1578 AC_DEFINE_UNQUOTED(SEND_QUAL_ARG2, $send_qual_arg2,
1579 [Define to the type qualifier of arg 2 for send.])
1580 AC_DEFINE_UNQUOTED(SEND_TYPE_ARG2, $send_type_arg2,
1581 [Define to the type of arg 2 for send.])
1583 case $prev_sh_opts in
1591 AC_DEFINE_UNQUOTED(HAVE_SEND, 1,
1592 [Define to 1 if you have the send function.])
1593 ac_cv_func_send="yes"
1596 AC_MSG_ERROR([Unable to link function send])
1600 dnl CURL_CHECK_MSG_NOSIGNAL
1601 dnl -------------------------------------------------
1602 dnl Check for MSG_NOSIGNAL
1604 AC_DEFUN([CURL_CHECK_MSG_NOSIGNAL], [
1605 AC_CHECK_HEADERS(sys/types.h sys/socket.h)
1606 AC_CACHE_CHECK([for MSG_NOSIGNAL], [ac_cv_msg_nosignal], [
1610 #ifdef HAVE_WINDOWS_H
1611 #ifndef WIN32_LEAN_AND_MEAN
1612 #define WIN32_LEAN_AND_MEAN
1614 #include <windows.h>
1615 #ifdef HAVE_WINSOCK2_H
1616 #include <winsock2.h>
1618 #ifdef HAVE_WINSOCK_H
1619 #include <winsock.h>
1623 #ifdef HAVE_SYS_TYPES_H
1624 #include <sys/types.h>
1626 #ifdef HAVE_SYS_SOCKET_H
1627 #include <sys/socket.h>
1631 int flag=MSG_NOSIGNAL;
1634 ac_cv_msg_nosignal="yes"
1636 ac_cv_msg_nosignal="no"
1639 case "$ac_cv_msg_nosignal" in
1641 AC_DEFINE_UNQUOTED(HAVE_MSG_NOSIGNAL, 1,
1642 [Define to 1 if you have the MSG_NOSIGNAL flag.])
1648 dnl CURL_CHECK_STRUCT_TIMEVAL
1649 dnl -------------------------------------------------
1650 dnl Check for timeval struct
1652 AC_DEFUN([CURL_CHECK_STRUCT_TIMEVAL], [
1653 AC_REQUIRE([AC_HEADER_TIME])dnl
1654 AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK])dnl
1655 AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK2])dnl
1656 AC_CHECK_HEADERS(sys/types.h sys/time.h time.h sys/socket.h)
1657 AC_CACHE_CHECK([for struct timeval], [ac_cv_struct_timeval], [
1661 #ifdef HAVE_WINDOWS_H
1662 #ifndef WIN32_LEAN_AND_MEAN
1663 #define WIN32_LEAN_AND_MEAN
1665 #include <windows.h>
1666 #ifdef HAVE_WINSOCK2_H
1667 #include <winsock2.h>
1669 #ifdef HAVE_WINSOCK_H
1670 #include <winsock.h>
1674 #ifdef HAVE_SYS_TYPES_H
1675 #include <sys/types.h>
1677 #ifdef HAVE_SYS_TIME_H
1678 #include <sys/time.h>
1679 #ifdef TIME_WITH_SYS_TIME
1687 #ifdef HAVE_SYS_SOCKET_H
1688 #include <sys/socket.h>
1696 ac_cv_struct_timeval="yes"
1698 ac_cv_struct_timeval="no"
1701 case "$ac_cv_struct_timeval" in
1703 AC_DEFINE_UNQUOTED(HAVE_STRUCT_TIMEVAL, 1,
1704 [Define to 1 if you have the timeval struct.])
1710 dnl TYPE_SIG_ATOMIC_T
1711 dnl -------------------------------------------------
1712 dnl Check if the sig_atomic_t type is available, and
1713 dnl verify if it is already defined as volatile.
1715 AC_DEFUN([TYPE_SIG_ATOMIC_T], [
1716 AC_CHECK_HEADERS(signal.h)
1717 AC_CHECK_TYPE([sig_atomic_t],[
1718 AC_DEFINE(HAVE_SIG_ATOMIC_T, 1,
1719 [Define to 1 if sig_atomic_t is an available typedef.])
1721 #ifdef HAVE_SIGNAL_H
1725 case "$ac_cv_type_sig_atomic_t" in
1728 AC_MSG_CHECKING([if sig_atomic_t is already defined as volatile])
1731 #ifdef HAVE_SIGNAL_H
1735 static volatile sig_atomic_t dummy = 0;
1739 ac_cv_sig_atomic_t_volatile="no"
1741 AC_MSG_RESULT([yes])
1742 ac_cv_sig_atomic_t_volatile="yes"
1745 if test "$ac_cv_sig_atomic_t_volatile" = "yes"; then
1746 AC_DEFINE(HAVE_SIG_ATOMIC_T_VOLATILE, 1,
1747 [Define to 1 if sig_atomic_t is already defined as volatile.])
1755 dnl -------------------------------------------------
1756 dnl Check for in_addr_t: it is used to receive the return code of inet_addr()
1757 dnl and a few other things.
1759 AC_DEFUN([TYPE_IN_ADDR_T], [
1760 AC_CHECK_TYPE([in_addr_t], ,[
1761 dnl in_addr_t not available
1762 AC_CACHE_CHECK([for in_addr_t equivalent],
1763 [curl_cv_in_addr_t_equiv], [
1764 curl_cv_in_addr_t_equiv="unknown"
1765 for t in "unsigned long" int size_t unsigned long; do
1766 if test "$curl_cv_in_addr_t_equiv" = "unknown"; then
1770 #ifdef HAVE_WINDOWS_H
1771 #ifndef WIN32_LEAN_AND_MEAN
1772 #define WIN32_LEAN_AND_MEAN
1774 #include <windows.h>
1775 #ifdef HAVE_WINSOCK2_H
1776 #include <winsock2.h>
1778 #ifdef HAVE_WINSOCK_H
1779 #include <winsock.h>
1783 #ifdef HAVE_SYS_TYPES_H
1784 #include <sys/types.h>
1786 #ifdef HAVE_SYS_SOCKET_H
1787 #include <sys/socket.h>
1789 #ifdef HAVE_NETINET_IN_H
1790 #include <netinet/in.h>
1792 #ifdef HAVE_ARPA_INET_H
1793 #include <arpa/inet.h>
1797 $t data = inet_addr ("1.2.3.4");
1800 curl_cv_in_addr_t_equiv="$t"
1805 case "$curl_cv_in_addr_t_equiv" in
1807 AC_MSG_ERROR([Cannot find a type to use in place of in_addr_t])
1810 AC_DEFINE_UNQUOTED(in_addr_t, $curl_cv_in_addr_t_equiv,
1811 [Type to use in place of in_addr_t when system does not provide it.])
1816 #ifdef HAVE_WINDOWS_H
1817 #ifndef WIN32_LEAN_AND_MEAN
1818 #define WIN32_LEAN_AND_MEAN
1820 #include <windows.h>
1821 #ifdef HAVE_WINSOCK2_H
1822 #include <winsock2.h>
1824 #ifdef HAVE_WINSOCK_H
1825 #include <winsock.h>
1829 #ifdef HAVE_SYS_TYPES_H
1830 #include <sys/types.h>
1832 #ifdef HAVE_SYS_SOCKET_H
1833 #include <sys/socket.h>
1835 #ifdef HAVE_NETINET_IN_H
1836 #include <netinet/in.h>
1838 #ifdef HAVE_ARPA_INET_H
1839 #include <arpa/inet.h>
1846 dnl CURL_CHECK_FUNC_CLOCK_GETTIME_MONOTONIC
1847 dnl -------------------------------------------------
1848 dnl Check if monotonic clock_gettime is available.
1850 AC_DEFUN([CURL_CHECK_FUNC_CLOCK_GETTIME_MONOTONIC], [
1851 AC_REQUIRE([AC_HEADER_TIME])dnl
1852 AC_CHECK_HEADERS(sys/types.h sys/time.h time.h)
1853 AC_MSG_CHECKING([for monotonic clock_gettime])
1856 #ifdef HAVE_SYS_TYPES_H
1857 #include <sys/types.h>
1859 #ifdef HAVE_SYS_TIME_H
1860 #include <sys/time.h>
1861 #ifdef TIME_WITH_SYS_TIME
1871 (void)clock_gettime(CLOCK_MONOTONIC, &ts);
1874 AC_MSG_RESULT([yes])
1875 ac_cv_func_clock_gettime="yes"
1878 ac_cv_func_clock_gettime="no"
1880 dnl Definition of HAVE_CLOCK_GETTIME_MONOTONIC is intentionally postponed
1881 dnl until library linking and run-time checks for clock_gettime succeed.
1885 dnl CURL_CHECK_LIBS_CLOCK_GETTIME_MONOTONIC
1886 dnl -------------------------------------------------
1887 dnl If monotonic clock_gettime is available then,
1888 dnl check and prepended to LIBS any needed libraries.
1890 AC_DEFUN([CURL_CHECK_LIBS_CLOCK_GETTIME_MONOTONIC], [
1891 AC_REQUIRE([CURL_CHECK_FUNC_CLOCK_GETTIME_MONOTONIC])dnl
1893 if test "$ac_cv_func_clock_gettime" = "yes"; then
1895 AC_MSG_CHECKING([for clock_gettime in libraries])
1897 curl_cv_save_LIBS="$LIBS"
1898 curl_cv_gclk_LIBS="unknown"
1900 for x_xlibs in '' '-lrt' '-lposix4' ; do
1901 if test "$curl_cv_gclk_LIBS" = "unknown"; then
1902 if test -z "$x_xlibs"; then
1903 LIBS="$curl_cv_save_LIBS"
1905 LIBS="$x_xlibs $curl_cv_save_LIBS"
1909 #ifdef HAVE_SYS_TYPES_H
1910 #include <sys/types.h>
1912 #ifdef HAVE_SYS_TIME_H
1913 #include <sys/time.h>
1914 #ifdef TIME_WITH_SYS_TIME
1924 (void)clock_gettime(CLOCK_MONOTONIC, &ts);
1927 curl_cv_gclk_LIBS="$x_xlibs"
1932 LIBS="$curl_cv_save_LIBS"
1934 case X-"$curl_cv_gclk_LIBS" in
1936 AC_MSG_RESULT([cannot find clock_gettime])
1937 AC_MSG_WARN([HAVE_CLOCK_GETTIME_MONOTONIC will not be defined])
1938 ac_cv_func_clock_gettime="no"
1941 AC_MSG_RESULT([no additional lib required])
1942 ac_cv_func_clock_gettime="yes"
1945 if test -z "$curl_cv_save_LIBS"; then
1946 LIBS="$curl_cv_gclk_LIBS"
1948 LIBS="$curl_cv_gclk_LIBS $curl_cv_save_LIBS"
1950 AC_MSG_RESULT([$curl_cv_gclk_LIBS])
1951 ac_cv_func_clock_gettime="yes"
1955 dnl only do runtime verification when not cross-compiling
1956 if test "x$cross_compiling" != "xyes" &&
1957 test "$ac_cv_func_clock_gettime" = "yes"; then
1958 AC_MSG_CHECKING([if monotonic clock_gettime works])
1961 #ifdef HAVE_STDLIB_H
1964 #ifdef HAVE_SYS_TYPES_H
1965 #include <sys/types.h>
1967 #ifdef HAVE_SYS_TIME_H
1968 #include <sys/time.h>
1969 #ifdef TIME_WITH_SYS_TIME
1979 if (0 == clock_gettime(CLOCK_MONOTONIC, &ts))
1985 AC_MSG_RESULT([yes])
1988 AC_MSG_WARN([HAVE_CLOCK_GETTIME_MONOTONIC will not be defined])
1989 ac_cv_func_clock_gettime="no"
1990 LIBS="$curl_cv_save_LIBS"
1994 case "$ac_cv_func_clock_gettime" in
1996 AC_DEFINE_UNQUOTED(HAVE_CLOCK_GETTIME_MONOTONIC, 1,
1997 [Define to 1 if you have the clock_gettime function and monotonic timer.])
2006 dnl CURL_CHECK_LIBS_CONNECT
2007 dnl -------------------------------------------------
2008 dnl Verify if network connect function is already available
2009 dnl using current libraries or if another one is required.
2011 AC_DEFUN([CURL_CHECK_LIBS_CONNECT], [
2012 AC_REQUIRE([CURL_INCLUDES_WINSOCK2])dnl
2013 AC_MSG_CHECKING([for connect in libraries])
2014 tst_connect_save_LIBS="$LIBS"
2015 tst_connect_need_LIBS="unknown"
2016 for tst_lib in '' '-lsocket' ; do
2017 if test "$tst_connect_need_LIBS" = "unknown"; then
2018 LIBS="$tst_lib $tst_connect_save_LIBS"
2021 $curl_includes_winsock2
2022 #ifndef HAVE_WINDOWS_H
2023 int connect(int, void*, int);
2026 if(0 != connect(0, 0, 0))
2030 tst_connect_need_LIBS="$tst_lib"
2034 LIBS="$tst_connect_save_LIBS"
2036 case X-"$tst_connect_need_LIBS" in
2038 AC_MSG_RESULT([cannot find connect])
2039 AC_MSG_ERROR([cannot find connect function in libraries.])
2042 AC_MSG_RESULT([yes])
2045 AC_MSG_RESULT([$tst_connect_need_LIBS])
2046 LIBS="$tst_connect_need_LIBS $tst_connect_save_LIBS"
2052 dnl CURL_DEFINE_UNQUOTED (VARIABLE, [VALUE])
2053 dnl -------------------------------------------------
2054 dnl Like AC_DEFINE_UNQUOTED this macro will define a C preprocessor
2055 dnl symbol that can be further used in custom template configuration
2056 dnl files. This macro, unlike AC_DEFINE_UNQUOTED, does not use a third
2057 dnl argument for the description. Symbol definitions done with this
2058 dnl macro are intended to be exclusively used in handcrafted *.h.in
2059 dnl template files. Contrary to what AC_DEFINE_UNQUOTED does, this one
2060 dnl prevents autoheader generation and insertion of symbol template
2061 dnl stub and definition into the first configuration header file. Do
2062 dnl not use this macro as a replacement for AC_DEFINE_UNQUOTED, each
2063 dnl one serves different functional needs.
2065 AC_DEFUN([CURL_DEFINE_UNQUOTED], [
2066 cat >>confdefs.h <<_EOF
2067 [@%:@define] $1 ifelse($#, 2, [$2], 1)
2072 dnl CURL_CONFIGURE_LONG
2073 dnl -------------------------------------------------
2074 dnl Find out the size of long as reported by sizeof() and define
2075 dnl CURL_SIZEOF_LONG as appropriate to be used in template file
2076 dnl include/curl/curlbuild.h.in to properly configure the library.
2077 dnl The size of long is a build time characteristic and as such
2078 dnl must be recorded in curlbuild.h
2080 AC_DEFUN([CURL_CONFIGURE_LONG], [
2081 if test -z "$ac_cv_sizeof_long" ||
2082 test "$ac_cv_sizeof_long" -eq "0"; then
2083 AC_MSG_ERROR([cannot find out size of long.])
2085 CURL_DEFINE_UNQUOTED([CURL_SIZEOF_LONG], [$ac_cv_sizeof_long])
2089 dnl CURL_CONFIGURE_CURL_SOCKLEN_T
2090 dnl -------------------------------------------------
2091 dnl Find out suitable curl_socklen_t data type definition and size, making
2092 dnl appropriate definitions for template file include/curl/curlbuild.h.in
2093 dnl to properly configure and use the library.
2095 dnl The need for the curl_socklen_t definition arises mainly to properly
2096 dnl interface HP-UX systems which on one hand have a typedef'ed socklen_t
2097 dnl data type which is 32 or 64-Bit wide depending on the data model being
2098 dnl used, and that on the other hand is only actually used when interfacing
2099 dnl the X/Open sockets provided in the xnet library.
2101 AC_DEFUN([CURL_CONFIGURE_CURL_SOCKLEN_T], [
2102 AC_REQUIRE([CURL_INCLUDES_WS2TCPIP])dnl
2103 AC_REQUIRE([CURL_INCLUDES_SYS_SOCKET])dnl
2104 AC_REQUIRE([CURL_PREPROCESS_CALLCONV])dnl
2106 AC_BEFORE([$0], [CURL_CONFIGURE_PULL_SYS_POLL])dnl
2108 AC_MSG_CHECKING([for curl_socklen_t data type])
2109 curl_typeof_curl_socklen_t="unknown"
2110 for arg1 in int SOCKET; do
2111 for arg2 in 'struct sockaddr' void; do
2112 for t in socklen_t int size_t 'unsigned int' long 'unsigned long' void; do
2113 if test "$curl_typeof_curl_socklen_t" = "unknown"; then
2116 $curl_includes_ws2tcpip
2117 $curl_includes_sys_socket
2118 $curl_preprocess_callconv
2119 extern int FUNCALLCONV getpeername($arg1, $arg2 *, $t *);
2122 if(0 != getpeername(0, 0, lenptr))
2126 curl_typeof_curl_socklen_t="$t"
2132 for t in socklen_t int; do
2133 if test "$curl_typeof_curl_socklen_t" = "void"; then
2136 $curl_includes_sys_socket
2137 typedef $t curl_socklen_t;
2139 curl_socklen_t dummy;
2142 curl_typeof_curl_socklen_t="$t"
2146 AC_MSG_RESULT([$curl_typeof_curl_socklen_t])
2147 if test "$curl_typeof_curl_socklen_t" = "void" ||
2148 test "$curl_typeof_curl_socklen_t" = "unknown"; then
2149 AC_MSG_ERROR([cannot find data type for curl_socklen_t.])
2152 AC_MSG_CHECKING([size of curl_socklen_t])
2153 curl_sizeof_curl_socklen_t="unknown"
2154 curl_pull_headers_socklen_t="unknown"
2155 if test "$ac_cv_header_ws2tcpip_h" = "yes"; then
2156 tst_pull_header_checks='none ws2tcpip'
2159 tst_pull_header_checks='none systypes syssocket'
2160 tst_size_checks='4 8 2'
2162 for tst_size in $tst_size_checks; do
2163 for tst_pull_headers in $tst_pull_header_checks; do
2164 if test "$curl_sizeof_curl_socklen_t" = "unknown"; then
2165 case $tst_pull_headers in
2167 tmp_includes="$curl_includes_ws2tcpip"
2170 tmp_includes="$curl_includes_sys_types"
2173 tmp_includes="$curl_includes_sys_socket"
2182 typedef $curl_typeof_curl_socklen_t curl_socklen_t;
2183 typedef char dummy_arr[sizeof(curl_socklen_t) == $tst_size ? 1 : -1];
2185 curl_socklen_t dummy;
2188 curl_sizeof_curl_socklen_t="$tst_size"
2189 curl_pull_headers_socklen_t="$tst_pull_headers"
2194 AC_MSG_RESULT([$curl_sizeof_curl_socklen_t])
2195 if test "$curl_sizeof_curl_socklen_t" = "unknown"; then
2196 AC_MSG_ERROR([cannot find out size of curl_socklen_t.])
2199 case $curl_pull_headers_socklen_t in
2201 CURL_DEFINE_UNQUOTED([CURL_PULL_WS2TCPIP_H])
2204 CURL_DEFINE_UNQUOTED([CURL_PULL_SYS_TYPES_H])
2207 CURL_DEFINE_UNQUOTED([CURL_PULL_SYS_TYPES_H])
2208 CURL_DEFINE_UNQUOTED([CURL_PULL_SYS_SOCKET_H])
2211 CURL_DEFINE_UNQUOTED([CURL_TYPEOF_CURL_SOCKLEN_T], [$curl_typeof_curl_socklen_t])
2212 CURL_DEFINE_UNQUOTED([CURL_SIZEOF_CURL_SOCKLEN_T], [$curl_sizeof_curl_socklen_t])
2216 dnl CURL_CONFIGURE_PULL_SYS_POLL
2217 dnl -------------------------------------------------
2218 dnl Find out if system header file sys/poll.h must be included by the
2219 dnl external interface, making appropriate definitions for template file
2220 dnl include/curl/curlbuild.h.in to properly configure and use the library.
2222 dnl The need for the sys/poll.h inclusion arises mainly to properly
2223 dnl interface AIX systems which define macros 'events' and 'revents'.
2225 AC_DEFUN([CURL_CONFIGURE_PULL_SYS_POLL], [
2226 AC_REQUIRE([CURL_INCLUDES_POLL])dnl
2228 tst_poll_events_macro_defined="unknown"
2234 #if defined(events) || defined(revents)
2237 force compilation error
2241 tst_poll_events_macro_defined="yes"
2243 tst_poll_events_macro_defined="no"
2246 if test "$tst_poll_events_macro_defined" = "yes"; then
2247 if test "x$ac_cv_header_sys_poll_h" = "xyes"; then
2248 CURL_DEFINE_UNQUOTED([CURL_PULL_SYS_POLL_H])
2255 dnl CURL_CHECK_FUNC_SELECT
2256 dnl -------------------------------------------------
2257 dnl Test if the socket select() function is available,
2258 dnl and check its return type and the types of its
2259 dnl arguments. If the function succeeds HAVE_SELECT
2260 dnl will be defined, defining the types of the
2261 dnl arguments in SELECT_TYPE_ARG1, SELECT_TYPE_ARG234
2262 dnl and SELECT_TYPE_ARG5, defining the type of the
2263 dnl function return value in SELECT_TYPE_RETV, and
2264 dnl also defining the type qualifier of fifth argument
2265 dnl in SELECT_QUAL_ARG5.
2267 AC_DEFUN([CURL_CHECK_FUNC_SELECT], [
2268 AC_REQUIRE([CURL_CHECK_STRUCT_TIMEVAL])dnl
2269 AC_CHECK_HEADERS(sys/select.h sys/socket.h)
2271 AC_MSG_CHECKING([for select])
2275 #ifdef HAVE_WINDOWS_H
2276 #ifndef WIN32_LEAN_AND_MEAN
2277 #define WIN32_LEAN_AND_MEAN
2279 #include <windows.h>
2280 #ifdef HAVE_WINSOCK2_H
2281 #include <winsock2.h>
2283 #ifdef HAVE_WINSOCK_H
2284 #include <winsock.h>
2288 #ifdef HAVE_SYS_TYPES_H
2289 #include <sys/types.h>
2291 #ifdef HAVE_SYS_TIME_H
2292 #include <sys/time.h>
2293 #ifdef TIME_WITH_SYS_TIME
2301 #ifndef HAVE_WINDOWS_H
2302 #ifdef HAVE_SYS_SELECT_H
2303 #include <sys/select.h>
2305 #ifdef HAVE_SYS_SOCKET_H
2306 #include <sys/socket.h>
2310 select(0, 0, 0, 0, 0);
2313 AC_MSG_RESULT([yes])
2314 curl_cv_select="yes"
2320 if test "$curl_cv_select" = "yes"; then
2321 AC_CACHE_CHECK([types of args and return type for select],
2322 [curl_cv_func_select_args], [
2323 curl_cv_func_select_args="unknown"
2324 for sel_retv in 'int' 'ssize_t'; do
2325 for sel_arg1 in 'int' 'ssize_t' 'size_t' 'unsigned long int' 'unsigned int'; do
2326 for sel_arg234 in 'fd_set *' 'int *' 'void *'; do
2327 for sel_arg5 in 'struct timeval *' 'const struct timeval *'; do
2328 if test "$curl_cv_func_select_args" = "unknown"; then
2332 #ifdef HAVE_WINDOWS_H
2333 #ifndef WIN32_LEAN_AND_MEAN
2334 #define WIN32_LEAN_AND_MEAN
2336 #include <windows.h>
2337 #ifdef HAVE_WINSOCK2_H
2338 #include <winsock2.h>
2340 #ifdef HAVE_WINSOCK_H
2341 #include <winsock.h>
2344 #define SELECTCALLCONV PASCAL
2346 #ifdef HAVE_SYS_TYPES_H
2347 #include <sys/types.h>
2349 #ifdef HAVE_SYS_TIME_H
2350 #include <sys/time.h>
2351 #ifdef TIME_WITH_SYS_TIME
2359 #ifndef HAVE_WINDOWS_H
2360 #ifdef HAVE_SYS_SELECT_H
2361 #include <sys/select.h>
2363 #ifdef HAVE_SYS_SOCKET_H
2364 #include <sys/socket.h>
2366 #define SELECTCALLCONV
2368 #ifndef HAVE_STRUCT_TIMEVAL
2374 extern $sel_retv SELECTCALLCONV select($sel_arg1,
2384 $sel_retv res = select(nfds, rfds, wfds, efds, 0);
2387 curl_cv_func_select_args="$sel_arg1,$sel_arg234,$sel_arg5,$sel_retv"
2395 if test "$curl_cv_func_select_args" = "unknown"; then
2396 AC_MSG_WARN([Cannot find proper types to use for select args])
2397 AC_MSG_WARN([HAVE_SELECT will not be defined])
2399 select_prev_IFS=$IFS; IFS=','
2400 set dummy `echo "$curl_cv_func_select_args" | sed 's/\*/\*/g'`
2401 IFS=$select_prev_IFS
2404 sel_qual_type_arg5=$[3]
2406 AC_DEFINE_UNQUOTED(SELECT_TYPE_ARG1, $[1],
2407 [Define to the type of arg 1 for select.])
2408 AC_DEFINE_UNQUOTED(SELECT_TYPE_ARG234, $[2],
2409 [Define to the type of args 2, 3 and 4 for select.])
2410 AC_DEFINE_UNQUOTED(SELECT_TYPE_RETV, $[4],
2411 [Define to the function return type for select.])
2415 case $prev_sh_opts in
2423 case "$sel_qual_type_arg5" in
2426 sel_type_arg5=`echo $sel_qual_type_arg5 | sed 's/^const //'`
2430 sel_type_arg5=$sel_qual_type_arg5
2434 AC_DEFINE_UNQUOTED(SELECT_QUAL_ARG5, $sel_qual_arg5,
2435 [Define to the type qualifier of arg 5 for select.])
2436 AC_DEFINE_UNQUOTED(SELECT_TYPE_ARG5, $sel_type_arg5,
2437 [Define to the type of arg 5 for select.])
2439 case $prev_sh_opts in
2447 AC_DEFINE_UNQUOTED(HAVE_SELECT, 1,
2448 [Define to 1 if you have the select function.])
2449 ac_cv_func_select="yes"
2455 # This is only a temporary fix. This macro is here to replace the broken one
2456 # delivered by the automake project (including the 1.9.6 release). As soon as
2457 # they ship a working version we SHOULD remove this work-around.
2459 AC_DEFUN([AM_MISSING_HAS_RUN],
2460 [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
2461 test x"${MISSING+set}" = xset || MISSING="\${SHELL} \"$am_aux_dir/missing\""
2462 # Use eval to expand $SHELL
2463 if eval "$MISSING --run true"; then
2464 am_missing_run="$MISSING --run "
2467 AC_MSG_WARN([`missing' script is too old or missing])
2472 dnl CURL_VERIFY_RUNTIMELIBS
2473 dnl -------------------------------------------------
2474 dnl Verify that the shared libs found so far can be used when running
2475 dnl programs, since otherwise the situation will create odd configure errors
2476 dnl that are misleading people.
2478 dnl Make sure this test is run BEFORE the first test in the script that
2479 dnl runs anything, which at the time of this writing is the AC_CHECK_SIZEOF
2480 dnl macro. It must also run AFTER all lib-checking macros are complete.
2482 AC_DEFUN([CURL_VERIFY_RUNTIMELIBS], [
2484 dnl this test is of course not sensible if we are cross-compiling!
2485 if test "x$cross_compiling" != xyes; then
2487 dnl just run a program to verify that the libs checked for previous to this
2488 dnl point also is available run-time!
2489 AC_MSG_CHECKING([run-time libs availability])
2496 AC_MSG_RESULT([fine]),
2497 AC_MSG_RESULT([failed])
2498 AC_MSG_ERROR([one or more libs available at link-time are not available run-time. Libs used at link-time: $LIBS])
2501 dnl if this test fails, configure has already stopped
2506 dnl CURL_CHECK_VARIADIC_MACROS
2507 dnl -------------------------------------------------
2508 dnl Check compiler support of variadic macros
2510 AC_DEFUN([CURL_CHECK_VARIADIC_MACROS], [
2511 AC_CACHE_CHECK([for compiler support of C99 variadic macro style],
2512 [curl_cv_variadic_macros_c99], [
2515 #define c99_vmacro3(first, ...) fun3(first, __VA_ARGS__)
2516 #define c99_vmacro2(first, ...) fun2(first, __VA_ARGS__)
2517 int fun3(int arg1, int arg2, int arg3);
2518 int fun2(int arg1, int arg2);
2519 int fun3(int arg1, int arg2, int arg3)
2520 { return arg1 + arg2 + arg3; }
2521 int fun2(int arg1, int arg2)
2522 { return arg1 + arg2; }
2524 int res3 = c99_vmacro3(1, 2, 3);
2525 int res2 = c99_vmacro2(1, 2);
2528 curl_cv_variadic_macros_c99="yes"
2530 curl_cv_variadic_macros_c99="no"
2533 case "$curl_cv_variadic_macros_c99" in
2535 AC_DEFINE_UNQUOTED(HAVE_VARIADIC_MACROS_C99, 1,
2536 [Define to 1 if compiler supports C99 variadic macro style.])
2539 AC_CACHE_CHECK([for compiler support of old gcc variadic macro style],
2540 [curl_cv_variadic_macros_gcc], [
2543 #define gcc_vmacro3(first, args...) fun3(first, args)
2544 #define gcc_vmacro2(first, args...) fun2(first, args)
2545 int fun3(int arg1, int arg2, int arg3);
2546 int fun2(int arg1, int arg2);
2547 int fun3(int arg1, int arg2, int arg3)
2548 { return arg1 + arg2 + arg3; }
2549 int fun2(int arg1, int arg2)
2550 { return arg1 + arg2; }
2552 int res3 = gcc_vmacro3(1, 2, 3);
2553 int res2 = gcc_vmacro2(1, 2);
2556 curl_cv_variadic_macros_gcc="yes"
2558 curl_cv_variadic_macros_gcc="no"
2561 case "$curl_cv_variadic_macros_gcc" in
2563 AC_DEFINE_UNQUOTED(HAVE_VARIADIC_MACROS_GCC, 1,
2564 [Define to 1 if compiler supports old gcc variadic macro style.])
2570 dnl CURL_CHECK_CA_BUNDLE
2571 dnl -------------------------------------------------
2572 dnl Check if a default ca-bundle should be used
2574 dnl regarding the paths this will scan:
2575 dnl /etc/ssl/certs/ca-certificates.crt Debian systems
2576 dnl /etc/pki/tls/certs/ca-bundle.crt Redhat and Mandriva
2577 dnl /usr/share/ssl/certs/ca-bundle.crt old(er) Redhat
2578 dnl /usr/local/share/certs/ca-root.crt FreeBSD
2579 dnl /etc/ssl/cert.pem OpenBSD
2580 dnl /etc/ssl/certs/ (ca path) SUSE
2582 AC_DEFUN([CURL_CHECK_CA_BUNDLE], [
2584 AC_MSG_CHECKING([default CA cert bundle/path])
2586 AC_ARG_WITH(ca-bundle,
2587 AC_HELP_STRING([--with-ca-bundle=FILE], [File name to use as CA bundle])
2588 AC_HELP_STRING([--without-ca-bundle], [Don't use a default CA bundle]),
2591 if test "x$want_ca" = "xyes"; then
2592 AC_MSG_ERROR([--with-ca-bundle=FILE requires a path to the CA bundle])
2595 [ want_ca="unset" ])
2596 AC_ARG_WITH(ca-path,
2597 AC_HELP_STRING([--with-ca-path=DIRECTORY], [Directory to use as CA path])
2598 AC_HELP_STRING([--without-ca-path], [Don't use a default CA path]),
2600 want_capath="$withval"
2601 if test "x$want_capath" = "xyes"; then
2602 AC_MSG_ERROR([--with-ca-path=DIRECTORY requires a path to the CA path directory])
2605 [ want_capath="unset"])
2607 if test "x$want_ca" != "xno" -a "x$want_ca" != "xunset" -a \
2608 "x$want_capath" != "xno" -a "x$want_capath" != "xunset"; then
2610 AC_MSG_ERROR([Can't specify both --with-ca-bundle and --with-ca-path.])
2611 elif test "x$want_ca" != "xno" -a "x$want_ca" != "xunset"; then
2612 dnl --with-ca-bundle given
2615 elif test "x$want_capath" != "xno" -a "x$want_capath" != "xunset"; then
2616 dnl --with-ca-path given
2617 if test "x$OPENSSL_ENABLED" != "x1"; then
2618 AC_MSG_ERROR([--with-ca-path only works with openSSL])
2620 capath="$want_capath"
2623 dnl first try autodetecting a CA bundle , then a CA path
2624 dnl both autodetections can be skipped by --without-ca-*
2627 if test "x$cross_compiling" != "xyes"; then
2628 dnl NOT cross-compiling and...
2629 dnl neither of the --with-ca-* options are provided
2630 if test "x$want_ca" = "xunset"; then
2631 dnl the path we previously would have installed the curl ca bundle
2632 dnl to, and thus we now check for an already existing cert in that
2633 dnl place in case we find no other
2634 if test "x$prefix" != xNONE; then
2635 cac="${prefix}/share/curl/curl-ca-bundle.crt"
2637 cac="$ac_default_prefix/share/curl/curl-ca-bundle.crt"
2640 for a in /etc/ssl/certs/ca-certificates.crt \
2641 /etc/pki/tls/certs/ca-bundle.crt \
2642 /usr/share/ssl/certs/ca-bundle.crt \
2643 /usr/local/share/certs/ca-root.crt \
2646 if test -f "$a"; then
2652 if test "x$want_capath" = "xunset" -a "x$ca" = "xno" -a \
2653 "x$OPENSSL_ENABLED" = "x1"; then
2654 for a in /etc/ssl/certs/; do
2655 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
2662 dnl no option given and cross-compiling
2663 AC_MSG_WARN([skipped the ca-cert path detection when cross-compiling])
2667 if test "x$ca" != "xno"; then
2668 CURL_CA_BUNDLE='"'$ca'"'
2669 AC_DEFINE_UNQUOTED(CURL_CA_BUNDLE, "$ca", [Location of default ca bundle])
2670 AC_SUBST(CURL_CA_BUNDLE)
2671 AC_MSG_RESULT([$ca])
2672 elif test "x$capath" != "xno"; then
2673 CURL_CA_PATH="\"$capath\""
2674 AC_DEFINE_UNQUOTED(CURL_CA_PATH, "$capath", [Location of default ca path])
2675 AC_MSG_RESULT([$capath (capath)])
2682 dnl DO_CURL_OFF_T_CHECK (TYPE, SIZE)
2683 dnl -------------------------------------------------
2684 dnl Internal macro for CURL_CONFIGURE_CURL_OFF_T
2686 AC_DEFUN([DO_CURL_OFF_T_CHECK], [
2687 AC_REQUIRE([CURL_INCLUDES_INTTYPES])dnl
2688 if test "$curl_typeof_curl_off_t" = "unknown" && test ! -z "$1"; then
2692 case XC_SH_TR_SH([$1]) in
2694 tmp_includes="$curl_includes_inttypes"
2695 tmp_source="char f@<:@@:>@ = PRId64;"
2699 tmp_includes="$curl_includes_inttypes"
2700 tmp_source="char f@<:@@:>@ = PRId32;"
2704 tmp_includes="$curl_includes_inttypes"
2705 tmp_source="char f@<:@@:>@ = PRId16;"
2712 typedef $1 curl_off_t;
2713 typedef char dummy_arr[sizeof(curl_off_t) == $2 ? 1 : -1];
2719 if test -z "$tmp_fmt"; then
2720 curl_typeof_curl_off_t="$1"
2721 curl_sizeof_curl_off_t="$2"
2723 CURL_CHECK_DEF([$tmp_fmt], [$curl_includes_inttypes], [silent])
2724 AS_VAR_PUSHDEF([tmp_HaveFmtDef], [curl_cv_have_def_$tmp_fmt])dnl
2725 AS_VAR_PUSHDEF([tmp_FmtDef], [curl_cv_def_$tmp_fmt])dnl
2726 if test AS_VAR_GET(tmp_HaveFmtDef) = "yes"; then
2727 curl_format_curl_off_t=AS_VAR_GET(tmp_FmtDef)
2728 curl_typeof_curl_off_t="$1"
2729 curl_sizeof_curl_off_t="$2"
2731 AS_VAR_POPDEF([tmp_FmtDef])dnl
2732 AS_VAR_POPDEF([tmp_HaveFmtDef])dnl
2739 dnl DO_CURL_OFF_T_SUFFIX_CHECK (TYPE)
2740 dnl -------------------------------------------------
2741 dnl Internal macro for CURL_CONFIGURE_CURL_OFF_T
2743 AC_DEFUN([DO_CURL_OFF_T_SUFFIX_CHECK], [
2744 AC_REQUIRE([CURL_INCLUDES_INTTYPES])dnl
2745 AC_MSG_CHECKING([constant suffix string for curl_off_t])
2747 curl_suffix_curl_off_t="unknown"
2748 curl_suffix_curl_off_tu="unknown"
2750 case XC_SH_TR_SH([$1]) in
2751 long_long | __longlong | __longlong_t)
2761 tst_suffixes="LL:i64::"
2764 tst_suffixes="L:i32::"
2767 tst_suffixes="L:i16::"
2770 AC_MSG_ERROR([unexpected data type $1])
2774 old_IFS=$IFS; IFS=':'
2775 for tmp_ssuf in $tst_suffixes ; do
2777 if test "x$curl_suffix_curl_off_t" = "xunknown"; then
2780 tmp_usuf="u$tmp_ssuf"
2783 tmp_usuf="U$tmp_ssuf"
2791 $curl_includes_inttypes
2802 curl_suffix_curl_off_t="$tmp_ssuf"
2803 curl_suffix_curl_off_tu="$tmp_usuf"
2809 if test "x$curl_suffix_curl_off_t" = "xunknown"; then
2810 AC_MSG_ERROR([cannot find constant suffix string for curl_off_t.])
2812 AC_MSG_RESULT([$curl_suffix_curl_off_t])
2813 AC_MSG_CHECKING([constant suffix string for unsigned curl_off_t])
2814 AC_MSG_RESULT([$curl_suffix_curl_off_tu])
2820 dnl CURL_CONFIGURE_CURL_OFF_T
2821 dnl -------------------------------------------------
2822 dnl Find out suitable curl_off_t data type definition and associated
2823 dnl items, and make the appropriate definitions used in template file
2824 dnl include/curl/curlbuild.h.in to properly configure the library.
2826 AC_DEFUN([CURL_CONFIGURE_CURL_OFF_T], [
2827 AC_REQUIRE([CURL_INCLUDES_INTTYPES])dnl
2829 AC_BEFORE([$0],[AC_SYS_LARGEFILE])dnl
2830 AC_BEFORE([$0],[CURL_CONFIGURE_REENTRANT])dnl
2831 AC_BEFORE([$0],[CURL_CHECK_AIX_ALL_SOURCE])dnl
2833 if test -z "$SED"; then
2834 AC_MSG_ERROR([SED not set. Cannot continue without SED being set.])
2837 AC_CHECK_SIZEOF(long)
2838 AC_CHECK_SIZEOF(void*)
2840 if test -z "$ac_cv_sizeof_long" ||
2841 test "$ac_cv_sizeof_long" -eq "0"; then
2842 AC_MSG_ERROR([cannot find out size of long.])
2844 if test -z "$ac_cv_sizeof_voidp" ||
2845 test "$ac_cv_sizeof_voidp" -eq "0"; then
2846 AC_MSG_ERROR([cannot find out size of void*.])
2853 if test "$ac_cv_sizeof_long" -eq "8" &&
2854 test "$ac_cv_sizeof_voidp" -ge "8"; then
2856 elif test "$ac_cv_sizeof_long" -eq "4" &&
2857 test "$ac_cv_sizeof_voidp" -ge "4"; then
2859 elif test "$ac_cv_sizeof_long" -eq "2" &&
2860 test "$ac_cv_sizeof_voidp" -ge "2"; then
2864 dnl DO_CURL_OFF_T_CHECK results are stored in next 3 vars
2866 curl_typeof_curl_off_t="unknown"
2867 curl_sizeof_curl_off_t="unknown"
2868 curl_format_curl_off_t="unknown"
2869 curl_format_curl_off_tu="unknown"
2871 if test "$curl_typeof_curl_off_t" = "unknown"; then
2872 AC_MSG_CHECKING([for 64-bit curl_off_t data type])
2880 DO_CURL_OFF_T_CHECK([$t8], [8])
2882 AC_MSG_RESULT([$curl_typeof_curl_off_t])
2884 if test "$curl_typeof_curl_off_t" = "unknown"; then
2885 AC_MSG_CHECKING([for 32-bit curl_off_t data type])
2891 DO_CURL_OFF_T_CHECK([$t4], [4])
2893 AC_MSG_RESULT([$curl_typeof_curl_off_t])
2895 if test "$curl_typeof_curl_off_t" = "unknown"; then
2896 AC_MSG_CHECKING([for 16-bit curl_off_t data type])
2902 DO_CURL_OFF_T_CHECK([$t2], [2])
2904 AC_MSG_RESULT([$curl_typeof_curl_off_t])
2906 if test "$curl_typeof_curl_off_t" = "unknown"; then
2907 AC_MSG_ERROR([cannot find data type for curl_off_t.])
2910 AC_MSG_CHECKING([size of curl_off_t])
2911 AC_MSG_RESULT([$curl_sizeof_curl_off_t])
2913 AC_MSG_CHECKING([formatting string directive for curl_off_t])
2914 if test "$curl_format_curl_off_t" != "unknown"; then
2915 x_pull_headers="yes"
2916 curl_format_curl_off_t=`echo "$curl_format_curl_off_t" | "$SED" 's/[["]]//g'`
2917 curl_format_curl_off_tu=`echo "$curl_format_curl_off_t" | "$SED" 's/i$/u/'`
2918 curl_format_curl_off_tu=`echo "$curl_format_curl_off_tu" | "$SED" 's/d$/u/'`
2919 curl_format_curl_off_tu=`echo "$curl_format_curl_off_tu" | "$SED" 's/D$/U/'`
2922 case XC_SH_TR_SH([$curl_typeof_curl_off_t]) in
2923 long_long | __longlong | __longlong_t)
2924 curl_format_curl_off_t="lld"
2925 curl_format_curl_off_tu="llu"
2928 curl_format_curl_off_t="ld"
2929 curl_format_curl_off_tu="lu"
2932 curl_format_curl_off_t="d"
2933 curl_format_curl_off_tu="u"
2936 curl_format_curl_off_t="I64d"
2937 curl_format_curl_off_tu="I64u"
2940 curl_format_curl_off_t="I32d"
2941 curl_format_curl_off_tu="I32u"
2944 curl_format_curl_off_t="I16d"
2945 curl_format_curl_off_tu="I16u"
2948 AC_MSG_ERROR([cannot find print format string for curl_off_t.])
2952 AC_MSG_RESULT(["$curl_format_curl_off_t"])
2954 AC_MSG_CHECKING([formatting string directive for unsigned curl_off_t])
2955 AC_MSG_RESULT(["$curl_format_curl_off_tu"])
2957 DO_CURL_OFF_T_SUFFIX_CHECK([$curl_typeof_curl_off_t])
2959 if test "$x_pull_headers" = "yes"; then
2960 if test "x$ac_cv_header_sys_types_h" = "xyes"; then
2961 CURL_DEFINE_UNQUOTED([CURL_PULL_SYS_TYPES_H])
2963 if test "x$ac_cv_header_stdint_h" = "xyes"; then
2964 CURL_DEFINE_UNQUOTED([CURL_PULL_STDINT_H])
2966 if test "x$ac_cv_header_inttypes_h" = "xyes"; then
2967 CURL_DEFINE_UNQUOTED([CURL_PULL_INTTYPES_H])
2971 CURL_DEFINE_UNQUOTED([CURL_TYPEOF_CURL_OFF_T], [$curl_typeof_curl_off_t])
2972 CURL_DEFINE_UNQUOTED([CURL_FORMAT_CURL_OFF_T], ["$curl_format_curl_off_t"])
2973 CURL_DEFINE_UNQUOTED([CURL_FORMAT_CURL_OFF_TU], ["$curl_format_curl_off_tu"])
2974 CURL_DEFINE_UNQUOTED([CURL_FORMAT_OFF_T], ["%$curl_format_curl_off_t"])
2975 CURL_DEFINE_UNQUOTED([CURL_SIZEOF_CURL_OFF_T], [$curl_sizeof_curl_off_t])
2976 CURL_DEFINE_UNQUOTED([CURL_SUFFIX_CURL_OFF_T], [$curl_suffix_curl_off_t])
2977 CURL_DEFINE_UNQUOTED([CURL_SUFFIX_CURL_OFF_TU], [$curl_suffix_curl_off_tu])
2982 dnl CURL_CHECK_WIN32_LARGEFILE
2983 dnl -------------------------------------------------
2984 dnl Check if curl's WIN32 large file will be used
2986 AC_DEFUN([CURL_CHECK_WIN32_LARGEFILE], [
2987 AC_REQUIRE([CURL_CHECK_HEADER_WINDOWS])dnl
2988 AC_MSG_CHECKING([whether build target supports WIN32 file API])
2989 curl_win32_file_api="no"
2990 if test "$ac_cv_header_windows_h" = "yes"; then
2991 if test x"$enable_largefile" != "xno"; then
2995 #if !defined(_WIN32_WCE) && \
2996 (defined(__MINGW32__) || \
2997 (defined(_MSC_VER) && (defined(_WIN32) || defined(_WIN64))))
3000 WIN32 large file API not supported.
3004 curl_win32_file_api="win32_large_files"
3007 if test "$curl_win32_file_api" = "no"; then
3011 #if defined(_WIN32_WCE) || defined(__MINGW32__) || defined(_MSC_VER)
3014 WIN32 small file API not supported.
3018 curl_win32_file_api="win32_small_files"
3022 case "$curl_win32_file_api" in
3024 AC_MSG_RESULT([yes (large file enabled)])
3025 AC_DEFINE_UNQUOTED(USE_WIN32_LARGE_FILES, 1,
3026 [Define to 1 if you are building a Windows target with large file support.])
3029 AC_MSG_RESULT([yes (large file disabled)])
3030 AC_DEFINE_UNQUOTED(USE_WIN32_SMALL_FILES, 1,
3031 [Define to 1 if you are building a Windows target without large file support.])
3039 dnl CURL_EXPORT_PCDIR ($pcdir)
3040 dnl ------------------------
3041 dnl if $pcdir is not empty, set PKG_CONFIG_LIBDIR to $pcdir and export
3043 dnl we need this macro since pkg-config distinguishes among empty and unset
3044 dnl variable while checking PKG_CONFIG_LIBDIR
3047 AC_DEFUN([CURL_EXPORT_PCDIR], [
3048 if test -n "$1"; then
3049 PKG_CONFIG_LIBDIR="$1"
3050 export PKG_CONFIG_LIBDIR
3054 dnl CURL_CHECK_PKGCONFIG ($module, [$pcdir])
3055 dnl ------------------------
3056 dnl search for the pkg-config tool. Set the PKGCONFIG variable to hold the
3057 dnl path to it, or 'no' if not found/present.
3059 dnl If pkg-config is present, check that it has info about the $module or
3060 dnl return "no" anyway!
3062 dnl Optionally PKG_CONFIG_LIBDIR may be given as $pcdir.
3065 AC_DEFUN([CURL_CHECK_PKGCONFIG], [
3069 AC_PATH_TOOL( PKGCONFIG, pkg-config, no, $PATH:/usr/bin:/usr/local/bin)
3071 if test x$PKGCONFIG != xno; then
3072 AC_MSG_CHECKING([for $1 options with pkg-config])
3073 dnl ask pkg-config about $1
3074 itexists=`CURL_EXPORT_PCDIR([$2]) dnl
3075 $PKGCONFIG --exists $1 >/dev/null 2>&1 && echo 1`
3077 if test -z "$itexists"; then
3078 dnl pkg-config does not have info about the given module! set the
3079 dnl variable to 'no'
3083 AC_MSG_RESULT([found])
3089 dnl CURL_GENERATE_CONFIGUREHELP_PM
3090 dnl -------------------------------------------------
3091 dnl Generate test harness configurehelp.pm module, defining and
3092 dnl initializing some perl variables with values which are known
3093 dnl when the configure script runs. For portability reasons, test
3094 dnl harness needs information on how to run the C preprocessor.
3096 AC_DEFUN([CURL_GENERATE_CONFIGUREHELP_PM], [
3097 AC_REQUIRE([AC_PROG_CPP])dnl
3098 tmp_cpp=`eval echo "$ac_cpp" 2>/dev/null`
3099 if test -z "$tmp_cpp"; then
3102 cat >./tests/configurehelp.pm <<_EOF
3103 [@%:@] This is a generated file. Do not edit.
3105 package configurehelp;
3117 @ISA = qw(Exporter);
3123 \$Cpreprocessor = '$tmp_cpp';