mirror of
https://https.git.savannah.gnu.org/git/gnulib.git
synced 2026-09-01 02:34:55 +00:00
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.
This commit is contained in:
@@ -1,3 +1,17 @@
|
||||
2023-04-13 Bruno Haible <bruno@clisp.org>
|
||||
|
||||
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.
|
||||
|
||||
2023-04-13 Bruno Haible <bruno@clisp.org>
|
||||
|
||||
getprogname: Avoid using HAVE_* macros in *.in.h files.
|
||||
|
||||
+3
-3
@@ -42,11 +42,11 @@
|
||||
<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 */
|
||||
# if @HAVE_UTIL_H@ /* macOS, NetBSD, OpenBSD, Minix */
|
||||
# include <util.h>
|
||||
# elif HAVE_LIBUTIL_H /* FreeBSD, Haiku */
|
||||
# elif @HAVE_LIBUTIL_H@ /* FreeBSD, Haiku */
|
||||
# include <libutil.h>
|
||||
# elif HAVE_TERMIOS_H /* Solaris */
|
||||
# elif @HAVE_TERMIOS_H@ /* Solaris */
|
||||
# include <termios.h>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
+15
-8
@@ -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.
|
||||
|
||||
+12
-1
@@ -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])
|
||||
|
||||
@@ -4,6 +4,8 @@ A GNU-like <utmp.h>.
|
||||
Files:
|
||||
lib/utmp.in.h
|
||||
m4/utmp_h.m4
|
||||
m4/pty_h.m4
|
||||
m4/termios_h.m4
|
||||
|
||||
Depends-on:
|
||||
gen-header
|
||||
@@ -30,6 +32,9 @@ utmp.h: utmp.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_USE_H)
|
||||
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
|
||||
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
|
||||
-e 's|@''NEXT_UTMP_H''@|$(NEXT_UTMP_H)|g' \
|
||||
-e 's|@''HAVE_UTIL_H''@|$(HAVE_UTIL_H)|g' \
|
||||
-e 's|@''HAVE_LIBUTIL_H''@|$(HAVE_LIBUTIL_H)|g' \
|
||||
-e 's|@''HAVE_TERMIOS_H''@|$(HAVE_TERMIOS_H)|g' \
|
||||
-e 's/@''GNULIB_LOGIN_TTY''@/$(GNULIB_LOGIN_TTY)/g' \
|
||||
-e 's|@''HAVE_LOGIN_TTY''@|$(HAVE_LOGIN_TTY)|g' \
|
||||
-e 's|@''REPLACE_LOGIN_TTY''@|$(REPLACE_LOGIN_TTY)|g' \
|
||||
|
||||
Reference in New Issue
Block a user