3 AC_INIT([c-ares], [1.18.1],
4 [c-ares mailing list: http://lists.haxx.se/listinfo/c-ares])
6 CARES_VERSION_INFO="7:1:5"
7 dnl This flag accepts an argument of the form current[:revision[:age]]. So,
8 dnl passing -version-info 3:12:1 sets current to 3, revision to 12, and age to
11 dnl If either revision or age are omitted, they default to 0. Also note that age
12 dnl must be less than or equal to the current interface number.
14 dnl Here are a set of rules to help you update your library version information:
16 dnl 1.Start with version information of 0:0:0 for each libtool library.
18 dnl 2.Update the version information only immediately before a public release of
19 dnl your software. More frequent updates are unnecessary, and only guarantee
20 dnl that the current interface number gets larger faster.
22 dnl 3.If the library source code has changed at all since the last update, then
23 dnl increment revision (c:r+1:a)
25 dnl 4.If any interfaces have been added, removed, or changed since the last
26 dnl update, increment current, and set revision to 0. (c+1:r=0:a)
28 dnl 5.If any interfaces have been added since the last public release, then
29 dnl increment age. (c:r:a+1)
31 dnl 6.If any interfaces have been removed since the last public release, then
32 dnl set age to 0. (c:r:a=0)
34 AC_SUBST([CARES_VERSION_INFO])
36 AC_CONFIG_SRCDIR([src/lib/ares_ipv6.h])
37 AC_CONFIG_HEADERS([src/lib/ares_config.h include/ares_build.h])
38 AC_CONFIG_MACRO_DIR([m4])
40 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
42 AX_REQUIRE_DEFINED([AX_CXX_COMPILE_STDCXX_11])
44 CARES_CHECK_OPTION_DEBUG
45 CARES_CHECK_OPTION_OPTIMIZE
46 CARES_CHECK_OPTION_WARNINGS
47 CARES_CHECK_OPTION_WERROR
48 CARES_CHECK_OPTION_SYMBOL_HIDING
49 CARES_CHECK_OPTION_EXPOSE_STATICS
51 XC_CHECK_PATH_SEPARATOR
53 dnl SED is mandatory for configure process and libtool.
54 dnl Set it now, allowing it to be changed later.
55 AC_PATH_PROG([SED], [sed], [not_found],
56 [$PATH:/usr/bin:/usr/local/bin])
57 if test -z "$SED" || test "$SED" = "not_found"; then
58 AC_MSG_ERROR([sed not found in PATH. Cannot continue without sed.])
62 dnl GREP is mandatory for configure process and libtool.
63 dnl Set it now, allowing it to be changed later.
64 AC_PATH_PROG([GREP], [grep], [not_found],
65 [$PATH:/usr/bin:/usr/local/bin])
66 if test -z "$GREP" || test "$GREP" = "not_found"; then
67 AC_MSG_ERROR([grep not found in PATH. Cannot continue without grep.])
71 dnl EGREP is mandatory for configure process and libtool.
72 dnl Set it now, allowing it to be changed later.
73 if echo a | ($GREP -E '(a|b)') >/dev/null 2>&1; then
74 AC_MSG_CHECKING([for egrep])
76 AC_MSG_RESULT([$EGREP])
78 AC_PATH_PROG([EGREP], [egrep], [not_found],
79 [$PATH:/usr/bin:/usr/local/bin])
81 if test -z "$EGREP" || test "$EGREP" = "not_found"; then
82 AC_MSG_ERROR([egrep not found in PATH. Cannot continue without egrep.])
86 dnl AR is mandatory for configure process and libtool.
87 dnl This is target dependent, so check it as a tool.
88 if test -z "$AR"; then
89 dnl allow it to be overridden
90 AC_PATH_TOOL([AR], [ar], [not_found],
91 [$PATH:/usr/bin:/usr/local/bin])
92 if test -z "$AR" || test "$AR" = "not_found"; then
93 AC_MSG_ERROR([ar not found in PATH. Cannot continue without ar.])
102 dnl Detect the canonical host and target build environment
106 dnl Get system canonical name
107 AC_DEFINE_UNQUOTED(OS, "${host}", [cpu-machine-OS])
110 AX_CXX_COMPILE_STDCXX_11([noext],[optional])
114 dnl This defines _ALL_SOURCE for AIX
115 CARES_CHECK_AIX_ALL_SOURCE
117 dnl Our configure and build reentrant settings
118 CARES_CONFIGURE_THREAD_SAFE
119 CARES_CONFIGURE_REENTRANT
121 dnl check for how to do large files
126 AC_DEFINE(ETC_INET, 1, [if a /etc/inet dir is being used])
134 # Automake conditionals based on libtool related checks
137 AM_CONDITIONAL([CARES_LT_SHLIB_USE_VERSION_INFO],
138 [test "x$xc_lt_shlib_use_version_info" = 'xyes'])
139 AM_CONDITIONAL([CARES_LT_SHLIB_USE_NO_UNDEFINED],
140 [test "x$xc_lt_shlib_use_no_undefined" = 'xyes'])
141 AM_CONDITIONAL([CARES_LT_SHLIB_USE_MIMPURE_TEXT],
142 [test "x$xc_lt_shlib_use_mimpure_text" = 'xyes'])
145 # Due to libtool and automake machinery limitations of not allowing
146 # specifying separate CPPFLAGS or CFLAGS when compiling objects for
147 # inclusion of these in shared or static libraries, we are forced to
148 # build using separate configure runs for shared and static libraries
149 # on systems where different CPPFLAGS or CFLAGS are mandatory in order
150 # to compile objects for each kind of library. Notice that relying on
151 # the '-DPIC' CFLAG that libtool provides is not valid given that the
152 # user might for example choose to build static libraries with PIC.
156 # Make our Makefile.am files use the staticlib CPPFLAG only when strictly
157 # targeting a static library and not building its shared counterpart.
160 AM_CONDITIONAL([USE_CPPFLAG_CARES_STATICLIB],
161 [test "x$xc_lt_build_static_only" = 'xyes'])
164 # Make staticlib CPPFLAG variable and its definition visible in output
165 # files unconditionally, providing an empty definition unless strictly
166 # targeting a static library and not building its shared counterpart.
169 CPPFLAG_CARES_STATICLIB=
170 if test "x$xc_lt_build_static_only" = 'xyes'; then
171 CPPFLAG_CARES_STATICLIB='-DCARES_STATICLIB'
173 AC_SUBST([CPPFLAG_CARES_STATICLIB])
175 dnl **********************************************************************
176 dnl platform/compiler/architecture specific checks/flags
177 dnl **********************************************************************
180 CARES_SET_COMPILER_BASIC_OPTS
181 CARES_SET_COMPILER_DEBUG_OPTS
182 CARES_SET_COMPILER_OPTIMIZE_OPTS
183 CARES_SET_COMPILER_WARNING_OPTS
185 if test "$compiler_id" = "INTEL_UNIX_C"; then
187 if test "$compiler_num" -ge "1000"; then
188 dnl icc 10.X or later
189 CFLAGS="$CFLAGS -shared-intel"
190 elif test "$compiler_num" -ge "900"; then
192 CFLAGS="$CFLAGS -i-dynamic"
197 CARES_CHECK_COMPILER_HALT_ON_ERROR
198 CARES_CHECK_COMPILER_ARRAY_SIZE_NEGATIVE
199 CARES_CHECK_COMPILER_PROTOTYPE_MISMATCH
200 CARES_CHECK_COMPILER_SYMBOL_HIDING
202 dnl **********************************************************************
203 dnl Compilation based checks should not be done before this point.
204 dnl **********************************************************************
206 dnl **********************************************************************
207 dnl Make sure that our checks for headers windows.h winsock.h winsock2.h
208 dnl and ws2tcpip.h take precedence over any other further checks which
209 dnl could be done later using AC_CHECK_HEADER or AC_CHECK_HEADERS for
210 dnl this specific header files. And do them before its results are used.
211 dnl **********************************************************************
213 CURL_CHECK_HEADER_WINDOWS
214 CURL_CHECK_NATIVE_WINDOWS
215 case X-"$ac_cv_native_windows" in
217 CURL_CHECK_HEADER_WINSOCK
218 CURL_CHECK_HEADER_WINSOCK2
219 CURL_CHECK_HEADER_WS2TCPIP
220 CPPFLAGS="$CPPFLAGS -D_WIN32_WINNT=0x0600"
223 ac_cv_header_winsock_h="no"
224 ac_cv_header_winsock2_h="no"
225 ac_cv_header_ws2tcpip_h="no"
229 dnl **********************************************************************
230 dnl Checks for libraries.
231 dnl **********************************************************************
235 dnl gethostbyname without lib or in the nsl lib?
236 AC_CHECK_FUNC(gethostbyname,
237 [HAVE_GETHOSTBYNAME="1"
239 [ AC_CHECK_LIB(nsl, gethostbyname,
240 [HAVE_GETHOSTBYNAME="1"
245 if test "$HAVE_GETHOSTBYNAME" != "1"
247 dnl gethostbyname in the socket lib?
248 AC_CHECK_LIB(socket, gethostbyname,
249 [HAVE_GETHOSTBYNAME="1"
250 LIBS="$LIBS -lsocket"
254 dnl At least one system has been identified to require BOTH nsl and socket
255 dnl libs at the same time to link properly.
256 if test "$HAVE_GETHOSTBYNAME" != "1"
258 AC_MSG_CHECKING([for gethostbyname with both nsl and socket libs])
259 my_ac_save_LIBS=$LIBS
260 LIBS="-lnsl -lsocket $LIBS"
268 HAVE_GETHOSTBYNAME="1"
271 LIBS=$my_ac_save_LIBS
275 if test "$HAVE_GETHOSTBYNAME" != "1"
277 dnl This is for winsock systems
278 if test "$ac_cv_header_windows_h" = "yes"; then
279 if test "$ac_cv_header_winsock_h" = "yes"; then
282 winsock_LIB="-lwinsock"
285 winsock_LIB="-lwsock32"
289 if test "$ac_cv_header_winsock2_h" = "yes"; then
290 winsock_LIB="-lws2_32"
292 if test ! -z "$winsock_LIB"; then
293 my_ac_save_LIBS=$LIBS
294 LIBS="$winsock_LIB $LIBS"
295 AC_MSG_CHECKING([for gethostbyname in $winsock_LIB])
298 #ifdef HAVE_WINDOWS_H
299 #ifndef WIN32_LEAN_AND_MEAN
300 #define WIN32_LEAN_AND_MEAN
303 #ifdef HAVE_WINSOCK2_H
304 #include <winsock2.h>
306 #ifdef HAVE_WINSOCK_H
312 gethostbyname("www.dummysite.com");
316 HAVE_GETHOSTBYNAME="1"
320 LIBS=$my_ac_save_LIBS
326 if test "$HAVE_GETHOSTBYNAME" != "1"
328 dnl This is for Minix 3.1
329 AC_MSG_CHECKING([for gethostbyname for Minix 3])
332 /* Older Minix versions may need <net/gen/netdb.h> here instead */
335 gethostbyname("www.dummysite.com");
339 HAVE_GETHOSTBYNAME="1"
345 if test "$HAVE_GETHOSTBYNAME" != "1"
347 dnl This is for eCos with a stubbed DNS implementation
348 AC_MSG_CHECKING([for gethostbyname for eCos])
354 gethostbyname("www.dummysite.com");
358 HAVE_GETHOSTBYNAME="1"
364 if test "$HAVE_GETHOSTBYNAME" != "1"
366 dnl gethostbyname in the net lib - for BeOS
367 AC_CHECK_LIB(net, gethostbyname,
368 [HAVE_GETHOSTBYNAME="1"
374 if test "$HAVE_GETHOSTBYNAME" != "1"; then
375 AC_MSG_ERROR([couldn't find libraries for gethostbyname()])
378 dnl resolv lib for Apple (MacOS and iOS)
379 AS_IF([test "x$host_vendor" = "xapple"], [
380 AC_SEARCH_LIBS([res_servicename], [resolv], [
381 AC_DEFINE([CARES_USE_LIBRESOLV], [1], [Use resolver library to configure cares])
383 AC_MSG_ERROR([Unable to find libresolv which is required for iPhone targets])
387 dnl resolv lib for z/OS
388 AS_IF([test "x$host_vendor" = "xibm" -a "x$host_os" = "xopenedition" ], [
389 AC_SEARCH_LIBS([res_init], [resolv], [
390 AC_DEFINE([CARES_USE_LIBRESOLV], [1], [Use resolver library to configure cares])
392 AC_MSG_ERROR([Unable to find libresolv which is required for z/OS])
397 AC_CHECK_FUNC(strcasecmp, , [ AC_CHECK_LIB(resolve, strcasecmp) ])
399 if test "$ac_cv_lib_resolve_strcasecmp" = "$ac_cv_func_strcasecmp"; then
400 AC_CHECK_LIB(resolve, strcasecmp,
401 [LIBS="-lresolve $LIBS"],
405 ac_cv_func_strcasecmp="no"
407 dnl Windows builds require linking to iphlpapi
408 if test "$ac_cv_header_winsock2_h" = "yes"; then
409 LIBS="$LIBS -liphlpapi"
412 CARES_CHECK_LIBS_CONNECT
415 AS_IF([test "x$host_vendor" = "xapple"], [
416 AC_MSG_CHECKING([for iOS minimum version 10 or later])
420 #include <TargetConditionals.h>
422 #if TARGET_OS_IPHONE == 0 || __IPHONE_OS_VERSION_MIN_REQUIRED < 100000
423 #error Not iOS 10 or later
436 AS_IF([test "x$host_vendor" = "xapple"], [
437 AC_MSG_CHECKING([for macOS minimum version 10.12 or later])
441 #include <TargetConditionals.h>
443 #ifndef MAC_OS_X_VERSION_10_12
444 # define MAC_OS_X_VERSION_10_12 101200
446 #if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_12
447 #error Not macOS 10.12 or later
453 ac_cv_macos_10_12="yes"
459 dnl **********************************************************************
460 dnl In case that function clock_gettime with monotonic timer is available,
461 dnl check for additional required libraries.
462 dnl **********************************************************************
463 dnl Xcode 8 bug: iOS when targeting less than 10, or macOS when targeting less than 10.12 will
464 dnl say clock_gettime exists, it is a weak symbol that only exists in iOS 10 or macOS 10.12 and will
465 dnl cause a crash at runtime when running on older versions. Skip finding CLOCK_MONOTONIC on older
467 if test "x$host_vendor" != "xapple" || test "x$ac_cv_ios_10" = "xyes" || test "x$ac_cv_macos_10_12" = "xyes"; then
468 CURL_CHECK_LIBS_CLOCK_GETTIME_MONOTONIC
471 AC_MSG_CHECKING([whether to use libgcc])
472 AC_ARG_ENABLE(libgcc,
473 AS_HELP_STRING([--enable-libgcc],[use libgcc when linking]),
474 [ case "$enableval" in
486 dnl Let's hope this split URL remains working:
487 dnl http://publibn.boulder.ibm.com/doc_link/en_US/a_doc_lib/aixprggd/ \
488 dnl genprogc/thread_quick_ref.htm
491 dnl **********************************************************************
492 dnl Back to "normal" configuring
493 dnl **********************************************************************
495 dnl Checks for header files.
501 CURL_CHECK_HEADER_MALLOC
502 CURL_CHECK_HEADER_MEMORY
504 dnl check for a few basic system headers we need
525 arpa/nameser_compat.h \
527 dnl to do if not found
533 #ifdef HAVE_SYS_TYPES_H
534 #include <sys/types.h>
536 #ifdef HAVE_SYS_TIME_H
537 #include <sys/time.h>
539 dnl We do this default-include simply to make sure that the nameser_compat.h
540 dnl header *REALLY* can be include after the new nameser.h. It seems AIX 5.1
541 dnl (and others?) is not designed to allow this.
542 #ifdef HAVE_ARPA_NAMESER_H
543 #include <arpa/nameser.h>
546 dnl *Sigh* these are needed in order for net/if.h to get properly detected.
547 #ifdef HAVE_SYS_SOCKET_H
548 #include <sys/socket.h>
550 #ifdef HAVE_NETINET_IN_H
551 #include <netinet/in.h>
556 dnl Test and set CARES_HAVE_ARPA_NAMESER_H / CARES_HAVE_ARPA_NAMESER_COMPAT_H
557 AC_CHECK_DECL([HAVE_ARPA_NAMESER_H],
559 CARES_DEFINE_UNQUOTED([CARES_HAVE_ARPA_NAMESER_H])
563 AC_CHECK_DECL([HAVE_ARPA_NAMESER_COMPAT_H],
565 CARES_DEFINE_UNQUOTED([CARES_HAVE_ARPA_NAMESER_COMPAT_H])
570 dnl Checks for typedefs, structures, and compiler characteristics.
574 [Update your code to rely only on HAVE_SYS_TIME_H,
575 then remove this warning and the obsolete code below it.
576 All current systems provide time.h; it need not be checked for.
577 Not all systems provide sys/time.h, but those that do, all allow
578 you to include it and time.h simultaneously.])dnl
579 AC_CHECK_HEADERS_ONCE([sys/time.h])
580 # Obsolete code to be removed.
581 if test $ac_cv_header_sys_time_h = yes; then
582 AC_DEFINE([TIME_WITH_SYS_TIME],[1],[Define to 1 if you can safely include both <sys/time.h>
583 and <time.h>. This macro is obsolete.])
585 # End of obsolete code.
587 CURL_CHECK_STRUCT_TIMEVAL
589 AC_CHECK_TYPE(long long,
590 [AC_DEFINE(HAVE_LONGLONG, 1,
591 [Define to 1 if the compiler supports the 'long long' data type.])]
595 if test "xyes" = "x$longlong"; then
596 AC_MSG_CHECKING([if numberLL works])
600 long long val = 1000LL;
604 AC_DEFINE(HAVE_LL, 1, [if your compiler supports LL])
612 AC_CHECK_TYPE(ssize_t, [ CARES_TYPEOF_ARES_SSIZE_T=ssize_t ],
613 [ CARES_TYPEOF_ARES_SSIZE_T=int ])
615 AC_DEFINE_UNQUOTED([CARES_TYPEOF_ARES_SSIZE_T], ${CARES_TYPEOF_ARES_SSIZE_T},
616 [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 CARES_CONFIGURE_ARES_SOCKLEN_T
636 TYPE_SOCKADDR_STORAGE
641 [your code may safely assume C89 semantics that RETSIGTYPE is void.
642 Remove this warning and the `AC_CACHE_CHECK' when you adjust the code.])dnl
643 AC_CACHE_CHECK([return type of signal handlers],[ac_cv_type_signal],[AC_COMPILE_IFELSE(
644 [AC_LANG_PROGRAM([#include <sys/types.h>
647 [return *(signal (0, 0)) (0) == 1;])],
648 [ac_cv_type_signal=int],
649 [ac_cv_type_signal=void])])
650 AC_DEFINE_UNQUOTED([RETSIGTYPE],[$ac_cv_type_signal],[Define as the return type of signal handlers
655 CURL_CHECK_FUNC_RECVFROM
657 CURL_CHECK_MSG_NOSIGNAL
659 CARES_CHECK_FUNC_CLOSESOCKET
660 CARES_CHECK_FUNC_CLOSESOCKET_CAMEL
661 CARES_CHECK_FUNC_CONNECT
662 CARES_CHECK_FUNC_FCNTL
663 CARES_CHECK_FUNC_FREEADDRINFO
664 CARES_CHECK_FUNC_GETADDRINFO
665 CARES_CHECK_FUNC_GETENV
666 CARES_CHECK_FUNC_GETHOSTBYADDR
667 CARES_CHECK_FUNC_GETHOSTBYNAME
668 CARES_CHECK_FUNC_GETHOSTNAME
669 CARES_CHECK_FUNC_GETSERVBYPORT_R
670 CARES_CHECK_FUNC_INET_NET_PTON
671 CARES_CHECK_FUNC_INET_NTOP
672 CARES_CHECK_FUNC_INET_PTON
673 CARES_CHECK_FUNC_IOCTL
674 CARES_CHECK_FUNC_IOCTLSOCKET
675 CARES_CHECK_FUNC_IOCTLSOCKET_CAMEL
676 CARES_CHECK_FUNC_SETSOCKOPT
677 CARES_CHECK_FUNC_SOCKET
678 CARES_CHECK_FUNC_STRCASECMP
679 CARES_CHECK_FUNC_STRCMPI
680 CARES_CHECK_FUNC_STRDUP
681 CARES_CHECK_FUNC_STRICMP
682 CARES_CHECK_FUNC_STRNCASECMP
683 CARES_CHECK_FUNC_STRNCMPI
684 CARES_CHECK_FUNC_STRNICMP
685 CARES_CHECK_FUNC_WRITEV
688 dnl check for AF_INET6
689 CARES_CHECK_CONSTANT(
692 #ifdef HAVE_WINDOWS_H
693 #ifndef WIN32_LEAN_AND_MEAN
694 #define WIN32_LEAN_AND_MEAN
697 #ifdef HAVE_WINSOCK2_H
698 #include <winsock2.h>
701 #ifdef HAVE_SYS_TYPES_H
702 #include <sys/types.h>
704 #ifdef HAVE_SYS_SOCKET_H
705 #include <sys/socket.h>
709 AC_DEFINE_UNQUOTED(HAVE_PF_INET6,1,[Define to 1 if you have PF_INET6.])
712 dnl check for PF_INET6
713 CARES_CHECK_CONSTANT(
716 #ifdef HAVE_WINDOWS_H
717 #ifndef WIN32_LEAN_AND_MEAN
718 #define WIN32_LEAN_AND_MEAN
721 #ifdef HAVE_WINSOCK2_H
722 #include <winsock2.h>
725 #ifdef HAVE_SYS_TYPES_H
726 #include <sys/types.h>
728 #ifdef HAVE_SYS_SOCKET_H
729 #include <sys/socket.h>
733 AC_DEFINE_UNQUOTED(HAVE_AF_INET6,1,[Define to 1 if you have AF_INET6.])
737 dnl check for the in6_addr structure
741 #ifdef HAVE_WINDOWS_H
742 #ifndef WIN32_LEAN_AND_MEAN
743 #define WIN32_LEAN_AND_MEAN
746 #ifdef HAVE_WINSOCK2_H
747 #include <winsock2.h>
748 #ifdef HAVE_WS2TCPIP_H
749 #include <ws2tcpip.h>
753 #ifdef HAVE_SYS_TYPES_H
754 #include <sys/types.h>
756 #ifdef HAVE_NETINET_IN_H
757 #include <netinet/in.h>
761 AC_DEFINE_UNQUOTED(HAVE_STRUCT_IN6_ADDR,1,[Define to 1 if you have struct in6_addr.])
764 dnl check for the sockaddr_in6 structure
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>
788 AC_DEFINE_UNQUOTED(HAVE_STRUCT_SOCKADDR_IN6,1,
789 [Define to 1 if you have struct sockaddr_in6.]) ac_have_sockaddr_in6=yes
792 AC_CHECK_MEMBER(struct sockaddr_in6.sin6_scope_id,
793 AC_DEFINE_UNQUOTED(HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID,1,
794 [Define to 1 if your struct sockaddr_in6 has sin6_scope_id.])
798 #ifdef HAVE_WINDOWS_H
799 #ifndef WIN32_LEAN_AND_MEAN
800 #define WIN32_LEAN_AND_MEAN
803 #ifdef HAVE_WINSOCK2_H
804 #include <winsock2.h>
805 #ifdef HAVE_WS2TCPIP_H
806 #include <ws2tcpip.h>
810 #ifdef HAVE_SYS_TYPES_H
811 #include <sys/types.h>
813 #ifdef HAVE_NETINET_IN_H
814 #include <netinet/in.h>
819 dnl check for the addrinfo structure
820 AC_CHECK_MEMBER(struct addrinfo.ai_flags,
821 AC_DEFINE_UNQUOTED(HAVE_STRUCT_ADDRINFO,1,
822 [Define to 1 if you have struct addrinfo.]),,
825 #ifdef HAVE_WINDOWS_H
826 #ifndef WIN32_LEAN_AND_MEAN
827 #define WIN32_LEAN_AND_MEAN
830 #ifdef HAVE_WINSOCK2_H
831 #include <winsock2.h>
832 #ifdef HAVE_WS2TCPIP_H
833 #include <ws2tcpip.h>
837 #ifdef HAVE_SYS_TYPES_H
838 #include <sys/types.h>
840 #ifdef HAVE_NETINET_IN_H
841 #include <netinet/in.h>
843 #ifdef HAVE_SYS_SOCKET_H
844 #include <sys/socket.h>
854 AC_CHECK_FUNCS([bitncmp \
860 AC_MSG_CHECKING([deeper for $func])
868 eval "ac_cv_func_$func=yes"
869 AC_DEFINE_UNQUOTED(XC_SH_TR_CPP([HAVE_$func]), [1],
870 [Define to 1 if you have the $func function.])
872 AC_MSG_RESULT([but still no])
876 dnl Android. Some variants like arm64 may no longer have __system_property_get
877 dnl in libc, but they are defined in the headers. Perform a link check.
878 AC_CHECK_FUNC([__system_property_get], [
879 AC_DEFINE([HAVE___SYSTEM_PROPERTY_GET], [1], [Define if __system_property_get exists.])
882 dnl Check if the getnameinfo function is available
883 dnl and get the types of five of its arguments.
884 CURL_CHECK_FUNC_GETNAMEINFO
888 [AC_DEFINE(ARES_BIG_ENDIAN, 1,
889 [define this if ares is built for a big endian system])],
891 [AC_MSG_WARN([couldn't figure out endianess, assuming little endian!])]
894 dnl Check for user-specified random device
896 AS_HELP_STRING([--with-random=FILE],
897 [read randomness from FILE (default=/dev/urandom)]),
898 [ CARES_RANDOM_FILE="$withval" ],
900 dnl Check for random device. If we're cross compiling, we can't
901 dnl check, and it's better to assume it doesn't exist than it is
902 dnl to fail on AC_CHECK_FILE or later.
903 if test "$cross_compiling" = "no"; then
904 AC_CHECK_FILE("/dev/urandom", [ CARES_RANDOM_FILE="/dev/urandom"] )
906 AC_MSG_WARN([cannot check for /dev/urandom while cross compiling; assuming none])
911 if test -n "$CARES_RANDOM_FILE" && test X"$CARES_RANDOM_FILE" != Xno ; then
912 AC_SUBST(CARES_RANDOM_FILE)
913 AC_DEFINE_UNQUOTED(CARES_RANDOM_FILE, "$CARES_RANDOM_FILE",
914 [a suitable file/device to read random data from])
917 CARES_CHECK_OPTION_NONBLOCKING
918 CARES_CHECK_NONBLOCKING_SOCKET
920 CARES_CONFIGURE_SYMBOL_HIDING
922 CARES_PRIVATE_LIBS="$LIBS"
923 AC_SUBST(CARES_PRIVATE_LIBS)
925 CARES_CFLAG_EXTRAS=""
926 if test X"$want_werror" = Xyes; then
927 CARES_CFLAG_EXTRAS="-Werror"
929 AC_SUBST(CARES_CFLAG_EXTRAS)
931 dnl squeeze whitespace out of some variables
939 squeeze CARES_PRIVATE_LIBS
943 AC_MSG_CHECKING([whether to build tests])
945 AS_HELP_STRING([--enable-tests], [build test suite]),
946 [ build_tests="$enableval" ],
947 [ if test "x$HAVE_CXX11" = "x1" && test "x$cross_compiling" = "xno" ; then
955 if test "x$build_tests" = "xyes" ; then
956 if test "x$HAVE_CXX11" = "0" ; then
957 AC_MSG_ERROR([*** Building tests requires a CXX11 compiler])
959 if test "x$cross_compiling" = "xyes" ; then
960 AC_MSG_ERROR([*** Tests not supported when cross compiling])
963 AC_MSG_RESULT([$build_tests])
966 BUILD_SUBDIRS="include src docs"
967 if test "x$build_tests" = "xyes" ; then
968 AC_CONFIG_SUBDIRS([test])
969 BUILD_SUBDIRS="${BUILD_SUBDIRS} test"
972 AC_SUBST(BUILD_SUBDIRS)
974 AC_CONFIG_FILES([Makefile \
983 XC_AMEND_DISTCLEAN(['.'])