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 platform/compiler/architecture specific checks/flags
172 dnl **********************************************************************
178 dnl find out if icc is being used
179 if test "z$ICC" = "z"; then
183 if test "$ICC" = "yes"; then
184 dnl figure out icc version
185 AC_MSG_CHECKING([icc version])
186 iccver=`$CC -dumpversion`
187 iccnhi=`echo $iccver | cut -d . -f1`
188 iccnlo=`echo $iccver | cut -d . -f2`
189 iccnum=`(expr $iccnhi "*" 100 + $iccnlo) 2>/dev/null`
190 AC_MSG_RESULT($iccver)
192 if test "$iccnum" -ge "900" && test "$iccnum" -lt "1000"; then
194 CFLAGS="$CFLAGS -i-dynamic"
197 if test "$iccnum" -ge "1000"; then
198 dnl icc 10.X or later
199 CFLAGS="$CFLAGS -shared-intel"
207 AC_MSG_CHECKING([whether we are using the IBM C compiler])
208 CURL_CHECK_DEF([__IBMC__], [], [silent])
209 if test "$curl_cv_have_def___IBMC__" = "yes"; then
211 dnl Ensure that compiler optimizations are always thread-safe.
212 CFLAGS="$CFLAGS -qthreaded"
213 dnl Disable type based strict aliasing optimizations, using worst
214 dnl case aliasing assumptions when compiling. Type based aliasing
215 dnl would restrict the lvalues that could be safely used to access
217 CFLAGS="$CFLAGS -qnoansialias"
218 dnl Force compiler to stop after the compilation phase, without
219 dnl generating an object code file when compilation has errors.
220 CFLAGS="$CFLAGS -qhalt=e"
225 AC_MSG_CHECKING([whether we are using the Intel C compiler])
226 CURL_CHECK_DEF([__INTEL_COMPILER], [], [silent])
227 if test "$curl_cv_have_def___INTEL_COMPILER" = "yes"; then
229 dnl Select strict ANSI C conformance
230 CPPFLAGS="$CPPFLAGS -strict-ansi"
231 dnl Select ANSI C dialect
232 CPPFLAGS="$CPPFLAGS -std=c89 -D__STRICT_ANSI__"
233 dnl Change some warnings into errors
234 dnl #140: too many arguments in function call
235 dnl #147: declaration is incompatible with 'previous one'
236 dnl #165: too few arguments in function call
237 dnl #266: function declared implicitly
238 CPPFLAGS="$CPPFLAGS -we 140,147,165,266"
239 dnl Disable use of ANSI C aliasing rules in optimizations
240 CFLAGS="$CFLAGS -no-ansi-alias"
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 Turn off optimizer ANSI C aliasing rules
254 CFLAGS="$CFLAGS -noansi_alias"
255 dnl Select a higher warning level than default level2
256 CFLAGS="$CFLAGS -msg_enable level3"
257 dnl Generate warnings for missing function prototypes
258 CFLAGS="$CFLAGS -warnprotos"
259 dnl Change some warnings into fatal errors
260 CFLAGS="$CFLAGS -msg_fatal toofewargs,toomanyargs"
265 CURL_CHECK_COMPILER_HALT_ON_ERROR
266 CURL_CHECK_COMPILER_ARRAY_SIZE_NEGATIVE
268 dnl **********************************************************************
269 dnl Compilation based checks should not be done before this point.
270 dnl **********************************************************************
272 dnl **********************************************************************
273 dnl Make sure that our checks for headers windows.h winsock.h winsock2.h
274 dnl and ws2tcpip.h take precedence over any other further checks which
275 dnl could be done later using AC_CHECK_HEADER or AC_CHECK_HEADERS for
276 dnl this specific header files. And do them before its results are used.
277 dnl **********************************************************************
279 CURL_CHECK_HEADER_WINDOWS
280 CURL_CHECK_NATIVE_WINDOWS
281 case X-"$ac_cv_native_windows" in
283 CURL_CHECK_HEADER_WINSOCK
284 CURL_CHECK_HEADER_WINSOCK2
285 CURL_CHECK_HEADER_WS2TCPIP
288 ac_cv_header_winsock_h="no"
289 ac_cv_header_winsock2_h="no"
290 ac_cv_header_ws2tcpip_h="no"
294 dnl **********************************************************************
295 dnl Checks for libraries.
296 dnl **********************************************************************
298 dnl gethostbyname without lib or in the nsl lib?
299 AC_CHECK_FUNC(gethostbyname,
300 [HAVE_GETHOSTBYNAME="1"
302 [ AC_CHECK_LIB(nsl, gethostbyname,
303 [HAVE_GETHOSTBYNAME="1"
308 if test "$HAVE_GETHOSTBYNAME" != "1"
310 dnl gethostbyname in the socket lib?
311 AC_CHECK_LIB(socket, gethostbyname,
312 [HAVE_GETHOSTBYNAME="1"
313 LIBS="$LIBS -lsocket"
317 dnl At least one system has been identified to require BOTH nsl and socket
318 dnl libs at the same time to link properly.
319 if test "$HAVE_GETHOSTBYNAME" != "1"
321 AC_MSG_CHECKING([for gethostbyname with both nsl and socket libs])
322 my_ac_save_LIBS=$LIBS
323 LIBS="-lnsl -lsocket $LIBS"
331 HAVE_GETHOSTBYNAME="1"
334 LIBS=$my_ac_save_LIBS
338 if test "$HAVE_GETHOSTBYNAME" != "1"
340 dnl This is for winsock systems
341 if test "$ac_cv_header_windows_h" = "yes"; then
342 if test "$ac_cv_header_winsock_h" = "yes"; then
345 winsock_LIB="-lwinsock"
348 winsock_LIB="-lwsock32"
352 if test "$ac_cv_header_winsock2_h" = "yes"; then
353 winsock_LIB="-lws2_32"
355 if test ! -z "$winsock_LIB"; then
356 my_ac_save_LIBS=$LIBS
357 LIBS="$winsock_LIB $LIBS"
358 AC_MSG_CHECKING([for gethostbyname in $winsock_LIB])
361 #ifdef HAVE_WINDOWS_H
362 #ifndef WIN32_LEAN_AND_MEAN
363 #define WIN32_LEAN_AND_MEAN
366 #ifdef HAVE_WINSOCK2_H
367 #include <winsock2.h>
369 #ifdef HAVE_WINSOCK_H
375 gethostbyname("www.dummysite.com");
379 HAVE_GETHOSTBYNAME="1"
383 LIBS=$my_ac_save_LIBS
389 if test "$HAVE_GETHOSTBYNAME" != "1"
391 dnl This is for Minix 3.1
392 AC_MSG_CHECKING([for gethostbyname for Minix 3])
395 /* Older Minix versions may need <net/gen/netdb.h> here instead */
398 gethostbyname("www.dummysite.com");
402 HAVE_GETHOSTBYNAME="1"
408 if test "$HAVE_GETHOSTBYNAME" != "1"
410 dnl This is for eCos with a stubbed DNS implementation
411 AC_MSG_CHECKING([for gethostbyname for eCos])
417 gethostbyname("www.dummysite.com");
421 HAVE_GETHOSTBYNAME="1"
427 if test "$HAVE_GETHOSTBYNAME" != "1"
429 dnl gethostbyname in the net lib - for BeOS
430 AC_CHECK_LIB(net, gethostbyname,
431 [HAVE_GETHOSTBYNAME="1"
437 if test "$HAVE_GETHOSTBYNAME" = "1"; then
438 AC_DEFINE(HAVE_GETHOSTBYNAME, 1, [If you have gethostbyname])
440 AC_MSG_ERROR([couldn't find libraries for gethostbyname()])
444 AC_CHECK_FUNC(strcasecmp, , [ AC_CHECK_LIB(resolve, strcasecmp) ])
446 if test "$ac_cv_lib_resolve_strcasecmp" = "$ac_cv_func_strcasecmp"; then
447 AC_CHECK_LIB(resolve, strcasecmp,
448 [LIBS="-lresolve $LIBS"],
452 ac_cv_func_strcasecmp="no"
455 AC_CHECK_FUNC(connect, , [ AC_CHECK_LIB(socket, connect) ])
457 dnl **********************************************************************
458 dnl In case that function clock_gettime with monotonic timer is available,
459 dnl check for additional required libraries.
460 dnl **********************************************************************
461 CURL_CHECK_LIBS_CLOCK_GETTIME_MONOTONIC
463 AC_MSG_CHECKING([whether to use libgcc])
464 AC_ARG_ENABLE(libgcc,
465 AC_HELP_STRING([--enable-libgcc],[use libgcc when linking]),
466 [ case "$enableval" in
478 dnl Default is to try the thread-safe versions of a few functions
481 dnl detect AIX 4.3 or later
482 AC_MSG_CHECKING([AIX 4.3 or later])
484 #if defined(_AIX) && defined(_AIX43)
487 #error "this is not AIX 4.3 or later"
490 [ AC_MSG_RESULT([yes])
493 [ AC_MSG_RESULT([no]) ]
496 AC_ARG_ENABLE(thread,dnl
497 AC_HELP_STRING([--disable-thread],[don't look for thread-safe functions])
498 AC_HELP_STRING([--enable-thread],[look for thread-safe functions]),
499 [ case "$enableval" in
502 AC_MSG_WARN(c-ares will not get built using thread-safe functions)
510 if test X"$OPT_THREAD" = Xoff
512 AC_DEFINE(DISABLED_THREADSAFE, 1,
513 [Set to explicitly specify we don't want to use thread-safe functions])
516 dnl for recent AIX versions, we skip all the thread-safe checks above since
517 dnl they claim a thread-safe libc using the standard API. But there are
518 dnl some functions still not thread-safe. Check for these!
520 dnl Let's hope this split URL remains working:
521 dnl http://publibn.boulder.ibm.com/doc_link/en_US/a_doc_lib/aixprggd/ \
522 dnl genprogc/thread_quick_ref.htm
524 if test "x$RECENTAIX" = "xyes"; then
526 AC_DEFINE(_THREAD_SAFE, 1, [define this if you need it to compile thread-safe code])
531 dnl **********************************************************************
532 dnl Back to "normal" configuring
533 dnl **********************************************************************
535 dnl Checks for header files.
538 CURL_CHECK_HEADER_MALLOC
540 dnl check for a few basic system headers we need
558 arpa/nameser_compat.h \
560 dnl to do if not found
566 #ifdef HAVE_SYS_TYPES_H
567 #include <sys/types.h>
569 #ifdef HAVE_SYS_TIME_H
570 #include <sys/time.h>
572 dnl We do this default-include simply to make sure that the nameser_compat.h
573 dnl header *REALLY* can be include after the new nameser.h. It seems AIX 5.1
574 dnl (and others?) is not designed to allow this.
575 #ifdef HAVE_ARPA_NAMESER_H
576 #include <arpa/nameser.h>
579 dnl *Sigh* these are needed in order for net/if.h to get properly detected.
580 #ifdef HAVE_SYS_SOCKET_H
581 #include <sys/socket.h>
583 #ifdef HAVE_NETINET_IN_H
584 #include <netinet/in.h>
589 dnl Checks for typedefs, structures, and compiler characteristics.
593 CURL_CHECK_STRUCT_TIMEVAL
595 AC_CHECK_SIZEOF(size_t)
596 AC_CHECK_SIZEOF(long)
597 AC_CHECK_SIZEOF(time_t)
599 AC_CHECK_TYPE(long long,
600 [AC_DEFINE(HAVE_LONGLONG, 1,
601 [Define to 1 if the compiler supports the 'long long' data type.])]
605 if test "xyes" = "x$longlong"; then
606 AC_MSG_CHECKING([if numberLL works])
607 AC_COMPILE_IFELSE([long long val = 1000LL;],
608 [AC_DEFINE(HAVE_LL, 1, [if your compiler supports LL])]
616 AC_CHECK_TYPE(ssize_t, ,
617 AC_DEFINE(ssize_t, int, [the signed version of size_t]))
619 # check for bool type
620 AC_CHECK_TYPE([bool],[
621 AC_DEFINE(HAVE_BOOL_T, 1,
622 [Define to 1 if bool is an available type.])
624 #ifdef HAVE_SYS_TYPES_H
625 #include <sys/types.h>
627 #ifdef HAVE_STDBOOL_H
632 # Check for socklen_t or equivalent
633 CURL_CHECK_TYPE_SOCKLEN_T
637 TYPE_SOCKADDR_STORAGE
644 CURL_CHECK_FUNC_RECVFROM
646 CURL_CHECK_MSG_NOSIGNAL
648 CARES_CHECK_FUNC_STRCASECMP
649 CARES_CHECK_FUNC_STRCMPI
650 CARES_CHECK_FUNC_STRDUP
651 CARES_CHECK_FUNC_STRICMP
652 CARES_CHECK_FUNC_STRNCASECMP
653 CARES_CHECK_FUNC_STRNCMPI
654 CARES_CHECK_FUNC_STRNICMP
655 CARES_CHECK_FUNC_WRITEV
658 dnl check for AF_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_PF_INET6,1,[Define to 1 if you have PF_INET6.])
682 dnl check for PF_INET6
683 CARES_CHECK_CONSTANT(
686 #ifdef HAVE_WINDOWS_H
687 #ifndef WIN32_LEAN_AND_MEAN
688 #define WIN32_LEAN_AND_MEAN
691 #ifdef HAVE_WINSOCK2_H
692 #include <winsock2.h>
695 #ifdef HAVE_SYS_TYPES_H
696 #include <sys/types.h>
698 #ifdef HAVE_SYS_SOCKET_H
699 #include <sys/socket.h>
703 AC_DEFINE_UNQUOTED(HAVE_AF_INET6,1,[Define to 1 if you have AF_INET6.])
707 dnl check for the in6_addr 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_IN6_ADDR,1,[Define to 1 if you have struct in6_addr.])
734 dnl check for the sockaddr_in6 structure
738 #ifdef HAVE_WINDOWS_H
739 #ifndef WIN32_LEAN_AND_MEAN
740 #define WIN32_LEAN_AND_MEAN
743 #ifdef HAVE_WINSOCK2_H
744 #include <winsock2.h>
745 #ifdef HAVE_WS2TCPIP_H
746 #include <ws2tcpip.h>
750 #ifdef HAVE_SYS_TYPES_H
751 #include <sys/types.h>
753 #ifdef HAVE_NETINET_IN_H
754 #include <netinet/in.h>
758 AC_DEFINE_UNQUOTED(HAVE_STRUCT_SOCKADDR_IN6,1,
759 [Define to 1 if you have struct sockaddr_in6.]) ac_have_sockaddr_in6=yes
762 AC_CHECK_MEMBER(struct sockaddr_in6.sin6_scope_id,
763 AC_DEFINE_UNQUOTED(HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID,1,
764 [Define to 1 if your struct sockaddr_in6 has sin6_scope_id.])
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>
789 dnl check for the addrinfo structure
790 AC_CHECK_MEMBER(struct addrinfo.ai_flags,
791 AC_DEFINE_UNQUOTED(HAVE_STRUCT_ADDRINFO,1,
792 [Define to 1 if you have struct addrinfo.]),,
795 #ifdef HAVE_WINDOWS_H
796 #ifndef WIN32_LEAN_AND_MEAN
797 #define WIN32_LEAN_AND_MEAN
800 #ifdef HAVE_WINSOCK2_H
801 #include <winsock2.h>
802 #ifdef HAVE_WS2TCPIP_H
803 #include <ws2tcpip.h>
807 #ifdef HAVE_SYS_TYPES_H
808 #include <sys/types.h>
810 #ifdef HAVE_NETINET_IN_H
811 #include <netinet/in.h>
813 #ifdef HAVE_SYS_SOCKET_H
814 #include <sys/socket.h>
824 AC_CHECK_FUNCS([bitncmp \
830 AC_MSG_CHECKING([deeper for $func])
838 eval "ac_cv_func_$func=yes"
839 AC_DEFINE_UNQUOTED([AS_TR_CPP([HAVE_$func])], [1],
840 [Define to 1 if you have the $func function.])
842 AC_MSG_RESULT([but still no])
847 dnl check for inet_pton
848 AC_CHECK_FUNCS(inet_pton)
849 dnl Some systems have it, but not IPv6
850 if test "$ac_cv_func_inet_pton" = "yes" ; then
851 AC_MSG_CHECKING(if inet_pton supports IPv6)
854 #ifdef HAVE_SYS_TYPES_H
855 #include <sys/types.h>
857 #ifdef HAVE_SYS_SOCKET_H
858 #include <sys/socket.h>
860 #ifdef HAVE_NETINET_IN_H
861 #include <netinet/in.h>
865 struct in6_addr addr6;
866 if (inet_pton(AF_INET6, "::1", &addr6) < 1)
873 AC_DEFINE_UNQUOTED(HAVE_INET_PTON_IPV6,1,[Define to 1 if inet_pton supports IPv6.])
874 ], AC_MSG_RESULT(no),AC_MSG_RESULT(no))
876 dnl Check for inet_net_pton
877 AC_CHECK_FUNCS(inet_net_pton)
878 dnl Again, some systems have it, but not IPv6
879 if test "$ac_cv_func_inet_net_pton" = "yes" ; then
880 AC_MSG_CHECKING(if inet_net_pton supports IPv6)
883 #ifdef HAVE_SYS_TYPES_H
884 #include <sys/types.h>
886 #ifdef HAVE_SYS_SOCKET_H
887 #include <sys/socket.h>
889 #ifdef HAVE_NETINET_IN_H
890 #include <netinet/in.h>
894 struct in6_addr addr6;
895 if (inet_net_pton(AF_INET6, "::1", &addr6, sizeof(addr6)) < 1)
902 AC_DEFINE_UNQUOTED(HAVE_INET_NET_PTON_IPV6,1,[Define to 1 if inet_net_pton supports IPv6.])
903 ], AC_MSG_RESULT(no),AC_MSG_RESULT(no))
907 dnl Check for inet_ntop
908 AC_CHECK_FUNCS(inet_ntop)
909 dnl Again, some systems have it, but not IPv6
910 if test "$ac_cv_func_inet_ntop" = "yes" ; then
911 AC_MSG_CHECKING(if inet_ntop supports IPv6)
914 #ifdef HAVE_SYS_TYPES_H
915 #include <sys/types.h>
917 #ifdef HAVE_SYS_SOCKET_H
918 #include <sys/socket.h>
920 #ifdef HAVE_NETINET_IN_H
921 #include <netinet/in.h>
926 struct in6_addr addr6;
928 if (inet_ntop(AF_INET6, &addr6, buf, 128) == 0 && errno == EAFNOSUPPORT)
935 AC_DEFINE_UNQUOTED(HAVE_INET_NTOP_IPV6,1,
936 [Define to 1 if inet_ntop supports IPv6.])
937 ], AC_MSG_RESULT(no),AC_MSG_RESULT(no))
940 AC_CHECK_SIZEOF(struct in6_addr, ,
943 #ifdef HAVE_WINDOWS_H
944 #ifndef WIN32_LEAN_AND_MEAN
945 #define WIN32_LEAN_AND_MEAN
948 #ifdef HAVE_WINSOCK2_H
949 #include <winsock2.h>
950 #ifdef HAVE_WS2TCPIP_H
951 #include <ws2tcpip.h>
955 #ifdef HAVE_SYS_TYPES_H
956 #include <sys/types.h>
958 #ifdef HAVE_SYS_SOCKET_H
959 #include <sys/socket.h>
961 #ifdef HAVE_NETINET_IN_H
962 #include <netinet/in.h>
968 AC_CHECK_SIZEOF(struct in_addr, ,
971 #ifdef HAVE_WINDOWS_H
972 #ifndef WIN32_LEAN_AND_MEAN
973 #define WIN32_LEAN_AND_MEAN
976 #ifdef HAVE_WINSOCK2_H
977 #include <winsock2.h>
978 #ifdef HAVE_WS2TCPIP_H
979 #include <ws2tcpip.h>
983 #ifdef HAVE_SYS_TYPES_H
984 #include <sys/types.h>
986 #ifdef HAVE_SYS_SOCKET_H
987 #include <sys/socket.h>
989 #ifdef HAVE_NETINET_IN_H
990 #include <netinet/in.h>
997 dnl Check if the getnameinfo function is available
998 dnl and get the types of five of its arguments.
999 CURL_CHECK_FUNC_GETNAMEINFO
1002 dnl God bless non-standardized functions! We need to see which getservbyport_r
1003 dnl variant is available
1004 CARES_CHECK_GETSERVBYPORT_R
1006 CURL_CHECK_NONBLOCKING_SOCKET
1009 [AC_DEFINE(ARES_BIG_ENDIAN, 1,
1010 [define this if ares is built for a big endian system])],
1012 [AC_MSG_WARN([couldn't figure out endianess, assuming little endian!])]
1015 dnl Check for user-specified random device
1017 AC_HELP_STRING([--with-random=FILE],
1018 [read randomness from FILE (default=/dev/urandom)]),
1019 [ RANDOM_FILE="$withval" ],
1021 dnl Check for random device. If we're cross compiling, we can't
1022 dnl check, and it's better to assume it doesn't exist than it is
1023 dnl to fail on AC_CHECK_FILE or later.
1024 if test "$cross_compiling" = "no"; then
1025 AC_CHECK_FILE("/dev/urandom", [ RANDOM_FILE="/dev/urandom"] )
1027 AC_MSG_WARN([cannot check for /dev/urandom while cross compiling; assuming none])
1032 if test -n "$RANDOM_FILE" && test X"$RANDOM_FILE" != Xno ; then
1033 AC_SUBST(RANDOM_FILE)
1034 AC_DEFINE_UNQUOTED(RANDOM_FILE, "$RANDOM_FILE",
1035 [a suitable file/device to read random data from])
1038 CARES_PRIVATE_LIBS="$LIBS"
1039 AC_SUBST(CARES_PRIVATE_LIBS)
1041 AC_CONFIG_FILES([Makefile libcares.pc])