Blame configure.ac

Packit 514978
AC_PREREQ(2.57)
Packit 514978
Packit 514978
dnl Version not hardcoded here. Fetched later from ares_version.h
Packit 514978
AC_INIT([c-ares], [1.13.0],
Packit 514978
  [c-ares mailing list: http://cool.haxx.se/mailman/listinfo/c-ares])
Packit 514978
Packit 514978
XC_OVR_ZZ50
Packit 514978
XC_OVR_ZZ60
Packit 514978
CARES_OVERRIDE_AUTOCONF
Packit 514978
Packit 514978
AC_CONFIG_SRCDIR([ares_ipv6.h])
Packit 514978
AC_CONFIG_HEADERS([ares_config.h ares_build.h])
Packit 514978
AC_CONFIG_MACRO_DIR([m4])
Packit 514978
AM_MAINTAINER_MODE
Packit 514978
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
Packit 514978
Packit 514978
CARES_CHECK_OPTION_DEBUG
Packit 514978
CARES_CHECK_OPTION_OPTIMIZE
Packit 514978
CARES_CHECK_OPTION_WARNINGS
Packit 514978
CARES_CHECK_OPTION_WERROR
Packit 514978
CARES_CHECK_OPTION_CURLDEBUG
Packit 514978
CARES_CHECK_OPTION_SYMBOL_HIDING
Packit 514978
CARES_CHECK_OPTION_EXPOSE_STATICS
Packit 514978
Packit 514978
XC_CHECK_PATH_SEPARATOR
Packit 514978
Packit 514978
dnl SED is mandatory for configure process and libtool.
Packit 514978
dnl Set it now, allowing it to be changed later.
Packit 514978
AC_PATH_PROG([SED], [sed], [not_found],
Packit 514978
  [$PATH:/usr/bin:/usr/local/bin])
Packit 514978
if test -z "$SED" || test "$SED" = "not_found"; then
Packit 514978
  AC_MSG_ERROR([sed not found in PATH. Cannot continue without sed.])
Packit 514978
fi
Packit 514978
AC_SUBST([SED])
Packit 514978
Packit 514978
dnl GREP is mandatory for configure process and libtool.
Packit 514978
dnl Set it now, allowing it to be changed later.
Packit 514978
AC_PATH_PROG([GREP], [grep], [not_found],
Packit 514978
  [$PATH:/usr/bin:/usr/local/bin])
Packit 514978
if test -z "$GREP" || test "$GREP" = "not_found"; then
Packit 514978
  AC_MSG_ERROR([grep not found in PATH. Cannot continue without grep.])
Packit 514978
fi
Packit 514978
AC_SUBST([GREP])
Packit 514978
Packit 514978
dnl EGREP is mandatory for configure process and libtool.
Packit 514978
dnl Set it now, allowing it to be changed later.
Packit 514978
if echo a | ($GREP -E '(a|b)') >/dev/null 2>&1; then
Packit 514978
  AC_MSG_CHECKING([for egrep])
Packit 514978
  EGREP="$GREP -E"
Packit 514978
  AC_MSG_RESULT([$EGREP])
Packit 514978
else
Packit 514978
  AC_PATH_PROG([EGREP], [egrep], [not_found],
Packit 514978
    [$PATH:/usr/bin:/usr/local/bin])
Packit 514978
fi
Packit 514978
if test -z "$EGREP" || test "$EGREP" = "not_found"; then
Packit 514978
  AC_MSG_ERROR([egrep not found in PATH. Cannot continue without egrep.])
Packit 514978
fi
Packit 514978
AC_SUBST([EGREP])
Packit 514978
Packit 514978
dnl AR is mandatory for configure process and libtool.
Packit 514978
dnl This is target dependent, so check it as a tool.
Packit 514978
if test -z "$AR"; then
Packit 514978
  dnl allow it to be overridden
Packit 514978
  AC_PATH_TOOL([AR], [ar], [not_found],
Packit 514978
    [$PATH:/usr/bin:/usr/local/bin])
Packit 514978
  if test -z "$AR" || test "$AR" = "not_found"; then
Packit 514978
    AC_MSG_ERROR([ar not found in PATH. Cannot continue without ar.])
Packit 514978
  fi
Packit 514978
fi
Packit 514978
AC_SUBST([AR])
Packit 514978
Packit 514978
AX_CODE_COVERAGE
Packit 514978
Packit 514978
dnl Remove non-configure distributed ares_build.h
Packit 514978
if test -f ${srcdir}/ares_build.h; then
Packit 514978
  rm -f ${srcdir}/ares_build.h
Packit 514978
fi
Packit 514978
Packit 514978
dnl
Packit 514978
dnl Detect the canonical host and target build environment
Packit 514978
dnl
Packit 514978
Packit 514978
AC_CANONICAL_HOST
Packit 514978
dnl Get system canonical name
Packit 514978
AC_DEFINE_UNQUOTED(OS, "${host}", [cpu-machine-OS])
Packit 514978
Packit 514978
XC_CHECK_PROG_CC
Packit 514978
AX_CXX_COMPILE_STDCXX_11([noext],[optional])
Packit 514978
Packit 514978
XC_AUTOMAKE
Packit 514978
Packit 514978
dnl This defines _ALL_SOURCE for AIX
Packit 514978
CARES_CHECK_AIX_ALL_SOURCE
Packit 514978
Packit 514978
dnl Our configure and build reentrant settings
Packit 514978
CARES_CONFIGURE_THREAD_SAFE
Packit 514978
CARES_CONFIGURE_REENTRANT
Packit 514978
Packit 514978
dnl check for how to do large files
Packit 514978
AC_SYS_LARGEFILE
Packit 514978
Packit 514978
case $host_os in
Packit 514978
  solaris*)
Packit 514978
    AC_DEFINE(ETC_INET, 1, [if a /etc/inet dir is being used])
Packit 514978
    ;;
Packit 514978
esac
Packit 514978
Packit 514978
XC_LIBTOOL
Packit 514978
Packit 514978
#
Packit 514978
# Automake conditionals based on libtool related checks
Packit 514978
#
Packit 514978
Packit 514978
AM_CONDITIONAL([CARES_LT_SHLIB_USE_VERSION_INFO],
Packit 514978
  [test "x$xc_lt_shlib_use_version_info" = 'xyes'])
Packit 514978
AM_CONDITIONAL([CARES_LT_SHLIB_USE_NO_UNDEFINED],
Packit 514978
  [test "x$xc_lt_shlib_use_no_undefined" = 'xyes'])
Packit 514978
AM_CONDITIONAL([CARES_LT_SHLIB_USE_MIMPURE_TEXT],
Packit 514978
  [test "x$xc_lt_shlib_use_mimpure_text" = 'xyes'])
Packit 514978
Packit 514978
#
Packit 514978
# Due to libtool and automake machinery limitations of not allowing
Packit 514978
# specifying separate CPPFLAGS or CFLAGS when compiling objects for
Packit 514978
# inclusion of these in shared or static libraries, we are forced to
Packit 514978
# build using separate configure runs for shared and static libraries
Packit 514978
# on systems where different CPPFLAGS or CFLAGS are mandatory in order
Packit 514978
# to compile objects for each kind of library. Notice that relying on
Packit 514978
# the '-DPIC' CFLAG that libtool provides is not valid given that the
Packit 514978
# user might for example choose to build static libraries with PIC.
Packit 514978
#
Packit 514978
Packit 514978
#
Packit 514978
# Make our Makefile.am files use the staticlib CPPFLAG only when strictly
Packit 514978
# targeting a static library and not building its shared counterpart.
Packit 514978
#
Packit 514978
Packit 514978
AM_CONDITIONAL([USE_CPPFLAG_CARES_STATICLIB],
Packit 514978
  [test "x$xc_lt_build_static_only" = 'xyes'])
Packit 514978
Packit 514978
#
Packit 514978
# Make staticlib CPPFLAG variable and its definition visible in output
Packit 514978
# files unconditionally, providing an empty definition unless strictly
Packit 514978
# targeting a static library and not building its shared counterpart.
Packit 514978
#
Packit 514978
Packit 514978
CPPFLAG_CARES_STATICLIB=
Packit 514978
if test "x$xc_lt_build_static_only" = 'xyes'; then
Packit 514978
  CPPFLAG_CARES_STATICLIB='-DCARES_STATICLIB'
Packit 514978
fi
Packit 514978
AC_SUBST([CPPFLAG_CARES_STATICLIB])
Packit 514978
Packit 514978
dnl **********************************************************************
Packit 514978
dnl platform/compiler/architecture specific checks/flags
Packit 514978
dnl **********************************************************************
Packit 514978
Packit 514978
CARES_CHECK_COMPILER
Packit 514978
CARES_SET_COMPILER_BASIC_OPTS
Packit 514978
CARES_SET_COMPILER_DEBUG_OPTS
Packit 514978
CARES_SET_COMPILER_OPTIMIZE_OPTS
Packit 514978
CARES_SET_COMPILER_WARNING_OPTS
Packit 514978
Packit 514978
if test "$compiler_id" = "INTEL_UNIX_C"; then
Packit 514978
  #
Packit 514978
  if test "$compiler_num" -ge "1000"; then
Packit 514978
    dnl icc 10.X or later
Packit 514978
    CFLAGS="$CFLAGS -shared-intel"
Packit 514978
  elif test "$compiler_num" -ge "900"; then
Packit 514978
    dnl icc 9.X specific
Packit 514978
    CFLAGS="$CFLAGS -i-dynamic"
Packit 514978
  fi
Packit 514978
  #
Packit 514978
fi
Packit 514978
Packit 514978
CARES_CHECK_COMPILER_HALT_ON_ERROR
Packit 514978
CARES_CHECK_COMPILER_ARRAY_SIZE_NEGATIVE
Packit 514978
CARES_CHECK_COMPILER_PROTOTYPE_MISMATCH
Packit 514978
CARES_CHECK_COMPILER_SYMBOL_HIDING
Packit 514978
Packit 514978
CARES_CHECK_CURLDEBUG
Packit 514978
AM_CONDITIONAL(CURLDEBUG, test x$want_curldebug = xyes)
Packit 514978
Packit 514978
dnl **********************************************************************
Packit 514978
dnl Compilation based checks should not be done before this point.
Packit 514978
dnl **********************************************************************
Packit 514978
Packit 514978
dnl **********************************************************************
Packit 514978
dnl Make sure that our checks for headers windows.h winsock.h winsock2.h 
Packit 514978
dnl and ws2tcpip.h take precedence over any other further checks which 
Packit 514978
dnl could be done later using AC_CHECK_HEADER or AC_CHECK_HEADERS for
Packit 514978
dnl this specific header files. And do them before its results are used.
Packit 514978
dnl **********************************************************************
Packit 514978
Packit 514978
CURL_CHECK_HEADER_WINDOWS
Packit 514978
CURL_CHECK_NATIVE_WINDOWS
Packit 514978
case X-"$ac_cv_native_windows" in
Packit 514978
  X-yes)
