[/
 / Copyright (c) 2003-2025 Christopher M. Kohlhoff (chris at kohlhoff dot com)
 /
 / Distributed under the Boost Software License, Version 1.0. (See accompanying
 / file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 /]

[heading Compiler/platform feature detection macros]

Asio automatically defines preprocessor macros corresponding to the detected
available features on a particular compiler and target platform. These macros
are named with the prefix `ASIO_HAS_`, and are listed in the table below.

Many of these macros also have a corresponding `ASIO_DISABLE_` macro that may
be used to explicitly disable the feature.

In general, `ASIO_HAS_` macros should not be explicitly defined by the user,
except when absolutely required as a workaround for the latest version of a
compiler or platform. For older compiler/platform combinations where a specific
`ASIO_HAS_` macro is not automatically defined, testing may have shown that a
claimed feature isn't sufficiently conformant to be compatible with Asio's
needs.

[table
  [[Macro][Description][Macro to disable feature]]
  [
    [`ASIO_HAS_ALIAS_TEMPLATES`]
    [
      Always enabled. Retained for backwards compatibility in user code.
    ]
    []
  ]
  [
    [`ASIO_HAS_ALIGNOF`]
    [
      Always enabled. Retained for backwards compatibility in user code.
    ]
    []
  ]
  [
    [`ASIO_HAS_BOOST_ALIGN`]
    [
      Boost align library.
    ]
    [`ASIO_DISABLE_BOOST_ALIGN`]
  ]
  [
    [`ASIO_HAS_BOOST_ARRAY`]
    [
      Boost array library.
    ]
    [`ASIO_DISABLE_BOOST_ARRAY`]
  ]
  [
    [`ASIO_HAS_BOOST_ASSERT`]
    [
      Boost assert macro.
    ]
    [`ASIO_DISABLE_BOOST_ASSERT`]
  ]
  [
    [`ASIO_HAS_BOOST_BIND`]
    [
      Boost bind function.
    ]
    [`ASIO_DISABLE_BOOST_BIND`]
  ]
  [
    [`ASIO_HAS_BOOST_CHRONO`]
    [
      Boost support for chrono.
    ]
    [`ASIO_DISABLE_BOOST_CHRONO`]
  ]
  [
    [`ASIO_HAS_BOOST_CONFIG`]
    [
      Boost.Config library is available.
    ]
    []
  ]
  [
    [`ASIO_HAS_BOOST_CONTEXT_FIBER`]
    [
      Boost support for the Context library's fibers.
    ]
    [`ASIO_DISABLE_BOOST_CONTEXT_FIBER`]
  ]
  [
    [`ASIO_HAS_BOOST_COROUTINE`]
    [
      Boost support for the Coroutine library.
    ]
    [`ASIO_DISABLE_BOOST_COROUTINE`]
  ]
  [
    [`ASIO_HAS_BOOST_DATE_TIME`]
    [
      Boost support for the DateTime library.
    ]
    [`ASIO_DISABLE_BOOST_DATE_TIME`]
  ]
  [
    [`ASIO_HAS_BOOST_LIMITS`]
    [
      Boost limits header.
    ]
    [`ASIO_DISABLE_BOOST_LIMITS`]
  ]
  [
    [`ASIO_HAS_BOOST_REGEX`]
    [
      Boost regex library.
    ]
    [`ASIO_DISABLE_BOOST_REGEX`]
  ]
  [
    [`ASIO_HAS_BOOST_SOURCE_LOCATION`]
    [
      Boost support for source_location and system errors.
    ]
    [`ASIO_DISABLE_BOOST_SOURCE_LOCATION`]
  ]
  [
    [`ASIO_HAS_BOOST_THROW_EXCEPTION`]
    [
      Boost throw_exception function.
    ]
    [`ASIO_DISABLE_BOOST_THROW_EXCEPTION`]
  ]
  [
    [`ASIO_HAS_BOOST_WORKAROUND`]
    [
      Boost's BOOST_WORKAROUND macro.
    ]
    [`ASIO_DISABLE_BOOST_WORKAROUND`]
  ]
  [
    [`ASIO_HAS_CHRONO`]
    [
      Some form of chrono library is available.
    ]
    []
  ]
  [
    [`ASIO_HAS_CLANG_LIBCXX`]
    [
      Clang / libc++ detection.
    ]
    []
  ]
  [
    [`ASIO_HAS_CONCEPTS`]
    [
      Support concepts on compilers known to allow them.
    ]
    [`ASIO_DISABLE_CONCEPTS`]
  ]
  [
    [`ASIO_HAS_CONSTANT_EXPRESSION_SFINAE`]
    [
      Support SFINAE use of constant expressions on compilers known to allow it.
    ]
    [`ASIO_DISABLE_CONSTANT_EXPRESSION_SFINAE`]
  ]
  [
    [`ASIO_HAS_CONSTEXPR`]
    [
      Always enabled. Retained for backwards compatibility in user code.
    ]
    []
  ]
  [
    [`ASIO_HAS_CO_AWAIT`]
    [
      Support the co_await keyword on compilers known to allow it.
    ]
    [`ASIO_DISABLE_CO_AWAIT`]
  ]
  [
    [`ASIO_HAS_CSTDINT`]
    [
      Always enabled. Retained for backwards compatibility in user code.
    ]
    []
  ]
  [
    [`ASIO_HAS_CXX11_ALLOCATORS`]
    [
      Always enabled. Retained for backwards compatibility in user code.
    ]
    []
  ]
  [
    [`ASIO_HAS_DECLTYPE`]
    [
      Always enabled. Retained for backwards compatibility in user code.
    ]
    []
  ]
  [
    [`ASIO_HAS_DEFAULT_FUNCTION_TEMPLATE_ARGUMENTS`]
    [
      Always enabled. Retained for backwards compatibility in user code.
    ]
    []
  ]
  [
    [`ASIO_HAS_DEV_POLL`]
    [
      Solaris: /dev/poll.
    ]
    [`ASIO_DISABLE_DEV_POLL`]
  ]
  [
    [`ASIO_HAS_ENUM_CLASS`]
    [
      Always enabled. Retained for backwards compatibility in user code.
    ]
    []
  ]
  [
    [`ASIO_HAS_EPOLL`]
    [
      Linux: epoll, eventfd, timerfd and io_uring.
    ]
    [`ASIO_DISABLE_EPOLL`]
  ]
  [
    [`ASIO_HAS_EVENTFD`]
    [
      Linux: epoll, eventfd, timerfd and io_uring.
    ]
    [`ASIO_DISABLE_EVENTFD`]
  ]
  [
    [`ASIO_HAS_FILE`]
    [
      Files.
    ]
    [`ASIO_DISABLE_FILE`]
  ]
  [
    [`ASIO_HAS_GETADDRINFO`]
    [
      Can use getaddrinfo() and getnameinfo().
    ]
    [`ASIO_DISABLE_GETADDRINFO`]
  ]
  [
    [`ASIO_HAS_HANDLER_HOOKS`]
    [
      Handler hooking. Disabled for ancient Borland C++ and gcc compilers.
    ]
    [`ASIO_DISABLE_HANDLER_HOOKS`]
  ]
  [
    [`ASIO_HAS_IOCP`]
    [
      Windows: IO Completion Ports.
    ]
    [`ASIO_DISABLE_IOCP`]
  ]
  [
    [`ASIO_HAS_IO_URING_AS_DEFAULT`]
    [
      Linux: io_uring is used instead of epoll.
    ]
    []
  ]
  [
    [`ASIO_HAS_KQUEUE`]
    [
      Mac OS X, FreeBSD, NetBSD, OpenBSD: kqueue.
    ]
    [`ASIO_DISABLE_KQUEUE`]
  ]
  [
    [`ASIO_HAS_LOCAL_SOCKETS`]
    [
      UNIX domain sockets.
    ]
    [`ASIO_DISABLE_LOCAL_SOCKETS`]
  ]
  [
    [`ASIO_HAS_MOVE`]
    [
      Always enabled. Retained for backwards compatibility in user code.
    ]
    []
  ]
  [
    [`ASIO_HAS_MSG_NOSIGNAL`]
    [
      Kernel support for MSG_NOSIGNAL.
    ]
    []
  ]
  [
    [`ASIO_HAS_NOEXCEPT`]
    [
      Always enabled. Retained for backwards compatibility in user code.
    ]
    []
  ]
  [
    [`ASIO_HAS_NOEXCEPT_FUNCTION_TYPE`]
    [
      Support noexcept on function types on compilers known to allow it.
    ]
    [`ASIO_DISABLE_NOEXCEPT_FUNCTION_TYPE`]
  ]
  [
    [`ASIO_HAS_NULLPTR`]
    [
      Always enabled. Retained for backwards compatibility in user code.
    ]
    []
  ]
  [
    [`ASIO_HAS_PIPE`]
    [
      Pipes.
    ]
    [`ASIO_DISABLE_PIPE`]
  ]
  [
    [`ASIO_HAS_POSIX_STREAM_DESCRIPTOR`]
    [
      POSIX: stream-oriented file descriptors.
    ]
    [`ASIO_DISABLE_POSIX_STREAM_DESCRIPTOR`]
  ]
  [
    [`ASIO_HAS_PTHREADS`]
    [
      POSIX threads.
    ]
    []
  ]
  [
    [`ASIO_HAS_REF_QUALIFIED_FUNCTIONS`]
    [
      Always enabled. Retained for backwards compatibility in user code.
    ]
    []
  ]
  [
    [`ASIO_HAS_RETURN_TYPE_DEDUCTION`]
    [
      Support return type deduction on compilers known to allow it.
    ]
    [`ASIO_DISABLE_RETURN_TYPE_DEDUCTION`]
  ]
  [
    [`ASIO_HAS_SECURE_RTL`]
    [
      Microsoft Visual C++'s secure C runtime library.
    ]
    [`ASIO_DISABLE_SECURE_RTL`]
  ]
  [
    [`ASIO_HAS_SERIAL_PORT`]
    [
      Serial ports.
    ]
    [`ASIO_DISABLE_SERIAL_PORT`]
  ]
  [
    [`ASIO_HAS_SFINAE_VARIABLE_TEMPLATES`]
    [
      Support SFINAEd template variables on compilers known to allow it.
    ]
    [`ASIO_DISABLE_SFINAE_VARIABLE_TEMPLATES`]
  ]
  [
    [`ASIO_HAS_SIGACTION`]
    [
      Can use sigaction() instead of signal().
    ]
    [`ASIO_DISABLE_SIGACTION`]
  ]
  [
    [`ASIO_HAS_SIGNAL`]
    [
      Can use signal().
    ]
    [`ASIO_DISABLE_SIGNAL`]
  ]
  [
    [`ASIO_HAS_SNPRINTF`]
    [
      Standard library support for snprintf.
    ]
    [`ASIO_DISABLE_SNPRINTF`]
  ]
  [
    [`ASIO_HAS_SOURCE_LOCATION`]
    [
      Standard library has a source_location that we can use.
    ]
    [`ASIO_DISABLE_SOURCE_LOCATION`]
  ]
  [
    [`ASIO_HAS_SSIZE_T`]
    [
      Support for POSIX ssize_t typedef.
    ]
    [`ASIO_DISABLE_SSIZE_T`]
  ]
  [
    [`ASIO_HAS_STD_ADDRESSOF`]
    [
      Always enabled. Retained for backwards compatibility in user code.
    ]
    []
  ]
  [
    [`ASIO_HAS_STD_ALIGN`]
    [
      Always enabled. Retained for backwards compatibility in user code.
    ]
    []
  ]
  [
    [`ASIO_HAS_STD_ALIGNED_ALLOC`]
    [
      Standard library support for aligned allocation.
    ]
    [`ASIO_DISABLE_STD_ALIGNED_ALLOC`]
  ]
  [
    [`ASIO_HAS_STD_ALLOCATOR_ARG`]
    [
      Always enabled. Retained for backwards compatibility in user code.
    ]
    []
  ]
  [
    [`ASIO_HAS_STD_ANY`]
    [
      Standard library support for std::any.
    ]
    [`ASIO_DISABLE_STD_ANY`]
  ]
  [
    [`ASIO_HAS_STD_ARRAY`]
    [
      Always enabled. Retained for backwards compatibility in user code.
    ]
    []
  ]
  [
    [`ASIO_HAS_STD_ATOMIC`]
    [
      Always enabled. Retained for backwards compatibility in user code.
    ]
    []
  ]
  [
    [`ASIO_HAS_STD_CALL_ONCE`]
    [
      Always enabled. Retained for backwards compatibility in user code.
    ]
    []
  ]
  [
    [`ASIO_HAS_STD_CHRONO`]
    [
      Always enabled. Retained for backwards compatibility in user code.
    ]
    []
  ]
  [
    [`ASIO_HAS_STD_CONCEPTS`]
    [
      Support concepts on compilers known to allow them.
    ]
    [`ASIO_DISABLE_STD_CONCEPTS`]
  ]
  [
    [`ASIO_HAS_STD_COROUTINE`]
    [
      Standard library support for coroutines.
    ]
    [`ASIO_DISABLE_STD_COROUTINE`]
  ]
  [
    [`ASIO_HAS_STD_EXCEPTION_PTR`]
    [
      Always enabled. Retained for backwards compatibility in user code.
    ]
    []
  ]
  [
    [`ASIO_HAS_STD_EXPERIMENTAL_SOURCE_LOCATION`]
    [
      Standard library support for std::experimental::source_location.
    ]
    [`ASIO_DISABLE_STD_EXPERIMENTAL_SOURCE_LOCATION`]
  ]
  [
    [`ASIO_HAS_STD_EXPERIMENTAL_STRING_VIEW`]
    [
      Standard library support for std::experimental::string_view.
    ]
    [`ASIO_DISABLE_STD_EXPERIMENTAL_STRING_VIEW`]
  ]
  [
    [`ASIO_HAS_STD_FUNCTION`]
    [
      Always enabled. Retained for backwards compatibility in user code.
    ]
    []
  ]
  [
    [`ASIO_HAS_STD_FUTURE`]
    [
      Always enabled. Retained for backwards compatibility in user code.
    ]
    []
  ]
  [
    [`ASIO_HAS_STD_HASH`]
    [
      Always enabled. Retained for backwards compatibility in user code.
    ]
    []
  ]
  [
    [`ASIO_HAS_STD_INDEX_SEQUENCE`]
    [
      Standard library support for std::index_sequence.
    ]
    [`ASIO_DISABLE_STD_INDEX_SEQUENCE`]
  ]
  [
    [`ASIO_HAS_STD_INVOKE_RESULT`]
    [
      Standard library has invoke_result (which supersedes result_of).
    ]
    [`ASIO_DISABLE_STD_INVOKE_RESULT`]
  ]
  [
    [`ASIO_HAS_STD_IOSTREAM_MOVE`]
    [
      Always enabled. Retained for backwards compatibility in user code.
    ]
    []
  ]
  [
    [`ASIO_HAS_STD_MUTEX_AND_CONDVAR`]
    [
      Always enabled. Retained for backwards compatibility in user code.
    ]
    []
  ]
  [
    [`ASIO_HAS_STD_NESTED_EXCEPTION`]
    [
      Always enabled. Retained for backwards compatibility in user code.
    ]
    []
  ]
  [
    [`ASIO_HAS_STD_REFERENCE_WRAPPER`]
    [
      Always enabled. Retained for backwards compatibility in user code.
    ]
    []
  ]
  [
    [`ASIO_HAS_STD_SHARED_PTR`]
    [
      Always enabled. Retained for backwards compatibility in user code.
    ]
    []
  ]
  [
    [`ASIO_HAS_STD_STRING_VIEW`]
    [
      Standard library support for std::string_view.
    ]
    [`ASIO_DISABLE_STD_STRING_VIEW`]
  ]
  [
    [`ASIO_HAS_STD_SYSTEM_ERROR`]
    [
      Always enabled. Retained for backwards compatibility in user code.
    ]
    []
  ]
  [
    [`ASIO_HAS_STD_THREAD`]
    [
      Always enabled. Retained for backwards compatibility in user code.
    ]
    []
  ]
  [
    [`ASIO_HAS_STD_TO_ADDRESS`]
    [
      Standard library support for std::to_address.
    ]
    [`ASIO_DISABLE_STD_TO_ADDRESS`]
  ]
  [
    [`ASIO_HAS_STD_TUPLE`]
    [
      Always enabled. Retained for backwards compatibility in user code.
    ]
    []
  ]
  [
    [`ASIO_HAS_STD_TYPE_TRAITS`]
    [
      Always enabled. Retained for backwards compatibility in user code.
    ]
    []
  ]
  [
    [`ASIO_HAS_STD_VARIANT`]
    [
      Standard library support for std::variant.
    ]
    [`ASIO_DISABLE_STD_VARIANT`]
  ]
  [
    [`ASIO_HAS_STRING_VIEW`]
    [
      Standard library has a string_view that we can use.
    ]
    [`ASIO_DISABLE_STRING_VIEW`]
  ]
  [
    [`ASIO_HAS_THREADS`]
    [
      Threads.
    ]
    [`ASIO_DISABLE_THREADS`]
  ]
  [
    [`ASIO_HAS_THREAD_KEYWORD_EXTENSION`]
    [
      Support for the __thread keyword extension, or equivalent.
    ]
    [`ASIO_DISABLE_THREAD_KEYWORD_EXTENSION`]
  ]
  [
    [`ASIO_HAS_TIMERFD`]
    [
      Linux: epoll, eventfd, timerfd and io_uring.
    ]
    []
  ]
  [
    [`ASIO_HAS_UNISTD_H`]
    [
      On POSIX (and POSIX-like) platforms we need to include unistd.h in order to
      get access to the various platform feature macros, e.g. to be able to test
      for threads support.
    ]
    []
  ]
  [
    [`ASIO_HAS_USER_DEFINED_LITERALS`]
    [
      Always enabled. Retained for backwards compatibility in user code.
    ]
    []
  ]
  [
    [`ASIO_HAS_VARIABLE_TEMPLATES`]
    [
      Support template variables on compilers known to allow it.
    ]
    [`ASIO_DISABLE_VARIABLE_TEMPLATES`]
  ]
  [
    [`ASIO_HAS_VARIADIC_LAMBDA_CAPTURES`]
    [
      Support for capturing parameter packs in lambdas.
    ]
    [`ASIO_DISABLE_VARIADIC_LAMBDA_CAPTURES`]
  ]
  [
    [`ASIO_HAS_VARIADIC_TEMPLATES`]
    [
      Always enabled. Retained for backwards compatibility in user code.
    ]
    []
  ]
  [
    [`ASIO_HAS_WINDOWS_OBJECT_HANDLE`]
    [
      Windows: object handles.
    ]
    [`ASIO_DISABLE_WINDOWS_OBJECT_HANDLE`]
  ]
  [
    [`ASIO_HAS_WINDOWS_OVERLAPPED_PTR`]
    [
      Windows: OVERLAPPED wrapper.
    ]
    [`ASIO_DISABLE_WINDOWS_OVERLAPPED_PTR`]
  ]
  [
    [`ASIO_HAS_WINDOWS_RANDOM_ACCESS_HANDLE`]
    [
      Windows: random access handles.
    ]
    [`ASIO_DISABLE_WINDOWS_RANDOM_ACCESS_HANDLE`]
  ]
  [
    [`ASIO_HAS_WINDOWS_STREAM_HANDLE`]
    [
      Windows: stream handles.
    ]
    [`ASIO_DISABLE_WINDOWS_STREAM_HANDLE`]
  ]
  [
    [`ASIO_HAS_WORKING_EXPRESSION_SFINAE`]
    [
      Enable workarounds for lack of working expression SFINAE.
    ]
    [`ASIO_DISABLE_WORKING_EXPRESSION_SFINAE`]
  ]
]
