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 **********************************************************************
174 ac_cv_compiler="unknown"
175 ac_cv_compiler_num="unknown"
177 AC_MSG_CHECKING([whether we are using the IBM C compiler])
178 CURL_CHECK_DEF([__IBMC__], [], [silent])
179 if test "$curl_cv_have_def___IBMC__" = "yes"; then
181 ac_cv_compiler="IBMC"
182 dnl Ensure that compiler optimizations are always thread-safe.
183 CFLAGS="$CFLAGS -qthreaded"
184 dnl Disable type based strict aliasing optimizations, using worst
185 dnl case aliasing assumptions when compiling. Type based aliasing
186 dnl would restrict the lvalues that could be safely used to access
188 CFLAGS="$CFLAGS -qnoansialias"
189 dnl Force compiler to stop after the compilation phase, without
190 dnl generating an object code file when compilation has errors.
191 CFLAGS="$CFLAGS -qhalt=e"
196 AC_MSG_CHECKING([whether we are using the Intel C compiler])
197 CURL_CHECK_DEF([__INTEL_COMPILER], [], [silent])
198 if test "$curl_cv_have_def___INTEL_COMPILER" = "yes"; then
201 AC_MSG_CHECKING([compiler version])
202 ac_cv_compiler_num="$curl_cv_def___INTEL_COMPILER"
203 AC_MSG_RESULT([$ac_cv_compiler_num])
204 dnl On unix this compiler uses gcc's header files, so
205 dnl we select ANSI C89 dialect plus GNU extensions.
206 CPPFLAGS="$CPPFLAGS -std=gnu89"
207 if test "$ac_cv_compiler_num" -gt "600"; then
208 dnl Show errors, warnings, and remarks
209 CPPFLAGS="$CPPFLAGS -Wall"
210 dnl Perform extra compile-time code checking
211 CPPFLAGS="$CPPFLAGS -Wcheck"
213 dnl Change some warnings into errors
214 dnl #140: too many arguments in function call
215 dnl #147: declaration is incompatible with 'previous one'
216 dnl #165: too few arguments in function call
217 dnl #266: function declared implicitly
218 CPPFLAGS="$CPPFLAGS -we 140,147,165,266"
219 dnl Disable some remarks
220 dnl #279: controlling expression is constant
221 dnl #981: operands are evaluated in unspecified order
222 dnl #1469: "cc" clobber ignored
223 if test "$ac_cv_compiler_num" -lt "910"; then
224 CPPFLAGS="$CPPFLAGS -wd 279"
226 CPPFLAGS="$CPPFLAGS -wd 981,1469"
227 dnl Disable use of ANSI C aliasing rules in optimizations
228 CFLAGS="$CFLAGS -no-ansi-alias"
229 dnl Disable floating point optimizations
230 CFLAGS="$CFLAGS -fp-model precise -mp"
235 AC_MSG_CHECKING([whether we are using the DEC/Compaq C compiler])
236 CURL_CHECK_DEF([__DECC], [], [silent])
237 CURL_CHECK_DEF([__DECC_VER], [], [silent])
238 if test "$curl_cv_have_def___DECC" = "yes" &&
239 test "$curl_cv_have_def___DECC_VER" = "yes"; then
241 ac_cv_compiler="DECC"
242 dnl Select strict ANSI C compiler mode
243 CFLAGS="$CFLAGS -std1"
244 dnl Turn off optimizer ANSI C aliasing rules
245 CFLAGS="$CFLAGS -noansi_alias"
246 dnl Select a higher warning level than default level2
247 CFLAGS="$CFLAGS -msg_enable level3"
248 dnl Generate warnings for missing function prototypes
249 CFLAGS="$CFLAGS -warnprotos"
250 dnl Change some warnings into fatal errors
251 CFLAGS="$CFLAGS -msg_fatal toofewargs,toomanyargs"
256 AC_MSG_CHECKING([whether we are using the GNU C compiler])
257 CURL_CHECK_DEF([__GNUC__], [], [silent])
258 if test "$curl_cv_have_def___GNUC__" = "yes" &&
259 test "$ac_cv_compiler" = "unknown"; then
261 ac_cv_compiler="GNUC"
262 AC_MSG_CHECKING([compiler version])
263 gccver=`$CC -dumpversion`
264 gccvhi=`echo $gccver | cut -d . -f1`
265 gccvlo=`echo $gccver | cut -d . -f2`
266 gccnum=`(expr $gccvhi "*" 100 + $gccvlo) 2>/dev/null`
267 ac_cv_compiler_num="$gccnum"
268 AC_MSG_RESULT([$ac_cv_compiler_num])
275 x86_64*linux*|amd64*freebsd*|ia64*freebsd*)
277 if test "$ac_cv_compiler" = "ICC"; then
279 if test "$ac_cv_compiler_num" -ge "900" &&
280 test "$ac_cv_compiler_num" -lt "1000"; then
282 CFLAGS="$CFLAGS -i-dynamic"
285 if test "$ac_cv_compiler_num" -ge "1000"; then
286 dnl icc 10.X or later
287 CFLAGS="$CFLAGS -shared-intel"
295 CURL_CHECK_COMPILER_HALT_ON_ERROR
296 CURL_CHECK_COMPILER_ARRAY_SIZE_NEGATIVE
298 dnl **********************************************************************
299 dnl Compilation based checks should not be done before this point.
300 dnl **********************************************************************
302 dnl **********************************************************************
303 dnl Make sure that our checks for headers windows.h winsock.h winsock2.h
304 dnl and ws2tcpip.h take precedence over any other further checks which
305 dnl could be done later using AC_CHECK_HEADER or AC_CHECK_HEADERS for
306 dnl this specific header files. And do them before its results are used.
307 dnl **********************************************************************
309 CURL_CHECK_HEADER_WINDOWS
310 CURL_CHECK_NATIVE_WINDOWS
311 case X-"$ac_cv_native_windows" in
313 CURL_CHECK_HEADER_WINSOCK
314 CURL_CHECK_HEADER_WINSOCK2
315 CURL_CHECK_HEADER_WS2TCPIP
318 ac_cv_header_winsock_h="no"
319 ac_cv_header_winsock2_h="no"
320 ac_cv_header_ws2tcpip_h="no"
324 dnl **********************************************************************
325 dnl Checks for libraries.
326 dnl **********************************************************************
328 dnl gethostbyname without lib or in the nsl lib?
329 AC_CHECK_FUNC(gethostbyname,
330 [HAVE_GETHOSTBYNAME="1"
332 [ AC_CHECK_LIB(nsl, gethostbyname,
333 [HAVE_GETHOSTBYNAME="1"
338 if test "$HAVE_GETHOSTBYNAME" != "1"
340 dnl gethostbyname in the socket lib?
341 AC_CHECK_LIB(socket, gethostbyname,
342 [HAVE_GETHOSTBYNAME="1"
343 LIBS="$LIBS -lsocket"
347 dnl At least one system has been identified to require BOTH nsl and socket
348 dnl libs at the same time to link properly.
349 if test "$HAVE_GETHOSTBYNAME" != "1"
351 AC_MSG_CHECKING([for gethostbyname with both nsl and socket libs])
352 my_ac_save_LIBS=$LIBS
353 LIBS="-lnsl -lsocket $LIBS"
361 HAVE_GETHOSTBYNAME="1"
364 LIBS=$my_ac_save_LIBS
368 if test "$HAVE_GETHOSTBYNAME" != "1"
370 dnl This is for winsock systems
371 if test "$ac_cv_header_windows_h" = "yes"; then
372 if test "$ac_cv_header_winsock_h" = "yes"; then
375 winsock_LIB="-lwinsock"
378 winsock_LIB="-lwsock32"
382 if test "$ac_cv_header_winsock2_h" = "yes"; then
383 winsock_LIB="-lws2_32"
385 if test ! -z "$winsock_LIB"; then
386 my_ac_save_LIBS=$LIBS
387 LIBS="$winsock_LIB $LIBS"
388 AC_MSG_CHECKING([for gethostbyname in $winsock_LIB])
391 #ifdef HAVE_WINDOWS_H
392 #ifndef WIN32_LEAN_AND_MEAN
393 #define WIN32_LEAN_AND_MEAN
396 #ifdef HAVE_WINSOCK2_H
397 #include <winsock2.h>
399 #ifdef HAVE_WINSOCK_H
405 gethostbyname("www.dummysite.com");
409 HAVE_GETHOSTBYNAME="1"
413 LIBS=$my_ac_save_LIBS
419 if test "$HAVE_GETHOSTBYNAME" != "1"
421 dnl This is for Minix 3.1
422 AC_MSG_CHECKING([for gethostbyname for Minix 3])
425 /* Older Minix versions may need <net/gen/netdb.h> here instead */
428 gethostbyname("www.dummysite.com");
432 HAVE_GETHOSTBYNAME="1"
438 if test "$HAVE_GETHOSTBYNAME" != "1"
440 dnl This is for eCos with a stubbed DNS implementation
441 AC_MSG_CHECKING([for gethostbyname for eCos])
447 gethostbyname("www.dummysite.com");
451 HAVE_GETHOSTBYNAME="1"
457 if test "$HAVE_GETHOSTBYNAME" != "1"
459 dnl gethostbyname in the net lib - for BeOS
460 AC_CHECK_LIB(net, gethostbyname,
461 [HAVE_GETHOSTBYNAME="1"
467 if test "$HAVE_GETHOSTBYNAME" = "1"; then
468 AC_DEFINE(HAVE_GETHOSTBYNAME, 1, [If you have gethostbyname])
470 AC_MSG_ERROR([couldn't find libraries for gethostbyname()])
474 AC_CHECK_FUNC(strcasecmp, , [ AC_CHECK_LIB(resolve, strcasecmp) ])
476 if test "$ac_cv_lib_resolve_strcasecmp" = "$ac_cv_func_strcasecmp"; then
477 AC_CHECK_LIB(resolve, strcasecmp,
478 [LIBS="-lresolve $LIBS"],
482 ac_cv_func_strcasecmp="no"
485 AC_CHECK_FUNC(connect, , [ AC_CHECK_LIB(socket, connect) ])
487 dnl **********************************************************************
488 dnl In case that function clock_gettime with monotonic timer is available,
489 dnl check for additional required libraries.
490 dnl **********************************************************************
491 CURL_CHECK_LIBS_CLOCK_GETTIME_MONOTONIC
493 AC_MSG_CHECKING([whether to use libgcc])
494 AC_ARG_ENABLE(libgcc,
495 AC_HELP_STRING([--enable-libgcc],[use libgcc when linking]),
496 [ case "$enableval" in
508 dnl Default is to try the thread-safe versions of a few functions
511 dnl detect AIX 4.3 or later
512 AC_MSG_CHECKING([AIX 4.3 or later])
514 #if defined(_AIX) && defined(_AIX43)
517 #error "this is not AIX 4.3 or later"
520 [ AC_MSG_RESULT([yes])
523 [ AC_MSG_RESULT([no]) ]
526 AC_ARG_ENABLE(thread,dnl
527 AC_HELP_STRING([--disable-thread],[don't look for thread-safe functions])
528 AC_HELP_STRING([--enable-thread],[look for thread-safe functions]),
529 [ case "$enableval" in
532 AC_MSG_WARN(c-ares will not get built using thread-safe functions)
540 if test X"$OPT_THREAD" = Xoff
542 AC_DEFINE(DISABLED_THREADSAFE, 1,
543 [Set to explicitly specify we don't want to use thread-safe functions])
546 dnl for recent AIX versions, we skip all the thread-safe checks above since
547 dnl they claim a thread-safe libc using the standard API. But there are
548 dnl some functions still not thread-safe. Check for these!
550 dnl Let's hope this split URL remains working:
551 dnl http://publibn.boulder.ibm.com/doc_link/en_US/a_doc_lib/aixprggd/ \
552 dnl genprogc/thread_quick_ref.htm
554 if test "x$RECENTAIX" = "xyes"; then
556 AC_DEFINE(_THREAD_SAFE, 1, [define this if you need it to compile thread-safe code])
561 dnl **********************************************************************
562 dnl Back to "normal" configuring
563 dnl **********************************************************************
565 dnl Checks for header files.
568 CURL_CHECK_HEADER_MALLOC
570 dnl check for a few basic system headers we need
588 arpa/nameser_compat.h \
590 dnl to do if not found
596 #ifdef HAVE_SYS_TYPES_H
597 #include <sys/types.h>
599 #ifdef HAVE_SYS_TIME_H
600 #include <sys/time.h>
602 dnl We do this default-include simply to make sure that the nameser_compat.h
603 dnl header *REALLY* can be include after the new nameser.h. It seems AIX 5.1
604 dnl (and others?) is not designed to allow this.
605 #ifdef HAVE_ARPA_NAMESER_H
606 #include <arpa/nameser.h>
609 dnl *Sigh* these are needed in order for net/if.h to get properly detected.
610 #ifdef HAVE_SYS_SOCKET_H
611 #include <sys/socket.h>
613 #ifdef HAVE_NETINET_IN_H
614 #include <netinet/in.h>
619 dnl Checks for typedefs, structures, and compiler characteristics.
623 CURL_CHECK_STRUCT_TIMEVAL
625 AC_CHECK_SIZEOF(size_t)
626 AC_CHECK_SIZEOF(long)
627 AC_CHECK_SIZEOF(time_t)
629 AC_CHECK_TYPE(long long,
630 [AC_DEFINE(HAVE_LONGLONG, 1,
631 [Define to 1 if the compiler supports the 'long long' data type.])]
635 if test "xyes" = "x$longlong"; then
636 AC_MSG_CHECKING([if numberLL works])
637 AC_COMPILE_IFELSE([long long val = 1000LL;],
638 [AC_DEFINE(HAVE_LL, 1, [if your compiler supports LL])]
646 AC_CHECK_TYPE(ssize_t, ,
647 AC_DEFINE(ssize_t, int, [the signed version of size_t]))
649 # check for bool type
650 AC_CHECK_TYPE([bool],[
651 AC_DEFINE(HAVE_BOOL_T, 1,
652 [Define to 1 if bool is an available type.])
654 #ifdef HAVE_SYS_TYPES_H
655 #include <sys/types.h>
657 #ifdef HAVE_STDBOOL_H
662 # Check for socklen_t or equivalent
663 CURL_CHECK_TYPE_SOCKLEN_T
667 TYPE_SOCKADDR_STORAGE
674 CURL_CHECK_FUNC_RECVFROM
676 CURL_CHECK_MSG_NOSIGNAL
678 CARES_CHECK_FUNC_GETHOSTNAME
679 CARES_CHECK_FUNC_GETSERVBYPORT_R
680 CARES_CHECK_FUNC_INET_NTOP
681 CARES_CHECK_FUNC_INET_PTON
682 CARES_CHECK_FUNC_STRCASECMP
683 CARES_CHECK_FUNC_STRCMPI
684 CARES_CHECK_FUNC_STRDUP
685 CARES_CHECK_FUNC_STRICMP
686 CARES_CHECK_FUNC_STRNCASECMP
687 CARES_CHECK_FUNC_STRNCMPI
688 CARES_CHECK_FUNC_STRNICMP
689 CARES_CHECK_FUNC_WRITEV
692 dnl check for AF_INET6
693 CARES_CHECK_CONSTANT(
696 #ifdef HAVE_WINDOWS_H
697 #ifndef WIN32_LEAN_AND_MEAN
698 #define WIN32_LEAN_AND_MEAN
701 #ifdef HAVE_WINSOCK2_H
702 #include <winsock2.h>
705 #ifdef HAVE_SYS_TYPES_H
706 #include <sys/types.h>
708 #ifdef HAVE_SYS_SOCKET_H
709 #include <sys/socket.h>
713 AC_DEFINE_UNQUOTED(HAVE_PF_INET6,1,[Define to 1 if you have PF_INET6.])
716 dnl check for PF_INET6
717 CARES_CHECK_CONSTANT(
720 #ifdef HAVE_WINDOWS_H
721 #ifndef WIN32_LEAN_AND_MEAN
722 #define WIN32_LEAN_AND_MEAN
725 #ifdef HAVE_WINSOCK2_H
726 #include <winsock2.h>
729 #ifdef HAVE_SYS_TYPES_H
730 #include <sys/types.h>
732 #ifdef HAVE_SYS_SOCKET_H
733 #include <sys/socket.h>
737 AC_DEFINE_UNQUOTED(HAVE_AF_INET6,1,[Define to 1 if you have AF_INET6.])
741 dnl check for the in6_addr structure
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>
765 AC_DEFINE_UNQUOTED(HAVE_STRUCT_IN6_ADDR,1,[Define to 1 if you have struct in6_addr.])
768 dnl check for the sockaddr_in6 structure
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>
792 AC_DEFINE_UNQUOTED(HAVE_STRUCT_SOCKADDR_IN6,1,
793 [Define to 1 if you have struct sockaddr_in6.]) ac_have_sockaddr_in6=yes
796 AC_CHECK_MEMBER(struct sockaddr_in6.sin6_scope_id,
797 AC_DEFINE_UNQUOTED(HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID,1,
798 [Define to 1 if your struct sockaddr_in6 has sin6_scope_id.])
802 #ifdef HAVE_WINDOWS_H
803 #ifndef WIN32_LEAN_AND_MEAN
804 #define WIN32_LEAN_AND_MEAN
807 #ifdef HAVE_WINSOCK2_H
808 #include <winsock2.h>
809 #ifdef HAVE_WS2TCPIP_H
810 #include <ws2tcpip.h>
814 #ifdef HAVE_SYS_TYPES_H
815 #include <sys/types.h>
817 #ifdef HAVE_NETINET_IN_H
818 #include <netinet/in.h>
823 dnl check for the addrinfo structure
824 AC_CHECK_MEMBER(struct addrinfo.ai_flags,
825 AC_DEFINE_UNQUOTED(HAVE_STRUCT_ADDRINFO,1,
826 [Define to 1 if you have struct addrinfo.]),,
829 #ifdef HAVE_WINDOWS_H
830 #ifndef WIN32_LEAN_AND_MEAN
831 #define WIN32_LEAN_AND_MEAN
834 #ifdef HAVE_WINSOCK2_H
835 #include <winsock2.h>
836 #ifdef HAVE_WS2TCPIP_H
837 #include <ws2tcpip.h>
841 #ifdef HAVE_SYS_TYPES_H
842 #include <sys/types.h>
844 #ifdef HAVE_NETINET_IN_H
845 #include <netinet/in.h>
847 #ifdef HAVE_SYS_SOCKET_H
848 #include <sys/socket.h>
858 AC_CHECK_FUNCS([bitncmp \
864 AC_MSG_CHECKING([deeper for $func])
872 eval "ac_cv_func_$func=yes"
873 AC_DEFINE_UNQUOTED([AS_TR_CPP([HAVE_$func])], [1],
874 [Define to 1 if you have the $func function.])
876 AC_MSG_RESULT([but still no])
881 dnl Check for inet_net_pton
882 AC_CHECK_FUNCS(inet_net_pton)
883 dnl Again, some systems have it, but not IPv6
884 if test "$ac_cv_func_inet_net_pton" = "yes" ; then
885 AC_MSG_CHECKING(if inet_net_pton supports IPv6)
888 #ifdef HAVE_SYS_TYPES_H
889 #include <sys/types.h>
891 #ifdef HAVE_SYS_SOCKET_H
892 #include <sys/socket.h>
894 #ifdef HAVE_NETINET_IN_H
895 #include <netinet/in.h>
899 struct in6_addr addr6;
900 if (inet_net_pton(AF_INET6, "::1", &addr6, sizeof(addr6)) < 1)
907 AC_DEFINE_UNQUOTED(HAVE_INET_NET_PTON_IPV6,1,[Define to 1 if inet_net_pton supports IPv6.])
908 ], AC_MSG_RESULT(no),AC_MSG_RESULT(no))
912 AC_CHECK_SIZEOF(struct in6_addr, ,
915 #ifdef HAVE_WINDOWS_H
916 #ifndef WIN32_LEAN_AND_MEAN
917 #define WIN32_LEAN_AND_MEAN
920 #ifdef HAVE_WINSOCK2_H
921 #include <winsock2.h>
922 #ifdef HAVE_WS2TCPIP_H
923 #include <ws2tcpip.h>
927 #ifdef HAVE_SYS_TYPES_H
928 #include <sys/types.h>
930 #ifdef HAVE_SYS_SOCKET_H
931 #include <sys/socket.h>
933 #ifdef HAVE_NETINET_IN_H
934 #include <netinet/in.h>
940 AC_CHECK_SIZEOF(struct in_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>
969 dnl Check if the getnameinfo function is available
970 dnl and get the types of five of its arguments.
971 CURL_CHECK_FUNC_GETNAMEINFO
974 CURL_CHECK_NONBLOCKING_SOCKET
977 [AC_DEFINE(ARES_BIG_ENDIAN, 1,
978 [define this if ares is built for a big endian system])],
980 [AC_MSG_WARN([couldn't figure out endianess, assuming little endian!])]
983 dnl Check for user-specified random device
985 AC_HELP_STRING([--with-random=FILE],
986 [read randomness from FILE (default=/dev/urandom)]),
987 [ RANDOM_FILE="$withval" ],
989 dnl Check for random device. If we're cross compiling, we can't
990 dnl check, and it's better to assume it doesn't exist than it is
991 dnl to fail on AC_CHECK_FILE or later.
992 if test "$cross_compiling" = "no"; then
993 AC_CHECK_FILE("/dev/urandom", [ RANDOM_FILE="/dev/urandom"] )
995 AC_MSG_WARN([cannot check for /dev/urandom while cross compiling; assuming none])
1000 if test -n "$RANDOM_FILE" && test X"$RANDOM_FILE" != Xno ; then
1001 AC_SUBST(RANDOM_FILE)
1002 AC_DEFINE_UNQUOTED(RANDOM_FILE, "$RANDOM_FILE",
1003 [a suitable file/device to read random data from])
1006 CARES_PRIVATE_LIBS="$LIBS"
1007 AC_SUBST(CARES_PRIVATE_LIBS)
1009 AC_CONFIG_FILES([Makefile libcares.pc])