Avoid entering static libusb directory if --with-system-libusb is enabled.
diff --git a/compat/Makefile.am b/compat/Makefile.am
index 4ed10f8..4cd32d2 100644
--- a/compat/Makefile.am
+++ b/compat/Makefile.am
@@ -2,5 +2,7 @@
SUBDIRS = jansson-2.5
if WANT_USBUTILS
+if WANT_STATIC_LIBUSB
SUBDIRS += libusb-1.0
endif
+endif
diff --git a/configure.ac b/configure.ac
index 8a505da..f6fa785 100644
--- a/configure.ac
+++ b/configure.ac
@@ -368,6 +368,8 @@ else
LIBUSB_LIBS=""
fi
+AM_CONDITIONAL([WANT_STATIC_LIBUSB], [test x$dlibusb = xno])
+
AC_CONFIG_SUBDIRS([compat/jansson-2.5])
JANSSON_LIBS="compat/jansson-2.5/src/.libs/libjansson.a"