Packit 514978
    CURL_CHECK_HEADER_WINSOCK
Packit 514978
    CURL_CHECK_HEADER_WINSOCK2
Packit 514978
    CURL_CHECK_HEADER_WS2TCPIP
Packit 514978
    CPPFLAGS="$CPPFLAGS -D_WIN32_WINNT=0x0600"
Packit 514978
    ;;
Packit 514978
  *)
Packit 514978
    ac_cv_header_winsock_h="no"
Packit 514978
    ac_cv_header_winsock2_h="no"
Packit 514978
    ac_cv_header_ws2tcpip_h="no"
Packit 514978
    ;;
Packit 514978
esac
Packit 514978
Packit 514978
dnl **********************************************************************
Packit 514978
dnl Checks for libraries.
Packit 514978
dnl **********************************************************************
Packit 514978
Packit 514978
CARES_CHECK_LIB_XNET
Packit 514978
Packit 514978
dnl gethostbyname without lib or in the nsl lib?
Packit 514978
AC_CHECK_FUNC(gethostbyname,
Packit 514978
              [HAVE_GETHOSTBYNAME="1"
Packit 514978
              ],
Packit 514978
              [ AC_CHECK_LIB(nsl, gethostbyname,
Packit 514978
                             [HAVE_GETHOSTBYNAME="1"
Packit 514978
                             LIBS="$LIBS -lnsl"
Packit 514978
                             ])
Packit 514978
              ])
