0001-build-use-pkg-config-to-discover-libusb.patch 1.56 KB
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