aboutsummaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorPaul Fertser <fercerpav@gmail.com>2013-09-11 23:07:59 +0200
committerAndreas Fritiofson <andreas.fritiofson@gmail.com>2013-09-13 21:43:18 +0000
commit191a5736c202dfb784e86a8190edc64e80dc62e5 (patch)
treed56878000543ba0e217d6cce5953b9d18d1bc2a5 /configure.ac
parent10df176b0fb932d61f0dc5d6bfd0a0942501fc40 (diff)
libusb: require pkg-config support
An alternative approach to show how much cleaner the pure pkg-config way is. This changes the discovery procedures for libusb-1.0 and libusb-0.1, making them depend on pkg-config being properly installed and configured, including the necessary build host configuration for the cross-builds (see http://www.flameeyes.eu/autotools-mythbuster/pkgconfig/cross-compiling.html) It should make it possible to compile OpenOCD without changes and extra effort on GNU/Linux, FreeBSD users would need to supply a .pc file for their libusb implementation or add LIBUSB1_LIBS and LIBUSB1_CFLAGS to the configure environment. Change-Id: I826e378dd1e0d101a549a573b2c63212a7e00b64 Signed-off-by: Paul Fertser <fercerpav@gmail.com> Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Reviewed-on: http://openocd.zylin.com/1467 Reviewed-by: Xiaofan <xiaofanc@gmail.com> Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk> Tested-by: Spencer Oliver <spen@spen-soft.co.uk>
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac15
1 files changed, 7 insertions, 8 deletions
diff --git a/configure.ac b/configure.ac
index c7700dc3..7f49ba05 100644
--- a/configure.ac
+++ b/configure.ac
@@ -19,6 +19,7 @@ AC_PROG_CC
AC_PROG_CC_C99
AM_PROG_CC_C_O
AC_PROG_RANLIB
+PKG_PROG_PKG_CONFIG([0.23])
dnl disable checks for C++, Fortran and GNU Java Compiler
m4_defun([_LT_AC_LANG_CXX_CONFIG], [:])
@@ -1175,10 +1176,10 @@ fi
# check for libusb library if necessary
use_libusb1=no
if test $need_usb = yes -o $need_usb_ng = yes; then
- AC_CHECK_HEADER([libusb-1.0/libusb.h], [
- AC_DEFINE([HAVE_LIBUSB1], [1], [Define if you have libusb-1.x])
+ PKG_CHECK_MODULES([LIBUSB1], [libusb-1.0], [
use_libusb1=yes
- AC_SEARCH_LIBS([libusb_error_name], [usb-1.0],
+ AC_DEFINE([HAVE_LIBUSB1], [1], [Define if you have libusb-1.x])
+ PKG_CHECK_EXISTS([libusb-1.0 >= 1.0.9],
[AC_DEFINE([HAVE_LIBUSB_ERROR_NAME], [1], [Define if your libusb has libusb_error_name()])],
[AC_MSG_WARN([libusb-1.x older than 1.0.9 detected, consider updating])])
], [
@@ -1193,11 +1194,9 @@ fi
use_libusb0=no
if test $need_usb0 = yes; then
- AC_CHECK_HEADERS([usb.h], [
- use_libusb0=yes
- ], [
- AC_MSG_ERROR([libusb-0.1 is required to build some OpenOCD driver(s)])
- ])
+ PKG_CHECK_MODULES([LIBUSB0], [libusb], [use_libusb0=yes], [
+ AC_MSG_ERROR([libusb-0.1 is required to build some OpenOCD driver(s)])
+ ])
fi
AM_CONDITIONAL([RELEASE], [test $build_release = yes])