1
0
mirror of https://git.savannah.gnu.org/git/gnulib.git synced 2026-10-24 00:48:56 +03:00

getlogin: Fix link error with option --with-systemd (regr. 2025-03-09).

Reported by Helmut Grohne <helmut@subdivi.de> in
<https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1129960>.

* m4/getlogin_r.m4 (gl_FUNC_GETLOGIN_R): Inline the gl_LIB_GETLOGIN
macro, assigning to GETLOGIN_R_LIB instead of GETLOGIN_LIB.
* m4/getlogin.m4 (gl_FUNC_GETLOGIN): Inline the gl_LIB_GETLOGIN macro.
Consider $READUTMP_LIB for $GETLOGIN_LIB.
(gl_LIB_GETLOGIN): Remove macro.
* modules/getlogin (configure.ac): Don't require gl_LIB_GETLOGIN.
* modules/getlogin_r (configure.ac): Likewise.
* modules/getlogin_r-tests (Makefile.am): Update link requirements for
test-getlogin_r.
* NEWS: Mention the change in the getlogin_r module.
This commit is contained in:
Bruno Haible
2026-08-27 20:11:33 +02:00
parent de89aaed82
commit 3058a5d9f0
7 changed files with 37 additions and 14 deletions

View File

@@ -1,3 +1,19 @@
2026-08-27 Bruno Haible <bruno@clisp.org>
getlogin: Fix link error with option --with-systemd (regr. 2025-03-09).
Reported by Helmut Grohne <helmut@subdivi.de> in
<https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1129960>.
* m4/getlogin_r.m4 (gl_FUNC_GETLOGIN_R): Inline the gl_LIB_GETLOGIN
macro, assigning to GETLOGIN_R_LIB instead of GETLOGIN_LIB.
* m4/getlogin.m4 (gl_FUNC_GETLOGIN): Inline the gl_LIB_GETLOGIN macro.
Consider $READUTMP_LIB for $GETLOGIN_LIB.
(gl_LIB_GETLOGIN): Remove macro.
* modules/getlogin (configure.ac): Don't require gl_LIB_GETLOGIN.
* modules/getlogin_r (configure.ac): Likewise.
* modules/getlogin_r-tests (Makefile.am): Update link requirements for
test-getlogin_r.
* NEWS: Mention the change in the getlogin_r module.
2026-08-27 Bruno Haible <bruno@clisp.org>
sd-dlopen: Fix test compilation error on Solaris 11.4.

3
NEWS
View File

@@ -78,6 +78,9 @@ User visible incompatible changes
Date Modules Changes
2026-08-27 getlogin_r The link requirements are changed from
$(GETLOGIN_LIB) to $(GETLOGIN_R_LIB).
2026-08-10 eloop-threshold Now include <min-eloop-threshold.h> and use
MIN_ELOOP_THRESHOLD rather than including
<eloop-threshold.h> and using __eloop_threshold ().

View File

@@ -1,5 +1,5 @@
# getlogin.m4
# serial 8
# serial 9
dnl Copyright (C) 2010-2026 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -9,6 +9,8 @@ dnl This file is offered as-is, without any warranty.
AC_DEFUN([gl_FUNC_GETLOGIN],
[
AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
AC_REQUIRE([AC_CANONICAL_HOST])
AC_REQUIRE([gl_READUTMP])
AC_CHECK_DECLS_ONCE([getlogin])
if test $ac_cv_have_decl_getlogin = no; then
HAVE_DECL_GETLOGIN=0
@@ -18,7 +20,6 @@ AC_DEFUN([gl_FUNC_GETLOGIN],
HAVE_GETLOGIN=0
else
dnl On musl libc, getlogin returns getenv ("LOGNAME").
AC_REQUIRE([AC_CANONICAL_HOST])
AC_CACHE_CHECK([whether getlogin works],
[gl_cv_func_getlogin_works],
[
@@ -64,19 +65,16 @@ main (void)
*) REPLACE_GETLOGIN=1 ;;
esac
fi
])
dnl Determines the library needed by the implementation of the
dnl getlogin and getlogin_r functions.
AC_DEFUN([gl_LIB_GETLOGIN],
[
AC_REQUIRE([AC_CANONICAL_HOST])
case $host_os in
mingw* | windows*)
GETLOGIN_LIB='-ladvapi32' ;;
*)
GETLOGIN_LIB= ;;
esac
if test $HAVE_GETLOGIN = 0 || test $REPLACE_GETLOGIN = 1; then
GETLOGIN_LIB="${GETLOGIN_LIB} ${READUTMP_LIB}"
fi
AC_SUBST([GETLOGIN_LIB])
dnl For backward compatibility.
LIB_GETLOGIN="$GETLOGIN_LIB"

View File

@@ -1,5 +1,5 @@
# getlogin_r.m4
# serial 17
# serial 18
dnl Copyright (C) 2005-2007, 2009-2026 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -14,6 +14,7 @@ dnl
AC_DEFUN([gl_FUNC_GETLOGIN_R],
[
AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
AC_REQUIRE([AC_CANONICAL_HOST])
dnl Persuade glibc <unistd.h> to declare getlogin_r().
dnl Persuade Solaris <unistd.h> to provide the POSIX compliant declaration of
@@ -36,7 +37,6 @@ AC_DEFUN([gl_FUNC_GETLOGIN_R],
dnl On Mac OS X 10.13, getlogin_r returns a truncated result
dnl if the buffer is not large enough.
dnl On musl libc, getlogin_r returns getenv ("LOGNAME").
AC_REQUIRE([AC_CANONICAL_HOST])
AC_CACHE_CHECK([whether getlogin_r works],
[gl_cv_func_getlogin_r_works],
[
@@ -95,6 +95,14 @@ main (void)
*) REPLACE_GETLOGIN_R=1 ;;
esac
fi
case $host_os in
mingw* | windows*)
GETLOGIN_R_LIB='-ladvapi32' ;;
*)
GETLOGIN_R_LIB= ;;
esac
AC_SUBST([GETLOGIN_R_LIB])
])
AC_DEFUN([gl_PREREQ_GETLOGIN_R],

View File

@@ -15,7 +15,6 @@ gl_FUNC_GETLOGIN
gl_CONDITIONAL([GL_COND_OBJ_GETLOGIN],
[test $HAVE_GETLOGIN = 0 || test $REPLACE_GETLOGIN = 1])
gl_UNISTD_MODULE_INDICATOR([getlogin])
AC_REQUIRE([gl_LIB_GETLOGIN])
Makefile.am:
if GL_COND_OBJ_GETLOGIN

View File

@@ -21,7 +21,6 @@ AM_COND_IF([GL_COND_OBJ_GETLOGIN_R], [
gl_PREREQ_GETLOGIN_R
])
gl_UNISTD_MODULE_INDICATOR([getlogin_r])
AC_REQUIRE([gl_LIB_GETLOGIN])
Makefile.am:
if GL_COND_OBJ_GETLOGIN_R
@@ -32,7 +31,7 @@ Include:
<unistd.h>
Link:
$(GETLOGIN_LIB)
$(GETLOGIN_R_LIB)
License:
LGPLv2+

View File

@@ -13,4 +13,4 @@ configure.ac:
Makefile.am:
TESTS += test-getlogin_r
check_PROGRAMS += test-getlogin_r
test_getlogin_r_LDADD = $(LDADD) $(GETLOGIN_LIB)
test_getlogin_r_LDADD = $(LDADD) $(GETLOGIN_R_LIB)