Permalink
Browse files

BUILD: Configure will try to find and use LibFTDI1 + LibUSB1.

LibFTDI1 will give asynchronous USB interface access which benefits in speed.
LibFTDI1 depends on LibUSB1 and dependency will be checked if LibFTDI1 found.
If LibFTDI1 or LibUSB1 is not present old LibFTDI is mandatory to build...
  • Loading branch information...
cederom committed Nov 15, 2013
1 parent 3d3b80d commit b1f7b1abbc222471276334d281eedfe4f5142043
Showing with 32 additions and 5 deletions.
  1. +32 −5 configure.ac
View
@@ -29,7 +29,15 @@ AS_IF([test x"$enable_application" == x"true"],
AC_CHECK_LIB([ftdi], [ftdi_new],
[AC_SUBST([LIBFTDI], ["-lftdi"])
AC_DEFINE([HAVE_FTDI], [1], [Define if you have libftdi])],
- [AC_MSG_FAILURE([LibFTDI not found, required by LibSWD Application!])]
+ )
+ ]
+)
+LIBFTDI1=
+AS_IF([test x"$enable_application" == x"true"],
+ [
+ AC_CHECK_LIB([ftdi1], [ftdi_new],
+ [AC_SUBST([LIBFTDI], ["-lftdi1"])
+ AC_DEFINE([HAVE_FTDI1], [1], [Define if you have libftdi1])],
)
]
)
@@ -41,15 +49,34 @@ AS_IF([test x"$enable_application" == x"true"],
[
AC_CHECK_LIB([usb], [libusb_init],
[AC_SUBST([LIBUSB], ["-lusb"])
- AC_DEFINE([HAVE_USB], [1], [Define if you have libusb-1])],
- [AC_MSG_FAILURE([LibUSB-1 not found, required by LibSWD Application!])]
+ AC_DEFINE([HAVE_USB1], [1], [Define if you have libusb-1])]
+ ,[AC_MSG_WARN([LibUSB-1 not found, no async USB I/O available...])]
)
],
[
AC_CHECK_LIB([usb-1.0], [libusb_init],
[AC_SUBST([LIBUSB], ["-lusb-1.0"])
- AC_DEFINE([HAVE_USB], [1], [Define if you have libusb-1])],
- [AC_MSG_FAILURE([LibUSB-1 not found, required by LibSWD Application!])]
+ AC_DEFINE([HAVE_USB1], [1], [Define if you have libusb-1])]
+ ,[AC_MSG_WARN([LibUSB-1 not found, no async USB I/O available...])]
+ )
+ ]
+ )
+ ]
+)
+#Check if we have LibFTDI. If using LibFTDI1 also verify LibUSB1 presence.
+AS_IF([test x"$enable_application" == x"true"],
+ [
+ AC_CHECK_DECL(HAVE_FTDI1,
+ [
+ AC_CHECK_DECL(HAVE_USB1,
+ [AC_MSG_NOTICE([LibFTDI1+LibUSB1 found, async USB I/O available!])],
+ [AC_MSG_FAILURE([LibFTDI1 requires LibUSB1, but it was not found!])]
+ )
+ ],
+ [
+ AC_CHECK_DECL(HAVE_FTDI,
+ [AC_MSG_NOTICE([Old LibFTDI found, no async USB I/O available!])],
+ [AC_MSG_FAILURE([Neither LibFTDI nor LibFTDI1 was found, but required by LibSWD Application!])]
)
]
)

0 comments on commit b1f7b1a

Please sign in to comment.