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