Packit 514978
Packit 514978
if test "$HAVE_GETHOSTBYNAME" != "1"
Packit 514978
then
Packit 514978
  dnl gethostbyname in the socket lib?
Packit 514978
  AC_CHECK_LIB(socket, gethostbyname,
Packit 514978
               [HAVE_GETHOSTBYNAME="1"
Packit 514978
               LIBS="$LIBS -lsocket"
Packit 514978
               ])
Packit 514978
fi
Packit 514978
Packit 514978
dnl At least one system has been identified to require BOTH nsl and socket
Packit 514978
dnl libs at the same time to link properly.
Packit 514978
if test "$HAVE_GETHOSTBYNAME" != "1"
Packit 514978
then
Packit 514978
  AC_MSG_CHECKING([for gethostbyname with both nsl and socket libs])
Packit 514978
  my_ac_save_LIBS=$LIBS
Packit 514978
  LIBS="-lnsl -lsocket $LIBS"
Packit 514978
  AC_LINK_IFELSE([
Packit 514978
    AC_LANG_PROGRAM([[
Packit 514978
    ]],[[
Packit 514978
      gethostbyname();
Packit 514978
    ]])
Packit 514978
  ],[
Packit 514978
    AC_MSG_RESULT([yes])
Packit 514978
    HAVE_GETHOSTBYNAME="1"
Packit 514978
  ],[
Packit 514978
    AC_MSG_RESULT([no])
Packit 514978
    LIBS=$my_ac_save_LIBS
Packit 514978
  ])
Packit 514978
fi
Packit 514978
Packit 514978
if test "$HAVE_GETHOSTBYNAME" != "1"
Packit 514978
then
Packit 514978
  dnl This is for winsock systems
Packit 514978
  if test "$ac_cv_header_windows_h" = "yes"; then
Packit 514978
    if test "$ac_cv_header_winsock_h" = "yes"; then
Packit 514978
      case $host in
Packit 514978
        *-*-mingw32ce*)
Packit 514978
          winsock_LIB="-lwinsock"
Packit 514978
          ;;
Packit 514978
        *)
Packit 514978
          winsock_LIB="-lwsock32"
Packit 514978
          ;;
Packit 514978
      esac
Packit 514978
    fi
Packit 514978
    if test "$ac_cv_header_winsock2_h" = "yes"; then
Packit 514978
      winsock_LIB="-lws2_32"
Packit 514978
    fi
Packit 514978
    if test ! -z "$winsock_LIB"; then
Packit 514978
      my_ac_save_LIBS=$LIBS
Packit 514978
      LIBS="$winsock_LIB $LIBS"
Packit 514978
      AC_MSG_CHECKING([for gethostbyname in $winsock_LIB])
Packit 514978
      AC_LINK_IFELSE([
Packit 514978
        AC_LANG_PROGRAM([[
Packit 514978
#ifdef HAVE_WINDOWS_H
Packit 514978
#ifndef WIN32_LEAN_AND_MEAN
Packit 514978
#define WIN32_LEAN_AND_MEAN
Packit 514978
#endif
Packit 514978
#include <windows.h>
Packit 514978
#ifdef HAVE_WINSOCK2_H
Packit 514978
#include <winsock2.h>
Packit 514978
#else
Packit 514978
#ifdef HAVE_WINSOCK_H
Packit 514978
#include <winsock.h>
Packit 514978
#endif
Packit 514978
#endif
Packit 514978
#endif
Packit 514978
        ]],[[
Packit 514978
          gethostbyname("www.dummysite.com");
Packit 514978
        ]])
Packit 514978
      ],[
Packit 514978
        AC_MSG_RESULT([yes])
Packit 514978
        HAVE_GETHOSTBYNAME="1"
Packit 514978
      ],[
Packit 514978
        AC_MSG_RESULT([no])
Packit 514978
        winsock_LIB=""
Packit 514978
        LIBS=$my_ac_save_LIBS
Packit 514978
      ])
Packit 514978
    fi
Packit 514978
  fi
Packit 514978
fi
Packit 514978
Packit 514978
if test "$HAVE_GETHOSTBYNAME" != "1"
Packit 514978
then
Packit 514978
  dnl This is for Minix 3.1
Packit 514978
  AC_MSG_CHECKING([for gethostbyname for Minix 3])
Packit 514978
  AC_LINK_IFELSE([
Packit 514978
    AC_LANG_PROGRAM([[
Packit 514978
/* Older Minix versions may need <net/gen/netdb.h> here instead */
Packit 514978
#include <netdb.h>
Packit 514978
    ]],[[
Packit 514978
      gethostbyname("www.dummysite.com");
Packit 514978
    ]])
Packit 514978
  ],[
Packit 514978
    AC_MSG_RESULT([yes])
Packit 514978
    HAVE_GETHOSTBYNAME="1"
Packit 514978
  ],[
Packit 514978
    AC_MSG_RESULT([no])
Packit 514978
  ])
Packit 514978
fi
Packit 514978
Packit 514978
if test "$HAVE_GETHOSTBYNAME" != "1"
Packit 514978
then
Packit 514978
  dnl This is for eCos with a stubbed DNS implementation
