fix FTBS on non-udev target platforms (eg. FreeBSD)

On platforms that don't have libudev at all (eg. FreeBSD), the build
breaks. The only consumer, EvdevDeviceIsVirtual(), can live well with
just bailing out directly if libudev isn't present.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/driver/xf86-input-evdev/-/merge_requests/6>
This commit is contained in:
Enrico Weigelt, metux IT consult
2024-06-10 18:45:18 +02:00
parent fbfb16edfe
commit aac329fd2a
2 changed files with 7 additions and 1 deletions

View File

@@ -45,7 +45,7 @@ XORG_DEFAULT_OPTIONS
# Obtain compiler/linker options from server and required extensions
PKG_CHECK_MODULES(XORG, [xorg-server >= 1.18] xproto [inputproto >= 2.1.99.3])
PKG_CHECK_MODULES(UDEV, libudev)
PKG_CHECK_MODULES(UDEV, libudev, [AC_DEFINE(HAVE_LIBUDEV, 1,[libudev support])])
PKG_CHECK_MODULES(LIBEVDEV, [libevdev >= 0.4])
PKG_CHECK_MODULES(MTDEV, mtdev)

View File

@@ -39,7 +39,9 @@
#include <X11/extensions/XI.h>
#include <sys/stat.h>
#ifdef HAVE_LIBUDEV
#include <libudev.h>
#endif
#include <unistd.h>
#include <errno.h>
#include <fcntl.h>
@@ -225,6 +227,7 @@ EvdevIsDuplicate(InputInfoPtr pInfo)
static BOOL
EvdevDeviceIsVirtual(const char* devicenode)
{
#ifdef HAVE_LIBUDEV
struct udev *udev = NULL;
struct udev_device *device = NULL;
struct stat st;
@@ -255,6 +258,9 @@ out:
udev_device_unref(device);
udev_unref(udev);
return rc;
#else
return FALSE;
#endif
}