summaryrefslogtreecommitdiff
path: root/src/gallium/include/pipe/p_config.h
blob: d2d2ae16172a7a084154ce0367b74fe22c8e93be (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
/**************************************************************************
 * 
 * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
 * All Rights Reserved.
 * 
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the
 * "Software"), to deal in the Software without restriction, including
 * without limitation the rights to use, copy, modify, merge, publish,
 * distribute, sub license, and/or sell copies of the Software, and to
 * permit persons to whom the Software is furnished to do so, subject to
 * the following conditions:
 * 
 * The above copyright notice and this permission notice (including the
 * next paragraph) shall be included in all copies or substantial portions
 * of the Software.
 * 
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
 * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 * 
 **************************************************************************/

/**
 * @file
 * Gallium configuration defines.
 * 
 * This header file sets several defines based on the compiler, processor 
 * architecture, and operating system being used. These defines should be used 
 * throughout the code to facilitate porting to new platforms. It is likely that 
 * this file is auto-generated by an autoconf-like tool at some point, as some 
 * things cannot be determined by existing defines alone. 
 * 
 * See also:
 * - http://gcc.gnu.org/onlinedocs/cpp/Common-Predefined-Macros.html
 * - echo | gcc -dM -E - | sort
 * - http://msdn.microsoft.com/en-us/library/b0084kay.aspx
 * @author José Fonseca <jrfonseca@tungstengraphics.com>
 */

#ifndef P_CONFIG_H_
#define P_CONFIG_H_


/*
 * Compiler
 */

#if defined(__GNUC__)
#define PIPE_CC_GCC
#endif

#if defined(_MSC_VER) || defined(__MSC__)
#define PIPE_CC_MSVC
#endif

#if defined(__ICL)
#define PIPE_CC_ICL
#endif


/*
 * Processor architecture
 */

#if defined(__i386__) /* gcc */ || defined(_M_IX86) /* msvc */ || defined(_X86_) || defined(__386__) || defined(i386)
#define PIPE_ARCH_X86
#endif

#if defined(__x86_64__) /* gcc */ || defined(_M_X64) /* msvc */ || defined(_M_AMD64) /* msvc */
#define PIPE_ARCH_X86_64
#endif

#if 0 /* FIXME */
#define PIPE_ARCH_PPC
#endif


/*
 * Operating system
 */

#if defined(__linux__)
#define PIPE_OS_LINUX
#endif

#if defined(_WIN32) || defined(WIN32)
#define PIPE_OS_WINDOWS
#endif


/*
 * Subsystem
 * 
 * XXX: There is no way to autodetect this.
 */

#if defined(PIPE_OS_LINUX)
#define PIPE_SUBSYSTEM_DRI
#endif

#if defined(PIPE_OS_WINDOWS)
#ifndef _WIN32_WCE
#if !defined(PIPE_SUBSYSTEM_USER) && !defined(PIPE_SUBSYSTEM_KERNEL)
#error Neither PIPE_SUBSYSTEM_USER or PIPE_SUBSYSTEM_KERNEL defined.
#endif
#if defined(PIPE_SUBSYSTEM_KERNEL)
#define PIPE_SUBSYSTEM_WINDOWS_DISPLAY
#endif
#if 0 /* FIXME */
#define PIPE_SUBSYSTEM_WINDOWS_MINIPORT
#endif
#if defined(PIPE_SUBSYSTEM_USER)
#define PIPE_SUBSYSTEM_WINDOWS_USER
#endif
#else /* _WIN32_WCE */
#define PIPE_SUBSYSTEM_WINDOWS_CE
#endif /* _WIN32_WCE */
#endif /* PIPE_OS_WINDOWS */


#endif /* P_CONFIG_H_ */