diff options
author | Daniel Stenberg <daniel@haxx.se> | 2016-10-11 11:04:06 +0200 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2016-10-11 11:05:06 +0200 |
commit | 9297ca49f5f3caca938a679b9c1feeb719e61ddb (patch) | |
tree | 8b16b1114711effa1d47f13e1df291cb52341d2c | |
parent | 358fd32820357c444c12386548872430be01549d (diff) | |
download | curl-9297ca49f5f3caca938a679b9c1feeb719e61ddb.tar.gz |
configure: detect the broken poll() in macOS 10.12
Fixes #1057
-rw-r--r-- | m4/curl-functions.m4 | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/m4/curl-functions.m4 b/m4/curl-functions.m4 index ee7a2521c..e1a1e32b3 100644 --- a/m4/curl-functions.m4 +++ b/m4/curl-functions.m4 @@ -5,7 +5,7 @@ # | (__| |_| | _ <| |___ # \___|\___/|_| \_\_____| # -# Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. +# Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. The terms @@ -4803,11 +4803,27 @@ AC_DEFUN([CURL_CHECK_FUNC_POLL], [ AC_LANG_PROGRAM([[ $curl_includes_stdlib $curl_includes_poll + $curl_includes_time ]],[[ + /* detect the original poll() breakage */ if(0 != poll(0, 0, 10)) exit(1); /* fail */ - else - exit(0); + else { + /* detect the 10.12 poll() breakage */ + struct timeval before, after; + int rc; + size_t us; + + gettimeofday(&before, NULL); + rc = poll(NULL, 0, 500); + gettimeofday(&after, NULL); + + us = (after.tv_sec - before.tv_sec) * 1000000 + + (after.tv_usec - before.tv_usec); + + if(us < 400000) + exit(1); + } ]]) ],[ AC_MSG_RESULT([yes]) |