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 On Linux this compiler uses gcc's header files, so
230 dnl we select ANSI C89 dialect plus GNU extensions.
231 CPPFLAGS="$CPPFLAGS -std=gnu89"
232 if test "$curl_cv_def___INTEL_COMPILER" -gt "600"; then
233 dnl Show errors, warnings, and remarks
234 CPPFLAGS="$CPPFLAGS -Wall"
235 dnl Perform extra compile-time code checking
236 CPPFLAGS="$CPPFLAGS -Wcheck"
238 dnl Change some warnings into errors
239 dnl #140: too many arguments in function call
240 dnl #147: declaration is incompatible with 'previous one'
241 dnl #165: too few arguments in function call
242 dnl #266: function declared implicitly
243 CPPFLAGS="$CPPFLAGS -we 140,147,165,266"
244 dnl Disable some remarks
245 dnl #279: controlling expression is constant
246 dnl #981: operands are evaluated in unspecified order
247 dnl #1469: "cc" clobber ignored
248 if test "$curl_cv_def___INTEL_COMPILER" -lt "910"; then
249 CPPFLAGS="$CPPFLAGS -wd 279"
251 CPPFLAGS="$CPPFLAGS -wd 981,1469"
252 dnl Disable use of ANSI C aliasing rules in optimizations
253 CFLAGS="$CFLAGS -no-ansi-alias"
258 AC_MSG_CHECKING([whether we are using the DEC/Compaq C compiler])
259 CURL_CHECK_DEF([__DECC], [], [silent])
260 CURL_CHECK_DEF([__DECC_VER], [], [silent])
261 if test "$curl_cv_have_def___DECC" = "yes" &&
262 test "$curl_cv_have_def___DECC_VER" = "yes"; then
264 dnl Select strict ANSI C compiler mode
265 CFLAGS="$CFLAGS -std1"
266 dnl Turn off optimizer ANSI C aliasing rules
267 CFLAGS="$CFLAGS -noansi_alias"
268 dnl Select a higher warning level than default level2
269 CFLAGS="$CFLAGS -msg_enable level3"
270 dnl Generate warnings for missing function prototypes
271 CFLAGS="$CFLAGS -warnprotos"
272 dnl Change some warnings into fatal errors
273 CFLAGS="$CFLAGS -msg_fatal toofewargs,toomanyargs"
278 CURL_CHECK_COMPILER_HALT_ON_ERROR
279 CURL_CHECK_COMPILER_ARRAY_SIZE_NEGATIVE
281 dnl **********************************************************************
282 dnl Compilation based checks should not be done before this point.
283 dnl **********************************************************************
285 dnl **********************************************************************
286 dnl Make sure that our checks for headers windows.h winsock.h winsock2.h
287 dnl and ws2tcpip.h take precedence over any other further checks which
288 dnl could be done later using AC_CHECK_HEADER or AC_CHECK_HEADERS for
289 dnl this specific header files. And do them before its results are used.
290 dnl **********************************************************************
292 CURL_CHECK_HEADER_WINDOWS
293 CURL_CHECK_NATIVE_WINDOWS
294 case X-"$ac_cv_native_windows" in
296 CURL_CHECK_HEADER_WINSOCK
297 CURL_CHECK_HEADER_WINSOCK2
298 CURL_CHECK_HEADER_WS2TCPIP
301 ac_cv_header_winsock_h="no"
302 ac_cv_header_winsock2_h="no"
303 ac_cv_header_ws2tcpip_h="no"
307 dnl **********************************************************************
308 dnl Checks for libraries.
309 dnl **********************************************************************
311 dnl gethostbyname without lib or in the nsl lib?
312 AC_CHECK_FUNC(gethostbyname,
313 [HAVE_GETHOSTBYNAME="1"
315 [ AC_CHECK_LIB(nsl, gethostbyname,
316 [HAVE_GETHOSTBYNAME="1"
321 if test "$HAVE_GETHOSTBYNAME" != "1"
323 dnl gethostbyname in the socket lib?
324 AC_CHECK_LIB(socket, gethostbyname,
325 [HAVE_GETHOSTBYNAME="1"
326 LIBS="$LIBS -lsocket"
330 dnl At least one system has been identified to require BOTH nsl and socket
331 dnl libs at the same time to link properly.
332 if test "$HAVE_GETHOSTBYNAME" != "1"
334 AC_MSG_CHECKING([for gethostbyname with both nsl and socket libs])
335 my_ac_save_LIBS=$LIBS
336 LIBS="-lnsl -lsocket $LIBS"
344 HAVE_GETHOSTBYNAME="1"
347 LIBS=$my_ac_save_LIBS
351 if test "$HAVE_GETHOSTBYNAME" != "1"
353 dnl This is for winsock systems
354 if test "$ac_cv_header_windows_h" = "yes"; then
355 if test "$ac_cv_header_winsock_h" = "yes"; then
358 winsock_LIB="-lwinsock"
361 winsock_LIB="-lwsock32"
365 if test "$ac_cv_header_winsock2_h" = "yes"; then
366 winsock_LIB="-lws2_32"
368 if test ! -z "$winsock_LIB"; then
369 my_ac_save_LIBS=$LIBS
370 LIBS="$winsock_LIB $LIBS"
371 AC_MSG_CHECKING([for gethostbyname in $winsock_LIB])
374 #ifdef HAVE_WINDOWS_H
375 #ifndef WIN32_LEAN_AND_MEAN
376 #define WIN32_LEAN_AND_MEAN
379 #ifdef HAVE_WINSOCK2_H
380 #include <winsock2.h>
382 #ifdef HAVE_WINSOCK_H
388 gethostbyname("www.dummysite.com");
392 HAVE_GETHOSTBYNAME="1"
396 LIBS=$my_ac_save_LIBS
402 if test "$HAVE_GETHOSTBYNAME" != "1"
404 dnl This is for Minix 3.1
405 AC_MSG_CHECKING([for gethostbyname for Minix 3])
408 /* Older Minix versions may need <net/gen/netdb.h> here instead */
411 gethostbyname("www.dummysite.com");
415 HAVE_GETHOSTBYNAME="1"
421 if test "$HAVE_GETHOSTBYNAME" != "1"
423 dnl This is for eCos with a stubbed DNS implementation
424 AC_MSG_CHECKING([for gethostbyname for eCos])
430 gethostbyname("www.dummysite.com");
434 HAVE_GETHOSTBYNAME="1"
440 if test "$HAVE_GETHOSTBYNAME" != "1"
442 dnl gethostbyname in the net lib - for BeOS
443 AC_CHECK_LIB(net, gethostbyname,
444 [HAVE_GETHOSTBYNAME="1"
450 if test "$HAVE_GETHOSTBYNAME" = "1"; then
451 AC_DEFINE(HAVE_GETHOSTBYNAME, 1, [If you have gethostbyname])
453 AC_MSG_ERROR([couldn't find libraries for gethostbyname()])
457 AC_CHECK_FUNC(strcasecmp, , [ AC_CHECK_LIB(resolve, strcasecmp) ])
459 if test "$ac_cv_lib_resolve_strcasecmp" = "$ac_cv_func_strcasecmp"; then
460 AC_CHECK_LIB(resolve, strcasecmp,
461 [LIBS="-lresolve $LIBS"],
465 ac_cv_func_strcasecmp="no"
468 AC_CHECK_FUNC(connect, , [ AC_CHECK_LIB(socket, connect) ])
470 dnl **********************************************************************
471 dnl In case that function clock_gettime with monotonic timer is available,
472 dnl check for additional required libraries.
473 dnl **********************************************************************
474 CURL_CHECK_LIBS_CLOCK_GETTIME_MONOTONIC
476 AC_MSG_CHECKING([whether to use libgcc])
477 AC_ARG_ENABLE(libgcc,
478 AC_HELP_STRING([--enable-libgcc],[use libgcc when linking]),
479 [ case "$enableval" in
491 dnl Default is to try the thread-safe versions of a few functions
494 dnl detect AIX 4.3 or later
495 AC_MSG_CHECKING([AIX 4.3 or later])
497 #if defined(_AIX) && defined(_AIX43)
500 #error "this is not AIX 4.3 or later"
503 [ AC_MSG_RESULT([yes])
506 [ AC_MSG_RESULT([no]) ]
509 AC_ARG_ENABLE(thread,dnl
510 AC_HELP_STRING([--disable-thread],[don't look for thread-safe functions])
511 AC_HELP_STRING([--enable-thread],[look for thread-safe functions]),
512 [ case "$enableval" in
515 AC_MSG_WARN(c-ares will not get built using thread-safe functions)
523 if test X"$OPT_THREAD" = Xoff
525 AC_DEFINE(DISABLED_THREADSAFE, 1,
526 [Set to explicitly specify we don't want to use thread-safe functions])
529 dnl for recent AIX versions, we skip all the thread-safe checks above since
530 dnl they claim a thread-safe libc using the standard API. But there are
531 dnl some functions still not thread-safe. Check for these!
533 dnl Let's hope this split URL remains working:
534 dnl http://publibn.boulder.ibm.com/doc_link/en_US/a_doc_lib/aixprggd/ \
535 dnl genprogc/thread_quick_ref.htm
537 if test "x$RECENTAIX" = "xyes"; then
539 AC_DEFINE(_THREAD_SAFE, 1, [define this if you need it to compile thread-safe code])
544 dnl **********************************************************************
545 dnl Back to "normal" configuring
546 dnl **********************************************************************
548 dnl Checks for header files.
551 CURL_CHECK_HEADER_MALLOC
553 dnl check for a few basic system headers we need
571 arpa/nameser_compat.h \
573 dnl to do if not found
579 #ifdef HAVE_SYS_TYPES_H
580 #include <sys/types.h>
582 #ifdef HAVE_SYS_TIME_H
583 #include <sys/time.h>
585 dnl We do this default-include simply to make sure that the nameser_compat.h
586 dnl header *REALLY* can be include after the new nameser.h. It seems AIX 5.1
587 dnl (and others?) is not designed to allow this.
588 #ifdef HAVE_ARPA_NAMESER_H
589 #include <arpa/nameser.h>
592 dnl *Sigh* these are needed in order for net/if.h to get properly detected.
593 #ifdef HAVE_SYS_SOCKET_H
594 #include <sys/socket.h>
596 #ifdef HAVE_NETINET_IN_H
597 #include <netinet/in.h>
602 dnl Checks for typedefs, structures, and compiler characteristics.
606 CURL_CHECK_STRUCT_TIMEVAL
608 AC_CHECK_SIZEOF(size_t)
609 AC_CHECK_SIZEOF(long)
610 AC_CHECK_SIZEOF(time_t)
612 AC_CHECK_TYPE(long long,
613 [AC_DEFINE(HAVE_LONGLONG, 1,
614 [Define to 1 if the compiler supports the 'long long' data type.])]
618 if test "xyes" = "x$longlong"; then
619 AC_MSG_CHECKING([if numberLL works])
620 AC_COMPILE_IFELSE([long long val = 1000LL;],
621 [AC_DEFINE(HAVE_LL, 1, [if your compiler supports LL])]
629 AC_CHECK_TYPE(ssize_t, ,
630 AC_DEFINE(ssize_t, int, [the signed version of size_t]))
632 # check for bool type
633 AC_CHECK_TYPE([bool],[
634 AC_DEFINE(HAVE_BOOL_T, 1,
635 [Define to 1 if bool is an available type.])
637 #ifdef HAVE_SYS_TYPES_H
638 #include <sys/types.h>
640 #ifdef HAVE_STDBOOL_H
645 # Check for socklen_t or equivalent
646 CURL_CHECK_TYPE_SOCKLEN_T
650 TYPE_SOCKADDR_STORAGE
657 CURL_CHECK_FUNC_RECVFROM
659 CURL_CHECK_MSG_NOSIGNAL
661 CARES_CHECK_FUNC_GETHOSTNAME
662 CARES_CHECK_FUNC_GETSERVBYPORT_R
663 CARES_CHECK_FUNC_INET_NTOP
664 CARES_CHECK_FUNC_STRCASECMP
665 CARES_CHECK_FUNC_STRCMPI
666 CARES_CHECK_FUNC_STRDUP
667 CARES_CHECK_FUNC_STRICMP
668 CARES_CHECK_FUNC_STRNCASECMP
669 CARES_CHECK_FUNC_STRNCMPI
670 CARES_CHECK_FUNC_STRNICMP
671 CARES_CHECK_FUNC_WRITEV
674 dnl check for AF_INET6
675 CARES_CHECK_CONSTANT(
678 #ifdef HAVE_WINDOWS_H
679 #ifndef WIN32_LEAN_AND_MEAN
680 #define WIN32_LEAN_AND_MEAN
683 #ifdef HAVE_WINSOCK2_H
684 #include <winsock2.h>
687 #ifdef HAVE_SYS_TYPES_H
688 #include <sys/types.h>
690 #ifdef HAVE_SYS_SOCKET_H
691 #include <sys/socket.h>
695 AC_DEFINE_UNQUOTED(HAVE_PF_INET6,1,[Define to 1 if you have PF_INET6.])
698 dnl check for PF_INET6
699 CARES_CHECK_CONSTANT(
702 #ifdef HAVE_WINDOWS_H
703 #ifndef WIN32_LEAN_AND_MEAN
704 #define WIN32_LEAN_AND_MEAN
707 #ifdef HAVE_WINSOCK2_H
708 #include <winsock2.h>
711 #ifdef HAVE_SYS_TYPES_H
712 #include <sys/types.h>
714 #ifdef HAVE_SYS_SOCKET_H
715 #include <sys/socket.h>
719 AC_DEFINE_UNQUOTED(HAVE_AF_INET6,1,[Define to 1 if you have AF_INET6.])
723 dnl check for the in6_addr structure
727 #ifdef HAVE_WINDOWS_H
728 #ifndef WIN32_LEAN_AND_MEAN
729 #define WIN32_LEAN_AND_MEAN
732 #ifdef HAVE_WINSOCK2_H
733 #include <winsock2.h>
734 #ifdef HAVE_WS2TCPIP_H
735 #include <ws2tcpip.h>
739 #ifdef HAVE_SYS_TYPES_H
740 #include <sys/types.h>
742 #ifdef HAVE_NETINET_IN_H
743 #include <netinet/in.h>
747 AC_DEFINE_UNQUOTED(HAVE_STRUCT_IN6_ADDR,1,[Define to 1 if you have struct in6_addr.])
750 dnl check for the sockaddr_in6 structure
754 #ifdef HAVE_WINDOWS_H
755 #ifndef WIN32_LEAN_AND_MEAN
756 #define WIN32_LEAN_AND_MEAN
759 #ifdef HAVE_WINSOCK2_H
760 #include <winsock2.h>
761 #ifdef HAVE_WS2TCPIP_H
762 #include <ws2tcpip.h>
766 #ifdef HAVE_SYS_TYPES_H
767 #include <sys/types.h>
769 #ifdef HAVE_NETINET_IN_H
770 #include <netinet/in.h>
774 AC_DEFINE_UNQUOTED(HAVE_STRUCT_SOCKADDR_IN6,1,
775 [Define to 1 if you have struct sockaddr_in6.]) ac_have_sockaddr_in6=yes
778 AC_CHECK_MEMBER(struct sockaddr_in6.sin6_scope_id,
779 AC_DEFINE_UNQUOTED(HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID,1,
780 [Define to 1 if your struct sockaddr_in6 has sin6_scope_id.])
784 #ifdef HAVE_WINDOWS_H
785 #ifndef WIN32_LEAN_AND_MEAN
786 #define WIN32_LEAN_AND_MEAN
789 #ifdef HAVE_WINSOCK2_H
790 #include <winsock2.h>
791 #ifdef HAVE_WS2TCPIP_H
792 #include <ws2tcpip.h>
796 #ifdef HAVE_SYS_TYPES_H
797 #include <sys/types.h>
799 #ifdef HAVE_NETINET_IN_H
800 #include <netinet/in.h>
805 dnl check for the addrinfo structure
806 AC_CHECK_MEMBER(struct addrinfo.ai_flags,
807 AC_DEFINE_UNQUOTED(HAVE_STRUCT_ADDRINFO,1,
808 [Define to 1 if you have struct addrinfo.]),,
811 #ifdef HAVE_WINDOWS_H
812 #ifndef WIN32_LEAN_AND_MEAN
813 #define WIN32_LEAN_AND_MEAN
816 #ifdef HAVE_WINSOCK2_H
817 #include <winsock2.h>
818 #ifdef HAVE_WS2TCPIP_H
819 #include <ws2tcpip.h>
823 #ifdef HAVE_SYS_TYPES_H
824 #include <sys/types.h>
826 #ifdef HAVE_NETINET_IN_H
827 #include <netinet/in.h>
829 #ifdef HAVE_SYS_SOCKET_H
830 #include <sys/socket.h>
840 AC_CHECK_FUNCS([bitncmp \
846 AC_MSG_CHECKING([deeper for $func])
854 eval "ac_cv_func_$func=yes"
855 AC_DEFINE_UNQUOTED([AS_TR_CPP([HAVE_$func])], [1],
856 [Define to 1 if you have the $func function.])
858 AC_MSG_RESULT([but still no])
863 dnl check for inet_pton
864 AC_CHECK_FUNCS(inet_pton)
865 dnl Some systems have it, but not IPv6
866 if test "$ac_cv_func_inet_pton" = "yes" ; then
867 AC_MSG_CHECKING(if inet_pton supports IPv6)
870 #ifdef HAVE_SYS_TYPES_H
871 #include <sys/types.h>
873 #ifdef HAVE_SYS_SOCKET_H
874 #include <sys/socket.h>
876 #ifdef HAVE_NETINET_IN_H
877 #include <netinet/in.h>
881 struct in6_addr addr6;
882 if (inet_pton(AF_INET6, "::1", &addr6) < 1)
889 AC_DEFINE_UNQUOTED(HAVE_INET_PTON_IPV6,1,[Define to 1 if inet_pton supports IPv6.])
890 ], AC_MSG_RESULT(no),AC_MSG_RESULT(no))
892 dnl Check for inet_net_pton
893 AC_CHECK_FUNCS(inet_net_pton)
894 dnl Again, some systems have it, but not IPv6
895 if test "$ac_cv_func_inet_net_pton" = "yes" ; then
896 AC_MSG_CHECKING(if inet_net_pton supports IPv6)
899 #ifdef HAVE_SYS_TYPES_H
900 #include <sys/types.h>
902 #ifdef HAVE_SYS_SOCKET_H
903 #include <sys/socket.h>
905 #ifdef HAVE_NETINET_IN_H
906 #include <netinet/in.h>
910 struct in6_addr addr6;
911 if (inet_net_pton(AF_INET6, "::1", &addr6, sizeof(addr6)) < 1)
918 AC_DEFINE_UNQUOTED(HAVE_INET_NET_PTON_IPV6,1,[Define to 1 if inet_net_pton supports IPv6.])
919 ], AC_MSG_RESULT(no),AC_MSG_RESULT(no))
923 AC_CHECK_SIZEOF(struct in6_addr, ,
926 #ifdef HAVE_WINDOWS_H
927 #ifndef WIN32_LEAN_AND_MEAN
928 #define WIN32_LEAN_AND_MEAN
931 #ifdef HAVE_WINSOCK2_H
932 #include <winsock2.h>
933 #ifdef HAVE_WS2TCPIP_H
934 #include <ws2tcpip.h>
938 #ifdef HAVE_SYS_TYPES_H
939 #include <sys/types.h>
941 #ifdef HAVE_SYS_SOCKET_H
942 #include <sys/socket.h>
944 #ifdef HAVE_NETINET_IN_H
945 #include <netinet/in.h>
951 AC_CHECK_SIZEOF(struct in_addr, ,
954 #ifdef HAVE_WINDOWS_H
955 #ifndef WIN32_LEAN_AND_MEAN
956 #define WIN32_LEAN_AND_MEAN
959 #ifdef HAVE_WINSOCK2_H
960 #include <winsock2.h>
961 #ifdef HAVE_WS2TCPIP_H
962 #include <ws2tcpip.h>
966 #ifdef HAVE_SYS_TYPES_H
967 #include <sys/types.h>
969 #ifdef HAVE_SYS_SOCKET_H
970 #include <sys/socket.h>
972 #ifdef HAVE_NETINET_IN_H
973 #include <netinet/in.h>
980 dnl Check if the getnameinfo function is available
981 dnl and get the types of five of its arguments.
982 CURL_CHECK_FUNC_GETNAMEINFO
985 CURL_CHECK_NONBLOCKING_SOCKET
988 [AC_DEFINE(ARES_BIG_ENDIAN, 1,
989 [define this if ares is built for a big endian system])],
991 [AC_MSG_WARN([couldn't figure out endianess, assuming little endian!])]
994 dnl Check for user-specified random device
996 AC_HELP_STRING([--with-random=FILE],
997 [read randomness from FILE (default=/dev/urandom)]),
998 [ RANDOM_FILE="$withval" ],
1000 dnl Check for random device. If we're cross compiling, we can't
1001 dnl check, and it's better to assume it doesn't exist than it is
1002 dnl to fail on AC_CHECK_FILE or later.
1003 if test "$cross_compiling" = "no"; then
1004 AC_CHECK_FILE("/dev/urandom", [ RANDOM_FILE="/dev/urandom"] )
1006 AC_MSG_WARN([cannot check for /dev/urandom while cross compiling; assuming none])
1011 if test -n "$RANDOM_FILE" && test X"$RANDOM_FILE" != Xno ; then
1012 AC_SUBST(RANDOM_FILE)
1013 AC_DEFINE_UNQUOTED(RANDOM_FILE, "$RANDOM_FILE",
1014 [a suitable file/device to read random data from])
1017 CARES_PRIVATE_LIBS="$LIBS"
1018 AC_SUBST(CARES_PRIVATE_LIBS)
1020 AC_CONFIG_FILES([Makefile libcares.pc])