svn-gvsig-desktop / trunk / libraries / libjni-mrsid / include / support / lt_platform.h @ 3539
History | View | Annotate | Download (5.44 KB)
1 |
/* $Id: lt_platform.h 3539 2006-01-09 12:23:20Z nacho $ */
|
---|---|
2 |
/* //////////////////////////////////////////////////////////////////////////
|
3 |
// //
|
4 |
// This code is Copyright (c) 2004 LizardTech, Inc, 1008 Western Avenue, //
|
5 |
// Suite 200, Seattle, WA 98104. Unauthorized use or distribution //
|
6 |
// prohibited. Access to and use of this code is permitted only under //
|
7 |
// license from LizardTech, Inc. Portions of the code are protected by //
|
8 |
// US and foreign patents and other filings. All Rights Reserved. //
|
9 |
// //
|
10 |
////////////////////////////////////////////////////////////////////////// */
|
11 |
/* PUBLIC */
|
12 |
|
13 |
|
14 |
/**
|
15 |
* @file
|
16 |
*
|
17 |
* Preprocessor symbols for canonical identification of OS, architecture,
|
18 |
* and compiler. Scrupulous use of these and only these symbols avoids
|
19 |
* portability problems due to inconsistent platform tests.
|
20 |
*
|
21 |
* For a given target platform XYZ, we define three symbols with the value 1:
|
22 |
*
|
23 |
* \li \c LT_OS_XYZ defines the operating system
|
24 |
* \li \c LT_COMPILER_XYZ defines the compiler
|
25 |
* \li \c LT_ARCH_XYZ defines the HW architecture
|
26 |
*
|
27 |
* Note for Windows, we treat WIN32, WIN64, and WinCE as distinct OS's, but
|
28 |
* bothwill define LT_OS_WINDOWS for the typical cases.
|
29 |
*
|
30 |
* See the file lt_platform.h for full details.
|
31 |
*
|
32 |
* @note This file is C-callable.
|
33 |
*/
|
34 |
|
35 |
|
36 |
#ifndef LT_PLATFORM_H
|
37 |
#define LT_PLATFORM_H
|
38 |
|
39 |
/*
|
40 |
*/
|
41 |
|
42 |
|
43 |
/*
|
44 |
* Check for Cross Platform Macros
|
45 |
*/
|
46 |
|
47 |
/* Check for GCC, Intel, of MSVC */
|
48 |
#if defined(__GNUC__) || defined(__GNUG__) /* GNU's GCC */ |
49 |
#define LT_COMPILER_GNU 1 |
50 |
#if defined(__GNUC__)
|
51 |
#define LT_COMPILER_GCC 1 |
52 |
#endif
|
53 |
#if defined(__GNUG__)
|
54 |
#define LT_COMPILER_GXX 1 |
55 |
#endif
|
56 |
#if(__GNUC__ == 2) |
57 |
#define LT_COMPILER_GCC2 1 |
58 |
#elif(__GNUC__ == 3) |
59 |
#define LT_COMPILER_GCC3 1 |
60 |
#else
|
61 |
#error PLATFORM ERROR: Unsupported version of GCC
|
62 |
#endif
|
63 |
#elif defined(__ECL) || defined(__LCL) /* Intel's VTune */ |
64 |
#define LT_COMPILER_INTEL 1 |
65 |
#elif defined(_MSC_VER) /* MS Visual C/C++ */ |
66 |
#define LT_COMPILER_MS 1 |
67 |
#if _MSC_VER == 1300 || _MSC_VER == 1310 |
68 |
#define LT_COMPILER_MS7 1 |
69 |
#endif
|
70 |
#endif
|
71 |
|
72 |
#if defined(_WIN64) || defined(WIN64)
|
73 |
|
74 |
#define LT_OS_WIN 1 |
75 |
#define LT_OS_WIN64 1 |
76 |
|
77 |
#if !defined(_M_IX86)
|
78 |
#define LT_ARCH_IA64 1 |
79 |
#else
|
80 |
#error PLATFORM ERROR: WIN64, but unknown architecture
|
81 |
#endif
|
82 |
|
83 |
#if !defined(LT_COMPILER_INTEL) && !defined(LT_COMPILER_MS)
|
84 |
#error PLATFORM ERROR: WIN64, but unknown compiler
|
85 |
#endif
|
86 |
|
87 |
#elif defined(_WIN32_WCE)
|
88 |
|
89 |
#define LT_OS_WIN 1 |
90 |
#define LT_OS_WINCE 1 |
91 |
|
92 |
#if defined(ARM) || defined(_ARM_)
|
93 |
#define LT_ARCH_ARM 1 |
94 |
#elif defined(MIPS) || defined(_MIPS_)
|
95 |
#define LT_ARCH_MIPS 1 |
96 |
#elif defined(SH3) || defined(_SH3_)
|
97 |
#define LT_ARCH_SH3 1 |
98 |
#elif defined(SH4) || defined(_SH4_)
|
99 |
#define LT_ARCH_SH4 1 |
100 |
#elif defined(_X86_) || defined(x86)
|
101 |
#define LT_ARCH_IA32 1 |
102 |
#else
|
103 |
#error PLATFORM ERROR: WINCE, but unknown architecture
|
104 |
#endif
|
105 |
|
106 |
#if !defined(LT_COMPILER_MS)
|
107 |
#error PLATFORM ERROR: WINCE, but unknown compiler
|
108 |
#endif
|
109 |
|
110 |
#elif defined(_WIN32) || defined(WIN32)
|
111 |
|
112 |
#define LT_OS_WIN 1 |
113 |
#define LT_OS_WIN32 1 |
114 |
|
115 |
#if defined(_M_IX86)
|
116 |
#define LT_ARCH_IA32 1 |
117 |
#else
|
118 |
#error PLATFORM ERROR: WIN32, but unknown architecture
|
119 |
#endif
|
120 |
|
121 |
#if !defined(LT_COMPILER_INTEL) && !defined(LT_COMPILER_MS)
|
122 |
#error PLATFORM ERROR: WIN32, but unknown compiler
|
123 |
#endif
|
124 |
|
125 |
#elif defined(__APPLE__) && defined(__MACH__)
|
126 |
|
127 |
#define LT_OS_UNIX 1 |
128 |
#define LT_OS_DARWIN 1 |
129 |
|
130 |
#if defined(__ppc__)
|
131 |
#define LT_ARCH_PPC 1 |
132 |
#else
|
133 |
#error PLATFORM ERROR: DARWIN, but unknown architecture
|
134 |
#endif
|
135 |
|
136 |
#if !defined(LT_COMPILER_GNU)
|
137 |
#error PLATFORM ERROR: DARWIN, but unknown compiler
|
138 |
#endif
|
139 |
|
140 |
#elif defined (__sun)
|
141 |
|
142 |
#define LT_OS_UNIX 1 |
143 |
#define LT_OS_SUNOS 1 |
144 |
|
145 |
#if defined(__sparc)
|
146 |
#define LT_ARCH_SPARC 1 |
147 |
#elif defined(i386)
|
148 |
#define LT_ARCH_IA32 1 |
149 |
#else
|
150 |
#error PLATFORM ERROR: SUNOS, but unknown architecture
|
151 |
#endif
|
152 |
|
153 |
#if defined (__SUNPRO_CC)
|
154 |
#define LT_COMPILER_SUN 1 |
155 |
#define LT_COMPILER_SUNPRO_CC 1 |
156 |
#elif defined(__SUNPRO_C)
|
157 |
#define LT_COMPILER_SUN 1 |
158 |
#define LT_COMPILER_SUNPRO_C 1 |
159 |
#elif !defined(LT_COMPILER_GNU)
|
160 |
#error PLATFORM ERROR: SUNOS, but unknown compiler
|
161 |
#endif
|
162 |
|
163 |
#elif defined (linux) || defined (__linux__) || defined (__linux)
|
164 |
|
165 |
#define LT_OS_UNIX 1 |
166 |
#define LT_OS_LINUX 1 |
167 |
|
168 |
#if defined(i386)
|
169 |
#define LT_ARCH_IA32 1 |
170 |
#else
|
171 |
#error PLATFORM ERROR: LINUX, but unknown architecture
|
172 |
#endif
|
173 |
|
174 |
#if !defined(LT_COMPILER_GNU)
|
175 |
#error PLATFORM ERROR: DARWIN, but unknown compiler
|
176 |
#endif
|
177 |
|
178 |
#else
|
179 |
#error PLATFORM ERROR: unsupported target platform
|
180 |
#endif
|
181 |
|
182 |
#if !defined(LT_OS_WIN) && !defined(LT_OS_UNIX)
|
183 |
#error PLATFORM ERROR: set LT_OS_WIN or LT_OS_UNIX
|
184 |
#endif
|
185 |
|
186 |
/*
|
187 |
* Endian-ness
|
188 |
*/
|
189 |
|
190 |
#if defined(LT_ARCH_IA32) || defined(LT_ARCH_IA64) || defined(LT_ARCH_ARM)
|
191 |
#define LT_LITTLE_ENDIAN
|
192 |
#elif defined(LT_ARCH_PPC) || defined(LT_ARCH_SPARC)
|
193 |
/* We do not define LT_BIG_ENDIAN, as that would just confuse things;
|
194 |
either you're little endian, or you're not. */
|
195 |
#else
|
196 |
#error PLATFORM ERROR: unknown architecture
|
197 |
#endif
|
198 |
|
199 |
/*
|
200 |
* backwards compatability, deprecated stuff
|
201 |
*/
|
202 |
|
203 |
#if defined(LT_LITTLE_ENDIAN) && !defined(_LITTLE_ENDIAN)
|
204 |
/* this is deprecated! */
|
205 |
#define _LITTLE_ENDIAN
|
206 |
#endif
|
207 |
|
208 |
#ifdef LT_OS_UNIX
|
209 |
#define LT_UNIX 1 |
210 |
#endif
|
211 |
|
212 |
#endif /* LT_PLATFORM_H */ |
213 |
|