Skip to content

Commit 7338f3b

Browse files
committed
compat: Split poll & pollfd detection
Some systems might have one but not the other
1 parent 53921c3 commit 7338f3b

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

compat/compat.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ extern int inet_pton(int af, const char *src, void *dst);
108108

109109
#endif // _WIN32
110110

111-
#ifndef HAVE_POLL
111+
#ifndef HAVE_STRUCT_POLLFD
112112
enum
113113
{
114114
POLLERR=0x1,
@@ -127,6 +127,9 @@ struct pollfd
127127
unsigned events;
128128
unsigned revents;
129129
};
130+
#endif
131+
132+
#ifndef HAVE_POLL
130133
int poll(struct pollfd *fds, unsigned nfds, int timeout);
131134
#endif
132135

configure.ac

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,17 @@ AC_LINK_IFELSE([
245245

246246
LIBS=${LIBS_SAVE}
247247

248+
dnl Check for struct pollfd
249+
AC_CHECK_TYPES([struct pollfd],,,
250+
[#include <sys/types.h>
251+
#if HAVE_POLL
252+
# include <poll.h>
253+
#elif defined (_WIN32)
254+
# include <winsock2.h>
255+
#endif
256+
])
257+
258+
248259
AC_CHECK_MEMBER([struct ifaddrs.ifa_addr],[
249260
AC_DEFINE([HAVE_IFADDRS],[1],[Define to 1 if you have ifaddrs.ifa_addr function])],
250261
[],[[#include <ifaddrs.h>]])

0 commit comments

Comments
 (0)