1 From 8002a7e6fa965dfd304d098fbc64b0f1a6e3b465 Mon Sep 17 00:00:00 2001
2 From: Romain Naour <romain.naour@openwide.fr>
3 Date: Sun, 24 Aug 2014 22:34:29 +0200
4 Subject: [PATCH 1/1] configure: add pkg-config support
6 The static linking doesn't works with libusb-compat when using libusb-config.
7 Also the CFLAGS initialization with libusb-config --cflags is comented out.
9 Based on libftdi's patch, add the support for pkg-config to link sispmctl
12 This allow to add correct include directory to CFLAGS
13 (Add -I$(STAGING_DIR)/usr/include and -I$(STAGING_DIR)/usr/include/libusb-1.0)
14 Also add needed libraries during static linking (-lusb -lusb-1.0 and -pthread)
16 Signed-off-by: Romain Naour <romain.naour@openwide.fr>
18 configure.in | 36 +++++++++++-------------------------
19 1 file changed, 11 insertions(+), 25 deletions(-)
21 diff --git a/configure.in b/configure.in
22 index 08d39ea..65d0c1d 100644
25 @@ -23,31 +23,17 @@ AC_SUBST(WEBDIR)
26 AC_ARG_WITH(bindaddr,[ --with-bindaddr=IP bind listening socket to IP], [BINDADDR="$withval"])
30 -# Checks for libraries.
31 -dnl check for libusb-config
32 -AC_PATH_PROG(HAVELIBUSB, libusb-config, $PATH)
34 -if test -e "$HAVELIBUSB"; then
35 - dnl LIBUSB_CFLAGS=`$HAVELIBUSB --cflags`
36 - LIBUSB_LIBS=`$HAVELIBUSB --libs`
37 - CFLAGS="$CFLAGS $LIBUSB_CFLAGS"
38 - LIBS="$LIBS $LIBUSB_LIBS"
40 - AC_MSG_ERROR([*** libusb-config not found. You need a working libusb installation. Version >=0.1.7])
43 -dnl check for version of libusb
44 -AC_MSG_CHECKING([if libusb version is >= 0.1.9])
45 -libusb_version_needed="1009"
46 -libusb_version=`$HAVELIBUSB --version | sed -e "s/libusb //" | awk 'BEGIN { FS = "."; } { printf "%d", ($''1 * 1000 + $''2) * 1000 + $''3;}'`
48 -if test $libusb_version -lt $libusb_version_needed; then
50 - AC_MSG_ERROR([*** libusb is too old ($libusb_version). You need a libusb installation newer or equal to 0.1.9.])
55 +PKG_CHECK_MODULES(LIBUSB, libusb >= 0.1.11)
56 +CFLAGS="$CFLAGS $LIBUSB_CFLAGS"
57 +LIBS="$LIBS $LIBUSB_LIBS"
59 +dnl Check for recent pkg-config which supports Requires.private
60 +case `$PKG_CONFIG --version` in
61 +0.?|0.1[0-7]) PKGCONFIG_REQUIRES="Requires"; ;;
62 +*) PKGCONFIG_REQUIRES="Requires.private"; ;;
64 +AC_SUBST(PKGCONFIG_REQUIRES)
66 # Checks for header files.