1 /* 2 * Copyright 2009-2010, Haiku, Inc. All Rights Reserved. 3 * Distributed under the terms of the MIT License. 4 */ 5 #ifndef _CONFIG_HAIKU_CONFIG_H 6 #define _CONFIG_HAIKU_CONFIG_H 7 8 9 /* Determine the architecture and define macros for some fundamental 10 properties: 11 __HAIKU_ARCH - short name of the architecture (used in paths) 12 __HAIKU_ARCH_ABI - name of ABI (as in package architecture) 13 __HAIKU_ARCH_<arch> - defined to 1 for the respective architecture 14 __HAIKU_ARCH_BITS - defined to 32/64 on 32/64 bit architectures 15 (defaults to 32) 16 __HAIKU_ARCH_PHYSICAL_BITS - defined to 32/64 on architectures with 32/64 17 (defaults to __HAIKU_ARCH_BITS) 18 __HAIKU_BIG_ENDIAN - defined to 1 on big endian architectures 19 (defaults to undefined) 20 */ 21 #ifdef __INTEL__ 22 # define __HAIKU_ARCH x86 23 # if __GNUC__ == 2 24 # define __HAIKU_ARCH_ABI "x86_gcc2" 25 # else 26 # define __HAIKU_ARCH_ABI "x86" 27 # endif 28 # define __HAIKU_ARCH_X86 1 29 # define __HAIKU_ARCH_PHYSICAL_BITS 64 30 #elif __x86_64__ 31 # define __HAIKU_ARCH x86_64 32 # define __HAIKU_ARCH_ABI "x86_64" 33 # define __HAIKU_ARCH_X86_64 1 34 # define __HAIKU_ARCH_BITS 64 35 #elif __POWERPC__ 36 # define __HAIKU_ARCH ppc 37 # define __HAIKU_ARCH_ABI "ppc" 38 # define __HAIKU_ARCH_PPC 1 39 # define __HAIKU_ARCH_PHYSICAL_BITS 64 40 # define __HAIKU_BIG_ENDIAN 1 41 #elif __M68K__ 42 # define __HAIKU_ARCH m68k 43 # define __HAIKU_ARCH_ABI "m68k" 44 # define __HAIKU_ARCH_M68K 1 45 # define __HAIKU_BIG_ENDIAN 1 46 #elif __MIPSEL__ 47 # define __HAIKU_ARCH mipsel 48 # define __HAIKU_ARCH_ABI "mipsel" 49 # define __HAIKU_ARCH_MIPSEL 1 50 #elif __ARM__ 51 # define __HAIKU_ARCH arm 52 # define __HAIKU_ARCH_ABI "arm" 53 # define __HAIKU_ARCH_ARM 1 54 #else 55 # error Unsupported architecture! 56 #endif 57 58 /* implied properties: 59 __HAIKU_ARCH_{32,64}_BIT - defined to 1 on 32/64 bit architectures, i.e. 60 using 32/64 bit virtual addresses 61 __HAIKU_ARCH_PHYSICAL_BITS - defined to 32/64 on architectures with 32/64 62 bit physical addresses 63 __HAIKU_ARCH_PHYSICAL_{32,64}_BIT - defined to 1 on architectures using 64 64 bit physical addresses 65 __HAIKU_BIG_ENDIAN - defined to 1 on big endian architectures 66 */ 67 68 /* bitness */ 69 #ifndef __HAIKU_ARCH_BITS 70 # define __HAIKU_ARCH_BITS 32 71 #endif 72 73 #if __HAIKU_ARCH_BITS == 32 74 # define __HAIKU_ARCH_32_BIT 1 75 #elif __HAIKU_ARCH_BITS == 64 76 # define __HAIKU_ARCH_64_BIT 1 77 #else 78 # error Unsupported bitness! 79 #endif 80 81 /* physical bitness */ 82 #ifndef __HAIKU_ARCH_PHYSICAL_BITS 83 # define __HAIKU_ARCH_PHYSICAL_BITS __HAIKU_ARCH_BITS 84 #endif 85 86 #if __HAIKU_ARCH_PHYSICAL_BITS == 32 87 # define __HAIKU_ARCH_PHYSICAL_32_BIT 1 88 #elif __HAIKU_ARCH_PHYSICAL_BITS == 64 89 # define __HAIKU_ARCH_PHYSICAL_64_BIT 1 90 #else 91 # error Unsupported physical bitness! 92 #endif 93 94 /* endianess */ 95 #ifndef __HAIKU_BIG_ENDIAN 96 # define __HAIKU_LITTLE_ENDIAN 1 97 #endif 98 99 /* architecture specific include macros */ 100 #define __HAIKU_ARCH_HEADER(header) <arch/__HAIKU_ARCH/header> 101 #define __HAIKU_SUBDIR_ARCH_HEADER(subdir, header) \ 102 <subdir/arch/__HAIKU_ARCH/header> 103 104 /* BeOS R5 binary compatibility (gcc 2 on x86) */ 105 #if defined(__HAIKU_ARCH_X86) && __GNUC__ == 2 106 # define __HAIKU_BEOS_COMPATIBLE 1 107 #endif 108 109 /* BeOS R5 compatible types */ 110 #ifndef __HAIKU_ARCH_64_BIT 111 /*#ifdef __HAIKU_ARCH_X86*/ 112 /* TODO: This should be "#ifdef __HAIKU_BEOS_COMPATIBLE", but this will 113 break all gcc 4 C++ optional packages. I.e. switch that at a suitable 114 time. 115 */ 116 # define __HAIKU_BEOS_COMPATIBLE_TYPES 1 117 #endif 118 119 120 #endif /* _CONFIG_HAIKU_CONFIG_H */ 121