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 <jfonseca@vmware.com> 44 */ 45 46 #ifndef UTIL_DETECT_ARCH_H_ 47 #define UTIL_DETECT_ARCH_H_ 48 49 #include <limits.h> 50 51 #include "util/detect_cc.h" 52 53 /* 54 * Processor architecture 55 */ 56 57 #if defined(__i386__) /* gcc */ || defined(_M_IX86) /* msvc */ || defined(_X86_) || defined(__386__) || defined(i386) || defined(__i386) /* Sun cc */ 58 #define DETECT_ARCH_X86 1 59 #endif 60 61 #if defined(__x86_64__) /* gcc */ || defined(_M_X64) /* msvc */ || defined(_M_AMD64) /* msvc */ || defined(__x86_64) /* Sun cc */ 62 #define DETECT_ARCH_X86_64 1 63 #endif 64 65 #if DETECT_ARCH_X86 || DETECT_ARCH_X86_64 66 #if DETECT_CC_GCC && !defined(__SSE2__) 67 /* #warning SSE2 support requires -msse -msse2 compiler options */ 68 #else 69 #define DETECT_ARCH_SSE 1 70 #endif 71 #endif 72 73 #if defined(__ppc__) || defined(__ppc64__) || defined(__PPC__) || defined(__PPC64__) 74 #define DETECT_ARCH_PPC 1 75 #if defined(__ppc64__) || defined(__PPC64__) 76 #define DETECT_ARCH_PPC_64 1 77 #endif 78 #endif 79 80 #if defined(__s390x__) 81 #define DETECT_ARCH_S390 1 82 #endif 83 84 #if defined(__arm__) 85 #define DETECT_ARCH_ARM 1 86 #endif 87 88 #if defined(__aarch64__) || defined(_M_ARM64) 89 #define DETECT_ARCH_AARCH64 1 90 #endif 91 92 #if defined(__mips64) && defined(__LP64__) 93 #define DETECT_ARCH_MIPS64 1 94 #endif 95 96 #if defined(__mips__) 97 #define DETECT_ARCH_MIPS 1 98 #endif 99 100 #ifndef DETECT_ARCH_X86 101 #define DETECT_ARCH_X86 0 102 #endif 103 104 #ifndef DETECT_ARCH_X86_64 105 #define DETECT_ARCH_X86_64 0 106 #endif 107 108 #ifndef DETECT_ARCH_SSE 109 #define DETECT_ARCH_SSE 0 110 #endif 111 112 #ifndef DETECT_ARCH_PPC 113 #define DETECT_ARCH_PPC 0 114 #endif 115 116 #ifndef DETECT_ARCH_PPC_64 117 #define DETECT_ARCH_PPC_64 0 118 #endif 119 120 #ifndef DETECT_ARCH_S390 121 #define DETECT_ARCH_S390 0 122 #endif 123 124 #ifndef DETECT_ARCH_ARM 125 #define DETECT_ARCH_ARM 0 126 #endif 127 128 #ifndef DETECT_ARCH_AARCH64 129 #define DETECT_ARCH_AARCH64 0 130 #endif 131 132 #ifndef DETECT_ARCH_MIPS64 133 #define DETECT_ARCH_MIPS64 0 134 #endif 135 136 #ifndef DETECT_ARCH_MIPS 137 #define DETECT_ARCH_MIPS 0 138 #endif 139 140 #endif /* UTIL_DETECT_ARCH_H_ */ 141