Packit 514978
  AC_MSG_CHECKING([for gethostbyname for eCos])
Packit 514978
  AC_LINK_IFELSE([
Packit 514978
    AC_LANG_PROGRAM([[
Packit 514978
#include <stdio.h>
Packit 514978
#include <netdb.h>
Packit 514978
    ]],[[
Packit 514978
      gethostbyname("www.dummysite.com");
Packit 514978
    ]])
Packit 514978
  ],[
Packit 514978
    AC_MSG_RESULT([yes])
Packit 514978
    HAVE_GETHOSTBYNAME="1"
Packit 514978
  ],[
Packit 514978
    AC_MSG_RESULT([no])
Packit 514978
  ])
Packit 514978
fi
Packit 514978
Packit 514978
if test "$HAVE_GETHOSTBYNAME" != "1"
Packit 514978
then
Packit 514978
  dnl gethostbyname in the net lib - for BeOS
Packit 514978
  AC_CHECK_LIB(net, gethostbyname,
Packit 514978
               [HAVE_GETHOSTBYNAME="1"
Packit 514978
               LIBS="$LIBS -lnet"
Packit 514978
               ])
Packit 514978
fi
Packit 514978
Packit 514978
Packit 514978
if test "$HAVE_GETHOSTBYNAME" != "1"; then
Packit 514978
  AC_MSG_ERROR([couldn't find libraries for gethostbyname()])
Packit 514978
fi
Packit 514978
Packit 514978
dnl resolv lib for iPhone
Packit 514978
AS_IF([test "x$host_vendor" = "xapple"], [
Packit 514978
  AC_MSG_CHECKING([for iPhone target])
Packit 514978
  AC_COMPILE_IFELSE([
Packit 514978
    AC_LANG_PROGRAM([[
Packit 514978
#include "TargetConditionals.h"
Packit 514978
    ]], [[
Packit 514978
#if TARGET_OS_IPHONE == 0
Packit 514978
#error Not an iPhone target
Packit 514978
#endif
Packit 514978
return 0;
Packit 514978
    ]])
Packit 514978
  ],[
Packit 514978
    AC_MSG_RESULT([yes])
Packit 514978
    AC_SEARCH_LIBS([res_servicename], [resolv], [
Packit 514978
      AC_DEFINE([CARES_USE_LIBRESOLV], [1], [Use resolver library to configure cares])
Packit 514978
    ], [
Packit 514978
      AC_MSG_ERROR([Unable to find libresolv which is required for iPhone targets])
Packit 514978
    ])
Packit 514978
  ],[
Packit 514978
    AC_MSG_RESULT([no])
Packit 514978
  ])
Packit 514978
])
Packit 514978
Packit 514978
dnl resolve lib?
Packit 514978
AC_CHECK_FUNC(strcasecmp, , [ AC_CHECK_LIB(resolve, strcasecmp) ])
Packit 514978
Packit 514978
if test "$ac_cv_lib_resolve_strcasecmp" = "$ac_cv_func_strcasecmp"; then
Packit 514978
  AC_CHECK_LIB(resolve, strcasecmp,
Packit 514978
              [LIBS="-lresolve $LIBS"],
Packit 514978
               ,
Packit 514978
               -lnsl)
Packit 514978
fi
Packit 514978
ac_cv_func_strcasecmp="no"
Packit 514978
Packit 514978
CARES_CHECK_LIBS_CONNECT
Packit 514978
Packit 514978
dnl iOS 10?
Packit 514978
AS_IF([test "x$host_vendor" = "xapple"], [
Packit 514978
  AC_MSG_CHECKING([for iOS minimum version 10 or later])
Packit 514978
  AC_COMPILE_IFELSE([
Packit 514978
    AC_LANG_PROGRAM([[
Packit 514978
#include <stdio.h>
Packit 514978
#include <TargetConditionals.h>
Packit 514978
    ]], [[
Packit 514978
#if TARGET_OS_IPHONE == 0 || __IPHONE_OS_VERSION_MIN_REQUIRED < 100000
Packit 514978
#error Not iOS 10 or later
Packit 514978
#endif
Packit 514978
return 0;
Packit 514978
   ]])
Packit 514978
  ],[
Packit 514978
    AC_MSG_RESULT([yes])
Packit 514978
    ac_cv_ios_10="yes"
Packit 514978
  ],[
Packit 514978
    AC_MSG_RESULT([no])
Packit 514978
  ])
Packit 514978
])
Packit 514978
Packit 514978
dnl macOS 10.12?
Packit 514978
AS_IF([test "x$host_vendor" = "xapple"], [
Packit 514978
  AC_MSG_CHECKING([for macOS minimum version 10.12 or later])
Packit 514978
  AC_COMPILE_IFELSE([
Packit 514978
    AC_LANG_PROGRAM([[
Packit 514978
#include <stdio.h>
Packit 514978
#include <TargetConditionals.h>
Packit 514978
    ]], [[
Packit 514978
#ifndef MAC_OS_X_VERSION_10_12
Packit 514978
#  define MAC_OS_X_VERSION_10_12 101200
Packit 514978
#endif
Packit 514978
#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_12
Packit 514978
#error Not macOS 10.12 or later
Packit 514978
#endif
Packit 514978
return 0;
Packit 514978
   ]])
Packit 514978
  ],[
Packit 514978
    AC_MSG_RESULT([yes])
Packit 514978
    ac_cv_macos_10_12="yes"
Packit 514978
  ],[
Packit 514978
    AC_MSG_RESULT([no])
Packit 514978
  ])
Packit 514978
])
Packit 514978
Packit 514978
dnl **********************************************************************
Packit 514978
dnl In case that function clock_gettime with monotonic timer is available,
Packit 514978
dnl check for additional required libraries.
Packit 514978
dnl **********************************************************************
Packit 514978
dnl Xcode 8 bug: iOS when targeting less than 10, or macOS when targeting less than 10.12 will
Packit 514978
dnl say clock_gettime exists, it is a weak symbol that only exists in iOS 10 or macOS 10.12 and will
Packit 514978
dnl cause a crash at runtime when running on older versions.  Skip finding CLOCK_MONOTONIC on older
Packit 514978
dnl Apple OS's.
Packit 514978
if test "x$host_vendor" != "xapple" || test "x$ac_cv_ios_10" = "xyes" || test "x$ac_cv_macos_10_12" = "xyes"; then
Packit 514978
  CURL_CHECK_LIBS_CLOCK_GETTIME_MONOTONIC
Packit 514978
fi
Packit 514978
Packit 514978
AC_MSG_CHECKING([whether to use libgcc])
Packit 514978
AC_ARG_ENABLE(libgcc,
Packit 514978
AC_HELP_STRING([--enable-libgcc],[use libgcc when linking]),
Packit 514978
[ case "$enableval" in
Packit 514978
  yes)
Packit 514978
        LIBS="$LIBS -lgcc"
Packit 514978
       AC_MSG_RESULT(yes)
Packit 514978
       ;;
Packit 514978
  *)   AC_MSG_RESULT(no)
Packit 514978
       ;;
Packit 514978
  esac ],
Packit 514978
       AC_MSG_RESULT(no)
Packit 514978
)
Packit 514978
Packit 514978
Packit 514978
dnl Let's hope this split URL remains working:
Packit 514978
dnl http://publibn.boulder.ibm.com/doc_link/en_US/a_doc_lib/aixprggd/ \
Packit 514978
dnl genprogc/thread_quick_ref.htm
Packit 514978
Packit 514978
Packit 514978
dnl **********************************************************************
Packit 514978
dnl Back to "normal" configuring
Packit 514978
dnl **********************************************************************
Packit 514978
Packit 514978
dnl Checks for header files.
Packit 514978
AC_HEADER_STDC
Packit 514978
Packit 514978
CURL_CHECK_HEADER_MALLOC
Packit 514978
CURL_CHECK_HEADER_MEMORY
Packit 514978
Packit 514978
dnl check for a few basic system headers we need
Packit 514978
AC_CHECK_HEADERS(
Packit 514978
       sys/types.h \
Packit 514978
       sys/time.h \
Packit 514978
       sys/select.h \
Packit 514978
       sys/socket.h \
Packit 514978
       sys/ioctl.h \
Packit 514978
       sys/param.h \
Packit 514978
       sys/uio.h \
Packit 514978
       assert.h \
Packit 514978
       netdb.h \
Packit 514978
       netinet/in.h \
Packit 514978
       netinet/tcp.h \
Packit 514978
       net/if.h \
Packit 514978
       errno.h \
Packit 514978
       socket.h \
Packit 514978
       strings.h \
Packit 514978
       stdbool.h \
Packit 514978
       time.h \
Packit 514978
       limits.h \
Packit 514978
       arpa/nameser.h \
Packit 514978
       arpa/nameser_compat.h \
Packit 514978
       arpa/inet.h,
Packit 514978
dnl to do if not found
Packit 514978
[],
Packit 514978
dnl to do if found
Packit 514978
[],
Packit 514978
dnl default includes
Packit 514978
[
Packit 514978
#ifdef HAVE_SYS_TYPES_H
Packit 514978
#include <sys/types.h>
Packit 514978
#endif
Packit 514978
#ifdef HAVE_SYS_TIME_H
Packit 514978
#include <sys/time.h>
Packit 514978
#endif
Packit 514978
dnl We do this default-include simply to make sure that the nameser_compat.h
Packit 514978
dnl header *REALLY* can be include after the new nameser.h. It seems AIX 5.1
Packit 514978
dnl (and others?) is not designed to allow this.
Packit 514978
#ifdef HAVE_ARPA_NAMESER_H
Packit 514978
#include <arpa/nameser.h>
Packit 514978
#endif
Packit 514978
Packit 514978
dnl *Sigh* these are needed in order for net/if.h to get properly detected.
Packit 514978
#ifdef HAVE_SYS_SOCKET_H
Packit 514978
#include <sys/socket.h>
Packit 514978
#endif
Packit 514978
#ifdef HAVE_NETINET_IN_H
Packit 514978
#include <netinet/in.h>
Packit 514978
#endif
Packit 514978
]
Packit 514978
)
Packit 514978
Packit 514978
dnl Checks for typedefs, structures, and compiler characteristics.
Packit 514978
AC_C_CONST
Packit 514978
AC_TYPE_SIZE_T
Packit 514978
AC_HEADER_TIME
Packit 514978
CURL_CHECK_STRUCT_TIMEVAL
Packit 514978
Packit 514978
AC_CHECK_TYPE(long long,
Packit 514978
   [AC_DEFINE(HAVE_LONGLONG, 1,
Packit 514978
     [Define to 1 if the compiler supports the 'long long' data type.])]
Packit 514978
   longlong="yes"  
Packit 514978
)
Packit 514978
Packit 514978
if test "xyes" = "x$longlong"; then
Packit 514978
  AC_MSG_CHECKING([if numberLL works])
