1// boost/system/api_config.hpp -------------------------------------------------------//
2
3// Copyright Beman Dawes 2003, 2006, 2010
4
5// Distributed under the Boost Software License, Version 1.0.
6// See http://www.boost.org/LICENSE_1_0.txt
7
8// See http://www.boost.org/libs/system for documentation.
9
10//--------------------------------------------------------------------------------------//
11
12// Boost.System calls operating system API functions to implement system error category
13// functions. Usually there is no question as to which API is to be used.
14//
15// In the case of MinGW or Cygwin/MinGW, however, both POSIX and Windows API's are
16// available. Chaos ensues if other code thinks one is in use when Boost.System was
17// actually built with the other. This header centralizes the API choice and prevents
18// user definition of API macros, thus elminating the possibility of mismatches and the
19// need to test configurations with little or no practical value.
20//
21
22//--------------------------------------------------------------------------------------//
23
24#ifndef BOOST_SYSTEM_API_CONFIG_HPP
25#define BOOST_SYSTEM_API_CONFIG_HPP
26
27# if defined(BOOST_POSIX_API) || defined(BOOST_WINDOWS_API)
28# error user defined BOOST_POSIX_API or BOOST_WINDOWS_API not supported
29# endif
30
31// BOOST_POSIX_API or BOOST_WINDOWS_API specify which API to use
32// Cygwin/MinGW does not predefine _WIN32.
33// Standalone MinGW and all other known Windows compilers do predefine _WIN32
34// Compilers that predefine _WIN32 or __MINGW32__ do so for Windows 64-bit builds too.
35
36# if defined(_WIN32) || defined(__CYGWIN__) // Windows default, including MinGW and Cygwin
37# define BOOST_WINDOWS_API
38# else
39# define BOOST_POSIX_API
40# endif
41
42#endif // BOOST_SYSTEM_API_CONFIG_HPP
43