summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorSimon McVittie <smcv@collabora.com>2018-10-22 11:45:45 +0100
committerSimon McVittie <smcv@collabora.com>2018-11-16 15:07:39 +0000
commit6cb51b22fa971e16554638ec3725b6126f284999 (patch)
tree8a46dfa0953d137ae031eda7c1c60be22f6004c0 /configure.ac
parenta2a8510e8efb67c8fe2e44831ceff51d17dc0064 (diff)
downloaddbus-6cb51b22fa971e16554638ec3725b6126f284999.tar.gz
dbus-6cb51b22fa971e16554638ec3725b6126f284999.tar.bz2
dbus-6cb51b22fa971e16554638ec3725b6126f284999.zip
build: Never use poll() on Darwin family (macOS, etc.) or Interix
Doing a runtime check in configure.ac (AC_RUN_IFELSE) has several disadvantages: * It doesn't work when cross-compiling. For example, if we build macOS binaries on a Linux system, we'd assume that poll() works, but in fact it won't. * It checks the build system capabilities, but that is not necessarily appropriate if (for example) a macOS 10.10 user builds binaries that could be used by macOS 10.12 or macOS 10.9 users. * It checks for one specific failure mode, but macOS seems to have a history of various implementation issues in poll(). * If we want it to work in CMake, we have to duplicate it in the CMake build system. None of these is a showstopper on its own, but the combination of all of them makes the current approach to avoiding the broken poll() on macOS look unreliable. libcurl, a widely-portable library making extensive use of sockets, specifically doesn't use poll() on Darwin (macOS, iOS, etc.) or on Interix; let's follow their example here. See also https://bugzilla.gnome.org/show_bug.cgi?id=302672 and https://daniel.haxx.se/blog/2016/10/11/poll-on-mac-10-12-is-broken/ for some relevant history. Signed-off-by: Simon McVittie <smcv@collabora.com> Resolves: https://gitlab.freedesktop.org/dbus/dbus/issues/232 (cherry picked from commit 0414ea65ca8196e328da09c3a2324d7765fba8c4)
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac28
1 files changed, 0 insertions, 28 deletions
diff --git a/configure.ac b/configure.ac
index 09a12ab1..0a18ab62 100644
--- a/configure.ac
+++ b/configure.ac
@@ -630,34 +630,6 @@ fi
AC_CHECK_HEADERS_ONCE([sys/prctl.h])
AC_CHECK_FUNCS_ONCE([prctl raise])
-#### Check for broken poll; taken from Glib's configure
-
-AC_MSG_CHECKING([for broken poll])
-AC_RUN_IFELSE([AC_LANG_SOURCE([[
- #include <stdlib.h>
- #include <fcntl.h>
- #include <poll.h>
- #ifdef HAVE_SYS_POLL_H
- #include <sys/poll.h>
- #endif
- int main(void) {
- struct pollfd fds[1];
- int fd;
- fd = open("/dev/null", 1);
- fds[0].fd = fd;
- fds[0].events = POLLIN;
- fds[0].revents = 0;
- if (poll(fds, 1, 0) < 0 || (fds[0].revents & POLLNVAL) != 0) {
- exit(1); /* Does not work for devices -- fail */
- }
- exit(0);
- }]])],
- [broken_poll=no],
- [broken_poll=yes
- AC_DEFINE(BROKEN_POLL,1,[poll doesn't work on devices])],
- [broken_poll="no (cross compiling)"])
-AC_MSG_RESULT($broken_poll)
-
AC_MSG_CHECKING(for dirfd)
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include <sys/types.h>