hc
2023-11-20 2e7bd41e4e8ab3d1efdabd9e263a2f7fe79bff8c
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
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