From: Natanael Copa Date: Tue, 4 Mar 2014 12:32:34 +0000 (+0000) Subject: build: detect wordsize in a portable way X-Git-Tag: v4.1~2256^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=edf9edf5a14ae282b8ef1fff514347964714431a;p=thirdparty%2Ftvheadend.git build: detect wordsize in a portable way There are no standard that says that __WORDSIZE should be defined or in what include file. So in case its not defined we fallback to a POSIX compliant way to determine wordsize. This fixes build with 64 bit musl libc. See https://tvheadend.org/issues/1983 --- diff --git a/src/tvheadend.h b/src/tvheadend.h index 218ac5db7..a52185100 100644 --- a/src/tvheadend.h +++ b/src/tvheadend.h @@ -31,6 +31,7 @@ #include #include #include +#include #if ENABLE_LOCKOWNER #include #endif @@ -611,6 +612,14 @@ qsort_r(void *base, size_t nmemb, size_t size, #endif /* ENABLE_QSORT_R */ /* printing */ +#ifndef __WORDSIZE +# if ULONG_MAX == 0xffffffffffffffff +# define __WORDSIZE 64 +# elif ULONG_MAX == 0xffffffff +# define __WORDSIZE 32 +# endif /* ULONG_MAX */ +#endif /* __WORDSIZE */ + # if __WORDSIZE == 64 #define PRIsword_t PRId64 #define PRIuword_t PRIu64