[/
 / Copyright (c) 2003-2026 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 `BOOST_ASIO_HAS_`, and are listed in the table below.

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

In general, `BOOST_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 `BOOST_ASIO_HAS_` macro is not automatically defined, testing may have
shown that a claimed feature isn't sufficiently conformant to be compatible
with Boost.Asio's needs.

[table
  [[Macro][Description][Macro to disable feature]]
  [
    [`BOOST_ASIO_HAS_ALIAS_TEMPLATES`]
    [
      Always enabled. Retained for backwards compatibility in user code.
    ]
    []
  ]
  [
    [`BOOST_ASIO_HAS_ALIGNOF`]
    [
      Always enabled. Retained for backwards compatibility in user code.
    ]
    []
  ]
  [
    [`BOOST_ASIO_HAS_BOOST_ALIGN`]
    [
      Boost align library.
    ]
    [`BOOST_ASIO_DISABLE_BOOST_ALIGN`]
  ]
  [
    [`BOOST_ASIO_HAS_BOOST_ARRAY`]
    [
      Boost array library.
    ]
    [`BOOST_ASIO_DISABLE_BOOST_ARRAY`]
  ]
  [
    [`BOOST_ASIO_HAS_BOOST_ASSERT`]
    [
      Boost assert macro.
    ]
    [`BOOST_ASIO_DISABLE_BOOST_ASSERT`]
  ]
  [
    [`BOOST_ASIO_HAS_BOOST_BIND`]
    [
      Boost bind function.
    ]
    [`BOOST_ASIO_DISABLE_BOOST_BIND`]
  ]
  [
    [`BOOST_ASIO_HAS_BOOST_CHRONO`]
    [
      Boost support for chrono.
    ]
    [`BOOST_ASIO_DISABLE_BOOST_CHRONO`]
  ]
  [
    [`BOOST_ASIO_HAS_BOOST_CONFIG`]
    [
      Boost.Config library is available.
    ]
    []
  ]
  [
    [`BOOST_ASIO_HAS_BOOST_CONTEXT_FIBER`]
    [
      Boost support for the Context library's fibers.
    ]
    [`BOOST_ASIO_DISABLE_BOOST_CONTEXT_FIBER`]
  ]
  [
    [`BOOST_ASIO_HAS_BOOST_DATE_TIME`]
    [
      Boost support for the DateTime library.
    ]
    [`BOOST_ASIO_DISABLE_BOOST_DATE_TIME`]
  ]
  [
    [`BOOST_ASIO_HAS_BOOST_LIMITS`]
    [
      Boost limits header.
    ]
    [`BOOST_ASIO_DISABLE_BOOST_LIMITS`]
  ]
  [
    [`BOOST_ASIO_HAS_BOOST_REGEX`]
    [
      Boost regex library.
    ]
    [`BOOST_ASIO_DISABLE_BOOST_REGEX`]
  ]
  [
    [`BOOST_ASIO_HAS_BOOST_SOURCE_LOCATION`]
    [
      Boost support for source_location and system errors.
    ]
    [`BOOST_ASIO_DISABLE_BOOST_SOURCE_LOCATION`]
  ]
  [
    [`BOOST_ASIO_HAS_BOOST_THROW_EXCEPTION`]
    [
      Boost throw_exception function.
    ]
    [`BOOST_ASIO_DISABLE_BOOST_THROW_EXCEPTION`]
  ]
  [
    [`BOOST_ASIO_HAS_BOOST_WORKAROUND`]
    [
      Boost's BOOST_WORKAROUND macro.
    ]
    [`BOOST_ASIO_DISABLE_BOOST_WORKAROUND`]
  ]
  [
    [`BOOST_ASIO_HAS_CHRONO`]
    [
      Some form of chrono library is available.
    ]
    []
  ]
  [
    [`BOOST_ASIO_HAS_CLANG_LIBCXX`]
    [
      Clang / libc++ detection.
    ]
    []
  ]
  [
    [`BOOST_ASIO_HAS_CONCEPTS`]
    [
      Support concepts on compilers known to allow them.
    ]
    [`BOOST_ASIO_DISABLE_CONCEPTS`]
  ]
  [
    [`BOOST_ASIO_HAS_CONSTANT_EXPRESSION_SFINAE`]
    [
      Support SFINAE use of constant expressions on compilers known to allow it.
    ]
    [`BOOST_ASIO_DISABLE_CONSTANT_EXPRESSION_SFINAE`]
  ]
  [
    [`BOOST_ASIO_HAS_CONSTEXPR`]
    [
      Always enabled. Retained for backwards compatibility in user code.
    ]
    []
  ]
  [
    [`BOOST_ASIO_HAS_CO_AWAIT`]
    [
      Support the co_await keyword on compilers known to allow it.
    ]
    [`BOOST_ASIO_DISABLE_CO_AWAIT`]
  ]
  [
    [`BOOST_ASIO_HAS_CSTDINT`]
    [
      Always enabled. Retained for backwards compatibility in user code.
    ]
    []
  ]
  [
    [`BOOST_ASIO_HAS_CXX11_ALLOCATORS`]
    [
      Always enabled. Retained for backwards compatibility in user code.
    ]
    []
  ]
  [
    [`BOOST_ASIO_HAS_DECLTYPE`]
    [
      Always enabled. Retained for backwards compatibility in user code.
    ]
    []
  ]
  [
    [`BOOST_ASIO_HAS_DEFAULT_FUNCTION_TEMPLATE_ARGUMENTS`]
    [
      Always enabled. Retained for backwards compatibility in user code.
    ]
    []
  ]
  [
    [`BOOST_ASIO_HAS_DEV_POLL`]
    [
      Solaris: /dev/poll.
    ]
    [`BOOST_ASIO_DISABLE_DEV_POLL`]
  ]
  [
    [`BOOST_ASIO_HAS_ENUM_CLASS`]
    [
      Always enabled. Retained for backwards compatibility in user code.
    ]
    []
  ]
  [
    [`BOOST_ASIO_HAS_EPOLL`]
    [
      Linux: epoll, eventfd, timerfd and io_uring.
    ]
    [`BOOST_ASIO_DISABLE_EPOLL`]
  ]
  [
    [`BOOST_ASIO_HAS_EVENTFD`]
    [
      Linux: epoll, eventfd, timerfd and io_uring.
    ]
    [`BOOST_ASIO_DISABLE_EVENTFD`]
  ]
  [
    [`BOOST_ASIO_HAS_FILE`]
    [
      Files.
    ]
    [`BOOST_ASIO_DISABLE_FILE`]
  ]
  [
    [`BOOST_ASIO_HAS_GETADDRINFO`]
    [
      Can use getaddrinfo() and getnameinfo().
    ]
    [`BOOST_ASIO_DISABLE_GETADDRINFO`]
  ]
  [
    [`BOOST_ASIO_HAS_HANDLER_HOOKS`]
    [
      Handler hooking. Disabled for ancient Borland C++ and gcc compilers.
    ]
    [`BOOST_ASIO_DISABLE_HANDLER_HOOKS`]
  ]
  [
    [`BOOST_ASIO_HAS_INLINE_VARIABLES`]
    [
      Support for inline variables.
    ]
    [`BOOST_ASIO_DISABLE_INLINE_VARIABLES`]
  ]
  [
    [`BOOST_ASIO_HAS_IOCP`]
    [
      Windows: IO Completion Ports.
    ]
    [`BOOST_ASIO_DISABLE_IOCP`]
  ]
  [
    [`BOOST_ASIO_HAS_IO_URING_AS_DEFAULT`]
    [
      Linux: io_uring is used instead of epoll.
    ]
    []
  ]
  [
    [`BOOST_ASIO_HAS_KQUEUE`]
    [
      Mac OS X, FreeBSD, NetBSD, OpenBSD: kqueue.
    ]
    [`BOOST_ASIO_DISABLE_KQUEUE`]
  ]
  [
    [`BOOST_ASIO_HAS_LOCAL_SOCKETS`]
    [
      UNIX domain sockets.
    ]
    [`BOOST_ASIO_DISABLE_LOCAL_SOCKETS`]
  ]
  [
    [`BOOST_ASIO_HAS_MOVE`]
    [
      Always enabled. Retained for backwards compatibility in user code.
    ]
    []
  ]
  [
    [`BOOST_ASIO_HAS_MSG_NOSIGNAL`]
    [
      Kernel support for MSG_NOSIGNAL.
    ]
    []
  ]
  [
    [`BOOST_ASIO_HAS_NOEXCEPT`]
    [
      Always enabled. Retained for backwards compatibility in user code.
    ]
    []
  ]
  [
    [`BOOST_ASIO_HAS_NOEXCEPT_FUNCTION_TYPE`]
    [
      Support noexcept on function types on compilers known to allow it.
    ]
    [`BOOST_ASIO_DISABLE_NOEXCEPT_FUNCTION_TYPE`]
  ]
  [
    [`BOOST_ASIO_HAS_NULLPTR`]
    [
      Always enabled. Retained for backwards compatibility in user code.
    ]
    []
  ]
  [
    [`BOOST_ASIO_HAS_PIPE`]
    [
      Pipes.
    ]
    [`BOOST_ASIO_DISABLE_PIPE`]
  ]
  [
    [`BOOST_ASIO_HAS_POSIX_STREAM_DESCRIPTOR`]
    [
      POSIX: stream-oriented file descriptors.
    ]
    [`BOOST_ASIO_DISABLE_POSIX_STREAM_DESCRIPTOR`]
  ]
  [
    [`BOOST_ASIO_HAS_PTHREADS`]
    [
      POSIX threads.
    ]
    []
  ]
  [
    [`BOOST_ASIO_HAS_REF_QUALIFIED_FUNCTIONS`]
    [
      Always enabled. Retained for backwards compatibility in user code.
    ]
    []
  ]
  [
    [`BOOST_ASIO_HAS_RETURN_TYPE_DEDUCTION`]
    [
      Support return type deduction on compilers known to allow it.
    ]
    [`BOOST_ASIO_DISABLE_RETURN_TYPE_DEDUCTION`]
  ]
  [
    [`BOOST_ASIO_HAS_SECURE_RTL`]
    [
      Microsoft Visual C++'s secure C runtime library.
    ]
    [`BOOST_ASIO_DISABLE_SECURE_RTL`]
  ]
  [
    [`BOOST_ASIO_HAS_SERIAL_PORT`]
    [
      Serial ports.
    ]
    [`BOOST_ASIO_DISABLE_SERIAL_PORT`]
  ]
  [
    [`BOOST_ASIO_HAS_SFINAE_VARIABLE_TEMPLATES`]
    [
      Support SFINAEd template variables on compilers known to allow it.
    ]
    [`BOOST_ASIO_DISABLE_SFINAE_VARIABLE_TEMPLATES`]
  ]
  [
    [`BOOST_ASIO_HAS_SIGACTION`]
    [
      Can use sigaction() instead of signal().
    ]
    [`BOOST_ASIO_DISABLE_SIGACTION`]
  ]
  [
    [`BOOST_ASIO_HAS_SIGNAL`]
    [
      Can use signal().
    ]
    [`BOOST_ASIO_DISABLE_SIGNAL`]
  ]
  [
    [`BOOST_ASIO_HAS_SNPRINTF`]
    [
      Standard library support for snprintf.
    ]
    [`BOOST_ASIO_DISABLE_SNPRINTF`]
  ]
  [
    [`BOOST_ASIO_HAS_SOURCE_LOCATION`]
    [
      Standard library has a source_location that we can use.
    ]
    [`BOOST_ASIO_DISABLE_SOURCE_LOCATION`]
  ]
  [
    [`BOOST_ASIO_HAS_SSIZE_T`]
    [
      Support for POSIX ssize_t typedef.
    ]
    [`BOOST_ASIO_DISABLE_SSIZE_T`]
  ]
  [
    [`BOOST_ASIO_HAS_STD_ADDRESSOF`]
    [
      Always enabled. Retained for backwards compatibility in user code.
    ]
    []
  ]
  [
    [`BOOST_ASIO_HAS_STD_ALIGN`]
    [
      Always enabled. Retained for backwards compatibility in user code.
    ]
    []
  ]
  [
    [`BOOST_ASIO_HAS_STD_ALIGNED_ALLOC`]
    [
      Standard library support for aligned allocation.
    ]
    [`BOOST_ASIO_DISABLE_STD_ALIGNED_ALLOC`]
  ]
  [
    [`BOOST_ASIO_HAS_STD_ALLOCATOR_ARG`]
    [
      Always enabled. Retained for backwards compatibility in user code.
    ]
    []
  ]
  [
    [`BOOST_ASIO_HAS_STD_ANY`]
    [
      Standard library support for std::any.
    ]
    [`BOOST_ASIO_DISABLE_STD_ANY`]
  ]
  [
    [`BOOST_ASIO_HAS_STD_ARRAY`]
    [
      Always enabled. Retained for backwards compatibility in user code.
    ]
    []
  ]
  [
    [`BOOST_ASIO_HAS_STD_ATOMIC`]
    [
      Always enabled. Retained for backwards compatibility in user code.
    ]
    []
  ]
  [
    [`BOOST_ASIO_HAS_STD_ATOMIC_WAIT`]
    [
      Standard library support for std::atomic<T>::wait and notify functions.
      By default, this is only enabled on platforms where the standard library is
      known to implement them using efficient wait primitives (e.g. Linux futex,
      Windows WaitOnAddress, Apple ulock).
    ]
    [`BOOST_ASIO_DISABLE_STD_ATOMIC_WAIT`]
  ]
  [
    [`BOOST_ASIO_HAS_STD_CALL_ONCE`]
    [
      Always enabled. Retained for backwards compatibility in user code.
    ]
    []
  ]
  [
    [`BOOST_ASIO_HAS_STD_CHRONO`]
    [
      Always enabled. Retained for backwards compatibility in user code.
    ]
    []
  ]
  [
    [`BOOST_ASIO_HAS_STD_CONCEPTS`]
    [
      Support concepts on compilers known to allow them.
    ]
    [`BOOST_ASIO_DISABLE_STD_CONCEPTS`]
  ]
  [
    [`BOOST_ASIO_HAS_STD_COROUTINE`]
    [
      Standard library support for coroutines.
    ]
    [`BOOST_ASIO_DISABLE_STD_COROUTINE`]
  ]
  [
    [`BOOST_ASIO_HAS_STD_EXCEPTION_PTR`]
    [
      Always enabled. Retained for backwards compatibility in user code.
    ]
    []
  ]
  [
    [`BOOST_ASIO_HAS_STD_EXPERIMENTAL_SOURCE_LOCATION`]
    [
      Standard library support for std::experimental::source_location.
    ]
    [`BOOST_ASIO_DISABLE_STD_EXPERIMENTAL_SOURCE_LOCATION`]
  ]
  [
    [`BOOST_ASIO_HAS_STD_EXPERIMENTAL_STRING_VIEW`]
    [
      Standard library support for std::experimental::string_view.
    ]
    [`BOOST_ASIO_DISABLE_STD_EXPERIMENTAL_STRING_VIEW`]
  ]
  [
    [`BOOST_ASIO_HAS_STD_FUNCTION`]
    [
      Always enabled. Retained for backwards compatibility in user code.
    ]
    []
  ]
  [
    [`BOOST_ASIO_HAS_STD_FUTURE`]
    [
      Always enabled. Retained for backwards compatibility in user code.
    ]
    []
  ]
  [
    [`BOOST_ASIO_HAS_STD_HASH`]
    [
      Always enabled. Retained for backwards compatibility in user code.
    ]
    []
  ]
  [
    [`BOOST_ASIO_HAS_STD_INDEX_SEQUENCE`]
    [
      Standard library support for std::index_sequence.
    ]
    [`BOOST_ASIO_DISABLE_STD_INDEX_SEQUENCE`]
  ]
  [
    [`BOOST_ASIO_HAS_STD_INVOKE_RESULT`]
    [
      Standard library has invoke_result (which supersedes result_of).
    ]
    [`BOOST_ASIO_DISABLE_STD_INVOKE_RESULT`]
  ]
  [
    [`BOOST_ASIO_HAS_STD_IOSTREAM_MOVE`]
    [
      Always enabled. Retained for backwards compatibility in user code.
    ]
    []
  ]
  [
    [`BOOST_ASIO_HAS_STD_MUTEX_AND_CONDVAR`]
    [
      Always enabled. Retained for backwards compatibility in user code.
    ]
    []
  ]
  [
    [`BOOST_ASIO_HAS_STD_NESTED_EXCEPTION`]
    [
      Always enabled. Retained for backwards compatibility in user code.
    ]
    []
  ]
  [
    [`BOOST_ASIO_HAS_STD_REFERENCE_WRAPPER`]
    [
      Always enabled. Retained for backwards compatibility in user code.
    ]
    []
  ]
  [
    [`BOOST_ASIO_HAS_STD_SHARED_PTR`]
    [
      Always enabled. Retained for backwards compatibility in user code.
    ]
    []
  ]
  [
    [`BOOST_ASIO_HAS_STD_SOURCE_LOCATION`]
    [
      Standard library support for std::source_location.
    ]
    [`BOOST_ASIO_DISABLE_STD_SOURCE_LOCATION`]
  ]
  [
    [`BOOST_ASIO_HAS_STD_STRING_VIEW`]
    [
      Standard library support for std::string_view.
    ]
    [`BOOST_ASIO_DISABLE_STD_STRING_VIEW`]
  ]
  [
    [`BOOST_ASIO_HAS_STD_SYSTEM_ERROR`]
    [
      Always enabled. Retained for backwards compatibility in user code.
    ]
    []
  ]
  [
    [`BOOST_ASIO_HAS_STD_THREAD`]
    [
      Always enabled. Retained for backwards compatibility in user code.
    ]
    []
  ]
  [
    [`BOOST_ASIO_HAS_STD_TO_ADDRESS`]
    [
      Standard library support for std::to_address.
    ]
    [`BOOST_ASIO_DISABLE_STD_TO_ADDRESS`]
  ]
  [
    [`BOOST_ASIO_HAS_STD_TUPLE`]
    [
      Always enabled. Retained for backwards compatibility in user code.
    ]
    []
  ]
  [
    [`BOOST_ASIO_HAS_STD_TYPE_TRAITS`]
    [
      Always enabled. Retained for backwards compatibility in user code.
    ]
    []
  ]
  [
    [`BOOST_ASIO_HAS_STD_VARIANT`]
    [
      Standard library support for std::variant.
    ]
    [`BOOST_ASIO_DISABLE_STD_VARIANT`]
  ]
  [
    [`BOOST_ASIO_HAS_STRING_VIEW`]
    [
      Standard library has a string_view that we can use.
    ]
    [`BOOST_ASIO_DISABLE_STRING_VIEW`]
  ]
  [
    [`BOOST_ASIO_HAS_THREADS`]
    [
      Threads.
    ]
    [`BOOST_ASIO_DISABLE_THREADS`]
  ]
  [
    [`BOOST_ASIO_HAS_THREAD_KEYWORD_EXTENSION`]
    [
      Support for the __thread keyword extension, or equivalent.
    ]
    [`BOOST_ASIO_DISABLE_THREAD_KEYWORD_EXTENSION`]
  ]
  [
    [`BOOST_ASIO_HAS_TIMERFD`]
    [
      Linux: epoll, eventfd, timerfd and io_uring.
    ]
    [`BOOST_ASIO_DISABLE_TIMERFD`]
  ]
  [
    [`BOOST_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.
    ]
    []
  ]
  [
    [`BOOST_ASIO_HAS_USER_DEFINED_LITERALS`]
    [
      Always enabled. Retained for backwards compatibility in user code.
    ]
    []
  ]
  [
    [`BOOST_ASIO_HAS_VARIABLE_TEMPLATES`]
    [
      Support template variables on compilers known to allow it.
    ]
    [`BOOST_ASIO_DISABLE_VARIABLE_TEMPLATES`]
  ]
  [
    [`BOOST_ASIO_HAS_VARIADIC_LAMBDA_CAPTURES`]
    [
      Support for capturing parameter packs in lambdas.
    ]
    [`BOOST_ASIO_DISABLE_VARIADIC_LAMBDA_CAPTURES`]
  ]
  [
    [`BOOST_ASIO_HAS_VARIADIC_TEMPLATES`]
    [
      Always enabled. Retained for backwards compatibility in user code.
    ]
    []
  ]
  [
    [`BOOST_ASIO_HAS_WINDOWS_OBJECT_HANDLE`]
    [
      Windows: object handles.
    ]
    [`BOOST_ASIO_DISABLE_WINDOWS_OBJECT_HANDLE`]
  ]
  [
    [`BOOST_ASIO_HAS_WINDOWS_OVERLAPPED_PTR`]
    [
      Windows: OVERLAPPED wrapper.
    ]
    [`BOOST_ASIO_DISABLE_WINDOWS_OVERLAPPED_PTR`]
  ]
  [
    [`BOOST_ASIO_HAS_WINDOWS_RANDOM_ACCESS_HANDLE`]
    [
      Windows: random access handles.
    ]
    [`BOOST_ASIO_DISABLE_WINDOWS_RANDOM_ACCESS_HANDLE`]
  ]
  [
    [`BOOST_ASIO_HAS_WINDOWS_SRWLOCK`]
    [
      Windows: Slim Reader/Writer Locks.
      Requires Windows 7 or later for TryAcquireSRWLockExclusive support.
    ]
    [`BOOST_ASIO_DISABLE_WINDOWS_SRWLOCK`]
  ]
  [
    [`BOOST_ASIO_HAS_WINDOWS_STREAM_HANDLE`]
    [
      Windows: stream handles.
    ]
    [`BOOST_ASIO_DISABLE_WINDOWS_STREAM_HANDLE`]
  ]
  [
    [`BOOST_ASIO_HAS_WORKING_EXPRESSION_SFINAE`]
    [
      Enable workarounds for lack of working expression SFINAE.
    ]
    [`BOOST_ASIO_DISABLE_WORKING_EXPRESSION_SFINAE`]
  ]
]
