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)
pull/676/head
Brad House 11 months ago committed by GitHub
parent 87eb22ef26
commit 4f490b40df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      .reuse/dep5
  2. 19
      CMakeLists.txt
  3. 1916
      acinclude.m4
  4. 139
      appveyor.yml
  5. 4
      ci/build.sh
  6. 1236
      configure.ac
  7. 27
      include/ares.h
  8. 122
      include/ares_build.h.in
  9. 2
      libcares.pc.cmake
  10. 2
      libcares.pc.in
  11. 44
      m4/ax_append_link_flags.m4
  12. 53
      m4/ax_check_link_flag.m4
  13. 119
      m4/ax_compiler_vendor.m4
  14. 1451
      m4/cares-compilers.m4
  15. 352
      m4/cares-confopts.m4
  16. 4135
      m4/cares-functions.m4
  17. 610
      m4/cares-reentrant.m4
  18. 254
      m4/xc-am-iface.m4
  19. 97
      m4/xc-cc-check.m4
  20. 467
      m4/xc-lt-iface.m4
  21. 166
      m4/xc-translit.m4
  22. 245
      m4/xc-val-flgs.m4
  23. 669
      m4/zz40-xc-ovr.m4
  24. 10
      src/lib/CMakeLists.txt
  25. 30
      src/lib/Makefile.am
  26. 2
      src/lib/ares__iface_ips.c
  27. 6
      src/lib/ares__socket.c
  28. 38
      src/lib/ares_config.h.cmake
  29. 14
      src/lib/ares_getnameinfo.c
  30. 7
      src/lib/ares_private.h
  31. 13
      src/lib/config-win32.h
  32. 77
      src/lib/setup_once.h
  33. 4
      src/tools/Makefile.am
  34. 1
      src/tools/adig.c
  35. 1
      test/.gitignore
  36. 3
      test/CMakeLists.txt
  37. 52
      test/Makefile.am
  38. 40
      test/ares-test-internal.cc
  39. 7
      test/ares-test.h
  40. 4
      test/buildconf
  41. 56
      test/configure.ac

@ -19,11 +19,11 @@ Copyright: The c-ares project and its contributors.
License: MIT License: MIT
# Imported m4 files # Imported m4 files
Files: m4/ax_pthread.m4 Files: m4/ax_pthread.m4 m4/ax_compiler_vendor.m4
Copyright: see file Copyright: see file
License: GPL-3.0-or-later WITH Autoconf-exception-3.0 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 Copyright: see files
License: FSFAP License: FSFAP

