123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919 |
- AC_PREREQ(2.57)
- dnl Version not hardcoded here. Fetched later from ares_version.h
- AC_INIT([c-ares], [-],
- [c-ares mailing list => http://cool.haxx.se/mailman/listinfo/c-ares])
- CARES_OVERRIDE_AUTOCONF
- AC_CONFIG_SRCDIR([ares_ipv6.h])
- AM_CONFIG_HEADER([config.h ares_build.h])
- AM_MAINTAINER_MODE
- CARES_CHECK_OPTION_DEBUG
- CARES_CHECK_OPTION_OPTIMIZE
- CARES_CHECK_OPTION_WARNINGS
- CARES_CHECK_PATH_SEPARATOR
- dnl SED is mandatory for configure process and libtool.
- dnl Set it now, allowing it to be changed later.
- AC_PATH_PROG([SED], [sed], [not_found],
- [$PATH:/usr/bin:/usr/local/bin])
- if test -z "$SED" || test "$SED" = "not_found"; then
- AC_MSG_ERROR([sed not found in PATH. Cannot continue without sed.])
- fi
- AC_SUBST([SED])
- dnl GREP is mandatory for configure process and libtool.
- dnl Set it now, allowing it to be changed later.
- AC_PATH_PROG([GREP], [grep], [not_found],
- [$PATH:/usr/bin:/usr/local/bin])
- if test -z "$GREP" || test "$GREP" = "not_found"; then
- AC_MSG_ERROR([grep not found in PATH. Cannot continue without grep.])
- fi
- AC_SUBST([GREP])
- dnl EGREP is mandatory for configure process and libtool.
- dnl Set it now, allowing it to be changed later.
- if echo a | ($GREP -E '(a|b)') >/dev/null 2>&1; then
- AC_MSG_CHECKING([for egrep])
- EGREP="$GREP -E"
- AC_MSG_RESULT([$EGREP])
- else
- AC_PATH_PROG([EGREP], [egrep], [not_found],
- [$PATH:/usr/bin:/usr/local/bin])
- fi
- if test -z "$EGREP" || test "$EGREP" = "not_found"; then
- AC_MSG_ERROR([egrep not found in PATH. Cannot continue without egrep.])
- fi
- AC_SUBST([EGREP])
- dnl AR is mandatory for configure process and libtool.
- dnl This is target dependant, so check it as a tool.
- AC_PATH_TOOL([AR], [ar], [not_found],
- [$PATH:/usr/bin:/usr/local/bin])
- if test -z "$AR" || test "$AR" = "not_found"; then
- AC_MSG_ERROR([ar not found in PATH. Cannot continue without ar.])
- fi
- AC_SUBST([AR])
- dnl Fetch c-ares version from ares_version.h
- VERSION=`$SED -ne 's/^#define ARES_VERSION_STR "\(.*\)"/\1/p' ${srcdir}/ares_version.h`
- AM_INIT_AUTOMAKE([c-ares], [$VERSION])
- AC_MSG_CHECKING([c-ares version])
- AC_MSG_RESULT([$VERSION])
- dnl
- dnl Detect the canonical host and target build environment
- dnl
- AC_CANONICAL_HOST
- dnl Get system canonical name
- AC_DEFINE_UNQUOTED(OS, "${host}", [cpu-machine-OS])
- CARES_CHECK_PROG_CC
- AM_PROG_CC_C_O
- AC_PROG_INSTALL
- dnl This defines _ALL_SOURCE for AIX
- CARES_CHECK_AIX_ALL_SOURCE
- dnl Our configure and build reentrant settings
- CARES_CONFIGURE_REENTRANT
- dnl check for how to do large files
- AC_SYS_LARGEFILE
- case $host_os in
- solaris*)
- AC_DEFINE(ETC_INET, 1, [if a /etc/inet dir is being used])
- ;;
- esac
- dnl support building of Windows DLLs
- AC_LIBTOOL_WIN32_DLL
- CARES_PROCESS_DEBUG_BUILD_OPTS
- AM_CONDITIONAL(DEBUGBUILD, test x$want_debug = xyes)
- AM_CONDITIONAL(CURLDEBUG, test x$want_debug = xyes)
- dnl force libtool to build static libraries with PIC on AMD64-Linux & FreeBSD
- AC_MSG_CHECKING([if arch-OS host is AMD64-Linux/FreeBSD (to build static libraries with PIC)])
- case $host in
- x86_64*linux*|amd64*freebsd*|ia64*freebsd*)
- AC_MSG_RESULT([yes])
- with_pic=yes
- ;;
- *)
- AC_MSG_RESULT([no])
- ;;
- esac
- dnl libtool setup
- AC_PROG_LIBTOOL
- AC_MSG_CHECKING([if we need -no-undefined])
- case $host in
- *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*)
- need_no_undefined=yes
- ;;
- *)
- need_no_undefined=no
- ;;
- esac
- AC_MSG_RESULT($need_no_undefined)
- AM_CONDITIONAL(NO_UNDEFINED, test x$need_no_undefined = xyes)
- dnl **********************************************************************
- dnl platform/compiler/architecture specific checks/flags
- dnl **********************************************************************
- CARES_CHECK_COMPILER
- CARES_SET_COMPILER_BASIC_OPTS
- CARES_SET_COMPILER_DEBUG_OPTS
- CARES_SET_COMPILER_OPTIMIZE_OPTS
- CARES_SET_COMPILER_WARNING_OPTS
- case $host in
- #
- x86_64*linux*|amd64*freebsd*|ia64*freebsd*)
- #
- if test "$compiler_id" = "INTEL_UNIX_C"; then
- #
- if test "$compiler_num" -ge "900" &&
- test "$compiler_num" -lt "1000"; then
- dnl icc 9.X specific
- CFLAGS="$CFLAGS -i-dynamic"
- fi
- #
- if test "$compiler_num" -ge "1000"; then
- dnl icc 10.X or later
- CFLAGS="$CFLAGS -shared-intel"
- fi
- #
- fi
- ;;
- #
- esac
- CURL_CHECK_COMPILER_HALT_ON_ERROR
- CURL_CHECK_COMPILER_ARRAY_SIZE_NEGATIVE
- dnl **********************************************************************
- dnl Compilation based checks should not be done before this point.
- dnl **********************************************************************
- dnl **********************************************************************
- dnl Make sure that our checks for headers windows.h winsock.h winsock2.h
- dnl and ws2tcpip.h take precedence over any other further checks which
- dnl could be done later using AC_CHECK_HEADER or AC_CHECK_HEADERS for
- dnl this specific header files. And do them before its results are used.
- dnl **********************************************************************
- CURL_CHECK_HEADER_WINDOWS
- CURL_CHECK_NATIVE_WINDOWS
- case X-"$ac_cv_native_windows" in
- X-yes)
- CURL_CHECK_HEADER_WINSOCK
- CURL_CHECK_HEADER_WINSOCK2
- CURL_CHECK_HEADER_WS2TCPIP
- ;;
- *)
- ac_cv_header_winsock_h="no"
- ac_cv_header_winsock2_h="no"
- ac_cv_header_ws2tcpip_h="no"
- ;;
- esac
- dnl **********************************************************************
- dnl Checks for libraries.
- dnl **********************************************************************
- tst_lib_xnet_required="no"
- AC_MSG_CHECKING([if X/Open network library is required])
- CURL_CHECK_DEF([__hpux], [], [silent])
- CURL_CHECK_DEF_CC([_XOPEN_SOURCE_EXTENDED], [], [silent])
- if test "$curl_cv_have_def__XOPEN_SOURCE_EXTENDED" = "yes" &&
- test "$curl_cv_have_def___hpux" = "yes"; then
- my_ac_save_LIBS=$LIBS
- LIBS="-lxnet $LIBS"
- AC_LINK_IFELSE([
- AC_LANG_PROGRAM([[
- ]],[[
- if(0 != getpeername(0, 0, 0))
- return 1;
- ]])
- ],[
- tst_lib_xnet_required="yes"
- ],[
- LIBS=$my_ac_save_LIBS
- ])
- fi
- AC_MSG_RESULT([$tst_lib_xnet_required])
- dnl gethostbyname without lib or in the nsl lib?
- AC_CHECK_FUNC(gethostbyname,
- [HAVE_GETHOSTBYNAME="1"
- ],
- [ AC_CHECK_LIB(nsl, gethostbyname,
- [HAVE_GETHOSTBYNAME="1"
- LIBS="$LIBS -lnsl"
- ])
- ])
- if test "$HAVE_GETHOSTBYNAME" != "1"
- then
- dnl gethostbyname in the socket lib?
- AC_CHECK_LIB(socket, gethostbyname,
- [HAVE_GETHOSTBYNAME="1"
- LIBS="$LIBS -lsocket"
- ])
- fi
- dnl At least one system has been identified to require BOTH nsl and socket
- dnl libs at the same time to link properly.
- if test "$HAVE_GETHOSTBYNAME" != "1"
- then
- AC_MSG_CHECKING([for gethostbyname with both nsl and socket libs])
- my_ac_save_LIBS=$LIBS
- LIBS="-lnsl -lsocket $LIBS"
- AC_LINK_IFELSE([
- AC_LANG_PROGRAM([[
- ]],[[
- gethostbyname();
- ]])
- ],[
- AC_MSG_RESULT([yes])
- HAVE_GETHOSTBYNAME="1"
- ],[
- AC_MSG_RESULT([no])
- LIBS=$my_ac_save_LIBS
- ])
- fi
- if test "$HAVE_GETHOSTBYNAME" != "1"
- then
- dnl This is for winsock systems
- if test "$ac_cv_header_windows_h" = "yes"; then
- if test "$ac_cv_header_winsock_h" = "yes"; then
- case $host in
- *-*-mingw32ce*)
- winsock_LIB="-lwinsock"
- ;;
- *)
- winsock_LIB="-lwsock32"
- ;;
- esac
- fi
- if test "$ac_cv_header_winsock2_h" = "yes"; then
- winsock_LIB="-lws2_32"
- fi
- if test ! -z "$winsock_LIB"; then
- my_ac_save_LIBS=$LIBS
- LIBS="$winsock_LIB $LIBS"
- AC_MSG_CHECKING([for gethostbyname in $winsock_LIB])
- AC_LINK_IFELSE([
- AC_LANG_PROGRAM([[
- #ifdef HAVE_WINDOWS_H
- #ifndef WIN32_LEAN_AND_MEAN
- #define WIN32_LEAN_AND_MEAN
- #endif
- #include <windows.h>
- #ifdef HAVE_WINSOCK2_H
- #include <winsock2.h>
- #else
- #ifdef HAVE_WINSOCK_H
- #include <winsock.h>
- #endif
- #endif
- #endif
- ]],[[
- gethostbyname("www.dummysite.com");
- ]])
- ],[
- AC_MSG_RESULT([yes])
- HAVE_GETHOSTBYNAME="1"
- ],[
- AC_MSG_RESULT([no])
- winsock_LIB=""
- LIBS=$my_ac_save_LIBS
- ])
- fi
- fi
- fi
- if test "$HAVE_GETHOSTBYNAME" != "1"
- then
- dnl This is for Minix 3.1
- AC_MSG_CHECKING([for gethostbyname for Minix 3])
- AC_LINK_IFELSE([
- AC_LANG_PROGRAM([[
- /* Older Minix versions may need <net/gen/netdb.h> here instead */
- #include <netdb.h>
- ]],[[
- gethostbyname("www.dummysite.com");
- ]])
- ],[
- AC_MSG_RESULT([yes])
- HAVE_GETHOSTBYNAME="1"
- ],[
- AC_MSG_RESULT([no])
- ])
- fi
- if test "$HAVE_GETHOSTBYNAME" != "1"
- then
- dnl This is for eCos with a stubbed DNS implementation
- AC_MSG_CHECKING([for gethostbyname for eCos])
- AC_LINK_IFELSE([
- AC_LANG_PROGRAM([[
- #include <stdio.h>
- #include <netdb.h>
- ]],[[
- gethostbyname("www.dummysite.com");
- ]])
- ],[
- AC_MSG_RESULT([yes])
- HAVE_GETHOSTBYNAME="1"
- ],[
- AC_MSG_RESULT([no])
- ])
- fi
- if test "$HAVE_GETHOSTBYNAME" != "1"
- then
- dnl gethostbyname in the net lib - for BeOS
- AC_CHECK_LIB(net, gethostbyname,
- [HAVE_GETHOSTBYNAME="1"
- LIBS="$LIBS -lnet"
- ])
- fi
- if test "$HAVE_GETHOSTBYNAME" != "1"; then
- AC_MSG_ERROR([couldn't find libraries for gethostbyname()])
- fi
- dnl resolve lib?
- AC_CHECK_FUNC(strcasecmp, , [ AC_CHECK_LIB(resolve, strcasecmp) ])
- if test "$ac_cv_lib_resolve_strcasecmp" = "$ac_cv_func_strcasecmp"; then
- AC_CHECK_LIB(resolve, strcasecmp,
- [LIBS="-lresolve $LIBS"],
- ,
- -lnsl)
- fi
- ac_cv_func_strcasecmp="no"
- dnl socket lib?
- AC_CHECK_FUNC(connect, , [ AC_CHECK_LIB(socket, connect) ])
- dnl **********************************************************************
- dnl In case that function clock_gettime with monotonic timer is available,
- dnl check for additional required libraries.
- dnl **********************************************************************
- CURL_CHECK_LIBS_CLOCK_GETTIME_MONOTONIC
- AC_MSG_CHECKING([whether to use libgcc])
- AC_ARG_ENABLE(libgcc,
- AC_HELP_STRING([--enable-libgcc],[use libgcc when linking]),
- [ case "$enableval" in
- yes)
- LIBS="$LIBS -lgcc"
- AC_MSG_RESULT(yes)
- ;;
- *) AC_MSG_RESULT(no)
- ;;
- esac ],
- AC_MSG_RESULT(no)
- )
- dnl Default is to try the thread-safe versions of a few functions
- OPT_THREAD=on
- dnl detect AIX 4.3 or later
- AC_MSG_CHECKING([AIX 4.3 or later])
- AC_PREPROC_IFELSE([
- #if defined(_AIX) && defined(_AIX43)
- printf("just fine");
- #else
- #error "this is not AIX 4.3 or later"
- #endif
- ],
- [ AC_MSG_RESULT([yes])
- RECENTAIX=yes
- OPT_THREAD=off ],
- [ AC_MSG_RESULT([no]) ]
- )
- AC_ARG_ENABLE(thread,dnl
- AC_HELP_STRING([--disable-thread],[don't look for thread-safe functions])
- AC_HELP_STRING([--enable-thread],[look for thread-safe functions]),
- [ case "$enableval" in
- no)
- OPT_THREAD=off
- AC_MSG_WARN(c-ares will not get built using thread-safe functions)
- ;;
- *)
- ;;
- esac
- ]
- )
- if test X"$OPT_THREAD" = Xoff
- then
- AC_DEFINE(DISABLED_THREADSAFE, 1,
- [Set to explicitly specify we don't want to use thread-safe functions])
- fi
- dnl for recent AIX versions, we skip all the thread-safe checks above since
- dnl they claim a thread-safe libc using the standard API. But there are
- dnl some functions still not thread-safe. Check for these!
- dnl Let's hope this split URL remains working:
- dnl http://publibn.boulder.ibm.com/doc_link/en_US/a_doc_lib/aixprggd/ \
- dnl genprogc/thread_quick_ref.htm
- if test "x$RECENTAIX" = "xyes"; then
- AC_DEFINE(_THREAD_SAFE, 1, [define this if you need it to compile thread-safe code])
- fi
- dnl **********************************************************************
- dnl Back to "normal" configuring
- dnl **********************************************************************
- dnl Checks for header files.
- AC_HEADER_STDC
- CURL_CHECK_HEADER_MALLOC
- CURL_CHECK_HEADER_MEMORY
- dnl check for a few basic system headers we need
- AC_CHECK_HEADERS(
- sys/types.h \
- sys/time.h \
- sys/select.h \
- sys/socket.h \
- sys/ioctl.h \
- sys/param.h \
- sys/uio.h \
- netdb.h \
- netinet/in.h \
- netinet/tcp.h \
- net/if.h \
- errno.h \
- strings.h \
- stdbool.h \
- time.h \
- limits.h \
- arpa/nameser.h \
- arpa/nameser_compat.h \
- arpa/inet.h,
- dnl to do if not found
- [],
- dnl to do if found
- [],
- dnl default includes
- [
- #ifdef HAVE_SYS_TYPES_H
- #include <sys/types.h>
- #endif
- #ifdef HAVE_SYS_TIME_H
- #include <sys/time.h>
- #endif
- dnl We do this default-include simply to make sure that the nameser_compat.h
- dnl header *REALLY* can be include after the new nameser.h. It seems AIX 5.1
- dnl (and others?) is not designed to allow this.
- #ifdef HAVE_ARPA_NAMESER_H
- #include <arpa/nameser.h>
- #endif
- dnl *Sigh* these are needed in order for net/if.h to get properly detected.
- #ifdef HAVE_SYS_SOCKET_H
- #include <sys/socket.h>
- #endif
- #ifdef HAVE_NETINET_IN_H
- #include <netinet/in.h>
- #endif
- ]
- )
- dnl Checks for typedefs, structures, and compiler characteristics.
- AC_C_CONST
- AC_TYPE_SIZE_T
- AC_HEADER_TIME
- CURL_CHECK_STRUCT_TIMEVAL
- AC_CHECK_SIZEOF(size_t)
- AC_CHECK_SIZEOF(int)
- AC_CHECK_SIZEOF(long)
- CARES_CONFIGURE_LONG
- AC_CHECK_SIZEOF(time_t)
- AC_CHECK_TYPE(long long,
- [AC_DEFINE(HAVE_LONGLONG, 1,
- [Define to 1 if the compiler supports the 'long long' data type.])]
- longlong="yes"
- )
- if test "xyes" = "x$longlong"; then
- AC_MSG_CHECKING([if numberLL works])
- AC_COMPILE_IFELSE([long long val = 1000LL;],
- [AC_DEFINE(HAVE_LL, 1, [if your compiler supports LL])]
- AC_MSG_RESULT(yes),
- AC_MSG_RESULT(no)
- )
- fi
- # check for ssize_t
- AC_CHECK_TYPE(ssize_t, ,
- AC_DEFINE(ssize_t, int, [the signed version of size_t]))
- # check for bool type
- AC_CHECK_TYPE([bool],[
- AC_DEFINE(HAVE_BOOL_T, 1,
- [Define to 1 if bool is an available type.])
- ], ,[
- #ifdef HAVE_SYS_TYPES_H
- #include <sys/types.h>
- #endif
- #ifdef HAVE_STDBOOL_H
- #include <stdbool.h>
- #endif
- ])
- CARES_CONFIGURE_ARES_SOCKLEN_T
- TYPE_IN_ADDR_T
- TYPE_SOCKADDR_STORAGE
- TYPE_SIG_ATOMIC_T
- AC_TYPE_SIGNAL
- CURL_CHECK_FUNC_RECV
- CURL_CHECK_FUNC_RECVFROM
- CURL_CHECK_FUNC_SEND
- CURL_CHECK_MSG_NOSIGNAL
- CARES_CHECK_FUNC_FCNTL
- CARES_CHECK_FUNC_FREEADDRINFO
- CARES_CHECK_FUNC_GETADDRINFO
- CARES_CHECK_FUNC_GETHOSTBYADDR
- CARES_CHECK_FUNC_GETHOSTBYNAME
- CARES_CHECK_FUNC_GETHOSTNAME
- CARES_CHECK_FUNC_GETSERVBYPORT_R
- CARES_CHECK_FUNC_INET_NTOP
- CARES_CHECK_FUNC_INET_PTON
- CARES_CHECK_FUNC_IOCTL
- CARES_CHECK_FUNC_IOCTLSOCKET
- CARES_CHECK_FUNC_IOCTLSOCKET_CAMEL
- CARES_CHECK_FUNC_SETSOCKOPT
- CARES_CHECK_FUNC_STRCASECMP
- CARES_CHECK_FUNC_STRCMPI
- CARES_CHECK_FUNC_STRDUP
- CARES_CHECK_FUNC_STRICMP
- CARES_CHECK_FUNC_STRNCASECMP
- CARES_CHECK_FUNC_STRNCMPI
- CARES_CHECK_FUNC_STRNICMP
- CARES_CHECK_FUNC_WRITEV
- dnl check for AF_INET6
- CARES_CHECK_CONSTANT(
- [
- #undef inline
- #ifdef HAVE_WINDOWS_H
- #ifndef WIN32_LEAN_AND_MEAN
- #define WIN32_LEAN_AND_MEAN
- #endif
- #include <windows.h>
- #ifdef HAVE_WINSOCK2_H
- #include <winsock2.h>
- #endif
- #else
- #ifdef HAVE_SYS_TYPES_H
- #include <sys/types.h>
- #endif
- #ifdef HAVE_SYS_SOCKET_H
- #include <sys/socket.h>
- #endif
- #endif
- ], [PF_INET6],
- AC_DEFINE_UNQUOTED(HAVE_PF_INET6,1,[Define to 1 if you have PF_INET6.])
- )
- dnl check for PF_INET6
- CARES_CHECK_CONSTANT(
- [
- #undef inline
- #ifdef HAVE_WINDOWS_H
- #ifndef WIN32_LEAN_AND_MEAN
- #define WIN32_LEAN_AND_MEAN
- #endif
- #include <windows.h>
- #ifdef HAVE_WINSOCK2_H
- #include <winsock2.h>
- #endif
- #else
- #ifdef HAVE_SYS_TYPES_H
- #include <sys/types.h>
- #endif
- #ifdef HAVE_SYS_SOCKET_H
- #include <sys/socket.h>
- #endif
- #endif
- ], [AF_INET6],
- AC_DEFINE_UNQUOTED(HAVE_AF_INET6,1,[Define to 1 if you have AF_INET6.])
- )
- dnl check for the in6_addr structure
- CARES_CHECK_STRUCT(
- [
- #undef inline
- #ifdef HAVE_WINDOWS_H
- #ifndef WIN32_LEAN_AND_MEAN
- #define WIN32_LEAN_AND_MEAN
- #endif
- #include <windows.h>
- #ifdef HAVE_WINSOCK2_H
- #include <winsock2.h>
- #ifdef HAVE_WS2TCPIP_H
- #include <ws2tcpip.h>
- #endif
- #endif
- #else
- #ifdef HAVE_SYS_TYPES_H
- #include <sys/types.h>
- #endif
- #ifdef HAVE_NETINET_IN_H
- #include <netinet/in.h>
- #endif
- #endif
- ], [in6_addr],
- AC_DEFINE_UNQUOTED(HAVE_STRUCT_IN6_ADDR,1,[Define to 1 if you have struct in6_addr.])
- )
- dnl check for the sockaddr_in6 structure
- CARES_CHECK_STRUCT(
- [
- #undef inline
- #ifdef HAVE_WINDOWS_H
- #ifndef WIN32_LEAN_AND_MEAN
- #define WIN32_LEAN_AND_MEAN
- #endif
- #include <windows.h>
- #ifdef HAVE_WINSOCK2_H
- #include <winsock2.h>
- #ifdef HAVE_WS2TCPIP_H
- #include <ws2tcpip.h>
- #endif
- #endif
- #else
- #ifdef HAVE_SYS_TYPES_H
- #include <sys/types.h>
- #endif
- #ifdef HAVE_NETINET_IN_H
- #include <netinet/in.h>
- #endif
- #endif
- ], [sockaddr_in6],
- AC_DEFINE_UNQUOTED(HAVE_STRUCT_SOCKADDR_IN6,1,
- [Define to 1 if you have struct sockaddr_in6.]) ac_have_sockaddr_in6=yes
- )
- AC_CHECK_MEMBER(struct sockaddr_in6.sin6_scope_id,
- AC_DEFINE_UNQUOTED(HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID,1,
- [Define to 1 if your struct sockaddr_in6 has sin6_scope_id.])
- , ,
- [
- #undef inline
- #ifdef HAVE_WINDOWS_H
- #ifndef WIN32_LEAN_AND_MEAN
- #define WIN32_LEAN_AND_MEAN
- #endif
- #include <windows.h>
- #ifdef HAVE_WINSOCK2_H
- #include <winsock2.h>
- #ifdef HAVE_WS2TCPIP_H
- #include <ws2tcpip.h>
- #endif
- #endif
- #else
- #ifdef HAVE_SYS_TYPES_H
- #include <sys/types.h>
- #endif
- #ifdef HAVE_NETINET_IN_H
- #include <netinet/in.h>
- #endif
- #endif
- ])
- dnl check for the addrinfo structure
- AC_CHECK_MEMBER(struct addrinfo.ai_flags,
- AC_DEFINE_UNQUOTED(HAVE_STRUCT_ADDRINFO,1,
- [Define to 1 if you have struct addrinfo.]),,
- [
- #undef inline
- #ifdef HAVE_WINDOWS_H
- #ifndef WIN32_LEAN_AND_MEAN
- #define WIN32_LEAN_AND_MEAN
- #endif
- #include <windows.h>
- #ifdef HAVE_WINSOCK2_H
- #include <winsock2.h>
- #ifdef HAVE_WS2TCPIP_H
- #include <ws2tcpip.h>
- #endif
- #endif
- #else
- #ifdef HAVE_SYS_TYPES_H
- #include <sys/types.h>
- #endif
- #ifdef HAVE_NETINET_IN_H
- #include <netinet/in.h>
- #endif
- #ifdef HAVE_SYS_SOCKET_H
- #include <sys/socket.h>
- #endif
- #ifdef HAVE_NETDB_H
- #include <netdb.h>
- #endif
- #endif
- ]
- )
- AC_CHECK_FUNCS([bitncmp \
- gettimeofday \
- if_indextoname
- ],[
- ],[
- func="$ac_func"
- AC_MSG_CHECKING([deeper for $func])
- AC_LINK_IFELSE([
- AC_LANG_PROGRAM([[
- ]],[[
- $func ();
- ]])
- ],[
- AC_MSG_RESULT([yes])
- eval "ac_cv_func_$func=yes"
- AC_DEFINE_UNQUOTED([AS_TR_CPP([HAVE_$func])], [1],
- [Define to 1 if you have the $func function.])
- ],[
- AC_MSG_RESULT([but still no])
- ])
- ])
- dnl Check for inet_net_pton
- AC_CHECK_FUNCS(inet_net_pton)
- dnl Again, some systems have it, but not IPv6
- if test "$ac_cv_func_inet_net_pton" = "yes" ; then
- AC_MSG_CHECKING(if inet_net_pton supports IPv6)
- AC_TRY_RUN(
- [
- #ifdef HAVE_SYS_TYPES_H
- #include <sys/types.h>
- #endif
- #ifdef HAVE_SYS_SOCKET_H
- #include <sys/socket.h>
- #endif
- #ifdef HAVE_NETINET_IN_H
- #include <netinet/in.h>
- #endif
- int main()
- {
- struct in6_addr addr6;
- if (inet_net_pton(AF_INET6, "::1", &addr6, sizeof(addr6)) < 1)
- exit(1);
- else
- exit(0);
- }
- ], [
- AC_MSG_RESULT(yes)
- AC_DEFINE_UNQUOTED(HAVE_INET_NET_PTON_IPV6,1,[Define to 1 if inet_net_pton supports IPv6.])
- ], AC_MSG_RESULT(no),AC_MSG_RESULT(no))
- fi
- AC_CHECK_SIZEOF(struct in6_addr, ,
- [
- #undef inline
- #ifdef HAVE_WINDOWS_H
- #ifndef WIN32_LEAN_AND_MEAN
- #define WIN32_LEAN_AND_MEAN
- #endif
- #include <windows.h>
- #ifdef HAVE_WINSOCK2_H
- #include <winsock2.h>
- #ifdef HAVE_WS2TCPIP_H
- #include <ws2tcpip.h>
- #endif
- #endif
- #else
- #ifdef HAVE_SYS_TYPES_H
- #include <sys/types.h>
- #endif
- #ifdef HAVE_SYS_SOCKET_H
- #include <sys/socket.h>
- #endif
- #ifdef HAVE_NETINET_IN_H
- #include <netinet/in.h>
- #endif
- #endif
- ]
- )
- AC_CHECK_SIZEOF(struct in_addr, ,
- [
- #undef inline
- #ifdef HAVE_WINDOWS_H
- #ifndef WIN32_LEAN_AND_MEAN
- #define WIN32_LEAN_AND_MEAN
- #endif
- #include <windows.h>
- #ifdef HAVE_WINSOCK2_H
- #include <winsock2.h>
- #ifdef HAVE_WS2TCPIP_H
- #include <ws2tcpip.h>
- #endif
- #endif
- #else
- #ifdef HAVE_SYS_TYPES_H
- #include <sys/types.h>
- #endif
- #ifdef HAVE_SYS_SOCKET_H
- #include <sys/socket.h>
- #endif
- #ifdef HAVE_NETINET_IN_H
- #include <netinet/in.h>
- #endif
- #endif
- ]
- )
- dnl Check if the getnameinfo function is available
- dnl and get the types of five of its arguments.
- CURL_CHECK_FUNC_GETNAMEINFO
- AC_C_BIGENDIAN(
- [AC_DEFINE(ARES_BIG_ENDIAN, 1,
- [define this if ares is built for a big endian system])],
- ,
- [AC_MSG_WARN([couldn't figure out endianess, assuming little endian!])]
- )
- dnl Check for user-specified random device
- AC_ARG_WITH(random,
- AC_HELP_STRING([--with-random=FILE],
- [read randomness from FILE (default=/dev/urandom)]),
- [ RANDOM_FILE="$withval" ],
- [
- dnl Check for random device. If we're cross compiling, we can't
- dnl check, and it's better to assume it doesn't exist than it is
- dnl to fail on AC_CHECK_FILE or later.
- if test "$cross_compiling" = "no"; then
- AC_CHECK_FILE("/dev/urandom", [ RANDOM_FILE="/dev/urandom"] )
- else
- AC_MSG_WARN([cannot check for /dev/urandom while cross compiling; assuming none])
- fi
-
- ]
- )
- if test -n "$RANDOM_FILE" && test X"$RANDOM_FILE" != Xno ; then
- AC_SUBST(RANDOM_FILE)
- AC_DEFINE_UNQUOTED(RANDOM_FILE, "$RANDOM_FILE",
- [a suitable file/device to read random data from])
- fi
- CARES_CHECK_OPTION_NONBLOCKING
- CARES_CHECK_NONBLOCKING_SOCKET
- CARES_PRIVATE_LIBS="$LIBS"
- AC_SUBST(CARES_PRIVATE_LIBS)
- dnl squeeze whitespace out of some variables
- squeeze CFLAGS
- squeeze CPPFLAGS
- squeeze DEFS
- squeeze LDFLAGS
- squeeze LIBS
- squeeze CARES_PRIVATE_LIBS
- AC_CONFIG_FILES([Makefile libcares.pc])
- AC_OUTPUT
|