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