4ca7214cff9595dd1d6c1342f5b1e8809e3b2881
[awesomized/libmemcached] / config / setsockopt.m4
1 dnl ---------------------------------------------------------------------------
2 dnl Macro: SETSOCKOPT_TEST
3 dnl ---------------------------------------------------------------------------
4 AC_LANG(C)
5 AC_RUN_IFELSE([
6 AC_LANG_PROGRAM([
7 #include <sys/types.h>
8 #include <sys/socket.h>
9 #include <time.h>
10 #include <sys/time.h>
11 #include <errno.h>
12 ], [
13 int sock = socket(AF_INET, SOCK_STREAM, 0);
14 struct timeval waittime;
15
16 waittime.tv_sec= 0;
17 waittime.tv_usec= 500;
18
19 if (setsockopt(sock, SOL_SOCKET, SO_SNDTIMEO,
20 &waittime, (socklen_t)sizeof(struct timeval)) == -1) {
21 if (errno == ENOPROTOOPT) {
22 return 1;
23 }
24 }
25 return 0;
26 ])
27 ], AC_DEFINE(HAVE_SNDTIMEO, 1, [Define to 1 if you have a working SO_SNDTIMEO]))
28
29 AC_RUN_IFELSE([
30 AC_LANG_PROGRAM([
31 #include <sys/types.h>
32 #include <sys/socket.h>
33 #include <time.h>
34 #include <sys/time.h>
35 #include <errno.h>
36 ], [
37 int sock = socket(AF_INET, SOCK_STREAM, 0);
38 struct timeval waittime;
39
40 waittime.tv_sec= 0;
41 waittime.tv_usec= 500;
42
43 if (setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO,
44 &waittime, (socklen_t)sizeof(struct timeval)) == -1) {
45 if (errno == ENOPROTOOPT) {
46 return 1;
47 }
48 }
49 return 0;
50 ])
51 ], AC_DEFINE(HAVE_RCVTIMEO, 1, [Define to 1 if you have a working SO_RCVTIMEO]))
52
53 dnl ---------------------------------------------------------------------------
54 dnl End Macro: SETSOCKOPT_TEST
55 dnl ---------------------------------------------------------------------------