Mercurial > ~dholland > hg > tradcpp > index.cgi
annotate config.h @ 136:59680a727e9d
Improve previous.
Just in case we ever crash and reach cleanup() while processing an
-include foo option, take the array entry for it out of the array to
make sure it doesn't get freed twice. This case shouldn't be
reachable, but it's better to be safe.
author | David A. Holland |
---|---|
date | Tue, 09 Jul 2013 13:38:43 -0400 |
parents | 9b859d40640a |
children | e200cb46ab23 |
rev | line source |
---|---|
30 | 1 /*- |
100
1e4eef5bf88d
Set up some real builtin macro config instead of hardwiring my platform.
David A. Holland
parents:
30
diff
changeset
|
2 * Copyright (c) 2010, 2013 The NetBSD Foundation, Inc. |
30 | 3 * All rights reserved. |
4 * | |
5 * This code is derived from software contributed to The NetBSD Foundation | |
6 * by David A. Holland. | |
7 * | |
8 * Redistribution and use in source and binary forms, with or without | |
9 * modification, are permitted provided that the following conditions | |
10 * are met: | |
11 * 1. Redistributions of source code must retain the above copyright | |
12 * notice, this list of conditions and the following disclaimer. | |
13 * 2. Redistributions in binary form must reproduce the above copyright | |
14 * notice, this list of conditions and the following disclaimer in the | |
15 * documentation and/or other materials provided with the distribution. | |
16 * | |
17 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS | |
18 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | |
19 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
20 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | |
21 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
22 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
23 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
24 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
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 | |
27 * POSSIBILITY OF SUCH DAMAGE. | |
28 */ | |
29 | |
100
1e4eef5bf88d
Set up some real builtin macro config instead of hardwiring my platform.
David A. Holland
parents:
30
diff
changeset
|
30 /* |
1e4eef5bf88d
Set up some real builtin macro config instead of hardwiring my platform.
David A. Holland
parents:
30
diff
changeset
|
31 * Config for predefined macros. If this doesn't do what you want you |
1e4eef5bf88d
Set up some real builtin macro config instead of hardwiring my platform.
David A. Holland
parents:
30
diff
changeset
|
32 * can set any or all of the CONFIG_ defines from the compiler command |
1e4eef5bf88d
Set up some real builtin macro config instead of hardwiring my platform.
David A. Holland
parents:
30
diff
changeset
|
33 * line; or patch the list in main.c; or both. |
1e4eef5bf88d
Set up some real builtin macro config instead of hardwiring my platform.
David A. Holland
parents:
30
diff
changeset
|
34 */ |
1e4eef5bf88d
Set up some real builtin macro config instead of hardwiring my platform.
David A. Holland
parents:
30
diff
changeset
|
35 |
1e4eef5bf88d
Set up some real builtin macro config instead of hardwiring my platform.
David A. Holland
parents:
30
diff
changeset
|
36 /* |
1e4eef5bf88d
Set up some real builtin macro config instead of hardwiring my platform.
David A. Holland
parents:
30
diff
changeset
|
37 * Paths |
1e4eef5bf88d
Set up some real builtin macro config instead of hardwiring my platform.
David A. Holland
parents:
30
diff
changeset
|
38 */ |
1e4eef5bf88d
Set up some real builtin macro config instead of hardwiring my platform.
David A. Holland
parents:
30
diff
changeset
|
39 |
1e4eef5bf88d
Set up some real builtin macro config instead of hardwiring my platform.
David A. Holland
parents:
30
diff
changeset
|
40 #ifndef CONFIG_LOCALINCLUDE |
4
ee9a66b87c70
Initial version of toplevel and options handling.
David A. Holland
parents:
diff
changeset
|
41 #define CONFIG_LOCALINCLUDE "/usr/local/include" |
100
1e4eef5bf88d
Set up some real builtin macro config instead of hardwiring my platform.
David A. Holland
parents:
30
diff
changeset
|
42 #endif |
1e4eef5bf88d
Set up some real builtin macro config instead of hardwiring my platform.
David A. Holland
parents:
30
diff
changeset
|
43 |
1e4eef5bf88d
Set up some real builtin macro config instead of hardwiring my platform.
David A. Holland
parents:
30
diff
changeset
|
44 #ifndef CONFIG_SYSTEMINCLUDE |
4
ee9a66b87c70
Initial version of toplevel and options handling.
David A. Holland
parents:
diff
changeset
|
45 #define CONFIG_SYSTEMINCLUDE "/usr/include" |
100
1e4eef5bf88d
Set up some real builtin macro config instead of hardwiring my platform.
David A. Holland
parents:
30
diff
changeset
|
46 #endif |
4
ee9a66b87c70
Initial version of toplevel and options handling.
David A. Holland
parents:
diff
changeset
|
47 |
100
1e4eef5bf88d
Set up some real builtin macro config instead of hardwiring my platform.
David A. Holland
parents:
30
diff
changeset
|
48 /* |
1e4eef5bf88d
Set up some real builtin macro config instead of hardwiring my platform.
David A. Holland
parents:
30
diff
changeset
|
49 * Operating system |
1e4eef5bf88d
Set up some real builtin macro config instead of hardwiring my platform.
David A. Holland
parents:
30
diff
changeset
|
50 */ |
1e4eef5bf88d
Set up some real builtin macro config instead of hardwiring my platform.
David A. Holland
parents:
30
diff
changeset
|
51 |
1e4eef5bf88d
Set up some real builtin macro config instead of hardwiring my platform.
David A. Holland
parents:
30
diff
changeset
|
52 #ifndef CONFIG_OS |
1e4eef5bf88d
Set up some real builtin macro config instead of hardwiring my platform.
David A. Holland
parents:
30
diff
changeset
|
53 #if defined(__NetBSD__) |
4
ee9a66b87c70
Initial version of toplevel and options handling.
David A. Holland
parents:
diff
changeset
|
54 #define CONFIG_OS "__NetBSD__" |
ee9a66b87c70
Initial version of toplevel and options handling.
David A. Holland
parents:
diff
changeset
|
55 #define CONFIG_OS_2 "__unix__" |
100
1e4eef5bf88d
Set up some real builtin macro config instead of hardwiring my platform.
David A. Holland
parents:
30
diff
changeset
|
56 #elif defined(__FreeBSD__) |
1e4eef5bf88d
Set up some real builtin macro config instead of hardwiring my platform.
David A. Holland
parents:
30
diff
changeset
|
57 #define CONFIG_OS "__FreeBSD__" |
1e4eef5bf88d
Set up some real builtin macro config instead of hardwiring my platform.
David A. Holland
parents:
30
diff
changeset
|
58 #define CONFIG_OS_2 "__unix__" |
1e4eef5bf88d
Set up some real builtin macro config instead of hardwiring my platform.
David A. Holland
parents:
30
diff
changeset
|
59 #elif defined(__OpenBSD__) |
1e4eef5bf88d
Set up some real builtin macro config instead of hardwiring my platform.
David A. Holland
parents:
30
diff
changeset
|
60 #define CONFIG_OS "__OpenBSD__" |
1e4eef5bf88d
Set up some real builtin macro config instead of hardwiring my platform.
David A. Holland
parents:
30
diff
changeset
|
61 #define CONFIG_OS_2 "__unix__" |
1e4eef5bf88d
Set up some real builtin macro config instead of hardwiring my platform.
David A. Holland
parents:
30
diff
changeset
|
62 #elif defined(__DragonFly__) |
1e4eef5bf88d
Set up some real builtin macro config instead of hardwiring my platform.
David A. Holland
parents:
30
diff
changeset
|
63 #define CONFIG_OS "__DragonFly__" |
1e4eef5bf88d
Set up some real builtin macro config instead of hardwiring my platform.
David A. Holland
parents:
30
diff
changeset
|
64 #define CONFIG_OS_2 "__unix__" |
1e4eef5bf88d
Set up some real builtin macro config instead of hardwiring my platform.
David A. Holland
parents:
30
diff
changeset
|
65 #elif defined(__bsdi__) |
1e4eef5bf88d
Set up some real builtin macro config instead of hardwiring my platform.
David A. Holland
parents:
30
diff
changeset
|
66 #define CONFIG_OS "__bsdi__" |
1e4eef5bf88d
Set up some real builtin macro config instead of hardwiring my platform.
David A. Holland
parents:
30
diff
changeset
|
67 #define CONFIG_OS_2 "__unix__" |
1e4eef5bf88d
Set up some real builtin macro config instead of hardwiring my platform.
David A. Holland
parents:
30
diff
changeset
|
68 #elif defined(__sun) |
1e4eef5bf88d
Set up some real builtin macro config instead of hardwiring my platform.
David A. Holland
parents:
30
diff
changeset
|
69 #define CONFIG_OS "__sun" |
1e4eef5bf88d
Set up some real builtin macro config instead of hardwiring my platform.
David A. Holland
parents:
30
diff
changeset
|
70 #define CONFIG_OS_2 "__unix__" |
1e4eef5bf88d
Set up some real builtin macro config instead of hardwiring my platform.
David A. Holland
parents:
30
diff
changeset
|
71 #elif defined(__sgi) |
1e4eef5bf88d
Set up some real builtin macro config instead of hardwiring my platform.
David A. Holland
parents:
30
diff
changeset
|
72 #define CONFIG_OS "__sgi" |
1e4eef5bf88d
Set up some real builtin macro config instead of hardwiring my platform.
David A. Holland
parents:
30
diff
changeset
|
73 #define CONFIG_OS_2 "__unix__" |
1e4eef5bf88d
Set up some real builtin macro config instead of hardwiring my platform.
David A. Holland
parents:
30
diff
changeset
|
74 #elif defined(__SVR4) |
1e4eef5bf88d
Set up some real builtin macro config instead of hardwiring my platform.
David A. Holland
parents:
30
diff
changeset
|
75 #define CONFIG_OS "__SVR4" |
1e4eef5bf88d
Set up some real builtin macro config instead of hardwiring my platform.
David A. Holland
parents:
30
diff
changeset
|
76 #define CONFIG_OS_2 "__unix__" |
1e4eef5bf88d
Set up some real builtin macro config instead of hardwiring my platform.
David A. Holland
parents:
30
diff
changeset
|
77 #elif defined(__APPLE__) |
1e4eef5bf88d
Set up some real builtin macro config instead of hardwiring my platform.
David A. Holland
parents:
30
diff
changeset
|
78 #define CONFIG_OS "__APPLE__" |
1e4eef5bf88d
Set up some real builtin macro config instead of hardwiring my platform.
David A. Holland
parents:
30
diff
changeset
|
79 #define CONFIG_OS_2 "__unix__" |
1e4eef5bf88d
Set up some real builtin macro config instead of hardwiring my platform.
David A. Holland
parents:
30
diff
changeset
|
80 #elif defined(__linux__) |
1e4eef5bf88d
Set up some real builtin macro config instead of hardwiring my platform.
David A. Holland
parents:
30
diff
changeset
|
81 #define CONFIG_OS "__linux__" |
1e4eef5bf88d
Set up some real builtin macro config instead of hardwiring my platform.
David A. Holland
parents:
30
diff
changeset
|
82 #elif defined(__CYGWIN__) |
1e4eef5bf88d
Set up some real builtin macro config instead of hardwiring my platform.
David A. Holland
parents:
30
diff
changeset
|
83 #define CONFIG_OS "__CYGWIN__" |
1e4eef5bf88d
Set up some real builtin macro config instead of hardwiring my platform.
David A. Holland
parents:
30
diff
changeset
|
84 #elif defined(__INTERIX) |
1e4eef5bf88d
Set up some real builtin macro config instead of hardwiring my platform.
David A. Holland
parents:
30
diff
changeset
|
85 #define CONFIG_OS "__INTERIX" |
1e4eef5bf88d
Set up some real builtin macro config instead of hardwiring my platform.
David A. Holland
parents:
30
diff
changeset
|
86 #elif defined(__MINGW32) |
1e4eef5bf88d
Set up some real builtin macro config instead of hardwiring my platform.
David A. Holland
parents:
30
diff
changeset
|
87 #define CONFIG_OS "__MINGW32" |
1e4eef5bf88d
Set up some real builtin macro config instead of hardwiring my platform.
David A. Holland
parents:
30
diff
changeset
|
88 #else |
1e4eef5bf88d
Set up some real builtin macro config instead of hardwiring my platform.
David A. Holland
parents:
30
diff
changeset
|
89 /* we could error... but let's instead assume generic unix */ |
1e4eef5bf88d
Set up some real builtin macro config instead of hardwiring my platform.
David A. Holland
parents:
30
diff
changeset
|
90 #define CONFIG_OS "__unix__" |
1e4eef5bf88d
Set up some real builtin macro config instead of hardwiring my platform.
David A. Holland
parents:
30
diff
changeset
|
91 #endif |
1e4eef5bf88d
Set up some real builtin macro config instead of hardwiring my platform.
David A. Holland
parents:
30
diff
changeset
|
92 #endif |
4
ee9a66b87c70
Initial version of toplevel and options handling.
David A. Holland
parents:
diff
changeset
|
93 |
100
1e4eef5bf88d
Set up some real builtin macro config instead of hardwiring my platform.
David A. Holland
parents:
30
diff
changeset
|
94 /* |
1e4eef5bf88d
Set up some real builtin macro config instead of hardwiring my platform.
David A. Holland
parents:
30
diff
changeset
|
95 * CPU |
1e4eef5bf88d
Set up some real builtin macro config instead of hardwiring my platform.
David A. Holland
parents:
30
diff
changeset
|
96 */ |
1e4eef5bf88d
Set up some real builtin macro config instead of hardwiring my platform.
David A. Holland
parents:
30
diff
changeset
|
97 |
1e4eef5bf88d
Set up some real builtin macro config instead of hardwiring my platform.
David A. Holland
parents:
30
diff
changeset
|
98 #ifndef CONFIG_CPU |
1e4eef5bf88d
Set up some real builtin macro config instead of hardwiring my platform.
David A. Holland
parents:
30
diff
changeset
|
99 #if defined(__x86_64__) |
4
ee9a66b87c70
Initial version of toplevel and options handling.
David A. Holland
parents:
diff
changeset
|
100 #define CONFIG_CPU "__x86_64__" |
ee9a66b87c70
Initial version of toplevel and options handling.
David A. Holland
parents:
diff
changeset
|
101 #define CONFIG_CPU_2 "__amd64__" |
100
1e4eef5bf88d
Set up some real builtin macro config instead of hardwiring my platform.
David A. Holland
parents:
30
diff
changeset
|
102 #elif defined(__i386__) || defined(__i386) |
1e4eef5bf88d
Set up some real builtin macro config instead of hardwiring my platform.
David A. Holland
parents:
30
diff
changeset
|
103 #define CONFIG_CPU "__i386__" |
1e4eef5bf88d
Set up some real builtin macro config instead of hardwiring my platform.
David A. Holland
parents:
30
diff
changeset
|
104 #define CONFIG_CPU_2 "__i386" |
1e4eef5bf88d
Set up some real builtin macro config instead of hardwiring my platform.
David A. Holland
parents:
30
diff
changeset
|
105 #elif defined(__sparc) |
1e4eef5bf88d
Set up some real builtin macro config instead of hardwiring my platform.
David A. Holland
parents:
30
diff
changeset
|
106 #define CONFIG_CPU "__sparc" |
1e4eef5bf88d
Set up some real builtin macro config instead of hardwiring my platform.
David A. Holland
parents:
30
diff
changeset
|
107 #elif defined(__mips) |
1e4eef5bf88d
Set up some real builtin macro config instead of hardwiring my platform.
David A. Holland
parents:
30
diff
changeset
|
108 #define CONFIG_CPU "__mips" |
102 | 109 #elif defined(__mips__) |
110 #define CONFIG_CPU "__mips__" | |
111 #elif defined(__mipsel__) | |
112 #define CONFIG_CPU "__mipsel__" | |
100
1e4eef5bf88d
Set up some real builtin macro config instead of hardwiring my platform.
David A. Holland
parents:
30
diff
changeset
|
113 #elif defined(__POWERPC__) |
1e4eef5bf88d
Set up some real builtin macro config instead of hardwiring my platform.
David A. Holland
parents:
30
diff
changeset
|
114 #define CONFIG_CPU "__POWERPC__" |
102 | 115 #elif defined(__POWERPC__) |
116 #define CONFIG_CPU "__powerpc__" | |
117 #elif defined(__PPC__) | |
118 #define CONFIG_CPU "__PPC__" | |
119 #elif defined(__ppc__) | |
120 #define CONFIG_CPU "__ppc__" | |
121 #elif defined(__PPC64__) | |
122 #define CONFIG_CPU "__PPC64__" | |
123 #elif defined(__ppc64__) | |
124 #define CONFIG_CPU "__ppc64__" | |
100
1e4eef5bf88d
Set up some real builtin macro config instead of hardwiring my platform.
David A. Holland
parents:
30
diff
changeset
|
125 #elif defined(__ARM__) |
1e4eef5bf88d
Set up some real builtin macro config instead of hardwiring my platform.
David A. Holland
parents:
30
diff
changeset
|
126 #define CONFIG_CPU "__ARM__" |
1e4eef5bf88d
Set up some real builtin macro config instead of hardwiring my platform.
David A. Holland
parents:
30
diff
changeset
|
127 #else |
1e4eef5bf88d
Set up some real builtin macro config instead of hardwiring my platform.
David A. Holland
parents:
30
diff
changeset
|
128 /* let it go */ |
1e4eef5bf88d
Set up some real builtin macro config instead of hardwiring my platform.
David A. Holland
parents:
30
diff
changeset
|
129 #endif |
1e4eef5bf88d
Set up some real builtin macro config instead of hardwiring my platform.
David A. Holland
parents:
30
diff
changeset
|
130 #endif |
4
ee9a66b87c70
Initial version of toplevel and options handling.
David A. Holland
parents:
diff
changeset
|
131 |
100
1e4eef5bf88d
Set up some real builtin macro config instead of hardwiring my platform.
David A. Holland
parents:
30
diff
changeset
|
132 /* |
1e4eef5bf88d
Set up some real builtin macro config instead of hardwiring my platform.
David A. Holland
parents:
30
diff
changeset
|
133 * Other stuff |
1e4eef5bf88d
Set up some real builtin macro config instead of hardwiring my platform.
David A. Holland
parents:
30
diff
changeset
|
134 */ |
1e4eef5bf88d
Set up some real builtin macro config instead of hardwiring my platform.
David A. Holland
parents:
30
diff
changeset
|
135 |
1e4eef5bf88d
Set up some real builtin macro config instead of hardwiring my platform.
David A. Holland
parents:
30
diff
changeset
|
136 #ifndef CONFIG_SIZE |
1e4eef5bf88d
Set up some real builtin macro config instead of hardwiring my platform.
David A. Holland
parents:
30
diff
changeset
|
137 #ifdef __LP64__ |
4
ee9a66b87c70
Initial version of toplevel and options handling.
David A. Holland
parents:
diff
changeset
|
138 #define CONFIG_SIZE "__LP64__" |
100
1e4eef5bf88d
Set up some real builtin macro config instead of hardwiring my platform.
David A. Holland
parents:
30
diff
changeset
|
139 #else |
1e4eef5bf88d
Set up some real builtin macro config instead of hardwiring my platform.
David A. Holland
parents:
30
diff
changeset
|
140 #define CONFIG_SIZE "__ILP32__" |
1e4eef5bf88d
Set up some real builtin macro config instead of hardwiring my platform.
David A. Holland
parents:
30
diff
changeset
|
141 #endif |
1e4eef5bf88d
Set up some real builtin macro config instead of hardwiring my platform.
David A. Holland
parents:
30
diff
changeset
|
142 #endif |
1e4eef5bf88d
Set up some real builtin macro config instead of hardwiring my platform.
David A. Holland
parents:
30
diff
changeset
|
143 |
1e4eef5bf88d
Set up some real builtin macro config instead of hardwiring my platform.
David A. Holland
parents:
30
diff
changeset
|
144 #ifndef CONFIG_BINFMT |
1e4eef5bf88d
Set up some real builtin macro config instead of hardwiring my platform.
David A. Holland
parents:
30
diff
changeset
|
145 #ifdef __ELF__ |
4
ee9a66b87c70
Initial version of toplevel and options handling.
David A. Holland
parents:
diff
changeset
|
146 #define CONFIG_BINFMT "__ELF__" |
100
1e4eef5bf88d
Set up some real builtin macro config instead of hardwiring my platform.
David A. Holland
parents:
30
diff
changeset
|
147 #endif |
1e4eef5bf88d
Set up some real builtin macro config instead of hardwiring my platform.
David A. Holland
parents:
30
diff
changeset
|
148 #endif |
4
ee9a66b87c70
Initial version of toplevel and options handling.
David A. Holland
parents:
diff
changeset
|
149 |
100
1e4eef5bf88d
Set up some real builtin macro config instead of hardwiring my platform.
David A. Holland
parents:
30
diff
changeset
|
150 /* |
1e4eef5bf88d
Set up some real builtin macro config instead of hardwiring my platform.
David A. Holland
parents:
30
diff
changeset
|
151 * We are __TRADCPP__ by default, but if you want to masquerade as |
1e4eef5bf88d
Set up some real builtin macro config instead of hardwiring my platform.
David A. Holland
parents:
30
diff
changeset
|
152 * some other compiler this is a convenient place to change it. |
1e4eef5bf88d
Set up some real builtin macro config instead of hardwiring my platform.
David A. Holland
parents:
30
diff
changeset
|
153 */ |
1e4eef5bf88d
Set up some real builtin macro config instead of hardwiring my platform.
David A. Holland
parents:
30
diff
changeset
|
154 |
1e4eef5bf88d
Set up some real builtin macro config instead of hardwiring my platform.
David A. Holland
parents:
30
diff
changeset
|
155 #ifndef CONFIG_COMPILER |
1e4eef5bf88d
Set up some real builtin macro config instead of hardwiring my platform.
David A. Holland
parents:
30
diff
changeset
|
156 #define CONFIG_COMPILER "__TRADCPP__" |
1e4eef5bf88d
Set up some real builtin macro config instead of hardwiring my platform.
David A. Holland
parents:
30
diff
changeset
|
157 #define CONFIG_COMPILER_MINOR "__TRADCPP_MINOR__" |
1e4eef5bf88d
Set up some real builtin macro config instead of hardwiring my platform.
David A. Holland
parents:
30
diff
changeset
|
158 #endif |