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])
71 dnl This defines _ALL_SOURCE for AIX
72 CARES_CHECK_AIX_ALL_SOURCE
74 dnl Our configure and build reentrant settings
75 CARES_CONFIGURE_REENTRANT
77 dnl check for how to do large files
82 AC_DEFINE(ETC_INET, 1, [if a /etc/inet dir is being used])
86 dnl support building of Windows DLLs
89 dnl ************************************************************
90 dnl Option to switch on debug options. This makes an assumption that
91 dnl this is built as an 'ares' subdir in the curl source tree. Subject for
92 dnl improval in the future!
94 AC_MSG_CHECKING([whether to enable debug options])
96 AC_HELP_STRING([--enable-debug],[Enable pedantic debug options])
97 AC_HELP_STRING([--disable-debug],[Disable debug options]),
98 [ case "$enableval" in
102 *) AC_MSG_RESULT(yes)
104 dnl when doing the debug stuff, use static library only
109 dnl the entire --enable-debug is a hack that lives and runs on top of
110 dnl libcurl stuff so this BUILDING_LIBCURL is not THAT much uglier
111 AC_DEFINE(BUILDING_LIBCURL, 1, [when building as static part of libcurl])
113 CPPFLAGS="$CPPFLAGS -DCURLDEBUG -I$srcdir/../include"
116 dnl set compiler "debug" options to become more picky, and remove
117 dnl optimize options from CFLAGS
124 AM_CONDITIONAL(DEBUGBUILD, test x$debugbuild = xyes)
125 AM_CONDITIONAL(CURLDEBUG, test x$debugbuild = xyes)
127 dnl skip libtool C++ and Fortran compiler checks
128 m4_ifdef([AC_PROG_CXX], [m4_undefine([AC_PROG_CXX])])
129 m4_defun([AC_PROG_CXX],[])
130 m4_ifdef([AC_PROG_CXXCPP], [m4_undefine([AC_PROG_CXXCPP])])
131 m4_defun([AC_PROG_CXXCPP],[true])
132 m4_ifdef([AC_PROG_F77], [m4_undefine([AC_PROG_F77])])
133 m4_defun([AC_PROG_F77],[])
135 dnl skip libtool C++ and Fortran linker checks
136 m4_ifdef([AC_LIBTOOL_CXX], [m4_undefine([AC_LIBTOOL_CXX])])
137 m4_defun([AC_LIBTOOL_CXX],[])
138 m4_ifdef([AC_LIBTOOL_CXXCPP], [m4_undefine([AC_LIBTOOL_CXXCPP])])
139 m4_defun([AC_LIBTOOL_CXXCPP],[true])
140 m4_ifdef([AC_LIBTOOL_F77], [m4_undefine([AC_LIBTOOL_F77])])
141 m4_defun([AC_LIBTOOL_F77],[])
143 dnl force libtool to build static libraries with PIC on AMD64-linux
144 AC_MSG_CHECKING([if arch-OS host is AMD64-linux (to build static libraries with PIC)])
158 AC_MSG_CHECKING([if we need -no-undefined])
160 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*)
161 need_no_undefined=yes
167 AC_MSG_RESULT($need_no_undefined)
168 AM_CONDITIONAL(NO_UNDEFINED, test x$need_no_undefined = xyes)
170 dnl **********************************************************************
171 dnl check if this is the Intel ICC compiler, and if so make it stricter
172 dnl (convert warning 147 into an error) so that it properly can detect the
173 dnl gethostbyname_r() version
174 dnl **********************************************************************
175 CURL_DETECT_ICC([CFLAGS="$CFLAGS -we 147"])
177 dnl **********************************************************************
178 dnl platform/compiler/architecture specific checks/flags
179 dnl **********************************************************************
185 dnl find out if icc is being used
186 if test "z$ICC" = "z"; then
190 if test "$ICC" = "yes"; then
191 dnl figure out icc version
192 AC_MSG_CHECKING([icc version])
193 iccver=`$CC -dumpversion`
194 iccnhi=`echo $iccver | cut -d . -f1`
195 iccnlo=`echo $iccver | cut -d . -f2`
196 iccnum=`(expr $iccnhi "*" 100 + $iccnlo) 2>/dev/null`
197 AC_MSG_RESULT($iccver)
199 if test "$iccnum" -ge "900" && test "$iccnum" -lt "1000"; then
201 CFLAGS="$CFLAGS -i-dynamic"
204 if test "$iccnum" -ge "1000"; then
205 dnl icc 10.X or later
206 CFLAGS="$CFLAGS -shared-intel"
214 AC_MSG_CHECKING([whether we are using the IBM C compiler])
215 CURL_CHECK_DEF([__IBMC__], [], [silent])
216 CURL_CHECK_DEF([__IBMCPP__], [], [silent])
217 if test "$curl_cv_have_def___IBMC__" = "yes" ||
218 test "$curl_cv_have_def___IBMCPP__" = "yes"; then
220 dnl Ensure that compiler optimizations are always thread-safe.
221 CFLAGS="$CFLAGS -qthreaded"
222 dnl Disable type based strict aliasing optimizations, using worst
223 dnl case aliasing assumptions when compiling. Type based aliasing
224 dnl would restrict the lvalues that could be safely used to access
226 CFLAGS="$CFLAGS -qnoansialias"
227 dnl Force compiler to stop after the compilation phase, without
228 dnl generating an object code file when compilation has errors.
229 CFLAGS="$CFLAGS -qhalt=e"
234 AC_MSG_CHECKING([whether we are using the DEC/Compaq C compiler])
235 CURL_CHECK_DEF([__DECC], [], [silent])
236 CURL_CHECK_DEF([__DECC_VER], [], [silent])
237 if test "$curl_cv_have_def___DECC" = "yes" ||
238 test "$curl_cv_have_def___DECC_VER" = "yes"; then
240 dnl Select strict ANSI C compiler mode
241 CFLAGS="$CFLAGS -std1"
242 dnl Turn off optimizer ANSI C aliasing rules
243 CFLAGS="$CFLAGS -noansi_alias"
244 dnl Select a higher warning level than default level2
245 CFLAGS="$CFLAGS -msg_enable level3"
246 dnl Generate warnings for missing function prototypes
247 CFLAGS="$CFLAGS -warnprotos"
248 dnl Change some warnings into fatal errors
249 CFLAGS="$CFLAGS -msg_fatal toofewargs,toomanyargs"
254 CURL_CHECK_COMPILER_HALT_ON_ERROR
255 CURL_CHECK_COMPILER_ARRAY_SIZE_NEGATIVE
257 dnl **********************************************************************
258 dnl Compilation based checks should not be done before this point.
259 dnl **********************************************************************
261 dnl **********************************************************************
262 dnl Make sure that our checks for headers windows.h winsock.h winsock2.h
263 dnl and ws2tcpip.h take precedence over any other further checks which
264 dnl could be done later using AC_CHECK_HEADER or AC_CHECK_HEADERS for
265 dnl this specific header files. And do them before its results are used.
266 dnl **********************************************************************
268 CURL_CHECK_HEADER_WINDOWS
269 CURL_CHECK_NATIVE_WINDOWS
270 case X-"$ac_cv_native_windows" in
272 CURL_CHECK_HEADER_WINSOCK
273 CURL_CHECK_HEADER_WINSOCK2
274 CURL_CHECK_HEADER_WS2TCPIP
277 ac_cv_header_winsock_h="no"
278 ac_cv_header_winsock2_h="no"
279 ac_cv_header_ws2tcpip_h="no"
283 dnl **********************************************************************
284 dnl Checks for libraries.
285 dnl **********************************************************************
287 dnl gethostbyname without lib or in the nsl lib?
288 AC_CHECK_FUNC(gethostbyname,
289 [HAVE_GETHOSTBYNAME="1"
291 [ AC_CHECK_LIB(nsl, gethostbyname,
292 [HAVE_GETHOSTBYNAME="1"
297 if test "$HAVE_GETHOSTBYNAME" != "1"
299 dnl gethostbyname in the socket lib?
300 AC_CHECK_LIB(socket, gethostbyname,
301 [HAVE_GETHOSTBYNAME="1"
302 LIBS="$LIBS -lsocket"
306 dnl At least one system has been identified to require BOTH nsl and socket
307 dnl libs at the same time to link properly.
308 if test "$HAVE_GETHOSTBYNAME" != "1"
310 AC_MSG_CHECKING([for gethostbyname with both nsl and socket libs])
311 my_ac_save_LIBS=$LIBS
312 LIBS="-lnsl -lsocket $LIBS"
320 HAVE_GETHOSTBYNAME="1"
323 LIBS=$my_ac_save_LIBS
327 if test "$HAVE_GETHOSTBYNAME" != "1"
329 dnl This is for winsock systems
330 if test "$ac_cv_header_windows_h" = "yes"; then
331 if test "$ac_cv_header_winsock_h" = "yes"; then
334 winsock_LIB="-lwinsock"
337 winsock_LIB="-lwsock32"
341 if test "$ac_cv_header_winsock2_h" = "yes"; then
342 winsock_LIB="-lws2_32"
344 if test ! -z "$winsock_LIB"; then
345 my_ac_save_LIBS=$LIBS
346 LIBS="$winsock_LIB $LIBS"
347 AC_MSG_CHECKING([for gethostbyname in $winsock_LIB])
350 #ifdef HAVE_WINDOWS_H
351 #ifndef WIN32_LEAN_AND_MEAN
352 #define WIN32_LEAN_AND_MEAN
355 #ifdef HAVE_WINSOCK2_H
356 #include <winsock2.h>
358 #ifdef HAVE_WINSOCK_H
364 gethostbyname("www.dummysite.com");
368 HAVE_GETHOSTBYNAME="1"
372 LIBS=$my_ac_save_LIBS
378 if test "$HAVE_GETHOSTBYNAME" != "1"
380 dnl This is for Minix 3.1
381 AC_MSG_CHECKING([for gethostbyname for Minix 3])
384 /* Older Minix versions may need <net/gen/netdb.h> here instead */
387 gethostbyname("www.dummysite.com");
391 HAVE_GETHOSTBYNAME="1"
397 if test "$HAVE_GETHOSTBYNAME" != "1"
399 dnl This is for eCos with a stubbed DNS implementation
400 AC_MSG_CHECKING([for gethostbyname for eCos])
406 gethostbyname("www.dummysite.com");
410 HAVE_GETHOSTBYNAME="1"
416 if test "$HAVE_GETHOSTBYNAME" != "1"
418 dnl gethostbyname in the net lib - for BeOS
419 AC_CHECK_LIB(net, gethostbyname,
420 [HAVE_GETHOSTBYNAME="1"
426 if test "$HAVE_GETHOSTBYNAME" = "1"; then
427 AC_DEFINE(HAVE_GETHOSTBYNAME, 1, [If you have gethostbyname])
429 AC_MSG_ERROR([couldn't find libraries for gethostbyname()])
433 AC_CHECK_FUNC(strcasecmp, , [ AC_CHECK_LIB(resolve, strcasecmp) ])
435 if test "$ac_cv_lib_resolve_strcasecmp" = "$ac_cv_func_strcasecmp"; then
436 AC_CHECK_LIB(resolve, strcasecmp,
437 [LIBS="-lresolve $LIBS"],
443 AC_CHECK_FUNC(connect, , [ AC_CHECK_LIB(socket, connect) ])
445 dnl **********************************************************************
446 dnl In case that function clock_gettime with monotonic timer is available,
447 dnl check for additional required libraries.
448 dnl **********************************************************************
449 CURL_CHECK_LIBS_CLOCK_GETTIME_MONOTONIC
451 AC_MSG_CHECKING([whether to use libgcc])
452 AC_ARG_ENABLE(libgcc,
453 AC_HELP_STRING([--enable-libgcc],[use libgcc when linking]),
454 [ case "$enableval" in
466 dnl Default is to try the thread-safe versions of a few functions
469 dnl detect AIX 4.3 or later
470 AC_MSG_CHECKING([AIX 4.3 or later])
472 #if defined(_AIX) && defined(_AIX43)
475 #error "this is not AIX 4.3 or later"
478 [ AC_MSG_RESULT([yes])
481 [ AC_MSG_RESULT([no]) ]
484 AC_ARG_ENABLE(thread,dnl
485 AC_HELP_STRING([--disable-thread],[don't look for thread-safe functions])
486 AC_HELP_STRING([--enable-thread],[look for thread-safe functions]),
487 [ case "$enableval" in
490 AC_MSG_WARN(c-ares will not get built using thread-safe functions)
498 if test X"$OPT_THREAD" = Xoff
500 AC_DEFINE(DISABLED_THREADSAFE, 1,
501 [Set to explicitly specify we don't want to use thread-safe functions])
504 dnl for recent AIX versions, we skip all the thread-safe checks above since
505 dnl they claim a thread-safe libc using the standard API. But there are
506 dnl some functions still not thread-safe. Check for these!
508 dnl Let's hope this split URL remains working:
509 dnl http://publibn.boulder.ibm.com/doc_link/en_US/a_doc_lib/aixprggd/ \
510 dnl genprogc/thread_quick_ref.htm
512 if test "x$RECENTAIX" = "xyes"; then
514 AC_DEFINE(_THREAD_SAFE, 1, [define this if you need it to compile thread-safe code])
519 dnl **********************************************************************
520 dnl Back to "normal" configuring
521 dnl **********************************************************************
523 dnl Checks for header files.
526 CURL_CHECK_HEADER_MALLOC
528 dnl check for a few basic system headers we need
545 arpa/nameser_compat.h \
547 dnl to do if not found
553 #ifdef HAVE_SYS_TYPES_H
554 #include <sys/types.h>
556 #ifdef HAVE_SYS_TIME_H
557 #include <sys/time.h>
559 dnl We do this default-include simply to make sure that the nameser_compat.h
560 dnl header *REALLY* can be include after the new nameser.h. It seems AIX 5.1
561 dnl (and others?) is not designed to allow this.
562 #ifdef HAVE_ARPA_NAMESER_H
563 #include <arpa/nameser.h>
566 dnl *Sigh* these are needed in order for net/if.h to get properly detected.
567 #ifdef HAVE_SYS_SOCKET_H
568 #include <sys/socket.h>
570 #ifdef HAVE_NETINET_IN_H
571 #include <netinet/in.h>
576 dnl Checks for typedefs, structures, and compiler characteristics.
580 CURL_CHECK_STRUCT_TIMEVAL
582 AC_CHECK_SIZEOF(size_t)
583 AC_CHECK_SIZEOF(long)
584 AC_CHECK_SIZEOF(time_t)
586 AC_CHECK_TYPE(long long,
587 [AC_DEFINE(HAVE_LONGLONG, 1, [if your compiler supports long long])]
591 if test "xyes" = "x$longlong"; then
592 AC_MSG_CHECKING([if numberLL works])
593 AC_COMPILE_IFELSE([long long val = 1000LL;],
594 [AC_DEFINE(HAVE_LL, 1, [if your compiler supports LL])]
602 AC_CHECK_TYPE(ssize_t, ,
603 AC_DEFINE(ssize_t, int, [the signed version of size_t]))
605 # check for bool type
606 AC_CHECK_TYPE([bool],[
607 AC_DEFINE(HAVE_BOOL_T, 1,
608 [Define to 1 if bool is an available type.])
610 #ifdef HAVE_SYS_TYPES_H
611 #include <sys/types.h>
613 #ifdef HAVE_STDBOOL_H
618 # Check for socklen_t or equivalent
619 CURL_CHECK_TYPE_SOCKLEN_T
623 TYPE_SOCKADDR_STORAGE
630 CURL_CHECK_FUNC_RECVFROM
632 CURL_CHECK_MSG_NOSIGNAL
634 dnl check for AF_INET6
635 CARES_CHECK_CONSTANT(
638 #ifdef HAVE_WINDOWS_H
639 #ifndef WIN32_LEAN_AND_MEAN
640 #define WIN32_LEAN_AND_MEAN
643 #ifdef HAVE_WINSOCK2_H
644 #include <winsock2.h>
647 #ifdef HAVE_SYS_TYPES_H
648 #include <sys/types.h>
650 #ifdef HAVE_SYS_SOCKET_H
651 #include <sys/socket.h>
655 AC_DEFINE_UNQUOTED(HAVE_PF_INET6,1,[Define to 1 if you have PF_INET6.])
658 dnl check for PF_INET6
659 CARES_CHECK_CONSTANT(
662 #ifdef HAVE_WINDOWS_H
663 #ifndef WIN32_LEAN_AND_MEAN
664 #define WIN32_LEAN_AND_MEAN
667 #ifdef HAVE_WINSOCK2_H
668 #include <winsock2.h>
671 #ifdef HAVE_SYS_TYPES_H
672 #include <sys/types.h>
674 #ifdef HAVE_SYS_SOCKET_H
675 #include <sys/socket.h>
679 AC_DEFINE_UNQUOTED(HAVE_AF_INET6,1,[Define to 1 if you have AF_INET6.])
683 dnl check for the in6_addr structure
687 #ifdef HAVE_WINDOWS_H
688 #ifndef WIN32_LEAN_AND_MEAN
689 #define WIN32_LEAN_AND_MEAN
692 #ifdef HAVE_WINSOCK2_H
693 #include <winsock2.h>
694 #ifdef HAVE_WS2TCPIP_H
695 #include <ws2tcpip.h>
699 #ifdef HAVE_SYS_TYPES_H
700 #include <sys/types.h>
702 #ifdef HAVE_NETINET_IN_H
703 #include <netinet/in.h>
707 AC_DEFINE_UNQUOTED(HAVE_STRUCT_IN6_ADDR,1,[Define to 1 if you have struct in6_addr.])
710 dnl check for the sockaddr_in6 structure
714 #ifdef HAVE_WINDOWS_H
715 #ifndef WIN32_LEAN_AND_MEAN
716 #define WIN32_LEAN_AND_MEAN
719 #ifdef HAVE_WINSOCK2_H
720 #include <winsock2.h>
721 #ifdef HAVE_WS2TCPIP_H
722 #include <ws2tcpip.h>
726 #ifdef HAVE_SYS_TYPES_H
727 #include <sys/types.h>
729 #ifdef HAVE_NETINET_IN_H
730 #include <netinet/in.h>
734 AC_DEFINE_UNQUOTED(HAVE_STRUCT_SOCKADDR_IN6,1,
735 [Define to 1 if you have struct sockaddr_in6.]) ac_have_sockaddr_in6=yes
738 AC_CHECK_MEMBER(struct sockaddr_in6.sin6_scope_id,
739 AC_DEFINE_UNQUOTED(HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID,1,
740 [Define to 1 if your struct sockaddr_in6 has sin6_scope_id.])
744 #ifdef HAVE_WINDOWS_H
745 #ifndef WIN32_LEAN_AND_MEAN
746 #define WIN32_LEAN_AND_MEAN
749 #ifdef HAVE_WINSOCK2_H
750 #include <winsock2.h>
751 #ifdef HAVE_WS2TCPIP_H
752 #include <ws2tcpip.h>
756 #ifdef HAVE_SYS_TYPES_H
757 #include <sys/types.h>
759 #ifdef HAVE_NETINET_IN_H
760 #include <netinet/in.h>
765 dnl check for the addrinfo structure
766 AC_CHECK_MEMBER(struct addrinfo.ai_flags,
767 AC_DEFINE_UNQUOTED(HAVE_STRUCT_ADDRINFO,1,
768 [Define to 1 if you have struct addrinfo.]),,
771 #ifdef HAVE_WINDOWS_H
772 #ifndef WIN32_LEAN_AND_MEAN
773 #define WIN32_LEAN_AND_MEAN
776 #ifdef HAVE_WINSOCK2_H
777 #include <winsock2.h>
778 #ifdef HAVE_WS2TCPIP_H
779 #include <ws2tcpip.h>
783 #ifdef HAVE_SYS_TYPES_H
784 #include <sys/types.h>
786 #ifdef HAVE_NETINET_IN_H
787 #include <netinet/in.h>
789 #ifdef HAVE_SYS_SOCKET_H
790 #include <sys/socket.h>
800 AC_CHECK_FUNCS([bitncmp \
806 AC_MSG_CHECKING([deeper for $func])
814 eval "ac_cv_func_$func=yes"
815 AC_DEFINE_UNQUOTED([AS_TR_CPP([HAVE_$func])], [1],
816 [Define to 1 if you have the $func function.])
818 AC_MSG_RESULT([but still no])
823 dnl check for inet_pton
824 AC_CHECK_FUNCS(inet_pton)
825 dnl Some systems have it, but not IPv6
826 if test "$ac_cv_func_inet_pton" = "yes" ; then
827 AC_MSG_CHECKING(if inet_pton supports IPv6)
830 #ifdef HAVE_SYS_TYPES_H
831 #include <sys/types.h>
833 #ifdef HAVE_SYS_SOCKET_H
834 #include <sys/socket.h>
836 #ifdef HAVE_NETINET_IN_H
837 #include <netinet/in.h>
841 struct in6_addr addr6;
842 if (inet_pton(AF_INET6, "::1", &addr6) < 1)
849 AC_DEFINE_UNQUOTED(HAVE_INET_PTON_IPV6,1,[Define to 1 if inet_pton supports IPv6.])
850 ], AC_MSG_RESULT(no),AC_MSG_RESULT(no))
852 dnl Check for inet_net_pton
853 AC_CHECK_FUNCS(inet_net_pton)
854 dnl Again, some systems have it, but not IPv6
855 if test "$ac_cv_func_inet_net_pton" = "yes" ; then
856 AC_MSG_CHECKING(if inet_net_pton supports IPv6)
859 #ifdef HAVE_SYS_TYPES_H
860 #include <sys/types.h>
862 #ifdef HAVE_SYS_SOCKET_H
863 #include <sys/socket.h>
865 #ifdef HAVE_NETINET_IN_H
866 #include <netinet/in.h>
870 struct in6_addr addr6;
871 if (inet_net_pton(AF_INET6, "::1", &addr6, sizeof(addr6)) < 1)
878 AC_DEFINE_UNQUOTED(HAVE_INET_NET_PTON_IPV6,1,[Define to 1 if inet_net_pton supports IPv6.])
879 ], AC_MSG_RESULT(no),AC_MSG_RESULT(no))
883 dnl Check for inet_ntop
884 AC_CHECK_FUNCS(inet_ntop)
885 dnl Again, some systems have it, but not IPv6
886 if test "$ac_cv_func_inet_ntop" = "yes" ; then
887 AC_MSG_CHECKING(if inet_ntop supports IPv6)
890 #ifdef HAVE_SYS_TYPES_H
891 #include <sys/types.h>
893 #ifdef HAVE_SYS_SOCKET_H
894 #include <sys/socket.h>
896 #ifdef HAVE_NETINET_IN_H
897 #include <netinet/in.h>
902 struct in6_addr addr6;
904 if (inet_ntop(AF_INET6, &addr6, buf, 128) == 0 && errno == EAFNOSUPPORT)
911 AC_DEFINE_UNQUOTED(HAVE_INET_NTOP_IPV6,1,
912 [Define to 1 if inet_ntop supports IPv6.])
913 ], AC_MSG_RESULT(no),AC_MSG_RESULT(no))
916 AC_CHECK_SIZEOF(struct in6_addr, ,
919 #ifdef HAVE_WINDOWS_H
920 #ifndef WIN32_LEAN_AND_MEAN
921 #define WIN32_LEAN_AND_MEAN
924 #ifdef HAVE_WINSOCK2_H
925 #include <winsock2.h>
926 #ifdef HAVE_WS2TCPIP_H
927 #include <ws2tcpip.h>
931 #ifdef HAVE_SYS_TYPES_H
932 #include <sys/types.h>
934 #ifdef HAVE_SYS_SOCKET_H
935 #include <sys/socket.h>
937 #ifdef HAVE_NETINET_IN_H
938 #include <netinet/in.h>
944 AC_CHECK_SIZEOF(struct in_addr, ,
947 #ifdef HAVE_WINDOWS_H
948 #ifndef WIN32_LEAN_AND_MEAN
949 #define WIN32_LEAN_AND_MEAN
952 #ifdef HAVE_WINSOCK2_H
953 #include <winsock2.h>
954 #ifdef HAVE_WS2TCPIP_H
955 #include <ws2tcpip.h>
959 #ifdef HAVE_SYS_TYPES_H
960 #include <sys/types.h>
962 #ifdef HAVE_SYS_SOCKET_H
963 #include <sys/socket.h>
965 #ifdef HAVE_NETINET_IN_H
966 #include <netinet/in.h>
973 dnl Check if the getnameinfo function is available
974 dnl and get the types of five of its arguments.
975 CURL_CHECK_FUNC_GETNAMEINFO
978 dnl God bless non-standardized functions! We need to see which getservbyport_r
979 dnl variant is available
980 CARES_CHECK_GETSERVBYPORT_R
982 CURL_CHECK_NONBLOCKING_SOCKET
985 [AC_DEFINE(ARES_BIG_ENDIAN, 1,
986 [define this if ares is built for a big endian system])],
988 [AC_MSG_WARN([couldn't figure out endianess, assuming little endian!])]
991 dnl Check for user-specified random device
993 AC_HELP_STRING([--with-random=FILE],
994 [read randomness from FILE (default=/dev/urandom)]),
995 [ RANDOM_FILE="$withval" ],
997 dnl Check for random device. If we're cross compiling, we can't
998 dnl check, and it's better to assume it doesn't exist than it is
999 dnl to fail on AC_CHECK_FILE or later.
1000 if test "$cross_compiling" = "no"; then
1001 AC_CHECK_FILE("/dev/urandom", [ RANDOM_FILE="/dev/urandom"] )
1003 AC_MSG_WARN([cannot check for /dev/urandom while cross compiling; assuming none])
1008 if test -n "$RANDOM_FILE" && test X"$RANDOM_FILE" != Xno ; then
1009 AC_SUBST(RANDOM_FILE)
1010 AC_DEFINE_UNQUOTED(RANDOM_FILE, "$RANDOM_FILE",
1011 [a suitable file/device to read random data from])
1014 CARES_PRIVATE_LIBS="$LIBS"
1015 AC_SUBST(CARES_PRIVATE_LIBS)
1017 AC_CONFIG_FILES([Makefile libcares.pc])