1 #ifndef __XBT_SELECT_PLATFORM_FEATURES_H__
2 #define __XBT_SELECT_PLATFORM_FEATURES_H__
5 /* select_platform_features.h - platform features selection */
7 /* Copyright (c) 2006, 2010. The SimGrid Team.
8 * All rights reserved. */
10 /* This program is free software; you can redistribute it and/or modify it
11 * under the terms of the license (GNU LGPL) which comes with this package. */
13 /* Windows platforms. */
17 * win32 or win64 (__XBT_WIN32 is defined for win32 and win64 applications, __TOS_WIN__ is defined by xlC).
20 /* If the platform is not resolved _XBT_PLATFORM_ID is set to zero. */
21 #define _XBT_PLATFORM_ID 0
24 #if defined(_WIN32) || defined(__WIN32__) || defined(WIN32) || defined(__TOS_WIN__)
25 #undef _XBT_PLATFORM_ID
26 #define _XBT_WIN32_PLATFORM 1
27 #define _XBT_PLATFORM_ID _XBT_WIN32_PLATFORM
28 #define _XBT_PLATFORM_NAME "Windows 32 bits platform"
33 #undef _XBT_PLATFORM_ID
34 #ifdef _XBT_WIN32_PLATFORM
35 #undef _XBT_WIN32_PLATFORM
38 #define _XBT_PLATFORM_NAME "Windows 64 bits platform"
39 #define _XBT_WIN64_PLATFORM 2
40 #define _XBT_PLATFORM_ID _XBT_WIN64_PLATFORM
45 #undef _XBT_PLATFORM_ID
46 #define _XBT_WIN16_PLATFORM 3
47 #define _XBT_PLATFORM_NAME "Windows 16 bits platform"
48 #define _XBT_PLATFORM_ID _XBT_WIN16_PLATFORM
52 #elif defined(UNDER_CE)
53 #undef _XBT_PLATFORM_ID
54 #define __XBT_WINCE_PLATFORM 4
55 #define _XBT_PLATFORM_ID _XBT_WINCE_PLATFORM
56 #define _XBT_PLATFORM_NAME "Windows CE bits platform"
58 #elif defined(linux) || defined(__linux) || defined(__linux__)
60 #undef _XBT_PLATFORM_ID
61 #define __XBT_LINUX_PLATFORM 5
62 #define _XBT_PLATFORM_ID _XBT_LINUX_PLATFORM
63 #define _XBT_PLATFORM_NAME "Linux platform"
65 #elif defined (_XBT_ASSERT_CONFIG)
66 // This must come last - generate an error if we don't
67 // resolve the platform:
68 #error "Unknown platform - please configure (simgrid.gforge.inria.fr/xbt/libs/config/config.htm#configuring) and report the results to the main simgrid mailing list (simgrid.gforge.inra.fr/more/mailing_lists.htm#main)"
71 #if defined(_XBT_WIN32_PLATFORM) || defined(_XBT_WIN64_PLATFORM) || defined(_XBT_WIN16_PLATFORM) || defined(_XBT_WINCE_PLATFORM)
78 /* Returns true if the platform is resolved, false in the other case. */
79 #define _xbt_is_platform_resolved() (_XBT_PLATFORM_ID != 0)
81 /* Returns the platform name. */
82 #define _xbt_get_platform_name() _XBT_PLATFORM_NAME
84 /* Returns the platform id. */
85 #define _xbt_get_platform_id() _XBT_PLATFORM_ID
87 /* Returns true if the platform is Windows 32 bits. */
88 #define _xbt_is_win32() (_XBT_PLATFORM_ID == 1)
90 /* Returns true if the platform is Windows 64 bits. */
91 #define _xbt_is_win64() (_XBT_PLATFORM_ID == 2)
93 /* Returns true if the platform is Windows 16 bits. */
94 #define _xbt_is_win16() (_XBT_PLATFORM_ID == 3)
96 /* Returns true if the platform is Windows CE. */
97 #define _xbt_is_wince() (_XBT_PLATFORM_ID == 4)
99 /* Returns true if the platform is linux. */
100 #define _xbt_is_linux() (_XBT_PLATFORM_ID == 5)
105 #endif /* #define __XBT_SELECT_PLATFORM_FEATURES_H__ */