Rev 3770 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
3770 | Serge | 1 | /************************************************************************** |
3772 | Serge | 2 | * |
3770 | Serge | 3 | * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. |
4 | * All Rights Reserved. |
||
3772 | Serge | 5 | * |
3770 | Serge | 6 | * Permission is hereby granted, free of charge, to any person obtaining a |
7 | * copy of this software and associated documentation files (the |
||
8 | * "Software"), to deal in the Software without restriction, including |
||
9 | * without limitation the rights to use, copy, modify, merge, publish, |
||
10 | * distribute, sub license, and/or sell copies of the Software, and to |
||
11 | * permit persons to whom the Software is furnished to do so, subject to |
||
12 | * the following conditions: |
||
3772 | Serge | 13 | * |
3770 | Serge | 14 | * The above copyright notice and this permission notice (including the |
15 | * next paragraph) shall be included in all copies or substantial portions |
||
16 | * of the Software. |
||
3772 | Serge | 17 | * |
3770 | Serge | 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
19 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
||
20 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. |
||
21 | * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR |
||
22 | * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, |
||
23 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE |
||
24 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
||
3772 | Serge | 25 | * |
3770 | Serge | 26 | **************************************************************************/ |
27 | |||
28 | /** |
||
29 | * @file |
||
30 | * Gallium configuration defines. |
||
3772 | Serge | 31 | * |
32 | * This header file sets several defines based on the compiler, processor |
||
33 | * architecture, and operating system being used. These defines should be used |
||
34 | * throughout the code to facilitate porting to new platforms. It is likely that |
||
35 | * this file is auto-generated by an autoconf-like tool at some point, as some |
||
36 | * things cannot be determined by pre-defined environment alone. |
||
37 | * |
||
3770 | Serge | 38 | * See also: |
39 | * - http://gcc.gnu.org/onlinedocs/cpp/Common-Predefined-Macros.html |
||
40 | * - echo | gcc -dM -E - | sort |
||
41 | * - http://msdn.microsoft.com/en-us/library/b0084kay.aspx |
||
3772 | Serge | 42 | * |
3770 | Serge | 43 | * @author José Fonseca |
44 | */ |
||
45 | |||
46 | #ifndef P_CONFIG_H_ |
||
47 | #define P_CONFIG_H_ |
||
48 | |||
49 | #include |
||
50 | /* |
||
51 | * Compiler |
||
52 | */ |
||
53 | |||
54 | #if defined(__GNUC__) |
||
55 | #define PIPE_CC_GCC |
||
56 | #define PIPE_CC_GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__) |
||
57 | #endif |
||
58 | |||
59 | /* |
||
60 | * Meaning of _MSC_VER value: |
||
61 | * - 1400: Visual C++ 2005 |
||
62 | * - 1310: Visual C++ .NET 2003 |
||
63 | * - 1300: Visual C++ .NET 2002 |
||
3772 | Serge | 64 | * |
65 | * __MSC__ seems to be an old macro -- it is not pre-defined on recent MSVC |
||
3770 | Serge | 66 | * versions. |
67 | */ |
||
68 | #if defined(_MSC_VER) || defined(__MSC__) |
||
69 | #define PIPE_CC_MSVC |
||
70 | #endif |
||
71 | |||
72 | #if defined(__ICL) |
||
73 | #define PIPE_CC_ICL |
||
74 | #endif |
||
75 | |||
76 | #if defined(__SUNPRO_C) || defined(__SUNPRO_CC) |
||
77 | #define PIPE_CC_SUNPRO |
||
78 | #endif |
||
79 | |||
80 | |||
81 | /* |
||
82 | * Processor architecture |
||
83 | */ |
||
84 | |||
85 | #if defined(__i386__) /* gcc */ || defined(_M_IX86) /* msvc */ || defined(_X86_) || defined(__386__) || defined(i386) || defined(__i386) /* Sun cc */ |
||
86 | #define PIPE_ARCH_X86 |
||
87 | #endif |
||
88 | |||
89 | #if defined(__x86_64__) /* gcc */ || defined(_M_X64) /* msvc */ || defined(_M_AMD64) /* msvc */ || defined(__x86_64) /* Sun cc */ |
||
90 | #define PIPE_ARCH_X86_64 |
||
91 | #endif |
||
92 | |||
93 | #if defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64) |
||
94 | #if defined(PIPE_CC_GCC) && !defined(__SSE2__) |
||
95 | /* #warning SSE2 support requires -msse -msse2 compiler options */ |
||
96 | #else |
||
97 | #define PIPE_ARCH_SSE |
||
98 | #endif |
||
99 | #if defined(PIPE_CC_GCC) && !defined(__SSSE3__) |
||
100 | /* #warning SSE3 support requires -msse3 compiler options */ |
||
101 | #else |
||
102 | #define PIPE_ARCH_SSSE3 |
||
103 | #endif |
||
104 | #endif |
||
105 | |||
106 | #if defined(__ppc__) || defined(__ppc64__) || defined(__PPC__) |
||
107 | #define PIPE_ARCH_PPC |
||
108 | #if defined(__ppc64__) || defined(__PPC64__) |
||
109 | #define PIPE_ARCH_PPC_64 |
||
110 | #endif |
||
111 | #endif |
||
112 | |||
113 | #if defined(__s390x__) |
||
114 | #define PIPE_ARCH_S390 |
||
115 | #endif |
||
116 | |||
117 | |||
118 | /* |
||
119 | * Endian detection. |
||
120 | */ |
||
121 | |||
122 | #ifdef __GLIBC__ |
||
123 | #include |
||
124 | |||
125 | #if __BYTE_ORDER == __LITTLE_ENDIAN |
||
126 | # define PIPE_ARCH_LITTLE_ENDIAN |
||
127 | #elif __BYTE_ORDER == __BIG_ENDIAN |
||
128 | # define PIPE_ARCH_BIG_ENDIAN |
||
129 | #endif |
||
130 | |||
131 | #elif defined(__APPLE__) |
||
132 | #include |
||
133 | |||
134 | #if __DARWIN_BYTE_ORDER == __DARWIN_LITTLE_ENDIAN |
||
135 | # define PIPE_ARCH_LITTLE_ENDIAN |
||
136 | #elif __DARWIN_BYTE_ORDER == __DARWIN_BIG_ENDIAN |
||
137 | # define PIPE_ARCH_BIG_ENDIAN |
||
138 | #endif |
||
139 | |||
140 | #elif defined(__sun) |
||
141 | #include |
||
142 | |||
143 | #if defined(_LITTLE_ENDIAN) |
||
144 | # define PIPE_ARCH_LITTLE_ENDIAN |
||
145 | #elif defined(_BIG_ENDIAN) |
||
146 | # define PIPE_ARCH_BIG_ENDIAN |
||
147 | #endif |
||
148 | |||
149 | #else |
||
150 | |||
151 | #if defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64) |
||
152 | #define PIPE_ARCH_LITTLE_ENDIAN |
||
153 | #elif defined(PIPE_ARCH_PPC) || defined(PIPE_ARCH_PPC_64) || defined(PIPE_ARCH_S390) |
||
154 | #define PIPE_ARCH_BIG_ENDIAN |
||
155 | #endif |
||
156 | |||
157 | #endif |
||
158 | |||
159 | #if !defined(PIPE_ARCH_LITTLE_ENDIAN) && !defined(PIPE_ARCH_BIG_ENDIAN) |
||
160 | #error Unknown Endianness |
||
161 | #endif |
||
162 | |||
163 | /* |
||
164 | * Auto-detect the operating system family. |
||
3772 | Serge | 165 | * |
3770 | Serge | 166 | * See subsystem below for a more fine-grained distinction. |
167 | */ |
||
168 | |||
169 | #if defined(__linux__) |
||
170 | #define PIPE_OS_LINUX |
||
171 | #define PIPE_OS_UNIX |
||
172 | #endif |
||
173 | |||
174 | /* |
||
175 | * Android defines __linux__ so PIPE_OS_LINUX and PIPE_OS_UNIX will also be |
||
176 | * defined. |
||
177 | */ |
||
178 | #if defined(ANDROID) |
||
179 | #define PIPE_OS_ANDROID |
||
180 | #endif |
||
181 | |||
182 | #if defined(__FreeBSD__) |
||
183 | #define PIPE_OS_FREEBSD |
||
184 | #define PIPE_OS_BSD |
||
185 | #define PIPE_OS_UNIX |
||
186 | #endif |
||
187 | |||
188 | #if defined(__OpenBSD__) |
||
189 | #define PIPE_OS_OPENBSD |
||
190 | #define PIPE_OS_BSD |
||
191 | #define PIPE_OS_UNIX |
||
192 | #endif |
||
193 | |||
194 | #if defined(__NetBSD__) |
||
195 | #define PIPE_OS_NETBSD |
||
196 | #define PIPE_OS_BSD |
||
197 | #define PIPE_OS_UNIX |
||
198 | #endif |
||
199 | |||
200 | #if defined(__GNU__) |
||
201 | #define PIPE_OS_HURD |
||
202 | #define PIPE_OS_UNIX |
||
203 | #endif |
||
204 | |||
205 | #if defined(__sun) |
||
206 | #define PIPE_OS_SOLARIS |
||
207 | #define PIPE_OS_UNIX |
||
208 | #endif |
||
209 | |||
210 | #if defined(__APPLE__) |
||
211 | #define PIPE_OS_APPLE |
||
212 | #define PIPE_OS_UNIX |
||
213 | #endif |
||
214 | |||
215 | #if defined(__HAIKU__) |
||
216 | #define PIPE_OS_HAIKU |
||
217 | #define PIPE_OS_UNIX |
||
218 | #endif |
||
219 | |||
220 | #if defined(__CYGWIN__) |
||
221 | #define PIPE_OS_CYGWIN |
||
222 | #define PIPE_OS_UNIX |
||
223 | #endif |
||
224 | |||
225 | /* |
||
226 | * Try to auto-detect the subsystem. |
||
3772 | Serge | 227 | * |
3770 | Serge | 228 | * NOTE: There is no way to auto-detect most of these. |
229 | */ |
||
230 | |||
231 | #if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS) |
||
232 | #define PIPE_SUBSYSTEM_DRI |
||
233 | #endif /* PIPE_OS_LINUX || PIPE_OS_BSD || PIPE_OS_SOLARIS */ |
||
234 | |||
235 | #if defined(PIPE_OS_WINDOWS) |
||
236 | #if defined(PIPE_SUBSYSTEM_WINDOWS_USER) |
||
237 | /* Windows User-space Library */ |
||
238 | #else |
||
239 | #define PIPE_SUBSYSTEM_WINDOWS_USER |
||
240 | #endif |
||
241 | #endif /* PIPE_OS_WINDOWS */ |
||
242 | |||
243 | |||
244 | #endif /* P_CONFIG_H_ */ |