Merge of build trunk.
[awesomized/libmemcached] / m4 / eagain.m4
1 #
2 # Some platforms define EWOULDBLOCK == EAGAIN, causing our switch for error
3 # codes to be illegal (POSIX.1-2001 allows both return codes from recv, so
4 # we need to test both if they differ...)
5 #
6 AC_DEFUN([DETECT_EAGAIN],
7 [
8 AC_CACHE_CHECK([if EWOULDBLOCK == EAGAIN],[av_cv_eagain_ewouldblock],
9 [AC_TRY_COMPILE([
10 #include <errno.h>
11 ], [
12 int error = EAGAIN;
13 switch (error)
14 {
15 case EAGAIN:
16 case EWOULDBLOCK:
17 error = 1;
18 break;
19 default:
20 error = 0;
21 }
22 ],
23 [ av_cv_eagain_ewouldblock=no ],
24 [ av_cv_eagain_ewouldblock=yes ])
25 ])
26 AS_IF([test "x$av_cv_eagain_ewouldblock" = "xno"],[
27 AC_DEFINE([USE_EAGAIN], [1], [Define to true if you need to test for eagain])])
28 ])