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>
# Restore the 'unexpanded ldflags'
LDFLAGS=$LDFLAGS_SAVE
CFLAGS=$CFLAGS_SAVE
+ LIBS=$LIBS_SAVE
fi
PKG_CHECK_MODULES([LIBUSB1], [libusb-1.0], [
endif
# add default CPPFLAGS
-libopenocd_la_CPPFLAGS += $(AM_CPPFLAGS) $(CPPFLAGS)
+libopenocd_la_CPPFLAGS += $(AM_CPPFLAGS) $(CPPFLAGS) $(LIBFTDI_CFLAGS)
# the library search path.
libopenocd_la_LDFLAGS = $(all_libraries)
MINGWLDADD =
endif
-if FT2232_LIBFTDI
-FTDI2232LIB = -lftdi -lusb
-else
-if PRESTO_LIBFTDI
-FTDI2232LIB = -lftdi -lusb
-else
-FTDI2232LIB =
-endif
-endif
-
-LIBUSB =
-if USE_LIBUSB1
-LIBUSB += $(LIBUSB1_LIBS)
-endif
-
-if USE_LIBUSB0
-LIBUSB += $(LIBUSB0_LIBS)
-endif
-
libopenocd_la_LIBADD = \
$(top_builddir)/src/xsvf/libxsvf.la \
$(top_builddir)/src/svf/libsvf.la \
$(top_builddir)/src/server/libserver.la \
$(top_builddir)/src/rtos/librtos.la \
$(top_builddir)/src/helper/libhelper.la \
- $(FTDI2232LIB) $(MINGWLDADD) $(LIBUSB)
+ $(LIBFTDI_LIBS) $(MINGWLDADD) \
+ $(LIBUSB1_LIBS) $(LIBUSB0_LIBS)
STARTUP_TCL_SRCS = \
$(srcdir)/helper/startup.tcl \