1//
2// detail/config.hpp
3// ~~~~~~~~~~~~~~~~~
4//
5// Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com)
6//
7// Distributed under the Boost Software License, Version 1.0. (See accompanying
8// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
9//
10
11#ifndef BOOST_ASIO_DETAIL_CONFIG_HPP
12#define BOOST_ASIO_DETAIL_CONFIG_HPP
13
14#if defined(BOOST_ASIO_STANDALONE)
15# define BOOST_ASIO_DISABLE_BOOST_ALIGN 1
16# define BOOST_ASIO_DISABLE_BOOST_ARRAY 1
17# define BOOST_ASIO_DISABLE_BOOST_ASSERT 1
18# define BOOST_ASIO_DISABLE_BOOST_BIND 1
19# define BOOST_ASIO_DISABLE_BOOST_CHRONO 1
20# define BOOST_ASIO_DISABLE_BOOST_DATE_TIME 1
21# define BOOST_ASIO_DISABLE_BOOST_LIMITS 1
22# define BOOST_ASIO_DISABLE_BOOST_REGEX 1
23# define BOOST_ASIO_DISABLE_BOOST_STATIC_CONSTANT 1
24# define BOOST_ASIO_DISABLE_BOOST_THROW_EXCEPTION 1
25# define BOOST_ASIO_DISABLE_BOOST_WORKAROUND 1
26#else // defined(BOOST_ASIO_STANDALONE)
27// Boost.Config library is available.
28# include <boost/config.hpp>
29# include <boost/version.hpp>
30# define BOOST_ASIO_HAS_BOOST_CONFIG 1
31#endif // defined(BOOST_ASIO_STANDALONE)
32
33// Default to a header-only implementation. The user must specifically request
34// separate compilation by defining either BOOST_ASIO_SEPARATE_COMPILATION or
35// BOOST_ASIO_DYN_LINK (as a DLL/shared library implies separate compilation).
36#if !defined(BOOST_ASIO_HEADER_ONLY)
37# if !defined(BOOST_ASIO_SEPARATE_COMPILATION)
38# if !defined(BOOST_ASIO_DYN_LINK)
39# define BOOST_ASIO_HEADER_ONLY 1
40# endif // !defined(BOOST_ASIO_DYN_LINK)
41# endif // !defined(BOOST_ASIO_SEPARATE_COMPILATION)
42#endif // !defined(BOOST_ASIO_HEADER_ONLY)
43
44#if defined(BOOST_ASIO_HEADER_ONLY)
45# define BOOST_ASIO_DECL inline
46#else // defined(BOOST_ASIO_HEADER_ONLY)
47# if defined(_MSC_VER) || defined(__BORLANDC__) || defined(__CODEGEARC__)
48// We need to import/export our code only if the user has specifically asked
49// for it by defining BOOST_ASIO_DYN_LINK.
50# if defined(BOOST_ASIO_DYN_LINK)
51// Export if this is our own source, otherwise import.
52# if defined(BOOST_ASIO_SOURCE)
53# define BOOST_ASIO_DECL __declspec(dllexport)
54# else // defined(BOOST_ASIO_SOURCE)
55# define BOOST_ASIO_DECL __declspec(dllimport)
56# endif // defined(BOOST_ASIO_SOURCE)
57# endif // defined(BOOST_ASIO_DYN_LINK)
58# endif // defined(_MSC_VER) || defined(__BORLANDC__) || defined(__CODEGEARC__)
59#endif // defined(BOOST_ASIO_HEADER_ONLY)
60
61// If BOOST_ASIO_DECL isn't defined yet define it now.
62#if !defined(BOOST_ASIO_DECL)
63# define BOOST_ASIO_DECL
64#endif // !defined(BOOST_ASIO_DECL)
65
66// Helper macro for documentation.
67#define BOOST_ASIO_UNSPECIFIED(e) e
68
69// Microsoft Visual C++ detection.
70#if !defined(BOOST_ASIO_MSVC)
71# if defined(BOOST_ASIO_HAS_BOOST_CONFIG) && defined(BOOST_MSVC)
72# define BOOST_ASIO_MSVC BOOST_MSVC
73# elif defined(_MSC_VER) && (defined(__INTELLISENSE__) \
74 || (!defined(__MWERKS__) && !defined(__EDG_VERSION__)))
75# define BOOST_ASIO_MSVC _MSC_VER
76# endif // defined(BOOST_ASIO_HAS_BOOST_CONFIG) && defined(BOOST_MSVC)
77#endif // !defined(BOOST_ASIO_MSVC)
78
79// Clang / libc++ detection.
80#if defined(__clang__)
81# if (__cplusplus >= 201103)
82# if __has_include(<__config>)
83# include <__config>
84# if defined(_LIBCPP_VERSION)
85# define BOOST_ASIO_HAS_CLANG_LIBCXX 1
86# endif // defined(_LIBCPP_VERSION)
87# endif // __has_include(<__config>)
88# endif // (__cplusplus >= 201103)
89#endif // defined(__clang__)
90
91// Android platform detection.
92#if defined(__ANDROID__)
93# include <android/api-level.h>
94#endif // defined(__ANDROID__)
95
96// Always enabled. Retained for backwards compatibility in user code.
97#if !defined(BOOST_ASIO_DISABLE_CXX11_MACROS)
98# define BOOST_ASIO_HAS_MOVE 1
99# define BOOST_ASIO_MOVE_ARG(type) type&&
100# define BOOST_ASIO_MOVE_ARG2(type1, type2) type1, type2&&
101# define BOOST_ASIO_NONDEDUCED_MOVE_ARG(type) type&
102# define BOOST_ASIO_MOVE_CAST(type) static_cast<type&&>
103# define BOOST_ASIO_MOVE_CAST2(type1, type2) static_cast<type1, type2&&>
104# define BOOST_ASIO_MOVE_OR_LVALUE(type) static_cast<type&&>
105# define BOOST_ASIO_MOVE_OR_LVALUE_ARG(type) type&&
106# define BOOST_ASIO_MOVE_OR_LVALUE_TYPE(type) type
107# define BOOST_ASIO_DELETED = delete
108# define BOOST_ASIO_HAS_VARIADIC_TEMPLATES 1
109# define BOOST_ASIO_HAS_CONSTEXPR 1
110# define BOOST_ASIO_STATIC_CONSTEXPR(type, assignment) \
111 static constexpr type assignment
112# define BOOST_ASIO_HAS_NOEXCEPT 1
113# define BOOST_ASIO_NOEXCEPT noexcept(true)
114# define BOOST_ASIO_NOEXCEPT_OR_NOTHROW noexcept(true)
115# define BOOST_ASIO_NOEXCEPT_IF(c) noexcept(c)
116# define BOOST_ASIO_HAS_DECLTYPE 1
117# define BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX(t) auto
118# define BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX2(t0, t1) auto
119# define BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX3(t0, t1, t2) auto
120# define BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX(expr) -> decltype expr
121# define BOOST_ASIO_HAS_ALIAS_TEMPLATES 1
122# define BOOST_ASIO_HAS_DEFAULT_FUNCTION_TEMPLATE_ARGUMENTS 1
123# define BOOST_ASIO_HAS_ENUM_CLASS 1
124# define BOOST_ASIO_HAS_REF_QUALIFIED_FUNCTIONS 1
125# define BOOST_ASIO_LVALUE_REF_QUAL &
126# define BOOST_ASIO_RVALUE_REF_QUAL &&
127# define BOOST_ASIO_HAS_USER_DEFINED_LITERALS 1
128# define BOOST_ASIO_HAS_ALIGNOF 1
129# define BOOST_ASIO_ALIGNOF(T) alignof(T)
130# define BOOST_ASIO_HAS_STD_ALIGN 1
131# define BOOST_ASIO_HAS_STD_SYSTEM_ERROR 1
132# define BOOST_ASIO_ERROR_CATEGORY_NOEXCEPT noexcept(true)
133# define BOOST_ASIO_HAS_STD_ARRAY 1
134# define BOOST_ASIO_HAS_STD_SHARED_PTR 1
135# define BOOST_ASIO_HAS_STD_ALLOCATOR_ARG 1
136# define BOOST_ASIO_HAS_STD_ATOMIC 1
137# define BOOST_ASIO_HAS_STD_CHRONO 1
138# define BOOST_ASIO_HAS_STD_ADDRESSOF 1
139# define BOOST_ASIO_HAS_STD_FUNCTION 1
140# define BOOST_ASIO_HAS_STD_REFERENCE_WRAPPER 1
141# define BOOST_ASIO_HAS_STD_TYPE_TRAITS 1
142# define BOOST_ASIO_HAS_NULLPTR 1
143# define BOOST_ASIO_HAS_CXX11_ALLOCATORS 1
144# define BOOST_ASIO_HAS_CSTDINT 1
145# define BOOST_ASIO_HAS_STD_THREAD 1
146# define BOOST_ASIO_HAS_STD_MUTEX_AND_CONDVAR 1
147# define BOOST_ASIO_HAS_STD_CALL_ONCE 1
148# define BOOST_ASIO_HAS_STD_FUTURE 1
149# define BOOST_ASIO_HAS_STD_TUPLE 1
150# define BOOST_ASIO_HAS_STD_IOSTREAM_MOVE 1
151# define BOOST_ASIO_HAS_STD_EXCEPTION_PTR 1
152# define BOOST_ASIO_HAS_STD_NESTED_EXCEPTION 1
153# define BOOST_ASIO_HAS_STD_HASH 1
154#endif // !defined(BOOST_ASIO_DISABLE_CXX11_MACROS)
155
156// Support for static constexpr with default initialisation.
157#if !defined(BOOST_ASIO_STATIC_CONSTEXPR_DEFAULT_INIT)
158# if defined(__GNUC__)
159# if (__GNUC__ >= 8)
160# define BOOST_ASIO_STATIC_CONSTEXPR_DEFAULT_INIT(type, name) \
161 static constexpr const type name{}
162# else // (__GNUC__ >= 8)
163# define BOOST_ASIO_STATIC_CONSTEXPR_DEFAULT_INIT(type, name) \
164 static const type name
165# endif // (__GNUC__ >= 8)
166# elif defined(BOOST_ASIO_MSVC)
167# define BOOST_ASIO_STATIC_CONSTEXPR_DEFAULT_INIT(type, name) \
168 static const type name
169# else // defined(BOOST_ASIO_MSVC)
170# define BOOST_ASIO_STATIC_CONSTEXPR_DEFAULT_INIT(type, name) \
171 static constexpr const type name{}
172# endif // defined(BOOST_ASIO_MSVC)
173#endif // !defined(BOOST_ASIO_STATIC_CONSTEXPR_DEFAULT_INIT)
174
175// Support noexcept on function types on compilers known to allow it.
176#if !defined(BOOST_ASIO_HAS_NOEXCEPT_FUNCTION_TYPE)
177# if !defined(BOOST_ASIO_DISABLE_NOEXCEPT_FUNCTION_TYPE)
178# if defined(__clang__)
179# if (__cplusplus >= 202002)
180# define BOOST_ASIO_HAS_NOEXCEPT_FUNCTION_TYPE 1
181# endif // (__cplusplus >= 202002)
182# elif defined(__GNUC__)
183# if (__cplusplus >= 202002)
184# define BOOST_ASIO_HAS_NOEXCEPT_FUNCTION_TYPE 1
185# endif // (__cplusplus >= 202002)
186# elif defined(BOOST_ASIO_MSVC)
187# if (_MSC_VER >= 1900 && _MSVC_LANG >= 202002)
188# define BOOST_ASIO_HAS_NOEXCEPT_FUNCTION_TYPE 1
189# endif // (_MSC_VER >= 1900 && _MSVC_LANG >= 202002)
190# endif // defined(BOOST_ASIO_MSVC)
191# endif // !defined(BOOST_ASIO_DISABLE_NOEXCEPT_FUNCTION_TYPE)
192#endif // !defined(BOOST_ASIO_HAS_NOEXCEPT_FUNCTION_TYPE)
193
194// Support return type deduction on compilers known to allow it.
195#if !defined(BOOST_ASIO_HAS_RETURN_TYPE_DEDUCTION)
196# if !defined(BOOST_ASIO_DISABLE_RETURN_TYPE_DEDUCTION)
197# if defined(__clang__)
198# if __has_feature(__cxx_return_type_deduction__)
199# define BOOST_ASIO_HAS_RETURN_TYPE_DEDUCTION 1
200# endif // __has_feature(__cxx_return_type_deduction__)
201# elif (__cplusplus >= 201402)
202# define BOOST_ASIO_HAS_RETURN_TYPE_DEDUCTION 1
203# elif defined(__cpp_return_type_deduction)
204# if (__cpp_return_type_deduction >= 201304)
205# define BOOST_ASIO_HAS_RETURN_TYPE_DEDUCTION 1
206# endif // (__cpp_return_type_deduction >= 201304)
207# elif defined(BOOST_ASIO_MSVC)
208# if (_MSC_VER >= 1900 && _MSVC_LANG >= 201402)
209# define BOOST_ASIO_HAS_RETURN_TYPE_DEDUCTION 1
210# endif // (_MSC_VER >= 1900 && _MSVC_LANG >= 201402)
211# endif // defined(BOOST_ASIO_MSVC)
212# endif // !defined(BOOST_ASIO_DISABLE_RETURN_TYPE_DEDUCTION)
213#endif // !defined(BOOST_ASIO_HAS_RETURN_TYPE_DEDUCTION)
214
215// Support concepts on compilers known to allow them.
216#if !defined(BOOST_ASIO_HAS_CONCEPTS)
217# if !defined(BOOST_ASIO_DISABLE_CONCEPTS)
218# if defined(__cpp_concepts)
219# define BOOST_ASIO_HAS_CONCEPTS 1
220# if (__cpp_concepts >= 201707)
221# define BOOST_ASIO_CONCEPT concept
222# else // (__cpp_concepts >= 201707)
223# define BOOST_ASIO_CONCEPT concept bool
224# endif // (__cpp_concepts >= 201707)
225# endif // defined(__cpp_concepts)
226# endif // !defined(BOOST_ASIO_DISABLE_CONCEPTS)
227#endif // !defined(BOOST_ASIO_HAS_CONCEPTS)
228
229// Support concepts on compilers known to allow them.
230#if !defined(BOOST_ASIO_HAS_STD_CONCEPTS)
231# if !defined(BOOST_ASIO_DISABLE_STD_CONCEPTS)
232# if defined(BOOST_ASIO_HAS_CONCEPTS)
233# if (__cpp_lib_concepts >= 202002L)
234# define BOOST_ASIO_HAS_STD_CONCEPTS 1
235# endif // (__cpp_concepts >= 202002L)
236# endif // defined(BOOST_ASIO_HAS_CONCEPTS)
237# endif // !defined(BOOST_ASIO_DISABLE_STD_CONCEPTS)
238#endif // !defined(BOOST_ASIO_HAS_STD_CONCEPTS)
239
240// Support template variables on compilers known to allow it.
241#if !defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES)
242# if !defined(BOOST_ASIO_DISABLE_VARIABLE_TEMPLATES)
243# if defined(__clang__)
244# if (__cplusplus >= 201402)
245# if __has_feature(__cxx_variable_templates__)
246# define BOOST_ASIO_HAS_VARIABLE_TEMPLATES 1
247# endif // __has_feature(__cxx_variable_templates__)
248# endif // (__cplusplus >= 201402)
249# elif defined(__GNUC__) && !defined(__INTEL_COMPILER)
250# if (__GNUC__ >= 6)
251# if (__cplusplus >= 201402)
252# define BOOST_ASIO_HAS_VARIABLE_TEMPLATES 1
253# endif // (__cplusplus >= 201402)
254# endif // (__GNUC__ >= 6)
255# endif // defined(__GNUC__) && !defined(__INTEL_COMPILER)
256# if defined(BOOST_ASIO_MSVC)
257# if (_MSC_VER >= 1901)
258# define BOOST_ASIO_HAS_VARIABLE_TEMPLATES 1
259# endif // (_MSC_VER >= 1901)
260# endif // defined(BOOST_ASIO_MSVC)
261# endif // !defined(BOOST_ASIO_DISABLE_VARIABLE_TEMPLATES)
262#endif // !defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES)
263
264// Support SFINAEd template variables on compilers known to allow it.
265#if !defined(BOOST_ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
266# if !defined(BOOST_ASIO_DISABLE_SFINAE_VARIABLE_TEMPLATES)
267# if defined(__clang__)
268# if (__cplusplus >= 201703)
269# if __has_feature(__cxx_variable_templates__)
270# define BOOST_ASIO_HAS_SFINAE_VARIABLE_TEMPLATES 1
271# endif // __has_feature(__cxx_variable_templates__)
272# endif // (__cplusplus >= 201703)
273# elif defined(__GNUC__)
274# if ((__GNUC__ == 8) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 8)
275# if (__cplusplus >= 201402)
276# define BOOST_ASIO_HAS_SFINAE_VARIABLE_TEMPLATES 1
277# endif // (__cplusplus >= 201402)
278# endif // ((__GNUC__ == 8) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 8)
279# endif // defined(__GNUC__)
280# if defined(BOOST_ASIO_MSVC)
281# if (_MSC_VER >= 1901)
282# define BOOST_ASIO_HAS_SFINAE_VARIABLE_TEMPLATES 1
283# endif // (_MSC_VER >= 1901)
284# endif // defined(BOOST_ASIO_MSVC)
285# endif // !defined(BOOST_ASIO_DISABLE_SFINAE_VARIABLE_TEMPLATES)
286#endif // !defined(BOOST_ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
287
288// Support SFINAE use of constant expressions on compilers known to allow it.
289#if !defined(BOOST_ASIO_HAS_CONSTANT_EXPRESSION_SFINAE)
290# if !defined(BOOST_ASIO_DISABLE_CONSTANT_EXPRESSION_SFINAE)
291# if defined(__clang__)
292# if (__cplusplus >= 201402)
293# define BOOST_ASIO_HAS_CONSTANT_EXPRESSION_SFINAE 1
294# endif // (__cplusplus >= 201402)
295# elif defined(__GNUC__) && !defined(__INTEL_COMPILER)
296# if (__GNUC__ >= 7)
297# if (__cplusplus >= 201402)
298# define BOOST_ASIO_HAS_CONSTANT_EXPRESSION_SFINAE 1
299# endif // (__cplusplus >= 201402)
300# endif // (__GNUC__ >= 7)
301# endif // defined(__GNUC__) && !defined(__INTEL_COMPILER)
302# if defined(BOOST_ASIO_MSVC)
303# if (_MSC_VER >= 1901)
304# define BOOST_ASIO_HAS_CONSTANT_EXPRESSION_SFINAE 1
305# endif // (_MSC_VER >= 1901)
306# endif // defined(BOOST_ASIO_MSVC)
307# endif // !defined(BOOST_ASIO_DISABLE_CONSTANT_EXPRESSION_SFINAE)
308#endif // !defined(BOOST_ASIO_HAS_CONSTANT_EXPRESSION_SFINAE)
309
310// Enable workarounds for lack of working expression SFINAE.
311#if !defined(BOOST_ASIO_HAS_WORKING_EXPRESSION_SFINAE)
312# if !defined(BOOST_ASIO_DISABLE_WORKING_EXPRESSION_SFINAE)
313# if !defined(BOOST_ASIO_MSVC) && !defined(__INTEL_COMPILER)
314# if (__cplusplus >= 201103)
315# define BOOST_ASIO_HAS_WORKING_EXPRESSION_SFINAE 1
316# endif // (__cplusplus >= 201103)
317# elif defined(BOOST_ASIO_MSVC) && (_MSC_VER >= 1929)
318# if (_MSVC_LANG >= 202000)
319# define BOOST_ASIO_HAS_WORKING_EXPRESSION_SFINAE 1
320# endif // (_MSVC_LANG >= 202000)
321# endif // defined(BOOST_ASIO_MSVC) && (_MSC_VER >= 1929)
322# endif // !defined(BOOST_ASIO_DISABLE_WORKING_EXPRESSION_SFINAE)
323#endif // !defined(BOOST_ASIO_HAS_WORKING_EXPRESSION_SFINAE)
324
325// Support for capturing parameter packs in lambdas.
326#if !defined(BOOST_ASIO_HAS_VARIADIC_LAMBDA_CAPTURES)
327# if !defined(BOOST_ASIO_DISABLE_VARIADIC_LAMBDA_CAPTURES)
328# if defined(__GNUC__)
329# if (__GNUC__ >= 6)
330# define BOOST_ASIO_HAS_VARIADIC_LAMBDA_CAPTURES 1
331# endif // (__GNUC__ >= 6)
332# elif defined(BOOST_ASIO_MSVC)
333# if (_MSVC_LANG >= 201103)
334# define BOOST_ASIO_HAS_VARIADIC_LAMBDA_CAPTURES 1
335# endif // (_MSC_LANG >= 201103)
336# else // defined(BOOST_ASIO_MSVC)
337# if (__cplusplus >= 201103)
338# define BOOST_ASIO_HAS_VARIADIC_LAMBDA_CAPTURES 1
339# endif // (__cplusplus >= 201103)
340# endif // defined(BOOST_ASIO_MSVC)
341# endif // !defined(BOOST_ASIO_DISABLE_VARIADIC_LAMBDA_CAPTURES)
342#endif // !defined(BOOST_ASIO_HAS_VARIADIC_LAMBDA_CAPTURES)
343
344// Default alignment.
345#if defined(__STDCPP_DEFAULT_NEW_ALIGNMENT__)
346# define BOOST_ASIO_DEFAULT_ALIGN __STDCPP_DEFAULT_NEW_ALIGNMENT__
347#elif defined(__GNUC__)
348# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 9)) || (__GNUC__ > 4)
349# define BOOST_ASIO_DEFAULT_ALIGN alignof(std::max_align_t)
350# else // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 9)) || (__GNUC__ > 4)
351# define BOOST_ASIO_DEFAULT_ALIGN alignof(max_align_t)
352# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 9)) || (__GNUC__ > 4)
353#else // defined(__GNUC__)
354# define BOOST_ASIO_DEFAULT_ALIGN alignof(std::max_align_t)
355#endif // defined(__GNUC__)
356
357// Standard library support for aligned allocation.
358#if !defined(BOOST_ASIO_HAS_STD_ALIGNED_ALLOC)
359# if !defined(BOOST_ASIO_DISABLE_STD_ALIGNED_ALLOC)
360# if (__cplusplus >= 201703)
361# if defined(__clang__)
362# if defined(BOOST_ASIO_HAS_CLANG_LIBCXX)
363# if (_LIBCPP_STD_VER > 14) && defined(_LIBCPP_HAS_ALIGNED_ALLOC) \
364 && !defined(_LIBCPP_MSVCRT) && !defined(__MINGW32__)
365# if defined(__APPLE__)
366# if defined(__MAC_OS_X_VERSION_MIN_REQUIRED)
367# if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 101500)
368# define BOOST_ASIO_HAS_STD_ALIGNED_ALLOC 1
369# endif // (__MAC_OS_X_VERSION_MIN_REQUIRED >= 101500)
370# elif defined(__IPHONE_OS_VERSION_MIN_REQUIRED)
371# if (__IPHONE_OS_VERSION_MIN_REQUIRED >= 130000)
372# define BOOST_ASIO_HAS_STD_ALIGNED_ALLOC 1
373# endif // (__IPHONE_OS_VERSION_MIN_REQUIRED >= 130000)
374# elif defined(__TV_OS_VERSION_MIN_REQUIRED)
375# if (__TV_OS_VERSION_MIN_REQUIRED >= 130000)
376# define BOOST_ASIO_HAS_STD_ALIGNED_ALLOC 1
377# endif // (__TV_OS_VERSION_MIN_REQUIRED >= 130000)
378# elif defined(__WATCH_OS_VERSION_MIN_REQUIRED)
379# if (__WATCH_OS_VERSION_MIN_REQUIRED >= 60000)
380# define BOOST_ASIO_HAS_STD_ALIGNED_ALLOC 1
381# endif // (__WATCH_OS_VERSION_MIN_REQUIRED >= 60000)
382# endif // defined(__WATCH_OS_X_VERSION_MIN_REQUIRED)
383# else // defined(__APPLE__)
384# define BOOST_ASIO_HAS_STD_ALIGNED_ALLOC 1
385# endif // defined(__APPLE__)
386# endif // (_LIBCPP_STD_VER > 14) && defined(_LIBCPP_HAS_ALIGNED_ALLOC)
387 // && !defined(_LIBCPP_MSVCRT) && !defined(__MINGW32__)
388# elif defined(_GLIBCXX_HAVE_ALIGNED_ALLOC)
389# define BOOST_ASIO_HAS_STD_ALIGNED_ALLOC 1
390# endif // defined(_GLIBCXX_HAVE_ALIGNED_ALLOC)
391# elif defined(__GNUC__)
392# if ((__GNUC__ == 7) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 7)
393# if defined(_GLIBCXX_HAVE_ALIGNED_ALLOC)
394# define BOOST_ASIO_HAS_STD_ALIGNED_ALLOC 1
395# endif // defined(_GLIBCXX_HAVE_ALIGNED_ALLOC)
396# endif // ((__GNUC__ == 7) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 7)
397# endif // defined(__GNUC__)
398# endif // (__cplusplus >= 201703)
399# endif // !defined(BOOST_ASIO_DISABLE_STD_ALIGNED_ALLOC)
400#endif // !defined(BOOST_ASIO_HAS_STD_ALIGNED_ALLOC)
401
402// Boost support for chrono.
403#if !defined(BOOST_ASIO_HAS_BOOST_CHRONO)
404# if !defined(BOOST_ASIO_DISABLE_BOOST_CHRONO)
405# if defined(BOOST_ASIO_HAS_BOOST_CONFIG) && (BOOST_VERSION >= 104700)
406# define BOOST_ASIO_HAS_BOOST_CHRONO 1
407# endif // defined(BOOST_ASIO_HAS_BOOST_CONFIG) && (BOOST_VERSION >= 104700)
408# endif // !defined(BOOST_ASIO_DISABLE_BOOST_CHRONO)
409#endif // !defined(BOOST_ASIO_HAS_BOOST_CHRONO)
410
411// Some form of chrono library is available.
412#if !defined(BOOST_ASIO_HAS_CHRONO)
413# if defined(BOOST_ASIO_HAS_STD_CHRONO) \
414 || defined(BOOST_ASIO_HAS_BOOST_CHRONO)
415# define BOOST_ASIO_HAS_CHRONO 1
416# endif // defined(BOOST_ASIO_HAS_STD_CHRONO)
417 // || defined(BOOST_ASIO_HAS_BOOST_CHRONO)
418#endif // !defined(BOOST_ASIO_HAS_CHRONO)
419
420// Boost support for the DateTime library.
421#if !defined(BOOST_ASIO_HAS_BOOST_DATE_TIME)
422# if !defined(BOOST_ASIO_DISABLE_BOOST_DATE_TIME)
423# define BOOST_ASIO_HAS_BOOST_DATE_TIME 1
424# endif // !defined(BOOST_ASIO_DISABLE_BOOST_DATE_TIME)
425#endif // !defined(BOOST_ASIO_HAS_BOOST_DATE_TIME)
426
427// Boost support for the Coroutine library.
428#if !defined(BOOST_ASIO_HAS_BOOST_COROUTINE)
429# if !defined(BOOST_ASIO_DISABLE_BOOST_COROUTINE)
430# define BOOST_ASIO_HAS_BOOST_COROUTINE 1
431# endif // !defined(BOOST_ASIO_DISABLE_BOOST_COROUTINE)
432#endif // !defined(BOOST_ASIO_HAS_BOOST_COROUTINE)
433
434// Boost support for the Context library's fibers.
435#if !defined(BOOST_ASIO_HAS_BOOST_CONTEXT_FIBER)
436# if !defined(BOOST_ASIO_DISABLE_BOOST_CONTEXT_FIBER)
437# if defined(__clang__)
438# if (__cplusplus >= 201103)
439# define BOOST_ASIO_HAS_BOOST_CONTEXT_FIBER 1
440# endif // (__cplusplus >= 201103)
441# elif defined(__GNUC__)
442# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 8)) || (__GNUC__ > 4)
443# if (__cplusplus >= 201103) || defined(__GXX_EXPERIMENTAL_CXX0X__)
444# define BOOST_ASIO_HAS_BOOST_CONTEXT_FIBER 1
445# endif // (__cplusplus >= 201103) || defined(__GXX_EXPERIMENTAL_CXX0X__)
446# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 8)) || (__GNUC__ > 4)
447# endif // defined(__GNUC__)
448# if defined(BOOST_ASIO_MSVC)
449# if (_MSVC_LANG >= 201103)
450# define BOOST_ASIO_HAS_BOOST_CONTEXT_FIBER 1
451# endif // (_MSC_LANG >= 201103)
452# endif // defined(BOOST_ASIO_MSVC)
453# endif // !defined(BOOST_ASIO_DISABLE_BOOST_CONTEXT_FIBER)
454#endif // !defined(BOOST_ASIO_HAS_BOOST_CONTEXT_FIBER)
455
456// Standard library support for std::string_view.
457#if !defined(BOOST_ASIO_HAS_STD_STRING_VIEW)
458# if !defined(BOOST_ASIO_DISABLE_STD_STRING_VIEW)
459# if defined(__clang__)
460# if defined(BOOST_ASIO_HAS_CLANG_LIBCXX)
461# if (__cplusplus >= 201402)
462# if __has_include(<string_view>)
463# define BOOST_ASIO_HAS_STD_STRING_VIEW 1
464# endif // __has_include(<string_view>)
465# endif // (__cplusplus >= 201402)
466# else // defined(BOOST_ASIO_HAS_CLANG_LIBCXX)
467# if (__cplusplus >= 201703)
468# if __has_include(<string_view>)
469# define BOOST_ASIO_HAS_STD_STRING_VIEW 1
470# endif // __has_include(<string_view>)
471# endif // (__cplusplus >= 201703)
472# endif // defined(BOOST_ASIO_HAS_CLANG_LIBCXX)
473# elif defined(__GNUC__)
474# if (__GNUC__ >= 7)
475# if (__cplusplus >= 201703)
476# define BOOST_ASIO_HAS_STD_STRING_VIEW 1
477# endif // (__cplusplus >= 201703)
478# endif // (__GNUC__ >= 7)
479# elif defined(BOOST_ASIO_MSVC)
480# if (_MSC_VER >= 1910 && _MSVC_LANG >= 201703)
481# define BOOST_ASIO_HAS_STD_STRING_VIEW 1
482# endif // (_MSC_VER >= 1910 && _MSVC_LANG >= 201703)
483# endif // defined(BOOST_ASIO_MSVC)
484# endif // !defined(BOOST_ASIO_DISABLE_STD_STRING_VIEW)
485#endif // !defined(BOOST_ASIO_HAS_STD_STRING_VIEW)
486
487// Standard library support for std::experimental::string_view.
488#if !defined(BOOST_ASIO_HAS_STD_EXPERIMENTAL_STRING_VIEW)
489# if !defined(BOOST_ASIO_DISABLE_STD_EXPERIMENTAL_STRING_VIEW)
490# if defined(__clang__)
491# if defined(BOOST_ASIO_HAS_CLANG_LIBCXX)
492# if (_LIBCPP_VERSION < 7000)
493# if (__cplusplus >= 201402)
494# if __has_include(<experimental/string_view>)
495# define BOOST_ASIO_HAS_STD_EXPERIMENTAL_STRING_VIEW 1
496# endif // __has_include(<experimental/string_view>)
497# endif // (__cplusplus >= 201402)
498# endif // (_LIBCPP_VERSION < 7000)
499# else // defined(BOOST_ASIO_HAS_CLANG_LIBCXX)
500# if (__cplusplus >= 201402)
501# if __has_include(<experimental/string_view>)
502# define BOOST_ASIO_HAS_STD_EXPERIMENTAL_STRING_VIEW 1
503# endif // __has_include(<experimental/string_view>)
504# endif // (__cplusplus >= 201402)
505# endif // // defined(BOOST_ASIO_HAS_CLANG_LIBCXX)
506# elif defined(__GNUC__)
507# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 9)) || (__GNUC__ > 4)
508# if (__cplusplus >= 201402)
509# define BOOST_ASIO_HAS_STD_EXPERIMENTAL_STRING_VIEW 1
510# endif // (__cplusplus >= 201402)
511# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 9)) || (__GNUC__ > 4)
512# endif // defined(__GNUC__)
513# endif // !defined(BOOST_ASIO_DISABLE_STD_EXPERIMENTAL_STRING_VIEW)
514#endif // !defined(BOOST_ASIO_HAS_STD_EXPERIMENTAL_STRING_VIEW)
515
516// Standard library has a string_view that we can use.
517#if !defined(BOOST_ASIO_HAS_STRING_VIEW)
518# if !defined(BOOST_ASIO_DISABLE_STRING_VIEW)
519# if defined(BOOST_ASIO_HAS_STD_STRING_VIEW)
520# define BOOST_ASIO_HAS_STRING_VIEW 1
521# elif defined(BOOST_ASIO_HAS_STD_EXPERIMENTAL_STRING_VIEW)
522# define BOOST_ASIO_HAS_STRING_VIEW 1
523# endif // defined(BOOST_ASIO_HAS_STD_EXPERIMENTAL_STRING_VIEW)
524# endif // !defined(BOOST_ASIO_DISABLE_STRING_VIEW)
525#endif // !defined(BOOST_ASIO_HAS_STRING_VIEW)
526
527// Standard library has invoke_result (which supersedes result_of).
528#if !defined(BOOST_ASIO_HAS_STD_INVOKE_RESULT)
529# if !defined(BOOST_ASIO_DISABLE_STD_INVOKE_RESULT)
530# if defined(BOOST_ASIO_MSVC)
531# if (_MSC_VER >= 1911 && _MSVC_LANG >= 201703)
532# define BOOST_ASIO_HAS_STD_INVOKE_RESULT 1
533# endif // (_MSC_VER >= 1911 && _MSVC_LANG >= 201703)
534# else // defined(BOOST_ASIO_MSVC)
535# if (__cplusplus >= 201703)
536# define BOOST_ASIO_HAS_STD_INVOKE_RESULT 1
537# endif // (__cplusplus >= 201703)
538# endif // defined(BOOST_ASIO_MSVC)
539# endif // !defined(BOOST_ASIO_DISABLE_STD_INVOKE_RESULT)
540#endif // !defined(BOOST_ASIO_HAS_STD_INVOKE_RESULT)
541
542// Standard library support for std::any.
543#if !defined(BOOST_ASIO_HAS_STD_ANY)
544# if !defined(BOOST_ASIO_DISABLE_STD_ANY)
545# if defined(__clang__)
546# if (__cplusplus >= 201703)
547# if __has_include(<any>)
548# define BOOST_ASIO_HAS_STD_ANY 1
549# endif // __has_include(<any>)
550# endif // (__cplusplus >= 201703)
551# elif defined(__GNUC__)
552# if (__GNUC__ >= 7)
553# if (__cplusplus >= 201703)
554# define BOOST_ASIO_HAS_STD_ANY 1
555# endif // (__cplusplus >= 201703)
556# endif // (__GNUC__ >= 7)
557# endif // defined(__GNUC__)
558# if defined(BOOST_ASIO_MSVC)
559# if (_MSC_VER >= 1910) && (_MSVC_LANG >= 201703)
560# define BOOST_ASIO_HAS_STD_ANY 1
561# endif // (_MSC_VER >= 1910) && (_MSVC_LANG >= 201703)
562# endif // defined(BOOST_ASIO_MSVC)
563# endif // !defined(BOOST_ASIO_DISABLE_STD_ANY)
564#endif // !defined(BOOST_ASIO_HAS_STD_ANY)
565
566// Standard library support for std::variant.
567#if !defined(BOOST_ASIO_HAS_STD_VARIANT)
568# if !defined(BOOST_ASIO_DISABLE_STD_VARIANT)
569# if defined(__clang__)
570# if (__cplusplus >= 201703)
571# if __has_include(<variant>)
572# define BOOST_ASIO_HAS_STD_VARIANT 1
573# endif // __has_include(<variant>)
574# endif // (__cplusplus >= 201703)
575# elif defined(__GNUC__)
576# if (__GNUC__ >= 7)
577# if (__cplusplus >= 201703)
578# define BOOST_ASIO_HAS_STD_VARIANT 1
579# endif // (__cplusplus >= 201703)
580# endif // (__GNUC__ >= 7)
581# endif // defined(__GNUC__)
582# if defined(BOOST_ASIO_MSVC)
583# if (_MSC_VER >= 1910) && (_MSVC_LANG >= 201703)
584# define BOOST_ASIO_HAS_STD_VARIANT 1
585# endif // (_MSC_VER >= 1910) && (_MSVC_LANG >= 201703)
586# endif // defined(BOOST_ASIO_MSVC)
587# endif // !defined(BOOST_ASIO_DISABLE_STD_VARIANT)
588#endif // !defined(BOOST_ASIO_HAS_STD_VARIANT)
589
590// Standard library support for std::source_location.
591#if !defined(BOOST_ASIO_HAS_STD_SOURCE_LOCATION)
592# if !defined(BOOST_ASIO_DISABLE_STD_SOURCE_LOCATION)
593// ...
594# endif // !defined(BOOST_ASIO_DISABLE_STD_SOURCE_LOCATION)
595#endif // !defined(BOOST_ASIO_HAS_STD_SOURCE_LOCATION)
596
597// Standard library support for std::experimental::source_location.
598#if !defined(BOOST_ASIO_HAS_STD_EXPERIMENTAL_SOURCE_LOCATION)
599# if !defined(BOOST_ASIO_DISABLE_STD_EXPERIMENTAL_SOURCE_LOCATION)
600# if defined(__GNUC__)
601# if (__cplusplus >= 201709)
602# if __has_include(<experimental/source_location>)
603# define BOOST_ASIO_HAS_STD_EXPERIMENTAL_SOURCE_LOCATION 1
604# endif // __has_include(<experimental/source_location>)
605# endif // (__cplusplus >= 201709)
606# endif // defined(__GNUC__)
607# endif // !defined(BOOST_ASIO_DISABLE_STD_EXPERIMENTAL_SOURCE_LOCATION)
608#endif // !defined(BOOST_ASIO_HAS_STD_EXPERIMENTAL_SOURCE_LOCATION)
609
610// Standard library has a source_location that we can use.
611#if !defined(BOOST_ASIO_HAS_SOURCE_LOCATION)
612# if !defined(BOOST_ASIO_DISABLE_SOURCE_LOCATION)
613# if defined(BOOST_ASIO_HAS_STD_SOURCE_LOCATION)
614# define BOOST_ASIO_HAS_SOURCE_LOCATION 1
615# elif defined(BOOST_ASIO_HAS_STD_EXPERIMENTAL_SOURCE_LOCATION)
616# define BOOST_ASIO_HAS_SOURCE_LOCATION 1
617# endif // defined(BOOST_ASIO_HAS_STD_EXPERIMENTAL_SOURCE_LOCATION)
618# endif // !defined(BOOST_ASIO_DISABLE_SOURCE_LOCATION)
619#endif // !defined(BOOST_ASIO_HAS_SOURCE_LOCATION)
620
621// Boost support for source_location and system errors.
622#if !defined(BOOST_ASIO_HAS_BOOST_SOURCE_LOCATION)
623# if !defined(BOOST_ASIO_DISABLE_BOOST_SOURCE_LOCATION)
624# if defined(BOOST_ASIO_HAS_BOOST_CONFIG) && (BOOST_VERSION >= 107900)
625# define BOOST_ASIO_HAS_BOOST_SOURCE_LOCATION 1
626# endif // defined(BOOST_ASIO_HAS_BOOST_CONFIG) && (BOOST_VERSION >= 107900)
627# endif // !defined(BOOST_ASIO_DISABLE_BOOST_SOURCE_LOCATION)
628#endif // !defined(BOOST_ASIO_HAS_BOOST_SOURCE_LOCATION)
629
630// Helper macros for working with Boost source locations.
631#if defined(BOOST_ASIO_HAS_BOOST_SOURCE_LOCATION)
632# define BOOST_ASIO_SOURCE_LOCATION_PARAM \
633 , const boost::source_location& loc
634# define BOOST_ASIO_SOURCE_LOCATION_DEFAULTED_PARAM \
635 , const boost::source_location& loc = BOOST_CURRENT_LOCATION
636# define BOOST_ASIO_SOURCE_LOCATION_ARG , loc
637#else // if defined(BOOST_ASIO_HAS_BOOST_SOURCE_LOCATION)
638# define BOOST_ASIO_SOURCE_LOCATION_PARAM
639# define BOOST_ASIO_SOURCE_LOCATION_DEFAULTED_PARAM
640# define BOOST_ASIO_SOURCE_LOCATION_ARG
641#endif // if defined(BOOST_ASIO_HAS_BOOST_SOURCE_LOCATION)
642
643// Standard library support for std::index_sequence.
644#if !defined(BOOST_ASIO_HAS_STD_INDEX_SEQUENCE)
645# if !defined(BOOST_ASIO_DISABLE_STD_INDEX_SEQUENCE)
646# if defined(__clang__)
647# if (__cplusplus >= 201402)
648# define BOOST_ASIO_HAS_STD_INDEX_SEQUENCE 1
649# endif // (__cplusplus >= 201402)
650# elif defined(__GNUC__)
651# if (__GNUC__ >= 7)
652# if (__cplusplus >= 201402)
653# define BOOST_ASIO_HAS_STD_INDEX_SEQUENCE 1
654# endif // (__cplusplus >= 201402)
655# endif // (__GNUC__ >= 7)
656# endif // defined(__GNUC__)
657# if defined(BOOST_ASIO_MSVC)
658# if (_MSC_VER >= 1910) && (_MSVC_LANG >= 201402)
659# define BOOST_ASIO_HAS_STD_INDEX_SEQUENCE 1
660# endif // (_MSC_VER >= 1910) && (_MSVC_LANG >= 201402)
661# endif // defined(BOOST_ASIO_MSVC)
662# endif // !defined(BOOST_ASIO_DISABLE_STD_INDEX_SEQUENCE)
663#endif // !defined(BOOST_ASIO_HAS_STD_INDEX_SEQUENCE)
664
665// Windows App target. Windows but with a limited API.
666#if !defined(BOOST_ASIO_WINDOWS_APP)
667# if defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0603)
668# include <winapifamily.h>
669# if (WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) \
670 || WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_TV_TITLE)) \
671 && !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
672# define BOOST_ASIO_WINDOWS_APP 1
673# endif // WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
674 // && !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
675# endif // defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0603)
676#endif // !defined(BOOST_ASIO_WINDOWS_APP)
677
678// Legacy WinRT target. Windows App is preferred.
679#if !defined(BOOST_ASIO_WINDOWS_RUNTIME)
680# if !defined(BOOST_ASIO_WINDOWS_APP)
681# if defined(__cplusplus_winrt)
682# include <winapifamily.h>
683# if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) \
684 && !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
685# define BOOST_ASIO_WINDOWS_RUNTIME 1
686# endif // WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
687 // && !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
688# endif // defined(__cplusplus_winrt)
689# endif // !defined(BOOST_ASIO_WINDOWS_APP)
690#endif // !defined(BOOST_ASIO_WINDOWS_RUNTIME)
691
692// Windows target. Excludes WinRT but includes Windows App targets.
693#if !defined(BOOST_ASIO_WINDOWS)
694# if !defined(BOOST_ASIO_WINDOWS_RUNTIME)
695# if defined(BOOST_ASIO_HAS_BOOST_CONFIG) && defined(BOOST_WINDOWS)
696# define BOOST_ASIO_WINDOWS 1
697# elif defined(WIN32) || defined(_WIN32) || defined(__WIN32__)
698# define BOOST_ASIO_WINDOWS 1
699# elif defined(BOOST_ASIO_WINDOWS_APP)
700# define BOOST_ASIO_WINDOWS 1
701# endif // defined(BOOST_ASIO_HAS_BOOST_CONFIG) && defined(BOOST_WINDOWS)
702# endif // !defined(BOOST_ASIO_WINDOWS_RUNTIME)
703#endif // !defined(BOOST_ASIO_WINDOWS)
704
705// Windows: target OS version.
706#if defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__)
707# if !defined(_WIN32_WINNT) && !defined(_WIN32_WINDOWS)
708# if defined(_MSC_VER) || (defined(__BORLANDC__) && !defined(__clang__))
709# pragma message( \
710 "Please define _WIN32_WINNT or _WIN32_WINDOWS appropriately. For example:\n"\
711 "- add -D_WIN32_WINNT=0x0601 to the compiler command line; or\n"\
712 "- add _WIN32_WINNT=0x0601 to your project's Preprocessor Definitions.\n"\
713 "Assuming _WIN32_WINNT=0x0601 (i.e. Windows 7 target).")
714# else // defined(_MSC_VER) || (defined(__BORLANDC__) && !defined(__clang__))
715# warning Please define _WIN32_WINNT or _WIN32_WINDOWS appropriately.
716# warning For example, add -D_WIN32_WINNT=0x0601 to the compiler command line.
717# warning Assuming _WIN32_WINNT=0x0601 (i.e. Windows 7 target).
718# endif // defined(_MSC_VER) || (defined(__BORLANDC__) && !defined(__clang__))
719# define _WIN32_WINNT 0x0601
720# endif // !defined(_WIN32_WINNT) && !defined(_WIN32_WINDOWS)
721# if defined(_MSC_VER)
722# if defined(_WIN32) && !defined(WIN32)
723# if !defined(_WINSOCK2API_)
724# define WIN32 // Needed for correct types in winsock2.h
725# else // !defined(_WINSOCK2API_)
726# error Please define the macro WIN32 in your compiler options
727# endif // !defined(_WINSOCK2API_)
728# endif // defined(_WIN32) && !defined(WIN32)
729# endif // defined(_MSC_VER)
730# if defined(__BORLANDC__)
731# if defined(__WIN32__) && !defined(WIN32)
732# if !defined(_WINSOCK2API_)
733# define WIN32 // Needed for correct types in winsock2.h
734# else // !defined(_WINSOCK2API_)
735# error Please define the macro WIN32 in your compiler options
736# endif // !defined(_WINSOCK2API_)
737# endif // defined(__WIN32__) && !defined(WIN32)
738# endif // defined(__BORLANDC__)
739# if defined(__CYGWIN__)
740# if !defined(__USE_W32_SOCKETS)
741# error You must add -D__USE_W32_SOCKETS to your compiler options.
742# endif // !defined(__USE_W32_SOCKETS)
743# endif // defined(__CYGWIN__)
744#endif // defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__)
745
746// Windows: minimise header inclusion.
747#if defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__)
748# if !defined(BOOST_ASIO_NO_WIN32_LEAN_AND_MEAN)
749# if !defined(WIN32_LEAN_AND_MEAN)
750# define WIN32_LEAN_AND_MEAN
751# endif // !defined(WIN32_LEAN_AND_MEAN)
752# endif // !defined(BOOST_ASIO_NO_WIN32_LEAN_AND_MEAN)
753#endif // defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__)
754
755// Windows: suppress definition of "min" and "max" macros.
756#if defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__)
757# if !defined(BOOST_ASIO_NO_NOMINMAX)
758# if !defined(NOMINMAX)
759# define NOMINMAX 1
760# endif // !defined(NOMINMAX)
761# endif // !defined(BOOST_ASIO_NO_NOMINMAX)
762#endif // defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__)
763
764// Windows: IO Completion Ports.
765#if !defined(BOOST_ASIO_HAS_IOCP)
766# if defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__)
767# if defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0400)
768# if !defined(UNDER_CE) && !defined(BOOST_ASIO_WINDOWS_APP)
769# if !defined(BOOST_ASIO_DISABLE_IOCP)
770# define BOOST_ASIO_HAS_IOCP 1
771# endif // !defined(BOOST_ASIO_DISABLE_IOCP)
772# endif // !defined(UNDER_CE) && !defined(BOOST_ASIO_WINDOWS_APP)
773# endif // defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0400)
774# endif // defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__)
775#endif // !defined(BOOST_ASIO_HAS_IOCP)
776
777// On POSIX (and POSIX-like) platforms we need to include unistd.h in order to
778// get access to the various platform feature macros, e.g. to be able to test
779// for threads support.
780#if !defined(BOOST_ASIO_HAS_UNISTD_H)
781# if !defined(BOOST_ASIO_HAS_BOOST_CONFIG)
782# if defined(unix) \
783 || defined(__unix) \
784 || defined(_XOPEN_SOURCE) \
785 || defined(_POSIX_SOURCE) \
786 || (defined(__MACH__) && defined(__APPLE__)) \
787 || defined(__FreeBSD__) \
788 || defined(__NetBSD__) \
789 || defined(__OpenBSD__) \
790 || defined(__linux__) \
791 || defined(__HAIKU__)
792# define BOOST_ASIO_HAS_UNISTD_H 1
793# endif
794# endif // !defined(BOOST_ASIO_HAS_BOOST_CONFIG)
795#endif // !defined(BOOST_ASIO_HAS_UNISTD_H)
796#if defined(BOOST_ASIO_HAS_UNISTD_H)
797# include <unistd.h>
798#endif // defined(BOOST_ASIO_HAS_UNISTD_H)
799
800// Linux: epoll, eventfd, timerfd and io_uring.
801#if defined(__linux__)
802# include <linux/version.h>
803# if !defined(BOOST_ASIO_HAS_EPOLL)
804# if !defined(BOOST_ASIO_DISABLE_EPOLL)
805# if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,45)
806# define BOOST_ASIO_HAS_EPOLL 1
807# endif // LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,45)
808# endif // !defined(BOOST_ASIO_DISABLE_EPOLL)
809# endif // !defined(BOOST_ASIO_HAS_EPOLL)
810# if !defined(BOOST_ASIO_HAS_EVENTFD)
811# if !defined(BOOST_ASIO_DISABLE_EVENTFD)
812# if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
813# define BOOST_ASIO_HAS_EVENTFD 1
814# endif // LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
815# endif // !defined(BOOST_ASIO_DISABLE_EVENTFD)
816# endif // !defined(BOOST_ASIO_HAS_EVENTFD)
817# if !defined(BOOST_ASIO_HAS_TIMERFD)
818# if defined(BOOST_ASIO_HAS_EPOLL)
819# if (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 8)
820# define BOOST_ASIO_HAS_TIMERFD 1
821# endif // (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 8)
822# endif // defined(BOOST_ASIO_HAS_EPOLL)
823# endif // !defined(BOOST_ASIO_HAS_TIMERFD)
824# if defined(BOOST_ASIO_HAS_IO_URING)
825# if LINUX_VERSION_CODE < KERNEL_VERSION(5,10,0)
826# error Linux kernel 5.10 or later is required to support io_uring
827# endif // LINUX_VERSION_CODE < KERNEL_VERSION(5,10,0)
828# endif // defined(BOOST_ASIO_HAS_IO_URING)
829#endif // defined(__linux__)
830
831// Linux: io_uring is used instead of epoll.
832#if !defined(BOOST_ASIO_HAS_IO_URING_AS_DEFAULT)
833# if !defined(BOOST_ASIO_HAS_EPOLL) && defined(BOOST_ASIO_HAS_IO_URING)
834# define BOOST_ASIO_HAS_IO_URING_AS_DEFAULT 1
835# endif // !defined(BOOST_ASIO_HAS_EPOLL) && defined(BOOST_ASIO_HAS_IO_URING)
836#endif // !defined(BOOST_ASIO_HAS_IO_URING_AS_DEFAULT)
837
838// Mac OS X, FreeBSD, NetBSD, OpenBSD: kqueue.
839#if (defined(__MACH__) && defined(__APPLE__)) \
840 || defined(__FreeBSD__) \
841 || defined(__NetBSD__) \
842 || defined(__OpenBSD__)
843# if !defined(BOOST_ASIO_HAS_KQUEUE)
844# if !defined(BOOST_ASIO_DISABLE_KQUEUE)
845# define BOOST_ASIO_HAS_KQUEUE 1
846# endif // !defined(BOOST_ASIO_DISABLE_KQUEUE)
847# endif // !defined(BOOST_ASIO_HAS_KQUEUE)
848#endif // (defined(__MACH__) && defined(__APPLE__))
849 // || defined(__FreeBSD__)
850 // || defined(__NetBSD__)
851 // || defined(__OpenBSD__)
852
853// Solaris: /dev/poll.
854#if defined(__sun)
855# if !defined(BOOST_ASIO_HAS_DEV_POLL)
856# if !defined(BOOST_ASIO_DISABLE_DEV_POLL)
857# define BOOST_ASIO_HAS_DEV_POLL 1
858# endif // !defined(BOOST_ASIO_DISABLE_DEV_POLL)
859# endif // !defined(BOOST_ASIO_HAS_DEV_POLL)
860#endif // defined(__sun)
861
862// Serial ports.
863#if !defined(BOOST_ASIO_HAS_SERIAL_PORT)
864# if defined(BOOST_ASIO_HAS_IOCP) \
865 || !defined(BOOST_ASIO_WINDOWS) \
866 && !defined(BOOST_ASIO_WINDOWS_RUNTIME) \
867 && !defined(__CYGWIN__)
868# if !defined(__SYMBIAN32__)
869# if !defined(BOOST_ASIO_DISABLE_SERIAL_PORT)
870# define BOOST_ASIO_HAS_SERIAL_PORT 1
871# endif // !defined(BOOST_ASIO_DISABLE_SERIAL_PORT)
872# endif // !defined(__SYMBIAN32__)
873# endif // defined(BOOST_ASIO_HAS_IOCP)
874 // || !defined(BOOST_ASIO_WINDOWS)
875 // && !defined(BOOST_ASIO_WINDOWS_RUNTIME)
876 // && !defined(__CYGWIN__)
877#endif // !defined(BOOST_ASIO_HAS_SERIAL_PORT)
878
879// Windows: stream handles.
880#if !defined(BOOST_ASIO_HAS_WINDOWS_STREAM_HANDLE)
881# if !defined(BOOST_ASIO_DISABLE_WINDOWS_STREAM_HANDLE)
882# if defined(BOOST_ASIO_HAS_IOCP)
883# define BOOST_ASIO_HAS_WINDOWS_STREAM_HANDLE 1
884# endif // defined(BOOST_ASIO_HAS_IOCP)
885# endif // !defined(BOOST_ASIO_DISABLE_WINDOWS_STREAM_HANDLE)
886#endif // !defined(BOOST_ASIO_HAS_WINDOWS_STREAM_HANDLE)
887
888// Windows: random access handles.
889#if !defined(BOOST_ASIO_HAS_WINDOWS_RANDOM_ACCESS_HANDLE)
890# if !defined(BOOST_ASIO_DISABLE_WINDOWS_RANDOM_ACCESS_HANDLE)
891# if defined(BOOST_ASIO_HAS_IOCP)
892# define BOOST_ASIO_HAS_WINDOWS_RANDOM_ACCESS_HANDLE 1
893# endif // defined(BOOST_ASIO_HAS_IOCP)
894# endif // !defined(BOOST_ASIO_DISABLE_WINDOWS_RANDOM_ACCESS_HANDLE)
895#endif // !defined(BOOST_ASIO_HAS_WINDOWS_RANDOM_ACCESS_HANDLE)
896
897// Windows: object handles.
898#if !defined(BOOST_ASIO_HAS_WINDOWS_OBJECT_HANDLE)
899# if !defined(BOOST_ASIO_DISABLE_WINDOWS_OBJECT_HANDLE)
900# if defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__)
901# if !defined(UNDER_CE) && !defined(BOOST_ASIO_WINDOWS_APP)
902# define BOOST_ASIO_HAS_WINDOWS_OBJECT_HANDLE 1
903# endif // !defined(UNDER_CE) && !defined(BOOST_ASIO_WINDOWS_APP)
904# endif // defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__)
905# endif // !defined(BOOST_ASIO_DISABLE_WINDOWS_OBJECT_HANDLE)
906#endif // !defined(BOOST_ASIO_HAS_WINDOWS_OBJECT_HANDLE)
907
908// Windows: OVERLAPPED wrapper.
909#if !defined(BOOST_ASIO_HAS_WINDOWS_OVERLAPPED_PTR)
910# if !defined(BOOST_ASIO_DISABLE_WINDOWS_OVERLAPPED_PTR)
911# if defined(BOOST_ASIO_HAS_IOCP)
912# define BOOST_ASIO_HAS_WINDOWS_OVERLAPPED_PTR 1
913# endif // defined(BOOST_ASIO_HAS_IOCP)
914# endif // !defined(BOOST_ASIO_DISABLE_WINDOWS_OVERLAPPED_PTR)
915#endif // !defined(BOOST_ASIO_HAS_WINDOWS_OVERLAPPED_PTR)
916
917// POSIX: stream-oriented file descriptors.
918#if !defined(BOOST_ASIO_HAS_POSIX_STREAM_DESCRIPTOR)
919# if !defined(BOOST_ASIO_DISABLE_POSIX_STREAM_DESCRIPTOR)
920# if !defined(BOOST_ASIO_WINDOWS) \
921 && !defined(BOOST_ASIO_WINDOWS_RUNTIME) \
922 && !defined(__CYGWIN__)
923# define BOOST_ASIO_HAS_POSIX_STREAM_DESCRIPTOR 1
924# endif // !defined(BOOST_ASIO_WINDOWS)
925 // && !defined(BOOST_ASIO_WINDOWS_RUNTIME)
926 // && !defined(__CYGWIN__)
927# endif // !defined(BOOST_ASIO_DISABLE_POSIX_STREAM_DESCRIPTOR)
928#endif // !defined(BOOST_ASIO_HAS_POSIX_STREAM_DESCRIPTOR)
929
930// UNIX domain sockets.
931#if !defined(BOOST_ASIO_HAS_LOCAL_SOCKETS)
932# if !defined(BOOST_ASIO_DISABLE_LOCAL_SOCKETS)
933# if !defined(BOOST_ASIO_WINDOWS_RUNTIME)
934# define BOOST_ASIO_HAS_LOCAL_SOCKETS 1
935# endif // !defined(BOOST_ASIO_WINDOWS_RUNTIME)
936# endif // !defined(BOOST_ASIO_DISABLE_LOCAL_SOCKETS)
937#endif // !defined(BOOST_ASIO_HAS_LOCAL_SOCKETS)
938
939// Files.
940#if !defined(BOOST_ASIO_HAS_FILE)
941# if !defined(BOOST_ASIO_DISABLE_FILE)
942# if defined(BOOST_ASIO_HAS_WINDOWS_RANDOM_ACCESS_HANDLE)
943# define BOOST_ASIO_HAS_FILE 1
944# elif defined(BOOST_ASIO_HAS_IO_URING)
945# define BOOST_ASIO_HAS_FILE 1
946# endif // defined(BOOST_ASIO_HAS_IO_URING)
947# endif // !defined(BOOST_ASIO_DISABLE_FILE)
948#endif // !defined(BOOST_ASIO_HAS_FILE)
949
950// Pipes.
951#if !defined(BOOST_ASIO_HAS_PIPE)
952# if defined(BOOST_ASIO_HAS_IOCP) \
953 || !defined(BOOST_ASIO_WINDOWS) \
954 && !defined(BOOST_ASIO_WINDOWS_RUNTIME) \
955 && !defined(__CYGWIN__)
956# if !defined(__SYMBIAN32__)
957# if !defined(BOOST_ASIO_DISABLE_PIPE)
958# define BOOST_ASIO_HAS_PIPE 1
959# endif // !defined(BOOST_ASIO_DISABLE_PIPE)
960# endif // !defined(__SYMBIAN32__)
961# endif // defined(BOOST_ASIO_HAS_IOCP)
962 // || !defined(BOOST_ASIO_WINDOWS)
963 // && !defined(BOOST_ASIO_WINDOWS_RUNTIME)
964 // && !defined(__CYGWIN__)
965#endif // !defined(BOOST_ASIO_HAS_PIPE)
966
967// Can use sigaction() instead of signal().
968#if !defined(BOOST_ASIO_HAS_SIGACTION)
969# if !defined(BOOST_ASIO_DISABLE_SIGACTION)
970# if !defined(BOOST_ASIO_WINDOWS) \
971 && !defined(BOOST_ASIO_WINDOWS_RUNTIME) \
972 && !defined(__CYGWIN__)
973# define BOOST_ASIO_HAS_SIGACTION 1
974# endif // !defined(BOOST_ASIO_WINDOWS)
975 // && !defined(BOOST_ASIO_WINDOWS_RUNTIME)
976 // && !defined(__CYGWIN__)
977# endif // !defined(BOOST_ASIO_DISABLE_SIGACTION)
978#endif // !defined(BOOST_ASIO_HAS_SIGACTION)
979
980// Can use signal().
981#if !defined(BOOST_ASIO_HAS_SIGNAL)
982# if !defined(BOOST_ASIO_DISABLE_SIGNAL)
983# if !defined(UNDER_CE)
984# define BOOST_ASIO_HAS_SIGNAL 1
985# endif // !defined(UNDER_CE)
986# endif // !defined(BOOST_ASIO_DISABLE_SIGNAL)
987#endif // !defined(BOOST_ASIO_HAS_SIGNAL)
988
989// Can use getaddrinfo() and getnameinfo().
990#if !defined(BOOST_ASIO_HAS_GETADDRINFO)
991# if !defined(BOOST_ASIO_DISABLE_GETADDRINFO)
992# if defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__)
993# if defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0501)
994# define BOOST_ASIO_HAS_GETADDRINFO 1
995# elif defined(UNDER_CE)
996# define BOOST_ASIO_HAS_GETADDRINFO 1
997# endif // defined(UNDER_CE)
998# elif defined(__MACH__) && defined(__APPLE__)
999# if defined(__MAC_OS_X_VERSION_MIN_REQUIRED)
1000# if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050)
1001# define BOOST_ASIO_HAS_GETADDRINFO 1
1002# endif // (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050)
1003# else // defined(__MAC_OS_X_VERSION_MIN_REQUIRED)
1004# define BOOST_ASIO_HAS_GETADDRINFO 1
1005# endif // defined(__MAC_OS_X_VERSION_MIN_REQUIRED)
1006# else // defined(__MACH__) && defined(__APPLE__)
1007# define BOOST_ASIO_HAS_GETADDRINFO 1
1008# endif // defined(__MACH__) && defined(__APPLE__)
1009# endif // !defined(BOOST_ASIO_DISABLE_GETADDRINFO)
1010#endif // !defined(BOOST_ASIO_HAS_GETADDRINFO)
1011
1012// Whether standard iostreams are disabled.
1013#if !defined(BOOST_ASIO_NO_IOSTREAM)
1014# if defined(BOOST_ASIO_HAS_BOOST_CONFIG) && defined(BOOST_NO_IOSTREAM)
1015# define BOOST_ASIO_NO_IOSTREAM 1
1016# endif // !defined(BOOST_NO_IOSTREAM)
1017#endif // !defined(BOOST_ASIO_NO_IOSTREAM)
1018
1019// Whether exception handling is disabled.
1020#if !defined(BOOST_ASIO_NO_EXCEPTIONS)
1021# if defined(BOOST_ASIO_HAS_BOOST_CONFIG) && defined(BOOST_NO_EXCEPTIONS)
1022# define BOOST_ASIO_NO_EXCEPTIONS 1
1023# endif // !defined(BOOST_NO_EXCEPTIONS)
1024#endif // !defined(BOOST_ASIO_NO_EXCEPTIONS)
1025
1026// Whether the typeid operator is supported.
1027#if !defined(BOOST_ASIO_NO_TYPEID)
1028# if defined(BOOST_ASIO_HAS_BOOST_CONFIG) && defined(BOOST_NO_TYPEID)
1029# define BOOST_ASIO_NO_TYPEID 1
1030# endif // !defined(BOOST_NO_TYPEID)
1031#endif // !defined(BOOST_ASIO_NO_TYPEID)
1032
1033// Threads.
1034#if !defined(BOOST_ASIO_HAS_THREADS)
1035# if !defined(BOOST_ASIO_DISABLE_THREADS)
1036# if defined(BOOST_ASIO_HAS_BOOST_CONFIG) && defined(BOOST_HAS_THREADS)
1037# define BOOST_ASIO_HAS_THREADS 1
1038# elif defined(__GNUC__) && !defined(__MINGW32__) \
1039 && !defined(linux) && !defined(__linux) && !defined(__linux__)
1040# define BOOST_ASIO_HAS_THREADS 1
1041# elif defined(_MT) || defined(__MT__)
1042# define BOOST_ASIO_HAS_THREADS 1
1043# elif defined(_REENTRANT)
1044# define BOOST_ASIO_HAS_THREADS 1
1045# elif defined(__APPLE__)
1046# define BOOST_ASIO_HAS_THREADS 1
1047# elif defined(__HAIKU__)
1048# define BOOST_ASIO_HAS_THREADS 1
1049# elif defined(_POSIX_THREADS) && (_POSIX_THREADS + 0 >= 0)
1050# define BOOST_ASIO_HAS_THREADS 1
1051# elif defined(_PTHREADS)
1052# define BOOST_ASIO_HAS_THREADS 1
1053# endif // defined(BOOST_ASIO_HAS_BOOST_CONFIG) && defined(BOOST_HAS_THREADS)
1054# endif // !defined(BOOST_ASIO_DISABLE_THREADS)
1055#endif // !defined(BOOST_ASIO_HAS_THREADS)
1056
1057// POSIX threads.
1058#if !defined(BOOST_ASIO_HAS_PTHREADS)
1059# if defined(BOOST_ASIO_HAS_THREADS)
1060# if defined(BOOST_ASIO_HAS_BOOST_CONFIG) && defined(BOOST_HAS_PTHREADS)
1061# define BOOST_ASIO_HAS_PTHREADS 1
1062# elif defined(_POSIX_THREADS) && (_POSIX_THREADS + 0 >= 0)
1063# define BOOST_ASIO_HAS_PTHREADS 1
1064# elif defined(__HAIKU__)
1065# define BOOST_ASIO_HAS_PTHREADS 1
1066# endif // defined(BOOST_ASIO_HAS_BOOST_CONFIG) && defined(BOOST_HAS_PTHREADS)
1067# endif // defined(BOOST_ASIO_HAS_THREADS)
1068#endif // !defined(BOOST_ASIO_HAS_PTHREADS)
1069
1070// Helper to prevent macro expansion.
1071#define BOOST_ASIO_PREVENT_MACRO_SUBSTITUTION
1072
1073// Helper to define in-class constants.
1074#if !defined(BOOST_ASIO_STATIC_CONSTANT)
1075# if !defined(BOOST_ASIO_DISABLE_BOOST_STATIC_CONSTANT)
1076# define BOOST_ASIO_STATIC_CONSTANT(type, assignment) \
1077 BOOST_STATIC_CONSTANT(type, assignment)
1078# else // !defined(BOOST_ASIO_DISABLE_BOOST_STATIC_CONSTANT)
1079# define BOOST_ASIO_STATIC_CONSTANT(type, assignment) \
1080 static const type assignment
1081# endif // !defined(BOOST_ASIO_DISABLE_BOOST_STATIC_CONSTANT)
1082#endif // !defined(BOOST_ASIO_STATIC_CONSTANT)
1083
1084// Boost align library.
1085#if !defined(BOOST_ASIO_HAS_BOOST_ALIGN)
1086# if !defined(BOOST_ASIO_DISABLE_BOOST_ALIGN)
1087# if defined(BOOST_ASIO_HAS_BOOST_CONFIG) && (BOOST_VERSION >= 105600)
1088# define BOOST_ASIO_HAS_BOOST_ALIGN 1
1089# endif // defined(BOOST_ASIO_HAS_BOOST_CONFIG) && (BOOST_VERSION >= 105600)
1090# endif // !defined(BOOST_ASIO_DISABLE_BOOST_ALIGN)
1091#endif // !defined(BOOST_ASIO_HAS_BOOST_ALIGN)
1092
1093// Boost array library.
1094#if !defined(BOOST_ASIO_HAS_BOOST_ARRAY)
1095# if !defined(BOOST_ASIO_DISABLE_BOOST_ARRAY)
1096# define BOOST_ASIO_HAS_BOOST_ARRAY 1
1097# endif // !defined(BOOST_ASIO_DISABLE_BOOST_ARRAY)
1098#endif // !defined(BOOST_ASIO_HAS_BOOST_ARRAY)
1099
1100// Boost assert macro.
1101#if !defined(BOOST_ASIO_HAS_BOOST_ASSERT)
1102# if !defined(BOOST_ASIO_DISABLE_BOOST_ASSERT)
1103# define BOOST_ASIO_HAS_BOOST_ASSERT 1
1104# endif // !defined(BOOST_ASIO_DISABLE_BOOST_ASSERT)
1105#endif // !defined(BOOST_ASIO_HAS_BOOST_ASSERT)
1106
1107// Boost limits header.
1108#if !defined(BOOST_ASIO_HAS_BOOST_LIMITS)
1109# if !defined(BOOST_ASIO_DISABLE_BOOST_LIMITS)
1110# define BOOST_ASIO_HAS_BOOST_LIMITS 1
1111# endif // !defined(BOOST_ASIO_DISABLE_BOOST_LIMITS)
1112#endif // !defined(BOOST_ASIO_HAS_BOOST_LIMITS)
1113
1114// Boost throw_exception function.
1115#if !defined(BOOST_ASIO_HAS_BOOST_THROW_EXCEPTION)
1116# if !defined(BOOST_ASIO_DISABLE_BOOST_THROW_EXCEPTION)
1117# define BOOST_ASIO_HAS_BOOST_THROW_EXCEPTION 1
1118# endif // !defined(BOOST_ASIO_DISABLE_BOOST_THROW_EXCEPTION)
1119#endif // !defined(BOOST_ASIO_HAS_BOOST_THROW_EXCEPTION)
1120
1121// Boost regex library.
1122#if !defined(BOOST_ASIO_HAS_BOOST_REGEX)
1123# if !defined(BOOST_ASIO_DISABLE_BOOST_REGEX)
1124# define BOOST_ASIO_HAS_BOOST_REGEX 1
1125# endif // !defined(BOOST_ASIO_DISABLE_BOOST_REGEX)
1126#endif // !defined(BOOST_ASIO_HAS_BOOST_REGEX)
1127
1128// Boost bind function.
1129#if !defined(BOOST_ASIO_HAS_BOOST_BIND)
1130# if !defined(BOOST_ASIO_DISABLE_BOOST_BIND)
1131# define BOOST_ASIO_HAS_BOOST_BIND 1
1132# endif // !defined(BOOST_ASIO_DISABLE_BOOST_BIND)
1133#endif // !defined(BOOST_ASIO_HAS_BOOST_BIND)
1134
1135// Boost's BOOST_WORKAROUND macro.
1136#if !defined(BOOST_ASIO_HAS_BOOST_WORKAROUND)
1137# if !defined(BOOST_ASIO_DISABLE_BOOST_WORKAROUND)
1138# define BOOST_ASIO_HAS_BOOST_WORKAROUND 1
1139# endif // !defined(BOOST_ASIO_DISABLE_BOOST_WORKAROUND)
1140#endif // !defined(BOOST_ASIO_HAS_BOOST_WORKAROUND)
1141
1142// Microsoft Visual C++'s secure C runtime library.
1143#if !defined(BOOST_ASIO_HAS_SECURE_RTL)
1144# if !defined(BOOST_ASIO_DISABLE_SECURE_RTL)
1145# if defined(BOOST_ASIO_MSVC) \
1146 && (BOOST_ASIO_MSVC >= 1400) \
1147 && !defined(UNDER_CE)
1148# define BOOST_ASIO_HAS_SECURE_RTL 1
1149# endif // defined(BOOST_ASIO_MSVC)
1150 // && (BOOST_ASIO_MSVC >= 1400)
1151 // && !defined(UNDER_CE)
1152# endif // !defined(BOOST_ASIO_DISABLE_SECURE_RTL)
1153#endif // !defined(BOOST_ASIO_HAS_SECURE_RTL)
1154
1155// Handler hooking. Disabled for ancient Borland C++ and gcc compilers.
1156#if !defined(BOOST_ASIO_HAS_HANDLER_HOOKS)
1157# if !defined(BOOST_ASIO_DISABLE_HANDLER_HOOKS)
1158# if defined(__GNUC__)
1159# if (__GNUC__ >= 3)
1160# define BOOST_ASIO_HAS_HANDLER_HOOKS 1
1161# endif // (__GNUC__ >= 3)
1162# elif !defined(__BORLANDC__) || defined(__clang__)
1163# define BOOST_ASIO_HAS_HANDLER_HOOKS 1
1164# endif // !defined(__BORLANDC__) || defined(__clang__)
1165# endif // !defined(BOOST_ASIO_DISABLE_HANDLER_HOOKS)
1166#endif // !defined(BOOST_ASIO_HAS_HANDLER_HOOKS)
1167
1168// Support for the __thread keyword extension, or equivalent.
1169#if !defined(BOOST_ASIO_DISABLE_THREAD_KEYWORD_EXTENSION)
1170# if defined(__linux__)
1171# if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
1172# if ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)
1173# if !defined(__INTEL_COMPILER) && !defined(__ICL) \
1174 && !(defined(__clang__) && defined(__ANDROID__))
1175# define BOOST_ASIO_HAS_THREAD_KEYWORD_EXTENSION 1
1176# define BOOST_ASIO_THREAD_KEYWORD __thread
1177# elif defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 1100)
1178# define BOOST_ASIO_HAS_THREAD_KEYWORD_EXTENSION 1
1179# endif // defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 1100)
1180 // && !(defined(__clang__) && defined(__ANDROID__))
1181# endif // ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)
1182# endif // defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
1183# endif // defined(__linux__)
1184# if defined(BOOST_ASIO_MSVC) && defined(BOOST_ASIO_WINDOWS_RUNTIME)
1185# if (_MSC_VER >= 1700)
1186# define BOOST_ASIO_HAS_THREAD_KEYWORD_EXTENSION 1
1187# define BOOST_ASIO_THREAD_KEYWORD __declspec(thread)
1188# endif // (_MSC_VER >= 1700)
1189# endif // defined(BOOST_ASIO_MSVC) && defined(BOOST_ASIO_WINDOWS_RUNTIME)
1190# if defined(__APPLE__)
1191# if defined(__clang__)
1192# if defined(__apple_build_version__)
1193# define BOOST_ASIO_HAS_THREAD_KEYWORD_EXTENSION 1
1194# define BOOST_ASIO_THREAD_KEYWORD __thread
1195# endif // defined(__apple_build_version__)
1196# endif // defined(__clang__)
1197# endif // defined(__APPLE__)
1198# if !defined(BOOST_ASIO_HAS_THREAD_KEYWORD_EXTENSION)
1199# if defined(BOOST_ASIO_HAS_BOOST_CONFIG)
1200# if !defined(BOOST_NO_CXX11_THREAD_LOCAL)
1201# define BOOST_ASIO_HAS_THREAD_KEYWORD_EXTENSION 1
1202# define BOOST_ASIO_THREAD_KEYWORD thread_local
1203# endif // !defined(BOOST_NO_CXX11_THREAD_LOCAL)
1204# endif // defined(BOOST_ASIO_HAS_BOOST_CONFIG)
1205# endif // !defined(BOOST_ASIO_HAS_THREAD_KEYWORD_EXTENSION)
1206#endif // !defined(BOOST_ASIO_DISABLE_THREAD_KEYWORD_EXTENSION)
1207#if !defined(BOOST_ASIO_THREAD_KEYWORD)
1208# define BOOST_ASIO_THREAD_KEYWORD __thread
1209#endif // !defined(BOOST_ASIO_THREAD_KEYWORD)
1210
1211// Support for POSIX ssize_t typedef.
1212#if !defined(BOOST_ASIO_DISABLE_SSIZE_T)
1213# if defined(__linux__) \
1214 || (defined(__MACH__) && defined(__APPLE__))
1215# define BOOST_ASIO_HAS_SSIZE_T 1
1216# endif // defined(__linux__)
1217 // || (defined(__MACH__) && defined(__APPLE__))
1218#endif // !defined(BOOST_ASIO_DISABLE_SSIZE_T)
1219
1220// Helper macros to manage transition away from error_code return values.
1221#if defined(BOOST_ASIO_NO_DEPRECATED)
1222# define BOOST_ASIO_SYNC_OP_VOID void
1223# define BOOST_ASIO_SYNC_OP_VOID_RETURN(e) return
1224#else // defined(BOOST_ASIO_NO_DEPRECATED)
1225# define BOOST_ASIO_SYNC_OP_VOID boost::system::error_code
1226# define BOOST_ASIO_SYNC_OP_VOID_RETURN(e) return e
1227#endif // defined(BOOST_ASIO_NO_DEPRECATED)
1228
1229// Newer gcc, clang need special treatment to suppress unused typedef warnings.
1230#if defined(__clang__)
1231# if defined(__apple_build_version__)
1232# if (__clang_major__ >= 7)
1233# define BOOST_ASIO_UNUSED_TYPEDEF __attribute__((__unused__))
1234# endif // (__clang_major__ >= 7)
1235# elif ((__clang_major__ == 3) && (__clang_minor__ >= 6)) \
1236 || (__clang_major__ > 3)
1237# define BOOST_ASIO_UNUSED_TYPEDEF __attribute__((__unused__))
1238# endif // ((__clang_major__ == 3) && (__clang_minor__ >= 6))
1239 // || (__clang_major__ > 3)
1240#elif defined(__GNUC__)
1241# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 8)) || (__GNUC__ > 4)
1242# define BOOST_ASIO_UNUSED_TYPEDEF __attribute__((__unused__))
1243# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 8)) || (__GNUC__ > 4)
1244#endif // defined(__GNUC__)
1245#if !defined(BOOST_ASIO_UNUSED_TYPEDEF)
1246# define BOOST_ASIO_UNUSED_TYPEDEF
1247#endif // !defined(BOOST_ASIO_UNUSED_TYPEDEF)
1248
1249// Some versions of gcc generate spurious warnings about unused variables.
1250#if defined(__GNUC__)
1251# if (__GNUC__ >= 4)
1252# define BOOST_ASIO_UNUSED_VARIABLE __attribute__((__unused__))
1253# endif // (__GNUC__ >= 4)
1254#endif // defined(__GNUC__)
1255#if !defined(BOOST_ASIO_UNUSED_VARIABLE)
1256# define BOOST_ASIO_UNUSED_VARIABLE
1257#endif // !defined(BOOST_ASIO_UNUSED_VARIABLE)
1258
1259// Helper macro to tell the optimiser what may be assumed to be true.
1260#if defined(BOOST_ASIO_MSVC)
1261# define BOOST_ASIO_ASSUME(expr) __assume(expr)
1262#elif defined(__clang__)
1263# if __has_builtin(__builtin_assume)
1264# define BOOST_ASIO_ASSUME(expr) __builtin_assume(expr)
1265# endif // __has_builtin(__builtin_assume)
1266#elif defined(__GNUC__)
1267# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) || (__GNUC__ > 4)
1268# define BOOST_ASIO_ASSUME(expr) if (expr) {} else { __builtin_unreachable(); }
1269# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) || (__GNUC__ > 4)
1270#endif // defined(__GNUC__)
1271#if !defined(BOOST_ASIO_ASSUME)
1272# define BOOST_ASIO_ASSUME(expr) (void)0
1273#endif // !defined(BOOST_ASIO_ASSUME)
1274
1275// Support the co_await keyword on compilers known to allow it.
1276#if !defined(BOOST_ASIO_HAS_CO_AWAIT)
1277# if !defined(BOOST_ASIO_DISABLE_CO_AWAIT)
1278# if defined(BOOST_ASIO_MSVC)
1279# if (_MSC_VER >= 1928) && (_MSVC_LANG >= 201705) && !defined(__clang__)
1280# define BOOST_ASIO_HAS_CO_AWAIT 1
1281# elif (_MSC_FULL_VER >= 190023506)
1282# if defined(_RESUMABLE_FUNCTIONS_SUPPORTED)
1283# define BOOST_ASIO_HAS_CO_AWAIT 1
1284# endif // defined(_RESUMABLE_FUNCTIONS_SUPPORTED)
1285# endif // (_MSC_FULL_VER >= 190023506)
1286# elif defined(__clang__)
1287# if (__clang_major__ >= 14)
1288# if (__cplusplus >= 202002) && (__cpp_impl_coroutine >= 201902)
1289# if __has_include(<coroutine>)
1290# define BOOST_ASIO_HAS_CO_AWAIT 1
1291# endif // __has_include(<coroutine>)
1292# elif (__cplusplus >= 201703) && (__cpp_coroutines >= 201703)
1293# if __has_include(<experimental/coroutine>)
1294# define BOOST_ASIO_HAS_CO_AWAIT 1
1295# endif // __has_include(<experimental/coroutine>)
1296# endif // (__cplusplus >= 201703) && (__cpp_coroutines >= 201703)
1297# else // (__clang_major__ >= 14)
1298# if (__cplusplus >= 201703) && (__cpp_coroutines >= 201703)
1299# if __has_include(<experimental/coroutine>)
1300# define BOOST_ASIO_HAS_CO_AWAIT 1
1301# endif // __has_include(<experimental/coroutine>)
1302# endif // (__cplusplus >= 201703) && (__cpp_coroutines >= 201703)
1303# endif // (__clang_major__ >= 14)
1304# elif defined(__GNUC__)
1305# if (__cplusplus >= 201709) && (__cpp_impl_coroutine >= 201902)
1306# if __has_include(<coroutine>)
1307# define BOOST_ASIO_HAS_CO_AWAIT 1
1308# endif // __has_include(<coroutine>)
1309# endif // (__cplusplus >= 201709) && (__cpp_impl_coroutine >= 201902)
1310# endif // defined(__GNUC__)
1311# endif // !defined(BOOST_ASIO_DISABLE_CO_AWAIT)
1312#endif // !defined(BOOST_ASIO_HAS_CO_AWAIT)
1313
1314// Standard library support for coroutines.
1315#if !defined(BOOST_ASIO_HAS_STD_COROUTINE)
1316# if !defined(BOOST_ASIO_DISABLE_STD_COROUTINE)
1317# if defined(BOOST_ASIO_MSVC)
1318# if (_MSC_VER >= 1928) && (_MSVC_LANG >= 201705)
1319# define BOOST_ASIO_HAS_STD_COROUTINE 1
1320# endif // (_MSC_VER >= 1928) && (_MSVC_LANG >= 201705)
1321# elif defined(__clang__)
1322# if (__clang_major__ >= 14)
1323# if (__cplusplus >= 202002) && (__cpp_impl_coroutine >= 201902)
1324# if __has_include(<coroutine>)
1325# define BOOST_ASIO_HAS_STD_COROUTINE 1
1326# endif // __has_include(<coroutine>)
1327# endif // (__cplusplus >= 202002) && (__cpp_impl_coroutine >= 201902)
1328# endif // (__clang_major__ >= 14)
1329# elif defined(__GNUC__)
1330# if (__cplusplus >= 201709) && (__cpp_impl_coroutine >= 201902)
1331# if __has_include(<coroutine>)
1332# define BOOST_ASIO_HAS_STD_COROUTINE 1
1333# endif // __has_include(<coroutine>)
1334# endif // (__cplusplus >= 201709) && (__cpp_impl_coroutine >= 201902)
1335# endif // defined(__GNUC__)
1336# endif // !defined(BOOST_ASIO_DISABLE_STD_COROUTINE)
1337#endif // !defined(BOOST_ASIO_HAS_STD_COROUTINE)
1338
1339// Compiler support for the the [[nodiscard]] attribute.
1340#if !defined(BOOST_ASIO_NODISCARD)
1341# if defined(__has_cpp_attribute)
1342# if __has_cpp_attribute(nodiscard)
1343# if (__cplusplus >= 201703)
1344# define BOOST_ASIO_NODISCARD [[nodiscard]]
1345# endif // (__cplusplus >= 201703)
1346# endif // __has_cpp_attribute(nodiscard)
1347# endif // defined(__has_cpp_attribute)
1348#endif // !defined(BOOST_ASIO_NODISCARD)
1349#if !defined(BOOST_ASIO_NODISCARD)
1350# define BOOST_ASIO_NODISCARD
1351#endif // !defined(BOOST_ASIO_NODISCARD)
1352
1353// Kernel support for MSG_NOSIGNAL.
1354#if !defined(BOOST_ASIO_HAS_MSG_NOSIGNAL)
1355# if defined(__linux__)
1356# define BOOST_ASIO_HAS_MSG_NOSIGNAL 1
1357# elif defined(_POSIX_VERSION)
1358# if (_POSIX_VERSION >= 200809L)
1359# define BOOST_ASIO_HAS_MSG_NOSIGNAL 1
1360# endif // _POSIX_VERSION >= 200809L
1361# endif // defined(_POSIX_VERSION)
1362#endif // !defined(BOOST_ASIO_HAS_MSG_NOSIGNAL)
1363
1364// Standard library support for std::to_address.
1365#if !defined(BOOST_ASIO_HAS_STD_TO_ADDRESS)
1366# if !defined(BOOST_ASIO_DISABLE_STD_TO_ADDRESS)
1367# if defined(__clang__)
1368# if (__cplusplus >= 202002)
1369# define BOOST_ASIO_HAS_STD_TO_ADDRESS 1
1370# endif // (__cplusplus >= 202002)
1371# elif defined(__GNUC__)
1372# if (__GNUC__ >= 8)
1373# if (__cplusplus >= 202002)
1374# define BOOST_ASIO_HAS_STD_TO_ADDRESS 1
1375# endif // (__cplusplus >= 202002)
1376# endif // (__GNUC__ >= 8)
1377# endif // defined(__GNUC__)
1378# if defined(BOOST_ASIO_MSVC)
1379# if (_MSC_VER >= 1922) && (_MSVC_LANG >= 202002)
1380# define BOOST_ASIO_HAS_STD_TO_ADDRESS 1
1381# endif // (_MSC_VER >= 1922) && (_MSVC_LANG >= 202002)
1382# endif // defined(BOOST_ASIO_MSVC)
1383# endif // !defined(BOOST_ASIO_DISABLE_STD_TO_ADDRESS)
1384#endif // !defined(BOOST_ASIO_HAS_STD_TO_ADDRESS)
1385
1386// Standard library support for snprintf.
1387#if !defined(BOOST_ASIO_HAS_SNPRINTF)
1388# if !defined(BOOST_ASIO_DISABLE_SNPRINTF)
1389# if defined(__apple_build_version__)
1390# if (__clang_major__ >= 14)
1391# define BOOST_ASIO_HAS_SNPRINTF 1
1392# endif // (__clang_major__ >= 14)
1393# endif // defined(__apple_build_version__)
1394# endif // !defined(BOOST_ASIO_DISABLE_SNPRINTF)
1395#endif // !defined(BOOST_ASIO_HAS_SNPRINTF)
1396
1397#endif // BOOST_ASIO_DETAIL_CONFIG_HPP
1398

source code of boost/libs/asio/include/boost/asio/detail/config.hpp