xref: /aosp_15_r20/external/virglrenderer/src/mesa/pipe/p_config.h (revision bbecb9d118dfdb95f99bd754f8fa9be01f189df3)
1 /**************************************************************************
2  *
3  * Copyright 2008 VMware, Inc.
4  * All Rights Reserved.
5  *
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:
13  *
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.
17  *
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 VMWARE 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.
25  *
26  **************************************************************************/
27 
28 /**
29  * @file
30  * Gallium configuration defines.
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  *
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
42  *
43  * @author José Fonseca <[email protected]>
44  */
45 
46 #ifndef P_CONFIG_H_
47 #define P_CONFIG_H_
48 
49 #include <limits.h>
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  * - 1800: Visual Studio 2013
62  * - 1700: Visual Studio 2012
63  * - 1600: Visual Studio 2010
64  * - 1500: Visual Studio 2008
65  * - 1400: Visual C++ 2005
66  * - 1310: Visual C++ .NET 2003
67  * - 1300: Visual C++ .NET 2002
68  *
69  * __MSC__ seems to be an old macro -- it is not pre-defined on recent MSVC
70  * versions.
71  */
72 #if defined(_MSC_VER) || defined(__MSC__)
73 #define PIPE_CC_MSVC
74 #endif
75 
76 #if defined(__ICL)
77 #define PIPE_CC_ICL
78 #endif
79 
80 
81 /*
82  * Processor architecture
83  *
84  * (virglrenderer) This is detected by meson.
85  */
86 
87 #if defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64)
88 #if defined(PIPE_CC_GCC) && !defined(__SSE2__)
89 /* #warning SSE2 support requires -msse -msse2 compiler options */
90 #else
91 #define PIPE_ARCH_SSE
92 #endif
93 #if defined(PIPE_CC_GCC) && (__GNUC__ * 100 + __GNUC_MINOR__) < 409 && !defined(__SSSE3__)
94 /* #warning SSE3 support requires -msse3 compiler options before GCC 4.9 */
95 #else
96 #define PIPE_ARCH_SSSE3
97 #endif
98 #endif
99 
100 /*
101  * Endian detection.
102  */
103 
104 #include "util/u_endian.h"
105 
106 /*
107  * Auto-detect the operating system family.
108  */
109 #include "util/detect_os.h"
110 
111 #if DETECT_OS_LINUX
112 #define PIPE_OS_LINUX
113 #endif
114 
115 #if DETECT_OS_UNIX
116 #define PIPE_OS_UNIX
117 #endif
118 
119 #if DETECT_OS_ANDROID
120 #define PIPE_OS_ANDROID
121 #endif
122 
123 #if DETECT_OS_FREEBSD
124 #define PIPE_OS_FREEBSD
125 #endif
126 
127 #if DETECT_OS_BSD
128 #define PIPE_OS_BSD
129 #endif
130 
131 #if DETECT_OS_OPENBSD
132 #define PIPE_OS_OPENBSD
133 #endif
134 
135 #if DETECT_OS_NETBSD
136 #define PIPE_OS_NETBSD
137 #endif
138 
139 #if DETECT_OS_DRAGONFLY
140 #define PIPE_OS_DRAGONFLY
141 #endif
142 
143 #if DETECT_OS_HURD
144 #define PIPE_OS_HURD
145 #endif
146 
147 #if DETECT_OS_SOLARIS
148 #define PIPE_OS_SOLARIS
149 #endif
150 
151 #if DETECT_OS_APPLE
152 #define PIPE_OS_APPLE
153 #endif
154 
155 #if DETECT_OS_WINDOWS
156 #define PIPE_OS_WINDOWS
157 #endif
158 
159 #if DETECT_OS_HAIKU
160 #define PIPE_OS_HAIKU
161 #endif
162 
163 #if DETECT_OS_CYGWIN
164 #define PIPE_OS_CYGWIN
165 #endif
166 
167 #endif /* P_CONFIG_H_ */
168