diff options
author | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2006-05-26 13:10:10 +0000 |
---|---|---|
committer | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2006-05-26 13:10:10 +0000 |
commit | e00fc16aaa0c1adb27bca40a9871b165c3ca3fb7 (patch) | |
tree | f7fa57904f8e69310988294c52ddb23e703a9c29 | |
parent | 7fd9983c568d447d66d41c3132d3800e895f3f5a (diff) | |
download | busybox-w32-e00fc16aaa0c1adb27bca40a9871b165c3ca3fb7.tar.gz busybox-w32-e00fc16aaa0c1adb27bca40a9871b165c3ca3fb7.tar.bz2 busybox-w32-e00fc16aaa0c1adb27bca40a9871b165c3ca3fb7.zip |
- move libc checks from busybox.h to platform.h
- add ATTRIBUTE_ALWAYS_INLINE, endian handling for DEC UNIX, some more
compiler dependent defines to platform.h
- add conditional bb_setpgrp define to platform.h
- remove superfluous specifying args from "#define fdprintf dprintf"
-rw-r--r-- | include/busybox.h | 8 | ||||
-rw-r--r-- | include/platform.h | 105 |
2 files changed, 101 insertions, 12 deletions
diff --git a/include/busybox.h b/include/busybox.h index 59d800e8b..1f9f9775f 100644 --- a/include/busybox.h +++ b/include/busybox.h | |||
@@ -15,16 +15,8 @@ | |||
15 | #include <sys/types.h> | 15 | #include <sys/types.h> |
16 | #include <sys/stat.h> | 16 | #include <sys/stat.h> |
17 | 17 | ||
18 | #if __GNU_LIBRARY__ < 5 && \ | ||
19 | !defined(__dietlibc__) && \ | ||
20 | !defined(_NEWLIB_VERSION) | ||
21 | #error "Sorry, this libc version is not supported :(" | ||
22 | #endif | ||
23 | |||
24 | extern const char BB_BANNER[]; | 18 | extern const char BB_BANNER[]; |
25 | 19 | ||
26 | #include <features.h> | ||
27 | |||
28 | /* Pull in the utility routines from libbb */ | 20 | /* Pull in the utility routines from libbb */ |
29 | #include "libbb.h" | 21 | #include "libbb.h" |
30 | 22 | ||
diff --git a/include/platform.h b/include/platform.h index 62b4efba9..68cd2cc8e 100644 --- a/include/platform.h +++ b/include/platform.h | |||
@@ -33,6 +33,26 @@ | |||
33 | # endif | 33 | # endif |
34 | #endif | 34 | #endif |
35 | 35 | ||
36 | #undef inline | ||
37 | #if __STDC_VERSION__ > 199901L | ||
38 | /* it's a keyword */ | ||
39 | #else | ||
40 | # if __GNUC_PREREQ (2,7) | ||
41 | # define inline __inline__ | ||
42 | # else | ||
43 | # define inline | ||
44 | # endif | ||
45 | #endif | ||
46 | |||
47 | #ifndef __const | ||
48 | # define __const const | ||
49 | #endif | ||
50 | |||
51 | #ifndef __THROW | ||
52 | # define __THROW | ||
53 | #endif | ||
54 | |||
55 | |||
36 | #ifndef ATTRIBUTE_UNUSED | 56 | #ifndef ATTRIBUTE_UNUSED |
37 | # define ATTRIBUTE_UNUSED __attribute__ ((__unused__)) | 57 | # define ATTRIBUTE_UNUSED __attribute__ ((__unused__)) |
38 | #endif /* ATTRIBUTE_UNUSED */ | 58 | #endif /* ATTRIBUTE_UNUSED */ |
@@ -49,6 +69,14 @@ | |||
49 | # define ATTRIBUTE_ALIGNED(m) __attribute__ ((__aligned__(m))) | 69 | # define ATTRIBUTE_ALIGNED(m) __attribute__ ((__aligned__(m))) |
50 | #endif /* ATTRIBUTE_ALIGNED */ | 70 | #endif /* ATTRIBUTE_ALIGNED */ |
51 | 71 | ||
72 | #ifndef ATTRIBUTE_ALWAYS_INLINE | ||
73 | # if __GNUC_PREREQ (3,0) | ||
74 | # define ATTRIBUTE_ALWAYS_INLINE __attribute__ ((always_inline)) inline | ||
75 | # else | ||
76 | # define ATTRIBUTE_ALWAYS_INLINE inline | ||
77 | # endif | ||
78 | #endif | ||
79 | |||
52 | /* -fwhole-program makes all symbols local. The attribute externally_visible | 80 | /* -fwhole-program makes all symbols local. The attribute externally_visible |
53 | forces a symbol global. */ | 81 | forces a symbol global. */ |
54 | #ifndef ATTRIBUTE_EXTERNALLY_VISIBLE | 82 | #ifndef ATTRIBUTE_EXTERNALLY_VISIBLE |
@@ -69,11 +97,18 @@ | |||
69 | #endif | 97 | #endif |
70 | 98 | ||
71 | /* ---- Endian Detection ------------------------------------ */ | 99 | /* ---- Endian Detection ------------------------------------ */ |
72 | #ifndef __APPLE__ | 100 | #if !defined __APPLE__ && !(defined __digital__ && defined __unix__) |
73 | # include <byteswap.h> | 101 | # include <byteswap.h> |
74 | # include <endian.h> | 102 | # include <endian.h> |
75 | #endif | 103 | #endif |
76 | 104 | ||
105 | #if (defined __digital__ && defined __unix__) | ||
106 | # include <sex.h> | ||
107 | # define __BIG_ENDIAN__ (BYTE_ORDER == BIG_ENDIAN) | ||
108 | # define __BYTE_ORDER BYTE_ORDER | ||
109 | #endif | ||
110 | |||
111 | |||
77 | #ifdef __BIG_ENDIAN__ | 112 | #ifdef __BIG_ENDIAN__ |
78 | # define BB_BIG_ENDIAN 1 | 113 | # define BB_BIG_ENDIAN 1 |
79 | # define BB_LITTLE_ENDIAN 0 | 114 | # define BB_LITTLE_ENDIAN 0 |
@@ -92,19 +127,81 @@ | |||
92 | # include <netinet/in.h> | 127 | # include <netinet/in.h> |
93 | #endif | 128 | #endif |
94 | 129 | ||
130 | #ifndef __socklen_t_defined | ||
131 | typedef int socklen_t; | ||
132 | #endif | ||
133 | |||
134 | /* ---- Compiler dependent settings ------------------------- */ | ||
135 | #ifndef __GNUC__ | ||
136 | #if defined __INTEL_COMPILER | ||
137 | __extension__ typedef __signed__ long long __s64; | ||
138 | __extension__ typedef unsigned long long __u64; | ||
139 | #endif /* __INTEL_COMPILER */ | ||
140 | #endif /* ifndef __GNUC__ */ | ||
141 | |||
142 | #if (defined __digital__ && defined __unix__) | ||
143 | # undef HAVE_STDBOOL_H | ||
144 | # undef HAVE_MNTENT_H | ||
145 | #else | ||
146 | # define HAVE_STDBOOL_H 1 | ||
147 | # define HAVE_MNTENT_H 1 | ||
148 | #endif /* ___digital__ && __unix__ */ | ||
149 | |||
95 | /*----- Kernel versioning ------------------------------------*/ | 150 | /*----- Kernel versioning ------------------------------------*/ |
96 | #ifdef __linux__ | 151 | #ifdef __linux__ |
97 | #define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) | 152 | #define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) |
98 | #else | ||
99 | #error implement KERNEL_VERSION for your platform | ||
100 | #endif | 153 | #endif |
101 | 154 | ||
102 | /* ---- miscellaneous --------------------------------------- */ | 155 | /* ---- miscellaneous --------------------------------------- */ |
156 | |||
157 | #if __GNU_LIBRARY__ < 5 && \ | ||
158 | !defined(__dietlibc__) && \ | ||
159 | !defined(_NEWLIB_VERSION) && \ | ||
160 | !(defined __digital__ && defined __unix__) | ||
161 | #error "Sorry, this libc version is not supported :(" | ||
162 | #endif | ||
163 | |||
164 | #if defined __GLIBC__ || defined __UCLIBC__ \ | ||
165 | || defined __dietlibc__ || defined _NEWLIB_VERSION | ||
166 | #include <features.h> | ||
167 | #define HAVE_FEATURES_H | ||
168 | #include <stdint.h> | ||
169 | #define HAVE_STDINT_H | ||
170 | #else | ||
171 | /* Largest integral types. */ | ||
172 | #if __BIG_ENDIAN__ | ||
173 | typedef long int intmax_t; | ||
174 | typedef unsigned long int uintmax_t; | ||
175 | #else | ||
176 | __extension__ | ||
177 | typedef long long int intmax_t; | ||
178 | __extension__ | ||
179 | typedef unsigned long long int uintmax_t; | ||
180 | #endif | ||
181 | #endif | ||
182 | |||
183 | #if (defined __digital__ && defined __unix__) | ||
184 | #include <standards.h> | ||
185 | #define HAVE_STANDARDS_H | ||
186 | #include <inttypes.h> | ||
187 | #define HAVE_INTTYPES_H | ||
188 | #define PRIu32 "u" | ||
189 | #endif | ||
190 | |||
191 | |||
103 | /* NLS stuff */ | 192 | /* NLS stuff */ |
104 | /* THIS SHOULD BE CLEANED OUT OF THE TREE ENTIRELY */ | 193 | /* THIS SHOULD BE CLEANED OUT OF THE TREE ENTIRELY */ |
105 | #define _(Text) Text | 194 | #define _(Text) Text |
106 | #define N_(Text) (Text) | 195 | #define N_(Text) (Text) |
107 | 196 | ||
108 | #define fdprintf(...) dprintf(__VA_ARGS__) | 197 | /* THIS SHOULD BE CLEANED OUT OF THE TREE ENTIRELY */ |
198 | #define fdprintf dprintf | ||
109 | 199 | ||
200 | /* move to platform.c */ | ||
201 | #if (defined __digital__ && defined __unix__) | ||
202 | /* use legacy setpgrp(pidt_,pid_t) for now.. */ | ||
203 | #define bb_setpgrp do{pid_t __me = getpid();setpgrp(__me,__me);}while(0) | ||
204 | #else | ||
205 | #define bb_setpgrp setpgrp() | ||
206 | #endif | ||
110 | #endif /* platform.h */ | 207 | #endif /* platform.h */ |