Initial suppor for --with-libftdi/etc. options to configure, and linking with FTDI FTD2XX library in Cygwin

git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@839 b68d4a1b-bc3d-0410-92ed-d4ac073336b7
master
Kolja Waschk 17 years ago
parent d92f9e3e6e
commit 084a0943a1

@ -1,3 +1,10 @@
2007-12-14 Kolja Waschk <kawk>
* README, doc/UrJTAG.txt: pointer to http://www.urjtag.org
* configure.ac, src/Makefile.am, src/tap/parport/ftd2xx.c:
Changes to allow linking against FTDI FTD2XX in Cygwin, initial
support for --with-(libftdi|libusb|ftd2xx) configure options
2007-12-13 Kolja Waschk <kawk>
* configure.ac: Run "svn info" with "-R" to get latest revision

@ -174,43 +174,103 @@ AC_CHECK_HEADERS(linux/ppdev.h)
VL_LIB_READLINE
dnl check for libftdi-config
AC_PATH_PROG(HAVELIBFTDI, libftdi-config, no)
if test "$HAVELIBFTDI" != "no" ; then
dnl LIBFTDI_CFLAGS=`$HAVELIBFTDI --cflags`
AM_CONDITIONAL(HAVE_LIBFTDI, true)
LIBFTDI_LIBS=`$HAVELIBFTDI --libs`
CFLAGS="$CFLAGS $LIBFTDI_CFLAGS"
LIBS="$LIBS $LIBFTDI_LIBS"
AC_DEFINE(HAVE_LIBFTDI, 1, [Define if you have libftdi])
else
AM_CONDITIONAL(HAVE_LIBFTDI, false)
AC_MSG_WARN([*** libftdi-config not found. No support for FTDI-based USB JTAG cables via libftdi.])
fi
AC_ARG_WITH([libftdi],
[AS_HELP_STRING([--with-libftdi],
[use libftdi for FTDI-based cables])],
[], [with_libftdi=check])
AS_IF([test "x$with_libftdi" == xyes -o "x$with_libftdi" = xcheck], [
AC_PATH_PROG(HAVELIBFTDI, libftdi-config, no)
AS_IF([test "$HAVELIBFTDI" != "no" ],[
dnl LIBFTDI_CFLAGS=`$HAVELIBFTDI --cflags`
AM_CONDITIONAL(HAVE_LIBFTDI, true)
LIBFTDI_LIBS=`$HAVELIBFTDI --libs`
CFLAGS="$CFLAGS $LIBFTDI_CFLAGS"
LIBS="$LIBS $LIBFTDI_LIBS"
AC_DEFINE(HAVE_LIBFTDI, 1, [Define if you have libftdi])
],[
AM_CONDITIONAL(HAVE_LIBFTDI, false)
AC_MSG_WARN([*** libftdi-config not found. No support for FTDI-based USB JTAG cables via libftdi.])
])
],[
AS_IF([test "x$with_libftdi" != xno], [
AM_CONDITIONAL(HAVE_LIBFTDI, true)
CFLAGS="$CFLAGS -I$with_libftdi -L$with_libftdi"
LIBS="$LIBS -lftdi"
AC_DEFINE(HAVE_LIBFTDI, 1, [Define if you have libftdi])
],[
AM_CONDITIONAL(HAVE_LIBFTDI, false)
])
])
dnl check for libusb-config
AC_PATH_PROG(HAVELIBUSB, libusb-config, no)
if test "$HAVELIBUSB" != "no" ; then
dnl LIBUSB_CFLAGS=`$HAVELIBUSB --cflags`
AM_CONDITIONAL(HAVE_LIBUSB, true)
LIBUSB_LIBS=`$HAVELIBUSB --libs`
CFLAGS="$CFLAGS $LIBUSB_CFLAGS"
LIBS="$LIBS $LIBUSB_LIBS"
AC_DEFINE(HAVE_LIBUSB, 1, [Define if you have libusb])
else
AM_CONDITIONAL(HAVE_LIBUSB, false)
AC_MSG_WARN([*** libusb-config not found. Omitting support for some USB JTAG cables.])
fi
dnl check for availability of libftd2xx
AC_CHECK_LIB([ftd2xx], [FT_Open], [
AM_CONDITIONAL(HAVE_LIBFTD2XX, true)
AC_DEFINE(HAVE_LIBFTD2XX, 1, [define if you have libftd2xx])
LIBS="-lftd2xx $LIBS"
AC_ARG_WITH([libusb],
[AS_HELP_STRING([--with-libusb],
[use libusb for some USB JTAG cables])],
[], [with_libusb=check])
AS_IF([test "x$with_libusb" == xyes -o "x$with_libusb" == xcheck], [
AC_PATH_PROG(HAVELIBUSB, libusb-config, no)
AS_IF([test "$HAVELIBUSB" != "no"],[
dnl LIBUSB_CFLAGS=`$HAVELIBUSB --cflags`
AM_CONDITIONAL(HAVE_LIBUSB, true)
LIBUSB_LIBS=`$HAVELIBUSB --libs`
CFLAGS="$CFLAGS $LIBUSB_CFLAGS"
LIBS="$LIBS $LIBUSB_LIBS"
AC_DEFINE(HAVE_LIBUSB, 1, [Define if you have libusb])
],[
AM_CONDITIONAL(HAVE_LIBUSB, false)
AC_MSG_WARN([*** libusb-config not found. Omitting support for some USB JTAG cables.])
])
],[
AS_IF([test "x$with_libusb" != xno], [
AM_CONDITIONAL(HAVE_LIBUSB, true)
CFLAGS="$CFLAGS -I$with_libusb -L$with_libusb"
LIBS="$LIBS -lusb"
AC_DEFINE(HAVE_LIBUSB, 1, [Define if you have libusb])
],[
AM_CONDITIONAL(HAVE_LIBUSB, false)
])
])
dnl Use FTDI ftd2xx library?
AC_ARG_WITH([ftd2xx],
[AS_HELP_STRING([--with-ftd2xx],
[use ftd2xx library for FTDI-based cables])],
[], [with_ftd2xx=check])
FTD2XXLIB=
AS_IF([test "x$with_ftd2xx" == xyes -o "x$with_ftd2xx" = xcheck], [
AC_CHECK_LIB([ftd2xx], [FT_Open], [
AM_CONDITIONAL(HAVE_LIBFTD2XX, true)
AC_DEFINE(HAVE_LIBFTD2XX, 1, [define if you have libftd2xx])
LIBS="-lftd2xx $LIBS"
],[
AM_CONDITIONAL(HAVE_LIBFTD2XX, false)
AC_MSG_WARN([*** libftd2xx not found. No support for FTDI-based USB JTAG cables via libftd2xx.])
])
],[
AM_CONDITIONAL(HAVE_LIBFTD2XX, false)
AC_MSG_WARN([*** libftd2xx not found. No support for FTDI-based USB JTAG cables via libftd2xx.])
AS_IF([test "x$with_ftd2xx" != xno], [
AM_CONDITIONAL(HAVE_LIBFTD2XX, true)
AC_DEFINE(HAVE_LIBFTD2XX, 1, [define if you have libftd2xx])
case $host in
*cygwin*)
CFLAGS="$CFLAGS -I$with_ftd2xx"
FTD2XXLIB="$with_ftd2xx/ftd2xx.lib"
;;
*)
CFLAGS="$CFLAGS -I$with_ftd2xx -L$with_ftd2xx"
LIBS="-lftd2xx $LIBS"
;;
esac
],[
AM_CONDITIONAL(HAVE_LIBFTD2XX, false)
])
])
AC_SUBST(FTD2XXLIB)
CFLAGS="$CFLAGS -Wall"
CPPFLAGS="$CPPFLAGS -I\$(top_srcdir) -I\$(top_srcdir)/include"

@ -65,6 +65,7 @@ jtag_LDADD = \
-Lbus -lbus \
-Lsvf -lsvf \
-lm \
@FTD2XXLIB@ \
@LIBINTL@
localedir = $(datadir)/locale

@ -30,9 +30,13 @@
#include "sysdep.h"
#include <fcntl.h>
#include <stropts.h>
#include <unistd.h>
#if __CYGWIN__
#include <windows.h>
#else
#include <stropts.h>
#include <linux/ioctl.h>
#endif
#include <stdlib.h>
#include <string.h>
@ -207,9 +211,11 @@ ftd2xx_generic_open( parport_t *parport )
ftd2xx_params_t *p = parport->params;
FT_STATUS status;
#if !__CYGWIN__
/* Add non-standard Vid/Pid to the linux driver */
if ((status = FT_SetVIDPID(p->vendor_id, p->product_id)) != FT_OK)
fprintf( stderr, "Warning: couldn't add %4.4x:%4.4x", p->vendor_id, p->product_id );
#endif
if ((status = FT_Open(0, &(p->fc))) != FT_OK) {
fprintf( stderr, "Error: unable to open FTDI device: %li\n", status);

Loading…
Cancel
Save