From 70ff64e8bfd87f3b0397b9d977e0d44d09107323 Mon Sep 17 00:00:00 2001 From: Kolja Waschk Date: Tue, 13 Nov 2007 08:07:45 +0000 Subject: [PATCH] Fix [ 1828368 ] Compilation fails without libusb/libftdi git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@758 b68d4a1b-bc3d-0410-92ed-d4ac073336b7 --- jtag/configure.ac | 16 ++++++++++------ jtag/src/tap/Makefile.am | 19 ++++++++++++++----- jtag/src/tap/cable.c | 4 ++++ 3 files changed, 28 insertions(+), 11 deletions(-) diff --git a/jtag/configure.ac b/jtag/configure.ac index 5c4d7549..cd967e0b 100644 --- a/jtag/configure.ac +++ b/jtag/configure.ac @@ -99,27 +99,31 @@ AC_CHECK_HEADERS(linux/ppdev.h) VL_LIB_READLINE dnl check for libftdi-config -AC_PATH_PROG(HAVELIBFTDI, libftdi-config, $PATH) -if test ! -z "$HAVELIBFTDI"; then +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 - AC_MSG_ERROR([*** libftdi-config not found. You need a working libftdi installation.]) + AM_CONDITIONAL(HAVE_LIBFTDI, false) + AC_MSG_WARN([*** libftdi-config not found. No support for FTDI-based USB JTAG cables.]) fi dnl check for libusb-config -AC_PATH_PROG(HAVELIBUSB, libusb-config, $PATH) -if test ! -z "$HAVELIBUSB"; then +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 - AC_MSG_ERROR([*** libusb-config not found. You need a working libusb installation.]) + AM_CONDITIONAL(HAVE_LIBUSB, false) + AC_MSG_WARN([*** libusb-config not found. Omitting support for some USB JTAG cables.]) fi CFLAGS="$CFLAGS -Wall" diff --git a/jtag/src/tap/Makefile.am b/jtag/src/tap/Makefile.am index c8f809f9..6445564f 100644 --- a/jtag/src/tap/Makefile.am +++ b/jtag/src/tap/Makefile.am @@ -33,17 +33,12 @@ libtap_a_SOURCES = \ parport.c \ parport/direct.c \ parport/ppdev.c \ - parport/xpcu_common.c \ - parport/xpcu_pp.c \ - parport/ftdi.c \ cable.c \ cable/generic.h \ cable/generic.c \ cable/arcom.c \ cable/byteblaster.c \ - cable/usbblaster.c \ cable/dlc5.c \ - cable/xpc.c \ cable/ea253.c \ cable/ei012.c \ cable/keithkoep.c \ @@ -52,3 +47,17 @@ libtap_a_SOURCES = \ cable/triton.c \ cable/wiggler.c \ cable/wiggler2.c + +if HAVE_LIBUSB +libtap_a_SOURCES += \ + parport/xpcu_common.c \ + parport/xpcu_pp.c \ + cable/xpc.c +endif + +if HAVE_LIBFTDI +libtap_a_SOURCES += \ + parport/ftdi.c \ + cable/usbblaster.c +endif + diff --git a/jtag/src/tap/cable.c b/jtag/src/tap/cable.c index 75bdac87..6ce644a7 100644 --- a/jtag/src/tap/cable.c +++ b/jtag/src/tap/cable.c @@ -37,7 +37,9 @@ extern cable_driver_t arcom_cable_driver; extern cable_driver_t byteblaster_cable_driver; +#ifdef HAVE_LIBFTDI extern cable_driver_t usbblaster_cable_driver; +#endif extern cable_driver_t dlc5_cable_driver; extern cable_driver_t ea253_cable_driver; extern cable_driver_t ei012_cable_driver; @@ -57,7 +59,9 @@ extern cable_driver_t xpc_ext_cable_driver; cable_driver_t *cable_drivers[] = { &arcom_cable_driver, &byteblaster_cable_driver, +#ifdef HAVE_LIBFTDI &usbblaster_cable_driver, +#endif &dlc5_cable_driver, &ea253_cable_driver, &ei012_cable_driver,