1 //
2 // detail/config.hpp
3 // ~~~~~~~~~~~~~~~~~
4 //
5 // Copyright (c) 2003-2019 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 ASIO_DETAIL_CONFIG_HPP
12 #define ASIO_DETAIL_CONFIG_HPP
13 
14 // boostify: non-boost code starts here
15 #if !defined(ASIO_STANDALONE)
16 # if !defined(ASIO_ENABLE_BOOST)
17 #  if (__cplusplus >= 201103)
18 #   define ASIO_STANDALONE 1
19 #  elif defined(_MSC_VER) && defined(_MSVC_LANG)
20 #   if (_MSC_VER >= 1900) && (_MSVC_LANG >= 201103)
21 #    define ASIO_STANDALONE 1
22 #   endif // (_MSC_VER >= 1900) && (_MSVC_LANG >= 201103)
23 #  endif // defined(_MSC_VER) && defined(_MSVC_LANG)
24 # endif // !defined(ASIO_ENABLE_BOOST)
25 #endif // !defined(ASIO_STANDALONE)
26 
27 // boostify: non-boost code ends here
28 #if defined(ASIO_STANDALONE)
29 # define ASIO_DISABLE_BOOST_ARRAY 1
30 # define ASIO_DISABLE_BOOST_ASSERT 1
31 # define ASIO_DISABLE_BOOST_BIND 1
32 # define ASIO_DISABLE_BOOST_CHRONO 1
33 # define ASIO_DISABLE_BOOST_DATE_TIME 1
34 # define ASIO_DISABLE_BOOST_LIMITS 1
35 # define ASIO_DISABLE_BOOST_REGEX 1
36 # define ASIO_DISABLE_BOOST_STATIC_CONSTANT 1
37 # define ASIO_DISABLE_BOOST_THROW_EXCEPTION 1
38 # define ASIO_DISABLE_BOOST_WORKAROUND 1
39 #else // defined(ASIO_STANDALONE)
40 # include <boost/config.hpp>
41 # include <boost/version.hpp>
42 # define ASIO_HAS_BOOST_CONFIG 1
43 #endif // defined(ASIO_STANDALONE)
44 
45 // Default to a header-only implementation. The user must specifically request
46 // separate compilation by defining either ASIO_SEPARATE_COMPILATION or
47 // ASIO_DYN_LINK (as a DLL/shared library implies separate compilation).
48 #if !defined(ASIO_HEADER_ONLY)
49 # if !defined(ASIO_SEPARATE_COMPILATION)
50 #  if !defined(ASIO_DYN_LINK)
51 #   define ASIO_HEADER_ONLY 1
52 #  endif // !defined(ASIO_DYN_LINK)
53 # endif // !defined(ASIO_SEPARATE_COMPILATION)
54 #endif // !defined(ASIO_HEADER_ONLY)
55 
56 #if defined(ASIO_HEADER_ONLY)
57 # define ASIO_DECL inline
58 #else // defined(ASIO_HEADER_ONLY)
59 # if defined(_MSC_VER) || defined(__BORLANDC__) || defined(__CODEGEARC__)
60 // We need to import/export our code only if the user has specifically asked
61 // for it by defining ASIO_DYN_LINK.
62 #  if defined(ASIO_DYN_LINK)
63 // Export if this is our own source, otherwise import.
64 #   if defined(ASIO_SOURCE)
65 #    define ASIO_DECL __declspec(dllexport)
66 #   else // defined(ASIO_SOURCE)
67 #    define ASIO_DECL __declspec(dllimport)
68 #   endif // defined(ASIO_SOURCE)
69 #  endif // defined(ASIO_DYN_LINK)
70 # endif // defined(_MSC_VER) || defined(__BORLANDC__) || defined(__CODEGEARC__)
71 #endif // defined(ASIO_HEADER_ONLY)
72 
73 // If ASIO_DECL isn't defined yet define it now.
74 #if !defined(ASIO_DECL)
75 # define ASIO_DECL
76 #endif // !defined(ASIO_DECL)
77 
78 // Microsoft Visual C++ detection.
79 #if !defined(ASIO_MSVC)
80 # if defined(ASIO_HAS_BOOST_CONFIG) && defined(BOOST_MSVC)
81 #  define ASIO_MSVC BOOST_MSVC
82 # elif defined(_MSC_VER) && (defined(__INTELLISENSE__) \
83       || (!defined(__MWERKS__) && !defined(__EDG_VERSION__)))
84 #  define ASIO_MSVC _MSC_VER
85 # endif // defined(ASIO_HAS_BOOST_CONFIG) && defined(BOOST_MSVC)
86 #endif // !defined(ASIO_MSVC)
87 
88 // Clang / libc++ detection.
89 #if defined(__clang__)
90 # if (__cplusplus >= 201103)
91 #  if __has_include(<__config>)
92 #   include <__config>
93 #   if defined(_LIBCPP_VERSION)
94 #    define ASIO_HAS_CLANG_LIBCXX 1
95 #   endif // defined(_LIBCPP_VERSION)
96 #  endif // __has_include(<__config>)
97 # endif // (__cplusplus >= 201103)
98 #endif // defined(__clang__)
99 
100 // Android platform detection.
101 #if defined(__ANDROID__)
102 # include <android/api-level.h>
103 #endif // defined(__ANDROID__)
104 
105 // Support move construction and assignment on compilers known to allow it.
106 #if !defined(ASIO_HAS_MOVE)
107 # if !defined(ASIO_DISABLE_MOVE)
108 #  if defined(__clang__)
109 #   if __has_feature(__cxx_rvalue_references__)
110 #    define ASIO_HAS_MOVE 1
111 #   endif // __has_feature(__cxx_rvalue_references__)
112 #  endif // defined(__clang__)
113 #  if defined(__GNUC__)
114 #   if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) || (__GNUC__ > 4)
115 #    if defined(__GXX_EXPERIMENTAL_CXX0X__)
116 #     define ASIO_HAS_MOVE 1
117 #    endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
118 #   endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) || (__GNUC__ > 4)
119 #  endif // defined(__GNUC__)
120 #  if defined(ASIO_MSVC)
121 #   if (_MSC_VER >= 1700)
122 #    define ASIO_HAS_MOVE 1
123 #   endif // (_MSC_VER >= 1700)
124 #  endif // defined(ASIO_MSVC)
125 #  if defined(__INTEL_CXX11_MODE__)
126 #    if defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 1500)
127 #      define BOOST_ASIO_HAS_MOVE 1
128 #    endif // defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 1500)
129 #    if defined(__ICL) && (__ICL >= 1500)
130 #      define BOOST_ASIO_HAS_MOVE 1
131 #    endif // defined(__ICL) && (__ICL >= 1500)
132 #  endif // defined(__INTEL_CXX11_MODE__)
133 # endif // !defined(ASIO_DISABLE_MOVE)
134 #endif // !defined(ASIO_HAS_MOVE)
135 
136 // If ASIO_MOVE_CAST isn't defined, and move support is available, define
137 // * ASIO_MOVE_ARG,
138 // * ASIO_NONDEDUCED_MOVE_ARG, and
139 // * ASIO_MOVE_CAST
140 // to take advantage of rvalue references and perfect forwarding.
141 #if defined(ASIO_HAS_MOVE) && !defined(ASIO_MOVE_CAST)
142 # define ASIO_MOVE_ARG(type) type&&
143 # define ASIO_MOVE_ARG2(type1, type2) type1, type2&&
144 # define ASIO_NONDEDUCED_MOVE_ARG(type) type&
145 # define ASIO_MOVE_CAST(type) static_cast<type&&>
146 # define ASIO_MOVE_CAST2(type1, type2) static_cast<type1, type2&&>
147 #endif // defined(ASIO_HAS_MOVE) && !defined(ASIO_MOVE_CAST)
148 
149 // If ASIO_MOVE_CAST still isn't defined, default to a C++03-compatible
150 // implementation. Note that older g++ and MSVC versions don't like it when you
151 // pass a non-member function through a const reference, so for most compilers
152 // we'll play it safe and stick with the old approach of passing the handler by
153 // value.
154 #if !defined(ASIO_MOVE_CAST)
155 # if defined(__GNUC__)
156 #  if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 1)) || (__GNUC__ > 4)
157 #   define ASIO_MOVE_ARG(type) const type&
158 #  else // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 1)) || (__GNUC__ > 4)
159 #   define ASIO_MOVE_ARG(type) type
160 #  endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 1)) || (__GNUC__ > 4)
161 # elif defined(ASIO_MSVC)
162 #  if (_MSC_VER >= 1400)
163 #   define ASIO_MOVE_ARG(type) const type&
164 #  else // (_MSC_VER >= 1400)
165 #   define ASIO_MOVE_ARG(type) type
166 #  endif // (_MSC_VER >= 1400)
167 # else
168 #  define ASIO_MOVE_ARG(type) type
169 # endif
170 # define ASIO_NONDEDUCED_MOVE_ARG(type) const type&
171 # define ASIO_MOVE_CAST(type) static_cast<const type&>
172 # define ASIO_MOVE_CAST2(type1, type2) static_cast<const type1, type2&>
173 #endif // !defined(ASIO_MOVE_CAST)
174 
175 // Support variadic templates on compilers known to allow it.
176 #if !defined(ASIO_HAS_VARIADIC_TEMPLATES)
177 # if !defined(ASIO_DISABLE_VARIADIC_TEMPLATES)
178 #  if defined(__clang__)
179 #   if __has_feature(__cxx_variadic_templates__)
180 #    define ASIO_HAS_VARIADIC_TEMPLATES 1
181 #   endif // __has_feature(__cxx_variadic_templates__)
182 #  endif // defined(__clang__)
183 #  if defined(__GNUC__)
184 #   if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 4)
185 #    if defined(__GXX_EXPERIMENTAL_CXX0X__)
186 #     define ASIO_HAS_VARIADIC_TEMPLATES 1
187 #    endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
188 #   endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 4)
189 #  endif // defined(__GNUC__)
190 #  if defined(ASIO_MSVC)
191 #   if (_MSC_VER >= 1900)
192 #    define ASIO_HAS_VARIADIC_TEMPLATES 1
193 #   endif // (_MSC_VER >= 1900)
194 #  endif // defined(ASIO_MSVC)
195 # endif // !defined(ASIO_DISABLE_VARIADIC_TEMPLATES)
196 #endif // !defined(ASIO_HAS_VARIADIC_TEMPLATES)
197 
198 // Support deleted functions on compilers known to allow it.
199 #if !defined(ASIO_DELETED)
200 # if defined(__GNUC__)
201 #  if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
202 #   if defined(__GXX_EXPERIMENTAL_CXX0X__)
203 #    define ASIO_DELETED = delete
204 #   endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
205 #  endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
206 # endif // defined(__GNUC__)
207 # if defined(__clang__)
208 #  if __has_feature(__cxx_deleted_functions__)
209 #   define ASIO_DELETED = delete
210 #  endif // __has_feature(__cxx_deleted_functions__)
211 # endif // defined(__clang__)
212 # if defined(ASIO_MSVC)
213 #  if (_MSC_VER >= 1900)
214 #   define ASIO_DELETED = delete
215 #  endif // (_MSC_VER >= 1900)
216 # endif // defined(ASIO_MSVC)
217 # if !defined(ASIO_DELETED)
218 #  define ASIO_DELETED
219 # endif // !defined(ASIO_DELETED)
220 #endif // !defined(ASIO_DELETED)
221 
222 // Support constexpr on compilers known to allow it.
223 #if !defined(ASIO_HAS_CONSTEXPR)
224 # if !defined(ASIO_DISABLE_CONSTEXPR)
225 #  if defined(__clang__)
226 #   if __has_feature(__cxx_constexpr__)
227 #    define ASIO_HAS_CONSTEXPR 1
228 #   endif // __has_feature(__cxx_constexr__)
229 #  endif // defined(__clang__)
230 #  if defined(__GNUC__)
231 #   if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4)
232 #    if defined(__GXX_EXPERIMENTAL_CXX0X__)
233 #     define ASIO_HAS_CONSTEXPR 1
234 #    endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
235 #   endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4)
236 #  endif // defined(__GNUC__)
237 #  if defined(ASIO_MSVC)
238 #   if (_MSC_VER >= 1900)
239 #    define ASIO_HAS_CONSTEXPR 1
240 #   endif // (_MSC_VER >= 1900)
241 #  endif // defined(ASIO_MSVC)
242 # endif // !defined(ASIO_DISABLE_CONSTEXPR)
243 #endif // !defined(ASIO_HAS_CONSTEXPR)
244 #if !defined(ASIO_CONSTEXPR)
245 # if defined(ASIO_HAS_CONSTEXPR)
246 #  define ASIO_CONSTEXPR constexpr
247 # else // defined(ASIO_HAS_CONSTEXPR)
248 #  define ASIO_CONSTEXPR
249 # endif // defined(ASIO_HAS_CONSTEXPR)
250 #endif // !defined(ASIO_CONSTEXPR)
251 
252 // Support noexcept on compilers known to allow it.
253 #if !defined(ASIO_NOEXCEPT)
254 # if !defined(ASIO_DISABLE_NOEXCEPT)
255 #  if defined(ASIO_HAS_BOOST_CONFIG) && (BOOST_VERSION >= 105300)
256 #   define ASIO_NOEXCEPT BOOST_NOEXCEPT
257 #   define ASIO_NOEXCEPT_OR_NOTHROW BOOST_NOEXCEPT_OR_NOTHROW
258 #  elif defined(__clang__)
259 #   if __has_feature(__cxx_noexcept__)
260 #    define ASIO_NOEXCEPT noexcept(true)
261 #    define ASIO_NOEXCEPT_OR_NOTHROW noexcept(true)
262 #   endif // __has_feature(__cxx_noexcept__)
263 #  elif defined(__GNUC__)
264 #   if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
265 #    if defined(__GXX_EXPERIMENTAL_CXX0X__)
266 #      define ASIO_NOEXCEPT noexcept(true)
267 #      define ASIO_NOEXCEPT_OR_NOTHROW noexcept(true)
268 #    endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
269 #   endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
270 #  elif defined(ASIO_MSVC)
271 #   if (_MSC_VER >= 1900)
272 #    define ASIO_NOEXCEPT noexcept(true)
273 #    define ASIO_NOEXCEPT_OR_NOTHROW noexcept(true)
274 #   endif // (_MSC_VER >= 1900)
275 #  endif // defined(ASIO_MSVC)
276 # endif // !defined(ASIO_DISABLE_NOEXCEPT)
277 # if !defined(ASIO_NOEXCEPT)
278 #  define ASIO_NOEXCEPT
279 # endif // !defined(ASIO_NOEXCEPT)
280 # if !defined(ASIO_NOEXCEPT_OR_NOTHROW)
281 #  define ASIO_NOEXCEPT_OR_NOTHROW throw()
282 # endif // !defined(ASIO_NOEXCEPT_OR_NOTHROW)
283 #endif // !defined(ASIO_NOEXCEPT)
284 
285 // Support automatic type deduction on compilers known to support it.
286 #if !defined(ASIO_HAS_DECLTYPE)
287 # if !defined(ASIO_DISABLE_DECLTYPE)
288 #  if defined(__clang__)
289 #   if __has_feature(__cxx_decltype__)
290 #    define ASIO_HAS_DECLTYPE 1
291 #   endif // __has_feature(__cxx_decltype__)
292 #  endif // defined(__clang__)
293 #  if defined(__GNUC__)
294 #   if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4)
295 #    if defined(__GXX_EXPERIMENTAL_CXX0X__)
296 #     define ASIO_HAS_DECLTYPE 1
297 #    endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
298 #   endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4)
299 #  endif // defined(__GNUC__)
300 #  if defined(ASIO_MSVC)
301 #   if (_MSC_VER >= 1800)
302 #    define ASIO_HAS_DECLTYPE 1
303 #   endif // (_MSC_VER >= 1800)
304 #  endif // defined(ASIO_MSVC)
305 # endif // !defined(ASIO_DISABLE_DECLTYPE)
306 #endif // !defined(ASIO_HAS_DECLTYPE)
307 
308 // Support alias templates on compilers known to allow it.
309 #if !defined(ASIO_HAS_ALIAS_TEMPLATES)
310 # if !defined(ASIO_DISABLE_ALIAS_TEMPLATES)
311 #  if defined(__clang__)
312 #   if __has_feature(__cxx_alias_templates__)
313 #    define ASIO_HAS_ALIAS_TEMPLATES 1
314 #   endif // __has_feature(__cxx_alias_templates__)
315 #  endif // defined(__clang__)
316 #  if defined(__GNUC__)
317 #   if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
318 #    if defined(__GXX_EXPERIMENTAL_CXX0X__)
319 #     define ASIO_HAS_ALIAS_TEMPLATES 1
320 #    endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
321 #   endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
322 #  endif // defined(__GNUC__)
323 #  if defined(ASIO_MSVC)
324 #   if (_MSC_VER >= 1900)
325 #    define ASIO_HAS_ALIAS_TEMPLATES 1
326 #   endif // (_MSC_VER >= 1900)
327 #  endif // defined(ASIO_MSVC)
328 # endif // !defined(ASIO_DISABLE_ALIAS_TEMPLATES)
329 #endif // !defined(ASIO_HAS_ALIAS_TEMPLATES)
330 
331 // Support return type deduction on compilers known to allow it.
332 #if !defined(ASIO_HAS_RETURN_TYPE_DEDUCTION)
333 # if !defined(ASIO_DISABLE_RETURN_TYPE_DEDUCTION)
334 #  if defined(__clang__)
335 #   if __has_feature(__cxx_return_type_deduction__)
336 #    define ASIO_HAS_RETURN_TYPE_DEDUCTION 1
337 #   endif // __has_feature(__cxx_alias_templates__)
338 #  elif (__cplusplus >= 201402)
339 #   define ASIO_HAS_RETURN_TYPE_DEDUCTION 1
340 #  elif defined(__cpp_return_type_deduction)
341 #   if (__cpp_return_type_deduction >= 201304)
342 #    define ASIO_HAS_RETURN_TYPE_DEDUCTION 1
343 #   endif // (__cpp_return_type_deduction >= 201304)
344 #  endif // defined(__cpp_return_type_deduction)
345 # endif // !defined(ASIO_DISABLE_RETURN_TYPE_DEDUCTION)
346 #endif // !defined(ASIO_HAS_RETURN_TYPE_DEDUCTION)
347 
348 // Support default function template arguments on compilers known to allow it.
349 #if !defined(ASIO_HAS_DEFAULT_FUNCTION_TEMPLATE_ARGUMENTS)
350 # if !defined(ASIO_DISABLE_DEFAULT_FUNCTION_TEMPLATE_ARGUMENTS)
351 #  if (__cplusplus >= 201103)
352 #   define ASIO_HAS_DEFAULT_FUNCTION_TEMPLATE_ARGUMENTS 1
353 #  endif // (__cplusplus >= 201103)
354 # endif // !defined(ASIO_DISABLE_DEFAULT_FUNCTION_TEMPLATE_ARGUMENTS)
355 #endif // !defined(ASIO_HAS_DEFAULT_FUNCTION_TEMPLATE_ARGUMENTS)
356 
357 // Support concepts on compilers known to allow them.
358 #if !defined(ASIO_HAS_CONCEPTS)
359 # if !defined(ASIO_DISABLE_CONCEPTS)
360 #  if __cpp_concepts
361 #   define ASIO_HAS_CONCEPTS 1
362 #   define ASIO_CONCEPT concept bool
363 #  endif // __cpp_concepts
364 # endif // !defined(ASIO_DISABLE_CONCEPTS)
365 #endif // !defined(ASIO_HAS_CONCEPTS)
366 
367 // Standard library support for system errors.
368 #if !defined(ASIO_HAS_STD_SYSTEM_ERROR)
369 # if !defined(ASIO_DISABLE_STD_SYSTEM_ERROR)
370 #  if defined(__clang__)
371 #   if defined(ASIO_HAS_CLANG_LIBCXX)
372 #    define ASIO_HAS_STD_SYSTEM_ERROR 1
373 #   elif (__cplusplus >= 201103)
374 #    if __has_include(<system_error>)
375 #     define ASIO_HAS_STD_SYSTEM_ERROR 1
376 #    endif // __has_include(<system_error>)
377 #   endif // (__cplusplus >= 201103)
378 #  endif // defined(__clang__)
379 #  if defined(__GNUC__)
380 #   if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4)
381 #    if defined(__GXX_EXPERIMENTAL_CXX0X__)
382 #     define ASIO_HAS_STD_SYSTEM_ERROR 1
383 #    endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
384 #   endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4)
385 #  endif // defined(__GNUC__)
386 #  if defined(ASIO_MSVC)
387 #   if (_MSC_VER >= 1700)
388 #    define ASIO_HAS_STD_SYSTEM_ERROR 1
389 #   endif // (_MSC_VER >= 1700)
390 #  endif // defined(ASIO_MSVC)
391 # endif // !defined(ASIO_DISABLE_STD_SYSTEM_ERROR)
392 #endif // !defined(ASIO_HAS_STD_SYSTEM_ERROR)
393 
394 // Compliant C++11 compilers put noexcept specifiers on error_category members.
395 #if !defined(ASIO_ERROR_CATEGORY_NOEXCEPT)
396 # if defined(ASIO_HAS_BOOST_CONFIG) && (BOOST_VERSION >= 105300)
397 #  define ASIO_ERROR_CATEGORY_NOEXCEPT BOOST_NOEXCEPT
398 # elif defined(__clang__)
399 #  if __has_feature(__cxx_noexcept__)
400 #   define ASIO_ERROR_CATEGORY_NOEXCEPT noexcept(true)
401 #  endif // __has_feature(__cxx_noexcept__)
402 # elif defined(__GNUC__)
403 #  if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
404 #   if defined(__GXX_EXPERIMENTAL_CXX0X__)
405 #     define ASIO_ERROR_CATEGORY_NOEXCEPT noexcept(true)
406 #   endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
407 #  endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
408 # elif defined(ASIO_MSVC)
409 #  if (_MSC_VER >= 1900)
410 #   define ASIO_ERROR_CATEGORY_NOEXCEPT noexcept(true)
411 #  endif // (_MSC_VER >= 1900)
412 # endif // defined(ASIO_MSVC)
413 # if !defined(ASIO_ERROR_CATEGORY_NOEXCEPT)
414 #  define ASIO_ERROR_CATEGORY_NOEXCEPT
415 # endif // !defined(ASIO_ERROR_CATEGORY_NOEXCEPT)
416 #endif // !defined(ASIO_ERROR_CATEGORY_NOEXCEPT)
417 
418 // Standard library support for arrays.
419 #if !defined(ASIO_HAS_STD_ARRAY)
420 # if !defined(ASIO_DISABLE_STD_ARRAY)
421 #  if defined(__clang__)
422 #   if defined(ASIO_HAS_CLANG_LIBCXX)
423 #    define ASIO_HAS_STD_ARRAY 1
424 #   elif (__cplusplus >= 201103)
425 #    if __has_include(<array>)
426 #     define ASIO_HAS_STD_ARRAY 1
427 #    endif // __has_include(<array>)
428 #   endif // (__cplusplus >= 201103)
429 #  endif // defined(__clang__)
430 #  if defined(__GNUC__)
431 #   if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 4)
432 #    if defined(__GXX_EXPERIMENTAL_CXX0X__)
433 #     define ASIO_HAS_STD_ARRAY 1
434 #    endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
435 #   endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 4)
436 #  endif // defined(__GNUC__)
437 #  if defined(ASIO_MSVC)
438 #   if (_MSC_VER >= 1600)
439 #    define ASIO_HAS_STD_ARRAY 1
440 #   endif // (_MSC_VER >= 1600)
441 #  endif // defined(ASIO_MSVC)
442 # endif // !defined(ASIO_DISABLE_STD_ARRAY)
443 #endif // !defined(ASIO_HAS_STD_ARRAY)
444 
445 // Standard library support for shared_ptr and weak_ptr.
446 #if !defined(ASIO_HAS_STD_SHARED_PTR)
447 # if !defined(ASIO_DISABLE_STD_SHARED_PTR)
448 #  if defined(__clang__)
449 #   if defined(ASIO_HAS_CLANG_LIBCXX)
450 #    define ASIO_HAS_STD_SHARED_PTR 1
451 #   elif (__cplusplus >= 201103)
452 #    define ASIO_HAS_STD_SHARED_PTR 1
453 #   endif // (__cplusplus >= 201103)
454 #  endif // defined(__clang__)
455 #  if defined(__GNUC__)
456 #   if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 4)
457 #    if defined(__GXX_EXPERIMENTAL_CXX0X__)
458 #     define ASIO_HAS_STD_SHARED_PTR 1
459 #    endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
460 #   endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 4)
461 #  endif // defined(__GNUC__)
462 #  if defined(ASIO_MSVC)
463 #   if (_MSC_VER >= 1600)
464 #    define ASIO_HAS_STD_SHARED_PTR 1
465 #   endif // (_MSC_VER >= 1600)
466 #  endif // defined(ASIO_MSVC)
467 # endif // !defined(ASIO_DISABLE_STD_SHARED_PTR)
468 #endif // !defined(ASIO_HAS_STD_SHARED_PTR)
469 
470 // Standard library support for allocator_arg_t.
471 #if !defined(ASIO_HAS_STD_ALLOCATOR_ARG)
472 # if !defined(ASIO_DISABLE_STD_ALLOCATOR_ARG)
473 #  if defined(__clang__)
474 #   if defined(ASIO_HAS_CLANG_LIBCXX)
475 #    define ASIO_HAS_STD_ALLOCATOR_ARG 1
476 #   elif (__cplusplus >= 201103)
477 #    define ASIO_HAS_STD_ALLOCATOR_ARG 1
478 #   endif // (__cplusplus >= 201103)
479 #  endif // defined(__clang__)
480 #  if defined(__GNUC__)
481 #   if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4)
482 #    if defined(__GXX_EXPERIMENTAL_CXX0X__)
483 #     define ASIO_HAS_STD_ALLOCATOR_ARG 1
484 #    endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
485 #   endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4)
486 #  endif // defined(__GNUC__)
487 #  if defined(ASIO_MSVC)
488 #   if (_MSC_VER >= 1600)
489 #    define ASIO_HAS_STD_ALLOCATOR_ARG 1
490 #   endif // (_MSC_VER >= 1600)
491 #  endif // defined(ASIO_MSVC)
492 # endif // !defined(ASIO_DISABLE_STD_ALLOCATOR_ARG)
493 #endif // !defined(ASIO_HAS_STD_ALLOCATOR_ARG)
494 
495 // Standard library support for atomic operations.
496 #if !defined(ASIO_HAS_STD_ATOMIC)
497 # if !defined(ASIO_DISABLE_STD_ATOMIC)
498 #  if defined(__clang__)
499 #   if defined(ASIO_HAS_CLANG_LIBCXX)
500 #    define ASIO_HAS_STD_ATOMIC 1
501 #   elif (__cplusplus >= 201103)
502 #    if __has_include(<atomic>)
503 #     define ASIO_HAS_STD_ATOMIC 1
504 #    endif // __has_include(<atomic>)
505 #   elif defined(__apple_build_version__) && defined(_LIBCPP_VERSION)
506 #    if (__clang_major__ >= 10)
507 #     if __has_include(<atomic>)
508 #      define ASIO_HAS_STD_ATOMIC 1
509 #     endif // __has_include(<atomic>)
510 #    endif // (__clang_major__ >= 10)
511 #   endif /// defined(__apple_build_version__) && defined(_LIBCPP_VERSION)
512 #  endif // defined(__clang__)
513 #  if defined(__GNUC__)
514 #   if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
515 #    if defined(__GXX_EXPERIMENTAL_CXX0X__)
516 #     define ASIO_HAS_STD_ATOMIC 1
517 #    endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
518 #   endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
519 #  endif // defined(__GNUC__)
520 #  if defined(ASIO_MSVC)
521 #   if (_MSC_VER >= 1700)
522 #    define ASIO_HAS_STD_ATOMIC 1
523 #   endif // (_MSC_VER >= 1700)
524 #  endif // defined(ASIO_MSVC)
525 # endif // !defined(ASIO_DISABLE_STD_ATOMIC)
526 #endif // !defined(ASIO_HAS_STD_ATOMIC)
527 
528 // Standard library support for chrono. Some standard libraries (such as the
529 // libstdc++ shipped with gcc 4.6) provide monotonic_clock as per early C++0x
530 // drafts, rather than the eventually standardised name of steady_clock.
531 #if !defined(ASIO_HAS_STD_CHRONO)
532 # if !defined(ASIO_DISABLE_STD_CHRONO)
533 #  if defined(__clang__)
534 #   if defined(ASIO_HAS_CLANG_LIBCXX)
535 #    define ASIO_HAS_STD_CHRONO 1
536 #   elif (__cplusplus >= 201103)
537 #    if __has_include(<chrono>)
538 #     define ASIO_HAS_STD_CHRONO 1
539 #    endif // __has_include(<chrono>)
540 #   endif // (__cplusplus >= 201103)
541 #  endif // defined(__clang__)
542 #  if defined(__GNUC__)
543 #   if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4)
544 #    if defined(__GXX_EXPERIMENTAL_CXX0X__)
545 #     define ASIO_HAS_STD_CHRONO 1
546 #     if ((__GNUC__ == 4) && (__GNUC_MINOR__ == 6))
547 #      define ASIO_HAS_STD_CHRONO_MONOTONIC_CLOCK 1
548 #     endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ == 6))
549 #    endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
550 #   endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4)
551 #  endif // defined(__GNUC__)
552 #  if defined(ASIO_MSVC)
553 #   if (_MSC_VER >= 1700)
554 #    define ASIO_HAS_STD_CHRONO 1
555 #   endif // (_MSC_VER >= 1700)
556 #  endif // defined(ASIO_MSVC)
557 # endif // !defined(ASIO_DISABLE_STD_CHRONO)
558 #endif // !defined(ASIO_HAS_STD_CHRONO)
559 
560 // Boost support for chrono.
561 #if !defined(ASIO_HAS_BOOST_CHRONO)
562 # if !defined(ASIO_DISABLE_BOOST_CHRONO)
563 #  if defined(ASIO_HAS_BOOST_CONFIG) && (BOOST_VERSION >= 104700)
564 #   define ASIO_HAS_BOOST_CHRONO 1
565 #  endif // defined(ASIO_HAS_BOOST_CONFIG) && (BOOST_VERSION >= 104700)
566 # endif // !defined(ASIO_DISABLE_BOOST_CHRONO)
567 #endif // !defined(ASIO_HAS_BOOST_CHRONO)
568 
569 // Some form of chrono library is available.
570 #if !defined(ASIO_HAS_CHRONO)
571 # if defined(ASIO_HAS_STD_CHRONO) \
572     || defined(ASIO_HAS_BOOST_CHRONO)
573 #  define ASIO_HAS_CHRONO 1
574 # endif // defined(ASIO_HAS_STD_CHRONO)
575         // || defined(ASIO_HAS_BOOST_CHRONO)
576 #endif // !defined(ASIO_HAS_CHRONO)
577 
578 // Boost support for the DateTime library.
579 #if !defined(ASIO_HAS_BOOST_DATE_TIME)
580 # if !defined(ASIO_DISABLE_BOOST_DATE_TIME)
581 #  define ASIO_HAS_BOOST_DATE_TIME 1
582 # endif // !defined(ASIO_DISABLE_BOOST_DATE_TIME)
583 #endif // !defined(ASIO_HAS_BOOST_DATE_TIME)
584 
585 // Standard library support for addressof.
586 #if !defined(ASIO_HAS_STD_ADDRESSOF)
587 # if !defined(ASIO_DISABLE_STD_ADDRESSOF)
588 #  if defined(__clang__)
589 #   if defined(ASIO_HAS_CLANG_LIBCXX)
590 #    define ASIO_HAS_STD_ADDRESSOF 1
591 #   elif (__cplusplus >= 201103)
592 #    define ASIO_HAS_STD_ADDRESSOF 1
593 #   endif // (__cplusplus >= 201103)
594 #  endif // defined(__clang__)
595 #  if defined(__GNUC__)
596 #   if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4)
597 #    if defined(__GXX_EXPERIMENTAL_CXX0X__)
598 #     define ASIO_HAS_STD_ADDRESSOF 1
599 #    endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
600 #   endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4)
601 #  endif // defined(__GNUC__)
602 #  if defined(ASIO_MSVC)
603 #   if (_MSC_VER >= 1700)
604 #    define ASIO_HAS_STD_ADDRESSOF 1
605 #   endif // (_MSC_VER >= 1700)
606 #  endif // defined(ASIO_MSVC)
607 # endif // !defined(ASIO_DISABLE_STD_ADDRESSOF)
608 #endif // !defined(ASIO_HAS_STD_ADDRESSOF)
609 
610 // Standard library support for the function class.
611 #if !defined(ASIO_HAS_STD_FUNCTION)
612 # if !defined(ASIO_DISABLE_STD_FUNCTION)
613 #  if defined(__clang__)
614 #   if defined(ASIO_HAS_CLANG_LIBCXX)
615 #    define ASIO_HAS_STD_FUNCTION 1
616 #   elif (__cplusplus >= 201103)
617 #    define ASIO_HAS_STD_FUNCTION 1
618 #   endif // (__cplusplus >= 201103)
619 #  endif // defined(__clang__)
620 #  if defined(__GNUC__)
621 #   if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) || (__GNUC__ > 4)
622 #    if defined(__GXX_EXPERIMENTAL_CXX0X__)
623 #     define ASIO_HAS_STD_FUNCTION 1
624 #    endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
625 #   endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) || (__GNUC__ > 4)
626 #  endif // defined(__GNUC__)
627 #  if defined(ASIO_MSVC)
628 #   if (_MSC_VER >= 1700)
629 #    define ASIO_HAS_STD_FUNCTION 1
630 #   endif // (_MSC_VER >= 1700)
631 #  endif // defined(ASIO_MSVC)
632 # endif // !defined(ASIO_DISABLE_STD_FUNCTION)
633 #endif // !defined(ASIO_HAS_STD_FUNCTION)
634 
635 // Standard library support for type traits.
636 #if !defined(ASIO_HAS_STD_TYPE_TRAITS)
637 # if !defined(ASIO_DISABLE_STD_TYPE_TRAITS)
638 #  if defined(__clang__)
639 #   if defined(ASIO_HAS_CLANG_LIBCXX)
640 #    define ASIO_HAS_STD_TYPE_TRAITS 1
641 #   elif (__cplusplus >= 201103)
642 #    if __has_include(<type_traits>)
643 #     define ASIO_HAS_STD_TYPE_TRAITS 1
644 #    endif // __has_include(<type_traits>)
645 #   endif // (__cplusplus >= 201103)
646 #  endif // defined(__clang__)
647 #  if defined(__GNUC__)
648 #   if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) || (__GNUC__ > 4)
649 #    if defined(__GXX_EXPERIMENTAL_CXX0X__)
650 #     define ASIO_HAS_STD_TYPE_TRAITS 1
651 #    endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
652 #   endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) || (__GNUC__ > 4)
653 #  endif // defined(__GNUC__)
654 #  if defined(ASIO_MSVC)
655 #   if (_MSC_VER >= 1700)
656 #    define ASIO_HAS_STD_TYPE_TRAITS 1
657 #   endif // (_MSC_VER >= 1700)
658 #  endif // defined(ASIO_MSVC)
659 # endif // !defined(ASIO_DISABLE_STD_TYPE_TRAITS)
660 #endif // !defined(ASIO_HAS_STD_TYPE_TRAITS)
661 
662 // Standard library support for the nullptr_t type.
663 #if !defined(ASIO_HAS_NULLPTR)
664 # if !defined(ASIO_DISABLE_NULLPTR)
665 #  if defined(__clang__)
666 #   if __has_feature(__cxx_nullptr__)
667 #    define ASIO_HAS_NULLPTR 1
668 #   endif // __has_feature(__cxx_rvalue_references__)
669 #  elif defined(__GNUC__)
670 #   if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4)
671 #    if defined(__GXX_EXPERIMENTAL_CXX0X__)
672 #     define ASIO_HAS_NULLPTR 1
673 #    endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
674 #   endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4)
675 #  endif // defined(__GNUC__)
676 #  if defined(ASIO_MSVC)
677 #   if (_MSC_VER >= 1700)
678 #    define ASIO_HAS_NULLPTR 1
679 #   endif // (_MSC_VER >= 1700)
680 #  endif // defined(ASIO_MSVC)
681 # endif // !defined(ASIO_DISABLE_NULLPTR)
682 #endif // !defined(ASIO_HAS_NULLPTR)
683 
684 // Standard library support for the C++11 allocator additions.
685 #if !defined(ASIO_HAS_CXX11_ALLOCATORS)
686 # if !defined(ASIO_DISABLE_CXX11_ALLOCATORS)
687 #  if defined(__clang__)
688 #   if defined(ASIO_HAS_CLANG_LIBCXX)
689 #    define ASIO_HAS_CXX11_ALLOCATORS 1
690 #   elif (__cplusplus >= 201103)
691 #    define ASIO_HAS_CXX11_ALLOCATORS 1
692 #   endif // (__cplusplus >= 201103)
693 #  elif defined(__GNUC__)
694 #   if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
695 #    if defined(__GXX_EXPERIMENTAL_CXX0X__)
696 #     define ASIO_HAS_CXX11_ALLOCATORS 1
697 #    endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
698 #   endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
699 #  endif // defined(__GNUC__)
700 #  if defined(ASIO_MSVC)
701 #   if (_MSC_VER >= 1800)
702 #    define ASIO_HAS_CXX11_ALLOCATORS 1
703 #   endif // (_MSC_VER >= 1800)
704 #  endif // defined(ASIO_MSVC)
705 # endif // !defined(ASIO_DISABLE_CXX11_ALLOCATORS)
706 #endif // !defined(ASIO_HAS_CXX11_ALLOCATORS)
707 
708 // Standard library support for the cstdint header.
709 #if !defined(ASIO_HAS_CSTDINT)
710 # if !defined(ASIO_DISABLE_CSTDINT)
711 #  if defined(__clang__)
712 #   if defined(ASIO_HAS_CLANG_LIBCXX)
713 #    define ASIO_HAS_CSTDINT 1
714 #   elif (__cplusplus >= 201103)
715 #    define ASIO_HAS_CSTDINT 1
716 #   endif // (__cplusplus >= 201103)
717 #  endif // defined(__clang__)
718 #  if defined(__GNUC__)
719 #   if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) || (__GNUC__ > 4)
720 #    if defined(__GXX_EXPERIMENTAL_CXX0X__)
721 #     define ASIO_HAS_CSTDINT 1
722 #    endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
723 #   endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) || (__GNUC__ > 4)
724 #  endif // defined(__GNUC__)
725 #  if defined(ASIO_MSVC)
726 #   if (_MSC_VER >= 1700)
727 #    define ASIO_HAS_CSTDINT 1
728 #   endif // (_MSC_VER >= 1700)
729 #  endif // defined(ASIO_MSVC)
730 # endif // !defined(ASIO_DISABLE_CSTDINT)
731 #endif // !defined(ASIO_HAS_CSTDINT)
732 
733 // Standard library support for the thread class.
734 #if !defined(ASIO_HAS_STD_THREAD)
735 # if !defined(ASIO_DISABLE_STD_THREAD)
736 #  if defined(__clang__)
737 #   if defined(ASIO_HAS_CLANG_LIBCXX)
738 #    define ASIO_HAS_STD_THREAD 1
739 #   elif (__cplusplus >= 201103)
740 #    if __has_include(<thread>)
741 #     define ASIO_HAS_STD_THREAD 1
742 #    endif // __has_include(<thread>)
743 #   endif // (__cplusplus >= 201103)
744 #  endif // defined(__clang__)
745 #  if defined(__GNUC__)
746 #   if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
747 #    if defined(__GXX_EXPERIMENTAL_CXX0X__)
748 #     define ASIO_HAS_STD_THREAD 1
749 #    endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
750 #   endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
751 #  endif // defined(__GNUC__)
752 #  if defined(ASIO_MSVC)
753 #   if (_MSC_VER >= 1700)
754 #    define ASIO_HAS_STD_THREAD 1
755 #   endif // (_MSC_VER >= 1700)
756 #  endif // defined(ASIO_MSVC)
757 # endif // !defined(ASIO_DISABLE_STD_THREAD)
758 #endif // !defined(ASIO_HAS_STD_THREAD)
759 
760 // Standard library support for the mutex and condition variable classes.
761 #if !defined(ASIO_HAS_STD_MUTEX_AND_CONDVAR)
762 # if !defined(ASIO_DISABLE_STD_MUTEX_AND_CONDVAR)
763 #  if defined(__clang__)
764 #   if defined(ASIO_HAS_CLANG_LIBCXX)
765 #    define ASIO_HAS_STD_MUTEX_AND_CONDVAR 1
766 #   elif (__cplusplus >= 201103)
767 #    if __has_include(<mutex>)
768 #     define ASIO_HAS_STD_MUTEX_AND_CONDVAR 1
769 #    endif // __has_include(<mutex>)
770 #   endif // (__cplusplus >= 201103)
771 #  endif // defined(__clang__)
772 #  if defined(__GNUC__)
773 #   if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
774 #    if defined(__GXX_EXPERIMENTAL_CXX0X__)
775 #     define ASIO_HAS_STD_MUTEX_AND_CONDVAR 1
776 #    endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
777 #   endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
778 #  endif // defined(__GNUC__)
779 #  if defined(ASIO_MSVC)
780 #   if (_MSC_VER >= 1700)
781 #    define ASIO_HAS_STD_MUTEX_AND_CONDVAR 1
782 #   endif // (_MSC_VER >= 1700)
783 #  endif // defined(ASIO_MSVC)
784 # endif // !defined(ASIO_DISABLE_STD_MUTEX_AND_CONDVAR)
785 #endif // !defined(ASIO_HAS_STD_MUTEX_AND_CONDVAR)
786 
787 // Standard library support for the call_once function.
788 #if !defined(ASIO_HAS_STD_CALL_ONCE)
789 # if !defined(ASIO_DISABLE_STD_CALL_ONCE)
790 #  if defined(__clang__)
791 #   if defined(ASIO_HAS_CLANG_LIBCXX)
792 #    define ASIO_HAS_STD_CALL_ONCE 1
793 #   elif (__cplusplus >= 201103)
794 #    if __has_include(<mutex>)
795 #     define ASIO_HAS_STD_CALL_ONCE 1
796 #    endif // __has_include(<mutex>)
797 #   endif // (__cplusplus >= 201103)
798 #  endif // defined(__clang__)
799 #  if defined(__GNUC__)
800 #   if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
801 #    if defined(__GXX_EXPERIMENTAL_CXX0X__)
802 #     define ASIO_HAS_STD_CALL_ONCE 1
803 #    endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
804 #   endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
805 #  endif // defined(__GNUC__)
806 #  if defined(ASIO_MSVC)
807 #   if (_MSC_VER >= 1700)
808 #    define ASIO_HAS_STD_CALL_ONCE 1
809 #   endif // (_MSC_VER >= 1700)
810 #  endif // defined(ASIO_MSVC)
811 # endif // !defined(ASIO_DISABLE_STD_CALL_ONCE)
812 #endif // !defined(ASIO_HAS_STD_CALL_ONCE)
813 
814 // Standard library support for futures.
815 #if !defined(ASIO_HAS_STD_FUTURE)
816 # if !defined(ASIO_DISABLE_STD_FUTURE)
817 #  if defined(__clang__)
818 #   if defined(ASIO_HAS_CLANG_LIBCXX)
819 #    define ASIO_HAS_STD_FUTURE 1
820 #   elif (__cplusplus >= 201103)
821 #    if __has_include(<future>)
822 #     define ASIO_HAS_STD_FUTURE 1
823 #    endif // __has_include(<mutex>)
824 #   endif // (__cplusplus >= 201103)
825 #  endif // defined(__clang__)
826 #  if defined(__GNUC__)
827 #   if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
828 #    if defined(__GXX_EXPERIMENTAL_CXX0X__)
829 #     define ASIO_HAS_STD_FUTURE 1
830 #    endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
831 #   endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
832 #  endif // defined(__GNUC__)
833 #  if defined(ASIO_MSVC)
834 #   if (_MSC_VER >= 1700)
835 #    define ASIO_HAS_STD_FUTURE 1
836 #   endif // (_MSC_VER >= 1700)
837 #  endif // defined(ASIO_MSVC)
838 # endif // !defined(ASIO_DISABLE_STD_FUTURE)
839 #endif // !defined(ASIO_HAS_STD_FUTURE)
840 
841 // Standard library support for std::string_view.
842 #if !defined(ASIO_HAS_STD_STRING_VIEW)
843 # if !defined(ASIO_DISABLE_STD_STRING_VIEW)
844 #  if defined(__clang__)
845 #   if defined(ASIO_HAS_CLANG_LIBCXX)
846 #    if (__cplusplus >= 201402)
847 #     if __has_include(<string_view>)
848 #      define ASIO_HAS_STD_STRING_VIEW 1
849 #     endif // __has_include(<string_view>)
850 #    endif // (__cplusplus >= 201402)
851 #   else // defined(ASIO_HAS_CLANG_LIBCXX)
852 #    if (__cplusplus >= 201703)
853 #     if __has_include(<string_view>)
854 #      define ASIO_HAS_STD_STRING_VIEW 1
855 #     endif // __has_include(<string_view>)
856 #    endif // (__cplusplus >= 201703)
857 #   endif // defined(ASIO_HAS_CLANG_LIBCXX)
858 #  elif defined(__GNUC__)
859 #   if (__GNUC__ >= 7)
860 #    if (__cplusplus >= 201703)
861 #     define ASIO_HAS_STD_STRING_VIEW 1
862 #    endif // (__cplusplus >= 201703)
863 #   endif // (__GNUC__ >= 7)
864 #  elif defined(ASIO_MSVC)
865 #   if (_MSC_VER >= 1910 && _MSVC_LANG >= 201703)
866 #    define ASIO_HAS_STD_STRING_VIEW 1
867 #   endif // (_MSC_VER >= 1910 && _MSVC_LANG >= 201703)
868 #  endif // defined(ASIO_MSVC)
869 # endif // !defined(ASIO_DISABLE_STD_STRING_VIEW)
870 #endif // !defined(ASIO_HAS_STD_STRING_VIEW)
871 
872 // Standard library support for std::experimental::string_view.
873 #if !defined(ASIO_HAS_STD_EXPERIMENTAL_STRING_VIEW)
874 # if !defined(ASIO_DISABLE_STD_EXPERIMENTAL_STRING_VIEW)
875 #  if defined(__clang__)
876 #   if defined(ASIO_HAS_CLANG_LIBCXX)
877 #    if (_LIBCPP_VERSION < 7000)
878 #     if (__cplusplus >= 201402)
879 #      if __has_include(<experimental/string_view>)
880 #       define ASIO_HAS_STD_EXPERIMENTAL_STRING_VIEW 1
881 #      endif // __has_include(<experimental/string_view>)
882 #     endif // (__cplusplus >= 201402)
883 #    endif // (_LIBCPP_VERSION < 7000)
884 #   else // defined(ASIO_HAS_CLANG_LIBCXX)
885 #    if (__cplusplus >= 201402)
886 #     if __has_include(<experimental/string_view>)
887 #      define ASIO_HAS_STD_EXPERIMENTAL_STRING_VIEW 1
888 #     endif // __has_include(<experimental/string_view>)
889 #    endif // (__cplusplus >= 201402)
890 #   endif // // defined(ASIO_HAS_CLANG_LIBCXX)
891 #  endif // defined(__clang__)
892 #  if defined(__GNUC__)
893 #   if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 9)) || (__GNUC__ > 4)
894 #    if (__cplusplus >= 201402)
895 #     define ASIO_HAS_STD_EXPERIMENTAL_STRING_VIEW 1
896 #    endif // (__cplusplus >= 201402)
897 #   endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 9)) || (__GNUC__ > 4)
898 #  endif // defined(__GNUC__)
899 # endif // !defined(ASIO_DISABLE_STD_EXPERIMENTAL_STRING_VIEW)
900 #endif // !defined(ASIO_HAS_STD_EXPERIMENTAL_STRING_VIEW)
901 
902 // Standard library has a string_view that we can use.
903 #if !defined(ASIO_HAS_STRING_VIEW)
904 # if !defined(ASIO_DISABLE_STRING_VIEW)
905 #  if defined(ASIO_HAS_STD_STRING_VIEW)
906 #   define ASIO_HAS_STRING_VIEW 1
907 #  elif defined(ASIO_HAS_STD_EXPERIMENTAL_STRING_VIEW)
908 #   define ASIO_HAS_STRING_VIEW 1
909 #  endif // defined(ASIO_HAS_STD_EXPERIMENTAL_STRING_VIEW)
910 # endif // !defined(ASIO_DISABLE_STRING_VIEW)
911 #endif // !defined(ASIO_HAS_STRING_VIEW)
912 
913 // Standard library support for iostream move construction and assignment.
914 #if !defined(ASIO_HAS_STD_IOSTREAM_MOVE)
915 # if !defined(ASIO_DISABLE_STD_IOSTREAM_MOVE)
916 #  if defined(__GNUC__)
917 #   if (__GNUC__ > 4)
918 #    if defined(__GXX_EXPERIMENTAL_CXX0X__)
919 #     define ASIO_HAS_STD_IOSTREAM_MOVE 1
920 #    endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
921 #   endif // (__GNUC__ > 4)
922 #  endif // defined(__GNUC__)
923 #  if defined(ASIO_MSVC)
924 #   if (_MSC_VER >= 1700)
925 #    define ASIO_HAS_STD_IOSTREAM_MOVE 1
926 #   endif // (_MSC_VER >= 1700)
927 #  endif // defined(ASIO_MSVC)
928 # endif // !defined(ASIO_DISABLE_STD_IOSTREAM_MOVE)
929 #endif // !defined(ASIO_HAS_STD_IOSTREAM_MOVE)
930 
931 // Standard library has invoke_result (which supersedes result_of).
932 #if !defined(ASIO_HAS_STD_INVOKE_RESULT)
933 # if !defined(ASIO_DISABLE_STD_INVOKE_RESULT)
934 #  if defined(ASIO_MSVC)
935 #   if (_MSC_VER >= 1911 && _MSVC_LANG >= 201703)
936 #    define ASIO_HAS_STD_INVOKE_RESULT 1
937 #   endif // (_MSC_VER >= 1911 && _MSVC_LANG >= 201703)
938 #  endif // defined(ASIO_MSVC)
939 # endif // !defined(ASIO_DISABLE_STD_INVOKE_RESULT)
940 #endif // !defined(ASIO_HAS_STD_INVOKE_RESULT)
941 
942 // Windows App target. Windows but with a limited API.
943 #if !defined(ASIO_WINDOWS_APP)
944 # if defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0603)
945 #  include <winapifamily.h>
946 #  if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) \
947    && !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
948 #   define ASIO_WINDOWS_APP 1
949 #  endif // WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
950          // && !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
951 # endif // defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0603)
952 #endif // !defined(ASIO_WINDOWS_APP)
953 
954 // Legacy WinRT target. Windows App is preferred.
955 #if !defined(ASIO_WINDOWS_RUNTIME)
956 # if !defined(ASIO_WINDOWS_APP)
957 #  if defined(__cplusplus_winrt)
958 #   include <winapifamily.h>
959 #   if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) \
960     && !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
961 #    define ASIO_WINDOWS_RUNTIME 1
962 #   endif // WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
963           // && !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
964 #  endif // defined(__cplusplus_winrt)
965 # endif // !defined(ASIO_WINDOWS_APP)
966 #endif // !defined(ASIO_WINDOWS_RUNTIME)
967 
968 // Windows target. Excludes WinRT but includes Windows App targets.
969 #if !defined(ASIO_WINDOWS)
970 # if !defined(ASIO_WINDOWS_RUNTIME)
971 #  if defined(ASIO_HAS_BOOST_CONFIG) && defined(BOOST_WINDOWS)
972 #   define ASIO_WINDOWS 1
973 #  elif defined(WIN32) || defined(_WIN32) || defined(__WIN32__)
974 #   define ASIO_WINDOWS 1
975 #  elif defined(ASIO_WINDOWS_APP)
976 #   define ASIO_WINDOWS 1
977 #  endif // defined(ASIO_HAS_BOOST_CONFIG) && defined(BOOST_WINDOWS)
978 # endif // !defined(ASIO_WINDOWS_RUNTIME)
979 #endif // !defined(ASIO_WINDOWS)
980 
981 // Windows: target OS version.
982 #if defined(ASIO_WINDOWS) || defined(__CYGWIN__)
983 # if !defined(_WIN32_WINNT) && !defined(_WIN32_WINDOWS)
984 #  if defined(_MSC_VER) || defined(__BORLANDC__)
985 #   pragma message( \
986   "Please define _WIN32_WINNT or _WIN32_WINDOWS appropriately. For example:\n"\
987   "- add -D_WIN32_WINNT=0x0601 to the compiler command line; or\n"\
988   "- add _WIN32_WINNT=0x0601 to your project's Preprocessor Definitions.\n"\
989   "Assuming _WIN32_WINNT=0x0601 (i.e. Windows 7 target).")
990 #  else // defined(_MSC_VER) || defined(__BORLANDC__)
991 #   warning Please define _WIN32_WINNT or _WIN32_WINDOWS appropriately.
992 #   warning For example, add -D_WIN32_WINNT=0x0601 to the compiler command line.
993 #   warning Assuming _WIN32_WINNT=0x0601 (i.e. Windows 7 target).
994 #  endif // defined(_MSC_VER) || defined(__BORLANDC__)
995 #  define _WIN32_WINNT 0x0601
996 # endif // !defined(_WIN32_WINNT) && !defined(_WIN32_WINDOWS)
997 # if defined(_MSC_VER)
998 #  if defined(_WIN32) && !defined(WIN32)
999 #   if !defined(_WINSOCK2API_)
1000 #    define WIN32 // Needed for correct types in winsock2.h
1001 #   else // !defined(_WINSOCK2API_)
1002 #    error Please define the macro WIN32 in your compiler options
1003 #   endif // !defined(_WINSOCK2API_)
1004 #  endif // defined(_WIN32) && !defined(WIN32)
1005 # endif // defined(_MSC_VER)
1006 # if defined(__BORLANDC__)
1007 #  if defined(__WIN32__) && !defined(WIN32)
1008 #   if !defined(_WINSOCK2API_)
1009 #    define WIN32 // Needed for correct types in winsock2.h
1010 #   else // !defined(_WINSOCK2API_)
1011 #    error Please define the macro WIN32 in your compiler options
1012 #   endif // !defined(_WINSOCK2API_)
1013 #  endif // defined(__WIN32__) && !defined(WIN32)
1014 # endif // defined(__BORLANDC__)
1015 # if defined(__CYGWIN__)
1016 #  if !defined(__USE_W32_SOCKETS)
1017 #   error You must add -D__USE_W32_SOCKETS to your compiler options.
1018 #  endif // !defined(__USE_W32_SOCKETS)
1019 # endif // defined(__CYGWIN__)
1020 #endif // defined(ASIO_WINDOWS) || defined(__CYGWIN__)
1021 
1022 // Windows: minimise header inclusion.
1023 #if defined(ASIO_WINDOWS) || defined(__CYGWIN__)
1024 # if !defined(ASIO_NO_WIN32_LEAN_AND_MEAN)
1025 #  if !defined(WIN32_LEAN_AND_MEAN)
1026 #   define WIN32_LEAN_AND_MEAN
1027 #  endif // !defined(WIN32_LEAN_AND_MEAN)
1028 # endif // !defined(ASIO_NO_WIN32_LEAN_AND_MEAN)
1029 #endif // defined(ASIO_WINDOWS) || defined(__CYGWIN__)
1030 
1031 // Windows: suppress definition of "min" and "max" macros.
1032 #if defined(ASIO_WINDOWS) || defined(__CYGWIN__)
1033 # if !defined(ASIO_NO_NOMINMAX)
1034 #  if !defined(NOMINMAX)
1035 #   define NOMINMAX 1
1036 #  endif // !defined(NOMINMAX)
1037 # endif // !defined(ASIO_NO_NOMINMAX)
1038 #endif // defined(ASIO_WINDOWS) || defined(__CYGWIN__)
1039 
1040 // Windows: IO Completion Ports.
1041 #if !defined(ASIO_HAS_IOCP)
1042 # if defined(ASIO_WINDOWS) || defined(__CYGWIN__)
1043 #  if defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0400)
1044 #   if !defined(UNDER_CE) && !defined(ASIO_WINDOWS_APP)
1045 #    if !defined(ASIO_DISABLE_IOCP)
1046 #     define ASIO_HAS_IOCP 1
1047 #    endif // !defined(ASIO_DISABLE_IOCP)
1048 #   endif // !defined(UNDER_CE) && !defined(ASIO_WINDOWS_APP)
1049 #  endif // defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0400)
1050 # endif // defined(ASIO_WINDOWS) || defined(__CYGWIN__)
1051 #endif // !defined(ASIO_HAS_IOCP)
1052 
1053 // On POSIX (and POSIX-like) platforms we need to include unistd.h in order to
1054 // get access to the various platform feature macros, e.g. to be able to test
1055 // for threads support.
1056 #if !defined(ASIO_HAS_UNISTD_H)
1057 # if !defined(ASIO_HAS_BOOST_CONFIG)
1058 #  if defined(unix) \
1059    || defined(__unix) \
1060    || defined(_XOPEN_SOURCE) \
1061    || defined(_POSIX_SOURCE) \
1062    || (defined(__MACH__) && defined(__APPLE__)) \
1063    || defined(__FreeBSD__) \
1064    || defined(__NetBSD__) \
1065    || defined(__OpenBSD__) \
1066    || defined(__linux__) \
1067    || defined(__HAIKU__)
1068 #   define ASIO_HAS_UNISTD_H 1
1069 #  endif
1070 # endif // !defined(ASIO_HAS_BOOST_CONFIG)
1071 #endif // !defined(ASIO_HAS_UNISTD_H)
1072 #if defined(ASIO_HAS_UNISTD_H)
1073 # include <unistd.h>
1074 #endif // defined(ASIO_HAS_UNISTD_H)
1075 
1076 // Linux: epoll, eventfd and timerfd.
1077 #if defined(__linux__)
1078 # include <linux/version.h>
1079 # if !defined(ASIO_HAS_EPOLL)
1080 #  if !defined(ASIO_DISABLE_EPOLL)
1081 #   if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,45)
1082 #    define ASIO_HAS_EPOLL 1
1083 #   endif // LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,45)
1084 #  endif // !defined(ASIO_DISABLE_EPOLL)
1085 # endif // !defined(ASIO_HAS_EPOLL)
1086 # if !defined(ASIO_HAS_EVENTFD)
1087 #  if !defined(ASIO_DISABLE_EVENTFD)
1088 #   if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
1089 #    define ASIO_HAS_EVENTFD 1
1090 #   endif // LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
1091 #  endif // !defined(ASIO_DISABLE_EVENTFD)
1092 # endif // !defined(ASIO_HAS_EVENTFD)
1093 # if !defined(ASIO_HAS_TIMERFD)
1094 #  if defined(ASIO_HAS_EPOLL)
1095 #   if (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 8)
1096 #    define ASIO_HAS_TIMERFD 1
1097 #   endif // (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 8)
1098 #  endif // defined(ASIO_HAS_EPOLL)
1099 # endif // !defined(ASIO_HAS_TIMERFD)
1100 #endif // defined(__linux__)
1101 
1102 // Mac OS X, FreeBSD, NetBSD, OpenBSD: kqueue.
1103 #if (defined(__MACH__) && defined(__APPLE__)) \
1104   || defined(__DragonFly__) \
1105   || defined(__FreeBSD__) \
1106   || defined(__NetBSD__) \
1107   || defined(__OpenBSD__)
1108 # if !defined(ASIO_HAS_KQUEUE)
1109 #  if !defined(ASIO_DISABLE_KQUEUE)
1110 #   define ASIO_HAS_KQUEUE 1
1111 #  endif // !defined(ASIO_DISABLE_KQUEUE)
1112 # endif // !defined(ASIO_HAS_KQUEUE)
1113 #endif // (defined(__MACH__) && defined(__APPLE__))
1114        //   || defined(__FreeBSD__)
1115        //   || defined(__NetBSD__)
1116        //   || defined(__OpenBSD__)
1117 
1118 // Solaris: /dev/poll.
1119 #if defined(__sun)
1120 # if !defined(ASIO_HAS_DEV_POLL)
1121 #  if !defined(ASIO_DISABLE_DEV_POLL)
1122 #   define ASIO_HAS_DEV_POLL 1
1123 #  endif // !defined(ASIO_DISABLE_DEV_POLL)
1124 # endif // !defined(ASIO_HAS_DEV_POLL)
1125 #endif // defined(__sun)
1126 
1127 // Serial ports.
1128 #if !defined(ASIO_HAS_SERIAL_PORT)
1129 # if defined(ASIO_HAS_IOCP) \
1130   || !defined(ASIO_WINDOWS) \
1131   && !defined(ASIO_WINDOWS_RUNTIME) \
1132   && !defined(__CYGWIN__)
1133 #  if !defined(__SYMBIAN32__)
1134 #   if !defined(ASIO_DISABLE_SERIAL_PORT)
1135 #    define ASIO_HAS_SERIAL_PORT 1
1136 #   endif // !defined(ASIO_DISABLE_SERIAL_PORT)
1137 #  endif // !defined(__SYMBIAN32__)
1138 # endif // defined(ASIO_HAS_IOCP)
1139         //   || !defined(ASIO_WINDOWS)
1140         //   && !defined(ASIO_WINDOWS_RUNTIME)
1141         //   && !defined(__CYGWIN__)
1142 #endif // !defined(ASIO_HAS_SERIAL_PORT)
1143 
1144 // Windows: stream handles.
1145 #if !defined(ASIO_HAS_WINDOWS_STREAM_HANDLE)
1146 # if !defined(ASIO_DISABLE_WINDOWS_STREAM_HANDLE)
1147 #  if defined(ASIO_HAS_IOCP)
1148 #   define ASIO_HAS_WINDOWS_STREAM_HANDLE 1
1149 #  endif // defined(ASIO_HAS_IOCP)
1150 # endif // !defined(ASIO_DISABLE_WINDOWS_STREAM_HANDLE)
1151 #endif // !defined(ASIO_HAS_WINDOWS_STREAM_HANDLE)
1152 
1153 // Windows: random access handles.
1154 #if !defined(ASIO_HAS_WINDOWS_RANDOM_ACCESS_HANDLE)
1155 # if !defined(ASIO_DISABLE_WINDOWS_RANDOM_ACCESS_HANDLE)
1156 #  if defined(ASIO_HAS_IOCP)
1157 #   define ASIO_HAS_WINDOWS_RANDOM_ACCESS_HANDLE 1
1158 #  endif // defined(ASIO_HAS_IOCP)
1159 # endif // !defined(ASIO_DISABLE_WINDOWS_RANDOM_ACCESS_HANDLE)
1160 #endif // !defined(ASIO_HAS_WINDOWS_RANDOM_ACCESS_HANDLE)
1161 
1162 // Windows: object handles.
1163 #if !defined(ASIO_HAS_WINDOWS_OBJECT_HANDLE)
1164 # if !defined(ASIO_DISABLE_WINDOWS_OBJECT_HANDLE)
1165 #  if defined(ASIO_WINDOWS) || defined(__CYGWIN__)
1166 #   if !defined(UNDER_CE) && !defined(ASIO_WINDOWS_APP)
1167 #    define ASIO_HAS_WINDOWS_OBJECT_HANDLE 1
1168 #   endif // !defined(UNDER_CE) && !defined(ASIO_WINDOWS_APP)
1169 #  endif // defined(ASIO_WINDOWS) || defined(__CYGWIN__)
1170 # endif // !defined(ASIO_DISABLE_WINDOWS_OBJECT_HANDLE)
1171 #endif // !defined(ASIO_HAS_WINDOWS_OBJECT_HANDLE)
1172 
1173 // Windows: OVERLAPPED wrapper.
1174 #if !defined(ASIO_HAS_WINDOWS_OVERLAPPED_PTR)
1175 # if !defined(ASIO_DISABLE_WINDOWS_OVERLAPPED_PTR)
1176 #  if defined(ASIO_HAS_IOCP)
1177 #   define ASIO_HAS_WINDOWS_OVERLAPPED_PTR 1
1178 #  endif // defined(ASIO_HAS_IOCP)
1179 # endif // !defined(ASIO_DISABLE_WINDOWS_OVERLAPPED_PTR)
1180 #endif // !defined(ASIO_HAS_WINDOWS_OVERLAPPED_PTR)
1181 
1182 // POSIX: stream-oriented file descriptors.
1183 #if !defined(ASIO_HAS_POSIX_STREAM_DESCRIPTOR)
1184 # if !defined(ASIO_DISABLE_POSIX_STREAM_DESCRIPTOR)
1185 #  if !defined(ASIO_WINDOWS) \
1186   && !defined(ASIO_WINDOWS_RUNTIME) \
1187   && !defined(__CYGWIN__)
1188 #   define ASIO_HAS_POSIX_STREAM_DESCRIPTOR 1
1189 #  endif // !defined(ASIO_WINDOWS)
1190          //   && !defined(ASIO_WINDOWS_RUNTIME)
1191          //   && !defined(__CYGWIN__)
1192 # endif // !defined(ASIO_DISABLE_POSIX_STREAM_DESCRIPTOR)
1193 #endif // !defined(ASIO_HAS_POSIX_STREAM_DESCRIPTOR)
1194 
1195 // UNIX domain sockets.
1196 #if !defined(ASIO_HAS_LOCAL_SOCKETS)
1197 # if !defined(ASIO_DISABLE_LOCAL_SOCKETS)
1198 #  if !defined(ASIO_WINDOWS) \
1199   && !defined(ASIO_WINDOWS_RUNTIME) \
1200   && !defined(__CYGWIN__)
1201 #   define ASIO_HAS_LOCAL_SOCKETS 1
1202 #  endif // !defined(ASIO_WINDOWS)
1203          //   && !defined(ASIO_WINDOWS_RUNTIME)
1204          //   && !defined(__CYGWIN__)
1205 # endif // !defined(ASIO_DISABLE_LOCAL_SOCKETS)
1206 #endif // !defined(ASIO_HAS_LOCAL_SOCKETS)
1207 
1208 // Can use sigaction() instead of signal().
1209 #if !defined(ASIO_HAS_SIGACTION)
1210 # if !defined(ASIO_DISABLE_SIGACTION)
1211 #  if !defined(ASIO_WINDOWS) \
1212   && !defined(ASIO_WINDOWS_RUNTIME) \
1213   && !defined(__CYGWIN__)
1214 #   define ASIO_HAS_SIGACTION 1
1215 #  endif // !defined(ASIO_WINDOWS)
1216          //   && !defined(ASIO_WINDOWS_RUNTIME)
1217          //   && !defined(__CYGWIN__)
1218 # endif // !defined(ASIO_DISABLE_SIGACTION)
1219 #endif // !defined(ASIO_HAS_SIGACTION)
1220 
1221 // Can use signal().
1222 #if !defined(ASIO_HAS_SIGNAL)
1223 # if !defined(ASIO_DISABLE_SIGNAL)
1224 #  if !defined(UNDER_CE)
1225 #   define ASIO_HAS_SIGNAL 1
1226 #  endif // !defined(UNDER_CE)
1227 # endif // !defined(ASIO_DISABLE_SIGNAL)
1228 #endif // !defined(ASIO_HAS_SIGNAL)
1229 
1230 // Can use getaddrinfo() and getnameinfo().
1231 #if !defined(ASIO_HAS_GETADDRINFO)
1232 # if !defined(ASIO_DISABLE_GETADDRINFO)
1233 #  if defined(ASIO_WINDOWS) || defined(__CYGWIN__)
1234 #   if defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0501)
1235 #    define ASIO_HAS_GETADDRINFO 1
1236 #   elif defined(UNDER_CE)
1237 #    define ASIO_HAS_GETADDRINFO 1
1238 #   endif // defined(UNDER_CE)
1239 #  elif defined(__MACH__) && defined(__APPLE__)
1240 #   if defined(__MAC_OS_X_VERSION_MIN_REQUIRED)
1241 #    if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050)
1242 #     define ASIO_HAS_GETADDRINFO 1
1243 #    endif // (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050)
1244 #   else // defined(__MAC_OS_X_VERSION_MIN_REQUIRED)
1245 #    define ASIO_HAS_GETADDRINFO 1
1246 #   endif // defined(__MAC_OS_X_VERSION_MIN_REQUIRED)
1247 #  else // defined(__MACH__) && defined(__APPLE__)
1248 #   define ASIO_HAS_GETADDRINFO 1
1249 #  endif // defined(__MACH__) && defined(__APPLE__)
1250 # endif // !defined(ASIO_DISABLE_GETADDRINFO)
1251 #endif // !defined(ASIO_HAS_GETADDRINFO)
1252 
1253 // Whether standard iostreams are disabled.
1254 #if !defined(ASIO_NO_IOSTREAM)
1255 # if defined(ASIO_HAS_BOOST_CONFIG) && defined(BOOST_NO_IOSTREAM)
1256 #  define ASIO_NO_IOSTREAM 1
1257 # endif // !defined(BOOST_NO_IOSTREAM)
1258 #endif // !defined(ASIO_NO_IOSTREAM)
1259 
1260 // Whether exception handling is disabled.
1261 #if !defined(ASIO_NO_EXCEPTIONS)
1262 # if defined(ASIO_HAS_BOOST_CONFIG) && defined(BOOST_NO_EXCEPTIONS)
1263 #  define ASIO_NO_EXCEPTIONS 1
1264 # endif // !defined(BOOST_NO_EXCEPTIONS)
1265 #endif // !defined(ASIO_NO_EXCEPTIONS)
1266 
1267 // Whether the typeid operator is supported.
1268 #if !defined(ASIO_NO_TYPEID)
1269 # if defined(ASIO_HAS_BOOST_CONFIG) && defined(BOOST_NO_TYPEID)
1270 #  define ASIO_NO_TYPEID 1
1271 # endif // !defined(BOOST_NO_TYPEID)
1272 #endif // !defined(ASIO_NO_TYPEID)
1273 
1274 // Threads.
1275 #if !defined(ASIO_HAS_THREADS)
1276 # if !defined(ASIO_DISABLE_THREADS)
1277 #  if defined(ASIO_HAS_BOOST_CONFIG) && defined(BOOST_HAS_THREADS)
1278 #   define ASIO_HAS_THREADS 1
1279 #  elif defined(__GNUC__) && !defined(__MINGW32__) \
1280      && !defined(linux) && !defined(__linux) && !defined(__linux__)
1281 #   define ASIO_HAS_THREADS 1
1282 #  elif defined(_MT) || defined(__MT__)
1283 #   define ASIO_HAS_THREADS 1
1284 #  elif defined(_REENTRANT)
1285 #   define ASIO_HAS_THREADS 1
1286 #  elif defined(__APPLE__)
1287 #   define ASIO_HAS_THREADS 1
1288 #  elif defined(__HAIKU__)
1289 #   define ASIO_HAS_THREADS 1
1290 #  elif defined(_POSIX_THREADS) && (_POSIX_THREADS + 0 >= 0)
1291 #   define ASIO_HAS_THREADS 1
1292 #  elif defined(_PTHREADS)
1293 #   define ASIO_HAS_THREADS 1
1294 #  endif // defined(ASIO_HAS_BOOST_CONFIG) && defined(BOOST_HAS_THREADS)
1295 # endif // !defined(ASIO_DISABLE_THREADS)
1296 #endif // !defined(ASIO_HAS_THREADS)
1297 
1298 // POSIX threads.
1299 #if !defined(ASIO_HAS_PTHREADS)
1300 # if defined(ASIO_HAS_THREADS)
1301 #  if defined(ASIO_HAS_BOOST_CONFIG) && defined(BOOST_HAS_PTHREADS)
1302 #   define ASIO_HAS_PTHREADS 1
1303 #  elif defined(_POSIX_THREADS) && (_POSIX_THREADS + 0 >= 0)
1304 #   define ASIO_HAS_PTHREADS 1
1305 #  elif defined(__HAIKU__)
1306 #   define ASIO_HAS_PTHREADS 1
1307 #  endif // defined(ASIO_HAS_BOOST_CONFIG) && defined(BOOST_HAS_PTHREADS)
1308 # endif // defined(ASIO_HAS_THREADS)
1309 #endif // !defined(ASIO_HAS_PTHREADS)
1310 
1311 // Helper to prevent macro expansion.
1312 #define ASIO_PREVENT_MACRO_SUBSTITUTION
1313 
1314 // Helper to define in-class constants.
1315 #if !defined(ASIO_STATIC_CONSTANT)
1316 # if !defined(ASIO_DISABLE_BOOST_STATIC_CONSTANT)
1317 #  define ASIO_STATIC_CONSTANT(type, assignment) \
1318     BOOST_STATIC_CONSTANT(type, assignment)
1319 # else // !defined(ASIO_DISABLE_BOOST_STATIC_CONSTANT)
1320 #  define ASIO_STATIC_CONSTANT(type, assignment) \
1321     static const type assignment
1322 # endif // !defined(ASIO_DISABLE_BOOST_STATIC_CONSTANT)
1323 #endif // !defined(ASIO_STATIC_CONSTANT)
1324 
1325 // Boost array library.
1326 #if !defined(ASIO_HAS_BOOST_ARRAY)
1327 # if !defined(ASIO_DISABLE_BOOST_ARRAY)
1328 #  define ASIO_HAS_BOOST_ARRAY 1
1329 # endif // !defined(ASIO_DISABLE_BOOST_ARRAY)
1330 #endif // !defined(ASIO_HAS_BOOST_ARRAY)
1331 
1332 // Boost assert macro.
1333 #if !defined(ASIO_HAS_BOOST_ASSERT)
1334 # if !defined(ASIO_DISABLE_BOOST_ASSERT)
1335 #  define ASIO_HAS_BOOST_ASSERT 1
1336 # endif // !defined(ASIO_DISABLE_BOOST_ASSERT)
1337 #endif // !defined(ASIO_HAS_BOOST_ASSERT)
1338 
1339 // Boost limits header.
1340 #if !defined(ASIO_HAS_BOOST_LIMITS)
1341 # if !defined(ASIO_DISABLE_BOOST_LIMITS)
1342 #  define ASIO_HAS_BOOST_LIMITS 1
1343 # endif // !defined(ASIO_DISABLE_BOOST_LIMITS)
1344 #endif // !defined(ASIO_HAS_BOOST_LIMITS)
1345 
1346 // Boost throw_exception function.
1347 #if !defined(ASIO_HAS_BOOST_THROW_EXCEPTION)
1348 # if !defined(ASIO_DISABLE_BOOST_THROW_EXCEPTION)
1349 #  define ASIO_HAS_BOOST_THROW_EXCEPTION 1
1350 # endif // !defined(ASIO_DISABLE_BOOST_THROW_EXCEPTION)
1351 #endif // !defined(ASIO_HAS_BOOST_THROW_EXCEPTION)
1352 
1353 // Boost regex library.
1354 #if !defined(ASIO_HAS_BOOST_REGEX)
1355 # if !defined(ASIO_DISABLE_BOOST_REGEX)
1356 #  define ASIO_HAS_BOOST_REGEX 1
1357 # endif // !defined(ASIO_DISABLE_BOOST_REGEX)
1358 #endif // !defined(ASIO_HAS_BOOST_REGEX)
1359 
1360 // Boost bind function.
1361 #if !defined(ASIO_HAS_BOOST_BIND)
1362 # if !defined(ASIO_DISABLE_BOOST_BIND)
1363 #  define ASIO_HAS_BOOST_BIND 1
1364 # endif // !defined(ASIO_DISABLE_BOOST_BIND)
1365 #endif // !defined(ASIO_HAS_BOOST_BIND)
1366 
1367 // Boost's BOOST_WORKAROUND macro.
1368 #if !defined(ASIO_HAS_BOOST_WORKAROUND)
1369 # if !defined(ASIO_DISABLE_BOOST_WORKAROUND)
1370 #  define ASIO_HAS_BOOST_WORKAROUND 1
1371 # endif // !defined(ASIO_DISABLE_BOOST_WORKAROUND)
1372 #endif // !defined(ASIO_HAS_BOOST_WORKAROUND)
1373 
1374 // Microsoft Visual C++'s secure C runtime library.
1375 #if !defined(ASIO_HAS_SECURE_RTL)
1376 # if !defined(ASIO_DISABLE_SECURE_RTL)
1377 #  if defined(ASIO_MSVC) \
1378     && (ASIO_MSVC >= 1400) \
1379     && !defined(UNDER_CE)
1380 #   define ASIO_HAS_SECURE_RTL 1
1381 #  endif // defined(ASIO_MSVC)
1382          // && (ASIO_MSVC >= 1400)
1383          // && !defined(UNDER_CE)
1384 # endif // !defined(ASIO_DISABLE_SECURE_RTL)
1385 #endif // !defined(ASIO_HAS_SECURE_RTL)
1386 
1387 // Handler hooking. Disabled for ancient Borland C++ and gcc compilers.
1388 #if !defined(ASIO_HAS_HANDLER_HOOKS)
1389 # if !defined(ASIO_DISABLE_HANDLER_HOOKS)
1390 #  if defined(__GNUC__)
1391 #   if (__GNUC__ >= 3)
1392 #    define ASIO_HAS_HANDLER_HOOKS 1
1393 #   endif // (__GNUC__ >= 3)
1394 #  elif !defined(__BORLANDC__)
1395 #   define ASIO_HAS_HANDLER_HOOKS 1
1396 #  endif // !defined(__BORLANDC__)
1397 # endif // !defined(ASIO_DISABLE_HANDLER_HOOKS)
1398 #endif // !defined(ASIO_HAS_HANDLER_HOOKS)
1399 
1400 // Support for the __thread keyword extension.
1401 #if !defined(ASIO_DISABLE_THREAD_KEYWORD_EXTENSION)
1402 # if defined(__linux__)
1403 #  if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
1404 #   if ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)
1405 #    if !defined(__INTEL_COMPILER) && !defined(__ICL) \
1406        && !(defined(__clang__) && defined(__ANDROID__))
1407 #     define ASIO_HAS_THREAD_KEYWORD_EXTENSION 1
1408 #     define ASIO_THREAD_KEYWORD __thread
1409 #    elif defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 1100)
1410 #     define ASIO_HAS_THREAD_KEYWORD_EXTENSION 1
1411 #    endif // defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 1100)
1412            // && !(defined(__clang__) && defined(__ANDROID__))
1413 #   endif // ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)
1414 #  endif // defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
1415 # endif // defined(__linux__)
1416 # if defined(ASIO_MSVC) && defined(ASIO_WINDOWS_RUNTIME)
1417 #  if (_MSC_VER >= 1700)
1418 #   define ASIO_HAS_THREAD_KEYWORD_EXTENSION 1
1419 #   define ASIO_THREAD_KEYWORD __declspec(thread)
1420 #  endif // (_MSC_VER >= 1700)
1421 # endif // defined(ASIO_MSVC) && defined(ASIO_WINDOWS_RUNTIME)
1422 #endif // !defined(ASIO_DISABLE_THREAD_KEYWORD_EXTENSION)
1423 #if !defined(ASIO_THREAD_KEYWORD)
1424 # define ASIO_THREAD_KEYWORD __thread
1425 #endif // !defined(ASIO_THREAD_KEYWORD)
1426 
1427 // Support for POSIX ssize_t typedef.
1428 #if !defined(ASIO_DISABLE_SSIZE_T)
1429 # if defined(__linux__) \
1430    || (defined(__MACH__) && defined(__APPLE__))
1431 #  define ASIO_HAS_SSIZE_T 1
1432 # endif // defined(__linux__)
1433         //   || (defined(__MACH__) && defined(__APPLE__))
1434 #endif // !defined(ASIO_DISABLE_SSIZE_T)
1435 
1436 // Helper macros to manage transition away from error_code return values.
1437 #if defined(ASIO_NO_DEPRECATED)
1438 # define ASIO_SYNC_OP_VOID void
1439 # define ASIO_SYNC_OP_VOID_RETURN(e) return
1440 #else // defined(ASIO_NO_DEPRECATED)
1441 # define ASIO_SYNC_OP_VOID asio::error_code
1442 # define ASIO_SYNC_OP_VOID_RETURN(e) return e
1443 #endif // defined(ASIO_NO_DEPRECATED)
1444 
1445 // Newer gcc, clang need special treatment to suppress unused typedef warnings.
1446 #if defined(__clang__)
1447 # if defined(__apple_build_version__)
1448 #  if (__clang_major__ >= 7)
1449 #   define ASIO_UNUSED_TYPEDEF __attribute__((__unused__))
1450 #  endif // (__clang_major__ >= 7)
1451 # elif ((__clang_major__ == 3) && (__clang_minor__ >= 6)) \
1452     || (__clang_major__ > 3)
1453 #  define ASIO_UNUSED_TYPEDEF __attribute__((__unused__))
1454 # endif // ((__clang_major__ == 3) && (__clang_minor__ >= 6))
1455         //   || (__clang_major__ > 3)
1456 #elif defined(__GNUC__)
1457 # if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 8)) || (__GNUC__ > 4)
1458 #  define ASIO_UNUSED_TYPEDEF __attribute__((__unused__))
1459 # endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 8)) || (__GNUC__ > 4)
1460 #endif // defined(__GNUC__)
1461 #if !defined(ASIO_UNUSED_TYPEDEF)
1462 # define ASIO_UNUSED_TYPEDEF
1463 #endif // !defined(ASIO_UNUSED_TYPEDEF)
1464 
1465 // Some versions of gcc generate spurious warnings about unused variables.
1466 #if defined(__GNUC__)
1467 # if (__GNUC__ >= 4)
1468 #  define ASIO_UNUSED_VARIABLE __attribute__((__unused__))
1469 # endif // (__GNUC__ >= 4)
1470 #endif // defined(__GNUC__)
1471 #if !defined(ASIO_UNUSED_VARIABLE)
1472 # define ASIO_UNUSED_VARIABLE
1473 #endif // !defined(ASIO_UNUSED_VARIABLE)
1474 
1475 // Support co_await on compilers known to allow it.
1476 #if !defined(ASIO_HAS_CO_AWAIT)
1477 # if !defined(ASIO_DISABLE_CO_AWAIT)
1478 #  if defined(ASIO_MSVC)
1479 #   if (_MSC_FULL_VER >= 190023506)
1480 #    if defined(_RESUMABLE_FUNCTIONS_SUPPORTED)
1481 #     define ASIO_HAS_CO_AWAIT 1
1482 #    endif // defined(_RESUMABLE_FUNCTIONS_SUPPORTED)
1483 #   endif // (_MSC_FULL_VER >= 190023506)
1484 #  endif // defined(ASIO_MSVC)
1485 # endif // !defined(ASIO_DISABLE_CO_AWAIT)
1486 # if defined(__clang__)
1487 #  if (__cplusplus >= 201703) && (__cpp_coroutines >= 201703)
1488 #   if __has_include(<experimental/coroutine>)
1489 #    define ASIO_HAS_CO_AWAIT 1
1490 #   endif // __has_include(<experimental/coroutine>)
1491 #  endif // (__cplusplus >= 201703) && (__cpp_coroutines >= 201703)
1492 # endif // defined(__clang__)
1493 #endif // !defined(ASIO_HAS_CO_AWAIT)
1494 
1495 #endif // ASIO_DETAIL_CONFIG_HPP
1496