PageRenderTime 14ms CodeModel.GetById 2ms app.highlight 5ms RepoModel.GetById 2ms app.codeStats 0ms

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