api_config.hpp 1.8 KB

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