From: Jaroslav Kysela Date: Wed, 5 Apr 2017 10:49:13 +0000 (+0200) Subject: compat: add compatibility code for old PPC build X-Git-Tag: v4.2.1~35 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ef1d24ead08309b8f966fb234818779f6db5627c;p=thirdparty%2Ftvheadend.git compat: add compatibility code for old PPC build --- diff --git a/configure b/configure index 40f3c2cfa..3b8b12420 100755 --- a/configure +++ b/configure @@ -287,6 +287,15 @@ int test(void) } ' +check_cc_snippet llabs ' +#include +int test(void) +{ + llabs(-10); + return 0; +} +' + # # Python # @@ -549,6 +558,14 @@ fi if enabled_or_auto inotify; then if check_cc_header "sys/inotify" inotify_h; then enable inotify + check_cc_snippet inotify_init1 ' + #include + int test(void) + { + inotify_init1(IN_CLOEXEC); + return 0; + } + ' elif enabled inotify; then die "Inotify support not found (use --disable-inotify)" fi @@ -601,6 +618,14 @@ fi # if [ ${PLATFORM} = "linux" ]; then enable epoll + check_cc_snippet epoll_create1 ' + #include + int test(void) + { + epoll_create1(EPOLL_CLOEXEC); + return 0; + } + ' fi # diff --git a/src/compat.h b/src/compat.h index a58c34870..3b31ad520 100644 --- a/src/compat.h +++ b/src/compat.h @@ -15,8 +15,8 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -#ifndef COMPAT_H -#define COMPAT_H +#ifndef TVH_COMPAT_H +#define TVH_COMPAT_H #if ENABLE_ANDROID #ifndef strdupa @@ -35,14 +35,25 @@ #define pthread_yield() sched_yield() #endif #define S_IEXEC S_IXUSR -#define epoll_create1(EPOLL_CLOEXEC) epoll_create(n) -#define inotify_init1(IN_CLOEXEC) inotify_init() #include // 32-bit Android has only timegm64() and not timegm(). // We replicate the behaviour of timegm() when the result overflows time_t. #endif /* ENABLE_ANDROID */ +#ifndef ENABLE_EPOLL_CREATE1 +#define epoll_create1(EPOLL_CLOEXEC) epoll_create(n) +#endif +#ifndef ENABLE_INOTIFY_INIT1 +#define inotify_init1(IN_CLOEXEC) inotify_init() +#endif +#ifndef ENABLE_LLABS +static inline long long int llabs(long long int a) +{ + if (a < 0) return -a; else return a; +} +#endif + #ifdef COMPAT_IPTOS #ifndef IPTOS_DSCP_MASK @@ -88,4 +99,4 @@ #endif /* COMPAT_IPTOS */ -#endif /* COMPAT_H */ +#endif /* TVH_COMPAT_H */ diff --git a/src/dvr/dvr_db.c b/src/dvr/dvr_db.c index 6bb59d31d..61a920f86 100644 --- a/src/dvr/dvr_db.c +++ b/src/dvr/dvr_db.c @@ -34,6 +34,7 @@ #include "imagecache.h" #include "access.h" #include "notify.h" +#include "compat.h" struct dvr_entry_list dvrentries; static int dvr_in_init;