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 and prevent it from being 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.])
22 dnl GREP is mandatory for configure process and libtool.
23 dnl Set it now and prevent it from being changed later.
24 AC_PATH_PROG([GREP], [grep], [not_found],
25 [$PATH:/usr/bin:/usr/local/bin])
26 if test -z "$GREP" || test "$GREP" = "not_found"; then
27 AC_MSG_ERROR([grep not found in PATH. Cannot continue without grep.])
29 ac_cv_prog_grep="$GREP"
30 ac_cv_prog_GREP="$GREP"
33 dnl EGREP is mandatory for configure process and libtool.
34 dnl Set it now and prevent it from being changed later.
35 if echo a | ($GREP -E '(a|b)') >/dev/null 2>&1; then
36 AC_MSG_CHECKING([for egrep])
38 AC_MSG_RESULT([$EGREP])
40 AC_PATH_PROG([EGREP], [egrep], [not_found],
41 [$PATH:/usr/bin:/usr/local/bin])
43 if test -z "$EGREP" || test "$EGREP" = "not_found"; then
44 AC_MSG_ERROR([egrep not found in PATH. Cannot continue without egrep.])
46 ac_cv_prog_egrep="$EGREP"
47 ac_cv_prog_EGREP="$EGREP"
50 dnl AR is mandatory for configure process and libtool.
51 dnl This is target dependant, so check it as a tool.
52 AC_PATH_TOOL([AR], [ar], [not_found],
53 [$PATH:/usr/bin:/usr/local/bin])
54 if test -z "$AR" || test "$AR" = "not_found"; then
55 AC_MSG_ERROR([ar not found in PATH. Cannot continue without ar.])
59 dnl Fetch c-ares version from ares_version.h
60 VERSION=`$SED -ne 's/^#define ARES_VERSION_STR "\(.*\)"/\1/p' ${srcdir}/ares_version.h`
61 AM_INIT_AUTOMAKE([c-ares], [$VERSION])
62 AC_MSG_CHECKING([c-ares version])
63 AC_MSG_RESULT([$VERSION])
66 dnl Detect the canonical host and target build environment
70 dnl Get system canonical name
71 AC_DEFINE_UNQUOTED(OS, "${host}", [cpu-machine-OS])
78 dnl Our configure and build reentrant settings
79 CARES_CONFIGURE_REENTRANT
81 dnl check for how to do large files
86 AC_DEFINE(ETC_INET, 1, [if a /etc/inet dir is being used])
90 dnl support building of Windows DLLs
93 dnl ************************************************************
94 dnl Option to switch on debug options. This makes an assumption that
95 dnl this is built as an 'ares' subdir in the curl source tree. Subject for
96 dnl improval in the future!
98 AC_MSG_CHECKING([whether to enable debug options])
100 AC_HELP_STRING([--enable-debug],[Enable pedantic debug options])
101 AC_HELP_STRING([--disable-debug],[Disable debug options]),
102 [ case "$enableval" in
106 *) AC_MSG_RESULT(yes)
108 dnl when doing the debug stuff, use static library only
113 dnl the entire --enable-debug is a hack that lives and runs on top of
114 dnl libcurl stuff so this BUILDING_LIBCURL is not THAT much uglier
115 AC_DEFINE(BUILDING_LIBCURL, 1, [when building as static part of libcurl])
117 CPPFLAGS="$CPPFLAGS -DCURLDEBUG -I$srcdir/../include"
120 dnl set compiler "debug" options to become more picky, and remove
121 dnl optimize options from CFLAGS
128 AM_CONDITIONAL(DEBUGBUILD, test x$debugbuild = xyes)
130 dnl skip libtool C++ and Fortran compiler checks
131 m4_ifdef([AC_PROG_CXX], [m4_undefine([AC_PROG_CXX])])
132 m4_defun([AC_PROG_CXX],[])
133 m4_ifdef([AC_PROG_CXXCPP], [m4_undefine([AC_PROG_CXXCPP])])
134 m4_defun([AC_PROG_CXXCPP],[true])
135 m4_ifdef([AC_PROG_F77], [m4_undefine([AC_PROG_F77])])
136 m4_defun([AC_PROG_F77],[])
138 dnl skip libtool C++ and Fortran linker checks
139 m4_ifdef([AC_LIBTOOL_CXX], [m4_undefine([AC_LIBTOOL_CXX])])
140 m4_defun([AC_LIBTOOL_CXX],[])
141 m4_ifdef([AC_LIBTOOL_CXXCPP], [m4_undefine([AC_LIBTOOL_CXXCPP])])
142 m4_defun([AC_LIBTOOL_CXXCPP],[true])
143 m4_ifdef([AC_LIBTOOL_F77], [m4_undefine([AC_LIBTOOL_F77])])
144 m4_defun([AC_LIBTOOL_F77],[])
146 dnl force libtool to build static libraries with PIC on AMD64-linux
147 AC_MSG_CHECKING([if arch-OS host is AMD64-linux (to build static libraries with PIC)])
161 AC_MSG_CHECKING([if we need -no-undefined])
163 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*)
164 need_no_undefined=yes
170 AC_MSG_RESULT($need_no_undefined)
171 AM_CONDITIONAL(NO_UNDEFINED, test x$need_no_undefined = xyes)
173 dnl **********************************************************************
174 dnl check if this is the Intel ICC compiler, and if so make it stricter
175 dnl (convert warning 147 into an error) so that it properly can detect the
176 dnl gethostbyname_r() version
177 dnl **********************************************************************
178 CURL_DETECT_ICC([CFLAGS="$CFLAGS -we 147"])
180 dnl **********************************************************************
181 dnl platform/compiler/architecture specific checks/flags
182 dnl **********************************************************************
188 dnl find out if icc is being used
189 if test "z$ICC" = "z"; then
193 if test "$ICC" = "yes"; then
194 dnl figure out icc version
195 AC_MSG_CHECKING([icc version])
196 iccver=`$CC -dumpversion`
197 iccnhi=`echo $iccver | cut -d . -f1`
198 iccnlo=`echo $iccver | cut -d . -f2`
199 iccnum=`(expr $iccnhi "*" 100 + $iccnlo) 2>/dev/null`
200 AC_MSG_RESULT($iccver)
202 if test "$iccnum" -ge "900" && test "$iccnum" -lt "1000"; then
204 CFLAGS="$CFLAGS -i-dynamic"
207 if test "$iccnum" -ge "1000"; then
208 dnl icc 10.X or later
209 CFLAGS="$CFLAGS -shared-intel"
217 AC_MSG_CHECKING([whether we are using the IBM C compiler])
218 CURL_CHECK_DEF([__IBMC__], [], [silent])
219 CURL_CHECK_DEF([__IBMCPP__], [], [silent])
220 if test "$curl_cv_have_def___IBMC__" = "yes" ||
221 test "$curl_cv_have_def___IBMCPP__" = "yes"; then
223 dnl Ensure that compiler optimizations are always thread-safe.
224 CFLAGS="$CFLAGS -qthreaded"
225 dnl Disable type based strict aliasing optimizations, using worst
226 dnl case aliasing assumptions when compiling. Type based aliasing
227 dnl would restrict the lvalues that could be safely used to access
229 CFLAGS="$CFLAGS -qnoansialias"
230 dnl Force compiler to stop after the compilation phase, without
231 dnl generating an object code file when compilation has errors.
232 CFLAGS="$CFLAGS -qhalt=e"
237 AC_MSG_CHECKING([whether we are using the DEC/Compaq C compiler])
238 CURL_CHECK_DEF([__DECC], [], [silent])
239 CURL_CHECK_DEF([__DECC_VER], [], [silent])
240 if test "$curl_cv_have_def___DECC" = "yes" ||
241 test "$curl_cv_have_def___DECC_VER" = "yes"; then
243 dnl Select strict ANSI C compiler mode
244 CFLAGS="$CFLAGS -std1"
245 dnl Select a higher warning level than default level2
246 CFLAGS="$CFLAGS -msg_enable level3"
247 dnl Generate warnings for missing function prototypes
248 CFLAGS="$CFLAGS -warnprotos"
249 dnl Change some warnings into fatal errors
250 CFLAGS="$CFLAGS -msg_fatal toofewargs,toomanyargs"
255 CURL_CHECK_COMPILER_HALT_ON_ERROR
256 CURL_CHECK_COMPILER_ARRAY_SIZE_NEGATIVE
258 dnl **********************************************************************
259 dnl Compilation based checks should not be done before this point.
260 dnl **********************************************************************
262 dnl **********************************************************************
263 dnl Make sure that our checks for headers windows.h winsock.h winsock2.h
264 dnl and ws2tcpip.h take precedence over any other further checks which
265 dnl could be done later using AC_CHECK_HEADER or AC_CHECK_HEADERS for
266 dnl this specific header files. And do them before its results are used.
267 dnl **********************************************************************
269 CURL_CHECK_HEADER_WINDOWS
270 CURL_CHECK_NATIVE_WINDOWS
271 case X-"$ac_cv_native_windows" in
273 CURL_CHECK_HEADER_WINSOCK
274 CURL_CHECK_HEADER_WINSOCK2
275 CURL_CHECK_HEADER_WS2TCPIP
278 ac_cv_header_winsock_h="no"
279 ac_cv_header_winsock2_h="no"
280 ac_cv_header_ws2tcpip_h="no"
284 dnl **********************************************************************
285 dnl Checks for libraries.
286 dnl **********************************************************************
288 dnl gethostbyname without lib or in the nsl lib?
289 AC_CHECK_FUNC(gethostbyname,
290 [HAVE_GETHOSTBYNAME="1"
292 [ AC_CHECK_LIB(nsl, gethostbyname,
293 [HAVE_GETHOSTBYNAME="1"
298 if test "$HAVE_GETHOSTBYNAME" != "1"
300 dnl gethostbyname in the socket lib?
301 AC_CHECK_LIB(socket, gethostbyname,
302 [HAVE_GETHOSTBYNAME="1"
303 LIBS="$LIBS -lsocket"
307 dnl At least one system has been identified to require BOTH nsl and socket
308 dnl libs at the same time to link properly.
309 if test "$HAVE_GETHOSTBYNAME" != "1"
311 AC_MSG_CHECKING([for gethostbyname with both nsl and socket libs])
312 my_ac_save_LIBS=$LIBS
313 LIBS="-lnsl -lsocket $LIBS"
321 HAVE_GETHOSTBYNAME="1"
324 LIBS=$my_ac_save_LIBS
328 if test "$HAVE_GETHOSTBYNAME" != "1"
330 dnl This is for winsock systems
331 if test "$ac_cv_header_windows_h" = "yes"; then
332 if test "$ac_cv_header_winsock_h" = "yes"; then
335 winsock_LIB="-lwinsock"
338 winsock_LIB="-lwsock32"
342 if test "$ac_cv_header_winsock2_h" = "yes"; then
343 winsock_LIB="-lws2_32"
345 if test ! -z "$winsock_LIB"; then
346 my_ac_save_LIBS=$LIBS
347 LIBS="$winsock_LIB $LIBS"
348 AC_MSG_CHECKING([for gethostbyname in $winsock_LIB])
351 #ifdef HAVE_WINDOWS_H
352 #ifndef WIN32_LEAN_AND_MEAN
353 #define WIN32_LEAN_AND_MEAN
356 #ifdef HAVE_WINSOCK2_H
357 #include <winsock2.h>
359 #ifdef HAVE_WINSOCK_H
365 gethostbyname("www.dummysite.com");
369 HAVE_GETHOSTBYNAME="1"
373 LIBS=$my_ac_save_LIBS
379 if test "$HAVE_GETHOSTBYNAME" != "1"
381 dnl This is for Minix 3.1
382 AC_MSG_CHECKING([for gethostbyname for Minix 3])
385 /* Older Minix versions may need <net/gen/netdb.h> here instead */
388 gethostbyname("www.dummysite.com");
392 HAVE_GETHOSTBYNAME="1"
398 if test "$HAVE_GETHOSTBYNAME" != "1"
400 dnl This is for eCos with a stubbed DNS implementation
401 AC_MSG_CHECKING([for gethostbyname for eCos])
407 gethostbyname("www.dummysite.com");
411 HAVE_GETHOSTBYNAME="1"
417 if test "$HAVE_GETHOSTBYNAME" != "1"
419 dnl gethostbyname in the net lib - for BeOS
420 AC_CHECK_LIB(net, gethostbyname,
421 [HAVE_GETHOSTBYNAME="1"
427 if test "$HAVE_GETHOSTBYNAME" = "1"; then
428 AC_DEFINE(HAVE_GETHOSTBYNAME, 1, [If you have gethostbyname])
430 AC_MSG_ERROR([couldn't find libraries for gethostbyname()])
434 AC_CHECK_FUNC(strcasecmp, , [ AC_CHECK_LIB(resolve, strcasecmp) ])
436 if test "$ac_cv_lib_resolve_strcasecmp" = "$ac_cv_func_strcasecmp"; then
437 AC_CHECK_LIB(resolve, strcasecmp,
438 [LIBS="-lresolve $LIBS"],
444 AC_CHECK_FUNC(connect, , [ AC_CHECK_LIB(socket, connect) ])
446 dnl **********************************************************************
447 dnl In case that function clock_gettime with monotonic timer is available,
448 dnl check for additional required libraries.
449 dnl **********************************************************************
450 CURL_CHECK_LIBS_CLOCK_GETTIME_MONOTONIC
452 AC_MSG_CHECKING([whether to use libgcc])
453 AC_ARG_ENABLE(libgcc,
454 AC_HELP_STRING([--enable-libgcc],[use libgcc when linking]),
455 [ case "$enableval" in
467 dnl Default is to try the thread-safe versions of a few functions
470 dnl detect AIX 4.3 or later
471 AC_MSG_CHECKING([AIX 4.3 or later])
473 #if defined(_AIX) && defined(_AIX43)
476 #error "this is not AIX 4.3 or later"
479 [ AC_MSG_RESULT([yes])
482 [ AC_MSG_RESULT([no]) ]
485 AC_ARG_ENABLE(thread,dnl
486 AC_HELP_STRING([--disable-thread],[don't look for thread-safe functions])
487 AC_HELP_STRING([--enable-thread],[look for thread-safe functions]),
488 [ case "$enableval" in
491 AC_MSG_WARN(c-ares will not get built using thread-safe functions)
499 if test X"$OPT_THREAD" = Xoff
501 AC_DEFINE(DISABLED_THREADSAFE, 1,
502 [Set to explicitly specify we don't want to use thread-safe functions])
505 dnl for recent AIX versions, we skip all the thread-safe checks above since
506 dnl they claim a thread-safe libc using the standard API. But there are
507 dnl some functions still not thread-safe. Check for these!
509 dnl Let's hope this split URL remains working:
510 dnl http://publibn.boulder.ibm.com/doc_link/en_US/a_doc_lib/aixprggd/ \
511 dnl genprogc/thread_quick_ref.htm
513 if test "x$RECENTAIX" = "xyes"; then
515 AC_DEFINE(_THREAD_SAFE, 1, [define this if you need it to compile thread-safe code])
520 dnl **********************************************************************
521 dnl Back to "normal" configuring
522 dnl **********************************************************************
524 dnl Checks for header files.
527 CURL_CHECK_HEADER_MALLOC
529 dnl check for a few basic system headers we need
546 arpa/nameser_compat.h \
548 dnl to do if not found
554 #ifdef HAVE_SYS_TYPES_H
555 #include <sys/types.h>
557 #ifdef HAVE_SYS_TIME_H
558 #include <sys/time.h>
560 dnl We do this default-include simply to make sure that the nameser_compat.h
561 dnl header *REALLY* can be include after the new nameser.h. It seems AIX 5.1
562 dnl (and others?) is not designed to allow this.
563 #ifdef HAVE_ARPA_NAMESER_H
564 #include <arpa/nameser.h>
567 dnl *Sigh* these are needed in order for net/if.h to get properly detected.
568 #ifdef HAVE_SYS_SOCKET_H
569 #include <sys/socket.h>
571 #ifdef HAVE_NETINET_IN_H
572 #include <netinet/in.h>
577 dnl Checks for typedefs, structures, and compiler characteristics.
581 CURL_CHECK_STRUCT_TIMEVAL
583 AC_CHECK_SIZEOF(size_t)
584 AC_CHECK_SIZEOF(long)
585 AC_CHECK_SIZEOF(time_t)
587 AC_CHECK_TYPE(long long,
588 [AC_DEFINE(HAVE_LONGLONG, 1, [if your compiler supports long long])]
592 if test "xyes" = "x$longlong"; then
593 AC_MSG_CHECKING([if numberLL works])
594 AC_COMPILE_IFELSE([long long val = 1000LL;],
595 [AC_DEFINE(HAVE_LL, 1, [if your compiler supports LL])]
603 AC_CHECK_TYPE(ssize_t, ,
604 AC_DEFINE(ssize_t, int, [the signed version of size_t]))
606 # check for bool type
607 AC_CHECK_TYPE([bool],[
608 AC_DEFINE(HAVE_BOOL_T, 1,
609 [Define to 1 if bool is an available type.])
611 #ifdef HAVE_SYS_TYPES_H
612 #include <sys/types.h>
614 #ifdef HAVE_STDBOOL_H
619 # Check for socklen_t or equivalent
620 CURL_CHECK_TYPE_SOCKLEN_T
624 TYPE_SOCKADDR_STORAGE
631 CURL_CHECK_FUNC_RECVFROM
633 CURL_CHECK_MSG_NOSIGNAL
635 dnl check for AF_INET6
636 CARES_CHECK_CONSTANT(
639 #ifdef HAVE_WINDOWS_H
640 #ifndef WIN32_LEAN_AND_MEAN
641 #define WIN32_LEAN_AND_MEAN
644 #ifdef HAVE_WINSOCK2_H
645 #include <winsock2.h>
648 #ifdef HAVE_SYS_TYPES_H
649 #include <sys/types.h>
651 #ifdef HAVE_SYS_SOCKET_H
652 #include <sys/socket.h>
656 AC_DEFINE_UNQUOTED(HAVE_PF_INET6,1,[Define to 1 if you have PF_INET6.])
659 dnl check for PF_INET6
660 CARES_CHECK_CONSTANT(
663 #ifdef HAVE_WINDOWS_H
664 #ifndef WIN32_LEAN_AND_MEAN
665 #define WIN32_LEAN_AND_MEAN
668 #ifdef HAVE_WINSOCK2_H
669 #include <winsock2.h>
672 #ifdef HAVE_SYS_TYPES_H
673 #include <sys/types.h>
675 #ifdef HAVE_SYS_SOCKET_H
676 #include <sys/socket.h>
680 AC_DEFINE_UNQUOTED(HAVE_AF_INET6,1,[Define to 1 if you have AF_INET6.])
684 dnl check for the in6_addr structure
688 #ifdef HAVE_WINDOWS_H
689 #ifndef WIN32_LEAN_AND_MEAN
690 #define WIN32_LEAN_AND_MEAN
693 #ifdef HAVE_WINSOCK2_H
694 #include <winsock2.h>
695 #ifdef HAVE_WS2TCPIP_H
696 #include <ws2tcpip.h>
700 #ifdef HAVE_SYS_TYPES_H
701 #include <sys/types.h>
703 #ifdef HAVE_NETINET_IN_H
704 #include <netinet/in.h>
708 AC_DEFINE_UNQUOTED(HAVE_STRUCT_IN6_ADDR,1,[Define to 1 if you have struct in6_addr.])
711 dnl check for the sockaddr_in6 structure
715 #ifdef HAVE_WINDOWS_H
716 #ifndef WIN32_LEAN_AND_MEAN
717 #define WIN32_LEAN_AND_MEAN
720 #ifdef HAVE_WINSOCK2_H
721 #include <winsock2.h>
722 #ifdef HAVE_WS2TCPIP_H
723 #include <ws2tcpip.h>
727 #ifdef HAVE_SYS_TYPES_H
728 #include <sys/types.h>
730 #ifdef HAVE_NETINET_IN_H
731 #include <netinet/in.h>
735 AC_DEFINE_UNQUOTED(HAVE_STRUCT_SOCKADDR_IN6,1,
736 [Define to 1 if you have struct sockaddr_in6.]) ac_have_sockaddr_in6=yes
739 AC_CHECK_MEMBER(struct sockaddr_in6.sin6_scope_id,
740 AC_DEFINE_UNQUOTED(HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID,1,
741 [Define to 1 if your struct sockaddr_in6 has sin6_scope_id.])
745 #ifdef HAVE_WINDOWS_H
746 #ifndef WIN32_LEAN_AND_MEAN
747 #define WIN32_LEAN_AND_MEAN
750 #ifdef HAVE_WINSOCK2_H
751 #include <winsock2.h>
752 #ifdef HAVE_WS2TCPIP_H
753 #include <ws2tcpip.h>
757 #ifdef HAVE_SYS_TYPES_H
758 #include <sys/types.h>
760 #ifdef HAVE_NETINET_IN_H
761 #include <netinet/in.h>
766 dnl check for the addrinfo structure
767 AC_CHECK_MEMBER(struct addrinfo.ai_flags,
768 AC_DEFINE_UNQUOTED(HAVE_STRUCT_ADDRINFO,1,
769 [Define to 1 if you have struct addrinfo.]),,
772 #ifdef HAVE_WINDOWS_H
773 #ifndef WIN32_LEAN_AND_MEAN
774 #define WIN32_LEAN_AND_MEAN
777 #ifdef HAVE_WINSOCK2_H
778 #include <winsock2.h>
779 #ifdef HAVE_WS2TCPIP_H
780 #include <ws2tcpip.h>
784 #ifdef HAVE_SYS_TYPES_H
785 #include <sys/types.h>
787 #ifdef HAVE_NETINET_IN_H
788 #include <netinet/in.h>
790 #ifdef HAVE_SYS_SOCKET_H
791 #include <sys/socket.h>
801 AC_CHECK_FUNCS( bitncmp \
806 dnl if not found, $ac_func is the name we check for
808 AC_MSG_CHECKING([deeper for $func])
812 eval "ac_cv_func_$func=yes"
813 def=`echo "HAVE_$func" | tr 'a-z' 'A-Z'`
814 AC_DEFINE_UNQUOTED($def, 1, [If you have $func]),
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])