diff --git a/ChangeLog b/ChangeLog index 5c5e24d1..b45324d2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2011-08-25 Joerg Wunsch + + * configure.ac: Add a check for FreeBSD's libusb-1.0 + compatible library that is found in libusb.a/.so on + FreeBSD 8+. + 2011-08-25 Joerg Wunsch Submitted by Doug Springer, based on work by diff --git a/configure.ac b/configure.ac index 36c880e2..8a03792c 100644 --- a/configure.ac +++ b/configure.ac @@ -82,6 +82,26 @@ if test x$have_libusb_1_0 = xyes; then AC_CHECK_HEADERS([libusb-1.0/libusb.h]) AC_CHECK_HEADERS([libusb.h]) fi +AH_TEMPLATE([HAVE_LIBUSB_1_0], + [Define if USB support is enabled via a libusb-1.0 compatible libusb]) +AC_CHECK_LIB([usb], [libusb_init], [have_libusb_1_0=yes]) +if test x$have_libusb_1_0 = xyes; then + case $target in + *-*-freebsd*) + # FreeBSD 8+ has a native libusb-1.0 API compatible + # library offered by -lusb (which is also libusb-0.1 + # compatible). FreeBSD <8 does not have a libusb-1.0 + # at all so probing will fail but we do not have to + # special-case that. + LIBUSB_1_0="-lusb" + ;; + *) + LIBUSB_1_0="-lusb-1.0" + ;; + esac + AC_DEFINE([HAVE_LIBUSB_1_0]) + AC_CHECK_HEADERS([libusb.h]) +fi AC_SUBST(LIBUSB_1_0, $LIBUSB_1_0) AH_TEMPLATE([HAVE_LIBFTDI], [Define if FTDI support is enabled via libftdi])