From: Fredrik Thulin Date: Sun, 6 Mar 2011 19:19:22 +0000 (+0100) Subject: Use AC_CHECK_LIB to check for FreeBSD libusb. X-Git-Tag: v1.5.0~12 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=52ab95873d5f2d7712edd90c9bd614f8488fd573;p=yubikey-personalization Use AC_CHECK_LIB to check for FreeBSD libusb. Can't use AC_LIB_HAVE_LINKFLAGS twice since the result is cached. --- diff --git a/configure.ac b/configure.ac index f065f1b..ed5a393 100644 --- a/configure.ac +++ b/configure.ac @@ -83,18 +83,25 @@ if test "x$with_backend" = "xlibusb-1.0"; then fi if test x$with_backend = xlibusb; then - AC_LIB_HAVE_LINKFLAGS(usb,, [#include ], [libusb_init(NULL)]) - if test "$ac_cv_libusb" = yes; then - # FreeBSD 8 has an implementation of the libusb-1.0 API in -lusb + freebsd_libusb_found=no + AC_CHECK_LIB(usb, libusb_init, [freebsd_libusb_found=yes]) + if test "$freebsd_libusb_found" = yes; then + # FreeBSD 8 has an implementation of the libusb-1.0 API in -lusb, + # interestingly enough together with most of libusb-0 API, so this + # check has to be before the generic libusb-0 check + AC_LIB_HAVE_LINKFLAGS(usb,, [#include ], [libusb_init(NULL)]) with_backend=libusb-1.0 - else + fi + + if test "$ac_cv_libusb" != yes; then AC_LIB_HAVE_LINKFLAGS(usb,, [#include ], [usb_init()]) - if test "$ac_cv_libusb" != yes; then - if test "$with_backend_orig" = "check"; then - AC_MSG_ERROR([libusb-1.0 or libusb not found, please install one of them]) - else - AC_MSG_ERROR([libusb not found, please install usb.h and libusb.so]) - fi + fi + + if test "$ac_cv_libusb" != yes; then + if test "$with_backend_orig" = "check"; then + AC_MSG_ERROR([libusb-1.0 or libusb not found, please install one of them]) + else + AC_MSG_ERROR([libusb not found, please install usb.h and libusb.so]) fi fi fi