xref: /OK3568_Linux_fs/buildroot/package/hplip/0001-build-use-pkg-config-to-discover-libusb.patch (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1From 1eed2b65eff4c66b80eab0ec46c6705de19bdb9d Mon Sep 17 00:00:00 2001
2From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
3Date: Thu, 21 Jan 2016 23:54:03 +0100
4Subject: [PATCH] build: use pkg-config to discover libusb
5
6This allows to remove hardcoded paths to libusb headers.
7
8Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
9---
10 Makefile.am  | 4 ++--
11 configure.in | 3 +--
12 2 files changed, 3 insertions(+), 4 deletions(-)
13
14diff --git a/Makefile.am b/Makefile.am
15index 73fed2e..3a4e899 100644
16--- a/Makefile.am
17+++ b/Makefile.am
18@@ -92,8 +92,8 @@ libhpmud_la_SOURCES += io/hpmud/musb_libusb01.c
19 libhpmud_la_LDFLAGS += -lusb
20 else
21 libhpmud_la_SOURCES += io/hpmud/musb.c
22-libhpmud_la_CFLAGS  += -I/usr/include/libusb-1.0
23-libhpmud_la_LDFLAGS += -lusb-1.0
24+libhpmud_la_CFLAGS  += $(LIBUSB_CFLAGS)
25+libhpmud_la_LDFLAGS += $(LIBUSB_LIBS)
26 endif
27
28 if NETWORK_BUILD
29diff --git a/configure.in b/configure.in
30index 3706645..8b06428 100755
31--- a/configure.in
32+++ b/configure.in
33@@ -542,8 +542,7 @@ if test "$hpijs_only_build" = "no" && test "$hpcups_only_build" = "no"; then
34       AC_CHECK_LIB([usb], [usb_init], [LIBS="$LIBS"], [AC_MSG_ERROR([cannot find libusb support], 2)])
35       AC_CHECK_HEADERS(usb.h, ,[AC_MSG_ERROR([cannot find libusb-devel support], 11)])
36    else
37-      AC_CHECK_LIB([usb-1.0], [libusb_init], [LIBS="$LIBS"], [AC_MSG_ERROR([cannot find libusb 1.0 support], 2)])
38-      AC_CHECK_HEADERS(libusb-1.0/libusb.h, ,[AC_MSG_ERROR([cannot find libusb-1.0-devel support], 11)])
39+      PKG_CHECK_MODULES([LIBUSB], [libusb-1.0])
40    fi
41 fi
42
43--
442.6.4
45
46