Skip to content

Commit

Permalink
m4/nut_check_libsystemd.m4: check if nut_have_libsystemd_inhibitor [n…
Browse files Browse the repository at this point in the history
…etworkupstools#1070]

Signed-off-by: Jim Klimov <[email protected]>
  • Loading branch information
jimklimov committed Aug 19, 2024
1 parent 575d423 commit 9fc586d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
3 changes: 3 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -4073,6 +4073,9 @@ AS_IF([test x"${with_libsystemd}" = xyes && test x"${SYSTEMD_SUPPORTS_DAEMON_TYP
NUT_REPORT_FEATURE([build with tighter systemd support], [${with_libsystemd}], [],
[WITH_LIBSYSTEMD], [Define to build with tighter systemd support (sd_notify etc)])

nut_with_libsystemd_inhibitor=0
AS_IF([test x"${with_libsystemd}" = xyes && test x"${nut_have_libsystemd_inhibitor}" = xyes], [nut_with_libsystemd_inhibitor=1])
AC_DEFINE_UNQUOTED(WITH_LIBSYSTEMD_INHIBITOR, [${nut_with_libsystemd_inhibitor}], [Define as 1 if we can use systemd inhibitor interface here])

dnl
dnl Tests for CppUnit availability and usability (will be built if we can,
Expand Down
7 changes: 6 additions & 1 deletion m4/nut_check_libsystemd.m4
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,12 @@ if test -z "${nut_have_libsystemd_seen}"; then
AC_CHECK_FUNCS(sd_booted sd_watchdog_enabled sd_notify_barrier)
LIBSYSTEMD_CFLAGS="${CFLAGS}"
LIBSYSTEMD_LIBS="${LIBS}"
])
dnl Since systemd 183: https://systemd.io/INHIBITOR_LOCKS/
dnl TODO: Which header?
nut_have_libsystemd_inhibitor=yes
AC_CHECK_FUNCS(Inhibit PrepareForSleep, [], [nut_have_libsystemd_inhibitor=no])
], [nut_have_libsystemd_inhibitor=no])
dnl restore original CFLAGS and LIBS
CFLAGS="${CFLAGS_ORIG}"
Expand Down

0 comments on commit 9fc586d

Please sign in to comment.