changeset 5353:ff496874348c draft

udev: disable for non Linux systems On FreeBSD udev, the function udev_device_new_from_subsystem_sysname exists but is not implemented. As such it breaks our device initialisation detection. Disabled by default, but can be enabled with ./configure --with-udev
author Roy Marples <roy@marples.name>
date Thu, 11 Jun 2020 11:35:20 +0100
parents 599c75a0ac56
children 698ae772942e
files configure
diffstat 1 files changed, 22 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/configure	Wed Jun 10 19:00:45 2020 +0100
+++ b/configure	Thu Jun 11 11:35:20 2020 +0100
@@ -1529,15 +1529,31 @@
 	fi
 fi
 
-if [ "$DEV" != no -a "$UDEV" != no ]; then
+if [ "$DEV" != no ] && [ "$UDEV" != no ]; then
 	printf "Checking for libudev ... "
 	if type "$PKG_CONFIG" >/dev/null 2>&1; then
 		LIBUDEV_CFLAGS=$("$PKG_CONFIG" --cflags libudev 2>&3)
 		LIBUDEV_LIBS=$("$PKG_CONFIG" --libs libudev 2>&3)
 	fi
+	if [ -n "$LIBUDEV_LIBS" ] && [ "$UDEV" = yes ]; then
+		echo "yes"
+	elif [ -n "$LIBUDEV_LIBS" ]; then
+		case "$OS" in
+		linux*)	echo "yes";;
+		*)	echo "yes (disabled)"
+			# FreeBSD libudev fails to return a udev device
+			# with udev_device_new_from_subsystem_sysname
+			# which breaks our test for device initialisation
+			LIBUDEV_CFLAGS=
+			LIBUDEV_LIBS=
+			;;
+		esac
+	else
+		echo "no"
+	fi
 fi
-if [ "$DEV" != no -a "$UDEV" != no -a -n "$LIBUDEV_LIBS" ]; then
-	echo "yes"
+
+if [ "$DEV" != no ] && [ "$UDEV" != no ] && [ -n "$LIBUDEV_LIBS" ]; then
 	[ -z "$DEV" ] && DEV=yes
 	echo "DEV_PLUGINS+=	udev" >>$CONFIG_MK
 	if [ -n "$LIBUDEV_CFLAGS" ]; then
@@ -1580,12 +1596,9 @@
 		echo "no"
 	fi
 	rm -f _udev.c _udev
-elif [ "$DEV" != no -a "$UDEV" != no ]; then
-	echo "no"
-	if [ -n "$UDEV" ]; then
-		echo "udev has been explicitly requested ... aborting" >&2
-		exit 1
-	fi
+elif [ "$DEV" != no ] && [ "$UDEV" != no ] && [ -n "$UDEV" ]; then
+	echo "udev has been explicitly requested ... aborting" >&2
+	exit 1
 fi
 
 if [ "$DEV" = yes ]; then