diff --git a/configure.ac b/configure.ac index 21d988473..03a99f95d 100644 --- a/configure.ac +++ b/configure.ac @@ -321,10 +321,11 @@ LIBUSB="" AC_ARG_VAR([LIBUSB_CFLAGS], [C compiler flags for libusb, overriding configure defaults]) AC_ARG_VAR([LIBUSB_LIBS], [linker flags for libusb, overriding configure check (useful for specifying static libusb-1.0.a (see INSTALL))]) -AS_IF([test x"${cf_with_libusb}" = "xyes"], - [AS_IF([test -z $LIBUSB_LIBS], +AS_IF([test x"${cf_with_libusb}" = "xyes"], [ + AS_IF([test -z $LIBUSB_LIBS], [AC_CHECK_LIB([usb-1.0], [libusb_init], [LIBUSB_LIBS="-lusb-1.0"], [AC_MSG_WARN([libusb_init was not found in libusb-1.0--USB backends will be disabled])]) + [cf_with_libusb="no"] ], [cf_with_libusb="yes"]) AS_IF([test x"${cf_with_libusb}" = "xyes"], diff --git a/tests/rigtestlibusb.c b/tests/rigtestlibusb.c index 29156cc0d..4689ff7e5 100644 --- a/tests/rigtestlibusb.c +++ b/tests/rigtestlibusb.c @@ -24,12 +24,13 @@ #include #include -#if __has_include("libusb.h") +#if defined(HAVE_LIBUSB_H) #include "libusb.h" -#else +#elif defined(HAVE_LIBUSB_1_0_LIBUSB_H) #include #endif +#if HAVE_LIBUSB int verbose = 0; static void print_endpoint_comp(const struct @@ -410,3 +411,10 @@ int main(int argc, char *argv[]) libusb_exit(NULL); return r; } +#else +int main() +{ + puts("libusb not installed"); + return 0; +} +#endif