summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2012-06-26 07:50:41 -0700
committerAllen Martin <amartin@nvidia.com>2012-06-26 18:04:53 -0700
commitf60b9d2aee60f48ca358a0cedf266580b8c4659e (patch)
treefb611c0638514d97a3b3dc54250bc91e010349ba
parent37eb31de9a5e55006f4bdaf4bbc9926b999692a7 (diff)
downloadtegrarcm-f60b9d2aee60f48ca358a0cedf266580b8c4659e.tar.gz
use pkg-config for libusb-1.0 look up
More friendly to exotic libusb setups. Signed-off-by: Mike Frysinger <vapier@gentoo.org> Change-Id: I36f54f2a6e36773c8cf213c56deea053b1f81083 Reviewed-on: http://git-master/r/111408 Reviewed-by: Allen Martin <amartin@nvidia.com> Tested-by: Allen Martin <amartin@nvidia.com>
-rw-r--r--configure.ac6
-rw-r--r--src/Makefile.am7
-rw-r--r--src/usb.c2
-rw-r--r--src/usb.h2
4 files changed, 7 insertions, 10 deletions
diff --git a/configure.ac b/configure.ac
index 6aebd33..0736a80 100644
--- a/configure.ac
+++ b/configure.ac
@@ -10,16 +10,14 @@ AC_CONFIG_HEADERS([config.h])
# Checks for programs.
AC_PROG_CXX
AC_PROG_CC
+PKG_PROG_PKG_CONFIG
# Checks for libraries.
AC_CHECK_LIB([pthread],
[pthread_create],
[HAVE_PTHREAD=1],
[AC_MSG_ERROR([libpthread is not installed.])])
-AC_CHECK_LIB([usb-1.0],
- [libusb_init],
- [HAVE_USB=1],
- [AC_MSG_ERROR([libusb-1.0 is not installed.])])
+PKG_CHECK_MODULES([LIBUSB], [libusb-1.0])
AC_LANG(C++)
SAVED_LDFLAGS=$LDFLAGS
LDFLAGS="$LDFLAGS -lcryptopp"
diff --git a/src/Makefile.am b/src/Makefile.am
index 647bdf1..108ea01 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,7 +1,6 @@
-AM_CFLAGS = -Wall -std=c99 -O2
-AM_CPPFLAGS = -isystem /usr/include/$(CRYPTOLIB)
+AM_CFLAGS = -Wall -std=c99
+AM_CPPFLAGS = -isystem /usr/include/$(CRYPTOLIB) $(LIBUSB_CFLAGS)
bin_PROGRAMS = tegrarcm
tegrarcm_SOURCES = main.c usb.c nv3p.c debug.c rcm.c aes-cmac.cpp aes-cmac.h debug.h nv3p.h nv3p_status.h rcm.h tegra20-miniloader.h tegra30-miniloader.h usb.h
-tegrarcm_LDADD = -lusb-1.0 -l$(CRYPTOLIB) -lpthread
-
+tegrarcm_LDADD = $(LIBUSB_LIBS) -l$(CRYPTOLIB) -lpthread
diff --git a/src/usb.c b/src/usb.c
index 4326e20..0f791ee 100644
--- a/src/usb.c
+++ b/src/usb.c
@@ -29,7 +29,7 @@
#include <stdlib.h>
#include <errno.h>
#include <string.h>
-#include <libusb-1.0/libusb.h>
+#include <libusb.h>
#include <sys/param.h>
#include "usb.h"
#include "debug.h"
diff --git a/src/usb.h b/src/usb.h
index 1f29b7d..18f14cf 100644
--- a/src/usb.h
+++ b/src/usb.h
@@ -29,7 +29,7 @@
#ifndef USB_H
#define USB_H
-#include <libusb-1.0/libusb.h>
+#include <libusb.h>
#define USB_VENID_NVIDIA 0x955
#define USB_DEVID_NVIDIA_TEGRA20 0x20