diff -ru xproto-7.0.19.orig/Xpoll.h.in xproto-7.0.19/Xpoll.h.in --- xproto-7.0.19.orig/Xpoll.h.in 2010-11-08 08:35:48 +0100 +++ xproto-7.0.19/Xpoll.h.in 2010-11-08 08:45:04 +0100 @@ -151,7 +151,7 @@ } #else /* USE_POLL */ -#include +#include <@USE_POLL_HEADER@> #endif /* USE_POLL */ #else /* WIN32 */ diff -ru xproto-7.0.19.orig/configure.ac xproto-7.0.19/configure.ac --- xproto-7.0.19.orig/configure.ac 2010-11-08 08:35:47 +0100 +++ xproto-7.0.19/configure.ac 2010-11-08 08:44:48 +0100 @@ -44,7 +44,7 @@ [WIDEPROTO=$enableval], [WIDEPROTO=auto]) -AC_CHECK_HEADERS([sys/select.h sys/param.h sys/types.h sys/time.h]) +AC_CHECK_HEADERS([sys/select.h sys/param.h sys/types.h sys/time.h sys/poll.h poll.h]) # Handle Xpoll.h.in # Avoid determining fds_bits on WIN32 hosts (not including cygwin) @@ -104,6 +104,20 @@ AC_SUBST([USE_FDS_BITS]) +# Handle poll.h include from Xpoll.h. don't rely on configure checks +# performed by other packages, and thus subst the correct header in. +AC_MSG_CHECKING([poll.h to include]) + +USE_POLL_HEADER="sys/poll.h" +if test "x$ac_cv_header_sys_poll_h" != xyes; then + if test "x$ac_cv_header_poll_h" = xyes; then + USE_POLL_HEADER="poll.h" + fi +fi + +AC_MSG_RESULT([$USE_POLL_HEADER]) +AC_SUBST([USE_POLL_HEADER]) + # Handle Xfuncproto.h AC_MSG_CHECKING([whether const prototypes are supported])