Allow to specify the hidapi library variant

On Linux, the hidapi library is usually available in two variants:
hidapi-libusb and hidapi-hidraw. By default, the autotools build system
won't be able to detect those variants (due to the difference in the
name) and will automatically fallback to the libusb implementation
instead.

If for some reason the hidapi library should be used, the preferred
hidapi variant can now be specified during configuation with a
parameter:

  ./configure --with-hidapi=hidapi-libusb|hidapi-hidraw

The default value for the parameter remains 'hidapi'.
This commit is contained in:
Jef Driesen 2022-11-06 20:54:34 +01:00
parent 5218d3921a
commit 913a65fde6

View File

@ -107,12 +107,12 @@ AS_IF([test "x$with_libusb" != "xno"], [
AC_ARG_WITH([hidapi],
[AS_HELP_STRING([--without-hidapi],
[Build without the hidapi library])],
[], [with_hidapi=auto])
[], [with_hidapi=hidapi])
AS_IF([test "x$with_hidapi" != "xno"], [
PKG_CHECK_MODULES([HIDAPI], [hidapi], [have_hidapi=yes], [have_hidapi=no])
PKG_CHECK_MODULES([HIDAPI], [$with_hidapi], [have_hidapi=yes], [have_hidapi=no])
AS_IF([test "x$have_hidapi" = "xyes"], [
AC_DEFINE([HAVE_HIDAPI], [1], [hidapi library])
DEPENDENCIES="$DEPENDENCIES hidapi"
DEPENDENCIES="$DEPENDENCIES $with_hidapi"
])
])