This is an automated email from Gerrit.

Andreas Fritiofson ([email protected]) just uploaded a new patch set 
to Gerrit, which you can find at http://openocd.zylin.com/3238

-- gerrit

commit 1bd1c1648d7485e49d98c4cd58e6e1e9d977d624
Author: Andreas Fritiofson <[email protected]>
Date:   Mon Feb 15 23:51:33 2016 +0100

    configure: Detect libftdi using pkgconfig
    
    Auto-enable libftdi adapter drivers if found, just like libusb and
    hidapi based adapters.
    
    Change-Id: I71a10c90c8b999c4cae9b4f8fb5e97971d03083b
    Signed-off-by: Andreas Fritiofson <[email protected]>

diff --git a/configure.ac b/configure.ac
index 4d88900..8363145 100644
--- a/configure.ac
+++ b/configure.ac
@@ -191,6 +191,10 @@ m4_define([USB0_ADAPTERS],
 m4_define([HIDAPI_ADAPTERS],
        [[[cmsis_dap], [CMSIS-DAP Compliant Debugger], [CMSIS_DAP]]])
 
+m4_define([LIBFTDI_ADAPTERS],
+       [[[usb_blaster], [Altera USB-Blaster Compatible], [USB_BLASTER]],
+       [[presto], [ASIX Presto Adapter], [PRESTO]],
+       [[openjtag], [OpenJTAG Adapter], [OPENJTAG]]])
 
 AC_ARG_ENABLE([doxygen-html],
   AS_HELP_STRING([--disable-doxygen-html],
@@ -292,7 +296,7 @@ m4_define([AC_ARG_ADAPTERS], [
   ])
 ])
 
-AC_ARG_ADAPTERS([USB1_ADAPTERS, USB_ADAPTERS, USB0_ADAPTERS, HIDAPI_ADAPTERS], 
[auto])
+AC_ARG_ADAPTERS([USB1_ADAPTERS, USB_ADAPTERS, USB0_ADAPTERS, HIDAPI_ADAPTERS, 
LIBFTDI_ADAPTERS], [auto])
 
 AC_ARG_ENABLE([parport],
   AS_HELP_STRING([--enable-parport], [Enable building the pc parallel port 
driver]),
@@ -312,10 +316,6 @@ AC_ARG_ENABLE([jtag_vpi],
   AS_HELP_STRING([--enable-jtag_vpi], [Enable building support for JTAG VPI]),
   [build_jtag_vpi=$enableval], [build_jtag_vpi=no])
 
-AC_ARG_ENABLE([usb_blaster_libftdi],
-  AS_HELP_STRING([--enable-usb_blaster_libftdi], [Enable building support for 
the Altera USB-Blaster using the libftdi driver]),
-  [build_usb_blaster=$enableval], [build_usb_blaster=no])
-
 AC_ARG_ENABLE([amtjtagaccel],
   AS_HELP_STRING([--enable-amtjtagaccel], [Enable building the Amontec 
JTAG-Accelerator driver]),
   [build_amtjtagaccel=$enableval], [build_amtjtagaccel=no])
@@ -358,14 +358,6 @@ AC_ARG_ENABLE([gw16012],
   AS_HELP_STRING([--enable-gw16012], [Enable building support for the 
Gateworks GW16012 JTAG Programmer]),
   [build_gw16012=$enableval], [build_gw16012=no])
 
-AC_ARG_ENABLE([presto_libftdi],
-  AS_HELP_STRING([--enable-presto_libftdi], [Enable building support for ASIX 
Presto Programmer using the libftdi library]),
-  [build_presto=$enableval], [build_presto=no])
-
-AC_ARG_ENABLE([openjtag_ftdi],
-  AS_HELP_STRING([--enable-openjtag_ftdi], [Enable building support for the 
OpenJTAG Programmer with libftdi library]),
-  [build_openjtag=$enableval], [build_openjtag=no])
-
 AC_ARG_ENABLE([oocd_trace],
   AS_HELP_STRING([--enable-oocd_trace],
   [Enable building support for some prototype OpenOCD+trace ETM capture 
hardware]),
@@ -578,12 +570,6 @@ else
   AC_DEFINE([BUILD_BITBANG], [0], [0 if you don't want a bitbang interface.])
 fi
 
-if test $build_usb_blaster = yes; then
-  AC_DEFINE([BUILD_USB_BLASTER], [1], [1 if you want libftdi usb_blaster.])
-else
-  AC_DEFINE([BUILD_USB_BLASTER], [0], [0 if you don't want libftdi 
usb_blaster.])
-fi
-
 if test $build_jtag_vpi = yes; then
   AC_DEFINE([BUILD_JTAG_VPI], [1], [1 if you want JTAG VPI.])
 else
@@ -602,26 +588,12 @@ else
   AC_DEFINE([BUILD_GW16012], [0], [0 if you don't want the Gateworks GW16012 
driver.])
 fi
 
-if test $build_presto = yes; then
-  build_bitq=yes
-  AC_DEFINE([BUILD_PRESTO], [1], [1 if you want the ASIX PRESTO driver using 
libftdi.])
-else
-  AC_DEFINE([BUILD_PRESTO], [0], [0 if you don't want the ASIX PRESTO driver 
using libftdi.])
-fi
-
 if test $build_bitq = yes; then
   AC_DEFINE([BUILD_BITQ], [1], [1 if you want a bitq interface.])
 else
   AC_DEFINE([BUILD_BITQ], [0], [0 if you don't want a bitq interface.])
 fi
 
-
-if test $build_openjtag = yes; then
-  AC_DEFINE([BUILD_OPENJTAG], [1], [1 if you want the OpenJTAG driver.])
-else
-  AC_DEFINE([BUILD_OPENJTAG], [0], [0 if you don't want the OpenJTAG driver.])
-fi
-
 if test $build_oocd_trace = yes; then
   AC_DEFINE([BUILD_OOCD_TRACE], [1], [1 if you want the OpenOCD+trace ETM 
capture driver.])
 else
@@ -669,77 +641,6 @@ else
   AC_DEFINE([BUILD_SYSFSGPIO], [0], [0 if you don't want SysfsGPIO driver.])
 fi
 
-if test $build_usb_blaster = yes -o $build_openjtag = yes -o $build_presto = 
yes; then
-
-  # 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 $LIBFTDI_CFLAGS"
-  LIBS="$_LIBS $LIBFTDI_LIBS"
-
-  AC_RUN_IFELSE([AC_LANG_PROGRAM([[
-#include <stdio.h>
-#include <ftdi.h>
-  ]], [[
-  struct ftdi_context *p;
-  p = ftdi_new();
-  if( p != NULL ){
-      return 0;
-  } else {
-      fprintf( stderr, "calling ftdi_new() failed\n");
-      return 1;
-        }
-    ]])], [
-      AC_MSG_RESULT([Success])
-    ], [
-      AC_MSG_ERROR([Cannot build & run test program using libftdi])
-    ], [
-      AC_MSG_RESULT([Skipping as we are cross-compiling, trying build only])
-      AC_SEARCH_LIBS([ftdi_new], [], [], [AC_MSG_ERROR([Cannot link with 
libftdi])])
-    ])
-
-AC_MSG_CHECKING([for libftdi FT232H device support])
-AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
-#include <stdio.h>
-#include <ftdi.h>
-  ]], [[
-enum ftdi_chip_type x = TYPE_232H;
-    ]])], [
-      AC_DEFINE([HAS_ENUM_FT232H], [1],
-        [Support FT232H with libftdi.])
-      has_enum_ft232h=yes
-    ], [
-      has_enum_ft232h=no
-    ])
-    AC_MSG_RESULT([$has_enum_ft232h])
-
-    if test $has_enum_ft232h = no; then
-      AC_MSG_WARN([You need a newer libftdi version (0.20 or later).])
-    fi
-
-  # Restore the 'unexpanded ldflags'
-  LDFLAGS=$LDFLAGS_SAVE
-  CFLAGS=$CFLAGS_SAVE
-  LIBS=$LIBS_SAVE
-fi
-
 PKG_CHECK_MODULES([LIBUSB1], [libusb-1.0], [
        use_libusb1=yes
        AC_DEFINE([HAVE_LIBUSB1], [1], [Define if you have libusb-1.x])
@@ -764,6 +665,11 @@ for hidapi_lib in hidapi hidapi-hidraw hidapi-libusb; do
        ])
 done
 
+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
+
 m4_define([PROCESS_ADAPTERS], [
   m4_foreach([adapter], [$1], [
        if test $2; then
@@ -786,6 +692,7 @@ PROCESS_ADAPTERS([USB1_ADAPTERS], [$use_libusb1 = yes], 
[libusb-1.x])
 PROCESS_ADAPTERS([USB_ADAPTERS], [$use_libusb1 = yes -o $use_libusb0 = yes], 
[libusb-1.x or libusb-0.1])
 PROCESS_ADAPTERS([USB0_ADAPTERS], [$use_libusb0 = yes], [libusb-0.1])
 PROCESS_ADAPTERS([HIDAPI_ADAPTERS], [$use_hidapi = yes], [hidapi])
+PROCESS_ADAPTERS([LIBFTDI_ADAPTERS], [$use_libftdi = yes], [libftdi])
 
 if test $enable_stlink != no -o $enable_ti_icdi != no; then
        AC_DEFINE([BUILD_HLADAPTER], [1], [1 if you want the High Level JTAG 
driver.])
@@ -802,6 +709,11 @@ if test $enable_jlink != no; then
   fi
 fi
 
+# Presto needs the bitq module
+if test $enable_presto != no; then
+  build_bitq=yes
+fi
+
 AM_CONDITIONAL([RELEASE], [test $build_release = yes])
 AM_CONDITIONAL([PARPORT], [test $build_parport = yes])
 AM_CONDITIONAL([DUMMY], [test $build_dummy = yes])
@@ -814,12 +726,9 @@ AM_CONDITIONAL([AT91RM9200], [test $build_at91rm9200 = 
yes])
 AM_CONDITIONAL([BCM2835GPIO], [test $build_bcm2835gpio = yes])
 AM_CONDITIONAL([BITBANG], [test $build_bitbang = yes])
 AM_CONDITIONAL([JTAG_VPI], [test $build_jtag_vpi = yes -o $build_jtag_vpi = 
yes])
-AM_CONDITIONAL([USB_BLASTER_DRIVER], [test $build_usb_blaster = yes -o 
$enable_usb_blaster_2 != no])
-AM_CONDITIONAL([USB_BLASTER], [test $build_usb_blaster = yes])
+AM_CONDITIONAL([USB_BLASTER_DRIVER], [test $enable_usb_blaster != no -o 
$enable_usb_blaster_2 != no])
 AM_CONDITIONAL([AMTJTAGACCEL], [test $build_amtjtagaccel = yes])
 AM_CONDITIONAL([GW16012], [test $build_gw16012 = yes])
-AM_CONDITIONAL([PRESTO], [test $build_presto = yes])
-AM_CONDITIONAL([OPENJTAG], [test $build_openjtag = yes])
 AM_CONDITIONAL([OOCD_TRACE], [test $build_oocd_trace = yes])
 AM_CONDITIONAL([REMOTE_BITBANG], [test $build_remote_bitbang = yes])
 AM_CONDITIONAL([BUSPIRATE], [test $build_buspirate = yes])
@@ -832,6 +741,7 @@ AM_CONDITIONAL([IS_WIN32], [test $is_win32 = yes])
 AM_CONDITIONAL([IS_DARWIN], [test $is_darwin = yes])
 AM_CONDITIONAL([BITQ], [test $build_bitq = yes])
 AM_CONDITIONAL([CMSIS_DAP], [test $use_hidapi = yes])
+AM_CONDITIONAL([USE_LIBFTDI], [test $use_libftdi = yes])
 
 AM_CONDITIONAL([MINIDRIVER], [test $build_minidriver = yes])
 AM_CONDITIONAL([MINIDRIVER_DUMMY], [test $build_minidriver_dummy = yes])
@@ -917,7 +827,7 @@ echo
 echo
 echo OpenOCD configuration summary
 echo --------------------------------------------------
-m4_foreach([adapter], [USB1_ADAPTERS, USB_ADAPTERS, USB0_ADAPTERS, 
HIDAPI_ADAPTERS],
+m4_foreach([adapter], [USB1_ADAPTERS, USB_ADAPTERS, USB0_ADAPTERS, 
HIDAPI_ADAPTERS, LIBFTDI_ADAPTERS],
        [s=m4_format(["%-40s"], ADAPTER_DESC([adapter]))
        case $ADAPTER_VAR([adapter]) in
                auto)

-- 

------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
_______________________________________________
OpenOCD-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to