1AC_PREREQ([2.60]) 2 3AC_INIT([c-ares], [1.18.1], 4 [c-ares mailing list: http://lists.haxx.se/listinfo/c-ares]) 5 6CARES_VERSION_INFO="7:1:5" 7dnl This flag accepts an argument of the form current[:revision[:age]]. So, 8dnl passing -version-info 3:12:1 sets current to 3, revision to 12, and age to 9dnl 1. 10dnl 11dnl If either revision or age are omitted, they default to 0. Also note that age 12dnl must be less than or equal to the current interface number. 13dnl 14dnl Here are a set of rules to help you update your library version information: 15dnl 16dnl 1.Start with version information of 0:0:0 for each libtool library. 17dnl 18dnl 2.Update the version information only immediately before a public release of 19dnl your software. More frequent updates are unnecessary, and only guarantee 20dnl that the current interface number gets larger faster. 21dnl 22dnl 3.If the library source code has changed at all since the last update, then 23dnl increment revision (c:r+1:a) 24dnl 25dnl 4.If any interfaces have been added, removed, or changed since the last 26dnl update, increment current, and set revision to 0. (c+1:r=0:a) 27dnl 28dnl 5.If any interfaces have been added since the last public release, then 29dnl increment age. (c:r:a+1) 30dnl 31dnl 6.If any interfaces have been removed since the last public release, then 32dnl set age to 0. (c:r:a=0) 33dnl 34AC_SUBST([CARES_VERSION_INFO]) 35 36AC_CONFIG_SRCDIR([src/lib/ares_ipv6.h]) 37AC_CONFIG_HEADERS([src/lib/ares_config.h include/ares_build.h]) 38AC_CONFIG_MACRO_DIR([m4]) 39AM_MAINTAINER_MODE 40m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) 41 42AX_REQUIRE_DEFINED([AX_CXX_COMPILE_STDCXX_11]) 43 44CARES_CHECK_OPTION_DEBUG 45CARES_CHECK_OPTION_OPTIMIZE 46CARES_CHECK_OPTION_WARNINGS 47CARES_CHECK_OPTION_WERROR 48CARES_CHECK_OPTION_SYMBOL_HIDING 49CARES_CHECK_OPTION_EXPOSE_STATICS 50 51XC_CHECK_PATH_SEPARATOR 52 53dnl SED is mandatory for configure process and libtool. 54dnl Set it now, allowing it to be changed later. 55AC_PATH_PROG([SED], [sed], [not_found], 56 [$PATH:/usr/bin:/usr/local/bin]) 57if test -z "$SED" || test "$SED" = "not_found"; then 58 AC_MSG_ERROR([sed not found in PATH. Cannot continue without sed.]) 59fi 60AC_SUBST([SED]) 61 62dnl GREP is mandatory for configure process and libtool. 63dnl Set it now, allowing it to be changed later. 64AC_PATH_PROG([GREP], [grep], [not_found], 65 [$PATH:/usr/bin:/usr/local/bin]) 66if test -z "$GREP" || test "$GREP" = "not_found"; then 67 AC_MSG_ERROR([grep not found in PATH. Cannot continue without grep.]) 68fi 69AC_SUBST([GREP]) 70 71dnl EGREP is mandatory for configure process and libtool. 72dnl Set it now, allowing it to be changed later. 73if echo a | ($GREP -E '(a|b)') >/dev/null 2>&1; then 74 AC_MSG_CHECKING([for egrep]) 75 EGREP="$GREP -E" 76 AC_MSG_RESULT([$EGREP]) 77else 78 AC_PATH_PROG([EGREP], [egrep], [not_found], 79 [$PATH:/usr/bin:/usr/local/bin]) 80fi 81if test -z "$EGREP" || test "$EGREP" = "not_found"; then 82 AC_MSG_ERROR([egrep not found in PATH. Cannot continue without egrep.]) 83fi 84AC_SUBST([EGREP]) 85 86dnl AR is mandatory for configure process and libtool. 87dnl This is target dependent, so check it as a tool. 88if 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.]) 94 fi 95fi 96AC_SUBST([AR]) 97 98AX_CODE_COVERAGE 99 100 101dnl 102dnl Detect the canonical host and target build environment 103dnl 104 105AC_CANONICAL_HOST 106dnl Get system canonical name 107AC_DEFINE_UNQUOTED(OS, "${host}", [cpu-machine-OS]) 108 109XC_CHECK_PROG_CC 110AX_CXX_COMPILE_STDCXX_11([noext],[optional]) 111 112XC_AUTOMAKE 113 114dnl This defines _ALL_SOURCE for AIX 115CARES_CHECK_AIX_ALL_SOURCE 116 117dnl Our configure and build reentrant settings 118CARES_CONFIGURE_THREAD_SAFE 119CARES_CONFIGURE_REENTRANT 120 121dnl check for how to do large files 122AC_SYS_LARGEFILE 123 124case $host_os in 125 solaris*) 126 AC_DEFINE(ETC_INET, 1, [if a /etc/inet dir is being used]) 127 ;; 128esac 129 130XC_LIBTOOL 131 132 133# 134# Automake conditionals based on libtool related checks 135# 136 137AM_CONDITIONAL([CARES_LT_SHLIB_USE_VERSION_INFO], 138 [test "x$xc_lt_shlib_use_version_info" = 'xyes']) 139AM_CONDITIONAL([CARES_LT_SHLIB_USE_NO_UNDEFINED], 140 [test "x$xc_lt_shlib_use_no_undefined" = 'xyes']) 141AM_CONDITIONAL([CARES_LT_SHLIB_USE_MIMPURE_TEXT], 142 [test "x$xc_lt_shlib_use_mimpure_text" = 'xyes']) 143 144# 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. 153# 154 155# 156# Make our Makefile.am files use the staticlib CPPFLAG only when strictly 157# targeting a static library and not building its shared counterpart. 158# 159 160AM_CONDITIONAL([USE_CPPFLAG_CARES_STATICLIB], 161 [test "x$xc_lt_build_static_only" = 'xyes']) 162 163# 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. 167# 168 169CPPFLAG_CARES_STATICLIB= 170if test "x$xc_lt_build_static_only" = 'xyes'; then 171 CPPFLAG_CARES_STATICLIB='-DCARES_STATICLIB' 172fi 173AC_SUBST([CPPFLAG_CARES_STATICLIB]) 174 175dnl ********************************************************************** 176dnl platform/compiler/architecture specific checks/flags 177dnl ********************************************************************** 178 179CARES_CHECK_COMPILER 180CARES_SET_COMPILER_BASIC_OPTS 181CARES_SET_COMPILER_DEBUG_OPTS 182CARES_SET_COMPILER_OPTIMIZE_OPTS 183CARES_SET_COMPILER_WARNING_OPTS 184 185if test "$compiler_id" = "INTEL_UNIX_C"; then 186 # 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 191 dnl icc 9.X specific 192 CFLAGS="$CFLAGS -i-dynamic" 193 fi 194 # 195fi 196 197CARES_CHECK_COMPILER_HALT_ON_ERROR 198CARES_CHECK_COMPILER_ARRAY_SIZE_NEGATIVE 199CARES_CHECK_COMPILER_PROTOTYPE_MISMATCH 200CARES_CHECK_COMPILER_SYMBOL_HIDING 201 202dnl ********************************************************************** 203dnl Compilation based checks should not be done before this point. 204dnl ********************************************************************** 205 206dnl ********************************************************************** 207dnl Make sure that our checks for headers windows.h winsock.h winsock2.h 208dnl and ws2tcpip.h take precedence over any other further checks which 209dnl could be done later using AC_CHECK_HEADER or AC_CHECK_HEADERS for 210dnl this specific header files. And do them before its results are used. 211dnl ********************************************************************** 212 213CURL_CHECK_HEADER_WINDOWS 214CURL_CHECK_NATIVE_WINDOWS 215case X-"$ac_cv_native_windows" in 216 X-yes) 217 CURL_CHECK_HEADER_WINSOCK 218 CURL_CHECK_HEADER_WINSOCK2 219 CURL_CHECK_HEADER_WS2TCPIP 220 CPPFLAGS="$CPPFLAGS -D_WIN32_WINNT=0x0600" 221 ;; 222 *) 223 ac_cv_header_winsock_h="no" 224 ac_cv_header_winsock2_h="no" 225 ac_cv_header_ws2tcpip_h="no" 226 ;; 227esac 228 229dnl ********************************************************************** 230dnl Checks for libraries. 231dnl ********************************************************************** 232 233CARES_CHECK_LIB_XNET 234 235dnl gethostbyname without lib or in the nsl lib? 236AC_CHECK_FUNC(gethostbyname, 237 [HAVE_GETHOSTBYNAME="1" 238 ], 239 [ AC_CHECK_LIB(nsl, gethostbyname, 240 [HAVE_GETHOSTBYNAME="1" 241 LIBS="$LIBS -lnsl" 242 ]) 243 ]) 244 245if test "$HAVE_GETHOSTBYNAME" != "1" 246then 247 dnl gethostbyname in the socket lib? 248 AC_CHECK_LIB(socket, gethostbyname, 249 [HAVE_GETHOSTBYNAME="1" 250 LIBS="$LIBS -lsocket" 251 ]) 252fi 253 254dnl At least one system has been identified to require BOTH nsl and socket 255dnl libs at the same time to link properly. 256if test "$HAVE_GETHOSTBYNAME" != "1" 257then 258 AC_MSG_CHECKING([for gethostbyname with both nsl and socket libs]) 259 my_ac_save_LIBS=$LIBS 260 LIBS="-lnsl -lsocket $LIBS" 261 AC_LINK_IFELSE([ 262 AC_LANG_PROGRAM([[ 263 ]],[[ 264 gethostbyname(); 265 ]]) 266 ],[ 267 AC_MSG_RESULT([yes]) 268 HAVE_GETHOSTBYNAME="1" 269 ],[ 270 AC_MSG_RESULT([no]) 271 LIBS=$my_ac_save_LIBS 272 ]) 273fi 274 275if test "$HAVE_GETHOSTBYNAME" != "1" 276then 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 280 case $host in 281 *-*-mingw32ce*) 282 winsock_LIB="-lwinsock" 283 ;; 284 *) 285 winsock_LIB="-lwsock32" 286 ;; 287 esac 288 fi 289 if test "$ac_cv_header_winsock2_h" = "yes"; then 290 winsock_LIB="-lws2_32" 291 fi 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]) 296 AC_LINK_IFELSE([ 297 AC_LANG_PROGRAM([[ 298#ifdef HAVE_WINDOWS_H 299#ifndef WIN32_LEAN_AND_MEAN 300#define WIN32_LEAN_AND_MEAN 301#endif 302#include <windows.h> 303#ifdef HAVE_WINSOCK2_H 304#include <winsock2.h> 305#else 306#ifdef HAVE_WINSOCK_H 307#include <winsock.h> 308#endif 309#endif 310#endif 311 ]],[[ 312 gethostbyname("www.dummysite.com"); 313 ]]) 314 ],[ 315 AC_MSG_RESULT([yes]) 316 HAVE_GETHOSTBYNAME="1" 317 ],[ 318 AC_MSG_RESULT([no]) 319 winsock_LIB="" 320 LIBS=$my_ac_save_LIBS 321 ]) 322 fi 323 fi 324fi 325 326if test "$HAVE_GETHOSTBYNAME" != "1" 327then 328 dnl This is for Minix 3.1 329 AC_MSG_CHECKING([for gethostbyname for Minix 3]) 330 AC_LINK_IFELSE([ 331 AC_LANG_PROGRAM([[ 332/* Older Minix versions may need <net/gen/netdb.h> here instead */ 333#include <netdb.h> 334 ]],[[ 335 gethostbyname("www.dummysite.com"); 336 ]]) 337 ],[ 338 AC_MSG_RESULT([yes]) 339 HAVE_GETHOSTBYNAME="1" 340 ],[ 341 AC_MSG_RESULT([no]) 342 ]) 343fi 344 345if test "$HAVE_GETHOSTBYNAME" != "1" 346then 347 dnl This is for eCos with a stubbed DNS implementation 348 AC_MSG_CHECKING([for gethostbyname for eCos]) 349 AC_LINK_IFELSE([ 350 AC_LANG_PROGRAM([[ 351#include <stdio.h> 352#include <netdb.h> 353 ]],[[ 354 gethostbyname("www.dummysite.com"); 355 ]]) 356 ],[ 357 AC_MSG_RESULT([yes]) 358 HAVE_GETHOSTBYNAME="1" 359 ],[ 360 AC_MSG_RESULT([no]) 361 ]) 362fi 363 364if test "$HAVE_GETHOSTBYNAME" != "1" 365then 366 dnl gethostbyname in the net lib - for BeOS 367 AC_CHECK_LIB(net, gethostbyname, 368 [HAVE_GETHOSTBYNAME="1" 369 LIBS="$LIBS -lnet" 370 ]) 371fi 372 373 374if test "$HAVE_GETHOSTBYNAME" != "1"; then 375 AC_MSG_ERROR([couldn't find libraries for gethostbyname()]) 376fi 377 378dnl resolv lib for Apple (MacOS and iOS) 379AS_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]) 382 ], [ 383 AC_MSG_ERROR([Unable to find libresolv which is required for iPhone targets]) 384 ]) 385]) 386 387dnl resolv lib for z/OS 388AS_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]) 391 ], [ 392 AC_MSG_ERROR([Unable to find libresolv which is required for z/OS]) 393 ]) 394]) 395 396dnl resolve lib? 397AC_CHECK_FUNC(strcasecmp, , [ AC_CHECK_LIB(resolve, strcasecmp) ]) 398 399if test "$ac_cv_lib_resolve_strcasecmp" = "$ac_cv_func_strcasecmp"; then 400 AC_CHECK_LIB(resolve, strcasecmp, 401 [LIBS="-lresolve $LIBS"], 402 , 403 -lnsl) 404fi 405ac_cv_func_strcasecmp="no" 406 407dnl Windows builds require linking to iphlpapi 408if test "$ac_cv_header_winsock2_h" = "yes"; then 409 LIBS="$LIBS -liphlpapi" 410fi 411 412CARES_CHECK_LIBS_CONNECT 413 414dnl iOS 10? 415AS_IF([test "x$host_vendor" = "xapple"], [ 416 AC_MSG_CHECKING([for iOS minimum version 10 or later]) 417 AC_COMPILE_IFELSE([ 418 AC_LANG_PROGRAM([[ 419#include <stdio.h> 420#include <TargetConditionals.h> 421 ]], [[ 422#if TARGET_OS_IPHONE == 0 || __IPHONE_OS_VERSION_MIN_REQUIRED < 100000 423#error Not iOS 10 or later 424#endif 425return 0; 426 ]]) 427 ],[ 428 AC_MSG_RESULT([yes]) 429 ac_cv_ios_10="yes" 430 ],[ 431 AC_MSG_RESULT([no]) 432 ]) 433]) 434 435dnl macOS 10.12? 436AS_IF([test "x$host_vendor" = "xapple"], [ 437 AC_MSG_CHECKING([for macOS minimum version 10.12 or later]) 438 AC_COMPILE_IFELSE([ 439 AC_LANG_PROGRAM([[ 440#include <stdio.h> 441#include <TargetConditionals.h> 442 ]], [[ 443#ifndef MAC_OS_X_VERSION_10_12 444# define MAC_OS_X_VERSION_10_12 101200 445#endif 446#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_12 447#error Not macOS 10.12 or later 448#endif 449return 0; 450 ]]) 451 ],[ 452 AC_MSG_RESULT([yes]) 453 ac_cv_macos_10_12="yes" 454 ],[ 455 AC_MSG_RESULT([no]) 456 ]) 457]) 458 459dnl ********************************************************************** 460dnl In case that function clock_gettime with monotonic timer is available, 461dnl check for additional required libraries. 462dnl ********************************************************************** 463dnl Xcode 8 bug: iOS when targeting less than 10, or macOS when targeting less than 10.12 will 464dnl say clock_gettime exists, it is a weak symbol that only exists in iOS 10 or macOS 10.12 and will 465dnl cause a crash at runtime when running on older versions. Skip finding CLOCK_MONOTONIC on older 466dnl Apple OS's. 467if 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 469fi 470 471AC_MSG_CHECKING([whether to use libgcc]) 472AC_ARG_ENABLE(libgcc, 473AS_HELP_STRING([--enable-libgcc],[use libgcc when linking]), 474[ case "$enableval" in 475 yes) 476 LIBS="$LIBS -lgcc" 477 AC_MSG_RESULT(yes) 478 ;; 479 *) AC_MSG_RESULT(no) 480 ;; 481 esac ], 482 AC_MSG_RESULT(no) 483) 484 485 486dnl Let's hope this split URL remains working: 487dnl http://publibn.boulder.ibm.com/doc_link/en_US/a_doc_lib/aixprggd/ \ 488dnl genprogc/thread_quick_ref.htm 489 490 491dnl ********************************************************************** 492dnl Back to "normal" configuring 493dnl ********************************************************************** 494 495dnl Checks for header files. 496STDC_HEADERS 497 498AC_PROG_EGREP 499 500 501CURL_CHECK_HEADER_MALLOC 502CURL_CHECK_HEADER_MEMORY 503 504dnl check for a few basic system headers we need 505AC_CHECK_HEADERS( 506 sys/types.h \ 507 sys/time.h \ 508 sys/select.h \ 509 sys/socket.h \ 510 sys/ioctl.h \ 511 sys/param.h \ 512 sys/uio.h \ 513 assert.h \ 514 netdb.h \ 515 netinet/in.h \ 516 netinet/tcp.h \ 517 net/if.h \ 518 errno.h \ 519 socket.h \ 520 strings.h \ 521 stdbool.h \ 522 time.h \ 523 limits.h \ 524 arpa/nameser.h \ 525 arpa/nameser_compat.h \ 526 arpa/inet.h, 527dnl to do if not found 528[], 529dnl to do if found 530[], 531dnl default includes 532[ 533#ifdef HAVE_SYS_TYPES_H 534#include <sys/types.h> 535#endif 536#ifdef HAVE_SYS_TIME_H 537#include <sys/time.h> 538#endif 539dnl We do this default-include simply to make sure that the nameser_compat.h 540dnl header *REALLY* can be include after the new nameser.h. It seems AIX 5.1 541dnl (and others?) is not designed to allow this. 542#ifdef HAVE_ARPA_NAMESER_H 543#include <arpa/nameser.h> 544#endif 545 546dnl *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> 549#endif 550#ifdef HAVE_NETINET_IN_H 551#include <netinet/in.h> 552#endif 553] 554) 555 556dnl Test and set CARES_HAVE_ARPA_NAMESER_H / CARES_HAVE_ARPA_NAMESER_COMPAT_H 557AC_CHECK_DECL([HAVE_ARPA_NAMESER_H], 558[ 559CARES_DEFINE_UNQUOTED([CARES_HAVE_ARPA_NAMESER_H]) 560], 561[] 562) 563AC_CHECK_DECL([HAVE_ARPA_NAMESER_COMPAT_H], 564[ 565CARES_DEFINE_UNQUOTED([CARES_HAVE_ARPA_NAMESER_COMPAT_H]) 566], 567[] 568) 569 570dnl Checks for typedefs, structures, and compiler characteristics. 571AC_C_CONST 572AC_TYPE_SIZE_T 573m4_warn([obsolete], 574[Update your code to rely only on HAVE_SYS_TIME_H, 575then remove this warning and the obsolete code below it. 576All current systems provide time.h; it need not be checked for. 577Not all systems provide sys/time.h, but those that do, all allow 578you to include it and time.h simultaneously.])dnl 579AC_CHECK_HEADERS_ONCE([sys/time.h]) 580# Obsolete code to be removed. 581if 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.]) 584fi 585# End of obsolete code. 586 587CURL_CHECK_STRUCT_TIMEVAL 588 589AC_CHECK_TYPE(long long, 590 [AC_DEFINE(HAVE_LONGLONG, 1, 591 [Define to 1 if the compiler supports the 'long long' data type.])] 592 longlong="yes" 593) 594 595if test "xyes" = "x$longlong"; then 596 AC_MSG_CHECKING([if numberLL works]) 597 AC_COMPILE_IFELSE([ 598 AC_LANG_PROGRAM([[ 599 ]],[[ 600 long long val = 1000LL; 601 ]]) 602 ],[ 603 AC_MSG_RESULT([yes]) 604 AC_DEFINE(HAVE_LL, 1, [if your compiler supports LL]) 605 ],[ 606 AC_MSG_RESULT([no]) 607 ]) 608fi 609 610 611# check for ssize_t 612AC_CHECK_TYPE(ssize_t, [ CARES_TYPEOF_ARES_SSIZE_T=ssize_t ], 613 [ CARES_TYPEOF_ARES_SSIZE_T=int ]) 614 615AC_DEFINE_UNQUOTED([CARES_TYPEOF_ARES_SSIZE_T], ${CARES_TYPEOF_ARES_SSIZE_T}, 616 [the signed version of size_t]) 617 618 619# check for bool type 620AC_CHECK_TYPE([bool],[ 621 AC_DEFINE(HAVE_BOOL_T, 1, 622 [Define to 1 if bool is an available type.]) 623], ,[ 624#ifdef HAVE_SYS_TYPES_H 625#include <sys/types.h> 626#endif 627#ifdef HAVE_STDBOOL_H 628#include <stdbool.h> 629#endif 630]) 631 632CARES_CONFIGURE_ARES_SOCKLEN_T 633 634TYPE_IN_ADDR_T 635 636TYPE_SOCKADDR_STORAGE 637 638TYPE_SIG_ATOMIC_T 639 640m4_warn([obsolete], 641[your code may safely assume C89 semantics that RETSIGTYPE is void. 642Remove this warning and the `AC_CACHE_CHECK' when you adjust the code.])dnl 643AC_CACHE_CHECK([return type of signal handlers],[ac_cv_type_signal],[AC_COMPILE_IFELSE( 644[AC_LANG_PROGRAM([#include <sys/types.h> 645#include <signal.h> 646], 647 [return *(signal (0, 0)) (0) == 1;])], 648 [ac_cv_type_signal=int], 649 [ac_cv_type_signal=void])]) 650AC_DEFINE_UNQUOTED([RETSIGTYPE],[$ac_cv_type_signal],[Define as the return type of signal handlers 651 (`int' or `void').]) 652 653 654CURL_CHECK_FUNC_RECV 655CURL_CHECK_FUNC_RECVFROM 656CURL_CHECK_FUNC_SEND 657CURL_CHECK_MSG_NOSIGNAL 658 659CARES_CHECK_FUNC_CLOSESOCKET 660CARES_CHECK_FUNC_CLOSESOCKET_CAMEL 661CARES_CHECK_FUNC_CONNECT 662CARES_CHECK_FUNC_FCNTL 663CARES_CHECK_FUNC_FREEADDRINFO 664CARES_CHECK_FUNC_GETADDRINFO 665CARES_CHECK_FUNC_GETENV 666CARES_CHECK_FUNC_GETHOSTBYADDR 667CARES_CHECK_FUNC_GETHOSTBYNAME 668CARES_CHECK_FUNC_GETHOSTNAME 669CARES_CHECK_FUNC_GETSERVBYPORT_R 670CARES_CHECK_FUNC_INET_NET_PTON 671CARES_CHECK_FUNC_INET_NTOP 672CARES_CHECK_FUNC_INET_PTON 673CARES_CHECK_FUNC_IOCTL 674CARES_CHECK_FUNC_IOCTLSOCKET 675CARES_CHECK_FUNC_IOCTLSOCKET_CAMEL 676CARES_CHECK_FUNC_SETSOCKOPT 677CARES_CHECK_FUNC_SOCKET 678CARES_CHECK_FUNC_STRCASECMP 679CARES_CHECK_FUNC_STRCMPI 680CARES_CHECK_FUNC_STRDUP 681CARES_CHECK_FUNC_STRICMP 682CARES_CHECK_FUNC_STRNCASECMP 683CARES_CHECK_FUNC_STRNCMPI 684CARES_CHECK_FUNC_STRNICMP 685CARES_CHECK_FUNC_WRITEV 686 687 688dnl check for AF_INET6 689CARES_CHECK_CONSTANT( 690 [ 691#undef inline 692#ifdef HAVE_WINDOWS_H 693#ifndef WIN32_LEAN_AND_MEAN 694#define WIN32_LEAN_AND_MEAN 695#endif 696#include <windows.h> 697#ifdef HAVE_WINSOCK2_H 698#include <winsock2.h> 699#endif 700#else 701#ifdef HAVE_SYS_TYPES_H 702#include <sys/types.h> 703#endif 704#ifdef HAVE_SYS_SOCKET_H 705#include <sys/socket.h> 706#endif 707#endif 708 ], [PF_INET6], 709 AC_DEFINE_UNQUOTED(HAVE_PF_INET6,1,[Define to 1 if you have PF_INET6.]) 710) 711 712dnl check for PF_INET6 713CARES_CHECK_CONSTANT( 714 [ 715#undef inline 716#ifdef HAVE_WINDOWS_H 717#ifndef WIN32_LEAN_AND_MEAN 718#define WIN32_LEAN_AND_MEAN 719#endif 720#include <windows.h> 721#ifdef HAVE_WINSOCK2_H 722#include <winsock2.h> 723#endif 724#else 725#ifdef HAVE_SYS_TYPES_H 726#include <sys/types.h> 727#endif 728#ifdef HAVE_SYS_SOCKET_H 729#include <sys/socket.h> 730#endif 731#endif 732 ], [AF_INET6], 733 AC_DEFINE_UNQUOTED(HAVE_AF_INET6,1,[Define to 1 if you have AF_INET6.]) 734) 735 736 737dnl check for the in6_addr structure 738CARES_CHECK_STRUCT( 739 [ 740#undef inline 741#ifdef HAVE_WINDOWS_H 742#ifndef WIN32_LEAN_AND_MEAN 743#define WIN32_LEAN_AND_MEAN 744#endif 745#include <windows.h> 746#ifdef HAVE_WINSOCK2_H 747#include <winsock2.h> 748#ifdef HAVE_WS2TCPIP_H 749#include <ws2tcpip.h> 750#endif 751#endif 752#else 753#ifdef HAVE_SYS_TYPES_H 754#include <sys/types.h> 755#endif 756#ifdef HAVE_NETINET_IN_H 757#include <netinet/in.h> 758#endif 759#endif 760 ], [in6_addr], 761 AC_DEFINE_UNQUOTED(HAVE_STRUCT_IN6_ADDR,1,[Define to 1 if you have struct in6_addr.]) 762) 763 764dnl check for the sockaddr_in6 structure 765CARES_CHECK_STRUCT( 766 [ 767#undef inline 768#ifdef HAVE_WINDOWS_H 769#ifndef WIN32_LEAN_AND_MEAN 770#define WIN32_LEAN_AND_MEAN 771#endif 772#include <windows.h> 773#ifdef HAVE_WINSOCK2_H 774#include <winsock2.h> 775#ifdef HAVE_WS2TCPIP_H 776#include <ws2tcpip.h> 777#endif 778#endif 779#else 780#ifdef HAVE_SYS_TYPES_H 781#include <sys/types.h> 782#endif 783#ifdef HAVE_NETINET_IN_H 784#include <netinet/in.h> 785#endif 786#endif 787 ], [sockaddr_in6], 788 AC_DEFINE_UNQUOTED(HAVE_STRUCT_SOCKADDR_IN6,1, 789 [Define to 1 if you have struct sockaddr_in6.]) ac_have_sockaddr_in6=yes 790) 791 792AC_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.]) 795 , , 796 [ 797#undef inline 798#ifdef HAVE_WINDOWS_H 799#ifndef WIN32_LEAN_AND_MEAN 800#define WIN32_LEAN_AND_MEAN 801#endif 802#include <windows.h> 803#ifdef HAVE_WINSOCK2_H 804#include <winsock2.h> 805#ifdef HAVE_WS2TCPIP_H 806#include <ws2tcpip.h> 807#endif 808#endif 809#else 810#ifdef HAVE_SYS_TYPES_H 811#include <sys/types.h> 812#endif 813#ifdef HAVE_NETINET_IN_H 814#include <netinet/in.h> 815#endif 816#endif 817 ]) 818 819dnl check for the addrinfo structure 820AC_CHECK_MEMBER(struct addrinfo.ai_flags, 821 AC_DEFINE_UNQUOTED(HAVE_STRUCT_ADDRINFO,1, 822 [Define to 1 if you have struct addrinfo.]),, 823 [ 824#undef inline 825#ifdef HAVE_WINDOWS_H 826#ifndef WIN32_LEAN_AND_MEAN 827#define WIN32_LEAN_AND_MEAN 828#endif 829#include <windows.h> 830#ifdef HAVE_WINSOCK2_H 831#include <winsock2.h> 832#ifdef HAVE_WS2TCPIP_H 833#include <ws2tcpip.h> 834#endif 835#endif 836#else 837#ifdef HAVE_SYS_TYPES_H 838#include <sys/types.h> 839#endif 840#ifdef HAVE_NETINET_IN_H 841#include <netinet/in.h> 842#endif 843#ifdef HAVE_SYS_SOCKET_H 844#include <sys/socket.h> 845#endif 846#ifdef HAVE_NETDB_H 847#include <netdb.h> 848#endif 849#endif 850 ] 851) 852 853 854AC_CHECK_FUNCS([bitncmp \ 855 gettimeofday \ 856 if_indextoname 857],[ 858],[ 859 func="$ac_func" 860 AC_MSG_CHECKING([deeper for $func]) 861 AC_LINK_IFELSE([ 862 AC_LANG_PROGRAM([[ 863 ]],[[ 864 $func (); 865 ]]) 866 ],[ 867 AC_MSG_RESULT([yes]) 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.]) 871 ],[ 872 AC_MSG_RESULT([but still no]) 873 ]) 874]) 875 876dnl Android. Some variants like arm64 may no longer have __system_property_get 877dnl in libc, but they are defined in the headers. Perform a link check. 878AC_CHECK_FUNC([__system_property_get], [ 879 AC_DEFINE([HAVE___SYSTEM_PROPERTY_GET], [1], [Define if __system_property_get exists.]) 880]) 881 882dnl Check if the getnameinfo function is available 883dnl and get the types of five of its arguments. 884CURL_CHECK_FUNC_GETNAMEINFO 885 886 887AC_C_BIGENDIAN( 888 [AC_DEFINE(ARES_BIG_ENDIAN, 1, 889 [define this if ares is built for a big endian system])], 890 , 891 [AC_MSG_WARN([couldn't figure out endianess, assuming little endian!])] 892) 893 894dnl Check for user-specified random device 895AC_ARG_WITH(random, 896AS_HELP_STRING([--with-random=FILE], 897 [read randomness from FILE (default=/dev/urandom)]), 898 [ CARES_RANDOM_FILE="$withval" ], 899 [ 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"] ) 905 else 906 AC_MSG_WARN([cannot check for /dev/urandom while cross compiling; assuming none]) 907 fi 908 909 ] 910) 911if 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]) 915fi 916 917CARES_CHECK_OPTION_NONBLOCKING 918CARES_CHECK_NONBLOCKING_SOCKET 919 920CARES_CONFIGURE_SYMBOL_HIDING 921 922CARES_PRIVATE_LIBS="$LIBS" 923AC_SUBST(CARES_PRIVATE_LIBS) 924 925CARES_CFLAG_EXTRAS="" 926if test X"$want_werror" = Xyes; then 927 CARES_CFLAG_EXTRAS="-Werror" 928fi 929AC_SUBST(CARES_CFLAG_EXTRAS) 930 931dnl squeeze whitespace out of some variables 932 933squeeze CFLAGS 934squeeze CPPFLAGS 935squeeze DEFS 936squeeze LDFLAGS 937squeeze LIBS 938 939squeeze CARES_PRIVATE_LIBS 940 941XC_CHECK_BUILD_FLAGS 942 943AC_MSG_CHECKING([whether to build tests]) 944AC_ARG_ENABLE(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 948 build_tests="yes" 949 else 950 build_tests="no" 951 fi 952 ] 953) 954 955if test "x$build_tests" = "xyes" ; then 956 if test "x$HAVE_CXX11" = "0" ; then 957 AC_MSG_ERROR([*** Building tests requires a CXX11 compiler]) 958 fi 959 if test "x$cross_compiling" = "xyes" ; then 960 AC_MSG_ERROR([*** Tests not supported when cross compiling]) 961 fi 962fi 963AC_MSG_RESULT([$build_tests]) 964 965 966BUILD_SUBDIRS="include src docs" 967if test "x$build_tests" = "xyes" ; then 968 AC_CONFIG_SUBDIRS([test]) 969 BUILD_SUBDIRS="${BUILD_SUBDIRS} test" 970fi 971 972AC_SUBST(BUILD_SUBDIRS) 973 974AC_CONFIG_FILES([Makefile \ 975 include/Makefile \ 976 src/Makefile \ 977 src/lib/Makefile \ 978 src/tools/Makefile \ 979 docs/Makefile \ 980 libcares.pc ]) 981 982AC_OUTPUT 983XC_AMEND_DISTCLEAN(['.']) 984