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