- /* =============================================================================
- * scpp_os.hpp
- * Copyright (c) 2003 - 2011 Nomura Kei
- * LICENSE :
- * LGPL (GNU Lesser General General Public License - Version 3,29 June 2007)
- * http://www.gnu.org/copyleft/lesser.html
- * =============================================================================
- *
- * OS の判定を行う下記マクロ定数を定義している.
- *
- * SCPP_IS_WINDOWS 1/0 (Windows/Windows ではない)
- * SCPP_IS_LINUX 1/0 (Linux /Linux ではない)
- * SCPP_IS_UNIX 1/0 (UNIX系 /UNIX系 ではない)
- * SCPP_IS_BSD 1/0 (BSD系 /BSD系 ではない)
- * SCPP_IS_MAC 1/0 (Mac /Mac ではない)
- * SCPP_IS_VXWORKS 1/0 (VxWorks/VxWorks ではない)
- *
- * また, 各OSにおいて必須のヘッダファイルを include します.
- */
- #ifndef SCPP_OS_HPP
- #define SCPP_OS_HPP
- ////////////////////////////////////////////////////////////////////////////////
- //
- // Windows 判定
- //
- // Windows の場合, windows.h と winsock2.h を include しておく
- //
- #if defined(WIN32) || defined(_WIN32) || defined(__WIN32) || defined(__WIN32__) \
- || defined(WIN64) || defined(_WIN64) || defined(__WIN64) || defined(__WIN64__)
- #define SCPP_IS_WINDOWS (1)
- // DMC にて winsock2.h を使用する場合, _WINSOCKAPI_ が必要
- // 詳細は下記 URL 参照
- // http://www.digitalmars.com/d/archives/c++/idde/326.html
- #ifdef __DMC__
- #define _WINSOCKAPI_
- #include <sys/types.h>
- #endif
- #ifndef _WIN32_WINNT
- #define _WIN32_WINNT 0x0501
- #endif
- #include <windows.h>
- #include <winsock2.h>
- #else
- #define SCPP_IS_WINDOWS (0)
- #endif
- ////////////////////////////////////////////////////////////////////////////////
- //
- // Linux 判定
- //
- #if defined(linux) || defined(__linux) || defined(__linux__)
- #define SCPP_IS_LINUX (1)
- #else
- #define SCPP_IS_LINUX (0)
- #endif
- ////////////////////////////////////////////////////////////////////////////////
- //
- // UNIX 判定
- //
- #if defined (unix) || defined(__unix) || defined(__unix__)
- #define SCPP_IS_UNIX (1)
- #else
- #define SCPP_IS_UNIX (0)
- #endif
- ////////////////////////////////////////////////////////////////////////////////
- //
- // BSD 判定
- //
- #if defined(BSD) || defined(_BSD) || defined(__BSD)
- #define SCPP_IS_BSD (1)
- #else
- #define SCPP_IS_BSD (0)
- #endif
- ////////////////////////////////////////////////////////////////////////////////
- //
- // Mac 判定
- //
- #if defined(mac) || defined(MAC) || defined(_MAC)
- #define SCPP_IS_MAC (1)
- #else
- #define SCPP_IS_MAC (0)
- #endif
- ////////////////////////////////////////////////////////////////////////////////
- //
- // VxWorks 判定
- //
- #if defined(VXWORKS) || defined(VxWorkd)
- #define SCPP_IS_VXWORKS (1)
- #else
- #define SCPP_IS_VXWORKS (0)
- #endif
- #endif // SCPP_OS_HPP