From 6b34109666bae2916bc20d43f291e95b1d285b3d Mon Sep 17 00:00:00 2001
From: "John M. Harris Jr." <johnmh@johnmh.me>
Date: Sat, 6 Sep 2025 09:10:08 -0700
Subject: [PATCH] Revert "Remove support for elogind"

This reverts commit bbda9dec06674757da55ce6a241953c37553aaf9.
---
 meson.build                | 6 ++++++
 meson_options.txt          | 4 ++++
 plugins/logind/meson.build | 4 +++-
 3 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/meson.build b/meson.build
index 3a16333..19db97b 100644
--- a/meson.build
+++ b/meson.build
@@ -712,6 +712,11 @@ if libsystemd.found()
   endif
 endif
 
+elogind = dependency('systemd', 'libelogind', required: get_option('elogind'))
+if elogind.found()
+  conf.set('HAVE_LOGIND' , '1')
+endif
+
 supported_build = get_option('supported_build').disable_auto_if(not tag).allowed()
 if supported_build
   conf.set('SUPPORTED_BUILD', '1')
@@ -923,6 +928,7 @@ summary(
     'dbus_socket_address': get_option('dbus_socket_address'),
     'vendor_ids_dir': vendor_ids_dir,
     'docs': build_docs,
+    'elogind': elogind,
     'gnutls': gnutls,
     'introspection': introspection.allowed(),
     'libblkid': libblkid,
diff --git a/meson_options.txt b/meson_options.txt
index 40103c0..bf8e964 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -39,6 +39,10 @@ option('efi_os_dir',
   type: 'string',
   description: 'the hardcoded name of OS directory in ESP, e.g. fedora',
 )
+option('elogind',
+  type: 'feature',
+  description: 'elogind support',
+)
 option('firmware-packager',
   type: 'boolean',
   value: true,
diff --git a/plugins/logind/meson.build b/plugins/logind/meson.build
index bd66fab..30b6073 100644
--- a/plugins/logind/meson.build
+++ b/plugins/logind/meson.build
@@ -1,4 +1,4 @@
-libsystemd.found() or subdir_done()
+if libsystemd.found() or elogind.found()
 
 cargs = ['-DG_LOG_DOMAIN="FuPluginLogind"']
 plugins += {meson.current_source_dir().split('/')[-1]: true}
@@ -12,3 +12,5 @@ plugin_builtins += static_library('fu_plugin_logind',
   c_args: cargs,
   dependencies: plugin_deps,
 )
+
+endif
