bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Detection of utmp/pty for *BSD.


From: Bruno Haible
Subject: Re: Detection of utmp/pty for *BSD.
Date: Fri, 10 Sep 2010 12:09:04 +0200
User-agent: KMail/1.9.9

Hi Mats,

Thank you for the additional details. I'm applying the attached workaround.

> I have verified the above failures with the given snippets,

Thanks. These are precisely the kind of tests that are most convincing
evidence.

> Like there is a test whether <sys/socket.h> is self-contained
> in any given OS, my observations suggest that similar tests
> for self-containedness of <utmp.h> and <libutil.h> would
> indeed improve the relevance of the autoconfiguration.

The test whether <sys/socket.h> and other header files are self-contained
is present because gnulib wants to allow the user to program according to
POSIX, and in POSIX <sys/socket.h> does not have prerequisite includes.
But <utmp.h> and <libutil.h> are not specified in POSIX, therefore it is
not required for gnulib to present a self-contained facade of them to the
user. But I'm adding a warning about it to the manual.

> 1. m4/readutmp.m4
> 
>    This concerns OpenBSD and FreeBSD.
> 
>    The test must be reformulated using
> 
>      #ifdef HAVE_UTMP_H
>      # if 
>          [...]
>      # endif
>      # include <sys/types.h>
>      # include <utmp.h>
>      #endif

Here <sys/types.h> was supposed to be included as part of $ac_includes_default.
Since ac_includes_default is undocumented, I'm changing it to
AC_INCLUDES_DEFAULT.


2010-09-10  Bruno Haible  <address@hidden>

        pty, readutmp: Fix for FreeBSD 8.0 and OpenBSD 4.6.
        * doc/glibc-functions/login_tty.texi: Mention the include file problem
        on FreeBSD 8.0 and OpenBSD 4.6.
        * lib/pty.in.h: Include <sys/types.h> before <libutil.h>.
        * m4/pty_h.m4 (gl_PTY_H): Likewise.
        * m4/pty.m4 (gl_FUNC_FORKPTY, gl_FUNC_OPENPTY): Likewise.
        * m4/readutmp.m4 (gl_READUTMP): Include <sys/types.h> before <utmp.h>.
        Invoke AC_INCLUDES_DEFAULT instead of using the undocumented variable
        ac_includes_default.
        Reported by Mats Erik Andersson <address@hidden>.

--- doc/glibc-functions/login_tty.texi.orig     Fri Sep 10 11:55:36 2010
+++ doc/glibc-functions/login_tty.texi  Fri Sep 10 11:52:05 2010
@@ -25,5 +25,7 @@
 This function is declared in @code{<utmp.h>} on glibc, Cygwin,
 in @code{<util.h>} on MacOS X 10.3, NetBSD 3.0, OpenBSD 3.8,
 in @code{<libutil.h>} on FreeBSD 6.0, Haiku, and not declared at all
-on OSF/1 5.1, Interix 3.5.
+on OSF/1 5.1, Interix 3.5.  Also note that @code{<sys/types.h>} is
+a prerequisite of @code{<utmp.h>} on FreeBSD 8.0, OpenBSD 4.6 and
+of @code{<libutil.h>} on FreeBSD 8.0.
 @end itemize
--- lib/pty.in.h.orig   Fri Sep 10 11:55:36 2010
+++ lib/pty.in.h        Fri Sep 10 11:53:13 2010
@@ -34,6 +34,8 @@
 # include <util.h>
 #endif
 #if @HAVE_LIBUTIL_H@
+/* <sys/types.h> is a prerequisite of <libutil.h> on FreeBSD 8.0.  */
+# include <sys/types.h>
 # include <libutil.h>
 #endif
 
--- m4/pty.m4.orig      Fri Sep 10 11:55:36 2010
+++ m4/pty.m4   Fri Sep 10 11:54:41 2010
@@ -1,4 +1,4 @@
-# pty.m4 serial 7
+# pty.m4 serial 8
 dnl Copyright (C) 2010 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -28,6 +28,8 @@
   dnl We assume that forkpty exists (possibly in libc, possibly in libutil)
   dnl if and only if it is declared.
   AC_CHECK_DECLS([forkpty],,, [[
+/* <sys/types.h> is a prerequisite of <libutil.h> on FreeBSD 8.0.  */
+#include <sys/types.h>
 #if HAVE_PTY_H
 # include <pty.h>
 #endif
@@ -45,6 +47,8 @@
       [gl_cv_func_forkpty_const],
       [AC_COMPILE_IFELSE(
         [AC_LANG_PROGRAM([[
+/* <sys/types.h> is a prerequisite of <libutil.h> on FreeBSD 8.0.  */
+#include <sys/types.h>
 #if HAVE_PTY_H
 # include <pty.h>
 #endif
@@ -83,6 +87,8 @@
   dnl We assume that openpty exists (possibly in libc, possibly in libutil)
   dnl if and only if it is declared.
   AC_CHECK_DECLS([openpty],,, [[
+/* <sys/types.h> is a prerequisite of <libutil.h> on FreeBSD 8.0.  */
+#include <sys/types.h>
 #if HAVE_PTY_H
 # include <pty.h>
 #endif
@@ -100,6 +106,8 @@
       [gl_cv_func_openpty_const],
       [AC_COMPILE_IFELSE(
         [AC_LANG_PROGRAM([[
+/* <sys/types.h> is a prerequisite of <libutil.h> on FreeBSD 8.0.  */
+#include <sys/types.h>
 #if HAVE_PTY_H
 # include <pty.h>
 #endif
--- m4/pty_h.m4.orig    Fri Sep 10 11:55:36 2010
+++ m4/pty_h.m4 Fri Sep 10 11:54:54 2010
@@ -1,4 +1,4 @@
-# pty_h.m4 serial 9
+# pty_h.m4 serial 10
 dnl Copyright (C) 2009, 2010 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -32,6 +32,8 @@
   dnl Check for declarations of anything we want to poison if the
   dnl corresponding gnulib module is not in use.
   gl_WARN_ON_USE_PREPARE([[
+/* <sys/types.h> is a prerequisite of <libutil.h> on FreeBSD 8.0.  */
+#include <sys/types.h>
 #if HAVE_PTY_H
 # include <pty.h>
 #endif
--- m4/readutmp.m4.orig Fri Sep 10 11:55:36 2010
+++ m4/readutmp.m4      Fri Sep 10 11:46:38 2010
@@ -1,4 +1,4 @@
-# readutmp.m4 serial 16
+# readutmp.m4 serial 17
 dnl Copyright (C) 2002-2010 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -17,12 +17,14 @@
     AC_REQUIRE([AC_C_INLINE])
     AC_CHECK_FUNCS_ONCE([utmpname utmpxname])
     AC_CHECK_DECLS([getutent],,,[
+/* <sys/types.h> is a prerequisite of <utmp.h> on FreeBSD 8.0, OpenBSD 4.6.  */
+#include <sys/types.h>
 #ifdef HAVE_UTMP_H
 # include <utmp.h>
 #endif
 ])
     utmp_includes="\
-$ac_includes_default
+AC_INCLUDES_DEFAULT
 #ifdef HAVE_UTMPX_H
 # include <utmpx.h>
 #endif





reply via email to

[Prev in Thread] Current Thread [Next in Thread]