@ -89,14 +89,6 @@ IF (CARES_SYMBOL_HIDING)
MESSAGE (FATAL_ERROR "Hiding symbols requires CMake 3.12") MESSAGE (FATAL_ERROR "Hiding symbols requires CMake 3.12")
ENDIF () ENDIF ()
CMAKE_POLICY (SET CMP0063 NEW) 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 () ENDIF ()
# Keep build organized. # Keep build organized.
@ -364,10 +356,8 @@ ENDMACRO ()
CARES_TYPE_EXISTS (socklen_t HAVE_SOCKLEN_T) CARES_TYPE_EXISTS (socklen_t HAVE_SOCKLEN_T)
CARES_TYPE_EXISTS (SOCKET HAVE_TYPE_SOCKET) 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 (ssize_t HAVE_SSIZE_T)
CARES_TYPE_EXISTS ("long long" HAVE_LONGLONG) 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 addrinfo" HAVE_STRUCT_ADDRINFO)
CARES_TYPE_EXISTS ("struct in6_addr" HAVE_STRUCT_IN6_ADDR) CARES_TYPE_EXISTS ("struct in6_addr" HAVE_STRUCT_IN6_ADDR)
CARES_TYPE_EXISTS ("struct sockaddr_in6" HAVE_STRUCT_SOCKADDR_IN6) 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) CHECK_SYMBOL_EXISTS (CLOCK_MONOTONIC "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_CLOCK_GETTIME_MONOTONIC)
ENDIF () ENDIF ()
CHECK_STRUCT_HAS_MEMBER("struct sockaddr_in6" sin6_scope_id "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID LANGUAGE C) CHECK_STRUCT_HAS_MEMBER("struct sockaddr_in6" sin6_scope_id "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_STRUCT_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_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)
CHECK_SYMBOL_EXISTS (CloseSocket "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_CLOSESOCKET_CAMEL) CHECK_SYMBOL_EXISTS (CloseSocket "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_CLOSESOCKET_CAMEL)
CHECK_SYMBOL_EXISTS (connect "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_CONNECT) 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 (freeaddrinfo "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_FREEADDRINFO)
CHECK_SYMBOL_EXISTS (getaddrinfo "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_GETADDRINFO) CHECK_SYMBOL_EXISTS (getaddrinfo "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_GETADDRINFO)
CHECK_SYMBOL_EXISTS (getenv "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_GETENV) 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 (gethostname "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_GETHOSTNAME)
CHECK_SYMBOL_EXISTS (getnameinfo "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_GETNAMEINFO) CHECK_SYMBOL_EXISTS (getnameinfo "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_GETNAMEINFO)
CHECK_SYMBOL_EXISTS (getrandom "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_GETRANDOM) CHECK_SYMBOL_EXISTS (getrandom "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_GETRANDOM)
@ -738,7 +722,6 @@ IF (CARES_INSTALL)
# pkgconfig support # pkgconfig support
IF (NOT CARES_SHARED) IF (NOT CARES_SHARED)
SET (CPPFLAG_CARES_STATICLIB "-DCARES_STATICLIB")
FOREACH (LIB ${CARES_DEPENDENT_LIBS}) FOREACH (LIB ${CARES_DEPENDENT_LIBS})
SET (CARES_PRIVATE_LIBS "${CARES_PRIVATE_LIBS} -l${LIB}") SET (CARES_PRIVATE_LIBS "${CARES_PRIVATE_LIBS} -l${LIB}")
ENDFOREACH () ENDFOREACH ()

File diff suppressed because it is too large Load Diff

@ -25,85 +25,115 @@ environment:
matrix: matrix:
# MSVC 2022, 32-bit x86 (cmake) # MSVC 2022, 32-bit x86 (cmake)
- COMPILER: MSVC - COMPILER: MSVC
BUILDTOOL: CMAKE CONFTOOL: CMAKE
TESTTYPE: CMAKE SYSTEM: CONSOLE
SKIP_TESTS: no
MSVC_SETUP_ARG: x86 MSVC_SETUP_ARG: x86
MSVC_SETUP_PATH: C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars32.bat 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 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 BUILD_GOOGLETEST: yes
# MSVC 2022, 64-bit x64 (cmake) # MSVC 2022, 64-bit x64 (cmake)
- COMPILER: MSVC - COMPILER: MSVC
BUILDTOOL: CMAKE CONFTOOL: CMAKE
TESTTYPE: CMAKE SYSTEM: CONSOLE
SKIP_TESTS: no
MSVC_SETUP_ARG: x64 MSVC_SETUP_ARG: x64
MSVC_SETUP_PATH: C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat 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 CMAKE_EXTRA_OPTIONS: -GNinja -DCARES_BUILD_TESTS=ON -DGTEST_ROOT=C:\projects\googletest -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDebugDLL
BUILD_GOOGLETEST: yes BUILD_GOOGLETEST: yes
# MinGW gcc via MSYS2 (latest version) # MinGW gcc via MSYS2 (latest version)
- COMPILER: MINGW - COMPILER: MINGW
BUILDTOOL: MSYS2 CONFTOOL: CMAKE
TESTTYPE: MSYS2 SYSTEM: MSYS2
SKIP_TESTS: no
MSYSTEM: MINGW64 MSYSTEM: MINGW64
TOOLSDIR: ./build/bin
TESTDIR: ./build/bin
CMAKE_EXTRA_OPTIONS: -GNinja CMAKE_EXTRA_OPTIONS: -GNinja
CHERE_INVOKING: YES 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 # MinGW clang UBSAN via MSYS2
- COMPILER: MINGW - COMPILER: MINGW
BUILDTOOL: MSYS2 CONFTOOL: CMAKE
TESTTYPE: MSYS2 SKIP_TESTS: no
SYSTEM: MSYS2
MSYSTEM: CLANG64 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 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 CHERE_INVOKING: YES
# MinGW clang ASAN via MSYS2 -- doesn't work due to some issue with clang itself # MinGW clang ASAN via MSYS2 -- doesn't work due to some issue with clang itself
#- COMPILER: MINGW # - COMPILER: MINGW
# BUILDTOOL: MSYS2 # CONFTOOL: CMAKE
# TESTTYPE: MSYS2 # SKIP_TESTS: no
# MSYSTEM: CLANG64 # SYSTEM: MSYS2
# 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 # MSYSTEM: CLANG64
# CHERE_INVOKING: YES # 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) # MSVC 2022, 64-bit x86 (nmake)
- COMPILER: MSVC - COMPILER: MSVC
BUILDTOOL: NMAKE CONFTOOL: NMAKE
TESTTYPE: NMAKE SYSTEM: CONSOLE
SKIP_TESTS: no
MSVC_SETUP_ARG: x64 MSVC_SETUP_ARG: x64
MSVC_SETUP_PATH: C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat MSVC_SETUP_PATH: C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat
BUILD_GOOGLETEST: yes BUILD_GOOGLETEST: yes
# MSVC 2022, 32-bit x86 (nmake) # MSVC 2022, 32-bit x86 (nmake)
- COMPILER: MSVC - COMPILER: MSVC
BUILDTOOL: NMAKE CONFTOOL: NMAKE
TESTTYPE: NMAKE SYSTEM: CONSOLE
SKIP_TESTS: no
MSVC_SETUP_ARG: x86 MSVC_SETUP_ARG: x86
MSVC_SETUP_PATH: C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars32.bat MSVC_SETUP_PATH: C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars32.bat
BUILD_GOOGLETEST: yes BUILD_GOOGLETEST: yes
# MinGW, 32-bit x86 (makefiles) # MinGW, 32-bit x86 (makefiles)
- COMPILER: MINGW - COMPILER: MINGW
BUILDTOOL: MAKE CONFTOOL: MAKE
TESTTYPE: MAKE SYSTEM: CONSOLE
SKIP_TESTS: no
PATH: C:\mingw-w64\i686-8.1.0-posix-dwarf-rt_v6-rev0\mingw32\bin;%PATH% PATH: C:\mingw-w64\i686-8.1.0-posix-dwarf-rt_v6-rev0\mingw32\bin;%PATH%
BUILD_GOOGLETEST: yes BUILD_GOOGLETEST: yes
# MinGW, 32-bit x86 (cmake static only) # MinGW, 32-bit x86 (cmake static only)
- COMPILER: MINGW - COMPILER: MINGW
BUILDTOOL: CMAKE CONFTOOL: CMAKE
TESTTYPE: 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% 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 CMAKE_EXTRA_OPTIONS: -DCARES_SHARED=OFF -GNinja -DCARES_BUILD_TESTS=ON -DGTEST_ROOT=C:\projects\googletest
BUILD_GOOGLETEST: yes BUILD_GOOGLETEST: yes
# MSVC 2022, UWP (cmake) # MSVC 2022, UWP (cmake)
- COMPILER: MSVC - COMPILER: MSVC
BUILDTOOL: CMAKE CONFTOOL: CMAKE
TESTTYPE: NONE SYSTEM: CONSOLE
SKIP_TESTS: yes
MSVC_SETUP_ARG: x64 store MSVC_SETUP_ARG: x64 store
MSVC_SETUP_PATH: C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvarsall.bat 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 CMAKE_EXTRA_OPTIONS: -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0 -A x64
TESTDIRSUFFIX: Release\
install: install:
- if "%COMPILER%" == "MINGW" rename "C:\Program Files\Git\usr\bin\sh.exe" "sh2.exe" - 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). # Setup build environment for the selected compiler (not all compilers need to do anything here).
# -- Visual Studio -- # -- Visual Studio --
- if "%COMPILER%" == "MSVC" call "%MSVC_SETUP_PATH%" %MSVC_SETUP_ARG% - if "%COMPILER%" == "MSVC" call "%MSVC_SETUP_PATH%" %MSVC_SETUP_ARG%
- if "%BUILDTOOL%" == "MSYS2" C:\msys64\usr\bin\bash -lc "pacman --noconfirm -Syuu" - if "%SYSTEM%" == "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 "%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 "%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" 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" git clone --depth=1 https://github.com/google/googletest googletest
- if "%BUILD_GOOGLETEST%" == "yes" cd 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 - 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 .. - if "%BUILD_GOOGLETEST%" == "yes" cd ..
build_script: 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 "%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 "%BUILDTOOL%" == "MSYS2" C:\msys64\usr\bin\bash -lc "%ANALYZE_PREFIX% ninja -v install" - if "%SYSTEM%" == "MSYS2" if "%CONFTOOL%" == "CMAKE" C:\msys64\usr\bin\bash -lc "%ANALYZE_PREFIX% cmake --build build"
- if "%BUILDTOOL%" == "NMAKE" copy .\include\ares_build.h.dist .\include\ares_build.h - if "%SYSTEM%" == "MSYS2" if "%CONFTOOL%" == "AUTOTOOLS" C:\msys64\usr\bin\bash -lc "./buildconf"
- if "%BUILDTOOL%" == "NMAKE" nmake /NOLOGO /f .\Makefile.msvc - if "%SYSTEM%" == "MSYS2" if "%CONFTOOL%" == "AUTOTOOLS" C:\msys64\usr\bin\bash -lc "%ANALYZE_PREFIX% ./configure --enable-static --disable-shared --enable-tests"
- 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 "%SYSTEM%" == "MSYS2" if "%CONFTOOL%" == "AUTOTOOLS" C:\msys64\usr\bin\bash -lc "%ANALYZE_PREFIX% make"
- if "%BUILDTOOL%" == "CMAKE" cmake --build build --config Debug - if "%SYSTEM%" == "CONSOLE" if "%CONFTOOL%" == "NMAKE" copy .\include\ares_build.h.dist .\include\ares_build.h
- if "%BUILDTOOL%" == "CMAKE" cmake --install build --config Debug - if "%SYSTEM%" == "CONSOLE" if "%CONFTOOL%" == "NMAKE" nmake /NOLOGO /f .\Makefile.msvc
- if "%BUILDTOOL%" == "MAKE" copy .\include\ares_build.h.dist .\include\ares_build.h - 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 "%BUILDTOOL%" == "MAKE" mingw32-make.exe -f Makefile.m32 demos - 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: test_script:
# We can't use powershell for tests due to treating stderr as an error # 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 "%SYSTEM%" == "MSYS2" if not "%SKIP_TESTS%" == "yes" C:\msys64\usr\bin\bash -lc "%TOOLSDIR%/adig.exe www.google.com"
- if "%TESTTYPE%" == "MSYS2" C:\msys64\usr\bin\bash -lc "./bin/ahost.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 "%TESTTYPE%" == "MSYS2" C:\msys64\usr\bin\bash -lc "./bin/arestest.exe -4 -v --gtest_filter=-*LiveSearchTXT*:*LiveSearchANY*:*LiveGetLocalhostByAddr*" - 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 "%TESTTYPE%" == "NMAKE" cd test - if "%SYSTEM%" == "CONSOLE" if "%CONFTOOL%" == "NMAKE" if not "%SKIP_TESTS%" == "yes" cd test
- if "%TESTTYPE%" == "NMAKE" 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 vtest
- if "%TESTTYPE%" == "NMAKE" nmake GTEST_ROOT=C:\projects\googletest /NOLOGO /f .\Makefile.msvc aresfuzz aresfuzzname dnsdump - 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 "%TESTTYPE%" == "NMAKE" .\msvc\arestest\lib-debug\dnsdump.exe fuzzinput\answer_a fuzzinput\answer_aaaa - if "%SYSTEM%" == "CONSOLE" if "%CONFTOOL%" == "NMAKE" if not "%SKIP_TESTS%" == "yes" .\msvc\arestest\lib-debug\dnsdump.exe fuzzinput\answer_a fuzzinput\answer_aaaa
- if "%TESTTYPE%" == "MAKE" cd test - if "%SYSTEM%" == "CONSOLE" if "%CONFTOOL%" == "MAKE" if not "%SKIP_TESTS%" == "yes" cd test
- if "%TESTTYPE%" == "MAKE" 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 vtest
- if "%TESTTYPE%" == "MAKE" 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" 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 "%SYSTEM%" == "CONSOLE" if "%CONFTOOL%" == "MAKE" if not "%SKIP_TESTS%" == "yes" .\dnsdump.exe fuzzinput\answer_a fuzzinput\answer_aaaa
- if "%TESTTYPE%" == "CMAKE" cd build\bin\%TESTDIRSUFFIX% - if "%SYSTEM%" == "CONSOLE" if "%CONFTOOL%" == "CMAKE" if not "%SKIP_TESTS%" == "yes" cd %TESTDIR%
- if "%TESTTYPE%" == "CMAKE" .\adig.exe www.google.com - if "%SYSTEM%" == "CONSOLE" if "%CONFTOOL%" == "CMAKE" if not "%SKIP_TESTS%" == "yes" .\adig.exe www.google.com
- if "%TESTTYPE%" == "CMAKE" .\ahost.exe www.google.com - if "%SYSTEM%" == "CONSOLE" if "%CONFTOOL%" == "CMAKE" if not "%SKIP_TESTS%" == "yes" .\ahost.exe www.google.com
- if "%TESTTYPE%" == "CMAKE" .\arestest.exe -4 -v --gtest_filter=-*LiveSearchTXT*:*LiveSearchANY*:*LiveGetLocalhostByAddr* - if "%SYSTEM%" == "CONSOLE" if "%CONFTOOL%" == "CMAKE" if not "%SKIP_TESTS%" == "yes" .\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%" == "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: #on_finish:
# - cd C:\projects\build-cares\test # - cd C:\projects\build-cares\test

