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