comparison config.h @ 100:1e4eef5bf88d release-0.1

Set up some real builtin macro config instead of hardwiring my platform.
author David A. Holland
date Tue, 11 Jun 2013 00:14:31 -0400
parents 76c114899f63
children 9b859d40640a
comparison
equal deleted inserted replaced
99:60184aa42604 100:1e4eef5bf88d
1 /*- 1 /*-
2 * Copyright (c) 2010 The NetBSD Foundation, Inc. 2 * Copyright (c) 2010, 2013 The NetBSD Foundation, Inc.
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
5 * This code is derived from software contributed to The NetBSD Foundation 5 * This code is derived from software contributed to The NetBSD Foundation
6 * by David A. Holland. 6 * by David A. Holland.
7 * 7 *
25 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27 * POSSIBILITY OF SUCH DAMAGE. 27 * POSSIBILITY OF SUCH DAMAGE.
28 */ 28 */
29 29
30 /*
31 * Config for predefined macros. If this doesn't do what you want you
32 * can set any or all of the CONFIG_ defines from the compiler command
33 * line; or patch the list in main.c; or both.
34 */
35
36 /*
37 * Paths
38 */
39
40 #ifndef CONFIG_LOCALINCLUDE
30 #define CONFIG_LOCALINCLUDE "/usr/local/include" 41 #define CONFIG_LOCALINCLUDE "/usr/local/include"
42 #endif
43
44 #ifndef CONFIG_SYSTEMINCLUDE
31 #define CONFIG_SYSTEMINCLUDE "/usr/include" 45 #define CONFIG_SYSTEMINCLUDE "/usr/include"
46 #endif
32 47
48 /*
49 * Operating system
50 */
51
52 #ifndef CONFIG_OS
53 #if defined(__NetBSD__)
33 #define CONFIG_OS "__NetBSD__" 54 #define CONFIG_OS "__NetBSD__"
34 #define CONFIG_OS_2 "__unix__" 55 #define CONFIG_OS_2 "__unix__"
56 #elif defined(__FreeBSD__)
57 #define CONFIG_OS "__FreeBSD__"
58 #define CONFIG_OS_2 "__unix__"
59 #elif defined(__OpenBSD__)
60 #define CONFIG_OS "__OpenBSD__"
61 #define CONFIG_OS_2 "__unix__"
62 #elif defined(__DragonFly__)
63 #define CONFIG_OS "__DragonFly__"
64 #define CONFIG_OS_2 "__unix__"
65 #elif defined(__bsdi__)
66 #define CONFIG_OS "__bsdi__"
67 #define CONFIG_OS_2 "__unix__"
68 #elif defined(__sun)
69 #define CONFIG_OS "__sun"
70 #define CONFIG_OS_2 "__unix__"
71 #elif defined(__sgi)
72 #define CONFIG_OS "__sgi"
73 #define CONFIG_OS_2 "__unix__"
74 #elif defined(__SVR4)
75 #define CONFIG_OS "__SVR4"
76 #define CONFIG_OS_2 "__unix__"
77 #elif defined(__APPLE__)
78 #define CONFIG_OS "__APPLE__"
79 #define CONFIG_OS_2 "__unix__"
80 #elif defined(__linux__)
81 #define CONFIG_OS "__linux__"
82 #elif defined(__CYGWIN__)
83 #define CONFIG_OS "__CYGWIN__"
84 #elif defined(__INTERIX)
85 #define CONFIG_OS "__INTERIX"
86 #elif defined(__MINGW32)
87 #define CONFIG_OS "__MINGW32"
88 #else
89 /* we could error... but let's instead assume generic unix */
90 #define CONFIG_OS "__unix__"
91 #endif
92 #endif
35 93
94 /*
95 * CPU
96 */
97
98 #ifndef CONFIG_CPU
99 #if defined(__x86_64__)
36 #define CONFIG_CPU "__x86_64__" 100 #define CONFIG_CPU "__x86_64__"
37 #define CONFIG_CPU_2 "__amd64__" 101 #define CONFIG_CPU_2 "__amd64__"
102 #elif defined(__i386__) || defined(__i386)
103 #define CONFIG_CPU "__i386__"
104 #define CONFIG_CPU_2 "__i386"
105 #elif defined(__sparc)
106 #define CONFIG_CPU "__sparc"
107 #elif defined(__mips)
108 #define CONFIG_CPU "__mips"
109 #elif defined(__POWERPC__)
110 #define CONFIG_CPU "__POWERPC__"
111 #elif defined(__ARM__)
112 #define CONFIG_CPU "__ARM__"
113 #else
114 /* let it go */
115 #endif
116 #endif
38 117
118 /*
119 * Other stuff
120 */
121
122 #ifndef CONFIG_SIZE
123 #ifdef __LP64__
39 #define CONFIG_SIZE "__LP64__" 124 #define CONFIG_SIZE "__LP64__"
125 #else
126 #define CONFIG_SIZE "__ILP32__"
127 #endif
128 #endif
129
130 #ifndef CONFIG_BINFMT
131 #ifdef __ELF__
40 #define CONFIG_BINFMT "__ELF__" 132 #define CONFIG_BINFMT "__ELF__"
133 #endif
134 #endif
41 135
42 #define CONFIG_COMPILER "__NBCC__" 136 /*
43 #define CONFIG_COMPILER_MINOR "__NBCC_MINOR__" 137 * We are __TRADCPP__ by default, but if you want to masquerade as
138 * some other compiler this is a convenient place to change it.
139 */
140
141 #ifndef CONFIG_COMPILER
142 #define CONFIG_COMPILER "__TRADCPP__"
143 #define CONFIG_COMPILER_MINOR "__TRADCPP_MINOR__"
144 #endif