summaryrefslogtreecommitdiff
path: root/mcon/U/d_poll.U
diff options
context:
space:
mode:
authorrmanfredi <rmanfredi@2592e710-e01b-42a5-8df0-11608a6cc53d>2010-11-27 11:55:39 +0000
committerrmanfredi <rmanfredi@2592e710-e01b-42a5-8df0-11608a6cc53d>2010-11-27 11:55:39 +0000
commit13158f86e3904284dce3dad36b64f07414459551 (patch)
tree12cc7b8d1b808c8c3505bb44cf067bd9ab98b1e6 /mcon/U/d_poll.U
parent194d1db97053d853d5f81c362c461d71c05ea80e (diff)
Applied mega patch from Christian Biere to greatly improve feature detection
and make a huge step towards better support for cross-compiling. git-svn-id: svn://svn.code.sf.net/p/dist/code/trunk/dist@34 2592e710-e01b-42a5-8df0-11608a6cc53d
Diffstat (limited to 'mcon/U/d_poll.U')
-rw-r--r--mcon/U/d_poll.U33
1 files changed, 30 insertions, 3 deletions
diff --git a/mcon/U/d_poll.U b/mcon/U/d_poll.U
index 54db1b8..cc7d659 100644
--- a/mcon/U/d_poll.U
+++ b/mcon/U/d_poll.U
@@ -15,7 +15,7 @@
?RCS: Revision 3.0.1.1 1995/01/11 15:26:31 ram
?RCS: patch45: created
?RCS:
-?MAKE:d_poll: Inlibc
+?MAKE:d_poll: Trylink cat i_poll i_syspoll
?MAKE: -pick add $@ %<
?S:d_poll:
?S: This variable conditionally defines the HAS_POLL symbol, which
@@ -31,6 +31,33 @@
?H:.
?LINT:set d_poll
: see if poll exists
-set poll d_poll
-eval $inlibc
+$cat >try.c <<EOC
+#include <sys/types.h>
+#$i_syspoll I_SYS_POLL
+#ifdef I_SYS_POLL
+#include <sys/poll.h>
+#endif
+#$i_poll I_POLL
+#ifdef I_POLL
+#include <poll.h>
+#endif
+int main(void)
+{
+ static int ret, timeout;
+ static unsigned n;
+ static struct pollfd pfd;
+ pfd.fd |= 1;
+ pfd.revents |= 1;
+ pfd.events |= POLLIN;
+ pfd.events |= POLLOUT;
+ pfd.events |= POLLPRI;
+ pfd.events |= POLLERR;
+ pfd.events |= POLLHUP;
+ pfd.events |= POLLNVAL;
+ ret |= poll(&pfd, n, timeout);
+ return ret ? 0 : 1;
+}
+EOC
+set d_poll
+eval $trylink