p_config.h revision c6c44bf48124dd5b4661014a8d58482c5a54557f
1/************************************************************************** 2 * 3 * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. 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 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. 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 <jrfonseca@tungstengraphics.com> 44 */ 45 46#ifndef P_CONFIG_H_ 47#define P_CONFIG_H_ 48 49 50/* 51 * Compiler 52 */ 53 54#if defined(__GNUC__) 55#define PIPE_CC_GCC 56#endif 57 58/* 59 * Meaning of _MSC_VER value: 60 * - 1400: Visual C++ 2005 61 * - 1310: Visual C++ .NET 2003 62 * - 1300: Visual C++ .NET 2002 63 * 64 * __MSC__ seems to be an old macro -- it is not pre-defined on recent MSVC 65 * versions. 66 */ 67#if defined(_MSC_VER) || defined(__MSC__) 68#define PIPE_CC_MSVC 69#endif 70 71#if defined(__ICL) 72#define PIPE_CC_ICL 73#endif 74 75 76/* 77 * Processor architecture 78 */ 79 80#if defined(__i386__) /* gcc */ || defined(_M_IX86) /* msvc */ || defined(_X86_) || defined(__386__) || defined(i386) || defined(__i386) /* Sun cc */ 81#define PIPE_ARCH_X86 82#endif 83 84#if defined(__x86_64__) /* gcc */ || defined(_M_X64) /* msvc */ || defined(_M_AMD64) /* msvc */ || defined(__x86_64) /* Sun cc */ 85#define PIPE_ARCH_X86_64 86#endif 87 88#if defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64) 89#if defined(PIPE_CC_GCC) && !defined(__SSE2__) 90/* #warning SSE2 support requires -msse -msse2 compiler options */ 91#else 92#define PIPE_ARCH_SSE 93#endif 94#endif 95 96#if defined(__PPC__) 97#define PIPE_ARCH_PPC 98#if defined(__PPC64__) 99#define PIPE_ARCH_PPC_64 100#endif 101#endif 102 103 104/* 105 * Endian detection. 106 */ 107 108#if defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64) 109#define PIPE_ARCH_LITTLE_ENDIAN 110#elif defined(PIPE_ARCH_PPC) || defined(PIPE_ARCH_PPC_64) 111#define PIPE_ARCH_BIG_ENDIAN 112#else 113#define PIPE_ARCH_UNKNOWN_ENDIAN 114#endif 115 116 117/* 118 * Operating system family. 119 * 120 * See subsystem below for a more fine-grained distinction. 121 */ 122 123#if defined(__linux__) 124#define PIPE_OS_LINUX 125#endif 126 127#if defined(__FreeBSD__) 128#define PIPE_OS_BSD 129#endif 130 131#if defined(__sun) 132#define PIPE_OS_SOLARIS 133#endif 134 135#if defined(__APPLE__) 136#define PIPE_OS_APPLE 137#endif 138 139#if defined(_WIN32) || defined(WIN32) 140#define PIPE_OS_WINDOWS 141#endif 142 143#if defined(__HAIKU__) 144#define PIPE_OS_HAIKU 145#endif 146 147/* 148 * Subsystem. 149 * 150 * NOTE: There is no way to auto-detect most of these. 151 */ 152 153#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS) 154#define PIPE_SUBSYSTEM_DRI 155#endif /* PIPE_OS_LINUX || PIPE_OS_BSD || PIPE_OS_SOLARIS */ 156 157#if defined(PIPE_OS_WINDOWS) 158#if defined(PIPE_SUBSYSTEM_WINDOWS_DISPLAY) 159/* Windows 2000/XP Display Driver */ 160#elif defined(PIPE_SUBSYSTEM_WINDOWS_MINIPORT) 161/* Windows 2000/XP Miniport Driver */ 162#elif defined(PIPE_SUBSYSTEM_WINDOWS_USER) 163/* Windows User-space Library */ 164#elif defined(PIPE_SUBSYSTEM_WINDOWS_CE) 165/* Windows CE 5.0/6.0 */ 166#else 167#ifdef _WIN32_WCE 168#define PIPE_SUBSYSTEM_WINDOWS_CE 169#else /* !_WIN32_WCE */ 170#error No PIPE_SUBSYSTEM_WINDOWS_xxx subsystem defined. 171#endif /* !_WIN32_WCE */ 172#endif 173#endif /* PIPE_OS_WINDOWS */ 174 175 176#endif /* P_CONFIG_H_ */ 177