/Src/Dependencies/Boost/boost/asio/detail/config.hpp

http://hadesmem.googlecode.com/ · C++ Header · 327 lines · 249 code · 29 blank · 49 comment · 113 complexity · 1f1d10242d3049f7655f4a7daf6f39f5 MD5 · raw file

  1. //
  2. // detail/config.hpp
  3. // ~~~~~~~~~~~~~~~~~
  4. //
  5. // Copyright (c) 2003-2011 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. #include <boost/config.hpp>
  13. // Default to a header-only implementation. The user must specifically request
  14. // separate compilation by defining either BOOST_ASIO_SEPARATE_COMPILATION or
  15. // BOOST_ASIO_DYN_LINK (as a DLL/shared library implies separate compilation).
  16. #if !defined(BOOST_ASIO_HEADER_ONLY)
  17. # if !defined(BOOST_ASIO_SEPARATE_COMPILATION)
  18. # if !defined(BOOST_ASIO_DYN_LINK)
  19. # define BOOST_ASIO_HEADER_ONLY
  20. # endif // !defined(BOOST_ASIO_DYN_LINK)
  21. # endif // !defined(BOOST_ASIO_SEPARATE_COMPILATION)
  22. #endif // !defined(BOOST_ASIO_HEADER_ONLY)
  23. #if defined(BOOST_ASIO_HEADER_ONLY)
  24. # define BOOST_ASIO_DECL inline
  25. #else // defined(BOOST_ASIO_HEADER_ONLY)
  26. # if defined(BOOST_HAS_DECLSPEC)
  27. // We need to import/export our code only if the user has specifically asked
  28. // for it by defining BOOST_ASIO_DYN_LINK.
  29. # if defined(BOOST_ASIO_DYN_LINK)
  30. // Export if this is our own source, otherwise import.
  31. # if defined(BOOST_ASIO_SOURCE)
  32. # define BOOST_ASIO_DECL __declspec(dllexport)
  33. # else // defined(BOOST_ASIO_SOURCE)
  34. # define BOOST_ASIO_DECL __declspec(dllimport)
  35. # endif // defined(BOOST_ASIO_SOURCE)
  36. # endif // defined(BOOST_ASIO_DYN_LINK)
  37. # endif // defined(BOOST_HAS_DECLSPEC)
  38. #endif // defined(BOOST_ASIO_HEADER_ONLY)
  39. // If BOOST_ASIO_DECL isn't defined yet define it now.
  40. #if !defined(BOOST_ASIO_DECL)
  41. # define BOOST_ASIO_DECL
  42. #endif // !defined(BOOST_ASIO_DECL)
  43. // Support move construction and assignment on compilers known to allow it.
  44. #if !defined(BOOST_ASIO_DISABLE_MOVE)
  45. # if defined(__GNUC__)
  46. # if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) || (__GNUC__ > 4)
  47. # if defined(__GXX_EXPERIMENTAL_CXX0X__)
  48. # define BOOST_ASIO_HAS_MOVE
  49. # endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
  50. # endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) || (__GNUC__ > 4)
  51. # endif // defined(__GNUC__)
  52. #endif // !defined(BOOST_ASIO_DISABLE_MOVE)
  53. // If BOOST_ASIO_MOVE_CAST isn't defined, and move support is available, define
  54. // BOOST_ASIO_MOVE_ARG and BOOST_ASIO_MOVE_CAST to take advantage of rvalue
  55. // references and perfect forwarding.
  56. #if defined(BOOST_ASIO_HAS_MOVE) && !defined(BOOST_ASIO_MOVE_CAST)
  57. # define BOOST_ASIO_MOVE_ARG(type) type&&
  58. # define BOOST_ASIO_MOVE_CAST(type) static_cast<type&&>
  59. #endif // defined(BOOST_ASIO_HAS_MOVE) && !defined(BOOST_ASIO_MOVE_CAST)
  60. // If BOOST_ASIO_MOVE_CAST still isn't defined, default to a C++03-compatible
  61. // implementation. Note that older g++ and MSVC versions don't like it when you
  62. // pass a non-member function through a const reference, so for most compilers
  63. // we'll play it safe and stick with the old approach of passing the handler by
  64. // value.
  65. #if !defined(BOOST_ASIO_MOVE_CAST)
  66. # if defined(__GNUC__)
  67. # if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 1)) || (__GNUC__ > 4)
  68. # define BOOST_ASIO_MOVE_ARG(type) const type&
  69. # else // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 1)) || (__GNUC__ > 4)
  70. # define BOOST_ASIO_MOVE_ARG(type) type
  71. # endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 1)) || (__GNUC__ > 4)
  72. # elif defined(BOOST_MSVC)
  73. # if (_MSC_VER >= 1400)
  74. # define BOOST_ASIO_MOVE_ARG(type) const type&
  75. # else // (_MSC_VER >= 1400)
  76. # define BOOST_ASIO_MOVE_ARG(type) type
  77. # endif // (_MSC_VER >= 1400)
  78. # else
  79. # define BOOST_ASIO_MOVE_ARG(type) type
  80. # endif
  81. # define BOOST_ASIO_MOVE_CAST(type) static_cast<const type&>
  82. #endif // !defined_BOOST_ASIO_MOVE_CAST
  83. // Support variadic templates on compilers known to allow it.
  84. #if !defined(BOOST_ASIO_DISABLE_VARIADIC_TEMPLATES)
  85. # if defined(__GNUC__)
  86. # if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 4)
  87. # if defined(__GXX_EXPERIMENTAL_CXX0X__)
  88. # define BOOST_ASIO_HAS_VARIADIC_TEMPLATES
  89. # endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
  90. # endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 4)
  91. # endif // defined(__GNUC__)
  92. #endif // !defined(BOOST_ASIO_DISABLE_VARIADIC_TEMPLATES)
  93. // Standard library support for system errors.
  94. #if !defined(BOOST_ASIO_DISABLE_STD_SYSTEM_ERROR)
  95. # if defined(__GNUC__)
  96. # if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4)
  97. # if defined(__GXX_EXPERIMENTAL_CXX0X__)
  98. # define BOOST_ASIO_HAS_STD_SYSTEM_ERROR
  99. # endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
  100. # endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4)
  101. # endif // defined(__GNUC__)
  102. #endif // !defined(BOOST_ASIO_DISABLE_STD_SYSTEM_ERROR)
  103. // Standard library support for arrays.
  104. #if !defined(BOOST_ASIO_DISABLE_STD_ARRAY)
  105. # if defined(__GNUC__)
  106. # if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 4)
  107. # if defined(__GXX_EXPERIMENTAL_CXX0X__)
  108. # define BOOST_ASIO_HAS_STD_ARRAY
  109. # endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
  110. # endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 4)
  111. # endif // defined(__GNUC__)
  112. # if defined(BOOST_MSVC)
  113. # if (_MSC_VER >= 1600)
  114. # define BOOST_ASIO_HAS_STD_ARRAY
  115. # endif // (_MSC_VER >= 1600)
  116. # endif // defined(BOOST_MSVC)
  117. #endif // !defined(BOOST_ASIO_DISABLE_STD_ARRAY)
  118. // Standard library support for shared_ptr and weak_ptr.
  119. #if !defined(BOOST_ASIO_DISABLE_STD_SHARED_PTR)
  120. # if defined(__GNUC__)
  121. # if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 4)
  122. # if defined(__GXX_EXPERIMENTAL_CXX0X__)
  123. # define BOOST_ASIO_HAS_STD_SHARED_PTR
  124. # endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
  125. # endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 4)
  126. # endif // defined(__GNUC__)
  127. # if defined(BOOST_MSVC)
  128. # if (_MSC_VER >= 1600)
  129. # define BOOST_ASIO_HAS_STD_SHARED_PTR
  130. # endif // (_MSC_VER >= 1600)
  131. # endif // defined(BOOST_MSVC)
  132. #endif // !defined(BOOST_ASIO_DISABLE_STD_SHARED_PTR)
  133. // Standard library support for atomic operations.
  134. #if !defined(BOOST_ASIO_DISABLE_STD_ATOMIC)
  135. # if defined(__GNUC__)
  136. # if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) || (__GNUC__ > 4)
  137. # if defined(__GXX_EXPERIMENTAL_CXX0X__)
  138. # define BOOST_ASIO_HAS_STD_ATOMIC
  139. # endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
  140. # endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) || (__GNUC__ > 4)
  141. # endif // defined(__GNUC__)
  142. #endif // !defined(BOOST_ASIO_DISABLE_STD_ATOMIC)
  143. // Windows: target OS version.
  144. #if defined(BOOST_WINDOWS) || defined(__CYGWIN__)
  145. # if !defined(_WIN32_WINNT) && !defined(_WIN32_WINDOWS)
  146. # if defined(_MSC_VER) || defined(__BORLANDC__)
  147. # pragma message( \
  148. "Please define _WIN32_WINNT or _WIN32_WINDOWS appropriately. For example:\n"\
  149. "- add -D_WIN32_WINNT=0x0501 to the compiler command line; or\n"\
  150. "- add _WIN32_WINNT=0x0501 to your project's Preprocessor Definitions.\n"\
  151. "Assuming _WIN32_WINNT=0x0501 (i.e. Windows XP target).")
  152. # else // defined(_MSC_VER) || defined(__BORLANDC__)
  153. # warning Please define _WIN32_WINNT or _WIN32_WINDOWS appropriately.
  154. # warning For example, add -D_WIN32_WINNT=0x0501 to the compiler command line.
  155. # warning Assuming _WIN32_WINNT=0x0501 (i.e. Windows XP target).
  156. # endif // defined(_MSC_VER) || defined(__BORLANDC__)
  157. # define _WIN32_WINNT 0x0501
  158. # endif // !defined(_WIN32_WINNT) && !defined(_WIN32_WINDOWS)
  159. # if defined(_MSC_VER)
  160. # if defined(_WIN32) && !defined(WIN32)
  161. # if !defined(_WINSOCK2API_)
  162. # define WIN32 // Needed for correct types in winsock2.h
  163. # else // !defined(_WINSOCK2API_)
  164. # error Please define the macro WIN32 in your compiler options
  165. # endif // !defined(_WINSOCK2API_)
  166. # endif // defined(_WIN32) && !defined(WIN32)
  167. # endif // defined(_MSC_VER)
  168. # if defined(__BORLANDC__)
  169. # if defined(__WIN32__) && !defined(WIN32)
  170. # if !defined(_WINSOCK2API_)
  171. # define WIN32 // Needed for correct types in winsock2.h
  172. # else // !defined(_WINSOCK2API_)
  173. # error Please define the macro WIN32 in your compiler options
  174. # endif // !defined(_WINSOCK2API_)
  175. # endif // defined(__WIN32__) && !defined(WIN32)
  176. # endif // defined(__BORLANDC__)
  177. # if defined(__CYGWIN__)
  178. # if !defined(__USE_W32_SOCKETS)
  179. # error You must add -D__USE_W32_SOCKETS to your compiler options.
  180. # endif // !defined(__USE_W32_SOCKETS)
  181. # endif // defined(__CYGWIN__)
  182. #endif // defined(BOOST_WINDOWS) || defined(__CYGWIN__)
  183. // Windows: minimise header inclusion.
  184. #if defined(BOOST_WINDOWS) || defined(__CYGWIN__)
  185. # if !defined(BOOST_ASIO_NO_WIN32_LEAN_AND_MEAN)
  186. # if !defined(WIN32_LEAN_AND_MEAN)
  187. # define WIN32_LEAN_AND_MEAN
  188. # endif // !defined(WIN32_LEAN_AND_MEAN)
  189. # endif // !defined(BOOST_ASIO_NO_WIN32_LEAN_AND_MEAN)
  190. #endif // defined(BOOST_WINDOWS) || defined(__CYGWIN__)
  191. // Windows: suppress definition of "min" and "max" macros.
  192. #if defined(BOOST_WINDOWS) || defined(__CYGWIN__)
  193. # if !defined(BOOST_ASIO_NO_NOMINMAX)
  194. # if !defined(NOMINMAX)
  195. # define NOMINMAX 1
  196. # endif // !defined(NOMINMAX)
  197. # endif // !defined(BOOST_ASIO_NO_NOMINMAX)
  198. #endif // defined(BOOST_WINDOWS) || defined(__CYGWIN__)
  199. // Windows: IO Completion Ports.
  200. #if defined(BOOST_WINDOWS) || defined(__CYGWIN__)
  201. # if defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0400)
  202. # if !defined(UNDER_CE)
  203. # if !defined(BOOST_ASIO_DISABLE_IOCP)
  204. # define BOOST_ASIO_HAS_IOCP 1
  205. # endif // !defined(BOOST_ASIO_DISABLE_IOCP)
  206. # endif // !defined(UNDER_CE)
  207. # endif // defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0400)
  208. #endif // defined(BOOST_WINDOWS) || defined(__CYGWIN__)
  209. // Linux: epoll, eventfd and timerfd.
  210. #if defined(__linux__)
  211. # include <linux/version.h>
  212. # if !defined(BOOST_ASIO_DISABLE_EPOLL)
  213. # if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,45)
  214. # define BOOST_ASIO_HAS_EPOLL 1
  215. # endif // LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,45)
  216. # endif // !defined(BOOST_ASIO_DISABLE_EVENTFD)
  217. # if !defined(BOOST_ASIO_DISABLE_EVENTFD)
  218. # if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
  219. # define BOOST_ASIO_HAS_EVENTFD 1
  220. # endif // LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
  221. # endif // !defined(BOOST_ASIO_DISABLE_EVENTFD)
  222. # if defined(BOOST_ASIO_HAS_EPOLL)
  223. # if (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 8)
  224. # define BOOST_ASIO_HAS_TIMERFD 1
  225. # endif // (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 8)
  226. # endif // defined(BOOST_ASIO_HAS_EPOLL)
  227. #endif // defined(__linux__)
  228. // Mac OS X, FreeBSD, NetBSD, OpenBSD: kqueue.
  229. #if (defined(__MACH__) && defined(__APPLE__)) \
  230. || defined(__FreeBSD__) \
  231. || defined(__NetBSD__) \
  232. || defined(__OpenBSD__)
  233. # if !defined(BOOST_ASIO_DISABLE_KQUEUE)
  234. # define BOOST_ASIO_HAS_KQUEUE 1
  235. # endif // !defined(BOOST_ASIO_DISABLE_KQUEUE)
  236. #endif // (defined(__MACH__) && defined(__APPLE__))
  237. // || defined(__FreeBSD__)
  238. // || defined(__NetBSD__)
  239. // || defined(__OpenBSD__)
  240. // Solaris: /dev/poll.
  241. #if defined(__sun)
  242. # if !defined(BOOST_ASIO_DISABLE_DEV_POLL)
  243. # define BOOST_ASIO_HAS_DEV_POLL 1
  244. # endif // !defined(BOOST_ASIO_DISABLE_DEV_POLL)
  245. #endif // defined(__sun)
  246. // Serial ports.
  247. #if defined(BOOST_ASIO_HAS_IOCP) \
  248. || !defined(BOOST_WINDOWS) && !defined(__CYGWIN__)
  249. # if !defined(__SYMBIAN32__)
  250. # if !defined(BOOST_ASIO_DISABLE_SERIAL_PORT)
  251. # define BOOST_ASIO_HAS_SERIAL_PORT 1
  252. # endif // !defined(BOOST_ASIO_DISABLE_SERIAL_PORT)
  253. # endif // !defined(__SYMBIAN32__)
  254. #endif // defined(BOOST_ASIO_HAS_IOCP)
  255. // || !defined(BOOST_WINDOWS) && !defined(__CYGWIN__)
  256. // Windows: stream handles.
  257. #if !defined(BOOST_ASIO_DISABLE_WINDOWS_STREAM_HANDLE)
  258. # if defined(BOOST_ASIO_HAS_IOCP)
  259. # define BOOST_ASIO_HAS_WINDOWS_STREAM_HANDLE 1
  260. # endif // defined(BOOST_ASIO_HAS_IOCP)
  261. #endif // !defined(BOOST_ASIO_DISABLE_WINDOWS_STREAM_HANDLE)
  262. // Windows: random access handles.
  263. #if !defined(BOOST_ASIO_DISABLE_WINDOWS_RANDOM_ACCESS_HANDLE)
  264. # if defined(BOOST_ASIO_HAS_IOCP)
  265. # define BOOST_ASIO_HAS_WINDOWS_RANDOM_ACCESS_HANDLE 1
  266. # endif // defined(BOOST_ASIO_HAS_IOCP)
  267. #endif // !defined(BOOST_ASIO_DISABLE_WINDOWS_RANDOM_ACCESS_HANDLE)
  268. // Windows: OVERLAPPED wrapper.
  269. #if !defined(BOOST_ASIO_DISABLE_WINDOWS_OVERLAPPED_PTR)
  270. # if defined(BOOST_ASIO_HAS_IOCP)
  271. # define BOOST_ASIO_HAS_WINDOWS_OVERLAPPED_PTR 1
  272. # endif // defined(BOOST_ASIO_HAS_IOCP)
  273. #endif // !defined(BOOST_ASIO_DISABLE_WINDOWS_OVERLAPPED_PTR)
  274. // POSIX: stream-oriented file descriptors.
  275. #if !defined(BOOST_ASIO_DISABLE_POSIX_STREAM_DESCRIPTOR)
  276. # if !defined(BOOST_WINDOWS) && !defined(__CYGWIN__)
  277. # define BOOST_ASIO_HAS_POSIX_STREAM_DESCRIPTOR 1
  278. # endif // !defined(BOOST_WINDOWS) && !defined(__CYGWIN__)
  279. #endif // !defined(BOOST_ASIO_DISABLE_POSIX_STREAM_DESCRIPTOR)
  280. // UNIX domain sockets.
  281. #if !defined(BOOST_ASIO_DISABLE_LOCAL_SOCKETS)
  282. # if !defined(BOOST_WINDOWS) && !defined(__CYGWIN__)
  283. # define BOOST_ASIO_HAS_LOCAL_SOCKETS 1
  284. # endif // !defined(BOOST_WINDOWS) && !defined(__CYGWIN__)
  285. #endif // !defined(BOOST_ASIO_DISABLE_LOCAL_SOCKETS)
  286. // Can use sigaction() instead of signal().
  287. #if !defined(BOOST_ASIO_DISABLE_SIGACTION)
  288. # if !defined(BOOST_WINDOWS) && !defined(__CYGWIN__)
  289. # define BOOST_ASIO_HAS_SIGACTION 1
  290. # endif // !defined(BOOST_WINDOWS) && !defined(__CYGWIN__)
  291. #endif // !defined(BOOST_ASIO_DISABLE_SIGACTION)
  292. // Can use signal().
  293. #if !defined(BOOST_ASIO_DISABLE_SIGNAL)
  294. # if !defined(UNDER_CE)
  295. # define BOOST_ASIO_HAS_SIGNAL 1
  296. # endif // !defined(UNDER_CE)
  297. #endif // !defined(BOOST_ASIO_DISABLE_SIGNAL)
  298. #endif // BOOST_ASIO_DETAIL_CONFIG_HPP