From 4f490b40df72beead4d70e267161a7066ff11ea8 Mon Sep 17 00:00:00 2001 From: Brad House Date: Thu, 28 Dec 2023 07:54:15 -0500 Subject: [PATCH] Autotools: rework to simplify and fix recent issues (#674) Completely rework the autotools build system, issues have cropped up due to the complexity and could cause issues on even semi-modern Linux systems (Ubuntu 20.04 for example). Changes include: Remove all curl/xc/cares m4 helper files, they go overboard on detections of functions and datatypes. Go back to more plain autoconf macros as they've come a long way over the years. Use known systems and heuristics to determine datatypes for functions like send() and recv(), rather than the error prone detection which required thousands of permutations and might still get it wrong. Remove unneeded configure arguments like --enable-debug or --enable-optimize, its more common for people to simply pass their own CFLAGS on the command line. Only require CARES_STATICLIB definition on Windows static builds, its not necessary ever for other systems, even when hiding non-public symbols. Remove some function and definition detections that were never used in c-ares The test framework is now embedded into the toplevel configure system, there was no need to chain build the test system as it is never built externally to c-ares. As a side-effect of the changes, a configure run completes in about 25% of the original time. This has been tested on various Linux distributions (of varying age), FreeBSD, MacOS, Windows (via MSYS2 with Mingw), and Solaris10/11 (by @dfandrich), AIX 7.3 (by @dfandrich). It is not unlikely that this may have broken more esoteric or legacy systems, and we'll likely need to be ready to accept bug reports and patches, but it has removed over 10k lines of build system code. It is very likely any issues that crop up will add far fewer lines of code to fix such systems. Fixes Bug: #670 Fix By: Brad House (@bradh352) --- .reuse/dep5 | 4 +- CMakeLists.txt | 19 +- acinclude.m4 | 1916 ---------------- appveyor.yml | 139 +- ci/build.sh | 4 +- configure.ac | 1236 +++++------ include/ares.h | 27 +- include/ares_build.h.in | 122 +- libcares.pc.cmake | 2 +- libcares.pc.in | 2 +- m4/ax_append_link_flags.m4 | 44 + m4/ax_check_link_flag.m4 | 53 + m4/ax_compiler_vendor.m4 | 119 + m4/cares-compilers.m4 | 1451 ------------ m4/cares-confopts.m4 | 352 --- m4/cares-functions.m4 | 4135 ----------------------------------- m4/cares-reentrant.m4 | 610 ------ m4/xc-am-iface.m4 | 254 --- m4/xc-cc-check.m4 | 97 - m4/xc-lt-iface.m4 | 467 ---- m4/xc-translit.m4 | 166 -- m4/xc-val-flgs.m4 | 245 --- m4/zz40-xc-ovr.m4 | 669 ------ src/lib/CMakeLists.txt | 10 +- src/lib/Makefile.am | 30 +- src/lib/ares__iface_ips.c | 2 +- src/lib/ares__socket.c | 6 +- src/lib/ares_config.h.cmake | 38 +- src/lib/ares_getnameinfo.c | 14 +- src/lib/ares_private.h | 7 - src/lib/config-win32.h | 13 +- src/lib/setup_once.h | 77 - src/tools/Makefile.am | 4 - src/tools/adig.c | 1 - test/.gitignore | 1 - test/CMakeLists.txt | 3 +- test/Makefile.am | 52 +- test/ares-test-internal.cc | 40 +- test/ares-test.h | 7 +- test/buildconf | 4 - test/configure.ac | 56 - 41 files changed, 927 insertions(+), 11571 deletions(-) delete mode 100644 acinclude.m4 create mode 100644 m4/ax_append_link_flags.m4 create mode 100644 m4/ax_check_link_flag.m4 create mode 100644 m4/ax_compiler_vendor.m4 delete mode 100644 m4/cares-compilers.m4 delete mode 100644 m4/cares-confopts.m4 delete mode 100644 m4/cares-functions.m4 delete mode 100644 m4/cares-reentrant.m4 delete mode 100644 m4/xc-am-iface.m4 delete mode 100644 m4/xc-cc-check.m4 delete mode 100644 m4/xc-lt-iface.m4 delete mode 100644 m4/xc-translit.m4 delete mode 100644 m4/xc-val-flgs.m4 delete mode 100644 m4/zz40-xc-ovr.m4 delete mode 100755 test/buildconf delete mode 100644 test/configure.ac diff --git a/.reuse/dep5 b/.reuse/dep5 index 839809d4..b4951d10 100644 --- a/.reuse/dep5 +++ b/.reuse/dep5 @@ -19,11 +19,11 @@ Copyright: The c-ares project and its contributors. License: MIT # Imported m4 files -Files: m4/ax_pthread.m4 +Files: m4/ax_pthread.m4 m4/ax_compiler_vendor.m4 Copyright: see file License: GPL-3.0-or-later WITH Autoconf-exception-3.0 -Files: m4/ax_cxx_compile_stdcxx.m4 m4/ax_cxx_compile_stdcxx_14.m4 me/ax_require_defined.m4 m4/ax_check_gnu_make.m4 m4/ax_file_escapes.m4 m4/ax_require_defined.m4 m4/ax_ac_append_to_file.m4 m4/ax_ac_print_to_file.m4 m4/ax_add_am_macro_static.m4 m4/ax_file_escapes.m4 m4/ax_am_macros_static.m4 m4/ax_append_flag.m4 m4/ax_append_compile_flags.m4 m4/ax_check_compile_flag.m4 +Files: m4/ax_cxx_compile_stdcxx.m4 m4/ax_cxx_compile_stdcxx_14.m4 me/ax_require_defined.m4 m4/ax_check_gnu_make.m4 m4/ax_file_escapes.m4 m4/ax_require_defined.m4 m4/ax_ac_append_to_file.m4 m4/ax_ac_print_to_file.m4 m4/ax_add_am_macro_static.m4 m4/ax_file_escapes.m4 m4/ax_am_macros_static.m4 m4/ax_append_flag.m4 m4/ax_append_compile_flags.m4 m4/ax_check_compile_flag.m4 m4/ax_append_link_flags.m4 m4/ax_check_link_flag.m4 Copyright: see files License: FSFAP diff --git a/CMakeLists.txt b/CMakeLists.txt index f533f165..7605eacd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -89,14 +89,6 @@ IF (CARES_SYMBOL_HIDING) MESSAGE (FATAL_ERROR "Hiding symbols requires CMake 3.12") ENDIF () CMAKE_POLICY (SET CMP0063 NEW) - SET (CARES_SYMBOL_SCOPE_EXTERN [=[__attribute__ ((visibility("default")))]=]) - CHECK_C_SOURCE_COMPILES (" - ${CARES_SYMBOL_SCOPE_EXTERN} int somefunc() { return 0; } - int main() { return somefunc(); } - " HAVE_VISIBILITY_ATTRIBUTE) - IF (NOT HAVE_VISIBILITY_ATTRIBUTE) - MESSAGE (FATAL_ERROR "C compiler does not accept visibility attribute") - ENDIF () ENDIF () # Keep build organized. @@ -364,10 +356,8 @@ ENDMACRO () CARES_TYPE_EXISTS (socklen_t HAVE_SOCKLEN_T) CARES_TYPE_EXISTS (SOCKET HAVE_TYPE_SOCKET) -CARES_TYPE_EXISTS (bool HAVE_BOOL_T) CARES_TYPE_EXISTS (ssize_t HAVE_SSIZE_T) CARES_TYPE_EXISTS ("long long" HAVE_LONGLONG) -CARES_TYPE_EXISTS (sig_atomic_t HAVE_SIG_ATOMIC_T) CARES_TYPE_EXISTS ("struct addrinfo" HAVE_STRUCT_ADDRINFO) CARES_TYPE_EXISTS ("struct in6_addr" HAVE_STRUCT_IN6_ADDR) CARES_TYPE_EXISTS ("struct sockaddr_in6" HAVE_STRUCT_SOCKADDR_IN6) @@ -392,13 +382,9 @@ IF ((NOT APPLE) OR IOS_V10 OR MACOS_V1012) CHECK_SYMBOL_EXISTS (CLOCK_MONOTONIC "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_CLOCK_GETTIME_MONOTONIC) ENDIF () -CHECK_STRUCT_HAS_MEMBER("struct sockaddr_in6" sin6_scope_id "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID LANGUAGE C) - -# Check for "LL" numeric suffix support -CHECK_C_SOURCE_COMPILES ("int main() { int n=1234LL; return 0; }" HAVE_LL) +CHECK_STRUCT_HAS_MEMBER("struct sockaddr_in6" sin6_scope_id "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_STRUCT_SOCKADDR_IN6_SIN6_SCOPE_ID LANGUAGE C) -CHECK_SYMBOL_EXISTS (bitncmp "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_BITNCMP) CHECK_SYMBOL_EXISTS (closesocket "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_CLOSESOCKET) CHECK_SYMBOL_EXISTS (CloseSocket "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_CLOSESOCKET_CAMEL) CHECK_SYMBOL_EXISTS (connect "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_CONNECT) @@ -406,8 +392,6 @@ CHECK_SYMBOL_EXISTS (fcntl "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_FCNTL) CHECK_SYMBOL_EXISTS (freeaddrinfo "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_FREEADDRINFO) CHECK_SYMBOL_EXISTS (getaddrinfo "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_GETADDRINFO) CHECK_SYMBOL_EXISTS (getenv "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_GETENV) -CHECK_SYMBOL_EXISTS (gethostbyaddr "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_GETHOSTBYADDR) -CHECK_SYMBOL_EXISTS (gethostbyname "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_GETHOSTBYNAME) CHECK_SYMBOL_EXISTS (gethostname "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_GETHOSTNAME) CHECK_SYMBOL_EXISTS (getnameinfo "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_GETNAMEINFO) CHECK_SYMBOL_EXISTS (getrandom "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_GETRANDOM) @@ -738,7 +722,6 @@ IF (CARES_INSTALL) # pkgconfig support IF (NOT CARES_SHARED) - SET (CPPFLAG_CARES_STATICLIB "-DCARES_STATICLIB") FOREACH (LIB ${CARES_DEPENDENT_LIBS}) SET (CARES_PRIVATE_LIBS "${CARES_PRIVATE_LIBS} -l${LIB}") ENDFOREACH () diff --git a/acinclude.m4 b/acinclude.m4 deleted file mode 100644 index 18a8ebdc..00000000 --- a/acinclude.m4 +++ /dev/null @@ -1,1916 +0,0 @@ -# Copyright (C) The c-ares project and its contributors -# SPDX-License-Identifier: MIT - -dnl CURL_CHECK_DEF (SYMBOL, [INCLUDES], [SILENT]) -dnl ------------------------------------------------- -dnl Use the C preprocessor to find out if the given object-style symbol -dnl is defined and get its expansion. This macro will not use default -dnl includes even if no INCLUDES argument is given. This macro will run -dnl silently when invoked with three arguments. If the expansion would -dnl result in a set of double-quoted strings the returned expansion will -dnl actually be a single double-quoted string concatenating all them. - -AC_DEFUN([CURL_CHECK_DEF], [ - AS_VAR_PUSHDEF([ac_HaveDef], [cares_cv_have_def_$1])dnl - AS_VAR_PUSHDEF([ac_Def], [cares_cv_def_$1])dnl - if test -z "$SED"; then - AC_MSG_ERROR([SED not set. Cannot continue without SED being set.]) - fi - if test -z "$GREP"; then - AC_MSG_ERROR([GREP not set. Cannot continue without GREP being set.]) - fi - ifelse($3,,[AC_MSG_CHECKING([for preprocessor definition of $1])]) - tmp_exp="" - AC_PREPROC_IFELSE([ - AC_LANG_SOURCE( -ifelse($2,,,[$2])[[ -#ifdef $1 -CURL_DEF_TOKEN $1 -#endif - ]]) - ],[ - tmp_exp=`eval "$ac_cpp conftest.$ac_ext" 2>/dev/null | \ - "$GREP" CURL_DEF_TOKEN 2>/dev/null | \ - "$SED" 's/.*CURL_DEF_TOKEN[[ ]][[ ]]*//' 2>/dev/null | \ - "$SED" 's/[["]][[ ]]*[["]]//g' 2>/dev/null` - if test -z "$tmp_exp" || test "$tmp_exp" = "$1"; then - tmp_exp="" - fi - ]) - if test -z "$tmp_exp"; then - AS_VAR_SET(ac_HaveDef, no) - ifelse($3,,[AC_MSG_RESULT([no])]) - else - AS_VAR_SET(ac_HaveDef, yes) - AS_VAR_SET(ac_Def, $tmp_exp) - ifelse($3,,[AC_MSG_RESULT([$tmp_exp])]) - fi - AS_VAR_POPDEF([ac_Def])dnl - AS_VAR_POPDEF([ac_HaveDef])dnl -]) - - -dnl CURL_CHECK_DEF_CC (SYMBOL, [INCLUDES], [SILENT]) -dnl ------------------------------------------------- -dnl Use the C compiler to find out only if the given symbol is defined -dnl or not, this can not find out its expansion. This macro will not use -dnl default includes even if no INCLUDES argument is given. This macro -dnl will run silently when invoked with three arguments. - -AC_DEFUN([CURL_CHECK_DEF_CC], [ - AS_VAR_PUSHDEF([ac_HaveDef], [cares_cv_have_def_$1])dnl - ifelse($3,,[AC_MSG_CHECKING([for compiler definition of $1])]) - AC_COMPILE_IFELSE([ - AC_LANG_SOURCE( -ifelse($2,,,[$2])[[ -int main (void) -{ -#ifdef $1 - return 0; -#else - force compilation error -#endif -} - ]]) - ],[ - tst_symbol_defined="yes" - ],[ - tst_symbol_defined="no" - ]) - if test "$tst_symbol_defined" = "yes"; then - AS_VAR_SET(ac_HaveDef, yes) - ifelse($3,,[AC_MSG_RESULT([yes])]) - else - AS_VAR_SET(ac_HaveDef, no) - ifelse($3,,[AC_MSG_RESULT([no])]) - fi - AS_VAR_POPDEF([ac_HaveDef])dnl -]) - - -dnl CARES_CHECK_LIB_XNET -dnl ------------------------------------------------- -dnl Verify if X/Open network library is required. - -AC_DEFUN([CARES_CHECK_LIB_XNET], [ - AC_MSG_CHECKING([if X/Open network library is required]) - tst_lib_xnet_required="no" - AC_COMPILE_IFELSE([ - AC_LANG_SOURCE([[ -int main (void) -{ -#if defined(__hpux) && defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE >= 600) - return 0; -#elif defined(__hpux) && defined(_XOPEN_SOURCE_EXTENDED) - return 0; -#else - force compilation error -#endif -} - ]]) - ],[ - tst_lib_xnet_required="yes" - LIBS="$LIBS -lxnet" - ]) - AC_MSG_RESULT([$tst_lib_xnet_required]) -]) - - -dnl CARES_CHECK_AIX_ALL_SOURCE -dnl ------------------------------------------------- -dnl Provides a replacement of traditional AC_AIX with -dnl an uniform behaviour across all autoconf versions, -dnl and with our own placement rules. - -AC_DEFUN([CARES_CHECK_AIX_ALL_SOURCE], [ - AH_VERBATIM([_ALL_SOURCE], - [/* Define to 1 if OS is AIX. */ -#ifndef _ALL_SOURCE -# undef _ALL_SOURCE -#endif]) - AC_BEFORE([$0], [AC_SYS_LARGEFILE])dnl - AC_BEFORE([$0], [CARES_CONFIGURE_REENTRANT])dnl - AC_MSG_CHECKING([if OS is AIX (to define _ALL_SOURCE)]) - AC_EGREP_CPP([yes_this_is_aix],[ -#ifdef _AIX - yes_this_is_aix -#endif - ],[ - AC_MSG_RESULT([yes]) - AC_DEFINE(_ALL_SOURCE) - ],[ - AC_MSG_RESULT([no]) - ]) -]) - - -dnl CURL_CHECK_HEADER_WINDOWS -dnl ------------------------------------------------- -dnl Check for compilable and valid windows.h header - -AC_DEFUN([CURL_CHECK_HEADER_WINDOWS], [ - AC_CACHE_CHECK([for windows.h], [ac_cv_header_windows_h], [ - AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM([[ -#undef inline -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN -#endif -#include - ]],[[ -#if defined(__CYGWIN__) || defined(__CEGCC__) - HAVE_WINDOWS_H shall not be defined. -#else - int dummy=2*WINVER; -#endif - ]]) - ],[ - ac_cv_header_windows_h="yes" - ],[ - ac_cv_header_windows_h="no" - ]) - ]) - case "$ac_cv_header_windows_h" in - yes) - AC_DEFINE_UNQUOTED(HAVE_WINDOWS_H, 1, - [Define to 1 if you have the windows.h header file.]) - AC_DEFINE_UNQUOTED(WIN32_LEAN_AND_MEAN, 1, - [Define to avoid automatic inclusion of winsock.h]) - ;; - esac -]) - - -dnl CURL_CHECK_NATIVE_WINDOWS -dnl ------------------------------------------------- -dnl Check if building a native Windows target - -AC_DEFUN([CURL_CHECK_NATIVE_WINDOWS], [ - AC_REQUIRE([CURL_CHECK_HEADER_WINDOWS])dnl - AC_CACHE_CHECK([whether build target is a native Windows one], [ac_cv_native_windows], [ - if test "$ac_cv_header_windows_h" = "no"; then - ac_cv_native_windows="no" - else - AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM([[ - ]],[[ -#if defined(__MINGW32__) || defined(__MINGW32CE__) || \ - (defined(_MSC_VER) && (defined(_WIN32) || defined(_WIN64))) - int dummy=1; -#else - Not a native Windows build target. -#endif - ]]) - ],[ - ac_cv_native_windows="yes" - ],[ - ac_cv_native_windows="no" - ]) - fi - ]) - AM_CONDITIONAL(DOING_NATIVE_WINDOWS, test "x$ac_cv_native_windows" = xyes) -]) - - -dnl CURL_CHECK_HEADER_WINSOCK -dnl ------------------------------------------------- -dnl Check for compilable and valid winsock.h header - -AC_DEFUN([CURL_CHECK_HEADER_WINSOCK], [ - AC_REQUIRE([CURL_CHECK_HEADER_WINDOWS])dnl - AC_CACHE_CHECK([for winsock.h], [ac_cv_header_winsock_h], [ - AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM([[ -#undef inline -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN -#endif -#include -#include - ]],[[ -#if defined(__CYGWIN__) || defined(__CEGCC__) - HAVE_WINSOCK_H shall not be defined. -#else - int dummy=WSACleanup(); -#endif - ]]) - ],[ - ac_cv_header_winsock_h="yes" - ],[ - ac_cv_header_winsock_h="no" - ]) - ]) - case "$ac_cv_header_winsock_h" in - yes) - AC_DEFINE_UNQUOTED(HAVE_WINSOCK_H, 1, - [Define to 1 if you have the winsock.h header file.]) - ;; - esac -]) - - -dnl CURL_CHECK_HEADER_WINSOCK2 -dnl ------------------------------------------------- -dnl Check for compilable and valid winsock2.h header - -AC_DEFUN([CURL_CHECK_HEADER_WINSOCK2], [ - AC_REQUIRE([CURL_CHECK_HEADER_WINDOWS])dnl - AC_CACHE_CHECK([for winsock2.h], [ac_cv_header_winsock2_h], [ - AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM([[ -#undef inline -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN -#endif -#include -#include - ]],[[ -#if defined(__CYGWIN__) || defined(__CEGCC__) || defined(__MINGW32CE__) - HAVE_WINSOCK2_H shall not be defined. -#else - int dummy=2*IPPROTO_ESP; -#endif - ]]) - ],[ - ac_cv_header_winsock2_h="yes" - ],[ - ac_cv_header_winsock2_h="no" - ]) - ]) - case "$ac_cv_header_winsock2_h" in - yes) - AC_DEFINE_UNQUOTED(HAVE_WINSOCK2_H, 1, - [Define to 1 if you have the winsock2.h header file.]) - ;; - esac -]) - - -dnl CURL_CHECK_HEADER_WS2TCPIP -dnl ------------------------------------------------- -dnl Check for compilable and valid ws2tcpip.h header - -AC_DEFUN([CURL_CHECK_HEADER_WS2TCPIP], [ - AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK2])dnl - AC_CACHE_CHECK([for ws2tcpip.h], [ac_cv_header_ws2tcpip_h], [ - AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM([[ -#undef inline -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN -#endif -#include -#include -#include - ]],[[ -#if defined(__CYGWIN__) || defined(__CEGCC__) || defined(__MINGW32CE__) - HAVE_WS2TCPIP_H shall not be defined. -#else - int dummy=2*IP_PKTINFO; -#endif - ]]) - ],[ - ac_cv_header_ws2tcpip_h="yes" - ],[ - ac_cv_header_ws2tcpip_h="no" - ]) - ]) - case "$ac_cv_header_ws2tcpip_h" in - yes) - AC_DEFINE_UNQUOTED(HAVE_WS2TCPIP_H, 1, - [Define to 1 if you have the ws2tcpip.h header file.]) - ;; - esac -]) - - -dnl CURL_CHECK_HEADER_MALLOC -dnl ------------------------------------------------- -dnl Check for compilable and valid malloc.h header, -dnl and check if it is needed even with stdlib.h - -AC_DEFUN([CURL_CHECK_HEADER_MALLOC], [ - AC_CACHE_CHECK([for malloc.h], [ac_cv_header_malloc_h], [ - AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM([[ -#include - ]],[[ - void *p = malloc(10); - void *q = calloc(10,10); - free(p); - free(q); - ]]) - ],[ - ac_cv_header_malloc_h="yes" - ],[ - ac_cv_header_malloc_h="no" - ]) - ]) - if test "$ac_cv_header_malloc_h" = "yes"; then - AC_DEFINE_UNQUOTED(HAVE_MALLOC_H, 1, - [Define to 1 if you have the malloc.h header file.]) - # - AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM([[ -#include - ]],[[ - void *p = malloc(10); - void *q = calloc(10,10); - free(p); - free(q); - ]]) - ],[ - cares_cv_need_header_malloc_h="no" - ],[ - cares_cv_need_header_malloc_h="yes" - ]) - # - case "$cares_cv_need_header_malloc_h" in - yes) - AC_DEFINE_UNQUOTED(NEED_MALLOC_H, 1, - [Define to 1 if you need the malloc.h header file even with stdlib.h]) - ;; - esac - fi -]) - - -dnl CURL_CHECK_HEADER_MEMORY -dnl ------------------------------------------------- -dnl Check for compilable and valid memory.h header, -dnl and check if it is needed even with stdlib.h for -dnl memory related functions. - -AC_DEFUN([CURL_CHECK_HEADER_MEMORY], [ - AC_CACHE_CHECK([for memory.h], [ac_cv_header_memory_h], [ - AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM([[ -#include - ]],[[ - void *p = malloc(10); - void *q = calloc(10,10); - free(p); - free(q); - ]]) - ],[ - ac_cv_header_memory_h="yes" - ],[ - ac_cv_header_memory_h="no" - ]) - ]) - if test "$ac_cv_header_memory_h" = "yes"; then - AC_DEFINE_UNQUOTED(HAVE_MEMORY_H, 1, - [Define to 1 if you have the memory.h header file.]) - # - AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM([[ -#include - ]],[[ - void *p = malloc(10); - void *q = calloc(10,10); - free(p); - free(q); - ]]) - ],[ - cares_cv_need_header_memory_h="no" - ],[ - cares_cv_need_header_memory_h="yes" - ]) - # - case "$cares_cv_need_header_memory_h" in - yes) - AC_DEFINE_UNQUOTED(NEED_MEMORY_H, 1, - [Define to 1 if you need the memory.h header file even with stdlib.h]) - ;; - esac - fi -]) - - -dnl CURL_CHECK_FUNC_GETNAMEINFO -dnl ------------------------------------------------- -dnl Test if the getnameinfo function is available, -dnl and check the types of five of its arguments. -dnl If the function succeeds HAVE_GETNAMEINFO will be -dnl defined, defining the types of the arguments in -dnl GETNAMEINFO_TYPE_ARG1, GETNAMEINFO_TYPE_ARG2, -dnl GETNAMEINFO_TYPE_ARG46 and GETNAMEINFO_TYPE_ARG7, -dnl and also defining the type qualifier of first -dnl argument in GETNAMEINFO_QUAL_ARG1. - -AC_DEFUN([CURL_CHECK_FUNC_GETNAMEINFO], [ - AC_REQUIRE([CURL_CHECK_HEADER_WS2TCPIP])dnl - AC_CHECK_HEADERS(sys/types.h sys/socket.h netdb.h) - # - AC_MSG_CHECKING([for getnameinfo]) - AC_LINK_IFELSE([ - AC_LANG_FUNC_LINK_TRY([getnameinfo]) - ],[ - AC_MSG_RESULT([yes]) - cares_cv_getnameinfo="yes" - ],[ - AC_MSG_RESULT([no]) - cares_cv_getnameinfo="no" - ]) - # - if test "$cares_cv_getnameinfo" != "yes"; then - AC_MSG_CHECKING([deeper for getnameinfo]) - AC_LINK_IFELSE([ - AC_LANG_PROGRAM([[ - ]],[[ - getnameinfo(); - ]]) - ],[ - AC_MSG_RESULT([yes]) - cares_cv_getnameinfo="yes" - ],[ - AC_MSG_RESULT([but still no]) - cares_cv_getnameinfo="no" - ]) - fi - # - if test "$cares_cv_getnameinfo" != "yes"; then - AC_MSG_CHECKING([deeper and deeper for getnameinfo]) - AC_LINK_IFELSE([ - AC_LANG_PROGRAM([[ -#undef inline -#ifdef HAVE_WINDOWS_H -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN -#endif -#include -#ifdef HAVE_WINSOCK2_H -#include -#ifdef HAVE_WS2TCPIP_H -#include -#endif -#endif -#else -#ifdef HAVE_SYS_TYPES_H -#include -#endif -#ifdef HAVE_SYS_SOCKET_H -#include -#endif -#ifdef HAVE_NETDB_H -#include -#endif -#endif - ]],[[ - getnameinfo(0, 0, 0, 0, 0, 0, 0); - ]]) - ],[ - AC_MSG_RESULT([yes]) - cares_cv_getnameinfo="yes" - ],[ - AC_MSG_RESULT([but still no]) - cares_cv_getnameinfo="no" - ]) - fi - # - if test "$cares_cv_getnameinfo" = "yes"; then - AC_CACHE_CHECK([types of arguments for getnameinfo], - [cares_cv_func_getnameinfo_args], [ - cares_cv_func_getnameinfo_args="unknown" - for gni_arg1 in 'struct sockaddr *' 'const struct sockaddr *' 'void *'; do - for gni_arg2 in 'socklen_t' 'size_t' 'int'; do - for gni_arg46 in 'size_t' 'int' 'socklen_t' 'unsigned int' 'DWORD'; do - for gni_arg7 in 'int' 'unsigned int'; do - if test "$cares_cv_func_getnameinfo_args" = "unknown"; then - AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM([[ -#undef inline -#ifdef HAVE_WINDOWS_H -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN -#endif -#if (!defined(_WIN32_WINNT)) || (_WIN32_WINNT < 0x0501) -#undef _WIN32_WINNT -#define _WIN32_WINNT 0x0501 -#endif -#include -#ifdef HAVE_WINSOCK2_H -#include -#ifdef HAVE_WS2TCPIP_H -#include -#endif -#endif -#define GNICALLCONV WSAAPI -#else -#ifdef HAVE_SYS_TYPES_H -#include -#endif -#ifdef HAVE_SYS_SOCKET_H -#include -#endif -#ifdef HAVE_NETDB_H -#include -#endif -#define GNICALLCONV -#endif - extern int GNICALLCONV getnameinfo($gni_arg1, $gni_arg2, - char *, $gni_arg46, - char *, $gni_arg46, - $gni_arg7); - ]],[[ - $gni_arg2 salen=0; - $gni_arg46 hostlen=0; - $gni_arg46 servlen=0; - $gni_arg7 flags=0; - int res = getnameinfo(0, salen, 0, hostlen, 0, servlen, flags); - ]]) - ],[ - cares_cv_func_getnameinfo_args="$gni_arg1,$gni_arg2,$gni_arg46,$gni_arg7" - ]) - fi - done - done - done - done - ]) # AC-CACHE-CHECK - if test "$cares_cv_func_getnameinfo_args" = "unknown"; then - AC_MSG_WARN([Cannot find proper types to use for getnameinfo args]) - AC_MSG_WARN([HAVE_GETNAMEINFO will not be defined]) - else - gni_prev_IFS=$IFS; IFS=',' - set dummy `echo "$cares_cv_func_getnameinfo_args" | sed 's/\*/\*/g'` - IFS=$gni_prev_IFS - shift - # - gni_qual_type_arg1=$[1] - # - AC_DEFINE_UNQUOTED(GETNAMEINFO_TYPE_ARG2, $[2], - [Define to the type of arg 2 for getnameinfo.]) - AC_DEFINE_UNQUOTED(GETNAMEINFO_TYPE_ARG46, $[3], - [Define to the type of args 4 and 6 for getnameinfo.]) - AC_DEFINE_UNQUOTED(GETNAMEINFO_TYPE_ARG7, $[4], - [Define to the type of arg 7 for getnameinfo.]) - # - prev_sh_opts=$- - # - case $prev_sh_opts in - *f*) - ;; - *) - set -f - ;; - esac - # - case "$gni_qual_type_arg1" in - const*) - gni_qual_arg1=const - gni_type_arg1=`echo $gni_qual_type_arg1 | sed 's/^const //'` - ;; - *) - gni_qual_arg1= - gni_type_arg1=$gni_qual_type_arg1 - ;; - esac - # - AC_DEFINE_UNQUOTED(GETNAMEINFO_QUAL_ARG1, $gni_qual_arg1, - [Define to the type qualifier of arg 1 for getnameinfo.]) - AC_DEFINE_UNQUOTED(GETNAMEINFO_TYPE_ARG1, $gni_type_arg1, - [Define to the type of arg 1 for getnameinfo.]) - # - case $prev_sh_opts in - *f*) - ;; - *) - set +f - ;; - esac - # - AC_DEFINE_UNQUOTED(HAVE_GETNAMEINFO, 1, - [Define to 1 if you have the getnameinfo function.]) - ac_cv_func_getnameinfo="yes" - fi - fi -]) - - -dnl TYPE_SOCKADDR_STORAGE -dnl ------------------------------------------------- -dnl Check for struct sockaddr_storage. Most IPv6-enabled -dnl hosts have it, but AIX 4.3 is one known exception. - -AC_DEFUN([TYPE_SOCKADDR_STORAGE], -[ - AC_CHECK_TYPE([struct sockaddr_storage], - AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE, 1, - [if struct sockaddr_storage is defined]), , - [ -#undef inline -#ifdef HAVE_WINDOWS_H -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN -#endif -#include -#ifdef HAVE_WINSOCK2_H -#include -#endif -#else -#ifdef HAVE_SYS_TYPES_H -#include -#endif -#ifdef HAVE_SYS_SOCKET_H -#include -#endif -#ifdef HAVE_NETINET_IN_H -#include -#endif -#ifdef HAVE_ARPA_INET_H -#include -#endif -#endif - ]) -]) - - -dnl CURL_CHECK_NI_WITHSCOPEID -dnl ------------------------------------------------- -dnl Check for working NI_WITHSCOPEID in getnameinfo() - -AC_DEFUN([CURL_CHECK_NI_WITHSCOPEID], [ - AC_REQUIRE([CURL_CHECK_FUNC_GETNAMEINFO])dnl - AC_REQUIRE([TYPE_SOCKADDR_STORAGE])dnl - AC_CHECK_HEADERS(stdio.h sys/types.h sys/socket.h \ - netdb.h netinet/in.h arpa/inet.h) - # - AC_CACHE_CHECK([for working NI_WITHSCOPEID], - [ac_cv_working_ni_withscopeid], [ - AC_RUN_IFELSE([ - AC_LANG_PROGRAM([[ -#ifdef HAVE_STDLIB_H -#include -#endif -#ifdef HAVE_STDIO_H -#include -#endif -#ifdef HAVE_SYS_TYPES_H -#include -#endif -#ifdef HAVE_SYS_SOCKET_H -#include -#endif -#ifdef HAVE_NETDB_H -#include -#endif -#ifdef HAVE_NETINET_IN_H -#include -#endif -#ifdef HAVE_ARPA_INET_H -#include -#endif - ]],[[ -#if defined(NI_WITHSCOPEID) && defined(HAVE_GETNAMEINFO) -#ifdef HAVE_STRUCT_SOCKADDR_STORAGE - struct sockaddr_storage sa; -#else - unsigned char sa[256]; -#endif - char hostbuf[NI_MAXHOST]; - int rc; - GETNAMEINFO_TYPE_ARG2 salen = (GETNAMEINFO_TYPE_ARG2)sizeof(sa); - GETNAMEINFO_TYPE_ARG46 hostlen = (GETNAMEINFO_TYPE_ARG46)sizeof(hostbuf); - GETNAMEINFO_TYPE_ARG7 flags = NI_NUMERICHOST | NI_NUMERICSERV | NI_WITHSCOPEID; - int fd = socket(AF_INET6, SOCK_STREAM, 0); - if(fd < 0) { - perror("socket()"); - return 1; /* Error creating socket */ - } - rc = getsockname(fd, (GETNAMEINFO_TYPE_ARG1)&sa, &salen); - if(rc) { - perror("getsockname()"); - return 2; /* Error retrieving socket name */ - } - rc = getnameinfo((GETNAMEINFO_TYPE_ARG1)&sa, salen, hostbuf, hostlen, NULL, 0, flags); - if(rc) { - printf("rc = %s\n", gai_strerror(rc)); - return 3; /* Error translating socket address */ - } - return 0; /* Ok, NI_WITHSCOPEID works */ -#else - return 4; /* Error, NI_WITHSCOPEID not defined or no getnameinfo() */ -#endif - ]]) # AC-LANG-PROGRAM - ],[ - # Exit code == 0. Program worked. - ac_cv_working_ni_withscopeid="yes" - ],[ - # Exit code != 0. Program failed. - ac_cv_working_ni_withscopeid="no" - ],[ - # Program is not run when cross-compiling. So we assume - # NI_WITHSCOPEID will work if we are able to compile it. - AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM([[ -#include -#include -#include - ]],[[ - unsigned int dummy= NI_NUMERICHOST | NI_NUMERICSERV | NI_WITHSCOPEID; - ]]) - ],[ - ac_cv_working_ni_withscopeid="yes" - ],[ - ac_cv_working_ni_withscopeid="no" - ]) # AC-COMPILE-IFELSE - ]) # AC-RUN-IFELSE - ]) # AC-CACHE-CHECK - case "$ac_cv_working_ni_withscopeid" in - yes) - AC_DEFINE(HAVE_NI_WITHSCOPEID, 1, - [Define to 1 if NI_WITHSCOPEID exists and works.]) - ;; - esac -]) - - -dnl CURL_CHECK_FUNC_RECV -dnl ------------------------------------------------- -dnl Test if the socket recv() function is available, -dnl and check its return type and the types of its -dnl arguments. If the function succeeds HAVE_RECV -dnl will be defined, defining the types of the arguments -dnl in RECV_TYPE_ARG1, RECV_TYPE_ARG2, RECV_TYPE_ARG3 -dnl and RECV_TYPE_ARG4, defining the type of the function -dnl return value in RECV_TYPE_RETV. - -AC_DEFUN([CURL_CHECK_FUNC_RECV], [ - AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK])dnl - AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK2])dnl - AC_CHECK_HEADERS(sys/types.h sys/socket.h) - # - AC_MSG_CHECKING([for recv]) - AC_LINK_IFELSE([ - AC_LANG_PROGRAM([[ -#undef inline -#ifdef HAVE_WINDOWS_H -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN -#endif -#include -#ifdef HAVE_WINSOCK2_H -#include -#else -#ifdef HAVE_WINSOCK_H -#include -#endif -#endif -#else -#ifdef HAVE_SYS_TYPES_H -#include -#endif -#ifdef HAVE_SYS_SOCKET_H -#include -#endif -#endif - ]],[[ - recv(0, 0, 0, 0); - ]]) - ],[ - AC_MSG_RESULT([yes]) - cares_cv_recv="yes" - ],[ - AC_MSG_RESULT([no]) - cares_cv_recv="no" - ]) - # - if test "$cares_cv_recv" = "yes"; then - AC_CACHE_CHECK([types of args and return type for recv], - [cares_cv_func_recv_args], [ - cares_cv_func_recv_args="unknown" - for recv_retv in 'int' 'ssize_t'; do - for recv_arg1 in 'int' 'ssize_t' 'SOCKET'; do - for recv_arg2 in 'char *' 'void *'; do - for recv_arg3 in 'size_t' 'int' 'socklen_t' 'unsigned int'; do - for recv_arg4 in 'int' 'unsigned int'; do - if test "$cares_cv_func_recv_args" = "unknown"; then - AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM([[ -#undef inline -#ifdef HAVE_WINDOWS_H -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN -#endif -#include -#ifdef HAVE_WINSOCK2_H -#include -#else -#ifdef HAVE_WINSOCK_H -#include -#endif -#endif -#define RECVCALLCONV PASCAL -#else -#ifdef HAVE_SYS_TYPES_H -#include -#endif -#ifdef HAVE_SYS_SOCKET_H -#include -#endif -#define RECVCALLCONV -#endif - extern $recv_retv RECVCALLCONV - recv($recv_arg1, $recv_arg2, $recv_arg3, $recv_arg4); - ]],[[ - $recv_arg1 s=0; - $recv_arg2 buf=0; - $recv_arg3 len=0; - $recv_arg4 flags=0; - $recv_retv res = recv(s, buf, len, flags); - ]]) - ],[ - cares_cv_func_recv_args="$recv_arg1,$recv_arg2,$recv_arg3,$recv_arg4,$recv_retv" - ]) - fi - done - done - done - done - done - ]) # AC-CACHE-CHECK - if test "$cares_cv_func_recv_args" = "unknown"; then - AC_MSG_ERROR([Cannot find proper types to use for recv args]) - else - recv_prev_IFS=$IFS; IFS=',' - set dummy `echo "$cares_cv_func_recv_args" | sed 's/\*/\*/g'` - IFS=$recv_prev_IFS - shift - # - AC_DEFINE_UNQUOTED(RECV_TYPE_ARG1, $[1], - [Define to the type of arg 1 for recv.]) - AC_DEFINE_UNQUOTED(RECV_TYPE_ARG2, $[2], - [Define to the type of arg 2 for recv.]) - AC_DEFINE_UNQUOTED(RECV_TYPE_ARG3, $[3], - [Define to the type of arg 3 for recv.]) - AC_DEFINE_UNQUOTED(RECV_TYPE_ARG4, $[4], - [Define to the type of arg 4 for recv.]) - AC_DEFINE_UNQUOTED(RECV_TYPE_RETV, $[5], - [Define to the function return type for recv.]) - # - AC_DEFINE_UNQUOTED(HAVE_RECV, 1, - [Define to 1 if you have the recv function.]) - ac_cv_func_recv="yes" - fi - else - AC_MSG_ERROR([Unable to link function recv]) - fi -]) - - -dnl CURL_CHECK_FUNC_SEND -dnl ------------------------------------------------- -dnl Test if the socket send() function is available, -dnl and check its return type and the types of its -dnl arguments. If the function succeeds HAVE_SEND -dnl will be defined, defining the types of the arguments -dnl in SEND_TYPE_ARG1, SEND_TYPE_ARG2, SEND_TYPE_ARG3 -dnl and SEND_TYPE_ARG4, defining the type of the function -dnl return value in SEND_TYPE_RETV, and also defining the -dnl type qualifier of second argument in SEND_QUAL_ARG2. - -AC_DEFUN([CURL_CHECK_FUNC_SEND], [ - AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK])dnl - AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK2])dnl - AC_CHECK_HEADERS(sys/types.h sys/socket.h) - # - AC_MSG_CHECKING([for send]) - AC_LINK_IFELSE([ - AC_LANG_PROGRAM([[ -#undef inline -#ifdef HAVE_WINDOWS_H -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN -#endif -#include -#ifdef HAVE_WINSOCK2_H -#include -#else -#ifdef HAVE_WINSOCK_H -#include -#endif -#endif -#else -#ifdef HAVE_SYS_TYPES_H -#include -#endif -#ifdef HAVE_SYS_SOCKET_H -#include -#endif -#endif - ]],[[ - send(0, 0, 0, 0); - ]]) - ],[ - AC_MSG_RESULT([yes]) - cares_cv_send="yes" - ],[ - AC_MSG_RESULT([no]) - cares_cv_send="no" - ]) - # - if test "$cares_cv_send" = "yes"; then - AC_CACHE_CHECK([types of args and return type for send], - [cares_cv_func_send_args], [ - cares_cv_func_send_args="unknown" - for send_retv in 'int' 'ssize_t'; do - for send_arg1 in 'int' 'ssize_t' 'SOCKET'; do - for send_arg2 in 'char *' 'void *' 'const char *' 'const void *'; do - for send_arg3 in 'size_t' 'int' 'socklen_t' 'unsigned int'; do - for send_arg4 in 'int' 'unsigned int'; do - if test "$cares_cv_func_send_args" = "unknown"; then - AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM([[ -#undef inline -#ifdef HAVE_WINDOWS_H -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN -#endif -#include -#ifdef HAVE_WINSOCK2_H -#include -#else -#ifdef HAVE_WINSOCK_H -#include -#endif -#endif -#define SENDCALLCONV PASCAL -#else -#ifdef HAVE_SYS_TYPES_H -#include -#endif -#ifdef HAVE_SYS_SOCKET_H -#include -#endif -#define SENDCALLCONV -#endif - extern $send_retv SENDCALLCONV - send($send_arg1, $send_arg2, $send_arg3, $send_arg4); - ]],[[ - $send_arg1 s=0; - $send_arg3 len=0; - $send_arg4 flags=0; - $send_retv res = send(s, 0, len, flags); - ]]) - ],[ - cares_cv_func_send_args="$send_arg1,$send_arg2,$send_arg3,$send_arg4,$send_retv" - ]) - fi - done - done - done - done - done - ]) # AC-CACHE-CHECK - if test "$cares_cv_func_send_args" = "unknown"; then - AC_MSG_ERROR([Cannot find proper types to use for send args]) - else - send_prev_IFS=$IFS; IFS=',' - set dummy `echo "$cares_cv_func_send_args" | sed 's/\*/\*/g'` - IFS=$send_prev_IFS - shift - # - send_qual_type_arg2=$[2] - # - AC_DEFINE_UNQUOTED(SEND_TYPE_ARG1, $[1], - [Define to the type of arg 1 for send.]) - AC_DEFINE_UNQUOTED(SEND_TYPE_ARG3, $[3], - [Define to the type of arg 3 for send.]) - AC_DEFINE_UNQUOTED(SEND_TYPE_ARG4, $[4], - [Define to the type of arg 4 for send.]) - AC_DEFINE_UNQUOTED(SEND_TYPE_RETV, $[5], - [Define to the function return type for send.]) - # - prev_sh_opts=$- - # - case $prev_sh_opts in - *f*) - ;; - *) - set -f - ;; - esac - # - case "$send_qual_type_arg2" in - const*) - send_qual_arg2=const - send_type_arg2=`echo $send_qual_type_arg2 | sed 's/^const //'` - ;; - *) - send_qual_arg2= - send_type_arg2=$send_qual_type_arg2 - ;; - esac - # - AC_DEFINE_UNQUOTED(SEND_QUAL_ARG2, $send_qual_arg2, - [Define to the type qualifier of arg 2 for send.]) - AC_DEFINE_UNQUOTED(SEND_TYPE_ARG2, $send_type_arg2, - [Define to the type of arg 2 for send.]) - # - case $prev_sh_opts in - *f*) - ;; - *) - set +f - ;; - esac - # - AC_DEFINE_UNQUOTED(HAVE_SEND, 1, - [Define to 1 if you have the send function.]) - ac_cv_func_send="yes" - fi - else - AC_MSG_ERROR([Unable to link function send]) - fi -]) - - -dnl CURL_CHECK_FUNC_RECVFROM -dnl ------------------------------------------------- -dnl Test if the socket recvfrom() function is available, -dnl and check its return type and the types of its -dnl arguments. If the function succeeds HAVE_RECVFROM -dnl will be defined, defining the types of the arguments -dnl in RECVFROM_TYPE_ARG1, RECVFROM_TYPE_ARG2, and so on -dnl to RECVFROM_TYPE_ARG6, defining also the type of the -dnl function return value in RECVFROM_TYPE_RETV. -dnl Notice that the types returned for pointer arguments -dnl will actually be the type pointed by the pointer. - -AC_DEFUN([CURL_CHECK_FUNC_RECVFROM], [ - AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK])dnl - AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK2])dnl - AC_CHECK_HEADERS(sys/types.h sys/socket.h) - # - AC_MSG_CHECKING([for recvfrom]) - AC_LINK_IFELSE([ - AC_LANG_PROGRAM([[ -#undef inline -#ifdef HAVE_WINDOWS_H -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN -#endif -#include -#ifdef HAVE_WINSOCK2_H -#include -#else -#ifdef HAVE_WINSOCK_H -#include -#endif -#endif -#else -#ifdef HAVE_SYS_TYPES_H -#include -#endif -#ifdef HAVE_SYS_SOCKET_H -#include -#endif -#endif - ]],[[ - recvfrom(0, 0, 0, 0, 0, 0); - ]]) - ],[ - AC_MSG_RESULT([yes]) - cares_cv_recvfrom="yes" - ],[ - AC_MSG_RESULT([no]) - cares_cv_recvfrom="no" - ]) - # - if test "$cares_cv_recvfrom" = "yes"; then - AC_CACHE_CHECK([types of args and return type for recvfrom], - [cares_cv_func_recvfrom_args], [ - cares_cv_func_recvfrom_args="unknown" - for recvfrom_retv in 'int' 'ssize_t'; do - for recvfrom_arg1 in 'int' 'ssize_t' 'SOCKET'; do - for recvfrom_arg2 in 'char *' 'void *'; do - for recvfrom_arg3 in 'size_t' 'int' 'socklen_t' 'unsigned int'; do - for recvfrom_arg4 in 'int' 'unsigned int'; do - for recvfrom_arg5 in 'struct sockaddr *' 'void *' 'const struct sockaddr *'; do - for recvfrom_arg6 in 'socklen_t *' 'int *' 'unsigned int *' 'size_t *' 'void *'; do - if test "$cares_cv_func_recvfrom_args" = "unknown"; then - AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM([[ -#undef inline -#ifdef HAVE_WINDOWS_H -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN -#endif -#include -#ifdef HAVE_WINSOCK2_H -#include -#else -#ifdef HAVE_WINSOCK_H -#include -#endif -#endif -#define RECVFROMCALLCONV PASCAL -#else -#ifdef HAVE_SYS_TYPES_H -#include -#endif -#ifdef HAVE_SYS_SOCKET_H -#include -#endif -#define RECVFROMCALLCONV -#endif - extern $recvfrom_retv RECVFROMCALLCONV - recvfrom($recvfrom_arg1, $recvfrom_arg2, - $recvfrom_arg3, $recvfrom_arg4, - $recvfrom_arg5, $recvfrom_arg6); - ]],[[ - $recvfrom_arg1 s=0; - $recvfrom_arg2 buf=0; - $recvfrom_arg3 len=0; - $recvfrom_arg4 flags=0; - $recvfrom_arg5 addr=0; - $recvfrom_arg6 addrlen=0; - $recvfrom_retv res=0; - res = recvfrom(s, buf, len, flags, addr, addrlen); - ]]) - ],[ - cares_cv_func_recvfrom_args="$recvfrom_arg1,$recvfrom_arg2,$recvfrom_arg3,$recvfrom_arg4,$recvfrom_arg5,$recvfrom_arg6,$recvfrom_retv" - ]) - fi - done - done - done - done - done - done - done - ]) # AC-CACHE-CHECK - # Nearly last minute change for this release starts here - AC_DEFINE_UNQUOTED(HAVE_RECVFROM, 1, - [Define to 1 if you have the recvfrom function.]) - ac_cv_func_recvfrom="yes" - # Nearly last minute change for this release ends here - if test "$cares_cv_func_recvfrom_args" = "unknown"; then - AC_MSG_WARN([Cannot find proper types to use for recvfrom args]) - else - recvfrom_prev_IFS=$IFS; IFS=',' - set dummy `echo "$cares_cv_func_recvfrom_args" | sed 's/\*/\*/g'` - IFS=$recvfrom_prev_IFS - shift - # - recvfrom_ptrt_arg2=$[2] - recvfrom_qual_ptrt_arg5=$[5] - recvfrom_ptrt_arg6=$[6] - # - AC_DEFINE_UNQUOTED(RECVFROM_TYPE_ARG1, $[1], - [Define to the type of arg 1 for recvfrom.]) - AC_DEFINE_UNQUOTED(RECVFROM_TYPE_ARG3, $[3], - [Define to the type of arg 3 for recvfrom.]) - AC_DEFINE_UNQUOTED(RECVFROM_TYPE_ARG4, $[4], - [Define to the type of arg 4 for recvfrom.]) - AC_DEFINE_UNQUOTED(RECVFROM_TYPE_RETV, $[7], - [Define to the function return type for recvfrom.]) - # - prev_sh_opts=$- - # - case $prev_sh_opts in - *f*) - ;; - *) - set -f - ;; - esac - # - case "$recvfrom_qual_ptrt_arg5" in - const*) - recvfrom_qual_arg5=const - recvfrom_ptrt_arg5=`echo $recvfrom_qual_ptrt_arg5 | sed 's/^const //'` - ;; - *) - recvfrom_qual_arg5= - recvfrom_ptrt_arg5=$recvfrom_qual_ptrt_arg5 - ;; - esac - # - recvfrom_type_arg2=`echo $recvfrom_ptrt_arg2 | sed 's/ \*//'` - recvfrom_type_arg5=`echo $recvfrom_ptrt_arg5 | sed 's/ \*//'` - recvfrom_type_arg6=`echo $recvfrom_ptrt_arg6 | sed 's/ \*//'` - # - AC_DEFINE_UNQUOTED(RECVFROM_TYPE_ARG2, $recvfrom_type_arg2, - [Define to the type pointed by arg 2 for recvfrom.]) - AC_DEFINE_UNQUOTED(RECVFROM_QUAL_ARG5, $recvfrom_qual_arg5, - [Define to the type qualifier pointed by arg 5 for recvfrom.]) - AC_DEFINE_UNQUOTED(RECVFROM_TYPE_ARG5, $recvfrom_type_arg5, - [Define to the type pointed by arg 5 for recvfrom.]) - AC_DEFINE_UNQUOTED(RECVFROM_TYPE_ARG6, $recvfrom_type_arg6, - [Define to the type pointed by arg 6 for recvfrom.]) - # - if test "$recvfrom_type_arg2" = "void"; then - AC_DEFINE_UNQUOTED(RECVFROM_TYPE_ARG2_IS_VOID, 1, - [Define to 1 if the type pointed by arg 2 for recvfrom is void.]) - fi - if test "$recvfrom_type_arg5" = "void"; then - AC_DEFINE_UNQUOTED(RECVFROM_TYPE_ARG5_IS_VOID, 1, - [Define to 1 if the type pointed by arg 5 for recvfrom is void.]) - fi - if test "$recvfrom_type_arg6" = "void"; then - AC_DEFINE_UNQUOTED(RECVFROM_TYPE_ARG6_IS_VOID, 1, - [Define to 1 if the type pointed by arg 6 for recvfrom is void.]) - fi - # - case $prev_sh_opts in - *f*) - ;; - *) - set +f - ;; - esac - # - AC_DEFINE_UNQUOTED(HAVE_RECVFROM, 1, - [Define to 1 if you have the recvfrom function.]) - ac_cv_func_recvfrom="yes" - fi - else - AC_MSG_WARN([Unable to link function recvfrom]) - AC_MSG_WARN([Your system will be vulnerable to some forms of DNS cache poisoning]) - fi -]) - - -dnl CURL_CHECK_MSG_NOSIGNAL -dnl ------------------------------------------------- -dnl Check for MSG_NOSIGNAL - -AC_DEFUN([CURL_CHECK_MSG_NOSIGNAL], [ - AC_CHECK_HEADERS(sys/types.h sys/socket.h) - AC_CACHE_CHECK([for MSG_NOSIGNAL], [ac_cv_msg_nosignal], [ - AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM([[ -#undef inline -#ifdef HAVE_WINDOWS_H -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN -#endif -#include -#ifdef HAVE_WINSOCK2_H -#include -#else -#ifdef HAVE_WINSOCK_H -#include -#endif -#endif -#else -#ifdef HAVE_SYS_TYPES_H -#include -#endif -#ifdef HAVE_SYS_SOCKET_H -#include -#endif -#endif - ]],[[ - int flag=MSG_NOSIGNAL; - ]]) - ],[ - ac_cv_msg_nosignal="yes" - ],[ - ac_cv_msg_nosignal="no" - ]) - ]) - case "$ac_cv_msg_nosignal" in - yes) - AC_DEFINE_UNQUOTED(HAVE_MSG_NOSIGNAL, 1, - [Define to 1 if you have the MSG_NOSIGNAL flag.]) - ;; - esac -]) - - -dnl CURL_CHECK_STRUCT_TIMEVAL -dnl ------------------------------------------------- -dnl Check for timeval struct - -AC_DEFUN([CURL_CHECK_STRUCT_TIMEVAL], [ - AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK])dnl - AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK2])dnl - AC_CHECK_HEADERS(sys/types.h sys/time.h time.h sys/socket.h) - AC_CACHE_CHECK([for struct timeval], [ac_cv_struct_timeval], [ - AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM([[ -#undef inline -#ifdef HAVE_WINDOWS_H -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN -#endif -#include -#ifdef HAVE_WINSOCK2_H -#include -#else -#ifdef HAVE_WINSOCK_H -#include -#endif -#endif -#endif -#ifdef HAVE_SYS_TYPES_H -#include -#endif -#ifdef HAVE_SYS_TIME_H -#include -#ifdef TIME_WITH_SYS_TIME -#include -#endif -#else -#ifdef HAVE_TIME_H -#include -#endif -#endif -#ifdef HAVE_SYS_SOCKET_H -#include -#endif - ]],[[ - struct timeval ts; - ts.tv_sec = 0; - ts.tv_usec = 0; - ]]) - ],[ - ac_cv_struct_timeval="yes" - ],[ - ac_cv_struct_timeval="no" - ]) - ]) - case "$ac_cv_struct_timeval" in - yes) - AC_DEFINE_UNQUOTED(HAVE_STRUCT_TIMEVAL, 1, - [Define to 1 if you have the timeval struct.]) - ;; - esac -]) - - -dnl TYPE_SIG_ATOMIC_T -dnl ------------------------------------------------- -dnl Check if the sig_atomic_t type is available, and -dnl verify if it is already defined as volatile. - -AC_DEFUN([TYPE_SIG_ATOMIC_T], [ - AC_CHECK_HEADERS(signal.h) - AC_CHECK_TYPE([sig_atomic_t],[ - AC_DEFINE(HAVE_SIG_ATOMIC_T, 1, - [Define to 1 if sig_atomic_t is an available typedef.]) - ], ,[ -#ifdef HAVE_SIGNAL_H -#include -#endif - ]) - case "$ac_cv_type_sig_atomic_t" in - yes) - # - AC_MSG_CHECKING([if sig_atomic_t is already defined as volatile]) - AC_LINK_IFELSE([ - AC_LANG_PROGRAM([[ -#ifdef HAVE_SIGNAL_H -#include -#endif - ]],[[ - static volatile sig_atomic_t dummy = 0; - ]]) - ],[ - AC_MSG_RESULT([no]) - ac_cv_sig_atomic_t_volatile="no" - ],[ - AC_MSG_RESULT([yes]) - ac_cv_sig_atomic_t_volatile="yes" - ]) - # - if test "$ac_cv_sig_atomic_t_volatile" = "yes"; then - AC_DEFINE(HAVE_SIG_ATOMIC_T_VOLATILE, 1, - [Define to 1 if sig_atomic_t is already defined as volatile.]) - fi - ;; - esac -]) - - -dnl TYPE_IN_ADDR_T -dnl ------------------------------------------------- -dnl Check for in_addr_t: it is used to receive the return code of inet_addr() -dnl and a few other things. - -AC_DEFUN([TYPE_IN_ADDR_T], [ - AC_CHECK_TYPE([in_addr_t], ,[ - dnl in_addr_t not available - AC_CACHE_CHECK([for in_addr_t equivalent], - [cares_cv_in_addr_t_equiv], [ - cares_cv_in_addr_t_equiv="unknown" - for t in "unsigned long" int size_t unsigned long; do - if test "$cares_cv_in_addr_t_equiv" = "unknown"; then - AC_LINK_IFELSE([ - AC_LANG_PROGRAM([[ -#undef inline -#ifdef HAVE_WINDOWS_H -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN -#endif -#include -#ifdef HAVE_WINSOCK2_H -#include -#else -#ifdef HAVE_WINSOCK_H -#include -#endif -#endif -#else -#ifdef HAVE_SYS_TYPES_H -#include -#endif -#ifdef HAVE_SYS_SOCKET_H -#include -#endif -#ifdef HAVE_NETINET_IN_H -#include -#endif -#ifdef HAVE_ARPA_INET_H -#include -#endif -#endif - ]],[[ - $t data = inet_addr ("1.2.3.4"); - ]]) - ],[ - cares_cv_in_addr_t_equiv="$t" - ]) - fi - done - ]) - case "$cares_cv_in_addr_t_equiv" in - unknown) - AC_MSG_ERROR([Cannot find a type to use in place of in_addr_t]) - ;; - *) - AC_DEFINE_UNQUOTED(in_addr_t, $cares_cv_in_addr_t_equiv, - [Type to use in place of in_addr_t when system does not provide it.]) - ;; - esac - ],[ -#undef inline -#ifdef HAVE_WINDOWS_H -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN -#endif -#include -#ifdef HAVE_WINSOCK2_H -#include -#else -#ifdef HAVE_WINSOCK_H -#include -#endif -#endif -#else -#ifdef HAVE_SYS_TYPES_H -#include -#endif -#ifdef HAVE_SYS_SOCKET_H -#include -#endif -#ifdef HAVE_NETINET_IN_H -#include -#endif -#ifdef HAVE_ARPA_INET_H -#include -#endif -#endif - ]) -]) - - -dnl CURL_CHECK_FUNC_CLOCK_GETTIME_MONOTONIC -dnl ------------------------------------------------- -dnl Check if monotonic clock_gettime is available. - -AC_DEFUN([CURL_CHECK_FUNC_CLOCK_GETTIME_MONOTONIC], [ - AC_CHECK_HEADERS(sys/types.h sys/time.h time.h) - AC_MSG_CHECKING([for monotonic clock_gettime]) - AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM([[ -#ifdef HAVE_SYS_TYPES_H -#include -#endif -#ifdef HAVE_SYS_TIME_H -#include -#ifdef TIME_WITH_SYS_TIME -#include -#endif -#else -#ifdef HAVE_TIME_H -#include -#endif -#endif - ]],[[ - struct timespec ts; - (void)clock_gettime(CLOCK_MONOTONIC, &ts); - ]]) - ],[ - AC_MSG_RESULT([yes]) - ac_cv_func_clock_gettime="yes" - ],[ - AC_MSG_RESULT([no]) - ac_cv_func_clock_gettime="no" - ]) - dnl Definition of HAVE_CLOCK_GETTIME_MONOTONIC is intentionally postponed - dnl until library linking and run-time checks for clock_gettime succeed. -]) - - -dnl CURL_CHECK_LIBS_CLOCK_GETTIME_MONOTONIC -dnl ------------------------------------------------- -dnl If monotonic clock_gettime is available then, -dnl check and prepended to LIBS any needed libraries. - -AC_DEFUN([CURL_CHECK_LIBS_CLOCK_GETTIME_MONOTONIC], [ - AC_REQUIRE([CURL_CHECK_FUNC_CLOCK_GETTIME_MONOTONIC])dnl - # - if test "$ac_cv_func_clock_gettime" = "yes"; then - # - AC_MSG_CHECKING([for clock_gettime in libraries]) - # - cares_cv_save_LIBS="$LIBS" - cares_cv_gclk_LIBS="unknown" - # - for x_xlibs in '' '-lrt' '-lposix4' ; do - if test "$cares_cv_gclk_LIBS" = "unknown"; then - if test -z "$x_xlibs"; then - LIBS="$cares_cv_save_LIBS" - else - LIBS="$x_xlibs $cares_cv_save_LIBS" - fi - AC_LINK_IFELSE([ - AC_LANG_PROGRAM([[ -#ifdef HAVE_SYS_TYPES_H -#include -#endif -#ifdef HAVE_SYS_TIME_H -#include -#ifdef TIME_WITH_SYS_TIME -#include -#endif -#else -#ifdef HAVE_TIME_H -#include -#endif -#endif - ]],[[ - struct timespec ts; - (void)clock_gettime(CLOCK_MONOTONIC, &ts); - ]]) - ],[ - cares_cv_gclk_LIBS="$x_xlibs" - ]) - fi - done - # - LIBS="$cares_cv_save_LIBS" - # - case X-"$cares_cv_gclk_LIBS" in - X-unknown) - AC_MSG_RESULT([cannot find clock_gettime]) - AC_MSG_WARN([HAVE_CLOCK_GETTIME_MONOTONIC will not be defined]) - ac_cv_func_clock_gettime="no" - ;; - X-) - AC_MSG_RESULT([no additional lib required]) - ac_cv_func_clock_gettime="yes" - ;; - *) - if test -z "$cares_cv_save_LIBS"; then - LIBS="$cares_cv_gclk_LIBS" - else - LIBS="$cares_cv_gclk_LIBS $cares_cv_save_LIBS" - fi - AC_MSG_RESULT([$cares_cv_gclk_LIBS]) - ac_cv_func_clock_gettime="yes" - ;; - esac - # - dnl only do runtime verification when not cross-compiling - if test "x$cross_compiling" != "xyes" && - test "$ac_cv_func_clock_gettime" = "yes"; then - AC_MSG_CHECKING([if monotonic clock_gettime works]) - AC_RUN_IFELSE([ - AC_LANG_PROGRAM([[ -#ifdef HAVE_STDLIB_H -#include -#endif -#ifdef HAVE_SYS_TYPES_H -#include -#endif -#ifdef HAVE_SYS_TIME_H -#include -#ifdef TIME_WITH_SYS_TIME -#include -#endif -#else -#ifdef HAVE_TIME_H -#include -#endif -#endif - ]],[[ - struct timespec ts; - if (0 == clock_gettime(CLOCK_MONOTONIC, &ts)) - exit(0); - else - exit(1); - ]]) - ],[ - AC_MSG_RESULT([yes]) - ],[ - AC_MSG_RESULT([no]) - AC_MSG_WARN([HAVE_CLOCK_GETTIME_MONOTONIC will not be defined]) - ac_cv_func_clock_gettime="no" - LIBS="$cares_cv_save_LIBS" - ]) - fi - # - case "$ac_cv_func_clock_gettime" in - yes) - AC_DEFINE_UNQUOTED(HAVE_CLOCK_GETTIME_MONOTONIC, 1, - [Define to 1 if you have the clock_gettime function and monotonic timer.]) - ;; - esac - # - fi - # -]) - - -dnl CARES_CHECK_LIBS_CONNECT -dnl ------------------------------------------------- -dnl Verify if network connect function is already available -dnl using current libraries or if another one is required. - -AC_DEFUN([CARES_CHECK_LIBS_CONNECT], [ - AC_REQUIRE([CARES_INCLUDES_WINSOCK2])dnl - AC_MSG_CHECKING([for connect in libraries]) - tst_connect_save_LIBS="$LIBS" - tst_connect_need_LIBS="unknown" - for tst_lib in '' '-lsocket' ; do - if test "$tst_connect_need_LIBS" = "unknown"; then - LIBS="$tst_lib $tst_connect_save_LIBS" - AC_LINK_IFELSE([ - AC_LANG_PROGRAM([[ - $cares_includes_winsock2 - #ifndef HAVE_WINDOWS_H - int connect(int, void*, int); - #endif - ]],[[ - if(0 != connect(0, 0, 0)) - return 1; - ]]) - ],[ - tst_connect_need_LIBS="$tst_lib" - ]) - fi - done - LIBS="$tst_connect_save_LIBS" - # - case X-"$tst_connect_need_LIBS" in - X-unknown) - AC_MSG_RESULT([cannot find connect]) - AC_MSG_ERROR([cannot find connect function in libraries.]) - ;; - X-) - AC_MSG_RESULT([yes]) - ;; - *) - AC_MSG_RESULT([$tst_connect_need_LIBS]) - LIBS="$tst_connect_need_LIBS $tst_connect_save_LIBS" - ;; - esac -]) - - -dnl CARES_DEFINE_UNQUOTED (VARIABLE, [VALUE]) -dnl ------------------------------------------------- -dnl Like AC_DEFINE_UNQUOTED this macro will define a C preprocessor -dnl symbol that can be further used in custom template configuration -dnl files. This macro, unlike AC_DEFINE_UNQUOTED, does not use a third -dnl argument for the description. Symbol definitions done with this -dnl macro are intended to be exclusively used in handcrafted *.h.in -dnl template files. Contrary to what AC_DEFINE_UNQUOTED does, this one -dnl prevents autoheader generation and insertion of symbol template -dnl stub and definition into the first configuration header file. Do -dnl not use this macro as a replacement for AC_DEFINE_UNQUOTED, each -dnl one serves different functional needs. - -AC_DEFUN([CARES_DEFINE_UNQUOTED], [ -cat >>confdefs.h <<_EOF -[@%:@define] $1 ifelse($#, 2, [$2], 1) -_EOF -]) - -dnl CARES_CONFIGURE_ARES_SOCKLEN_T -dnl ------------------------------------------------- -dnl Find out suitable ares_socklen_t data type definition and size, making -dnl appropriate definitions for template file ares_build.h.in -dnl to properly configure and use the library. -dnl -dnl The need for the ares_socklen_t definition arises mainly to properly -dnl interface HP-UX systems which on one hand have a typedef'ed socklen_t -dnl data type which is 32 or 64-Bit wide depending on the data model being -dnl used, and that on the other hand is only actually used when interfacing -dnl the X/Open sockets provided in the xnet library. - -AC_DEFUN([CARES_CONFIGURE_ARES_SOCKLEN_T], [ - AC_REQUIRE([CARES_INCLUDES_WS2TCPIP])dnl - AC_REQUIRE([CARES_INCLUDES_SYS_SOCKET])dnl - AC_REQUIRE([CARES_PREPROCESS_CALLCONV])dnl - # - AC_MSG_CHECKING([for ares_socklen_t data type]) - cares_typeof_ares_socklen_t="unknown" - for arg1 in int SOCKET; do - for arg2 in 'struct sockaddr' void; do - for t in socklen_t int size_t 'unsigned int' long 'unsigned long' void; do - if test "$cares_typeof_ares_socklen_t" = "unknown"; then - AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM([[ - $cares_includes_ws2tcpip - $cares_includes_sys_socket - $cares_preprocess_callconv - extern int FUNCALLCONV getpeername($arg1, $arg2 *, $t *); - ]],[[ - $t *lenptr = 0; - if(0 != getpeername(0, 0, lenptr)) - return 1; - ]]) - ],[ - cares_typeof_ares_socklen_t="$t" - ]) - fi - done - done - done - for t in socklen_t int; do - if test "$cares_typeof_ares_socklen_t" = "void"; then - AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM([[ - $cares_includes_sys_socket - typedef $t ares_socklen_t; - ]],[[ - ares_socklen_t dummy; - ]]) - ],[ - cares_typeof_ares_socklen_t="$t" - ]) - fi - done - AC_MSG_RESULT([$cares_typeof_ares_socklen_t]) - if test "$cares_typeof_ares_socklen_t" = "void" || - test "$cares_typeof_ares_socklen_t" = "unknown"; then - AC_MSG_ERROR([cannot find data type for ares_socklen_t.]) - fi - # - AC_MSG_CHECKING([size of ares_socklen_t]) - cares_sizeof_ares_socklen_t="unknown" - cares_pull_headers_socklen_t="unknown" - if test "$ac_cv_header_ws2tcpip_h" = "yes"; then - tst_pull_header_checks='none ws2tcpip' - tst_size_checks='4' - else - tst_pull_header_checks='none systypes syssocket' - tst_size_checks='4 8 2' - fi - for tst_size in $tst_size_checks; do - for tst_pull_headers in $tst_pull_header_checks; do - if test "$cares_sizeof_ares_socklen_t" = "unknown"; then - case $tst_pull_headers in - ws2tcpip) - tmp_includes="$cares_includes_ws2tcpip" - ;; - systypes) - tmp_includes="$cares_includes_sys_types" - ;; - syssocket) - tmp_includes="$cares_includes_sys_socket" - ;; - *) - tmp_includes="" - ;; - esac - AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM([[ - $tmp_includes - typedef $cares_typeof_ares_socklen_t ares_socklen_t; - typedef char dummy_arr[sizeof(ares_socklen_t) == $tst_size ? 1 : -1]; - ]],[[ - ares_socklen_t dummy; - ]]) - ],[ - cares_sizeof_ares_socklen_t="$tst_size" - cares_pull_headers_socklen_t="$tst_pull_headers" - ]) - fi - done - done - AC_MSG_RESULT([$cares_sizeof_ares_socklen_t]) - if test "$cares_sizeof_ares_socklen_t" = "unknown"; then - AC_MSG_ERROR([cannot find out size of ares_socklen_t.]) - fi - # - case $cares_pull_headers_socklen_t in - ws2tcpip) - CARES_DEFINE_UNQUOTED([CARES_PULL_WS2TCPIP_H]) - ;; - systypes) - CARES_DEFINE_UNQUOTED([CARES_PULL_SYS_TYPES_H]) - ;; - syssocket) - CARES_DEFINE_UNQUOTED([CARES_PULL_SYS_TYPES_H]) - CARES_DEFINE_UNQUOTED([CARES_PULL_SYS_SOCKET_H]) - ;; - esac - CARES_DEFINE_UNQUOTED([CARES_TYPEOF_ARES_SOCKLEN_T], [$cares_typeof_ares_socklen_t]) - CARES_DEFINE_UNQUOTED([CARES_SIZEOF_ARES_SOCKLEN_T], [$cares_sizeof_ares_socklen_t]) -]) - - -dnl This macro determines if the specified struct exists in the specified file -dnl Syntax: -dnl CARES_CHECK_STRUCT(headers, struct name, if found, [if not found]) - -AC_DEFUN([CARES_CHECK_STRUCT], [ - AC_MSG_CHECKING([for struct $2]) - AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM([$1], - [struct $2 struct_instance;] - ) - ], ac_struct="yes", ac_struct="no" - ) - if test "$ac_struct" = "yes" ; then - AC_MSG_RESULT(yes) - $3 - else - AC_MSG_RESULT(no) - $4 - fi -]) - -dnl This macro determines if the specified constant exists in the specified file -dnl Syntax: -dnl CARES_CHECK_CONSTANT(headers, constant name, if found, [if not found]) - -AC_DEFUN([CARES_CHECK_CONSTANT], [ - AC_MSG_CHECKING([for $2]) - AC_EGREP_CPP(VARIABLEWASDEFINED, - [ - $1 - - #ifdef $2 - VARIABLEWASDEFINED - #else - NJET - #endif - ], ac_constant="yes", ac_constant="no" - ) - if test "$ac_constant" = "yes" ; then - AC_MSG_RESULT(yes) - $3 - else - AC_MSG_RESULT(no) - $4 - fi -]) - diff --git a/appveyor.yml b/appveyor.yml index 03b74c81..06cd21fe 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -25,85 +25,115 @@ environment: matrix: # MSVC 2022, 32-bit x86 (cmake) - COMPILER: MSVC - BUILDTOOL: CMAKE - TESTTYPE: CMAKE + CONFTOOL: CMAKE + SYSTEM: CONSOLE + SKIP_TESTS: no MSVC_SETUP_ARG: x86 MSVC_SETUP_PATH: C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars32.bat CMAKE_EXTRA_OPTIONS: -GNinja -DCARES_BUILD_TESTS=ON -DGTEST_ROOT=C:\projects\googletest -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDebugDLL + TOOLSDIR: ./build/bin + TESTDIR: ./build/bin BUILD_GOOGLETEST: yes # MSVC 2022, 64-bit x64 (cmake) - COMPILER: MSVC - BUILDTOOL: CMAKE - TESTTYPE: CMAKE + CONFTOOL: CMAKE + SYSTEM: CONSOLE + SKIP_TESTS: no MSVC_SETUP_ARG: x64 MSVC_SETUP_PATH: C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat + TOOLSDIR: ./build/bin + TESTDIR: ./build/bin CMAKE_EXTRA_OPTIONS: -GNinja -DCARES_BUILD_TESTS=ON -DGTEST_ROOT=C:\projects\googletest -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDebugDLL BUILD_GOOGLETEST: yes # MinGW gcc via MSYS2 (latest version) - COMPILER: MINGW - BUILDTOOL: MSYS2 - TESTTYPE: MSYS2 + CONFTOOL: CMAKE + SYSTEM: MSYS2 + SKIP_TESTS: no MSYSTEM: MINGW64 + TOOLSDIR: ./build/bin + TESTDIR: ./build/bin CMAKE_EXTRA_OPTIONS: -GNinja CHERE_INVOKING: YES + # MinGW gcc via MSYS2 using autotools + - COMPILER: MINGW + CONFTOOL: AUTOTOOLS + SKIP_TESTS: no + SYSTEM: MSYS2 + MSYSTEM: MINGW64 + TOOLSDIR: ./src/tools + TESTDIR: ./test + CHERE_INVOKING: YES + # MinGW clang UBSAN via MSYS2 - COMPILER: MINGW - BUILDTOOL: MSYS2 - TESTTYPE: MSYS2 + CONFTOOL: CMAKE + SKIP_TESTS: no + SYSTEM: MSYS2 MSYSTEM: CLANG64 + TOOLSDIR: ./build/bin + TESTDIR: ./build/bin CMAKE_EXTRA_OPTIONS: -GNinja -DCMAKE_CXX_FLAGS=-fsanitize=undefined -DCMAKE_C_FLAGS=-fsanitize=undefined -DCMAKE_SHARED_LINKER_FLAGS=-fsanitize=undefined -DCMAKE_EXE_LINKER_FLAGS=-fsanitize=undefined CHERE_INVOKING: YES # MinGW clang ASAN via MSYS2 -- doesn't work due to some issue with clang itself - #- COMPILER: MINGW - # BUILDTOOL: MSYS2 - # TESTTYPE: MSYS2 - # MSYSTEM: CLANG64 - # CMAKE_EXTRA_OPTIONS: -GNinja -DCMAKE_CXX_FLAGS=-fsanitize=address -DCMAKE_C_FLAGS=-fsanitize=address -DCMAKE_SHARED_LINKER_FLAGS=-fsanitize=address -DCMAKE_EXE_LINKER_FLAGS=-fsanitize=address - # CHERE_INVOKING: YES + # - COMPILER: MINGW + # CONFTOOL: CMAKE + # SKIP_TESTS: no + # SYSTEM: MSYS2 + # MSYSTEM: CLANG64 + # TESTDIR: ./cmakebld/bin + # CMAKE_EXTRA_OPTIONS: -GNinja -DCMAKE_CXX_FLAGS=-fsanitize=address -DCMAKE_C_FLAGS=-fsanitize=address -DCMAKE_SHARED_LINKER_FLAGS=-fsanitize=address -DCMAKE_EXE_LINKER_FLAGS=-fsanitize=address + # CHERE_INVOKING: YES # MSVC 2022, 64-bit x86 (nmake) - COMPILER: MSVC - BUILDTOOL: NMAKE - TESTTYPE: NMAKE + CONFTOOL: NMAKE + SYSTEM: CONSOLE + SKIP_TESTS: no MSVC_SETUP_ARG: x64 MSVC_SETUP_PATH: C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat BUILD_GOOGLETEST: yes # MSVC 2022, 32-bit x86 (nmake) - COMPILER: MSVC - BUILDTOOL: NMAKE - TESTTYPE: NMAKE + CONFTOOL: NMAKE + SYSTEM: CONSOLE + SKIP_TESTS: no MSVC_SETUP_ARG: x86 MSVC_SETUP_PATH: C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars32.bat BUILD_GOOGLETEST: yes # MinGW, 32-bit x86 (makefiles) - COMPILER: MINGW - BUILDTOOL: MAKE - TESTTYPE: MAKE + CONFTOOL: MAKE + SYSTEM: CONSOLE + SKIP_TESTS: no PATH: C:\mingw-w64\i686-8.1.0-posix-dwarf-rt_v6-rev0\mingw32\bin;%PATH% BUILD_GOOGLETEST: yes # MinGW, 32-bit x86 (cmake static only) - COMPILER: MINGW - BUILDTOOL: CMAKE - TESTTYPE: CMAKE + CONFTOOL: CMAKE + SYSTEM: CONSOLE + SKIP_TESTS: no + TOOLSDIR: ./build/bin + TESTDIR: ./build/bin PATH: C:\mingw-w64\i686-8.1.0-posix-dwarf-rt_v6-rev0\mingw32\bin;%PATH% CMAKE_EXTRA_OPTIONS: -DCARES_SHARED=OFF -GNinja -DCARES_BUILD_TESTS=ON -DGTEST_ROOT=C:\projects\googletest BUILD_GOOGLETEST: yes # MSVC 2022, UWP (cmake) - COMPILER: MSVC - BUILDTOOL: CMAKE - TESTTYPE: NONE + CONFTOOL: CMAKE + SYSTEM: CONSOLE + SKIP_TESTS: yes MSVC_SETUP_ARG: x64 store MSVC_SETUP_PATH: C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvarsall.bat CMAKE_EXTRA_OPTIONS: -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0 -A x64 - TESTDIRSUFFIX: Release\ install: - if "%COMPILER%" == "MINGW" rename "C:\Program Files\Git\usr\bin\sh.exe" "sh2.exe" @@ -112,9 +142,9 @@ before_build: # Setup build environment for the selected compiler (not all compilers need to do anything here). # -- Visual Studio -- - if "%COMPILER%" == "MSVC" call "%MSVC_SETUP_PATH%" %MSVC_SETUP_ARG% - - if "%BUILDTOOL%" == "MSYS2" C:\msys64\usr\bin\bash -lc "pacman --noconfirm -Syuu" - - if "%BUILDTOOL%" == "MSYS2" if "%MSYSTEM%" == "MINGW64" C:\msys64\usr\bin\bash -lc "pacman --noconfirm -Syu git mingw-w64-x86_64-gcc mingw-w64-x86_64-cmake mingw-w64-x86_64-ninja mingw-w64-x86_64-gtest" - - if "%BUILDTOOL%" == "MSYS2" if "%MSYSTEM%" == "CLANG64" C:\msys64\usr\bin\bash -lc "pacman --noconfirm -Syu git mingw-w64-clang-x86_64-clang mingw-w64-clang-x86_64-clang-analyzer mingw-w64-clang-x86_64-cmake mingw-w64-clang-x86_64-ninja mingw-w64-clang-x86_64-gtest" + - if "%SYSTEM%" == "MSYS2" C:\msys64\usr\bin\bash -lc "pacman --noconfirm -Syuu" + - if "%SYSTEM%" == "MSYS2" if "%MSYSTEM%" == "MINGW64" C:\msys64\usr\bin\bash -lc "pacman --noconfirm -Syu autoconf autoconf-archive automake libtool make git mingw-w64-x86_64-gcc mingw-w64-x86_64-cmake mingw-w64-x86_64-ninja mingw-w64-x86_64-gtest" + - if "%SYSTEM%" == "MSYS2" if "%MSYSTEM%" == "CLANG64" C:\msys64\usr\bin\bash -lc "pacman --noconfirm -Syu autoconf autoconf-archive automake libtool make git mingw-w64-clang-x86_64-clang mingw-w64-clang-x86_64-clang-analyzer mingw-w64-clang-x86_64-cmake mingw-w64-clang-x86_64-ninja mingw-w64-clang-x86_64-gtest" - if "%BUILD_GOOGLETEST%" == "yes" git clone --depth=1 https://github.com/google/googletest googletest - if "%BUILD_GOOGLETEST%" == "yes" cd googletest - if "%BUILD_GOOGLETEST%" == "yes" cmake -DCMAKE_INSTALL_PREFIX=C:\projects\googletest -DCMAKE_POLICY_DEFAULT_CMP0091:STRING=NEW -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDebugDLL -GNinja -Bbuild @@ -123,34 +153,37 @@ before_build: - if "%BUILD_GOOGLETEST%" == "yes" cd .. build_script: - - if "%BUILDTOOL%" == "MSYS2" C:\msys64\usr\bin\bash -lc "%ANALYZE_PREFIX% cmake -DCMAKE_BUILD_TYPE=%configuration% -DCMAKE_INSTALL_PREFIX=C:/projects/build-cares/test_install -DCARES_STATIC=ON -DCARES_STATIC_PIC=ON -DCARES_BUILD_TESTS=ON %CMAKE_EXTRA_OPTIONS% ." - - if "%BUILDTOOL%" == "MSYS2" C:\msys64\usr\bin\bash -lc "%ANALYZE_PREFIX% ninja -v install" - - if "%BUILDTOOL%" == "NMAKE" copy .\include\ares_build.h.dist .\include\ares_build.h - - if "%BUILDTOOL%" == "NMAKE" nmake /NOLOGO /f .\Makefile.msvc - - if "%BUILDTOOL%" == "CMAKE" cmake -DCMAKE_BUILD_TYPE=%configuration% -DCMAKE_INSTALL_PREFIX=C:\projects\build-cares\test_install -DCARES_STATIC=ON -DCARES_STATIC_PIC=ON %CMAKE_EXTRA_OPTIONS% -Bbuild - - if "%BUILDTOOL%" == "CMAKE" cmake --build build --config Debug - - if "%BUILDTOOL%" == "CMAKE" cmake --install build --config Debug - - if "%BUILDTOOL%" == "MAKE" copy .\include\ares_build.h.dist .\include\ares_build.h - - if "%BUILDTOOL%" == "MAKE" mingw32-make.exe -f Makefile.m32 demos + - if "%SYSTEM%" == "MSYS2" if "%CONFTOOL%" == "CMAKE" C:\msys64\usr\bin\bash -lc "%ANALYZE_PREFIX% cmake -DCMAKE_BUILD_TYPE=%configuration% -DCMAKE_INSTALL_PREFIX=C:/projects/build-cares/test_install -DCARES_STATIC=ON -DCARES_STATIC_PIC=ON -DCARES_BUILD_TESTS=ON %CMAKE_EXTRA_OPTIONS% -Bbuild ." + - if "%SYSTEM%" == "MSYS2" if "%CONFTOOL%" == "CMAKE" C:\msys64\usr\bin\bash -lc "%ANALYZE_PREFIX% cmake --build build" + - if "%SYSTEM%" == "MSYS2" if "%CONFTOOL%" == "AUTOTOOLS" C:\msys64\usr\bin\bash -lc "./buildconf" + - if "%SYSTEM%" == "MSYS2" if "%CONFTOOL%" == "AUTOTOOLS" C:\msys64\usr\bin\bash -lc "%ANALYZE_PREFIX% ./configure --enable-static --disable-shared --enable-tests" + - if "%SYSTEM%" == "MSYS2" if "%CONFTOOL%" == "AUTOTOOLS" C:\msys64\usr\bin\bash -lc "%ANALYZE_PREFIX% make" + - if "%SYSTEM%" == "CONSOLE" if "%CONFTOOL%" == "NMAKE" copy .\include\ares_build.h.dist .\include\ares_build.h + - if "%SYSTEM%" == "CONSOLE" if "%CONFTOOL%" == "NMAKE" nmake /NOLOGO /f .\Makefile.msvc + - if "%SYSTEM%" == "CONSOLE" if "%CONFTOOL%" == "CMAKE" cmake -DCMAKE_BUILD_TYPE=%configuration% -DCMAKE_INSTALL_PREFIX=C:\projects\build-cares\test_install -DCARES_STATIC=ON -DCARES_STATIC_PIC=ON %CMAKE_EXTRA_OPTIONS% -Bbuild + - if "%SYSTEM%" == "CONSOLE" if "%CONFTOOL%" == "CMAKE" cmake --build build --config Debug + - if "%SYSTEM%" == "CONSOLE" if "%CONFTOOL%" == "CMAKE" cmake --install build --config Debug + - if "%SYSTEM%" == "CONSOLE" if "%CONFTOOL%" == "MAKE" copy .\include\ares_build.h.dist .\include\ares_build.h + - if "%SYSTEM%" == "CONSOLE" if "%CONFTOOL%" == "MAKE" mingw32-make.exe -f Makefile.m32 demos test_script: # We can't use powershell for tests due to treating stderr as an error - - if "%TESTTYPE%" == "MSYS2" C:\msys64\usr\bin\bash -lc "./bin/adig.exe www.google.com" - - if "%TESTTYPE%" == "MSYS2" C:\msys64\usr\bin\bash -lc "./bin/ahost.exe www.google.com" - - if "%TESTTYPE%" == "MSYS2" C:\msys64\usr\bin\bash -lc "./bin/arestest.exe -4 -v --gtest_filter=-*LiveSearchTXT*:*LiveSearchANY*:*LiveGetLocalhostByAddr*" - - if "%TESTTYPE%" == "NMAKE" cd test - - if "%TESTTYPE%" == "NMAKE" nmake GTEST_ROOT=C:\projects\googletest /NOLOGO /f .\Makefile.msvc vtest - - if "%TESTTYPE%" == "NMAKE" nmake GTEST_ROOT=C:\projects\googletest /NOLOGO /f .\Makefile.msvc aresfuzz aresfuzzname dnsdump - - if "%TESTTYPE%" == "NMAKE" .\msvc\arestest\lib-debug\dnsdump.exe fuzzinput\answer_a fuzzinput\answer_aaaa - - if "%TESTTYPE%" == "MAKE" cd test - - if "%TESTTYPE%" == "MAKE" mingw32-make.exe GTEST_ROOT=C:\projects\googletest -f Makefile.m32 vtest - - if "%TESTTYPE%" == "MAKE" mingw32-make.exe GTEST_ROOT=C:\projects\googletest -f Makefile.m32 aresfuzz.exe aresfuzzname.exe dnsdump.exe - - if "%TESTTYPE%" == "MAKE" .\dnsdump.exe fuzzinput\answer_a fuzzinput\answer_aaaa - - if "%TESTTYPE%" == "CMAKE" cd build\bin\%TESTDIRSUFFIX% - - if "%TESTTYPE%" == "CMAKE" .\adig.exe www.google.com - - if "%TESTTYPE%" == "CMAKE" .\ahost.exe www.google.com - - if "%TESTTYPE%" == "CMAKE" .\arestest.exe -4 -v --gtest_filter=-*LiveSearchTXT*:*LiveSearchANY*:*LiveGetLocalhostByAddr* - - if "%TESTTYPE%" == "CMAKE" .\dnsdump.exe "%APPVEYOR_BUILD_FOLDER%\test\fuzzinput\answer_a" "%APPVEYOR_BUILD_FOLDER%\test\fuzzinput\answer_aaaa" + - if "%SYSTEM%" == "MSYS2" if not "%SKIP_TESTS%" == "yes" C:\msys64\usr\bin\bash -lc "%TOOLSDIR%/adig.exe www.google.com" + - if "%SYSTEM%" == "MSYS2" if not "%SKIP_TESTS%" == "yes" C:\msys64\usr\bin\bash -lc "%TOOLSDIR%/ahost.exe www.google.com" + - if "%SYSTEM%" == "MSYS2" if not "%SKIP_TESTS%" == "yes" C:\msys64\usr\bin\bash -lc "%TESTDIR%/arestest.exe -4 -v --gtest_filter=-*LiveSearchTXT*:*LiveSearchANY*:*LiveGetLocalhostByAddr*" + - if "%SYSTEM%" == "CONSOLE" if "%CONFTOOL%" == "NMAKE" if not "%SKIP_TESTS%" == "yes" cd test + - if "%SYSTEM%" == "CONSOLE" if "%CONFTOOL%" == "NMAKE" if not "%SKIP_TESTS%" == "yes" nmake GTEST_ROOT=C:\projects\googletest /NOLOGO /f .\Makefile.msvc vtest + - if "%SYSTEM%" == "CONSOLE" if "%CONFTOOL%" == "NMAKE" if not "%SKIP_TESTS%" == "yes" nmake GTEST_ROOT=C:\projects\googletest /NOLOGO /f .\Makefile.msvc aresfuzz aresfuzzname dnsdump + - if "%SYSTEM%" == "CONSOLE" if "%CONFTOOL%" == "NMAKE" if not "%SKIP_TESTS%" == "yes" .\msvc\arestest\lib-debug\dnsdump.exe fuzzinput\answer_a fuzzinput\answer_aaaa + - if "%SYSTEM%" == "CONSOLE" if "%CONFTOOL%" == "MAKE" if not "%SKIP_TESTS%" == "yes" cd test + - if "%SYSTEM%" == "CONSOLE" if "%CONFTOOL%" == "MAKE" if not "%SKIP_TESTS%" == "yes" mingw32-make.exe GTEST_ROOT=C:\projects\googletest -f Makefile.m32 vtest + - if "%SYSTEM%" == "CONSOLE" if "%CONFTOOL%" == "MAKE" if not "%SKIP_TESTS%" == "yes" mingw32-make.exe GTEST_ROOT=C:\projects\googletest -f Makefile.m32 aresfuzz.exe aresfuzzname.exe dnsdump.exe + - if "%SYSTEM%" == "CONSOLE" if "%CONFTOOL%" == "MAKE" if not "%SKIP_TESTS%" == "yes" .\dnsdump.exe fuzzinput\answer_a fuzzinput\answer_aaaa + - if "%SYSTEM%" == "CONSOLE" if "%CONFTOOL%" == "CMAKE" if not "%SKIP_TESTS%" == "yes" cd %TESTDIR% + - if "%SYSTEM%" == "CONSOLE" if "%CONFTOOL%" == "CMAKE" if not "%SKIP_TESTS%" == "yes" .\adig.exe www.google.com + - if "%SYSTEM%" == "CONSOLE" if "%CONFTOOL%" == "CMAKE" if not "%SKIP_TESTS%" == "yes" .\ahost.exe www.google.com + - if "%SYSTEM%" == "CONSOLE" if "%CONFTOOL%" == "CMAKE" if not "%SKIP_TESTS%" == "yes" .\arestest.exe -4 -v --gtest_filter=-*LiveSearchTXT*:*LiveSearchANY*:*LiveGetLocalhostByAddr* + - if "%SYSTEM%" == "CONSOLE" if "%CONFTOOL%" == "CMAKE" if not "%SKIP_TESTS%" == "yes" .\dnsdump.exe "%APPVEYOR_BUILD_FOLDER%\test\fuzzinput\answer_a" "%APPVEYOR_BUILD_FOLDER%\test\fuzzinput\answer_aaaa" #on_finish: # - cd C:\projects\build-cares\test diff --git a/ci/build.sh b/ci/build.sh index 3bc44c95..ffd0881d 100755 --- a/ci/build.sh +++ b/ci/build.sh @@ -24,7 +24,9 @@ if [ "$BUILD_TYPE" = "autotools" -o "$BUILD_TYPE" = "coverage" ]; then export CXXFLAGS="${CXXFLAGS} -isysroot ${SYSROOT}" export LDFLAGS="${LDFLAGS} -isysroot ${SYSROOT}" fi - $SCAN_WRAP ../configure --disable-symbol-hiding --enable-expose-statics --enable-maintainer-mode --enable-debug $CONFIG_OPTS + export CFLAGS="${CFLAGS} -O0 -g" + export CXXFLAGS="${CXXFLAGS} -O0 -g" + $SCAN_WRAP ../configure --disable-symbol-hiding --enable-maintainer-mode $CONFIG_OPTS $SCAN_WRAP make else # Use cmake for everything else diff --git a/configure.ac b/configure.ac index c065f708..d1be4ae7 100644 --- a/configure.ac +++ b/configure.ac @@ -1,23 +1,5 @@ -############################################################# -# -# Copyright (C) the Massachusetts Institute of Technology. -# Copyright (C) Daniel Stenberg -# -# Permission to use, copy, modify, and distribute this -# software and its documentation for any purpose and without -# fee is hereby granted, provided that the above copyright -# notice appear in all copies and that both that copyright -# notice and this permission notice appear in supporting -# documentation, and that the name of M.I.T. not be used in -# advertising or publicity pertaining to distribution of the -# software without specific, written prior permission. -# M.I.T. makes no representations about the suitability of -# this software for any purpose. It is provided "as is" -# without express or implied warranty. -# -# SPDX-License-Identifier: MIT -# -############################################################# +dnl Copyright (C) The c-ares project and its contributors +dnl SPDX-License-Identifier: MIT AC_PREREQ([2.69]) AC_INIT([c-ares], [1.24.0], @@ -55,157 +37,203 @@ AC_SUBST([CARES_VERSION_INFO]) AC_CONFIG_SRCDIR([src/lib/ares_ipv6.h]) AC_CONFIG_HEADERS([src/lib/ares_config.h include/ares_build.h]) +AC_CONFIG_AUX_DIR(config) AC_CONFIG_MACRO_DIR([m4]) - -CARES_CHECK_OPTION_DEBUG -CARES_CHECK_OPTION_OPTIMIZE -CARES_CHECK_OPTION_WARNINGS -XC_CHECK_PATH_SEPARATOR -XC_CHECK_PROG_CC -CARES_CHECK_OPTION_WERROR -CARES_CHECK_OPTION_SYMBOL_HIDING -CARES_CHECK_OPTION_EXPOSE_STATICS - -dnl make sure we use system extensions like _GNU_SOURCE or _XOPEN_SOURCE AC_USE_SYSTEM_EXTENSIONS +AX_CXX_COMPILE_STDCXX_14([noext],[optional]) +AM_INIT_AUTOMAKE([foreign subdir-objects 1.9.6]) +AC_DISABLE_STATIC +AC_ENABLE_SHARED +LT_INIT([win32-dll,shared,disable-static,pic,disable-fast-install,aix-soname=svr4]) +AC_LANG([C]) +AC_PROG_CC +AM_PROG_CC_C_O +AC_PROG_EGREP +AC_PROG_INSTALL +AC_CANONICAL_HOST +AX_COMPILER_VENDOR -AM_MAINTAINER_MODE -m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) +AC_ARG_ENABLE(warnings, + AS_HELP_STRING([--disable-warnings],[Disable strict compiler warnings]), + [ enable_warnings=${enableval} ], + [ enable_warnings=yes ]) -AX_REQUIRE_DEFINED([AX_CXX_COMPILE_STDCXX_14]) +AC_ARG_ENABLE(symbol-hiding, + AS_HELP_STRING([--disable-symbol-hiding], [Disable symbol hiding. Enabled by default if the compiler supports it.]), + [ + symbol_hiding="$enableval" + if test "$symbol_hiding" = "no" -a "x$enable_shared" = "xyes" ; then + case $host_os in + cygwin* | mingw* | pw32* | cegcc*) + AC_MSG_ERROR([Cannot disable symbol hiding on windows]) + ;; + esac + fi + ], + [ + if test "x$enable_shared" = "xyes" ; then + symbol_hiding="maybe" + else + symbol_hiding="no" + fi + ] +) +AC_ARG_ENABLE(tests, + AS_HELP_STRING([--disable-tests], [disable building of test suite. Built by default if GoogleTest is found.]), + [ build_tests="$enableval" ], + [ if test "x$HAVE_CXX14" = "x1" && test "x$cross_compiling" = "xno" ; then + build_tests="maybe" + else + build_tests="no" + fi + ] +) -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 dependent, so check it as a tool. -if test -z "$AR"; then - dnl allow it to be overridden - 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_ARG_ENABLE(cares-threads, + AS_HELP_STRING([--disable-cares-threads], [Disable building of thread safety support]), + [ CARES_THREADS=${enableval} ], + [ CARES_THREADS=yes ]) + +AC_ARG_WITH(random, + AS_HELP_STRING([--with-random=FILE], + [read randomness from FILE (default=/dev/urandom)]), + [ CARES_RANDOM_FILE="$withval" ], + [ CARES_RANDOM_FILE="/dev/urandom" ] +) +if test -n "$CARES_RANDOM_FILE" && test X"$CARES_RANDOM_FILE" != Xno ; then + AC_SUBST(CARES_RANDOM_FILE) + AC_DEFINE_UNQUOTED(CARES_RANDOM_FILE, "$CARES_RANDOM_FILE", [a suitable file/device to read random data from]) fi -AC_SUBST([AR]) -AX_CODE_COVERAGE +AM_MAINTAINER_MODE +m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) -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]) +dnl CARES_DEFINE_UNQUOTED (VARIABLE, [VALUE]) +dnl ------------------------------------------------- +dnl Like AC_DEFINE_UNQUOTED this macro will define a C preprocessor +dnl symbol that can be further used in custom template configuration +dnl files. This macro, unlike AC_DEFINE_UNQUOTED, does not use a third +dnl argument for the description. Symbol definitions done with this +dnl macro are intended to be exclusively used in handcrafted *.h.in +dnl template files. Contrary to what AC_DEFINE_UNQUOTED does, this one +dnl prevents autoheader generation and insertion of symbol template +dnl stub and definition into the first configuration header file. Do +dnl not use this macro as a replacement for AC_DEFINE_UNQUOTED, each +dnl one serves different functional needs. + +AC_DEFUN([CARES_DEFINE_UNQUOTED], [ +cat >>confdefs.h <<_EOF +[@%:@define] $1 ifelse($#, 2, [$2], 1) +_EOF +]) -AX_CXX_COMPILE_STDCXX_14([noext],[optional]) +AX_CODE_COVERAGE +AX_CHECK_USER_NAMESPACE +AX_CHECK_UTS_NAMESPACE +AC_SYS_LARGEFILE -XC_AUTOMAKE +case $host_os in + solaris*) + AC_DEFINE(ETC_INET, 1, [if a /etc/inet dir is being used]) + ;; +esac -dnl This defines _ALL_SOURCE for AIX -CARES_CHECK_AIX_ALL_SOURCE +dnl solaris needed flag +case $host_os in + solaris2*) + if test "x$GCC" = 'xyes'; then + AX_APPEND_LINK_FLAGS([-mimpure-text]) + fi + ;; + *) + ;; +esac -dnl Our configure and build reentrant settings -CARES_CONFIGURE_THREAD_SAFE -CARES_CONFIGURE_REENTRANT +dnl -no-undefined libtool (not linker) flag for windows +cares_use_no_undefined=no +case $host_os in + cygwin* | mingw* | pw32* | cegcc* | os2* | aix*) + cares_use_no_undefined=yes + ;; + *) + ;; +esac +AM_CONDITIONAL([CARES_USE_NO_UNDEFINED], [test "$cares_use_no_undefined" = 'yes']) -dnl check for how to do large files -AC_SYS_LARGEFILE +AC_MSG_CHECKING([whether this is native windows]) +ac_cv_native_windows=no +ac_cv_windows=no case $host_os in - solaris*) - AC_DEFINE(ETC_INET, 1, [if a /etc/inet dir is being used]) + mingw*) + ac_cv_native_windows=yes + ac_cv_windows=yes + ;; + cygwin*) + ac_cv_windows=yes ;; esac +if test "$ax_cv_c_compiler_vendor" = "microsoft" ; then + ac_cv_native_windows=yes + ac_cv_windows=yes +fi +if test "$ac_cv_native_windows" = "yes" ; then + CPPFLAGS="$CPPFLAGS -D_WIN32_WINNT=0x0602 -DWIN32_LEAN_AND_MEAN" +fi +AC_MSG_RESULT($ac_cv_native_windows) + -XC_LIBTOOL - - -# -# Automake conditionals based on libtool related checks -# - -AM_CONDITIONAL([CARES_LT_SHLIB_USE_VERSION_INFO], - [test "x$xc_lt_shlib_use_version_info" = 'xyes']) -AM_CONDITIONAL([CARES_LT_SHLIB_USE_NO_UNDEFINED], - [test "x$xc_lt_shlib_use_no_undefined" = 'xyes']) -AM_CONDITIONAL([CARES_LT_SHLIB_USE_MIMPURE_TEXT], - [test "x$xc_lt_shlib_use_mimpure_text" = 'xyes']) - -# -# Due to libtool and automake machinery limitations of not allowing -# specifying separate CPPFLAGS or CFLAGS when compiling objects for -# inclusion of these in shared or static libraries, we are forced to -# build using separate configure runs for shared and static libraries -# on systems where different CPPFLAGS or CFLAGS are mandatory in order -# to compile objects for each kind of library. Notice that relying on -# the '-DPIC' CFLAG that libtool provides is not valid given that the -# user might for example choose to build static libraries with PIC. -# - -# -# Make our Makefile.am files use the staticlib CPPFLAG only when strictly -# targeting a static library and not building its shared counterpart. -# - -AM_CONDITIONAL([USE_CPPFLAG_CARES_STATICLIB], - [test "x$xc_lt_build_static_only" = 'xyes']) - -# -# Make staticlib CPPFLAG variable and its definition visible in output -# files unconditionally, providing an empty definition unless strictly -# targeting a static library and not building its shared counterpart. -# - -CPPFLAG_CARES_STATICLIB= -if test "x$xc_lt_build_static_only" = 'xyes'; then - CPPFLAG_CARES_STATICLIB='-DCARES_STATICLIB' +dnl Only windows requires CARES_STATICLIB definition +if test "x$enable_shared" = "xno" -a "x$enable_static" = "xyes" ; then + AC_MSG_CHECKING([whether we need CARES_STATICLIB definition]) + if test "$ac_cv_native_windows" = "yes" ; then + AX_APPEND_FLAG([-DCARES_STATICLIB], [CPPFLAGS]) + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + fi fi -AC_SUBST([CPPFLAG_CARES_STATICLIB]) -dnl ********************************************************************** -dnl platform/compiler/architecture specific checks/flags -dnl ********************************************************************** +dnl Test for symbol hiding +CARES_SYMBOL_HIDING_CFLAG="" +if test "$symbol_hiding" != "no" ; then + compiler_supports_symbol_hiding="no" + if test "$ac_cv_windows" = "yes" ; then + compiler_supports_symbol_hiding="yes" + else + case "$ax_cv_c_compiler_vendor" in + clang|gnu|intel) + AX_APPEND_COMPILE_FLAGS([-fvisibility=hidden], [CARES_SYMBOL_HIDING_CFLAG]) + if test "x$CARES_SYMBOL_HIDING_CFLAG" != "x" ; then + compiler_supports_symbol_hiding="yes" + fi + ;; + sun) + AX_APPEND_COMPILE_FLAGS([-xldscope=hidden], [CARES_SYMBOL_HIDING_CFLAG]) + if test "x$CARES_SYMBOL_HIDING_CFLAG" != "x" ; then + compiler_supports_symbol_hiding="yes" + fi + ;; + esac + fi + if test "$compiler_supports_symbol_hiding" = "no" ; then + if test "$symbol_hiding" = "yes" ; then + AC_MSG_ERROR([Compiler does not support symbol hiding]) + else + symbol_hiding="no" + fi + else + AC_DEFINE([CARES_SYMBOL_HIDING], [ 1 ], [Set to 1 if non-pubilc shared library symbols are hidden]) + symbol_hiding="yes" + fi +fi +AM_CONDITIONAL(CARES_SYMBOL_HIDING, test "x$symbol_hiding" = "xyes") +AC_SUBST(CARES_SYMBOL_HIDING_CFLAG) -CARES_CHECK_COMPILER -CARES_SET_COMPILER_BASIC_OPTS -CARES_SET_COMPILER_DEBUG_OPTS -CARES_SET_COMPILER_OPTIMIZE_OPTS -CARES_SET_COMPILER_WARNING_OPTS -if test "$want_warnings" = "yes"; then +if test "$enable_warnings" = "yes"; then AX_APPEND_COMPILE_FLAGS([-Wall \ -Wextra \ -Wcast-align \ @@ -244,198 +272,52 @@ if test "$want_warnings" = "yes"; then ], [CFLAGS], [-Werror]) fi -if test "$compiler_id" = "INTEL_UNIX_C"; then - # - if test "$compiler_num" -ge "1000"; then - dnl icc 10.X or later - CFLAGS="$CFLAGS -shared-intel" - elif test "$compiler_num" -ge "900"; then - dnl icc 9.X specific - CFLAGS="$CFLAGS -i-dynamic" - fi - # +if test "$ax_cv_c_compiler_vendor" = "intel"; then + CFLAGS="$CFLAGS -shared-intel" fi -CARES_CHECK_COMPILER_HALT_ON_ERROR -CARES_CHECK_COMPILER_ARRAY_SIZE_NEGATIVE -CARES_CHECK_COMPILER_PROTOTYPE_MISMATCH -CARES_CHECK_COMPILER_SYMBOL_HIDING - -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 - CPPFLAGS="$CPPFLAGS -D_WIN32_WINNT=0x0602" - ;; - *) - ac_cv_header_winsock_h="no" - ac_cv_header_winsock2_h="no" - ac_cv_header_ws2tcpip_h="no" - ;; -esac +if test "$ac_cv_native_windows" = "yes" ; then + dnl we use [ - ] in the 4th argument to tell AC_CHECK_HEADERS to simply + dnl check for existence of the headers, not usability. This is because + dnl on windows, header order matters, and you need to include headers *after* + dnl other headers, AC_CHECK_HEADERS only allows you to specify headers that + dnl must be included *before* the header being checked. + + AC_CHECK_HEADERS( + windows.h \ + winsock2.h \ + ws2tcpip.h \ + iphlpapi.h \ + netioapi.h \ + ws2ipdef.h, + [], [], [-]) + + dnl Windows builds require linking to iphlpapi + if test "$ac_cv_header_winsock2_h" = "yes"; then + LIBS="$LIBS -lws2_32 -liphlpapi" + fi +fi dnl ********************************************************************** dnl Checks for libraries. dnl ********************************************************************** -CARES_CHECK_LIB_XNET - -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 see if libnsl or libsocket are required +AC_SEARCH_LIBS([getservbyport], [nsl socket resolv]) -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 -#ifdef HAVE_WINSOCK2_H -#include -#else -#ifdef HAVE_WINSOCK_H -#include -#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 - ]) +AC_MSG_CHECKING([if libxnet is required]) +need_xnet=no +case $host_os in + hpux*) + XNET_LIBS="" + AX_APPEND_LINK_FLAGS([-lxnet], [XNET_LIBS]) + if test "x$XNET_LIBS" != "x" ; then + LIBS="$LIBS $XNET_LIBS" + need_xnet=yes 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 here instead */ -#include - ]],[[ - 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 -#include - ]],[[ - 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 + ;; +esac +AC_MSG_RESULT($need_xnet) dnl resolv lib for Apple (MacOS and iOS) AS_IF([test "x$host_vendor" = "xapple"], [ @@ -455,23 +337,6 @@ AS_IF([test "x$host_vendor" = "xibm" -a "x$host_os" = "xopenedition" ], [ ]) ]) -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 Windows builds require linking to iphlpapi -if test "$ac_cv_header_winsock2_h" = "yes"; then - LIBS="$LIBS -liphlpapi" -fi - -CARES_CHECK_LIBS_CONNECT dnl iOS 10? AS_IF([test "x$host_vendor" = "xapple"], [ @@ -520,53 +385,30 @@ return 0; ]) ]) -dnl ********************************************************************** -dnl In case that function clock_gettime with monotonic timer is available, -dnl check for additional required libraries. -dnl ********************************************************************** -dnl Xcode 8 bug: iOS when targeting less than 10, or macOS when targeting less than 10.12 will -dnl say clock_gettime exists, it is a weak symbol that only exists in iOS 10 or macOS 10.12 and will -dnl cause a crash at runtime when running on older versions. Skip finding CLOCK_MONOTONIC on older -dnl Apple OS's. -if test "x$host_vendor" != "xapple" || test "x$ac_cv_ios_10" = "xyes" || test "x$ac_cv_macos_10_12" = "xyes"; then - CURL_CHECK_LIBS_CLOCK_GETTIME_MONOTONIC -fi - AC_MSG_CHECKING([whether to use libgcc]) AC_ARG_ENABLE(libgcc, AS_HELP_STRING([--enable-libgcc],[use libgcc when linking]), [ case "$enableval" in yes) - LIBS="$LIBS -lgcc" - AC_MSG_RESULT(yes) - ;; - *) AC_MSG_RESULT(no) - ;; + LIBS="$LIBS -lgcc" + AC_MSG_RESULT(yes) + ;; + *) + AC_MSG_RESULT(no) + ;; esac ], AC_MSG_RESULT(no) ) - -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 - - -dnl ********************************************************************** -dnl Back to "normal" configuring -dnl ********************************************************************** - -AC_PROG_EGREP - -CURL_CHECK_HEADER_MALLOC -CURL_CHECK_HEADER_MEMORY - dnl check for a few basic system headers we need AC_CHECK_HEADERS( + malloc.h \ + memory.h \ sys/types.h \ sys/time.h \ sys/select.h \ sys/socket.h \ + sys/filio.h \ sys/ioctl.h \ sys/param.h \ sys/uio.h \ @@ -579,6 +421,7 @@ AC_CHECK_HEADERS( netinet/tcp.h \ net/if.h \ ifaddrs.h \ + fcntl.h \ errno.h \ socket.h \ strings.h \ @@ -617,344 +460,321 @@ dnl *Sigh* these are needed in order for net/if.h to get properly detected. ] ) -dnl Test and set CARES_HAVE_ARPA_NAMESER_H / CARES_HAVE_ARPA_NAMESER_COMPAT_H -AC_CHECK_DECL([HAVE_ARPA_NAMESER_H], -[ -CARES_DEFINE_UNQUOTED([CARES_HAVE_ARPA_NAMESER_H]) -], -[] -) -AC_CHECK_DECL([HAVE_ARPA_NAMESER_COMPAT_H], -[ -CARES_DEFINE_UNQUOTED([CARES_HAVE_ARPA_NAMESER_COMPAT_H]) -], -[] -) - -dnl Checks for typedefs, structures, and compiler characteristics. -AC_C_CONST -AC_TYPE_SIZE_T - -CURL_CHECK_STRUCT_TIMEVAL -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([ - AC_LANG_PROGRAM([[ - ]],[[ - long long val = 1000LL; - ]]) - ],[ - AC_MSG_RESULT([yes]) - AC_DEFINE(HAVE_LL, 1, [if your compiler supports LL]) - ],[ - AC_MSG_RESULT([no]) - ]) -fi - - -# check for ssize_t -AC_CHECK_TYPE(ssize_t, [ CARES_TYPEOF_ARES_SSIZE_T=ssize_t ], - [ CARES_TYPEOF_ARES_SSIZE_T=int ]) - -AC_DEFINE_UNQUOTED([CARES_TYPEOF_ARES_SSIZE_T], ${CARES_TYPEOF_ARES_SSIZE_T}, - [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 -#endif -#ifdef HAVE_STDBOOL_H -#include -#endif -]) - -CARES_CONFIGURE_ARES_SOCKLEN_T - -TYPE_IN_ADDR_T - -TYPE_SOCKADDR_STORAGE - -TYPE_SIG_ATOMIC_T - -CURL_CHECK_FUNC_RECV -CURL_CHECK_FUNC_RECVFROM -CURL_CHECK_FUNC_SEND -CURL_CHECK_MSG_NOSIGNAL - -CARES_CHECK_FUNC_CLOSESOCKET -CARES_CHECK_FUNC_CLOSESOCKET_CAMEL -CARES_CHECK_FUNC_CONNECT -CARES_CHECK_FUNC_FCNTL -CARES_CHECK_FUNC_FREEADDRINFO -CARES_CHECK_FUNC_GETADDRINFO -CARES_CHECK_FUNC_GETENV -CARES_CHECK_FUNC_GETHOSTBYADDR -CARES_CHECK_FUNC_GETHOSTBYNAME -CARES_CHECK_FUNC_GETHOSTNAME -CARES_CHECK_FUNC_GETRANDOM -CARES_CHECK_FUNC_GETSERVBYPORT_R -CARES_CHECK_FUNC_INET_NET_PTON -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_SOCKET -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 -CARES_CHECK_FUNC_ARC4RANDOM_BUF -CARES_CHECK_FUNC_STAT -CARES_CHECK_FUNC_GETIFADDRS - -dnl check for AF_INET6 -CARES_CHECK_CONSTANT( - [ -#undef inline -#ifdef HAVE_WINDOWS_H -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN +cares_all_includes=" +#include +#include +#ifdef HAVE_SYS_UIO_H +# include #endif -#include -#ifdef HAVE_WINSOCK2_H -#include +#ifdef HAVE_NETINET_IN_H +# include #endif -#else -#ifdef HAVE_SYS_TYPES_H -#include +#ifdef HAVE_TCP_H +# include #endif -#ifdef HAVE_SYS_SOCKET_H -#include +#ifdef HAVE_SYS_FILIO_H +# include #endif +#ifdef HAVE_SYS_IOCTL_H +# include #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 +#ifdef HAVE_UNISTD_H +# include #endif -#include -#ifdef HAVE_WINSOCK2_H -#include +#ifdef HAVE_STRINGS_H +# include #endif -#else #ifdef HAVE_SYS_TYPES_H -#include +# include #endif #ifdef HAVE_SYS_SOCKET_H -#include +# include #endif +#ifdef HAVE_SYS_PARAM_H +# include #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 +#ifdef HAVE_FCNTL_H +# include #endif -#include -#ifdef HAVE_WINSOCK2_H -#include -#ifdef HAVE_WS2TCPIP_H -#include +#ifdef HAVE_NET_IF_H +# include #endif -#endif -#else -#ifdef HAVE_SYS_TYPES_H -#include +#ifdef HAVE_IFADDRS_H +# include #endif #ifdef HAVE_NETINET_IN_H -#include -#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 +# include #endif -#include -#ifdef HAVE_WINSOCK2_H -#include -#ifdef HAVE_WS2TCPIP_H -#include +#ifdef HAVE_NETINET_TCP_H +# include #endif +#ifdef HAVE_NETDB_H +# include #endif -#else -#ifdef HAVE_SYS_TYPES_H -#include +#ifdef HAVE_ARPA_INET_H +# include #endif -#ifdef HAVE_NETINET_IN_H -#include +#ifdef HAVE_RESOLV_H +# include #endif +#ifdef HAVE_IPHLPAPI_H +# include #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 +#ifdef HAVE_NETIOAPI_H +# include #endif -#include #ifdef HAVE_WINSOCK2_H -#include -#ifdef HAVE_WS2TCPIP_H -#include -#endif +# include #endif -#else -#ifdef HAVE_SYS_TYPES_H -#include +#ifdef HAVE_WS2IPDEF_H +# include #endif -#ifdef HAVE_NETINET_IN_H -#include +#ifdef HAVE_WS2TCPIP_H +# include #endif +#ifdef HAVE_WINDOWS_H +# include #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.]),, +AC_CHECK_DECL([HAVE_ARPA_NAMESER_H],[CARES_DEFINE_UNQUOTED([CARES_HAVE_ARPA_NAMESER_H])], []) +AC_CHECK_DECL([HAVE_ARPA_NAMESER_COMPAT_H],[CARES_DEFINE_UNQUOTED([CARES_HAVE_ARPA_NAMESER_COMPAT_H])],[]) +AC_CHECK_TYPE(long long, [AC_DEFINE(HAVE_LONGLONG, 1, [Define to 1 if the compiler supports the 'long long' data type.])]) +AC_CHECK_TYPE(ssize_t, [ CARES_TYPEOF_ARES_SSIZE_T=ssize_t ], [ CARES_TYPEOF_ARES_SSIZE_T=int ]) +AC_DEFINE_UNQUOTED([CARES_TYPEOF_ARES_SSIZE_T], ${CARES_TYPEOF_ARES_SSIZE_T}, [the signed version of size_t]) + +AC_CHECK_TYPE(socklen_t, [ -#undef inline -#ifdef HAVE_WINDOWS_H -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN -#endif -#include -#ifdef HAVE_WINSOCK2_H -#include -#ifdef HAVE_WS2TCPIP_H -#include -#endif -#endif -#else -#ifdef HAVE_SYS_TYPES_H -#include -#endif -#ifdef HAVE_NETINET_IN_H -#include -#endif -#ifdef HAVE_SYS_SOCKET_H -#include -#endif -#ifdef HAVE_NETDB_H -#include -#endif -#endif - ] -) + AC_DEFINE(HAVE_SOCKLEN_T, [], [socklen_t]) + CARES_DEFINE_UNQUOTED([CARES_TYPEOF_ARES_SOCKLEN_T], [socklen_t]) + ], + [ CARES_DEFINE_UNQUOTED([CARES_TYPEOF_ARES_SOCKLEN_T], [int]) ], + $cares_all_includes + ) +AC_CHECK_TYPE(SOCKET, [], [], $cares_all_includes) + + + +dnl ############################################################################### +dnl recv, recvfrom, send, getnameinfo, gethostname +dnl ARGUMENTS AND RETURN VALUES + +AC_CHECK_FUNCS([recv recvfrom send getnameinfo gethostname]) + +if test "x$ac_cv_type_ssize_t" = "xyes" -a "x$ac_cv_type_socklen_t" = "xyes" -a "x$ac_cv_native_windows" != "xyes" ; then + recvfrom_type_retv="ssize_t" + recvfrom_type_arg3="size_t" +else + recvfrom_type_retv="int" + recvfrom_type_arg3="int" +fi + +if test "x$ac_cv_type_SOCKET" = "xyes" ; then + dnl If the SOCKET type is defined, it uses socket ... should be windows only + recvfrom_type_arg1="SOCKET" +else + recvfrom_type_arg1="int" +fi -AC_CHECK_FUNCS([gettimeofday \ - if_indextoname \ - if_nametoindex \ +if test "x$ac_cv_type_socklen_t" = "xyes" ; then + recvfrom_type_arg6="socklen_t *" + getnameinfo_type_arg2="socklen_t" + getnameinfo_type_arg46="socklen_t" +else + recvfrom_type_arg6="int *" + getnameinfo_type_arg2="int" + getnameinfo_type_arg46="int" +fi + +if test "x$ac_cv_native_windows" = "xyes" ; then + recv_type_arg2="char *" +else + recv_type_arg2="void *" +fi + +dnl Functions are typically consistent so the equivalent fields map ... equivalently +recv_type_retv=${recvfrom_type_retv} +send_type_retv=${recvfrom_type_retv} +recv_type_arg1=${recvfrom_type_arg1} +recvfrom_type_arg2=${recv_type_arg2} +send_type_arg1=${recvfrom_type_arg1} +recv_type_arg3=${recvfrom_type_arg3} +send_type_arg3=${recvfrom_type_arg3} +gethostname_type_arg2=${recvfrom_type_arg3} + +dnl These should always be "sane" values to use always +recvfrom_qual_arg5= +recvfrom_type_arg4=int +recvfrom_type_arg5="struct sockaddr *" +recv_type_arg4=int +getnameinfo_type_arg1="struct sockaddr *" +getnameinfo_type_arg7=int +send_type_arg2="void *" +send_type_arg4=int + +AC_DEFINE_UNQUOTED([RECVFROM_TYPE_RETV], [ ${recvfrom_type_retv} ], [ recvfrom() return value ]) +AC_DEFINE_UNQUOTED([RECVFROM_TYPE_ARG1], [ ${recvfrom_type_arg1} ], [ recvfrom() arg1 type ]) +AC_DEFINE_UNQUOTED([RECVFROM_TYPE_ARG2], [ ${recvfrom_type_arg2} ], [ recvfrom() arg2 type ]) +AC_DEFINE_UNQUOTED([RECVFROM_TYPE_ARG3], [ ${recvfrom_type_arg3} ], [ recvfrom() arg3 type ]) +AC_DEFINE_UNQUOTED([RECVFROM_TYPE_ARG4], [ ${recvfrom_type_arg4} ], [ recvfrom() arg4 type ]) +AC_DEFINE_UNQUOTED([RECVFROM_TYPE_ARG5], [ ${recvfrom_type_arg5} ], [ recvfrom() arg5 type ]) +AC_DEFINE_UNQUOTED([RECVFROM_QUAL_ARG5], [ ${recvfrom_qual_arg5}], [ recvfrom() arg5 qualifier]) + +AC_DEFINE_UNQUOTED([RECV_TYPE_RETV], [ ${recv_type_retv} ], [ recv() return value ]) +AC_DEFINE_UNQUOTED([RECV_TYPE_ARG1], [ ${recv_type_arg1} ], [ recv() arg1 type ]) +AC_DEFINE_UNQUOTED([RECV_TYPE_ARG2], [ ${recv_type_arg2} ], [ recv() arg2 type ]) +AC_DEFINE_UNQUOTED([RECV_TYPE_ARG3], [ ${recv_type_arg3} ], [ recv() arg3 type ]) +AC_DEFINE_UNQUOTED([RECV_TYPE_ARG4], [ ${recv_type_arg4} ], [ recv() arg4 type ]) + +AC_DEFINE_UNQUOTED([SEND_TYPE_RETV], [ ${send_type_retv} ], [ send() return value ]) +AC_DEFINE_UNQUOTED([SEND_TYPE_ARG1], [ ${send_type_arg1} ], [ send() arg1 type ]) +AC_DEFINE_UNQUOTED([SEND_TYPE_ARG2], [ ${send_type_arg2} ], [ send() arg2 type ]) +AC_DEFINE_UNQUOTED([SEND_QUAL_ARG2], [ ], [ send() arg2 qualifier ]) +AC_DEFINE_UNQUOTED([SEND_TYPE_ARG3], [ ${send_type_arg3} ], [ send() arg3 type ]) +AC_DEFINE_UNQUOTED([SEND_TYPE_ARG4], [ ${send_type_arg4} ], [ send() arg4 type ]) + +AC_DEFINE_UNQUOTED([GETNAMEINFO_TYPE_ARG1], [ ${getnameinfo_type_arg1} ], [ getnameinfo() arg1 type ]) +AC_DEFINE_UNQUOTED([GETNAMEINFO_TYPE_ARG2], [ ${getnameinfo_type_arg2} ], [ getnameinfo() arg2 type ]) +AC_DEFINE_UNQUOTED([GETNAMEINFO_TYPE_ARG7], [ ${getnameinfo_type_arg7} ], [ getnameinfo() arg7 type ]) +AC_DEFINE_UNQUOTED([GETNAMEINFO_TYPE_ARG46], [ ${getnameinfo_type_arg46} ], [ getnameinfo() arg4 and 6 type ]) + +AC_DEFINE_UNQUOTED([GETHOSTNAME_TYPE_ARG2], [ ${gethostname_type_arg2} ], [ gethostname() arg2 type ]) + + + +dnl ############################################################################### + +dnl clock_gettime might require an external library +AC_SEARCH_LIBS([clock_gettime], [rt posix4]) + +AC_CHECK_FUNCS(connect \ + closesocket \ + CloseSocket \ + fcntl \ + getenv \ + gethostname \ + getrandom \ + getservbyport_r \ + inet_net_pton \ + inet_ntop \ + inet_pton \ + ioctl \ + IoctlSocket \ + ioctlsocket \ + setsockopt \ + socket \ + strcasecmp \ + strdup \ + stricmp \ + strncasecmp \ + strncmpi \ + strnicmp \ + writev \ + arc4random_buf \ + stat \ + gettimeofday \ + clock_gettime \ + if_indextoname \ + if_nametoindex \ ConvertInterfaceIndexToLuid \ - ConvertInterfaceLuidToNameA -],[ -],[ - 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(XC_SH_TR_CPP([HAVE_$func]), [1], - [Define to 1 if you have the $func function.]) - ],[ - AC_MSG_RESULT([but still no]) - ]) -]) + ConvertInterfaceLuidToNameA \ + getifaddrs \ + __system_property_get) -dnl Android. Some variants like arm64 may no longer have __system_property_get -dnl in libc, but they are defined in the headers. Perform a link check. -AC_CHECK_FUNC([__system_property_get], [ - AC_DEFINE([HAVE___SYSTEM_PROPERTY_GET], [1], [Define if __system_property_get exists.]) -]) -dnl Check if the getnameinfo function is available -dnl and get the types of five of its arguments. -CURL_CHECK_FUNC_GETNAMEINFO +if test "$ac_cv_func_getservbyport_r" = "yes" ; then + AC_MSG_CHECKING([number of arguments for getservbyport_r()]) + getservbyport_r_args=6 + case $host_os in + solaris*) + getservbyport_r_args=5 + ;; + aix*|openbsd*) + getservbyport_r_args=4 + ;; + esac + AC_MSG_RESULT([$getservbyport_r_args]) + AC_DEFINE_UNQUOTED([GETSERVBYPORT_R_ARGS], [ $getservbyport_r_args ], [ number of arguments for getservbyport_r() ]) +fi +if test "$ac_cv_func_getservbyname_r" = "yes" ; then + AC_MSG_CHECKING([number of arguments for getservbyname_r()]) + getservbyname_r_args=6 + case $host_os in + solaris*) + getservbyname_r_args=5 + ;; + aix*|openbsd*) + getservbyname_r_args=4 + ;; + esac + AC_DEFINE_UNQUOTED([GETSERVBYNAME_R_ARGS], [ $getservbyname_r_args ], [ number of arguments for getservbyname_r() ]) + AC_MSG_RESULT([$getservbyname_r_args]) +fi -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 endianness, assuming little endian!])] -) +AC_TYPE_SIZE_T +AC_CHECK_DECL(AF_INET6, [AC_DEFINE([HAVE_AF_INET6],1,[Define to 1 if you have AF_INET6])], [], $cares_all_includes) +AC_CHECK_DECL(PF_INET6, [AC_DEFINE([HAVE_PF_INET6],1,[Define to 1 if you have PF_INET6])], [], $cares_all_includes) +AC_CHECK_TYPES(struct in6_addr, [], [], $cares_all_includes) +AC_CHECK_TYPES(struct sockaddr_in6, [], [], $cares_all_includes) +AC_CHECK_TYPES(struct sockaddr_storage, [], [], $cares_all_includes) +AC_CHECK_TYPES(struct addrinfo, [], [], $cares_all_includes) +AC_CHECK_TYPES(struct timeval, [], [], $cares_all_includes) +AC_CHECK_MEMBERS(struct sockaddr_in6.sin6_scope_id, [], [], $cares_all_includes) +AC_CHECK_MEMBERS(struct addrinfo.ai_flags, [], [], $cares_all_includes) +AC_CHECK_DECL(FIONBIO, [], [], $cares_all_includes) +AC_CHECK_DECL(O_NONBLOCK, [], [], $cares_all_includes) +AC_CHECK_DECL(SO_NONBLOCK, [], [], $cares_all_includes) +AC_CHECK_DECL(MSG_NOSIGNAL, [], [], $cares_all_includes) +AC_CHECK_DECL(CLOCK_MONOTONIC, [], [], $cares_all_includes) + +if test "$ac_cv_have_decl_CLOCK_MONOTONIC" = "yes" -a "$ac_cv_func_clock_gettime" = "yes" ; then + AC_DEFINE([HAVE_CLOCK_GETTIME_MONOTONIC], [ 1 ], [ clock_gettime() with CLOCK_MONOTONIC support ]) +fi -dnl Check for user-specified random device -AC_ARG_WITH(random, -AS_HELP_STRING([--with-random=FILE], - [read randomness from FILE (default=/dev/urandom)]), - [ CARES_RANDOM_FILE="$withval" ], - [ CARES_RANDOM_FILE="/dev/urandom" ] -) -if test -n "$CARES_RANDOM_FILE" && test X"$CARES_RANDOM_FILE" != Xno ; then - AC_SUBST(CARES_RANDOM_FILE) - AC_DEFINE_UNQUOTED(CARES_RANDOM_FILE, "$CARES_RANDOM_FILE", - [a suitable file/device to read random data from]) +if test "$ac_cv_have_decl_FIONBIO" = "yes" -a "$ac_cv_func_ioctl" = "yes" ; then + AC_DEFINE([HAVE_IOCTL_FIONBIO], [ 1 ], [ ioctl() with FIONBIO support ]) +fi +if test "$ac_cv_have_decl_FIONBIO" = "yes" -a "$ac_cv_func_ioctlsocket" = "yes" ; then + AC_DEFINE([HAVE_IOCTLSOCKET_FIONBIO], [ 1 ], [ ioctlsocket() with FIONBIO support ]) +fi +if test "$ac_cv_have_decl_SO_NONBLOCK" = "yes" -a "$ac_cv_func_setsockopt" = "yes" ; then + AC_DEFINE([HAVE_SETSOCKOPT_SO_NONBLOCK], [ 1 ], [ setsockopt() with SO_NONBLOCK support ]) +fi +if test "$ac_cv_have_decl_O_NONBLOCK" = "yes" -a "$ac_cv_func_fcntl" = "yes" ; then + AC_DEFINE([HAVE_FCNTL_O_NONBLOCK], [ 1 ], [ fcntl() with O_NONBLOCK support ]) fi -CARES_CHECK_OPTION_NONBLOCKING -CARES_CHECK_NONBLOCKING_SOCKET +dnl ares_build.h.in specific defines +if test "x$ac_cv_header_sys_types_h" = "xyes" ; then + CARES_DEFINE_UNQUOTED([CARES_HAVE_SYS_TYPES_H],[1]) +fi +if test "x$ac_cv_header_sys_random_h" = "xyes" ; then + CARES_DEFINE_UNQUOTED([CARES_HAVE_SYS_RANDOM_H],[1]) +fi +if test "x$ac_cv_header_sys_socket_h" = "xyes" ; then + CARES_DEFINE_UNQUOTED([CARES_HAVE_SYS_SOCKET_H],[1]) +fi +if test "x$ac_cv_header_ws2tcpip_h" = "xyes" ; then + CARES_DEFINE_UNQUOTED([CARES_HAVE_WS2TCPIP_H],[1]) +fi +if test "x$ac_cv_header_winsock2_h" = "xyes" ; then + CARES_DEFINE_UNQUOTED([CARES_HAVE_WINSOCK2_H],[1]) +fi +if test "x$ac_cv_header_windows_h" = "xyes" ; then + CARES_DEFINE_UNQUOTED([CARES_HAVE_WINDOWS_H],[1]) +fi +if test "x$ac_cv_header_arpa_nameser_h" = "xyes" ; then + CARES_DEFINE_UNQUOTED([CARES_HAVE_ARPA_NAMESER_H],[1]) +fi +if test "x$ac_cv_header_arpa_nameser_compa_h" = "xyes" ; then + CARES_DEFINE_UNQUOTED([CARES_HAVE_ARPA_NAMESER_COMPA_H],[1]) +fi dnl ------------ THREADING -------------- -AC_ARG_ENABLE(cares-threads, - AS_HELP_STRING([--disable-cares-threads],[Disable building of thread safety support]), - [ CARES_THREADS=${enableval} ], - [ CARES_THREADS=yes ]) dnl windows always supports threads, only check non-windows systems. if test "${CARES_THREADS}" = "yes" -a "x${ac_cv_native_windows}" != "xyes" ; then @@ -976,58 +796,49 @@ if test "${CARES_THREADS}" = "yes" ; then AC_DEFINE([CARES_THREADS], [ 1 ], [Threading enabled]) fi -CARES_CONFIGURE_SYMBOL_HIDING - CARES_PRIVATE_LIBS="$LIBS" AC_SUBST(CARES_PRIVATE_LIBS) -CARES_CFLAG_EXTRAS="" -if test X"$want_werror" = Xyes; then - CARES_CFLAG_EXTRAS="-Werror" -fi -AC_SUBST(CARES_CFLAG_EXTRAS) - -dnl squeeze whitespace out of some variables - -squeeze CFLAGS -squeeze CPPFLAGS -squeeze DEFS -squeeze LDFLAGS -squeeze LIBS - -squeeze CARES_PRIVATE_LIBS +BUILD_SUBDIRS="include src docs" -XC_CHECK_BUILD_FLAGS AC_MSG_CHECKING([whether to build tests]) -AC_ARG_ENABLE(tests, - AS_HELP_STRING([--enable-tests], [build test suite]), - [ build_tests="$enableval" ], - [ if test "x$HAVE_CXX14" = "x1" && test "x$cross_compiling" = "xno" ; then - build_tests="yes" - else - build_tests="no" - fi - ] -) - if test "x$build_tests" = "xyes" ; then - if test "x$HAVE_CXX14" = "0" ; then - AC_MSG_ERROR([*** Building tests requires a CXX14 compiler]) - fi - if test "x$cross_compiling" = "xyes" ; then - AC_MSG_ERROR([*** Tests not supported when cross compiling]) - fi + if test "x$HAVE_CXX14" = "0" ; then + AC_MSG_ERROR([*** Building tests requires a CXX14 compiler]) + fi + if test "x$cross_compiling" = "xyes" ; then + AC_MSG_ERROR([*** Tests not supported when cross compiling]) + fi fi AC_MSG_RESULT([$build_tests]) +if test "x$build_tests" != "xno" ; then + PKG_CHECK_MODULES([GMOCK], [gmock], [ have_gmock=yes ], [ have_gmock=no ]) + if test "x$have_gmock" = "xno" ; then + if test "x$build_tests" = "xmaybe" ; then + AC_MSG_WARN([gmock could not be found, not building tests]) + build_tests=no + else + AC_MSG_ERROR([tests require gmock]) + fi + fi +fi + +if test "x$build_tests" != "xno" ; then + build_tests=yes + + AX_CXX_COMPILE_STDCXX_14([noext],[mandatory]) + + if test "$ac_cv_native_windows" != "yes" ; then + AX_PTHREAD([ CARES_TEST_PTHREADS="yes" ], [ AC_MSG_ERROR([threading required for tests]) ]) + fi -BUILD_SUBDIRS="include src docs" -if test "x$build_tests" = "xyes" ; then - AC_CONFIG_SUBDIRS([test]) BUILD_SUBDIRS="${BUILD_SUBDIRS} test" fi +AM_CONDITIONAL(BUILD_TESTS, test "x$build_tests" = "xyes") + AC_SUBST(BUILD_SUBDIRS) AC_CONFIG_FILES([Makefile \ @@ -1037,6 +848,7 @@ AC_CONFIG_FILES([Makefile \ src/tools/Makefile \ docs/Makefile \ libcares.pc ]) +AM_COND_IF([BUILD_TESTS], + [AC_CONFIG_FILES([test/Makefile])]) AC_OUTPUT -XC_AMEND_DISTCLEAN(['.']) diff --git a/include/ares.h b/include/ares.h index e3c7a933..f0b3add5 100644 --- a/include/ares.h +++ b/include/ares.h @@ -97,21 +97,28 @@ extern "C" { ** c-ares external API function linkage decorations. */ -#ifdef CARES_STATICLIB -# define CARES_EXTERN -#elif defined(WIN32) || defined(_WIN32) || defined(__SYMBIAN32__) -# if defined(CARES_BUILDING_LIBRARY) -# define CARES_EXTERN __declspec(dllexport) +#if defined(_WIN32) || defined(__CYGWIN__) || defined(__SYMBIAN32__) +# ifdef CARES_STATICLIB +# define CARES_EXTERN # else -# define CARES_EXTERN __declspec(dllimport) +# ifdef CARES_BUILDING_LIBRARY +# define CARES_EXTERN __declspec(dllexport) +# else +# define CARES_EXTERN __declspec(dllimport) +# endif # endif -#elif defined(CARES_BUILDING_LIBRARY) && defined(CARES_SYMBOL_HIDING) -# define CARES_EXTERN CARES_SYMBOL_SCOPE_EXTERN #else -# define CARES_EXTERN +# if defined(__GNUC__) && __GNUC__ >= 4 +# define CARES_EXTERN __attribute__ ((visibility ("default"))) +# elif defined(__INTEL_COMPILER) && __INTEL_COMPILER >= 900 +# define CARES_EXTERN __attribute__ ((visibility ("default"))) +# elif defined(__SUNPRO_C) +# define CARES_EXTERN _global +# else +# define CARES_EXTERN +# endif #endif - typedef enum { ARES_SUCCESS = 0, diff --git a/include/ares_build.h.in b/include/ares_build.h.in index c8624da8..b4a26d89 100644 --- a/include/ares_build.h.in +++ b/include/ares_build.h.in @@ -1,114 +1,52 @@ -/* MIT License - * - * Copyright (c) 2009 Daniel Stenberg - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - * SPDX-License-Identifier: MIT - */ #ifndef __CARES_BUILD_H #define __CARES_BUILD_H - -/* ================================================================ */ -/* NOTES FOR CONFIGURE CAPABLE SYSTEMS */ -/* ================================================================ */ - /* - * NOTE 1: - * ------- - * - * Nothing in this file is intended to be modified or adjusted by the - * c-ares library user nor by the c-ares library builder. - * - * If you think that something actually needs to be changed, adjusted - * or fixed in this file, then, report it on the c-ares development - * mailing list: http://lists.haxx.se/listinfo/c-ares/ - * - * This header file shall only export symbols which are 'cares' or 'CARES' - * prefixed, otherwise public name space would be polluted. - * - * NOTE 2: - * ------- - * - * Right now you might be staring at file ares_build.h.in or ares_build.h, - * this is due to the following reason: - * - * On systems capable of running the configure script, the configure process - * will overwrite the distributed ares_build.h file with one that is suitable - * and specific to the library being configured and built, which is generated - * from the ares_build.h.in template file. - * + * Copyright (C) The c-ares project and its contributors + * SPDX-License-Identifier: MIT */ -/* ================================================================ */ -/* DEFINITION OF THESE SYMBOLS SHALL NOT TAKE PLACE ANYWHERE ELSE */ -/* ================================================================ */ +#define CARES_TYPEOF_ARES_SOCKLEN_T @CARES_TYPEOF_ARES_SOCKLEN_T@ +#define CARES_TYPEOF_ARES_SSIZE_T @CARES_TYPEOF_ARES_SSIZE_T@ + +/* Prefix names with CARES_ to make sure they don't conflict with other config.h + * files. We need to include some dependent headers that may be system specific + * for C-Ares */ +#undef CARES_HAVE_SYS_TYPES_H +#undef CARES_HAVE_SYS_RANDOM_H +#undef CARES_HAVE_SYS_SOCKET_H +#undef CARES_HAVE_WINDOWS_H +#undef CARES_HAVE_WS2TCPIP_H +#undef CARES_HAVE_WINSOCK2_H +#undef CARES_HAVE_WINDOWS_H +#undef CARES_HAVE_ARPA_NAMESER_H +#undef CARES_HAVE_ARPA_NAMESER_COMPAT_H -#ifdef CARES_TYPEOF_ARES_SOCKLEN_T -# error "CARES_TYPEOF_ARES_SOCKLEN_T shall not be defined except in ares_build.h" - Error Compilation_aborted_CARES_TYPEOF_ARES_SOCKLEN_T_already_defined +#ifdef CARES_HAVE_SYS_TYPES_H +# include #endif -#undef CARES_HAVE_ARPA_NAMESER_H -#undef CARES_HAVE_ARPA_NAMESER_COMPAT_H +#ifdef CARES_HAVE_SYS_RANDOM_H +# include +#endif -/* ================================================================ */ -/* EXTERNAL INTERFACE SETTINGS FOR CONFIGURE CAPABLE SYSTEMS ONLY */ -/* ================================================================ */ +#ifdef CARES_HAVE_SYS_SOCKET_H +# include +#endif -/* Configure process defines this to 1 when it finds out that system */ -/* header file ws2tcpip.h must be included by the external interface. */ -#undef CARES_PULL_WS2TCPIP_H -#ifdef CARES_PULL_WS2TCPIP_H -# ifndef WIN32_LEAN_AND_MEAN -# define WIN32_LEAN_AND_MEAN -# endif -# include +#ifdef CARES_HAVE_WINSOCK2_H # include -# include #endif -/* Configure process defines this to 1 when it finds out that system */ -/* header file sys/types.h must be included by the external interface. */ -#undef CARES_PULL_SYS_TYPES_H -#ifdef CARES_PULL_SYS_TYPES_H -# include +#ifdef CARES_HAVE_WS2TCPIP_H +# include #endif -/* Configure process defines this to 1 when it finds out that system */ -/* header file sys/socket.h must be included by the external interface. */ -#undef CARES_PULL_SYS_SOCKET_H -#ifdef CARES_PULL_SYS_SOCKET_H -# include +#ifdef CARES_HAVE_WINDOWS_H +# include #endif -/* Integral data type used for ares_socklen_t. */ -#undef CARES_TYPEOF_ARES_SOCKLEN_T -/* Data type definition of ares_socklen_t. */ typedef CARES_TYPEOF_ARES_SOCKLEN_T ares_socklen_t; - -/* Integral data type used for ares_ssize_t. */ -#undef CARES_TYPEOF_ARES_SSIZE_T - -/* Data type definition of ares_ssize_t. */ typedef CARES_TYPEOF_ARES_SSIZE_T ares_ssize_t; #endif /* __CARES_BUILD_H */ diff --git a/libcares.pc.cmake b/libcares.pc.cmake index df493686..74e4d0cf 100644 --- a/libcares.pc.cmake +++ b/libcares.pc.cmake @@ -17,6 +17,6 @@ Description: asynchronous DNS lookup library Version: @CARES_VERSION@ Requires: Requires.private: -Cflags: -I${includedir} @CPPFLAG_CARES_STATICLIB@ +Cflags: -I${includedir} Libs: -L${libdir} -lcares Libs.private: @CARES_PRIVATE_LIBS@ diff --git a/libcares.pc.in b/libcares.pc.in index aa4bfc91..54f6d68b 100644 --- a/libcares.pc.in +++ b/libcares.pc.in @@ -17,6 +17,6 @@ Description: asynchronous DNS lookup library Version: @VERSION@ Requires: Requires.private: -Cflags: -I${includedir} @CPPFLAG_CARES_STATICLIB@ +Cflags: -I${includedir} Libs: -L${libdir} -lcares Libs.private: @CARES_PRIVATE_LIBS@ diff --git a/m4/ax_append_link_flags.m4 b/m4/ax_append_link_flags.m4 new file mode 100644 index 00000000..99b9fa5b --- /dev/null +++ b/m4/ax_append_link_flags.m4 @@ -0,0 +1,44 @@ +# =========================================================================== +# https://www.gnu.org/software/autoconf-archive/ax_append_link_flags.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_APPEND_LINK_FLAGS([FLAG1 FLAG2 ...], [FLAGS-VARIABLE], [EXTRA-FLAGS], [INPUT]) +# +# DESCRIPTION +# +# For every FLAG1, FLAG2 it is checked whether the linker works with the +# flag. If it does, the flag is added FLAGS-VARIABLE +# +# If FLAGS-VARIABLE is not specified, the linker's flags (LDFLAGS) is +# used. During the check the flag is always added to the linker's flags. +# +# If EXTRA-FLAGS is defined, it is added to the linker's default flags +# when the check is done. The check is thus made with the flags: "LDFLAGS +# EXTRA-FLAGS FLAG". This can for example be used to force the linker to +# issue an error when a bad flag is given. +# +# INPUT gives an alternative input source to AC_COMPILE_IFELSE. +# +# NOTE: This macro depends on the AX_APPEND_FLAG and AX_CHECK_LINK_FLAG. +# Please keep this macro in sync with AX_APPEND_COMPILE_FLAGS. +# +# LICENSE +# +# Copyright (c) 2011 Maarten Bosmans +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 7 + +AC_DEFUN([AX_APPEND_LINK_FLAGS], +[AX_REQUIRE_DEFINED([AX_CHECK_LINK_FLAG]) +AX_REQUIRE_DEFINED([AX_APPEND_FLAG]) +for flag in $1; do + AX_CHECK_LINK_FLAG([$flag], [AX_APPEND_FLAG([$flag], [m4_default([$2], [LDFLAGS])])], [], [$3], [$4]) +done +])dnl AX_APPEND_LINK_FLAGS diff --git a/m4/ax_check_link_flag.m4 b/m4/ax_check_link_flag.m4 new file mode 100644 index 00000000..03a30ce4 --- /dev/null +++ b/m4/ax_check_link_flag.m4 @@ -0,0 +1,53 @@ +# =========================================================================== +# https://www.gnu.org/software/autoconf-archive/ax_check_link_flag.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_CHECK_LINK_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS], [INPUT]) +# +# DESCRIPTION +# +# Check whether the given FLAG works with the linker or gives an error. +# (Warnings, however, are ignored) +# +# ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on +# success/failure. +# +# If EXTRA-FLAGS is defined, it is added to the linker's default flags +# when the check is done. The check is thus made with the flags: "LDFLAGS +# EXTRA-FLAGS FLAG". This can for example be used to force the linker to +# issue an error when a bad flag is given. +# +# INPUT gives an alternative input source to AC_LINK_IFELSE. +# +# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this +# macro in sync with AX_CHECK_{PREPROC,COMPILE}_FLAG. +# +# LICENSE +# +# Copyright (c) 2008 Guido U. Draheim +# Copyright (c) 2011 Maarten Bosmans +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 6 + +AC_DEFUN([AX_CHECK_LINK_FLAG], +[AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_IF +AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_ldflags_$4_$1])dnl +AC_CACHE_CHECK([whether the linker accepts $1], CACHEVAR, [ + ax_check_save_flags=$LDFLAGS + LDFLAGS="$LDFLAGS $4 $1" + AC_LINK_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])], + [AS_VAR_SET(CACHEVAR,[yes])], + [AS_VAR_SET(CACHEVAR,[no])]) + LDFLAGS=$ax_check_save_flags]) +AS_VAR_IF(CACHEVAR,yes, + [m4_default([$2], :)], + [m4_default([$3], :)]) +AS_VAR_POPDEF([CACHEVAR])dnl +])dnl AX_CHECK_LINK_FLAGS diff --git a/m4/ax_compiler_vendor.m4 b/m4/ax_compiler_vendor.m4 new file mode 100644 index 00000000..039f99d2 --- /dev/null +++ b/m4/ax_compiler_vendor.m4 @@ -0,0 +1,119 @@ +# =========================================================================== +# https://www.gnu.org/software/autoconf-archive/ax_compiler_vendor.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_COMPILER_VENDOR +# +# DESCRIPTION +# +# Determine the vendor of the C, C++ or Fortran compiler. The vendor is +# returned in the cache variable $ax_cv_c_compiler_vendor for C, +# $ax_cv_cxx_compiler_vendor for C++ or $ax_cv_fc_compiler_vendor for +# (modern) Fortran. The value is one of "intel", "ibm", "pathscale", +# "clang" (LLVM), "cray", "fujitsu", "sdcc", "sx", "nvhpc" (NVIDIA HPC +# Compiler), "portland" (PGI), "gnu" (GCC), "sun" (Oracle Developer +# Studio), "hp", "dec", "borland", "comeau", "kai", "lcc", "sgi", +# "microsoft", "metrowerks", "watcom", "tcc" (Tiny CC) or "unknown" (if +# the compiler cannot be determined). +# +# To check for a Fortran compiler, you must first call AC_FC_PP_SRCEXT +# with an appropriate preprocessor-enabled extension. For example: +# +# AC_LANG_PUSH([Fortran]) +# AC_PROG_FC +# AC_FC_PP_SRCEXT([F]) +# AX_COMPILER_VENDOR +# AC_LANG_POP([Fortran]) +# +# LICENSE +# +# Copyright (c) 2008 Steven G. Johnson +# Copyright (c) 2008 Matteo Frigo +# Copyright (c) 2018-19 John Zaitseff +# +# This program is free software: you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation, either version 3 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 32 + +AC_DEFUN([AX_COMPILER_VENDOR], [dnl + AC_CACHE_CHECK([for _AC_LANG compiler vendor], ax_cv_[]_AC_LANG_ABBREV[]_compiler_vendor, [dnl + dnl If you modify this list of vendors, please add similar support + dnl to ax_compiler_version.m4 if at all possible. + dnl + dnl Note: Do NOT check for GCC first since some other compilers + dnl define __GNUC__ to remain compatible with it. Compilers that + dnl are very slow to start (such as Intel) are listed first. + + vendors=" + intel: __ICC,__ECC,__INTEL_COMPILER + ibm: __xlc__,__xlC__,__IBMC__,__IBMCPP__,__ibmxl__ + pathscale: __PATHCC__,__PATHSCALE__ + clang: __clang__ + cray: _CRAYC + fujitsu: __FUJITSU + sdcc: SDCC,__SDCC + sx: _SX + nvhpc: __NVCOMPILER + portland: __PGI + gnu: __GNUC__ + sun: __SUNPRO_C,__SUNPRO_CC,__SUNPRO_F90,__SUNPRO_F95 + hp: __HP_cc,__HP_aCC + dec: __DECC,__DECCXX,__DECC_VER,__DECCXX_VER + borland: __BORLANDC__,__CODEGEARC__,__TURBOC__ + comeau: __COMO__ + kai: __KCC + lcc: __LCC__ + sgi: __sgi,sgi + microsoft: _MSC_VER + metrowerks: __MWERKS__ + watcom: __WATCOMC__ + tcc: __TINYC__ + unknown: UNKNOWN + " + for ventest in $vendors; do + case $ventest in + *:) + vendor=$ventest + continue + ;; + *) + vencpp="defined("`echo $ventest | sed 's/,/) || defined(/g'`")" + ;; + esac + + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[ +#if !($vencpp) + thisisanerror; +#endif + ]])], [break]) + done + + ax_cv_[]_AC_LANG_ABBREV[]_compiler_vendor=`echo $vendor | cut -d: -f1` + ]) +])dnl diff --git a/m4/cares-compilers.m4 b/m4/cares-compilers.m4 deleted file mode 100644 index 89f63549..00000000 --- a/m4/cares-compilers.m4 +++ /dev/null @@ -1,1451 +0,0 @@ -#*************************************************************************** -# -# Copyright (C) Daniel Stenberg et al -# -# Permission to use, copy, modify, and distribute this software and its -# documentation for any purpose and without fee is hereby granted, provided -# that the above copyright notice appear in all copies and that both that -# copyright notice and this permission notice appear in supporting -# documentation, and that the name of M.I.T. not be used in advertising or -# publicity pertaining to distribution of the software without specific, -# written prior permission. M.I.T. makes no representations about the -# suitability of this software for any purpose. It is provided "as is" -# without express or implied warranty. -# -# SPDX-License-Identifier: MIT -#*************************************************************************** - -# File version for 'aclocal' use. Keep it a single number. -# serial 75 - - -dnl CARES_CHECK_COMPILER -dnl ------------------------------------------------- -dnl Verify if the C compiler being used is known. - -AC_DEFUN([CARES_CHECK_COMPILER], [ - # - compiler_id="unknown" - compiler_num="0" - # - flags_dbg_all="unknown" - flags_dbg_yes="unknown" - flags_dbg_off="unknown" - flags_opt_all="unknown" - flags_opt_yes="unknown" - flags_opt_off="unknown" - # - flags_prefer_cppflags="no" - # - CARES_CHECK_COMPILER_DEC_C - CARES_CHECK_COMPILER_HPUX_C - CARES_CHECK_COMPILER_IBM_C - CARES_CHECK_COMPILER_INTEL_C - CARES_CHECK_COMPILER_CLANG - CARES_CHECK_COMPILER_GNU_C - CARES_CHECK_COMPILER_LCC - CARES_CHECK_COMPILER_SGI_MIPSPRO_C - CARES_CHECK_COMPILER_SGI_MIPS_C - CARES_CHECK_COMPILER_SUNPRO_C - CARES_CHECK_COMPILER_TINY_C - CARES_CHECK_COMPILER_WATCOM_C - # - if test "$compiler_id" = "unknown"; then - cat <<_EOF 1>&2 -*** -*** Warning: This configure script does not have information about the -*** compiler you are using, relative to the flags required to enable or -*** disable generation of debug info, optimization options or warnings. -*** -*** Whatever settings are present in CFLAGS will be used for this run. -*** -*** If you wish to help the c-ares project to better support your compiler -*** you can report this and the required info on the c-ares development -*** mailing list: http://lists.haxx.se/listinfo/c-ares/ -*** -_EOF - fi -]) - - -dnl CARES_CHECK_COMPILER_CLANG -dnl ------------------------------------------------- -dnl Verify if compiler being used is clang. - -AC_DEFUN([CARES_CHECK_COMPILER_CLANG], [ - AC_BEFORE([$0],[CARES_CHECK_COMPILER_GNU_C])dnl - AC_MSG_CHECKING([if compiler is clang]) - CURL_CHECK_DEF([__clang__], [], [silent]) - if test "$cares_cv_have_def___clang__" = "yes"; then - AC_MSG_RESULT([yes]) - compiler_id="CLANG" - clangver=`$CC -dumpversion` - clangvhi=`echo $clangver | cut -d . -f1` - clangvlo=`echo $clangver | cut -d . -f2` - compiler_num=`(expr $clangvhi "*" 100 + $clangvlo) 2>/dev/null` - flags_dbg_all="-g -g0 -g1 -g2 -g3" - flags_dbg_all="$flags_dbg_all -ggdb" - flags_dbg_all="$flags_dbg_all -gstabs" - flags_dbg_all="$flags_dbg_all -gstabs+" - flags_dbg_all="$flags_dbg_all -gcoff" - flags_dbg_all="$flags_dbg_all -gxcoff" - flags_dbg_all="$flags_dbg_all -gdwarf-2" - flags_dbg_all="$flags_dbg_all -gvms" - flags_dbg_yes="-g" - flags_dbg_off="-g0" - flags_opt_all="-O -O0 -O1 -O2 -Os -O3 -O4" - flags_opt_yes="-Os" - flags_opt_off="-O0" - else - AC_MSG_RESULT([no]) - fi -]) - - -dnl CARES_CHECK_COMPILER_DEC_C -dnl ------------------------------------------------- -dnl Verify if compiler being used is DEC C. - -AC_DEFUN([CARES_CHECK_COMPILER_DEC_C], [ - AC_MSG_CHECKING([if compiler is DEC/Compaq/HP C]) - CURL_CHECK_DEF([__DECC], [], [silent]) - CURL_CHECK_DEF([__DECC_VER], [], [silent]) - if test "$cares_cv_have_def___DECC" = "yes" && - test "$cares_cv_have_def___DECC_VER" = "yes"; then - AC_MSG_RESULT([yes]) - compiler_id="DEC_C" - flags_dbg_all="-g -g0 -g1 -g2 -g3" - flags_dbg_yes="-g2" - flags_dbg_off="-g0" - flags_opt_all="-O -O0 -O1 -O2 -O3 -O4" - flags_opt_yes="-O1" - flags_opt_off="-O0" - else - AC_MSG_RESULT([no]) - fi -]) - - -dnl CARES_CHECK_COMPILER_GNU_C -dnl ------------------------------------------------- -dnl Verify if compiler being used is GNU C. - -AC_DEFUN([CARES_CHECK_COMPILER_GNU_C], [ - AC_REQUIRE([CARES_CHECK_COMPILER_INTEL_C])dnl - AC_REQUIRE([CARES_CHECK_COMPILER_CLANG])dnl - AC_MSG_CHECKING([if compiler is GNU C]) - CURL_CHECK_DEF([__GNUC__], [], [silent]) - if test "$cares_cv_have_def___GNUC__" = "yes" && - test "$compiler_id" = "unknown"; then - AC_MSG_RESULT([yes]) - compiler_id="GNU_C" - gccver=`$CC -dumpversion` - gccvhi=`echo $gccver | cut -d . -f1` - gccvlo=`echo $gccver | cut -d . -f2` - compiler_num=`(expr $gccvhi "*" 100 + $gccvlo) 2>/dev/null` - flags_dbg_all="-g -g0 -g1 -g2 -g3" - flags_dbg_all="$flags_dbg_all -ggdb" - flags_dbg_all="$flags_dbg_all -gstabs" - flags_dbg_all="$flags_dbg_all -gstabs+" - flags_dbg_all="$flags_dbg_all -gcoff" - flags_dbg_all="$flags_dbg_all -gxcoff" - flags_dbg_all="$flags_dbg_all -gdwarf-2" - flags_dbg_all="$flags_dbg_all -gvms" - flags_dbg_yes="-g" - flags_dbg_off="-g0" - flags_opt_all="-O -O0 -O1 -O2 -O3 -Os" - flags_opt_yes="-O2" - flags_opt_off="-O0" - CURL_CHECK_DEF([_WIN32], [], [silent]) - else - AC_MSG_RESULT([no]) - fi -]) - - -dnl CARES_CHECK_COMPILER_HPUX_C -dnl ------------------------------------------------- -dnl Verify if compiler being used is HP-UX C. - -AC_DEFUN([CARES_CHECK_COMPILER_HPUX_C], [ - AC_MSG_CHECKING([if compiler is HP-UX C]) - CURL_CHECK_DEF([__HP_cc], [], [silent]) - if test "$cares_cv_have_def___HP_cc" = "yes"; then - AC_MSG_RESULT([yes]) - compiler_id="HP_UX_C" - flags_dbg_all="-g -s" - flags_dbg_yes="-g" - flags_dbg_off="-s" - flags_opt_all="-O +O0 +O1 +O2 +O3 +O4" - flags_opt_yes="+O2" - flags_opt_off="+O0" - else - AC_MSG_RESULT([no]) - fi -]) - - -dnl CARES_CHECK_COMPILER_IBM_C -dnl ------------------------------------------------- -dnl Verify if compiler being used is IBM C. - -AC_DEFUN([CARES_CHECK_COMPILER_IBM_C], [ - AC_MSG_CHECKING([if compiler is IBM C]) - CURL_CHECK_DEF([__IBMC__], [], [silent]) - if test "$cares_cv_have_def___IBMC__" = "yes"; then - AC_MSG_RESULT([yes]) - compiler_id="IBM_C" - flags_dbg_all="-g -g0 -g1 -g2 -g3" - flags_dbg_yes="-g" - flags_dbg_off="" - flags_opt_all="-O -O0 -O1 -O2 -O3 -O4 -O5" - flags_opt_all="$flags_opt_all -qnooptimize" - flags_opt_all="$flags_opt_all -qoptimize=0" - flags_opt_all="$flags_opt_all -qoptimize=1" - flags_opt_all="$flags_opt_all -qoptimize=2" - flags_opt_all="$flags_opt_all -qoptimize=3" - flags_opt_all="$flags_opt_all -qoptimize=4" - flags_opt_all="$flags_opt_all -qoptimize=5" - flags_opt_yes="-O2" - flags_opt_off="-qnooptimize" - flags_prefer_cppflags="yes" - else - AC_MSG_RESULT([no]) - fi -]) - - -dnl CARES_CHECK_COMPILER_INTEL_C -dnl ------------------------------------------------- -dnl Verify if compiler being used is Intel C. - -AC_DEFUN([CARES_CHECK_COMPILER_INTEL_C], [ - AC_BEFORE([$0],[CARES_CHECK_COMPILER_GNU_C])dnl - AC_MSG_CHECKING([if compiler is Intel C]) - CURL_CHECK_DEF([__INTEL_COMPILER], [], [silent]) - if test "$cares_cv_have_def___INTEL_COMPILER" = "yes"; then - AC_MSG_RESULT([yes]) - compiler_num="$cares_cv_def___INTEL_COMPILER" - CURL_CHECK_DEF([__unix__], [], [silent]) - if test "$cares_cv_have_def___unix__" = "yes"; then - compiler_id="INTEL_UNIX_C" - flags_dbg_all="-g -g0" - flags_dbg_yes="-g" - flags_dbg_off="-g0" - flags_opt_all="-O -O0 -O1 -O2 -O3 -Os" - flags_opt_yes="-O2" - flags_opt_off="-O0" - else - compiler_id="INTEL_WINDOWS_C" - flags_dbg_all="/ZI /Zi /zI /zi /ZD /Zd /zD /zd /Z7 /z7 /Oy /Oy-" - flags_dbg_all="$flags_dbg_all /debug" - flags_dbg_all="$flags_dbg_all /debug:none" - flags_dbg_all="$flags_dbg_all /debug:minimal" - flags_dbg_all="$flags_dbg_all /debug:partial" - flags_dbg_all="$flags_dbg_all /debug:full" - flags_dbg_all="$flags_dbg_all /debug:semantic_stepping" - flags_dbg_all="$flags_dbg_all /debug:extended" - flags_dbg_yes="/Zi /Oy-" - flags_dbg_off="/debug:none /Oy-" - flags_opt_all="/O /O0 /O1 /O2 /O3 /Od /Og /Og- /Oi /Oi-" - flags_opt_yes="/O2" - flags_opt_off="/Od" - fi - else - AC_MSG_RESULT([no]) - fi -]) - - -dnl CARES_CHECK_COMPILER_LCC -dnl ------------------------------------------------- -dnl Verify if compiler being used is LCC. - -AC_DEFUN([CARES_CHECK_COMPILER_LCC], [ - AC_MSG_CHECKING([if compiler is LCC]) - CURL_CHECK_DEF([__LCC__], [], [silent]) - if test "$cares_cv_have_def___LCC__" = "yes"; then - AC_MSG_RESULT([yes]) - compiler_id="LCC" - flags_dbg_all="-g" - flags_dbg_yes="-g" - flags_dbg_off="" - flags_opt_all="" - flags_opt_yes="" - flags_opt_off="" - else - AC_MSG_RESULT([no]) - fi -]) - - -dnl CARES_CHECK_COMPILER_SGI_MIPS_C -dnl ------------------------------------------------- -dnl Verify if compiler being used is SGI MIPS C. - -AC_DEFUN([CARES_CHECK_COMPILER_SGI_MIPS_C], [ - AC_REQUIRE([CARES_CHECK_COMPILER_SGI_MIPSPRO_C])dnl - AC_MSG_CHECKING([if compiler is SGI MIPS C]) - CURL_CHECK_DEF([__GNUC__], [], [silent]) - CURL_CHECK_DEF([__sgi], [], [silent]) - if test "$cares_cv_have_def___GNUC__" = "no" && - test "$cares_cv_have_def___sgi" = "yes" && - test "$compiler_id" = "unknown"; then - AC_MSG_RESULT([yes]) - compiler_id="SGI_MIPS_C" - flags_dbg_all="-g -g0 -g1 -g2 -g3" - flags_dbg_yes="-g" - flags_dbg_off="-g0" - flags_opt_all="-O -O0 -O1 -O2 -O3 -Ofast" - flags_opt_yes="-O2" - flags_opt_off="-O0" - else - AC_MSG_RESULT([no]) - fi -]) - - -dnl CARES_CHECK_COMPILER_SGI_MIPSPRO_C -dnl ------------------------------------------------- -dnl Verify if compiler being used is SGI MIPSpro C. - -AC_DEFUN([CARES_CHECK_COMPILER_SGI_MIPSPRO_C], [ - AC_BEFORE([$0],[CARES_CHECK_COMPILER_SGI_MIPS_C])dnl - AC_MSG_CHECKING([if compiler is SGI MIPSpro C]) - CURL_CHECK_DEF([__GNUC__], [], [silent]) - CURL_CHECK_DEF([_COMPILER_VERSION], [], [silent]) - CURL_CHECK_DEF([_SGI_COMPILER_VERSION], [], [silent]) - if test "$cares_cv_have_def___GNUC__" = "no" && - (test "$cares_cv_have_def__SGI_COMPILER_VERSION" = "yes" || - test "$cares_cv_have_def__COMPILER_VERSION" = "yes"); then - AC_MSG_RESULT([yes]) - compiler_id="SGI_MIPSPRO_C" - flags_dbg_all="-g -g0 -g1 -g2 -g3" - flags_dbg_yes="-g" - flags_dbg_off="-g0" - flags_opt_all="-O -O0 -O1 -O2 -O3 -Ofast" - flags_opt_yes="-O2" - flags_opt_off="-O0" - else - AC_MSG_RESULT([no]) - fi -]) - - -dnl CARES_CHECK_COMPILER_SUNPRO_C -dnl ------------------------------------------------- -dnl Verify if compiler being used is SunPro C. - -AC_DEFUN([CARES_CHECK_COMPILER_SUNPRO_C], [ - AC_MSG_CHECKING([if compiler is SunPro C]) - CURL_CHECK_DEF([__SUNPRO_C], [], [silent]) - if test "$cares_cv_have_def___SUNPRO_C" = "yes"; then - AC_MSG_RESULT([yes]) - compiler_id="SUNPRO_C" - flags_dbg_all="-g -s" - flags_dbg_yes="-g" - flags_dbg_off="-s" - flags_opt_all="-O -xO -xO1 -xO2 -xO3 -xO4 -xO5" - flags_opt_yes="-xO2" - flags_opt_off="" - else - AC_MSG_RESULT([no]) - fi -]) - - -dnl CARES_CHECK_COMPILER_TINY_C -dnl ------------------------------------------------- -dnl Verify if compiler being used is Tiny C. - -AC_DEFUN([CARES_CHECK_COMPILER_TINY_C], [ - AC_MSG_CHECKING([if compiler is Tiny C]) - CURL_CHECK_DEF([__TINYC__], [], [silent]) - if test "$cares_cv_have_def___TINYC__" = "yes"; then - AC_MSG_RESULT([yes]) - compiler_id="TINY_C" - flags_dbg_all="-g -b" - flags_dbg_yes="-g" - flags_dbg_off="" - flags_opt_all="" - flags_opt_yes="" - flags_opt_off="" - else - AC_MSG_RESULT([no]) - fi -]) - - -dnl CARES_CHECK_COMPILER_WATCOM_C -dnl ------------------------------------------------- -dnl Verify if compiler being used is Watcom C. - -AC_DEFUN([CARES_CHECK_COMPILER_WATCOM_C], [ - AC_MSG_CHECKING([if compiler is Watcom C]) - CURL_CHECK_DEF([__WATCOMC__], [], [silent]) - if test "$cares_cv_have_def___WATCOMC__" = "yes"; then - AC_MSG_RESULT([yes]) - CURL_CHECK_DEF([__UNIX__], [], [silent]) - if test "$cares_cv_have_def___UNIX__" = "yes"; then - compiler_id="WATCOM_UNIX_C" - flags_dbg_all="-g1 -g1+ -g2 -g3" - flags_dbg_yes="-g2" - flags_dbg_off="" - flags_opt_all="-O0 -O1 -O2 -O3" - flags_opt_yes="-O2" - flags_opt_off="-O0" - else - compiler_id="WATCOM_WINDOWS_C" - flags_dbg_all="" - flags_dbg_yes="" - flags_dbg_off="" - flags_opt_all="" - flags_opt_yes="" - flags_opt_off="" - fi - else - AC_MSG_RESULT([no]) - fi -]) - - -dnl CARES_CONVERT_INCLUDE_TO_ISYSTEM -dnl ------------------------------------------------- -dnl Changes standard include paths present in CFLAGS -dnl and CPPFLAGS into isystem include paths. This is -dnl done to prevent GNUC from generating warnings on -dnl headers from these locations, although on ancient -dnl GNUC versions these warnings are not silenced. - -AC_DEFUN([CARES_CONVERT_INCLUDE_TO_ISYSTEM], [ - AC_REQUIRE([CARES_SHFUNC_SQUEEZE])dnl - AC_REQUIRE([CARES_CHECK_COMPILER])dnl - if test "$compiler_id" = "GNU_C" || - test "$compiler_id" = "CLANG"; then - tmp_has_include="no" - tmp_chg_FLAGS="$CFLAGS" - for word1 in $tmp_chg_FLAGS; do - case "$word1" in - -I*) - tmp_has_include="yes" - ;; - esac - done - if test "$tmp_has_include" = "yes"; then - tmp_chg_FLAGS=`echo "$tmp_chg_FLAGS" | "$SED" 's/^-I/ -isystem /g'` - tmp_chg_FLAGS=`echo "$tmp_chg_FLAGS" | "$SED" 's/ -I/ -isystem /g'` - CFLAGS="$tmp_chg_FLAGS" - squeeze CFLAGS - fi - tmp_has_include="no" - tmp_chg_FLAGS="$CPPFLAGS" - for word1 in $tmp_chg_FLAGS; do - case "$word1" in - -I*) - tmp_has_include="yes" - ;; - esac - done - if test "$tmp_has_include" = "yes"; then - tmp_chg_FLAGS=`echo "$tmp_chg_FLAGS" | "$SED" 's/^-I/ -isystem /g'` - tmp_chg_FLAGS=`echo "$tmp_chg_FLAGS" | "$SED" 's/ -I/ -isystem /g'` - CPPFLAGS="$tmp_chg_FLAGS" - squeeze CPPFLAGS - fi - fi -]) - - -dnl CARES_COMPILER_WORKS_IFELSE ([ACTION-IF-WORKS], [ACTION-IF-NOT-WORKS]) -dnl ------------------------------------------------- -dnl Verify if the C compiler seems to work with the -dnl settings that are 'active' at the time the test -dnl is performed. - -AC_DEFUN([CARES_COMPILER_WORKS_IFELSE], [ - dnl compilation capability verification - tmp_compiler_works="unknown" - AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM([[ - ]],[[ - int i = 1; - return i; - ]]) - ],[ - tmp_compiler_works="yes" - ],[ - tmp_compiler_works="no" - echo " " >&6 - sed 's/^/cc-fail: /' conftest.err >&6 - echo " " >&6 - ]) - dnl linking capability verification - if test "$tmp_compiler_works" = "yes"; then - AC_LINK_IFELSE([ - AC_LANG_PROGRAM([[ - ]],[[ - int i = 1; - return i; - ]]) - ],[ - tmp_compiler_works="yes" - ],[ - tmp_compiler_works="no" - echo " " >&6 - sed 's/^/link-fail: /' conftest.err >&6 - echo " " >&6 - ]) - fi - dnl only do runtime verification when not cross-compiling - if test "x$cross_compiling" != "xyes" && - test "$tmp_compiler_works" = "yes"; then - AC_RUN_IFELSE([ - AC_LANG_PROGRAM([[ -# ifdef __STDC__ -# include -# endif - ]],[[ - int i = 0; - exit(i); - ]]) - ],[ - tmp_compiler_works="yes" - ],[ - tmp_compiler_works="no" - echo " " >&6 - echo "run-fail: test program exited with status $ac_status" >&6 - echo " " >&6 - ]) - fi - dnl branch upon test result - if test "$tmp_compiler_works" = "yes"; then - ifelse($1,,:,[$1]) - ifelse($2,,,[else - $2]) - fi -]) - - -dnl CARES_SET_COMPILER_BASIC_OPTS -dnl ------------------------------------------------- -dnl Sets compiler specific options/flags which do not -dnl depend on configure's debug, optimize or warnings -dnl options. - -AC_DEFUN([CARES_SET_COMPILER_BASIC_OPTS], [ - AC_REQUIRE([CARES_CHECK_COMPILER])dnl - AC_REQUIRE([CARES_SHFUNC_SQUEEZE])dnl - # - if test "$compiler_id" != "unknown"; then - # - if test "$compiler_id" = "GNU_C" || - test "$compiler_id" = "CLANG"; then - CARES_CONVERT_INCLUDE_TO_ISYSTEM - fi - # - tmp_save_CPPFLAGS="$CPPFLAGS" - tmp_save_CFLAGS="$CFLAGS" - tmp_CPPFLAGS="" - tmp_CFLAGS="" - # - case "$compiler_id" in - # - CLANG) - # - dnl Disable warnings for unused arguments, otherwise clang will - dnl warn about compile-time arguments used during link-time, like - dnl -O and -g and -pedantic. - tmp_CFLAGS="$tmp_CFLAGS -Qunused-arguments" - ;; - # - DEC_C) - # - dnl Select strict ANSI C compiler mode - tmp_CFLAGS="$tmp_CFLAGS -std1" - dnl Turn off optimizer ANSI C aliasing rules - tmp_CFLAGS="$tmp_CFLAGS -noansi_alias" - dnl Generate warnings for missing function prototypes - tmp_CFLAGS="$tmp_CFLAGS -warnprotos" - dnl Change some warnings into fatal errors - tmp_CFLAGS="$tmp_CFLAGS -msg_fatal toofewargs,toomanyargs" - ;; - # - GNU_C) - # - dnl Placeholder - tmp_CFLAGS="$tmp_CFLAGS" - ;; - # - HP_UX_C) - # - dnl Disallow run-time dereferencing of null pointers - tmp_CFLAGS="$tmp_CFLAGS -z" - dnl Disable some remarks - dnl #4227: padding struct with n bytes to align member - dnl #4255: padding size of struct with n bytes to alignment boundary - tmp_CFLAGS="$tmp_CFLAGS +W 4227,4255" - ;; - # - IBM_C) - # - dnl Ensure that compiler optimizations are always thread-safe. - tmp_CPPFLAGS="$tmp_CPPFLAGS -qthreaded" - dnl Disable type based strict aliasing optimizations, using worst - dnl case aliasing assumptions when compiling. Type based aliasing - dnl would restrict the lvalues that could be safely used to access - dnl a data object. - tmp_CPPFLAGS="$tmp_CPPFLAGS -qnoansialias" - dnl Force compiler to stop after the compilation phase, without - dnl generating an object code file when compilation has errors. - tmp_CPPFLAGS="$tmp_CPPFLAGS -qhalt=e" - ;; - # - INTEL_UNIX_C) - # - dnl On unix this compiler uses gcc's header files, so - dnl we select ANSI C89 dialect plus GNU extensions. - tmp_CFLAGS="$tmp_CFLAGS -std=gnu89" - dnl Change some warnings into errors - dnl #140: too many arguments in function call - dnl #147: declaration is incompatible with 'previous one' - dnl #165: too few arguments in function call - dnl #266: function declared implicitly - tmp_CPPFLAGS="$tmp_CPPFLAGS -diag-error 140,147,165,266" - dnl Disable some remarks - dnl #279: controlling expression is constant - dnl #981: operands are evaluated in unspecified order - dnl #1469: "cc" clobber ignored - tmp_CPPFLAGS="$tmp_CPPFLAGS -diag-disable 279,981,1469" - ;; - # - INTEL_WINDOWS_C) - # - dnl Placeholder - tmp_CFLAGS="$tmp_CFLAGS" - ;; - # - LCC) - # - dnl Disallow run-time dereferencing of null pointers - tmp_CFLAGS="$tmp_CFLAGS -n" - ;; - # - SGI_MIPS_C) - # - dnl Placeholder - tmp_CFLAGS="$tmp_CFLAGS" - ;; - # - SGI_MIPSPRO_C) - # - dnl Placeholder - tmp_CFLAGS="$tmp_CFLAGS" - ;; - # - SUNPRO_C) - # - dnl Placeholder - tmp_CFLAGS="$tmp_CFLAGS" - ;; - # - TINY_C) - # - dnl Placeholder - tmp_CFLAGS="$tmp_CFLAGS" - ;; - # - WATCOM_UNIX_C) - # - dnl Placeholder - tmp_CFLAGS="$tmp_CFLAGS" - ;; - # - WATCOM_WINDOWS_C) - # - dnl Placeholder - tmp_CFLAGS="$tmp_CFLAGS" - ;; - # - esac - # - squeeze tmp_CPPFLAGS - squeeze tmp_CFLAGS - # - if test ! -z "$tmp_CFLAGS" || test ! -z "$tmp_CPPFLAGS"; then - AC_MSG_CHECKING([if compiler accepts some basic options]) - CPPFLAGS="$tmp_save_CPPFLAGS $tmp_CPPFLAGS" - CFLAGS="$tmp_save_CFLAGS $tmp_CFLAGS" - squeeze CPPFLAGS - squeeze CFLAGS - CARES_COMPILER_WORKS_IFELSE([ - AC_MSG_RESULT([yes]) - AC_MSG_NOTICE([compiler options added: $tmp_CFLAGS $tmp_CPPFLAGS]) - ],[ - AC_MSG_RESULT([no]) - AC_MSG_WARN([compiler options rejected: $tmp_CFLAGS $tmp_CPPFLAGS]) - dnl restore initial settings - CPPFLAGS="$tmp_save_CPPFLAGS" - CFLAGS="$tmp_save_CFLAGS" - ]) - fi - # - fi -]) - - -dnl CARES_SET_COMPILER_DEBUG_OPTS -dnl ------------------------------------------------- -dnl Sets compiler specific options/flags which depend -dnl on configure's debug option. - -AC_DEFUN([CARES_SET_COMPILER_DEBUG_OPTS], [ - AC_REQUIRE([CARES_CHECK_OPTION_DEBUG])dnl - AC_REQUIRE([CARES_CHECK_COMPILER])dnl - AC_REQUIRE([CARES_SHFUNC_SQUEEZE])dnl - # - if test "$compiler_id" != "unknown"; then - # - tmp_save_CFLAGS="$CFLAGS" - tmp_save_CPPFLAGS="$CPPFLAGS" - # - tmp_options="" - tmp_CFLAGS="$CFLAGS" - tmp_CPPFLAGS="$CPPFLAGS" - CARES_VAR_STRIP([tmp_CFLAGS],[$flags_dbg_all]) - CARES_VAR_STRIP([tmp_CPPFLAGS],[$flags_dbg_all]) - # - if test "$want_debug" = "yes"; then - AC_MSG_CHECKING([if compiler accepts debug enabling options]) - tmp_options="$flags_dbg_yes" - fi - if test "$want_debug" = "no"; then - AC_MSG_CHECKING([if compiler accepts debug disabling options]) - tmp_options="$flags_dbg_off" - fi - # - if test "$flags_prefer_cppflags" = "yes"; then - CPPFLAGS="$tmp_CPPFLAGS $tmp_options" - CFLAGS="$tmp_CFLAGS" - else - CPPFLAGS="$tmp_CPPFLAGS" - CFLAGS="$tmp_CFLAGS $tmp_options" - fi - squeeze CPPFLAGS - squeeze CFLAGS - CARES_COMPILER_WORKS_IFELSE([ - AC_MSG_RESULT([yes]) - AC_MSG_NOTICE([compiler options added: $tmp_options]) - ],[ - AC_MSG_RESULT([no]) - AC_MSG_WARN([compiler options rejected: $tmp_options]) - dnl restore initial settings - CPPFLAGS="$tmp_save_CPPFLAGS" - CFLAGS="$tmp_save_CFLAGS" - ]) - # - fi -]) - - -dnl CARES_SET_COMPILER_OPTIMIZE_OPTS -dnl ------------------------------------------------- -dnl Sets compiler specific options/flags which depend -dnl on configure's optimize option. - -AC_DEFUN([CARES_SET_COMPILER_OPTIMIZE_OPTS], [ - AC_REQUIRE([CARES_CHECK_OPTION_OPTIMIZE])dnl - AC_REQUIRE([CARES_CHECK_COMPILER])dnl - AC_REQUIRE([CARES_SHFUNC_SQUEEZE])dnl - # - if test "$compiler_id" != "unknown"; then - # - tmp_save_CFLAGS="$CFLAGS" - tmp_save_CPPFLAGS="$CPPFLAGS" - # - tmp_options="" - tmp_CFLAGS="$CFLAGS" - tmp_CPPFLAGS="$CPPFLAGS" - honor_optimize_option="yes" - # - dnl If optimization request setting has not been explicitly specified, - dnl it has been derived from the debug setting and initially assumed. - dnl This initially assumed optimizer setting will finally be ignored - dnl if CFLAGS or CPPFLAGS already hold optimizer flags. This implies - dnl that an initially assumed optimizer setting might not be honored. - # - if test "$want_optimize" = "assume_no" || - test "$want_optimize" = "assume_yes"; then - AC_MSG_CHECKING([if compiler optimizer assumed setting might be used]) - CARES_VAR_MATCH_IFELSE([tmp_CFLAGS],[$flags_opt_all],[ - honor_optimize_option="no" - ]) - CARES_VAR_MATCH_IFELSE([tmp_CPPFLAGS],[$flags_opt_all],[ - honor_optimize_option="no" - ]) - AC_MSG_RESULT([$honor_optimize_option]) - if test "$honor_optimize_option" = "yes"; then - if test "$want_optimize" = "assume_yes"; then - want_optimize="yes" - fi - if test "$want_optimize" = "assume_no"; then - want_optimize="no" - fi - fi - fi - # - if test "$honor_optimize_option" = "yes"; then - CARES_VAR_STRIP([tmp_CFLAGS],[$flags_opt_all]) - CARES_VAR_STRIP([tmp_CPPFLAGS],[$flags_opt_all]) - if test "$want_optimize" = "yes"; then - AC_MSG_CHECKING([if compiler accepts optimizer enabling options]) - tmp_options="$flags_opt_yes" - fi - if test "$want_optimize" = "no"; then - AC_MSG_CHECKING([if compiler accepts optimizer disabling options]) - tmp_options="$flags_opt_off" - fi - if test "$flags_prefer_cppflags" = "yes"; then - CPPFLAGS="$tmp_CPPFLAGS $tmp_options" - CFLAGS="$tmp_CFLAGS" - else - CPPFLAGS="$tmp_CPPFLAGS" - CFLAGS="$tmp_CFLAGS $tmp_options" - fi - squeeze CPPFLAGS - squeeze CFLAGS - CARES_COMPILER_WORKS_IFELSE([ - AC_MSG_RESULT([yes]) - AC_MSG_NOTICE([compiler options added: $tmp_options]) - ],[ - AC_MSG_RESULT([no]) - AC_MSG_WARN([compiler options rejected: $tmp_options]) - dnl restore initial settings - CPPFLAGS="$tmp_save_CPPFLAGS" - CFLAGS="$tmp_save_CFLAGS" - ]) - fi - # - fi -]) - - -dnl CARES_SET_COMPILER_WARNING_OPTS -dnl ------------------------------------------------- -dnl Sets compiler options/flags which depend on -dnl configure's warnings given option. - -AC_DEFUN([CARES_SET_COMPILER_WARNING_OPTS], [ - AC_REQUIRE([CARES_CHECK_OPTION_WARNINGS])dnl - AC_REQUIRE([CARES_CHECK_COMPILER])dnl - AC_REQUIRE([CARES_SHFUNC_SQUEEZE])dnl - # - if test "$compiler_id" != "unknown"; then - # - tmp_save_CPPFLAGS="$CPPFLAGS" - tmp_save_CFLAGS="$CFLAGS" - tmp_CPPFLAGS="" - tmp_CFLAGS="" - # - case "$compiler_id" in - # - CLANG) - # - if test "$want_warnings" = "yes"; then - tmp_CFLAGS="$tmp_CFLAGS -pedantic" - tmp_CFLAGS="$tmp_CFLAGS -Winline" - tmp_CFLAGS="$tmp_CFLAGS -Wno-long-long" - tmp_CFLAGS="$tmp_CFLAGS -Wno-multichar -Wsign-compare" - tmp_CFLAGS="$tmp_CFLAGS -Wno-format-nonliteral" - tmp_CFLAGS="$tmp_CFLAGS -Wendif-labels" - tmp_CFLAGS="$tmp_CFLAGS -Wno-system-headers" - tmp_CFLAGS="$tmp_CFLAGS -Wshorten-64-to-32" - fi - ;; - # - DEC_C) - # - if test "$want_warnings" = "yes"; then - dnl Select a higher warning level than default level2 - tmp_CFLAGS="$tmp_CFLAGS -msg_enable level3" - fi - ;; - # - GNU_C) - # - if test "$want_warnings" = "yes"; then - # - dnl Do not enable -pedantic when cross-compiling with a gcc older - dnl than 3.0, to avoid warnings from third party system headers. - if test "x$cross_compiling" != "xyes" || - test "$compiler_num" -ge "300"; then - tmp_CFLAGS="$tmp_CFLAGS -pedantic" - fi - # - dnl Set of options we believe *ALL* gcc versions support: - tmp_CFLAGS="$tmp_CFLAGS -W" - # - dnl Only gcc 2.7 or later - if test "$compiler_num" -ge "207"; then - tmp_CFLAGS="$tmp_CFLAGS -Winline" - dnl If not cross-compiling with a gcc older than 3.0 - if test "x$cross_compiling" != "xyes" || - test "$compiler_num" -ge "300"; then - tmp_CFLAGS="$tmp_CFLAGS -Wmissing-prototypes" - fi - fi - # - dnl Only gcc 2.95 or later - if test "$compiler_num" -ge "295"; then - tmp_CFLAGS="$tmp_CFLAGS -Wno-long-long" - fi - # - dnl Only gcc 2.96 or later - if test "$compiler_num" -ge "296"; then - tmp_CFLAGS="$tmp_CFLAGS -Wno-multichar -Wsign-compare" - fi - # - dnl Only gcc 2.97 or later - if test "$compiler_num" -ge "297"; then - tmp_CFLAGS="$tmp_CFLAGS -Wno-format-nonliteral" - fi - # - dnl Only gcc 3.0 or later - if test "$compiler_num" -ge "300"; then - dnl -Wunreachable-code seems totally unreliable on my gcc 3.3.2 on - dnl on i686-Linux as it gives us heaps with false positives. - dnl Also, on gcc 4.0.X it is totally unbearable and complains all - dnl over making it unusable for generic purposes. Let's not use it. - tmp_CFLAGS="$tmp_CFLAGS" - fi - # - dnl Only gcc 3.3 or later - if test "$compiler_num" -ge "303"; then - tmp_CFLAGS="$tmp_CFLAGS -Wendif-labels" - fi - # - dnl Only gcc 4.0 or later - if test "$compiler_num" -ge "400"; then - tmp_CFLAGS="$tmp_CFLAGS -Wstrict-aliasing=3" - fi - # - dnl Only gcc 4.3 or later - if test "$compiler_num" -ge "403"; then - tmp_CFLAGS="$tmp_CFLAGS -Wtype-limits -Wold-style-declaration" - tmp_CFLAGS="$tmp_CFLAGS -Wmissing-parameter-type -Wempty-body" - tmp_CFLAGS="$tmp_CFLAGS -Wclobbered -Wignored-qualifiers" - tmp_CFLAGS="$tmp_CFLAGS -Wno-sign-conversion" - fi - # - dnl Only gcc 4.5 or later - if test "$compiler_num" -ge "405"; then - dnl Only windows targets - if test "$cares_cv_have_def__WIN32" = "yes"; then - tmp_CFLAGS="$tmp_CFLAGS -Wno-pedantic-ms-format" - fi - fi - # - fi - # - dnl Do not issue warnings for code in system include paths. - if test "$compiler_num" -ge "300"; then - tmp_CFLAGS="$tmp_CFLAGS -Wno-system-headers" - else - dnl When cross-compiling with a gcc older than 3.0, disable - dnl some warnings triggered on third party system headers. - if test "x$cross_compiling" = "xyes"; then - if test "$compiler_num" -ge "104"; then - dnl gcc 1.4 or later - tmp_CFLAGS="$tmp_CFLAGS -Wno-unused -Wno-shadow" - fi - if test "$compiler_num" -ge "207"; then - dnl gcc 2.7 or later - tmp_CFLAGS="$tmp_CFLAGS -Wno-missing-declarations" - tmp_CFLAGS="$tmp_CFLAGS -Wno-missing-prototypes" - fi - fi - fi - ;; - # - HP_UX_C) - # - if test "$want_warnings" = "yes"; then - dnl Issue all warnings - tmp_CFLAGS="$tmp_CFLAGS +w1" - fi - ;; - # - IBM_C) - # - dnl Placeholder - tmp_CFLAGS="$tmp_CFLAGS" - ;; - # - INTEL_UNIX_C) - # - if test "$want_warnings" = "yes"; then - if test "$compiler_num" -gt "600"; then - dnl Show errors, warnings, and remarks - tmp_CPPFLAGS="$tmp_CPPFLAGS -w2" - dnl Perform extra compile-time code checking - tmp_CPPFLAGS="$tmp_CPPFLAGS -Wcheck" - dnl Warn on nested comments - tmp_CPPFLAGS="$tmp_CPPFLAGS -Wcomment" - dnl Show warnings relative to deprecated features - tmp_CPPFLAGS="$tmp_CPPFLAGS -Wdeprecated" - dnl Enable warnings for missing prototypes - tmp_CPPFLAGS="$tmp_CPPFLAGS -Wmissing-prototypes" - dnl Enable warnings for 64-bit portability issues - tmp_CPPFLAGS="$tmp_CPPFLAGS -Wp64" - dnl Check for function return typw issues - tmp_CPPFLAGS="$tmp_CPPFLAGS -Wreturn-type" - dnl Warn when a variable is used before initialized - tmp_CPPFLAGS="$tmp_CPPFLAGS -Wuninitialized" - dnl Warn if a declared function is not used - tmp_CPPFLAGS="$tmp_CPPFLAGS -Wunused-function" - fi - fi - dnl Disable using EBP register in optimizations - tmp_CFLAGS="$tmp_CFLAGS -fno-omit-frame-pointer" - dnl Disable use of ANSI C aliasing rules in optimizations - tmp_CFLAGS="$tmp_CFLAGS -fno-strict-aliasing" - dnl Value-safe optimizations on floating-point data - tmp_CFLAGS="$tmp_CFLAGS -fp-model precise" - dnl Only icc 10.0 or later - if test "$compiler_num" -ge "1000"; then - dnl Disable vectorizer diagnostic information - tmp_CFLAGS="$tmp_CFLAGS -vec-report0" - fi - ;; - # - INTEL_WINDOWS_C) - # - dnl Placeholder - tmp_CFLAGS="$tmp_CFLAGS" - ;; - # - LCC) - # - if test "$want_warnings" = "yes"; then - dnl Highest warning level is double -A, next is single -A. - dnl Due to the big number of warnings these trigger on third - dnl party header files it is impractical for us to use any of - dnl them here. If you want them simply define it in CPPFLAGS. - tmp_CFLAGS="$tmp_CFLAGS" - fi - ;; - # - SGI_MIPS_C) - # - if test "$want_warnings" = "yes"; then - dnl Perform stricter semantic and lint-like checks - tmp_CFLAGS="$tmp_CFLAGS -fullwarn" - fi - ;; - # - SGI_MIPSPRO_C) - # - if test "$want_warnings" = "yes"; then - dnl Perform stricter semantic and lint-like checks - tmp_CFLAGS="$tmp_CFLAGS -fullwarn" - dnl Disable some remarks - dnl #1209: controlling expression is constant - tmp_CFLAGS="$tmp_CFLAGS -woff 1209" - fi - ;; - # - SUNPRO_C) - # - if test "$want_warnings" = "yes"; then - dnl Perform stricter semantic and lint-like checks - tmp_CFLAGS="$tmp_CFLAGS -v" - fi - ;; - # - TINY_C) - # - if test "$want_warnings" = "yes"; then - dnl Activate all warnings - tmp_CFLAGS="$tmp_CFLAGS" - dnl Warn use of unsupported GCC features ignored by TCC - tmp_CFLAGS="$tmp_CFLAGS -Wunsupported" - fi - ;; - # - WATCOM_UNIX_C) - # - if test "$want_warnings" = "yes"; then - dnl Issue all warnings - tmp_CFLAGS="$tmp_CFLAGS" - fi - ;; - # - WATCOM_WINDOWS_C) - # - dnl Placeholder - tmp_CFLAGS="$tmp_CFLAGS" - ;; - # - esac - # - squeeze tmp_CPPFLAGS - squeeze tmp_CFLAGS - # - if test ! -z "$tmp_CFLAGS" || test ! -z "$tmp_CPPFLAGS"; then - AC_MSG_CHECKING([if compiler accepts strict warning options]) - CPPFLAGS="$tmp_save_CPPFLAGS $tmp_CPPFLAGS" - CFLAGS="$tmp_save_CFLAGS $tmp_CFLAGS" - squeeze CPPFLAGS - squeeze CFLAGS - CARES_COMPILER_WORKS_IFELSE([ - AC_MSG_RESULT([yes]) - AC_MSG_NOTICE([compiler options added: $tmp_CFLAGS $tmp_CPPFLAGS]) - ],[ - AC_MSG_RESULT([no]) - AC_MSG_WARN([compiler options rejected: $tmp_CFLAGS $tmp_CPPFLAGS]) - dnl restore initial settings - CPPFLAGS="$tmp_save_CPPFLAGS" - CFLAGS="$tmp_save_CFLAGS" - ]) - fi - # - fi -]) - - -dnl CARES_SHFUNC_SQUEEZE -dnl ------------------------------------------------- -dnl Declares a shell function squeeze() which removes -dnl redundant whitespace out of a shell variable. - -AC_DEFUN([CARES_SHFUNC_SQUEEZE], [ -squeeze() { - _sqz_result="" - eval _sqz_input=\[$][$]1 - for _sqz_token in $_sqz_input; do - if test -z "$_sqz_result"; then - _sqz_result="$_sqz_token" - else - _sqz_result="$_sqz_result $_sqz_token" - fi - done - eval [$]1=\$_sqz_result - return 0 -} -]) - - -dnl CARES_CHECK_COMPILER_HALT_ON_ERROR -dnl ------------------------------------------------- -dnl Verifies if the compiler actually halts after the -dnl compilation phase without generating any object -dnl code file, when the source compiles with errors. - -AC_DEFUN([CARES_CHECK_COMPILER_HALT_ON_ERROR], [ - AC_MSG_CHECKING([if compiler halts on compilation errors]) - AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM([[ - ]],[[ - force compilation error - ]]) - ],[ - AC_MSG_RESULT([no]) - AC_MSG_ERROR([compiler does not halt on compilation errors.]) - ],[ - AC_MSG_RESULT([yes]) - ]) -]) - - -dnl CARES_CHECK_COMPILER_ARRAY_SIZE_NEGATIVE -dnl ------------------------------------------------- -dnl Verifies if the compiler actually halts after the -dnl compilation phase without generating any object -dnl code file, when the source code tries to define a -dnl type for a constant array with negative dimension. - -AC_DEFUN([CARES_CHECK_COMPILER_ARRAY_SIZE_NEGATIVE], [ - AC_REQUIRE([CARES_CHECK_COMPILER_HALT_ON_ERROR])dnl - AC_MSG_CHECKING([if compiler halts on negative sized arrays]) - AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM([[ - typedef char bad_t[sizeof(char) == sizeof(int) ? -1 : -1 ]; - ]],[[ - bad_t dummy; - ]]) - ],[ - AC_MSG_RESULT([no]) - AC_MSG_ERROR([compiler does not halt on negative sized arrays.]) - ],[ - AC_MSG_RESULT([yes]) - ]) -]) - - -dnl CARES_CHECK_COMPILER_STRUCT_MEMBER_SIZE -dnl ------------------------------------------------- -dnl Verifies if the compiler is capable of handling the -dnl size of a struct member, struct which is a function -dnl result, as a compilation-time condition inside the -dnl type definition of a constant array. - -AC_DEFUN([CARES_CHECK_COMPILER_STRUCT_MEMBER_SIZE], [ - AC_REQUIRE([CARES_CHECK_COMPILER_ARRAY_SIZE_NEGATIVE])dnl - AC_MSG_CHECKING([if compiler struct member size checking works]) - tst_compiler_check_one_works="unknown" - AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM([[ - struct mystruct { - int mi; - char mc; - struct mystruct *next; - }; - struct mystruct myfunc(); - typedef char good_t1[sizeof(myfunc().mi) == sizeof(int) ? 1 : -1 ]; - typedef char good_t2[sizeof(myfunc().mc) == sizeof(char) ? 1 : -1 ]; - ]],[[ - good_t1 dummy1; - good_t2 dummy2; - ]]) - ],[ - tst_compiler_check_one_works="yes" - ],[ - tst_compiler_check_one_works="no" - sed 's/^/cc-src: /' conftest.$ac_ext >&6 - sed 's/^/cc-err: /' conftest.err >&6 - ]) - tst_compiler_check_two_works="unknown" - AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM([[ - struct mystruct { - int mi; - char mc; - struct mystruct *next; - }; - struct mystruct myfunc(); - typedef char bad_t1[sizeof(myfunc().mi) != sizeof(int) ? 1 : -1 ]; - typedef char bad_t2[sizeof(myfunc().mc) != sizeof(char) ? 1 : -1 ]; - ]],[[ - bad_t1 dummy1; - bad_t2 dummy2; - ]]) - ],[ - tst_compiler_check_two_works="no" - ],[ - tst_compiler_check_two_works="yes" - ]) - if test "$tst_compiler_check_one_works" = "yes" && - test "$tst_compiler_check_two_works" = "yes"; then - AC_MSG_RESULT([yes]) - else - AC_MSG_RESULT([no]) - AC_MSG_ERROR([compiler fails struct member size checking.]) - fi -]) - - -dnl CARES_CHECK_COMPILER_SYMBOL_HIDING -dnl ------------------------------------------------- -dnl Verify if compiler supports hiding library internal symbols, setting -dnl shell variable supports_symbol_hiding value as appropriate, as well as -dnl variables symbol_hiding_CFLAGS and symbol_hiding_EXTERN when supported. - -AC_DEFUN([CARES_CHECK_COMPILER_SYMBOL_HIDING], [ - AC_REQUIRE([CARES_CHECK_COMPILER])dnl - AC_BEFORE([$0],[CARES_CONFIGURE_SYMBOL_HIDING])dnl - AC_MSG_CHECKING([if compiler supports hiding library internal symbols]) - supports_symbol_hiding="no" - symbol_hiding_CFLAGS="" - symbol_hiding_EXTERN="" - tmp_CFLAGS="" - tmp_EXTERN="" - case "$compiler_id" in - CLANG) - dnl All versions of clang support -fvisibility= - tmp_EXTERN="__attribute__ ((__visibility__ (\"default\")))" - tmp_CFLAGS="-fvisibility=hidden" - supports_symbol_hiding="yes" - ;; - GNU_C) - dnl Only gcc 3.4 or later - if test "$compiler_num" -ge "304"; then - if $CC --help --verbose 2>&1 | grep fvisibility= > /dev/null ; then - tmp_EXTERN="__attribute__ ((__visibility__ (\"default\")))" - tmp_CFLAGS="-fvisibility=hidden" - supports_symbol_hiding="yes" - fi - fi - ;; - INTEL_UNIX_C) - dnl Only icc 9.0 or later - if test "$compiler_num" -ge "900"; then - if $CC --help --verbose 2>&1 | grep fvisibility= > /dev/null ; then - tmp_save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -fvisibility=hidden" - AC_LINK_IFELSE([ - AC_LANG_PROGRAM([[ -# include - ]],[[ - printf("icc fvisibility bug test"); - ]]) - ],[ - tmp_EXTERN="__attribute__ ((__visibility__ (\"default\")))" - tmp_CFLAGS="-fvisibility=hidden" - supports_symbol_hiding="yes" - ]) - CFLAGS="$tmp_save_CFLAGS" - fi - fi - ;; - SUNPRO_C) - if $CC 2>&1 | grep flags >/dev/null && $CC -flags | grep xldscope= >/dev/null ; then - tmp_EXTERN="__global" - tmp_CFLAGS="-xldscope=hidden" - supports_symbol_hiding="yes" - fi - ;; - esac - if test "$supports_symbol_hiding" = "yes"; then - tmp_save_CFLAGS="$CFLAGS" - CFLAGS="$tmp_save_CFLAGS $tmp_CFLAGS" - squeeze CFLAGS - AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM([[ - $tmp_EXTERN char *dummy(char *buff); - char *dummy(char *buff) - { - if(buff) - return ++buff; - else - return buff; - } - ]],[[ - char b[16]; - char *r = dummy(&b[0]); - if(r) - return (int)*r; - ]]) - ],[ - supports_symbol_hiding="yes" - if test -f conftest.err; then - grep 'visibility' conftest.err >/dev/null - if test "$?" -eq "0"; then - supports_symbol_hiding="no" - fi - fi - ],[ - supports_symbol_hiding="no" - echo " " >&6 - sed 's/^/cc-src: /' conftest.$ac_ext >&6 - sed 's/^/cc-err: /' conftest.err >&6 - echo " " >&6 - ]) - CFLAGS="$tmp_save_CFLAGS" - fi - if test "$supports_symbol_hiding" = "yes"; then - AC_MSG_RESULT([yes]) - symbol_hiding_CFLAGS="$tmp_CFLAGS" - symbol_hiding_EXTERN="$tmp_EXTERN" - else - AC_MSG_RESULT([no]) - fi -]) - - -dnl CARES_CHECK_COMPILER_PROTOTYPE_MISMATCH -dnl ------------------------------------------------- -dnl Verifies if the compiler actually halts after the -dnl compilation phase without generating any object -dnl code file, when the source code tries to redefine -dnl a prototype which does not match previous one. - -AC_DEFUN([CARES_CHECK_COMPILER_PROTOTYPE_MISMATCH], [ - AC_REQUIRE([CARES_CHECK_COMPILER_HALT_ON_ERROR])dnl - AC_MSG_CHECKING([if compiler halts on function prototype mismatch]) - AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM([[ -# include - int rand(int n); - int rand(int n) - { - if(n) - return ++n; - else - return n; - } - ]],[[ - int i[2]; - int j = rand(i[0]); - if(j) - return j; - ]]) - ],[ - AC_MSG_RESULT([no]) - AC_MSG_ERROR([compiler does not halt on function prototype mismatch.]) - ],[ - AC_MSG_RESULT([yes]) - ]) -]) - - -dnl CARES_VAR_MATCH (VARNAME, VALUE) -dnl ------------------------------------------------- -dnl Verifies if shell variable VARNAME contains VALUE. -dnl Contents of variable VARNAME and VALUE are handled -dnl as whitespace separated lists of words. If at least -dnl one word of VALUE is present in VARNAME the match -dnl is considered positive, otherwise false. - -AC_DEFUN([CARES_VAR_MATCH], [ - ac_var_match_word="no" - for word1 in $[$1]; do - for word2 in [$2]; do - if test "$word1" = "$word2"; then - ac_var_match_word="yes" - fi - done - done -]) - - -dnl CARES_VAR_MATCH_IFELSE (VARNAME, VALUE, -dnl [ACTION-IF-MATCH], [ACTION-IF-NOT-MATCH]) -dnl ------------------------------------------------- -dnl This performs a CURL_VAR_MATCH check and executes -dnl first branch if the match is positive, otherwise -dnl the second branch is executed. - -AC_DEFUN([CARES_VAR_MATCH_IFELSE], [ - CARES_VAR_MATCH([$1],[$2]) - if test "$ac_var_match_word" = "yes"; then - ifelse($3,,:,[$3]) - ifelse($4,,,[else - $4]) - fi -]) - - -dnl CARES_VAR_STRIP (VARNAME, VALUE) -dnl ------------------------------------------------- -dnl Contents of variable VARNAME and VALUE are handled -dnl as whitespace separated lists of words. Each word -dnl from VALUE is removed from VARNAME when present. - -AC_DEFUN([CARES_VAR_STRIP], [ - AC_REQUIRE([CARES_SHFUNC_SQUEEZE])dnl - ac_var_stripped="" - for word1 in $[$1]; do - ac_var_strip_word="no" - for word2 in [$2]; do - if test "$word1" = "$word2"; then - ac_var_strip_word="yes" - fi - done - if test "$ac_var_strip_word" = "no"; then - ac_var_stripped="$ac_var_stripped $word1" - fi - done - dnl squeeze whitespace out of result - [$1]="$ac_var_stripped" - squeeze [$1] -]) - diff --git a/m4/cares-confopts.m4 b/m4/cares-confopts.m4 deleted file mode 100644 index 1a42eb3b..00000000 --- a/m4/cares-confopts.m4 +++ /dev/null @@ -1,352 +0,0 @@ -#*************************************************************************** -# -# Copyright (C) Daniel Stenberg et al -# -# Permission to use, copy, modify, and distribute this software and its -# documentation for any purpose and without fee is hereby granted, provided -# that the above copyright notice appear in all copies and that both that -# copyright notice and this permission notice appear in supporting -# documentation, and that the name of M.I.T. not be used in advertising or -# publicity pertaining to distribution of the software without specific, -# written prior permission. M.I.T. makes no representations about the -# suitability of this software for any purpose. It is provided "as is" -# without express or implied warranty. -# -# SPDX-License-Identifier: MIT -#*************************************************************************** - -# File version for 'aclocal' use. Keep it a single number. -# serial 11 - - -dnl CARES_CHECK_OPTION_DEBUG -dnl ------------------------------------------------- -dnl Verify if configure has been invoked with option -dnl --enable-debug or --disable-debug, and set shell -dnl variable want_debug value as appropriate. - -AC_DEFUN([CARES_CHECK_OPTION_DEBUG], [ - AC_BEFORE([$0],[CARES_CHECK_OPTION_WARNINGS])dnl - AC_BEFORE([$0],[XC_CHECK_PROG_CC])dnl - AC_MSG_CHECKING([whether to enable debug build options]) - OPT_DEBUG_BUILD="default" - AC_ARG_ENABLE(debug, -AS_HELP_STRING([--enable-debug],[Enable debug build options]) -AS_HELP_STRING([--disable-debug],[Disable debug build options]), - OPT_DEBUG_BUILD=$enableval) - case "$OPT_DEBUG_BUILD" in - no) - dnl --disable-debug option used - want_debug="no" - ;; - default) - dnl configure option not specified - want_debug="no" - ;; - *) - dnl --enable-debug option used - want_debug="yes" - ;; - esac - AC_MSG_RESULT([$want_debug]) -]) - - -dnl CARES_CHECK_OPTION_NONBLOCKING -dnl ------------------------------------------------- -dnl Verify if configure has been invoked with option -dnl --enable-nonblocking or --disable-nonblocking, and -dnl set shell variable want_nonblocking as appropriate. - -AC_DEFUN([CARES_CHECK_OPTION_NONBLOCKING], [ - AC_BEFORE([$0],[CARES_CHECK_NONBLOCKING_SOCKET])dnl - AC_MSG_CHECKING([whether to enable non-blocking communications]) - OPT_NONBLOCKING="default" - AC_ARG_ENABLE(nonblocking, -AS_HELP_STRING([--enable-nonblocking],[Enable non-blocking communications]) -AS_HELP_STRING([--disable-nonblocking],[Disable non-blocking communications]), - OPT_NONBLOCKING=$enableval) - case "$OPT_NONBLOCKING" in - no) - dnl --disable-nonblocking option used - want_nonblocking="no" - ;; - default) - dnl configure option not specified - want_nonblocking="yes" - ;; - *) - dnl --enable-nonblocking option used - want_nonblocking="yes" - ;; - esac - AC_MSG_RESULT([$want_nonblocking]) -]) - - -dnl CARES_CHECK_OPTION_OPTIMIZE -dnl ------------------------------------------------- -dnl Verify if configure has been invoked with option -dnl --enable-optimize or --disable-optimize, and set -dnl shell variable want_optimize value as appropriate. - -AC_DEFUN([CARES_CHECK_OPTION_OPTIMIZE], [ - AC_REQUIRE([CARES_CHECK_OPTION_DEBUG])dnl - AC_BEFORE([$0],[XC_CHECK_PROG_CC])dnl - AC_MSG_CHECKING([whether to enable compiler optimizer]) - OPT_COMPILER_OPTIMIZE="default" - AC_ARG_ENABLE(optimize, -AS_HELP_STRING([--enable-optimize(=OPT)],[Enable compiler optimizations (default=-O2)]) -AS_HELP_STRING([--disable-optimize],[Disable compiler optimizations]), - OPT_COMPILER_OPTIMIZE=$enableval) - case "$OPT_COMPILER_OPTIMIZE" in - no) - dnl --disable-optimize option used. We will handle this as - dnl a request to disable compiler optimizations if possible. - dnl If the compiler is known CFLAGS and CPPFLAGS will be - dnl overridden, otherwise this can not be honored. - want_optimize="no" - AC_MSG_RESULT([no]) - ;; - default) - dnl configure's optimize option not specified. Initially we will - dnl handle this as a a request contrary to configure's setting - dnl for --enable-debug. IOW, initially, for debug-enabled builds - dnl this will be handled as a request to disable optimizations if - dnl possible, and for debug-disabled builds this will be handled - dnl initially as a request to enable optimizations if possible. - dnl Finally, if the compiler is known and CFLAGS and CPPFLAGS do - dnl not have any optimizer flag the request will be honored, in - dnl any other case the request can not be honored. - dnl IOW, existing optimizer flags defined in CFLAGS or CPPFLAGS - dnl will always take precedence over any initial assumption. - if test "$want_debug" = "yes"; then - want_optimize="assume_no" - AC_MSG_RESULT([not specified (assuming no)]) - else - want_optimize="assume_yes" - AC_MSG_RESULT([not specified (assuming yes)]) - fi - ;; - *) - dnl --enable-optimize option used. We will handle this as - dnl a request to enable compiler optimizations if possible. - dnl If the compiler is known CFLAGS and CPPFLAGS will be - dnl overridden, otherwise this can not be honored. - want_optimize="yes" - AC_MSG_RESULT([yes]) - ;; - esac -]) - - -dnl CARES_CHECK_OPTION_SYMBOL_HIDING -dnl ------------------------------------------------- -dnl Verify if configure has been invoked with option -dnl --enable-symbol-hiding or --disable-symbol-hiding, -dnl setting shell variable want_symbol_hiding value. - -AC_DEFUN([CARES_CHECK_OPTION_SYMBOL_HIDING], [ - AC_BEFORE([$0],[CARES_CHECK_COMPILER_SYMBOL_HIDING])dnl - AC_MSG_CHECKING([whether to enable hiding of library internal symbols]) - OPT_SYMBOL_HIDING="default" - AC_ARG_ENABLE(symbol-hiding, -AS_HELP_STRING([--enable-symbol-hiding],[Enable hiding of library internal symbols]) -AS_HELP_STRING([--disable-symbol-hiding],[Disable hiding of library internal symbols]), - OPT_SYMBOL_HIDING=$enableval) - case "$OPT_SYMBOL_HIDING" in - no) - dnl --disable-symbol-hiding option used. - dnl This is an indication to not attempt hiding of library internal - dnl symbols. Default symbol visibility will be used, which normally - dnl exposes all library internal symbols. - want_symbol_hiding="no" - AC_MSG_RESULT([no]) - ;; - default) - dnl configure's symbol-hiding option not specified. - dnl Handle this as if --enable-symbol-hiding option was given. - want_symbol_hiding="yes" - AC_MSG_RESULT([yes]) - ;; - *) - dnl --enable-symbol-hiding option used. - dnl This is an indication to attempt hiding of library internal - dnl symbols. This is only supported on some compilers/linkers. - want_symbol_hiding="yes" - AC_MSG_RESULT([yes]) - ;; - esac -]) - - -dnl CARES_CHECK_OPTION_EXPOSE_STATICS -dnl ------------------------------------------------- -dnl Verify if configure has been invoked with option -dnl --enable-expose-statics or --disable-expose-statics, -dnl setting shell variable want_expose_statics value. - -AC_DEFUN([CARES_CHECK_OPTION_EXPOSE_STATICS], [ - AC_MSG_CHECKING([whether to expose internal static functions for testing]) - OPT_EXPOSE_STATICS="default" - AC_ARG_ENABLE(expose-statics, -AS_HELP_STRING([--enable-expose-statics],[Enable exposure of internal static functions for testing]) -AS_HELP_STRING([--disable-expose-statics],[Disable exposure of internal static functions for testing]), - OPT_EXPOSE_STATICS=$enableval) - case "$OPT_EXPOSE_STATICS" in - no) - dnl --disable-expose-statics option used. - want_expose_statics="no" - AC_MSG_RESULT([no]) - ;; - default) - dnl configure's expose-statics option not specified. - dnl Handle this as if --disable-expose-statics option was given. - want_expose_statics="no" - AC_MSG_RESULT([no]) - ;; - *) - dnl --enable-expose-statics option used. - want_expose_statics="yes" - AC_MSG_RESULT([yes]) - ;; - esac - if test "$want_expose_statics" = "yes"; then - AC_DEFINE_UNQUOTED(CARES_EXPOSE_STATICS, 1, - [Defined for build that exposes internal static functions for testing.]) - fi -]) - - -dnl CARES_CHECK_OPTION_WARNINGS -dnl ------------------------------------------------- -dnl Verify if configure has been invoked with option -dnl --enable-warnings or --disable-warnings, and set -dnl shell variable want_warnings as appropriate. - -AC_DEFUN([CARES_CHECK_OPTION_WARNINGS], [ - AC_REQUIRE([CARES_CHECK_OPTION_DEBUG])dnl - AC_BEFORE([$0],[CARES_CHECK_OPTION_WERROR])dnl - AC_BEFORE([$0],[XC_CHECK_PROG_CC])dnl - AC_MSG_CHECKING([whether to enable strict compiler warnings]) - OPT_COMPILER_WARNINGS="yes" - AC_ARG_ENABLE(warnings, -AS_HELP_STRING([--enable-warnings],[Enable strict compiler warnings]) -AS_HELP_STRING([--disable-warnings],[Disable strict compiler warnings]), - OPT_COMPILER_WARNINGS=yes) - case "$OPT_COMPILER_WARNINGS" in - no) - dnl --disable-warnings option used - want_warnings="no" - ;; - *) - dnl --enable-warnings option used - want_warnings="yes" - ;; - esac - AC_MSG_RESULT([$want_warnings]) -]) - -dnl CARES_CHECK_OPTION_WERROR -dnl ------------------------------------------------- -dnl Verify if configure has been invoked with option -dnl --enable-werror or --disable-werror, and set -dnl shell variable want_werror as appropriate. - -AC_DEFUN([CARES_CHECK_OPTION_WERROR], [ - AC_BEFORE([$0],[CARES_CHECK_COMPILER])dnl - AC_MSG_CHECKING([whether to enable compiler warnings as errors]) - OPT_COMPILER_WERROR="default" - AC_ARG_ENABLE(werror, -AS_HELP_STRING([--enable-werror],[Enable compiler warnings as errors]) -AS_HELP_STRING([--disable-werror],[Disable compiler warnings as errors]), - OPT_COMPILER_WERROR=$enableval) - case "$OPT_COMPILER_WERROR" in - no) - dnl --disable-werror option used - want_werror="no" - ;; - default) - dnl configure option not specified - want_werror="no" - ;; - *) - dnl --enable-werror option used - want_werror="yes" - ;; - esac - AC_MSG_RESULT([$want_werror]) -]) - - -dnl CARES_CHECK_NONBLOCKING_SOCKET -dnl ------------------------------------------------- -dnl Check for how to set a socket into non-blocking state. - -AC_DEFUN([CARES_CHECK_NONBLOCKING_SOCKET], [ - AC_REQUIRE([CARES_CHECK_OPTION_NONBLOCKING])dnl - AC_REQUIRE([CARES_CHECK_FUNC_FCNTL])dnl - AC_REQUIRE([CARES_CHECK_FUNC_IOCTL])dnl - AC_REQUIRE([CARES_CHECK_FUNC_IOCTLSOCKET])dnl - AC_REQUIRE([CARES_CHECK_FUNC_IOCTLSOCKET_CAMEL])dnl - AC_REQUIRE([CARES_CHECK_FUNC_SETSOCKOPT])dnl - # - tst_method="unknown" - if test "$want_nonblocking" = "yes"; then - AC_MSG_CHECKING([how to set a socket into non-blocking mode]) - if test "x$ac_cv_func_fcntl_o_nonblock" = "xyes"; then - tst_method="fcntl O_NONBLOCK" - elif test "x$ac_cv_func_ioctl_fionbio" = "xyes"; then - tst_method="ioctl FIONBIO" - elif test "x$ac_cv_func_ioctlsocket_fionbio" = "xyes"; then - tst_method="ioctlsocket FIONBIO" - elif test "x$ac_cv_func_ioctlsocket_camel_fionbio" = "xyes"; then - tst_method="IoctlSocket FIONBIO" - elif test "x$ac_cv_func_setsockopt_so_nonblock" = "xyes"; then - tst_method="setsockopt SO_NONBLOCK" - fi - AC_MSG_RESULT([$tst_method]) - if test "$tst_method" = "unknown"; then - AC_MSG_WARN([cannot determine non-blocking socket method.]) - fi - fi - if test "$tst_method" = "unknown"; then - AC_DEFINE_UNQUOTED(USE_BLOCKING_SOCKETS, 1, - [Define to disable non-blocking sockets.]) - AC_MSG_WARN([non-blocking sockets disabled.]) - fi -]) - - -dnl CARES_CONFIGURE_SYMBOL_HIDING -dnl ------------------------------------------------- -dnl Depending on --enable-symbol-hiding or --disable-symbol-hiding -dnl configure option, and compiler capability to actually honor such -dnl option, this will modify compiler flags as appropriate and also -dnl provide needed definitions for configuration and Makefile.am files. -dnl This macro should not be used until all compilation tests have -dnl been done to prevent interferences on other tests. - -AC_DEFUN([CARES_CONFIGURE_SYMBOL_HIDING], [ - AC_MSG_CHECKING([whether hiding of library internal symbols will actually happen]) - CFLAG_CARES_SYMBOL_HIDING="" - doing_symbol_hiding="no" - if test x"$ac_cv_native_windows" != "xyes" && - test "$want_symbol_hiding" = "yes" && - test "$supports_symbol_hiding" = "yes"; then - doing_symbol_hiding="yes" - CFLAG_CARES_SYMBOL_HIDING="$symbol_hiding_CFLAGS" - AC_DEFINE_UNQUOTED(CARES_SYMBOL_SCOPE_EXTERN, $symbol_hiding_EXTERN, - [Definition to make a library symbol externally visible.]) - AC_MSG_RESULT([yes]) - else - AC_MSG_RESULT([no]) - fi - AM_CONDITIONAL(DOING_CARES_SYMBOL_HIDING, test x$doing_symbol_hiding = xyes) - AC_SUBST(CFLAG_CARES_SYMBOL_HIDING) - if test "$doing_symbol_hiding" = "yes"; then - AC_DEFINE_UNQUOTED(CARES_SYMBOL_HIDING, 1, - [Defined for build with symbol hiding.]) - fi -]) - diff --git a/m4/cares-functions.m4 b/m4/cares-functions.m4 deleted file mode 100644 index 562b915d..00000000 --- a/m4/cares-functions.m4 +++ /dev/null @@ -1,4135 +0,0 @@ -#*************************************************************************** -# -# Copyright (C) Daniel Stenberg et al -# -# Permission to use, copy, modify, and distribute this software and its -# documentation for any purpose and without fee is hereby granted, provided -# that the above copyright notice appear in all copies and that both that -# copyright notice and this permission notice appear in supporting -# documentation, and that the name of M.I.T. not be used in advertising or -# publicity pertaining to distribution of the software without specific, -# written prior permission. M.I.T. makes no representations about the -# suitability of this software for any purpose. It is provided "as is" -# without express or implied warranty. -# -# SPDX-License-Identifier: MIT -#*************************************************************************** - -# File version for 'aclocal' use. Keep it a single number. -# serial 46 - - -dnl CARES_INCLUDES_ARPA_INET -dnl ------------------------------------------------- -dnl Set up variable with list of headers that must be -dnl included when arpa/inet.h is to be included. - -AC_DEFUN([CARES_INCLUDES_ARPA_INET], [ -cares_includes_arpa_inet="\ -/* includes start */ -#ifdef HAVE_SYS_TYPES_H -# include -#endif -#ifdef HAVE_SYS_SOCKET_H -# include -#endif -#ifdef HAVE_NETINET_IN_H -# include -#endif -#ifdef HAVE_ARPA_INET_H -# include -#endif -/* includes end */" - AC_CHECK_HEADERS( - sys/types.h sys/socket.h netinet/in.h arpa/inet.h, - [], [], [$cares_includes_arpa_inet]) -]) - - -dnl CARES_INCLUDES_FCNTL -dnl ------------------------------------------------- -dnl Set up variable with list of headers that must be -dnl included when fcntl.h is to be included. - -AC_DEFUN([CARES_INCLUDES_FCNTL], [ -cares_includes_fcntl="\ -/* includes start */ -#ifdef HAVE_SYS_TYPES_H -# include -#endif -#ifdef HAVE_UNISTD_H -# include -#endif -#ifdef HAVE_FCNTL_H -# include -#endif -/* includes end */" - AC_CHECK_HEADERS( - sys/types.h unistd.h fcntl.h, - [], [], [$cares_includes_fcntl]) -]) - - -dnl CARES_INCLUDES_NETDB -dnl ------------------------------------------------- -dnl Set up variable with list of headers that must be -dnl included when netdb.h is to be included. - -AC_DEFUN([CARES_INCLUDES_NETDB], [ -cares_includes_netdb="\ -/* includes start */ -#ifdef HAVE_SYS_TYPES_H -# include -#endif -#ifdef HAVE_NETDB_H -# include -#endif -/* includes end */" - AC_CHECK_HEADERS( - sys/types.h netdb.h, - [], [], [$cares_includes_netdb]) -]) - - -dnl CARES_INCLUDES_SOCKET -dnl ------------------------------------------------- -dnl Set up variable with list of headers that must be -dnl included when socket.h is to be included. - -AC_DEFUN([CARES_INCLUDES_SOCKET], [ -cares_includes_socket="\ -/* includes start */ -#ifdef HAVE_SYS_TYPES_H -# include -#endif -#ifdef HAVE_SOCKET_H -# include -#endif -/* includes end */" - AC_CHECK_HEADERS( - sys/types.h socket.h, - [], [], [$cares_includes_socket]) -]) - - -dnl CARES_INCLUDES_STDLIB -dnl ------------------------------------------------- -dnl Set up variable with list of headers that must be -dnl included when stdlib.h is to be included. - -AC_DEFUN([CARES_INCLUDES_STDLIB], [ -cares_includes_stdlib="\ -/* includes start */ -#ifdef HAVE_SYS_TYPES_H -# include -#endif -#ifdef HAVE_STDLIB_H -# include -#endif -/* includes end */" - AC_CHECK_HEADERS( - sys/types.h stdlib.h, - [], [], [$cares_includes_stdlib]) -]) - - -dnl CARES_INCLUDES_STRING -dnl ------------------------------------------------- -dnl Set up variable with list of headers that must be -dnl included when string(s).h is to be included. - -AC_DEFUN([CARES_INCLUDES_STRING], [ -cares_includes_string="\ -/* includes start */ -#ifdef HAVE_SYS_TYPES_H -# include -#endif -#ifdef HAVE_STRING_H -# include -#endif -#ifdef HAVE_STRINGS_H -# include -#endif -/* includes end */" - AC_CHECK_HEADERS( - sys/types.h string.h strings.h, - [], [], [$cares_includes_string]) -]) - - -dnl CARES_INCLUDES_STROPTS -dnl ------------------------------------------------- -dnl Set up variable with list of headers that must be -dnl included when stropts.h is to be included. - -AC_DEFUN([CARES_INCLUDES_STROPTS], [ -cares_includes_stropts="\ -/* includes start */ -#ifdef HAVE_SYS_TYPES_H -# include -#endif -#ifdef HAVE_UNISTD_H -# include -#endif -#ifdef HAVE_SYS_SOCKET_H -# include -#endif -#ifdef HAVE_SYS_IOCTL_H -# include -#endif -#ifdef HAVE_STROPTS_H -# include -#endif -/* includes end */" - AC_CHECK_HEADERS( - sys/types.h unistd.h sys/socket.h sys/ioctl.h stropts.h, - [], [], [$cares_includes_stropts]) -]) - - -dnl CARES_INCLUDES_SYS_RANDOM -dnl ------------------------------------------------- -dnl Set up variable with list of headers that must be -dnl included when sys/random.h is to be included. - -AC_DEFUN([CARES_INCLUDES_SYS_RANDOM], [ -cares_includes_sys_random="\ -/* includes start */ -#ifdef HAVE_SYS_RANDOM_H -# include -#endif -/* includes end */" - AC_CHECK_HEADERS( - sys/random.h, - [], [], [$cares_includes_sys_random]) -]) - - -dnl CARES_INCLUDES_SYS_SOCKET -dnl ------------------------------------------------- -dnl Set up variable with list of headers that must be -dnl included when sys/socket.h is to be included. - -AC_DEFUN([CARES_INCLUDES_SYS_SOCKET], [ -cares_includes_sys_socket="\ -/* includes start */ -#ifdef HAVE_SYS_TYPES_H -# include -#endif -#ifdef HAVE_SYS_SOCKET_H -# include -#endif -/* includes end */" - AC_CHECK_HEADERS( - sys/types.h sys/socket.h, - [], [], [$cares_includes_sys_socket]) -]) - - -dnl CARES_INCLUDES_SYS_TYPES -dnl ------------------------------------------------- -dnl Set up variable with list of headers that must be -dnl included when sys/types.h is to be included. - -AC_DEFUN([CARES_INCLUDES_SYS_TYPES], [ -cares_includes_sys_types="\ -/* includes start */ -#ifdef HAVE_SYS_TYPES_H -# include -#endif -/* includes end */" - AC_CHECK_HEADERS( - sys/types.h, - [], [], [$cares_includes_sys_types]) -]) - - -dnl CARES_INCLUDES_SYS_UIO -dnl ------------------------------------------------- -dnl Set up variable with list of headers that must be -dnl included when sys/uio.h is to be included. - -AC_DEFUN([CARES_INCLUDES_SYS_UIO], [ -cares_includes_sys_uio="\ -/* includes start */ -#ifdef HAVE_SYS_TYPES_H -# include -#endif -#ifdef HAVE_SYS_UIO_H -# include -#endif -/* includes end */" - AC_CHECK_HEADERS( - sys/types.h sys/uio.h, - [], [], [$cares_includes_sys_uio]) -]) - - -dnl CARES_INCLUDES_SYS_STAT -dnl ------------------------------------------------- -dnl Set up variable with list of headers that must be -dnl included when sys/stat.h is to be included. - -AC_DEFUN([CARES_INCLUDES_SYS_STAT], [ -cares_includes_sys_stat="\ -/* includes start */ -#ifdef HAVE_SYS_TYPES_H -# include -#endif -#ifdef HAVE_SYS_STAT_H -# include -#endif -/* includes end */" - AC_CHECK_HEADERS( - sys/types.h sys/stat.h, - [], [], [$cares_includes_sys_stat]) -]) - -dnl CARES_INCLUDES_UNISTD -dnl ------------------------------------------------- -dnl Set up variable with list of headers that must be -dnl included when unistd.h is to be included. - -AC_DEFUN([CARES_INCLUDES_UNISTD], [ -cares_includes_unistd="\ -/* includes start */ -#ifdef HAVE_SYS_TYPES_H -# include -#endif -#ifdef HAVE_UNISTD_H -# include -#endif -/* includes end */" - AC_CHECK_HEADERS( - sys/types.h unistd.h, - [], [], [$cares_includes_unistd]) -]) - - -dnl CARES_INCLUDES_WINSOCK2 -dnl ------------------------------------------------- -dnl Set up variable with list of headers that must be -dnl included when winsock(2).h is to be included. - -AC_DEFUN([CARES_INCLUDES_WINSOCK2], [ -cares_includes_winsock2="\ -/* includes start */ -#ifdef HAVE_WINDOWS_H -# ifndef WIN32_LEAN_AND_MEAN -# define WIN32_LEAN_AND_MEAN -# endif -# include -# ifdef HAVE_WINSOCK2_H -# include -# else -# ifdef HAVE_WINSOCK_H -# include -# endif -# endif -#endif -/* includes end */" - CURL_CHECK_HEADER_WINDOWS - CURL_CHECK_HEADER_WINSOCK - CURL_CHECK_HEADER_WINSOCK2 -]) - - -dnl CARES_INCLUDES_WS2TCPIP -dnl ------------------------------------------------- -dnl Set up variable with list of headers that must be -dnl included when ws2tcpip.h is to be included. - -AC_DEFUN([CARES_INCLUDES_WS2TCPIP], [ -cares_includes_ws2tcpip="\ -/* includes start */ -#ifdef HAVE_WINDOWS_H -# ifndef WIN32_LEAN_AND_MEAN -# define WIN32_LEAN_AND_MEAN -# endif -# include -# ifdef HAVE_WINSOCK2_H -# include -# ifdef HAVE_WS2TCPIP_H -# include -# endif -# endif -#endif -/* includes end */" - CURL_CHECK_HEADER_WINDOWS - CURL_CHECK_HEADER_WINSOCK2 - CURL_CHECK_HEADER_WS2TCPIP -]) - - -dnl CARES_PREPROCESS_CALLCONV -dnl ------------------------------------------------- -dnl Set up variable with a preprocessor block which -dnl defines function calling convention. - -AC_DEFUN([CARES_PREPROCESS_CALLCONV], [ -cares_preprocess_callconv="\ -/* preprocess start */ -#ifdef HAVE_WINDOWS_H -# define FUNCALLCONV __stdcall -#else -# define FUNCALLCONV -#endif -/* preprocess end */" -]) - - -dnl CARES_CHECK_FUNC_CLOSESOCKET -dnl ------------------------------------------------- -dnl Verify if closesocket is available, prototyped, and -dnl can be compiled. If all of these are true, and -dnl usage has not been previously disallowed with -dnl shell variable cares_disallow_closesocket, then -dnl HAVE_CLOSESOCKET will be defined. - -AC_DEFUN([CARES_CHECK_FUNC_CLOSESOCKET], [ - AC_REQUIRE([CARES_INCLUDES_WINSOCK2])dnl - AC_REQUIRE([CARES_INCLUDES_SOCKET])dnl - # - tst_links_closesocket="unknown" - tst_proto_closesocket="unknown" - tst_compi_closesocket="unknown" - tst_allow_closesocket="unknown" - # - AC_MSG_CHECKING([if closesocket can be linked]) - AC_LINK_IFELSE([ - AC_LANG_PROGRAM([[ - $cares_includes_winsock2 - $cares_includes_socket - ]],[[ - if(0 != closesocket(0)) - return 1; - ]]) - ],[ - AC_MSG_RESULT([yes]) - tst_links_closesocket="yes" - ],[ - AC_MSG_RESULT([no]) - tst_links_closesocket="no" - ]) - # - if test "$tst_links_closesocket" = "yes"; then - AC_MSG_CHECKING([if closesocket is prototyped]) - AC_EGREP_CPP([closesocket],[ - $cares_includes_winsock2 - $cares_includes_socket - ],[ - AC_MSG_RESULT([yes]) - tst_proto_closesocket="yes" - ],[ - AC_MSG_RESULT([no]) - tst_proto_closesocket="no" - ]) - fi - # - if test "$tst_proto_closesocket" = "yes"; then - AC_MSG_CHECKING([if closesocket is compilable]) - AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM([[ - $cares_includes_winsock2 - $cares_includes_socket - ]],[[ - if(0 != closesocket(0)) - return 1; - ]]) - ],[ - AC_MSG_RESULT([yes]) - tst_compi_closesocket="yes" - ],[ - AC_MSG_RESULT([no]) - tst_compi_closesocket="no" - ]) - fi - # - if test "$tst_compi_closesocket" = "yes"; then - AC_MSG_CHECKING([if closesocket usage allowed]) - if test "x$cares_disallow_closesocket" != "xyes"; then - AC_MSG_RESULT([yes]) - tst_allow_closesocket="yes" - else - AC_MSG_RESULT([no]) - tst_allow_closesocket="no" - fi - fi - # - AC_MSG_CHECKING([if closesocket might be used]) - if test "$tst_links_closesocket" = "yes" && - test "$tst_proto_closesocket" = "yes" && - test "$tst_compi_closesocket" = "yes" && - test "$tst_allow_closesocket" = "yes"; then - AC_MSG_RESULT([yes]) - AC_DEFINE_UNQUOTED(HAVE_CLOSESOCKET, 1, - [Define to 1 if you have the closesocket function.]) - ac_cv_func_closesocket="yes" - else - AC_MSG_RESULT([no]) - ac_cv_func_closesocket="no" - fi -]) - - -dnl CARES_CHECK_FUNC_CLOSESOCKET_CAMEL -dnl ------------------------------------------------- -dnl Verify if CloseSocket is available, prototyped, and -dnl can be compiled. If all of these are true, and -dnl usage has not been previously disallowed with -dnl shell variable cares_disallow_closesocket_camel, -dnl then HAVE_CLOSESOCKET_CAMEL will be defined. - -AC_DEFUN([CARES_CHECK_FUNC_CLOSESOCKET_CAMEL], [ - AC_REQUIRE([CARES_INCLUDES_SYS_SOCKET])dnl - # - tst_links_closesocket_camel="unknown" - tst_proto_closesocket_camel="unknown" - tst_compi_closesocket_camel="unknown" - tst_allow_closesocket_camel="unknown" - # - AC_MSG_CHECKING([if CloseSocket can be linked]) - AC_LINK_IFELSE([ - AC_LANG_PROGRAM([[ - $cares_includes_sys_socket - ]],[[ - if(0 != CloseSocket(0)) - return 1; - ]]) - ],[ - AC_MSG_RESULT([yes]) - tst_links_closesocket_camel="yes" - ],[ - AC_MSG_RESULT([no]) - tst_links_closesocket_camel="no" - ]) - # - if test "$tst_links_closesocket_camel" = "yes"; then - AC_MSG_CHECKING([if CloseSocket is prototyped]) - AC_EGREP_CPP([CloseSocket],[ - $cares_includes_sys_socket - ],[ - AC_MSG_RESULT([yes]) - tst_proto_closesocket_camel="yes" - ],[ - AC_MSG_RESULT([no]) - tst_proto_closesocket_camel="no" - ]) - fi - # - if test "$tst_proto_closesocket_camel" = "yes"; then - AC_MSG_CHECKING([if CloseSocket is compilable]) - AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM([[ - $cares_includes_sys_socket - ]],[[ - if(0 != CloseSocket(0)) - return 1; - ]]) - ],[ - AC_MSG_RESULT([yes]) - tst_compi_closesocket_camel="yes" - ],[ - AC_MSG_RESULT([no]) - tst_compi_closesocket_camel="no" - ]) - fi - # - if test "$tst_compi_closesocket_camel" = "yes"; then - AC_MSG_CHECKING([if CloseSocket usage allowed]) - if test "x$cares_disallow_closesocket_camel" != "xyes"; then - AC_MSG_RESULT([yes]) - tst_allow_closesocket_camel="yes" - else - AC_MSG_RESULT([no]) - tst_allow_closesocket_camel="no" - fi - fi - # - AC_MSG_CHECKING([if CloseSocket might be used]) - if test "$tst_links_closesocket_camel" = "yes" && - test "$tst_proto_closesocket_camel" = "yes" && - test "$tst_compi_closesocket_camel" = "yes" && - test "$tst_allow_closesocket_camel" = "yes"; then - AC_MSG_RESULT([yes]) - AC_DEFINE_UNQUOTED(HAVE_CLOSESOCKET_CAMEL, 1, - [Define to 1 if you have the CloseSocket camel case function.]) - ac_cv_func_closesocket_camel="yes" - else - AC_MSG_RESULT([no]) - ac_cv_func_closesocket_camel="no" - fi -]) - - -dnl CARES_CHECK_FUNC_CONNECT -dnl ------------------------------------------------- -dnl Verify if connect is available, prototyped, and -dnl can be compiled. If all of these are true, and -dnl usage has not been previously disallowed with -dnl shell variable cares_disallow_connect, then -dnl HAVE_CONNECT will be defined. - -AC_DEFUN([CARES_CHECK_FUNC_CONNECT], [ - AC_REQUIRE([CARES_INCLUDES_WINSOCK2])dnl - AC_REQUIRE([CARES_INCLUDES_SYS_SOCKET])dnl - AC_REQUIRE([CARES_INCLUDES_SOCKET])dnl - # - tst_links_connect="unknown" - tst_proto_connect="unknown" - tst_compi_connect="unknown" - tst_allow_connect="unknown" - # - AC_MSG_CHECKING([if connect can be linked]) - AC_LINK_IFELSE([ - AC_LANG_PROGRAM([[ - $cares_includes_winsock2 - $cares_includes_sys_socket - $cares_includes_socket - ]],[[ - if(0 != connect(0, 0, 0)) - return 1; - ]]) - ],[ - AC_MSG_RESULT([yes]) - tst_links_connect="yes" - ],[ - AC_MSG_RESULT([no]) - tst_links_connect="no" - ]) - # - if test "$tst_links_connect" = "yes"; then - AC_MSG_CHECKING([if connect is prototyped]) - AC_EGREP_CPP([connect],[ - $cares_includes_winsock2 - $cares_includes_sys_socket - $cares_includes_socket - ],[ - AC_MSG_RESULT([yes]) - tst_proto_connect="yes" - ],[ - AC_MSG_RESULT([no]) - tst_proto_connect="no" - ]) - fi - # - if test "$tst_proto_connect" = "yes"; then - AC_MSG_CHECKING([if connect is compilable]) - AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM([[ - $cares_includes_winsock2 - $cares_includes_sys_socket - $cares_includes_socket - ]],[[ - if(0 != connect(0, 0, 0)) - return 1; - ]]) - ],[ - AC_MSG_RESULT([yes]) - tst_compi_connect="yes" - ],[ - AC_MSG_RESULT([no]) - tst_compi_connect="no" - ]) - fi - # - if test "$tst_compi_connect" = "yes"; then - AC_MSG_CHECKING([if connect usage allowed]) - if test "x$cares_disallow_connect" != "xyes"; then - AC_MSG_RESULT([yes]) - tst_allow_connect="yes" - else - AC_MSG_RESULT([no]) - tst_allow_connect="no" - fi - fi - # - AC_MSG_CHECKING([if connect might be used]) - if test "$tst_links_connect" = "yes" && - test "$tst_proto_connect" = "yes" && - test "$tst_compi_connect" = "yes" && - test "$tst_allow_connect" = "yes"; then - AC_MSG_RESULT([yes]) - AC_DEFINE_UNQUOTED(HAVE_CONNECT, 1, - [Define to 1 if you have the connect function.]) - ac_cv_func_connect="yes" - else - AC_MSG_RESULT([no]) - ac_cv_func_connect="no" - fi -]) - - -dnl CARES_CHECK_FUNC_FCNTL -dnl ------------------------------------------------- -dnl Verify if fcntl is available, prototyped, and -dnl can be compiled. If all of these are true, and -dnl usage has not been previously disallowed with -dnl shell variable cares_disallow_fcntl, then -dnl HAVE_FCNTL will be defined. - -AC_DEFUN([CARES_CHECK_FUNC_FCNTL], [ - AC_REQUIRE([CARES_INCLUDES_FCNTL])dnl - # - tst_links_fcntl="unknown" - tst_proto_fcntl="unknown" - tst_compi_fcntl="unknown" - tst_allow_fcntl="unknown" - # - AC_MSG_CHECKING([if fcntl can be linked]) - AC_LINK_IFELSE([ - AC_LANG_FUNC_LINK_TRY([fcntl]) - ],[ - AC_MSG_RESULT([yes]) - tst_links_fcntl="yes" - ],[ - AC_MSG_RESULT([no]) - tst_links_fcntl="no" - ]) - # - if test "$tst_links_fcntl" = "yes"; then - AC_MSG_CHECKING([if fcntl is prototyped]) - AC_EGREP_CPP([fcntl],[ - $cares_includes_fcntl - ],[ - AC_MSG_RESULT([yes]) - tst_proto_fcntl="yes" - ],[ - AC_MSG_RESULT([no]) - tst_proto_fcntl="no" - ]) - fi - # - if test "$tst_proto_fcntl" = "yes"; then - AC_MSG_CHECKING([if fcntl is compilable]) - AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM([[ - $cares_includes_fcntl - ]],[[ - if(0 != fcntl(0, 0, 0)) - return 1; - ]]) - ],[ - AC_MSG_RESULT([yes]) - tst_compi_fcntl="yes" - ],[ - AC_MSG_RESULT([no]) - tst_compi_fcntl="no" - ]) - fi - # - if test "$tst_compi_fcntl" = "yes"; then - AC_MSG_CHECKING([if fcntl usage allowed]) - if test "x$cares_disallow_fcntl" != "xyes"; then - AC_MSG_RESULT([yes]) - tst_allow_fcntl="yes" - else - AC_MSG_RESULT([no]) - tst_allow_fcntl="no" - fi - fi - # - AC_MSG_CHECKING([if fcntl might be used]) - if test "$tst_links_fcntl" = "yes" && - test "$tst_proto_fcntl" = "yes" && - test "$tst_compi_fcntl" = "yes" && - test "$tst_allow_fcntl" = "yes"; then - AC_MSG_RESULT([yes]) - AC_DEFINE_UNQUOTED(HAVE_FCNTL, 1, - [Define to 1 if you have the fcntl function.]) - ac_cv_func_fcntl="yes" - CARES_CHECK_FUNC_FCNTL_O_NONBLOCK - else - AC_MSG_RESULT([no]) - ac_cv_func_fcntl="no" - fi -]) - - -dnl CARES_CHECK_FUNC_FCNTL_O_NONBLOCK -dnl ------------------------------------------------- -dnl Verify if fcntl with status flag O_NONBLOCK is -dnl available, can be compiled, and seems to work. If -dnl all of these are true, then HAVE_FCNTL_O_NONBLOCK -dnl will be defined. - -AC_DEFUN([CARES_CHECK_FUNC_FCNTL_O_NONBLOCK], [ - # - tst_compi_fcntl_o_nonblock="unknown" - tst_allow_fcntl_o_nonblock="unknown" - # - case $host_os in - sunos4* | aix3* | beos*) - dnl O_NONBLOCK does not work on these platforms - cares_disallow_fcntl_o_nonblock="yes" - ;; - esac - # - if test "$ac_cv_func_fcntl" = "yes"; then - AC_MSG_CHECKING([if fcntl O_NONBLOCK is compilable]) - AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM([[ - $cares_includes_fcntl - ]],[[ - int flags = 0; - if(0 != fcntl(0, F_SETFL, flags | O_NONBLOCK)) - return 1; - ]]) - ],[ - AC_MSG_RESULT([yes]) - tst_compi_fcntl_o_nonblock="yes" - ],[ - AC_MSG_RESULT([no]) - tst_compi_fcntl_o_nonblock="no" - ]) - fi - # - if test "$tst_compi_fcntl_o_nonblock" = "yes"; then - AC_MSG_CHECKING([if fcntl O_NONBLOCK usage allowed]) - if test "x$cares_disallow_fcntl_o_nonblock" != "xyes"; then - AC_MSG_RESULT([yes]) - tst_allow_fcntl_o_nonblock="yes" - else - AC_MSG_RESULT([no]) - tst_allow_fcntl_o_nonblock="no" - fi - fi - # - AC_MSG_CHECKING([if fcntl O_NONBLOCK might be used]) - if test "$tst_compi_fcntl_o_nonblock" = "yes" && - test "$tst_allow_fcntl_o_nonblock" = "yes"; then - AC_MSG_RESULT([yes]) - AC_DEFINE_UNQUOTED(HAVE_FCNTL_O_NONBLOCK, 1, - [Define to 1 if you have a working fcntl O_NONBLOCK function.]) - ac_cv_func_fcntl_o_nonblock="yes" - else - AC_MSG_RESULT([no]) - ac_cv_func_fcntl_o_nonblock="no" - fi -]) - - -dnl CARES_CHECK_FUNC_FREEADDRINFO -dnl ------------------------------------------------- -dnl Verify if freeaddrinfo is available, prototyped, -dnl and can be compiled. If all of these are true, -dnl and usage has not been previously disallowed with -dnl shell variable cares_disallow_freeaddrinfo, then -dnl HAVE_FREEADDRINFO will be defined. - -AC_DEFUN([CARES_CHECK_FUNC_FREEADDRINFO], [ - AC_REQUIRE([CARES_INCLUDES_WS2TCPIP])dnl - AC_REQUIRE([CARES_INCLUDES_SYS_SOCKET])dnl - AC_REQUIRE([CARES_INCLUDES_NETDB])dnl - # - tst_links_freeaddrinfo="unknown" - tst_proto_freeaddrinfo="unknown" - tst_compi_freeaddrinfo="unknown" - tst_allow_freeaddrinfo="unknown" - # - AC_MSG_CHECKING([if freeaddrinfo can be linked]) - AC_LINK_IFELSE([ - AC_LANG_PROGRAM([[ - $cares_includes_ws2tcpip - $cares_includes_sys_socket - $cares_includes_netdb - ]],[[ - freeaddrinfo(0); - ]]) - ],[ - AC_MSG_RESULT([yes]) - tst_links_freeaddrinfo="yes" - ],[ - AC_MSG_RESULT([no]) - tst_links_freeaddrinfo="no" - ]) - # - if test "$tst_links_freeaddrinfo" = "yes"; then - AC_MSG_CHECKING([if freeaddrinfo is prototyped]) - AC_EGREP_CPP([freeaddrinfo],[ - $cares_includes_ws2tcpip - $cares_includes_sys_socket - $cares_includes_netdb - ],[ - AC_MSG_RESULT([yes]) - tst_proto_freeaddrinfo="yes" - ],[ - AC_MSG_RESULT([no]) - tst_proto_freeaddrinfo="no" - ]) - fi - # - if test "$tst_proto_freeaddrinfo" = "yes"; then - AC_MSG_CHECKING([if freeaddrinfo is compilable]) - AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM([[ - $cares_includes_ws2tcpip - $cares_includes_sys_socket - $cares_includes_netdb - ]],[[ - freeaddrinfo(0); - ]]) - ],[ - AC_MSG_RESULT([yes]) - tst_compi_freeaddrinfo="yes" - ],[ - AC_MSG_RESULT([no]) - tst_compi_freeaddrinfo="no" - ]) - fi - # - if test "$tst_compi_freeaddrinfo" = "yes"; then - AC_MSG_CHECKING([if freeaddrinfo usage allowed]) - if test "x$cares_disallow_freeaddrinfo" != "xyes"; then - AC_MSG_RESULT([yes]) - tst_allow_freeaddrinfo="yes" - else - AC_MSG_RESULT([no]) - tst_allow_freeaddrinfo="no" - fi - fi - # - AC_MSG_CHECKING([if freeaddrinfo might be used]) - if test "$tst_links_freeaddrinfo" = "yes" && - test "$tst_proto_freeaddrinfo" = "yes" && - test "$tst_compi_freeaddrinfo" = "yes" && - test "$tst_allow_freeaddrinfo" = "yes"; then - AC_MSG_RESULT([yes]) - AC_DEFINE_UNQUOTED(HAVE_FREEADDRINFO, 1, - [Define to 1 if you have the freeaddrinfo function.]) - ac_cv_func_freeaddrinfo="yes" - else - AC_MSG_RESULT([no]) - ac_cv_func_freeaddrinfo="no" - fi -]) - - -dnl CARES_CHECK_FUNC_GETADDRINFO -dnl ------------------------------------------------- -dnl Verify if getaddrinfo is available, prototyped, can -dnl be compiled and seems to work. If all of these are -dnl true, and usage has not been previously disallowed -dnl with shell variable cares_disallow_getaddrinfo, then -dnl HAVE_GETADDRINFO will be defined. Additionally when -dnl HAVE_GETADDRINFO gets defined this will also attempt -dnl to find out if getaddrinfo happens to be threadsafe, -dnl defining HAVE_GETADDRINFO_THREADSAFE when true. - -AC_DEFUN([CARES_CHECK_FUNC_GETADDRINFO], [ - AC_REQUIRE([CARES_INCLUDES_WS2TCPIP])dnl - AC_REQUIRE([CARES_INCLUDES_STDLIB])dnl - AC_REQUIRE([CARES_INCLUDES_STRING])dnl - AC_REQUIRE([CARES_INCLUDES_SYS_SOCKET])dnl - AC_REQUIRE([CARES_INCLUDES_NETDB])dnl - AC_REQUIRE([CURL_CHECK_NATIVE_WINDOWS])dnl - # - tst_links_getaddrinfo="unknown" - tst_proto_getaddrinfo="unknown" - tst_compi_getaddrinfo="unknown" - tst_works_getaddrinfo="unknown" - tst_allow_getaddrinfo="unknown" - tst_tsafe_getaddrinfo="unknown" - # - AC_MSG_CHECKING([if getaddrinfo can be linked]) - AC_LINK_IFELSE([ - AC_LANG_PROGRAM([[ - $cares_includes_ws2tcpip - $cares_includes_sys_socket - $cares_includes_netdb - ]],[[ - if(0 != getaddrinfo(0, 0, 0, 0)) - return 1; - ]]) - ],[ - AC_MSG_RESULT([yes]) - tst_links_getaddrinfo="yes" - ],[ - AC_MSG_RESULT([no]) - tst_links_getaddrinfo="no" - ]) - # - if test "$tst_links_getaddrinfo" = "yes"; then - AC_MSG_CHECKING([if getaddrinfo is prototyped]) - AC_EGREP_CPP([getaddrinfo],[ - $cares_includes_ws2tcpip - $cares_includes_sys_socket - $cares_includes_netdb - ],[ - AC_MSG_RESULT([yes]) - tst_proto_getaddrinfo="yes" - ],[ - AC_MSG_RESULT([no]) - tst_proto_getaddrinfo="no" - ]) - fi - # - if test "$tst_proto_getaddrinfo" = "yes"; then - AC_MSG_CHECKING([if getaddrinfo is compilable]) - AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM([[ - $cares_includes_ws2tcpip - $cares_includes_sys_socket - $cares_includes_netdb - ]],[[ - if(0 != getaddrinfo(0, 0, 0, 0)) - return 1; - ]]) - ],[ - AC_MSG_RESULT([yes]) - tst_compi_getaddrinfo="yes" - ],[ - AC_MSG_RESULT([no]) - tst_compi_getaddrinfo="no" - ]) - fi - # - dnl only do runtime verification when not cross-compiling - if test "x$cross_compiling" != "xyes" && - test "$tst_compi_getaddrinfo" = "yes"; then - AC_MSG_CHECKING([if getaddrinfo seems to work]) - AC_RUN_IFELSE([ - AC_LANG_PROGRAM([[ - $cares_includes_ws2tcpip - $cares_includes_stdlib - $cares_includes_string - $cares_includes_sys_socket - $cares_includes_netdb - ]],[[ - struct addrinfo hints; - struct addrinfo *ai = 0; - int error; - - memset(&hints, 0, sizeof(hints)); - hints.ai_flags = AI_NUMERICHOST; - hints.ai_family = AF_UNSPEC; - hints.ai_socktype = SOCK_STREAM; - error = getaddrinfo("127.0.0.1", 0, &hints, &ai); - if(error || !ai) - exit(1); /* fail */ - else - exit(0); - ]]) - ],[ - AC_MSG_RESULT([yes]) - tst_works_getaddrinfo="yes" - ],[ - AC_MSG_RESULT([no]) - tst_works_getaddrinfo="no" - ]) - fi - # - if test "$tst_compi_getaddrinfo" = "yes" && - test "$tst_works_getaddrinfo" != "no"; then - AC_MSG_CHECKING([if getaddrinfo usage allowed]) - if test "x$cares_disallow_getaddrinfo" != "xyes"; then - AC_MSG_RESULT([yes]) - tst_allow_getaddrinfo="yes" - else - AC_MSG_RESULT([no]) - tst_allow_getaddrinfo="no" - fi - fi - # - AC_MSG_CHECKING([if getaddrinfo might be used]) - if test "$tst_links_getaddrinfo" = "yes" && - test "$tst_proto_getaddrinfo" = "yes" && - test "$tst_compi_getaddrinfo" = "yes" && - test "$tst_allow_getaddrinfo" = "yes" && - test "$tst_works_getaddrinfo" != "no"; then - AC_MSG_RESULT([yes]) - AC_DEFINE_UNQUOTED(HAVE_GETADDRINFO, 1, - [Define to 1 if you have a working getaddrinfo function.]) - ac_cv_func_getaddrinfo="yes" - else - AC_MSG_RESULT([no]) - ac_cv_func_getaddrinfo="no" - ac_cv_func_getaddrinfo_threadsafe="no" - fi - # - if test "$ac_cv_func_getaddrinfo" = "yes"; then - AC_MSG_CHECKING([if getaddrinfo is threadsafe]) - case $host_os in - aix[[1234]].* | aix5.[[01]].*) - dnl aix 5.1 and older - tst_tsafe_getaddrinfo="no" - ;; - aix*) - dnl aix 5.2 and newer - tst_tsafe_getaddrinfo="yes" - ;; - darwin[[12345]].*) - dnl darwin 5.0 and mac os x 10.1.X and older - tst_tsafe_getaddrinfo="no" - ;; - darwin*) - dnl darwin 6.0 and mac os x 10.2.X and newer - tst_tsafe_getaddrinfo="yes" - ;; - freebsd[[1234]].* | freebsd5.[[1234]]*) - dnl freebsd 5.4 and older - tst_tsafe_getaddrinfo="no" - ;; - freebsd*) - dnl freebsd 5.5 and newer - tst_tsafe_getaddrinfo="yes" - ;; - hpux[[123456789]].* | hpux10.* | hpux11.0* | hpux11.10*) - dnl hpux 11.10 and older - tst_tsafe_getaddrinfo="no" - ;; - hpux*) - dnl hpux 11.11 and newer - tst_tsafe_getaddrinfo="yes" - ;; - netbsd[[123]].*) - dnl netbsd 3.X and older - tst_tsafe_getaddrinfo="no" - ;; - netbsd*) - dnl netbsd 4.X and newer - tst_tsafe_getaddrinfo="yes" - ;; - *bsd*) - dnl All other bsd's - tst_tsafe_getaddrinfo="no" - ;; - solaris2*) - dnl solaris which have it - tst_tsafe_getaddrinfo="yes" - ;; - esac - if test "$tst_tsafe_getaddrinfo" = "unknown" && - test "$ac_cv_native_windows" = "yes"; then - tst_tsafe_getaddrinfo="yes" - fi - if test "$tst_tsafe_getaddrinfo" = "unknown"; then - CURL_CHECK_DEF_CC([h_errno], [ - $cares_includes_sys_socket - $cares_includes_netdb - ], [silent]) - if test "$cares_cv_have_def_h_errno" = "yes"; then - tst_h_errno_macro="yes" - else - tst_h_errno_macro="no" - fi - AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM([[ - $cares_includes_sys_socket - $cares_includes_netdb - ]],[[ - h_errno = 2; - if(0 != h_errno) - return 1; - ]]) - ],[ - tst_h_errno_modifiable_lvalue="yes" - ],[ - tst_h_errno_modifiable_lvalue="no" - ]) - AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM([[ - ]],[[ -#if defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE >= 200809L) - return 0; -#elif defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE >= 700) - return 0; -#else - force compilation error -#endif - ]]) - ],[ - tst_h_errno_sbs_issue_7="yes" - ],[ - tst_h_errno_sbs_issue_7="no" - ]) - if test "$tst_h_errno_macro" = "no" && - test "$tst_h_errno_modifiable_lvalue" = "no" && - test "$tst_h_errno_sbs_issue_7" = "no"; then - tst_tsafe_getaddrinfo="no" - else - tst_tsafe_getaddrinfo="yes" - fi - fi - AC_MSG_RESULT([$tst_tsafe_getaddrinfo]) - if test "$tst_tsafe_getaddrinfo" = "yes"; then - AC_DEFINE_UNQUOTED(HAVE_GETADDRINFO_THREADSAFE, 1, - [Define to 1 if the getaddrinfo function is threadsafe.]) - ac_cv_func_getaddrinfo_threadsafe="yes" - else - ac_cv_func_getaddrinfo_threadsafe="no" - fi - fi -]) - - -dnl CARES_CHECK_FUNC_GETENV -dnl ------------------------------------------------- -dnl Verify if getenv is available, prototyped, and -dnl can be compiled. If all of these are true, and -dnl usage has not been previously disallowed with -dnl shell variable cares_disallow_getenv, then -dnl HAVE_GETENV will be defined. - -AC_DEFUN([CARES_CHECK_FUNC_GETENV], [ - AC_REQUIRE([CARES_INCLUDES_STDLIB])dnl - # - tst_links_getenv="unknown" - tst_proto_getenv="unknown" - tst_compi_getenv="unknown" - tst_allow_getenv="unknown" - # - AC_MSG_CHECKING([if getenv can be linked]) - AC_LINK_IFELSE([ - AC_LANG_FUNC_LINK_TRY([getenv]) - ],[ - AC_MSG_RESULT([yes]) - tst_links_getenv="yes" - ],[ - AC_MSG_RESULT([no]) - tst_links_getenv="no" - ]) - # - if test "$tst_links_getenv" = "yes"; then - AC_MSG_CHECKING([if getenv is prototyped]) - AC_EGREP_CPP([getenv],[ - $cares_includes_stdlib - ],[ - AC_MSG_RESULT([yes]) - tst_proto_getenv="yes" - ],[ - AC_MSG_RESULT([no]) - tst_proto_getenv="no" - ]) - fi - # - if test "$tst_proto_getenv" = "yes"; then - AC_MSG_CHECKING([if getenv is compilable]) - AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM([[ - $cares_includes_stdlib - ]],[[ - if(0 != getenv(0)) - return 1; - ]]) - ],[ - AC_MSG_RESULT([yes]) - tst_compi_getenv="yes" - ],[ - AC_MSG_RESULT([no]) - tst_compi_getenv="no" - ]) - fi - # - if test "$tst_compi_getenv" = "yes"; then - AC_MSG_CHECKING([if getenv usage allowed]) - if test "x$cares_disallow_getenv" != "xyes"; then - AC_MSG_RESULT([yes]) - tst_allow_getenv="yes" - else - AC_MSG_RESULT([no]) - tst_allow_getenv="no" - fi - fi - # - AC_MSG_CHECKING([if getenv might be used]) - if test "$tst_links_getenv" = "yes" && - test "$tst_proto_getenv" = "yes" && - test "$tst_compi_getenv" = "yes" && - test "$tst_allow_getenv" = "yes"; then - AC_MSG_RESULT([yes]) - AC_DEFINE_UNQUOTED(HAVE_GETENV, 1, - [Define to 1 if you have the getenv function.]) - ac_cv_func_getenv="yes" - else - AC_MSG_RESULT([no]) - ac_cv_func_getenv="no" - fi -]) - - -dnl CARES_CHECK_FUNC_GETHOSTBYADDR -dnl ------------------------------------------------- -dnl Verify if gethostbyaddr is available, prototyped, -dnl and can be compiled. If all of these are true, -dnl and usage has not been previously disallowed with -dnl shell variable cares_disallow_gethostbyaddr, then -dnl HAVE_GETHOSTBYADDR will be defined. - -AC_DEFUN([CARES_CHECK_FUNC_GETHOSTBYADDR], [ - AC_REQUIRE([CARES_INCLUDES_WINSOCK2])dnl - AC_REQUIRE([CARES_INCLUDES_NETDB])dnl - # - tst_links_gethostbyaddr="unknown" - tst_proto_gethostbyaddr="unknown" - tst_compi_gethostbyaddr="unknown" - tst_allow_gethostbyaddr="unknown" - # - AC_MSG_CHECKING([if gethostbyaddr can be linked]) - AC_LINK_IFELSE([ - AC_LANG_PROGRAM([[ - $cares_includes_winsock2 - $cares_includes_netdb - ]],[[ - if(0 != gethostbyaddr(0, 0, 0)) - return 1; - ]]) - ],[ - AC_MSG_RESULT([yes]) - tst_links_gethostbyaddr="yes" - ],[ - AC_MSG_RESULT([no]) - tst_links_gethostbyaddr="no" - ]) - # - if test "$tst_links_gethostbyaddr" = "yes"; then - AC_MSG_CHECKING([if gethostbyaddr is prototyped]) - AC_EGREP_CPP([gethostbyaddr],[ - $cares_includes_winsock2 - $cares_includes_netdb - ],[ - AC_MSG_RESULT([yes]) - tst_proto_gethostbyaddr="yes" - ],[ - AC_MSG_RESULT([no]) - tst_proto_gethostbyaddr="no" - ]) - fi - # - if test "$tst_proto_gethostbyaddr" = "yes"; then - AC_MSG_CHECKING([if gethostbyaddr is compilable]) - AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM([[ - $cares_includes_winsock2 - $cares_includes_netdb - ]],[[ - if(0 != gethostbyaddr(0, 0, 0)) - return 1; - ]]) - ],[ - AC_MSG_RESULT([yes]) - tst_compi_gethostbyaddr="yes" - ],[ - AC_MSG_RESULT([no]) - tst_compi_gethostbyaddr="no" - ]) - fi - # - if test "$tst_compi_gethostbyaddr" = "yes"; then - AC_MSG_CHECKING([if gethostbyaddr usage allowed]) - if test "x$cares_disallow_gethostbyaddr" != "xyes"; then - AC_MSG_RESULT([yes]) - tst_allow_gethostbyaddr="yes" - else - AC_MSG_RESULT([no]) - tst_allow_gethostbyaddr="no" - fi - fi - # - AC_MSG_CHECKING([if gethostbyaddr might be used]) - if test "$tst_links_gethostbyaddr" = "yes" && - test "$tst_proto_gethostbyaddr" = "yes" && - test "$tst_compi_gethostbyaddr" = "yes" && - test "$tst_allow_gethostbyaddr" = "yes"; then - AC_MSG_RESULT([yes]) - AC_DEFINE_UNQUOTED(HAVE_GETHOSTBYADDR, 1, - [Define to 1 if you have the gethostbyaddr function.]) - ac_cv_func_gethostbyaddr="yes" - else - AC_MSG_RESULT([no]) - ac_cv_func_gethostbyaddr="no" - fi -]) - - -dnl CARES_CHECK_FUNC_GETHOSTBYNAME -dnl ------------------------------------------------- -dnl Verify if gethostbyname is available, prototyped, -dnl and can be compiled. If all of these are true, -dnl and usage has not been previously disallowed with -dnl shell variable cares_disallow_gethostbyname, then -dnl HAVE_GETHOSTBYNAME will be defined. - -AC_DEFUN([CARES_CHECK_FUNC_GETHOSTBYNAME], [ - AC_REQUIRE([CARES_INCLUDES_WINSOCK2])dnl - AC_REQUIRE([CARES_INCLUDES_NETDB])dnl - # - tst_links_gethostbyname="unknown" - tst_proto_gethostbyname="unknown" - tst_compi_gethostbyname="unknown" - tst_allow_gethostbyname="unknown" - # - AC_MSG_CHECKING([if gethostbyname can be linked]) - AC_LINK_IFELSE([ - AC_LANG_PROGRAM([[ - $cares_includes_winsock2 - $cares_includes_netdb - ]],[[ - if(0 != gethostbyname(0)) - return 1; - ]]) - ],[ - AC_MSG_RESULT([yes]) - tst_links_gethostbyname="yes" - ],[ - AC_MSG_RESULT([no]) - tst_links_gethostbyname="no" - ]) - # - if test "$tst_links_gethostbyname" = "yes"; then - AC_MSG_CHECKING([if gethostbyname is prototyped]) - AC_EGREP_CPP([gethostbyname],[ - $cares_includes_winsock2 - $cares_includes_netdb - ],[ - AC_MSG_RESULT([yes]) - tst_proto_gethostbyname="yes" - ],[ - AC_MSG_RESULT([no]) - tst_proto_gethostbyname="no" - ]) - fi - # - if test "$tst_proto_gethostbyname" = "yes"; then - AC_MSG_CHECKING([if gethostbyname is compilable]) - AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM([[ - $cares_includes_winsock2 - $cares_includes_netdb - ]],[[ - if(0 != gethostbyname(0)) - return 1; - ]]) - ],[ - AC_MSG_RESULT([yes]) - tst_compi_gethostbyname="yes" - ],[ - AC_MSG_RESULT([no]) - tst_compi_gethostbyname="no" - ]) - fi - # - if test "$tst_compi_gethostbyname" = "yes"; then - AC_MSG_CHECKING([if gethostbyname usage allowed]) - if test "x$cares_disallow_gethostbyname" != "xyes"; then - AC_MSG_RESULT([yes]) - tst_allow_gethostbyname="yes" - else - AC_MSG_RESULT([no]) - tst_allow_gethostbyname="no" - fi - fi - # - AC_MSG_CHECKING([if gethostbyname might be used]) - if test "$tst_links_gethostbyname" = "yes" && - test "$tst_proto_gethostbyname" = "yes" && - test "$tst_compi_gethostbyname" = "yes" && - test "$tst_allow_gethostbyname" = "yes"; then - AC_MSG_RESULT([yes]) - AC_DEFINE_UNQUOTED(HAVE_GETHOSTBYNAME, 1, - [Define to 1 if you have the gethostbyname function.]) - ac_cv_func_gethostbyname="yes" - else - AC_MSG_RESULT([no]) - ac_cv_func_gethostbyname="no" - fi -]) - - -dnl CARES_CHECK_FUNC_GETHOSTNAME -dnl ------------------------------------------------- -dnl Verify if gethostname is available, prototyped, and -dnl can be compiled. If all of these are true, and -dnl usage has not been previously disallowed with -dnl shell variable cares_disallow_gethostname, then -dnl HAVE_GETHOSTNAME will be defined. - -AC_DEFUN([CARES_CHECK_FUNC_GETHOSTNAME], [ - AC_REQUIRE([CARES_INCLUDES_WINSOCK2])dnl - AC_REQUIRE([CARES_INCLUDES_UNISTD])dnl - AC_REQUIRE([CARES_PREPROCESS_CALLCONV])dnl - # - tst_links_gethostname="unknown" - tst_proto_gethostname="unknown" - tst_compi_gethostname="unknown" - tst_allow_gethostname="unknown" - # - AC_MSG_CHECKING([if gethostname can be linked]) - AC_LINK_IFELSE([ - AC_LANG_PROGRAM([[ - $cares_includes_winsock2 - $cares_includes_unistd - ]],[[ - if(0 != gethostname(0, 0)) - return 1; - ]]) - ],[ - AC_MSG_RESULT([yes]) - tst_links_gethostname="yes" - ],[ - AC_MSG_RESULT([no]) - tst_links_gethostname="no" - ]) - # - if test "$tst_links_gethostname" = "yes"; then - AC_MSG_CHECKING([if gethostname is prototyped]) - AC_EGREP_CPP([gethostname],[ - $cares_includes_winsock2 - $cares_includes_unistd - ],[ - AC_MSG_RESULT([yes]) - tst_proto_gethostname="yes" - ],[ - AC_MSG_RESULT([no]) - tst_proto_gethostname="no" - ]) - fi - # - if test "$tst_proto_gethostname" = "yes"; then - AC_MSG_CHECKING([if gethostname is compilable]) - AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM([[ - $cares_includes_winsock2 - $cares_includes_unistd - ]],[[ - if(0 != gethostname(0, 0)) - return 1; - ]]) - ],[ - AC_MSG_RESULT([yes]) - tst_compi_gethostname="yes" - ],[ - AC_MSG_RESULT([no]) - tst_compi_gethostname="no" - ]) - fi - # - if test "$tst_compi_gethostname" = "yes"; then - AC_MSG_CHECKING([for gethostname arg 2 data type]) - tst_gethostname_type_arg2="unknown" - for tst_arg1 in 'char *' 'unsigned char *' 'void *'; do - for tst_arg2 in 'int' 'unsigned int' 'size_t'; do - if test "$tst_gethostname_type_arg2" = "unknown"; then - AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM([[ - $cares_includes_winsock2 - $cares_includes_unistd - $cares_preprocess_callconv - extern int FUNCALLCONV gethostname($tst_arg1, $tst_arg2); - ]],[[ - if(0 != gethostname(0, 0)) - return 1; - ]]) - ],[ - tst_gethostname_type_arg2="$tst_arg2" - ]) - fi - done - done - AC_MSG_RESULT([$tst_gethostname_type_arg2]) - if test "$tst_gethostname_type_arg2" != "unknown"; then - AC_DEFINE_UNQUOTED(GETHOSTNAME_TYPE_ARG2, $tst_gethostname_type_arg2, - [Define to the type of arg 2 for gethostname.]) - fi - fi - # - if test "$tst_compi_gethostname" = "yes"; then - AC_MSG_CHECKING([if gethostname usage allowed]) - if test "x$cares_disallow_gethostname" != "xyes"; then - AC_MSG_RESULT([yes]) - tst_allow_gethostname="yes" - else - AC_MSG_RESULT([no]) - tst_allow_gethostname="no" - fi - fi - # - AC_MSG_CHECKING([if gethostname might be used]) - if test "$tst_links_gethostname" = "yes" && - test "$tst_proto_gethostname" = "yes" && - test "$tst_compi_gethostname" = "yes" && - test "$tst_allow_gethostname" = "yes"; then - AC_MSG_RESULT([yes]) - AC_DEFINE_UNQUOTED(HAVE_GETHOSTNAME, 1, - [Define to 1 if you have the gethostname function.]) - ac_cv_func_gethostname="yes" - else - AC_MSG_RESULT([no]) - ac_cv_func_gethostname="no" - fi -]) - -dnl CARES_CHECK_FUNC_GETRANDOM -dnl ------------------------------------------------- -dnl Verify if getrandom is available, prototyped, and -dnl can be compiled. If all of these are true, and -dnl usage has not been previously disallowed with -dnl shell variable cares_disallow_getrandom, then -dnl HAVE_GETRANDOM will be defined. - -AC_DEFUN([CARES_CHECK_FUNC_GETRANDOM], [ - AC_REQUIRE([CARES_INCLUDES_SYS_RANDOM])dnl - # - tst_links_getrandom="unknown" - tst_proto_getrandom="unknown" - tst_compi_getrandom="unknown" - tst_allow_getrandom="unknown" - # - AC_MSG_CHECKING([if getrandom can be linked]) - AC_LINK_IFELSE([ - AC_LANG_FUNC_LINK_TRY([getrandom]) - ],[ - AC_MSG_RESULT([yes]) - tst_links_getrandom="yes" - ],[ - AC_MSG_RESULT([no]) - tst_links_getrandom="no" - ]) - # - if test "$tst_links_getrandom" = "yes"; then - AC_MSG_CHECKING([if getrandom is prototyped]) - AC_EGREP_CPP([getrandom],[ - $cares_includes_sys_random - ],[ - AC_MSG_RESULT([yes]) - tst_proto_getrandom="yes" - ],[ - AC_MSG_RESULT([no]) - tst_proto_getrandom="no" - ]) - fi - # - if test "$tst_proto_getrandom" = "yes"; then - AC_MSG_CHECKING([if getrandom is compilable]) - AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM([[ - $cares_includes_sys_random - ]],[[ - if(0 != getrandom(0, 0, 0)) - return 1; - ]]) - ],[ - AC_MSG_RESULT([yes]) - tst_compi_getrandom="yes" - ],[ - AC_MSG_RESULT([no]) - tst_compi_getrandom="no" - ]) - fi - # - if test "$tst_compi_getrandom" = "yes"; then - AC_MSG_CHECKING([if getrandom usage allowed]) - if test "x$cares_disallow_getrandom" != "xyes"; then - AC_MSG_RESULT([yes]) - tst_allow_getrandom="yes" - else - AC_MSG_RESULT([no]) - tst_allow_getrandom="no" - fi - fi - # - AC_MSG_CHECKING([if getrandom might be used]) - if test "$tst_links_getrandom" = "yes" && - test "$tst_proto_getrandom" = "yes" && - test "$tst_compi_getrandom" = "yes" && - test "$tst_allow_getrandom" = "yes"; then - AC_MSG_RESULT([yes]) - AC_DEFINE_UNQUOTED(HAVE_GETRANDOM, 1, - [Define to 1 if you have the getrandom function.]) - ac_cv_func_getrandom="yes" - else - AC_MSG_RESULT([no]) - ac_cv_func_getrandom="no" - fi -]) - - -dnl CARES_CHECK_FUNC_GETSERVBYPORT_R -dnl ------------------------------------------------- -dnl Verify if getservbyport_r is available, prototyped, -dnl and can be compiled. If all of these are true, and -dnl usage has not been previously disallowed with -dnl shell variable cares_disallow_getservbyport_r, then -dnl HAVE_GETSERVBYPORT_R will be defined. - -AC_DEFUN([CARES_CHECK_FUNC_GETSERVBYPORT_R], [ - AC_REQUIRE([CARES_INCLUDES_NETDB])dnl - # - tst_links_getservbyport_r="unknown" - tst_proto_getservbyport_r="unknown" - tst_compi_getservbyport_r="unknown" - tst_allow_getservbyport_r="unknown" - tst_nargs_getservbyport_r="unknown" - # - AC_MSG_CHECKING([if getservbyport_r can be linked]) - AC_LINK_IFELSE([ - AC_LANG_FUNC_LINK_TRY([getservbyport_r]) - ],[ - AC_MSG_RESULT([yes]) - tst_links_getservbyport_r="yes" - ],[ - AC_MSG_RESULT([no]) - tst_links_getservbyport_r="no" - ]) - # - if test "$tst_links_getservbyport_r" = "yes"; then - AC_MSG_CHECKING([if getservbyport_r is prototyped]) - AC_EGREP_CPP([getservbyport_r],[ - $cares_includes_netdb - ],[ - AC_MSG_RESULT([yes]) - tst_proto_getservbyport_r="yes" - ],[ - AC_MSG_RESULT([no]) - tst_proto_getservbyport_r="no" - ]) - fi - # - if test "$tst_proto_getservbyport_r" = "yes"; then - if test "$tst_nargs_getservbyport_r" = "unknown"; then - AC_MSG_CHECKING([if getservbyport_r takes 4 args.]) - AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM([[ - $cares_includes_netdb - ]],[[ - if(0 != getservbyport_r(0, 0, 0, 0)) - return 1; - ]]) - ],[ - AC_MSG_RESULT([yes]) - tst_compi_getservbyport_r="yes" - tst_nargs_getservbyport_r="4" - ],[ - AC_MSG_RESULT([no]) - tst_compi_getservbyport_r="no" - ]) - fi - if test "$tst_nargs_getservbyport_r" = "unknown"; then - AC_MSG_CHECKING([if getservbyport_r takes 5 args.]) - AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM([[ - $cares_includes_netdb - ]],[[ - if(0 != getservbyport_r(0, 0, 0, 0, 0)) - return 1; - ]]) - ],[ - AC_MSG_RESULT([yes]) - tst_compi_getservbyport_r="yes" - tst_nargs_getservbyport_r="5" - ],[ - AC_MSG_RESULT([no]) - tst_compi_getservbyport_r="no" - ]) - fi - if test "$tst_nargs_getservbyport_r" = "unknown"; then - AC_MSG_CHECKING([if getservbyport_r takes 6 args.]) - AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM([[ - $cares_includes_netdb - ]],[[ - if(0 != getservbyport_r(0, 0, 0, 0, 0, 0)) - return 1; - ]]) - ],[ - AC_MSG_RESULT([yes]) - tst_compi_getservbyport_r="yes" - tst_nargs_getservbyport_r="6" - ],[ - AC_MSG_RESULT([no]) - tst_compi_getservbyport_r="no" - ]) - fi - AC_MSG_CHECKING([if getservbyport_r is compilable]) - if test "$tst_compi_getservbyport_r" = "yes"; then - AC_MSG_RESULT([yes]) - else - AC_MSG_RESULT([no]) - fi - fi - # - if test "$tst_compi_getservbyport_r" = "yes"; then - AC_MSG_CHECKING([if getservbyport_r usage allowed]) - if test "x$cares_disallow_getservbyport_r" != "xyes"; then - AC_MSG_RESULT([yes]) - tst_allow_getservbyport_r="yes" - else - AC_MSG_RESULT([no]) - tst_allow_getservbyport_r="no" - fi - fi - # - AC_MSG_CHECKING([if getservbyport_r might be used]) - if test "$tst_links_getservbyport_r" = "yes" && - test "$tst_proto_getservbyport_r" = "yes" && - test "$tst_compi_getservbyport_r" = "yes" && - test "$tst_allow_getservbyport_r" = "yes"; then - AC_MSG_RESULT([yes]) - AC_DEFINE_UNQUOTED(HAVE_GETSERVBYPORT_R, 1, - [Define to 1 if you have the getservbyport_r function.]) - AC_DEFINE_UNQUOTED(GETSERVBYPORT_R_ARGS, $tst_nargs_getservbyport_r, - [Specifies the number of arguments to getservbyport_r]) - if test "$tst_nargs_getservbyport_r" -eq "4"; then - AC_DEFINE(GETSERVBYPORT_R_BUFSIZE, sizeof(struct servent_data), - [Specifies the size of the buffer to pass to getservbyport_r]) - else - AC_DEFINE(GETSERVBYPORT_R_BUFSIZE, 4096, - [Specifies the size of the buffer to pass to getservbyport_r]) - fi - ac_cv_func_getservbyport_r="yes" - else - AC_MSG_RESULT([no]) - ac_cv_func_getservbyport_r="no" - fi -]) - - -dnl CARES_CHECK_FUNC_GETSERVBYNAME_R -dnl ------------------------------------------------- -dnl Verify if getservbyname_r is available, prototyped, -dnl and can be compiled. If all of these are true, and -dnl usage has not been previously disallowed with -dnl shell variable cares_disallow_getservbyname_r, then -dnl HAVE_GETSERVBYNAME_R will be defined. - -AC_DEFUN([CARES_CHECK_FUNC_GETSERVBYNAME_R], [ - AC_REQUIRE([CARES_INCLUDES_NETDB])dnl - # - tst_links_getservbyname_r="unknown" - tst_proto_getservbyname_r="unknown" - tst_compi_getservbyname_r="unknown" - tst_allow_getservbyname_r="unknown" - tst_nargs_getservbyname_r="unknown" - # - AC_MSG_CHECKING([if getservbyname_r can be linked]) - AC_LINK_IFELSE([ - AC_LANG_FUNC_LINK_TRY([getservbyname_r]) - ],[ - AC_MSG_RESULT([yes]) - tst_links_getservbyname_r="yes" - ],[ - AC_MSG_RESULT([no]) - tst_links_getservbyname_r="no" - ]) - # - if test "$tst_links_getservbyname_r" = "yes"; then - AC_MSG_CHECKING([if getservbyname_r is prototyped]) - AC_EGREP_CPP([getservbyname_r],[ - $cares_includes_netdb - ],[ - AC_MSG_RESULT([yes]) - tst_proto_getservbyname_r="yes" - ],[ - AC_MSG_RESULT([no]) - tst_proto_getservbyname_r="no" - ]) - fi - # - if test "$tst_proto_getservbyname_r" = "yes"; then - if test "$tst_nargs_getservbyname_r" = "unknown"; then - AC_MSG_CHECKING([if getservbyname_r takes 4 args.]) - AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM([[ - $cares_includes_netdb - ]],[[ - if(0 != getservbyname_r(0, 0, 0, 0)) - return 1; - ]]) - ],[ - AC_MSG_RESULT([yes]) - tst_compi_getservbyname_r="yes" - tst_nargs_getservbyname_r="4" - ],[ - AC_MSG_RESULT([no]) - tst_compi_getservbyname_r="no" - ]) - fi - if test "$tst_nargs_getservbyname_r" = "unknown"; then - AC_MSG_CHECKING([if getservbyname_r takes 5 args.]) - AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM([[ - $cares_includes_netdb - ]],[[ - if(0 != getservbyname_r(0, 0, 0, 0, 0)) - return 1; - ]]) - ],[ - AC_MSG_RESULT([yes]) - tst_compi_getservbyname_r="yes" - tst_nargs_getservbyname_r="5" - ],[ - AC_MSG_RESULT([no]) - tst_compi_getservbyname_r="no" - ]) - fi - if test "$tst_nargs_getservbyname_r" = "unknown"; then - AC_MSG_CHECKING([if getservbyname_r takes 6 args.]) - AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM([[ - $cares_includes_netdb - ]],[[ - if(0 != getservbyname_r(0, 0, 0, 0, 0, 0)) - return 1; - ]]) - ],[ - AC_MSG_RESULT([yes]) - tst_compi_getservbyname_r="yes" - tst_nargs_getservbyname_r="6" - ],[ - AC_MSG_RESULT([no]) - tst_compi_getservbyname_r="no" - ]) - fi - AC_MSG_CHECKING([if getservbyname_r is compilable]) - if test "$tst_compi_getservbyname_r" = "yes"; then - AC_MSG_RESULT([yes]) - else - AC_MSG_RESULT([no]) - fi - fi - # - if test "$tst_compi_getservbyname_r" = "yes"; then - AC_MSG_CHECKING([if getservbyname_r usage allowed]) - if test "x$cares_disallow_getservbyname_r" != "xyes"; then - AC_MSG_RESULT([yes]) - tst_allow_getservbyname_r="yes" - else - AC_MSG_RESULT([no]) - tst_allow_getservbyname_r="no" - fi - fi - # - AC_MSG_CHECKING([if getservbyname_r might be used]) - if test "$tst_links_getservbyname_r" = "yes" && - test "$tst_proto_getservbyname_r" = "yes" && - test "$tst_compi_getservbyname_r" = "yes" && - test "$tst_allow_getservbyname_r" = "yes"; then - AC_MSG_RESULT([yes]) - AC_DEFINE_UNQUOTED(HAVE_GETSERVBYNAME_R, 1, - [Define to 1 if you have the getservbyname_r function.]) - AC_DEFINE_UNQUOTED(GETSERVBYNAME_R_ARGS, $tst_nargs_getservbyname_r, - [Specifies the number of arguments to getservbyname_r]) - if test "$tst_nargs_getservbyname_r" -eq "4"; then - AC_DEFINE(GETSERVBYNAME_R_BUFSIZE, sizeof(struct servent_data), - [Specifies the size of the buffer to pass to getservbyname_r]) - else - AC_DEFINE(GETSERVBYNAME_R_BUFSIZE, 4096, - [Specifies the size of the buffer to pass to getservbyname_r]) - fi - ac_cv_func_getservbyname_r="yes" - else - AC_MSG_RESULT([no]) - ac_cv_func_getservbyname_r="no" - fi -]) - - -dnl CARES_CHECK_FUNC_INET_NET_PTON -dnl ------------------------------------------------- -dnl Verify if inet_net_pton is available, prototyped, can -dnl be compiled and seems to work. If all of these are -dnl true, and usage has not been previously disallowed -dnl with shell variable cares_disallow_inet_net_pton, then -dnl HAVE_INET_NET_PTON will be defined. - -AC_DEFUN([CARES_CHECK_FUNC_INET_NET_PTON], [ - AC_REQUIRE([CARES_INCLUDES_STDLIB])dnl - AC_REQUIRE([CARES_INCLUDES_ARPA_INET])dnl - AC_REQUIRE([CARES_INCLUDES_STRING])dnl - # - tst_links_inet_net_pton="unknown" - tst_proto_inet_net_pton="unknown" - tst_compi_inet_net_pton="unknown" - tst_works_inet_net_pton="unknown" - tst_allow_inet_net_pton="unknown" - # - AC_MSG_CHECKING([if inet_net_pton can be linked]) - AC_LINK_IFELSE([ - AC_LANG_FUNC_LINK_TRY([inet_net_pton]) - ],[ - AC_MSG_RESULT([yes]) - tst_links_inet_net_pton="yes" - ],[ - AC_MSG_RESULT([no]) - tst_links_inet_net_pton="no" - ]) - # - if test "$tst_links_inet_net_pton" = "yes"; then - AC_MSG_CHECKING([if inet_net_pton is prototyped]) - AC_EGREP_CPP([inet_net_pton],[ - $cares_includes_arpa_inet - ],[ - AC_MSG_RESULT([yes]) - tst_proto_inet_net_pton="yes" - ],[ - AC_MSG_RESULT([no]) - tst_proto_inet_net_pton="no" - ]) - fi - # - if test "$tst_proto_inet_net_pton" = "yes"; then - AC_MSG_CHECKING([if inet_net_pton is compilable]) - AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM([[ - $cares_includes_arpa_inet - ]],[[ - if(0 != inet_net_pton(0, 0, 0, 0)) - return 1; - ]]) - ],[ - AC_MSG_RESULT([yes]) - tst_compi_inet_net_pton="yes" - ],[ - AC_MSG_RESULT([no]) - tst_compi_inet_net_pton="no" - ]) - fi - # - dnl only do runtime verification when not cross-compiling - if test "x$cross_compiling" != "xyes" && - test "$tst_compi_inet_net_pton" = "yes"; then - AC_MSG_CHECKING([if inet_net_pton seems to work]) - AC_RUN_IFELSE([ - AC_LANG_PROGRAM([[ - $cares_includes_stdlib - $cares_includes_arpa_inet - $cares_includes_string - ]],[[ - unsigned char ipv6a[16+1]; - unsigned char ipv4a[4+1]; - const char *ipv6net1 = "fe80::214:4fff:fe0b:76c8"; - const char *ipv6net2 = "::fffe:7f00:1"; - const char *ipv6net3 = "7f20:1::/64"; - const char *ipv6net4 = "7f20:1::/2147483649"; - const char *ipv4net1 = "192.168.100.1"; - const char *ipv4net2 = "192.168.100/32"; - const char *ipv4net3 = "192.168.100.1/2147483649"; - /* - */ - memset(ipv4a, 1, sizeof(ipv4a)); - if(32 != inet_net_pton(AF_INET, ipv4net1, ipv4a, 4)) - exit(1); /* fail */ - /* - */ - if( (ipv4a[0x00] != 0xc0) || - (ipv4a[0x01] != 0xa8) || - (ipv4a[0x02] != 0x64) || - (ipv4a[0x03] != 0x01) || - (ipv4a[0x04] != 0x01) ) - exit(1); /* fail */ - /* - */ - memset(ipv4a, 1, sizeof(ipv4a)); - if(32 != inet_net_pton(AF_INET, ipv4net2, ipv4a, 4)) - exit(1); /* fail */ - /* - */ - if( (ipv4a[0x00] != 0xc0) || - (ipv4a[0x01] != 0xa8) || - (ipv4a[0x02] != 0x64) || - (ipv4a[0x03] != 0x00) || - (ipv4a[0x04] != 0x01) ) - exit(1); /* fail */ - /* - */ - memset(ipv4a, 1, sizeof(ipv4a)); - if(-1 != inet_net_pton(AF_INET, ipv4net3, ipv4a, 4)) - exit(1); /* fail */ - /* - */ - memset(ipv6a, 1, sizeof(ipv6a)); - if(128 != inet_net_pton(AF_INET6, ipv6net1, ipv6a, 16)) - exit(1); /* fail */ - /* - */ - if( (ipv6a[0x00] != 0xfe) || - (ipv6a[0x01] != 0x80) || - (ipv6a[0x08] != 0x02) || - (ipv6a[0x09] != 0x14) || - (ipv6a[0x0a] != 0x4f) || - (ipv6a[0x0b] != 0xff) || - (ipv6a[0x0c] != 0xfe) || - (ipv6a[0x0d] != 0x0b) || - (ipv6a[0x0e] != 0x76) || - (ipv6a[0x0f] != 0xc8) || - (ipv6a[0x10] != 0x01) ) - exit(1); /* fail */ - /* - */ - if( (ipv6a[0x02] != 0x0) || - (ipv6a[0x03] != 0x0) || - (ipv6a[0x04] != 0x0) || - (ipv6a[0x05] != 0x0) || - (ipv6a[0x06] != 0x0) || - (ipv6a[0x07] != 0x0) ) - exit(1); /* fail */ - /* - */ - memset(ipv6a, 0, sizeof(ipv6a)); - ipv6a[0x10] = 0x01; - if(128 != inet_net_pton(AF_INET6, ipv6net2, ipv6a, 16)) - exit(1); /* fail */ - /* - */ - if( (ipv6a[0x0a] != 0xff) || - (ipv6a[0x0b] != 0xfe) || - (ipv6a[0x0c] != 0x7f) || - (ipv6a[0x0f] != 0x01) || - (ipv6a[0x10] != 0x01) ) - exit(1); /* fail */ - /* - */ - if( (ipv6a[0x00] != 0x0) || - (ipv6a[0x01] != 0x0) || - (ipv6a[0x02] != 0x0) || - (ipv6a[0x03] != 0x0) || - (ipv6a[0x04] != 0x0) || - (ipv6a[0x05] != 0x0) || - (ipv6a[0x06] != 0x0) || - (ipv6a[0x07] != 0x0) || - (ipv6a[0x08] != 0x0) || - (ipv6a[0x09] != 0x0) || - (ipv6a[0x0d] != 0x0) || - (ipv6a[0x0e] != 0x0) ) - exit(1); /* fail */ - /* - */ - memset(ipv6a, 1, sizeof(ipv6a)); - if(64 != inet_net_pton(AF_INET6, ipv6net3, ipv6a, 16)) - exit(1); /* fail */ - if( (ipv6a[0x00] != 0x7f) || - (ipv6a[0x01] != 0x20) || - (ipv6a[0x03] != 0x01) || - (ipv6a[0x08] != 0x01) || - (ipv6a[0x09] != 0x01) || - (ipv6a[0x0a] != 0x01) || - (ipv6a[0x0b] != 0x01) || - (ipv6a[0x0c] != 0x01) || - (ipv6a[0x0d] != 0x01) || - (ipv6a[0x0e] != 0x01) || - (ipv6a[0x0f] != 0x01) || - (ipv6a[0x10] != 0x01) ) - exit(1); /* fail */ - if( (ipv6a[0x02] != 0x0) || - (ipv6a[0x04] != 0x0) || - (ipv6a[0x05] != 0x0) || - (ipv6a[0x06] != 0x0) || - (ipv6a[0x07] != 0x0) || - (ipv6a[0x07] != 0x0) ) - exit(1); /* fail */ - /* - */ - memset(ipv6a, 1, sizeof(ipv6a)); - if(-1 != inet_net_pton(AF_INET6, ipv6net4, ipv6a, 16)) - exit(1); /* fail */ - /* - */ - exit(0); - ]]) - ],[ - AC_MSG_RESULT([yes]) - tst_works_inet_net_pton="yes" - ],[ - AC_MSG_RESULT([no]) - tst_works_inet_net_pton="no" - ]) - fi - # - if test "$tst_compi_inet_net_pton" = "yes" && - test "$tst_works_inet_net_pton" != "no"; then - AC_MSG_CHECKING([if inet_net_pton usage allowed]) - if test "x$cares_disallow_inet_net_pton" != "xyes"; then - AC_MSG_RESULT([yes]) - tst_allow_inet_net_pton="yes" - else - AC_MSG_RESULT([no]) - tst_allow_inet_net_pton="no" - fi - fi - # - AC_MSG_CHECKING([if inet_net_pton might be used]) - if test "$tst_links_inet_net_pton" = "yes" && - test "$tst_proto_inet_net_pton" = "yes" && - test "$tst_compi_inet_net_pton" = "yes" && - test "$tst_allow_inet_net_pton" = "yes" && - test "$tst_works_inet_net_pton" != "no"; then - AC_MSG_RESULT([yes]) - AC_DEFINE_UNQUOTED(HAVE_INET_NET_PTON, 1, - [Define to 1 if you have a IPv6 capable working inet_net_pton function.]) - ac_cv_func_inet_net_pton="yes" - else - AC_MSG_RESULT([no]) - ac_cv_func_inet_net_pton="no" - fi -]) - - -dnl CARES_CHECK_FUNC_INET_NTOP -dnl ------------------------------------------------- -dnl Verify if inet_ntop is available, prototyped, can -dnl be compiled and seems to work. If all of these are -dnl true, and usage has not been previously disallowed -dnl with shell variable cares_disallow_inet_ntop, then -dnl HAVE_INET_NTOP will be defined. - -AC_DEFUN([CARES_CHECK_FUNC_INET_NTOP], [ - AC_REQUIRE([CARES_INCLUDES_STDLIB])dnl - AC_REQUIRE([CARES_INCLUDES_ARPA_INET])dnl - AC_REQUIRE([CARES_INCLUDES_STRING])dnl - # - tst_links_inet_ntop="unknown" - tst_proto_inet_ntop="unknown" - tst_compi_inet_ntop="unknown" - tst_works_inet_ntop="unknown" - tst_allow_inet_ntop="unknown" - # - AC_MSG_CHECKING([if inet_ntop can be linked]) - AC_LINK_IFELSE([ - AC_LANG_FUNC_LINK_TRY([inet_ntop]) - ],[ - AC_MSG_RESULT([yes]) - tst_links_inet_ntop="yes" - ],[ - AC_MSG_RESULT([no]) - tst_links_inet_ntop="no" - ]) - # - if test "$tst_links_inet_ntop" = "yes"; then - AC_MSG_CHECKING([if inet_ntop is prototyped]) - AC_EGREP_CPP([inet_ntop],[ - $cares_includes_arpa_inet - ],[ - AC_MSG_RESULT([yes]) - tst_proto_inet_ntop="yes" - ],[ - AC_MSG_RESULT([no]) - tst_proto_inet_ntop="no" - ]) - fi - # - if test "$tst_proto_inet_ntop" = "yes"; then - AC_MSG_CHECKING([if inet_ntop is compilable]) - AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM([[ - $cares_includes_arpa_inet - ]],[[ - if(0 != inet_ntop(0, 0, 0, 0)) - return 1; - ]]) - ],[ - AC_MSG_RESULT([yes]) - tst_compi_inet_ntop="yes" - ],[ - AC_MSG_RESULT([no]) - tst_compi_inet_ntop="no" - ]) - fi - # - dnl only do runtime verification when not cross-compiling - if test "x$cross_compiling" != "xyes" && - test "$tst_compi_inet_ntop" = "yes"; then - AC_MSG_CHECKING([if inet_ntop seems to work]) - AC_RUN_IFELSE([ - AC_LANG_PROGRAM([[ - $cares_includes_stdlib - $cares_includes_arpa_inet - $cares_includes_string - ]],[[ - char ipv6res[sizeof("ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255")]; - char ipv4res[sizeof "255.255.255.255"]; - unsigned char ipv6a[26]; - unsigned char ipv4a[5]; - char *ipv6ptr = 0; - char *ipv4ptr = 0; - /* - */ - ipv4res[0] = '\0'; - ipv4a[0] = 0xc0; - ipv4a[1] = 0xa8; - ipv4a[2] = 0x64; - ipv4a[3] = 0x01; - ipv4a[4] = 0x01; - /* - */ - ipv4ptr = inet_ntop(AF_INET, ipv4a, ipv4res, sizeof(ipv4res)); - if(!ipv4ptr) - exit(1); /* fail */ - if(ipv4ptr != ipv4res) - exit(1); /* fail */ - if(!ipv4ptr[0]) - exit(1); /* fail */ - if(memcmp(ipv4res, "192.168.100.1", 13) != 0) - exit(1); /* fail */ - /* - */ - ipv6res[0] = '\0'; - memset(ipv6a, 0, sizeof(ipv6a)); - ipv6a[0] = 0xfe; - ipv6a[1] = 0x80; - ipv6a[8] = 0x02; - ipv6a[9] = 0x14; - ipv6a[10] = 0x4f; - ipv6a[11] = 0xff; - ipv6a[12] = 0xfe; - ipv6a[13] = 0x0b; - ipv6a[14] = 0x76; - ipv6a[15] = 0xc8; - ipv6a[25] = 0x01; - /* - */ - ipv6ptr = inet_ntop(AF_INET6, ipv6a, ipv6res, sizeof(ipv6res)); - if(!ipv6ptr) - exit(1); /* fail */ - if(ipv6ptr != ipv6res) - exit(1); /* fail */ - if(!ipv6ptr[0]) - exit(1); /* fail */ - if(memcmp(ipv6res, "fe80::214:4fff:fe0b:76c8", 24) != 0) - exit(1); /* fail */ - /* - */ - exit(0); - ]]) - ],[ - AC_MSG_RESULT([yes]) - tst_works_inet_ntop="yes" - ],[ - AC_MSG_RESULT([no]) - tst_works_inet_ntop="no" - ]) - fi - # - if test "$tst_compi_inet_ntop" = "yes" && - test "$tst_works_inet_ntop" != "no"; then - AC_MSG_CHECKING([if inet_ntop usage allowed]) - if test "x$cares_disallow_inet_ntop" != "xyes"; then - AC_MSG_RESULT([yes]) - tst_allow_inet_ntop="yes" - else - AC_MSG_RESULT([no]) - tst_allow_inet_ntop="no" - fi - fi - # - AC_MSG_CHECKING([if inet_ntop might be used]) - if test "$tst_links_inet_ntop" = "yes" && - test "$tst_proto_inet_ntop" = "yes" && - test "$tst_compi_inet_ntop" = "yes" && - test "$tst_allow_inet_ntop" = "yes" && - test "$tst_works_inet_ntop" != "no"; then - AC_MSG_RESULT([yes]) - AC_DEFINE_UNQUOTED(HAVE_INET_NTOP, 1, - [Define to 1 if you have a IPv6 capable working inet_ntop function.]) - ac_cv_func_inet_ntop="yes" - else - AC_MSG_RESULT([no]) - ac_cv_func_inet_ntop="no" - fi -]) - - -dnl CARES_CHECK_FUNC_INET_PTON -dnl ------------------------------------------------- -dnl Verify if inet_pton is available, prototyped, can -dnl be compiled and seems to work. If all of these are -dnl true, and usage has not been previously disallowed -dnl with shell variable cares_disallow_inet_pton, then -dnl HAVE_INET_PTON will be defined. - -AC_DEFUN([CARES_CHECK_FUNC_INET_PTON], [ - AC_REQUIRE([CARES_INCLUDES_STDLIB])dnl - AC_REQUIRE([CARES_INCLUDES_ARPA_INET])dnl - AC_REQUIRE([CARES_INCLUDES_STRING])dnl - # - tst_links_inet_pton="unknown" - tst_proto_inet_pton="unknown" - tst_compi_inet_pton="unknown" - tst_works_inet_pton="unknown" - tst_allow_inet_pton="unknown" - # - AC_MSG_CHECKING([if inet_pton can be linked]) - AC_LINK_IFELSE([ - AC_LANG_FUNC_LINK_TRY([inet_pton]) - ],[ - AC_MSG_RESULT([yes]) - tst_links_inet_pton="yes" - ],[ - AC_MSG_RESULT([no]) - tst_links_inet_pton="no" - ]) - # - if test "$tst_links_inet_pton" = "yes"; then - AC_MSG_CHECKING([if inet_pton is prototyped]) - AC_EGREP_CPP([inet_pton],[ - $cares_includes_arpa_inet - ],[ - AC_MSG_RESULT([yes]) - tst_proto_inet_pton="yes" - ],[ - AC_MSG_RESULT([no]) - tst_proto_inet_pton="no" - ]) - fi - # - if test "$tst_proto_inet_pton" = "yes"; then - AC_MSG_CHECKING([if inet_pton is compilable]) - AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM([[ - $cares_includes_arpa_inet - ]],[[ - if(0 != inet_pton(0, 0, 0)) - return 1; - ]]) - ],[ - AC_MSG_RESULT([yes]) - tst_compi_inet_pton="yes" - ],[ - AC_MSG_RESULT([no]) - tst_compi_inet_pton="no" - ]) - fi - # - dnl only do runtime verification when not cross-compiling - if test "x$cross_compiling" != "xyes" && - test "$tst_compi_inet_pton" = "yes"; then - AC_MSG_CHECKING([if inet_pton seems to work]) - AC_RUN_IFELSE([ - AC_LANG_PROGRAM([[ - $cares_includes_stdlib - $cares_includes_arpa_inet - $cares_includes_string - ]],[[ - unsigned char ipv6a[16+1]; - unsigned char ipv4a[4+1]; - const char *ipv6src = "fe80::214:4fff:fe0b:76c8"; - const char *ipv4src = "192.168.100.1"; - /* - */ - memset(ipv4a, 1, sizeof(ipv4a)); - if(1 != inet_pton(AF_INET, ipv4src, ipv4a)) - exit(1); /* fail */ - /* - */ - if( (ipv4a[0] != 0xc0) || - (ipv4a[1] != 0xa8) || - (ipv4a[2] != 0x64) || - (ipv4a[3] != 0x01) || - (ipv4a[4] != 0x01) ) - exit(1); /* fail */ - /* - */ - memset(ipv6a, 1, sizeof(ipv6a)); - if(1 != inet_pton(AF_INET6, ipv6src, ipv6a)) - exit(1); /* fail */ - /* - */ - if( (ipv6a[0] != 0xfe) || - (ipv6a[1] != 0x80) || - (ipv6a[8] != 0x02) || - (ipv6a[9] != 0x14) || - (ipv6a[10] != 0x4f) || - (ipv6a[11] != 0xff) || - (ipv6a[12] != 0xfe) || - (ipv6a[13] != 0x0b) || - (ipv6a[14] != 0x76) || - (ipv6a[15] != 0xc8) || - (ipv6a[16] != 0x01) ) - exit(1); /* fail */ - /* - */ - if( (ipv6a[2] != 0x0) || - (ipv6a[3] != 0x0) || - (ipv6a[4] != 0x0) || - (ipv6a[5] != 0x0) || - (ipv6a[6] != 0x0) || - (ipv6a[7] != 0x0) ) - exit(1); /* fail */ - /* - */ - exit(0); - ]]) - ],[ - AC_MSG_RESULT([yes]) - tst_works_inet_pton="yes" - ],[ - AC_MSG_RESULT([no]) - tst_works_inet_pton="no" - ]) - fi - # - if test "$tst_compi_inet_pton" = "yes" && - test "$tst_works_inet_pton" != "no"; then - AC_MSG_CHECKING([if inet_pton usage allowed]) - if test "x$cares_disallow_inet_pton" != "xyes"; then - AC_MSG_RESULT([yes]) - tst_allow_inet_pton="yes" - else - AC_MSG_RESULT([no]) - tst_allow_inet_pton="no" - fi - fi - # - AC_MSG_CHECKING([if inet_pton might be used]) - if test "$tst_links_inet_pton" = "yes" && - test "$tst_proto_inet_pton" = "yes" && - test "$tst_compi_inet_pton" = "yes" && - test "$tst_allow_inet_pton" = "yes" && - test "$tst_works_inet_pton" != "no"; then - AC_MSG_RESULT([yes]) - AC_DEFINE_UNQUOTED(HAVE_INET_PTON, 1, - [Define to 1 if you have a IPv6 capable working inet_pton function.]) - ac_cv_func_inet_pton="yes" - else - AC_MSG_RESULT([no]) - ac_cv_func_inet_pton="no" - fi -]) - - -dnl CARES_CHECK_FUNC_IOCTL -dnl ------------------------------------------------- -dnl Verify if ioctl is available, prototyped, and -dnl can be compiled. If all of these are true, and -dnl usage has not been previously disallowed with -dnl shell variable cares_disallow_ioctl, then -dnl HAVE_IOCTL will be defined. - -AC_DEFUN([CARES_CHECK_FUNC_IOCTL], [ - AC_REQUIRE([CARES_INCLUDES_STROPTS])dnl - # - tst_links_ioctl="unknown" - tst_proto_ioctl="unknown" - tst_compi_ioctl="unknown" - tst_allow_ioctl="unknown" - # - AC_MSG_CHECKING([if ioctl can be linked]) - AC_LINK_IFELSE([ - AC_LANG_FUNC_LINK_TRY([ioctl]) - ],[ - AC_MSG_RESULT([yes]) - tst_links_ioctl="yes" - ],[ - AC_MSG_RESULT([no]) - tst_links_ioctl="no" - ]) - # - if test "$tst_links_ioctl" = "yes"; then - AC_MSG_CHECKING([if ioctl is prototyped]) - AC_EGREP_CPP([ioctl],[ - $cares_includes_stropts - ],[ - AC_MSG_RESULT([yes]) - tst_proto_ioctl="yes" - ],[ - AC_MSG_RESULT([no]) - tst_proto_ioctl="no" - ]) - fi - # - if test "$tst_proto_ioctl" = "yes"; then - AC_MSG_CHECKING([if ioctl is compilable]) - AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM([[ - $cares_includes_stropts - ]],[[ - if(0 != ioctl(0, 0, 0)) - return 1; - ]]) - ],[ - AC_MSG_RESULT([yes]) - tst_compi_ioctl="yes" - ],[ - AC_MSG_RESULT([no]) - tst_compi_ioctl="no" - ]) - fi - # - if test "$tst_compi_ioctl" = "yes"; then - AC_MSG_CHECKING([if ioctl usage allowed]) - if test "x$cares_disallow_ioctl" != "xyes"; then - AC_MSG_RESULT([yes]) - tst_allow_ioctl="yes" - else - AC_MSG_RESULT([no]) - tst_allow_ioctl="no" - fi - fi - # - AC_MSG_CHECKING([if ioctl might be used]) - if test "$tst_links_ioctl" = "yes" && - test "$tst_proto_ioctl" = "yes" && - test "$tst_compi_ioctl" = "yes" && - test "$tst_allow_ioctl" = "yes"; then - AC_MSG_RESULT([yes]) - AC_DEFINE_UNQUOTED(HAVE_IOCTL, 1, - [Define to 1 if you have the ioctl function.]) - ac_cv_func_ioctl="yes" - CARES_CHECK_FUNC_IOCTL_FIONBIO - CARES_CHECK_FUNC_IOCTL_SIOCGIFADDR - else - AC_MSG_RESULT([no]) - ac_cv_func_ioctl="no" - fi -]) - - -dnl CARES_CHECK_FUNC_IOCTL_FIONBIO -dnl ------------------------------------------------- -dnl Verify if ioctl with the FIONBIO command is -dnl available, can be compiled, and seems to work. If -dnl all of these are true, then HAVE_IOCTL_FIONBIO -dnl will be defined. - -AC_DEFUN([CARES_CHECK_FUNC_IOCTL_FIONBIO], [ - # - tst_compi_ioctl_fionbio="unknown" - tst_allow_ioctl_fionbio="unknown" - # - if test "$ac_cv_func_ioctl" = "yes"; then - AC_MSG_CHECKING([if ioctl FIONBIO is compilable]) - AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM([[ - $cares_includes_stropts - ]],[[ - int flags = 0; - if(0 != ioctl(0, FIONBIO, &flags)) - return 1; - ]]) - ],[ - AC_MSG_RESULT([yes]) - tst_compi_ioctl_fionbio="yes" - ],[ - AC_MSG_RESULT([no]) - tst_compi_ioctl_fionbio="no" - ]) - fi - # - if test "$tst_compi_ioctl_fionbio" = "yes"; then - AC_MSG_CHECKING([if ioctl FIONBIO usage allowed]) - if test "x$cares_disallow_ioctl_fionbio" != "xyes"; then - AC_MSG_RESULT([yes]) - tst_allow_ioctl_fionbio="yes" - else - AC_MSG_RESULT([no]) - tst_allow_ioctl_fionbio="no" - fi - fi - # - AC_MSG_CHECKING([if ioctl FIONBIO might be used]) - if test "$tst_compi_ioctl_fionbio" = "yes" && - test "$tst_allow_ioctl_fionbio" = "yes"; then - AC_MSG_RESULT([yes]) - AC_DEFINE_UNQUOTED(HAVE_IOCTL_FIONBIO, 1, - [Define to 1 if you have a working ioctl FIONBIO function.]) - ac_cv_func_ioctl_fionbio="yes" - else - AC_MSG_RESULT([no]) - ac_cv_func_ioctl_fionbio="no" - fi -]) - - -dnl CARES_CHECK_FUNC_IOCTL_SIOCGIFADDR -dnl ------------------------------------------------- -dnl Verify if ioctl with the SIOCGIFADDR command is available, -dnl struct ifreq is defined, they can be compiled, and seem to -dnl work. If all of these are true, then HAVE_IOCTL_SIOCGIFADDR -dnl will be defined. - -AC_DEFUN([CARES_CHECK_FUNC_IOCTL_SIOCGIFADDR], [ - # - tst_compi_ioctl_siocgifaddr="unknown" - tst_allow_ioctl_siocgifaddr="unknown" - # - if test "$ac_cv_func_ioctl" = "yes"; then - AC_MSG_CHECKING([if ioctl SIOCGIFADDR is compilable]) - AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM([[ - $cares_includes_stropts - #include - ]],[[ - struct ifreq ifr; - if(0 != ioctl(0, SIOCGIFADDR, &ifr)) - return 1; - ]]) - ],[ - AC_MSG_RESULT([yes]) - tst_compi_ioctl_siocgifaddr="yes" - ],[ - AC_MSG_RESULT([no]) - tst_compi_ioctl_siocgifaddr="no" - ]) - fi - # - if test "$tst_compi_ioctl_siocgifaddr" = "yes"; then - AC_MSG_CHECKING([if ioctl SIOCGIFADDR usage allowed]) - if test "x$cares_disallow_ioctl_siocgifaddr" != "xyes"; then - AC_MSG_RESULT([yes]) - tst_allow_ioctl_siocgifaddr="yes" - else - AC_MSG_RESULT([no]) - tst_allow_ioctl_siocgifaddr="no" - fi - fi - # - AC_MSG_CHECKING([if ioctl SIOCGIFADDR might be used]) - if test "$tst_compi_ioctl_siocgifaddr" = "yes" && - test "$tst_allow_ioctl_siocgifaddr" = "yes"; then - AC_MSG_RESULT([yes]) - AC_DEFINE_UNQUOTED(HAVE_IOCTL_SIOCGIFADDR, 1, - [Define to 1 if you have a working ioctl SIOCGIFADDR function.]) - ac_cv_func_ioctl_siocgifaddr="yes" - else - AC_MSG_RESULT([no]) - ac_cv_func_ioctl_siocgifaddr="no" - fi -]) - - -dnl CARES_CHECK_FUNC_IOCTLSOCKET -dnl ------------------------------------------------- -dnl Verify if ioctlsocket is available, prototyped, and -dnl can be compiled. If all of these are true, and -dnl usage has not been previously disallowed with -dnl shell variable cares_disallow_ioctlsocket, then -dnl HAVE_IOCTLSOCKET will be defined. - -AC_DEFUN([CARES_CHECK_FUNC_IOCTLSOCKET], [ - AC_REQUIRE([CARES_INCLUDES_WINSOCK2])dnl - # - tst_links_ioctlsocket="unknown" - tst_proto_ioctlsocket="unknown" - tst_compi_ioctlsocket="unknown" - tst_allow_ioctlsocket="unknown" - # - AC_MSG_CHECKING([if ioctlsocket can be linked]) - AC_LINK_IFELSE([ - AC_LANG_PROGRAM([[ - $cares_includes_winsock2 - ]],[[ - if(0 != ioctlsocket(0, 0, 0)) - return 1; - ]]) - ],[ - AC_MSG_RESULT([yes]) - tst_links_ioctlsocket="yes" - ],[ - AC_MSG_RESULT([no]) - tst_links_ioctlsocket="no" - ]) - # - if test "$tst_links_ioctlsocket" = "yes"; then - AC_MSG_CHECKING([if ioctlsocket is prototyped]) - AC_EGREP_CPP([ioctlsocket],[ - $cares_includes_winsock2 - ],[ - AC_MSG_RESULT([yes]) - tst_proto_ioctlsocket="yes" - ],[ - AC_MSG_RESULT([no]) - tst_proto_ioctlsocket="no" - ]) - fi - # - if test "$tst_proto_ioctlsocket" = "yes"; then - AC_MSG_CHECKING([if ioctlsocket is compilable]) - AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM([[ - $cares_includes_winsock2 - ]],[[ - if(0 != ioctlsocket(0, 0, 0)) - return 1; - ]]) - ],[ - AC_MSG_RESULT([yes]) - tst_compi_ioctlsocket="yes" - ],[ - AC_MSG_RESULT([no]) - tst_compi_ioctlsocket="no" - ]) - fi - # - if test "$tst_compi_ioctlsocket" = "yes"; then - AC_MSG_CHECKING([if ioctlsocket usage allowed]) - if test "x$cares_disallow_ioctlsocket" != "xyes"; then - AC_MSG_RESULT([yes]) - tst_allow_ioctlsocket="yes" - else - AC_MSG_RESULT([no]) - tst_allow_ioctlsocket="no" - fi - fi - # - AC_MSG_CHECKING([if ioctlsocket might be used]) - if test "$tst_links_ioctlsocket" = "yes" && - test "$tst_proto_ioctlsocket" = "yes" && - test "$tst_compi_ioctlsocket" = "yes" && - test "$tst_allow_ioctlsocket" = "yes"; then - AC_MSG_RESULT([yes]) - AC_DEFINE_UNQUOTED(HAVE_IOCTLSOCKET, 1, - [Define to 1 if you have the ioctlsocket function.]) - ac_cv_func_ioctlsocket="yes" - CARES_CHECK_FUNC_IOCTLSOCKET_FIONBIO - else - AC_MSG_RESULT([no]) - ac_cv_func_ioctlsocket="no" - fi -]) - - -dnl CARES_CHECK_FUNC_IOCTLSOCKET_FIONBIO -dnl ------------------------------------------------- -dnl Verify if ioctlsocket with the FIONBIO command is -dnl available, can be compiled, and seems to work. If -dnl all of these are true, then HAVE_IOCTLSOCKET_FIONBIO -dnl will be defined. - -AC_DEFUN([CARES_CHECK_FUNC_IOCTLSOCKET_FIONBIO], [ - # - tst_compi_ioctlsocket_fionbio="unknown" - tst_allow_ioctlsocket_fionbio="unknown" - # - if test "$ac_cv_func_ioctlsocket" = "yes"; then - AC_MSG_CHECKING([if ioctlsocket FIONBIO is compilable]) - AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM([[ - $cares_includes_winsock2 - ]],[[ - int flags = 0; - if(0 != ioctlsocket(0, FIONBIO, &flags)) - return 1; - ]]) - ],[ - AC_MSG_RESULT([yes]) - tst_compi_ioctlsocket_fionbio="yes" - ],[ - AC_MSG_RESULT([no]) - tst_compi_ioctlsocket_fionbio="no" - ]) - fi - # - if test "$tst_compi_ioctlsocket_fionbio" = "yes"; then - AC_MSG_CHECKING([if ioctlsocket FIONBIO usage allowed]) - if test "x$cares_disallow_ioctlsocket_fionbio" != "xyes"; then - AC_MSG_RESULT([yes]) - tst_allow_ioctlsocket_fionbio="yes" - else - AC_MSG_RESULT([no]) - tst_allow_ioctlsocket_fionbio="no" - fi - fi - # - AC_MSG_CHECKING([if ioctlsocket FIONBIO might be used]) - if test "$tst_compi_ioctlsocket_fionbio" = "yes" && - test "$tst_allow_ioctlsocket_fionbio" = "yes"; then - AC_MSG_RESULT([yes]) - AC_DEFINE_UNQUOTED(HAVE_IOCTLSOCKET_FIONBIO, 1, - [Define to 1 if you have a working ioctlsocket FIONBIO function.]) - ac_cv_func_ioctlsocket_fionbio="yes" - else - AC_MSG_RESULT([no]) - ac_cv_func_ioctlsocket_fionbio="no" - fi -]) - - -dnl CARES_CHECK_FUNC_IOCTLSOCKET_CAMEL -dnl ------------------------------------------------- -dnl Verify if IoctlSocket is available, prototyped, and -dnl can be compiled. If all of these are true, and -dnl usage has not been previously disallowed with -dnl shell variable cares_disallow_ioctlsocket_camel, -dnl then HAVE_IOCTLSOCKET_CAMEL will be defined. - -AC_DEFUN([CARES_CHECK_FUNC_IOCTLSOCKET_CAMEL], [ - AC_REQUIRE([CARES_INCLUDES_STROPTS])dnl - # - tst_links_ioctlsocket_camel="unknown" - tst_proto_ioctlsocket_camel="unknown" - tst_compi_ioctlsocket_camel="unknown" - tst_allow_ioctlsocket_camel="unknown" - # - AC_MSG_CHECKING([if IoctlSocket can be linked]) - AC_LINK_IFELSE([ - AC_LANG_FUNC_LINK_TRY([IoctlSocket]) - ],[ - AC_MSG_RESULT([yes]) - tst_links_ioctlsocket_camel="yes" - ],[ - AC_MSG_RESULT([no]) - tst_links_ioctlsocket_camel="no" - ]) - # - if test "$tst_links_ioctlsocket_camel" = "yes"; then - AC_MSG_CHECKING([if IoctlSocket is prototyped]) - AC_EGREP_CPP([IoctlSocket],[ - $cares_includes_stropts - ],[ - AC_MSG_RESULT([yes]) - tst_proto_ioctlsocket_camel="yes" - ],[ - AC_MSG_RESULT([no]) - tst_proto_ioctlsocket_camel="no" - ]) - fi - # - if test "$tst_proto_ioctlsocket_camel" = "yes"; then - AC_MSG_CHECKING([if IoctlSocket is compilable]) - AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM([[ - $cares_includes_stropts - ]],[[ - if(0 != IoctlSocket(0, 0, 0)) - return 1; - ]]) - ],[ - AC_MSG_RESULT([yes]) - tst_compi_ioctlsocket_camel="yes" - ],[ - AC_MSG_RESULT([no]) - tst_compi_ioctlsocket_camel="no" - ]) - fi - # - if test "$tst_compi_ioctlsocket_camel" = "yes"; then - AC_MSG_CHECKING([if IoctlSocket usage allowed]) - if test "x$cares_disallow_ioctlsocket_camel" != "xyes"; then - AC_MSG_RESULT([yes]) - tst_allow_ioctlsocket_camel="yes" - else - AC_MSG_RESULT([no]) - tst_allow_ioctlsocket_camel="no" - fi - fi - # - AC_MSG_CHECKING([if IoctlSocket might be used]) - if test "$tst_links_ioctlsocket_camel" = "yes" && - test "$tst_proto_ioctlsocket_camel" = "yes" && - test "$tst_compi_ioctlsocket_camel" = "yes" && - test "$tst_allow_ioctlsocket_camel" = "yes"; then - AC_MSG_RESULT([yes]) - AC_DEFINE_UNQUOTED(HAVE_IOCTLSOCKET_CAMEL, 1, - [Define to 1 if you have the IoctlSocket camel case function.]) - ac_cv_func_ioctlsocket_camel="yes" - CARES_CHECK_FUNC_IOCTLSOCKET_CAMEL_FIONBIO - else - AC_MSG_RESULT([no]) - ac_cv_func_ioctlsocket_camel="no" - fi -]) - - -dnl CARES_CHECK_FUNC_IOCTLSOCKET_CAMEL_FIONBIO -dnl ------------------------------------------------- -dnl Verify if IoctlSocket with FIONBIO command is available, -dnl can be compiled, and seems to work. If all of these are -dnl true, then HAVE_IOCTLSOCKET_CAMEL_FIONBIO will be defined. - -AC_DEFUN([CARES_CHECK_FUNC_IOCTLSOCKET_CAMEL_FIONBIO], [ - # - tst_compi_ioctlsocket_camel_fionbio="unknown" - tst_allow_ioctlsocket_camel_fionbio="unknown" - # - if test "$ac_cv_func_ioctlsocket_camel" = "yes"; then - AC_MSG_CHECKING([if IoctlSocket FIONBIO is compilable]) - AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM([[ - $cares_includes_stropts - ]],[[ - long flags = 0; - if(0 != ioctlsocket(0, FIONBIO, &flags)) - return 1; - ]]) - ],[ - AC_MSG_RESULT([yes]) - tst_compi_ioctlsocket_camel_fionbio="yes" - ],[ - AC_MSG_RESULT([no]) - tst_compi_ioctlsocket_camel_fionbio="no" - ]) - fi - # - if test "$tst_compi_ioctlsocket_camel_fionbio" = "yes"; then - AC_MSG_CHECKING([if IoctlSocket FIONBIO usage allowed]) - if test "x$cares_disallow_ioctlsocket_camel_fionbio" != "xyes"; then - AC_MSG_RESULT([yes]) - tst_allow_ioctlsocket_camel_fionbio="yes" - else - AC_MSG_RESULT([no]) - tst_allow_ioctlsocket_camel_fionbio="no" - fi - fi - # - AC_MSG_CHECKING([if IoctlSocket FIONBIO might be used]) - if test "$tst_compi_ioctlsocket_camel_fionbio" = "yes" && - test "$tst_allow_ioctlsocket_camel_fionbio" = "yes"; then - AC_MSG_RESULT([yes]) - AC_DEFINE_UNQUOTED(HAVE_IOCTLSOCKET_CAMEL_FIONBIO, 1, - [Define to 1 if you have a working IoctlSocket camel case FIONBIO function.]) - ac_cv_func_ioctlsocket_camel_fionbio="yes" - else - AC_MSG_RESULT([no]) - ac_cv_func_ioctlsocket_camel_fionbio="no" - fi -]) - - -dnl CARES_CHECK_FUNC_SETSOCKOPT -dnl ------------------------------------------------- -dnl Verify if setsockopt is available, prototyped, and -dnl can be compiled. If all of these are true, and -dnl usage has not been previously disallowed with -dnl shell variable cares_disallow_setsockopt, then -dnl HAVE_SETSOCKOPT will be defined. - -AC_DEFUN([CARES_CHECK_FUNC_SETSOCKOPT], [ - AC_REQUIRE([CARES_INCLUDES_WINSOCK2])dnl - AC_REQUIRE([CARES_INCLUDES_SYS_SOCKET])dnl - # - tst_links_setsockopt="unknown" - tst_proto_setsockopt="unknown" - tst_compi_setsockopt="unknown" - tst_allow_setsockopt="unknown" - # - AC_MSG_CHECKING([if setsockopt can be linked]) - AC_LINK_IFELSE([ - AC_LANG_PROGRAM([[ - $cares_includes_winsock2 - $cares_includes_sys_socket - ]],[[ - if(0 != setsockopt(0, 0, 0, 0, 0)) - return 1; - ]]) - ],[ - AC_MSG_RESULT([yes]) - tst_links_setsockopt="yes" - ],[ - AC_MSG_RESULT([no]) - tst_links_setsockopt="no" - ]) - # - if test "$tst_links_setsockopt" = "yes"; then - AC_MSG_CHECKING([if setsockopt is prototyped]) - AC_EGREP_CPP([setsockopt],[ - $cares_includes_winsock2 - $cares_includes_sys_socket - ],[ - AC_MSG_RESULT([yes]) - tst_proto_setsockopt="yes" - ],[ - AC_MSG_RESULT([no]) - tst_proto_setsockopt="no" - ]) - fi - # - if test "$tst_proto_setsockopt" = "yes"; then - AC_MSG_CHECKING([if setsockopt is compilable]) - AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM([[ - $cares_includes_winsock2 - $cares_includes_sys_socket - ]],[[ - if(0 != setsockopt(0, 0, 0, 0, 0)) - return 1; - ]]) - ],[ - AC_MSG_RESULT([yes]) - tst_compi_setsockopt="yes" - ],[ - AC_MSG_RESULT([no]) - tst_compi_setsockopt="no" - ]) - fi - # - if test "$tst_compi_setsockopt" = "yes"; then - AC_MSG_CHECKING([if setsockopt usage allowed]) - if test "x$cares_disallow_setsockopt" != "xyes"; then - AC_MSG_RESULT([yes]) - tst_allow_setsockopt="yes" - else - AC_MSG_RESULT([no]) - tst_allow_setsockopt="no" - fi - fi - # - AC_MSG_CHECKING([if setsockopt might be used]) - if test "$tst_links_setsockopt" = "yes" && - test "$tst_proto_setsockopt" = "yes" && - test "$tst_compi_setsockopt" = "yes" && - test "$tst_allow_setsockopt" = "yes"; then - AC_MSG_RESULT([yes]) - AC_DEFINE_UNQUOTED(HAVE_SETSOCKOPT, 1, - [Define to 1 if you have the setsockopt function.]) - ac_cv_func_setsockopt="yes" - CARES_CHECK_FUNC_SETSOCKOPT_SO_NONBLOCK - else - AC_MSG_RESULT([no]) - ac_cv_func_setsockopt="no" - fi -]) - - -dnl CARES_CHECK_FUNC_SETSOCKOPT_SO_NONBLOCK -dnl ------------------------------------------------- -dnl Verify if setsockopt with the SO_NONBLOCK command is -dnl available, can be compiled, and seems to work. If -dnl all of these are true, then HAVE_SETSOCKOPT_SO_NONBLOCK -dnl will be defined. - -AC_DEFUN([CARES_CHECK_FUNC_SETSOCKOPT_SO_NONBLOCK], [ - # - tst_compi_setsockopt_so_nonblock="unknown" - tst_allow_setsockopt_so_nonblock="unknown" - # - if test "$ac_cv_func_setsockopt" = "yes"; then - AC_MSG_CHECKING([if setsockopt SO_NONBLOCK is compilable]) - AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM([[ - $cares_includes_winsock2 - $cares_includes_sys_socket - ]],[[ - if(0 != setsockopt(0, SOL_SOCKET, SO_NONBLOCK, 0, 0)) - return 1; - ]]) - ],[ - AC_MSG_RESULT([yes]) - tst_compi_setsockopt_so_nonblock="yes" - ],[ - AC_MSG_RESULT([no]) - tst_compi_setsockopt_so_nonblock="no" - ]) - fi - # - if test "$tst_compi_setsockopt_so_nonblock" = "yes"; then - AC_MSG_CHECKING([if setsockopt SO_NONBLOCK usage allowed]) - if test "x$cares_disallow_setsockopt_so_nonblock" != "xyes"; then - AC_MSG_RESULT([yes]) - tst_allow_setsockopt_so_nonblock="yes" - else - AC_MSG_RESULT([no]) - tst_allow_setsockopt_so_nonblock="no" - fi - fi - # - AC_MSG_CHECKING([if setsockopt SO_NONBLOCK might be used]) - if test "$tst_compi_setsockopt_so_nonblock" = "yes" && - test "$tst_allow_setsockopt_so_nonblock" = "yes"; then - AC_MSG_RESULT([yes]) - AC_DEFINE_UNQUOTED(HAVE_SETSOCKOPT_SO_NONBLOCK, 1, - [Define to 1 if you have a working setsockopt SO_NONBLOCK function.]) - ac_cv_func_setsockopt_so_nonblock="yes" - else - AC_MSG_RESULT([no]) - ac_cv_func_setsockopt_so_nonblock="no" - fi -]) - - -dnl CARES_CHECK_FUNC_SOCKET -dnl ------------------------------------------------- -dnl Verify if socket is available, prototyped, and -dnl can be compiled. If all of these are true, and -dnl usage has not been previously disallowed with -dnl shell variable cares_disallow_socket, then -dnl HAVE_SOCKET will be defined. - -AC_DEFUN([CARES_CHECK_FUNC_SOCKET], [ - AC_REQUIRE([CARES_INCLUDES_WINSOCK2])dnl - AC_REQUIRE([CARES_INCLUDES_SYS_SOCKET])dnl - AC_REQUIRE([CARES_INCLUDES_SOCKET])dnl - # - tst_links_socket="unknown" - tst_proto_socket="unknown" - tst_compi_socket="unknown" - tst_allow_socket="unknown" - # - AC_MSG_CHECKING([if socket can be linked]) - AC_LINK_IFELSE([ - AC_LANG_PROGRAM([[ - $cares_includes_winsock2 - $cares_includes_sys_socket - $cares_includes_socket - ]],[[ - if(0 != socket(0, 0, 0)) - return 1; - ]]) - ],[ - AC_MSG_RESULT([yes]) - tst_links_socket="yes" - ],[ - AC_MSG_RESULT([no]) - tst_links_socket="no" - ]) - # - if test "$tst_links_socket" = "yes"; then - AC_MSG_CHECKING([if socket is prototyped]) - AC_EGREP_CPP([socket],[ - $cares_includes_winsock2 - $cares_includes_sys_socket - $cares_includes_socket - ],[ - AC_MSG_RESULT([yes]) - tst_proto_socket="yes" - ],[ - AC_MSG_RESULT([no]) - tst_proto_socket="no" - ]) - fi - # - if test "$tst_proto_socket" = "yes"; then - AC_MSG_CHECKING([if socket is compilable]) - AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM([[ - $cares_includes_winsock2 - $cares_includes_sys_socket - $cares_includes_socket - ]],[[ - if(0 != socket(0, 0, 0)) - return 1; - ]]) - ],[ - AC_MSG_RESULT([yes]) - tst_compi_socket="yes" - ],[ - AC_MSG_RESULT([no]) - tst_compi_socket="no" - ]) - fi - # - if test "$tst_compi_socket" = "yes"; then - AC_MSG_CHECKING([if socket usage allowed]) - if test "x$cares_disallow_socket" != "xyes"; then - AC_MSG_RESULT([yes]) - tst_allow_socket="yes" - else - AC_MSG_RESULT([no]) - tst_allow_socket="no" - fi - fi - # - AC_MSG_CHECKING([if socket might be used]) - if test "$tst_links_socket" = "yes" && - test "$tst_proto_socket" = "yes" && - test "$tst_compi_socket" = "yes" && - test "$tst_allow_socket" = "yes"; then - AC_MSG_RESULT([yes]) - AC_DEFINE_UNQUOTED(HAVE_SOCKET, 1, - [Define to 1 if you have the socket function.]) - ac_cv_func_socket="yes" - else - AC_MSG_RESULT([no]) - ac_cv_func_socket="no" - fi -]) - - -dnl CARES_CHECK_FUNC_STRCASECMP -dnl ------------------------------------------------- -dnl Verify if strcasecmp is available, prototyped, and -dnl can be compiled. If all of these are true, and -dnl usage has not been previously disallowed with -dnl shell variable cares_disallow_strcasecmp, then -dnl HAVE_STRCASECMP will be defined. - -AC_DEFUN([CARES_CHECK_FUNC_STRCASECMP], [ - AC_REQUIRE([CARES_INCLUDES_STRING])dnl - # - tst_links_strcasecmp="unknown" - tst_proto_strcasecmp="unknown" - tst_compi_strcasecmp="unknown" - tst_allow_strcasecmp="unknown" - # - AC_MSG_CHECKING([if strcasecmp can be linked]) - AC_LINK_IFELSE([ - AC_LANG_FUNC_LINK_TRY([strcasecmp]) - ],[ - AC_MSG_RESULT([yes]) - tst_links_strcasecmp="yes" - ],[ - AC_MSG_RESULT([no]) - tst_links_strcasecmp="no" - ]) - # - if test "$tst_links_strcasecmp" = "yes"; then - AC_MSG_CHECKING([if strcasecmp is prototyped]) - AC_EGREP_CPP([strcasecmp],[ - $cares_includes_string - ],[ - AC_MSG_RESULT([yes]) - tst_proto_strcasecmp="yes" - ],[ - AC_MSG_RESULT([no]) - tst_proto_strcasecmp="no" - ]) - fi - # - if test "$tst_proto_strcasecmp" = "yes"; then - AC_MSG_CHECKING([if strcasecmp is compilable]) - AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM([[ - $cares_includes_string - ]],[[ - if(0 != strcasecmp(0, 0)) - return 1; - ]]) - ],[ - AC_MSG_RESULT([yes]) - tst_compi_strcasecmp="yes" - ],[ - AC_MSG_RESULT([no]) - tst_compi_strcasecmp="no" - ]) - fi - # - if test "$tst_compi_strcasecmp" = "yes"; then - AC_MSG_CHECKING([if strcasecmp usage allowed]) - if test "x$cares_disallow_strcasecmp" != "xyes"; then - AC_MSG_RESULT([yes]) - tst_allow_strcasecmp="yes" - else - AC_MSG_RESULT([no]) - tst_allow_strcasecmp="no" - fi - fi - # - AC_MSG_CHECKING([if strcasecmp might be used]) - if test "$tst_links_strcasecmp" = "yes" && - test "$tst_proto_strcasecmp" = "yes" && - test "$tst_compi_strcasecmp" = "yes" && - test "$tst_allow_strcasecmp" = "yes"; then - AC_MSG_RESULT([yes]) - AC_DEFINE_UNQUOTED(HAVE_STRCASECMP, 1, - [Define to 1 if you have the strcasecmp function.]) - ac_cv_func_strcasecmp="yes" - else - AC_MSG_RESULT([no]) - ac_cv_func_strcasecmp="no" - fi -]) - - -dnl CARES_CHECK_FUNC_STRCMPI -dnl ------------------------------------------------- -dnl Verify if strcmpi is available, prototyped, and -dnl can be compiled. If all of these are true, and -dnl usage has not been previously disallowed with -dnl shell variable cares_disallow_strcmpi, then -dnl HAVE_STRCMPI will be defined. - -AC_DEFUN([CARES_CHECK_FUNC_STRCMPI], [ - AC_REQUIRE([CARES_INCLUDES_STRING])dnl - # - tst_links_strcmpi="unknown" - tst_proto_strcmpi="unknown" - tst_compi_strcmpi="unknown" - tst_allow_strcmpi="unknown" - # - AC_MSG_CHECKING([if strcmpi can be linked]) - AC_LINK_IFELSE([ - AC_LANG_FUNC_LINK_TRY([strcmpi]) - ],[ - AC_MSG_RESULT([yes]) - tst_links_strcmpi="yes" - ],[ - AC_MSG_RESULT([no]) - tst_links_strcmpi="no" - ]) - # - if test "$tst_links_strcmpi" = "yes"; then - AC_MSG_CHECKING([if strcmpi is prototyped]) - AC_EGREP_CPP([strcmpi],[ - $cares_includes_string - ],[ - AC_MSG_RESULT([yes]) - tst_proto_strcmpi="yes" - ],[ - AC_MSG_RESULT([no]) - tst_proto_strcmpi="no" - ]) - fi - # - if test "$tst_proto_strcmpi" = "yes"; then - AC_MSG_CHECKING([if strcmpi is compilable]) - AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM([[ - $cares_includes_string - ]],[[ - if(0 != strcmpi(0, 0)) - return 1; - ]]) - ],[ - AC_MSG_RESULT([yes]) - tst_compi_strcmpi="yes" - ],[ - AC_MSG_RESULT([no]) - tst_compi_strcmpi="no" - ]) - fi - # - if test "$tst_compi_strcmpi" = "yes"; then - AC_MSG_CHECKING([if strcmpi usage allowed]) - if test "x$cares_disallow_strcmpi" != "xyes"; then - AC_MSG_RESULT([yes]) - tst_allow_strcmpi="yes" - else - AC_MSG_RESULT([no]) - tst_allow_strcmpi="no" - fi - fi - # - AC_MSG_CHECKING([if strcmpi might be used]) - if test "$tst_links_strcmpi" = "yes" && - test "$tst_proto_strcmpi" = "yes" && - test "$tst_compi_strcmpi" = "yes" && - test "$tst_allow_strcmpi" = "yes"; then - AC_MSG_RESULT([yes]) - AC_DEFINE_UNQUOTED(HAVE_STRCMPI, 1, - [Define to 1 if you have the strcmpi function.]) - ac_cv_func_strcmpi="yes" - else - AC_MSG_RESULT([no]) - ac_cv_func_strcmpi="no" - fi -]) - - -dnl CARES_CHECK_FUNC_STRDUP -dnl ------------------------------------------------- -dnl Verify if strdup is available, prototyped, and -dnl can be compiled. If all of these are true, and -dnl usage has not been previously disallowed with -dnl shell variable cares_disallow_strdup, then -dnl HAVE_STRDUP will be defined. - -AC_DEFUN([CARES_CHECK_FUNC_STRDUP], [ - AC_REQUIRE([CARES_INCLUDES_STRING])dnl - # - tst_links_strdup="unknown" - tst_proto_strdup="unknown" - tst_compi_strdup="unknown" - tst_allow_strdup="unknown" - # - AC_MSG_CHECKING([if strdup can be linked]) - AC_LINK_IFELSE([ - AC_LANG_FUNC_LINK_TRY([strdup]) - ],[ - AC_MSG_RESULT([yes]) - tst_links_strdup="yes" - ],[ - AC_MSG_RESULT([no]) - tst_links_strdup="no" - ]) - # - if test "$tst_links_strdup" = "yes"; then - AC_MSG_CHECKING([if strdup is prototyped]) - AC_EGREP_CPP([strdup],[ - $cares_includes_string - ],[ - AC_MSG_RESULT([yes]) - tst_proto_strdup="yes" - ],[ - AC_MSG_RESULT([no]) - tst_proto_strdup="no" - ]) - fi - # - if test "$tst_proto_strdup" = "yes"; then - AC_MSG_CHECKING([if strdup is compilable]) - AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM([[ - $cares_includes_string - ]],[[ - if(0 != strdup(0)) - return 1; - ]]) - ],[ - AC_MSG_RESULT([yes]) - tst_compi_strdup="yes" - ],[ - AC_MSG_RESULT([no]) - tst_compi_strdup="no" - ]) - fi - # - if test "$tst_compi_strdup" = "yes"; then - AC_MSG_CHECKING([if strdup usage allowed]) - if test "x$cares_disallow_strdup" != "xyes"; then - AC_MSG_RESULT([yes]) - tst_allow_strdup="yes" - else - AC_MSG_RESULT([no]) - tst_allow_strdup="no" - fi - fi - # - AC_MSG_CHECKING([if strdup might be used]) - if test "$tst_links_strdup" = "yes" && - test "$tst_proto_strdup" = "yes" && - test "$tst_compi_strdup" = "yes" && - test "$tst_allow_strdup" = "yes"; then - AC_MSG_RESULT([yes]) - AC_DEFINE_UNQUOTED(HAVE_STRDUP, 1, - [Define to 1 if you have the strdup function.]) - ac_cv_func_strdup="yes" - else - AC_MSG_RESULT([no]) - ac_cv_func_strdup="no" - fi -]) - - -dnl CARES_CHECK_FUNC_STRICMP -dnl ------------------------------------------------- -dnl Verify if stricmp is available, prototyped, and -dnl can be compiled. If all of these are true, and -dnl usage has not been previously disallowed with -dnl shell variable cares_disallow_stricmp, then -dnl HAVE_STRICMP will be defined. - -AC_DEFUN([CARES_CHECK_FUNC_STRICMP], [ - AC_REQUIRE([CARES_INCLUDES_STRING])dnl - # - tst_links_stricmp="unknown" - tst_proto_stricmp="unknown" - tst_compi_stricmp="unknown" - tst_allow_stricmp="unknown" - # - AC_MSG_CHECKING([if stricmp can be linked]) - AC_LINK_IFELSE([ - AC_LANG_FUNC_LINK_TRY([stricmp]) - ],[ - AC_MSG_RESULT([yes]) - tst_links_stricmp="yes" - ],[ - AC_MSG_RESULT([no]) - tst_links_stricmp="no" - ]) - # - if test "$tst_links_stricmp" = "yes"; then - AC_MSG_CHECKING([if stricmp is prototyped]) - AC_EGREP_CPP([stricmp],[ - $cares_includes_string - ],[ - AC_MSG_RESULT([yes]) - tst_proto_stricmp="yes" - ],[ - AC_MSG_RESULT([no]) - tst_proto_stricmp="no" - ]) - fi - # - if test "$tst_proto_stricmp" = "yes"; then - AC_MSG_CHECKING([if stricmp is compilable]) - AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM([[ - $cares_includes_string - ]],[[ - if(0 != stricmp(0, 0)) - return 1; - ]]) - ],[ - AC_MSG_RESULT([yes]) - tst_compi_stricmp="yes" - ],[ - AC_MSG_RESULT([no]) - tst_compi_stricmp="no" - ]) - fi - # - if test "$tst_compi_stricmp" = "yes"; then - AC_MSG_CHECKING([if stricmp usage allowed]) - if test "x$cares_disallow_stricmp" != "xyes"; then - AC_MSG_RESULT([yes]) - tst_allow_stricmp="yes" - else - AC_MSG_RESULT([no]) - tst_allow_stricmp="no" - fi - fi - # - AC_MSG_CHECKING([if stricmp might be used]) - if test "$tst_links_stricmp" = "yes" && - test "$tst_proto_stricmp" = "yes" && - test "$tst_compi_stricmp" = "yes" && - test "$tst_allow_stricmp" = "yes"; then - AC_MSG_RESULT([yes]) - AC_DEFINE_UNQUOTED(HAVE_STRICMP, 1, - [Define to 1 if you have the stricmp function.]) - ac_cv_func_stricmp="yes" - else - AC_MSG_RESULT([no]) - ac_cv_func_stricmp="no" - fi -]) - - -dnl CARES_CHECK_FUNC_STRNCASECMP -dnl ------------------------------------------------- -dnl Verify if strncasecmp is available, prototyped, and -dnl can be compiled. If all of these are true, and -dnl usage has not been previously disallowed with -dnl shell variable cares_disallow_strncasecmp, then -dnl HAVE_STRNCASECMP will be defined. - -AC_DEFUN([CARES_CHECK_FUNC_STRNCASECMP], [ - AC_REQUIRE([CARES_INCLUDES_STRING])dnl - # - tst_links_strncasecmp="unknown" - tst_proto_strncasecmp="unknown" - tst_compi_strncasecmp="unknown" - tst_allow_strncasecmp="unknown" - # - AC_MSG_CHECKING([if strncasecmp can be linked]) - AC_LINK_IFELSE([ - AC_LANG_FUNC_LINK_TRY([strncasecmp]) - ],[ - AC_MSG_RESULT([yes]) - tst_links_strncasecmp="yes" - ],[ - AC_MSG_RESULT([no]) - tst_links_strncasecmp="no" - ]) - # - if test "$tst_links_strncasecmp" = "yes"; then - AC_MSG_CHECKING([if strncasecmp is prototyped]) - AC_EGREP_CPP([strncasecmp],[ - $cares_includes_string - ],[ - AC_MSG_RESULT([yes]) - tst_proto_strncasecmp="yes" - ],[ - AC_MSG_RESULT([no]) - tst_proto_strncasecmp="no" - ]) - fi - # - if test "$tst_proto_strncasecmp" = "yes"; then - AC_MSG_CHECKING([if strncasecmp is compilable]) - AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM([[ - $cares_includes_string - ]],[[ - if(0 != strncasecmp(0, 0, 0)) - return 1; - ]]) - ],[ - AC_MSG_RESULT([yes]) - tst_compi_strncasecmp="yes" - ],[ - AC_MSG_RESULT([no]) - tst_compi_strncasecmp="no" - ]) - fi - # - if test "$tst_compi_strncasecmp" = "yes"; then - AC_MSG_CHECKING([if strncasecmp usage allowed]) - if test "x$cares_disallow_strncasecmp" != "xyes"; then - AC_MSG_RESULT([yes]) - tst_allow_strncasecmp="yes" - else - AC_MSG_RESULT([no]) - tst_allow_strncasecmp="no" - fi - fi - # - AC_MSG_CHECKING([if strncasecmp might be used]) - if test "$tst_links_strncasecmp" = "yes" && - test "$tst_proto_strncasecmp" = "yes" && - test "$tst_compi_strncasecmp" = "yes" && - test "$tst_allow_strncasecmp" = "yes"; then - AC_MSG_RESULT([yes]) - AC_DEFINE_UNQUOTED(HAVE_STRNCASECMP, 1, - [Define to 1 if you have the strncasecmp function.]) - ac_cv_func_strncasecmp="yes" - else - AC_MSG_RESULT([no]) - ac_cv_func_strncasecmp="no" - fi -]) - - -dnl CARES_CHECK_FUNC_STRNCMPI -dnl ------------------------------------------------- -dnl Verify if strncmpi is available, prototyped, and -dnl can be compiled. If all of these are true, and -dnl usage has not been previously disallowed with -dnl shell variable cares_disallow_strncmpi, then -dnl HAVE_STRNCMPI will be defined. - -AC_DEFUN([CARES_CHECK_FUNC_STRNCMPI], [ - AC_REQUIRE([CARES_INCLUDES_STRING])dnl - # - tst_links_strncmpi="unknown" - tst_proto_strncmpi="unknown" - tst_compi_strncmpi="unknown" - tst_allow_strncmpi="unknown" - # - AC_MSG_CHECKING([if strncmpi can be linked]) - AC_LINK_IFELSE([ - AC_LANG_FUNC_LINK_TRY([strncmpi]) - ],[ - AC_MSG_RESULT([yes]) - tst_links_strncmpi="yes" - ],[ - AC_MSG_RESULT([no]) - tst_links_strncmpi="no" - ]) - # - if test "$tst_links_strncmpi" = "yes"; then - AC_MSG_CHECKING([if strncmpi is prototyped]) - AC_EGREP_CPP([strncmpi],[ - $cares_includes_string - ],[ - AC_MSG_RESULT([yes]) - tst_proto_strncmpi="yes" - ],[ - AC_MSG_RESULT([no]) - tst_proto_strncmpi="no" - ]) - fi - # - if test "$tst_proto_strncmpi" = "yes"; then - AC_MSG_CHECKING([if strncmpi is compilable]) - AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM([[ - $cares_includes_string - ]],[[ - if(0 != strncmpi(0, 0)) - return 1; - ]]) - ],[ - AC_MSG_RESULT([yes]) - tst_compi_strncmpi="yes" - ],[ - AC_MSG_RESULT([no]) - tst_compi_strncmpi="no" - ]) - fi - # - if test "$tst_compi_strncmpi" = "yes"; then - AC_MSG_CHECKING([if strncmpi usage allowed]) - if test "x$cares_disallow_strncmpi" != "xyes"; then - AC_MSG_RESULT([yes]) - tst_allow_strncmpi="yes" - else - AC_MSG_RESULT([no]) - tst_allow_strncmpi="no" - fi - fi - # - AC_MSG_CHECKING([if strncmpi might be used]) - if test "$tst_links_strncmpi" = "yes" && - test "$tst_proto_strncmpi" = "yes" && - test "$tst_compi_strncmpi" = "yes" && - test "$tst_allow_strncmpi" = "yes"; then - AC_MSG_RESULT([yes]) - AC_DEFINE_UNQUOTED(HAVE_STRNCMPI, 1, - [Define to 1 if you have the strncmpi function.]) - ac_cv_func_strncmpi="yes" - else - AC_MSG_RESULT([no]) - ac_cv_func_strncmpi="no" - fi -]) - - -dnl CARES_CHECK_FUNC_STRNICMP -dnl ------------------------------------------------- -dnl Verify if strnicmp is available, prototyped, and -dnl can be compiled. If all of these are true, and -dnl usage has not been previously disallowed with -dnl shell variable cares_disallow_strnicmp, then -dnl HAVE_STRNICMP will be defined. - -AC_DEFUN([CARES_CHECK_FUNC_STRNICMP], [ - AC_REQUIRE([CARES_INCLUDES_STRING])dnl - # - tst_links_strnicmp="unknown" - tst_proto_strnicmp="unknown" - tst_compi_strnicmp="unknown" - tst_allow_strnicmp="unknown" - # - AC_MSG_CHECKING([if strnicmp can be linked]) - AC_LINK_IFELSE([ - AC_LANG_FUNC_LINK_TRY([strnicmp]) - ],[ - AC_MSG_RESULT([yes]) - tst_links_strnicmp="yes" - ],[ - AC_MSG_RESULT([no]) - tst_links_strnicmp="no" - ]) - # - if test "$tst_links_strnicmp" = "yes"; then - AC_MSG_CHECKING([if strnicmp is prototyped]) - AC_EGREP_CPP([strnicmp],[ - $cares_includes_string - ],[ - AC_MSG_RESULT([yes]) - tst_proto_strnicmp="yes" - ],[ - AC_MSG_RESULT([no]) - tst_proto_strnicmp="no" - ]) - fi - # - if test "$tst_proto_strnicmp" = "yes"; then - AC_MSG_CHECKING([if strnicmp is compilable]) - AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM([[ - $cares_includes_string - ]],[[ - if(0 != strnicmp(0, 0)) - return 1; - ]]) - ],[ - AC_MSG_RESULT([yes]) - tst_compi_strnicmp="yes" - ],[ - AC_MSG_RESULT([no]) - tst_compi_strnicmp="no" - ]) - fi - # - if test "$tst_compi_strnicmp" = "yes"; then - AC_MSG_CHECKING([if strnicmp usage allowed]) - if test "x$cares_disallow_strnicmp" != "xyes"; then - AC_MSG_RESULT([yes]) - tst_allow_strnicmp="yes" - else - AC_MSG_RESULT([no]) - tst_allow_strnicmp="no" - fi - fi - # - AC_MSG_CHECKING([if strnicmp might be used]) - if test "$tst_links_strnicmp" = "yes" && - test "$tst_proto_strnicmp" = "yes" && - test "$tst_compi_strnicmp" = "yes" && - test "$tst_allow_strnicmp" = "yes"; then - AC_MSG_RESULT([yes]) - AC_DEFINE_UNQUOTED(HAVE_STRNICMP, 1, - [Define to 1 if you have the strnicmp function.]) - ac_cv_func_strnicmp="yes" - else - AC_MSG_RESULT([no]) - ac_cv_func_strnicmp="no" - fi -]) - - -dnl CARES_CHECK_FUNC_WRITEV -dnl ------------------------------------------------- -dnl Verify if writev is available, prototyped, and -dnl can be compiled. If all of these are true, and -dnl usage has not been previously disallowed with -dnl shell variable cares_disallow_writev, then -dnl HAVE_WRITEV will be defined. - -AC_DEFUN([CARES_CHECK_FUNC_WRITEV], [ - AC_REQUIRE([CARES_INCLUDES_SYS_UIO])dnl - # - tst_links_writev="unknown" - tst_proto_writev="unknown" - tst_compi_writev="unknown" - tst_allow_writev="unknown" - # - AC_MSG_CHECKING([if writev can be linked]) - AC_LINK_IFELSE([ - AC_LANG_FUNC_LINK_TRY([writev]) - ],[ - AC_MSG_RESULT([yes]) - tst_links_writev="yes" - ],[ - AC_MSG_RESULT([no]) - tst_links_writev="no" - ]) - # - if test "$tst_links_writev" = "yes"; then - AC_MSG_CHECKING([if writev is prototyped]) - AC_EGREP_CPP([writev],[ - $cares_includes_sys_uio - ],[ - AC_MSG_RESULT([yes]) - tst_proto_writev="yes" - ],[ - AC_MSG_RESULT([no]) - tst_proto_writev="no" - ]) - fi - # - if test "$tst_proto_writev" = "yes"; then - AC_MSG_CHECKING([if writev is compilable]) - AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM([[ - $cares_includes_sys_uio - ]],[[ - if(0 != writev(0, 0, 0)) - return 1; - ]]) - ],[ - AC_MSG_RESULT([yes]) - tst_compi_writev="yes" - ],[ - AC_MSG_RESULT([no]) - tst_compi_writev="no" - ]) - fi - # - if test "$tst_compi_writev" = "yes"; then - AC_MSG_CHECKING([if writev usage allowed]) - if test "x$cares_disallow_writev" != "xyes"; then - AC_MSG_RESULT([yes]) - tst_allow_writev="yes" - else - AC_MSG_RESULT([no]) - tst_allow_writev="no" - fi - fi - # - AC_MSG_CHECKING([if writev might be used]) - if test "$tst_links_writev" = "yes" && - test "$tst_proto_writev" = "yes" && - test "$tst_compi_writev" = "yes" && - test "$tst_allow_writev" = "yes"; then - AC_MSG_RESULT([yes]) - AC_DEFINE_UNQUOTED(HAVE_WRITEV, 1, - [Define to 1 if you have the writev function.]) - ac_cv_func_writev="yes" - else - AC_MSG_RESULT([no]) - ac_cv_func_writev="no" - fi -]) - -dnl CARES_CHECK_FUNC_GETIFADDRS -dnl ------------------------------------------------- -dnl Verify if getifaddrs is available, prototyped, and -dnl can be compiled. If all of these are true, and -dnl usage has not been previously disallowed with -dnl shell variable cares_disallow_getifaddrs, then -dnl HAVE_GETIFADDRS will be defined. - -AC_DEFUN([CARES_CHECK_FUNC_GETIFADDRS], [ - # - tst_links_getifaddrs="unknown" - tst_proto_getifaddrs="unknown" - tst_compi_getifaddrs="unknown" - tst_allow_getifaddrs="unknown" - # - AC_MSG_CHECKING([if getifaddrs can be linked]) - AC_LINK_IFELSE([ - AC_LANG_FUNC_LINK_TRY([getifaddrs]) - ],[ - AC_MSG_RESULT([yes]) - tst_links_getifaddrs="yes" - ],[ - AC_MSG_RESULT([no]) - tst_links_getifaddrs="no" - ]) - # - if test "$tst_links_getifaddrs" = "yes"; then - AC_MSG_CHECKING([if getifaddrs is prototyped]) - AC_EGREP_CPP([getifaddrs],[ - #include - ],[ - AC_MSG_RESULT([yes]) - tst_proto_getifaddrs="yes" - ],[ - AC_MSG_RESULT([no]) - tst_proto_getifaddrs="no" - ]) - fi - # - if test "$tst_proto_getifaddrs" = "yes"; then - AC_MSG_CHECKING([if getifaddrs is compilable]) - AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM([[ - #include - #include - #include - #include - ]],[[ - if(0 != getifaddrs(NULL)) - return 1; - ]]) - ],[ - AC_MSG_RESULT([yes]) - tst_compi_getifaddrs="yes" - ],[ - AC_MSG_RESULT([no]) - tst_compi_getifaddrs="no" - ]) - fi - # - if test "$tst_compi_getifaddrs" = "yes"; then - AC_MSG_CHECKING([if getifaddrs usage allowed]) - if test "x$cares_disallow_getifaddrs" != "xyes"; then - AC_MSG_RESULT([yes]) - tst_allow_getifaddrs="yes" - else - AC_MSG_RESULT([no]) - tst_allow_getifaddrs="no" - fi - fi - # - AC_MSG_CHECKING([if getifaddrs might be used]) - if test "$tst_links_getifaddrs" = "yes" && - test "$tst_proto_getifaddrs" = "yes" && - test "$tst_compi_getifaddrs" = "yes" && - test "$tst_allow_getifaddrs" = "yes"; then - AC_MSG_RESULT([yes]) - AC_DEFINE_UNQUOTED(HAVE_GETIFADDRS, 1, - [Define to 1 if you have the getifaddrs function.]) - ac_cv_func_getifaddrs="yes" - else - AC_MSG_RESULT([no]) - ac_cv_func_getifaddrs="no" - fi -]) - - -dnl CARES_CHECK_FUNC_STAT -dnl ------------------------------------------------- -dnl Verify if stat is available, prototyped, and -dnl can be compiled. If all of these are true, and -dnl usage has not been previously disallowed with -dnl shell variable cares_disallow_stat, then -dnl HAVE_STAT will be defined. - -AC_DEFUN([CARES_CHECK_FUNC_STAT], [ - AC_REQUIRE([CARES_INCLUDES_SYS_STAT])dnl - # - tst_links_stat="unknown" - tst_proto_stat="unknown" - tst_compi_stat="unknown" - tst_allow_stat="unknown" - # - AC_MSG_CHECKING([if stat can be linked]) - AC_LINK_IFELSE([ - AC_LANG_FUNC_LINK_TRY([stat]) - ],[ - AC_MSG_RESULT([yes]) - tst_links_stat="yes" - ],[ - AC_MSG_RESULT([no]) - tst_links_stat="no" - ]) - # - if test "$tst_links_stat" = "yes"; then - AC_MSG_CHECKING([if stat is prototyped]) - AC_EGREP_CPP([stat],[ - $cares_includes_sys_stat - ],[ - AC_MSG_RESULT([yes]) - tst_proto_stat="yes" - ],[ - AC_MSG_RESULT([no]) - tst_proto_stat="no" - ]) - fi - # - if test "$tst_proto_stat" = "yes"; then - AC_MSG_CHECKING([if stat is compilable]) - AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM([[ - $cares_includes_sys_types - $cares_includes_sys_stat - ]],[[ - if(0 != stat(0, 0)) - return 1; - ]]) - ],[ - AC_MSG_RESULT([yes]) - tst_compi_stat="yes" - ],[ - AC_MSG_RESULT([no]) - tst_compi_stat="no" - ]) - fi - # - if test "$tst_compi_stat" = "yes"; then - AC_MSG_CHECKING([if stat usage allowed]) - if test "x$cares_disallow_stat" != "xyes"; then - AC_MSG_RESULT([yes]) - tst_allow_stat="yes" - else - AC_MSG_RESULT([no]) - tst_allow_stat="no" - fi - fi - # - AC_MSG_CHECKING([if stat might be used]) - if test "$tst_links_stat" = "yes" && - test "$tst_proto_stat" = "yes" && - test "$tst_compi_stat" = "yes" && - test "$tst_allow_stat" = "yes"; then - AC_MSG_RESULT([yes]) - AC_DEFINE_UNQUOTED(HAVE_STAT, 1, - [Define to 1 if you have the stat function.]) - ac_cv_func_stat="yes" - else - AC_MSG_RESULT([no]) - ac_cv_func_stat="no" - fi -]) - -dnl CARES_CHECK_FUNC_ARC4RANDOM_BUF -dnl ------------------------------------------------- -dnl Verify if arc4random_buf is available, prototyped, and -dnl can be compiled. If all of these are true, and -dnl usage has not been previously disallowed with -dnl shell variable cares_disallow_arc4random_buf, then -dnl HAVE_ARC4RANDOM_BUF will be defined. - -AC_DEFUN([CARES_CHECK_FUNC_ARC4RANDOM_BUF], [ - AC_REQUIRE([CARES_INCLUDES_STDLIB])dnl - # - tst_links_arc4random_buf="unknown" - tst_proto_arc4random_buf="unknown" - tst_compi_arc4random_buf="unknown" - tst_allow_arc4random_buf="unknown" - # - AC_MSG_CHECKING([if arc4random_buf can be linked]) - AC_LINK_IFELSE([ - AC_LANG_FUNC_LINK_TRY([arc4random_buf]) - ],[ - AC_MSG_RESULT([yes]) - tst_links_arc4random_buf="yes" - ],[ - AC_MSG_RESULT([no]) - tst_links_arc4random_buf="no" - ]) - # - if test "$tst_links_arc4random_buf" = "yes"; then - AC_MSG_CHECKING([if arc4random_buf is prototyped]) - AC_EGREP_CPP([arc4random_buf],[ - $cares_includes_stdlib - ],[ - AC_MSG_RESULT([yes]) - tst_proto_arc4random_buf="yes" - ],[ - AC_MSG_RESULT([no]) - tst_proto_arc4random_buf="no" - ]) - fi - # - if test "$tst_proto_arc4random_buf" = "yes"; then - AC_MSG_CHECKING([if arc4random_buf is compilable]) - AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM([[ - $cares_includes_stdlib - ]],[[ - arc4random_buf(NULL, 0); - return 1; - ]]) - ],[ - AC_MSG_RESULT([yes]) - tst_compi_arc4random_buf="yes" - ],[ - AC_MSG_RESULT([no]) - tst_compi_arc4random_buf="no" - ]) - fi - # - if test "$tst_compi_arc4random_buf" = "yes"; then - AC_MSG_CHECKING([if arc4random_buf usage allowed]) - if test "x$cares_disallow_arc4random_buf" != "xyes"; then - AC_MSG_RESULT([yes]) - tst_allow_arc4random_buf="yes" - else - AC_MSG_RESULT([no]) - tst_allow_arc4random_buf="no" - fi - fi - # - AC_MSG_CHECKING([if arc4random_buf might be used]) - if test "$tst_links_arc4random_buf" = "yes" && - test "$tst_proto_arc4random_buf" = "yes" && - test "$tst_compi_arc4random_buf" = "yes" && - test "$tst_allow_arc4random_buf" = "yes"; then - AC_MSG_RESULT([yes]) - AC_DEFINE_UNQUOTED(HAVE_ARC4RANDOM_BUF, 1, - [Define to 1 if you have the arc4random_buf function.]) - ac_cv_func_arc4random_buf="yes" - else - AC_MSG_RESULT([no]) - ac_cv_func_arc4random_buf="no" - fi -]) - diff --git a/m4/cares-reentrant.m4 b/m4/cares-reentrant.m4 deleted file mode 100644 index 2a16fb22..00000000 --- a/m4/cares-reentrant.m4 +++ /dev/null @@ -1,610 +0,0 @@ -#*************************************************************************** -# Copyright (C) Daniel Stenberg et al -# -# Permission to use, copy, modify, and distribute this software and its -# documentation for any purpose and without fee is hereby granted, provided -# that the above copyright notice appear in all copies and that both that -# copyright notice and this permission notice appear in supporting -# documentation, and that the name of M.I.T. not be used in advertising or -# publicity pertaining to distribution of the software without specific, -# written prior permission. M.I.T. makes no representations about the -# suitability of this software for any purpose. It is provided "as is" -# without express or implied warranty. -# -# SPDX-License-Identifier: MIT -#*************************************************************************** - -# File version for 'aclocal' use. Keep it a single number. -# serial 6 - -dnl Note 1 -dnl ------ -dnl None of the CARES_CHECK_NEED_REENTRANT_* macros shall use HAVE_FOO_H to -dnl conditionally include header files. These macros are used early in the -dnl configure process much before header file availability is known. - - -dnl CARES_CHECK_NEED_REENTRANT_ERRNO -dnl ------------------------------------------------- -dnl Checks if the preprocessor _REENTRANT definition -dnl makes errno available as a preprocessor macro. - -AC_DEFUN([CARES_CHECK_NEED_REENTRANT_ERRNO], [ - AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM([[ -#include - ]],[[ - if(0 != errno) - return 1; - ]]) - ],[ - tmp_errno="yes" - ],[ - tmp_errno="no" - ]) - if test "$tmp_errno" = "yes"; then - AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM([[ -#include - ]],[[ -#ifdef errno - int dummy=1; -#else - force compilation error -#endif - ]]) - ],[ - tmp_errno="errno_macro_defined" - ],[ - AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM([[ -#define _REENTRANT -#include - ]],[[ -#ifdef errno - int dummy=1; -#else - force compilation error -#endif - ]]) - ],[ - tmp_errno="errno_macro_needs_reentrant" - tmp_need_reentrant="yes" - ]) - ]) - fi -]) - - -dnl CARES_CHECK_NEED_REENTRANT_GMTIME_R -dnl ------------------------------------------------- -dnl Checks if the preprocessor _REENTRANT definition -dnl makes function gmtime_r compiler visible. - -AC_DEFUN([CARES_CHECK_NEED_REENTRANT_GMTIME_R], [ - AC_LINK_IFELSE([ - AC_LANG_FUNC_LINK_TRY([gmtime_r]) - ],[ - tmp_gmtime_r="yes" - ],[ - tmp_gmtime_r="no" - ]) - if test "$tmp_gmtime_r" = "yes"; then - AC_EGREP_CPP([gmtime_r],[ -#include -#include - ],[ - tmp_gmtime_r="proto_declared" - ],[ - AC_EGREP_CPP([gmtime_r],[ -#define _REENTRANT -#include -#include - ],[ - tmp_gmtime_r="proto_needs_reentrant" - tmp_need_reentrant="yes" - ]) - ]) - fi -]) - - -dnl CARES_CHECK_NEED_REENTRANT_LOCALTIME_R -dnl ------------------------------------------------- -dnl Checks if the preprocessor _REENTRANT definition -dnl makes function localtime_r compiler visible. - -AC_DEFUN([CARES_CHECK_NEED_REENTRANT_LOCALTIME_R], [ - AC_LINK_IFELSE([ - AC_LANG_FUNC_LINK_TRY([localtime_r]) - ],[ - tmp_localtime_r="yes" - ],[ - tmp_localtime_r="no" - ]) - if test "$tmp_localtime_r" = "yes"; then - AC_EGREP_CPP([localtime_r],[ -#include -#include - ],[ - tmp_localtime_r="proto_declared" - ],[ - AC_EGREP_CPP([localtime_r],[ -#define _REENTRANT -#include -#include - ],[ - tmp_localtime_r="proto_needs_reentrant" - tmp_need_reentrant="yes" - ]) - ]) - fi -]) - - -dnl CARES_CHECK_NEED_REENTRANT_STRERROR_R -dnl ------------------------------------------------- -dnl Checks if the preprocessor _REENTRANT definition -dnl makes function strerror_r compiler visible. - -AC_DEFUN([CARES_CHECK_NEED_REENTRANT_STRERROR_R], [ - AC_LINK_IFELSE([ - AC_LANG_FUNC_LINK_TRY([strerror_r]) - ],[ - tmp_strerror_r="yes" - ],[ - tmp_strerror_r="no" - ]) - if test "$tmp_strerror_r" = "yes"; then - AC_EGREP_CPP([strerror_r],[ -#include -#include - ],[ - tmp_strerror_r="proto_declared" - ],[ - AC_EGREP_CPP([strerror_r],[ -#define _REENTRANT -#include -#include - ],[ - tmp_strerror_r="proto_needs_reentrant" - tmp_need_reentrant="yes" - ]) - ]) - fi -]) - - -dnl CARES_CHECK_NEED_REENTRANT_STRTOK_R -dnl ------------------------------------------------- -dnl Checks if the preprocessor _REENTRANT definition -dnl makes function strtok_r compiler visible. - -AC_DEFUN([CARES_CHECK_NEED_REENTRANT_STRTOK_R], [ - AC_LINK_IFELSE([ - AC_LANG_FUNC_LINK_TRY([strtok_r]) - ],[ - tmp_strtok_r="yes" - ],[ - tmp_strtok_r="no" - ]) - if test "$tmp_strtok_r" = "yes"; then - AC_EGREP_CPP([strtok_r],[ -#include -#include - ],[ - tmp_strtok_r="proto_declared" - ],[ - AC_EGREP_CPP([strtok_r],[ -#define _REENTRANT -#include -#include - ],[ - tmp_strtok_r="proto_needs_reentrant" - tmp_need_reentrant="yes" - ]) - ]) - fi -]) - - -dnl CARES_CHECK_NEED_REENTRANT_INET_NTOA_R -dnl ------------------------------------------------- -dnl Checks if the preprocessor _REENTRANT definition -dnl makes function inet_ntoa_r compiler visible. - -AC_DEFUN([CARES_CHECK_NEED_REENTRANT_INET_NTOA_R], [ - AC_LINK_IFELSE([ - AC_LANG_FUNC_LINK_TRY([inet_ntoa_r]) - ],[ - tmp_inet_ntoa_r="yes" - ],[ - tmp_inet_ntoa_r="no" - ]) - if test "$tmp_inet_ntoa_r" = "yes"; then - AC_EGREP_CPP([inet_ntoa_r],[ -#include -#include -#include -#include - ],[ - tmp_inet_ntoa_r="proto_declared" - ],[ - AC_EGREP_CPP([inet_ntoa_r],[ -#define _REENTRANT -#include -#include -#include -#include - ],[ - tmp_inet_ntoa_r="proto_needs_reentrant" - tmp_need_reentrant="yes" - ]) - ]) - fi -]) - - -dnl CARES_CHECK_NEED_REENTRANT_GETHOSTBYADDR_R -dnl ------------------------------------------------- -dnl Checks if the preprocessor _REENTRANT definition -dnl makes function gethostbyaddr_r compiler visible. - -AC_DEFUN([CARES_CHECK_NEED_REENTRANT_GETHOSTBYADDR_R], [ - AC_LINK_IFELSE([ - AC_LANG_FUNC_LINK_TRY([gethostbyaddr_r]) - ],[ - tmp_gethostbyaddr_r="yes" - ],[ - tmp_gethostbyaddr_r="no" - ]) - if test "$tmp_gethostbyaddr_r" = "yes"; then - AC_EGREP_CPP([gethostbyaddr_r],[ -#include -#include - ],[ - tmp_gethostbyaddr_r="proto_declared" - ],[ - AC_EGREP_CPP([gethostbyaddr_r],[ -#define _REENTRANT -#include -#include - ],[ - tmp_gethostbyaddr_r="proto_needs_reentrant" - tmp_need_reentrant="yes" - ]) - ]) - fi -]) - - -dnl CARES_CHECK_NEED_REENTRANT_GETHOSTBYNAME_R -dnl ------------------------------------------------- -dnl Checks if the preprocessor _REENTRANT definition -dnl makes function gethostbyname_r compiler visible. - -AC_DEFUN([CARES_CHECK_NEED_REENTRANT_GETHOSTBYNAME_R], [ - AC_LINK_IFELSE([ - AC_LANG_FUNC_LINK_TRY([gethostbyname_r]) - ],[ - tmp_gethostbyname_r="yes" - ],[ - tmp_gethostbyname_r="no" - ]) - if test "$tmp_gethostbyname_r" = "yes"; then - AC_EGREP_CPP([gethostbyname_r],[ -#include -#include - ],[ - tmp_gethostbyname_r="proto_declared" - ],[ - AC_EGREP_CPP([gethostbyname_r],[ -#define _REENTRANT -#include -#include - ],[ - tmp_gethostbyname_r="proto_needs_reentrant" - tmp_need_reentrant="yes" - ]) - ]) - fi -]) - - -dnl CARES_CHECK_NEED_REENTRANT_GETPROTOBYNAME_R -dnl ------------------------------------------------- -dnl Checks if the preprocessor _REENTRANT definition -dnl makes function getprotobyname_r compiler visible. - -AC_DEFUN([CARES_CHECK_NEED_REENTRANT_GETPROTOBYNAME_R], [ - AC_LINK_IFELSE([ - AC_LANG_FUNC_LINK_TRY([getprotobyname_r]) - ],[ - tmp_getprotobyname_r="yes" - ],[ - tmp_getprotobyname_r="no" - ]) - if test "$tmp_getprotobyname_r" = "yes"; then - AC_EGREP_CPP([getprotobyname_r],[ -#include -#include - ],[ - tmp_getprotobyname_r="proto_declared" - ],[ - AC_EGREP_CPP([getprotobyname_r],[ -#define _REENTRANT -#include -#include - ],[ - tmp_getprotobyname_r="proto_needs_reentrant" - tmp_need_reentrant="yes" - ]) - ]) - fi -]) - - -dnl CARES_CHECK_NEED_REENTRANT_GETSERVBYPORT_R -dnl ------------------------------------------------- -dnl Checks if the preprocessor _REENTRANT definition -dnl makes function getservbyport_r compiler visible. - -AC_DEFUN([CARES_CHECK_NEED_REENTRANT_GETSERVBYPORT_R], [ - AC_LINK_IFELSE([ - AC_LANG_FUNC_LINK_TRY([getservbyport_r]) - ],[ - tmp_getservbyport_r="yes" - ],[ - tmp_getservbyport_r="no" - ]) - if test "$tmp_getservbyport_r" = "yes"; then - AC_EGREP_CPP([getservbyport_r],[ -#include -#include - ],[ - tmp_getservbyport_r="proto_declared" - ],[ - AC_EGREP_CPP([getservbyport_r],[ -#define _REENTRANT -#include -#include - ],[ - tmp_getservbyport_r="proto_needs_reentrant" - tmp_need_reentrant="yes" - ]) - ]) - fi -]) - - -dnl CARES_CHECK_NEED_REENTRANT_FUNCTIONS_R -dnl ------------------------------------------------- -dnl Checks if the preprocessor _REENTRANT definition -dnl makes several _r functions compiler visible. -dnl Internal macro for CARES_CONFIGURE_REENTRANT. - -AC_DEFUN([CARES_CHECK_NEED_REENTRANT_FUNCTIONS_R], [ - if test "$tmp_need_reentrant" = "no"; then - CARES_CHECK_NEED_REENTRANT_GMTIME_R - fi - if test "$tmp_need_reentrant" = "no"; then - CARES_CHECK_NEED_REENTRANT_LOCALTIME_R - fi - if test "$tmp_need_reentrant" = "no"; then - CARES_CHECK_NEED_REENTRANT_STRERROR_R - fi - if test "$tmp_need_reentrant" = "no"; then - CARES_CHECK_NEED_REENTRANT_STRTOK_R - fi - if test "$tmp_need_reentrant" = "no"; then - CARES_CHECK_NEED_REENTRANT_INET_NTOA_R - fi - if test "$tmp_need_reentrant" = "no"; then - CARES_CHECK_NEED_REENTRANT_GETHOSTBYADDR_R - fi - if test "$tmp_need_reentrant" = "no"; then - CARES_CHECK_NEED_REENTRANT_GETHOSTBYNAME_R - fi - if test "$tmp_need_reentrant" = "no"; then - CARES_CHECK_NEED_REENTRANT_GETPROTOBYNAME_R - fi - if test "$tmp_need_reentrant" = "no"; then - CARES_CHECK_NEED_REENTRANT_GETSERVBYPORT_R - fi -]) - - -dnl CARES_CHECK_NEED_REENTRANT_SYSTEM -dnl ------------------------------------------------- -dnl Checks if the preprocessor _REENTRANT definition -dnl must be unconditionally done for this platform. -dnl Internal macro for CARES_CONFIGURE_REENTRANT. - -AC_DEFUN([CARES_CHECK_NEED_REENTRANT_SYSTEM], [ - case $host_os in - solaris*) - tmp_need_reentrant="yes" - ;; - *) - tmp_need_reentrant="no" - ;; - esac -]) - - -dnl CARES_CHECK_NEED_THREAD_SAFE_SYSTEM -dnl ------------------------------------------------- -dnl Checks if the preprocessor _THREAD_SAFE definition -dnl must be unconditionally done for this platform. -dnl Internal macro for CARES_CONFIGURE_THREAD_SAFE. - -AC_DEFUN([CARES_CHECK_NEED_THREAD_SAFE_SYSTEM], [ - case $host_os in - aix[[123]].* | aix4.[[012]].*) - dnl aix 4.2 and older - tmp_need_thread_safe="no" - ;; - aix*) - dnl AIX 4.3 and newer - tmp_need_thread_safe="yes" - ;; - *) - tmp_need_thread_safe="no" - ;; - esac -]) - - -dnl CARES_CONFIGURE_FROM_NOW_ON_WITH_REENTRANT -dnl ------------------------------------------------- -dnl This macro ensures that configuration tests done -dnl after this will execute with preprocessor symbol -dnl _REENTRANT defined. This macro also ensures that -dnl the generated config file defines NEED_REENTRANT -dnl and that in turn setup.h will define _REENTRANT. -dnl Internal macro for CARES_CONFIGURE_REENTRANT. - -AC_DEFUN([CARES_CONFIGURE_FROM_NOW_ON_WITH_REENTRANT], [ -AC_DEFINE(NEED_REENTRANT, 1, - [Define to 1 if _REENTRANT preprocessor symbol must be defined.]) -cat >>confdefs.h <<_EOF -#ifndef _REENTRANT -# define _REENTRANT -#endif -_EOF -]) - - -dnl CARES_CONFIGURE_FROM_NOW_ON_WITH_THREAD_SAFE -dnl ------------------------------------------------- -dnl This macro ensures that configuration tests done -dnl after this will execute with preprocessor symbol -dnl _THREAD_SAFE defined. This macro also ensures that -dnl the generated config file defines NEED_THREAD_SAFE -dnl and that in turn setup.h will define _THREAD_SAFE. -dnl Internal macro for CARES_CONFIGURE_THREAD_SAFE. - -AC_DEFUN([CARES_CONFIGURE_FROM_NOW_ON_WITH_THREAD_SAFE], [ -AC_DEFINE(NEED_THREAD_SAFE, 1, - [Define to 1 if _THREAD_SAFE preprocessor symbol must be defined.]) -cat >>confdefs.h <<_EOF -#ifndef _THREAD_SAFE -# define _THREAD_SAFE -#endif -_EOF -]) - - -dnl CARES_CONFIGURE_REENTRANT -dnl ------------------------------------------------- -dnl This first checks if the preprocessor _REENTRANT -dnl symbol is already defined. If it isn't currently -dnl defined a set of checks are performed to verify -dnl if its definition is required to make visible to -dnl the compiler a set of *_r functions. Finally, if -dnl _REENTRANT is already defined or needed it takes -dnl care of making adjustments necessary to ensure -dnl that it is defined equally for further configure -dnl tests and generated config file. - -AC_DEFUN([CARES_CONFIGURE_REENTRANT], [ - AC_PREREQ([2.50])dnl - # - AC_MSG_CHECKING([if _REENTRANT is already defined]) - AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM([[ - ]],[[ -#ifdef _REENTRANT - int dummy=1; -#else - force compilation error -#endif - ]]) - ],[ - AC_MSG_RESULT([yes]) - tmp_reentrant_initially_defined="yes" - ],[ - AC_MSG_RESULT([no]) - tmp_reentrant_initially_defined="no" - ]) - # - if test "$tmp_reentrant_initially_defined" = "no"; then - AC_MSG_CHECKING([if _REENTRANT is actually needed]) - CARES_CHECK_NEED_REENTRANT_SYSTEM - if test "$tmp_need_reentrant" = "no"; then - CARES_CHECK_NEED_REENTRANT_ERRNO - fi - if test "$tmp_need_reentrant" = "no"; then - CARES_CHECK_NEED_REENTRANT_FUNCTIONS_R - fi - if test "$tmp_need_reentrant" = "yes"; then - AC_MSG_RESULT([yes]) - else - AC_MSG_RESULT([no]) - fi - fi - # - AC_MSG_CHECKING([if _REENTRANT is onwards defined]) - if test "$tmp_reentrant_initially_defined" = "yes" || - test "$tmp_need_reentrant" = "yes"; then - CARES_CONFIGURE_FROM_NOW_ON_WITH_REENTRANT - AC_MSG_RESULT([yes]) - else - AC_MSG_RESULT([no]) - fi - # -]) - - -dnl CARES_CONFIGURE_THREAD_SAFE -dnl ------------------------------------------------- -dnl This first checks if the preprocessor _THREAD_SAFE -dnl symbol is already defined. If it isn't currently -dnl defined a set of checks are performed to verify -dnl if its definition is required. Finally, if -dnl _THREAD_SAFE is already defined or needed it takes -dnl care of making adjustments necessary to ensure -dnl that it is defined equally for further configure -dnl tests and generated config file. - -AC_DEFUN([CARES_CONFIGURE_THREAD_SAFE], [ - AC_PREREQ([2.50])dnl - # - AC_MSG_CHECKING([if _THREAD_SAFE is already defined]) - AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM([[ - ]],[[ -#ifdef _THREAD_SAFE - int dummy=1; -#else - force compilation error -#endif - ]]) - ],[ - AC_MSG_RESULT([yes]) - tmp_thread_safe_initially_defined="yes" - ],[ - AC_MSG_RESULT([no]) - tmp_thread_safe_initially_defined="no" - ]) - # - if test "$tmp_thread_safe_initially_defined" = "no"; then - AC_MSG_CHECKING([if _THREAD_SAFE is actually needed]) - CARES_CHECK_NEED_THREAD_SAFE_SYSTEM - if test "$tmp_need_thread_safe" = "yes"; then - AC_MSG_RESULT([yes]) - else - AC_MSG_RESULT([no]) - fi - fi - # - AC_MSG_CHECKING([if _THREAD_SAFE is onwards defined]) - if test "$tmp_thread_safe_initially_defined" = "yes" || - test "$tmp_need_thread_safe" = "yes"; then - CARES_CONFIGURE_FROM_NOW_ON_WITH_THREAD_SAFE - AC_MSG_RESULT([yes]) - else - AC_MSG_RESULT([no]) - fi - # -]) diff --git a/m4/xc-am-iface.m4 b/m4/xc-am-iface.m4 deleted file mode 100644 index 80c53b61..00000000 --- a/m4/xc-am-iface.m4 +++ /dev/null @@ -1,254 +0,0 @@ -#--------------------------------------------------------------------------- -# -# xc-am-iface.m4 -# -# Copyright (c) Daniel Stenberg -# -# Permission to use, copy, modify, and distribute this software for any -# purpose with or without fee is hereby granted, provided that the above -# copyright notice and this permission notice appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -# -# SPDX-License-Identifier: MIT -#--------------------------------------------------------------------------- - -# serial 1 - - -dnl _XC_AUTOMAKE_BODY -dnl ------------------------------------------------- -dnl Private macro. -dnl -dnl This macro performs embedding of automake initialization -dnl code into configure script. When automake version 1.14 or -dnl newer is used at configure script generation time, this -dnl results in 'subdir-objects' automake option being used. -dnl When using automake versions older than 1.14 this option -dnl is not used when generating configure script. -dnl -dnl Existence of automake _AM_PROG_CC_C_O m4 private macro -dnl is used to differentiate automake version 1.14 from older -dnl ones which lack this macro. - -m4_define([_XC_AUTOMAKE_BODY], -[dnl -## --------------------------------------- ## -## Start of automake initialization code ## -## --------------------------------------- ## -m4_ifdef([_AM_PROG_CC_C_O], -[ -AM_INIT_AUTOMAKE([subdir-objects]) -],[ -AM_INIT_AUTOMAKE -])dnl -## ------------------------------------- ## -## End of automake initialization code ## -## ------------------------------------- ## -dnl -m4_define([$0], [])[]dnl -]) - - -dnl XC_AUTOMAKE -dnl ------------------------------------------------- -dnl Public macro. -dnl -dnl This macro embeds automake machinery into configure -dnl script regardless of automake version used in order -dnl to generate configure script. -dnl -dnl When using automake version 1.14 or newer, automake -dnl initialization option 'subdir-objects' is used to -dnl generate the configure script, otherwise this option -dnl is not used. - -AC_DEFUN([XC_AUTOMAKE], -[dnl -AC_PREREQ([2.50])dnl -dnl -AC_BEFORE([$0],[AM_INIT_AUTOMAKE])dnl -dnl -_XC_AUTOMAKE_BODY -dnl -m4_ifdef([AM_INIT_AUTOMAKE], - [m4_undefine([AM_INIT_AUTOMAKE])])dnl -dnl -m4_define([$0], [])[]dnl -]) - - -dnl _XC_AMEND_DISTCLEAN_BODY ([LIST-OF-SUBDIRS]) -dnl ------------------------------------------------- -dnl Private macro. -dnl -dnl This macro performs shell code embedding into -dnl configure script in order to modify distclean -dnl and maintainer-clean targets of makefiles which -dnl are located in given list of subdirs. -dnl -dnl See XC_AMEND_DISTCLEAN comments for details. - -m4_define([_XC_AMEND_DISTCLEAN_BODY], -[dnl -## ---------------------------------- ## -## Start of distclean amending code ## -## ---------------------------------- ## - -for xc_subdir in [$1] -do - -if test ! -f "$xc_subdir/Makefile"; then - echo "$xc_msg_err $xc_subdir/Makefile file not found. $xc_msg_abrt" >&2 - exit 1 -fi - -# Fetch dependency tracking file list from Makefile include lines. - -xc_inc_lines=`grep '^include .*(DEPDIR)' "$xc_subdir/Makefile" 2>/dev/null` -xc_cnt_words=`echo "$xc_inc_lines" | wc -w | tr -d "$xc_space$xc_tab"` - -# --disable-dependency-tracking might have been used, consequently -# there is nothing to amend without a dependency tracking file list. - -if test $xc_cnt_words -gt 0; then - -AC_MSG_NOTICE([amending $xc_subdir/Makefile]) - -# Build Makefile specific patch hunk. - -xc_p="$xc_subdir/xc_patch.tmp" - -xc_rm_depfiles=`echo "$xc_inc_lines" \ - | $SED 's%include% -rm -f%' 2>/dev/null` - -xc_dep_subdirs=`echo "$xc_inc_lines" \ - | $SED 's%include[[ ]][[ ]]*%%' 2>/dev/null \ - | $SED 's%(DEPDIR)/.*%(DEPDIR)%' 2>/dev/null \ - | sort | uniq` - -echo "$xc_rm_depfiles" >$xc_p - -for xc_dep_dir in $xc_dep_subdirs; do - echo "${xc_tab}@xm_dep_cnt=\`ls $xc_dep_dir | wc -l 2>/dev/null\`; \\" >>$xc_p - echo "${xc_tab}if test \$\$xm_dep_cnt -eq 0 && test -d $xc_dep_dir; then \\" >>$xc_p - echo "${xc_tab} rm -rf $xc_dep_dir; \\" >>$xc_p - echo "${xc_tab}fi" >>$xc_p -done - -# Build Makefile patching sed scripts. - -xc_s1="$xc_subdir/xc_script_1.tmp" -xc_s2="$xc_subdir/xc_script_2.tmp" -xc_s3="$xc_subdir/xc_script_3.tmp" - -cat >$xc_s1 <<\_EOT -/^distclean[[ ]]*:/,/^[[^ ]][[^ ]]*:/{ - s/^.*(DEPDIR)/___xc_depdir_line___/ -} -/^maintainer-clean[[ ]]*:/,/^[[^ ]][[^ ]]*:/{ - s/^.*(DEPDIR)/___xc_depdir_line___/ -} -_EOT - -cat >$xc_s2 <<\_EOT -/___xc_depdir_line___$/{ - N - /___xc_depdir_line___$/D -} -_EOT - -cat >$xc_s3 <<_EOT -/^___xc_depdir_line___/{ - r $xc_p - d -} -_EOT - -# Apply patch to Makefile and cleanup. - -$SED -f "$xc_s1" "$xc_subdir/Makefile" >"$xc_subdir/Makefile.tmp1" -$SED -f "$xc_s2" "$xc_subdir/Makefile.tmp1" >"$xc_subdir/Makefile.tmp2" -$SED -f "$xc_s3" "$xc_subdir/Makefile.tmp2" >"$xc_subdir/Makefile.tmp3" - -if test -f "$xc_subdir/Makefile.tmp3"; then - mv -f "$xc_subdir/Makefile.tmp3" "$xc_subdir/Makefile" -fi - -test -f "$xc_subdir/Makefile.tmp1" && rm -f "$xc_subdir/Makefile.tmp1" -test -f "$xc_subdir/Makefile.tmp2" && rm -f "$xc_subdir/Makefile.tmp2" -test -f "$xc_subdir/Makefile.tmp3" && rm -f "$xc_subdir/Makefile.tmp3" - -test -f "$xc_p" && rm -f "$xc_p" -test -f "$xc_s1" && rm -f "$xc_s1" -test -f "$xc_s2" && rm -f "$xc_s2" -test -f "$xc_s3" && rm -f "$xc_s3" - -fi - -done - -## -------------------------------- ## -## End of distclean amending code ## -## -------------------------------- ## -dnl -m4_define([$0], [])[]dnl -]) - - -dnl XC_AMEND_DISTCLEAN ([LIST-OF-SUBDIRS]) -dnl ------------------------------------------------- -dnl Public macro. -dnl -dnl This macro embeds shell code into configure script -dnl that amends, at configure runtime, the distclean -dnl and maintainer-clean targets of Makefiles located -dnl in all subdirs given in the mandatory white-space -dnl separated list argument. -dnl -dnl Embedding only takes place when using automake 1.14 -dnl or newer, otherwise amending code is not included -dnl in generated configure script. -dnl -dnl distclean and maintainer-clean targets are modified -dnl to avoid unconditional removal of dependency subdirs -dnl which triggers distclean and maintainer-clean errors -dnl when using automake 'subdir-objects' option along -dnl with per-target objects and source files existing in -dnl multiple subdirs used for different build targets. -dnl -dnl New behavior first removes each dependency tracking -dnl file independently, and only removes each dependency -dnl subdir when it finds out that it no longer holds any -dnl dependency tracking file. -dnl -dnl When configure option --disable-dependency-tracking -dnl is used no amending takes place given that there are -dnl no dependency tracking files. - -AC_DEFUN([XC_AMEND_DISTCLEAN], -[dnl -AC_PREREQ([2.50])dnl -dnl -m4_ifdef([_AC_OUTPUT_MAIN_LOOP], - [m4_provide_if([_AC_OUTPUT_MAIN_LOOP], [], - [m4_fatal([call to AC_OUTPUT needed before $0])])])dnl -dnl -m4_if([$#], [1], [], [m4_fatal([$0: wrong number of arguments])])dnl -m4_if([$1], [], [m4_fatal([$0: missing argument])])dnl -dnl -AC_REQUIRE([XC_CONFIGURE_PREAMBLE])dnl -dnl -m4_ifdef([_AM_PROG_CC_C_O], -[ -_XC_AMEND_DISTCLEAN_BODY([$1]) -])dnl -m4_define([$0], [])[]dnl -]) - diff --git a/m4/xc-cc-check.m4 b/m4/xc-cc-check.m4 deleted file mode 100644 index cfa201ac..00000000 --- a/m4/xc-cc-check.m4 +++ /dev/null @@ -1,97 +0,0 @@ -#--------------------------------------------------------------------------- -# -# xc-cc-check.m4 -# -# Copyright (c) Daniel Stenberg -# -# Permission to use, copy, modify, and distribute this software for any -# purpose with or without fee is hereby granted, provided that the above -# copyright notice and this permission notice appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -# -# SPDX-License-Identifier: MIT -#--------------------------------------------------------------------------- - -# serial 1 - - -dnl _XC_PROG_CC_PREAMBLE -dnl ------------------------------------------------- -dnl Private macro. - -AC_DEFUN([_XC_PROG_CC_PREAMBLE], [ - xc_prog_cc_prev_IFS=$IFS - xc_prog_cc_prev_LIBS=$LIBS - xc_prog_cc_prev_CFLAGS=$CFLAGS - xc_prog_cc_prev_LDFLAGS=$LDFLAGS - xc_prog_cc_prev_CPPFLAGS=$CPPFLAGS -]) - - -dnl _XC_PROG_CC_POSTLUDE -dnl ------------------------------------------------- -dnl Private macro. - -AC_DEFUN([_XC_PROG_CC_POSTLUDE], [ - IFS=$xc_prog_cc_prev_IFS - LIBS=$xc_prog_cc_prev_LIBS - CFLAGS=$xc_prog_cc_prev_CFLAGS - LDFLAGS=$xc_prog_cc_prev_LDFLAGS - CPPFLAGS=$xc_prog_cc_prev_CPPFLAGS - AC_SUBST([CC])dnl - AC_SUBST([CPP])dnl - AC_SUBST([LIBS])dnl - AC_SUBST([CFLAGS])dnl - AC_SUBST([LDFLAGS])dnl - AC_SUBST([CPPFLAGS])dnl -]) - - -dnl _XC_PROG_CC -dnl ------------------------------------------------- -dnl Private macro. - -AC_DEFUN([_XC_PROG_CC], [ - AC_REQUIRE([_XC_PROG_CC_PREAMBLE])dnl - AC_REQUIRE([XC_CHECK_BUILD_FLAGS])dnl - AC_REQUIRE([AC_PROG_INSTALL])dnl - AC_REQUIRE([AC_PROG_CC])dnl - AC_REQUIRE([AM_PROG_CC_C_O])dnl - AC_REQUIRE([AC_PROG_CPP])dnl - AC_REQUIRE([_XC_PROG_CC_POSTLUDE])dnl -]) - - -dnl XC_CHECK_PROG_CC -dnl ------------------------------------------------- -dnl Public macro. -dnl -dnl Checks for C compiler and C preprocessor programs, -dnl while doing some previous sanity validation on user -dnl provided LIBS, LDFLAGS, CPPFLAGS and CFLAGS values -dnl that must succeed in order to continue execution. -dnl -dnl This sets variables CC and CPP, while preventing -dnl LIBS, LDFLAGS, CFLAGS, CPPFLAGS and IFS from being -dnl unexpectedly changed by underlying macros. - -AC_DEFUN([XC_CHECK_PROG_CC], [ - AC_PREREQ([2.50])dnl - AC_BEFORE([$0],[_XC_PROG_CC_PREAMBLE])dnl - AC_BEFORE([$0],[AC_PROG_INSTALL])dnl - AC_BEFORE([$0],[AC_PROG_CC])dnl - AC_BEFORE([$0],[AM_PROG_CC_C_O])dnl - AC_BEFORE([$0],[AC_PROG_CPP])dnl - AC_BEFORE([$0],[AC_PROG_LIBTOOL])dnl - AC_BEFORE([$0],[AM_INIT_AUTOMAKE])dnl - AC_BEFORE([$0],[_XC_PROG_CC_POSTLUDE])dnl - AC_REQUIRE([_XC_PROG_CC])dnl -]) - diff --git a/m4/xc-lt-iface.m4 b/m4/xc-lt-iface.m4 deleted file mode 100644 index f8a6c125..00000000 --- a/m4/xc-lt-iface.m4 +++ /dev/null @@ -1,467 +0,0 @@ -#--------------------------------------------------------------------------- -# -# xc-lt-iface.m4 -# -# Copyright (c) Daniel Stenberg -# -# Permission to use, copy, modify, and distribute this software for any -# purpose with or without fee is hereby granted, provided that the above -# copyright notice and this permission notice appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -# -# -# SPDX-License-Identifier: MIT -#--------------------------------------------------------------------------- - -# serial 1 - - -dnl _XC_LIBTOOL_PREAMBLE -dnl ------------------------------------------------- -dnl Private macro. -dnl -dnl Checks some configure script options related with -dnl libtool and customizes its default behavior before -dnl libtool code is actually used in script. - -m4_define([_XC_LIBTOOL_PREAMBLE], -[dnl -# ------------------------------------ # -# Determine libtool default behavior # -# ------------------------------------ # - -# -# Default behavior is to enable shared and static libraries on systems -# where libtool knows how to build both library versions, and does not -# require separate configuration and build runs for each flavor. -# - -xc_lt_want_enable_shared='yes' -xc_lt_want_enable_static='yes' - -# -# User may have disabled shared or static libraries. -# -case "x$enable_shared" in @%:@ ( - xno) - xc_lt_want_enable_shared='no' - ;; -esac -case "x$enable_static" in @%:@ ( - xno) - xc_lt_want_enable_static='no' - ;; -esac -if test "x$xc_lt_want_enable_shared" = 'xno' && - test "x$xc_lt_want_enable_static" = 'xno'; then - AC_MSG_ERROR([can not disable shared and static libraries simultaneously]) -fi - -# -# Default behavior on systems that require independent configuration -# and build runs for shared and static is to enable shared libraries -# and disable static ones. On these systems option '--disable-shared' -# must be used in order to build a proper static library. -# - -if test "x$xc_lt_want_enable_shared" = 'xyes' && - test "x$xc_lt_want_enable_static" = 'xyes'; then - case $host_os in @%:@ ( - mingw* | pw32* | cegcc* | os2* | aix*) - xc_lt_want_enable_static='no' - ;; - esac -fi - -# -# Make libtool aware of current shared and static library preferences -# taking in account that, depending on host characteristics, libtool -# may modify these option preferences later in this configure script. -# - -enable_shared=$xc_lt_want_enable_shared -enable_static=$xc_lt_want_enable_static - -# -# Default behavior is to build PIC objects for shared libraries and -# non-PIC objects for static libraries. -# - -xc_lt_want_with_pic='default' - -# -# User may have specified PIC preference. -# - -case "x$with_pic" in @%:@ (( - xno) - xc_lt_want_with_pic='no' - ;; - xyes) - xc_lt_want_with_pic='yes' - ;; -esac - -# -# Default behavior on some systems where building a shared library out -# of non-PIC compiled objects will fail with following linker error -# "relocation R_X86_64_32 can not be used when making a shared object" -# is to build PIC objects even for static libraries. This behavior may -# be overriden using 'configure --disable-shared --without-pic'. -# - -if test "x$xc_lt_want_with_pic" = 'xdefault'; then - case $host_cpu in @%:@ ( - x86_64 | amd64 | ia64) - case $host_os in @%:@ ( - linux* | freebsd*) - xc_lt_want_with_pic='yes' - ;; - esac - ;; - esac -fi - -# -# Make libtool aware of current PIC preference taking in account that, -# depending on host characteristics, libtool may modify PIC default -# behavior to fit host system idiosyncrasies later in this script. -# - -with_pic=$xc_lt_want_with_pic -dnl -m4_define([$0],[])dnl -]) - - -dnl _XC_LIBTOOL_BODY -dnl ------------------------------------------------- -dnl Private macro. -dnl -dnl This macro performs embedding of libtool code into -dnl configure script, regardless of libtool version in -dnl use when generating configure script. - -m4_define([_XC_LIBTOOL_BODY], -[dnl -## ----------------------- ## -## Start of libtool code ## -## ----------------------- ## -m4_ifdef([LT_INIT], -[dnl -LT_INIT([win32-dll]) -],[dnl -AC_LIBTOOL_WIN32_DLL -AC_PROG_LIBTOOL -])dnl -## --------------------- ## -## End of libtool code ## -## --------------------- ## -dnl -m4_define([$0], [])[]dnl -]) - - -dnl _XC_CHECK_LT_BUILD_LIBRARIES -dnl ------------------------------------------------- -dnl Private macro. -dnl -dnl Checks wether libtool shared and static libraries -dnl are finally built depending on user input, default -dnl behavior and knowledge that libtool has about host -dnl characteristics. -dnl Results stored in following shell variables: -dnl xc_lt_build_shared -dnl xc_lt_build_static - -m4_define([_XC_CHECK_LT_BUILD_LIBRARIES], -[dnl -# -# Verify if finally libtool shared libraries will be built -# - -case "x$enable_shared" in @%:@ (( - xyes | xno) - xc_lt_build_shared=$enable_shared - ;; - *) - AC_MSG_ERROR([unexpected libtool enable_shared value: $enable_shared]) - ;; -esac - -# -# Verify if finally libtool static libraries will be built -# - -case "x$enable_static" in @%:@ (( - xyes | xno) - xc_lt_build_static=$enable_static - ;; - *) - AC_MSG_ERROR([unexpected libtool enable_static value: $enable_static]) - ;; -esac -dnl -m4_define([$0],[])dnl -]) - - -dnl _XC_CHECK_LT_SHLIB_USE_VERSION_INFO -dnl ------------------------------------------------- -dnl Private macro. -dnl -dnl Checks if the -version-info linker flag must be -dnl provided when building libtool shared libraries. -dnl Result stored in xc_lt_shlib_use_version_info. - -m4_define([_XC_CHECK_LT_SHLIB_USE_VERSION_INFO], -[dnl -# -# Verify if libtool shared libraries should be linked using flag -version-info -# - -AC_MSG_CHECKING([whether to build shared libraries with -version-info]) -xc_lt_shlib_use_version_info='yes' -if test "x$version_type" = 'xnone'; then - xc_lt_shlib_use_version_info='no' -fi -case $host_os in @%:@ ( - amigaos*) - xc_lt_shlib_use_version_info='yes' - ;; -esac -AC_MSG_RESULT([$xc_lt_shlib_use_version_info]) -dnl -m4_define([$0], [])[]dnl -]) - - -dnl _XC_CHECK_LT_SHLIB_USE_NO_UNDEFINED -dnl ------------------------------------------------- -dnl Private macro. -dnl -dnl Checks if the -no-undefined linker flag must be -dnl provided when building libtool shared libraries. -dnl Result stored in xc_lt_shlib_use_no_undefined. - -m4_define([_XC_CHECK_LT_SHLIB_USE_NO_UNDEFINED], -[dnl -# -# Verify if libtool shared libraries should be linked using flag -no-undefined -# - -AC_MSG_CHECKING([whether to build shared libraries with -no-undefined]) -xc_lt_shlib_use_no_undefined='no' -if test "x$allow_undefined" = 'xno'; then - xc_lt_shlib_use_no_undefined='yes' -elif test "x$allow_undefined_flag" = 'xunsupported'; then - xc_lt_shlib_use_no_undefined='yes' -fi -case $host_os in @%:@ ( - cygwin* | mingw* | pw32* | cegcc* | os2* | aix*) - xc_lt_shlib_use_no_undefined='yes' - ;; -esac -AC_MSG_RESULT([$xc_lt_shlib_use_no_undefined]) -dnl -m4_define([$0], [])[]dnl -]) - - -dnl _XC_CHECK_LT_SHLIB_USE_MIMPURE_TEXT -dnl ------------------------------------------------- -dnl Private macro. -dnl -dnl Checks if the -mimpure-text linker flag must be -dnl provided when building libtool shared libraries. -dnl Result stored in xc_lt_shlib_use_mimpure_text. - -m4_define([_XC_CHECK_LT_SHLIB_USE_MIMPURE_TEXT], -[dnl -# -# Verify if libtool shared libraries should be linked using flag -mimpure-text -# - -AC_MSG_CHECKING([whether to build shared libraries with -mimpure-text]) -xc_lt_shlib_use_mimpure_text='no' -case $host_os in @%:@ ( - solaris2*) - if test "x$GCC" = 'xyes'; then - xc_lt_shlib_use_mimpure_text='yes' - fi - ;; -esac -AC_MSG_RESULT([$xc_lt_shlib_use_mimpure_text]) -dnl -m4_define([$0], [])[]dnl -]) - - -dnl _XC_CHECK_LT_BUILD_WITH_PIC -dnl ------------------------------------------------- -dnl Private macro. -dnl -dnl Checks wether libtool shared and static libraries -dnl would be built with PIC depending on user input, -dnl default behavior and knowledge that libtool has -dnl about host characteristics. -dnl Results stored in following shell variables: -dnl xc_lt_build_shared_with_pic -dnl xc_lt_build_static_with_pic - -m4_define([_XC_CHECK_LT_BUILD_WITH_PIC], -[dnl -# -# Find out wether libtool libraries would be built wit PIC -# - -case "x$pic_mode" in @%:@ (((( - xdefault) - xc_lt_build_shared_with_pic='yes' - xc_lt_build_static_with_pic='no' - ;; - xyes) - xc_lt_build_shared_with_pic='yes' - xc_lt_build_static_with_pic='yes' - ;; - xno) - xc_lt_build_shared_with_pic='no' - xc_lt_build_static_with_pic='no' - ;; - *) - xc_lt_build_shared_with_pic='unknown' - xc_lt_build_static_with_pic='unknown' - AC_MSG_WARN([unexpected libtool pic_mode value: $pic_mode]) - ;; -esac -AC_MSG_CHECKING([whether to build shared libraries with PIC]) -AC_MSG_RESULT([$xc_lt_build_shared_with_pic]) -AC_MSG_CHECKING([whether to build static libraries with PIC]) -AC_MSG_RESULT([$xc_lt_build_static_with_pic]) -dnl -m4_define([$0],[])dnl -]) - - -dnl _XC_CHECK_LT_BUILD_SINGLE_VERSION -dnl ------------------------------------------------- -dnl Private macro. -dnl -dnl Checks wether a libtool shared or static library -dnl is finally built exclusively without the other. -dnl Results stored in following shell variables: -dnl xc_lt_build_shared_only -dnl xc_lt_build_static_only - -m4_define([_XC_CHECK_LT_BUILD_SINGLE_VERSION], -[dnl -# -# Verify if libtool shared libraries will be built while static not built -# - -AC_MSG_CHECKING([whether to build shared libraries only]) -if test "$xc_lt_build_shared" = 'yes' && - test "$xc_lt_build_static" = 'no'; then - xc_lt_build_shared_only='yes' -else - xc_lt_build_shared_only='no' -fi -AC_MSG_RESULT([$xc_lt_build_shared_only]) - -# -# Verify if libtool static libraries will be built while shared not built -# - -AC_MSG_CHECKING([whether to build static libraries only]) -if test "$xc_lt_build_static" = 'yes' && - test "$xc_lt_build_shared" = 'no'; then - xc_lt_build_static_only='yes' -else - xc_lt_build_static_only='no' -fi -AC_MSG_RESULT([$xc_lt_build_static_only]) -dnl -m4_define([$0],[])dnl -]) - - -dnl _XC_LIBTOOL_POSTLUDE -dnl ------------------------------------------------- -dnl Private macro. -dnl -dnl Performs several checks related with libtool that -dnl can not be done unless libtool code has already -dnl been executed. See individual check descriptions -dnl for further info. - -m4_define([_XC_LIBTOOL_POSTLUDE], -[dnl -_XC_CHECK_LT_BUILD_LIBRARIES -_XC_CHECK_LT_SHLIB_USE_VERSION_INFO -_XC_CHECK_LT_SHLIB_USE_NO_UNDEFINED -_XC_CHECK_LT_SHLIB_USE_MIMPURE_TEXT -_XC_CHECK_LT_BUILD_WITH_PIC -_XC_CHECK_LT_BUILD_SINGLE_VERSION -dnl -m4_define([$0],[])dnl -]) - - -dnl XC_LIBTOOL -dnl ------------------------------------------------- -dnl Public macro. -dnl -dnl This macro embeds libtool machinery into configure -dnl script, regardless of libtool version, and performs -dnl several additional checks whose results can be used -dnl later on. -dnl -dnl Usage of this macro ensures that generated configure -dnl script uses equivalent logic irrespective of autoconf -dnl or libtool version being used to generate configure -dnl script. -dnl -dnl Results stored in following shell variables: -dnl xc_lt_build_shared -dnl xc_lt_build_static -dnl xc_lt_shlib_use_version_info -dnl xc_lt_shlib_use_no_undefined -dnl xc_lt_shlib_use_mimpure_text -dnl xc_lt_build_shared_with_pic -dnl xc_lt_build_static_with_pic -dnl xc_lt_build_shared_only -dnl xc_lt_build_static_only - -AC_DEFUN([XC_LIBTOOL], -[dnl -AC_PREREQ([2.50])dnl -dnl -AC_BEFORE([$0],[LT_INIT])dnl -AC_BEFORE([$0],[AC_PROG_LIBTOOL])dnl -AC_BEFORE([$0],[AC_LIBTOOL_WIN32_DLL])dnl -dnl -AC_REQUIRE([XC_CHECK_PATH_SEPARATOR])dnl -AC_REQUIRE([AC_CANONICAL_HOST])dnl -AC_REQUIRE([AC_PROG_CC])dnl -dnl -_XC_LIBTOOL_PREAMBLE -_XC_LIBTOOL_BODY -_XC_LIBTOOL_POSTLUDE -dnl -m4_ifdef([AC_LIBTOOL_WIN32_DLL], - [m4_undefine([AC_LIBTOOL_WIN32_DLL])])dnl -m4_ifdef([AC_PROG_LIBTOOL], - [m4_undefine([AC_PROG_LIBTOOL])])dnl -m4_ifdef([LT_INIT], - [m4_undefine([LT_INIT])])dnl -dnl -m4_define([$0],[])dnl -]) - diff --git a/m4/xc-translit.m4 b/m4/xc-translit.m4 deleted file mode 100644 index db8ca821..00000000 --- a/m4/xc-translit.m4 +++ /dev/null @@ -1,166 +0,0 @@ -#--------------------------------------------------------------------------- -# -# xc-translit.m4 -# -# Copyright (c) Daniel Stenberg -# -# Permission to use, copy, modify, and distribute this software for any -# purpose with or without fee is hereby granted, provided that the above -# copyright notice and this permission notice appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -# -# -# SPDX-License-Identifier: MIT -#--------------------------------------------------------------------------- - -# File version for 'aclocal' use. Keep it a single number. -# serial 2 - - -dnl XC_SH_TR_SH (expression) -dnl ------------------------------------------------- -dnl Shell execution time transliteration of 'expression' -dnl argument, where all non-alfanumeric characters are -dnl converted to the underscore '_' character. -dnl Normal shell expansion and substitution takes place -dnl for given 'expression' at shell execution time before -dnl transliteration is applied to it. - -AC_DEFUN([XC_SH_TR_SH], -[`echo "$1" | sed 's/[[^a-zA-Z0-9_]]/_/g'`]) - - -dnl XC_SH_TR_SH_EX (expression, [extra]) -dnl ------------------------------------------------- -dnl Like XC_SH_TR_SH but transliterating characters -dnl given in 'extra' argument to lowercase 'p'. For -dnl example [*+], [*], and [+] are valid 'extra' args. - -AC_DEFUN([XC_SH_TR_SH_EX], -[ifelse([$2], [], - [XC_SH_TR_SH([$1])], - [`echo "$1" | sed 's/[[$2]]/p/g' | sed 's/[[^a-zA-Z0-9_]]/_/g'`])]) - - -dnl XC_M4_TR_SH (expression) -dnl ------------------------------------------------- -dnl m4 execution time transliteration of 'expression' -dnl argument, where all non-alfanumeric characters are -dnl converted to the underscore '_' character. - -AC_DEFUN([XC_M4_TR_SH], -[patsubst(XC_QPATSUBST(XC_QUOTE($1), - [[^a-zA-Z0-9_]], [_]), - [\(_\(.*\)_\)], [\2])]) - - -dnl XC_M4_TR_SH_EX (expression, [extra]) -dnl ------------------------------------------------- -dnl Like XC_M4_TR_SH but transliterating characters -dnl given in 'extra' argument to lowercase 'p'. For -dnl example [*+], [*], and [+] are valid 'extra' args. - -AC_DEFUN([XC_M4_TR_SH_EX], -[ifelse([$2], [], - [XC_M4_TR_SH([$1])], - [patsubst(XC_QPATSUBST(XC_QPATSUBST(XC_QUOTE($1), - [[$2]], - [p]), - [[^a-zA-Z0-9_]], [_]), - [\(_\(.*\)_\)], [\2])])]) - - -dnl XC_SH_TR_CPP (expression) -dnl ------------------------------------------------- -dnl Shell execution time transliteration of 'expression' -dnl argument, where all non-alfanumeric characters are -dnl converted to the underscore '_' character and alnum -dnl characters are converted to uppercase. -dnl Normal shell expansion and substitution takes place -dnl for given 'expression' at shell execution time before -dnl transliteration is applied to it. - -AC_DEFUN([XC_SH_TR_CPP], -[`echo "$1" | dnl -sed 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/' | dnl -sed 's/[[^A-Z0-9_]]/_/g'`]) - - -dnl XC_SH_TR_CPP_EX (expression, [extra]) -dnl ------------------------------------------------- -dnl Like XC_SH_TR_CPP but transliterating characters -dnl given in 'extra' argument to uppercase 'P'. For -dnl example [*+], [*], and [+] are valid 'extra' args. - -AC_DEFUN([XC_SH_TR_CPP_EX], -[ifelse([$2], [], - [XC_SH_TR_CPP([$1])], - [`echo "$1" | dnl -sed 's/[[$2]]/P/g' | dnl -sed 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/' | dnl -sed 's/[[^A-Z0-9_]]/_/g'`])]) - - -dnl XC_M4_TR_CPP (expression) -dnl ------------------------------------------------- -dnl m4 execution time transliteration of 'expression' -dnl argument, where all non-alfanumeric characters are -dnl converted to the underscore '_' character and alnum -dnl characters are converted to uppercase. - -AC_DEFUN([XC_M4_TR_CPP], -[patsubst(XC_QPATSUBST(XC_QTRANSLIT(XC_QUOTE($1), - [abcdefghijklmnopqrstuvwxyz], - [ABCDEFGHIJKLMNOPQRSTUVWXYZ]), - [[^A-Z0-9_]], [_]), - [\(_\(.*\)_\)], [\2])]) - - -dnl XC_M4_TR_CPP_EX (expression, [extra]) -dnl ------------------------------------------------- -dnl Like XC_M4_TR_CPP but transliterating characters -dnl given in 'extra' argument to uppercase 'P'. For -dnl example [*+], [*], and [+] are valid 'extra' args. - -AC_DEFUN([XC_M4_TR_CPP_EX], -[ifelse([$2], [], - [XC_M4_TR_CPP([$1])], - [patsubst(XC_QPATSUBST(XC_QTRANSLIT(XC_QPATSUBST(XC_QUOTE($1), - [[$2]], - [P]), - [abcdefghijklmnopqrstuvwxyz], - [ABCDEFGHIJKLMNOPQRSTUVWXYZ]), - [[^A-Z0-9_]], [_]), - [\(_\(.*\)_\)], [\2])])]) - - -dnl XC_QUOTE (expression) -dnl ------------------------------------------------- -dnl Expands to quoted result of 'expression' expansion. - -AC_DEFUN([XC_QUOTE], -[[$@]]) - - -dnl XC_QPATSUBST (string, regexp[, repl]) -dnl ------------------------------------------------- -dnl Expands to quoted result of 'patsubst' expansion. - -AC_DEFUN([XC_QPATSUBST], -[XC_QUOTE(patsubst([$1], [$2], [$3]))]) - - -dnl XC_QTRANSLIT (string, chars, repl) -dnl ------------------------------------------------- -dnl Expands to quoted result of 'translit' expansion. - -AC_DEFUN([XC_QTRANSLIT], -[XC_QUOTE(translit([$1], [$2], [$3]))]) - diff --git a/m4/xc-val-flgs.m4 b/m4/xc-val-flgs.m4 deleted file mode 100644 index c9e472e6..00000000 --- a/m4/xc-val-flgs.m4 +++ /dev/null @@ -1,245 +0,0 @@ -#--------------------------------------------------------------------------- -# -# xc-val-flgs.m4 -# -# Copyright (c) Daniel Stenberg -# -# Permission to use, copy, modify, and distribute this software for any -# purpose with or without fee is hereby granted, provided that the above -# copyright notice and this permission notice appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -# -# -# SPDX-License-Identifier: MIT -#--------------------------------------------------------------------------- - -# serial 1 - - -dnl _XC_CHECK_VAR_LIBS -dnl ------------------------------------------------- -dnl Private macro. - -AC_DEFUN([_XC_CHECK_VAR_LIBS], [ - xc_bad_var_libs=no - for xc_word in $LIBS; do - case "$xc_word" in - -l* | --library=*) - : - ;; - *) - xc_bad_var_libs=yes - ;; - esac - done - if test $xc_bad_var_libs = yes; then - AC_MSG_NOTICE([using LIBS: $LIBS]) - AC_MSG_NOTICE([LIBS error: LIBS may only be used to specify libraries (-lname).]) - fi -]) - - -dnl _XC_CHECK_VAR_LDFLAGS -dnl ------------------------------------------------- -dnl Private macro. - -AC_DEFUN([_XC_CHECK_VAR_LDFLAGS], [ - xc_bad_var_ldflags=no - for xc_word in $LDFLAGS; do - case "$xc_word" in - -D*) - xc_bad_var_ldflags=yes - ;; - -U*) - xc_bad_var_ldflags=yes - ;; - -I*) - xc_bad_var_ldflags=yes - ;; - -l* | --library=*) - xc_bad_var_ldflags=yes - ;; - esac - done - if test $xc_bad_var_ldflags = yes; then - AC_MSG_NOTICE([using LDFLAGS: $LDFLAGS]) - xc_bad_var_msg="LDFLAGS error: LDFLAGS may only be used to specify linker flags, not" - for xc_word in $LDFLAGS; do - case "$xc_word" in - -D*) - AC_MSG_NOTICE([$xc_bad_var_msg macro definitions. Use CPPFLAGS for: $xc_word]) - ;; - -U*) - AC_MSG_NOTICE([$xc_bad_var_msg macro suppressions. Use CPPFLAGS for: $xc_word]) - ;; - -I*) - AC_MSG_NOTICE([$xc_bad_var_msg include directories. Use CPPFLAGS for: $xc_word]) - ;; - -l* | --library=*) - AC_MSG_NOTICE([$xc_bad_var_msg libraries. Use LIBS for: $xc_word]) - ;; - esac - done - fi -]) - - -dnl _XC_CHECK_VAR_CPPFLAGS -dnl ------------------------------------------------- -dnl Private macro. - -AC_DEFUN([_XC_CHECK_VAR_CPPFLAGS], [ - xc_bad_var_cppflags=no - for xc_word in $CPPFLAGS; do - case "$xc_word" in - -rpath*) - xc_bad_var_cppflags=yes - ;; - -L* | --library-path=*) - xc_bad_var_cppflags=yes - ;; - -l* | --library=*) - xc_bad_var_cppflags=yes - ;; - esac - done - if test $xc_bad_var_cppflags = yes; then - AC_MSG_NOTICE([using CPPFLAGS: $CPPFLAGS]) - xc_bad_var_msg="CPPFLAGS error: CPPFLAGS may only be used to specify C preprocessor flags, not" - for xc_word in $CPPFLAGS; do - case "$xc_word" in - -rpath*) - AC_MSG_NOTICE([$xc_bad_var_msg library runtime directories. Use LDFLAGS for: $xc_word]) - ;; - -L* | --library-path=*) - AC_MSG_NOTICE([$xc_bad_var_msg library directories. Use LDFLAGS for: $xc_word]) - ;; - -l* | --library=*) - AC_MSG_NOTICE([$xc_bad_var_msg libraries. Use LIBS for: $xc_word]) - ;; - esac - done - fi -]) - - -dnl _XC_CHECK_VAR_CFLAGS -dnl ------------------------------------------------- -dnl Private macro. - -AC_DEFUN([_XC_CHECK_VAR_CFLAGS], [ - xc_bad_var_cflags=no - for xc_word in $CFLAGS; do - case "$xc_word" in - -D*) - xc_bad_var_cflags=yes - ;; - -U*) - xc_bad_var_cflags=yes - ;; - -I*) - xc_bad_var_cflags=yes - ;; - -rpath*) - xc_bad_var_cflags=yes - ;; - -L* | --library-path=*) - xc_bad_var_cflags=yes - ;; - -l* | --library=*) - xc_bad_var_cflags=yes - ;; - esac - done - if test $xc_bad_var_cflags = yes; then - AC_MSG_NOTICE([using CFLAGS: $CFLAGS]) - xc_bad_var_msg="CFLAGS error: CFLAGS may only be used to specify C compiler flags, not" - for xc_word in $CFLAGS; do - case "$xc_word" in - -D*) - AC_MSG_NOTICE([$xc_bad_var_msg macro definitions. Use CPPFLAGS for: $xc_word]) - ;; - -U*) - AC_MSG_NOTICE([$xc_bad_var_msg macro suppressions. Use CPPFLAGS for: $xc_word]) - ;; - -I*) - AC_MSG_NOTICE([$xc_bad_var_msg include directories. Use CPPFLAGS for: $xc_word]) - ;; - -rpath*) - AC_MSG_NOTICE([$xc_bad_var_msg library runtime directories. Use LDFLAGS for: $xc_word]) - ;; - -L* | --library-path=*) - AC_MSG_NOTICE([$xc_bad_var_msg library directories. Use LDFLAGS for: $xc_word]) - ;; - -l* | --library=*) - AC_MSG_NOTICE([$xc_bad_var_msg libraries. Use LIBS for: $xc_word]) - ;; - esac - done - fi -]) - - -dnl XC_CHECK_USER_FLAGS -dnl ------------------------------------------------- -dnl Public macro. -dnl -dnl Performs some sanity checks for LIBS, LDFLAGS, -dnl CPPFLAGS and CFLAGS values that the user might -dnl have set. When checks fails, user is noticed -dnl about errors detected in all of them and script -dnl execution is halted. -dnl -dnl Intended to be used early in configure script. - -AC_DEFUN([XC_CHECK_USER_FLAGS], [ - AC_PREREQ([2.50])dnl - AC_BEFORE([$0],[XC_CHECK_PROG_CC])dnl - dnl check order below matters - _XC_CHECK_VAR_LIBS - _XC_CHECK_VAR_LDFLAGS - _XC_CHECK_VAR_CPPFLAGS - _XC_CHECK_VAR_CFLAGS - if test $xc_bad_var_libs = yes || - test $xc_bad_var_cflags = yes || - test $xc_bad_var_ldflags = yes || - test $xc_bad_var_cppflags = yes; then - AC_MSG_ERROR([Can not continue. Fix errors mentioned immediately above this line.]) - fi -]) - - -dnl XC_CHECK_BUILD_FLAGS -dnl ------------------------------------------------- -dnl Public macro. -dnl -dnl Performs some sanity checks for LIBS, LDFLAGS, -dnl CPPFLAGS and CFLAGS values that the configure -dnl script might have set. When checks fails, user -dnl is noticed about errors detected in all of them -dnl but script continues execution. -dnl -dnl Intended to be used very late in configure script. - -AC_DEFUN([XC_CHECK_BUILD_FLAGS], [ - AC_PREREQ([2.50])dnl - dnl check order below matters - _XC_CHECK_VAR_LIBS - _XC_CHECK_VAR_LDFLAGS - _XC_CHECK_VAR_CPPFLAGS - _XC_CHECK_VAR_CFLAGS - if test $xc_bad_var_libs = yes || - test $xc_bad_var_cflags = yes || - test $xc_bad_var_ldflags = yes || - test $xc_bad_var_cppflags = yes; then - AC_MSG_WARN([Continuing even with errors mentioned immediately above this line.]) - fi -]) - diff --git a/m4/zz40-xc-ovr.m4 b/m4/zz40-xc-ovr.m4 deleted file mode 100644 index 41833479..00000000 --- a/m4/zz40-xc-ovr.m4 +++ /dev/null @@ -1,669 +0,0 @@ -#--------------------------------------------------------------------------- -# -# zz40-xc-ovr.m4 -# -# Copyright (c) Daniel Stenberg -# -# Permission to use, copy, modify, and distribute this software for any -# purpose with or without fee is hereby granted, provided that the above -# copyright notice and this permission notice appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -# -# SPDX-License-Identifier: MIT -#--------------------------------------------------------------------------- - -# serial 1 - - -dnl The funny name of this file is intentional in order to make it -dnl sort alphabetically after any libtool, autoconf or automake -dnl provided .m4 macro file that might get copied into this same -dnl subdirectory. This allows that macro (re)definitions from this -dnl file may override those provided in other files. - - -dnl Version macros -dnl ------------------------------------------------- -dnl Public macros. - -m4_define([XC_CONFIGURE_PREAMBLE_VER_MAJOR],[1])dnl -m4_define([XC_CONFIGURE_PREAMBLE_VER_MINOR],[0])dnl - - -dnl _XC_CFG_PRE_PREAMBLE -dnl ------------------------------------------------- -dnl Private macro. - -AC_DEFUN([_XC_CFG_PRE_PREAMBLE], -[ -## -------------------------------- ## -@%:@@%:@ [XC_CONFIGURE_PREAMBLE] ver: []dnl -XC_CONFIGURE_PREAMBLE_VER_MAJOR.[]dnl -XC_CONFIGURE_PREAMBLE_VER_MINOR ## -## -------------------------------- ## - -xc_configure_preamble_ver_major='XC_CONFIGURE_PREAMBLE_VER_MAJOR' -xc_configure_preamble_ver_minor='XC_CONFIGURE_PREAMBLE_VER_MINOR' - -# -# Set IFS to space, tab and newline. -# - -xc_space=' ' -xc_tab=' ' -xc_newline=' -' -IFS="$xc_space$xc_tab$xc_newline" - -# -# Set internationalization behavior variables. -# - -LANG='C' -LC_ALL='C' -LANGUAGE='C' -export LANG -export LC_ALL -export LANGUAGE - -# -# Some useful variables. -# - -xc_msg_warn='configure: WARNING:' -xc_msg_abrt='Can not continue.' -xc_msg_err='configure: error:' -]) - - -dnl _XC_CFG_PRE_BASIC_CHK_CMD_ECHO -dnl ------------------------------------------------- -dnl Private macro. -dnl -dnl Emits shell code that verifies that 'echo' command -dnl is available, otherwise aborts execution. - -AC_DEFUN([_XC_CFG_PRE_BASIC_CHK_CMD_ECHO], -[dnl -AC_REQUIRE([_XC_CFG_PRE_PREAMBLE])dnl -# -# Verify that 'echo' command is available, otherwise abort. -# - -xc_tst_str='unknown' -(`echo "$xc_tst_str" >/dev/null 2>&1`) && xc_tst_str='success' -case "x$xc_tst_str" in @%:@ (( - xsuccess) - : - ;; - *) - # Try built-in echo, and fail. - echo "$xc_msg_err 'echo' command not found. $xc_msg_abrt" >&2 - exit 1 - ;; -esac -]) - - -dnl _XC_CFG_PRE_BASIC_CHK_CMD_TEST -dnl ------------------------------------------------- -dnl Private macro. -dnl -dnl Emits shell code that verifies that 'test' command -dnl is available, otherwise aborts execution. - -AC_DEFUN([_XC_CFG_PRE_BASIC_CHK_CMD_TEST], -[dnl -AC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_CMD_ECHO])dnl -# -# Verify that 'test' command is available, otherwise abort. -# - -xc_tst_str='unknown' -(`test -n "$xc_tst_str" >/dev/null 2>&1`) && xc_tst_str='success' -case "x$xc_tst_str" in @%:@ (( - xsuccess) - : - ;; - *) - echo "$xc_msg_err 'test' command not found. $xc_msg_abrt" >&2 - exit 1 - ;; -esac -]) - - -dnl _XC_CFG_PRE_BASIC_CHK_VAR_PATH -dnl ------------------------------------------------- -dnl Private macro. -dnl -dnl Emits shell code that verifies that 'PATH' variable -dnl is set, otherwise aborts execution. - -AC_DEFUN([_XC_CFG_PRE_BASIC_CHK_VAR_PATH], -[dnl -AC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_CMD_TEST])dnl -# -# Verify that 'PATH' variable is set, otherwise abort. -# - -xc_tst_str='unknown' -(`test -n "$PATH" >/dev/null 2>&1`) && xc_tst_str='success' -case "x$xc_tst_str" in @%:@ (( - xsuccess) - : - ;; - *) - echo "$xc_msg_err 'PATH' variable not set. $xc_msg_abrt" >&2 - exit 1 - ;; -esac -]) - - -dnl _XC_CFG_PRE_BASIC_CHK_CMD_EXPR -dnl ------------------------------------------------- -dnl Private macro. -dnl -dnl Emits shell code that verifies that 'expr' command -dnl is available, otherwise aborts execution. - -AC_DEFUN([_XC_CFG_PRE_BASIC_CHK_CMD_EXPR], -[dnl -AC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_VAR_PATH])dnl -# -# Verify that 'expr' command is available, otherwise abort. -# - -xc_tst_str='unknown' -xc_tst_str=`expr "$xc_tst_str" : '.*' 2>/dev/null` -case "x$xc_tst_str" in @%:@ (( - x7) - : - ;; - *) - echo "$xc_msg_err 'expr' command not found. $xc_msg_abrt" >&2 - exit 1 - ;; -esac -]) - - -dnl _XC_CFG_PRE_BASIC_CHK_UTIL_SED -dnl ------------------------------------------------- -dnl Private macro. -dnl -dnl Emits shell code that verifies that 'sed' utility -dnl is found within 'PATH', otherwise aborts execution. -dnl -dnl This 'sed' is required in order to allow configure -dnl script bootstrapping itself. No fancy testing for a -dnl proper 'sed' this early, that should be done later. - -AC_DEFUN([_XC_CFG_PRE_BASIC_CHK_UTIL_SED], -[dnl -AC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_VAR_PATH])dnl -# -# Verify that 'sed' utility is found within 'PATH', otherwise abort. -# - -xc_tst_str='unknown' -xc_tst_str=`echo "$xc_tst_str" 2>/dev/null \ - | sed -e 's:unknown:success:' 2>/dev/null` -case "x$xc_tst_str" in @%:@ (( - xsuccess) - : - ;; - *) - echo "$xc_msg_err 'sed' utility not found in 'PATH'. $xc_msg_abrt" >&2 - exit 1 - ;; -esac -]) - - -dnl _XC_CFG_PRE_BASIC_CHK_UTIL_GREP -dnl ------------------------------------------------- -dnl Private macro. -dnl -dnl Emits shell code that verifies that 'grep' utility -dnl is found within 'PATH', otherwise aborts execution. -dnl -dnl This 'grep' is required in order to allow configure -dnl script bootstrapping itself. No fancy testing for a -dnl proper 'grep' this early, that should be done later. - -AC_DEFUN([_XC_CFG_PRE_BASIC_CHK_UTIL_GREP], -[dnl -AC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_VAR_PATH])dnl -# -# Verify that 'grep' utility is found within 'PATH', otherwise abort. -# - -xc_tst_str='unknown' -(`echo "$xc_tst_str" 2>/dev/null \ - | grep 'unknown' >/dev/null 2>&1`) && xc_tst_str='success' -case "x$xc_tst_str" in @%:@ (( - xsuccess) - : - ;; - *) - echo "$xc_msg_err 'grep' utility not found in 'PATH'. $xc_msg_abrt" >&2 - exit 1 - ;; -esac -]) - - -dnl _XC_CFG_PRE_BASIC_CHK_UTIL_TR -dnl ------------------------------------------------- -dnl Private macro. -dnl -dnl Emits shell code that verifies that 'tr' utility -dnl is found within 'PATH', otherwise aborts execution. - -AC_DEFUN([_XC_CFG_PRE_BASIC_CHK_UTIL_TR], -[dnl -AC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_VAR_PATH])dnl -# -# Verify that 'tr' utility is found within 'PATH', otherwise abort. -# - -xc_tst_str="${xc_tab}98s7u6c5c4e3s2s10" -xc_tst_str=`echo "$xc_tst_str" 2>/dev/null \ - | tr -d "0123456789$xc_tab" 2>/dev/null` -case "x$xc_tst_str" in @%:@ (( - xsuccess) - : - ;; - *) - echo "$xc_msg_err 'tr' utility not found in 'PATH'. $xc_msg_abrt" >&2 - exit 1 - ;; -esac -]) - - -dnl _XC_CFG_PRE_BASIC_CHK_UTIL_WC -dnl ------------------------------------------------- -dnl Private macro. -dnl -dnl Emits shell code that verifies that 'wc' utility -dnl is found within 'PATH', otherwise aborts execution. - -AC_DEFUN([_XC_CFG_PRE_BASIC_CHK_UTIL_WC], -[dnl -AC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_UTIL_TR])dnl -# -# Verify that 'wc' utility is found within 'PATH', otherwise abort. -# - -xc_tst_str='unknown unknown unknown unknown' -xc_tst_str=`echo "$xc_tst_str" 2>/dev/null \ - | wc -w 2>/dev/null | tr -d "$xc_space$xc_tab" 2>/dev/null` -case "x$xc_tst_str" in @%:@ (( - x4) - : - ;; - *) - echo "$xc_msg_err 'wc' utility not found in 'PATH'. $xc_msg_abrt" >&2 - exit 1 - ;; -esac -]) - - -dnl _XC_CFG_PRE_BASIC_CHK_UTIL_CAT -dnl ------------------------------------------------- -dnl Private macro. -dnl -dnl Emits shell code that verifies that 'cat' utility -dnl is found within 'PATH', otherwise aborts execution. - -AC_DEFUN([_XC_CFG_PRE_BASIC_CHK_UTIL_CAT], -[dnl -AC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_UTIL_WC])dnl -# -# Verify that 'cat' utility is found within 'PATH', otherwise abort. -# - -xc_tst_str='unknown' -xc_tst_str=`cat <<_EOT 2>/dev/null \ - | wc -l 2>/dev/null | tr -d "$xc_space$xc_tab" 2>/dev/null -unknown -unknown -unknown -_EOT` -case "x$xc_tst_str" in @%:@ (( - x3) - : - ;; - *) - echo "$xc_msg_err 'cat' utility not found in 'PATH'. $xc_msg_abrt" >&2 - exit 1 - ;; -esac -]) - - -dnl _XC_CFG_PRE_CHECK_PATH_SEPARATOR -dnl ------------------------------------------------- -dnl Private macro. -dnl -dnl Emits shell code that computes the path separator -dnl and stores the result in 'PATH_SEPARATOR', unless -dnl the user has already set it with a non-empty value. -dnl -dnl This path separator is the symbol used to separate -dnl or diferentiate paths inside the 'PATH' environment -dnl variable. -dnl -dnl Non-empty user provided 'PATH_SEPARATOR' always -dnl overrides the auto-detected one. - -AC_DEFUN([_XC_CFG_PRE_CHECK_PATH_SEPARATOR], -[dnl -AC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_CMD_EXPR])dnl -# -# Auto-detect and set 'PATH_SEPARATOR', unless it is already non-empty set. -# - -# Directory count in 'PATH' when using a colon separator. -xc_tst_dirs_col='x' -xc_tst_prev_IFS=$IFS; IFS=':' -for xc_tst_dir in $PATH; do - IFS=$xc_tst_prev_IFS - xc_tst_dirs_col="x$xc_tst_dirs_col" -done -IFS=$xc_tst_prev_IFS -xc_tst_dirs_col=`expr "$xc_tst_dirs_col" : '.*'` - -# Directory count in 'PATH' when using a semicolon separator. -xc_tst_dirs_sem='x' -xc_tst_prev_IFS=$IFS; IFS=';' -for xc_tst_dir in $PATH; do - IFS=$xc_tst_prev_IFS - xc_tst_dirs_sem="x$xc_tst_dirs_sem" -done -IFS=$xc_tst_prev_IFS -xc_tst_dirs_sem=`expr "$xc_tst_dirs_sem" : '.*'` - -if test $xc_tst_dirs_sem -eq $xc_tst_dirs_col; then - # When both counting methods give the same result we do not want to - # chose one over the other, and consider auto-detection not possible. - if test -z "$PATH_SEPARATOR"; then - # Stop dead until user provides 'PATH_SEPARATOR' definition. - echo "$xc_msg_err 'PATH_SEPARATOR' variable not set. $xc_msg_abrt" >&2 - exit 1 - fi -else - # Separator with the greater directory count is the auto-detected one. - if test $xc_tst_dirs_sem -gt $xc_tst_dirs_col; then - xc_tst_auto_separator=';' - else - xc_tst_auto_separator=':' - fi - if test -z "$PATH_SEPARATOR"; then - # Simply use the auto-detected one when not already set. - PATH_SEPARATOR=$xc_tst_auto_separator - elif test "x$PATH_SEPARATOR" != "x$xc_tst_auto_separator"; then - echo "$xc_msg_warn 'PATH_SEPARATOR' does not match auto-detected one." >&2 - fi -fi -xc_PATH_SEPARATOR=$PATH_SEPARATOR -AC_SUBST([PATH_SEPARATOR])dnl -]) - - -dnl _XC_CFG_PRE_POSTLUDE -dnl ------------------------------------------------- -dnl Private macro. - -AC_DEFUN([_XC_CFG_PRE_POSTLUDE], -[dnl -AC_REQUIRE([_XC_CFG_PRE_PREAMBLE])dnl -AC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_CMD_ECHO])dnl -AC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_CMD_TEST])dnl -AC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_VAR_PATH])dnl -AC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_CMD_EXPR])dnl -AC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_UTIL_SED])dnl -AC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_UTIL_GREP])dnl -AC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_UTIL_TR])dnl -AC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_UTIL_WC])dnl -AC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_UTIL_CAT])dnl -AC_REQUIRE([_XC_CFG_PRE_CHECK_PATH_SEPARATOR])dnl -dnl -xc_configure_preamble_result='yes' -]) - - -dnl XC_CONFIGURE_PREAMBLE -dnl ------------------------------------------------- -dnl Public macro. -dnl -dnl This macro emits shell code which does some -dnl very basic checks related with the availability -dnl of some commands and utilities needed to allow -dnl configure script bootstrapping itself when using -dnl these to figure out other settings. Also emits -dnl code that performs PATH_SEPARATOR auto-detection -dnl and sets its value unless it is already set with -dnl a non-empty value. -dnl -dnl These basic checks are intended to be placed and -dnl executed as early as possible in the resulting -dnl configure script, and as such these must be pure -dnl and portable shell code. -dnl -dnl This macro may be used directly, or indirectly -dnl when using other macros that AC_REQUIRE it such -dnl as XC_CHECK_PATH_SEPARATOR. -dnl -dnl Currently the mechanism used to ensure that this -dnl macro expands early enough in generated configure -dnl script is making it override autoconf and libtool -dnl PATH_SEPARATOR check. - -AC_DEFUN([XC_CONFIGURE_PREAMBLE], -[dnl -AC_PREREQ([2.50])dnl -dnl -AC_BEFORE([$0],[_XC_CFG_PRE_PREAMBLE])dnl -AC_BEFORE([$0],[_XC_CFG_PRE_BASIC_CHK_CMD_ECHO])dnl -AC_BEFORE([$0],[_XC_CFG_PRE_BASIC_CHK_CMD_TEST])dnl -AC_BEFORE([$0],[_XC_CFG_PRE_BASIC_CHK_VAR_PATH])dnl -AC_BEFORE([$0],[_XC_CFG_PRE_BASIC_CHK_CMD_EXPR])dnl -AC_BEFORE([$0],[_XC_CFG_PRE_BASIC_CHK_UTIL_SED])dnl -AC_BEFORE([$0],[_XC_CFG_PRE_BASIC_CHK_UTIL_GREP])dnl -AC_BEFORE([$0],[_XC_CFG_PRE_BASIC_CHK_UTIL_TR])dnl -AC_BEFORE([$0],[_XC_CFG_PRE_BASIC_CHK_UTIL_WC])dnl -AC_BEFORE([$0],[_XC_CFG_PRE_BASIC_CHK_UTIL_CAT])dnl -AC_BEFORE([$0],[_XC_CFG_PRE_CHECK_PATH_SEPARATOR])dnl -AC_BEFORE([$0],[_XC_CFG_PRE_POSTLUDE])dnl -dnl -AC_BEFORE([$0],[AC_CHECK_TOOL])dnl -AC_BEFORE([$0],[AC_CHECK_PROG])dnl -AC_BEFORE([$0],[AC_CHECK_TOOLS])dnl -AC_BEFORE([$0],[AC_CHECK_PROGS])dnl -dnl -AC_BEFORE([$0],[AC_PATH_TOOL])dnl -AC_BEFORE([$0],[AC_PATH_PROG])dnl -AC_BEFORE([$0],[AC_PATH_PROGS])dnl -dnl -AC_BEFORE([$0],[AC_PROG_SED])dnl -AC_BEFORE([$0],[AC_PROG_GREP])dnl -AC_BEFORE([$0],[AC_PROG_LN_S])dnl -AC_BEFORE([$0],[AC_PROG_MKDIR_P])dnl -AC_BEFORE([$0],[AC_PROG_INSTALL])dnl -AC_BEFORE([$0],[AC_PROG_MAKE_SET])dnl -AC_BEFORE([$0],[AC_PROG_LIBTOOL])dnl -dnl -AC_BEFORE([$0],[LT_INIT])dnl -AC_BEFORE([$0],[AM_INIT_AUTOMAKE])dnl -AC_BEFORE([$0],[AC_LIBTOOL_WIN32_DLL])dnl -dnl -AC_REQUIRE([_XC_CFG_PRE_PREAMBLE])dnl -AC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_CMD_ECHO])dnl -AC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_CMD_TEST])dnl -AC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_VAR_PATH])dnl -AC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_CMD_EXPR])dnl -AC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_UTIL_SED])dnl -AC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_UTIL_GREP])dnl -AC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_UTIL_TR])dnl -AC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_UTIL_WC])dnl -AC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_UTIL_CAT])dnl -AC_REQUIRE([_XC_CFG_PRE_CHECK_PATH_SEPARATOR])dnl -AC_REQUIRE([_XC_CFG_PRE_POSTLUDE])dnl -dnl -m4_pattern_forbid([^_*XC])dnl -m4_define([$0],[])dnl -]) - - -dnl Override autoconf and libtool PATH_SEPARATOR check -dnl ------------------------------------------------- -dnl Macros overriding. -dnl -dnl This is done to ensure that the same check is -dnl used across different autoconf versions and to -dnl allow expansion of XC_CONFIGURE_PREAMBLE macro -dnl early enough in the generated configure script. - -dnl -dnl Override when using autoconf 2.53 and newer. -dnl - -m4_ifdef([_AS_PATH_SEPARATOR_PREPARE], -[dnl -m4_undefine([_AS_PATH_SEPARATOR_PREPARE])dnl -m4_defun([_AS_PATH_SEPARATOR_PREPARE], -[dnl -AC_REQUIRE([XC_CONFIGURE_PREAMBLE])dnl -m4_define([$0],[])dnl -])dnl -]) - -dnl -dnl Override when using autoconf 2.50 to 2.52 -dnl - -m4_ifdef([_AC_INIT_PREPARE_FS_SEPARATORS], -[dnl -m4_undefine([_AC_INIT_PREPARE_FS_SEPARATORS])dnl -m4_defun([_AC_INIT_PREPARE_FS_SEPARATORS], -[dnl -AC_REQUIRE([XC_CONFIGURE_PREAMBLE])dnl -ac_path_separator=$PATH_SEPARATOR -m4_define([$0],[])dnl -])dnl -]) - -dnl -dnl Override when using libtool 1.4.2 -dnl - -m4_ifdef([_LT_AC_LIBTOOL_SYS_PATH_SEPARATOR], -[dnl -m4_undefine([_LT_AC_LIBTOOL_SYS_PATH_SEPARATOR])dnl -m4_defun([_LT_AC_LIBTOOL_SYS_PATH_SEPARATOR], -[dnl -AC_REQUIRE([XC_CONFIGURE_PREAMBLE])dnl -lt_cv_sys_path_separator=$PATH_SEPARATOR -m4_define([$0],[])dnl -])dnl -]) - - -dnl XC_CHECK_PATH_SEPARATOR -dnl ------------------------------------------------- -dnl Public macro. -dnl -dnl Usage of this macro ensures that generated configure -dnl script uses the same PATH_SEPARATOR check irrespective -dnl of autoconf or libtool version being used to generate -dnl configure script. -dnl -dnl Emits shell code that computes the path separator -dnl and stores the result in 'PATH_SEPARATOR', unless -dnl the user has already set it with a non-empty value. -dnl -dnl This path separator is the symbol used to separate -dnl or diferentiate paths inside the 'PATH' environment -dnl variable. -dnl -dnl Non-empty user provided 'PATH_SEPARATOR' always -dnl overrides the auto-detected one. -dnl -dnl Strictly speaking the check is done in two steps. The -dnl first, which does the actual check, takes place in -dnl XC_CONFIGURE_PREAMBLE macro and happens very early in -dnl generated configure script. The second one shows and -dnl logs the result of the check into config.log at a later -dnl configure stage. Placement of this second stage in -dnl generated configure script will be done where first -dnl direct or indirect usage of this macro happens. - -AC_DEFUN([XC_CHECK_PATH_SEPARATOR], -[dnl -AC_PREREQ([2.50])dnl -dnl -AC_BEFORE([$0],[AC_CHECK_TOOL])dnl -AC_BEFORE([$0],[AC_CHECK_PROG])dnl -AC_BEFORE([$0],[AC_CHECK_TOOLS])dnl -AC_BEFORE([$0],[AC_CHECK_PROGS])dnl -dnl -AC_BEFORE([$0],[AC_PATH_TOOL])dnl -AC_BEFORE([$0],[AC_PATH_PROG])dnl -AC_BEFORE([$0],[AC_PATH_PROGS])dnl -dnl -AC_BEFORE([$0],[AC_PROG_SED])dnl -AC_BEFORE([$0],[AC_PROG_GREP])dnl -AC_BEFORE([$0],[AC_PROG_LN_S])dnl -AC_BEFORE([$0],[AC_PROG_MKDIR_P])dnl -AC_BEFORE([$0],[AC_PROG_INSTALL])dnl -AC_BEFORE([$0],[AC_PROG_MAKE_SET])dnl -AC_BEFORE([$0],[AC_PROG_LIBTOOL])dnl -dnl -AC_BEFORE([$0],[LT_INIT])dnl -AC_BEFORE([$0],[AM_INIT_AUTOMAKE])dnl -AC_BEFORE([$0],[AC_LIBTOOL_WIN32_DLL])dnl -dnl -AC_REQUIRE([XC_CONFIGURE_PREAMBLE])dnl -dnl -# -# Check that 'XC_CONFIGURE_PREAMBLE' has already run. -# - -if test -z "$xc_configure_preamble_result"; then - AC_MSG_ERROR([xc_configure_preamble_result not set (internal problem)]) -fi - -# -# Check that 'PATH_SEPARATOR' has already been set. -# - -if test -z "$xc_PATH_SEPARATOR"; then - AC_MSG_ERROR([xc_PATH_SEPARATOR not set (internal problem)]) -fi -if test -z "$PATH_SEPARATOR"; then - AC_MSG_ERROR([PATH_SEPARATOR not set (internal or config.site problem)]) -fi -AC_MSG_CHECKING([for path separator]) -AC_MSG_RESULT([$PATH_SEPARATOR]) -if test "x$PATH_SEPARATOR" != "x$xc_PATH_SEPARATOR"; then - AC_MSG_CHECKING([for initial path separator]) - AC_MSG_RESULT([$xc_PATH_SEPARATOR]) - AC_MSG_ERROR([path separator mismatch (internal or config.site problem)]) -fi -dnl -m4_pattern_forbid([^_*XC])dnl -m4_define([$0],[])dnl -]) - diff --git a/src/lib/CMakeLists.txt b/src/lib/CMakeLists.txt index 373e1fbd..ce3b5a9b 100644 --- a/src/lib/CMakeLists.txt +++ b/src/lib/CMakeLists.txt @@ -104,10 +104,12 @@ IF (CARES_STATIC) PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}" ) - TARGET_COMPILE_DEFINITIONS (${LIBNAME} - PUBLIC CARES_STATICLIB - PRIVATE HAVE_CONFIG_H=1 - ) + TARGET_COMPILE_DEFINITIONS (${LIBNAME} PRIVATE HAVE_CONFIG_H=1 CARES_BUILDING_LIBRARY) + + # Only matters on Windows + IF (WIN32 OR CYGWIN) + TARGET_COMPILE_DEFINITIONS (${LIBNAME} PUBLIC CARES_STATICLIB) + ENDIF() TARGET_LINK_LIBRARIES (${LIBNAME} PUBLIC ${CARES_DEPENDENT_LIBS}) IF (CARES_INSTALL) diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am index 998996b1..39f28578 100644 --- a/src/lib/Makefile.am +++ b/src/lib/Makefile.am @@ -27,37 +27,17 @@ DISTCLEANFILES = ares_config.h DIST_SUBDIRS = -AM_LDFLAGS = - -libcares_la_LDFLAGS_EXTRA = - -if CARES_LT_SHLIB_USE_VERSION_INFO -libcares_la_LDFLAGS_EXTRA += -version-info @CARES_VERSION_INFO@ -endif - -if CARES_LT_SHLIB_USE_NO_UNDEFINED -libcares_la_LDFLAGS_EXTRA += -no-undefined -endif - -if CARES_LT_SHLIB_USE_MIMPURE_TEXT -libcares_la_LDFLAGS_EXTRA += -mimpure-text -endif - -libcares_la_LDFLAGS = $(AM_LDFLAGS) $(libcares_la_LDFLAGS_EXTRA) - -# Add -Werror if defined -CFLAGS += @CARES_CFLAG_EXTRAS@ - -if USE_CPPFLAG_CARES_STATICLIB -AM_CPPFLAGS += $(CPPFLAG_CARES_STATICLIB) +libcares_la_LDFLAGS = -version-info @CARES_VERSION_INFO@ +if CARES_USE_NO_UNDEFINED +libcares_la_LDFLAGS += -no-undefined endif libcares_la_CFLAGS_EXTRA = libcares_la_CPPFLAGS_EXTRA = -DCARES_BUILDING_LIBRARY -if DOING_CARES_SYMBOL_HIDING -libcares_la_CFLAGS_EXTRA += $(CFLAG_CARES_SYMBOL_HIDING) +if CARES_SYMBOL_HIDING +libcares_la_CFLAGS_EXTRA += @CARES_SYMBOL_HIDING_CFLAG@ libcares_la_CPPFLAGS_EXTRA += -DCARES_SYMBOL_HIDING endif diff --git a/src/lib/ares__iface_ips.c b/src/lib/ares__iface_ips.c index 15e813d4..b252a7ab 100644 --- a/src/lib/ares__iface_ips.c +++ b/src/lib/ares__iface_ips.c @@ -481,7 +481,7 @@ static ares_status_t ares__iface_ips_enumerate(ares__iface_ips_t *ips, /* netmask */ sockaddr_in6 = (struct sockaddr_in6 *)((void *)ifa->ifa_netmask); netmask = count_addr_bits((const void *)&sockaddr_in6->sin6_addr, 16); -# ifdef HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID +# ifdef HAVE_STRUCT_SOCKADDR_IN6_SIN6_SCOPE_ID ll_scope = sockaddr_in6->sin6_scope_id; # endif } else { diff --git a/src/lib/ares__socket.c b/src/lib/ares__socket.c index 9129f444..c379f605 100644 --- a/src/lib/ares__socket.c +++ b/src/lib/ares__socket.c @@ -106,7 +106,7 @@ static int setsocknonblock(ares_socket_t sockfd, /* operate on this */ /* most recent unix versions */ int flags; flags = fcntl(sockfd, F_GETFL, 0); - if (FALSE != nonblock) { + if (nonblock) { return fcntl(sockfd, F_SETFL, flags | O_NONBLOCK); } else { return fcntl(sockfd, F_SETFL, flags & (~O_NONBLOCK)); /* LCOV_EXCL_LINE */ @@ -177,7 +177,7 @@ static int configure_socket(ares_socket_t s, struct server_state *server) return 0; } - (void)setsocknonblock(s, TRUE); + (void)setsocknonblock(s, 1); #if defined(FD_CLOEXEC) && !defined(MSDOS) /* Configure the socket fd as close-on-exec. */ @@ -278,7 +278,7 @@ ares_status_t ares__open_connection(ares_channel_t *channel, saddr.sa6.sin6_port = htons(is_tcp ? server->tcp_port : server->udp_port); memcpy(&saddr.sa6.sin6_addr, &server->addr.addr.addr6, sizeof(saddr.sa6.sin6_addr)); -#ifdef HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID +#ifdef HAVE_STRUCT_SOCKADDR_IN6_SIN6_SCOPE_ID saddr.sa6.sin6_scope_id = server->ll_scope; #endif break; diff --git a/src/lib/ares_config.h.cmake b/src/lib/ares_config.h.cmake index 17ceefd0..4529eb94 100644 --- a/src/lib/ares_config.h.cmake +++ b/src/lib/ares_config.h.cmake @@ -7,21 +7,9 @@ /* Define if building universal (internal helper macro) */ #undef AC_APPLE_UNIVERSAL_BUILD -/* define this if ares is built for a big endian system */ -#undef ARES_BIG_ENDIAN - -/* when building as static part of libcurl */ -#undef BUILDING_LIBCURL - -/* Defined for build that exposes internal static functions for testing. */ -#undef CARES_EXPOSE_STATICS - /* Defined for build with symbol hiding. */ #cmakedefine CARES_SYMBOL_HIDING -/* Definition to make a library symbol externally visible. */ -#define CARES_SYMBOL_SCOPE_EXTERN @CARES_SYMBOL_SCOPE_EXTERN@ - /* Use resolver library to configure cares */ #cmakedefine CARES_USE_LIBRESOLV @@ -67,12 +55,6 @@ /* Define to 1 if you have the header file. */ #cmakedefine HAVE_ASSERT_H -/* Define to 1 if you have the `bitncmp' function. */ -#cmakedefine HAVE_BITNCMP - -/* Define to 1 if bool is an available type. */ -#cmakedefine HAVE_BOOL_T - /* Define to 1 if you have the clock_gettime function and monotonic timer. */ #cmakedefine HAVE_CLOCK_GETTIME_MONOTONIC @@ -115,12 +97,6 @@ /* Define to 1 if you have the getenv function. */ #cmakedefine HAVE_GETENV -/* Define to 1 if you have the gethostbyaddr function. */ -#cmakedefine HAVE_GETHOSTBYADDR - -/* Define to 1 if you have the gethostbyname function. */ -#cmakedefine HAVE_GETHOSTBYNAME - /* Define to 1 if you have the gethostname function. */ #cmakedefine HAVE_GETHOSTNAME @@ -197,9 +173,6 @@ /* Define to 1 if you have the header file. */ #cmakedefine HAVE_LIMITS_H -/* if your compiler supports LL */ -#cmakedefine HAVE_LL - /* Define to 1 if the compiler supports the 'long long' data type. */ #cmakedefine HAVE_LONGLONG @@ -245,14 +218,8 @@ /* Define to 1 if you have the header file. */ #cmakedefine HAVE_SIGNAL_H -/* Define to 1 if sig_atomic_t is an available typedef. */ -#cmakedefine HAVE_SIG_ATOMIC_T - -/* Define to 1 if sig_atomic_t is already defined as volatile. */ -#cmakedefine HAVE_SIG_ATOMIC_T_VOLATILE - /* Define to 1 if your struct sockaddr_in6 has sin6_scope_id. */ -#cmakedefine HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID +#cmakedefine HAVE_STRUCT_SOCKADDR_IN6_SIN6_SCOPE_ID /* Define to 1 if you have the socket function. */ #cmakedefine HAVE_SOCKET @@ -458,9 +425,6 @@ /* Define to avoid automatic inclusion of winsock.h */ #undef WIN32_LEAN_AND_MEAN -/* Type to use in place of in_addr_t when system does not provide it. */ -#undef in_addr_t - /* Define to 1 if you have the pthread.h header file. */ #cmakedefine HAVE_PTHREAD_H diff --git a/src/lib/ares_getnameinfo.c b/src/lib/ares_getnameinfo.c index 2afcfade..7a9c0d55 100644 --- a/src/lib/ares_getnameinfo.c +++ b/src/lib/ares_getnameinfo.c @@ -69,7 +69,7 @@ struct nameinfo_query { size_t timeouts; }; -#ifdef HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID +#ifdef HAVE_STRUCT_SOCKADDR_IN6_SIN6_SCOPE_ID # define IPBUFSIZ \ (sizeof("ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255") + IF_NAMESIZE) #else @@ -80,11 +80,11 @@ static void nameinfo_callback(void *arg, int status, int timeouts, struct hostent *host); static char *lookup_service(unsigned short port, unsigned int flags, char *buf, size_t buflen); -#ifdef HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID +#ifdef HAVE_STRUCT_SOCKADDR_IN6_SIN6_SCOPE_ID static void append_scopeid(const struct sockaddr_in6 *addr6, unsigned int scopeid, char *buf, size_t buflen); #endif -STATIC_TESTABLE char *ares_striendstr(const char *s1, const char *s2); +static char *ares_striendstr(const char *s1, const char *s2); static void ares_getnameinfo_int(ares_channel_t *channel, const struct sockaddr *sa, @@ -145,7 +145,7 @@ static void ares_getnameinfo_int(ares_channel_t *channel, if (salen == sizeof(struct sockaddr_in6)) { ares_inet_ntop(AF_INET6, &addr6->sin6_addr, ipbuf, IPBUFSIZ); /* If the system supports scope IDs, use it */ -#ifdef HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID +#ifdef HAVE_STRUCT_SOCKADDR_IN6_SIN6_SCOPE_ID append_scopeid(addr6, flags, ipbuf, sizeof(ipbuf)); #endif } else { @@ -247,7 +247,7 @@ static void nameinfo_callback(void *arg, int status, int timeouts, ares_inet_ntop(AF_INET, &niquery->addr.addr4.sin_addr, ipbuf, IPBUFSIZ); } else { ares_inet_ntop(AF_INET6, &niquery->addr.addr6.sin6_addr, ipbuf, IPBUFSIZ); -#ifdef HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID +#ifdef HAVE_STRUCT_SOCKADDR_IN6_SIN6_SCOPE_ID append_scopeid(&niquery->addr.addr6, niquery->flags, ipbuf, sizeof(ipbuf)); #endif @@ -346,7 +346,7 @@ static char *lookup_service(unsigned short port, unsigned int flags, char *buf, return NULL; } -#ifdef HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID +#ifdef HAVE_STRUCT_SOCKADDR_IN6_SIN6_SCOPE_ID static void append_scopeid(const struct sockaddr_in6 *addr6, unsigned int flags, char *buf, size_t buflen) { @@ -387,7 +387,7 @@ static void append_scopeid(const struct sockaddr_in6 *addr6, unsigned int flags, #endif /* Determines if s1 ends with the string in s2 (case-insensitive) */ -STATIC_TESTABLE char *ares_striendstr(const char *s1, const char *s2) +static char *ares_striendstr(const char *s1, const char *s2) { const char *c1; const char *c2; diff --git a/src/lib/ares_private.h b/src/lib/ares_private.h index acc7f7ca..4c1df3bd 100644 --- a/src/lib/ares_private.h +++ b/src/lib/ares_private.h @@ -50,13 +50,6 @@ # define INADDR_NONE 0xffffffff #endif -#ifdef CARES_EXPOSE_STATICS -/* Make some internal functions visible for testing */ -# define STATIC_TESTABLE -#else -# define STATIC_TESTABLE static -#endif - /* By using a double cast, we can get rid of the bogus warning of * warning: cast from 'const struct sockaddr *' to 'const struct sockaddr_in6 *' * increases required alignment from 1 to 4 [-Wcast-align] diff --git a/src/lib/config-win32.h b/src/lib/config-win32.h index 24301f29..e275fbf0 100644 --- a/src/lib/config-win32.h +++ b/src/lib/config-win32.h @@ -105,9 +105,6 @@ /* OTHER HEADER INFO */ /* ---------------------------------------------------------------- */ -/* Define if sig_atomic_t is an available typedef. */ -#define HAVE_SIG_ATOMIC_T 1 - /* Define if you have the ANSI C header files. */ #define STDC_HEADERS 1 @@ -234,14 +231,6 @@ /* TYPEDEF REPLACEMENTS */ /* ---------------------------------------------------------------- */ -/* Define if in_addr_t is not an available 'typedefed' type. */ -#define in_addr_t unsigned long - -#ifdef __cplusplus -/* Compiling headers in C++ mode means bool is available */ -# define HAVE_BOOL_T -#endif - /* ---------------------------------------------------------------- */ /* TYPE SIZES */ /* ---------------------------------------------------------------- */ @@ -354,7 +343,7 @@ /* Define if you have sockaddr_in6 with scopeid. */ #ifdef HAVE_WS2TCPIP_H -# define HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID 1 +# define HAVE_STRUCT_SOCKADDR_IN6_SIN6_SCOPE_ID 1 #endif #if defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0600) && !defined(__WATCOMC__) diff --git a/src/lib/setup_once.h b/src/lib/setup_once.h index 97bc30ac..042a3aae 100644 --- a/src/lib/setup_once.h +++ b/src/lib/setup_once.h @@ -80,10 +80,6 @@ # include #endif -#if defined(HAVE_STDBOOL_H) && defined(HAVE_BOOL_T) -# include -#endif - #ifdef HAVE_UNISTD_H # include #endif @@ -290,58 +286,6 @@ Error Missing_definition_of_macro_sread #define TOLOWER(x) (tolower((int)((unsigned char)x))) -/* - * 'bool' stuff compatible with HP-UX headers. - */ - -#if defined(__hpux) && !defined(HAVE_BOOL_T) -typedef int bool; -# define false 0 -# define true 1 -# define HAVE_BOOL_T -#endif - - -/* - * 'bool' exists on platforms with , i.e. C99 platforms. - * On non-C99 platforms there's no bool, so define an enum for that. - * On C99 platforms 'false' and 'true' also exist. Enum uses a - * global namespace though, so use bool_false and bool_true. - */ - -#ifndef HAVE_BOOL_T -typedef enum { - bool_false = 0, - bool_true = 1 -} bool; - -/* - * Use a define to let 'true' and 'false' use those enums. There - * are currently no use of true and false in libcurl proper, but - * there are some in the examples. This will cater for any later - * code happening to use true and false. - */ -# define false bool_false -# define true bool_true -# define HAVE_BOOL_T -#endif - - -/* - * Redefine TRUE and FALSE too, to catch current use. With this - * change, 'bool found = 1' will give a warning on MIPSPro, but - * 'bool found = TRUE' will not. Change tested on IRIX/MIPSPro, - * AIX 5.1/Xlc, Tru64 5.1/cc, w/make test too. - */ - -#ifndef TRUE -# define TRUE true -#endif -#ifndef FALSE -# define FALSE false -#endif - - /* * Macro WHILE_FALSE may be used to build single-iteration do-while loops, * avoiding compiler warnings. Mostly intended for other macro definitions. @@ -361,27 +305,6 @@ typedef enum { #endif -/* - * Typedef to 'int' if sig_atomic_t is not an available 'typedefed' type. - */ - -#ifndef HAVE_SIG_ATOMIC_T -typedef int sig_atomic_t; -# define HAVE_SIG_ATOMIC_T -#endif - - -/* - * Convenience SIG_ATOMIC_T definition - */ - -#ifdef HAVE_SIG_ATOMIC_T_VOLATILE -# define SIG_ATOMIC_T static sig_atomic_t -#else -# define SIG_ATOMIC_T static volatile sig_atomic_t -#endif - - /* * Macro used to include code only in debug builds. */ diff --git a/src/tools/Makefile.am b/src/tools/Makefile.am index 8ca33a93..0545c064 100644 --- a/src/tools/Makefile.am +++ b/src/tools/Makefile.am @@ -17,10 +17,6 @@ AM_CPPFLAGS = -I$(top_builddir)/include \ -I$(top_srcdir)/include \ -I$(top_srcdir)/src/lib -if USE_CPPFLAG_CARES_STATICLIB -AM_CPPFLAGS += $(CPPFLAG_CARES_STATICLIB) -endif - include Makefile.inc # We're not interested in code coverage of the test apps themselves, but need diff --git a/src/tools/adig.c b/src/tools/adig.c index 35f4b224..539080da 100644 --- a/src/tools/adig.c +++ b/src/tools/adig.c @@ -46,7 +46,6 @@ #include "ares_dns.h" #ifndef HAVE_STRDUP -# include "ares_strdup.h" # define strdup(ptr) ares_strdup(ptr) #endif diff --git a/test/.gitignore b/test/.gitignore index c7c4cc47..e8076895 100644 --- a/test/.gitignore +++ b/test/.gitignore @@ -11,7 +11,6 @@ fuzzcheck.sh.trs test-suite.log fuzzoutput config.h.in -config.h dnsdump ares-libfuzzer ares-libfuzzer-name diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 0afee848..5d1e1373 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -15,6 +15,7 @@ target_compile_definitions(caresinternal INTERFACE HAVE_CONFIG_H=1) target_include_directories(caresinternal INTERFACE "${PROJECT_BINARY_DIR}" + "${PROJECT_BINARY_DIR}/src/lib" "${PROJECT_SOURCE_DIR}" "${PROJECT_SOURCE_DIR}/src/lib" "${CARES_TOPLEVEL_DIR}/include" @@ -30,8 +31,6 @@ ENDIF () transform_makefile_inc("Makefile.inc" "${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake") include(${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake) -configure_file(${CARES_TOPLEVEL_DIR}/src/lib/ares_config.h.cmake config.h) - add_executable(arestest ${TESTSOURCES} ${TESTHEADERS}) target_include_directories(arestest PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) target_link_libraries(arestest PRIVATE caresinternal GTest::gmock) diff --git a/test/Makefile.am b/test/Makefile.am index 76ce5277..a84906dc 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -1,36 +1,16 @@ -############################################################# -# -# Copyright (C) the Massachusetts Institute of Technology. -# Copyright (C) Daniel Stenberg -# -# Permission to use, copy, modify, and distribute this -# software and its documentation for any purpose and without -# fee is hereby granted, provided that the above copyright -# notice appear in all copies and that both that copyright -# notice and this permission notice appear in supporting -# documentation, and that the name of M.I.T. not be used in -# advertising or publicity pertaining to distribution of the -# software without specific, written prior permission. -# M.I.T. makes no representations about the suitability of -# this software for any purpose. It is provided "as is" -# without express or implied warranty. -# +# Copyright (C) The c-ares project and its contributors # SPDX-License-Identifier: MIT -# -############################################################# - -ARES_BLD_DIR = $(top_builddir)/.. -ARES_SRC_DIR = $(top_srcdir)/.. - AUTOMAKE_OPTIONS = foreign subdir-objects nostdinc 1.9.6 -ACLOCAL_AMFLAGS = -I ../m4 --install -CPPFLAGS += -I$(ARES_BLD_DIR)/include \ - -I$(ARES_BLD_DIR)/src/lib \ - -I$(ARES_SRC_DIR)/include \ - -I$(ARES_SRC_DIR)/src/lib \ - -I$(top_builddir) -CXXFLAGS += -Wall $(PTHREAD_CFLAGS) +AM_CPPFLAGS = -I$(top_builddir)/include \ + -I$(top_builddir)/src/lib \ + -I$(top_srcdir)/include \ + -I$(top_srcdir)/src/lib \ + -I$(top_srcdir)/test \ + -I$(top_builddir)/test \ + -I$(top_builddir) +AM_CXXFLAGS = $(PTHREAD_CFLAGS) +AM_CFLAGS = $(PTHREAD_CFLAGS) # Makefile.inc provides the various *SOURCES and *HEADERS defines include Makefile.inc @@ -38,22 +18,20 @@ include Makefile.inc TESTS = arestest fuzzcheck.sh noinst_PROGRAMS = arestest aresfuzz aresfuzzname dnsdump -EXTRA_DIST = fuzzcheck.sh CMakeLists.txt Makefile.m32 Makefile.msvc README.md buildconf $(srcdir)/fuzzinput/* $(srcdir)/fuzznames/* +EXTRA_DIST = fuzzcheck.sh CMakeLists.txt Makefile.m32 Makefile.msvc README.md $(srcdir)/fuzzinput/* $(srcdir)/fuzznames/* arestest_SOURCES = $(TESTSOURCES) $(TESTHEADERS) # Not interested in coverage of test code, but linking the test binary needs the coverage option arestest_CXXFLAGS = $(GMOCK_CFLAGS) -arestest_LDADD = $(GMOCK_LIBS) $(ARES_BLD_DIR)/src/lib/libcares.la $(PTHREAD_LIBS) $(CODE_COVERAGE_LIBS) - -include $(top_srcdir)/aminclude_static.am +arestest_LDADD = $(GMOCK_LIBS) $(top_builddir)/src/lib/libcares.la $(PTHREAD_LIBS) $(CODE_COVERAGE_LIBS) aresfuzz_SOURCES = $(FUZZSOURCES) -aresfuzz_LDADD = $(ARES_BLD_DIR)/src/lib/libcares.la $(PTHREAD_LIBS) $(CODE_COVERAGE_LIBS) +aresfuzz_LDADD = $(top_builddir)/src/lib/libcares.la $(PTHREAD_LIBS) $(CODE_COVERAGE_LIBS) aresfuzzname_SOURCES = $(FUZZNAMESOURCES) -aresfuzzname_LDADD = $(ARES_BLD_DIR)/src/lib/libcares.la $(PTHREAD_LIBS) $(CODE_COVERAGE_LIBS) +aresfuzzname_LDADD = $(top_builddir)/src/lib/libcares.la $(PTHREAD_LIBS) $(CODE_COVERAGE_LIBS) dnsdump_SOURCES = $(DUMPSOURCES) -dnsdump_LDADD = $(ARES_BLD_DIR)/src/lib/libcares.la $(PTHREAD_LIBS) $(CODE_COVERAGE_LIBS) +dnsdump_LDADD = $(top_builddir)/src/lib/libcares.la $(PTHREAD_LIBS) $(CODE_COVERAGE_LIBS) test: check diff --git a/test/ares-test-internal.cc b/test/ares-test-internal.cc index 51d7bc11..8ae002a8 100644 --- a/test/ares-test-internal.cc +++ b/test/ares-test-internal.cc @@ -32,7 +32,9 @@ #include #endif #include - +#ifdef HAVE_SYS_IOCTL_H +# include +#endif extern "C" { // Remove command-line defines of package variables for the test project... #undef PACKAGE_NAME @@ -919,42 +921,6 @@ TEST_F(LibraryTest, SlistMisuse) { } #endif -#ifdef CARES_EXPOSE_STATICS -// These tests access internal static functions from the library, which -// are only exposed when CARES_EXPOSE_STATICS has been configured. As such -// they are tightly couple to the internal library implementation details. -extern "C" char *ares_striendstr(const char*, const char*); -TEST_F(LibraryTest, Striendstr) { - EXPECT_EQ(nullptr, ares_striendstr("abc", "12345")); - EXPECT_NE(nullptr, ares_striendstr("abc12345", "12345")); - EXPECT_NE(nullptr, ares_striendstr("abcxyzzy", "XYZZY")); - EXPECT_NE(nullptr, ares_striendstr("xyzzy", "XYZZY")); - EXPECT_EQ(nullptr, ares_striendstr("xyxzy", "XYZZY")); - EXPECT_NE(nullptr, ares_striendstr("", "")); - const char *str = "plugh"; - EXPECT_NE(nullptr, ares_striendstr(str, str)); -} - -TEST_F(DefaultChannelTest, SingleDomain) { - TempFile aliases("www www.google.com\n"); - EnvValue with_env("HOSTALIASES", aliases.filename()); - - SetAllocSizeFail(128); - char *ptr = nullptr; - EXPECT_EQ(ARES_ENOMEM, ares__single_domain(channel_, "www", &ptr)); - - channel_->flags |= ARES_FLAG_NOSEARCH|ARES_FLAG_NOALIASES; - EXPECT_EQ(ARES_SUCCESS, ares__single_domain(channel_, "www", &ptr)); - EXPECT_EQ("www", std::string(ptr)); - ares_free(ptr); - ptr = nullptr; - - SetAllocFail(1); - EXPECT_EQ(ARES_ENOMEM, ares__single_domain(channel_, "www", &ptr)); - EXPECT_EQ(nullptr, ptr); -} -#endif - TEST_F(DefaultChannelTest, SaveInvalidChannel) { ares__slist_t *saved = channel_->servers; channel_->servers = NULL; diff --git a/test/ares-test.h b/test/ares-test.h index 79affd79..ffcf029f 100644 --- a/test/ares-test.h +++ b/test/ares-test.h @@ -20,7 +20,9 @@ #define ARES_TEST_H #include "ares_setup.h" -#include "ares.h" +#ifdef HAVE_CONFIG_H +#include "ares_config.h" +#endif #include "dns-proto.h" // Include ares internal file for DNS protocol constants @@ -29,9 +31,6 @@ #include "gtest/gtest.h" #include "gmock/gmock.h" -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif #if defined(HAVE_USER_NAMESPACE) && defined(HAVE_UTS_NAMESPACE) # define HAVE_CONTAINER #endif diff --git a/test/buildconf b/test/buildconf deleted file mode 100755 index 91109ca1..00000000 --- a/test/buildconf +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh -# Copyright (C) The c-ares project and its contributors -# SPDX-License-Identifier: MIT -autoreconf -iv diff --git a/test/configure.ac b/test/configure.ac deleted file mode 100644 index 39c0b105..00000000 --- a/test/configure.ac +++ /dev/null @@ -1,56 +0,0 @@ -############################################################# -# -# Copyright (C) the Massachusetts Institute of Technology. -# Copyright (C) Daniel Stenberg -# -# Permission to use, copy, modify, and distribute this -# software and its documentation for any purpose and without -# fee is hereby granted, provided that the above copyright -# notice appear in all copies and that both that copyright -# notice and this permission notice appear in supporting -# documentation, and that the name of M.I.T. not be used in -# advertising or publicity pertaining to distribution of the -# software without specific, written prior permission. -# M.I.T. makes no representations about the suitability of -# this software for any purpose. It is provided "as is" -# without express or implied warranty. -# -# SPDX-License-Identifier: MIT -# -############################################################# -AC_PREREQ(2.69) -AC_INIT([c-ares-test],[-],[-]) -AC_CONFIG_SRCDIR([ares-test.cc]) -AC_CONFIG_MACRO_DIR([../m4]) - -AM_INIT_AUTOMAKE([no-define]) -m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) - -AX_REQUIRE_DEFINED([AX_CXX_COMPILE_STDCXX_14]) -AX_REQUIRE_DEFINED([AX_PTHREAD]) - -dnl Checks for programs. -AC_PROG_CXX -AX_CXX_COMPILE_STDCXX_14([noext],[mandatory]) -LT_INIT -AC_SUBST(LIBTOOL_DEPS) -AX_PTHREAD([ CARES_THREADS=yes ], [ CARES_THREADS=no ]) - -PKG_CHECK_MODULES([GMOCK], [gmock]) - -if test "${CARES_THREADS}" = "yes" ; then - LIBS="$PTHREAD_LIBS $LIBS" - CFLAGS="$CFLAGS $PTHREAD_CFLAGS" - CXXFLAGS="$CXXFLAGS $PTHREAD_CFLAGS" - CC="$PTHREAD_CC" - CXX="$PTHREAD_CXX" -fi - -AX_CODE_COVERAGE -AX_CHECK_USER_NAMESPACE -AX_CHECK_UTS_NAMESPACE - -AC_CHECK_HEADERS(netdb.h netinet/tcp.h) -AC_CONFIG_HEADERS([config.h]) -AC_CONFIG_FILES([Makefile]) -AC_OUTPUT