buildroot/package/hplip/0001-build-use-pkg-config-to-discover-libusb.patch
Thomas Petazzoni ffca78cbcd package/hplip: remove includedir hack
The 0001-fix-make.patch which was added to the hplip package to remove
hardcoded paths to the libusb header introduced a solution that isn't
correct. When cross-compiling, $(includedir) is ${prefix}/include (i.e
/usr/include), so it is not the location where headers can be
found. Due to this, hplip.mk was overriding the includedir value with
--includedir which is not correct.

To replace this mechanism, this commit changes the patch to instead
use pkg-config (which is already used in other places in hplip
configure.in) to detect libusb. This way, we can get rid of the hack
and get a proper detection of libusb.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2016-01-22 00:05:47 +01:00

46 lines
1.6 KiB
Diff

From 1eed2b65eff4c66b80eab0ec46c6705de19bdb9d Mon Sep 17 00:00:00 2001
From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Date: Thu, 21 Jan 2016 23:54:03 +0100
Subject: [PATCH] build: use pkg-config to discover libusb
This allows to remove hardcoded paths to libusb headers.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
Makefile.am | 4 ++--
configure.in | 3 +--
2 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index 73fed2e..3a4e899 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -92,8 +92,8 @@ libhpmud_la_SOURCES += io/hpmud/musb_libusb01.c
libhpmud_la_LDFLAGS += -lusb
else
libhpmud_la_SOURCES += io/hpmud/musb.c
-libhpmud_la_CFLAGS += -I/usr/include/libusb-1.0
-libhpmud_la_LDFLAGS += -lusb-1.0
+libhpmud_la_CFLAGS += $(LIBUSB_CFLAGS)
+libhpmud_la_LDFLAGS += $(LIBUSB_LIBS)
endif
if NETWORK_BUILD
diff --git a/configure.in b/configure.in
index 3706645..8b06428 100755
--- a/configure.in
+++ b/configure.in
@@ -542,8 +542,7 @@ if test "$hpijs_only_build" = "no" && test "$hpcups_only_build" = "no"; then
AC_CHECK_LIB([usb], [usb_init], [LIBS="$LIBS"], [AC_MSG_ERROR([cannot find libusb support], 2)])
AC_CHECK_HEADERS(usb.h, ,[AC_MSG_ERROR([cannot find libusb-devel support], 11)])
else
- AC_CHECK_LIB([usb-1.0], [libusb_init], [LIBS="$LIBS"], [AC_MSG_ERROR([cannot find libusb 1.0 support], 2)])
- AC_CHECK_HEADERS(libusb-1.0/libusb.h, ,[AC_MSG_ERROR([cannot find libusb-1.0-devel support], 11)])
+ PKG_CHECK_MODULES([LIBUSB], [libusb-1.0])
fi
fi
--
2.6.4