From ca004d4657d5e8b468a4552ede429be53193a3a9 Mon Sep 17 00:00:00 2001
From: Craig Small <csmall@dropbear.xyz>
Date: Thu, 31 Aug 2023 22:24:23 +1000
Subject: build-sys: Add systemd/elogind to w

Depending on the compiler flags, w needs to be explictly linked
to libsystemd or elogind even though libproc2 is linked to it.

Signed-off-by: Craig Small <csmall@dropbear.xyz>
---
 Makefile.am | 7 +++++++
 NEWS        | 3 +++
 2 files changed, 10 insertions(+)

diff --git a/Makefile.am b/Makefile.am
index f70c8fb1..ddfc0141 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -149,6 +149,13 @@ endif
 
 dist_man_MANS += man/w.1
 src_w_SOURCES = src/w.c local/fileutils.c
+src_w_LDADD = $(LDADD)
+if WITH_SYSTEMD
+src_w_LDADD += @SYSTEMD_LIBS@
+endif
+if WITH_ELOGIND
+src_w_LDADD += @ELOGIND_LIBS@
+endif
 else
   EXTRA_DIST += man/w.1
 endif
diff --git a/NEWS b/NEWS
index 3f2158d4..4ad9f74e 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,6 @@
+procps-ng-NEXT
+---------------
+
 procps-ng-4.0.4
 ---------------
   * library (API & ABI unchanged)
