1From 61991db099f66348dddbc3408e7ee8c05bda85cb Mon Sep 17 00:00:00 2001
2From: Yoann Congal <yoann.congal@smile.fr>
3Date: Sat, 2 Mar 2024 16:23:07 +0100
4Subject: [PATCH] configure.ac: Add an option to disable host udev version
5 checks
6
7In cross-compilation environment, the build host might have an outdated
8udev or no udev at all. But the user may still want to build with the
9enabled udev rule (for its udev-enabled target).
10
11This patch adds a "--disable-udevchecks" option the disable build host
12udev version check at configure-time and unconditionally install the
13enabled udev rule. Without this new option, the behavior stays the same
14(checks enabled).
15
16Signed-off-by: Yoann Congal <yoann.congal@smile.fr>
17Upstream-Status: Backport [https://github.com/LINBIT/drbd-utils/commit/f2b5a7335ae52109dfb95a9d99ae20519c43d59a]
18---
19 configure.ac | 9 +++++++--
20 1 file changed, 7 insertions(+), 2 deletions(-)
21
22diff --git a/configure.ac b/configure.ac
23index f1d69ea3..4c56d33b 100644
24--- a/configure.ac
25+++ b/configure.ac
26@@ -71,6 +71,11 @@ AC_ARG_WITH([udev],
27 	[AS_HELP_STRING([--with-udev],
28 			[Enable udev integration])],
29 	[WITH_UDEV=$withval])
30+AC_ARG_ENABLE([udevchecks],
31+	[AS_HELP_STRING([--disable-udevchecks],
32+			[Disable host udev version checks])],
33+	[],
34+	[enable_udevchecks=yes])
35 AC_ARG_WITH([xen],
36 	[AS_HELP_STRING([--with-xen],
37 			[Enable Xen integration])],
38@@ -315,7 +320,7 @@ if test -z $GIT; then
39    AC_MSG_WARN(Cannot update buildtag without git. You may safely ignore this warning when building from a tarball.)
40 fi
41
42-if test $UDEVADM = false && test $UDEVINFO = false; then
43+if test "x$enable_udevchecks" != "xno" && test $UDEVADM = false && test $UDEVINFO = false; then
44    if test "$WITH_UDEV" = "yes"; then
45      AC_MSG_WARN([udev support enabled, but neither udevadm nor udevinfo found on this system.])
46    fi
47@@ -423,7 +428,7 @@ else
48     test -z $INITDIR && INITDIR="$sysconfdir/init.d"
49
50     dnl Our udev rules file is known to work only with udev >= 85
51-    if test "$WITH_UDEV" = "yes"; then
52+    if test "x$enable_udevchecks" != "xno" && test "$WITH_UDEV" = "yes"; then
53        udev_version=$( set -- $($UDEVADM version); echo $1 )
54        if test -z "$udev_version"; then
55 	    udev_version=$( set -- $($UDEVINFO -V); echo $3 )
56