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