summaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2023-04-13 21:43:51 +0200
committerBruno Haible <bruno@clisp.org>2023-04-13 21:43:51 +0200
commitffb4ed843f5a18175bc07ef190b9db700c3b5eba (patch)
tree26f180b7a05213c1ebde203afd21523d185c3247 /m4
parenta194861e540c2e278c716022f4ca4103710d1d8f (diff)
downloadgnulib-ffb4ed843f5a18175bc07ef190b9db700c3b5eba.tar.gz
utmp: Avoid using HAVE_* macros in *.in.h files.
* m4/pty_h.m4 (gl_PTY_CHECK_UTIL_H): New macro, extracted from gl_PTY_H. (gl_PTY_H): Invoke it. * m4/utmp_h.m4 (gl_UTMP_H): Invoke gl_PTY_CHECK_UTIL_H and set HAVE_TERMIOS_H. (gl_UTMP_H_DEFAULTS): Require gl_PTY_H_DEFAULTS, gl_TERMIOS_H_DEFAULTS. * modules/utmp (Files): Add m4/pty_h.m4, m4/termios_h.m4. (Makefile.am): Substitute also HAVE_UTIL_H, HAVE_LIBUTIL_H, HAVE_TERMIOS_H. * lib/utmp.in.h: Test HAVE_UTIL_H, HAVE_LIBUTIL_H, HAVE_TERMIOS_H as Autoconf variables.
Diffstat (limited to 'm4')
-rw-r--r--m4/pty_h.m423
-rw-r--r--m4/utmp_h.m413
2 files changed, 27 insertions, 9 deletions
diff --git a/m4/pty_h.m4 b/m4/pty_h.m4
index 1fce4b98e4..2c0f8bc9ea 100644
--- a/m4/pty_h.m4
+++ b/m4/pty_h.m4
@@ -1,4 +1,4 @@
-# pty_h.m4 serial 14
+# pty_h.m4 serial 15
dnl Copyright (C) 2009-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,
@@ -15,13 +15,7 @@ AC_DEFUN_ONCE([gl_PTY_H],
AC_CHECK_HEADERS_ONCE([pty.h])
if test $ac_cv_header_pty_h != yes; then
HAVE_PTY_H=0
- AC_CHECK_HEADERS([util.h libutil.h])
- if test $ac_cv_header_util_h = yes; then
- HAVE_UTIL_H=1
- fi
- if test $ac_cv_header_libutil_h = yes; then
- HAVE_LIBUTIL_H=1
- fi
+ gl_PTY_CHECK_UTIL_H
AC_CHECK_HEADERS_ONCE([termios.h])
else # Have <pty.h>, assume forkpty is declared there.
HAVE_PTY_H=1
@@ -50,6 +44,19 @@ AC_DEFUN_ONCE([gl_PTY_H],
]], [forkpty openpty])
])
+dnl Test for <util.h> and <libutil.h>.
+AC_DEFUN([gl_PTY_CHECK_UTIL_H],
+[
+ AC_REQUIRE([gl_PTY_H_DEFAULTS])
+ AC_CHECK_HEADERS([util.h libutil.h])
+ if test $ac_cv_header_util_h = yes; then
+ HAVE_UTIL_H=1
+ fi
+ if test $ac_cv_header_libutil_h = yes; then
+ HAVE_LIBUTIL_H=1
+ fi
+])
+
# gl_PTY_MODULE_INDICATOR([modulename])
# sets the shell variable that indicates the presence of the given module
# to a C preprocessor expression that will evaluate to 1.
diff --git a/m4/utmp_h.m4 b/m4/utmp_h.m4
index fff6dbdfe7..6dd5eb989b 100644
--- a/m4/utmp_h.m4
+++ b/m4/utmp_h.m4
@@ -5,7 +5,7 @@
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
-# serial 1
+# serial 2
AC_DEFUN_ONCE([gl_UTMP_H],
[
@@ -21,6 +21,13 @@ AC_DEFUN_ONCE([gl_UTMP_H],
fi
AC_SUBST([HAVE_UTMP_H])
+ gl_PTY_CHECK_UTIL_H
+
+ AC_CHECK_HEADERS_ONCE([termios.h])
+ if test $ac_cv_header_termios_h != yes; then
+ HAVE_TERMIOS_H=0
+ fi
+
dnl Check for declarations of anything we want to poison if the
dnl corresponding gnulib module is not in use, and which is not
dnl guaranteed by C89.
@@ -58,6 +65,10 @@ AC_DEFUN([gl_UTMP_H_REQUIRE_DEFAULTS],
AC_DEFUN([gl_UTMP_H_DEFAULTS],
[
+ dnl For HAVE_UTIL_H, HAVE_LIBUTIL_H.
+ AC_REQUIRE([gl_PTY_H_DEFAULTS])
+ dnl For HAVE_TERMIOS_H.
+ AC_REQUIRE([gl_TERMIOS_H_DEFAULTS])
dnl Assume proper GNU behavior unless another module says otherwise.
HAVE_LOGIN_TTY=1; AC_SUBST([HAVE_LOGIN_TTY])
REPLACE_LOGIN_TTY=0; AC_SUBST([REPLACE_LOGIN_TTY])