configure.ac: Make sure that logind is enabled if requested, make --enable-logind default

Before this commit, if configured with --enable-logind, but libsystemd
is not found, configure silently succeed, however logind is efficiently
disabled.
With this commit, the configure fails if logind is not explicitly
disabled and libsystemd is not found.
--disable-logind is mandatory if logind integration should not be used.

Automatic detection is disabled by Alejandro Colomar's request.
Extra help in the error message is added by lslebodn's request.

Signed-off-by: Evgeny Grin (Karlson2k) <k2k@drgrin.dev>
This commit is contained in:
Evgeny Grin (Karlson2k) 2025-07-10 18:38:48 +02:00 committed by Alejandro Colomar
parent 048083ab92
commit 324d070ff8
5 changed files with 11 additions and 7 deletions

View File

@ -22,5 +22,5 @@ runs:
sudo apt-mark hold grub-efi-amd64-bin grub-efi-amd64-signed
sudo apt-get update
sudo apt-get -y dist-upgrade
sudo apt-get -y install ubuntu-dev-tools automake autopoint xsltproc gettext expect libtool libbsd-dev libltdl-dev pkgconf
sudo apt-get -y install ubuntu-dev-tools automake autopoint xsltproc gettext expect libtool libbsd-dev libltdl-dev libsystemd-dev pkgconf
sudo apt-get -y build-dep shadow

View File

@ -62,7 +62,7 @@ jobs:
tar -zxf $f
d=$(basename $f .tar.gz)
cd $d
./configure
./configure --disable-logind
make -j5
make check

View File

@ -1,6 +1,8 @@
## Process this file with automake to produce Makefile.in
ACLOCAL_AMFLAGS = -I m4
AM_DISTCHECK_CONFIGURE_FLAGS = --disable-logind
SUBDIRS = lib
if ENABLE_SUBIDS

View File

@ -18,6 +18,7 @@ CFLAGS="$CFLAGS -Wno-unknown-warning-option"
"$(dirname "$0")"/configure \
CFLAGS="$CFLAGS" \
--enable-lastlog \
--disable-logind \
--enable-man \
--enable-maintainer-mode \
--enable-shared \

View File

@ -152,13 +152,14 @@ AC_ARG_ENABLE([lastlog],
)
AC_ARG_ENABLE([logind],
[AS_HELP_STRING([--enable-logind],
[enable logind @<:@default=yes if found@:>@])],
[AS_HELP_STRING([--disable-logind],
[disable logind integration])],
[
AS_CASE([${enableval}],
[yes],[],
[no],[],
[AC_MSG_ERROR([bad parameter value for --enable-logind=${enableval}])]
[AC_MSG_ERROR([bad parameter value for --enable-logind=${enableval}. ]dnl
[Supported values are: --enable-logind (or --enable-logind=yes) and --disable-logind (or --enable-logind=no).])]
)
],
[enable_logind="yes"]
@ -347,11 +348,11 @@ AC_SUBST([LIBSYSTEMD])
if test "X$enable_logind" = "Xyes"; then
AC_CHECK_LIB([systemd], [sd_session_get_remote_host],
[
enable_logind="yes"
LIBSYSTEMD=-lsystemd
AC_DEFINE([ENABLE_LOGIND], [1], [Define to manage session support with logind.])
],[
enable_logind="no"
AC_MSG_ERROR([libsystemd not found. If logind integration is not required, disable it using the --disable-logind option. ]dnl
[ If logind integration is required, consider installing systemd or another package that provides libsystemd.])
]
)
fi