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) 2003, 2004 Cherier Malek. All rights reserved. */
9 /* This program is free software; you can redistribute it and/or modify it
10 * under the terms of the license (GNU LGPL) which comes with this package. */
12 /* Windows platforms. */
16 * win32 or win64 (__WIN32 is defined for win32 and win64 applications, __TOS_WIN__ is defined by xlC).
19 /* If the platform is not resolved _XBT_PLATFORM_ID is set to zero. */
20 #define _XBT_PLATFORM_ID 0
23 #if defined(_WIN32) || defined(__WIN32__) || defined(WIN32) || defined(__TOS_WIN__)
24 #undef _XBT_PLATFORM_ID
25 #define _XBT_WIN32_PLATFORM 1
26 #define _XBT_PLATFORM_ID _XBT_WIN32_PLATFORM
27 #define _XBT_PLATFORM_NAME "Windows 32 bits platform"
32 #undef _XBT_PLATFORM_ID
33 #ifdef _XBT_WIN32_PLATFORM
34 #undef _XBT_WIN32_PLATFORM
37 #define _XBT_PLATFORM_NAME "Windows 64 bits platform"
38 #define _XBT_WIN64_PLATFORM 2
39 #define _XBT_PLATFORM_ID _XBT_WIN64_PLATFORM
44 #undef _XBT_PLATFORM_ID
45 #define _XBT_WIN16_PLATFORM 3
46 #define _XBT_PLATFORM_NAME "Windows 16 bits platform"
47 #define _XBT_PLATFORM_ID _XBT_WIN16_PLATFORM
51 #elif defined(UNDER_CE)
52 #undef _XBT_PLATFORM_ID
53 #define __XBT_WINCE_PLATFORM 4
54 #define _XBT_PLATFORM_ID _XBT_WINCE_PLATFORM
55 #define _XBT_PLATFORM_NAME "Windows CE bits platform"
57 #elif defined(linux) || defined(__linux) || defined(__linux__)
59 #undef _XBT_PLATFORM_ID
60 #define __XBT_LINUX_PLATFORM 5
61 #define _XBT_PLATFORM_ID _XBT_LINUX_PLATFORM
62 #define _XBT_PLATFORM_NAME "Linux platform"
64 #elif defined (_XBT_ASSERT_CONFIG)
65 // This must come last - generate an error if we don't
66 // resolve the platform:
67 #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)"
70 #if defined(_XBT_WIN32_PLATFORM) || defined(_XBT_WIN64_PLATFORM) || defined(_XBT_WIN16_PLATFORM) || defined(_XBT_WINCE_PLATFORM)
77 /* Returns true if the platform is resolved, false in the other case. */
78 #define _xbt_is_platform_resolved() (_XBT_PLATFORM_ID != 0)
80 /* Returns the platform name. */
81 #define _xbt_get_platform_name() _XBT_PLATFORM_NAME
83 /* Returns the platform id. */
84 #define _xbt_get_platform_id() _XBT_PLATFORM_ID
86 /* Returns true if the platform is Windows 32 bits. */
87 #define _xbt_is_win32() (_XBT_PLATFORM_ID == 1)
89 /* Returns true if the platform is Windows 64 bits. */
90 #define _xbt_is_win64() (_XBT_PLATFORM_ID == 2)
92 /* Returns true if the platform is Windows 16 bits. */
93 #define _xbt_is_win16() (_XBT_PLATFORM_ID == 3)
95 /* Returns true if the platform is Windows CE. */
96 #define _xbt_is_wince() (_XBT_PLATFORM_ID == 4)
98 /* Returns true if the platform is linux. */
99 #define _xbt_is_linux() (_XBT_PLATFORM_ID == 5)
104 #endif /* #define __XBT_SELECT_PLATFORM_FEATURES_H__ */