OSSP CVS Repository

ossp - Difference in ossp-pkg/sa/sa.ac versions 1.14 and 1.15
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [History

ossp-pkg/sa/sa.ac 1.14 -> 1.15

--- sa.ac        2003/02/07 20:47:51     1.14
+++ sa.ac        2004/03/26 16:05:59     1.15
@@ -53,6 +53,48 @@
     fi
 ])
 
+dnl #  Check whether to use SO_RCVTIMEO|SO_SNDTIMEO with setsockopt(2)
+dnl #   configure.ac:
+dnl #     SA_CHECK_SOCKOPT(SO_RCVTIMEO)
+dnl #     SA_CHECK_SOCKOPT(SO_SNDTIMEO)
+dnl #   config.h:
+dnl #     #undef USE_SO_RCVTIMEO or #define USE_SO_RCVTIMEO 1
+dnl #     #undef USE_SO_SNDTIMEO or #define USE_SO_SNDTIMEO 1
+
+AC_DEFUN(SA_CHECK_SOCKOPT, [
+AC_MSG_CHECKING(whether to use $1 with setsockopt(2))
+AC_TRY_RUN([
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/time.h>
+
+int main(void)
+{
+    int s;
+    struct timeval timeo;
+    timeo.tv_sec  = 3;
+    timeo.tv_usec = 3;
+
+#ifndef $1
+    exit(3);
+#else
+    if ((s = socket(PF_INET, SOCK_STREAM, 0)) == -1)
+        exit(2);
+
+    /* fails on Solaris 2.6,8,9,10 and Debian 2.2 because
+       SO_RCVTIMEO|SO_SNDTIMEO are defined but not implemented */
+    if (setsockopt(s, SOL_SOCKET, $1, (void *)&timeo, sizeof(timeo)) == -1)
+        exit(1);
+
+    exit(0);
+#endif
+}
+]
+, [ AC_MSG_RESULT([yes]) AC_DEFINE(USE_$1, 1, [Define to use $1 with setsockopt(2)]) ]
+, [ AC_MSG_RESULT([no]) ]
+)
+])dnl
+
 dnl #   Check for anything OSSP SA wants to know
 dnl #   configure.in:
 dnl #     SA_CHECK_ALL
@@ -77,5 +119,7 @@
     dnl # check for network/socket size type
     SA_CHECK_TYPEDEF(socklen_t, sys/socket.h)
     SA_CHECK_TYPEDEF(ssize_t, sys/types.h)
+    SA_CHECK_SOCKOPT(SO_RCVTIMEO)
+    SA_CHECK_SOCKOPT(SO_SNDTIMEO)
 ])
 

CVSTrac 2.0.1