Jeff Thompson | 86b6d64 | 2013-10-17 15:01:56 -0700 | [diff] [blame] | 1 | // ndnboost/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 NDNBOOST_SYSTEM_API_CONFIG_HPP |
| 25 | #define NDNBOOST_SYSTEM_API_CONFIG_HPP |
| 26 | |
| 27 | # if defined(NDNBOOST_POSIX_API) || defined(NDNBOOST_WINDOWS_API) |
| 28 | # error user defined NDNBOOST_POSIX_API or NDNBOOST_WINDOWS_API not supported |
| 29 | # endif |
| 30 | |
| 31 | // NDNBOOST_POSIX_API or NDNBOOST_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 NDNBOOST_WINDOWS_API |
| 38 | # else |
| 39 | # define NDNBOOST_POSIX_API |
| 40 | # endif |
| 41 | |
| 42 | #endif // NDNBOOST_SYSTEM_API_CONFIG_HPP |