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 // Standard library support for system errors.
332 #if !defined(ASIO_HAS_STD_SYSTEM_ERROR)
333 # if !defined(ASIO_DISABLE_STD_SYSTEM_ERROR)
334 #  if defined(__clang__)
335 #   if defined(ASIO_HAS_CLANG_LIBCXX)
336 #    define ASIO_HAS_STD_SYSTEM_ERROR 1
337 #   elif (__cplusplus >= 201103)
338 #    if __has_include(<system_error>)
339 #     define ASIO_HAS_STD_SYSTEM_ERROR 1
340 #    endif // __has_include(<system_error>)
341 #   endif // (__cplusplus >= 201103)
342 #  endif // defined(__clang__)
343 #  if defined(__GNUC__)
344 #   if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4)
345 #    if defined(__GXX_EXPERIMENTAL_CXX0X__)
346 #     define ASIO_HAS_STD_SYSTEM_ERROR 1
347 #    endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
348 #   endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4)
349 #  endif // defined(__GNUC__)
350 #  if defined(ASIO_MSVC)
351 #   if (_MSC_VER >= 1700)
352 #    define ASIO_HAS_STD_SYSTEM_ERROR 1
353 #   endif // (_MSC_VER >= 1700)
354 #  endif // defined(ASIO_MSVC)
355 # endif // !defined(ASIO_DISABLE_STD_SYSTEM_ERROR)
356 #endif // !defined(ASIO_HAS_STD_SYSTEM_ERROR)
357 
358 // Compliant C++11 compilers put noexcept specifiers on error_category members.
359 #if !defined(ASIO_ERROR_CATEGORY_NOEXCEPT)
360 # if (BOOST_VERSION >= 105300)
361 #  define ASIO_ERROR_CATEGORY_NOEXCEPT BOOST_NOEXCEPT
362 # elif defined(__clang__)
363 #  if __has_feature(__cxx_noexcept__)
364 #   define ASIO_ERROR_CATEGORY_NOEXCEPT noexcept(true)
365 #  endif // __has_feature(__cxx_noexcept__)
366 # elif defined(__GNUC__)
367 #  if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
368 #   if defined(__GXX_EXPERIMENTAL_CXX0X__)
369 #     define ASIO_ERROR_CATEGORY_NOEXCEPT noexcept(true)
370 #   endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
371 #  endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
372 # elif defined(ASIO_MSVC)
373 #  if (_MSC_VER >= 1900)
374 #   define ASIO_ERROR_CATEGORY_NOEXCEPT noexcept(true)
375 #  endif // (_MSC_VER >= 1900)
376 # endif // defined(ASIO_MSVC)
377 # if !defined(ASIO_ERROR_CATEGORY_NOEXCEPT)
378 #  define ASIO_ERROR_CATEGORY_NOEXCEPT
379 # endif // !defined(ASIO_ERROR_CATEGORY_NOEXCEPT)
380 #endif // !defined(ASIO_ERROR_CATEGORY_NOEXCEPT)
381 
382 // Standard library support for arrays.
383 #if !defined(ASIO_HAS_STD_ARRAY)
384 # if !defined(ASIO_DISABLE_STD_ARRAY)
385 #  if defined(__clang__)
386 #   if defined(ASIO_HAS_CLANG_LIBCXX)
387 #    define ASIO_HAS_STD_ARRAY 1
388 #   elif (__cplusplus >= 201103)
389 #    if __has_include(<array>)
390 #     define ASIO_HAS_STD_ARRAY 1
391 #    endif // __has_include(<array>)
392 #   endif // (__cplusplus >= 201103)
393 #  endif // defined(__clang__)
394 #  if defined(__GNUC__)
395 #   if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 4)
396 #    if defined(__GXX_EXPERIMENTAL_CXX0X__)
397 #     define ASIO_HAS_STD_ARRAY 1
398 #    endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
399 #   endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 4)
400 #  endif // defined(__GNUC__)
401 #  if defined(ASIO_MSVC)
402 #   if (_MSC_VER >= 1600)
403 #    define ASIO_HAS_STD_ARRAY 1
404 #   endif // (_MSC_VER >= 1600)
405 #  endif // defined(ASIO_MSVC)
406 # endif // !defined(ASIO_DISABLE_STD_ARRAY)
407 #endif // !defined(ASIO_HAS_STD_ARRAY)
408 
409 // Standard library support for shared_ptr and weak_ptr.
410 #if !defined(ASIO_HAS_STD_SHARED_PTR)
411 # if !defined(ASIO_DISABLE_STD_SHARED_PTR)
412 #  if defined(__clang__)
413 #   if defined(ASIO_HAS_CLANG_LIBCXX)
414 #    define ASIO_HAS_STD_SHARED_PTR 1
415 #   elif (__cplusplus >= 201103)
416 #    define ASIO_HAS_STD_SHARED_PTR 1
417 #   endif // (__cplusplus >= 201103)
418 #  endif // defined(__clang__)
419 #  if defined(__GNUC__)
420 #   if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 4)
421 #    if defined(__GXX_EXPERIMENTAL_CXX0X__)
422 #     define ASIO_HAS_STD_SHARED_PTR 1
423 #    endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
424 #   endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 4)
425 #  endif // defined(__GNUC__)
426 #  if defined(ASIO_MSVC)
427 #   if (_MSC_VER >= 1600)
428 #    define ASIO_HAS_STD_SHARED_PTR 1
429 #   endif // (_MSC_VER >= 1600)
430 #  endif // defined(ASIO_MSVC)
431 # endif // !defined(ASIO_DISABLE_STD_SHARED_PTR)
432 #endif // !defined(ASIO_HAS_STD_SHARED_PTR)
433 
434 // Standard library support for allocator_arg_t.
435 #if !defined(ASIO_HAS_STD_ALLOCATOR_ARG)
436 # if !defined(ASIO_DISABLE_STD_ALLOCATOR_ARG)
437 #  if defined(__clang__)
438 #   if defined(ASIO_HAS_CLANG_LIBCXX)
439 #    define ASIO_HAS_STD_ALLOCATOR_ARG 1
440 #   elif (__cplusplus >= 201103)
441 #    define ASIO_HAS_STD_ALLOCATOR_ARG 1
442 #   endif // (__cplusplus >= 201103)
443 #  endif // defined(__clang__)
444 #  if defined(__GNUC__)
445 #   if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4)
446 #    if defined(__GXX_EXPERIMENTAL_CXX0X__)
447 #     define ASIO_HAS_STD_ALLOCATOR_ARG 1
448 #    endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
449 #   endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4)
450 #  endif // defined(__GNUC__)
451 #  if defined(ASIO_MSVC)
452 #   if (_MSC_VER >= 1600)
453 #    define ASIO_HAS_STD_ALLOCATOR_ARG 1
454 #   endif // (_MSC_VER >= 1600)
455 #  endif // defined(ASIO_MSVC)
456 # endif // !defined(ASIO_DISABLE_STD_ALLOCATOR_ARG)
457 #endif // !defined(ASIO_HAS_STD_ALLOCATOR_ARG)
458 
459 // Standard library support for atomic operations.
460 #if !defined(ASIO_HAS_STD_ATOMIC)
461 # if !defined(ASIO_DISABLE_STD_ATOMIC)
462 #  if defined(__clang__)
463 #   if defined(ASIO_HAS_CLANG_LIBCXX)
464 #    define ASIO_HAS_STD_ATOMIC 1
465 #   elif (__cplusplus >= 201103)
466 #    if __has_include(<atomic>)
467 #     define ASIO_HAS_STD_ATOMIC 1
468 #    endif // __has_include(<atomic>)
469 #   elif defined(__apple_build_version__) && defined(_LIBCPP_VERSION)
470 #    if (__clang_major__ >= 10)
471 #     if __has_include(<atomic>)
472 #      define ASIO_HAS_STD_ATOMIC 1
473 #     endif // __has_include(<atomic>)
474 #    endif // (__clang_major__ >= 10)
475 #   endif /// defined(__apple_build_version__) && defined(_LIBCPP_VERSION)
476 #  endif // defined(__clang__)
477 #  if defined(__GNUC__)
478 #   if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
479 #    if defined(__GXX_EXPERIMENTAL_CXX0X__)
480 #     define ASIO_HAS_STD_ATOMIC 1
481 #    endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
482 #   endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
483 #  endif // defined(__GNUC__)
484 #  if defined(ASIO_MSVC)
485 #   if (_MSC_VER >= 1700)
486 #    define ASIO_HAS_STD_ATOMIC 1
487 #   endif // (_MSC_VER >= 1700)
488 #  endif // defined(ASIO_MSVC)
489 # endif // !defined(ASIO_DISABLE_STD_ATOMIC)
490 #endif // !defined(ASIO_HAS_STD_ATOMIC)
491 
492 // Standard library support for chrono. Some standard libraries (such as the
493 // libstdc++ shipped with gcc 4.6) provide monotonic_clock as per early C++0x
494 // drafts, rather than the eventually standardised name of steady_clock.
495 #if !defined(ASIO_HAS_STD_CHRONO)
496 # if !defined(ASIO_DISABLE_STD_CHRONO)
497 #  if defined(__clang__)
498 #   if defined(ASIO_HAS_CLANG_LIBCXX)
499 #    define ASIO_HAS_STD_CHRONO 1
500 #   elif (__cplusplus >= 201103)
501 #    if __has_include(<chrono>)
502 #     define ASIO_HAS_STD_CHRONO 1
503 #    endif // __has_include(<chrono>)
504 #   endif // (__cplusplus >= 201103)
505 #  endif // defined(__clang__)
506 #  if defined(__GNUC__)
507 #   if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4)
508 #    if defined(__GXX_EXPERIMENTAL_CXX0X__)
509 #     define ASIO_HAS_STD_CHRONO 1
510 #     if ((__GNUC__ == 4) && (__GNUC_MINOR__ == 6))
511 #      define ASIO_HAS_STD_CHRONO_MONOTONIC_CLOCK 1
512 #     endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ == 6))
513 #    endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
514 #   endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4)
515 #  endif // defined(__GNUC__)
516 #  if defined(ASIO_MSVC)
517 #   if (_MSC_VER >= 1700)
518 #    define ASIO_HAS_STD_CHRONO 1
519 #   endif // (_MSC_VER >= 1700)
520 #  endif // defined(ASIO_MSVC)
521 # endif // !defined(ASIO_DISABLE_STD_CHRONO)
522 #endif // !defined(ASIO_HAS_STD_CHRONO)
523 
524 // Boost support for chrono.
525 #if !defined(ASIO_HAS_BOOST_CHRONO)
526 # if !defined(ASIO_DISABLE_BOOST_CHRONO)
527 #  if (BOOST_VERSION >= 104700)
528 #   define ASIO_HAS_BOOST_CHRONO 1
529 #  endif // (BOOST_VERSION >= 104700)
530 # endif // !defined(ASIO_DISABLE_BOOST_CHRONO)
531 #endif // !defined(ASIO_HAS_BOOST_CHRONO)
532 
533 // Some form of chrono library is available.
534 #if !defined(ASIO_HAS_CHRONO)
535 # if defined(ASIO_HAS_STD_CHRONO) \
536     || defined(ASIO_HAS_BOOST_CHRONO)
537 #  define ASIO_HAS_CHRONO 1
538 # endif // defined(ASIO_HAS_STD_CHRONO)
539         // || defined(ASIO_HAS_BOOST_CHRONO)
540 #endif // !defined(ASIO_HAS_CHRONO)
541 
542 // Boost support for the DateTime library.
543 #if !defined(ASIO_HAS_BOOST_DATE_TIME)
544 # if !defined(ASIO_DISABLE_BOOST_DATE_TIME)
545 #  define ASIO_HAS_BOOST_DATE_TIME 1
546 # endif // !defined(ASIO_DISABLE_BOOST_DATE_TIME)
547 #endif // !defined(ASIO_HAS_BOOST_DATE_TIME)
548 
549 // Standard library support for addressof.
550 #if !defined(ASIO_HAS_STD_ADDRESSOF)
551 # if !defined(ASIO_DISABLE_STD_ADDRESSOF)
552 #  if defined(__clang__)
553 #   if defined(ASIO_HAS_CLANG_LIBCXX)
554 #    define ASIO_HAS_STD_ADDRESSOF 1
555 #   elif (__cplusplus >= 201103)
556 #    define ASIO_HAS_STD_ADDRESSOF 1
557 #   endif // (__cplusplus >= 201103)
558 #  endif // defined(__clang__)
559 #  if defined(__GNUC__)
560 #   if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4)
561 #    if defined(__GXX_EXPERIMENTAL_CXX0X__)
562 #     define ASIO_HAS_STD_ADDRESSOF 1
563 #    endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
564 #   endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4)
565 #  endif // defined(__GNUC__)
566 #  if defined(ASIO_MSVC)
567 #   if (_MSC_VER >= 1700)
568 #    define ASIO_HAS_STD_ADDRESSOF 1
569 #   endif // (_MSC_VER >= 1700)
570 #  endif // defined(ASIO_MSVC)
571 # endif // !defined(ASIO_DISABLE_STD_ADDRESSOF)
572 #endif // !defined(ASIO_HAS_STD_ADDRESSOF)
573 
574 // Standard library support for the function class.
575 #if !defined(ASIO_HAS_STD_FUNCTION)
576 # if !defined(ASIO_DISABLE_STD_FUNCTION)
577 #  if defined(__clang__)
578 #   if defined(ASIO_HAS_CLANG_LIBCXX)
579 #    define ASIO_HAS_STD_FUNCTION 1
580 #   elif (__cplusplus >= 201103)
581 #    define ASIO_HAS_STD_FUNCTION 1
582 #   endif // (__cplusplus >= 201103)
583 #  endif // defined(__clang__)
584 #  if defined(__GNUC__)
585 #   if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) || (__GNUC__ > 4)
586 #    if defined(__GXX_EXPERIMENTAL_CXX0X__)
587 #     define ASIO_HAS_STD_FUNCTION 1
588 #    endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
589 #   endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) || (__GNUC__ > 4)
590 #  endif // defined(__GNUC__)
591 #  if defined(ASIO_MSVC)
592 #   if (_MSC_VER >= 1700)
593 #    define ASIO_HAS_STD_FUNCTION 1
594 #   endif // (_MSC_VER >= 1700)
595 #  endif // defined(ASIO_MSVC)
596 # endif // !defined(ASIO_DISABLE_STD_FUNCTION)
597 #endif // !defined(ASIO_HAS_STD_FUNCTION)
598 
599 // Standard library support for type traits.
600 #if !defined(ASIO_HAS_STD_TYPE_TRAITS)
601 # if !defined(ASIO_DISABLE_STD_TYPE_TRAITS)
602 #  if defined(__clang__)
603 #   if defined(ASIO_HAS_CLANG_LIBCXX)
604 #    define ASIO_HAS_STD_TYPE_TRAITS 1
605 #   elif (__cplusplus >= 201103)
606 #    if __has_include(<type_traits>)
607 #     define ASIO_HAS_STD_TYPE_TRAITS 1
608 #    endif // __has_include(<type_traits>)
609 #   endif // (__cplusplus >= 201103)
610 #  endif // defined(__clang__)
611 #  if defined(__GNUC__)
612 #   if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) || (__GNUC__ > 4)
613 #    if defined(__GXX_EXPERIMENTAL_CXX0X__)
614 #     define ASIO_HAS_STD_TYPE_TRAITS 1
615 #    endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
616 #   endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) || (__GNUC__ > 4)
617 #  endif // defined(__GNUC__)
618 #  if defined(ASIO_MSVC)
619 #   if (_MSC_VER >= 1700)
620 #    define ASIO_HAS_STD_TYPE_TRAITS 1
621 #   endif // (_MSC_VER >= 1700)
622 #  endif // defined(ASIO_MSVC)
623 # endif // !defined(ASIO_DISABLE_STD_TYPE_TRAITS)
624 #endif // !defined(ASIO_HAS_STD_TYPE_TRAITS)
625 
626 // Standard library support for the nullptr_t type.
627 #if !defined(ASIO_HAS_NULLPTR)
628 # if !defined(ASIO_DISABLE_NULLPTR)
629 #  if defined(__clang__)
630 #   if __has_feature(__cxx_nullptr__)
631 #    define ASIO_HAS_NULLPTR 1
632 #   endif // __has_feature(__cxx_rvalue_references__)
633 #  elif defined(__GNUC__)
634 #   if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4)
635 #    if defined(__GXX_EXPERIMENTAL_CXX0X__)
636 #     define ASIO_HAS_NULLPTR 1
637 #    endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
638 #   endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4)
639 #  endif // defined(__GNUC__)
640 #  if defined(ASIO_MSVC)
641 #   if (_MSC_VER >= 1700)
642 #    define ASIO_HAS_NULLPTR 1
643 #   endif // (_MSC_VER >= 1700)
644 #  endif // defined(ASIO_MSVC)
645 # endif // !defined(ASIO_DISABLE_NULLPTR)
646 #endif // !defined(ASIO_HAS_NULLPTR)
647 
648 // Standard library support for the C++11 allocator additions.
649 #if !defined(ASIO_HAS_CXX11_ALLOCATORS)
650 # if !defined(ASIO_DISABLE_CXX11_ALLOCATORS)
651 #  if defined(__clang__)
652 #   if defined(ASIO_HAS_CLANG_LIBCXX)
653 #    define ASIO_HAS_CXX11_ALLOCATORS 1
654 #   elif (__cplusplus >= 201103)
655 #    define ASIO_HAS_CXX11_ALLOCATORS 1
656 #   endif // (__cplusplus >= 201103)
657 #  elif defined(__GNUC__)
658 #   if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
659 #    if defined(__GXX_EXPERIMENTAL_CXX0X__)
660 #     define ASIO_HAS_CXX11_ALLOCATORS 1
661 #    endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
662 #   endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
663 #  endif // defined(__GNUC__)
664 #  if defined(ASIO_MSVC)
665 #   if (_MSC_VER >= 1800)
666 #    define ASIO_HAS_CXX11_ALLOCATORS 1
667 #   endif // (_MSC_VER >= 1800)
668 #  endif // defined(ASIO_MSVC)
669 # endif // !defined(ASIO_DISABLE_CXX11_ALLOCATORS)
670 #endif // !defined(ASIO_HAS_CXX11_ALLOCATORS)
671 
672 // Standard library support for the cstdint header.
673 #if !defined(ASIO_HAS_CSTDINT)
674 # if !defined(ASIO_DISABLE_CSTDINT)
675 #  if defined(__clang__)
676 #   if defined(ASIO_HAS_CLANG_LIBCXX)
677 #    define ASIO_HAS_CSTDINT 1
678 #   elif (__cplusplus >= 201103)
679 #    define ASIO_HAS_CSTDINT 1
680 #   endif // (__cplusplus >= 201103)
681 #  endif // defined(__clang__)
682 #  if defined(__GNUC__)
683 #   if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) || (__GNUC__ > 4)
684 #    if defined(__GXX_EXPERIMENTAL_CXX0X__)
685 #     define ASIO_HAS_CSTDINT 1
686 #    endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
687 #   endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) || (__GNUC__ > 4)
688 #  endif // defined(__GNUC__)
689 #  if defined(ASIO_MSVC)
690 #   if (_MSC_VER >= 1700)
691 #    define ASIO_HAS_CSTDINT 1
692 #   endif // (_MSC_VER >= 1700)
693 #  endif // defined(ASIO_MSVC)
694 # endif // !defined(ASIO_DISABLE_CSTDINT)
695 #endif // !defined(ASIO_HAS_CSTDINT)
696 
697 // Standard library support for the thread class.
698 #if !defined(ASIO_HAS_STD_THREAD)
699 # if !defined(ASIO_DISABLE_STD_THREAD)
700 #  if defined(__clang__)
701 #   if defined(ASIO_HAS_CLANG_LIBCXX)
702 #    define ASIO_HAS_STD_THREAD 1
703 #   elif (__cplusplus >= 201103)
704 #    if __has_include(<thread>)
705 #     define ASIO_HAS_STD_THREAD 1
706 #    endif // __has_include(<thread>)
707 #   endif // (__cplusplus >= 201103)
708 #  endif // defined(__clang__)
709 #  if defined(__GNUC__)
710 #   if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
711 #    if defined(__GXX_EXPERIMENTAL_CXX0X__)
712 #     define ASIO_HAS_STD_THREAD 1
713 #    endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
714 #   endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
715 #  endif // defined(__GNUC__)
716 #  if defined(ASIO_MSVC)
717 #   if (_MSC_VER >= 1700)
718 #    define ASIO_HAS_STD_THREAD 1
719 #   endif // (_MSC_VER >= 1700)
720 #  endif // defined(ASIO_MSVC)
721 # endif // !defined(ASIO_DISABLE_STD_THREAD)
722 #endif // !defined(ASIO_HAS_STD_THREAD)
723 
724 // Standard library support for the mutex and condition variable classes.
725 #if !defined(ASIO_HAS_STD_MUTEX_AND_CONDVAR)
726 # if !defined(ASIO_DISABLE_STD_MUTEX_AND_CONDVAR)
727 #  if defined(__clang__)
728 #   if defined(ASIO_HAS_CLANG_LIBCXX)
729 #    define ASIO_HAS_STD_MUTEX_AND_CONDVAR 1
730 #   elif (__cplusplus >= 201103)
731 #    if __has_include(<mutex>)
732 #     define ASIO_HAS_STD_MUTEX_AND_CONDVAR 1
733 #    endif // __has_include(<mutex>)
734 #   endif // (__cplusplus >= 201103)
735 #  endif // defined(__clang__)
736 #  if defined(__GNUC__)
737 #   if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
738 #    if defined(__GXX_EXPERIMENTAL_CXX0X__)
739 #     define ASIO_HAS_STD_MUTEX_AND_CONDVAR 1
740 #    endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
741 #   endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
742 #  endif // defined(__GNUC__)
743 #  if defined(ASIO_MSVC)
744 #   if (_MSC_VER >= 1700)
745 #    define ASIO_HAS_STD_MUTEX_AND_CONDVAR 1
746 #   endif // (_MSC_VER >= 1700)
747 #  endif // defined(ASIO_MSVC)
748 # endif // !defined(ASIO_DISABLE_STD_MUTEX_AND_CONDVAR)
749 #endif // !defined(ASIO_HAS_STD_MUTEX_AND_CONDVAR)
750 
751 // Standard library support for the call_once function.
752 #if !defined(ASIO_HAS_STD_CALL_ONCE)
753 # if !defined(ASIO_DISABLE_STD_CALL_ONCE)
754 #  if defined(__clang__)
755 #   if defined(ASIO_HAS_CLANG_LIBCXX)
756 #    define ASIO_HAS_STD_CALL_ONCE 1
757 #   elif (__cplusplus >= 201103)
758 #    if __has_include(<mutex>)
759 #     define ASIO_HAS_STD_CALL_ONCE 1
760 #    endif // __has_include(<mutex>)
761 #   endif // (__cplusplus >= 201103)
762 #  endif // defined(__clang__)
763 #  if defined(__GNUC__)
764 #   if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
765 #    if defined(__GXX_EXPERIMENTAL_CXX0X__)
766 #     define ASIO_HAS_STD_CALL_ONCE 1
767 #    endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
768 #   endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
769 #  endif // defined(__GNUC__)
770 #  if defined(ASIO_MSVC)
771 #   if (_MSC_VER >= 1700)
772 #    define ASIO_HAS_STD_CALL_ONCE 1
773 #   endif // (_MSC_VER >= 1700)
774 #  endif // defined(ASIO_MSVC)
775 # endif // !defined(ASIO_DISABLE_STD_CALL_ONCE)
776 #endif // !defined(ASIO_HAS_STD_CALL_ONCE)
777 
778 // Standard library support for futures.
779 #if !defined(ASIO_HAS_STD_FUTURE)
780 # if !defined(ASIO_DISABLE_STD_FUTURE)
781 #  if defined(__clang__)
782 #   if defined(ASIO_HAS_CLANG_LIBCXX)
783 #    define ASIO_HAS_STD_FUTURE 1
784 #   elif (__cplusplus >= 201103)
785 #    if __has_include(<future>)
786 #     define ASIO_HAS_STD_FUTURE 1
787 #    endif // __has_include(<mutex>)
788 #   endif // (__cplusplus >= 201103)
789 #  endif // defined(__clang__)
790 #  if defined(__GNUC__)
791 #   if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
792 #    if defined(__GXX_EXPERIMENTAL_CXX0X__)
793 #     define ASIO_HAS_STD_FUTURE 1
794 #    endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
795 #   endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
796 #  endif // defined(__GNUC__)
797 #  if defined(ASIO_MSVC)
798 #   if (_MSC_VER >= 1700)
799 #    define ASIO_HAS_STD_FUTURE 1
800 #   endif // (_MSC_VER >= 1700)
801 #  endif // defined(ASIO_MSVC)
802 # endif // !defined(ASIO_DISABLE_STD_FUTURE)
803 #endif // !defined(ASIO_HAS_STD_FUTURE)
804 
805 // Standard library support for std::string_view.
806 #if !defined(ASIO_HAS_STD_STRING_VIEW)
807 # if !defined(ASIO_DISABLE_STD_STRING_VIEW)
808 #  if defined(__clang__)
809 #   if defined(ASIO_HAS_CLANG_LIBCXX)
810 #    if (__cplusplus >= 201402)
811 #     if __has_include(<string_view>)
812 #      define ASIO_HAS_STD_STRING_VIEW 1
813 #     endif // __has_include(<string_view>)
814 #    endif // (__cplusplus >= 201402)
815 #   else // defined(ASIO_HAS_CLANG_LIBCXX)
816 #    if (__cplusplus >= 201703)
817 #     if __has_include(<string_view>)
818 #      define ASIO_HAS_STD_STRING_VIEW 1
819 #     endif // __has_include(<string_view>)
820 #    endif // (__cplusplus >= 201703)
821 #   endif // defined(ASIO_HAS_CLANG_LIBCXX)
822 #  elif defined(__GNUC__)
823 #   if (__GNUC__ >= 7)
824 #    if (__cplusplus >= 201703)
825 #     define ASIO_HAS_STD_STRING_VIEW 1
826 #    endif // (__cplusplus >= 201703)
827 #   endif // (__GNUC__ >= 7)
828 #  elif defined(ASIO_MSVC)
829 #   if (_MSC_VER >= 1910 && _MSVC_LANG >= 201703)
830 #    define ASIO_HAS_STD_STRING_VIEW 1
831 #   endif // (_MSC_VER >= 1910 && _MSVC_LANG >= 201703)
832 #  endif // defined(ASIO_MSVC)
833 # endif // !defined(ASIO_DISABLE_STD_STRING_VIEW)
834 #endif // !defined(ASIO_HAS_STD_STRING_VIEW)
835 
836 // Standard library support for std::experimental::string_view.
837 #if !defined(ASIO_HAS_STD_EXPERIMENTAL_STRING_VIEW)
838 # if !defined(ASIO_DISABLE_STD_EXPERIMENTAL_STRING_VIEW)
839 #  if defined(__clang__)
840 #   if defined(ASIO_HAS_CLANG_LIBCXX)
841 #    if (_LIBCPP_VERSION < 7000)
842 #     if (__cplusplus >= 201402)
843 #      if __has_include(<experimental/string_view>)
844 #       define ASIO_HAS_STD_EXPERIMENTAL_STRING_VIEW 1
845 #      endif // __has_include(<experimental/string_view>)
846 #     endif // (__cplusplus >= 201402)
847 #    endif // (_LIBCPP_VERSION < 7000)
848 #   else // defined(ASIO_HAS_CLANG_LIBCXX)
849 #    if (__cplusplus >= 201402)
850 #     if __has_include(<experimental/string_view>)
851 #      define ASIO_HAS_STD_EXPERIMENTAL_STRING_VIEW 1
852 #     endif // __has_include(<experimental/string_view>)
853 #    endif // (__cplusplus >= 201402)
854 #   endif // // defined(ASIO_HAS_CLANG_LIBCXX)
855 #  endif // defined(__clang__)
856 #  if defined(__GNUC__)
857 #   if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 9)) || (__GNUC__ > 4)
858 #    if (__cplusplus >= 201402)
859 #     define ASIO_HAS_STD_EXPERIMENTAL_STRING_VIEW 1
860 #    endif // (__cplusplus >= 201402)
861 #   endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 9)) || (__GNUC__ > 4)
862 #  endif // defined(__GNUC__)
863 # endif // !defined(ASIO_DISABLE_STD_EXPERIMENTAL_STRING_VIEW)
864 #endif // !defined(ASIO_HAS_STD_EXPERIMENTAL_STRING_VIEW)
865 
866 // Standard library has a string_view that we can use.
867 #if !defined(ASIO_HAS_STRING_VIEW)
868 # if !defined(ASIO_DISABLE_STRING_VIEW)
869 #  if defined(ASIO_HAS_STD_STRING_VIEW)
870 #   define ASIO_HAS_STRING_VIEW 1
871 #  elif defined(ASIO_HAS_STD_EXPERIMENTAL_STRING_VIEW)
872 #   define ASIO_HAS_STRING_VIEW 1
873 #  endif // defined(ASIO_HAS_STD_EXPERIMENTAL_STRING_VIEW)
874 # endif // !defined(ASIO_DISABLE_STRING_VIEW)
875 #endif // !defined(ASIO_HAS_STRING_VIEW)
876 
877 // Standard library support for iostream move construction and assignment.
878 #if !defined(ASIO_HAS_STD_IOSTREAM_MOVE)
879 # if !defined(ASIO_DISABLE_STD_IOSTREAM_MOVE)
880 #  if defined(__GNUC__)
881 #   if (__GNUC__ > 4)
882 #    if defined(__GXX_EXPERIMENTAL_CXX0X__)
883 #     define ASIO_HAS_STD_IOSTREAM_MOVE 1
884 #    endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
885 #   endif // (__GNUC__ > 4)
886 #  endif // defined(__GNUC__)
887 #  if defined(ASIO_MSVC)
888 #   if (_MSC_VER >= 1700)
889 #    define ASIO_HAS_STD_IOSTREAM_MOVE 1
890 #   endif // (_MSC_VER >= 1700)
891 #  endif // defined(ASIO_MSVC)
892 # endif // !defined(ASIO_DISABLE_STD_IOSTREAM_MOVE)
893 #endif // !defined(ASIO_HAS_STD_IOSTREAM_MOVE)
894 
895 // Standard library has invoke_result (which supersedes result_of).
896 #if !defined(ASIO_HAS_STD_INVOKE_RESULT)
897 # if !defined(ASIO_DISABLE_STD_INVOKE_RESULT)
898 #  if defined(ASIO_MSVC)
899 #   if (_MSC_VER >= 1911 && _MSVC_LANG >= 201703)
900 #    define ASIO_HAS_STD_INVOKE_RESULT 1
901 #   endif // (_MSC_VER >= 1911 && _MSVC_LANG >= 201703)
902 #  endif // defined(ASIO_MSVC)
903 # endif // !defined(ASIO_DISABLE_STD_INVOKE_RESULT)
904 #endif // !defined(ASIO_HAS_STD_INVOKE_RESULT)
905 
906 // Windows App target. Windows but with a limited API.
907 #if !defined(ASIO_WINDOWS_APP)
908 # if defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0603)
909 #  include <winapifamily.h>
910 #  if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) \
911    && !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
912 #   define ASIO_WINDOWS_APP 1
913 #  endif // WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
914          // && !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
915 # endif // defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0603)
916 #endif // !defined(ASIO_WINDOWS_APP)
917 
918 // Legacy WinRT target. Windows App is preferred.
919 #if !defined(ASIO_WINDOWS_RUNTIME)
920 # if !defined(ASIO_WINDOWS_APP)
921 #  if defined(__cplusplus_winrt)
922 #   include <winapifamily.h>
923 #   if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) \
924     && !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
925 #    define ASIO_WINDOWS_RUNTIME 1
926 #   endif // WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
927           // && !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
928 #  endif // defined(__cplusplus_winrt)
929 # endif // !defined(ASIO_WINDOWS_APP)
930 #endif // !defined(ASIO_WINDOWS_RUNTIME)
931 
932 // Windows target. Excludes WinRT but includes Windows App targets.
933 #if !defined(ASIO_WINDOWS)
934 # if !defined(ASIO_WINDOWS_RUNTIME)
935 #  if defined(ASIO_HAS_BOOST_CONFIG) && defined(BOOST_WINDOWS)
936 #   define ASIO_WINDOWS 1
937 #  elif defined(WIN32) || defined(_WIN32) || defined(__WIN32__)
938 #   define ASIO_WINDOWS 1
939 #  elif defined(ASIO_WINDOWS_APP)
940 #   define ASIO_WINDOWS 1
941 #  endif // defined(ASIO_HAS_BOOST_CONFIG) && defined(BOOST_WINDOWS)
942 # endif // !defined(ASIO_WINDOWS_RUNTIME)
943 #endif // !defined(ASIO_WINDOWS)
944 
945 // Windows: target OS version.
946 #if defined(ASIO_WINDOWS) || defined(__CYGWIN__)
947 # if !defined(_WIN32_WINNT) && !defined(_WIN32_WINDOWS)
948 #  if defined(_MSC_VER) || defined(__BORLANDC__)
949 #   pragma message( \
950   "Please define _WIN32_WINNT or _WIN32_WINDOWS appropriately. For example:\n"\
951   "- add -D_WIN32_WINNT=0x0601 to the compiler command line; or\n"\
952   "- add _WIN32_WINNT=0x0601 to your project's Preprocessor Definitions.\n"\
953   "Assuming _WIN32_WINNT=0x0601 (i.e. Windows 7 target).")
954 #  else // defined(_MSC_VER) || defined(__BORLANDC__)
955 #   warning Please define _WIN32_WINNT or _WIN32_WINDOWS appropriately.
956 #   warning For example, add -D_WIN32_WINNT=0x0601 to the compiler command line.
957 #   warning Assuming _WIN32_WINNT=0x0601 (i.e. Windows 7 target).
958 #  endif // defined(_MSC_VER) || defined(__BORLANDC__)
959 #  define _WIN32_WINNT 0x0601
960 # endif // !defined(_WIN32_WINNT) && !defined(_WIN32_WINDOWS)
961 # if defined(_MSC_VER)
962 #  if defined(_WIN32) && !defined(WIN32)
963 #   if !defined(_WINSOCK2API_)
964 #    define WIN32 // Needed for correct types in winsock2.h
965 #   else // !defined(_WINSOCK2API_)
966 #    error Please define the macro WIN32 in your compiler options
967 #   endif // !defined(_WINSOCK2API_)
968 #  endif // defined(_WIN32) && !defined(WIN32)
969 # endif // defined(_MSC_VER)
970 # if defined(__BORLANDC__)
971 #  if defined(__WIN32__) && !defined(WIN32)
972 #   if !defined(_WINSOCK2API_)
973 #    define WIN32 // Needed for correct types in winsock2.h
974 #   else // !defined(_WINSOCK2API_)
975 #    error Please define the macro WIN32 in your compiler options
976 #   endif // !defined(_WINSOCK2API_)
977 #  endif // defined(__WIN32__) && !defined(WIN32)
978 # endif // defined(__BORLANDC__)
979 # if defined(__CYGWIN__)
980 #  if !defined(__USE_W32_SOCKETS)
981 #   error You must add -D__USE_W32_SOCKETS to your compiler options.
982 #  endif // !defined(__USE_W32_SOCKETS)
983 # endif // defined(__CYGWIN__)
984 #endif // defined(ASIO_WINDOWS) || defined(__CYGWIN__)
985 
986 // Windows: minimise header inclusion.
987 #if defined(ASIO_WINDOWS) || defined(__CYGWIN__)
988 # if !defined(ASIO_NO_WIN32_LEAN_AND_MEAN)
989 #  if !defined(WIN32_LEAN_AND_MEAN)
990 #   define WIN32_LEAN_AND_MEAN
991 #  endif // !defined(WIN32_LEAN_AND_MEAN)
992 # endif // !defined(ASIO_NO_WIN32_LEAN_AND_MEAN)
993 #endif // defined(ASIO_WINDOWS) || defined(__CYGWIN__)
994 
995 // Windows: suppress definition of "min" and "max" macros.
996 #if defined(ASIO_WINDOWS) || defined(__CYGWIN__)
997 # if !defined(ASIO_NO_NOMINMAX)
998 #  if !defined(NOMINMAX)
999 #   define NOMINMAX 1
1000 #  endif // !defined(NOMINMAX)
1001 # endif // !defined(ASIO_NO_NOMINMAX)
1002 #endif // defined(ASIO_WINDOWS) || defined(__CYGWIN__)
1003 
1004 // Windows: IO Completion Ports.
1005 #if !defined(ASIO_HAS_IOCP)
1006 # if defined(ASIO_WINDOWS) || defined(__CYGWIN__)
1007 #  if defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0400)
1008 #   if !defined(UNDER_CE) && !defined(ASIO_WINDOWS_APP)
1009 #    if !defined(ASIO_DISABLE_IOCP)
1010 #     define ASIO_HAS_IOCP 1
1011 #    endif // !defined(ASIO_DISABLE_IOCP)
1012 #   endif // !defined(UNDER_CE) && !defined(ASIO_WINDOWS_APP)
1013 #  endif // defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0400)
1014 # endif // defined(ASIO_WINDOWS) || defined(__CYGWIN__)
1015 #endif // !defined(ASIO_HAS_IOCP)
1016 
1017 // On POSIX (and POSIX-like) platforms we need to include unistd.h in order to
1018 // get access to the various platform feature macros, e.g. to be able to test
1019 // for threads support.
1020 #if !defined(ASIO_HAS_UNISTD_H)
1021 # if !defined(ASIO_HAS_BOOST_CONFIG)
1022 #  if defined(unix) \
1023    || defined(__unix) \
1024    || defined(_XOPEN_SOURCE) \
1025    || defined(_POSIX_SOURCE) \
1026    || (defined(__MACH__) && defined(__APPLE__)) \
1027    || defined(__FreeBSD__) \
1028    || defined(__NetBSD__) \
1029    || defined(__OpenBSD__) \
1030    || defined(__linux__) \
1031    || defined(__HAIKU__)
1032 #   define ASIO_HAS_UNISTD_H 1
1033 #  endif
1034 # endif // !defined(ASIO_HAS_BOOST_CONFIG)
1035 #endif // !defined(ASIO_HAS_UNISTD_H)
1036 #if defined(ASIO_HAS_UNISTD_H)
1037 # include <unistd.h>
1038 #endif // defined(ASIO_HAS_UNISTD_H)
1039 
1040 // Linux: epoll, eventfd and timerfd.
1041 #if defined(__linux__)
1042 # include <linux/version.h>
1043 # if !defined(ASIO_HAS_EPOLL)
1044 #  if !defined(ASIO_DISABLE_EPOLL)
1045 #   if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,45)
1046 #    define ASIO_HAS_EPOLL 1
1047 #   endif // LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,45)
1048 #  endif // !defined(ASIO_DISABLE_EPOLL)
1049 # endif // !defined(ASIO_HAS_EPOLL)
1050 # if !defined(ASIO_HAS_EVENTFD)
1051 #  if !defined(ASIO_DISABLE_EVENTFD)
1052 #   if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
1053 #    define ASIO_HAS_EVENTFD 1
1054 #   endif // LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
1055 #  endif // !defined(ASIO_DISABLE_EVENTFD)
1056 # endif // !defined(ASIO_HAS_EVENTFD)
1057 # if !defined(ASIO_HAS_TIMERFD)
1058 #  if defined(ASIO_HAS_EPOLL)
1059 #   if (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 8)
1060 #    define ASIO_HAS_TIMERFD 1
1061 #   endif // (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 8)
1062 #  endif // defined(ASIO_HAS_EPOLL)
1063 # endif // !defined(ASIO_HAS_TIMERFD)
1064 #endif // defined(__linux__)
1065 
1066 // Mac OS X, FreeBSD, NetBSD, OpenBSD: kqueue.
1067 #if (defined(__MACH__) && defined(__APPLE__)) \
1068   || defined(__FreeBSD__) \
1069   || defined(__NetBSD__) \
1070   || defined(__OpenBSD__)
1071 # if !defined(ASIO_HAS_KQUEUE)
1072 #  if !defined(ASIO_DISABLE_KQUEUE)
1073 #   define ASIO_HAS_KQUEUE 1
1074 #  endif // !defined(ASIO_DISABLE_KQUEUE)
1075 # endif // !defined(ASIO_HAS_KQUEUE)
1076 #endif // (defined(__MACH__) && defined(__APPLE__))
1077        //   || defined(__FreeBSD__)
1078        //   || defined(__NetBSD__)
1079        //   || defined(__OpenBSD__)
1080 
1081 // Solaris: /dev/poll.
1082 #if defined(__sun)
1083 # if !defined(ASIO_HAS_DEV_POLL)
1084 #  if !defined(ASIO_DISABLE_DEV_POLL)
1085 #   define ASIO_HAS_DEV_POLL 1
1086 #  endif // !defined(ASIO_DISABLE_DEV_POLL)
1087 # endif // !defined(ASIO_HAS_DEV_POLL)
1088 #endif // defined(__sun)
1089 
1090 // Serial ports.
1091 #if !defined(ASIO_HAS_SERIAL_PORT)
1092 # if defined(ASIO_HAS_IOCP) \
1093   || !defined(ASIO_WINDOWS) \
1094   && !defined(ASIO_WINDOWS_RUNTIME) \
1095   && !defined(__CYGWIN__)
1096 #  if !defined(__SYMBIAN32__)
1097 #   if !defined(ASIO_DISABLE_SERIAL_PORT)
1098 #    define ASIO_HAS_SERIAL_PORT 1
1099 #   endif // !defined(ASIO_DISABLE_SERIAL_PORT)
1100 #  endif // !defined(__SYMBIAN32__)
1101 # endif // defined(ASIO_HAS_IOCP)
1102         //   || !defined(ASIO_WINDOWS)
1103         //   && !defined(ASIO_WINDOWS_RUNTIME)
1104         //   && !defined(__CYGWIN__)
1105 #endif // !defined(ASIO_HAS_SERIAL_PORT)
1106 
1107 // Windows: stream handles.
1108 #if !defined(ASIO_HAS_WINDOWS_STREAM_HANDLE)
1109 # if !defined(ASIO_DISABLE_WINDOWS_STREAM_HANDLE)
1110 #  if defined(ASIO_HAS_IOCP)
1111 #   define ASIO_HAS_WINDOWS_STREAM_HANDLE 1
1112 #  endif // defined(ASIO_HAS_IOCP)
1113 # endif // !defined(ASIO_DISABLE_WINDOWS_STREAM_HANDLE)
1114 #endif // !defined(ASIO_HAS_WINDOWS_STREAM_HANDLE)
1115 
1116 // Windows: random access handles.
1117 #if !defined(ASIO_HAS_WINDOWS_RANDOM_ACCESS_HANDLE)
1118 # if !defined(ASIO_DISABLE_WINDOWS_RANDOM_ACCESS_HANDLE)
1119 #  if defined(ASIO_HAS_IOCP)
1120 #   define ASIO_HAS_WINDOWS_RANDOM_ACCESS_HANDLE 1
1121 #  endif // defined(ASIO_HAS_IOCP)
1122 # endif // !defined(ASIO_DISABLE_WINDOWS_RANDOM_ACCESS_HANDLE)
1123 #endif // !defined(ASIO_HAS_WINDOWS_RANDOM_ACCESS_HANDLE)
1124 
1125 // Windows: object handles.
1126 #if !defined(ASIO_HAS_WINDOWS_OBJECT_HANDLE)
1127 # if !defined(ASIO_DISABLE_WINDOWS_OBJECT_HANDLE)
1128 #  if defined(ASIO_WINDOWS) || defined(__CYGWIN__)
1129 #   if !defined(UNDER_CE) && !defined(ASIO_WINDOWS_APP)
1130 #    define ASIO_HAS_WINDOWS_OBJECT_HANDLE 1
1131 #   endif // !defined(UNDER_CE) && !defined(ASIO_WINDOWS_APP)
1132 #  endif // defined(ASIO_WINDOWS) || defined(__CYGWIN__)
1133 # endif // !defined(ASIO_DISABLE_WINDOWS_OBJECT_HANDLE)
1134 #endif // !defined(ASIO_HAS_WINDOWS_OBJECT_HANDLE)
1135 
1136 // Windows: OVERLAPPED wrapper.
1137 #if !defined(ASIO_HAS_WINDOWS_OVERLAPPED_PTR)
1138 # if !defined(ASIO_DISABLE_WINDOWS_OVERLAPPED_PTR)
1139 #  if defined(ASIO_HAS_IOCP)
1140 #   define ASIO_HAS_WINDOWS_OVERLAPPED_PTR 1
1141 #  endif // defined(ASIO_HAS_IOCP)
1142 # endif // !defined(ASIO_DISABLE_WINDOWS_OVERLAPPED_PTR)
1143 #endif // !defined(ASIO_HAS_WINDOWS_OVERLAPPED_PTR)
1144 
1145 // POSIX: stream-oriented file descriptors.
1146 #if !defined(ASIO_HAS_POSIX_STREAM_DESCRIPTOR)
1147 # if !defined(ASIO_DISABLE_POSIX_STREAM_DESCRIPTOR)
1148 #  if !defined(ASIO_WINDOWS) \
1149   && !defined(ASIO_WINDOWS_RUNTIME) \
1150   && !defined(__CYGWIN__)
1151 #   define ASIO_HAS_POSIX_STREAM_DESCRIPTOR 1
1152 #  endif // !defined(ASIO_WINDOWS)
1153          //   && !defined(ASIO_WINDOWS_RUNTIME)
1154          //   && !defined(__CYGWIN__)
1155 # endif // !defined(ASIO_DISABLE_POSIX_STREAM_DESCRIPTOR)
1156 #endif // !defined(ASIO_HAS_POSIX_STREAM_DESCRIPTOR)
1157 
1158 // UNIX domain sockets.
1159 #if !defined(ASIO_HAS_LOCAL_SOCKETS)
1160 # if !defined(ASIO_DISABLE_LOCAL_SOCKETS)
1161 #  if !defined(ASIO_WINDOWS) \
1162   && !defined(ASIO_WINDOWS_RUNTIME) \
1163   && !defined(__CYGWIN__)
1164 #   define ASIO_HAS_LOCAL_SOCKETS 1
1165 #  endif // !defined(ASIO_WINDOWS)
1166          //   && !defined(ASIO_WINDOWS_RUNTIME)
1167          //   && !defined(__CYGWIN__)
1168 # endif // !defined(ASIO_DISABLE_LOCAL_SOCKETS)
1169 #endif // !defined(ASIO_HAS_LOCAL_SOCKETS)
1170 
1171 // Can use sigaction() instead of signal().
1172 #if !defined(ASIO_HAS_SIGACTION)
1173 # if !defined(ASIO_DISABLE_SIGACTION)
1174 #  if !defined(ASIO_WINDOWS) \
1175   && !defined(ASIO_WINDOWS_RUNTIME) \
1176   && !defined(__CYGWIN__)
1177 #   define ASIO_HAS_SIGACTION 1
1178 #  endif // !defined(ASIO_WINDOWS)
1179          //   && !defined(ASIO_WINDOWS_RUNTIME)
1180          //   && !defined(__CYGWIN__)
1181 # endif // !defined(ASIO_DISABLE_SIGACTION)
1182 #endif // !defined(ASIO_HAS_SIGACTION)
1183 
1184 // Can use signal().
1185 #if !defined(ASIO_HAS_SIGNAL)
1186 # if !defined(ASIO_DISABLE_SIGNAL)
1187 #  if !defined(UNDER_CE)
1188 #   define ASIO_HAS_SIGNAL 1
1189 #  endif // !defined(UNDER_CE)
1190 # endif // !defined(ASIO_DISABLE_SIGNAL)
1191 #endif // !defined(ASIO_HAS_SIGNAL)
1192 
1193 // Can use getaddrinfo() and getnameinfo().
1194 #if !defined(ASIO_HAS_GETADDRINFO)
1195 # if !defined(ASIO_DISABLE_GETADDRINFO)
1196 #  if defined(ASIO_WINDOWS) || defined(__CYGWIN__)
1197 #   if defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0501)
1198 #    define ASIO_HAS_GETADDRINFO 1
1199 #   elif defined(UNDER_CE)
1200 #    define ASIO_HAS_GETADDRINFO 1
1201 #   endif // defined(UNDER_CE)
1202 #  elif defined(__MACH__) && defined(__APPLE__)
1203 #   if defined(__MAC_OS_X_VERSION_MIN_REQUIRED)
1204 #    if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050)
1205 #     define ASIO_HAS_GETADDRINFO 1
1206 #    endif // (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050)
1207 #   else // defined(__MAC_OS_X_VERSION_MIN_REQUIRED)
1208 #    define ASIO_HAS_GETADDRINFO 1
1209 #   endif // defined(__MAC_OS_X_VERSION_MIN_REQUIRED)
1210 #  else // defined(__MACH__) && defined(__APPLE__)
1211 #   define ASIO_HAS_GETADDRINFO 1
1212 #  endif // defined(__MACH__) && defined(__APPLE__)
1213 # endif // !defined(ASIO_DISABLE_GETADDRINFO)
1214 #endif // !defined(ASIO_HAS_GETADDRINFO)
1215 
1216 // Whether standard iostreams are disabled.
1217 #if !defined(ASIO_NO_IOSTREAM)
1218 # if defined(ASIO_HAS_BOOST_CONFIG) && defined(BOOST_NO_IOSTREAM)
1219 #  define ASIO_NO_IOSTREAM 1
1220 # endif // !defined(BOOST_NO_IOSTREAM)
1221 #endif // !defined(ASIO_NO_IOSTREAM)
1222 
1223 // Whether exception handling is disabled.
1224 #if !defined(ASIO_NO_EXCEPTIONS)
1225 # if defined(ASIO_HAS_BOOST_CONFIG) && defined(BOOST_NO_EXCEPTIONS)
1226 #  define ASIO_NO_EXCEPTIONS 1
1227 # endif // !defined(BOOST_NO_EXCEPTIONS)
1228 #endif // !defined(ASIO_NO_EXCEPTIONS)
1229 
1230 // Whether the typeid operator is supported.
1231 #if !defined(ASIO_NO_TYPEID)
1232 # if defined(ASIO_HAS_BOOST_CONFIG) && defined(BOOST_NO_TYPEID)
1233 #  define ASIO_NO_TYPEID 1
1234 # endif // !defined(BOOST_NO_TYPEID)
1235 #endif // !defined(ASIO_NO_TYPEID)
1236 
1237 // Threads.
1238 #if !defined(ASIO_HAS_THREADS)
1239 # if !defined(ASIO_DISABLE_THREADS)
1240 #  if defined(ASIO_HAS_BOOST_CONFIG) && defined(BOOST_HAS_THREADS)
1241 #   define ASIO_HAS_THREADS 1
1242 #  elif defined(__GNUC__) && !defined(__MINGW32__) \
1243      && !defined(linux) && !defined(__linux) && !defined(__linux__)
1244 #   define ASIO_HAS_THREADS 1
1245 #  elif defined(_MT) || defined(__MT__)
1246 #   define ASIO_HAS_THREADS 1
1247 #  elif defined(_REENTRANT)
1248 #   define ASIO_HAS_THREADS 1
1249 #  elif defined(__APPLE__)
1250 #   define ASIO_HAS_THREADS 1
1251 #  elif defined(_POSIX_THREADS) && (_POSIX_THREADS + 0 >= 0)
1252 #   define ASIO_HAS_THREADS 1
1253 #  elif defined(_PTHREADS)
1254 #   define ASIO_HAS_THREADS 1
1255 #  endif // defined(ASIO_HAS_BOOST_CONFIG) && defined(BOOST_HAS_THREADS)
1256 # endif // !defined(ASIO_DISABLE_THREADS)
1257 #endif // !defined(ASIO_HAS_THREADS)
1258 
1259 // POSIX threads.
1260 #if !defined(ASIO_HAS_PTHREADS)
1261 # if defined(ASIO_HAS_THREADS)
1262 #  if defined(ASIO_HAS_BOOST_CONFIG) && defined(BOOST_HAS_PTHREADS)
1263 #   define ASIO_HAS_PTHREADS 1
1264 #  elif defined(_POSIX_THREADS) && (_POSIX_THREADS + 0 >= 0)
1265 #   define ASIO_HAS_PTHREADS 1
1266 #  endif // defined(ASIO_HAS_BOOST_CONFIG) && defined(BOOST_HAS_PTHREADS)
1267 # endif // defined(ASIO_HAS_THREADS)
1268 #endif // !defined(ASIO_HAS_PTHREADS)
1269 
1270 // Helper to prevent macro expansion.
1271 #define ASIO_PREVENT_MACRO_SUBSTITUTION
1272 
1273 // Helper to define in-class constants.
1274 #if !defined(ASIO_STATIC_CONSTANT)
1275 # if !defined(ASIO_DISABLE_BOOST_STATIC_CONSTANT)
1276 #  define ASIO_STATIC_CONSTANT(type, assignment) \
1277     BOOST_STATIC_CONSTANT(type, assignment)
1278 # else // !defined(ASIO_DISABLE_BOOST_STATIC_CONSTANT)
1279 #  define ASIO_STATIC_CONSTANT(type, assignment) \
1280     static const type assignment
1281 # endif // !defined(ASIO_DISABLE_BOOST_STATIC_CONSTANT)
1282 #endif // !defined(ASIO_STATIC_CONSTANT)
1283 
1284 // Boost array library.
1285 #if !defined(ASIO_HAS_BOOST_ARRAY)
1286 # if !defined(ASIO_DISABLE_BOOST_ARRAY)
1287 #  define ASIO_HAS_BOOST_ARRAY 1
1288 # endif // !defined(ASIO_DISABLE_BOOST_ARRAY)
1289 #endif // !defined(ASIO_HAS_BOOST_ARRAY)
1290 
1291 // Boost assert macro.
1292 #if !defined(ASIO_HAS_BOOST_ASSERT)
1293 # if !defined(ASIO_DISABLE_BOOST_ASSERT)
1294 #  define ASIO_HAS_BOOST_ASSERT 1
1295 # endif // !defined(ASIO_DISABLE_BOOST_ASSERT)
1296 #endif // !defined(ASIO_HAS_BOOST_ASSERT)
1297 
1298 // Boost limits header.
1299 #if !defined(ASIO_HAS_BOOST_LIMITS)
1300 # if !defined(ASIO_DISABLE_BOOST_LIMITS)
1301 #  define ASIO_HAS_BOOST_LIMITS 1
1302 # endif // !defined(ASIO_DISABLE_BOOST_LIMITS)
1303 #endif // !defined(ASIO_HAS_BOOST_LIMITS)
1304 
1305 // Boost throw_exception function.
1306 #if !defined(ASIO_HAS_BOOST_THROW_EXCEPTION)
1307 # if !defined(ASIO_DISABLE_BOOST_THROW_EXCEPTION)
1308 #  define ASIO_HAS_BOOST_THROW_EXCEPTION 1
1309 # endif // !defined(ASIO_DISABLE_BOOST_THROW_EXCEPTION)
1310 #endif // !defined(ASIO_HAS_BOOST_THROW_EXCEPTION)
1311 
1312 // Boost regex library.
1313 #if !defined(ASIO_HAS_BOOST_REGEX)
1314 # if !defined(ASIO_DISABLE_BOOST_REGEX)
1315 #  define ASIO_HAS_BOOST_REGEX 1
1316 # endif // !defined(ASIO_DISABLE_BOOST_REGEX)
1317 #endif // !defined(ASIO_HAS_BOOST_REGEX)
1318 
1319 // Boost bind function.
1320 #if !defined(ASIO_HAS_BOOST_BIND)
1321 # if !defined(ASIO_DISABLE_BOOST_BIND)
1322 #  define ASIO_HAS_BOOST_BIND 1
1323 # endif // !defined(ASIO_DISABLE_BOOST_BIND)
1324 #endif // !defined(ASIO_HAS_BOOST_BIND)
1325 
1326 // Boost's BOOST_WORKAROUND macro.
1327 #if !defined(ASIO_HAS_BOOST_WORKAROUND)
1328 # if !defined(ASIO_DISABLE_BOOST_WORKAROUND)
1329 #  define ASIO_HAS_BOOST_WORKAROUND 1
1330 # endif // !defined(ASIO_DISABLE_BOOST_WORKAROUND)
1331 #endif // !defined(ASIO_HAS_BOOST_WORKAROUND)
1332 
1333 // Microsoft Visual C++'s secure C runtime library.
1334 #if !defined(ASIO_HAS_SECURE_RTL)
1335 # if !defined(ASIO_DISABLE_SECURE_RTL)
1336 #  if defined(ASIO_MSVC) \
1337     && (ASIO_MSVC >= 1400) \
1338     && !defined(UNDER_CE)
1339 #   define ASIO_HAS_SECURE_RTL 1
1340 #  endif // defined(ASIO_MSVC)
1341          // && (ASIO_MSVC >= 1400)
1342          // && !defined(UNDER_CE)
1343 # endif // !defined(ASIO_DISABLE_SECURE_RTL)
1344 #endif // !defined(ASIO_HAS_SECURE_RTL)
1345 
1346 // Handler hooking. Disabled for ancient Borland C++ and gcc compilers.
1347 #if !defined(ASIO_HAS_HANDLER_HOOKS)
1348 # if !defined(ASIO_DISABLE_HANDLER_HOOKS)
1349 #  if defined(__GNUC__)
1350 #   if (__GNUC__ >= 3)
1351 #    define ASIO_HAS_HANDLER_HOOKS 1
1352 #   endif // (__GNUC__ >= 3)
1353 #  elif !defined(__BORLANDC__)
1354 #   define ASIO_HAS_HANDLER_HOOKS 1
1355 #  endif // !defined(__BORLANDC__)
1356 # endif // !defined(ASIO_DISABLE_HANDLER_HOOKS)
1357 #endif // !defined(ASIO_HAS_HANDLER_HOOKS)
1358 
1359 // Support for the __thread keyword extension.
1360 #if !defined(ASIO_DISABLE_THREAD_KEYWORD_EXTENSION)
1361 # if defined(__linux__)
1362 #  if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
1363 #   if ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)
1364 #    if !defined(__INTEL_COMPILER) && !defined(__ICL) \
1365        && !(defined(__clang__) && defined(__ANDROID__))
1366 #     define ASIO_HAS_THREAD_KEYWORD_EXTENSION 1
1367 #     define ASIO_THREAD_KEYWORD __thread
1368 #    elif defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 1100)
1369 #     define ASIO_HAS_THREAD_KEYWORD_EXTENSION 1
1370 #    endif // defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 1100)
1371            // && !(defined(__clang__) && defined(__ANDROID__))
1372 #   endif // ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)
1373 #  endif // defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
1374 # endif // defined(__linux__)
1375 # if defined(ASIO_MSVC) && defined(ASIO_WINDOWS_RUNTIME)
1376 #  if (_MSC_VER >= 1700)
1377 #   define ASIO_HAS_THREAD_KEYWORD_EXTENSION 1
1378 #   define ASIO_THREAD_KEYWORD __declspec(thread)
1379 #  endif // (_MSC_VER >= 1700)
1380 # endif // defined(ASIO_MSVC) && defined(ASIO_WINDOWS_RUNTIME)
1381 #endif // !defined(ASIO_DISABLE_THREAD_KEYWORD_EXTENSION)
1382 #if !defined(ASIO_THREAD_KEYWORD)
1383 # define ASIO_THREAD_KEYWORD __thread
1384 #endif // !defined(ASIO_THREAD_KEYWORD)
1385 
1386 // Support for POSIX ssize_t typedef.
1387 #if !defined(ASIO_DISABLE_SSIZE_T)
1388 # if defined(__linux__) \
1389    || (defined(__MACH__) && defined(__APPLE__))
1390 #  define ASIO_HAS_SSIZE_T 1
1391 # endif // defined(__linux__)
1392         //   || (defined(__MACH__) && defined(__APPLE__))
1393 #endif // !defined(ASIO_DISABLE_SSIZE_T)
1394 
1395 // Helper macros to manage transition away from error_code return values.
1396 #if defined(ASIO_NO_DEPRECATED)
1397 # define ASIO_SYNC_OP_VOID void
1398 # define ASIO_SYNC_OP_VOID_RETURN(e) return
1399 #else // defined(ASIO_NO_DEPRECATED)
1400 # define ASIO_SYNC_OP_VOID asio::error_code
1401 # define ASIO_SYNC_OP_VOID_RETURN(e) return e
1402 #endif // defined(ASIO_NO_DEPRECATED)
1403 
1404 // Newer gcc, clang need special treatment to suppress unused typedef warnings.
1405 #if defined(__clang__)
1406 # if defined(__apple_build_version__)
1407 #  if (__clang_major__ >= 7)
1408 #   define ASIO_UNUSED_TYPEDEF __attribute__((__unused__))
1409 #  endif // (__clang_major__ >= 7)
1410 # elif ((__clang_major__ == 3) && (__clang_minor__ >= 6)) \
1411     || (__clang_major__ > 3)
1412 #  define ASIO_UNUSED_TYPEDEF __attribute__((__unused__))
1413 # endif // ((__clang_major__ == 3) && (__clang_minor__ >= 6))
1414         //   || (__clang_major__ > 3)
1415 #elif defined(__GNUC__)
1416 # if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 8)) || (__GNUC__ > 4)
1417 #  define ASIO_UNUSED_TYPEDEF __attribute__((__unused__))
1418 # endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 8)) || (__GNUC__ > 4)
1419 #endif // defined(__GNUC__)
1420 #if !defined(ASIO_UNUSED_TYPEDEF)
1421 # define ASIO_UNUSED_TYPEDEF
1422 #endif // !defined(ASIO_UNUSED_TYPEDEF)
1423 
1424 // Some versions of gcc generate spurious warnings about unused variables.
1425 #if defined(__GNUC__)
1426 # if (__GNUC__ >= 4)
1427 #  define ASIO_UNUSED_VARIABLE __attribute__((__unused__))
1428 # endif // (__GNUC__ >= 4)
1429 #endif // defined(__GNUC__)
1430 #if !defined(ASIO_UNUSED_VARIABLE)
1431 # define ASIO_UNUSED_VARIABLE
1432 #endif // !defined(ASIO_UNUSED_VARIABLE)
1433 
1434 // Support co_await on compilers known to allow it.
1435 #if !defined(ASIO_HAS_CO_AWAIT)
1436 # if !defined(ASIO_DISABLE_CO_AWAIT)
1437 #  if defined(ASIO_MSVC)
1438 #   if (_MSC_FULL_VER >= 190023506)
1439 #    if defined(_RESUMABLE_FUNCTIONS_SUPPORTED)
1440 #     define ASIO_HAS_CO_AWAIT 1
1441 #    endif // defined(_RESUMABLE_FUNCTIONS_SUPPORTED)
1442 #   endif // (_MSC_FULL_VER >= 190023506)
1443 #  endif // defined(ASIO_MSVC)
1444 # endif // !defined(ASIO_DISABLE_CO_AWAIT)
1445 # if defined(__clang__)
1446 #  if (__cpp_coroutines >= 201703)
1447 #   if __has_include(<experimental/coroutine>)
1448 #    define ASIO_HAS_CO_AWAIT 1
1449 #   endif // __has_include(<experimental/coroutine>)
1450 #  endif // (__cpp_coroutines >= 201703)
1451 # endif // defined(__clang__)
1452 #endif // !defined(ASIO_HAS_CO_AWAIT)
1453 
1454 #endif // ASIO_DETAIL_CONFIG_HPP
1455