From 2b82e882edcbc0c92ea285a60b5436f881535d9c Mon Sep 17 00:00:00 2001
From: Zdenek Kabelac <zkabelac@redhat.com>
Date: Fri, 6 Dec 2024 17:02:24 +0100
Subject: [PATCH 5/5] configure: autoreconf

---
 configure | 55 +++++++++++++++++++++++++++++++++++++++++++++++--------
 1 file changed, 47 insertions(+), 8 deletions(-)

diff --git a/configure b/configure
index 25090cc62788..0ae687e9c369 100755
--- a/configure
+++ b/configure
@@ -678,6 +678,7 @@ SILENT_RULES
 SHARED_LINK
 SELINUX_STATIC_LIBS
 SELINUX_PC
+SD_NOTIFY_SUPPORT
 SBINDIR
 RT_LIBS
 PYTHON3DIR
@@ -971,6 +972,7 @@ enable_use_lvmpolld
 with_lvmpolld_pidfile
 enable_systemd_journal
 enable_app_machineid
+enable_sd_notify
 with_systemd_run
 enable_blkid_wiping
 enable_udev_sync
@@ -1713,6 +1715,7 @@ Optional Features:
   --disable-systemd-journal
                           disable LVM systemd journaling
   --disable-app-machineid disable LVM system ID using app-specific machine-id
+  --disable-sd-notify     disable LVM sd_notify
   --disable-blkid_wiping  disable libblkid detection of signatures when wiping
                           and use native code instead
   --enable-udev_sync      enable synchronization with udev processing
@@ -12721,6 +12724,7 @@ SYSTEMD_MIN_VERSION=0
 NOTIFYDBUS_SUPPORT="no"
 SYSTEMD_JOURNAL_SUPPORT="no"
 APP_MACHINEID_SUPPORT="no"
+SD_NOTIFY_SUPPORT="no"
 if test "$with_systemd" = "yes"
 then :
   if test -n "$PKG_CONFIG" && \
@@ -12729,7 +12733,7 @@ then :
   ac_status=$?
   printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   test $ac_status = 0; }; then
-  SYSTEMD_MIN_VERSION=221 NOTIFYDBUS_SUPPORT="maybe" SYSTEMD_JOURNAL_SUPPORT="maybe"
+  SYSTEMD_MIN_VERSION=221 NOTIFYDBUS_SUPPORT="maybe" SD_NOTIFY_SUPPORT="maybe" SYSTEMD_JOURNAL_SUPPORT="maybe"
 fi
       if test -n "$PKG_CONFIG" && \
     { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"systemd >= 234\""; } >&5
@@ -12811,6 +12815,41 @@ printf "%s\n" "#define APP_MACHINEID_SUPPORT 1" >>confdefs.h
 
 fi
 
+################################################################################
+if test "$SD_NOTIFY_SUPPORT" != "no"
+then :
+  ac_fn_c_check_header_compile "$LINENO" "systemd/sd-daemon.h" "ac_cv_header_systemd_sd_daemon_h" "$ac_includes_default"
+if test "x$ac_cv_header_systemd_sd_daemon_h" = xyes
+then :
+  SD_NOTIFY_SUPPORT="yes"
+else case e in #(
+  e) SD_NOTIFY_SUPPORT="no" ;;
+esac
+fi
+
+fi
+# Check whether --enable-sd-notify was given.
+if test ${enable_sd_notify+y}
+then :
+  enableval=$enable_sd_notify; if test "$enableval" = "yes" && test "$SD_NOTIFY_SUPPORT" = "no"
+then :
+  as_fn_error $? "--enable-sd-notify requires systemd/sd-daemon.h. (--with-systemd=$with_systemd)" "$LINENO" 5
+fi
+	      SD_NOTIFY_SUPPORT=$enableval
+fi
+
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether to enable to sd_notify" >&5
+printf %s "checking whether to enable to sd_notify... " >&6; }
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $SD_NOTIFY_SUPPORT" >&5
+printf "%s\n" "$SD_NOTIFY_SUPPORT" >&6; }
+
+if test "$SD_NOTIFY_SUPPORT" = "yes"
+then :
+
+printf "%s\n" "#define SD_NOTIFY_SUPPORT 1" >>confdefs.h
+
+fi
+
 ################################################################################
 
 # Check whether --with-systemd-run was given.
@@ -13430,7 +13469,7 @@ fi
 
 if test "$NOTIFYDBUS_SUPPORT" = "maybe"
 then :
-  if test "$BUILD_LVMDBUSD" = "yes" || test "$BUILD_LVMLOCKD" = "yes"
+  if test "$BUILD_LVMDBUSD" = "yes"
 then :
   NOTIFYDBUS_SUPPORT="yes"
 else case e in #(
@@ -13456,10 +13495,10 @@ printf %s "checking whether to build notifydbus... " >&6; }
 printf "%s\n" "$NOTIFYDBUS_SUPPORT" >&6; }
 
 ################################################################################
-if test "$NOTIFYDBUS_SUPPORT" = "yes" || test "$SYSTEMD_JOURNAL_SUPPORT" = "yes" || test "$APP_MACHINEID_SUPPORT" = "yes"
+if test "$NOTIFYDBUS_SUPPORT" = "yes" || test "$SYSTEMD_JOURNAL_SUPPORT" = "yes" ||
+       test "$APP_MACHINEID_SUPPORT" = "yes" || test "$SD_NOTIFY_SUPPORT" = "yes"
 then :
 
-
 pkg_failed=no
 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for libsystemd" >&5
 printf %s "checking for libsystemd... " >&6; }
@@ -13550,7 +13589,6 @@ else
 printf "%s\n" "yes" >&6; }
 
 fi
-
 fi
 
 ################################################################################
@@ -16561,6 +16599,7 @@ AIO_LIBS=${AIO_LIBS:--laio}
 
 
 
+
 
 
 ################################################################################
@@ -17958,9 +17997,9 @@ then :
 printf "%s\n" "$as_me: WARNING: Building D-Bus support without D-Bus notifications!" >&2;}
 fi
 
-if test "$BUILD_LVMLOCKD" = "yes" && test "$NOTIFYDBUS_SUPPORT" = "no"
+if test "$BUILD_LVMLOCKD" = "yes" && test "$SD_NOTIFY_SUPPORT" = "no"
 then :
-  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: Building lvmlockd without D-Bus notifications may block!" >&5
-printf "%s\n" "$as_me: WARNING: Building lvmlockd without D-Bus notifications may block!" >&2;}
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: Building lvmlockd without sd-notify support may block!" >&5
+printf "%s\n" "$as_me: WARNING: Building lvmlockd without sd-notify support may block!" >&2;}
 fi
 
-- 
2.39.5 (Apple Git-154)

