config.hpp 36 KB

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