1 dnl ---------------------------------------------------------------------------
2 dnl Macro: SETSOCKOPT_SANITY
3 dnl ---------------------------------------------------------------------------
4 AC_DEFUN([SETSOCKOPT_SANITY],[
5 AC_CACHE_CHECK([for working SO_SNDTIMEO], [ac_cv_have_so_sndtimeo],
10 #include <sys/socket.h>
15 int sock = socket(AF_INET, SOCK_STREAM, 0);
16 struct timeval waittime;
19 waittime.tv_usec= 500;
21 if (setsockopt(sock, SOL_SOCKET, SO_SNDTIMEO,
22 &waittime, (socklen_t)sizeof(struct timeval)) == -1) {
23 if (errno == ENOPROTOOPT) {
29 [ac_cv_have_so_sndtimeo=yes],
30 [ac_cv_have_so_sndtimeo=no],
31 [ac_cv_have_so_sndtimeo=yes])
33 AS_IF([test "x$ac_cv_have_so_sndtimeo" = "xyes"], [
34 AC_DEFINE(HAVE_SNDTIMEO, 1, [Define to 1 if you have a working SO_SNDTIMEO])])
38 AC_CACHE_CHECK([for working SO_RCVTIMEO], [ac_cv_have_so_rcvtimeo],
42 #include <sys/types.h>
43 #include <sys/socket.h>
48 int sock = socket(AF_INET, SOCK_STREAM, 0);
49 struct timeval waittime;
52 waittime.tv_usec= 500;
54 if (setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO,
55 &waittime, (socklen_t)sizeof(struct timeval)) == -1) {
56 if (errno == ENOPROTOOPT) {
62 [ac_cv_have_so_rcvtimeo=yes],
63 [ac_cv_have_so_rcvtimeo=no],
64 [ac_cv_have_so_rcvtimeo=yes])
66 AS_IF([test "x$ac_cv_have_so_rcvtimeo" = "xyes"], [
67 AC_DEFINE(HAVE_RCVTIMEO, 1, [Define to 1 if you have a working SO_RCVTIMEO])])
71 dnl ---------------------------------------------------------------------------
72 dnl End Macro: SETSOCKOPT_SANITY
73 dnl ---------------------------------------------------------------------------