3 dnl Version not hardcoded here. Fetched later from ares_version.h
5 [c-ares mailing list => http://cool.haxx.se/mailman/listinfo/c-ares])
7 AC_CONFIG_SRCDIR([ares_ipv6.h])
8 AM_CONFIG_HEADER([config.h])
11 dnl SED is mandatory for configure process and libtool.
12 dnl Set it now, allowing it to be changed later.
13 AC_PATH_PROG([SED], [sed], [not_found],
14 [$PATH:/usr/bin:/usr/local/bin])
15 if test -z "$SED" || test "$SED" = "not_found"; then
16 AC_MSG_ERROR([sed not found in PATH. Cannot continue without sed.])
20 dnl GREP is mandatory for configure process and libtool.
21 dnl Set it now, allowing it to be changed later.
22 AC_PATH_PROG([GREP], [grep], [not_found],
23 [$PATH:/usr/bin:/usr/local/bin])
24 if test -z "$GREP" || test "$GREP" = "not_found"; then
25 AC_MSG_ERROR([grep not found in PATH. Cannot continue without grep.])
29 dnl EGREP is mandatory for configure process and libtool.
30 dnl Set it now, allowing it to be changed later.
31 if echo a | ($GREP -E '(a|b)') >/dev/null 2>&1; then
32 AC_MSG_CHECKING([for egrep])
34 AC_MSG_RESULT([$EGREP])
36 AC_PATH_PROG([EGREP], [egrep], [not_found],
37 [$PATH:/usr/bin:/usr/local/bin])
39 if test -z "$EGREP" || test "$EGREP" = "not_found"; then
40 AC_MSG_ERROR([egrep not found in PATH. Cannot continue without egrep.])
44 dnl AR is mandatory for configure process and libtool.
45 dnl This is target dependant, so check it as a tool.
46 AC_PATH_TOOL([AR], [ar], [not_found],
47 [$PATH:/usr/bin:/usr/local/bin])
48 if test -z "$AR" || test "$AR" = "not_found"; then
49 AC_MSG_ERROR([ar not found in PATH. Cannot continue without ar.])
53 dnl Fetch c-ares version from ares_version.h
54 VERSION=`$SED -ne 's/^#define ARES_VERSION_STR "\(.*\)"/\1/p' ${srcdir}/ares_version.h`
55 AM_INIT_AUTOMAKE([c-ares], [$VERSION])
56 AC_MSG_CHECKING([c-ares version])
57 AC_MSG_RESULT([$VERSION])
60 dnl Detect the canonical host and target build environment
64 dnl Get system canonical name
65 AC_DEFINE_UNQUOTED(OS, "${host}", [cpu-machine-OS])
72 dnl Our configure and build reentrant settings
73 CARES_CONFIGURE_REENTRANT
75 dnl check for how to do large files
80 AC_DEFINE(ETC_INET, 1, [if a /etc/inet dir is being used])
84 dnl support building of Windows DLLs
87 dnl ************************************************************
88 dnl Option to switch on debug options. This makes an assumption that
89 dnl this is built as an 'ares' subdir in the curl source tree. Subject for
90 dnl improval in the future!
92 AC_MSG_CHECKING([whether to enable debug options])
94 AC_HELP_STRING([--enable-debug],[Enable pedantic debug options])
95 AC_HELP_STRING([--disable-debug],[Disable debug options]),
96 [ case "$enableval" in
100 *) AC_MSG_RESULT(yes)
102 dnl when doing the debug stuff, use static library only
107 dnl the entire --enable-debug is a hack that lives and runs on top of
108 dnl libcurl stuff so this BUILDING_LIBCURL is not THAT much uglier
109 AC_DEFINE(BUILDING_LIBCURL, 1, [when building as static part of libcurl])
111 CPPFLAGS="$CPPFLAGS -DCURLDEBUG -I$srcdir/../include"
114 dnl set compiler "debug" options to become more picky, and remove
115 dnl optimize options from CFLAGS
122 AM_CONDITIONAL(DEBUGBUILD, test x$debugbuild = xyes)
124 dnl skip libtool C++ and Fortran compiler checks
125 m4_ifdef([AC_PROG_CXX], [m4_undefine([AC_PROG_CXX])])
126 m4_defun([AC_PROG_CXX],[])
127 m4_ifdef([AC_PROG_CXXCPP], [m4_undefine([AC_PROG_CXXCPP])])
128 m4_defun([AC_PROG_CXXCPP],[true])
129 m4_ifdef([AC_PROG_F77], [m4_undefine([AC_PROG_F77])])
130 m4_defun([AC_PROG_F77],[])
132 dnl skip libtool C++ and Fortran linker checks
133 m4_ifdef([AC_LIBTOOL_CXX], [m4_undefine([AC_LIBTOOL_CXX])])
134 m4_defun([AC_LIBTOOL_CXX],[])
135 m4_ifdef([AC_LIBTOOL_CXXCPP], [m4_undefine([AC_LIBTOOL_CXXCPP])])
136 m4_defun([AC_LIBTOOL_CXXCPP],[true])
137 m4_ifdef([AC_LIBTOOL_F77], [m4_undefine([AC_LIBTOOL_F77])])
138 m4_defun([AC_LIBTOOL_F77],[])
140 dnl force libtool to build static libraries with PIC on AMD64-linux
141 AC_MSG_CHECKING([if arch-OS host is AMD64-linux (to build static libraries with PIC)])
155 AC_MSG_CHECKING([if we need -no-undefined])
157 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*)
158 need_no_undefined=yes
164 AC_MSG_RESULT($need_no_undefined)
165 AM_CONDITIONAL(NO_UNDEFINED, test x$need_no_undefined = xyes)
167 dnl **********************************************************************
168 dnl check if this is the Intel ICC compiler, and if so make it stricter
169 dnl (convert warning 147 into an error) so that it properly can detect the
170 dnl gethostbyname_r() version
171 dnl **********************************************************************
172 CURL_DETECT_ICC([CFLAGS="$CFLAGS -we 147"])
174 dnl **********************************************************************
175 dnl platform/compiler/architecture specific checks/flags
176 dnl **********************************************************************
182 dnl find out if icc is being used
183 if test "z$ICC" = "z"; then
187 if test "$ICC" = "yes"; then
188 dnl figure out icc version
189 AC_MSG_CHECKING([icc version])
190 iccver=`$CC -dumpversion`
191 iccnhi=`echo $iccver | cut -d . -f1`
192 iccnlo=`echo $iccver | cut -d . -f2`
193 iccnum=`(expr $iccnhi "*" 100 + $iccnlo) 2>/dev/null`
194 AC_MSG_RESULT($iccver)
196 if test "$iccnum" -ge "900" && test "$iccnum" -lt "1000"; then
198 CFLAGS="$CFLAGS -i-dynamic"
201 if test "$iccnum" -ge "1000"; then
202 dnl icc 10.X or later
203 CFLAGS="$CFLAGS -shared-intel"
211 AC_MSG_CHECKING([whether we are using the IBM C compiler])
212 CURL_CHECK_DEF([__IBMC__], [], [silent])
213 CURL_CHECK_DEF([__IBMCPP__], [], [silent])
214 if test "$curl_cv_have_def___IBMC__" = "yes" ||
215 test "$curl_cv_have_def___IBMCPP__" = "yes"; then
217 dnl Ensure that compiler optimizations are always thread-safe.
218 CFLAGS="$CFLAGS -qthreaded"
219 dnl Disable type based strict aliasing optimizations, using worst
220 dnl case aliasing assumptions when compiling. Type based aliasing
221 dnl would restrict the lvalues that could be safely used to access
223 CFLAGS="$CFLAGS -qnoansialias"
224 dnl Force compiler to stop after the compilation phase, without
225 dnl generating an object code file when compilation has errors.
226 CFLAGS="$CFLAGS -qhalt=e"
231 AC_MSG_CHECKING([whether we are using the DEC/Compaq C compiler])
232 CURL_CHECK_DEF([__DECC], [], [silent])
233 CURL_CHECK_DEF([__DECC_VER], [], [silent])
234 if test "$curl_cv_have_def___DECC" = "yes" ||
235 test "$curl_cv_have_def___DECC_VER" = "yes"; then
237 dnl Select strict ANSI C compiler mode
238 CFLAGS="$CFLAGS -std1"
239 dnl Turn off optimizer ANSI C aliasing rules
240 CFLAGS="$CFLAGS -noansi_alias"
241 dnl Select a higher warning level than default level2
242 CFLAGS="$CFLAGS -msg_enable level3"
243 dnl Generate warnings for missing function prototypes
244 CFLAGS="$CFLAGS -warnprotos"
245 dnl Change some warnings into fatal errors
246 CFLAGS="$CFLAGS -msg_fatal toofewargs,toomanyargs"
251 CURL_CHECK_COMPILER_HALT_ON_ERROR
252 CURL_CHECK_COMPILER_ARRAY_SIZE_NEGATIVE
254 dnl **********************************************************************
255 dnl Compilation based checks should not be done before this point.
256 dnl **********************************************************************
258 dnl **********************************************************************
259 dnl Make sure that our checks for headers windows.h winsock.h winsock2.h
260 dnl and ws2tcpip.h take precedence over any other further checks which
261 dnl could be done later using AC_CHECK_HEADER or AC_CHECK_HEADERS for
262 dnl this specific header files. And do them before its results are used.
263 dnl **********************************************************************
265 CURL_CHECK_HEADER_WINDOWS
266 CURL_CHECK_NATIVE_WINDOWS
267 case X-"$ac_cv_native_windows" in
269 CURL_CHECK_HEADER_WINSOCK
270 CURL_CHECK_HEADER_WINSOCK2
271 CURL_CHECK_HEADER_WS2TCPIP
274 ac_cv_header_winsock_h="no"
275 ac_cv_header_winsock2_h="no"
276 ac_cv_header_ws2tcpip_h="no"
280 dnl **********************************************************************
281 dnl Checks for libraries.
282 dnl **********************************************************************
284 dnl gethostbyname without lib or in the nsl lib?
285 AC_CHECK_FUNC(gethostbyname,
286 [HAVE_GETHOSTBYNAME="1"
288 [ AC_CHECK_LIB(nsl, gethostbyname,
289 [HAVE_GETHOSTBYNAME="1"
294 if test "$HAVE_GETHOSTBYNAME" != "1"
296 dnl gethostbyname in the socket lib?
297 AC_CHECK_LIB(socket, gethostbyname,
298 [HAVE_GETHOSTBYNAME="1"
299 LIBS="$LIBS -lsocket"
303 dnl At least one system has been identified to require BOTH nsl and socket
304 dnl libs at the same time to link properly.
305 if test "$HAVE_GETHOSTBYNAME" != "1"
307 AC_MSG_CHECKING([for gethostbyname with both nsl and socket libs])
308 my_ac_save_LIBS=$LIBS
309 LIBS="-lnsl -lsocket $LIBS"
317 HAVE_GETHOSTBYNAME="1"
320 LIBS=$my_ac_save_LIBS
324 if test "$HAVE_GETHOSTBYNAME" != "1"
326 dnl This is for winsock systems
327 if test "$ac_cv_header_windows_h" = "yes"; then
328 if test "$ac_cv_header_winsock_h" = "yes"; then
331 winsock_LIB="-lwinsock"
334 winsock_LIB="-lwsock32"
338 if test "$ac_cv_header_winsock2_h" = "yes"; then
339 winsock_LIB="-lws2_32"
341 if test ! -z "$winsock_LIB"; then
342 my_ac_save_LIBS=$LIBS
343 LIBS="$winsock_LIB $LIBS"
344 AC_MSG_CHECKING([for gethostbyname in $winsock_LIB])
347 #ifdef HAVE_WINDOWS_H
348 #ifndef WIN32_LEAN_AND_MEAN
349 #define WIN32_LEAN_AND_MEAN
352 #ifdef HAVE_WINSOCK2_H
353 #include <winsock2.h>
355 #ifdef HAVE_WINSOCK_H
361 gethostbyname("www.dummysite.com");
365 HAVE_GETHOSTBYNAME="1"
369 LIBS=$my_ac_save_LIBS
375 if test "$HAVE_GETHOSTBYNAME" != "1"
377 dnl This is for Minix 3.1
378 AC_MSG_CHECKING([for gethostbyname for Minix 3])
381 /* Older Minix versions may need <net/gen/netdb.h> here instead */
384 gethostbyname("www.dummysite.com");
388 HAVE_GETHOSTBYNAME="1"
394 if test "$HAVE_GETHOSTBYNAME" != "1"
396 dnl This is for eCos with a stubbed DNS implementation
397 AC_MSG_CHECKING([for gethostbyname for eCos])
403 gethostbyname("www.dummysite.com");
407 HAVE_GETHOSTBYNAME="1"
413 if test "$HAVE_GETHOSTBYNAME" != "1"
415 dnl gethostbyname in the net lib - for BeOS
416 AC_CHECK_LIB(net, gethostbyname,
417 [HAVE_GETHOSTBYNAME="1"
423 if test "$HAVE_GETHOSTBYNAME" = "1"; then
424 AC_DEFINE(HAVE_GETHOSTBYNAME, 1, [If you have gethostbyname])
426 AC_MSG_ERROR([couldn't find libraries for gethostbyname()])
430 AC_CHECK_FUNC(strcasecmp, , [ AC_CHECK_LIB(resolve, strcasecmp) ])
432 if test "$ac_cv_lib_resolve_strcasecmp" = "$ac_cv_func_strcasecmp"; then
433 AC_CHECK_LIB(resolve, strcasecmp,
434 [LIBS="-lresolve $LIBS"],
440 AC_CHECK_FUNC(connect, , [ AC_CHECK_LIB(socket, connect) ])
442 dnl **********************************************************************
443 dnl In case that function clock_gettime with monotonic timer is available,
444 dnl check for additional required libraries.
445 dnl **********************************************************************
446 CURL_CHECK_LIBS_CLOCK_GETTIME_MONOTONIC
448 AC_MSG_CHECKING([whether to use libgcc])
449 AC_ARG_ENABLE(libgcc,
450 AC_HELP_STRING([--enable-libgcc],[use libgcc when linking]),
451 [ case "$enableval" in
463 dnl Default is to try the thread-safe versions of a few functions
466 dnl detect AIX 4.3 or later
467 AC_MSG_CHECKING([AIX 4.3 or later])
469 #if defined(_AIX) && defined(_AIX43)
472 #error "this is not AIX 4.3 or later"
475 [ AC_MSG_RESULT([yes])
478 [ AC_MSG_RESULT([no]) ]
481 AC_ARG_ENABLE(thread,dnl
482 AC_HELP_STRING([--disable-thread],[don't look for thread-safe functions])
483 AC_HELP_STRING([--enable-thread],[look for thread-safe functions]),
484 [ case "$enableval" in
487 AC_MSG_WARN(c-ares will not get built using thread-safe functions)
495 if test X"$OPT_THREAD" = Xoff
497 AC_DEFINE(DISABLED_THREADSAFE, 1,
498 [Set to explicitly specify we don't want to use thread-safe functions])
501 dnl for recent AIX versions, we skip all the thread-safe checks above since
502 dnl they claim a thread-safe libc using the standard API. But there are
503 dnl some functions still not thread-safe. Check for these!
505 dnl Let's hope this split URL remains working:
506 dnl http://publibn.boulder.ibm.com/doc_link/en_US/a_doc_lib/aixprggd/ \
507 dnl genprogc/thread_quick_ref.htm
509 if test "x$RECENTAIX" = "xyes"; then
511 AC_DEFINE(_THREAD_SAFE, 1, [define this if you need it to compile thread-safe code])
516 dnl **********************************************************************
517 dnl Back to "normal" configuring
518 dnl **********************************************************************
520 dnl Checks for header files.
523 CURL_CHECK_HEADER_MALLOC
525 dnl check for a few basic system headers we need
542 arpa/nameser_compat.h \
544 dnl to do if not found
550 #ifdef HAVE_SYS_TYPES_H
551 #include <sys/types.h>
553 #ifdef HAVE_SYS_TIME_H
554 #include <sys/time.h>
556 dnl We do this default-include simply to make sure that the nameser_compat.h
557 dnl header *REALLY* can be include after the new nameser.h. It seems AIX 5.1
558 dnl (and others?) is not designed to allow this.
559 #ifdef HAVE_ARPA_NAMESER_H
560 #include <arpa/nameser.h>
563 dnl *Sigh* these are needed in order for net/if.h to get properly detected.
564 #ifdef HAVE_SYS_SOCKET_H
565 #include <sys/socket.h>
567 #ifdef HAVE_NETINET_IN_H
568 #include <netinet/in.h>
573 dnl Checks for typedefs, structures, and compiler characteristics.
577 CURL_CHECK_STRUCT_TIMEVAL
579 AC_CHECK_SIZEOF(size_t)
580 AC_CHECK_SIZEOF(long)
581 AC_CHECK_SIZEOF(time_t)
583 AC_CHECK_TYPE(long long,
584 [AC_DEFINE(HAVE_LONGLONG, 1, [if your compiler supports long long])]
588 if test "xyes" = "x$longlong"; then
589 AC_MSG_CHECKING([if numberLL works])
590 AC_COMPILE_IFELSE([long long val = 1000LL;],
591 [AC_DEFINE(HAVE_LL, 1, [if your compiler supports LL])]
599 AC_CHECK_TYPE(ssize_t, ,
600 AC_DEFINE(ssize_t, int, [the signed version of size_t]))
602 # check for bool type
603 AC_CHECK_TYPE([bool],[
604 AC_DEFINE(HAVE_BOOL_T, 1,
605 [Define to 1 if bool is an available type.])
607 #ifdef HAVE_SYS_TYPES_H
608 #include <sys/types.h>
610 #ifdef HAVE_STDBOOL_H
615 # Check for socklen_t or equivalent
616 CURL_CHECK_TYPE_SOCKLEN_T
620 TYPE_SOCKADDR_STORAGE
627 CURL_CHECK_FUNC_RECVFROM
629 CURL_CHECK_MSG_NOSIGNAL
631 dnl check for AF_INET6
632 CARES_CHECK_CONSTANT(
635 #ifdef HAVE_WINDOWS_H
636 #ifndef WIN32_LEAN_AND_MEAN
637 #define WIN32_LEAN_AND_MEAN
640 #ifdef HAVE_WINSOCK2_H
641 #include <winsock2.h>
644 #ifdef HAVE_SYS_TYPES_H
645 #include <sys/types.h>
647 #ifdef HAVE_SYS_SOCKET_H
648 #include <sys/socket.h>
652 AC_DEFINE_UNQUOTED(HAVE_PF_INET6,1,[Define to 1 if you have PF_INET6.])
655 dnl check for PF_INET6
656 CARES_CHECK_CONSTANT(
659 #ifdef HAVE_WINDOWS_H
660 #ifndef WIN32_LEAN_AND_MEAN
661 #define WIN32_LEAN_AND_MEAN
664 #ifdef HAVE_WINSOCK2_H
665 #include <winsock2.h>
668 #ifdef HAVE_SYS_TYPES_H
669 #include <sys/types.h>
671 #ifdef HAVE_SYS_SOCKET_H
672 #include <sys/socket.h>
676 AC_DEFINE_UNQUOTED(HAVE_AF_INET6,1,[Define to 1 if you have AF_INET6.])
680 dnl check for the in6_addr structure
684 #ifdef HAVE_WINDOWS_H
685 #ifndef WIN32_LEAN_AND_MEAN
686 #define WIN32_LEAN_AND_MEAN
689 #ifdef HAVE_WINSOCK2_H
690 #include <winsock2.h>
691 #ifdef HAVE_WS2TCPIP_H
692 #include <ws2tcpip.h>
696 #ifdef HAVE_SYS_TYPES_H
697 #include <sys/types.h>
699 #ifdef HAVE_NETINET_IN_H
700 #include <netinet/in.h>
704 AC_DEFINE_UNQUOTED(HAVE_STRUCT_IN6_ADDR,1,[Define to 1 if you have struct in6_addr.])
707 dnl check for the sockaddr_in6 structure
711 #ifdef HAVE_WINDOWS_H
712 #ifndef WIN32_LEAN_AND_MEAN
713 #define WIN32_LEAN_AND_MEAN
716 #ifdef HAVE_WINSOCK2_H
717 #include <winsock2.h>
718 #ifdef HAVE_WS2TCPIP_H
719 #include <ws2tcpip.h>
723 #ifdef HAVE_SYS_TYPES_H
724 #include <sys/types.h>
726 #ifdef HAVE_NETINET_IN_H
727 #include <netinet/in.h>
731 AC_DEFINE_UNQUOTED(HAVE_STRUCT_SOCKADDR_IN6,1,
732 [Define to 1 if you have struct sockaddr_in6.]) ac_have_sockaddr_in6=yes
735 AC_CHECK_MEMBER(struct sockaddr_in6.sin6_scope_id,
736 AC_DEFINE_UNQUOTED(HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID,1,
737 [Define to 1 if your struct sockaddr_in6 has sin6_scope_id.])
741 #ifdef HAVE_WINDOWS_H
742 #ifndef WIN32_LEAN_AND_MEAN
743 #define WIN32_LEAN_AND_MEAN
746 #ifdef HAVE_WINSOCK2_H
747 #include <winsock2.h>
748 #ifdef HAVE_WS2TCPIP_H
749 #include <ws2tcpip.h>
753 #ifdef HAVE_SYS_TYPES_H
754 #include <sys/types.h>
756 #ifdef HAVE_NETINET_IN_H
757 #include <netinet/in.h>
762 dnl check for the addrinfo structure
763 AC_CHECK_MEMBER(struct addrinfo.ai_flags,
764 AC_DEFINE_UNQUOTED(HAVE_STRUCT_ADDRINFO,1,
765 [Define to 1 if you have struct addrinfo.]),,
768 #ifdef HAVE_WINDOWS_H
769 #ifndef WIN32_LEAN_AND_MEAN
770 #define WIN32_LEAN_AND_MEAN
773 #ifdef HAVE_WINSOCK2_H
774 #include <winsock2.h>
775 #ifdef HAVE_WS2TCPIP_H
776 #include <ws2tcpip.h>
780 #ifdef HAVE_SYS_TYPES_H
781 #include <sys/types.h>
783 #ifdef HAVE_NETINET_IN_H
784 #include <netinet/in.h>
786 #ifdef HAVE_SYS_SOCKET_H
787 #include <sys/socket.h>
797 AC_CHECK_FUNCS([bitncmp \
803 AC_MSG_CHECKING([deeper for $func])
811 eval "ac_cv_func_$func=yes"
812 AC_DEFINE_UNQUOTED([AS_TR_CPP([HAVE_$func])], [1],
813 [Define to 1 if you have the $func function.])
815 AC_MSG_RESULT([but still no])
820 dnl check for inet_pton
821 AC_CHECK_FUNCS(inet_pton)
822 dnl Some systems have it, but not IPv6
823 if test "$ac_cv_func_inet_pton" = "yes" ; then
824 AC_MSG_CHECKING(if inet_pton supports IPv6)
827 #ifdef HAVE_SYS_TYPES_H
828 #include <sys/types.h>
830 #ifdef HAVE_SYS_SOCKET_H
831 #include <sys/socket.h>
833 #ifdef HAVE_NETINET_IN_H
834 #include <netinet/in.h>
838 struct in6_addr addr6;
839 if (inet_pton(AF_INET6, "::1", &addr6) < 1)
846 AC_DEFINE_UNQUOTED(HAVE_INET_PTON_IPV6,1,[Define to 1 if inet_pton supports IPv6.])
847 ], AC_MSG_RESULT(no),AC_MSG_RESULT(no))
849 dnl Check for inet_net_pton
850 AC_CHECK_FUNCS(inet_net_pton)
851 dnl Again, some systems have it, but not IPv6
852 if test "$ac_cv_func_inet_net_pton" = "yes" ; then
853 AC_MSG_CHECKING(if inet_net_pton supports IPv6)
856 #ifdef HAVE_SYS_TYPES_H
857 #include <sys/types.h>
859 #ifdef HAVE_SYS_SOCKET_H
860 #include <sys/socket.h>
862 #ifdef HAVE_NETINET_IN_H
863 #include <netinet/in.h>
867 struct in6_addr addr6;
868 if (inet_net_pton(AF_INET6, "::1", &addr6, sizeof(addr6)) < 1)
875 AC_DEFINE_UNQUOTED(HAVE_INET_NET_PTON_IPV6,1,[Define to 1 if inet_net_pton supports IPv6.])
876 ], AC_MSG_RESULT(no),AC_MSG_RESULT(no))
880 dnl Check for inet_ntop
881 AC_CHECK_FUNCS(inet_ntop)
882 dnl Again, some systems have it, but not IPv6
883 if test "$ac_cv_func_inet_ntop" = "yes" ; then
884 AC_MSG_CHECKING(if inet_ntop supports IPv6)
887 #ifdef HAVE_SYS_TYPES_H
888 #include <sys/types.h>
890 #ifdef HAVE_SYS_SOCKET_H
891 #include <sys/socket.h>
893 #ifdef HAVE_NETINET_IN_H
894 #include <netinet/in.h>
899 struct in6_addr addr6;
901 if (inet_ntop(AF_INET6, &addr6, buf, 128) == 0 && errno == EAFNOSUPPORT)
908 AC_DEFINE_UNQUOTED(HAVE_INET_NTOP_IPV6,1,
909 [Define to 1 if inet_ntop supports IPv6.])
910 ], AC_MSG_RESULT(no),AC_MSG_RESULT(no))
913 AC_CHECK_SIZEOF(struct in6_addr, ,
916 #ifdef HAVE_WINDOWS_H
917 #ifndef WIN32_LEAN_AND_MEAN
918 #define WIN32_LEAN_AND_MEAN
921 #ifdef HAVE_WINSOCK2_H
922 #include <winsock2.h>
923 #ifdef HAVE_WS2TCPIP_H
924 #include <ws2tcpip.h>
928 #ifdef HAVE_SYS_TYPES_H
929 #include <sys/types.h>
931 #ifdef HAVE_SYS_SOCKET_H
932 #include <sys/socket.h>
934 #ifdef HAVE_NETINET_IN_H
935 #include <netinet/in.h>
941 AC_CHECK_SIZEOF(struct in_addr, ,
944 #ifdef HAVE_WINDOWS_H
945 #ifndef WIN32_LEAN_AND_MEAN
946 #define WIN32_LEAN_AND_MEAN
949 #ifdef HAVE_WINSOCK2_H
950 #include <winsock2.h>
951 #ifdef HAVE_WS2TCPIP_H
952 #include <ws2tcpip.h>
956 #ifdef HAVE_SYS_TYPES_H
957 #include <sys/types.h>
959 #ifdef HAVE_SYS_SOCKET_H
960 #include <sys/socket.h>
962 #ifdef HAVE_NETINET_IN_H
963 #include <netinet/in.h>
970 dnl Check if the getnameinfo function is available
971 dnl and get the types of five of its arguments.
972 CURL_CHECK_FUNC_GETNAMEINFO
975 dnl God bless non-standardized functions! We need to see which getservbyport_r
976 dnl variant is available
977 CARES_CHECK_GETSERVBYPORT_R
979 CURL_CHECK_NONBLOCKING_SOCKET
982 [AC_DEFINE(ARES_BIG_ENDIAN, 1,
983 [define this if ares is built for a big endian system])],
985 [AC_MSG_WARN([couldn't figure out endianess, assuming little endian!])]
988 dnl Check for user-specified random device
990 AC_HELP_STRING([--with-random=FILE],
991 [read randomness from FILE (default=/dev/urandom)]),
992 [ RANDOM_FILE="$withval" ],
994 dnl Check for random device. If we're cross compiling, we can't
995 dnl check, and it's better to assume it doesn't exist than it is
996 dnl to fail on AC_CHECK_FILE or later.
997 if test "$cross_compiling" = "no"; then
998 AC_CHECK_FILE("/dev/urandom", [ RANDOM_FILE="/dev/urandom"] )
1000 AC_MSG_WARN([cannot check for /dev/urandom while cross compiling; assuming none])
1005 if test -n "$RANDOM_FILE" && test X"$RANDOM_FILE" != Xno ; then
1006 AC_SUBST(RANDOM_FILE)
1007 AC_DEFINE_UNQUOTED(RANDOM_FILE, "$RANDOM_FILE",
1008 [a suitable file/device to read random data from])
1011 CARES_PRIVATE_LIBS="$LIBS"
1012 AC_SUBST(CARES_PRIVATE_LIBS)
1014 AC_CONFIG_FILES([Makefile libcares.pc])