]> Savannah Git Hosting - gnulib.git/commitdiff
login_tty: Fix detection of declaration (regression 2023-01-19).
authorBruno Haible <bruno@clisp.org>
Sat, 21 Jan 2023 20:00:19 +0000 (21:00 +0100)
committerBruno Haible <bruno@clisp.org>
Sat, 21 Jan 2023 20:05:00 +0000 (21:05 +0100)
* m4/pty.m4 (gl_FUNC_LOGIN_TTY): Check for the three possible header
files.

ChangeLog
m4/pty.m4

index 1de0058d5e7598dc063e74577c2569ba196385ae..cc88b5cdef81176976043fb3e8264987010afc2d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2023-01-21  Bruno Haible  <bruno@clisp.org>
+
+       login_tty: Fix detection of declaration (regression 2023-01-19).
+       * m4/pty.m4 (gl_FUNC_LOGIN_TTY): Check for the three possible header
+       files.
+
 2023-01-21  Bruno Haible  <bruno@clisp.org>
 
        alignasof tests: Rename test file.
index 54523fdac0c727dc8272938755499f22a0103951..f6b5bb3115171ef7ac1ed61a9e89ec117fc9ed5c 100644 (file)
--- a/m4/pty.m4
+++ b/m4/pty.m4
@@ -1,4 +1,4 @@
-# pty.m4 serial 16
+# pty.m4 serial 17
 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,
@@ -154,8 +154,19 @@ AC_DEFUN([gl_FUNC_LOGIN_TTY],
 [
   AC_REQUIRE([gl_PTY_LIB])
 
+  AC_CHECK_HEADERS_ONCE([utmp.h util.h libutil.h])
   gl_saved_libs="$LIBS"
   LIBS="$LIBS $PTY_LIB"
-  gl_CHECK_FUNCS_ANDROID([login_tty], [[#include <utmp.h>]])
+  gl_CHECK_FUNCS_ANDROID([login_tty], [[
+    #include <sys/types.h>
+    #if HAVE_UTMP_H
+    # include <utmp.h>
+    #endif
+    #if HAVE_UTIL_H
+    # include <util.h>
+    #elif HAVE_LIBUTIL_H
+    # include <libutil.h>
+    #endif
+  ]])
   LIBS="$gl_saved_LIBS"
 ])