summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorPeter Stuge <peter@stuge.se>2010-10-30 22:07:37 +0200
committerPeter Stuge <peter@stuge.se>2011-06-13 22:01:42 +0200
commita120747d561929682cd0276ea4c13fb22fad8554 (patch)
tree856be9c9f9538047d9e2b41aaac1d102f3c266de /configure.ac
parent21d03d12f92c0d9bd7990861ca0ebf5009f82799 (diff)
configure.ac: Check for poll.h, and for nfds_t on Darwin
On Linux, assume nfds_t is always available. On Darwin, fall back to unsigned int when poll() exists but there is no nfds_t, such as on Mac OS X before 10.4. On Windows (both MinGW and Cygwin), always use unsigned int instead of nfds_t, and don't check for poll.h because we use our own poll() implementation.
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac9
1 files changed, 9 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index 3dcb02d..c6515ad 100644
--- a/configure.ac
+++ b/configure.ac
@@ -49,6 +49,8 @@ case $host in
THREAD_CFLAGS="-pthread"
PC_LIBS_PRIVATE="${PC_LIBS_PRIVATE} -pthread"
AM_LDFLAGS=""
+ AC_CHECK_HEADERS([poll.h])
+ AC_DEFINE([POLL_NFDS_TYPE],[nfds_t],[type of second poll() argument])
;;
*-darwin*)
AC_DEFINE(OS_DARWIN, [], [Darwin backend])
@@ -60,6 +62,11 @@ case $host in
THREAD_CFLAGS="-pthread"
PC_LIBS_PRIVATE="-Wl,-framework,IOKit -Wl,-framework,CoreFoundation -Wl,-prebind -no-undefined -pthread"
AM_LDFLAGS=${PC_LIBS_PRIVATE}
+ AC_CHECK_HEADERS([poll.h])
+ AC_CHECK_TYPE([nfds_t],
+ [AC_DEFINE([POLL_NFDS_TYPE],[nfds_t],[type of second poll() argument])],
+ [AC_DEFINE([POLL_NFDS_TYPE],[unsigned int],[type of second poll() argument])],
+ [#include <poll.h>])
;;
*-mingw*)
AC_DEFINE(OS_WINDOWS, [], [Windows backend])
@@ -72,6 +79,7 @@ case $host in
# -avoid-version to avoid a naming scheme such as libusb-0.dll
AM_LDFLAGS="-no-undefined -avoid-version --add-stdcall-alias"
AC_CHECK_TOOL(RC, windres, no)
+ AC_DEFINE([POLL_NFDS_TYPE],[unsigned int],[type of second poll() argument])
;;
*-cygwin*)
AC_DEFINE(OS_WINDOWS, [], [Windows backend])
@@ -84,6 +92,7 @@ case $host in
LIBS="${LIBS} ${PC_LIBS_PRIVATE}"
AM_LDFLAGS="-no-undefined -avoid-version"
AC_CHECK_TOOL(RC, windres, no)
+ AC_DEFINE([POLL_NFDS_TYPE],[unsigned int],[type of second poll() argument])
;;
*)
AC_MSG_ERROR([unsupported operating system])