[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
poll-h: create poll.h always
From: |
Bruno Haible |
Subject: |
poll-h: create poll.h always |
Date: |
Wed, 29 Sep 2010 01:51:09 +0200 |
User-agent: |
KMail/1.9.9 |
Eric Blake wrote:
> we need a new module poll-h if you want a working poll.h
> [pollfd, nfds_t, and the various POLL macros] that can be used for
> GNULIB_POSIXCHECK conformance
For using GNULIB_POSIXCHECK it is also necessary to create the .h file on
all platforms. Like what you did on 2009-12-31.
2010-09-28 Bruno Haible <address@hidden>
poll-h: Create poll.h on all platforms.
* lib/poll.in.h: Use double-inclusion guard. Don't define POLL*,
struct pollfd, nfds_t, INFTIM when the system has <poll.h>.
* m4/poll_h.m4 (gl_POLL_H): Set HAVE_POLL_H. Invoke
gl_CHECK_NEXT_HEADERS. Don't set POLL_H.
(gl_REPLACE_POLL_H): Don't set POLL_H.
(gl_POLL_H_DEFAULTS): Don't initialize POLL_H.
* modules/poll-h (Depends-on): Add include_next.
(Makefile.am): Create poll.h unconditionally. Substitute also
HAVE_POLL_H, INCLUDE_NEXT, PRAGMA_SYSTEM_HEADER, NEXT_POLL_H.
--- lib/poll.in.h.orig Wed Sep 29 01:43:50 2010
+++ lib/poll.in.h Wed Sep 29 01:35:54 2010
@@ -20,6 +20,17 @@
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#ifndef _GL_POLL_H
+
+#if __GNUC__ >= 3
address@hidden@
+#endif
+
+/* The include_next requires a split double-inclusion guard. */
+#if @HAVE_POLL_H@
+# @INCLUDE_NEXT@ @NEXT_POLL_H@
+#endif
+
+#ifndef _GL_POLL_H
#define _GL_POLL_H
@@ -28,17 +39,19 @@
/* The definition of _GL_WARN_ON_USE is copied here. */
+#if address@hidden@
+
/* fake a poll(2) environment */
-#define POLLIN 0x0001 /* any readable data available */
-#define POLLPRI 0x0002 /* OOB/Urgent readable data */
-#define POLLOUT 0x0004 /* file descriptor is writeable */
-#define POLLERR 0x0008 /* some poll error occurred */
-#define POLLHUP 0x0010 /* file descriptor was "hung up" */
-#define POLLNVAL 0x0020 /* requested events "invalid" */
-#define POLLRDNORM 0x0040
-#define POLLRDBAND 0x0080
-#define POLLWRNORM 0x0100
-#define POLLWRBAND 0x0200
+# define POLLIN 0x0001 /* any readable data available */
+# define POLLPRI 0x0002 /* OOB/Urgent readable data */
+# define POLLOUT 0x0004 /* file descriptor is writeable */
+# define POLLERR 0x0008 /* some poll error occurred */
+# define POLLHUP 0x0010 /* file descriptor was "hung up" */
+# define POLLNVAL 0x0020 /* requested events "invalid" */
+# define POLLRDNORM 0x0040
+# define POLLRDBAND 0x0080
+# define POLLWRNORM 0x0100
+# define POLLWRBAND 0x0200
struct pollfd
{
@@ -49,6 +62,14 @@
typedef unsigned long nfds_t;
+/* Define INFTIM only if doing so conforms to POSIX. */
+# if !defined (_POSIX_C_SOURCE) && !defined (_XOPEN_SOURCE)
+# define INFTIM (-1)
+# endif
+
+#endif
+
+
#if @GNULIB_POLL@
# if @REPLACE_POLL@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -72,10 +93,6 @@
# endif
#endif
-/* Define INFTIM only if doing so conforms to POSIX. */
-#if !defined (_POSIX_C_SOURCE) && !defined (_XOPEN_SOURCE)
-#define INFTIM (-1)
-#endif
-
#endif /* _GL_POLL_H */
+#endif /* _GL_POLL_H */
--- m4/poll_h.m4.orig Wed Sep 29 01:43:50 2010
+++ m4/poll_h.m4 Wed Sep 29 01:40:05 2010
@@ -13,9 +13,16 @@
AC_REQUIRE([gl_POLL_H_DEFAULTS])
AC_CHECK_HEADERS_ONCE([poll.h])
- if test $ac_cv_header_poll_h != yes; then
+ if test $ac_cv_header_poll_h = yes; then
+ HAVE_POLL_H=1
+ else
+ HAVE_POLL_H=0
gl_REPLACE_POLL_H
fi
+ AC_SUBST([HAVE_POLL_H])
+
+ dnl <poll.h> is always overridden, because of GNULIB_POSIXCHECK.
+ gl_CHECK_NEXT_HEADERS([poll.h])
dnl Check for declarations of anything we want to poison if the
dnl corresponding gnulib module is not in use.
@@ -26,8 +33,8 @@
dnl Unconditionally enables the replacement of <poll.h>.
AC_DEFUN([gl_REPLACE_POLL_H],
[
- AC_REQUIRE([gl_POLL_H_DEFAULTS])
- POLL_H='poll.h'
+ dnl This is a no-op, because <poll.h> is always overridden.
+ :
])
AC_DEFUN([gl_POLL_MODULE_INDICATOR],
@@ -43,7 +50,6 @@
[
GNULIB_POLL=0; AC_SUBST([GNULIB_POLL])
dnl Assume proper GNU behavior unless another module says otherwise.
- POLL_H=''; AC_SUBST([POLL_H])
HAVE_POLL=1; AC_SUBST([HAVE_POLL])
REPLACE_POLL=0; AC_SUBST([REPLACE_POLL])
])
--- modules/poll-h.orig Wed Sep 29 01:43:50 2010
+++ modules/poll-h Wed Sep 29 01:40:55 2010
@@ -8,20 +8,25 @@
Depends-on:
c++defs
extensions
+include_next
warn-on-use
configure.ac:
gl_POLL_H
Makefile.am:
-BUILT_SOURCES += $(POLL_H)
+BUILT_SOURCES += poll.h
# We need the following in order to create <poll.h> when the system
# doesn't have one.
poll.h: poll.in.h $(CXXDEFS_H) $(WARN_ON_USE_H)
$(AM_V_GEN)rm -f address@hidden $@ && \
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
- sed -e 's|@''GNULIB_POLL''@|$(GNULIB_POLL)|g' \
+ sed -e 's|@''HAVE_POLL_H''@|$(HAVE_POLL_H)|g' \
+ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
+ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
+ -e 's|@''NEXT_POLL_H''@|$(NEXT_POLL_H)|g' \
+ -e 's|@''GNULIB_POLL''@|$(GNULIB_POLL)|g' \
-e 's|@''HAVE_POLL''@|$(HAVE_POLL)|g' \
-e 's|@''REPLACE_POLL''@|$(REPLACE_POLL)|g' \
-e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \