]> Savannah Git Hosting - gnulib.git/commitdiff
login_tty: Fix compilation error in C++ mode on Solaris 11.4.
authorBruno Haible <bruno@clisp.org>
Sat, 8 Apr 2023 10:08:03 +0000 (12:08 +0200)
committerBruno Haible <bruno@clisp.org>
Sat, 8 Apr 2023 10:08:03 +0000 (12:08 +0200)
* m4/login_tty.m4 (gl_FUNC_LOGIN_TTY): Test whether <termios.h> exists.
Consider it when testing whether login_tty is declared.
* lib/utmp.in.h: If none of <util.h> and <libutil.h> exists, include
<termios.h> instead.
* doc/glibc-functions/login_tty.texi: Document the Solaris 11.4 problem.

ChangeLog
doc/glibc-functions/login_tty.texi
lib/utmp.in.h
m4/login_tty.m4

index 6e78d73fa08eadf9117e0269df402eda4e5c28ae..5da003bd5b9bde5bf00d462ede3c6069269465b9 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2023-04-08  Bruno Haible  <bruno@clisp.org>
+
+       login_tty: Fix compilation error in C++ mode on Solaris 11.4.
+       * m4/login_tty.m4 (gl_FUNC_LOGIN_TTY): Test whether <termios.h> exists.
+       Consider it when testing whether login_tty is declared.
+       * lib/utmp.in.h: If none of <util.h> and <libutil.h> exists, include
+       <termios.h> instead.
+       * doc/glibc-functions/login_tty.texi: Document the Solaris 11.4 problem.
+
 2023-04-08  Bruno Haible  <bruno@clisp.org>
 
        time: Fix compilation error in C++ mode on Solaris 11.
index 3e743b15277e87c2c7ba3eea8eb53107b1a9c407..42e7068d911c1ad8ad6d278acbe910ecab410fa1 100644 (file)
@@ -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{<utmp.h>} on glibc, Cygwin, Android,
 in @code{<util.h>} on macOS 11.1, NetBSD 5.0, OpenBSD 3.8,
-and in @code{<libutil.h>} on FreeBSD 13.0, Haiku.
+in @code{<libutil.h>} on FreeBSD 13.0, Haiku,
+and in @code{<termios.h>} on Solaris 11.4.
 @c Also note that @code{<sys/types.h>} is
 @c a prerequisite of @code{<utmp.h>} on FreeBSD 8.0, OpenBSD 4.6 and
 @c of @code{<libutil.h>} on FreeBSD 8.0.
index c33b3d24698888794e02472bd4ed4b759171e104..2c8c79d129ee4e4df88eec7b1b7fe6bd359380db 100644 (file)
 #define _@GUARD_PREFIX@_UTMP_H
 
 /* FreeBSD, NetBSD, OpenBSD, macOS, Minix, Haiku declare login_tty in
-   <util.h> or <libutil.h>, not in <utmp.h>.  */
+   <util.h> or <libutil.h>, not in <utmp.h>.  Solaris declares it in
+   <termios.h>, not in <utmp.h>.  */
 /* 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 <util.h>
 # elif HAVE_LIBUTIL_H /* FreeBSD, Haiku */
 #  include <libutil.h>
+# elif HAVE_TERMIOS_H /* Solaris */
+#  include <termios.h>
 # endif
 #endif
 
index ca15e6aabb29244f113f6583d55453c05e198425..734e64c4f854db6e6481892814baeea788fa8d3e 100644 (file)
@@ -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 <util.h>
     #elif HAVE_LIBUTIL_H
     # include <libutil.h>
+    #elif HAVE_TERMIOS_H
+    # include <termios.h>
     #endif
   ]])
   LIBS="$gl_saved_LIBS"