From dc7c42cdfec450f109151649544b88765877e4ab Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sat, 8 Apr 2023 12:08:03 +0200 Subject: [PATCH] login_tty: Fix compilation error in C++ mode on Solaris 11.4. * m4/login_tty.m4 (gl_FUNC_LOGIN_TTY): Test whether exists. Consider it when testing whether login_tty is declared. * lib/utmp.in.h: If none of and exists, include instead. * doc/glibc-functions/login_tty.texi: Document the Solaris 11.4 problem. --- ChangeLog | 9 +++++++++ doc/glibc-functions/login_tty.texi | 3 ++- lib/utmp.in.h | 5 ++++- m4/login_tty.m4 | 6 ++++-- 4 files changed, 19 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6e78d73fa0..5da003bd5b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2023-04-08 Bruno Haible + + login_tty: Fix compilation error in C++ mode on Solaris 11.4. + * m4/login_tty.m4 (gl_FUNC_LOGIN_TTY): Test whether exists. + Consider it when testing whether login_tty is declared. + * lib/utmp.in.h: If none of and exists, include + instead. + * doc/glibc-functions/login_tty.texi: Document the Solaris 11.4 problem. + 2023-04-08 Bruno Haible time: Fix compilation error in C++ mode on Solaris 11. diff --git a/doc/glibc-functions/login_tty.texi b/doc/glibc-functions/login_tty.texi index 3e743b1527..42e7068d91 100644 --- a/doc/glibc-functions/login_tty.texi +++ b/doc/glibc-functions/login_tty.texi @@ -25,7 +25,8 @@ Minix 3.1.8, AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 11.3, Android 5.1. @item This function is declared in @code{} on glibc, Cygwin, Android, in @code{} on macOS 11.1, NetBSD 5.0, OpenBSD 3.8, -and in @code{} on FreeBSD 13.0, Haiku. +in @code{} on FreeBSD 13.0, Haiku, +and in @code{} on Solaris 11.4. @c Also note that @code{} is @c a prerequisite of @code{} on FreeBSD 8.0, OpenBSD 4.6 and @c of @code{} on FreeBSD 8.0. diff --git a/lib/utmp.in.h b/lib/utmp.in.h index c33b3d2469..2c8c79d129 100644 --- a/lib/utmp.in.h +++ b/lib/utmp.in.h @@ -33,13 +33,16 @@ #define _@GUARD_PREFIX@_UTMP_H /* FreeBSD, NetBSD, OpenBSD, macOS, Minix, Haiku declare login_tty in - or , not in . */ + or , not in . Solaris declares it in + , not in . */ /* But in any case avoid namespace pollution on glibc systems. */ #if (@GNULIB_LOGIN_TTY@ || defined GNULIB_POSIXCHECK) && ! defined __GLIBC__ # if HAVE_UTIL_H /* macOS, NetBSD, OpenBSD, Minix */ # include # elif HAVE_LIBUTIL_H /* FreeBSD, Haiku */ # include +# elif HAVE_TERMIOS_H /* Solaris */ +# include # endif #endif diff --git a/m4/login_tty.m4 b/m4/login_tty.m4 index ca15e6aabb..734e64c4f8 100644 --- a/m4/login_tty.m4 +++ b/m4/login_tty.m4 @@ -1,4 +1,4 @@ -# login_tty.m4 serial 2 +# login_tty.m4 serial 3 dnl Copyright (C) 2010-2023 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -8,7 +8,7 @@ AC_DEFUN([gl_FUNC_LOGIN_TTY], [ AC_REQUIRE([gl_PTY_LIB]) - AC_CHECK_HEADERS_ONCE([utmp.h util.h libutil.h]) + AC_CHECK_HEADERS_ONCE([utmp.h util.h libutil.h termios.h]) gl_saved_libs="$LIBS" LIBS="$LIBS $PTY_LIB" gl_CHECK_FUNCS_ANDROID([login_tty], [[ @@ -20,6 +20,8 @@ AC_DEFUN([gl_FUNC_LOGIN_TTY], # include #elif HAVE_LIBUTIL_H # include + #elif HAVE_TERMIOS_H + # include #endif ]]) LIBS="$gl_saved_LIBS" -- 2.39.5