aboutsummaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorMathias K <kesmtp@freenet.de>2013-10-30 16:52:10 +0100
committerSpencer Oliver <spen@spen-soft.co.uk>2013-12-22 20:22:37 +0000
commit23be4e435f8b61c4603bd7822b3fb3c2c46cb16a (patch)
treec751dafdc5bb9b38becf2f574a164a62338a8bd4 /configure.ac
parent0da3f66ed48d29be02af5e18496d383a7f8c66ba (diff)
downloadriscv-openocd-23be4e435f8b61c4603bd7822b3fb3c2c46cb16a.zip
riscv-openocd-23be4e435f8b61c4603bd7822b3fb3c2c46cb16a.tar.gz
riscv-openocd-23be4e435f8b61c4603bd7822b3fb3c2c46cb16a.tar.bz2
build: remove hard coded ftdi and usb libraries
This patch remove the hardcoded libraries. Also a check for libftdi1 installations was added. This check fix an issue with gentoo and maybe other systems. Change-Id: Ieff9ec4d66ee0f3e6b22261a10e4cab9f26b6b51 Signed-off-by: Mathias K <kesmtp@freenet.de> Reviewed-on: http://openocd.zylin.com/1759 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac19
1 files changed, 15 insertions, 4 deletions
diff --git a/configure.ac b/configure.ac
index a5abdfd..968e381 100644
--- a/configure.ac
+++ b/configure.ac
@@ -999,19 +999,29 @@ fi
if test $build_ft2232_libftdi = yes -o $build_usb_blaster_libftdi = yes -o \
$build_openjtag_ftdi = yes; then
- # We assume: the package is preinstalled in the proper place
- # these present as 2 libraries..
- LIBS="$LIBS -lftdi -lusb"
+
+ # we can have libftdi or libftdi1, so check it and use the latest one
+ PKG_CHECK_MODULES([LIBFTDI], [libftdi1], [use_libftdi=yes], [use_libftdi=no])
+ if test $use_libftdi = no; then
+ PKG_CHECK_MODULES([LIBFTDI], [libftdi], [use_libftdi=yes], [use_libftdi=no])
+ fi
+ if test $use_libftdi = no; then
+ AC_MSG_ERROR([The libftdi driver is not present on your system.])
+ fi
+
#
# Try to build a small program.
AC_MSG_CHECKING([Build & Link with libftdi...])
LDFLAGS_SAVE=$LDFLAGS
CFLAGS_SAVE=$CFLAGS
+ LIBS_SAVE=$LIBS
_LDFLAGS=`eval echo $LDFLAGS`
_CFLAGS=`eval echo $CFLAGS`
+ _LIBS=`eval echo $LIBS`
LDFLAGS=$_LDFLAGS
- CFLAGS=$_CFLAGS
+ CFLAGS="$_CFLAGS $LIBFTDI_CFLAGS"
+ LIBS="$_LIBS $LIBFTDI_LIBS"
AC_RUN_IFELSE([AC_LANG_PROGRAM([[
#include <stdio.h>
@@ -1075,6 +1085,7 @@ enum ftdi_chip_type x = TYPE_232H;
# Restore the 'unexpanded ldflags'
LDFLAGS=$LDFLAGS_SAVE
CFLAGS=$CFLAGS_SAVE
+ LIBS=$LIBS_SAVE
fi
PKG_CHECK_MODULES([LIBUSB1], [libusb-1.0], [