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 Select a higher warning level than default level2
240 CFLAGS="$CFLAGS -msg_enable level3"
241 dnl Generate warnings for missing function prototypes
242 CFLAGS="$CFLAGS -warnprotos"
243 dnl Change some warnings into fatal errors
244 CFLAGS="$CFLAGS -msg_fatal toofewargs,toomanyargs"
249 CURL_CHECK_COMPILER_HALT_ON_ERROR
250 CURL_CHECK_COMPILER_ARRAY_SIZE_NEGATIVE
252 dnl **********************************************************************
253 dnl Compilation based checks should not be done before this point.
254 dnl **********************************************************************
256 dnl **********************************************************************
257 dnl Make sure that our checks for headers windows.h winsock.h winsock2.h
258 dnl and ws2tcpip.h take precedence over any other further checks which
259 dnl could be done later using AC_CHECK_HEADER or AC_CHECK_HEADERS for
260 dnl this specific header files. And do them before its results are used.
261 dnl **********************************************************************
263 CURL_CHECK_HEADER_WINDOWS
264 CURL_CHECK_NATIVE_WINDOWS
265 case X-"$ac_cv_native_windows" in
267 CURL_CHECK_HEADER_WINSOCK
268 CURL_CHECK_HEADER_WINSOCK2
269 CURL_CHECK_HEADER_WS2TCPIP
272 ac_cv_header_winsock_h="no"
273 ac_cv_header_winsock2_h="no"
274 ac_cv_header_ws2tcpip_h="no"
278 dnl **********************************************************************
279 dnl Checks for libraries.
280 dnl **********************************************************************
282 dnl gethostbyname without lib or in the nsl lib?
283 AC_CHECK_FUNC(gethostbyname,
284 [HAVE_GETHOSTBYNAME="1"
286 [ AC_CHECK_LIB(nsl, gethostbyname,
287 [HAVE_GETHOSTBYNAME="1"
292 if test "$HAVE_GETHOSTBYNAME" != "1"
294 dnl gethostbyname in the socket lib?
295 AC_CHECK_LIB(socket, gethostbyname,
296 [HAVE_GETHOSTBYNAME="1"
297 LIBS="$LIBS -lsocket"
301 dnl At least one system has been identified to require BOTH nsl and socket
302 dnl libs at the same time to link properly.
303 if test "$HAVE_GETHOSTBYNAME" != "1"
305 AC_MSG_CHECKING([for gethostbyname with both nsl and socket libs])
306 my_ac_save_LIBS=$LIBS
307 LIBS="-lnsl -lsocket $LIBS"
315 HAVE_GETHOSTBYNAME="1"
318 LIBS=$my_ac_save_LIBS
322 if test "$HAVE_GETHOSTBYNAME" != "1"
324 dnl This is for winsock systems
325 if test "$ac_cv_header_windows_h" = "yes"; then
326 if test "$ac_cv_header_winsock_h" = "yes"; then
329 winsock_LIB="-lwinsock"
332 winsock_LIB="-lwsock32"
336 if test "$ac_cv_header_winsock2_h" = "yes"; then
337 winsock_LIB="-lws2_32"
339 if test ! -z "$winsock_LIB"; then
340 my_ac_save_LIBS=$LIBS
341 LIBS="$winsock_LIB $LIBS"
342 AC_MSG_CHECKING([for gethostbyname in $winsock_LIB])
345 #ifdef HAVE_WINDOWS_H
346 #ifndef WIN32_LEAN_AND_MEAN
347 #define WIN32_LEAN_AND_MEAN
350 #ifdef HAVE_WINSOCK2_H
351 #include <winsock2.h>
353 #ifdef HAVE_WINSOCK_H
359 gethostbyname("www.dummysite.com");
363 HAVE_GETHOSTBYNAME="1"
367 LIBS=$my_ac_save_LIBS
373 if test "$HAVE_GETHOSTBYNAME" != "1"
375 dnl This is for Minix 3.1
376 AC_MSG_CHECKING([for gethostbyname for Minix 3])
379 /* Older Minix versions may need <net/gen/netdb.h> here instead */
382 gethostbyname("www.dummysite.com");
386 HAVE_GETHOSTBYNAME="1"
392 if test "$HAVE_GETHOSTBYNAME" != "1"
394 dnl This is for eCos with a stubbed DNS implementation
395 AC_MSG_CHECKING([for gethostbyname for eCos])
401 gethostbyname("www.dummysite.com");
405 HAVE_GETHOSTBYNAME="1"
411 if test "$HAVE_GETHOSTBYNAME" != "1"
413 dnl gethostbyname in the net lib - for BeOS
414 AC_CHECK_LIB(net, gethostbyname,
415 [HAVE_GETHOSTBYNAME="1"
421 if test "$HAVE_GETHOSTBYNAME" = "1"; then
422 AC_DEFINE(HAVE_GETHOSTBYNAME, 1, [If you have gethostbyname])
424 AC_MSG_ERROR([couldn't find libraries for gethostbyname()])
428 AC_CHECK_FUNC(strcasecmp, , [ AC_CHECK_LIB(resolve, strcasecmp) ])
430 if test "$ac_cv_lib_resolve_strcasecmp" = "$ac_cv_func_strcasecmp"; then
431 AC_CHECK_LIB(resolve, strcasecmp,
432 [LIBS="-lresolve $LIBS"],
438 AC_CHECK_FUNC(connect, , [ AC_CHECK_LIB(socket, connect) ])
440 dnl **********************************************************************
441 dnl In case that function clock_gettime with monotonic timer is available,
442 dnl check for additional required libraries.
443 dnl **********************************************************************
444 CURL_CHECK_LIBS_CLOCK_GETTIME_MONOTONIC
446 AC_MSG_CHECKING([whether to use libgcc])
447 AC_ARG_ENABLE(libgcc,
448 AC_HELP_STRING([--enable-libgcc],[use libgcc when linking]),
449 [ case "$enableval" in
461 dnl Default is to try the thread-safe versions of a few functions
464 dnl detect AIX 4.3 or later
465 AC_MSG_CHECKING([AIX 4.3 or later])
467 #if defined(_AIX) && defined(_AIX43)
470 #error "this is not AIX 4.3 or later"
473 [ AC_MSG_RESULT([yes])
476 [ AC_MSG_RESULT([no]) ]
479 AC_ARG_ENABLE(thread,dnl
480 AC_HELP_STRING([--disable-thread],[don't look for thread-safe functions])
481 AC_HELP_STRING([--enable-thread],[look for thread-safe functions]),
482 [ case "$enableval" in
485 AC_MSG_WARN(c-ares will not get built using thread-safe functions)
493 if test X"$OPT_THREAD" = Xoff
495 AC_DEFINE(DISABLED_THREADSAFE, 1,
496 [Set to explicitly specify we don't want to use thread-safe functions])
499 dnl for recent AIX versions, we skip all the thread-safe checks above since
500 dnl they claim a thread-safe libc using the standard API. But there are
501 dnl some functions still not thread-safe. Check for these!
503 dnl Let's hope this split URL remains working:
504 dnl http://publibn.boulder.ibm.com/doc_link/en_US/a_doc_lib/aixprggd/ \
505 dnl genprogc/thread_quick_ref.htm
507 if test "x$RECENTAIX" = "xyes"; then
509 AC_DEFINE(_THREAD_SAFE, 1, [define this if you need it to compile thread-safe code])
514 dnl **********************************************************************
515 dnl Back to "normal" configuring
516 dnl **********************************************************************
518 dnl Checks for header files.
521 CURL_CHECK_HEADER_MALLOC
523 dnl check for a few basic system headers we need
540 arpa/nameser_compat.h \
542 dnl to do if not found
548 #ifdef HAVE_SYS_TYPES_H
549 #include <sys/types.h>
551 #ifdef HAVE_SYS_TIME_H
552 #include <sys/time.h>
554 dnl We do this default-include simply to make sure that the nameser_compat.h
555 dnl header *REALLY* can be include after the new nameser.h. It seems AIX 5.1
556 dnl (and others?) is not designed to allow this.
557 #ifdef HAVE_ARPA_NAMESER_H
558 #include <arpa/nameser.h>
561 dnl *Sigh* these are needed in order for net/if.h to get properly detected.
562 #ifdef HAVE_SYS_SOCKET_H
563 #include <sys/socket.h>
565 #ifdef HAVE_NETINET_IN_H
566 #include <netinet/in.h>
571 dnl Checks for typedefs, structures, and compiler characteristics.
575 CURL_CHECK_STRUCT_TIMEVAL
577 AC_CHECK_SIZEOF(size_t)
578 AC_CHECK_SIZEOF(long)
579 AC_CHECK_SIZEOF(time_t)
581 AC_CHECK_TYPE(long long,
582 [AC_DEFINE(HAVE_LONGLONG, 1, [if your compiler supports long long])]
586 if test "xyes" = "x$longlong"; then
587 AC_MSG_CHECKING([if numberLL works])
588 AC_COMPILE_IFELSE([long long val = 1000LL;],
589 [AC_DEFINE(HAVE_LL, 1, [if your compiler supports LL])]
597 AC_CHECK_TYPE(ssize_t, ,
598 AC_DEFINE(ssize_t, int, [the signed version of size_t]))
600 # check for bool type
601 AC_CHECK_TYPE([bool],[
602 AC_DEFINE(HAVE_BOOL_T, 1,
603 [Define to 1 if bool is an available type.])
605 #ifdef HAVE_SYS_TYPES_H
606 #include <sys/types.h>
608 #ifdef HAVE_STDBOOL_H
613 # Check for socklen_t or equivalent
614 CURL_CHECK_TYPE_SOCKLEN_T
618 TYPE_SOCKADDR_STORAGE
625 CURL_CHECK_FUNC_RECVFROM
627 CURL_CHECK_MSG_NOSIGNAL
629 dnl check for AF_INET6
630 CARES_CHECK_CONSTANT(
633 #ifdef HAVE_WINDOWS_H
634 #ifndef WIN32_LEAN_AND_MEAN
635 #define WIN32_LEAN_AND_MEAN
638 #ifdef HAVE_WINSOCK2_H
639 #include <winsock2.h>
642 #ifdef HAVE_SYS_TYPES_H
643 #include <sys/types.h>
645 #ifdef HAVE_SYS_SOCKET_H
646 #include <sys/socket.h>
650 AC_DEFINE_UNQUOTED(HAVE_PF_INET6,1,[Define to 1 if you have PF_INET6.])
653 dnl check for PF_INET6
654 CARES_CHECK_CONSTANT(
657 #ifdef HAVE_WINDOWS_H
658 #ifndef WIN32_LEAN_AND_MEAN
659 #define WIN32_LEAN_AND_MEAN
662 #ifdef HAVE_WINSOCK2_H
663 #include <winsock2.h>
666 #ifdef HAVE_SYS_TYPES_H
667 #include <sys/types.h>
669 #ifdef HAVE_SYS_SOCKET_H
670 #include <sys/socket.h>
674 AC_DEFINE_UNQUOTED(HAVE_AF_INET6,1,[Define to 1 if you have AF_INET6.])
678 dnl check for the in6_addr structure
682 #ifdef HAVE_WINDOWS_H
683 #ifndef WIN32_LEAN_AND_MEAN
684 #define WIN32_LEAN_AND_MEAN
687 #ifdef HAVE_WINSOCK2_H
688 #include <winsock2.h>
689 #ifdef HAVE_WS2TCPIP_H
690 #include <ws2tcpip.h>
694 #ifdef HAVE_SYS_TYPES_H
695 #include <sys/types.h>
697 #ifdef HAVE_NETINET_IN_H
698 #include <netinet/in.h>
702 AC_DEFINE_UNQUOTED(HAVE_STRUCT_IN6_ADDR,1,[Define to 1 if you have struct in6_addr.])
705 dnl check for the sockaddr_in6 structure
709 #ifdef HAVE_WINDOWS_H
710 #ifndef WIN32_LEAN_AND_MEAN
711 #define WIN32_LEAN_AND_MEAN
714 #ifdef HAVE_WINSOCK2_H
715 #include <winsock2.h>
716 #ifdef HAVE_WS2TCPIP_H
717 #include <ws2tcpip.h>
721 #ifdef HAVE_SYS_TYPES_H
722 #include <sys/types.h>
724 #ifdef HAVE_NETINET_IN_H
725 #include <netinet/in.h>
729 AC_DEFINE_UNQUOTED(HAVE_STRUCT_SOCKADDR_IN6,1,
730 [Define to 1 if you have struct sockaddr_in6.]) ac_have_sockaddr_in6=yes
733 AC_CHECK_MEMBER(struct sockaddr_in6.sin6_scope_id,
734 AC_DEFINE_UNQUOTED(HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID,1,
735 [Define to 1 if your struct sockaddr_in6 has sin6_scope_id.])
739 #ifdef HAVE_WINDOWS_H
740 #ifndef WIN32_LEAN_AND_MEAN
741 #define WIN32_LEAN_AND_MEAN
744 #ifdef HAVE_WINSOCK2_H
745 #include <winsock2.h>
746 #ifdef HAVE_WS2TCPIP_H
747 #include <ws2tcpip.h>
751 #ifdef HAVE_SYS_TYPES_H
752 #include <sys/types.h>
754 #ifdef HAVE_NETINET_IN_H
755 #include <netinet/in.h>
760 dnl check for the addrinfo structure
761 AC_CHECK_MEMBER(struct addrinfo.ai_flags,
762 AC_DEFINE_UNQUOTED(HAVE_STRUCT_ADDRINFO,1,
763 [Define to 1 if you have struct addrinfo.]),,
766 #ifdef HAVE_WINDOWS_H
767 #ifndef WIN32_LEAN_AND_MEAN
768 #define WIN32_LEAN_AND_MEAN
771 #ifdef HAVE_WINSOCK2_H
772 #include <winsock2.h>
773 #ifdef HAVE_WS2TCPIP_H
774 #include <ws2tcpip.h>
778 #ifdef HAVE_SYS_TYPES_H
779 #include <sys/types.h>
781 #ifdef HAVE_NETINET_IN_H
782 #include <netinet/in.h>
784 #ifdef HAVE_SYS_SOCKET_H
785 #include <sys/socket.h>
795 AC_CHECK_FUNCS( bitncmp \
800 dnl if not found, $ac_func is the name we check for
802 AC_MSG_CHECKING([deeper for $func])
806 eval "ac_cv_func_$func=yes"
807 def=`echo "HAVE_$func" | tr 'a-z' 'A-Z'`
808 AC_DEFINE_UNQUOTED($def, 1, [If you have $func]),
809 AC_MSG_RESULT(but still no)
814 dnl check for inet_pton
815 AC_CHECK_FUNCS(inet_pton)
816 dnl Some systems have it, but not IPv6
817 if test "$ac_cv_func_inet_pton" = "yes" ; then
818 AC_MSG_CHECKING(if inet_pton supports IPv6)
821 #ifdef HAVE_SYS_TYPES_H
822 #include <sys/types.h>
824 #ifdef HAVE_SYS_SOCKET_H
825 #include <sys/socket.h>
827 #ifdef HAVE_NETINET_IN_H
828 #include <netinet/in.h>
832 struct in6_addr addr6;
833 if (inet_pton(AF_INET6, "::1", &addr6) < 1)
840 AC_DEFINE_UNQUOTED(HAVE_INET_PTON_IPV6,1,[Define to 1 if inet_pton supports IPv6.])
841 ], AC_MSG_RESULT(no),AC_MSG_RESULT(no))
843 dnl Check for inet_net_pton
844 AC_CHECK_FUNCS(inet_net_pton)
845 dnl Again, some systems have it, but not IPv6
846 if test "$ac_cv_func_inet_net_pton" = "yes" ; then
847 AC_MSG_CHECKING(if inet_net_pton supports IPv6)
850 #ifdef HAVE_SYS_TYPES_H
851 #include <sys/types.h>
853 #ifdef HAVE_SYS_SOCKET_H
854 #include <sys/socket.h>
856 #ifdef HAVE_NETINET_IN_H
857 #include <netinet/in.h>
861 struct in6_addr addr6;
862 if (inet_net_pton(AF_INET6, "::1", &addr6, sizeof(addr6)) < 1)
869 AC_DEFINE_UNQUOTED(HAVE_INET_NET_PTON_IPV6,1,[Define to 1 if inet_net_pton supports IPv6.])
870 ], AC_MSG_RESULT(no),AC_MSG_RESULT(no))
874 dnl Check for inet_ntop
875 AC_CHECK_FUNCS(inet_ntop)
876 dnl Again, some systems have it, but not IPv6
877 if test "$ac_cv_func_inet_ntop" = "yes" ; then
878 AC_MSG_CHECKING(if inet_ntop supports IPv6)
881 #ifdef HAVE_SYS_TYPES_H
882 #include <sys/types.h>
884 #ifdef HAVE_SYS_SOCKET_H
885 #include <sys/socket.h>
887 #ifdef HAVE_NETINET_IN_H
888 #include <netinet/in.h>
893 struct in6_addr addr6;
895 if (inet_ntop(AF_INET6, &addr6, buf, 128) == 0 && errno == EAFNOSUPPORT)
902 AC_DEFINE_UNQUOTED(HAVE_INET_NTOP_IPV6,1,
903 [Define to 1 if inet_ntop supports IPv6.])
904 ], AC_MSG_RESULT(no),AC_MSG_RESULT(no))
907 AC_CHECK_SIZEOF(struct in6_addr, ,
910 #ifdef HAVE_WINDOWS_H
911 #ifndef WIN32_LEAN_AND_MEAN
912 #define WIN32_LEAN_AND_MEAN
915 #ifdef HAVE_WINSOCK2_H
916 #include <winsock2.h>
917 #ifdef HAVE_WS2TCPIP_H
918 #include <ws2tcpip.h>
922 #ifdef HAVE_SYS_TYPES_H
923 #include <sys/types.h>
925 #ifdef HAVE_SYS_SOCKET_H
926 #include <sys/socket.h>
928 #ifdef HAVE_NETINET_IN_H
929 #include <netinet/in.h>
935 AC_CHECK_SIZEOF(struct in_addr, ,
938 #ifdef HAVE_WINDOWS_H
939 #ifndef WIN32_LEAN_AND_MEAN
940 #define WIN32_LEAN_AND_MEAN
943 #ifdef HAVE_WINSOCK2_H
944 #include <winsock2.h>
945 #ifdef HAVE_WS2TCPIP_H
946 #include <ws2tcpip.h>
950 #ifdef HAVE_SYS_TYPES_H
951 #include <sys/types.h>
953 #ifdef HAVE_SYS_SOCKET_H
954 #include <sys/socket.h>
956 #ifdef HAVE_NETINET_IN_H
957 #include <netinet/in.h>
964 dnl Check if the getnameinfo function is available
965 dnl and get the types of five of its arguments.
966 CURL_CHECK_FUNC_GETNAMEINFO
969 dnl God bless non-standardized functions! We need to see which getservbyport_r
970 dnl variant is available
971 CARES_CHECK_GETSERVBYPORT_R
973 CURL_CHECK_NONBLOCKING_SOCKET
976 [AC_DEFINE(ARES_BIG_ENDIAN, 1,
977 [define this if ares is built for a big endian system])],
979 [AC_MSG_WARN([couldn't figure out endianess, assuming little endian!])]
982 dnl Check for user-specified random device
984 AC_HELP_STRING([--with-random=FILE],
985 [read randomness from FILE (default=/dev/urandom)]),
986 [ RANDOM_FILE="$withval" ],
988 dnl Check for random device. If we're cross compiling, we can't
989 dnl check, and it's better to assume it doesn't exist than it is
990 dnl to fail on AC_CHECK_FILE or later.
991 if test "$cross_compiling" = "no"; then
992 AC_CHECK_FILE("/dev/urandom", [ RANDOM_FILE="/dev/urandom"] )
994 AC_MSG_WARN([cannot check for /dev/urandom while cross compiling; assuming none])
999 if test -n "$RANDOM_FILE" && test X"$RANDOM_FILE" != Xno ; then
1000 AC_SUBST(RANDOM_FILE)
1001 AC_DEFINE_UNQUOTED(RANDOM_FILE, "$RANDOM_FILE",
1002 [a suitable file/device to read random data from])
1005 CARES_PRIVATE_LIBS="$LIBS"
1006 AC_SUBST(CARES_PRIVATE_LIBS)
1008 AC_CONFIG_FILES([Makefile libcares.pc])