1//
2// detail/config.hpp
3// ~~~~~~~~~~~~~~~~~
4//
5// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com)
6//
7// Distributed under the Boost Software License, Version 1.0. (See accompanying
8// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
9//
10
11#ifndef BOOST_ASIO_DETAIL_CONFIG_HPP
12#define BOOST_ASIO_DETAIL_CONFIG_HPP
13
14#if defined(BOOST_ASIO_STANDALONE)
15# define BOOST_ASIO_DISABLE_BOOST_ARRAY 1
16# define BOOST_ASIO_DISABLE_BOOST_ASSERT 1
17# define BOOST_ASIO_DISABLE_BOOST_BIND 1
18# define BOOST_ASIO_DISABLE_BOOST_CHRONO 1
19# define BOOST_ASIO_DISABLE_BOOST_DATE_TIME 1
20# define BOOST_ASIO_DISABLE_BOOST_LIMITS 1
21# define BOOST_ASIO_DISABLE_BOOST_REGEX 1
22# define BOOST_ASIO_DISABLE_BOOST_STATIC_CONSTANT 1
23# define BOOST_ASIO_DISABLE_BOOST_THROW_EXCEPTION 1
24# define BOOST_ASIO_DISABLE_BOOST_WORKAROUND 1
25#else // defined(BOOST_ASIO_STANDALONE)
26# include <boost/config.hpp>
27# include <boost/version.hpp>
28# define BOOST_ASIO_HAS_BOOST_CONFIG 1
29#endif // defined(BOOST_ASIO_STANDALONE)
30
31// Default to a header-only implementation. The user must specifically request
32// separate compilation by defining either BOOST_ASIO_SEPARATE_COMPILATION or
33// BOOST_ASIO_DYN_LINK (as a DLL/shared library implies separate compilation).
34#if !defined(BOOST_ASIO_HEADER_ONLY)
35# if !defined(BOOST_ASIO_SEPARATE_COMPILATION)
36# if !defined(BOOST_ASIO_DYN_LINK)
37# define BOOST_ASIO_HEADER_ONLY 1
38# endif // !defined(BOOST_ASIO_DYN_LINK)
39# endif // !defined(BOOST_ASIO_SEPARATE_COMPILATION)
40#endif // !defined(BOOST_ASIO_HEADER_ONLY)
41
42#if defined(BOOST_ASIO_HEADER_ONLY)
43# define BOOST_ASIO_DECL inline
44#else // defined(BOOST_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 BOOST_ASIO_DYN_LINK.
48# if defined(BOOST_ASIO_DYN_LINK)
49// Export if this is our own source, otherwise import.
50# if defined(BOOST_ASIO_SOURCE)
51# define BOOST_ASIO_DECL __declspec(dllexport)
52# else // defined(BOOST_ASIO_SOURCE)
53# define BOOST_ASIO_DECL __declspec(dllimport)
54# endif // defined(BOOST_ASIO_SOURCE)
55# endif // defined(BOOST_ASIO_DYN_LINK)
56# endif // defined(_MSC_VER) || defined(__BORLANDC__) || defined(__CODEGEARC__)
57#endif // defined(BOOST_ASIO_HEADER_ONLY)
58
59// If BOOST_ASIO_DECL isn't defined yet define it now.
60#if !defined(BOOST_ASIO_DECL)
61# define BOOST_ASIO_DECL
62#endif // !defined(BOOST_ASIO_DECL)
63
64// Microsoft Visual C++ detection.
65#if !defined(BOOST_ASIO_MSVC)
66# if defined(BOOST_ASIO_HAS_BOOST_CONFIG) && defined(BOOST_MSVC)
67# define BOOST_ASIO_MSVC BOOST_MSVC
68# elif defined(_MSC_VER) && !defined(__MWERKS__) && !defined(__EDG_VERSION__)
69# define BOOST_ASIO_MSVC _MSC_VER
70# endif // defined(BOOST_ASIO_HAS_BOOST_CONFIG) && defined(BOOST_MSVC)
71#endif // defined(BOOST_ASIO_MSVC)
72
73// Clang / libc++ detection.
74#if defined(__clang__)
75# if (__cplusplus >= 201103)
76# if __has_include(<__config>)
77# include <__config>
78# if defined(_LIBCPP_VERSION)
79# define BOOST_ASIO_HAS_CLANG_LIBCXX 1
80# endif // defined(_LIBCPP_VERSION)
81# endif // __has_include(<__config>)
82# endif // (__cplusplus >= 201103)
83#endif // defined(__clang__)
84
85// Support move construction and assignment on compilers known to allow it.
86#if !defined(BOOST_ASIO_HAS_MOVE)
87# if !defined(BOOST_ASIO_DISABLE_MOVE)
88# if defined(__clang__)
89# if __has_feature(__cxx_rvalue_references__)
90# define BOOST_ASIO_HAS_MOVE 1
91# endif // __has_feature(__cxx_rvalue_references__)
92# endif // defined(__clang__)
93# if defined(__GNUC__)
94# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) || (__GNUC__ > 4)
95# if defined(__GXX_EXPERIMENTAL_CXX0X__)
96# define BOOST_ASIO_HAS_MOVE 1
97# endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
98# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) || (__GNUC__ > 4)
99# endif // defined(__GNUC__)
100# if defined(BOOST_ASIO_MSVC)
101# if (_MSC_VER >= 1700)
102# define BOOST_ASIO_HAS_MOVE 1
103# endif // (_MSC_VER >= 1700)
104# endif // defined(BOOST_ASIO_MSVC)
105# endif // !defined(BOOST_ASIO_DISABLE_MOVE)
106#endif // !defined(BOOST_ASIO_HAS_MOVE)
107
108// If BOOST_ASIO_MOVE_CAST isn't defined, and move support is available, define
109// BOOST_ASIO_MOVE_ARG and BOOST_ASIO_MOVE_CAST to take advantage of rvalue
110// references and perfect forwarding.
111#if defined(BOOST_ASIO_HAS_MOVE) && !defined(BOOST_ASIO_MOVE_CAST)
112# define BOOST_ASIO_MOVE_ARG(type) type&&
113# define BOOST_ASIO_MOVE_CAST(type) static_cast<type&&>
114# define BOOST_ASIO_MOVE_CAST2(type1, type2) static_cast<type1, type2&&>
115#endif // defined(BOOST_ASIO_HAS_MOVE) && !defined(BOOST_ASIO_MOVE_CAST)
116
117// If BOOST_ASIO_MOVE_CAST still isn't defined, default to a C++03-compatible
118// implementation. Note that older g++ and MSVC versions don't like it when you
119// pass a non-member function through a const reference, so for most compilers
120// we'll play it safe and stick with the old approach of passing the handler by
121// value.
122#if !defined(BOOST_ASIO_MOVE_CAST)
123# if defined(__GNUC__)
124# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 1)) || (__GNUC__ > 4)
125# define BOOST_ASIO_MOVE_ARG(type) const type&
126# else // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 1)) || (__GNUC__ > 4)
127# define BOOST_ASIO_MOVE_ARG(type) type
128# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 1)) || (__GNUC__ > 4)
129# elif defined(BOOST_ASIO_MSVC)
130# if (_MSC_VER >= 1400)
131# define BOOST_ASIO_MOVE_ARG(type) const type&
132# else // (_MSC_VER >= 1400)
133# define BOOST_ASIO_MOVE_ARG(type) type
134# endif // (_MSC_VER >= 1400)
135# else
136# define BOOST_ASIO_MOVE_ARG(type) type
137# endif
138# define BOOST_ASIO_MOVE_CAST(type) static_cast<const type&>
139# define BOOST_ASIO_MOVE_CAST2(type1, type2) static_cast<const type1, type2&>
140#endif // !defined(BOOST_ASIO_MOVE_CAST)
141
142// Support variadic templates on compilers known to allow it.
143#if !defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES)
144# if !defined(BOOST_ASIO_DISABLE_VARIADIC_TEMPLATES)
145# if defined(__clang__)
146# if __has_feature(__cxx_variadic_templates__)
147# define BOOST_ASIO_HAS_VARIADIC_TEMPLATES 1
148# endif // __has_feature(__cxx_variadic_templates__)
149# endif // defined(__clang__)
150# if defined(__GNUC__)
151# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 4)
152# if defined(__GXX_EXPERIMENTAL_CXX0X__)
153# define BOOST_ASIO_HAS_VARIADIC_TEMPLATES 1
154# endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
155# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 4)
156# endif // defined(__GNUC__)
157# endif // !defined(BOOST_ASIO_DISABLE_VARIADIC_TEMPLATES)
158#endif // !defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES)
159
160// Support constexpr on compilers known to allow it.
161#if !defined(BOOST_ASIO_HAS_CONSTEXPR)
162# if !defined(BOOST_ASIO_DISABLE_CONSTEXPR)
163# if defined(__clang__)
164# if __has_feature(__cxx_constexpr__)
165# define BOOST_ASIO_HAS_CONSTEXPR 1
166# endif // __has_feature(__cxx_constexr__)
167# endif // defined(__clang__)
168# if defined(__GNUC__)
169# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4)
170# if defined(__GXX_EXPERIMENTAL_CXX0X__)
171# define BOOST_ASIO_HAS_CONSTEXPR 1
172# endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
173# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4)
174# endif // defined(__GNUC__)
175# endif // !defined(BOOST_ASIO_DISABLE_CONSTEXPR)
176#endif // !defined(BOOST_ASIO_HAS_CONSTEXPR)
177#if !defined(BOOST_ASIO_CONSTEXPR)
178# if defined(BOOST_ASIO_HAS_CONSTEXPR)
179# define BOOST_ASIO_CONSTEXPR constexpr
180# else // defined(BOOST_ASIO_HAS_CONSTEXPR)
181# define BOOST_ASIO_CONSTEXPR
182# endif // defined(BOOST_ASIO_HAS_CONSTEXPR)
183#endif // !defined(BOOST_ASIO_CONSTEXPR)
184
185// Standard library support for system errors.
186# if !defined(BOOST_ASIO_DISABLE_STD_SYSTEM_ERROR)
187# if defined(__clang__)
188# if defined(BOOST_ASIO_HAS_CLANG_LIBCXX)
189# define BOOST_ASIO_HAS_STD_SYSTEM_ERROR 1
190# elif (__cplusplus >= 201103)
191# if __has_include(<system_error>)
192# define BOOST_ASIO_HAS_STD_SYSTEM_ERROR 1
193# endif // __has_include(<system_error>)
194# endif // (__cplusplus >= 201103)
195# endif // defined(__clang__)
196# if defined(__GNUC__)
197# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4)
198# if defined(__GXX_EXPERIMENTAL_CXX0X__)
199# define BOOST_ASIO_HAS_STD_SYSTEM_ERROR 1
200# endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
201# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4)
202# endif // defined(__GNUC__)
203# if defined(BOOST_ASIO_MSVC)
204# if (_MSC_VER >= 1700)
205# define BOOST_ASIO_HAS_STD_SYSTEM_ERROR 1
206# endif // (_MSC_VER >= 1700)
207# endif // defined(BOOST_ASIO_MSVC)
208# endif // !defined(BOOST_ASIO_DISABLE_STD_SYSTEM_ERROR)
209
210// Compliant C++11 compilers put noexcept specifiers on error_category members.
211#if !defined(BOOST_ASIO_ERROR_CATEGORY_NOEXCEPT)
212# if (BOOST_VERSION >= 105300)
213# define BOOST_ASIO_ERROR_CATEGORY_NOEXCEPT BOOST_NOEXCEPT
214# elif defined(__clang__)
215# if __has_feature(__cxx_noexcept__)
216# define BOOST_ASIO_ERROR_CATEGORY_NOEXCEPT noexcept(true)
217# endif // __has_feature(__cxx_noexcept__)
218# elif defined(__GNUC__)
219# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
220# if defined(__GXX_EXPERIMENTAL_CXX0X__)
221# define BOOST_ASIO_ERROR_CATEGORY_NOEXCEPT noexcept(true)
222# endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
223# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
224# elif defined(BOOST_ASIO_MSVC)
225# if (_MSC_VER >= 1900)
226# define BOOST_ASIO_ERROR_CATEGORY_NOEXCEPT noexcept(true)
227# endif // (_MSC_VER >= 1900)
228# endif // defined(BOOST_ASIO_MSVC)
229# if !defined(BOOST_ASIO_ERROR_CATEGORY_NOEXCEPT)
230# define BOOST_ASIO_ERROR_CATEGORY_NOEXCEPT
231# endif // !defined(BOOST_ASIO_ERROR_CATEGORY_NOEXCEPT)
232#endif // !defined(BOOST_ASIO_ERROR_CATEGORY_NOEXCEPT)
233
234// Standard library support for arrays.
235#if !defined(BOOST_ASIO_HAS_STD_ARRAY)
236# if !defined(BOOST_ASIO_DISABLE_STD_ARRAY)
237# if defined(__clang__)
238# if defined(BOOST_ASIO_HAS_CLANG_LIBCXX)
239# define BOOST_ASIO_HAS_STD_ARRAY 1
240# elif (__cplusplus >= 201103)
241# if __has_include(<array>)
242# define BOOST_ASIO_HAS_STD_ARRAY 1
243# endif // __has_include(<array>)
244# endif // (__cplusplus >= 201103)
245# endif // defined(__clang__)
246# if defined(__GNUC__)
247# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 4)
248# if defined(__GXX_EXPERIMENTAL_CXX0X__)
249# define BOOST_ASIO_HAS_STD_ARRAY 1
250# endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
251# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 4)
252# endif // defined(__GNUC__)
253# if defined(BOOST_ASIO_MSVC)
254# if (_MSC_VER >= 1600)
255# define BOOST_ASIO_HAS_STD_ARRAY 1
256# endif // (_MSC_VER >= 1600)
257# endif // defined(BOOST_ASIO_MSVC)
258# endif // !defined(BOOST_ASIO_DISABLE_STD_ARRAY)
259#endif // !defined(BOOST_ASIO_HAS_STD_ARRAY)
260
261// Standard library support for shared_ptr and weak_ptr.
262#if !defined(BOOST_ASIO_HAS_STD_SHARED_PTR)
263# if !defined(BOOST_ASIO_DISABLE_STD_SHARED_PTR)
264# if defined(__clang__)
265# if defined(BOOST_ASIO_HAS_CLANG_LIBCXX)
266# define BOOST_ASIO_HAS_STD_SHARED_PTR 1
267# elif (__cplusplus >= 201103)
268# define BOOST_ASIO_HAS_STD_SHARED_PTR 1
269# endif // (__cplusplus >= 201103)
270# endif // defined(__clang__)
271# if defined(__GNUC__)
272# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 4)
273# if defined(__GXX_EXPERIMENTAL_CXX0X__)
274# define BOOST_ASIO_HAS_STD_SHARED_PTR 1
275# endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
276# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 4)
277# endif // defined(__GNUC__)
278# if defined(BOOST_ASIO_MSVC)
279# if (_MSC_VER >= 1600)
280# define BOOST_ASIO_HAS_STD_SHARED_PTR 1
281# endif // (_MSC_VER >= 1600)
282# endif // defined(BOOST_ASIO_MSVC)
283# endif // !defined(BOOST_ASIO_DISABLE_STD_SHARED_PTR)
284#endif // !defined(BOOST_ASIO_HAS_STD_SHARED_PTR)
285
286// Standard library support for atomic operations.
287#if !defined(BOOST_ASIO_HAS_STD_ATOMIC)
288# if !defined(BOOST_ASIO_DISABLE_STD_ATOMIC)
289# if defined(__clang__)
290# if defined(BOOST_ASIO_HAS_CLANG_LIBCXX)
291# define BOOST_ASIO_HAS_STD_ATOMIC 1
292# elif (__cplusplus >= 201103)
293# if __has_include(<atomic>)
294# define BOOST_ASIO_HAS_STD_ATOMIC 1
295# endif // __has_include(<atomic>)
296# endif // (__cplusplus >= 201103)
297# endif // defined(__clang__)
298# if defined(__GNUC__)
299# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) || (__GNUC__ > 4)
300# if defined(__GXX_EXPERIMENTAL_CXX0X__)
301# define BOOST_ASIO_HAS_STD_ATOMIC 1
302# endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
303# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) || (__GNUC__ > 4)
304# endif // defined(__GNUC__)
305# if defined(BOOST_ASIO_MSVC)
306# if (_MSC_VER >= 1700)
307# define BOOST_ASIO_HAS_STD_ATOMIC 1
308# endif // (_MSC_VER >= 1700)
309# endif // defined(BOOST_ASIO_MSVC)
310# endif // !defined(BOOST_ASIO_DISABLE_STD_ATOMIC)
311#endif // !defined(BOOST_ASIO_HAS_STD_ATOMIC)
312
313// Standard library support for chrono. Some standard libraries (such as the
314// libstdc++ shipped with gcc 4.6) provide monotonic_clock as per early C++0x
315// drafts, rather than the eventually standardised name of steady_clock.
316#if !defined(BOOST_ASIO_HAS_STD_CHRONO)
317# if !defined(BOOST_ASIO_DISABLE_STD_CHRONO)
318# if defined(__clang__)
319# if defined(BOOST_ASIO_HAS_CLANG_LIBCXX)
320# define BOOST_ASIO_HAS_STD_CHRONO 1
321# elif (__cplusplus >= 201103)
322# if __has_include(<chrono>)
323# define BOOST_ASIO_HAS_STD_CHRONO 1
324# endif // __has_include(<chrono>)
325# endif // (__cplusplus >= 201103)
326# endif // defined(__clang__)
327# if defined(__GNUC__)
328# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4)
329# if defined(__GXX_EXPERIMENTAL_CXX0X__)
330# define BOOST_ASIO_HAS_STD_CHRONO 1
331# if ((__GNUC__ == 4) && (__GNUC_MINOR__ == 6))
332# define BOOST_ASIO_HAS_STD_CHRONO_MONOTONIC_CLOCK 1
333# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ == 6))
334# endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
335# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4)
336# endif // defined(__GNUC__)
337# if defined(BOOST_ASIO_MSVC)
338# if (_MSC_VER >= 1700)
339# define BOOST_ASIO_HAS_STD_CHRONO 1
340# endif // (_MSC_VER >= 1700)
341# endif // defined(BOOST_ASIO_MSVC)
342# endif // !defined(BOOST_ASIO_DISABLE_STD_CHRONO)
343#endif // !defined(BOOST_ASIO_HAS_STD_CHRONO)
344
345// Boost support for chrono.
346#if !defined(BOOST_ASIO_HAS_BOOST_CHRONO)
347# if !defined(BOOST_ASIO_DISABLE_BOOST_CHRONO)
348# if (BOOST_VERSION >= 104700)
349# define BOOST_ASIO_HAS_BOOST_CHRONO 1
350# endif // (BOOST_VERSION >= 104700)
351# endif // !defined(BOOST_ASIO_DISABLE_BOOST_CHRONO)
352#endif // !defined(BOOST_ASIO_HAS_BOOST_CHRONO)
353
354// Boost support for the DateTime library.
355#if !defined(BOOST_ASIO_HAS_BOOST_DATE_TIME)
356# if !defined(BOOST_ASIO_DISABLE_BOOST_DATE_TIME)
357# define BOOST_ASIO_HAS_BOOST_DATE_TIME 1
358# endif // !defined(BOOST_ASIO_DISABLE_BOOST_DATE_TIME)
359#endif // !defined(BOOST_ASIO_HAS_BOOST_DATE_TIME)
360
361// Standard library support for addressof.
362#if !defined(BOOST_ASIO_HAS_STD_ADDRESSOF)
363# if !defined(BOOST_ASIO_DISABLE_STD_ADDRESSOF)
364# if defined(__clang__)
365# if defined(BOOST_ASIO_HAS_CLANG_LIBCXX)
366# define BOOST_ASIO_HAS_STD_ADDRESSOF 1
367# elif (__cplusplus >= 201103)
368# define BOOST_ASIO_HAS_STD_ADDRESSOF 1
369# endif // (__cplusplus >= 201103)
370# endif // defined(__clang__)
371# if defined(__GNUC__)
372# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4)
373# if defined(__GXX_EXPERIMENTAL_CXX0X__)
374# define BOOST_ASIO_HAS_STD_ADDRESSOF 1
375# endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
376# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4)
377# endif // defined(__GNUC__)
378# if defined(BOOST_ASIO_MSVC)
379# if (_MSC_VER >= 1700)
380# define BOOST_ASIO_HAS_STD_ADDRESSOF 1
381# endif // (_MSC_VER >= 1700)
382# endif // defined(BOOST_ASIO_MSVC)
383# endif // !defined(BOOST_ASIO_DISABLE_STD_ADDRESSOF)
384#endif // !defined(BOOST_ASIO_HAS_STD_ADDRESSOF)
385
386// Standard library support for the function class.
387#if !defined(BOOST_ASIO_HAS_STD_FUNCTION)
388# if !defined(BOOST_ASIO_DISABLE_STD_FUNCTION)
389# if defined(__clang__)
390# if defined(BOOST_ASIO_HAS_CLANG_LIBCXX)
391# define BOOST_ASIO_HAS_STD_FUNCTION 1
392# elif (__cplusplus >= 201103)
393# define BOOST_ASIO_HAS_STD_FUNCTION 1
394# endif // (__cplusplus >= 201103)
395# endif // defined(__clang__)
396# if defined(__GNUC__)
397# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) || (__GNUC__ > 4)
398# if defined(__GXX_EXPERIMENTAL_CXX0X__)
399# define BOOST_ASIO_HAS_STD_FUNCTION 1
400# endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
401# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) || (__GNUC__ > 4)
402# endif // defined(__GNUC__)
403# if defined(BOOST_ASIO_MSVC)
404# if (_MSC_VER >= 1700)
405# define BOOST_ASIO_HAS_STD_FUNCTION 1
406# endif // (_MSC_VER >= 1700)
407# endif // defined(BOOST_ASIO_MSVC)
408# endif // !defined(BOOST_ASIO_DISABLE_STD_FUNCTION)
409#endif // !defined(BOOST_ASIO_HAS_STD_FUNCTION)
410
411// Standard library support for type traits.
412#if !defined(BOOST_ASIO_HAS_STD_TYPE_TRAITS)
413# if !defined(BOOST_ASIO_DISABLE_STD_TYPE_TRAITS)
414# if defined(__clang__)
415# if defined(BOOST_ASIO_HAS_CLANG_LIBCXX)
416# define BOOST_ASIO_HAS_STD_TYPE_TRAITS 1
417# elif (__cplusplus >= 201103)
418# if __has_include(<type_traits>)
419# define BOOST_ASIO_HAS_STD_TYPE_TRAITS 1
420# endif // __has_include(<type_traits>)
421# endif // (__cplusplus >= 201103)
422# endif // defined(__clang__)
423# if defined(__GNUC__)
424# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) || (__GNUC__ > 4)
425# if defined(__GXX_EXPERIMENTAL_CXX0X__)
426# define BOOST_ASIO_HAS_STD_TYPE_TRAITS 1
427# endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
428# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) || (__GNUC__ > 4)
429# endif // defined(__GNUC__)
430# if defined(BOOST_ASIO_MSVC)
431# if (_MSC_VER >= 1700)
432# define BOOST_ASIO_HAS_STD_TYPE_TRAITS 1
433# endif // (_MSC_VER >= 1700)
434# endif // defined(BOOST_ASIO_MSVC)
435# endif // !defined(BOOST_ASIO_DISABLE_STD_TYPE_TRAITS)
436#endif // !defined(BOOST_ASIO_HAS_STD_TYPE_TRAITS)
437
438// Standard library support for the cstdint header.
439#if !defined(BOOST_ASIO_HAS_CSTDINT)
440# if !defined(BOOST_ASIO_DISABLE_CSTDINT)
441# if defined(__clang__)
442# if defined(BOOST_ASIO_HAS_CLANG_LIBCXX)
443# define BOOST_ASIO_HAS_CSTDINT 1
444# elif (__cplusplus >= 201103)
445# define BOOST_ASIO_HAS_CSTDINT 1
446# endif // (__cplusplus >= 201103)
447# endif // defined(__clang__)
448# if defined(__GNUC__)
449# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) || (__GNUC__ > 4)
450# if defined(__GXX_EXPERIMENTAL_CXX0X__)
451# define BOOST_ASIO_HAS_CSTDINT 1
452# endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
453# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) || (__GNUC__ > 4)
454# endif // defined(__GNUC__)
455# if defined(BOOST_ASIO_MSVC)
456# if (_MSC_VER >= 1700)
457# define BOOST_ASIO_HAS_CSTDINT 1
458# endif // (_MSC_VER >= 1700)
459# endif // defined(BOOST_ASIO_MSVC)
460# endif // !defined(BOOST_ASIO_DISABLE_CSTDINT)
461#endif // !defined(BOOST_ASIO_HAS_CSTDINT)
462
463// Standard library support for the thread class.
464#if !defined(BOOST_ASIO_HAS_STD_THREAD)
465# if !defined(BOOST_ASIO_DISABLE_STD_THREAD)
466# if defined(__clang__)
467# if defined(BOOST_ASIO_HAS_CLANG_LIBCXX)
468# define BOOST_ASIO_HAS_STD_THREAD 1
469# elif (__cplusplus >= 201103)
470# if __has_include(<thread>)
471# define BOOST_ASIO_HAS_STD_THREAD 1
472# endif // __has_include(<thread>)
473# endif // (__cplusplus >= 201103)
474# endif // defined(__clang__)
475# if defined(__GNUC__)
476# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
477# if defined(__GXX_EXPERIMENTAL_CXX0X__)
478# define BOOST_ASIO_HAS_STD_THREAD 1
479# endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
480# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
481# endif // defined(__GNUC__)
482# if defined(BOOST_ASIO_MSVC)
483# if (_MSC_VER >= 1700)
484# define BOOST_ASIO_HAS_STD_THREAD 1
485# endif // (_MSC_VER >= 1700)
486# endif // defined(BOOST_ASIO_MSVC)
487# endif // !defined(BOOST_ASIO_DISABLE_STD_THREAD)
488#endif // !defined(BOOST_ASIO_HAS_STD_THREAD)
489
490// Standard library support for the mutex and condition variable classes.
491#if !defined(BOOST_ASIO_HAS_STD_MUTEX_AND_CONDVAR)
492# if !defined(BOOST_ASIO_DISABLE_STD_MUTEX_AND_CONDVAR)
493# if defined(__clang__)
494# if defined(BOOST_ASIO_HAS_CLANG_LIBCXX)
495# define BOOST_ASIO_HAS_STD_MUTEX_AND_CONDVAR 1
496# elif (__cplusplus >= 201103)
497# if __has_include(<mutex>)
498# define BOOST_ASIO_HAS_STD_MUTEX_AND_CONDVAR 1
499# endif // __has_include(<mutex>)
500# endif // (__cplusplus >= 201103)
501# endif // defined(__clang__)
502# if defined(__GNUC__)
503# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
504# if defined(__GXX_EXPERIMENTAL_CXX0X__)
505# define BOOST_ASIO_HAS_STD_MUTEX_AND_CONDVAR 1
506# endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
507# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
508# endif // defined(__GNUC__)
509# if defined(BOOST_ASIO_MSVC)
510# if (_MSC_VER >= 1700)
511# define BOOST_ASIO_HAS_STD_MUTEX_AND_CONDVAR 1
512# endif // (_MSC_VER >= 1700)
513# endif // defined(BOOST_ASIO_MSVC)
514# endif // !defined(BOOST_ASIO_DISABLE_STD_MUTEX_AND_CONDVAR)
515#endif // !defined(BOOST_ASIO_HAS_STD_MUTEX_AND_CONDVAR)
516
517// Windows App target. Windows but with a limited API.
518#if !defined(BOOST_ASIO_WINDOWS_APP)
519# if defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0603)
520# include <winapifamily.h>
521# if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) \
522 && !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
523# define BOOST_ASIO_WINDOWS_APP 1
524# endif // WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
525 // && !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
526# endif // defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0603)
527#endif // !defined(BOOST_ASIO_WINDOWS_APP)
528
529// Legacy WinRT target. Windows App is preferred.
530#if !defined(BOOST_ASIO_WINDOWS_RUNTIME)
531# if !defined(BOOST_ASIO_WINDOWS_APP)
532# if defined(__cplusplus_winrt)
533# include <winapifamily.h>
534# if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) \
535 && !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
536# define BOOST_ASIO_WINDOWS_RUNTIME 1
537# endif // WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
538 // && !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
539# endif // defined(__cplusplus_winrt)
540# endif // !defined(BOOST_ASIO_WINDOWS_APP)
541#endif // !defined(BOOST_ASIO_WINDOWS_RUNTIME)
542
543// Windows target. Excludes WinRT but includes Windows App targets.
544#if !defined(BOOST_ASIO_WINDOWS)
545# if !defined(BOOST_ASIO_WINDOWS_RUNTIME)
546# if defined(BOOST_ASIO_HAS_BOOST_CONFIG) && defined(BOOST_WINDOWS)
547# define BOOST_ASIO_WINDOWS 1
548# elif defined(WIN32) || defined(_WIN32) || defined(__WIN32__)
549# define BOOST_ASIO_WINDOWS 1
550# elif defined(BOOST_ASIO_WINDOWS_APP)
551# define BOOST_ASIO_WINDOWS 1
552# endif // defined(BOOST_ASIO_HAS_BOOST_CONFIG) && defined(BOOST_WINDOWS)
553# endif // !defined(BOOST_ASIO_WINDOWS_RUNTIME)
554#endif // !defined(BOOST_ASIO_WINDOWS)
555
556// Windows: target OS version.
557#if defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__)
558# if !defined(_WIN32_WINNT) && !defined(_WIN32_WINDOWS)
559# if defined(_MSC_VER) || defined(__BORLANDC__)
560# pragma message( \
561 "Please define _WIN32_WINNT or _WIN32_WINDOWS appropriately. For example:\n"\
562 "- add -D_WIN32_WINNT=0x0501 to the compiler command line; or\n"\
563 "- add _WIN32_WINNT=0x0501 to your project's Preprocessor Definitions.\n"\
564 "Assuming _WIN32_WINNT=0x0501 (i.e. Windows XP target).")
565# else // defined(_MSC_VER) || defined(__BORLANDC__)
566# warning Please define _WIN32_WINNT or _WIN32_WINDOWS appropriately.
567# warning For example, add -D_WIN32_WINNT=0x0501 to the compiler command line.
568# warning Assuming _WIN32_WINNT=0x0501 (i.e. Windows XP target).
569# endif // defined(_MSC_VER) || defined(__BORLANDC__)
570# define _WIN32_WINNT 0x0501
571# endif // !defined(_WIN32_WINNT) && !defined(_WIN32_WINDOWS)
572# if defined(_MSC_VER)
573# if defined(_WIN32) && !defined(WIN32)
574# if !defined(_WINSOCK2API_)
575# define WIN32 // Needed for correct types in winsock2.h
576# else // !defined(_WINSOCK2API_)
577# error Please define the macro WIN32 in your compiler options
578# endif // !defined(_WINSOCK2API_)
579# endif // defined(_WIN32) && !defined(WIN32)
580# endif // defined(_MSC_VER)
581# if defined(__BORLANDC__)
582# if defined(__WIN32__) && !defined(WIN32)
583# if !defined(_WINSOCK2API_)
584# define WIN32 // Needed for correct types in winsock2.h
585# else // !defined(_WINSOCK2API_)
586# error Please define the macro WIN32 in your compiler options
587# endif // !defined(_WINSOCK2API_)
588# endif // defined(__WIN32__) && !defined(WIN32)
589# endif // defined(__BORLANDC__)
590# if defined(__CYGWIN__)
591# if !defined(__USE_W32_SOCKETS)
592# error You must add -D__USE_W32_SOCKETS to your compiler options.
593# endif // !defined(__USE_W32_SOCKETS)
594# endif // defined(__CYGWIN__)
595#endif // defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__)
596
597// Windows: minimise header inclusion.
598#if defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__)
599# if !defined(BOOST_ASIO_NO_WIN32_LEAN_AND_MEAN)
600# if !defined(WIN32_LEAN_AND_MEAN)
601# define WIN32_LEAN_AND_MEAN
602# endif // !defined(WIN32_LEAN_AND_MEAN)
603# endif // !defined(BOOST_ASIO_NO_WIN32_LEAN_AND_MEAN)
604#endif // defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__)
605
606// Windows: suppress definition of "min" and "max" macros.
607#if defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__)
608# if !defined(BOOST_ASIO_NO_NOMINMAX)
609# if !defined(NOMINMAX)
610# define NOMINMAX 1
611# endif // !defined(NOMINMAX)
612# endif // !defined(BOOST_ASIO_NO_NOMINMAX)
613#endif // defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__)
614
615// Windows: IO Completion Ports.
616#if !defined(BOOST_ASIO_HAS_IOCP)
617# if defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__)
618# if defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0400)
619# if !defined(UNDER_CE) && !defined(BOOST_ASIO_WINDOWS_APP)
620# if !defined(BOOST_ASIO_DISABLE_IOCP)
621# define BOOST_ASIO_HAS_IOCP 1
622# endif // !defined(BOOST_ASIO_DISABLE_IOCP)
623# endif // !defined(UNDER_CE) && !defined(BOOST_ASIO_WINDOWS_APP)
624# endif // defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0400)
625# endif // defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__)
626#endif // !defined(BOOST_ASIO_HAS_IOCP)
627
628// On POSIX (and POSIX-like) platforms we need to include unistd.h in order to
629// get access to the various platform feature macros, e.g. to be able to test
630// for threads support.
631#if !defined(BOOST_ASIO_HAS_UNISTD_H)
632# if !defined(BOOST_ASIO_HAS_BOOST_CONFIG)
633# if defined(unix) \
634 || defined(__unix) \
635 || defined(_XOPEN_SOURCE) \
636 || defined(_POSIX_SOURCE) \
637 || (defined(__MACH__) && defined(__APPLE__)) \
638 || defined(__FreeBSD__) \
639 || defined(__NetBSD__) \
640 || defined(__OpenBSD__) \
641 || defined(__linux__)
642# define BOOST_ASIO_HAS_UNISTD_H 1
643# endif
644# endif // !defined(BOOST_ASIO_HAS_BOOST_CONFIG)
645#endif // !defined(BOOST_ASIO_HAS_UNISTD_H)
646#if defined(BOOST_ASIO_HAS_UNISTD_H)
647# include <unistd.h>
648#endif // defined(BOOST_ASIO_HAS_UNISTD_H)
649
650// Linux: epoll, eventfd and timerfd.
651#if defined(__linux__)
652# include <linux/version.h>
653# if !defined(BOOST_ASIO_HAS_EPOLL)
654# if !defined(BOOST_ASIO_DISABLE_EPOLL)
655# if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,45)
656# define BOOST_ASIO_HAS_EPOLL 1
657# endif // LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,45)
658# endif // !defined(BOOST_ASIO_DISABLE_EPOLL)
659# endif // !defined(BOOST_ASIO_HAS_EPOLL)
660# if !defined(BOOST_ASIO_HAS_EVENTFD)
661# if !defined(BOOST_ASIO_DISABLE_EVENTFD)
662# if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
663# define BOOST_ASIO_HAS_EVENTFD 1
664# endif // LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
665# endif // !defined(BOOST_ASIO_DISABLE_EVENTFD)
666# endif // !defined(BOOST_ASIO_HAS_EVENTFD)
667# if !defined(BOOST_ASIO_HAS_TIMERFD)
668# if defined(BOOST_ASIO_HAS_EPOLL)
669# if (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 8)
670# define BOOST_ASIO_HAS_TIMERFD 1
671# endif // (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 8)
672# endif // defined(BOOST_ASIO_HAS_EPOLL)
673# endif // !defined(BOOST_ASIO_HAS_TIMERFD)
674#endif // defined(__linux__)
675
676// Mac OS X, FreeBSD, NetBSD, OpenBSD: kqueue.
677#if (defined(__MACH__) && defined(__APPLE__)) \
678 || defined(__FreeBSD__) \
679 || defined(__NetBSD__) \
680 || defined(__OpenBSD__)
681# if !defined(BOOST_ASIO_HAS_KQUEUE)
682# if !defined(BOOST_ASIO_DISABLE_KQUEUE)
683# define BOOST_ASIO_HAS_KQUEUE 1
684# endif // !defined(BOOST_ASIO_DISABLE_KQUEUE)
685# endif // !defined(BOOST_ASIO_HAS_KQUEUE)
686#endif // (defined(__MACH__) && defined(__APPLE__))
687 // || defined(__FreeBSD__)
688 // || defined(__NetBSD__)
689 // || defined(__OpenBSD__)
690
691// Solaris: /dev/poll.
692#if defined(__sun)
693# if !defined(BOOST_ASIO_HAS_DEV_POLL)
694# if !defined(BOOST_ASIO_DISABLE_DEV_POLL)
695# define BOOST_ASIO_HAS_DEV_POLL 1
696# endif // !defined(BOOST_ASIO_DISABLE_DEV_POLL)
697# endif // !defined(BOOST_ASIO_HAS_DEV_POLL)
698#endif // defined(__sun)
699
700// Serial ports.
701#if !defined(BOOST_ASIO_HAS_SERIAL_PORT)
702# if defined(BOOST_ASIO_HAS_IOCP) \
703 || !defined(BOOST_ASIO_WINDOWS) \
704 && !defined(BOOST_ASIO_WINDOWS_RUNTIME) \
705 && !defined(__CYGWIN__)
706# if !defined(__SYMBIAN32__)
707# if !defined(BOOST_ASIO_DISABLE_SERIAL_PORT)
708# define BOOST_ASIO_HAS_SERIAL_PORT 1
709# endif // !defined(BOOST_ASIO_DISABLE_SERIAL_PORT)
710# endif // !defined(__SYMBIAN32__)
711# endif // defined(BOOST_ASIO_HAS_IOCP)
712 // || !defined(BOOST_ASIO_WINDOWS)
713 // && !defined(BOOST_ASIO_WINDOWS_RUNTIME)
714 // && !defined(__CYGWIN__)
715#endif // !defined(BOOST_ASIO_HAS_SERIAL_PORT)
716
717// Windows: stream handles.
718#if !defined(BOOST_ASIO_HAS_WINDOWS_STREAM_HANDLE)
719# if !defined(BOOST_ASIO_DISABLE_WINDOWS_STREAM_HANDLE)
720# if defined(BOOST_ASIO_HAS_IOCP)
721# define BOOST_ASIO_HAS_WINDOWS_STREAM_HANDLE 1
722# endif // defined(BOOST_ASIO_HAS_IOCP)
723# endif // !defined(BOOST_ASIO_DISABLE_WINDOWS_STREAM_HANDLE)
724#endif // !defined(BOOST_ASIO_HAS_WINDOWS_STREAM_HANDLE)
725
726// Windows: random access handles.
727#if !defined(BOOST_ASIO_HAS_WINDOWS_RANDOM_ACCESS_HANDLE)
728# if !defined(BOOST_ASIO_DISABLE_WINDOWS_RANDOM_ACCESS_HANDLE)
729# if defined(BOOST_ASIO_HAS_IOCP)
730# define BOOST_ASIO_HAS_WINDOWS_RANDOM_ACCESS_HANDLE 1
731# endif // defined(BOOST_ASIO_HAS_IOCP)
732# endif // !defined(BOOST_ASIO_DISABLE_WINDOWS_RANDOM_ACCESS_HANDLE)
733#endif // !defined(BOOST_ASIO_HAS_WINDOWS_RANDOM_ACCESS_HANDLE)
734
735// Windows: object handles.
736#if !defined(BOOST_ASIO_HAS_WINDOWS_OBJECT_HANDLE)
737# if !defined(BOOST_ASIO_DISABLE_WINDOWS_OBJECT_HANDLE)
738# if defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__)
739# if !defined(UNDER_CE) && !defined(BOOST_ASIO_WINDOWS_APP)
740# define BOOST_ASIO_HAS_WINDOWS_OBJECT_HANDLE 1
741# endif // !defined(UNDER_CE) && !defined(BOOST_ASIO_WINDOWS_APP)
742# endif // defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__)
743# endif // !defined(BOOST_ASIO_DISABLE_WINDOWS_OBJECT_HANDLE)
744#endif // !defined(BOOST_ASIO_HAS_WINDOWS_OBJECT_HANDLE)
745
746// Windows: OVERLAPPED wrapper.
747#if !defined(BOOST_ASIO_HAS_WINDOWS_OVERLAPPED_PTR)
748# if !defined(BOOST_ASIO_DISABLE_WINDOWS_OVERLAPPED_PTR)
749# if defined(BOOST_ASIO_HAS_IOCP)
750# define BOOST_ASIO_HAS_WINDOWS_OVERLAPPED_PTR 1
751# endif // defined(BOOST_ASIO_HAS_IOCP)
752# endif // !defined(BOOST_ASIO_DISABLE_WINDOWS_OVERLAPPED_PTR)
753#endif // !defined(BOOST_ASIO_HAS_WINDOWS_OVERLAPPED_PTR)
754
755// POSIX: stream-oriented file descriptors.
756#if !defined(BOOST_ASIO_HAS_POSIX_STREAM_DESCRIPTOR)
757# if !defined(BOOST_ASIO_DISABLE_POSIX_STREAM_DESCRIPTOR)
758# if !defined(BOOST_ASIO_WINDOWS) \
759 && !defined(BOOST_ASIO_WINDOWS_RUNTIME) \
760 && !defined(__CYGWIN__)
761# define BOOST_ASIO_HAS_POSIX_STREAM_DESCRIPTOR 1
762# endif // !defined(BOOST_ASIO_WINDOWS)
763 // && !defined(BOOST_ASIO_WINDOWS_RUNTIME)
764 // && !defined(__CYGWIN__)
765# endif // !defined(BOOST_ASIO_DISABLE_POSIX_STREAM_DESCRIPTOR)
766#endif // !defined(BOOST_ASIO_HAS_POSIX_STREAM_DESCRIPTOR)
767
768// UNIX domain sockets.
769#if !defined(BOOST_ASIO_HAS_LOCAL_SOCKETS)
770# if !defined(BOOST_ASIO_DISABLE_LOCAL_SOCKETS)
771# if !defined(BOOST_ASIO_WINDOWS) \
772 && !defined(BOOST_ASIO_WINDOWS_RUNTIME) \
773 && !defined(__CYGWIN__)
774# define BOOST_ASIO_HAS_LOCAL_SOCKETS 1
775# endif // !defined(BOOST_ASIO_WINDOWS)
776 // && !defined(BOOST_ASIO_WINDOWS_RUNTIME)
777 // && !defined(__CYGWIN__)
778# endif // !defined(BOOST_ASIO_DISABLE_LOCAL_SOCKETS)
779#endif // !defined(BOOST_ASIO_HAS_LOCAL_SOCKETS)
780
781// Can use sigaction() instead of signal().
782#if !defined(BOOST_ASIO_HAS_SIGACTION)
783# if !defined(BOOST_ASIO_DISABLE_SIGACTION)
784# if !defined(BOOST_ASIO_WINDOWS) \
785 && !defined(BOOST_ASIO_WINDOWS_RUNTIME) \
786 && !defined(__CYGWIN__)
787# define BOOST_ASIO_HAS_SIGACTION 1
788# endif // !defined(BOOST_ASIO_WINDOWS)
789 // && !defined(BOOST_ASIO_WINDOWS_RUNTIME)
790 // && !defined(__CYGWIN__)
791# endif // !defined(BOOST_ASIO_DISABLE_SIGACTION)
792#endif // !defined(BOOST_ASIO_HAS_SIGACTION)
793
794// Can use signal().
795#if !defined(BOOST_ASIO_HAS_SIGNAL)
796# if !defined(BOOST_ASIO_DISABLE_SIGNAL)
797# if !defined(UNDER_CE)
798# define BOOST_ASIO_HAS_SIGNAL 1
799# endif // !defined(UNDER_CE)
800# endif // !defined(BOOST_ASIO_DISABLE_SIGNAL)
801#endif // !defined(BOOST_ASIO_HAS_SIGNAL)
802
803// Can use getaddrinfo() and getnameinfo().
804#if !defined(BOOST_ASIO_HAS_GETADDRINFO)
805# if defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__)
806# if defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0501)
807# define BOOST_ASIO_HAS_GETADDRINFO 1
808# elif defined(UNDER_CE)
809# define BOOST_ASIO_HAS_GETADDRINFO 1
810# endif // defined(UNDER_CE)
811# elif !(defined(__MACH__) && defined(__APPLE__))
812# define BOOST_ASIO_HAS_GETADDRINFO 1
813# endif // !(defined(__MACH__) && defined(__APPLE__))
814#endif // !defined(BOOST_ASIO_HAS_GETADDRINFO)
815
816// Whether standard iostreams are disabled.
817#if !defined(BOOST_ASIO_NO_IOSTREAM)
818# if defined(BOOST_ASIO_HAS_BOOST_CONFIG) && defined(BOOST_NO_IOSTREAM)
819# define BOOST_ASIO_NO_IOSTREAM 1
820# endif // !defined(BOOST_NO_IOSTREAM)
821#endif // !defined(BOOST_ASIO_NO_IOSTREAM)
822
823// Whether exception handling is disabled.
824#if !defined(BOOST_ASIO_NO_EXCEPTIONS)
825# if defined(BOOST_ASIO_HAS_BOOST_CONFIG) && defined(BOOST_NO_EXCEPTIONS)
826# define BOOST_ASIO_NO_EXCEPTIONS 1
827# endif // !defined(BOOST_NO_EXCEPTIONS)
828#endif // !defined(BOOST_ASIO_NO_EXCEPTIONS)
829
830// Whether the typeid operator is supported.
831#if !defined(BOOST_ASIO_NO_TYPEID)
832# if defined(BOOST_ASIO_HAS_BOOST_CONFIG) && defined(BOOST_NO_TYPEID)
833# define BOOST_ASIO_NO_TYPEID 1
834# endif // !defined(BOOST_NO_TYPEID)
835#endif // !defined(BOOST_ASIO_NO_TYPEID)
836
837// Threads.
838#if !defined(BOOST_ASIO_HAS_THREADS)
839# if !defined(BOOST_ASIO_DISABLE_THREADS)
840# if defined(BOOST_ASIO_HAS_BOOST_CONFIG) && defined(BOOST_HAS_THREADS)
841# define BOOST_ASIO_HAS_THREADS 1
842# elif defined(_MSC_VER) && defined(_MT)
843# define BOOST_ASIO_HAS_THREADS 1
844# elif defined(__BORLANDC__) && defined(__MT__)
845# define BOOST_ASIO_HAS_THREADS 1
846# elif defined(_POSIX_THREADS)
847# define BOOST_ASIO_HAS_THREADS 1
848# endif // defined(BOOST_ASIO_HAS_BOOST_CONFIG) && defined(BOOST_HAS_THREADS)
849# endif // !defined(BOOST_ASIO_DISABLE_THREADS)
850#endif // !defined(BOOST_ASIO_HAS_THREADS)
851
852// POSIX threads.
853#if !defined(BOOST_ASIO_HAS_PTHREADS)
854# if defined(BOOST_ASIO_HAS_THREADS)
855# if defined(BOOST_ASIO_HAS_BOOST_CONFIG) && defined(BOOST_HAS_PTHREADS)
856# define BOOST_ASIO_HAS_PTHREADS 1
857# elif defined(_POSIX_THREADS)
858# define BOOST_ASIO_HAS_PTHREADS 1
859# endif // defined(BOOST_ASIO_HAS_BOOST_CONFIG) && defined(BOOST_HAS_PTHREADS)
860# endif // defined(BOOST_ASIO_HAS_THREADS)
861#endif // !defined(BOOST_ASIO_HAS_PTHREADS)
862
863// Helper to prevent macro expansion.
864#define BOOST_ASIO_PREVENT_MACRO_SUBSTITUTION
865
866// Helper to define in-class constants.
867#if !defined(BOOST_ASIO_STATIC_CONSTANT)
868# if !defined(BOOST_ASIO_DISABLE_BOOST_STATIC_CONSTANT)
869# define BOOST_ASIO_STATIC_CONSTANT(type, assignment) \
870 BOOST_STATIC_CONSTANT(type, assignment)
871# else // !defined(BOOST_ASIO_DISABLE_BOOST_STATIC_CONSTANT)
872# define BOOST_ASIO_STATIC_CONSTANT(type, assignment) \
873 static const type assignment
874# endif // !defined(BOOST_ASIO_DISABLE_BOOST_STATIC_CONSTANT)
875#endif // !defined(BOOST_ASIO_STATIC_CONSTANT)
876
877// Boost array library.
878#if !defined(BOOST_ASIO_HAS_BOOST_ARRAY)
879# if !defined(BOOST_ASIO_DISABLE_BOOST_ARRAY)
880# define BOOST_ASIO_HAS_BOOST_ARRAY 1
881# endif // !defined(BOOST_ASIO_DISABLE_BOOST_ARRAY)
882#endif // !defined(BOOST_ASIO_HAS_BOOST_ARRAY)
883
884// Boost assert macro.
885#if !defined(BOOST_ASIO_HAS_BOOST_ASSERT)
886# if !defined(BOOST_ASIO_DISABLE_BOOST_ASSERT)
887# define BOOST_ASIO_HAS_BOOST_ASSERT 1
888# endif // !defined(BOOST_ASIO_DISABLE_BOOST_ASSERT)
889#endif // !defined(BOOST_ASIO_HAS_BOOST_ASSERT)
890
891// Boost limits header.
892#if !defined(BOOST_ASIO_HAS_BOOST_LIMITS)
893# if !defined(BOOST_ASIO_DISABLE_BOOST_LIMITS)
894# define BOOST_ASIO_HAS_BOOST_LIMITS 1
895# endif // !defined(BOOST_ASIO_DISABLE_BOOST_LIMITS)
896#endif // !defined(BOOST_ASIO_HAS_BOOST_LIMITS)
897
898// Boost throw_exception function.
899#if !defined(BOOST_ASIO_HAS_BOOST_THROW_EXCEPTION)
900# if !defined(BOOST_ASIO_DISABLE_BOOST_THROW_EXCEPTION)
901# define BOOST_ASIO_HAS_BOOST_THROW_EXCEPTION 1
902# endif // !defined(BOOST_ASIO_DISABLE_BOOST_THROW_EXCEPTION)
903#endif // !defined(BOOST_ASIO_HAS_BOOST_THROW_EXCEPTION)
904
905// Boost regex library.
906#if !defined(BOOST_ASIO_HAS_BOOST_REGEX)
907# if !defined(BOOST_ASIO_DISABLE_BOOST_REGEX)
908# define BOOST_ASIO_HAS_BOOST_REGEX 1
909# endif // !defined(BOOST_ASIO_DISABLE_BOOST_REGEX)
910#endif // !defined(BOOST_ASIO_HAS_BOOST_REGEX)
911
912// Boost bind function.
913#if !defined(BOOST_ASIO_HAS_BOOST_BIND)
914# if !defined(BOOST_ASIO_DISABLE_BOOST_BIND)
915# define BOOST_ASIO_HAS_BOOST_BIND 1
916# endif // !defined(BOOST_ASIO_DISABLE_BOOST_BIND)
917#endif // !defined(BOOST_ASIO_HAS_BOOST_BIND)
918
919// Boost's BOOST_WORKAROUND macro.
920#if !defined(BOOST_ASIO_HAS_BOOST_WORKAROUND)
921# if !defined(BOOST_ASIO_DISABLE_BOOST_WORKAROUND)
922# define BOOST_ASIO_HAS_BOOST_WORKAROUND 1
923# endif // !defined(BOOST_ASIO_DISABLE_BOOST_WORKAROUND)
924#endif // !defined(BOOST_ASIO_HAS_BOOST_WORKAROUND)
925
926// Microsoft Visual C++'s secure C runtime library.
927#if !defined(BOOST_ASIO_HAS_SECURE_RTL)
928# if !defined(BOOST_ASIO_DISABLE_SECURE_RTL)
929# if defined(BOOST_ASIO_MSVC) \
930 && (BOOST_ASIO_MSVC >= 1400) \
931 && !defined(UNDER_CE)
932# define BOOST_ASIO_HAS_SECURE_RTL 1
933# endif // defined(BOOST_ASIO_MSVC)
934 // && (BOOST_ASIO_MSVC >= 1400)
935 // && !defined(UNDER_CE)
936# endif // !defined(BOOST_ASIO_DISABLE_SECURE_RTL)
937#endif // !defined(BOOST_ASIO_HAS_SECURE_RTL)
938
939// Handler hooking. Disabled for ancient Borland C++ and gcc compilers.
940#if !defined(BOOST_ASIO_HAS_HANDLER_HOOKS)
941# if !defined(BOOST_ASIO_DISABLE_HANDLER_HOOKS)
942# if defined(__GNUC__)
943# if (__GNUC__ >= 3)
944# define BOOST_ASIO_HAS_HANDLER_HOOKS 1
945# endif // (__GNUC__ >= 3)
946# elif !defined(__BORLANDC__)
947# define BOOST_ASIO_HAS_HANDLER_HOOKS 1
948# endif // !defined(__BORLANDC__)
949# endif // !defined(BOOST_ASIO_DISABLE_HANDLER_HOOKS)
950#endif // !defined(BOOST_ASIO_HAS_HANDLER_HOOKS)
951
952// Support for the __thread keyword extension.
953#if !defined(BOOST_ASIO_DISABLE_THREAD_KEYWORD_EXTENSION)
954# if defined(__linux__)
955# if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
956# if ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)
957# if !defined(__INTEL_COMPILER) && !defined(__ICL)
958# define BOOST_ASIO_HAS_THREAD_KEYWORD_EXTENSION 1
959# define BOOST_ASIO_THREAD_KEYWORD __thread
960# elif defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 1100)
961# define BOOST_ASIO_HAS_THREAD_KEYWORD_EXTENSION 1
962# endif // defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 1100)
963# endif // ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)
964# endif // defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
965# endif // defined(__linux__)
966# if defined(BOOST_ASIO_MSVC) && defined(BOOST_ASIO_WINDOWS_RUNTIME)
967# if (_MSC_VER >= 1700)
968# define BOOST_ASIO_HAS_THREAD_KEYWORD_EXTENSION 1
969# define BOOST_ASIO_THREAD_KEYWORD __declspec(thread)
970# endif // (_MSC_VER >= 1700)
971# endif // defined(BOOST_ASIO_MSVC) && defined(BOOST_ASIO_WINDOWS_RUNTIME)
972#endif // !defined(BOOST_ASIO_DISABLE_THREAD_KEYWORD_EXTENSION)
973#if !defined(BOOST_ASIO_THREAD_KEYWORD)
974# define BOOST_ASIO_THREAD_KEYWORD __thread
975#endif // !defined(BOOST_ASIO_THREAD_KEYWORD)
976
977// Support for POSIX ssize_t typedef.
978#if !defined(BOOST_ASIO_DISABLE_SSIZE_T)
979# if defined(__linux__) \
980 || (defined(__MACH__) && defined(__APPLE__))
981# define BOOST_ASIO_HAS_SSIZE_T 1
982# endif // defined(__linux__)
983 // || (defined(__MACH__) && defined(__APPLE__))
984#endif // !defined(BOOST_ASIO_DISABLE_SSIZE_T)
985
986#endif // BOOST_ASIO_DETAIL_CONFIG_HPP
987