diff options
author | Mike Frysinger <vapier@gentoo.org> | 2013-03-12 11:13:22 -0400 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2013-03-12 11:13:22 -0400 |
commit | 445e7543e80d629173d96a77fbfe228fe795cb88 (patch) | |
tree | 8cff682c57f9767dd77bcca26f48a750be99bb2a | |
parent | bca5c556c43ced7b368fdd90a24e4aecf40045ac (diff) | |
download | busybox-w32-445e7543e80d629173d96a77fbfe228fe795cb88.tar.gz busybox-w32-445e7543e80d629173d96a77fbfe228fe795cb88.tar.bz2 busybox-w32-445e7543e80d629173d96a77fbfe228fe795cb88.zip |
platform: use KERNEL_VERSION to simplify uClibc version checking
This makes reading the logic (as well as adding new code) a lot simpler,
and fixes one or two cases that were broken due to incorrect sub-version
tests.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
-rw-r--r-- | coreutils/id.c | 4 | ||||
-rw-r--r-- | include/platform.h | 20 | ||||
-rw-r--r-- | networking/ether-wake.c | 5 |
3 files changed, 13 insertions, 16 deletions
diff --git a/coreutils/id.c b/coreutils/id.c index 1f20b755e..1f3e1c4c2 100644 --- a/coreutils/id.c +++ b/coreutils/id.c | |||
@@ -64,12 +64,10 @@ | |||
64 | /* This is a NOEXEC applet. Be very careful! */ | 64 | /* This is a NOEXEC applet. Be very careful! */ |
65 | 65 | ||
66 | #if !ENABLE_USE_BB_PWD_GRP | 66 | #if !ENABLE_USE_BB_PWD_GRP |
67 | #if defined(__UCLIBC_MAJOR__) && (__UCLIBC_MAJOR__ == 0) | 67 | #if defined(__UCLIBC__) && UCLIBC_VERSION < KERNEL_VERSION(0, 9, 30) |
68 | #if (__UCLIBC_MINOR__ < 9) || (__UCLIBC_MINOR__ == 9 && __UCLIBC_SUBLEVEL__ < 30) | ||
69 | #error "Sorry, you need at least uClibc version 0.9.30 for id applet to build" | 68 | #error "Sorry, you need at least uClibc version 0.9.30 for id applet to build" |
70 | #endif | 69 | #endif |
71 | #endif | 70 | #endif |
72 | #endif | ||
73 | 71 | ||
74 | enum { | 72 | enum { |
75 | PRINT_REAL = (1 << 0), | 73 | PRINT_REAL = (1 << 0), |
diff --git a/include/platform.h b/include/platform.h index f4deb30c0..917d87dd6 100644 --- a/include/platform.h +++ b/include/platform.h | |||
@@ -263,6 +263,12 @@ typedef unsigned smalluint; | |||
263 | 263 | ||
264 | #define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) | 264 | #define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) |
265 | 265 | ||
266 | #ifdef __UCLIBC__ | ||
267 | # define UCLIBC_VERSION KERNEL_VERSION(__UCLIBC_MAJOR__, __UCLIBC_MINOR__, __UCLIBC_SUBLEVEL__) | ||
268 | #else | ||
269 | # define UCLIBC_VERSION 0 | ||
270 | #endif | ||
271 | |||
266 | 272 | ||
267 | /* ---- Miscellaneous --------------------------------------- */ | 273 | /* ---- Miscellaneous --------------------------------------- */ |
268 | 274 | ||
@@ -305,8 +311,9 @@ typedef unsigned smalluint; | |||
305 | * for a mmu-less system. | 311 | * for a mmu-less system. |
306 | */ | 312 | */ |
307 | #if ENABLE_NOMMU || \ | 313 | #if ENABLE_NOMMU || \ |
308 | (defined __UCLIBC__ && __UCLIBC_MAJOR__ >= 0 && __UCLIBC_MINOR__ >= 9 && \ | 314 | (defined __UCLIBC__ && \ |
309 | __UCLIBC_SUBLEVEL__ > 28 && !defined __ARCH_USE_MMU__) | 315 | UCLIBC_VERSION > KERNEL_VERSION(0, 9, 28) && \ |
316 | !defined __ARCH_USE_MMU__) | ||
310 | # define BB_MMU 0 | 317 | # define BB_MMU 0 |
311 | # define USE_FOR_NOMMU(...) __VA_ARGS__ | 318 | # define USE_FOR_NOMMU(...) __VA_ARGS__ |
312 | # define USE_FOR_MMU(...) | 319 | # define USE_FOR_MMU(...) |
@@ -373,13 +380,8 @@ typedef unsigned smalluint; | |||
373 | #define HAVE_NET_ETHERNET_H 1 | 380 | #define HAVE_NET_ETHERNET_H 1 |
374 | #define HAVE_SYS_STATFS_H 1 | 381 | #define HAVE_SYS_STATFS_H 1 |
375 | 382 | ||
376 | #if defined(__UCLIBC_MAJOR__) | 383 | #if defined(__UCLIBC__) && UCLIBC_VERSION < KERNEL_VERSION(0, 9, 32) |
377 | # if __UCLIBC_MAJOR__ == 0 \ | 384 | # undef HAVE_STRVERSCMP |
378 | && ( __UCLIBC_MINOR__ < 9 \ | ||
379 | || (__UCLIBC_MINOR__ == 9 && __UCLIBC_SUBLEVEL__ < 32) \ | ||
380 | ) | ||
381 | # undef HAVE_STRVERSCMP | ||
382 | # endif | ||
383 | #endif | 385 | #endif |
384 | 386 | ||
385 | #if defined(__dietlibc__) | 387 | #if defined(__dietlibc__) |
diff --git a/networking/ether-wake.c b/networking/ether-wake.c index bf09cd529..2d389ea30 100644 --- a/networking/ether-wake.c +++ b/networking/ether-wake.c | |||
@@ -121,10 +121,7 @@ static void get_dest_addr(const char *hostid, struct ether_addr *eaddr) | |||
121 | eap = ether_aton_r(hostid, eaddr); | 121 | eap = ether_aton_r(hostid, eaddr); |
122 | if (eap) { | 122 | if (eap) { |
123 | bb_debug_msg("The target station address is %s\n\n", ether_ntoa(eap)); | 123 | bb_debug_msg("The target station address is %s\n\n", ether_ntoa(eap)); |
124 | #if !defined(__UCLIBC_MAJOR__) \ | 124 | #if !defined(__UCLIBC__) || UCLIBC_VERSION >= KERNEL_VERSION(0, 9, 30) |
125 | || __UCLIBC_MAJOR__ > 0 \ | ||
126 | || __UCLIBC_MINOR__ > 9 \ | ||
127 | || (__UCLIBC_MINOR__ == 9 && __UCLIBC_SUBLEVEL__ >= 30) | ||
128 | } else if (ether_hostton(hostid, eaddr) == 0) { | 125 | } else if (ether_hostton(hostid, eaddr) == 0) { |
129 | bb_debug_msg("Station address for hostname %s is %s\n\n", hostid, ether_ntoa(eaddr)); | 126 | bb_debug_msg("Station address for hostname %s is %s\n\n", hostid, ether_ntoa(eaddr)); |
130 | #endif | 127 | #endif |