From 8fb3922219d3c6656b3902d6ae907de9e443797c Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Mon, 31 Aug 2015 07:34:51 +0000 Subject: [PATCH] isadump: Fix compilation under musl From Brendan Heading: You may be aware of the musl C-library implementation, which tries to be strictly standards compliant, avoids non-standard extensions, etc. Some distributions have adopted it as their standard C library, in others (such as buildroot) it is a configuration alternative. Vanilla lm-sensors does not compile under musl, due to the following excerpt which appears in four different places. The code is checking that the glibc version is greater than 2.0. #if defined(__GLIBC__) && __GLIBC__ == 2 && __GLIBC_MINOR__ >= 0 #include #else #include #endif This fails under musl does not define __GLIBC__ (in fact, by design, it doesn't provide any way to identify itself at all) - which causes it to try to include rather than . It's a long time since glibc 2.0.1 was released - 1997. Accordingly, it seems to make little sense at this stage to try to retain compatibility with very old libcs - so maybe it should be removed entirely. --- prog/dump/isadump.c | 9 +-------- prog/dump/isaset.c | 9 +-------- prog/dump/superio.c | 8 +------- prog/dump/util.c | 8 +------- 4 files changed, 4 insertions(+), 30 deletions(-) diff --git a/prog/dump/isadump.c b/prog/dump/isadump.c index e0e6f000..ef3dd0ae 100644 --- a/prog/dump/isadump.c +++ b/prog/dump/isadump.c @@ -29,6 +29,7 @@ isadump -f 0xecf0 0x10 1 PC87366, temperature channel 2 */ +#include #include #include #include @@ -36,14 +37,6 @@ #include "util.h" #include "superio.h" - -/* To keep glibc2 happy */ -#if defined(__GLIBC__) && __GLIBC__ == 2 && __GLIBC_MINOR__ >= 0 -#include -#else -#include -#endif - #ifdef __powerpc__ unsigned long isa_io_base = 0; /* XXX for now */ #endif /* __powerpc__ */ diff --git a/prog/dump/isaset.c b/prog/dump/isaset.c index e743755a..590f75c0 100644 --- a/prog/dump/isaset.c +++ b/prog/dump/isaset.c @@ -26,20 +26,13 @@ isaset -f 0x5010 0x12 Write 0x12 to location 0x5010 */ +#include #include #include #include #include #include "util.h" - -/* To keep glibc2 happy */ -#if defined(__GLIBC__) && __GLIBC__ == 2 && __GLIBC_MINOR__ >= 0 -#include -#else -#include -#endif - #ifdef __powerpc__ unsigned long isa_io_base = 0; /* XXX for now */ #endif /* __powerpc__ */ diff --git a/prog/dump/superio.c b/prog/dump/superio.c index 64ef27bf..dbcde7bf 100644 --- a/prog/dump/superio.c +++ b/prog/dump/superio.c @@ -19,14 +19,8 @@ MA 02110-1301 USA. */ -#include - -#if defined(__GLIBC__) && __GLIBC__ == 2 && __GLIBC_MINOR__ >= 0 #include -#else -#include -#endif - +#include #include "superio.h" int superio_parse_key(unsigned char *key, const char *s) diff --git a/prog/dump/util.c b/prog/dump/util.c index 874c1b9c..908b3733 100644 --- a/prog/dump/util.c +++ b/prog/dump/util.c @@ -8,16 +8,10 @@ (at your option) any later version. */ +#include #include #include "util.h" -/* To keep glibc2 happy */ -#if defined(__GLIBC__) && __GLIBC__ == 2 && __GLIBC_MINOR__ >= 0 -#include -#else -#include -#endif - /* Return 1 if we should continue, 0 if we should abort */ int user_ack(int def) {