Blob Blame History Raw
From f86da92490ff32465a1aba8754c0c856191e6907 Mon Sep 17 00:00:00 2001
From: Alec Leamas <leamas.alec@gmail.com>
Date: Sun, 23 Oct 2016 15:45:52 +0200
Subject: [PATCH 03/10] build: lirc.h: Configure includes in lirc.h (#234).

Fall back to sys/ioctl.h instead of linux/ioctl.h etc. on
non-linux platform i. e., MacOS.
---
 configure.ac         |  5 +++--
 include/media/lirc.h | 11 +++++++++++
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index 20933a8..cde9813 100644
--- a/configure.ac
+++ b/configure.ac
@@ -48,8 +48,9 @@ LIBUSB_CONFIG="pkg-config libusb"
 dnl Checks for header files.
 AC_HEADER_STDC
 AC_HEADER_TIME
-AC_CHECK_HEADERS([fcntl.h limits.h poll.h sys/ioctl.h sys/poll.h sys/time.h ])
-AC_CHECK_HEADERS([syslog.h unistd.h util.h libutil.h pty.h])
+AC_CHECK_HEADERS([fcntl.h limits.h linux/ioctl.h poll.h sys/ioctl.h \
+		  sys/poll.h sys/time.h syslog.h unistd.h util.h \
+		  libutil.h pty.h])

 dnl Checks for typedefs, structures, and compiler characteristics.
 AC_C_CONST
diff --git a/include/media/lirc.h b/include/media/lirc.h
index 991ab45..84af7ed 100644
--- a/include/media/lirc.h
+++ b/include/media/lirc.h
@@ -6,8 +6,19 @@
 #ifndef _LINUX_LIRC_H
 #define _LINUX_LIRC_H

+#include <config.h>
+
+#ifdef HAVE_LINUX_TYPES_H
 #include <linux/types.h>
+#else
+#include <sys/types.h>
+#endif
+
+#ifdef HAVE_LINUX_IOCTL_H
 #include <linux/ioctl.h>
+#else
+#include <sys/ioctl.h>
+#endif

 #define PULSE_BIT       0x01000000
 #define PULSE_MASK      0x00FFFFFF
--
2.5.5