]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
compat: add compatibility code for old PPC build
authorJaroslav Kysela <perex@perex.cz>
Wed, 5 Apr 2017 10:49:13 +0000 (12:49 +0200)
committerJaroslav Kysela <perex@perex.cz>
Wed, 5 Apr 2017 10:49:13 +0000 (12:49 +0200)
configure
src/compat.h
src/dvr/dvr_db.c

index 40f3c2cfa6589f88e6c9ede2f1c4e2e247743004..3b8b12420db8acfbe6219c3e73f49a7c89038c33 100755 (executable)
--- a/configure
+++ b/configure
@@ -287,6 +287,15 @@ int test(void)
 }
 '
 
+check_cc_snippet llabs '
+#include <stdlib.h>
+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 <sys/inotify.h>
+    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 <sys/epoll.h>
+  int test(void)
+  {
+    epoll_create1(EPOLL_CLOEXEC);
+    return 0;
+  }
+  '
 fi
 
 #
index a58c34870e2a8e3c77aae664ac3b01528029ec1a..3b31ad520f462cc044bde23e78449f4a6700bfe1 100644 (file)
@@ -15,8 +15,8 @@
  *  You should have received a copy of the GNU General Public License
  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
-#ifndef COMPAT_H
-#define COMPAT_H
+#ifndef TVH_COMPAT_H
+#define TVH_COMPAT_H
 
 #if ENABLE_ANDROID
 #ifndef strdupa
 #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 <time64.h>
 // 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 */
index 6bb59d31d544749758ece0b75812d807a498a4c9..61a920f86125ba991ab81d1b38ce419176e65262 100644 (file)
@@ -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;