1 #***************************************************************************
3 # Project ___| | | | _ \| |
5 # | (__| |_| | _ <| |___
6 # \___|\___/|_| \_\_____|
8 # Copyright (C) 1998 - 2012, 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_MSG_CHECKING([if OS is AIX (to define _ALL_SOURCE)])
154 AC_EGREP_CPP([yes_this_is_aix],[
160 AC_DEFINE(_ALL_SOURCE)
167 dnl CURL_CHECK_HEADER_WINDOWS
168 dnl -------------------------------------------------
169 dnl Check for compilable and valid windows.h header
171 AC_DEFUN([CURL_CHECK_HEADER_WINDOWS], [
172 AC_CACHE_CHECK([for windows.h], [ac_cv_header_windows_h], [
176 #ifndef WIN32_LEAN_AND_MEAN
177 #define WIN32_LEAN_AND_MEAN
181 #if defined(__CYGWIN__) || defined(__CEGCC__)
182 HAVE_WINDOWS_H shall not be defined.
188 ac_cv_header_windows_h="yes"
190 ac_cv_header_windows_h="no"
193 case "$ac_cv_header_windows_h" in
195 AC_DEFINE_UNQUOTED(HAVE_WINDOWS_H, 1,
196 [Define to 1 if you have the windows.h header file.])
197 AC_DEFINE_UNQUOTED(WIN32_LEAN_AND_MEAN, 1,
198 [Define to avoid automatic inclusion of winsock.h])
204 dnl CURL_CHECK_NATIVE_WINDOWS
205 dnl -------------------------------------------------
206 dnl Check if building a native Windows target
208 AC_DEFUN([CURL_CHECK_NATIVE_WINDOWS], [
209 AC_REQUIRE([CURL_CHECK_HEADER_WINDOWS])dnl
210 AC_CACHE_CHECK([whether build target is a native Windows one], [ac_cv_native_windows], [
211 if test "$ac_cv_header_windows_h" = "no"; then
212 ac_cv_native_windows="no"
217 #if defined(__MINGW32__) || defined(__MINGW32CE__) || \
218 (defined(_MSC_VER) && (defined(_WIN32) || defined(_WIN64)))
221 Not a native Windows build target.
225 ac_cv_native_windows="yes"
227 ac_cv_native_windows="no"
231 AM_CONDITIONAL(DOING_NATIVE_WINDOWS, test "x$ac_cv_native_windows" = xyes)
235 dnl CURL_CHECK_HEADER_WINSOCK
236 dnl -------------------------------------------------
237 dnl Check for compilable and valid winsock.h header
239 AC_DEFUN([CURL_CHECK_HEADER_WINSOCK], [
240 AC_REQUIRE([CURL_CHECK_HEADER_WINDOWS])dnl
241 AC_CACHE_CHECK([for winsock.h], [ac_cv_header_winsock_h], [
245 #ifndef WIN32_LEAN_AND_MEAN
246 #define WIN32_LEAN_AND_MEAN
251 #if defined(__CYGWIN__) || defined(__CEGCC__)
252 HAVE_WINSOCK_H shall not be defined.
254 int dummy=WSACleanup();
258 ac_cv_header_winsock_h="yes"
260 ac_cv_header_winsock_h="no"
263 case "$ac_cv_header_winsock_h" in
265 AC_DEFINE_UNQUOTED(HAVE_WINSOCK_H, 1,
266 [Define to 1 if you have the winsock.h header file.])
272 dnl CURL_CHECK_HEADER_WINSOCK2
273 dnl -------------------------------------------------
274 dnl Check for compilable and valid winsock2.h header
276 AC_DEFUN([CURL_CHECK_HEADER_WINSOCK2], [
277 AC_REQUIRE([CURL_CHECK_HEADER_WINDOWS])dnl
278 AC_CACHE_CHECK([for winsock2.h], [ac_cv_header_winsock2_h], [
282 #ifndef WIN32_LEAN_AND_MEAN
283 #define WIN32_LEAN_AND_MEAN
286 #include <winsock2.h>
288 #if defined(__CYGWIN__) || defined(__CEGCC__) || defined(__MINGW32CE__)
289 HAVE_WINSOCK2_H shall not be defined.
291 int dummy=2*IPPROTO_ESP;
295 ac_cv_header_winsock2_h="yes"
297 ac_cv_header_winsock2_h="no"
300 case "$ac_cv_header_winsock2_h" in
302 AC_DEFINE_UNQUOTED(HAVE_WINSOCK2_H, 1,
303 [Define to 1 if you have the winsock2.h header file.])
309 dnl CURL_CHECK_HEADER_WS2TCPIP
310 dnl -------------------------------------------------
311 dnl Check for compilable and valid ws2tcpip.h header
313 AC_DEFUN([CURL_CHECK_HEADER_WS2TCPIP], [
314 AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK2])dnl
315 AC_CACHE_CHECK([for ws2tcpip.h], [ac_cv_header_ws2tcpip_h], [
319 #ifndef WIN32_LEAN_AND_MEAN
320 #define WIN32_LEAN_AND_MEAN
323 #include <winsock2.h>
324 #include <ws2tcpip.h>
326 #if defined(__CYGWIN__) || defined(__CEGCC__) || defined(__MINGW32CE__)
327 HAVE_WS2TCPIP_H shall not be defined.
329 int dummy=2*IP_PKTINFO;
333 ac_cv_header_ws2tcpip_h="yes"
335 ac_cv_header_ws2tcpip_h="no"
338 case "$ac_cv_header_ws2tcpip_h" in
340 AC_DEFINE_UNQUOTED(HAVE_WS2TCPIP_H, 1,
341 [Define to 1 if you have the ws2tcpip.h header file.])
347 dnl CURL_CHECK_HEADER_WINLDAP
348 dnl -------------------------------------------------
349 dnl Check for compilable and valid winldap.h header
351 AC_DEFUN([CURL_CHECK_HEADER_WINLDAP], [
352 AC_REQUIRE([CURL_CHECK_HEADER_WINDOWS])dnl
353 AC_CACHE_CHECK([for winldap.h], [ac_cv_header_winldap_h], [
357 #ifdef HAVE_WINDOWS_H
358 #ifndef WIN32_LEAN_AND_MEAN
359 #define WIN32_LEAN_AND_MEAN
365 #if defined(__CYGWIN__) || defined(__CEGCC__)
366 HAVE_WINLDAP_H shall not be defined.
368 LDAP *ldp = ldap_init("dummy", LDAP_PORT);
369 ULONG res = ldap_unbind(ldp);
373 ac_cv_header_winldap_h="yes"
375 ac_cv_header_winldap_h="no"
378 case "$ac_cv_header_winldap_h" in
380 AC_DEFINE_UNQUOTED(HAVE_WINLDAP_H, 1,
381 [Define to 1 if you have the winldap.h header file.])
387 dnl CURL_CHECK_HEADER_WINBER
388 dnl -------------------------------------------------
389 dnl Check for compilable and valid winber.h header
391 AC_DEFUN([CURL_CHECK_HEADER_WINBER], [
392 AC_REQUIRE([CURL_CHECK_HEADER_WINLDAP])dnl
393 AC_CACHE_CHECK([for winber.h], [ac_cv_header_winber_h], [
397 #ifdef HAVE_WINDOWS_H
398 #ifndef WIN32_LEAN_AND_MEAN
399 #define WIN32_LEAN_AND_MEAN
406 #if defined(__CYGWIN__) || defined(__CEGCC__)
407 HAVE_WINBER_H shall not be defined.
410 BerElement *bep = ber_init(bvp);
415 ac_cv_header_winber_h="yes"
417 ac_cv_header_winber_h="no"
420 case "$ac_cv_header_winber_h" in
422 AC_DEFINE_UNQUOTED(HAVE_WINBER_H, 1,
423 [Define to 1 if you have the winber.h header file.])
429 dnl CURL_CHECK_HEADER_LBER
430 dnl -------------------------------------------------
431 dnl Check for compilable and valid lber.h header,
432 dnl and check if it is needed even with ldap.h
434 AC_DEFUN([CURL_CHECK_HEADER_LBER], [
435 AC_REQUIRE([CURL_CHECK_HEADER_WINDOWS])dnl
436 AC_CACHE_CHECK([for lber.h], [ac_cv_header_lber_h], [
440 #ifdef HAVE_WINDOWS_H
441 #ifndef WIN32_LEAN_AND_MEAN
442 #define WIN32_LEAN_AND_MEAN
446 #ifdef HAVE_SYS_TYPES_H
447 #include <sys/types.h>
451 #define NULL (void *)0
455 BerValue *bvp = NULL;
456 BerElement *bep = ber_init(bvp);
460 ac_cv_header_lber_h="yes"
462 ac_cv_header_lber_h="no"
465 if test "$ac_cv_header_lber_h" = "yes"; then
466 AC_DEFINE_UNQUOTED(HAVE_LBER_H, 1,
467 [Define to 1 if you have the lber.h header file.])
472 #ifdef HAVE_WINDOWS_H
473 #ifndef WIN32_LEAN_AND_MEAN
474 #define WIN32_LEAN_AND_MEAN
478 #ifdef HAVE_SYS_TYPES_H
479 #include <sys/types.h>
483 #define NULL (void *)0
485 #ifndef LDAP_DEPRECATED
486 #define LDAP_DEPRECATED 1
490 BerValue *bvp = NULL;
491 BerElement *bep = ber_init(bvp);
495 curl_cv_need_header_lber_h="no"
497 curl_cv_need_header_lber_h="yes"
500 case "$curl_cv_need_header_lber_h" in
502 AC_DEFINE_UNQUOTED(NEED_LBER_H, 1,
503 [Define to 1 if you need the lber.h header file even with ldap.h])
510 dnl CURL_CHECK_HEADER_LDAP
511 dnl -------------------------------------------------
512 dnl Check for compilable and valid ldap.h header
514 AC_DEFUN([CURL_CHECK_HEADER_LDAP], [
515 AC_REQUIRE([CURL_CHECK_HEADER_LBER])dnl
516 AC_CACHE_CHECK([for ldap.h], [ac_cv_header_ldap_h], [
520 #ifdef HAVE_WINDOWS_H
521 #ifndef WIN32_LEAN_AND_MEAN
522 #define WIN32_LEAN_AND_MEAN
526 #ifdef HAVE_SYS_TYPES_H
527 #include <sys/types.h>
530 #ifndef LDAP_DEPRECATED
531 #define LDAP_DEPRECATED 1
538 LDAP *ldp = ldap_init("dummy", LDAP_PORT);
539 int res = ldap_unbind(ldp);
542 ac_cv_header_ldap_h="yes"
544 ac_cv_header_ldap_h="no"
547 case "$ac_cv_header_ldap_h" in
549 AC_DEFINE_UNQUOTED(HAVE_LDAP_H, 1,
550 [Define to 1 if you have the ldap.h header file.])
556 dnl CURL_CHECK_HEADER_LDAP_SSL
557 dnl -------------------------------------------------
558 dnl Check for compilable and valid ldap_ssl.h header
560 AC_DEFUN([CURL_CHECK_HEADER_LDAP_SSL], [
561 AC_REQUIRE([CURL_CHECK_HEADER_LDAP])dnl
562 AC_CACHE_CHECK([for ldap_ssl.h], [ac_cv_header_ldap_ssl_h], [
566 #ifdef HAVE_WINDOWS_H
567 #ifndef WIN32_LEAN_AND_MEAN
568 #define WIN32_LEAN_AND_MEAN
572 #ifdef HAVE_SYS_TYPES_H
573 #include <sys/types.h>
576 #ifndef LDAP_DEPRECATED
577 #define LDAP_DEPRECATED 1
585 #include <ldap_ssl.h>
587 LDAP *ldp = ldapssl_init("dummy", LDAPS_PORT, 1);
590 ac_cv_header_ldap_ssl_h="yes"
592 ac_cv_header_ldap_ssl_h="no"
595 case "$ac_cv_header_ldap_ssl_h" in
597 AC_DEFINE_UNQUOTED(HAVE_LDAP_SSL_H, 1,
598 [Define to 1 if you have the ldap_ssl.h header file.])
604 dnl CURL_CHECK_HEADER_LDAPSSL
605 dnl -------------------------------------------------
606 dnl Check for compilable and valid ldapssl.h header
608 AC_DEFUN([CURL_CHECK_HEADER_LDAPSSL], [
609 AC_REQUIRE([CURL_CHECK_HEADER_LDAP])dnl
610 AC_CACHE_CHECK([for ldapssl.h], [ac_cv_header_ldapssl_h], [
614 #ifdef HAVE_WINDOWS_H
615 #ifndef WIN32_LEAN_AND_MEAN
616 #define WIN32_LEAN_AND_MEAN
620 #ifdef HAVE_SYS_TYPES_H
621 #include <sys/types.h>
625 #define NULL (void *)0
627 #ifndef LDAP_DEPRECATED
628 #define LDAP_DEPRECATED 1
638 char *cert_label = NULL;
639 LDAP *ldp = ldap_ssl_init("dummy", LDAPS_PORT, cert_label);
642 ac_cv_header_ldapssl_h="yes"
644 ac_cv_header_ldapssl_h="no"
647 case "$ac_cv_header_ldapssl_h" in
649 AC_DEFINE_UNQUOTED(HAVE_LDAPSSL_H, 1,
650 [Define to 1 if you have the ldapssl.h header file.])
656 dnl CURL_CHECK_LIBS_WINLDAP
657 dnl -------------------------------------------------
658 dnl Check for libraries needed for WINLDAP support,
659 dnl and prepended to LIBS any needed libraries.
660 dnl This macro can take an optional parameter with a
661 dnl white space separated list of libraries to check
662 dnl before the WINLDAP default ones.
664 AC_DEFUN([CURL_CHECK_LIBS_WINLDAP], [
665 AC_REQUIRE([CURL_CHECK_HEADER_WINBER])dnl
667 AC_MSG_CHECKING([for WINLDAP libraries])
681 if test -z "$u_libs"; then
684 u_libs="$u_libs $l_lib"
689 curl_cv_save_LIBS="$LIBS"
690 curl_cv_ldap_LIBS="unknown"
692 for x_nlibs in '' "$u_libs" \
694 if test "$curl_cv_ldap_LIBS" = "unknown"; then
695 if test -z "$x_nlibs"; then
696 LIBS="$curl_cv_save_LIBS"
698 LIBS="$x_nlibs $curl_cv_save_LIBS"
703 #ifdef HAVE_WINDOWS_H
704 #ifndef WIN32_LEAN_AND_MEAN
705 #define WIN32_LEAN_AND_MEAN
708 #ifdef HAVE_WINLDAP_H
717 BerElement *bep = ber_init(bvp);
718 LDAP *ldp = ldap_init("dummy", LDAP_PORT);
719 ULONG res = ldap_unbind(ldp);
723 curl_cv_ldap_LIBS="$x_nlibs"
728 LIBS="$curl_cv_save_LIBS"
730 case X-"$curl_cv_ldap_LIBS" in
732 AC_MSG_RESULT([cannot find WINLDAP libraries])
735 AC_MSG_RESULT([no additional lib required])
738 if test -z "$curl_cv_save_LIBS"; then
739 LIBS="$curl_cv_ldap_LIBS"
741 LIBS="$curl_cv_ldap_LIBS $curl_cv_save_LIBS"
743 AC_MSG_RESULT([$curl_cv_ldap_LIBS])
750 dnl CURL_CHECK_LIBS_LDAP
751 dnl -------------------------------------------------
752 dnl Check for libraries needed for LDAP support,
753 dnl and prepended to LIBS any needed libraries.
754 dnl This macro can take an optional parameter with a
755 dnl white space separated list of libraries to check
756 dnl before the default ones.
758 AC_DEFUN([CURL_CHECK_LIBS_LDAP], [
759 AC_REQUIRE([CURL_CHECK_HEADER_LDAP])dnl
761 AC_MSG_CHECKING([for LDAP libraries])
775 if test -z "$u_libs"; then
778 u_libs="$u_libs $l_lib"
783 curl_cv_save_LIBS="$LIBS"
784 curl_cv_ldap_LIBS="unknown"
786 for x_nlibs in '' "$u_libs" \
790 '-lldapssl -lldapx -lldapsdk' \
791 '-lldapsdk -lldapx -lldapssl' ; do
792 if test "$curl_cv_ldap_LIBS" = "unknown"; then
793 if test -z "$x_nlibs"; then
794 LIBS="$curl_cv_save_LIBS"
796 LIBS="$x_nlibs $curl_cv_save_LIBS"
801 #ifdef HAVE_WINDOWS_H
802 #ifndef WIN32_LEAN_AND_MEAN
803 #define WIN32_LEAN_AND_MEAN
807 #ifdef HAVE_SYS_TYPES_H
808 #include <sys/types.h>
812 #define NULL (void *)0
814 #ifndef LDAP_DEPRECATED
815 #define LDAP_DEPRECATED 1
824 BerValue *bvp = NULL;
825 BerElement *bep = ber_init(bvp);
826 LDAP *ldp = ldap_init("dummy", LDAP_PORT);
827 int res = ldap_unbind(ldp);
831 curl_cv_ldap_LIBS="$x_nlibs"
836 LIBS="$curl_cv_save_LIBS"
838 case X-"$curl_cv_ldap_LIBS" in
840 AC_MSG_RESULT([cannot find LDAP libraries])
843 AC_MSG_RESULT([no additional lib required])
846 if test -z "$curl_cv_save_LIBS"; then
847 LIBS="$curl_cv_ldap_LIBS"
849 LIBS="$curl_cv_ldap_LIBS $curl_cv_save_LIBS"
851 AC_MSG_RESULT([$curl_cv_ldap_LIBS])
858 dnl CURL_CHECK_HEADER_MALLOC
859 dnl -------------------------------------------------
860 dnl Check for compilable and valid malloc.h header,
861 dnl and check if it is needed even with stdlib.h
863 AC_DEFUN([CURL_CHECK_HEADER_MALLOC], [
864 AC_CACHE_CHECK([for malloc.h], [ac_cv_header_malloc_h], [
869 void *p = malloc(10);
870 void *q = calloc(10,10);
875 ac_cv_header_malloc_h="yes"
877 ac_cv_header_malloc_h="no"
880 if test "$ac_cv_header_malloc_h" = "yes"; then
881 AC_DEFINE_UNQUOTED(HAVE_MALLOC_H, 1,
882 [Define to 1 if you have the malloc.h header file.])
888 void *p = malloc(10);
889 void *q = calloc(10,10);
894 curl_cv_need_header_malloc_h="no"
896 curl_cv_need_header_malloc_h="yes"
899 case "$curl_cv_need_header_malloc_h" in
901 AC_DEFINE_UNQUOTED(NEED_MALLOC_H, 1,
902 [Define to 1 if you need the malloc.h header file even with stdlib.h])
909 dnl CURL_CHECK_HEADER_MEMORY
910 dnl -------------------------------------------------
911 dnl Check for compilable and valid memory.h header,
912 dnl and check if it is needed even with stdlib.h for
913 dnl memory related functions.
915 AC_DEFUN([CURL_CHECK_HEADER_MEMORY], [
916 AC_CACHE_CHECK([for memory.h], [ac_cv_header_memory_h], [
921 void *p = malloc(10);
922 void *q = calloc(10,10);
927 ac_cv_header_memory_h="yes"
929 ac_cv_header_memory_h="no"
932 if test "$ac_cv_header_memory_h" = "yes"; then
933 AC_DEFINE_UNQUOTED(HAVE_MEMORY_H, 1,
934 [Define to 1 if you have the memory.h header file.])
940 void *p = malloc(10);
941 void *q = calloc(10,10);
946 curl_cv_need_header_memory_h="no"
948 curl_cv_need_header_memory_h="yes"
951 case "$curl_cv_need_header_memory_h" in
953 AC_DEFINE_UNQUOTED(NEED_MEMORY_H, 1,
954 [Define to 1 if you need the memory.h header file even with stdlib.h])
961 dnl CURL_CHECK_FUNC_GETNAMEINFO
962 dnl -------------------------------------------------
963 dnl Test if the getnameinfo function is available,
964 dnl and check the types of five of its arguments.
965 dnl If the function succeeds HAVE_GETNAMEINFO will be
966 dnl defined, defining the types of the arguments in
967 dnl GETNAMEINFO_TYPE_ARG1, GETNAMEINFO_TYPE_ARG2,
968 dnl GETNAMEINFO_TYPE_ARG46 and GETNAMEINFO_TYPE_ARG7,
969 dnl and also defining the type qualifier of first
970 dnl argument in GETNAMEINFO_QUAL_ARG1.
972 AC_DEFUN([CURL_CHECK_FUNC_GETNAMEINFO], [
973 AC_REQUIRE([CURL_CHECK_HEADER_WS2TCPIP])dnl
974 AC_CHECK_HEADERS(sys/types.h sys/socket.h netdb.h)
976 AC_MSG_CHECKING([for getnameinfo])
978 AC_LANG_FUNC_LINK_TRY([getnameinfo])
981 curl_cv_getnameinfo="yes"
984 curl_cv_getnameinfo="no"
987 if test "$curl_cv_getnameinfo" != "yes"; then
988 AC_MSG_CHECKING([deeper for getnameinfo])
996 curl_cv_getnameinfo="yes"
998 AC_MSG_RESULT([but still no])
999 curl_cv_getnameinfo="no"
1003 if test "$curl_cv_getnameinfo" != "yes"; then
1004 AC_MSG_CHECKING([deeper and deeper for getnameinfo])
1008 #ifdef HAVE_WINDOWS_H
1009 #ifndef WIN32_LEAN_AND_MEAN
1010 #define WIN32_LEAN_AND_MEAN
1012 #include <windows.h>
1013 #ifdef HAVE_WINSOCK2_H
1014 #include <winsock2.h>
1015 #ifdef HAVE_WS2TCPIP_H
1016 #include <ws2tcpip.h>
1020 #ifdef HAVE_SYS_TYPES_H
1021 #include <sys/types.h>
1023 #ifdef HAVE_SYS_SOCKET_H
1024 #include <sys/socket.h>
1031 getnameinfo(0, 0, 0, 0, 0, 0, 0);
1034 AC_MSG_RESULT([yes])
1035 curl_cv_getnameinfo="yes"
1037 AC_MSG_RESULT([but still no])
1038 curl_cv_getnameinfo="no"
1042 if test "$curl_cv_getnameinfo" = "yes"; then
1043 AC_CACHE_CHECK([types of arguments for getnameinfo],
1044 [curl_cv_func_getnameinfo_args], [
1045 curl_cv_func_getnameinfo_args="unknown"
1046 for gni_arg1 in 'struct sockaddr *' 'const struct sockaddr *' 'void *'; do
1047 for gni_arg2 in 'socklen_t' 'size_t' 'int'; do
1048 for gni_arg46 in 'size_t' 'int' 'socklen_t' 'unsigned int' 'DWORD'; do
1049 for gni_arg7 in 'int' 'unsigned int'; do
1050 if test "$curl_cv_func_getnameinfo_args" = "unknown"; then
1054 #ifdef HAVE_WINDOWS_H
1055 #ifndef WIN32_LEAN_AND_MEAN
1056 #define WIN32_LEAN_AND_MEAN
1058 #if (!defined(_WIN32_WINNT)) || (_WIN32_WINNT < 0x0501)
1060 #define _WIN32_WINNT 0x0501
1062 #include <windows.h>
1063 #ifdef HAVE_WINSOCK2_H
1064 #include <winsock2.h>
1065 #ifdef HAVE_WS2TCPIP_H
1066 #include <ws2tcpip.h>
1069 #define GNICALLCONV WSAAPI
1071 #ifdef HAVE_SYS_TYPES_H
1072 #include <sys/types.h>
1074 #ifdef HAVE_SYS_SOCKET_H
1075 #include <sys/socket.h>
1082 extern int GNICALLCONV getnameinfo($gni_arg1, $gni_arg2,
1088 $gni_arg46 hostlen=0;
1089 $gni_arg46 servlen=0;
1091 int res = getnameinfo(0, salen, 0, hostlen, 0, servlen, flags);
1094 curl_cv_func_getnameinfo_args="$gni_arg1,$gni_arg2,$gni_arg46,$gni_arg7"
1102 if test "$curl_cv_func_getnameinfo_args" = "unknown"; then
1103 AC_MSG_WARN([Cannot find proper types to use for getnameinfo args])
1104 AC_MSG_WARN([HAVE_GETNAMEINFO will not be defined])
1106 gni_prev_IFS=$IFS; IFS=','
1107 set dummy `echo "$curl_cv_func_getnameinfo_args" | sed 's/\*/\*/g'`
1111 gni_qual_type_arg1=$[1]
1113 AC_DEFINE_UNQUOTED(GETNAMEINFO_TYPE_ARG2, $[2],
1114 [Define to the type of arg 2 for getnameinfo.])
1115 AC_DEFINE_UNQUOTED(GETNAMEINFO_TYPE_ARG46, $[3],
1116 [Define to the type of args 4 and 6 for getnameinfo.])
1117 AC_DEFINE_UNQUOTED(GETNAMEINFO_TYPE_ARG7, $[4],
1118 [Define to the type of arg 7 for getnameinfo.])
1122 case $prev_sh_opts in
1130 case "$gni_qual_type_arg1" in
1133 gni_type_arg1=`echo $gni_qual_type_arg1 | sed 's/^const //'`
1137 gni_type_arg1=$gni_qual_type_arg1
1141 AC_DEFINE_UNQUOTED(GETNAMEINFO_QUAL_ARG1, $gni_qual_arg1,
1142 [Define to the type qualifier of arg 1 for getnameinfo.])
1143 AC_DEFINE_UNQUOTED(GETNAMEINFO_TYPE_ARG1, $gni_type_arg1,
1144 [Define to the type of arg 1 for getnameinfo.])
1146 case $prev_sh_opts in
1154 AC_DEFINE_UNQUOTED(HAVE_GETNAMEINFO, 1,
1155 [Define to 1 if you have the getnameinfo function.])
1156 ac_cv_func_getnameinfo="yes"
1162 dnl TYPE_SOCKADDR_STORAGE
1163 dnl -------------------------------------------------
1164 dnl Check for struct sockaddr_storage. Most IPv6-enabled
1165 dnl hosts have it, but AIX 4.3 is one known exception.
1167 AC_DEFUN([TYPE_SOCKADDR_STORAGE],
1169 AC_CHECK_TYPE([struct sockaddr_storage],
1170 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE, 1,
1171 [if struct sockaddr_storage is defined]), ,
1174 #ifdef HAVE_WINDOWS_H
1175 #ifndef WIN32_LEAN_AND_MEAN
1176 #define WIN32_LEAN_AND_MEAN
1178 #include <windows.h>
1179 #ifdef HAVE_WINSOCK2_H
1180 #include <winsock2.h>
1183 #ifdef HAVE_SYS_TYPES_H
1184 #include <sys/types.h>
1186 #ifdef HAVE_SYS_SOCKET_H
1187 #include <sys/socket.h>
1189 #ifdef HAVE_NETINET_IN_H
1190 #include <netinet/in.h>
1192 #ifdef HAVE_ARPA_INET_H
1193 #include <arpa/inet.h>
1200 dnl CURL_CHECK_NI_WITHSCOPEID
1201 dnl -------------------------------------------------
1202 dnl Check for working NI_WITHSCOPEID in getnameinfo()
1204 AC_DEFUN([CURL_CHECK_NI_WITHSCOPEID], [
1205 AC_REQUIRE([CURL_CHECK_FUNC_GETNAMEINFO])dnl
1206 AC_REQUIRE([TYPE_SOCKADDR_STORAGE])dnl
1207 AC_CHECK_HEADERS(stdio.h sys/types.h sys/socket.h \
1208 netdb.h netinet/in.h arpa/inet.h)
1210 AC_CACHE_CHECK([for working NI_WITHSCOPEID],
1211 [ac_cv_working_ni_withscopeid], [
1214 #ifdef HAVE_STDLIB_H
1220 #ifdef HAVE_SYS_TYPES_H
1221 #include <sys/types.h>
1223 #ifdef HAVE_SYS_SOCKET_H
1224 #include <sys/socket.h>
1229 #ifdef HAVE_NETINET_IN_H
1230 #include <netinet/in.h>
1232 #ifdef HAVE_ARPA_INET_H
1233 #include <arpa/inet.h>
1236 #if defined(NI_WITHSCOPEID) && defined(HAVE_GETNAMEINFO)
1237 #ifdef HAVE_STRUCT_SOCKADDR_STORAGE
1238 struct sockaddr_storage sa;
1240 unsigned char sa[256];
1242 char hostbuf[NI_MAXHOST];
1244 GETNAMEINFO_TYPE_ARG2 salen = (GETNAMEINFO_TYPE_ARG2)sizeof(sa);
1245 GETNAMEINFO_TYPE_ARG46 hostlen = (GETNAMEINFO_TYPE_ARG46)sizeof(hostbuf);
1246 GETNAMEINFO_TYPE_ARG7 flags = NI_NUMERICHOST | NI_NUMERICSERV | NI_WITHSCOPEID;
1247 int fd = socket(AF_INET6, SOCK_STREAM, 0);
1250 return 1; /* Error creating socket */
1252 rc = getsockname(fd, (GETNAMEINFO_TYPE_ARG1)&sa, &salen);
1254 perror("getsockname()");
1255 return 2; /* Error retrieving socket name */
1257 rc = getnameinfo((GETNAMEINFO_TYPE_ARG1)&sa, salen, hostbuf, hostlen, NULL, 0, flags);
1259 printf("rc = %s\n", gai_strerror(rc));
1260 return 3; /* Error translating socket address */
1262 return 0; /* Ok, NI_WITHSCOPEID works */
1264 return 4; /* Error, NI_WITHSCOPEID not defined or no getnameinfo() */
1266 ]]) # AC-LANG-PROGRAM
1268 # Exit code == 0. Program worked.
1269 ac_cv_working_ni_withscopeid="yes"
1271 # Exit code != 0. Program failed.
1272 ac_cv_working_ni_withscopeid="no"
1274 # Program is not run when cross-compiling. So we assume
1275 # NI_WITHSCOPEID will work if we are able to compile it.
1278 #include <sys/types.h>
1279 #include <sys/socket.h>
1282 unsigned int dummy= NI_NUMERICHOST | NI_NUMERICSERV | NI_WITHSCOPEID;
1285 ac_cv_working_ni_withscopeid="yes"
1287 ac_cv_working_ni_withscopeid="no"
1288 ]) # AC-COMPILE-IFELSE
1291 case "$ac_cv_working_ni_withscopeid" in
1293 AC_DEFINE(HAVE_NI_WITHSCOPEID, 1,
1294 [Define to 1 if NI_WITHSCOPEID exists and works.])
1300 dnl CURL_CHECK_FUNC_RECV
1301 dnl -------------------------------------------------
1302 dnl Test if the socket recv() function is available,
1303 dnl and check its return type and the types of its
1304 dnl arguments. If the function succeeds HAVE_RECV
1305 dnl will be defined, defining the types of the arguments
1306 dnl in RECV_TYPE_ARG1, RECV_TYPE_ARG2, RECV_TYPE_ARG3
1307 dnl and RECV_TYPE_ARG4, defining the type of the function
1308 dnl return value in RECV_TYPE_RETV.
1310 AC_DEFUN([CURL_CHECK_FUNC_RECV], [
1311 AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK])dnl
1312 AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK2])dnl
1313 AC_CHECK_HEADERS(sys/types.h sys/socket.h)
1315 AC_MSG_CHECKING([for recv])
1319 #ifdef HAVE_WINDOWS_H
1320 #ifndef WIN32_LEAN_AND_MEAN
1321 #define WIN32_LEAN_AND_MEAN
1323 #include <windows.h>
1324 #ifdef HAVE_WINSOCK2_H
1325 #include <winsock2.h>
1327 #ifdef HAVE_WINSOCK_H
1328 #include <winsock.h>
1332 #ifdef HAVE_SYS_TYPES_H
1333 #include <sys/types.h>
1335 #ifdef HAVE_SYS_SOCKET_H
1336 #include <sys/socket.h>
1343 AC_MSG_RESULT([yes])
1350 if test "$curl_cv_recv" = "yes"; then
1351 AC_CACHE_CHECK([types of args and return type for recv],
1352 [curl_cv_func_recv_args], [
1353 curl_cv_func_recv_args="unknown"
1354 for recv_retv in 'int' 'ssize_t'; do
1355 for recv_arg1 in 'int' 'ssize_t' 'SOCKET'; do
1356 for recv_arg2 in 'char *' 'void *'; do
1357 for recv_arg3 in 'size_t' 'int' 'socklen_t' 'unsigned int'; do
1358 for recv_arg4 in 'int' 'unsigned int'; do
1359 if test "$curl_cv_func_recv_args" = "unknown"; then
1363 #ifdef HAVE_WINDOWS_H
1364 #ifndef WIN32_LEAN_AND_MEAN
1365 #define WIN32_LEAN_AND_MEAN
1367 #include <windows.h>
1368 #ifdef HAVE_WINSOCK2_H
1369 #include <winsock2.h>
1371 #ifdef HAVE_WINSOCK_H
1372 #include <winsock.h>
1375 #define RECVCALLCONV PASCAL
1377 #ifdef HAVE_SYS_TYPES_H
1378 #include <sys/types.h>
1380 #ifdef HAVE_SYS_SOCKET_H
1381 #include <sys/socket.h>
1383 #define RECVCALLCONV
1385 extern $recv_retv RECVCALLCONV
1386 recv($recv_arg1, $recv_arg2, $recv_arg3, $recv_arg4);
1392 $recv_retv res = recv(s, buf, len, flags);
1395 curl_cv_func_recv_args="$recv_arg1,$recv_arg2,$recv_arg3,$recv_arg4,$recv_retv"
1404 if test "$curl_cv_func_recv_args" = "unknown"; then
1405 AC_MSG_ERROR([Cannot find proper types to use for recv args])
1407 recv_prev_IFS=$IFS; IFS=','
1408 set dummy `echo "$curl_cv_func_recv_args" | sed 's/\*/\*/g'`
1412 AC_DEFINE_UNQUOTED(RECV_TYPE_ARG1, $[1],
1413 [Define to the type of arg 1 for recv.])
1414 AC_DEFINE_UNQUOTED(RECV_TYPE_ARG2, $[2],
1415 [Define to the type of arg 2 for recv.])
1416 AC_DEFINE_UNQUOTED(RECV_TYPE_ARG3, $[3],
1417 [Define to the type of arg 3 for recv.])
1418 AC_DEFINE_UNQUOTED(RECV_TYPE_ARG4, $[4],
1419 [Define to the type of arg 4 for recv.])
1420 AC_DEFINE_UNQUOTED(RECV_TYPE_RETV, $[5],
1421 [Define to the function return type for recv.])
1423 AC_DEFINE_UNQUOTED(HAVE_RECV, 1,
1424 [Define to 1 if you have the recv function.])
1425 ac_cv_func_recv="yes"
1428 AC_MSG_ERROR([Unable to link function recv])
1433 dnl CURL_CHECK_FUNC_SEND
1434 dnl -------------------------------------------------
1435 dnl Test if the socket send() function is available,
1436 dnl and check its return type and the types of its
1437 dnl arguments. If the function succeeds HAVE_SEND
1438 dnl will be defined, defining the types of the arguments
1439 dnl in SEND_TYPE_ARG1, SEND_TYPE_ARG2, SEND_TYPE_ARG3
1440 dnl and SEND_TYPE_ARG4, defining the type of the function
1441 dnl return value in SEND_TYPE_RETV, and also defining the
1442 dnl type qualifier of second argument in SEND_QUAL_ARG2.
1444 AC_DEFUN([CURL_CHECK_FUNC_SEND], [
1445 AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK])dnl
1446 AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK2])dnl
1447 AC_CHECK_HEADERS(sys/types.h sys/socket.h)
1449 AC_MSG_CHECKING([for send])
1453 #ifdef HAVE_WINDOWS_H
1454 #ifndef WIN32_LEAN_AND_MEAN
1455 #define WIN32_LEAN_AND_MEAN
1457 #include <windows.h>
1458 #ifdef HAVE_WINSOCK2_H
1459 #include <winsock2.h>
1461 #ifdef HAVE_WINSOCK_H
1462 #include <winsock.h>
1466 #ifdef HAVE_SYS_TYPES_H
1467 #include <sys/types.h>
1469 #ifdef HAVE_SYS_SOCKET_H
1470 #include <sys/socket.h>
1477 AC_MSG_RESULT([yes])
1484 if test "$curl_cv_send" = "yes"; then
1485 AC_CACHE_CHECK([types of args and return type for send],
1486 [curl_cv_func_send_args], [
1487 curl_cv_func_send_args="unknown"
1488 for send_retv in 'int' 'ssize_t'; do
1489 for send_arg1 in 'int' 'ssize_t' 'SOCKET'; do
1490 for send_arg2 in 'char *' 'void *' 'const char *' 'const void *'; do
1491 for send_arg3 in 'size_t' 'int' 'socklen_t' 'unsigned int'; do
1492 for send_arg4 in 'int' 'unsigned int'; do
1493 if test "$curl_cv_func_send_args" = "unknown"; then
1497 #ifdef HAVE_WINDOWS_H
1498 #ifndef WIN32_LEAN_AND_MEAN
1499 #define WIN32_LEAN_AND_MEAN
1501 #include <windows.h>
1502 #ifdef HAVE_WINSOCK2_H
1503 #include <winsock2.h>
1505 #ifdef HAVE_WINSOCK_H
1506 #include <winsock.h>
1509 #define SENDCALLCONV PASCAL
1511 #ifdef HAVE_SYS_TYPES_H
1512 #include <sys/types.h>
1514 #ifdef HAVE_SYS_SOCKET_H
1515 #include <sys/socket.h>
1517 #define SENDCALLCONV
1519 extern $send_retv SENDCALLCONV
1520 send($send_arg1, $send_arg2, $send_arg3, $send_arg4);
1525 $send_retv res = send(s, 0, len, flags);
1528 curl_cv_func_send_args="$send_arg1,$send_arg2,$send_arg3,$send_arg4,$send_retv"
1537 if test "$curl_cv_func_send_args" = "unknown"; then
1538 AC_MSG_ERROR([Cannot find proper types to use for send args])
1540 send_prev_IFS=$IFS; IFS=','
1541 set dummy `echo "$curl_cv_func_send_args" | sed 's/\*/\*/g'`
1545 send_qual_type_arg2=$[2]
1547 AC_DEFINE_UNQUOTED(SEND_TYPE_ARG1, $[1],
1548 [Define to the type of arg 1 for send.])
1549 AC_DEFINE_UNQUOTED(SEND_TYPE_ARG3, $[3],
1550 [Define to the type of arg 3 for send.])
1551 AC_DEFINE_UNQUOTED(SEND_TYPE_ARG4, $[4],
1552 [Define to the type of arg 4 for send.])
1553 AC_DEFINE_UNQUOTED(SEND_TYPE_RETV, $[5],
1554 [Define to the function return type for send.])
1558 case $prev_sh_opts in
1566 case "$send_qual_type_arg2" in
1568 send_qual_arg2=const
1569 send_type_arg2=`echo $send_qual_type_arg2 | sed 's/^const //'`
1573 send_type_arg2=$send_qual_type_arg2
1577 AC_DEFINE_UNQUOTED(SEND_QUAL_ARG2, $send_qual_arg2,
1578 [Define to the type qualifier of arg 2 for send.])
1579 AC_DEFINE_UNQUOTED(SEND_TYPE_ARG2, $send_type_arg2,
1580 [Define to the type of arg 2 for send.])
1582 case $prev_sh_opts in
1590 AC_DEFINE_UNQUOTED(HAVE_SEND, 1,
1591 [Define to 1 if you have the send function.])
1592 ac_cv_func_send="yes"
1595 AC_MSG_ERROR([Unable to link function send])
1600 dnl CURL_CHECK_FUNC_RECVFROM
1601 dnl -------------------------------------------------
1602 dnl Test if the socket recvfrom() function is available,
1603 dnl and check its return type and the types of its
1604 dnl arguments. If the function succeeds HAVE_RECVFROM
1605 dnl will be defined, defining the types of the arguments
1606 dnl in RECVFROM_TYPE_ARG1, RECVFROM_TYPE_ARG2, and so on
1607 dnl to RECVFROM_TYPE_ARG6, defining also the type of the
1608 dnl function return value in RECVFROM_TYPE_RETV.
1609 dnl Notice that the types returned for pointer arguments
1610 dnl will actually be the type pointed by the pointer.
1612 AC_DEFUN([CURL_CHECK_FUNC_RECVFROM], [
1613 AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK])dnl
1614 AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK2])dnl
1615 AC_CHECK_HEADERS(sys/types.h sys/socket.h)
1617 AC_MSG_CHECKING([for recvfrom])
1621 #ifdef HAVE_WINDOWS_H
1622 #ifndef WIN32_LEAN_AND_MEAN
1623 #define WIN32_LEAN_AND_MEAN
1625 #include <windows.h>
1626 #ifdef HAVE_WINSOCK2_H
1627 #include <winsock2.h>
1629 #ifdef HAVE_WINSOCK_H
1630 #include <winsock.h>
1634 #ifdef HAVE_SYS_TYPES_H
1635 #include <sys/types.h>
1637 #ifdef HAVE_SYS_SOCKET_H
1638 #include <sys/socket.h>
1642 recvfrom(0, 0, 0, 0, 0, 0);
1645 AC_MSG_RESULT([yes])
1646 curl_cv_recvfrom="yes"
1649 curl_cv_recvfrom="no"
1652 if test "$curl_cv_recvfrom" = "yes"; then
1653 AC_CACHE_CHECK([types of args and return type for recvfrom],
1654 [curl_cv_func_recvfrom_args], [
1655 curl_cv_func_recvfrom_args="unknown"
1656 for recvfrom_retv in 'int' 'ssize_t'; do
1657 for recvfrom_arg1 in 'int' 'ssize_t' 'SOCKET'; do
1658 for recvfrom_arg2 in 'char *' 'void *'; do
1659 for recvfrom_arg3 in 'size_t' 'int' 'socklen_t' 'unsigned int'; do
1660 for recvfrom_arg4 in 'int' 'unsigned int'; do
1661 for recvfrom_arg5 in 'struct sockaddr *' 'void *' 'const struct sockaddr *'; do
1662 for recvfrom_arg6 in 'socklen_t *' 'int *' 'unsigned int *' 'size_t *' 'void *'; do
1663 if test "$curl_cv_func_recvfrom_args" = "unknown"; then
1667 #ifdef HAVE_WINDOWS_H
1668 #ifndef WIN32_LEAN_AND_MEAN
1669 #define WIN32_LEAN_AND_MEAN
1671 #include <windows.h>
1672 #ifdef HAVE_WINSOCK2_H
1673 #include <winsock2.h>
1675 #ifdef HAVE_WINSOCK_H
1676 #include <winsock.h>
1679 #define RECVFROMCALLCONV PASCAL
1681 #ifdef HAVE_SYS_TYPES_H
1682 #include <sys/types.h>
1684 #ifdef HAVE_SYS_SOCKET_H
1685 #include <sys/socket.h>
1687 #define RECVFROMCALLCONV
1689 extern $recvfrom_retv RECVFROMCALLCONV
1690 recvfrom($recvfrom_arg1, $recvfrom_arg2,
1691 $recvfrom_arg3, $recvfrom_arg4,
1692 $recvfrom_arg5, $recvfrom_arg6);
1695 $recvfrom_arg2 buf=0;
1696 $recvfrom_arg3 len=0;
1697 $recvfrom_arg4 flags=0;
1698 $recvfrom_arg5 addr=0;
1699 $recvfrom_arg6 addrlen=0;
1700 $recvfrom_retv res=0;
1701 res = recvfrom(s, buf, len, flags, addr, addrlen);
1704 curl_cv_func_recvfrom_args="$recvfrom_arg1,$recvfrom_arg2,$recvfrom_arg3,$recvfrom_arg4,$recvfrom_arg5,$recvfrom_arg6,$recvfrom_retv"
1715 # Nearly last minute change for this release starts here
1716 AC_DEFINE_UNQUOTED(HAVE_RECVFROM, 1,
1717 [Define to 1 if you have the recvfrom function.])
1718 ac_cv_func_recvfrom="yes"
1719 # Nearly last minute change for this release ends here
1720 if test "$curl_cv_func_recvfrom_args" = "unknown"; then
1721 AC_MSG_WARN([Cannot find proper types to use for recvfrom args])
1723 recvfrom_prev_IFS=$IFS; IFS=','
1724 set dummy `echo "$curl_cv_func_recvfrom_args" | sed 's/\*/\*/g'`
1725 IFS=$recvfrom_prev_IFS
1728 recvfrom_ptrt_arg2=$[2]
1729 recvfrom_qual_ptrt_arg5=$[5]
1730 recvfrom_ptrt_arg6=$[6]
1732 AC_DEFINE_UNQUOTED(RECVFROM_TYPE_ARG1, $[1],
1733 [Define to the type of arg 1 for recvfrom.])
1734 AC_DEFINE_UNQUOTED(RECVFROM_TYPE_ARG3, $[3],
1735 [Define to the type of arg 3 for recvfrom.])
1736 AC_DEFINE_UNQUOTED(RECVFROM_TYPE_ARG4, $[4],
1737 [Define to the type of arg 4 for recvfrom.])
1738 AC_DEFINE_UNQUOTED(RECVFROM_TYPE_RETV, $[7],
1739 [Define to the function return type for recvfrom.])
1743 case $prev_sh_opts in
1751 case "$recvfrom_qual_ptrt_arg5" in
1753 recvfrom_qual_arg5=const
1754 recvfrom_ptrt_arg5=`echo $recvfrom_qual_ptrt_arg5 | sed 's/^const //'`
1758 recvfrom_ptrt_arg5=$recvfrom_qual_ptrt_arg5
1762 recvfrom_type_arg2=`echo $recvfrom_ptrt_arg2 | sed 's/ \*//'`
1763 recvfrom_type_arg5=`echo $recvfrom_ptrt_arg5 | sed 's/ \*//'`
1764 recvfrom_type_arg6=`echo $recvfrom_ptrt_arg6 | sed 's/ \*//'`
1766 AC_DEFINE_UNQUOTED(RECVFROM_TYPE_ARG2, $recvfrom_type_arg2,
1767 [Define to the type pointed by arg 2 for recvfrom.])
1768 AC_DEFINE_UNQUOTED(RECVFROM_QUAL_ARG5, $recvfrom_qual_arg5,
1769 [Define to the type qualifier pointed by arg 5 for recvfrom.])
1770 AC_DEFINE_UNQUOTED(RECVFROM_TYPE_ARG5, $recvfrom_type_arg5,
1771 [Define to the type pointed by arg 5 for recvfrom.])
1772 AC_DEFINE_UNQUOTED(RECVFROM_TYPE_ARG6, $recvfrom_type_arg6,
1773 [Define to the type pointed by arg 6 for recvfrom.])
1775 if test "$recvfrom_type_arg2" = "void"; then
1776 AC_DEFINE_UNQUOTED(RECVFROM_TYPE_ARG2_IS_VOID, 1,
1777 [Define to 1 if the type pointed by arg 2 for recvfrom is void.])
1779 if test "$recvfrom_type_arg5" = "void"; then
1780 AC_DEFINE_UNQUOTED(RECVFROM_TYPE_ARG5_IS_VOID, 1,
1781 [Define to 1 if the type pointed by arg 5 for recvfrom is void.])
1783 if test "$recvfrom_type_arg6" = "void"; then
1784 AC_DEFINE_UNQUOTED(RECVFROM_TYPE_ARG6_IS_VOID, 1,
1785 [Define to 1 if the type pointed by arg 6 for recvfrom is void.])
1788 case $prev_sh_opts in
1796 AC_DEFINE_UNQUOTED(HAVE_RECVFROM, 1,
1797 [Define to 1 if you have the recvfrom function.])
1798 ac_cv_func_recvfrom="yes"
1801 AC_MSG_WARN([Unable to link function recvfrom])
1806 dnl CURL_CHECK_MSG_NOSIGNAL
1807 dnl -------------------------------------------------
1808 dnl Check for MSG_NOSIGNAL
1810 AC_DEFUN([CURL_CHECK_MSG_NOSIGNAL], [
1811 AC_CHECK_HEADERS(sys/types.h sys/socket.h)
1812 AC_CACHE_CHECK([for MSG_NOSIGNAL], [ac_cv_msg_nosignal], [
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>
1837 int flag=MSG_NOSIGNAL;
1840 ac_cv_msg_nosignal="yes"
1842 ac_cv_msg_nosignal="no"
1845 case "$ac_cv_msg_nosignal" in
1847 AC_DEFINE_UNQUOTED(HAVE_MSG_NOSIGNAL, 1,
1848 [Define to 1 if you have the MSG_NOSIGNAL flag.])
1854 dnl CURL_CHECK_STRUCT_TIMEVAL
1855 dnl -------------------------------------------------
1856 dnl Check for timeval struct
1858 AC_DEFUN([CURL_CHECK_STRUCT_TIMEVAL], [
1859 AC_REQUIRE([AC_HEADER_TIME])dnl
1860 AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK])dnl
1861 AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK2])dnl
1862 AC_CHECK_HEADERS(sys/types.h sys/time.h time.h sys/socket.h)
1863 AC_CACHE_CHECK([for struct timeval], [ac_cv_struct_timeval], [
1867 #ifdef HAVE_WINDOWS_H
1868 #ifndef WIN32_LEAN_AND_MEAN
1869 #define WIN32_LEAN_AND_MEAN
1871 #include <windows.h>
1872 #ifdef HAVE_WINSOCK2_H
1873 #include <winsock2.h>
1875 #ifdef HAVE_WINSOCK_H
1876 #include <winsock.h>
1880 #ifdef HAVE_SYS_TYPES_H
1881 #include <sys/types.h>
1883 #ifdef HAVE_SYS_TIME_H
1884 #include <sys/time.h>
1885 #ifdef TIME_WITH_SYS_TIME
1893 #ifdef HAVE_SYS_SOCKET_H
1894 #include <sys/socket.h>
1902 ac_cv_struct_timeval="yes"
1904 ac_cv_struct_timeval="no"
1907 case "$ac_cv_struct_timeval" in
1909 AC_DEFINE_UNQUOTED(HAVE_STRUCT_TIMEVAL, 1,
1910 [Define to 1 if you have the timeval struct.])
1916 dnl TYPE_SIG_ATOMIC_T
1917 dnl -------------------------------------------------
1918 dnl Check if the sig_atomic_t type is available, and
1919 dnl verify if it is already defined as volatile.
1921 AC_DEFUN([TYPE_SIG_ATOMIC_T], [
1922 AC_CHECK_HEADERS(signal.h)
1923 AC_CHECK_TYPE([sig_atomic_t],[
1924 AC_DEFINE(HAVE_SIG_ATOMIC_T, 1,
1925 [Define to 1 if sig_atomic_t is an available typedef.])
1927 #ifdef HAVE_SIGNAL_H
1931 case "$ac_cv_type_sig_atomic_t" in
1934 AC_MSG_CHECKING([if sig_atomic_t is already defined as volatile])
1937 #ifdef HAVE_SIGNAL_H
1941 static volatile sig_atomic_t dummy = 0;
1945 ac_cv_sig_atomic_t_volatile="no"
1947 AC_MSG_RESULT([yes])
1948 ac_cv_sig_atomic_t_volatile="yes"
1951 if test "$ac_cv_sig_atomic_t_volatile" = "yes"; then
1952 AC_DEFINE(HAVE_SIG_ATOMIC_T_VOLATILE, 1,
1953 [Define to 1 if sig_atomic_t is already defined as volatile.])
1961 dnl -------------------------------------------------
1962 dnl Check for in_addr_t: it is used to receive the return code of inet_addr()
1963 dnl and a few other things.
1965 AC_DEFUN([TYPE_IN_ADDR_T], [
1966 AC_CHECK_TYPE([in_addr_t], ,[
1967 dnl in_addr_t not available
1968 AC_CACHE_CHECK([for in_addr_t equivalent],
1969 [curl_cv_in_addr_t_equiv], [
1970 curl_cv_in_addr_t_equiv="unknown"
1971 for t in "unsigned long" int size_t unsigned long; do
1972 if test "$curl_cv_in_addr_t_equiv" = "unknown"; then
1976 #ifdef HAVE_WINDOWS_H
1977 #ifndef WIN32_LEAN_AND_MEAN
1978 #define WIN32_LEAN_AND_MEAN
1980 #include <windows.h>
1981 #ifdef HAVE_WINSOCK2_H
1982 #include <winsock2.h>
1984 #ifdef HAVE_WINSOCK_H
1985 #include <winsock.h>
1989 #ifdef HAVE_SYS_TYPES_H
1990 #include <sys/types.h>
1992 #ifdef HAVE_SYS_SOCKET_H
1993 #include <sys/socket.h>
1995 #ifdef HAVE_NETINET_IN_H
1996 #include <netinet/in.h>
1998 #ifdef HAVE_ARPA_INET_H
1999 #include <arpa/inet.h>
2003 $t data = inet_addr ("1.2.3.4");
2006 curl_cv_in_addr_t_equiv="$t"
2011 case "$curl_cv_in_addr_t_equiv" in
2013 AC_MSG_ERROR([Cannot find a type to use in place of in_addr_t])
2016 AC_DEFINE_UNQUOTED(in_addr_t, $curl_cv_in_addr_t_equiv,
2017 [Type to use in place of in_addr_t when system does not provide it.])
2022 #ifdef HAVE_WINDOWS_H
2023 #ifndef WIN32_LEAN_AND_MEAN
2024 #define WIN32_LEAN_AND_MEAN
2026 #include <windows.h>
2027 #ifdef HAVE_WINSOCK2_H
2028 #include <winsock2.h>
2030 #ifdef HAVE_WINSOCK_H
2031 #include <winsock.h>
2035 #ifdef HAVE_SYS_TYPES_H
2036 #include <sys/types.h>
2038 #ifdef HAVE_SYS_SOCKET_H
2039 #include <sys/socket.h>
2041 #ifdef HAVE_NETINET_IN_H
2042 #include <netinet/in.h>
2044 #ifdef HAVE_ARPA_INET_H
2045 #include <arpa/inet.h>
2052 dnl CURL_CHECK_FUNC_CLOCK_GETTIME_MONOTONIC
2053 dnl -------------------------------------------------
2054 dnl Check if monotonic clock_gettime is available.
2056 AC_DEFUN([CURL_CHECK_FUNC_CLOCK_GETTIME_MONOTONIC], [
2057 AC_REQUIRE([AC_HEADER_TIME])dnl
2058 AC_CHECK_HEADERS(sys/types.h sys/time.h time.h)
2059 AC_MSG_CHECKING([for monotonic clock_gettime])
2062 #ifdef HAVE_SYS_TYPES_H
2063 #include <sys/types.h>
2065 #ifdef HAVE_SYS_TIME_H
2066 #include <sys/time.h>
2067 #ifdef TIME_WITH_SYS_TIME
2077 (void)clock_gettime(CLOCK_MONOTONIC, &ts);
2080 AC_MSG_RESULT([yes])
2081 ac_cv_func_clock_gettime="yes"
2084 ac_cv_func_clock_gettime="no"
2086 dnl Definition of HAVE_CLOCK_GETTIME_MONOTONIC is intentionally postponed
2087 dnl until library linking and run-time checks for clock_gettime succeed.
2091 dnl CURL_CHECK_LIBS_CLOCK_GETTIME_MONOTONIC
2092 dnl -------------------------------------------------
2093 dnl If monotonic clock_gettime is available then,
2094 dnl check and prepended to LIBS any needed libraries.
2096 AC_DEFUN([CURL_CHECK_LIBS_CLOCK_GETTIME_MONOTONIC], [
2097 AC_REQUIRE([CURL_CHECK_FUNC_CLOCK_GETTIME_MONOTONIC])dnl
2099 if test "$ac_cv_func_clock_gettime" = "yes"; then
2101 AC_MSG_CHECKING([for clock_gettime in libraries])
2103 curl_cv_save_LIBS="$LIBS"
2104 curl_cv_gclk_LIBS="unknown"
2106 for x_xlibs in '' '-lrt' '-lposix4' ; do
2107 if test "$curl_cv_gclk_LIBS" = "unknown"; then
2108 if test -z "$x_xlibs"; then
2109 LIBS="$curl_cv_save_LIBS"
2111 LIBS="$x_xlibs $curl_cv_save_LIBS"
2115 #ifdef HAVE_SYS_TYPES_H
2116 #include <sys/types.h>
2118 #ifdef HAVE_SYS_TIME_H
2119 #include <sys/time.h>
2120 #ifdef TIME_WITH_SYS_TIME
2130 (void)clock_gettime(CLOCK_MONOTONIC, &ts);
2133 curl_cv_gclk_LIBS="$x_xlibs"
2138 LIBS="$curl_cv_save_LIBS"
2140 case X-"$curl_cv_gclk_LIBS" in
2142 AC_MSG_RESULT([cannot find clock_gettime])
2143 AC_MSG_WARN([HAVE_CLOCK_GETTIME_MONOTONIC will not be defined])
2144 ac_cv_func_clock_gettime="no"
2147 AC_MSG_RESULT([no additional lib required])
2148 ac_cv_func_clock_gettime="yes"
2151 if test -z "$curl_cv_save_LIBS"; then
2152 LIBS="$curl_cv_gclk_LIBS"
2154 LIBS="$curl_cv_gclk_LIBS $curl_cv_save_LIBS"
2156 CURL_LIBS="$CURL_LIBS $curl_cv_gclk_LIBS"
2157 AC_MSG_RESULT([$curl_cv_gclk_LIBS])
2158 ac_cv_func_clock_gettime="yes"
2162 dnl only do runtime verification when not cross-compiling
2163 if test "x$cross_compiling" != "xyes" &&
2164 test "$ac_cv_func_clock_gettime" = "yes"; then
2165 AC_MSG_CHECKING([if monotonic clock_gettime works])
2168 #ifdef HAVE_STDLIB_H
2171 #ifdef HAVE_SYS_TYPES_H
2172 #include <sys/types.h>
2174 #ifdef HAVE_SYS_TIME_H
2175 #include <sys/time.h>
2176 #ifdef TIME_WITH_SYS_TIME
2186 if (0 == clock_gettime(CLOCK_MONOTONIC, &ts))
2192 AC_MSG_RESULT([yes])
2195 AC_MSG_WARN([HAVE_CLOCK_GETTIME_MONOTONIC will not be defined])
2196 ac_cv_func_clock_gettime="no"
2197 LIBS="$curl_cv_save_LIBS"
2201 case "$ac_cv_func_clock_gettime" in
2203 AC_DEFINE_UNQUOTED(HAVE_CLOCK_GETTIME_MONOTONIC, 1,
2204 [Define to 1 if you have the clock_gettime function and monotonic timer.])
2213 dnl CURL_CHECK_LIBS_CONNECT
2214 dnl -------------------------------------------------
2215 dnl Verify if network connect function is already available
2216 dnl using current libraries or if another one is required.
2218 AC_DEFUN([CURL_CHECK_LIBS_CONNECT], [
2219 AC_REQUIRE([CURL_INCLUDES_WINSOCK2])dnl
2220 AC_MSG_CHECKING([for connect in libraries])
2221 tst_connect_save_LIBS="$LIBS"
2222 tst_connect_need_LIBS="unknown"
2223 for tst_lib in '' '-lsocket' ; do
2224 if test "$tst_connect_need_LIBS" = "unknown"; then
2225 LIBS="$tst_lib $tst_connect_save_LIBS"
2228 $curl_includes_winsock2
2229 #ifndef HAVE_WINDOWS_H
2230 int connect(int, void*, int);
2233 if(0 != connect(0, 0, 0))
2237 tst_connect_need_LIBS="$tst_lib"
2241 LIBS="$tst_connect_save_LIBS"
2243 case X-"$tst_connect_need_LIBS" in
2245 AC_MSG_RESULT([cannot find connect])
2246 AC_MSG_ERROR([cannot find connect function in libraries.])
2249 AC_MSG_RESULT([yes])
2252 AC_MSG_RESULT([$tst_connect_need_LIBS])
2253 LIBS="$tst_connect_need_LIBS $tst_connect_save_LIBS"
2259 dnl CURL_DEFINE_UNQUOTED (VARIABLE, [VALUE])
2260 dnl -------------------------------------------------
2261 dnl Like AC_DEFINE_UNQUOTED this macro will define a C preprocessor
2262 dnl symbol that can be further used in custom template configuration
2263 dnl files. This macro, unlike AC_DEFINE_UNQUOTED, does not use a third
2264 dnl argument for the description. Symbol definitions done with this
2265 dnl macro are intended to be exclusively used in handcrafted *.h.in
2266 dnl template files. Contrary to what AC_DEFINE_UNQUOTED does, this one
2267 dnl prevents autoheader generation and insertion of symbol template
2268 dnl stub and definition into the first configuration header file. Do
2269 dnl not use this macro as a replacement for AC_DEFINE_UNQUOTED, each
2270 dnl one serves different functional needs.
2272 AC_DEFUN([CURL_DEFINE_UNQUOTED], [
2273 cat >>confdefs.h <<_EOF
2274 [@%:@define] $1 ifelse($#, 2, [$2], 1)
2279 dnl CURL_CONFIGURE_LONG
2280 dnl -------------------------------------------------
2281 dnl Find out the size of long as reported by sizeof() and define
2282 dnl CURL_SIZEOF_LONG as appropriate to be used in template file
2283 dnl include/curl/curlbuild.h.in to properly configure the library.
2284 dnl The size of long is a build time characteristic and as such
2285 dnl must be recorded in curlbuild.h
2287 AC_DEFUN([CURL_CONFIGURE_LONG], [
2288 if test -z "$ac_cv_sizeof_long" ||
2289 test "$ac_cv_sizeof_long" -eq "0"; then
2290 AC_MSG_ERROR([cannot find out size of long.])
2292 CURL_DEFINE_UNQUOTED([CURL_SIZEOF_LONG], [$ac_cv_sizeof_long])
2296 dnl CURL_CONFIGURE_CURL_SOCKLEN_T
2297 dnl -------------------------------------------------
2298 dnl Find out suitable curl_socklen_t data type definition and size, making
2299 dnl appropriate definitions for template file include/curl/curlbuild.h.in
2300 dnl to properly configure and use the library.
2302 dnl The need for the curl_socklen_t definition arises mainly to properly
2303 dnl interface HP-UX systems which on one hand have a typedef'ed socklen_t
2304 dnl data type which is 32 or 64-Bit wide depending on the data model being
2305 dnl used, and that on the other hand is only actually used when interfacing
2306 dnl the X/Open sockets provided in the xnet library.
2308 AC_DEFUN([CURL_CONFIGURE_CURL_SOCKLEN_T], [
2309 AC_REQUIRE([CURL_INCLUDES_WS2TCPIP])dnl
2310 AC_REQUIRE([CURL_INCLUDES_SYS_SOCKET])dnl
2311 AC_REQUIRE([CURL_PREPROCESS_CALLCONV])dnl
2313 AC_MSG_CHECKING([for curl_socklen_t data type])
2314 curl_typeof_curl_socklen_t="unknown"
2315 for arg1 in int SOCKET; do
2316 for arg2 in 'struct sockaddr' void; do
2317 for t in socklen_t int size_t 'unsigned int' long 'unsigned long' void; do
2318 if test "$curl_typeof_curl_socklen_t" = "unknown"; then
2321 $curl_includes_ws2tcpip
2322 $curl_includes_sys_socket
2323 $curl_preprocess_callconv
2324 extern int FUNCALLCONV getpeername($arg1, $arg2 *, $t *);
2327 if(0 != getpeername(0, 0, lenptr))
2331 curl_typeof_curl_socklen_t="$t"
2337 for t in socklen_t int; do
2338 if test "$curl_typeof_curl_socklen_t" = "void"; then
2341 $curl_includes_sys_socket
2342 typedef $t curl_socklen_t;
2344 curl_socklen_t dummy;
2347 curl_typeof_curl_socklen_t="$t"
2351 AC_MSG_RESULT([$curl_typeof_curl_socklen_t])
2352 if test "$curl_typeof_curl_socklen_t" = "void" ||
2353 test "$curl_typeof_curl_socklen_t" = "unknown"; then
2354 AC_MSG_ERROR([cannot find data type for curl_socklen_t.])
2357 AC_MSG_CHECKING([size of curl_socklen_t])
2358 curl_sizeof_curl_socklen_t="unknown"
2359 curl_pull_headers_socklen_t="unknown"
2360 if test "$ac_cv_header_ws2tcpip_h" = "yes"; then
2361 tst_pull_header_checks='none ws2tcpip'
2364 tst_pull_header_checks='none systypes syssocket'
2365 tst_size_checks='4 8 2'
2367 for tst_size in $tst_size_checks; do
2368 for tst_pull_headers in $tst_pull_header_checks; do
2369 if test "$curl_sizeof_curl_socklen_t" = "unknown"; then
2370 case $tst_pull_headers in
2372 tmp_includes="$curl_includes_ws2tcpip"
2375 tmp_includes="$curl_includes_sys_types"
2378 tmp_includes="$curl_includes_sys_socket"
2387 typedef $curl_typeof_curl_socklen_t curl_socklen_t;
2388 typedef char dummy_arr[sizeof(curl_socklen_t) == $tst_size ? 1 : -1];
2390 curl_socklen_t dummy;
2393 curl_sizeof_curl_socklen_t="$tst_size"
2394 curl_pull_headers_socklen_t="$tst_pull_headers"
2399 AC_MSG_RESULT([$curl_sizeof_curl_socklen_t])
2400 if test "$curl_sizeof_curl_socklen_t" = "unknown"; then
2401 AC_MSG_ERROR([cannot find out size of curl_socklen_t.])
2404 case $curl_pull_headers_socklen_t in
2406 CURL_DEFINE_UNQUOTED([CURL_PULL_WS2TCPIP_H])
2409 CURL_DEFINE_UNQUOTED([CURL_PULL_SYS_TYPES_H])
2412 CURL_DEFINE_UNQUOTED([CURL_PULL_SYS_TYPES_H])
2413 CURL_DEFINE_UNQUOTED([CURL_PULL_SYS_SOCKET_H])
2416 CURL_DEFINE_UNQUOTED([CURL_TYPEOF_CURL_SOCKLEN_T], [$curl_typeof_curl_socklen_t])
2417 CURL_DEFINE_UNQUOTED([CURL_SIZEOF_CURL_SOCKLEN_T], [$curl_sizeof_curl_socklen_t])
2421 dnl CURL_CHECK_FUNC_SELECT
2422 dnl -------------------------------------------------
2423 dnl Test if the socket select() function is available,
2424 dnl and check its return type and the types of its
2425 dnl arguments. If the function succeeds HAVE_SELECT
2426 dnl will be defined, defining the types of the
2427 dnl arguments in SELECT_TYPE_ARG1, SELECT_TYPE_ARG234
2428 dnl and SELECT_TYPE_ARG5, defining the type of the
2429 dnl function return value in SELECT_TYPE_RETV, and
2430 dnl also defining the type qualifier of fifth argument
2431 dnl in SELECT_QUAL_ARG5.
2433 AC_DEFUN([CURL_CHECK_FUNC_SELECT], [
2434 AC_REQUIRE([CURL_CHECK_STRUCT_TIMEVAL])dnl
2435 AC_CHECK_HEADERS(sys/select.h sys/socket.h)
2437 AC_MSG_CHECKING([for select])
2441 #ifdef HAVE_WINDOWS_H
2442 #ifndef WIN32_LEAN_AND_MEAN
2443 #define WIN32_LEAN_AND_MEAN
2445 #include <windows.h>
2446 #ifdef HAVE_WINSOCK2_H
2447 #include <winsock2.h>
2449 #ifdef HAVE_WINSOCK_H
2450 #include <winsock.h>
2454 #ifdef HAVE_SYS_TYPES_H
2455 #include <sys/types.h>
2457 #ifdef HAVE_SYS_TIME_H
2458 #include <sys/time.h>
2459 #ifdef TIME_WITH_SYS_TIME
2467 #ifndef HAVE_WINDOWS_H
2468 #ifdef HAVE_SYS_SELECT_H
2469 #include <sys/select.h>
2471 #ifdef HAVE_SYS_SOCKET_H
2472 #include <sys/socket.h>
2476 select(0, 0, 0, 0, 0);
2479 AC_MSG_RESULT([yes])
2480 curl_cv_select="yes"
2486 if test "$curl_cv_select" = "yes"; then
2487 AC_CACHE_CHECK([types of args and return type for select],
2488 [curl_cv_func_select_args], [
2489 curl_cv_func_select_args="unknown"
2490 for sel_retv in 'int' 'ssize_t'; do
2491 for sel_arg1 in 'int' 'ssize_t' 'size_t' 'unsigned long int' 'unsigned int'; do
2492 for sel_arg234 in 'fd_set *' 'int *' 'void *'; do
2493 for sel_arg5 in 'struct timeval *' 'const struct timeval *'; do
2494 if test "$curl_cv_func_select_args" = "unknown"; then
2498 #ifdef HAVE_WINDOWS_H
2499 #ifndef WIN32_LEAN_AND_MEAN
2500 #define WIN32_LEAN_AND_MEAN
2502 #include <windows.h>
2503 #ifdef HAVE_WINSOCK2_H
2504 #include <winsock2.h>
2506 #ifdef HAVE_WINSOCK_H
2507 #include <winsock.h>
2510 #define SELECTCALLCONV PASCAL
2512 #ifdef HAVE_SYS_TYPES_H
2513 #include <sys/types.h>
2515 #ifdef HAVE_SYS_TIME_H
2516 #include <sys/time.h>
2517 #ifdef TIME_WITH_SYS_TIME
2525 #ifndef HAVE_WINDOWS_H
2526 #ifdef HAVE_SYS_SELECT_H
2527 #include <sys/select.h>
2529 #ifdef HAVE_SYS_SOCKET_H
2530 #include <sys/socket.h>
2532 #define SELECTCALLCONV
2534 #ifndef HAVE_STRUCT_TIMEVAL
2540 extern $sel_retv SELECTCALLCONV select($sel_arg1,
2550 $sel_retv res = select(nfds, rfds, wfds, efds, 0);
2553 curl_cv_func_select_args="$sel_arg1,$sel_arg234,$sel_arg5,$sel_retv"
2561 if test "$curl_cv_func_select_args" = "unknown"; then
2562 AC_MSG_WARN([Cannot find proper types to use for select args])
2563 AC_MSG_WARN([HAVE_SELECT will not be defined])
2565 select_prev_IFS=$IFS; IFS=','
2566 set dummy `echo "$curl_cv_func_select_args" | sed 's/\*/\*/g'`
2567 IFS=$select_prev_IFS
2570 sel_qual_type_arg5=$[3]
2572 AC_DEFINE_UNQUOTED(SELECT_TYPE_ARG1, $[1],
2573 [Define to the type of arg 1 for select.])
2574 AC_DEFINE_UNQUOTED(SELECT_TYPE_ARG234, $[2],
2575 [Define to the type of args 2, 3 and 4 for select.])
2576 AC_DEFINE_UNQUOTED(SELECT_TYPE_RETV, $[4],
2577 [Define to the function return type for select.])
2581 case $prev_sh_opts in
2589 case "$sel_qual_type_arg5" in
2592 sel_type_arg5=`echo $sel_qual_type_arg5 | sed 's/^const //'`
2596 sel_type_arg5=$sel_qual_type_arg5
2600 AC_DEFINE_UNQUOTED(SELECT_QUAL_ARG5, $sel_qual_arg5,
2601 [Define to the type qualifier of arg 5 for select.])
2602 AC_DEFINE_UNQUOTED(SELECT_TYPE_ARG5, $sel_type_arg5,
2603 [Define to the type of arg 5 for select.])
2605 case $prev_sh_opts in
2613 AC_DEFINE_UNQUOTED(HAVE_SELECT, 1,
2614 [Define to 1 if you have the select function.])
2615 ac_cv_func_select="yes"
2621 # This is only a temporary fix. This macro is here to replace the broken one
2622 # delivered by the automake project (including the 1.9.6 release). As soon as
2623 # they ship a working version we SHOULD remove this work-around.
2625 AC_DEFUN([AM_MISSING_HAS_RUN],
2626 [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
2627 test x"${MISSING+set}" = xset || MISSING="\${SHELL} \"$am_aux_dir/missing\""
2628 # Use eval to expand $SHELL
2629 if eval "$MISSING --run true"; then
2630 am_missing_run="$MISSING --run "
2633 AC_MSG_WARN([`missing' script is too old or missing])
2638 dnl CURL_VERIFY_RUNTIMELIBS
2639 dnl -------------------------------------------------
2640 dnl Verify that the shared libs found so far can be used when running
2641 dnl programs, since otherwise the situation will create odd configure errors
2642 dnl that are misleading people.
2644 dnl Make sure this test is run BEFORE the first test in the script that
2645 dnl runs anything, which at the time of this writing is the AC_CHECK_SIZEOF
2646 dnl macro. It must also run AFTER all lib-checking macros are complete.
2648 AC_DEFUN([CURL_VERIFY_RUNTIMELIBS], [
2650 dnl this test is of course not sensible if we are cross-compiling!
2651 if test "x$cross_compiling" != xyes; then
2653 dnl just run a program to verify that the libs checked for previous to this
2654 dnl point also is available run-time!
2655 AC_MSG_CHECKING([run-time libs availability])
2662 AC_MSG_RESULT([fine]),
2663 AC_MSG_RESULT([failed])
2664 AC_MSG_ERROR([one or more libs available at link-time are not available run-time. Libs used at link-time: $LIBS])
2667 dnl if this test fails, configure has already stopped
2672 dnl CURL_CHECK_VARIADIC_MACROS
2673 dnl -------------------------------------------------
2674 dnl Check compiler support of variadic macros
2676 AC_DEFUN([CURL_CHECK_VARIADIC_MACROS], [
2677 AC_CACHE_CHECK([for compiler support of C99 variadic macro style],
2678 [curl_cv_variadic_macros_c99], [
2681 #define c99_vmacro3(first, ...) fun3(first, __VA_ARGS__)
2682 #define c99_vmacro2(first, ...) fun2(first, __VA_ARGS__)
2683 int fun3(int arg1, int arg2, int arg3);
2684 int fun2(int arg1, int arg2);
2685 int fun3(int arg1, int arg2, int arg3)
2686 { return arg1 + arg2 + arg3; }
2687 int fun2(int arg1, int arg2)
2688 { return arg1 + arg2; }
2690 int res3 = c99_vmacro3(1, 2, 3);
2691 int res2 = c99_vmacro2(1, 2);
2694 curl_cv_variadic_macros_c99="yes"
2696 curl_cv_variadic_macros_c99="no"
2699 case "$curl_cv_variadic_macros_c99" in
2701 AC_DEFINE_UNQUOTED(HAVE_VARIADIC_MACROS_C99, 1,
2702 [Define to 1 if compiler supports C99 variadic macro style.])
2705 AC_CACHE_CHECK([for compiler support of old gcc variadic macro style],
2706 [curl_cv_variadic_macros_gcc], [
2709 #define gcc_vmacro3(first, args...) fun3(first, args)
2710 #define gcc_vmacro2(first, args...) fun2(first, args)
2711 int fun3(int arg1, int arg2, int arg3);
2712 int fun2(int arg1, int arg2);
2713 int fun3(int arg1, int arg2, int arg3)
2714 { return arg1 + arg2 + arg3; }
2715 int fun2(int arg1, int arg2)
2716 { return arg1 + arg2; }
2718 int res3 = gcc_vmacro3(1, 2, 3);
2719 int res2 = gcc_vmacro2(1, 2);
2722 curl_cv_variadic_macros_gcc="yes"
2724 curl_cv_variadic_macros_gcc="no"
2727 case "$curl_cv_variadic_macros_gcc" in
2729 AC_DEFINE_UNQUOTED(HAVE_VARIADIC_MACROS_GCC, 1,
2730 [Define to 1 if compiler supports old gcc variadic macro style.])
2736 dnl CURL_CHECK_CA_BUNDLE
2737 dnl -------------------------------------------------
2738 dnl Check if a default ca-bundle should be used
2740 dnl regarding the paths this will scan:
2741 dnl /etc/ssl/certs/ca-certificates.crt Debian systems
2742 dnl /etc/pki/tls/certs/ca-bundle.crt Redhat and Mandriva
2743 dnl /usr/share/ssl/certs/ca-bundle.crt old(er) Redhat
2744 dnl /usr/local/share/certs/ca-root.crt FreeBSD
2745 dnl /etc/ssl/cert.pem OpenBSD
2746 dnl /etc/ssl/certs/ (ca path) SUSE
2748 AC_DEFUN([CURL_CHECK_CA_BUNDLE], [
2750 AC_MSG_CHECKING([default CA cert bundle/path])
2752 AC_ARG_WITH(ca-bundle,
2753 AC_HELP_STRING([--with-ca-bundle=FILE], [File name to use as CA bundle])
2754 AC_HELP_STRING([--without-ca-bundle], [Don't use a default CA bundle]),
2757 if test "x$want_ca" = "xyes"; then
2758 AC_MSG_ERROR([--with-ca-bundle=FILE requires a path to the CA bundle])
2761 [ want_ca="unset" ])
2762 AC_ARG_WITH(ca-path,
2763 AC_HELP_STRING([--with-ca-path=DIRECTORY], [Directory to use as CA path])
2764 AC_HELP_STRING([--without-ca-path], [Don't use a default CA path]),
2766 want_capath="$withval"
2767 if test "x$want_capath" = "xyes"; then
2768 AC_MSG_ERROR([--with-ca-path=DIRECTORY requires a path to the CA path directory])
2771 [ want_capath="unset"])
2773 if test "x$want_ca" != "xno" -a "x$want_ca" != "xunset" -a \
2774 "x$want_capath" != "xno" -a "x$want_capath" != "xunset"; then
2776 AC_MSG_ERROR([Can't specify both --with-ca-bundle and --with-ca-path.])
2777 elif test "x$want_ca" != "xno" -a "x$want_ca" != "xunset"; then
2778 dnl --with-ca-bundle given
2781 elif test "x$want_capath" != "xno" -a "x$want_capath" != "xunset"; then
2782 dnl --with-ca-path given
2783 if test "x$OPENSSL_ENABLED" != "x1"; then
2784 AC_MSG_ERROR([--with-ca-path only works with openSSL])
2786 capath="$want_capath"
2789 dnl neither of --with-ca-* given
2790 dnl first try autodetecting a CA bundle , then a CA path
2791 dnl both autodetections can be skipped by --without-ca-*
2794 if test "x$want_ca" = "xunset"; then
2795 dnl the path we previously would have installed the curl ca bundle
2796 dnl to, and thus we now check for an already existing cert in that place
2797 dnl in case we find no other
2798 if test "x$prefix" != xNONE; then
2799 cac="${prefix}/share/curl/curl-ca-bundle.crt"
2801 cac="$ac_default_prefix/share/curl/curl-ca-bundle.crt"
2804 for a in /etc/ssl/certs/ca-certificates.crt \
2805 /etc/pki/tls/certs/ca-bundle.crt \
2806 /usr/share/ssl/certs/ca-bundle.crt \
2807 /usr/local/share/certs/ca-root.crt \
2810 if test -f "$a"; then
2816 if test "x$want_capath" = "xunset" -a "x$ca" = "xno" -a \
2817 "x$OPENSSL_ENABLED" = "x1"; then
2818 for a in /etc/ssl/certs/; do
2819 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
2829 if test "x$ca" != "xno"; then
2830 CURL_CA_BUNDLE='"'$ca'"'
2831 AC_DEFINE_UNQUOTED(CURL_CA_BUNDLE, "$ca", [Location of default ca bundle])
2832 AC_SUBST(CURL_CA_BUNDLE)
2833 AC_MSG_RESULT([$ca])
2834 elif test "x$capath" != "xno"; then
2835 CURL_CA_PATH="\"$capath\""
2836 AC_DEFINE_UNQUOTED(CURL_CA_PATH, "$capath", [Location of default ca path])
2837 AC_MSG_RESULT([$capath (capath)])
2844 dnl DO_CURL_OFF_T_CHECK (TYPE, SIZE)
2845 dnl -------------------------------------------------
2846 dnl Internal macro for CURL_CONFIGURE_CURL_OFF_T
2848 AC_DEFUN([DO_CURL_OFF_T_CHECK], [
2849 AC_REQUIRE([CURL_INCLUDES_INTTYPES])dnl
2850 if test "$curl_typeof_curl_off_t" = "unknown" && test ! -z "$1"; then
2854 case XC_SH_TR_SH([$1]) in
2856 tmp_includes="$curl_includes_inttypes"
2857 tmp_source="char f@<:@@:>@ = PRId64;"
2861 tmp_includes="$curl_includes_inttypes"
2862 tmp_source="char f@<:@@:>@ = PRId32;"
2866 tmp_includes="$curl_includes_inttypes"
2867 tmp_source="char f@<:@@:>@ = PRId16;"
2874 typedef $1 curl_off_t;
2875 typedef char dummy_arr[sizeof(curl_off_t) == $2 ? 1 : -1];
2881 if test -z "$tmp_fmt"; then
2882 curl_typeof_curl_off_t="$1"
2883 curl_sizeof_curl_off_t="$2"
2885 CURL_CHECK_DEF([$tmp_fmt], [$curl_includes_inttypes], [silent])
2886 AS_VAR_PUSHDEF([tmp_HaveFmtDef], [curl_cv_have_def_$tmp_fmt])dnl
2887 AS_VAR_PUSHDEF([tmp_FmtDef], [curl_cv_def_$tmp_fmt])dnl
2888 if test AS_VAR_GET(tmp_HaveFmtDef) = "yes"; then
2889 curl_format_curl_off_t=AS_VAR_GET(tmp_FmtDef)
2890 curl_typeof_curl_off_t="$1"
2891 curl_sizeof_curl_off_t="$2"
2893 AS_VAR_POPDEF([tmp_FmtDef])dnl
2894 AS_VAR_POPDEF([tmp_HaveFmtDef])dnl
2901 dnl DO_CURL_OFF_T_SUFFIX_CHECK (TYPE)
2902 dnl -------------------------------------------------
2903 dnl Internal macro for CURL_CONFIGURE_CURL_OFF_T
2905 AC_DEFUN([DO_CURL_OFF_T_SUFFIX_CHECK], [
2906 AC_REQUIRE([CURL_INCLUDES_INTTYPES])dnl
2907 AC_MSG_CHECKING([constant suffix string for curl_off_t])
2909 curl_suffix_curl_off_t="unknown"
2910 curl_suffix_curl_off_tu="unknown"
2912 case XC_SH_TR_SH([$1]) in
2913 long_long | __longlong | __longlong_t)
2923 tst_suffixes="LL:i64::"
2926 tst_suffixes="L:i32::"
2929 tst_suffixes="L:i16::"
2932 AC_MSG_ERROR([unexpected data type $1])
2936 old_IFS=$IFS; IFS=':'
2937 for tmp_ssuf in $tst_suffixes ; do
2939 if test "x$curl_suffix_curl_off_t" = "xunknown"; then
2942 tmp_usuf="u$tmp_ssuf"
2945 tmp_usuf="U$tmp_ssuf"
2953 $curl_includes_inttypes
2964 curl_suffix_curl_off_t="$tmp_ssuf"
2965 curl_suffix_curl_off_tu="$tmp_usuf"
2971 if test "x$curl_suffix_curl_off_t" = "xunknown"; then
2972 AC_MSG_ERROR([cannot find constant suffix string for curl_off_t.])
2974 AC_MSG_RESULT([$curl_suffix_curl_off_t])
2975 AC_MSG_CHECKING([constant suffix string for unsigned curl_off_t])
2976 AC_MSG_RESULT([$curl_suffix_curl_off_tu])
2982 dnl CURL_CONFIGURE_CURL_OFF_T
2983 dnl -------------------------------------------------
2984 dnl Find out suitable curl_off_t data type definition and associated
2985 dnl items, and make the appropriate definitions used in template file
2986 dnl include/curl/curlbuild.h.in to properly configure the library.
2988 AC_DEFUN([CURL_CONFIGURE_CURL_OFF_T], [
2989 AC_REQUIRE([CURL_INCLUDES_INTTYPES])dnl
2991 AC_BEFORE([$0],[AC_SYS_LARGEFILE])dnl
2992 AC_BEFORE([$0],[CURL_CONFIGURE_REENTRANT])dnl
2993 AC_BEFORE([$0],[CURL_CHECK_AIX_ALL_SOURCE])dnl
2995 if test -z "$SED"; then
2996 AC_MSG_ERROR([SED not set. Cannot continue without SED being set.])
2999 AC_CHECK_SIZEOF(long)
3000 AC_CHECK_SIZEOF(void*)
3002 if test -z "$ac_cv_sizeof_long" ||
3003 test "$ac_cv_sizeof_long" -eq "0"; then
3004 AC_MSG_ERROR([cannot find out size of long.])
3006 if test -z "$ac_cv_sizeof_voidp" ||
3007 test "$ac_cv_sizeof_voidp" -eq "0"; then
3008 AC_MSG_ERROR([cannot find out size of void*.])
3015 if test "$ac_cv_sizeof_long" -eq "8" &&
3016 test "$ac_cv_sizeof_voidp" -ge "8"; then
3018 elif test "$ac_cv_sizeof_long" -eq "4" &&
3019 test "$ac_cv_sizeof_voidp" -ge "4"; then
3021 elif test "$ac_cv_sizeof_long" -eq "2" &&
3022 test "$ac_cv_sizeof_voidp" -ge "2"; then
3026 dnl DO_CURL_OFF_T_CHECK results are stored in next 3 vars
3028 curl_typeof_curl_off_t="unknown"
3029 curl_sizeof_curl_off_t="unknown"
3030 curl_format_curl_off_t="unknown"
3031 curl_format_curl_off_tu="unknown"
3033 if test "$curl_typeof_curl_off_t" = "unknown"; then
3034 AC_MSG_CHECKING([for 64-bit curl_off_t data type])
3042 DO_CURL_OFF_T_CHECK([$t8], [8])
3044 AC_MSG_RESULT([$curl_typeof_curl_off_t])
3046 if test "$curl_typeof_curl_off_t" = "unknown"; then
3047 AC_MSG_CHECKING([for 32-bit curl_off_t data type])
3053 DO_CURL_OFF_T_CHECK([$t4], [4])
3055 AC_MSG_RESULT([$curl_typeof_curl_off_t])
3057 if test "$curl_typeof_curl_off_t" = "unknown"; then
3058 AC_MSG_CHECKING([for 16-bit curl_off_t data type])
3064 DO_CURL_OFF_T_CHECK([$t2], [2])
3066 AC_MSG_RESULT([$curl_typeof_curl_off_t])
3068 if test "$curl_typeof_curl_off_t" = "unknown"; then
3069 AC_MSG_ERROR([cannot find data type for curl_off_t.])
3072 AC_MSG_CHECKING([size of curl_off_t])
3073 AC_MSG_RESULT([$curl_sizeof_curl_off_t])
3075 AC_MSG_CHECKING([formatting string directive for curl_off_t])
3076 if test "$curl_format_curl_off_t" != "unknown"; then
3077 x_pull_headers="yes"
3078 curl_format_curl_off_t=`echo "$curl_format_curl_off_t" | "$SED" 's/[["]]//g'`
3079 curl_format_curl_off_tu=`echo "$curl_format_curl_off_t" | "$SED" 's/i$/u/'`
3080 curl_format_curl_off_tu=`echo "$curl_format_curl_off_tu" | "$SED" 's/d$/u/'`
3081 curl_format_curl_off_tu=`echo "$curl_format_curl_off_tu" | "$SED" 's/D$/U/'`
3084 case XC_SH_TR_SH([$curl_typeof_curl_off_t]) in
3085 long_long | __longlong | __longlong_t)
3086 curl_format_curl_off_t="lld"
3087 curl_format_curl_off_tu="llu"
3090 curl_format_curl_off_t="ld"
3091 curl_format_curl_off_tu="lu"
3094 curl_format_curl_off_t="d"
3095 curl_format_curl_off_tu="u"
3098 curl_format_curl_off_t="I64d"
3099 curl_format_curl_off_tu="I64u"
3102 curl_format_curl_off_t="I32d"
3103 curl_format_curl_off_tu="I32u"
3106 curl_format_curl_off_t="I16d"
3107 curl_format_curl_off_tu="I16u"
3110 AC_MSG_ERROR([cannot find print format string for curl_off_t.])
3114 AC_MSG_RESULT(["$curl_format_curl_off_t"])
3116 AC_MSG_CHECKING([formatting string directive for unsigned curl_off_t])
3117 AC_MSG_RESULT(["$curl_format_curl_off_tu"])
3119 DO_CURL_OFF_T_SUFFIX_CHECK([$curl_typeof_curl_off_t])
3121 if test "$x_pull_headers" = "yes"; then
3122 if test "x$ac_cv_header_sys_types_h" = "xyes"; then
3123 CURL_DEFINE_UNQUOTED([CURL_PULL_SYS_TYPES_H])
3125 if test "x$ac_cv_header_stdint_h" = "xyes"; then
3126 CURL_DEFINE_UNQUOTED([CURL_PULL_STDINT_H])
3128 if test "x$ac_cv_header_inttypes_h" = "xyes"; then
3129 CURL_DEFINE_UNQUOTED([CURL_PULL_INTTYPES_H])
3133 CURL_DEFINE_UNQUOTED([CURL_TYPEOF_CURL_OFF_T], [$curl_typeof_curl_off_t])
3134 CURL_DEFINE_UNQUOTED([CURL_FORMAT_CURL_OFF_T], ["$curl_format_curl_off_t"])
3135 CURL_DEFINE_UNQUOTED([CURL_FORMAT_CURL_OFF_TU], ["$curl_format_curl_off_tu"])
3136 CURL_DEFINE_UNQUOTED([CURL_FORMAT_OFF_T], ["%$curl_format_curl_off_t"])
3137 CURL_DEFINE_UNQUOTED([CURL_SIZEOF_CURL_OFF_T], [$curl_sizeof_curl_off_t])
3138 CURL_DEFINE_UNQUOTED([CURL_SUFFIX_CURL_OFF_T], [$curl_suffix_curl_off_t])
3139 CURL_DEFINE_UNQUOTED([CURL_SUFFIX_CURL_OFF_TU], [$curl_suffix_curl_off_tu])
3144 dnl CURL_CHECK_WIN32_LARGEFILE
3145 dnl -------------------------------------------------
3146 dnl Check if curl's WIN32 large file will be used
3148 AC_DEFUN([CURL_CHECK_WIN32_LARGEFILE], [
3149 AC_REQUIRE([CURL_CHECK_HEADER_WINDOWS])dnl
3150 AC_MSG_CHECKING([whether build target supports WIN32 file API])
3151 curl_win32_file_api="no"
3152 if test "$ac_cv_header_windows_h" = "yes"; then
3153 if test x"$enable_largefile" != "xno"; then
3157 #if !defined(_WIN32_WCE) && \
3158 (defined(__MINGW32__) || \
3159 (defined(_MSC_VER) && (defined(_WIN32) || defined(_WIN64))))
3162 WIN32 large file API not supported.
3166 curl_win32_file_api="win32_large_files"
3169 if test "$curl_win32_file_api" = "no"; then
3173 #if defined(_WIN32_WCE) || defined(__MINGW32__) || defined(_MSC_VER)
3176 WIN32 small file API not supported.
3180 curl_win32_file_api="win32_small_files"
3184 case "$curl_win32_file_api" in
3186 AC_MSG_RESULT([yes (large file enabled)])
3187 AC_DEFINE_UNQUOTED(USE_WIN32_LARGE_FILES, 1,
3188 [Define to 1 if you are building a Windows target with large file support.])
3191 AC_MSG_RESULT([yes (large file disabled)])
3192 AC_DEFINE_UNQUOTED(USE_WIN32_SMALL_FILES, 1,
3193 [Define to 1 if you are building a Windows target without large file support.])
3201 dnl CURL_EXPORT_PCDIR ($pcdir)
3202 dnl ------------------------
3203 dnl if $pcdir is not empty, set PKG_CONFIG_LIBDIR to $pcdir and export
3205 dnl we need this macro since pkg-config distinguishes among empty and unset
3206 dnl variable while checking PKG_CONFIG_LIBDIR
3209 AC_DEFUN([CURL_EXPORT_PCDIR], [
3210 if test -n "$1"; then
3211 PKG_CONFIG_LIBDIR="$1"
3212 export PKG_CONFIG_LIBDIR
3216 dnl CURL_CHECK_PKGCONFIG ($module, [$pcdir])
3217 dnl ------------------------
3218 dnl search for the pkg-config tool (if not cross-compiling). Set the PKGCONFIG
3219 dnl variable to hold the path to it, or 'no' if not found/present.
3221 dnl If pkg-config is present, check that it has info about the $module or
3222 dnl return "no" anyway!
3224 dnl Optionally PKG_CONFIG_LIBDIR may be given as $pcdir.
3227 AC_DEFUN([CURL_CHECK_PKGCONFIG], [
3231 if test x$cross_compiling = xyes; then
3232 dnl see if there's a pkg-specific for this host setup
3233 AC_PATH_PROG( PKGCONFIG, ${host}-pkg-config, no,
3234 $PATH:/usr/bin:/usr/local/bin)
3237 if test x$PKGCONFIG = xno; then
3238 AC_PATH_PROG( PKGCONFIG, pkg-config, no, $PATH:/usr/bin:/usr/local/bin)
3241 if test x$PKGCONFIG != xno; then
3242 AC_MSG_CHECKING([for $1 options with pkg-config])
3243 dnl ask pkg-config about $1
3244 itexists=`CURL_EXPORT_PCDIR([$2]) dnl
3245 $PKGCONFIG --exists $1 >/dev/null 2>&1 && echo 1`
3247 if test -z "$itexists"; then
3248 dnl pkg-config does not have info about the given module! set the
3249 dnl variable to 'no'
3253 AC_MSG_RESULT([found])
3259 dnl CURL_GENERATE_CONFIGUREHELP_PM
3260 dnl -------------------------------------------------
3261 dnl Generate test harness configurehelp.pm module, defining and
3262 dnl initializing some perl variables with values which are known
3263 dnl when the configure script runs. For portability reasons, test
3264 dnl harness needs information on how to run the C preprocessor.
3266 AC_DEFUN([CURL_GENERATE_CONFIGUREHELP_PM], [
3267 AC_REQUIRE([AC_PROG_CPP])dnl
3268 tmp_cpp=`eval echo "$ac_cpp" 2>/dev/null`
3269 if test -z "$tmp_cpp"; then
3272 cat >./tests/configurehelp.pm <<_EOF
3273 [@%:@] This is a generated file. Do not edit.
3275 package configurehelp;
3287 @ISA = qw(Exporter);
3293 \$Cpreprocessor = '$tmp_cpp';