Packit 514978
  AC_COMPILE_IFELSE([
Packit 514978
    AC_LANG_PROGRAM([[
Packit 514978
    ]],[[
Packit 514978
      long long val = 1000LL;
Packit 514978
    ]])
Packit 514978
  ],[
Packit 514978
    AC_MSG_RESULT([yes])
Packit 514978
    AC_DEFINE(HAVE_LL, 1, [if your compiler supports LL])
Packit 514978
  ],[
Packit 514978
    AC_MSG_RESULT([no])
Packit 514978
  ])
Packit 514978
fi
Packit 514978
Packit 514978
Packit 514978
# check for ssize_t
Packit 514978
AC_CHECK_TYPE(ssize_t, [ CARES_TYPEOF_ARES_SSIZE_T=ssize_t ],
Packit 514978
  [ CARES_TYPEOF_ARES_SSIZE_T=int ])
Packit 514978
Packit 514978
AC_DEFINE_UNQUOTED([CARES_TYPEOF_ARES_SSIZE_T], ${CARES_TYPEOF_ARES_SSIZE_T},
Packit 514978
  [the signed version of size_t])
Packit 514978
Packit 514978
Packit 514978
# check for bool type
Packit 514978
AC_CHECK_TYPE([bool],[
Packit 514978
  AC_DEFINE(HAVE_BOOL_T, 1,
Packit 514978
    [Define to 1 if bool is an available type.])
Packit 514978
], ,[
Packit 514978
#ifdef HAVE_SYS_TYPES_H
Packit 514978
#include <sys/types.h>
Packit 514978
#endif
Packit 514978
#ifdef HAVE_STDBOOL_H
Packit 514978
#include <stdbool.h>
Packit 514978
#endif
Packit 514978
])
Packit 514978
Packit 514978
CARES_CONFIGURE_ARES_SOCKLEN_T
Packit 514978
Packit 514978
TYPE_IN_ADDR_T
Packit 514978
Packit 514978
TYPE_SOCKADDR_STORAGE
Packit 514978
Packit 514978
TYPE_SIG_ATOMIC_T
Packit 514978
Packit 514978
AC_TYPE_SIGNAL
Packit 514978
Packit 514978
CURL_CHECK_FUNC_RECV
Packit 514978
CURL_CHECK_FUNC_RECVFROM
Packit 514978
CURL_CHECK_FUNC_SEND
Packit 514978
CURL_CHECK_MSG_NOSIGNAL
Packit 514978
Packit 514978
CARES_CHECK_FUNC_CLOSESOCKET
Packit 514978
CARES_CHECK_FUNC_CLOSESOCKET_CAMEL
Packit 514978
CARES_CHECK_FUNC_CONNECT
Packit 514978
CARES_CHECK_FUNC_FCNTL
Packit 514978
CARES_CHECK_FUNC_FREEADDRINFO
Packit 514978
CARES_CHECK_FUNC_GETADDRINFO
Packit 514978
CARES_CHECK_FUNC_GETENV
Packit 514978
CARES_CHECK_FUNC_GETHOSTBYADDR
Packit 514978
CARES_CHECK_FUNC_GETHOSTBYNAME
Packit 514978
CARES_CHECK_FUNC_GETHOSTNAME
Packit 514978
CARES_CHECK_FUNC_GETSERVBYPORT_R
Packit 514978
CARES_CHECK_FUNC_INET_NET_PTON
Packit 514978
CARES_CHECK_FUNC_INET_NTOP
Packit 514978
CARES_CHECK_FUNC_INET_PTON
Packit 514978
CARES_CHECK_FUNC_IOCTL
Packit 514978
CARES_CHECK_FUNC_IOCTLSOCKET
Packit 514978
CARES_CHECK_FUNC_IOCTLSOCKET_CAMEL
Packit 514978
CARES_CHECK_FUNC_SETSOCKOPT
Packit 514978
CARES_CHECK_FUNC_SOCKET
Packit 514978
CARES_CHECK_FUNC_STRCASECMP
Packit 514978
CARES_CHECK_FUNC_STRCMPI
Packit 514978
CARES_CHECK_FUNC_STRDUP
Packit 514978
CARES_CHECK_FUNC_STRICMP
Packit 514978
CARES_CHECK_FUNC_STRNCASECMP
Packit 514978
CARES_CHECK_FUNC_STRNCMPI
Packit 514978
CARES_CHECK_FUNC_STRNICMP
Packit 514978
CARES_CHECK_FUNC_WRITEV
Packit 514978
Packit 514978
Packit 514978
dnl check for AF_INET6
Packit 514978
CARES_CHECK_CONSTANT(
Packit 514978
  [
Packit 514978
#undef inline
Packit 514978
#ifdef HAVE_WINDOWS_H
Packit 514978
#ifndef WIN32_LEAN_AND_MEAN
Packit 514978
#define WIN32_LEAN_AND_MEAN
Packit 514978
#endif
Packit 514978
#include <windows.h>
Packit 514978
#ifdef HAVE_WINSOCK2_H
Packit 514978
#include <winsock2.h>
Packit 514978
#endif
Packit 514978
#else
Packit 514978
#ifdef HAVE_SYS_TYPES_H
Packit 514978
#include <sys/types.h>
Packit 514978
#endif
Packit 514978
#ifdef HAVE_SYS_SOCKET_H
Packit 514978
#include <sys/socket.h>
Packit 514978
#endif
Packit 514978
#endif
Packit 514978
  ], [PF_INET6], 
Packit 514978
     AC_DEFINE_UNQUOTED(HAVE_PF_INET6,1,[Define to 1 if you have PF_INET6.])
Packit 514978
)
Packit 514978
Packit 514978
dnl check for PF_INET6
Packit 514978
CARES_CHECK_CONSTANT(
Packit 514978
  [
Packit 514978
#undef inline
Packit 514978
#ifdef HAVE_WINDOWS_H
Packit 514978
#ifndef WIN32_LEAN_AND_MEAN
Packit 514978
#define WIN32_LEAN_AND_MEAN
Packit 514978
#endif
Packit 514978
#include <windows.h>
Packit 514978
#ifdef HAVE_WINSOCK2_H
Packit 514978
#include <winsock2.h>
Packit 514978
#endif
Packit 514978
#else
Packit 514978
#ifdef HAVE_SYS_TYPES_H
Packit 514978
#include <sys/types.h>
Packit 514978
#endif
Packit 514978
#ifdef HAVE_SYS_SOCKET_H
Packit 514978
#include <sys/socket.h>
Packit 514978
#endif
Packit 514978
#endif
Packit 514978
  ], [AF_INET6], 
Packit 514978
     AC_DEFINE_UNQUOTED(HAVE_AF_INET6,1,[Define to 1 if you have AF_INET6.])
Packit 514978
)
Packit 514978
Packit 514978
Packit 514978
dnl check for the in6_addr structure
Packit 514978
CARES_CHECK_STRUCT(
Packit 514978
  [
Packit 514978
#undef inline
Packit 514978
#ifdef HAVE_WINDOWS_H
Packit 514978
#ifndef WIN32_LEAN_AND_MEAN
Packit 514978
#define WIN32_LEAN_AND_MEAN
Packit 514978
#endif
Packit 514978
#include <windows.h>
Packit 514978
#ifdef HAVE_WINSOCK2_H
Packit 514978
#include <winsock2.h>
Packit 514978
#ifdef HAVE_WS2TCPIP_H
Packit 514978
#include <ws2tcpip.h>
Packit 514978
#endif
Packit 514978
#endif
Packit 514978
#else
Packit 514978
#ifdef HAVE_SYS_TYPES_H
Packit 514978
#include <sys/types.h>
Packit 514978
#endif
Packit 514978
#ifdef HAVE_NETINET_IN_H
Packit 514978
#include <netinet/in.h>
Packit 514978
#endif
Packit 514978
#endif
Packit 514978
  ], [in6_addr], 
Packit 514978
     AC_DEFINE_UNQUOTED(HAVE_STRUCT_IN6_ADDR,1,[Define to 1 if you have struct in6_addr.])
Packit 514978
)
Packit 514978
Packit 514978
dnl check for the sockaddr_in6 structure
Packit 514978
CARES_CHECK_STRUCT(
Packit 514978
  [
Packit 514978
#undef inline
Packit 514978
#ifdef HAVE_WINDOWS_H
Packit 514978
#ifndef WIN32_LEAN_AND_MEAN
Packit 514978
#define WIN32_LEAN_AND_MEAN
Packit 514978
#endif
Packit 514978
#include <windows.h>
Packit 514978
#ifdef HAVE_WINSOCK2_H
Packit 514978
#include <winsock2.h>
Packit 514978
#ifdef HAVE_WS2TCPIP_H
Packit 514978
#include <ws2tcpip.h>
Packit 514978
#endif
Packit 514978
#endif
Packit 514978
#else
Packit 514978
#ifdef HAVE_SYS_TYPES_H
Packit 514978
#include <sys/types.h>
Packit 514978
#endif
Packit 514978
#ifdef HAVE_NETINET_IN_H
Packit 514978
#include <netinet/in.h>
Packit 514978
#endif
Packit 514978
#endif
Packit 514978
  ], [sockaddr_in6], 
Packit 514978
     AC_DEFINE_UNQUOTED(HAVE_STRUCT_SOCKADDR_IN6,1,
Packit 514978
       [Define to 1 if you have struct sockaddr_in6.]) ac_have_sockaddr_in6=yes
Packit 514978
)
Packit 514978
Packit 514978
AC_CHECK_MEMBER(struct sockaddr_in6.sin6_scope_id,
Packit 514978
    AC_DEFINE_UNQUOTED(HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID,1,
Packit 514978
      [Define to 1 if your struct sockaddr_in6 has sin6_scope_id.])
Packit 514978
   , ,
Packit 514978
  [
Packit 514978
#undef inline
Packit 514978
#ifdef HAVE_WINDOWS_H
Packit 514978
#ifndef WIN32_LEAN_AND_MEAN
Packit 514978
#define WIN32_LEAN_AND_MEAN
Packit 514978
#endif
Packit 514978
#include <windows.h>
Packit 514978
#ifdef HAVE_WINSOCK2_H
Packit 514978
#include <winsock2.h>
Packit 514978
#ifdef HAVE_WS2TCPIP_H
Packit 514978
#include <ws2tcpip.h>
Packit 514978
#endif
Packit 514978
#endif
Packit 514978
#else
Packit 514978
#ifdef HAVE_SYS_TYPES_H
Packit 514978
#include <sys/types.h>
Packit 514978
#endif
Packit 514978
#ifdef HAVE_NETINET_IN_H
Packit 514978
#include <netinet/in.h>
Packit 514978
#endif
Packit 514978
#endif
Packit 514978
  ])