@ -24,7 +24,9 @@ if [ "$BUILD_TYPE" = "autotools" -o "$BUILD_TYPE" = "coverage" ]; then
export CXXFLAGS="${CXXFLAGS} -isysroot ${SYSROOT}" export CXXFLAGS="${CXXFLAGS} -isysroot ${SYSROOT}"
export LDFLAGS="${LDFLAGS} -isysroot ${SYSROOT}" export LDFLAGS="${LDFLAGS} -isysroot ${SYSROOT}"
fi 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 $SCAN_WRAP make
else else
# Use cmake for everything else # Use cmake for everything else

File diff suppressed because it is too large Load Diff

@ -97,21 +97,28 @@ extern "C" {
** c-ares external API function linkage decorations. ** c-ares external API function linkage decorations.
*/ */
#ifdef CARES_STATICLIB #if defined(_WIN32) || defined(__CYGWIN__) || defined(__SYMBIAN32__)
# define CARES_EXTERN # ifdef CARES_STATICLIB
#elif defined(WIN32) || defined(_WIN32) || defined(__SYMBIAN32__) # define CARES_EXTERN
# if defined(CARES_BUILDING_LIBRARY)
# define CARES_EXTERN __declspec(dllexport)
# else # else
# define CARES_EXTERN __declspec(dllimport) # ifdef CARES_BUILDING_LIBRARY
# define CARES_EXTERN __declspec(dllexport)
# else
# define CARES_EXTERN __declspec(dllimport)
# endif
# endif # endif
#elif defined(CARES_BUILDING_LIBRARY) && defined(CARES_SYMBOL_HIDING)
# define CARES_EXTERN CARES_SYMBOL_SCOPE_EXTERN
#else #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 #endif
typedef enum { typedef enum {
ARES_SUCCESS = 0, ARES_SUCCESS = 0,

@ -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 #ifndef __CARES_BUILD_H
#define __CARES_BUILD_H #define __CARES_BUILD_H
/* ================================================================ */
/* NOTES FOR CONFIGURE CAPABLE SYSTEMS */
/* ================================================================ */
/* /*
* NOTE 1: * Copyright (C) The c-ares project and its contributors
* ------- * SPDX-License-Identifier: MIT
*
* 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.
*
*/ */
/* ================================================================ */ #define CARES_TYPEOF_ARES_SOCKLEN_T @CARES_TYPEOF_ARES_SOCKLEN_T@
/* DEFINITION OF THESE SYMBOLS SHALL NOT TAKE PLACE ANYWHERE ELSE */ #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 #ifdef CARES_HAVE_SYS_TYPES_H
# error "CARES_TYPEOF_ARES_SOCKLEN_T shall not be defined except in ares_build.h" # include <sys/types.h>
Error Compilation_aborted_CARES_TYPEOF_ARES_SOCKLEN_T_already_defined
#endif #endif
#undef CARES_HAVE_ARPA_NAMESER_H #ifdef CARES_HAVE_SYS_RANDOM_H
#undef CARES_HAVE_ARPA_NAMESER_COMPAT_H # include <sys/random.h>
#endif
/* ================================================================ */ #ifdef CARES_HAVE_SYS_SOCKET_H
/* EXTERNAL INTERFACE SETTINGS FOR CONFIGURE CAPABLE SYSTEMS ONLY */ # include <sys/socket.h>
/* ================================================================ */ #endif
/* Configure process defines this to 1 when it finds out that system */ #ifdef CARES_HAVE_WINSOCK2_H
/* 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 <windows.h>
# include <winsock2.h> # include <winsock2.h>
# include <ws2tcpip.h>
#endif #endif
/* Configure process defines this to 1 when it finds out that system */ #ifdef CARES_HAVE_WS2TCPIP_H
/* header file sys/types.h must be included by the external interface. */ # include <ws2tcpip.h>
#undef CARES_PULL_SYS_TYPES_H
#ifdef CARES_PULL_SYS_TYPES_H
# include <sys/types.h>
#endif #endif
/* Configure process defines this to 1 when it finds out that system */ #ifdef CARES_HAVE_WINDOWS_H
/* header file sys/socket.h must be included by the external interface. */ # include <windows.h>
#undef CARES_PULL_SYS_SOCKET_H
#ifdef CARES_PULL_SYS_SOCKET_H
# include <sys/socket.h>
#endif #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; 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; typedef CARES_TYPEOF_ARES_SSIZE_T ares_ssize_t;
#endif /* __CARES_BUILD_H */ #endif /* __CARES_BUILD_H */

@ -17,6 +17,6 @@ Description: asynchronous DNS lookup library
Version: @CARES_VERSION@ Version: @CARES_VERSION@
Requires: Requires:
Requires.private: Requires.private:
Cflags: -I${includedir} @CPPFLAG_CARES_STATICLIB@ Cflags: -I${includedir}
Libs: -L${libdir} -lcares Libs: -L${libdir} -lcares
Libs.private: @CARES_PRIVATE_LIBS@ Libs.private: @CARES_PRIVATE_LIBS@

@ -17,6 +17,6 @@ Description: asynchronous DNS lookup library
Version: @VERSION@ Version: @VERSION@
Requires: Requires:
Requires.private: Requires.private:
Cflags: -I${includedir} @CPPFLAG_CARES_STATICLIB@ Cflags: -I${includedir}
Libs: -L${libdir} -lcares Libs: -L${libdir} -lcares
Libs.private: @CARES_PRIVATE_LIBS@ Libs.private: @CARES_PRIVATE_LIBS@

@ -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 <mkbosmans@gmail.com>
#
# 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

@ -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 <guidod@gmx.de>
# Copyright (c) 2011 Maarten Bosmans <mkbosmans@gmail.com>
#
# 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

@ -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 <stevenj@alum.mit.edu>
# Copyright (c) 2008 Matteo Frigo
# Copyright (c) 2018-19 John Zaitseff <J.Zaitseff@zap.org.au>
#
# 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 <https://www.gnu.org/licenses/>.
#
# 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

File diff suppressed because it is too large Load Diff

@ -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
])

File diff suppressed because it is too large Load Diff

@ -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 <errno.h>
]],[[
if(0 != errno)
return 1;
]])
],[
tmp_errno="yes"
],[
tmp_errno="no"
])
if test "$tmp_errno" = "yes"; then
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[
#include <errno.h>
]],[[
#ifdef errno
int dummy=1;
#else
force compilation error
#endif
]])
],[
tmp_errno="errno_macro_defined"
],[
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[
#define _REENTRANT
#include <errno.h>
]],[[
#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 <sys/types.h>
#include <time.h>
],[
tmp_gmtime_r="proto_declared"
],[
AC_EGREP_CPP([gmtime_r],[
#define _REENTRANT
#include <sys/types.h>
#include <time.h>
],[
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 <sys/types.h>
#include <time.h>
],[
tmp_localtime_r="proto_declared"
],[
AC_EGREP_CPP([localtime_r],[
#define _REENTRANT
#include <sys/types.h>
#include <time.h>
],[
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 <sys/types.h>
#include <string.h>
],[
tmp_strerror_r="proto_declared"
],[
AC_EGREP_CPP([strerror_r],[
#define _REENTRANT
#include <sys/types.h>
#include <string.h>
],[
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 <sys/types.h>
#include <string.h>
],[
tmp_strtok_r="proto_declared"
],[
AC_EGREP_CPP([strtok_r],[
#define _REENTRANT
#include <sys/types.h>
#include <string.h>
],[
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 <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
],[
tmp_inet_ntoa_r="proto_declared"
],[
AC_EGREP_CPP([inet_ntoa_r],[
#define _REENTRANT
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
],[
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 <sys/types.h>
#include <netdb.h>
],[
tmp_gethostbyaddr_r="proto_declared"
],[
AC_EGREP_CPP([gethostbyaddr_r],[
#define _REENTRANT
#include <sys/types.h>
#include <netdb.h>
],[
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 <sys/types.h>
#include <netdb.h>
],[
tmp_gethostbyname_r="proto_declared"
],[
AC_EGREP_CPP([gethostbyname_r],[
#define _REENTRANT
#include <sys/types.h>
#include <netdb.h>
],[
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 <sys/types.h>
#include <netdb.h>
],[
tmp_getprotobyname_r="proto_declared"
],[
AC_EGREP_CPP([getprotobyname_r],[
#define _REENTRANT
#include <sys/types.h>
#include <netdb.h>
],[
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 <sys/types.h>
#include <netdb.h>
],[
tmp_getservbyport_r="proto_declared"
],[
AC_EGREP_CPP([getservbyport_r],[
#define _REENTRANT
#include <sys/types.h>
#include <netdb.h>
],[
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
#
])

@ -1,254 +0,0 @@
#---------------------------------------------------------------------------
#
# xc-am-iface.m4
#
# Copyright (c) Daniel Stenberg <daniel@haxx.se>
#
# 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
])

@ -1,97 +0,0 @@
#---------------------------------------------------------------------------
#
# xc-cc-check.m4
#
# Copyright (c) Daniel Stenberg <daniel@haxx.se>
#
# 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
])

@ -1,467 +0,0 @@
#---------------------------------------------------------------------------
#
# xc-lt-iface.m4
#
# Copyright (c) Daniel Stenberg <daniel@haxx.se>
#
# 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
])

@ -1,166 +0,0 @@
#---------------------------------------------------------------------------
#
# xc-translit.m4
#
# Copyright (c) Daniel Stenberg <daniel@haxx.se>
#
# 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]))])

@ -1,245 +0,0 @@
#---------------------------------------------------------------------------
#
# xc-val-flgs.m4
#
# Copyright (c) Daniel Stenberg <daniel@haxx.se>
#
# 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
])

@ -1,669 +0,0 @@
#---------------------------------------------------------------------------
#
# zz40-xc-ovr.m4
#
# Copyright (c) Daniel Stenberg <daniel@haxx.se>
#
# 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
])

@ -104,10 +104,12 @@ IF (CARES_STATIC)
PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}" PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}"
) )
TARGET_COMPILE_DEFINITIONS (${LIBNAME} TARGET_COMPILE_DEFINITIONS (${LIBNAME} PRIVATE HAVE_CONFIG_H=1 CARES_BUILDING_LIBRARY)
PUBLIC CARES_STATICLIB
PRIVATE HAVE_CONFIG_H=1 # Only matters on Windows
) IF (WIN32 OR CYGWIN)
TARGET_COMPILE_DEFINITIONS (${LIBNAME} PUBLIC CARES_STATICLIB)
ENDIF()
TARGET_LINK_LIBRARIES (${LIBNAME} PUBLIC ${CARES_DEPENDENT_LIBS}) TARGET_LINK_LIBRARIES (${LIBNAME} PUBLIC ${CARES_DEPENDENT_LIBS})
IF (CARES_INSTALL) IF (CARES_INSTALL)

@ -27,37 +27,17 @@ DISTCLEANFILES = ares_config.h
DIST_SUBDIRS = DIST_SUBDIRS =
AM_LDFLAGS = libcares_la_LDFLAGS = -version-info @CARES_VERSION_INFO@
if CARES_USE_NO_UNDEFINED
libcares_la_LDFLAGS_EXTRA = libcares_la_LDFLAGS += -no-undefined
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)
endif endif
libcares_la_CFLAGS_EXTRA = libcares_la_CFLAGS_EXTRA =
libcares_la_CPPFLAGS_EXTRA = -DCARES_BUILDING_LIBRARY libcares_la_CPPFLAGS_EXTRA = -DCARES_BUILDING_LIBRARY
if DOING_CARES_SYMBOL_HIDING if CARES_SYMBOL_HIDING
libcares_la_CFLAGS_EXTRA += $(CFLAG_CARES_SYMBOL_HIDING) libcares_la_CFLAGS_EXTRA += @CARES_SYMBOL_HIDING_CFLAG@
libcares_la_CPPFLAGS_EXTRA += -DCARES_SYMBOL_HIDING libcares_la_CPPFLAGS_EXTRA += -DCARES_SYMBOL_HIDING
endif endif

@ -481,7 +481,7 @@ static ares_status_t ares__iface_ips_enumerate(ares__iface_ips_t *ips,
/* netmask */ /* netmask */
sockaddr_in6 = (struct sockaddr_in6 *)((void *)ifa->ifa_netmask); sockaddr_in6 = (struct sockaddr_in6 *)((void *)ifa->ifa_netmask);
netmask = count_addr_bits((const void *)&sockaddr_in6->sin6_addr, 16); 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; ll_scope = sockaddr_in6->sin6_scope_id;
# endif # endif
} else { } else {

@ -106,7 +106,7 @@ static int setsocknonblock(ares_socket_t sockfd, /* operate on this */
/* most recent unix versions */ /* most recent unix versions */
int flags; int flags;
flags = fcntl(sockfd, F_GETFL, 0); flags = fcntl(sockfd, F_GETFL, 0);
if (FALSE != nonblock) { if (nonblock) {
return fcntl(sockfd, F_SETFL, flags | O_NONBLOCK); return fcntl(sockfd, F_SETFL, flags | O_NONBLOCK);
} else { } else {
return fcntl(sockfd, F_SETFL, flags & (~O_NONBLOCK)); /* LCOV_EXCL_LINE */ 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; return 0;
} }
(void)setsocknonblock(s, TRUE); (void)setsocknonblock(s, 1);
#if defined(FD_CLOEXEC) && !defined(MSDOS) #if defined(FD_CLOEXEC) && !defined(MSDOS)
/* Configure the socket fd as close-on-exec. */ /* 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); saddr.sa6.sin6_port = htons(is_tcp ? server->tcp_port : server->udp_port);
memcpy(&saddr.sa6.sin6_addr, &server->addr.addr.addr6, memcpy(&saddr.sa6.sin6_addr, &server->addr.addr.addr6,
sizeof(saddr.sa6.sin6_addr)); 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; saddr.sa6.sin6_scope_id = server->ll_scope;
#endif #endif
break; break;

@ -7,21 +7,9 @@
/* Define if building universal (internal helper macro) */ /* Define if building universal (internal helper macro) */
#undef AC_APPLE_UNIVERSAL_BUILD #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. */ /* Defined for build with symbol hiding. */
#cmakedefine CARES_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 */ /* Use resolver library to configure cares */
#cmakedefine CARES_USE_LIBRESOLV #cmakedefine CARES_USE_LIBRESOLV
@ -67,12 +55,6 @@
/* Define to 1 if you have the <assert.h> header file. */ /* Define to 1 if you have the <assert.h> header file. */
#cmakedefine HAVE_ASSERT_H #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. */ /* Define to 1 if you have the clock_gettime function and monotonic timer. */
#cmakedefine HAVE_CLOCK_GETTIME_MONOTONIC #cmakedefine HAVE_CLOCK_GETTIME_MONOTONIC
@ -115,12 +97,6 @@
/* Define to 1 if you have the getenv function. */ /* Define to 1 if you have the getenv function. */
#cmakedefine HAVE_GETENV #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. */ /* Define to 1 if you have the gethostname function. */
#cmakedefine HAVE_GETHOSTNAME #cmakedefine HAVE_GETHOSTNAME
@ -197,9 +173,6 @@
/* Define to 1 if you have the <limits.h> header file. */ /* Define to 1 if you have the <limits.h> header file. */
#cmakedefine HAVE_LIMITS_H #cmakedefine HAVE_LIMITS_H
/* if your compiler supports LL */
#cmakedefine HAVE_LL
/* Define to 1 if the compiler supports the 'long long' data type. */ /* Define to 1 if the compiler supports the 'long long' data type. */
#cmakedefine HAVE_LONGLONG #cmakedefine HAVE_LONGLONG
@ -245,14 +218,8 @@
/* Define to 1 if you have the <signal.h> header file. */ /* Define to 1 if you have the <signal.h> header file. */
#cmakedefine HAVE_SIGNAL_H #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. */ /* 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. */ /* Define to 1 if you have the socket function. */
#cmakedefine HAVE_SOCKET #cmakedefine HAVE_SOCKET
@ -458,9 +425,6 @@
/* Define to avoid automatic inclusion of winsock.h */ /* Define to avoid automatic inclusion of winsock.h */
#undef WIN32_LEAN_AND_MEAN #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. */ /* Define to 1 if you have the pthread.h header file. */
#cmakedefine HAVE_PTHREAD_H #cmakedefine HAVE_PTHREAD_H

@ -69,7 +69,7 @@ struct nameinfo_query {
size_t timeouts; size_t timeouts;
}; };
#ifdef HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID #ifdef HAVE_STRUCT_SOCKADDR_IN6_SIN6_SCOPE_ID
# define IPBUFSIZ \ # define IPBUFSIZ \
(sizeof("ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255") + IF_NAMESIZE) (sizeof("ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255") + IF_NAMESIZE)
#else #else
@ -80,11 +80,11 @@ static void nameinfo_callback(void *arg, int status, int timeouts,
struct hostent *host); struct hostent *host);
static char *lookup_service(unsigned short port, unsigned int flags, char *buf, static char *lookup_service(unsigned short port, unsigned int flags, char *buf,
size_t buflen); 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, static void append_scopeid(const struct sockaddr_in6 *addr6,
unsigned int scopeid, char *buf, size_t buflen); unsigned int scopeid, char *buf, size_t buflen);
#endif #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, static void ares_getnameinfo_int(ares_channel_t *channel,
const struct sockaddr *sa, const struct sockaddr *sa,
@ -145,7 +145,7 @@ static void ares_getnameinfo_int(ares_channel_t *channel,
if (salen == sizeof(struct sockaddr_in6)) { if (salen == sizeof(struct sockaddr_in6)) {
ares_inet_ntop(AF_INET6, &addr6->sin6_addr, ipbuf, IPBUFSIZ); ares_inet_ntop(AF_INET6, &addr6->sin6_addr, ipbuf, IPBUFSIZ);
/* If the system supports scope IDs, use it */ /* 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)); append_scopeid(addr6, flags, ipbuf, sizeof(ipbuf));
#endif #endif
} else { } 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); ares_inet_ntop(AF_INET, &niquery->addr.addr4.sin_addr, ipbuf, IPBUFSIZ);
} else { } else {
ares_inet_ntop(AF_INET6, &niquery->addr.addr6.sin6_addr, ipbuf, IPBUFSIZ); 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, append_scopeid(&niquery->addr.addr6, niquery->flags, ipbuf,
sizeof(ipbuf)); sizeof(ipbuf));
#endif #endif
@ -346,7 +346,7 @@ static char *lookup_service(unsigned short port, unsigned int flags, char *buf,
return NULL; 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, static void append_scopeid(const struct sockaddr_in6 *addr6, unsigned int flags,
char *buf, size_t buflen) char *buf, size_t buflen)
{ {
@ -387,7 +387,7 @@ static void append_scopeid(const struct sockaddr_in6 *addr6, unsigned int flags,
#endif #endif
/* Determines if s1 ends with the string in s2 (case-insensitive) */ /* 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 *c1;
const char *c2; const char *c2;

@ -50,13 +50,6 @@
# define INADDR_NONE 0xffffffff # define INADDR_NONE 0xffffffff
#endif #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 /* 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 *' * warning: cast from 'const struct sockaddr *' to 'const struct sockaddr_in6 *'
* increases required alignment from 1 to 4 [-Wcast-align] * increases required alignment from 1 to 4 [-Wcast-align]

@ -105,9 +105,6 @@
/* OTHER HEADER INFO */ /* 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 if you have the ANSI C header files. */
#define STDC_HEADERS 1 #define STDC_HEADERS 1
@ -234,14 +231,6 @@
/* TYPEDEF REPLACEMENTS */ /* 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 */ /* TYPE SIZES */
/* ---------------------------------------------------------------- */ /* ---------------------------------------------------------------- */
@ -354,7 +343,7 @@
/* Define if you have sockaddr_in6 with scopeid. */ /* Define if you have sockaddr_in6 with scopeid. */
#ifdef HAVE_WS2TCPIP_H #ifdef HAVE_WS2TCPIP_H
# define HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID 1 # define HAVE_STRUCT_SOCKADDR_IN6_SIN6_SCOPE_ID 1
#endif #endif
#if defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0600) && !defined(__WATCOMC__) #if defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0600) && !defined(__WATCOMC__)

@ -80,10 +80,6 @@
# include <fcntl.h> # include <fcntl.h>
#endif #endif
#if defined(HAVE_STDBOOL_H) && defined(HAVE_BOOL_T)
# include <stdbool.h>
#endif
#ifdef HAVE_UNISTD_H #ifdef HAVE_UNISTD_H
# include <unistd.h> # include <unistd.h>
#endif #endif
@ -290,58 +286,6 @@ Error Missing_definition_of_macro_sread
#define TOLOWER(x) (tolower((int)((unsigned char)x))) #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 <stdbool.h>, 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, * Macro WHILE_FALSE may be used to build single-iteration do-while loops,
* avoiding compiler warnings. Mostly intended for other macro definitions. * avoiding compiler warnings. Mostly intended for other macro definitions.
@ -361,27 +305,6 @@ typedef enum {
#endif #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. * Macro used to include code only in debug builds.
*/ */

@ -17,10 +17,6 @@ AM_CPPFLAGS = -I$(top_builddir)/include \
-I$(top_srcdir)/include \ -I$(top_srcdir)/include \
-I$(top_srcdir)/src/lib -I$(top_srcdir)/src/lib
if USE_CPPFLAG_CARES_STATICLIB
AM_CPPFLAGS += $(CPPFLAG_CARES_STATICLIB)
endif
include Makefile.inc include Makefile.inc
# We're not interested in code coverage of the test apps themselves, but need # We're not interested in code coverage of the test apps themselves, but need

@ -46,7 +46,6 @@
#include "ares_dns.h" #include "ares_dns.h"
#ifndef HAVE_STRDUP #ifndef HAVE_STRDUP
# include "ares_strdup.h"
# define strdup(ptr) ares_strdup(ptr) # define strdup(ptr) ares_strdup(ptr)
#endif #endif

1
test/.gitignore vendored

@ -11,7 +11,6 @@ fuzzcheck.sh.trs
test-suite.log test-suite.log
fuzzoutput fuzzoutput
config.h.in config.h.in
config.h
dnsdump dnsdump
ares-libfuzzer ares-libfuzzer
ares-libfuzzer-name ares-libfuzzer-name

@ -15,6 +15,7 @@ target_compile_definitions(caresinternal INTERFACE HAVE_CONFIG_H=1)
target_include_directories(caresinternal target_include_directories(caresinternal
INTERFACE "${PROJECT_BINARY_DIR}" INTERFACE "${PROJECT_BINARY_DIR}"
"${PROJECT_BINARY_DIR}/src/lib"
"${PROJECT_SOURCE_DIR}" "${PROJECT_SOURCE_DIR}"
"${PROJECT_SOURCE_DIR}/src/lib" "${PROJECT_SOURCE_DIR}/src/lib"
"${CARES_TOPLEVEL_DIR}/include" "${CARES_TOPLEVEL_DIR}/include"
@ -30,8 +31,6 @@ ENDIF ()
transform_makefile_inc("Makefile.inc" "${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake") transform_makefile_inc("Makefile.inc" "${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake")
include(${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}) add_executable(arestest ${TESTSOURCES} ${TESTHEADERS})
target_include_directories(arestest PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) target_include_directories(arestest PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
target_link_libraries(arestest PRIVATE caresinternal GTest::gmock) target_link_libraries(arestest PRIVATE caresinternal GTest::gmock)

52
test/Makefile.am vendored

@ -1,36 +1,16 @@
############################################################# # Copyright (C) The c-ares project and its contributors
#
# 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 # SPDX-License-Identifier: MIT
#
#############################################################
ARES_BLD_DIR = $(top_builddir)/..
ARES_SRC_DIR = $(top_srcdir)/..
AUTOMAKE_OPTIONS = foreign subdir-objects nostdinc 1.9.6 AUTOMAKE_OPTIONS = foreign subdir-objects nostdinc 1.9.6
ACLOCAL_AMFLAGS = -I ../m4 --install
CPPFLAGS += -I$(ARES_BLD_DIR)/include \ AM_CPPFLAGS = -I$(top_builddir)/include \
-I$(ARES_BLD_DIR)/src/lib \ -I$(top_builddir)/src/lib \
-I$(ARES_SRC_DIR)/include \ -I$(top_srcdir)/include \
-I$(ARES_SRC_DIR)/src/lib \ -I$(top_srcdir)/src/lib \
-I$(top_builddir) -I$(top_srcdir)/test \
CXXFLAGS += -Wall $(PTHREAD_CFLAGS) -I$(top_builddir)/test \
-I$(top_builddir)
AM_CXXFLAGS = $(PTHREAD_CFLAGS)
AM_CFLAGS = $(PTHREAD_CFLAGS)
# Makefile.inc provides the various *SOURCES and *HEADERS defines # Makefile.inc provides the various *SOURCES and *HEADERS defines
include Makefile.inc include Makefile.inc
@ -38,22 +18,20 @@ include Makefile.inc
TESTS = arestest fuzzcheck.sh TESTS = arestest fuzzcheck.sh
noinst_PROGRAMS = arestest aresfuzz aresfuzzname dnsdump 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) arestest_SOURCES = $(TESTSOURCES) $(TESTHEADERS)
# Not interested in coverage of test code, but linking the test binary needs the coverage option # Not interested in coverage of test code, but linking the test binary needs the coverage option
arestest_CXXFLAGS = $(GMOCK_CFLAGS) arestest_CXXFLAGS = $(GMOCK_CFLAGS)
arestest_LDADD = $(GMOCK_LIBS) $(ARES_BLD_DIR)/src/lib/libcares.la $(PTHREAD_LIBS) $(CODE_COVERAGE_LIBS) arestest_LDADD = $(GMOCK_LIBS) $(top_builddir)/src/lib/libcares.la $(PTHREAD_LIBS) $(CODE_COVERAGE_LIBS)
include $(top_srcdir)/aminclude_static.am
aresfuzz_SOURCES = $(FUZZSOURCES) 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_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_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 test: check

@ -32,7 +32,9 @@
#include <unistd.h> #include <unistd.h>
#endif #endif
#include <fcntl.h> #include <fcntl.h>
#ifdef HAVE_SYS_IOCTL_H
# include <sys/ioctl.h>
#endif
extern "C" { extern "C" {
// Remove command-line defines of package variables for the test project... // Remove command-line defines of package variables for the test project...
#undef PACKAGE_NAME #undef PACKAGE_NAME
@ -919,42 +921,6 @@ TEST_F(LibraryTest, SlistMisuse) {
} }
#endif #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) { TEST_F(DefaultChannelTest, SaveInvalidChannel) {
ares__slist_t *saved = channel_->servers; ares__slist_t *saved = channel_->servers;
channel_->servers = NULL; channel_->servers = NULL;

7
test/ares-test.h vendored

@ -20,7 +20,9 @@
#define ARES_TEST_H #define ARES_TEST_H
#include "ares_setup.h" #include "ares_setup.h"
#include "ares.h" #ifdef HAVE_CONFIG_H
#include "ares_config.h"
#endif
#include "dns-proto.h" #include "dns-proto.h"
// Include ares internal file for DNS protocol constants // Include ares internal file for DNS protocol constants
@ -29,9 +31,6 @@
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "gmock/gmock.h" #include "gmock/gmock.h"
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#if defined(HAVE_USER_NAMESPACE) && defined(HAVE_UTS_NAMESPACE) #if defined(HAVE_USER_NAMESPACE) && defined(HAVE_UTS_NAMESPACE)
# define HAVE_CONTAINER # define HAVE_CONTAINER
#endif #endif

4
test/buildconf vendored

@ -1,4 +0,0 @@
#!/bin/sh
# Copyright (C) The c-ares project and its contributors
# SPDX-License-Identifier: MIT
autoreconf -iv

56
test/configure.ac vendored

@ -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
Loading…
Cancel
Save