]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
configure.ac: fix checks for lastlog support
authorMike Gilbert <floppym@gentoo.org>
Wed, 18 Feb 2026 19:00:51 +0000 (14:00 -0500)
committerAlejandro Colomar <foss+github@alejandro-colomar.es>
Wed, 18 Feb 2026 22:36:22 +0000 (23:36 +0100)
The check for lastlog.h was removed by mistake in a previous changset.

The configure script should terminate with an error if lastlog support
was requested but lastlog.h is not available.

Partial functionality is provided if ll_host is not a member of
struct lastlog.

Fixes: 1bdcfa8d3710 (2023-07-15; "lastlog: stop building by default")
Fixes: 9eea4bc9cf95 (2024-11-12, 2025-02-07; "configure.ac: Remove unused AC_CHECK_HEADERS() checks")
Signed-off-by: Mike Gilbert <floppym@gentoo.org>
configure.ac

index 278f8454642bd056a4723d72829d9013c412798b..3b2aefd0ad888d504c3380eea1e796f1f5c13d3f 100644 (file)
@@ -302,27 +302,18 @@ if test "$enable_subids" != "no"; then
 fi
 AM_CONDITIONAL([ENABLE_SUBIDS], [test "x$enable_subids" != "xno"])
 
-if test "X$enable_lastlog" = "Xyes" && test "X$ac_cv_header_lastlog_h" = "Xyes"; then
-       AC_CACHE_CHECK([for ll_host in struct lastlog],
-               [ac_cv_struct_lastlog_ll_host],
-               [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <lastlog.h>]],
-                                       [struct lastlog ll; char *cp = ll.ll_host;])],
-                       [ac_cv_struct_lastlog_ll_host=yes],
-                       [ac_cv_struct_lastlog_ll_host=no])
-               ]
-       )
-
-       if test "X$ac_cv_struct_lastlog_ll_host" = "Xyes"; then
-               AC_DEFINE([HAVE_LL_HOST], [1],
-                       [Define if struct lastlog has ll_host])
-               AC_DEFINE([ENABLE_LASTLOG], [1], [Define to support lastlog.])
-               enable_lastlog="yes"
-       else
-               AC_MSG_ERROR([Cannot enable support for lastlog on systems where the data structures aren't available])
-               enable_lastlog="no"
-       fi
+if test "X$enable_lastlog" = "Xyes"; then
+       AC_CHECK_HEADER([lastlog.h], [
+               AC_CHECK_MEMBER([struct lastlog.ll_host], [
+                       AC_DEFINE([HAVE_LL_HOST], [1],
+                               [Define if struct lastlog has ll_host])
+               ], [], [#include <lastlog.h>])
+       ], [
+               AC_MSG_ERROR([Cannot enable support for lastlog on systems where lastlog.h is not available])
+       ])
+       AC_DEFINE([ENABLE_LASTLOG], [1], [Define to support lastlog.])
 fi
-AM_CONDITIONAL([ENABLE_LASTLOG], [test "x$enable_lastlog" != "xno"])
+AM_CONDITIONAL([ENABLE_LASTLOG], [test "x$enable_lastlog" = "xyes"])
 
 AC_SUBST([LIBSYSTEMD])
 if test "X$enable_logind" = "Xyes"; then