Add a link warning when the 'select' module is not used.
authorBruno Haible <bruno@clisp.org>
Sun, 5 Oct 2008 23:10:08 +0000 (01:10 +0200)
committerBruno Haible <bruno@clisp.org>
Sun, 5 Oct 2008 23:10:08 +0000 (01:10 +0200)
ChangeLog
lib/sys_select.in.h
modules/sys_select

index bbc3db5..052772a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2008-10-05  Bruno Haible  <bruno@clisp.org>
+
+       * lib/sys_select.in.h: Include the GL_LINK_WARNING definition.
+       (select): Add a link warning when the 'select' module is not used.
+       * modules/sys_select (Depends-on): Add link-warning.
+       (Makefile.am): Substitute the definition of GL_LINK_WARNING.
+       Suggested by Paolo Bonzini.
+
 2008-10-05  Jim Meyering  <meyering@redhat.com>
 
        bootstrap: check for LT_INIT more portably
index 5a4b7a5..ac60020 100644 (file)
 
 # include <sys/socket.h>
 
-# if @HAVE_WINSOCK2_H@
+/* The definition of GL_LINK_WARNING is copied here.  */
 
-#  ifdef __cplusplus
+# ifdef __cplusplus
 extern "C" {
-#  endif
+# endif
 
-#  if @GNULIB_SELECT@
+# if @GNULIB_SELECT@
+#  if @HAVE_WINSOCK2_H@
 #   undef select
 #   define select rpl_select
 extern int rpl_select (int, fd_set *, fd_set *, fd_set *, struct timeval *);
-#  else
-#   undef select
-#   define select select_used_without_requesting_gnulib_module_select
 #  endif
+# elif @HAVE_WINSOCK2_H@
+#  undef select
+#  define select select_used_without_requesting_gnulib_module_select
+# elif defined GNULIB_POSIXCHECK
+#  undef select
+#  define select(n,r,w,e,t) \
+     (GL_LINK_WARNING ("select is not always POSIX compliant - " \
+                       "use gnulib module for portability"), \
+      select (n, r, w, e, t))
+# endif
 
-#  ifdef __cplusplus
+# ifdef __cplusplus
 }
-#  endif
-
 # endif
 
 #endif
index ffb5fae..c893e7c 100644 (file)
@@ -7,6 +7,7 @@ m4/sys_select_h.m4
 
 Depends-on:
 include_next
+link-warning
 sys_socket
 sys_time
 
@@ -29,6 +30,7 @@ sys/select.h: sys_select.in.h
              -e 's|@''HAVE_SYS_SELECT_H''@|$(HAVE_SYS_SELECT_H)|g' \
              -e 's|@''GNULIB_SELECT''@|$(GNULIB_SELECT)|g' \
              -e 's|@''HAVE_WINSOCK2_H''@|$(HAVE_WINSOCK2_H)|g' \
+             -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
              < $(srcdir)/sys_select.in.h; \
        } > $@-t
        mv $@-t $@