configure.ac (34696B)
1 dnl Copyright (C) The c-ares project and its contributors 2 dnl SPDX-License-Identifier: MIT 3 AC_PREREQ([2.69]) 4 5 AC_INIT([c-ares], [1.34.5], 6 [c-ares mailing list: http://lists.haxx.se/listinfo/c-ares]) 7 8 CARES_VERSION_INFO="21:4:19" 9 dnl This flag accepts an argument of the form current[:revision[:age]]. So, 10 dnl passing -version-info 3:12:1 sets current to 3, revision to 12, and age to 11 dnl 1. 12 dnl 13 dnl If either revision or age are omitted, they default to 0. Also note that age 14 dnl must be less than or equal to the current interface number. 15 dnl 16 dnl Here are a set of rules to help you update your library version information: 17 dnl 18 dnl 1.Start with version information of 0:0:0 for each libtool library. 19 dnl 20 dnl 2.Update the version information only immediately before a public release of 21 dnl your software. More frequent updates are unnecessary, and only guarantee 22 dnl that the current interface number gets larger faster. 23 dnl 24 dnl 3.If the library source code has changed at all since the last update, then 25 dnl increment revision (c:r+1:a) 26 dnl 27 dnl 4.If any interfaces have been added, removed, or changed since the last 28 dnl update, increment current, and set revision to 0. (c+1:r=0:a) 29 dnl 30 dnl 5.If any interfaces have been added since the last public release, then 31 dnl increment age. (c:r:a+1) 32 dnl 33 dnl 6.If any interfaces have been removed since the last public release, then 34 dnl set age to 0. (c:r:a=0) 35 dnl 36 AC_SUBST([CARES_VERSION_INFO]) 37 38 AC_CONFIG_SRCDIR([src/lib/ares_ipv6.h]) 39 AC_CONFIG_HEADERS([src/lib/ares_config.h include/ares_build.h]) 40 AC_CONFIG_AUX_DIR(config) 41 AC_CONFIG_MACRO_DIR([m4]) 42 AC_USE_SYSTEM_EXTENSIONS 43 AX_CXX_COMPILE_STDCXX_14([noext],[optional]) 44 AM_INIT_AUTOMAKE([foreign subdir-objects 1.9.6]) 45 LT_INIT([win32-dll,pic,disable-fast-install,aix-soname=svr4]) 46 AC_LANG([C]) 47 AC_PROG_CC 48 AM_PROG_CC_C_O 49 AC_PROG_EGREP 50 AC_PROG_INSTALL 51 AC_CANONICAL_HOST 52 AX_COMPILER_VENDOR 53 54 AC_MSG_CHECKING([whether this is native windows]) 55 ac_cv_native_windows=no 56 ac_cv_windows=no 57 case $host_os in 58 mingw*) 59 ac_cv_native_windows=yes 60 ac_cv_windows=yes 61 ;; 62 cygwin*) 63 ac_cv_windows=yes 64 ;; 65 esac 66 if test "$ax_cv_c_compiler_vendor" = "microsoft" ; then 67 ac_cv_native_windows=yes 68 ac_cv_windows=yes 69 fi 70 AC_MSG_RESULT($ac_cv_native_windows) 71 72 73 AC_ENABLE_SHARED 74 75 dnl Disable static builds by default on Windows unless overwritten since Windows 76 dnl can't simultaneously build shared and static with autotools. 77 AS_IF([test "x$ac_cv_windows" = "xyes"], [AC_DISABLE_STATIC], [AC_ENABLE_STATIC]) 78 79 AC_ARG_ENABLE(warnings, 80 AS_HELP_STRING([--disable-warnings],[Disable strict compiler warnings]), 81 [ enable_warnings=${enableval} ], 82 [ enable_warnings=yes ]) 83 84 AC_ARG_ENABLE(symbol-hiding, 85 AS_HELP_STRING([--disable-symbol-hiding], [Disable symbol hiding. Enabled by default if the compiler supports it.]), 86 [ 87 symbol_hiding="$enableval" 88 if test "$symbol_hiding" = "no" -a "x$enable_shared" = "xyes" ; then 89 case $host_os in 90 cygwin* | mingw* | pw32* | cegcc*) 91 AC_MSG_ERROR([Cannot disable symbol hiding on windows]) 92 ;; 93 esac 94 fi 95 ], 96 [ 97 if test "x$enable_shared" = "xyes" ; then 98 symbol_hiding="maybe" 99 else 100 symbol_hiding="no" 101 fi 102 ] 103 ) 104 105 AC_ARG_ENABLE(tests, 106 AS_HELP_STRING([--disable-tests], [disable building of test suite. Built by default if GoogleTest is found.]), 107 [ build_tests="$enableval" ], 108 [ if test "x$HAVE_CXX14" = "x1" && test "x$cross_compiling" = "xno" ; then 109 build_tests="maybe" 110 else 111 build_tests="no" 112 fi 113 ] 114 ) 115 116 AC_ARG_ENABLE(cares-threads, 117 AS_HELP_STRING([--disable-cares-threads], [Disable building of thread safety support]), 118 [ CARES_THREADS=${enableval} ], 119 [ CARES_THREADS=yes ]) 120 121 AC_ARG_WITH(random, 122 AS_HELP_STRING([--with-random=FILE], 123 [read randomness from FILE (default=/dev/urandom)]), 124 [ CARES_RANDOM_FILE="$withval" ], 125 [ CARES_RANDOM_FILE="/dev/urandom" ] 126 ) 127 if test -n "$CARES_RANDOM_FILE" && test X"$CARES_RANDOM_FILE" != Xno ; then 128 AC_SUBST(CARES_RANDOM_FILE) 129 AC_DEFINE_UNQUOTED(CARES_RANDOM_FILE, "$CARES_RANDOM_FILE", [a suitable file/device to read random data from]) 130 fi 131 132 AM_MAINTAINER_MODE 133 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) 134 135 136 dnl CARES_DEFINE_UNQUOTED (VARIABLE, [VALUE]) 137 dnl ------------------------------------------------- 138 dnl Like AC_DEFINE_UNQUOTED this macro will define a C preprocessor 139 dnl symbol that can be further used in custom template configuration 140 dnl files. This macro, unlike AC_DEFINE_UNQUOTED, does not use a third 141 dnl argument for the description. Symbol definitions done with this 142 dnl macro are intended to be exclusively used in handcrafted *.h.in 143 dnl template files. Contrary to what AC_DEFINE_UNQUOTED does, this one 144 dnl prevents autoheader generation and insertion of symbol template 145 dnl stub and definition into the first configuration header file. Do 146 dnl not use this macro as a replacement for AC_DEFINE_UNQUOTED, each 147 dnl one serves different functional needs. 148 149 AC_DEFUN([CARES_DEFINE_UNQUOTED], [ 150 cat >>confdefs.h <<_EOF 151 [@%:@define] $1 ifelse($#, 2, [$2], 1) 152 _EOF 153 ]) 154 155 AX_CODE_COVERAGE 156 AC_SYS_LARGEFILE 157 158 case $host_os in 159 solaris*) 160 AC_DEFINE(ETC_INET, 1, [if a /etc/inet dir is being used]) 161 ;; 162 esac 163 164 dnl solaris needed flag 165 case $host_os in 166 solaris2*) 167 if test "x$GCC" = 'xyes'; then 168 AX_APPEND_LINK_FLAGS([-mimpure-text]) 169 fi 170 ;; 171 *) 172 ;; 173 esac 174 175 dnl -no-undefined libtool (not linker) flag for windows 176 cares_use_no_undefined=no 177 case $host_os in 178 cygwin* | mingw* | pw32* | cegcc* | os2* | aix*) 179 cares_use_no_undefined=yes 180 ;; 181 *) 182 ;; 183 esac 184 AM_CONDITIONAL([CARES_USE_NO_UNDEFINED], [test "$cares_use_no_undefined" = 'yes']) 185 186 187 if test "$ac_cv_native_windows" = "yes" ; then 188 AM_CPPFLAGS="$AM_CPPFLAGS -D_WIN32_WINNT=0x0602 -DWIN32_LEAN_AND_MEAN" 189 fi 190 191 dnl Windows can only build shared or static, not both at the same time 192 if test "$ac_cv_native_windows" = "yes" -a "x$enable_shared" = "xyes" -a "x$enable_static" = "xyes" ; then 193 AC_MSG_ERROR([Windows cannot build both static and shared simultaneously, specify --disable-shared or --disable-static]) 194 fi 195 196 dnl Only windows requires CARES_STATICLIB definition 197 if test "x$enable_shared" = "xno" -a "x$enable_static" = "xyes" ; then 198 AC_MSG_CHECKING([whether we need CARES_STATICLIB definition]) 199 if test "$ac_cv_native_windows" = "yes" ; then 200 AX_APPEND_FLAG([-DCARES_STATICLIB], [AM_CPPFLAGS]) 201 PKGCONFIG_CFLAGS="-DCARES_STATICLIB" 202 AC_MSG_RESULT([yes]) 203 else 204 AC_MSG_RESULT([no]) 205 fi 206 fi 207 208 dnl Test for symbol hiding 209 CARES_SYMBOL_HIDING_CFLAG="" 210 if test "$symbol_hiding" != "no" ; then 211 compiler_supports_symbol_hiding="no" 212 if test "$ac_cv_windows" = "yes" ; then 213 compiler_supports_symbol_hiding="yes" 214 else 215 case "$ax_cv_c_compiler_vendor" in 216 clang|gnu|intel) 217 AX_APPEND_COMPILE_FLAGS([-fvisibility=hidden], [CARES_SYMBOL_HIDING_CFLAG]) 218 if test "x$CARES_SYMBOL_HIDING_CFLAG" != "x" ; then 219 compiler_supports_symbol_hiding="yes" 220 fi 221 ;; 222 sun) 223 AX_APPEND_COMPILE_FLAGS([-xldscope=hidden], [CARES_SYMBOL_HIDING_CFLAG]) 224 if test "x$CARES_SYMBOL_HIDING_CFLAG" != "x" ; then 225 compiler_supports_symbol_hiding="yes" 226 fi 227 ;; 228 esac 229 fi 230 if test "$compiler_supports_symbol_hiding" = "no" ; then 231 if test "$symbol_hiding" = "yes" ; then 232 AC_MSG_ERROR([Compiler does not support symbol hiding]) 233 else 234 symbol_hiding="no" 235 fi 236 else 237 AC_DEFINE([CARES_SYMBOL_HIDING], [ 1 ], [Set to 1 if non-pubilc shared library symbols are hidden]) 238 symbol_hiding="yes" 239 fi 240 fi 241 AM_CONDITIONAL(CARES_SYMBOL_HIDING, test "x$symbol_hiding" = "xyes") 242 AC_SUBST(CARES_SYMBOL_HIDING_CFLAG) 243 244 245 if test "$enable_warnings" = "yes"; then 246 AX_APPEND_COMPILE_FLAGS([-Wall -Wextra -Waggregate-return -Wcast-align -Wcast-qual -Wconversion -Wdeclaration-after-statement -Wdouble-promotion -Wfloat-equal -Wformat-security -Winit-self -Wjump-misses-init -Wlogical-op -Wmissing-braces -Wmissing-declarations -Wmissing-format-attribute -Wmissing-include-dirs -Wmissing-prototypes -Wnested-externs -Wno-coverage-mismatch -Wold-style-definition -Wpacked -Wpedantic -Wpointer-arith -Wredundant-decls -Wshadow -Wsign-conversion -Wstrict-overflow -Wstrict-prototypes -Wtrampolines -Wundef -Wunreachable-code -Wunused -Wvariadic-macros -Wvla -Wwrite-strings -Werror=implicit-int -Werror=implicit-function-declaration -Werror=partial-availability -Wno-long-long ], 247 [AM_CFLAGS], [-Werror]) 248 fi 249 250 dnl Android and QNX require c99, all others should use c90 251 case $host_os in 252 *qnx*|*android*) 253 AX_APPEND_COMPILE_FLAGS([-std=c99], [AM_CFLAGS], [-Werror]) 254 ;; 255 *) 256 AX_APPEND_COMPILE_FLAGS([-std=c90], [AM_CFLAGS], [-Werror]) 257 ;; 258 esac 259 260 dnl QNX needs -D_QNX_SOURCE 261 case $host_os in 262 *qnx*) 263 AX_APPEND_COMPILE_FLAGS([-D_QNX_SOURCE], [AM_CPPFLAGS], [-Werror]) 264 ;; 265 esac 266 267 if test "$ax_cv_c_compiler_vendor" = "intel"; then 268 AX_APPEND_COMPILE_FLAGS([-shared-intel], [AM_CFLAGS]) 269 fi 270 271 if test "$ac_cv_native_windows" = "yes" ; then 272 dnl we use [ - ] in the 4th argument to tell AC_CHECK_HEADERS to simply 273 dnl check for existence of the headers, not usability. This is because 274 dnl on windows, header order matters, and you need to include headers *after* 275 dnl other headers, AC_CHECK_HEADERS only allows you to specify headers that 276 dnl must be included *before* the header being checked. 277 278 AC_CHECK_HEADERS([windows.h winsock2.h ws2tcpip.h iphlpapi.h netioapi.h ws2ipdef.h winternl.h ntdef.h ntstatus.h mswsock.h ], 279 [], [], [-]) 280 281 dnl Windows builds require linking to iphlpapi 282 if test "$ac_cv_header_winsock2_h" = "yes"; then 283 LIBS="$LIBS -lws2_32 -liphlpapi" 284 fi 285 fi 286 287 dnl ********************************************************************** 288 dnl Checks for libraries. 289 dnl ********************************************************************** 290 291 dnl see if libnsl or libsocket are required 292 AC_SEARCH_LIBS([getservbyport], [nsl socket resolv]) 293 294 AC_MSG_CHECKING([if libxnet is required]) 295 need_xnet=no 296 case $host_os in 297 hpux*) 298 XNET_LIBS="" 299 AX_APPEND_LINK_FLAGS([-lxnet], [XNET_LIBS]) 300 if test "x$XNET_LIBS" != "x" ; then 301 LIBS="$LIBS $XNET_LIBS" 302 need_xnet=yes 303 fi 304 ;; 305 esac 306 AC_MSG_RESULT($need_xnet) 307 308 dnl resolv lib for z/OS 309 AS_IF([test "x$host_vendor" = "xibm" -a "x$host_os" = "xopenedition" ], [ 310 AC_SEARCH_LIBS([res_init], [resolv], [ 311 AC_DEFINE([CARES_USE_LIBRESOLV], [1], [Use resolver library to configure cares]) 312 ], [ 313 AC_MSG_ERROR([Unable to find libresolv which is required for z/OS]) 314 ]) 315 ]) 316 317 318 dnl iOS 10? 319 AS_IF([test "x$host_vendor" = "xapple"], [ 320 AC_MSG_CHECKING([for iOS minimum version 10 or later]) 321 AC_COMPILE_IFELSE([ 322 AC_LANG_PROGRAM([[ 323 #include <stdio.h> 324 #include <AvailabilityMacros.h> 325 #include <TargetConditionals.h> 326 ]], [[ 327 #if TARGET_OS_IPHONE == 0 || __IPHONE_OS_VERSION_MIN_REQUIRED < 100000 328 #error Not iOS 10 or later 329 #endif 330 return 0; 331 ]]) 332 ],[ 333 AC_MSG_RESULT([yes]) 334 ac_cv_ios_10="yes" 335 ],[ 336 AC_MSG_RESULT([no]) 337 ]) 338 ]) 339 340 dnl macOS 10.12? 341 AS_IF([test "x$host_vendor" = "xapple"], [ 342 AC_MSG_CHECKING([for macOS minimum version 10.12 or later]) 343 AC_COMPILE_IFELSE([ 344 AC_LANG_PROGRAM([[ 345 #include <stdio.h> 346 #include <AvailabilityMacros.h> 347 #include <TargetConditionals.h> 348 ]], [[ 349 #ifndef MAC_OS_X_VERSION_10_12 350 # define MAC_OS_X_VERSION_10_12 101200 351 #endif 352 #if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_12 353 #error Not macOS 10.12 or later 354 #endif 355 return 0; 356 ]]) 357 ],[ 358 AC_MSG_RESULT([yes]) 359 ac_cv_macos_10_12="yes" 360 ],[ 361 AC_MSG_RESULT([no]) 362 ]) 363 ]) 364 365 AC_MSG_CHECKING([whether to use libgcc]) 366 AC_ARG_ENABLE(libgcc, 367 AS_HELP_STRING([--enable-libgcc],[use libgcc when linking]), 368 [ case "$enableval" in 369 yes) 370 LIBS="$LIBS -lgcc" 371 AC_MSG_RESULT(yes) 372 ;; 373 *) 374 AC_MSG_RESULT(no) 375 ;; 376 esac ], 377 AC_MSG_RESULT(no) 378 ) 379 380 dnl check for a few basic system headers we need. It would be nice if we could 381 dnl split these on separate lines, but for some reason autotools on Windows doesn't 382 dnl allow this, even tried ending lines with a backslash. 383 AC_CHECK_HEADERS([malloc.h memory.h AvailabilityMacros.h sys/types.h sys/time.h sys/select.h sys/socket.h sys/filio.h sys/ioctl.h sys/param.h sys/uio.h sys/random.h sys/event.h sys/epoll.h assert.h iphlpapi.h netioapi.h netdb.h netinet/in.h netinet6/in6.h netinet/tcp.h net/if.h ifaddrs.h fcntl.h errno.h socket.h strings.h stdbool.h time.h poll.h limits.h arpa/nameser.h arpa/nameser_compat.h arpa/inet.h sys/system_properties.h ], 384 dnl to do if not found 385 [], 386 dnl to do if found 387 [], 388 dnl default includes 389 [ 390 #ifdef HAVE_SYS_TYPES_H 391 #include <sys/types.h> 392 #endif 393 #ifdef HAVE_SYS_TIME_H 394 #include <sys/time.h> 395 #endif 396 dnl We do this default-include simply to make sure that the nameser_compat.h 397 dnl header *REALLY* can be include after the new nameser.h. It seems AIX 5.1 398 dnl (and others?) is not designed to allow this. 399 #ifdef HAVE_ARPA_NAMESER_H 400 #include <arpa/nameser.h> 401 #endif 402 403 dnl *Sigh* these are needed in order for net/if.h to get properly detected. 404 #ifdef HAVE_SYS_SOCKET_H 405 #include <sys/socket.h> 406 #endif 407 #ifdef HAVE_NETINET_IN_H 408 #include <netinet/in.h> 409 #endif 410 ] 411 ) 412 413 414 cares_all_includes=" 415 #include <stdio.h> 416 #include <stdlib.h> 417 #ifdef HAVE_AVAILABILITYMACROS_H 418 # include <AvailabilityMacros.h> 419 #endif 420 #ifdef HAVE_SYS_UIO_H 421 # include <sys/uio.h> 422 #endif 423 #ifdef HAVE_NETINET_IN_H 424 # include <netinet/in.h> 425 #endif 426 #ifdef HAVE_TCP_H 427 # include <tcp.h> 428 #endif 429 #ifdef HAVE_SYS_FILIO_H 430 # include <sys/filio.h> 431 #endif 432 #ifdef HAVE_SYS_IOCTL_H 433 # include <sys/ioctl.h> 434 #endif 435 #ifdef HAVE_UNISTD_H 436 # include <unistd.h> 437 #endif 438 #ifdef HAVE_STRING_H 439 # include <string.h> 440 #endif 441 #ifdef HAVE_STRINGS_H 442 # include <strings.h> 443 #endif 444 #ifdef HAVE_TIME_H 445 # include <time.h> 446 #endif 447 #ifdef HAVE_SYS_TIME_H 448 # include <sys/time.h> 449 #endif 450 #ifdef HAVE_SYS_TYPES_H 451 # include <sys/types.h> 452 #endif 453 #ifdef HAVE_SYS_STAT_H 454 # include <sys/stat.h> 455 #endif 456 #ifdef HAVE_SYS_RANDOM_H 457 # include <sys/random.h> 458 #endif 459 #ifdef HAVE_SYS_EVENT_H 460 # include <sys/event.h> 461 #endif 462 #ifdef HAVE_SYS_EPOLL_H 463 # include <sys/epoll.h> 464 #endif 465 #ifdef HAVE_SYS_SOCKET_H 466 # include <sys/socket.h> 467 #endif 468 #ifdef HAVE_SYS_PARAM_H 469 # include <sys/param.h> 470 #endif 471 #ifdef HAVE_FCNTL_H 472 # include <fcntl.h> 473 #endif 474 #ifdef HAVE_POLL_H 475 # include <poll.h> 476 #endif 477 #ifdef HAVE_NET_IF_H 478 # include <net/if.h> 479 #endif 480 #ifdef HAVE_IFADDRS_H 481 # include <ifaddrs.h> 482 #endif 483 #ifdef HAVE_NETINET_IN_H 484 # include <netinet/in.h> 485 #endif 486 #ifdef HAVE_NETINET_TCP_H 487 # include <netinet/tcp.h> 488 #endif 489 #ifdef HAVE_NETDB_H 490 # include <netdb.h> 491 #endif 492 #ifdef HAVE_ARPA_INET_H 493 # include <arpa/inet.h> 494 #endif 495 #ifdef HAVE_RESOLV_H 496 # include <resolv.h> 497 #endif 498 #ifdef HAVE_SYS_SYSTEM_PROPERTIES_H 499 # include <sys/system_properties.h> 500 #endif 501 #ifdef HAVE_IPHLPAPI_H 502 # include <iphlpapi.h> 503 #endif 504 #ifdef HAVE_NETIOAPI_H 505 # include <netioapi.h> 506 #endif 507 #ifdef HAVE_WINSOCK2_H 508 # include <winsock2.h> 509 #endif 510 #ifdef HAVE_WS2IPDEF_H 511 # include <ws2ipdef.h> 512 #endif 513 #ifdef HAVE_WS2TCPIP_H 514 # include <ws2tcpip.h> 515 #endif 516 #ifdef HAVE_WINDOWS_H 517 # include <windows.h> 518 #endif 519 " 520 521 AC_CHECK_DECL([HAVE_ARPA_NAMESER_H],[CARES_DEFINE_UNQUOTED([CARES_HAVE_ARPA_NAMESER_H])], []) 522 AC_CHECK_DECL([HAVE_ARPA_NAMESER_COMPAT_H],[CARES_DEFINE_UNQUOTED([CARES_HAVE_ARPA_NAMESER_COMPAT_H])],[]) 523 AC_CHECK_TYPE(long long, [AC_DEFINE(HAVE_LONGLONG, 1, [Define to 1 if the compiler supports the 'long long' data type.])]) 524 AC_CHECK_TYPE(ssize_t, [ CARES_TYPEOF_ARES_SSIZE_T=ssize_t ], [ CARES_TYPEOF_ARES_SSIZE_T=int ]) 525 AC_DEFINE_UNQUOTED([CARES_TYPEOF_ARES_SSIZE_T], ${CARES_TYPEOF_ARES_SSIZE_T}, [the signed version of size_t]) 526 527 AC_CHECK_TYPE(socklen_t, 528 [ 529 AC_DEFINE(HAVE_SOCKLEN_T, [], [socklen_t]) 530 CARES_DEFINE_UNQUOTED([CARES_TYPEOF_ARES_SOCKLEN_T], [socklen_t]) 531 ], 532 [ CARES_DEFINE_UNQUOTED([CARES_TYPEOF_ARES_SOCKLEN_T], [int]) ], 533 $cares_all_includes 534 ) 535 536 AC_CHECK_TYPE(SOCKET, [], [], $cares_all_includes) 537 538 dnl ############################################################################### 539 540 dnl clock_gettime might require an external library 541 AC_SEARCH_LIBS([clock_gettime], [rt posix4]) 542 543 dnl Use AC_CHECK_DECL not AC_CHECK_FUNCS, while this doesn't do a linkage test, 544 dnl it just makes sure the headers define it, this is the only thing without 545 dnl a complex workaround on Windows that will do what we need. See: 546 dnl https://github.com/msys2/msys2/wiki/Porting/f87a222118b1008ebc166ad237f04edb759c8f4c#calling-conventions-stdcall-and-autotools 547 dnl https://lists.gnu.org/archive/html/autoconf/2013-05/msg00085.html 548 dnl and for a more complex workaround, we'd need to use AC_LINK_IFELSE like: 549 dnl https://mailman.videolan.org/pipermail/vlc-devel/2015-March/101802.html 550 dnl which would require we check each individually and provide function arguments 551 dnl for the test. 552 553 AC_CHECK_DECL(strnlen, [AC_DEFINE([HAVE_STRNLEN], 1, [Define to 1 if you have `strnlen`] )], [], $cares_all_includes) 554 AC_CHECK_DECL(memmem, [AC_DEFINE([HAVE_MEMMEM], 1, [Define to 1 if you have `memmem`] )], [], $cares_all_includes) 555 AC_CHECK_DECL(recv, [AC_DEFINE([HAVE_RECV], 1, [Define to 1 if you have `recv`] )], [], $cares_all_includes) 556 AC_CHECK_DECL(recvfrom, [AC_DEFINE([HAVE_RECVFROM], 1, [Define to 1 if you have `recvfrom`] )], [], $cares_all_includes) 557 AC_CHECK_DECL(send, [AC_DEFINE([HAVE_SEND], 1, [Define to 1 if you have `send`] )], [], $cares_all_includes) 558 AC_CHECK_DECL(sendto, [AC_DEFINE([HAVE_SENDTO], 1, [Define to 1 if you have `sendto`] )], [], $cares_all_includes) 559 AC_CHECK_DECL(getnameinfo, [AC_DEFINE([HAVE_GETNAMEINFO], 1, [Define to 1 if you have `getnameinfo`] )], [], $cares_all_includes) 560 AC_CHECK_DECL(gethostname, [AC_DEFINE([HAVE_GETHOSTNAME], 1, [Define to 1 if you have `gethostname`] )], [], $cares_all_includes) 561 AC_CHECK_DECL(connect, [AC_DEFINE([HAVE_CONNECT], 1, [Define to 1 if you have `connect`] )], [], $cares_all_includes) 562 AC_CHECK_DECL(connectx, [AC_DEFINE([HAVE_CONNECTX], 1, [Define to 1 if you have `connectx`] )], [], $cares_all_includes) 563 AC_CHECK_DECL(closesocket, [AC_DEFINE([HAVE_CLOSESOCKET], 1, [Define to 1 if you have `closesocket`] )], [], $cares_all_includes) 564 AC_CHECK_DECL(CloseSocket, [AC_DEFINE([HAVE_CLOSESOCKET_CAMEL], 1, [Define to 1 if you have `CloseSocket`] )], [], $cares_all_includes) 565 AC_CHECK_DECL(fcntl, [AC_DEFINE([HAVE_FCNTL], 1, [Define to 1 if you have `fcntl`] )], [], $cares_all_includes) 566 AC_CHECK_DECL(getenv, [AC_DEFINE([HAVE_GETENV], 1, [Define to 1 if you have `getenv`] )], [], $cares_all_includes) 567 AC_CHECK_DECL(gethostname, [AC_DEFINE([HAVE_GETHOSTNAME], 1, [Define to 1 if you have `gethostname`] )], [], $cares_all_includes) 568 AC_CHECK_DECL(getrandom, [AC_DEFINE([HAVE_GETRANDOM], 1, [Define to 1 if you have `getrandom`] )], [], $cares_all_includes) 569 AC_CHECK_DECL(getservbyport_r, [AC_DEFINE([HAVE_GETSERVBYPORT_R], 1, [Define to 1 if you have `getservbyport_r`])], [], $cares_all_includes) 570 AC_CHECK_DECL(inet_net_pton, [AC_DEFINE([HAVE_INET_NET_PTON], 1, [Define to 1 if you have `inet_net_pton`] )], [], $cares_all_includes) 571 AC_CHECK_DECL(inet_ntop, [AC_DEFINE([HAVE_INET_NTOP], 1, [Define to 1 if you have `inet_ntop`] )], [], $cares_all_includes) 572 AC_CHECK_DECL(inet_pton, [AC_DEFINE([HAVE_INET_PTON], 1, [Define to 1 if you have `inet_pton`] )], [], $cares_all_includes) 573 AC_CHECK_DECL(ioctl, [AC_DEFINE([HAVE_IOCTL], 1, [Define to 1 if you have `ioctl`] )], [], $cares_all_includes) 574 AC_CHECK_DECL(ioctlsocket, [AC_DEFINE([HAVE_IOCTLSOCKET], 1, [Define to 1 if you have `ioctlsocket`] )], [], $cares_all_includes) 575 AC_CHECK_DECL(IoctlSocket, [AC_DEFINE([HAVE_IOCTLSOCKET_CAMEL], 1, [Define to 1 if you have `IoctlSocket`] )], [], $cares_all_includes) 576 AC_CHECK_DECL(setsockopt, [AC_DEFINE([HAVE_SETSOCKOPT], 1, [Define to 1 if you have `setsockopt`] )], [], $cares_all_includes) 577 AC_CHECK_DECL(socket, [AC_DEFINE([HAVE_SOCKET], 1, [Define to 1 if you have `socket`] )], [], $cares_all_includes) 578 AC_CHECK_DECL(strcasecmp, [AC_DEFINE([HAVE_STRCASECMP], 1, [Define to 1 if you have `strcasecmp`] )], [], $cares_all_includes) 579 AC_CHECK_DECL(strdup, [AC_DEFINE([HAVE_STRDUP], 1, [Define to 1 if you have `strdup`] )], [], $cares_all_includes) 580 AC_CHECK_DECL(stricmp, [AC_DEFINE([HAVE_STRICMP], 1, [Define to 1 if you have `stricmp`] )], [], $cares_all_includes) 581 AC_CHECK_DECL(strncasecmp, [AC_DEFINE([HAVE_STRNCASECMP], 1, [Define to 1 if you have `strncasecmp`] )], [], $cares_all_includes) 582 AC_CHECK_DECL(strncmpi, [AC_DEFINE([HAVE_STRNCMPI], 1, [Define to 1 if you have `strncmpi`] )], [], $cares_all_includes) 583 AC_CHECK_DECL(strnicmp, [AC_DEFINE([HAVE_STRNICMP], 1, [Define to 1 if you have `strnicmp`] )], [], $cares_all_includes) 584 AC_CHECK_DECL(writev, [AC_DEFINE([HAVE_WRITEV], 1, [Define to 1 if you have `writev`] )], [], $cares_all_includes) 585 AC_CHECK_DECL(arc4random_buf, [AC_DEFINE([HAVE_ARC4RANDOM_BUF], 1, [Define to 1 if you have `arc4random_buf`] )], [], $cares_all_includes) 586 AC_CHECK_DECL(stat, [AC_DEFINE([HAVE_STAT], 1, [Define to 1 if you have `stat`] )], [], $cares_all_includes) 587 AC_CHECK_DECL(gettimeofday, [AC_DEFINE([HAVE_GETTIMEOFDAY], 1, [Define to 1 if you have `gettimeofday`] )], [], $cares_all_includes) 588 AC_CHECK_DECL(clock_gettime, [AC_DEFINE([HAVE_CLOCK_GETTIME], 1, [Define to 1 if you have `clock_gettime`] )], [], $cares_all_includes) 589 AC_CHECK_DECL(if_indextoname, [AC_DEFINE([HAVE_IF_INDEXTONAME], 1, [Define to 1 if you have `if_indextoname`] )], [], $cares_all_includes) 590 AC_CHECK_DECL(if_nametoindex, [AC_DEFINE([HAVE_IF_NAMETOINDEX], 1, [Define to 1 if you have `if_nametoindex`] )], [], $cares_all_includes) 591 AC_CHECK_DECL(getifaddrs, [AC_DEFINE([HAVE_GETIFADDRS], 1, [Define to 1 if you have `getifaddrs`] )], [], $cares_all_includes) 592 AC_CHECK_DECL(poll, [AC_DEFINE([HAVE_POLL], 1, [Define to 1 if you have `poll`] )], [], $cares_all_includes) 593 AC_CHECK_DECL(pipe, [AC_DEFINE([HAVE_PIPE], 1, [Define to 1 if you have `pipe`] )], [], $cares_all_includes) 594 AC_CHECK_DECL(pipe2, [AC_DEFINE([HAVE_PIPE2], 1, [Define to 1 if you have `pipe2`] )], [], $cares_all_includes) 595 AC_CHECK_DECL(kqueue, [AC_DEFINE([HAVE_KQUEUE], 1, [Define to 1 if you have `kqueue`] )], [], $cares_all_includes) 596 AC_CHECK_DECL(epoll_create1, [AC_DEFINE([HAVE_EPOLL], 1, [Define to 1 if you have `epoll_{create1,ctl,wait}`])], [], $cares_all_includes) 597 AC_CHECK_DECL(GetBestRoute2, [AC_DEFINE([HAVE_GETBESTROUTE2], 1, [Define to 1 if you have `GetBestRoute2`] )], [], $cares_all_includes) 598 AC_CHECK_DECL(ConvertInterfaceIndexToLuid, [AC_DEFINE([HAVE_CONVERTINTERFACEINDEXTOLUID], 1, [Define to 1 if you have `ConvertInterfaceIndexToLuid`])], [], $cares_all_includes) 599 AC_CHECK_DECL(ConvertInterfaceLuidToNameA, [AC_DEFINE([HAVE_CONVERTINTERFACELUIDTONAMEA], 1, [Define to 1 if you have `ConvertInterfaceLuidToNameA`])], [], $cares_all_includes) 600 AC_CHECK_DECL(NotifyIpInterfaceChange, [AC_DEFINE([HAVE_NOTIFYIPINTERFACECHANGE], 1, [Define to 1 if you have `NotifyIpInterfaceChange`] )], [], $cares_all_includes) 601 AC_CHECK_DECL(RegisterWaitForSingleObject, [AC_DEFINE([HAVE_REGISTERWAITFORSINGLEOBJECT], 1, [Define to 1 if you have `RegisterWaitForSingleObject`])], [], $cares_all_includes) 602 AC_CHECK_DECL(__system_property_get, [AC_DEFINE([HAVE___SYSTEM_PROPERTY_GET], 1, [Define to 1 if you have `__system_property_get`] )], [], $cares_all_includes) 603 604 605 dnl ############################################################################### 606 dnl recv, recvfrom, send, getnameinfo, gethostname 607 dnl ARGUMENTS AND RETURN VALUES 608 609 if test "x$ac_cv_type_ssize_t" = "xyes" -a "x$ac_cv_type_socklen_t" = "xyes" -a "x$ac_cv_native_windows" != "xyes" ; then 610 recvfrom_type_retv="ssize_t" 611 recvfrom_type_arg3="size_t" 612 else 613 recvfrom_type_retv="int" 614 recvfrom_type_arg3="int" 615 fi 616 617 if test "x$ac_cv_type_SOCKET" = "xyes" ; then 618 dnl If the SOCKET type is defined, it uses socket ... should be windows only 619 recvfrom_type_arg1="SOCKET" 620 else 621 recvfrom_type_arg1="int" 622 fi 623 624 if test "x$ac_cv_type_socklen_t" = "xyes" ; then 625 recvfrom_type_arg6="socklen_t *" 626 getnameinfo_type_arg2="socklen_t" 627 getnameinfo_type_arg46="socklen_t" 628 else 629 recvfrom_type_arg6="int *" 630 getnameinfo_type_arg2="int" 631 getnameinfo_type_arg46="int" 632 fi 633 634 if test "x$ac_cv_native_windows" = "xyes" ; then 635 recv_type_arg2="char *" 636 else 637 recv_type_arg2="void *" 638 fi 639 640 dnl Functions are typically consistent so the equivalent fields map ... equivalently 641 recv_type_retv=${recvfrom_type_retv} 642 send_type_retv=${recvfrom_type_retv} 643 recv_type_arg1=${recvfrom_type_arg1} 644 recvfrom_type_arg2=${recv_type_arg2} 645 send_type_arg1=${recvfrom_type_arg1} 646 recv_type_arg3=${recvfrom_type_arg3} 647 send_type_arg3=${recvfrom_type_arg3} 648 gethostname_type_arg2=${recvfrom_type_arg3} 649 650 dnl These should always be "sane" values to use always 651 recvfrom_qual_arg5= 652 recvfrom_type_arg4=int 653 recvfrom_type_arg5="struct sockaddr *" 654 recv_type_arg4=int 655 getnameinfo_type_arg1="struct sockaddr *" 656 getnameinfo_type_arg7=int 657 send_type_arg2="const void *" 658 send_type_arg4=int 659 660 AC_DEFINE_UNQUOTED([RECVFROM_TYPE_RETV], [ ${recvfrom_type_retv} ], [ recvfrom() return value ]) 661 AC_DEFINE_UNQUOTED([RECVFROM_TYPE_ARG1], [ ${recvfrom_type_arg1} ], [ recvfrom() arg1 type ]) 662 AC_DEFINE_UNQUOTED([RECVFROM_TYPE_ARG2], [ ${recvfrom_type_arg2} ], [ recvfrom() arg2 type ]) 663 AC_DEFINE_UNQUOTED([RECVFROM_TYPE_ARG3], [ ${recvfrom_type_arg3} ], [ recvfrom() arg3 type ]) 664 AC_DEFINE_UNQUOTED([RECVFROM_TYPE_ARG4], [ ${recvfrom_type_arg4} ], [ recvfrom() arg4 type ]) 665 AC_DEFINE_UNQUOTED([RECVFROM_TYPE_ARG5], [ ${recvfrom_type_arg5} ], [ recvfrom() arg5 type ]) 666 AC_DEFINE_UNQUOTED([RECVFROM_QUAL_ARG5], [ ${recvfrom_qual_arg5}], [ recvfrom() arg5 qualifier]) 667 668 AC_DEFINE_UNQUOTED([RECV_TYPE_RETV], [ ${recv_type_retv} ], [ recv() return value ]) 669 AC_DEFINE_UNQUOTED([RECV_TYPE_ARG1], [ ${recv_type_arg1} ], [ recv() arg1 type ]) 670 AC_DEFINE_UNQUOTED([RECV_TYPE_ARG2], [ ${recv_type_arg2} ], [ recv() arg2 type ]) 671 AC_DEFINE_UNQUOTED([RECV_TYPE_ARG3], [ ${recv_type_arg3} ], [ recv() arg3 type ]) 672 AC_DEFINE_UNQUOTED([RECV_TYPE_ARG4], [ ${recv_type_arg4} ], [ recv() arg4 type ]) 673 674 AC_DEFINE_UNQUOTED([SEND_TYPE_RETV], [ ${send_type_retv} ], [ send() return value ]) 675 AC_DEFINE_UNQUOTED([SEND_TYPE_ARG1], [ ${send_type_arg1} ], [ send() arg1 type ]) 676 AC_DEFINE_UNQUOTED([SEND_TYPE_ARG2], [ ${send_type_arg2} ], [ send() arg2 type ]) 677 AC_DEFINE_UNQUOTED([SEND_TYPE_ARG3], [ ${send_type_arg3} ], [ send() arg3 type ]) 678 AC_DEFINE_UNQUOTED([SEND_TYPE_ARG4], [ ${send_type_arg4} ], [ send() arg4 type ]) 679 680 AC_DEFINE_UNQUOTED([GETNAMEINFO_TYPE_ARG1], [ ${getnameinfo_type_arg1} ], [ getnameinfo() arg1 type ]) 681 AC_DEFINE_UNQUOTED([GETNAMEINFO_TYPE_ARG2], [ ${getnameinfo_type_arg2} ], [ getnameinfo() arg2 type ]) 682 AC_DEFINE_UNQUOTED([GETNAMEINFO_TYPE_ARG7], [ ${getnameinfo_type_arg7} ], [ getnameinfo() arg7 type ]) 683 AC_DEFINE_UNQUOTED([GETNAMEINFO_TYPE_ARG46], [ ${getnameinfo_type_arg46} ], [ getnameinfo() arg4 and 6 type ]) 684 685 AC_DEFINE_UNQUOTED([GETHOSTNAME_TYPE_ARG2], [ ${gethostname_type_arg2} ], [ gethostname() arg2 type ]) 686 dnl ############################################################################### 687 688 689 if test "$ac_cv_have_decl_getservbyport_r" = "yes" ; then 690 AC_MSG_CHECKING([number of arguments for getservbyport_r()]) 691 getservbyport_r_args=6 692 case $host_os in 693 solaris*) 694 getservbyport_r_args=5 695 ;; 696 aix*|openbsd*) 697 getservbyport_r_args=4 698 ;; 699 esac 700 AC_MSG_RESULT([$getservbyport_r_args]) 701 AC_DEFINE_UNQUOTED([GETSERVBYPORT_R_ARGS], [ $getservbyport_r_args ], [ number of arguments for getservbyport_r() ]) 702 fi 703 704 if test "$ac_cv_have_decl_getservbyname_r" = "yes" ; then 705 AC_MSG_CHECKING([number of arguments for getservbyname_r()]) 706 getservbyname_r_args=6 707 case $host_os in 708 solaris*) 709 getservbyname_r_args=5 710 ;; 711 aix*|openbsd*) 712 getservbyname_r_args=4 713 ;; 714 esac 715 AC_DEFINE_UNQUOTED([GETSERVBYNAME_R_ARGS], [ $getservbyname_r_args ], [ number of arguments for getservbyname_r() ]) 716 AC_MSG_RESULT([$getservbyname_r_args]) 717 fi 718 719 AC_TYPE_SIZE_T 720 AC_CHECK_DECL(AF_INET6, [AC_DEFINE([HAVE_AF_INET6],1,[Define to 1 if you have AF_INET6])], [], $cares_all_includes) 721 AC_CHECK_DECL(PF_INET6, [AC_DEFINE([HAVE_PF_INET6],1,[Define to 1 if you have PF_INET6])], [], $cares_all_includes) 722 AC_CHECK_TYPES(struct in6_addr, [], [], $cares_all_includes) 723 AC_CHECK_TYPES(struct sockaddr_in6, [], [], $cares_all_includes) 724 AC_CHECK_TYPES(struct sockaddr_storage, [], [], $cares_all_includes) 725 AC_CHECK_TYPES(struct addrinfo, [], [], $cares_all_includes) 726 AC_CHECK_TYPES(struct timeval, [], [], $cares_all_includes) 727 AC_CHECK_MEMBERS(struct sockaddr_in6.sin6_scope_id, [], [], $cares_all_includes) 728 AC_CHECK_MEMBERS(struct addrinfo.ai_flags, [], [], $cares_all_includes) 729 AC_CHECK_DECL(FIONBIO, [], [], $cares_all_includes) 730 AC_CHECK_DECL(O_NONBLOCK, [], [], $cares_all_includes) 731 AC_CHECK_DECL(SO_NONBLOCK, [], [], $cares_all_includes) 732 AC_CHECK_DECL(MSG_NOSIGNAL, [], [], $cares_all_includes) 733 AC_CHECK_DECL(CLOCK_MONOTONIC, [], [], $cares_all_includes) 734 735 if test "$ac_cv_have_decl_CLOCK_MONOTONIC" = "yes" -a "$ac_cv_have_decl_clock_gettime" = "yes" ; then 736 AC_DEFINE([HAVE_CLOCK_GETTIME_MONOTONIC], [ 1 ], [ clock_gettime() with CLOCK_MONOTONIC support ]) 737 fi 738 739 if test "$ac_cv_have_decl_FIONBIO" = "yes" -a "$ac_cv_have_decl_ioctl" = "yes" ; then 740 AC_DEFINE([HAVE_IOCTL_FIONBIO], [ 1 ], [ ioctl() with FIONBIO support ]) 741 fi 742 if test "$ac_cv_have_decl_FIONBIO" = "yes" -a "$ac_cv_have_decl_ioctlsocket" = "yes" ; then 743 AC_DEFINE([HAVE_IOCTLSOCKET_FIONBIO], [ 1 ], [ ioctlsocket() with FIONBIO support ]) 744 fi 745 if test "$ac_cv_have_decl_SO_NONBLOCK" = "yes" -a "$ac_cv_have_decl_setsockopt" = "yes" ; then 746 AC_DEFINE([HAVE_SETSOCKOPT_SO_NONBLOCK], [ 1 ], [ setsockopt() with SO_NONBLOCK support ]) 747 fi 748 if test "$ac_cv_have_decl_O_NONBLOCK" = "yes" -a "$ac_cv_have_decl_fcntl" = "yes" ; then 749 AC_DEFINE([HAVE_FCNTL_O_NONBLOCK], [ 1 ], [ fcntl() with O_NONBLOCK support ]) 750 fi 751 752 dnl ares_build.h.in specific defines 753 if test "x$ac_cv_header_sys_types_h" = "xyes" ; then 754 CARES_DEFINE_UNQUOTED([CARES_HAVE_SYS_TYPES_H],[1]) 755 fi 756 if test "x$ac_cv_header_sys_socket_h" = "xyes" ; then 757 CARES_DEFINE_UNQUOTED([CARES_HAVE_SYS_SOCKET_H],[1]) 758 fi 759 if test "x$ac_cv_header_sys_select_h" = "xyes" ; then 760 CARES_DEFINE_UNQUOTED([CARES_HAVE_SYS_SELECT_H],[1]) 761 fi 762 if test "x$ac_cv_header_ws2tcpip_h" = "xyes" ; then 763 CARES_DEFINE_UNQUOTED([CARES_HAVE_WS2TCPIP_H],[1]) 764 fi 765 if test "x$ac_cv_header_winsock2_h" = "xyes" ; then 766 CARES_DEFINE_UNQUOTED([CARES_HAVE_WINSOCK2_H],[1]) 767 fi 768 if test "x$ac_cv_header_windows_h" = "xyes" ; then 769 CARES_DEFINE_UNQUOTED([CARES_HAVE_WINDOWS_H],[1]) 770 fi 771 if test "x$ac_cv_header_arpa_nameser_h" = "xyes" ; then 772 CARES_DEFINE_UNQUOTED([CARES_HAVE_ARPA_NAMESER_H],[1]) 773 fi 774 if test "x$ac_cv_header_arpa_nameser_compa_h" = "xyes" ; then 775 CARES_DEFINE_UNQUOTED([CARES_HAVE_ARPA_NAMESER_COMPA_H],[1]) 776 fi 777 778 779 dnl ------------ THREADING -------------- 780 781 dnl windows always supports threads, only check non-windows systems. 782 if test "${CARES_THREADS}" = "yes" -a "x${ac_cv_native_windows}" != "xyes" ; then 783 AX_PTHREAD([ ], [ 784 AC_MSG_WARN([threads requested but not supported]) 785 CARES_THREADS=no 786 ]) 787 788 if test "${CARES_THREADS}" = "yes" ; then 789 AC_CHECK_HEADERS([pthread.h pthread_np.h]) 790 LIBS="$PTHREAD_LIBS $LIBS" 791 AM_CFLAGS="$AM_CFLAGS $PTHREAD_CFLAGS" 792 CC="$PTHREAD_CC" 793 CXX="$PTHREAD_CXX" 794 fi 795 fi 796 797 if test "${CARES_THREADS}" = "yes" ; then 798 AC_DEFINE([CARES_THREADS], [ 1 ], [Threading enabled]) 799 fi 800 801 CARES_PRIVATE_LIBS="$LIBS" 802 AC_SUBST(CARES_PRIVATE_LIBS) 803 804 BUILD_SUBDIRS="include src docs" 805 806 807 dnl ******** TESTS ******* 808 809 if test "x$build_tests" != "xno" -a "x$HAVE_CXX14" = "0" ; then 810 if test "x$build_tests" = "xmaybe" ; then 811 AC_MSG_WARN([cannot build tests without a CXX14 compiler]) 812 build_tests=no 813 else 814 AC_MSG_ERROR([*** Building tests requires a CXX14 compiler]) 815 fi 816 fi 817 if test "x$build_tests" != "xno" -a "x$cross_compiling" = "xyes" ; then 818 if test "x$build_tests" = "xmaybe" ; then 819 AC_MSG_WARN([cannot build tests when cross compiling]) 820 build_tests=no 821 else 822 AC_MSG_ERROR([*** Tests not supported when cross compiling]) 823 fi 824 fi 825 826 dnl Forces compiling of tests even when cross-compiling. 827 AC_ARG_ENABLE(tests-crossbuild, 828 AS_HELP_STRING([--enable-tests-crossbuild], [Enable test building even when cross building]), 829 [build_tests="$enableval"] 830 ) 831 832 if test "x$build_tests" != "xno" ; then 833 PKG_CHECK_MODULES([GMOCK], [gmock], [ have_gmock=yes ], [ have_gmock=no ]) 834 if test "x$have_gmock" = "xno" ; then 835 if test "x$build_tests" = "xmaybe" ; then 836 AC_MSG_WARN([gmock could not be found, not building tests]) 837 build_tests=no 838 else 839 AC_MSG_ERROR([tests require gmock]) 840 fi 841 else 842 PKG_CHECK_MODULES([GMOCK112], [gmock >= 1.12.0], [ have_gmock_v112=yes ], [ have_gmock_v112=no ]) 843 if test "x$have_gmock_v112" = "xyes" ; then 844 ARES_CHECK_USER_NAMESPACE 845 ARES_CHECK_UTS_NAMESPACE 846 fi 847 fi 848 fi 849 if test "x$build_tests" != "xno" ; then 850 build_tests=yes 851 852 AX_CXX_COMPILE_STDCXX_14([noext],[mandatory]) 853 if test "$ac_cv_native_windows" != "yes" ; then 854 AX_PTHREAD([ CARES_TEST_PTHREADS="yes" ], [ AC_MSG_ERROR([threading required for tests]) ]) 855 fi 856 857 BUILD_SUBDIRS="${BUILD_SUBDIRS} test" 858 fi 859 AC_MSG_CHECKING([whether to build tests]) 860 AC_MSG_RESULT([$build_tests]) 861 862 AM_CONDITIONAL(BUILD_TESTS, test "x$build_tests" = "xyes") 863 864 AC_SUBST(AM_CFLAGS) 865 AC_SUBST(AM_CPPFLAGS) 866 AC_SUBST(PKGCONFIG_CFLAGS) 867 AC_SUBST(BUILD_SUBDIRS) 868 869 AC_CONFIG_FILES([Makefile 870 include/Makefile 871 src/Makefile 872 src/lib/Makefile 873 src/tools/Makefile 874 docs/Makefile 875 libcares.pc ]) 876 AM_COND_IF([BUILD_TESTS], 877 [AC_CONFIG_FILES([test/Makefile])]) 878 879 AC_OUTPUT