From 13315231ce5c72d9d979d52c5def7f4734f7abd3 Mon Sep 17 00:00:00 2001 From: Fredrik Thulin Date: Tue, 1 Mar 2011 15:22:27 +0100 Subject: [PATCH] Try to fix libusb detection on FreeBSD 8. FreeBSD 8 has an implementation of the libusb-1.0 API in -lusb, try to handle it. --- configure.ac | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/configure.ac b/configure.ac index a231f57..c31c589 100644 --- a/configure.ac +++ b/configure.ac @@ -77,9 +77,6 @@ if test "x$with_backend" = xcheck; then esac AC_MSG_RESULT([$with_backend]) fi -AM_CONDITIONAL([BACKEND_LIBUSB], test x$with_backend = xlibusb) -AM_CONDITIONAL([BACKEND_LIBUSB_1_0], test x$with_backend = xlibusb-1.0) -AM_CONDITIONAL([BACKEND_OSX], test x$with_backend = xosx) if test "x$with_backend" = "xlibusb-1.0"; then PKG_CHECK_MODULES([LIBUSB], [libusb-1.0]) @@ -88,10 +85,16 @@ fi if test x$with_backend = xlibusb; 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]) + # FreeBSD 8 has an implementation of the libusb-1.0 API in -lusb + AC_LIB_HAVE_LINKFLAGS(usb,, [#include ], [libusb_init(NULL)]) + 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 else - AC_MSG_ERROR([libusb not found, please install usb.h and libusb.so]) + with_backend=libusb-1.0 fi fi fi @@ -100,6 +103,10 @@ if test x$with_backend = xosx; then LDFLAGS="$LDFLAGS -framework IOKit -framework CoreFoundation" fi +AM_CONDITIONAL([BACKEND_LIBUSB], test x$with_backend = xlibusb) +AM_CONDITIONAL([BACKEND_LIBUSB_1_0], test x$with_backend = xlibusb-1.0) +AM_CONDITIONAL([BACKEND_OSX], test x$with_backend = xosx) + gl_LD_VERSION_SCRIPT AC_CONFIG_FILES([ -- 2.39.5