3 dnl Explicitly include our m4 files first. Without these explicit inclusions
4 dnl aclocal will actually find and include them automatically, but before it
5 dnl does it might fully scan all other system installed m4 files. Doing this
6 dnl explicit inclusion also allows us to override definitions of macros done
7 dnl elsewhere in other packages with the ones done in our included files.
8 m4_include([m4/reentrant.m4])
9 m4_include([acinclude.m4])
11 dnl Version not hardcoded here. Fetched later from ares_version.h
12 AC_INIT([c-ares], [-],
13 [c-ares mailing list => http://cool.haxx.se/mailman/listinfo/c-ares])
15 AC_CONFIG_SRCDIR([ares_ipv6.h])
16 AM_CONFIG_HEADER([config.h])
19 dnl SED is mandatory for configure process and libtool.
20 dnl Set it now and prevent it from being changed later.
21 AC_PATH_PROG([SED], [sed], [not_found],
22 [$PATH:/usr/bin:/usr/local/bin])
23 if test -z "$SED" || test "$SED" = "not_found"; then
24 AC_MSG_ERROR([sed not found in PATH. Cannot continue without sed.])
30 dnl GREP is mandatory for configure process and libtool.
31 dnl Set it now and prevent it from being changed later.
32 AC_PATH_PROG([GREP], [grep], [not_found],
33 [$PATH:/usr/bin:/usr/local/bin])
34 if test -z "$GREP" || test "$GREP" = "not_found"; then
35 AC_MSG_ERROR([grep not found in PATH. Cannot continue without grep.])
37 ac_cv_prog_grep="$GREP"
38 ac_cv_prog_GREP="$GREP"
41 dnl EGREP is mandatory for configure process and libtool.
42 dnl Set it now and prevent it from being changed later.
43 if echo a | ($GREP -E '(a|b)') >/dev/null 2>&1; then
44 AC_MSG_CHECKING([for egrep])
46 AC_MSG_RESULT([$EGREP])
48 AC_PATH_PROG([EGREP], [egrep], [not_found],
49 [$PATH:/usr/bin:/usr/local/bin])
51 if test -z "$EGREP" || test "$EGREP" = "not_found"; then
52 AC_MSG_ERROR([egrep not found in PATH. Cannot continue without egrep.])
54 ac_cv_prog_egrep="$EGREP"
55 ac_cv_prog_EGREP="$EGREP"
58 dnl AR is mandatory for configure process and libtool.
59 dnl This is target dependant, so check it as a tool.
60 AC_PATH_TOOL([AR], [ar], [not_found],
61 [$PATH:/usr/bin:/usr/local/bin])
62 if test -z "$AR" || test "$AR" = "not_found"; then
63 AC_MSG_ERROR([ar not found in PATH. Cannot continue without ar.])
67 dnl Fetch c-ares version from ares_version.h
68 VERSION=`$SED -ne 's/^#define ARES_VERSION_STR "\(.*\)"/\1/p' ${srcdir}/ares_version.h`
69 AM_INIT_AUTOMAKE([c-ares], [$VERSION])
70 AC_MSG_CHECKING([c-ares version])
71 AC_MSG_RESULT([$VERSION])
74 dnl Detect the canonical host and target build environment
78 dnl Get system canonical name
79 AC_DEFINE_UNQUOTED(OS, "${host}", [cpu-machine-OS])
86 dnl Our configure and build reentrant settings
89 dnl check for how to do large files
94 AC_DEFINE(ETC_INET, 1, [if a /etc/inet dir is being used])
98 dnl support building of Windows DLLs
101 dnl ************************************************************
102 dnl Option to switch on debug options. This makes an assumption that
103 dnl this is built as an 'ares' subdir in the curl source tree. Subject for
104 dnl improval in the future!
106 AC_MSG_CHECKING([whether to enable debug options])
108 AC_HELP_STRING([--enable-debug],[Enable pedantic debug options])
109 AC_HELP_STRING([--disable-debug],[Disable debug options]),
110 [ case "$enableval" in
114 *) AC_MSG_RESULT(yes)
116 dnl when doing the debug stuff, use static library only
121 dnl the entire --enable-debug is a hack that lives and runs on top of
122 dnl libcurl stuff so this BUILDING_LIBCURL is not THAT much uglier
123 AC_DEFINE(BUILDING_LIBCURL, 1, [when building as static part of libcurl])
125 CPPFLAGS="$CPPFLAGS -DCURLDEBUG -I$srcdir/../include"
128 dnl set compiler "debug" options to become more picky, and remove
129 dnl optimize options from CFLAGS
136 AM_CONDITIONAL(DEBUGBUILD, test x$debugbuild = xyes)
138 dnl skip libtool C++ and Fortran compiler checks
139 m4_ifdef([AC_PROG_CXX], [m4_undefine([AC_PROG_CXX])])
140 m4_defun([AC_PROG_CXX],[])
141 m4_ifdef([AC_PROG_CXXCPP], [m4_undefine([AC_PROG_CXXCPP])])
142 m4_defun([AC_PROG_CXXCPP],[true])
143 m4_ifdef([AC_PROG_F77], [m4_undefine([AC_PROG_F77])])
144 m4_defun([AC_PROG_F77],[])
146 dnl skip libtool C++ and Fortran linker checks
147 m4_ifdef([AC_LIBTOOL_CXX], [m4_undefine([AC_LIBTOOL_CXX])])
148 m4_defun([AC_LIBTOOL_CXX],[])
149 m4_ifdef([AC_LIBTOOL_CXXCPP], [m4_undefine([AC_LIBTOOL_CXXCPP])])
150 m4_defun([AC_LIBTOOL_CXXCPP],[true])
151 m4_ifdef([AC_LIBTOOL_F77], [m4_undefine([AC_LIBTOOL_F77])])
152 m4_defun([AC_LIBTOOL_F77],[])
154 dnl force libtool to build static libraries with PIC on AMD64-linux
155 AC_MSG_CHECKING([if arch-OS host is AMD64-linux (to build static libraries with PIC)])
169 AC_MSG_CHECKING([if we need -no-undefined])
171 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*)
172 need_no_undefined=yes
178 AC_MSG_RESULT($need_no_undefined)
179 AM_CONDITIONAL(NO_UNDEFINED, test x$need_no_undefined = xyes)
181 dnl **********************************************************************
182 dnl check if this is the Intel ICC compiler, and if so make it stricter
183 dnl (convert warning 147 into an error) so that it properly can detect the
184 dnl gethostbyname_r() version
185 dnl **********************************************************************
186 CURL_DETECT_ICC([CFLAGS="$CFLAGS -we 147"])
188 dnl **********************************************************************
189 dnl platform/compiler/architecture specific checks/flags
190 dnl **********************************************************************
196 dnl find out if icc is being used
197 if test "z$ICC" = "z"; then
201 if test "$ICC" = "yes"; then
202 dnl figure out icc version
203 AC_MSG_CHECKING([icc version])
204 iccver=`$CC -dumpversion`
205 iccnhi=`echo $iccver | cut -d . -f1`
206 iccnlo=`echo $iccver | cut -d . -f2`
207 iccnum=`(expr $iccnhi "*" 100 + $iccnlo) 2>/dev/null`
208 AC_MSG_RESULT($iccver)
210 if test "$iccnum" -ge "900" && test "$iccnum" -lt "1000"; then
212 CFLAGS="$CFLAGS -i-dynamic"
215 if test "$iccnum" -ge "1000"; then
216 dnl icc 10.X or later
217 CFLAGS="$CFLAGS -shared-intel"
225 AC_MSG_CHECKING([whether we are using the IBM C compiler])
226 CURL_CHECK_DEF([__IBMC__], [], [silent])
227 CURL_CHECK_DEF([__IBMCPP__], [], [silent])
228 if test "$curl_cv_have_def___IBMC__" = "yes" ||
229 test "$curl_cv_have_def___IBMCPP__" = "yes"; then
231 dnl Ensure that compiler optimizations are always thread-safe.
232 CFLAGS="$CFLAGS -qthreaded"
233 dnl Disable type based strict aliasing optimizations, using worst
234 dnl case aliasing assumptions when compiling. Type based aliasing
235 dnl would restrict the lvalues that could be safely used to access
237 CFLAGS="$CFLAGS -qnoansialias"
238 dnl Force compiler to stop after the compilation phase, without
239 dnl generating an object code file when compilation has errors.
240 CFLAGS="$CFLAGS -qhalt=e"
245 AC_MSG_CHECKING([whether we are using the DEC/Compaq C compiler])
246 CURL_CHECK_DEF([__DECC], [], [silent])
247 CURL_CHECK_DEF([__DECC_VER], [], [silent])
248 if test "$curl_cv_have_def___DECC" = "yes" ||
249 test "$curl_cv_have_def___DECC_VER" = "yes"; then
251 dnl Select strict ANSI C compiler mode
252 CFLAGS="$CFLAGS -std1"
253 dnl Select a higher warning level than default level2
254 CFLAGS="$CFLAGS -msg_enable level3"
255 dnl Generate warnings for missing function prototypes
256 CFLAGS="$CFLAGS -warnprotos"
257 dnl Change some warnings into fatal errors
258 CFLAGS="$CFLAGS -msg_fatal toofewargs,toomanyargs"
263 CURL_CHECK_COMPILER_HALT_ON_ERROR
264 CURL_CHECK_COMPILER_ARRAY_SIZE_NEGATIVE
266 dnl **********************************************************************
267 dnl Compilation based checks should not be done before this point.
268 dnl **********************************************************************
270 dnl **********************************************************************
271 dnl Make sure that our checks for headers windows.h winsock.h winsock2.h
272 dnl and ws2tcpip.h take precedence over any other further checks which
273 dnl could be done later using AC_CHECK_HEADER or AC_CHECK_HEADERS for
274 dnl this specific header files. And do them before its results are used.
275 dnl **********************************************************************
277 CURL_CHECK_HEADER_WINDOWS
278 CURL_CHECK_NATIVE_WINDOWS
279 case X-"$ac_cv_native_windows" in
281 CURL_CHECK_HEADER_WINSOCK
282 CURL_CHECK_HEADER_WINSOCK2
283 CURL_CHECK_HEADER_WS2TCPIP
286 ac_cv_header_winsock_h="no"
287 ac_cv_header_winsock2_h="no"
288 ac_cv_header_ws2tcpip_h="no"
292 dnl **********************************************************************
293 dnl Checks for libraries.
294 dnl **********************************************************************
296 dnl gethostbyname without lib or in the nsl lib?
297 AC_CHECK_FUNC(gethostbyname,
298 [HAVE_GETHOSTBYNAME="1"
300 [ AC_CHECK_LIB(nsl, gethostbyname,
301 [HAVE_GETHOSTBYNAME="1"
306 if test "$HAVE_GETHOSTBYNAME" != "1"
308 dnl gethostbyname in the socket lib?
309 AC_CHECK_LIB(socket, gethostbyname,
310 [HAVE_GETHOSTBYNAME="1"
311 LIBS="$LIBS -lsocket"
315 dnl At least one system has been identified to require BOTH nsl and socket
316 dnl libs at the same time to link properly.
317 if test "$HAVE_GETHOSTBYNAME" != "1"
319 AC_MSG_CHECKING([for gethostbyname with both nsl and socket libs])
320 my_ac_save_LIBS=$LIBS
321 LIBS="-lnsl -lsocket $LIBS"
329 HAVE_GETHOSTBYNAME="1"
332 LIBS=$my_ac_save_LIBS
336 if test "$HAVE_GETHOSTBYNAME" != "1"
338 dnl This is for winsock systems
339 if test "$ac_cv_header_windows_h" = "yes"; then
340 if test "$ac_cv_header_winsock_h" = "yes"; then
343 winsock_LIB="-lwinsock"
346 winsock_LIB="-lwsock32"
350 if test "$ac_cv_header_winsock2_h" = "yes"; then
351 winsock_LIB="-lws2_32"
353 if test ! -z "$winsock_LIB"; then
354 my_ac_save_LIBS=$LIBS
355 LIBS="$winsock_LIB $LIBS"
356 AC_MSG_CHECKING([for gethostbyname in $winsock_LIB])
359 #ifdef HAVE_WINDOWS_H
360 #ifndef WIN32_LEAN_AND_MEAN
361 #define WIN32_LEAN_AND_MEAN
364 #ifdef HAVE_WINSOCK2_H
365 #include <winsock2.h>
367 #ifdef HAVE_WINSOCK_H
373 gethostbyname("www.dummysite.com");
377 HAVE_GETHOSTBYNAME="1"
381 LIBS=$my_ac_save_LIBS
387 if test "$HAVE_GETHOSTBYNAME" != "1"
389 dnl This is for Minix 3.1
390 AC_MSG_CHECKING([for gethostbyname for Minix 3])
393 /* Older Minix versions may need <net/gen/netdb.h> here instead */
396 gethostbyname("www.dummysite.com");
400 HAVE_GETHOSTBYNAME="1"
406 if test "$HAVE_GETHOSTBYNAME" != "1"
408 dnl This is for eCos with a stubbed DNS implementation
409 AC_MSG_CHECKING([for gethostbyname for eCos])
415 gethostbyname("www.dummysite.com");
419 HAVE_GETHOSTBYNAME="1"
425 if test "$HAVE_GETHOSTBYNAME" != "1"
427 dnl gethostbyname in the net lib - for BeOS
428 AC_CHECK_LIB(net, gethostbyname,
429 [HAVE_GETHOSTBYNAME="1"
435 if test "$HAVE_GETHOSTBYNAME" = "1"; then
436 AC_DEFINE(HAVE_GETHOSTBYNAME, 1, [If you have gethostbyname])
438 AC_MSG_ERROR([couldn't find libraries for gethostbyname()])
442 AC_CHECK_FUNC(strcasecmp, , [ AC_CHECK_LIB(resolve, strcasecmp) ])
444 if test "$ac_cv_lib_resolve_strcasecmp" = "$ac_cv_func_strcasecmp"; then
445 AC_CHECK_LIB(resolve, strcasecmp,
446 [LIBS="-lresolve $LIBS"],
452 AC_CHECK_FUNC(connect, , [ AC_CHECK_LIB(socket, connect) ])
454 dnl **********************************************************************
455 dnl In case that function clock_gettime with monotonic timer is available,
456 dnl check for additional required libraries.
457 dnl **********************************************************************
458 CURL_CHECK_LIBS_CLOCK_GETTIME_MONOTONIC
460 AC_MSG_CHECKING([whether to use libgcc])
461 AC_ARG_ENABLE(libgcc,
462 AC_HELP_STRING([--enable-libgcc],[use libgcc when linking]),
463 [ case "$enableval" in
475 dnl Default is to try the thread-safe versions of a few functions
478 dnl detect AIX 4.3 or later
479 AC_MSG_CHECKING([AIX 4.3 or later])
481 #if defined(_AIX) && defined(_AIX43)
484 #error "this is not AIX 4.3 or later"
487 [ AC_MSG_RESULT([yes])
490 [ AC_MSG_RESULT([no]) ]
493 AC_ARG_ENABLE(thread,dnl
494 AC_HELP_STRING([--disable-thread],[don't look for thread-safe functions])
495 AC_HELP_STRING([--enable-thread],[look for thread-safe functions]),
496 [ case "$enableval" in
499 AC_MSG_WARN(c-ares will not get built using thread-safe functions)
507 if test X"$OPT_THREAD" = Xoff
509 AC_DEFINE(DISABLED_THREADSAFE, 1,
510 [Set to explicitly specify we don't want to use thread-safe functions])
513 dnl for recent AIX versions, we skip all the thread-safe checks above since
514 dnl they claim a thread-safe libc using the standard API. But there are
515 dnl some functions still not thread-safe. Check for these!
517 dnl Let's hope this split URL remains working:
518 dnl http://publibn.boulder.ibm.com/doc_link/en_US/a_doc_lib/aixprggd/ \
519 dnl genprogc/thread_quick_ref.htm
521 if test "x$RECENTAIX" = "xyes"; then
523 AC_DEFINE(_THREAD_SAFE, 1, [define this if you need it to compile thread-safe code])
528 dnl **********************************************************************
529 dnl Back to "normal" configuring
530 dnl **********************************************************************
532 dnl Checks for header files.
535 CURL_CHECK_HEADER_MALLOC
537 dnl check for a few basic system headers we need
554 arpa/nameser_compat.h \
556 dnl to do if not found
562 #ifdef HAVE_SYS_TYPES_H
563 #include <sys/types.h>
565 #ifdef HAVE_SYS_TIME_H
566 #include <sys/time.h>
568 dnl We do this default-include simply to make sure that the nameser_compat.h
569 dnl header *REALLY* can be include after the new nameser.h. It seems AIX 5.1
570 dnl (and others?) is not designed to allow this.
571 #ifdef HAVE_ARPA_NAMESER_H
572 #include <arpa/nameser.h>
575 dnl *Sigh* these are needed in order for net/if.h to get properly detected.
576 #ifdef HAVE_SYS_SOCKET_H
577 #include <sys/socket.h>
579 #ifdef HAVE_NETINET_IN_H
580 #include <netinet/in.h>
585 dnl Checks for typedefs, structures, and compiler characteristics.
589 CURL_CHECK_STRUCT_TIMEVAL
591 AC_CHECK_SIZEOF(size_t)
592 AC_CHECK_SIZEOF(long)
593 AC_CHECK_SIZEOF(time_t)
595 AC_CHECK_TYPE(long long,
596 [AC_DEFINE(HAVE_LONGLONG, 1, [if your compiler supports long long])]
600 if test "xyes" = "x$longlong"; then
601 AC_MSG_CHECKING([if numberLL works])
602 AC_COMPILE_IFELSE([long long val = 1000LL;],
603 [AC_DEFINE(HAVE_LL, 1, [if your compiler supports LL])]
611 AC_CHECK_TYPE(ssize_t, ,
612 AC_DEFINE(ssize_t, int, [the signed version of size_t]))
614 # check for bool type
615 AC_CHECK_TYPE([bool],[
616 AC_DEFINE(HAVE_BOOL_T, 1,
617 [Define to 1 if bool is an available type.])
619 #ifdef HAVE_SYS_TYPES_H
620 #include <sys/types.h>
622 #ifdef HAVE_STDBOOL_H
627 # Check for socklen_t or equivalent
628 CURL_CHECK_TYPE_SOCKLEN_T
632 TYPE_SOCKADDR_STORAGE
639 CURL_CHECK_FUNC_RECVFROM
641 CURL_CHECK_MSG_NOSIGNAL
643 dnl check for AF_INET6
644 CARES_CHECK_CONSTANT(
647 #ifdef HAVE_WINDOWS_H
648 #ifndef WIN32_LEAN_AND_MEAN
649 #define WIN32_LEAN_AND_MEAN
652 #ifdef HAVE_WINSOCK2_H
653 #include <winsock2.h>
656 #ifdef HAVE_SYS_TYPES_H
657 #include <sys/types.h>
659 #ifdef HAVE_SYS_SOCKET_H
660 #include <sys/socket.h>
664 AC_DEFINE_UNQUOTED(HAVE_PF_INET6,1,[Define to 1 if you have PF_INET6.])
667 dnl check for PF_INET6
668 CARES_CHECK_CONSTANT(
671 #ifdef HAVE_WINDOWS_H
672 #ifndef WIN32_LEAN_AND_MEAN
673 #define WIN32_LEAN_AND_MEAN
676 #ifdef HAVE_WINSOCK2_H
677 #include <winsock2.h>
680 #ifdef HAVE_SYS_TYPES_H
681 #include <sys/types.h>
683 #ifdef HAVE_SYS_SOCKET_H
684 #include <sys/socket.h>
688 AC_DEFINE_UNQUOTED(HAVE_AF_INET6,1,[Define to 1 if you have AF_INET6.])
692 dnl check for the in6_addr structure
696 #ifdef HAVE_WINDOWS_H
697 #ifndef WIN32_LEAN_AND_MEAN
698 #define WIN32_LEAN_AND_MEAN
701 #ifdef HAVE_WINSOCK2_H
702 #include <winsock2.h>
703 #ifdef HAVE_WS2TCPIP_H
704 #include <ws2tcpip.h>
708 #ifdef HAVE_SYS_TYPES_H
709 #include <sys/types.h>
711 #ifdef HAVE_NETINET_IN_H
712 #include <netinet/in.h>
716 AC_DEFINE_UNQUOTED(HAVE_STRUCT_IN6_ADDR,1,[Define to 1 if you have struct in6_addr.])
719 dnl check for the sockaddr_in6 structure
723 #ifdef HAVE_WINDOWS_H
724 #ifndef WIN32_LEAN_AND_MEAN
725 #define WIN32_LEAN_AND_MEAN
728 #ifdef HAVE_WINSOCK2_H
729 #include <winsock2.h>
730 #ifdef HAVE_WS2TCPIP_H
731 #include <ws2tcpip.h>
735 #ifdef HAVE_SYS_TYPES_H
736 #include <sys/types.h>
738 #ifdef HAVE_NETINET_IN_H
739 #include <netinet/in.h>
743 AC_DEFINE_UNQUOTED(HAVE_STRUCT_SOCKADDR_IN6,1,
744 [Define to 1 if you have struct sockaddr_in6.]) ac_have_sockaddr_in6=yes
747 AC_CHECK_MEMBER(struct sockaddr_in6.sin6_scope_id,
748 AC_DEFINE_UNQUOTED(HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID,1,
749 [Define to 1 if your struct sockaddr_in6 has sin6_scope_id.])
753 #ifdef HAVE_WINDOWS_H
754 #ifndef WIN32_LEAN_AND_MEAN
755 #define WIN32_LEAN_AND_MEAN
758 #ifdef HAVE_WINSOCK2_H
759 #include <winsock2.h>
760 #ifdef HAVE_WS2TCPIP_H
761 #include <ws2tcpip.h>
765 #ifdef HAVE_SYS_TYPES_H
766 #include <sys/types.h>
768 #ifdef HAVE_NETINET_IN_H
769 #include <netinet/in.h>
774 dnl check for the addrinfo structure
775 AC_CHECK_MEMBER(struct addrinfo.ai_flags,
776 AC_DEFINE_UNQUOTED(HAVE_STRUCT_ADDRINFO,1,
777 [Define to 1 if you have struct addrinfo.]),,
780 #ifdef HAVE_WINDOWS_H
781 #ifndef WIN32_LEAN_AND_MEAN
782 #define WIN32_LEAN_AND_MEAN
785 #ifdef HAVE_WINSOCK2_H
786 #include <winsock2.h>
787 #ifdef HAVE_WS2TCPIP_H
788 #include <ws2tcpip.h>
792 #ifdef HAVE_SYS_TYPES_H
793 #include <sys/types.h>
795 #ifdef HAVE_NETINET_IN_H
796 #include <netinet/in.h>
798 #ifdef HAVE_SYS_SOCKET_H
799 #include <sys/socket.h>
809 AC_CHECK_FUNCS( bitncmp \
814 dnl if not found, $ac_func is the name we check for
816 AC_MSG_CHECKING([deeper for $func])
820 eval "ac_cv_func_$func=yes"
821 def=`echo "HAVE_$func" | tr 'a-z' 'A-Z'`
822 AC_DEFINE_UNQUOTED($def, 1, [If you have $func]),
823 AC_MSG_RESULT(but still no)
828 dnl check for inet_pton
829 AC_CHECK_FUNCS(inet_pton)
830 dnl Some systems have it, but not IPv6
831 if test "$ac_cv_func_inet_pton" = "yes" ; then
832 AC_MSG_CHECKING(if inet_pton supports IPv6)
835 #ifdef HAVE_SYS_TYPES_H
836 #include <sys/types.h>
838 #ifdef HAVE_SYS_SOCKET_H
839 #include <sys/socket.h>
841 #ifdef HAVE_NETINET_IN_H
842 #include <netinet/in.h>
846 struct in6_addr addr6;
847 if (inet_pton(AF_INET6, "::1", &addr6) < 1)
854 AC_DEFINE_UNQUOTED(HAVE_INET_PTON_IPV6,1,[Define to 1 if inet_pton supports IPv6.])
855 ], AC_MSG_RESULT(no),AC_MSG_RESULT(no))
857 dnl Check for inet_net_pton
858 AC_CHECK_FUNCS(inet_net_pton)
859 dnl Again, some systems have it, but not IPv6
860 if test "$ac_cv_func_inet_net_pton" = "yes" ; then
861 AC_MSG_CHECKING(if inet_net_pton supports IPv6)
864 #ifdef HAVE_SYS_TYPES_H
865 #include <sys/types.h>
867 #ifdef HAVE_SYS_SOCKET_H
868 #include <sys/socket.h>
870 #ifdef HAVE_NETINET_IN_H
871 #include <netinet/in.h>
875 struct in6_addr addr6;
876 if (inet_net_pton(AF_INET6, "::1", &addr6, sizeof(addr6)) < 1)
883 AC_DEFINE_UNQUOTED(HAVE_INET_NET_PTON_IPV6,1,[Define to 1 if inet_net_pton supports IPv6.])
884 ], AC_MSG_RESULT(no),AC_MSG_RESULT(no))
888 dnl Check for inet_ntop
889 AC_CHECK_FUNCS(inet_ntop)
890 dnl Again, some systems have it, but not IPv6
891 if test "$ac_cv_func_inet_ntop" = "yes" ; then
892 AC_MSG_CHECKING(if inet_ntop supports IPv6)
895 #ifdef HAVE_SYS_TYPES_H
896 #include <sys/types.h>
898 #ifdef HAVE_SYS_SOCKET_H
899 #include <sys/socket.h>
901 #ifdef HAVE_NETINET_IN_H
902 #include <netinet/in.h>
907 struct in6_addr addr6;
909 if (inet_ntop(AF_INET6, &addr6, buf, 128) == 0 && errno == EAFNOSUPPORT)
916 AC_DEFINE_UNQUOTED(HAVE_INET_NTOP_IPV6,1,
917 [Define to 1 if inet_ntop supports IPv6.])
918 ], AC_MSG_RESULT(no),AC_MSG_RESULT(no))
921 AC_CHECK_SIZEOF(struct in6_addr, ,
924 #ifdef HAVE_WINDOWS_H
925 #ifndef WIN32_LEAN_AND_MEAN
926 #define WIN32_LEAN_AND_MEAN
929 #ifdef HAVE_WINSOCK2_H
930 #include <winsock2.h>
931 #ifdef HAVE_WS2TCPIP_H
932 #include <ws2tcpip.h>
936 #ifdef HAVE_SYS_TYPES_H
937 #include <sys/types.h>
939 #ifdef HAVE_SYS_SOCKET_H
940 #include <sys/socket.h>
942 #ifdef HAVE_NETINET_IN_H
943 #include <netinet/in.h>
949 AC_CHECK_SIZEOF(struct in_addr, ,
952 #ifdef HAVE_WINDOWS_H
953 #ifndef WIN32_LEAN_AND_MEAN
954 #define WIN32_LEAN_AND_MEAN
957 #ifdef HAVE_WINSOCK2_H
958 #include <winsock2.h>
959 #ifdef HAVE_WS2TCPIP_H
960 #include <ws2tcpip.h>
964 #ifdef HAVE_SYS_TYPES_H
965 #include <sys/types.h>
967 #ifdef HAVE_SYS_SOCKET_H
968 #include <sys/socket.h>
970 #ifdef HAVE_NETINET_IN_H
971 #include <netinet/in.h>
978 dnl Check if the getnameinfo function is available
979 dnl and get the types of five of its arguments.
980 CURL_CHECK_FUNC_GETNAMEINFO
983 dnl God bless non-standardized functions! We need to see which getservbyport_r
984 dnl variant is available
985 CARES_CHECK_GETSERVBYPORT_R
987 CURL_CHECK_NONBLOCKING_SOCKET
990 [AC_DEFINE(ARES_BIG_ENDIAN, 1,
991 [define this if ares is built for a big endian system])],
993 [AC_MSG_WARN([couldn't figure out endianess, assuming little endian!])]
996 dnl Check for user-specified random device
998 AC_HELP_STRING([--with-random=FILE],
999 [read randomness from FILE (default=/dev/urandom)]),
1000 [ RANDOM_FILE="$withval" ],
1002 dnl Check for random device. If we're cross compiling, we can't
1003 dnl check, and it's better to assume it doesn't exist than it is
1004 dnl to fail on AC_CHECK_FILE or later.
1005 if test "$cross_compiling" = "no"; then
1006 AC_CHECK_FILE("/dev/urandom", [ RANDOM_FILE="/dev/urandom"] )
1008 AC_MSG_WARN([cannot check for /dev/urandom while cross compiling; assuming none])
1013 if test -n "$RANDOM_FILE" && test X"$RANDOM_FILE" != Xno ; then
1014 AC_SUBST(RANDOM_FILE)
1015 AC_DEFINE_UNQUOTED(RANDOM_FILE, "$RANDOM_FILE",
1016 [a suitable file/device to read random data from])
1019 CARES_PRIVATE_LIBS="$LIBS"
1020 AC_SUBST(CARES_PRIVATE_LIBS)
1022 AC_CONFIG_FILES([Makefile libcares.pc])