"Fossies" - the Fresh Open Source Software Archive

Member "c-ares-1.17.2/configure.ac" (10 Aug 2021, 23839 Bytes) of package /linux/misc/dns/c-ares-1.17.2.tar.gz:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "configure.ac": 1.17.1_vs_1.17.2.

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