File: 0014-Build-Don-t-use-pkg-config-for-libusb-freebsd-buildf.patch

package info (click to toggle)
lirc 0.9.4c-9
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 8,264 kB
  • ctags: 5,536
  • sloc: ansic: 26,459; cpp: 9,138; sh: 5,492; python: 2,996; makefile: 873; xml: 63
file content (134 lines) | stat: -rw-r--r-- 3,371 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
From 3e1045c6be76a0cec6f1aec4ef4afa71d04e442f Mon Sep 17 00:00:00 2001
From: Alec Leamas <leamas.alec@gmail.com>
Date: Wed, 9 Nov 2016 11:09:54 +0100
Subject: [PATCH] Build: Don't use pkg-config for libusb (freebsd buildfix).

---
 configure.ac       | 20 +++++++++++++-------
 lib/lirc_driver.h  |  5 +++++
 lib/lirc_private.h |  5 +++++
 plugins/ftdi.c     |  9 ++++++++-
 plugins/ftdix.c    |  9 ++++++++-
 5 files changed, 39 insertions(+), 9 deletions(-)

diff --git a/configure.ac b/configure.ac
index d79b82e..88a4c38 100644
--- a/configure.ac
+++ b/configure.ac
@@ -228,14 +228,20 @@ AH_TEMPLATE([HAVE_LIBUDEV_H],
 AH_TEMPLATE([HAVE_UTIL_H],
         [Define if util.h is installed])
 
+AH_TEMPLATE([HAVE_USB_H],
+        [Define if usb.h is installed])
+
+AH_TEMPLATE([HAVE_LIBUSB_H],
+        [Define if libusb.h is installed])
+
+AH_TEMPLATE([HAVE_LIBUSB_1_0_LIBUSB_H],
+        [Define if libusb-1.0/libusb.h is installed])
+
+AC_CHECK_HEADERS([usb.h libusb-1.0/libusb.h libusb.h])
+AC_CHECK_LIB([usb],[usb_get_string],[usb_libs="-lusb"],,)
+AM_CONDITIONAL([BUILD_USB],[test x$usb_libs != x])
+AC_CHECK_LIB([usb-1.0],[libusb_lock_events],[usb_libs="$usb_libs -lusb-1.0"],,)
 
-AC_CHECK_HEADER(usb.h,[
-  AC_DEFINE(HAVE_LIBUSB)
-  AM_CONDITIONAL([BUILD_USB],[true])
-  usb_libs=`${LIBUSB_CONFIG} --libs`
-  ],[
-  AM_CONDITIONAL([BUILD_USB],[false])]
-)
 
 PKG_CHECK_MODULES([FTDI],[libftdi >= 1.0],,[true])
 test -z "$FTDI_LIBS" && PKG_CHECK_MODULES([FTDI], [libftdi1 >= 1.0],,[true])
diff --git a/lib/lirc_driver.h b/lib/lirc_driver.h
index 71231df..4ca1524 100644
--- a/lib/lirc_driver.h
+++ b/lib/lirc_driver.h
@@ -13,6 +13,11 @@
 
 #define IN_DRIVER
 
+#ifndef __u32
+#include <stdint.h>
+#define __u32 uint32_t
+#endif
+
 #include "lirc/ir_remote_types.h"
 #include "lirc/lirc_log.h"
 #include "lirc/driver.h"
diff --git a/lib/lirc_private.h b/lib/lirc_private.h
index 2336c0a..e4f615b 100644
--- a/lib/lirc_private.h
+++ b/lib/lirc_private.h
@@ -13,6 +13,11 @@
 #ifndef _LIRC_PRIVATE_H
 #define _LIRC_PRIVATE_H
 
+#ifndef __u32
+#include <stdint.h>
+#define __u32 uint32_t
+#endif
+
 #ifdef HAVE_KERNEL_LIRC_H
 #include <linux/lirc.h>
 #else
diff --git a/plugins/ftdi.c b/plugins/ftdi.c
index 4ef7f27..0d3b527 100644
--- a/plugins/ftdi.c
+++ b/plugins/ftdi.c
@@ -31,6 +31,14 @@
 # include <config.h>
 #endif
 
+#if defined (HAVE_LIBUSB_1_0_LIBUSB_H)
+#include <libusb-1.0/libusb.h>
+#elif defined (HAVE_LIBUSB_H)
+#include <libusb.h>
+#else
+#error Cannot find required libusb.h header
+#endif
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
@@ -38,7 +46,6 @@
 #include <sys/wait.h>
 #include <sys/socket.h>
 #include <fcntl.h>
-#include <libusb-1.0/libusb.h>
 #include <netinet/in.h>
 #include <errno.h>
 #include <glob.h>
diff --git a/plugins/ftdix.c b/plugins/ftdix.c
index c6c2198..cd15f5d 100644
--- a/plugins/ftdix.c
+++ b/plugins/ftdix.c
@@ -31,6 +31,14 @@
 # include <config.h>
 #endif
 
+#if defined (HAVE_LIBUSB_1_0_LIBUSB_H)
+#include <libusb-1.0/libusb.h>
+#elif defined (HAVE_LIBUSB_H)
+#include <libusb.h>
+#else
+#error Cannot find required libusb.h header
+#endif
+
 #include <assert.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -39,7 +47,6 @@
 #include <sys/wait.h>
 #include <sys/socket.h>
 #include <fcntl.h>
-#include <libusb-1.0/libusb.h>
 #include <netinet/in.h>
 #include <errno.h>
 #include <glob.h>
-- 
2.5.5