Packit 514978
Packit 514978
dnl check for the addrinfo structure
Packit 514978
AC_CHECK_MEMBER(struct addrinfo.ai_flags,
Packit 514978
     AC_DEFINE_UNQUOTED(HAVE_STRUCT_ADDRINFO,1,
Packit 514978
       [Define to 1 if you have struct addrinfo.]),,
Packit 514978
  [
Packit 514978
#undef inline
Packit 514978
#ifdef HAVE_WINDOWS_H
Packit 514978
#ifndef WIN32_LEAN_AND_MEAN
Packit 514978
#define WIN32_LEAN_AND_MEAN
Packit 514978
#endif
Packit 514978
#include <windows.h>
Packit 514978
#ifdef HAVE_WINSOCK2_H
Packit 514978
#include <winsock2.h>
Packit 514978
#ifdef HAVE_WS2TCPIP_H
Packit 514978
#include <ws2tcpip.h>
Packit 514978
#endif
Packit 514978
#endif
Packit 514978
#else
Packit 514978
#ifdef HAVE_SYS_TYPES_H
Packit 514978
#include <sys/types.h>
Packit 514978
#endif
Packit 514978
#ifdef HAVE_NETINET_IN_H
Packit 514978
#include <netinet/in.h>
Packit 514978
#endif
Packit 514978
#ifdef HAVE_SYS_SOCKET_H
Packit 514978
#include <sys/socket.h>
Packit 514978
#endif
Packit 514978
#ifdef HAVE_NETDB_H
Packit 514978
#include <netdb.h>
Packit 514978
#endif
Packit 514978
#endif
Packit 514978
  ]
Packit 514978
)
Packit 514978
Packit 514978
Packit 514978
AC_CHECK_FUNCS([bitncmp \
Packit 514978
  gettimeofday \
Packit 514978
  if_indextoname
Packit 514978
],[
Packit 514978
],[
Packit 514978
  func="$ac_func"
Packit 514978
  AC_MSG_CHECKING([deeper for $func])
Packit 514978
  AC_LINK_IFELSE([
Packit 514978
    AC_LANG_PROGRAM([[
Packit 514978
    ]],[[
Packit 514978
      $func ();
Packit 514978
    ]])
Packit 514978
  ],[
Packit 514978
    AC_MSG_RESULT([yes])
Packit 514978
    eval "ac_cv_func_$func=yes"
Packit 514978
    AC_DEFINE_UNQUOTED(XC_SH_TR_CPP([HAVE_$func]), [1],
Packit 514978
      [Define to 1 if you have the $func function.])
Packit 514978
  ],[
Packit 514978
    AC_MSG_RESULT([but still no])
Packit 514978
  ])
Packit 514978
])
Packit 514978
Packit 514978
Packit 514978
dnl Check if the getnameinfo function is available
Packit 514978
dnl and get the types of five of its arguments.
Packit 514978
CURL_CHECK_FUNC_GETNAMEINFO
Packit 514978
Packit 514978
Packit 514978
AC_C_BIGENDIAN(
Packit 514978
    [AC_DEFINE(ARES_BIG_ENDIAN, 1,
Packit 514978
      [define this if ares is built for a big endian system])],
Packit 514978
    ,
Packit 514978
    [AC_MSG_WARN([couldn't figure out endianess, assuming little endian!])]
Packit 514978
)
Packit 514978
Packit 514978
dnl Check for user-specified random device
Packit 514978
AC_ARG_WITH(random,
Packit 514978
AC_HELP_STRING([--with-random=FILE],
Packit 514978
               [read randomness from FILE (default=/dev/urandom)]),
Packit 514978
    [ RANDOM_FILE="$withval" ],
Packit 514978
    [
Packit 514978
        dnl Check for random device.  If we're cross compiling, we can't
Packit 514978
        dnl check, and it's better to assume it doesn't exist than it is
Packit 514978
        dnl to fail on AC_CHECK_FILE or later.
Packit 514978
        if test "$cross_compiling" = "no"; then
Packit 514978
          AC_CHECK_FILE("/dev/urandom", [ RANDOM_FILE="/dev/urandom"] )
Packit 514978
        else
Packit 514978
          AC_MSG_WARN([cannot check for /dev/urandom while cross compiling; assuming none])
Packit 514978
        fi
Packit 514978
        
Packit 514978
    ]
Packit 514978
)
Packit 514978
if test -n "$RANDOM_FILE" && test X"$RANDOM_FILE" != Xno ; then
Packit 514978
        AC_SUBST(RANDOM_FILE)
Packit 514978
        AC_DEFINE_UNQUOTED(RANDOM_FILE, "$RANDOM_FILE",
Packit 514978
        [a suitable file/device to read random data from])
Packit 514978
fi
Packit 514978
Packit 514978
CARES_CHECK_OPTION_NONBLOCKING
Packit 514978
CARES_CHECK_NONBLOCKING_SOCKET
Packit 514978
Packit 514978
CARES_CONFIGURE_SYMBOL_HIDING
Packit 514978
Packit 514978
CARES_PRIVATE_LIBS="$LIBS"
Packit 514978
AC_SUBST(CARES_PRIVATE_LIBS)
Packit 514978
Packit 514978
CARES_CFLAG_EXTRAS=""
Packit 514978
if test X"$want_werror" = Xyes; then
Packit 514978
  CARES_CFLAG_EXTRAS="-Werror"
Packit 514978
fi
Packit 514978
AC_SUBST(CARES_CFLAG_EXTRAS)
Packit 514978
Packit 514978
dnl squeeze whitespace out of some variables
Packit 514978
Packit 514978
squeeze CFLAGS
Packit 514978
squeeze CPPFLAGS
Packit 514978
squeeze DEFS
Packit 514978
squeeze LDFLAGS
Packit 514978
squeeze LIBS
Packit 514978
Packit 514978
squeeze CARES_PRIVATE_LIBS
Packit 514978
Packit 514978
XC_CHECK_BUILD_FLAGS
Packit 514978
Packit 514978
AC_MSG_CHECKING([whether to build tests])
Packit 514978
AC_ARG_ENABLE(tests,
Packit 514978
	AC_HELP_STRING([--enable-tests], [build test suite]),
Packit 514978
	[ build_tests="$enableval" ],
Packit 514978
	[ if test "x$HAVE_CXX11" = "x1" && test "x$cross_compiling" = "xno" ; then
Packit 514978
	    build_tests="yes"
Packit 514978
	  else
Packit 514978
	    build_tests="no"
Packit 514978
	  fi
Packit 514978
	]
Packit 514978
)
Packit 514978
Packit 514978
if test "x$build_tests" = "xyes" ; then
Packit 514978
	if test "x$HAVE_CXX11" = "0" ; then
Packit 514978
		AC_MSG_ERROR([*** Building tests requires a CXX11 compiler])
Packit 514978
	fi
Packit 514978
	if test "x$cross_compiling" = "xyes" ; then
Packit 514978
		AC_MSG_ERROR([*** Tests not supported when cross compiling])
Packit 514978
	fi
Packit 514978
fi
Packit 514978
AC_MSG_RESULT([$build_tests])
Packit 514978
Packit 514978
if test "x$build_tests" = "xyes" ; then
Packit 514978
  AC_CONFIG_SUBDIRS([test])
Packit 514978
fi
Packit 514978
Packit 514978
AC_CONFIG_FILES([Makefile libcares.pc])
Packit 514978
AC_OUTPUT
Packit 514978
XC_AMEND_DISTCLEAN(['.'])