OSSP CVS Repository

ossp - Difference in ossp-pkg/l2/l2_ut_sa.ac versions 1.7 and 1.8
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [History

ossp-pkg/l2/l2_ut_sa.ac 1.7 -> 1.8

--- l2_ut_sa.ac  2002/11/09 14:44:31     1.7
+++ l2_ut_sa.ac  2004/03/26 17:14:48     1.8
@@ -1,8 +1,8 @@
 dnl ##
 dnl ##  OSSP sa - Socket Abstraction
-dnl ##  Copyright (c) 2001-2002 Ralf S. Engelschall <rse@engelschall.com>
-dnl ##  Copyright (c) 2001-2002 The OSSP Project <http://www.ossp.org/>
-dnl ##  Copyright (c) 2001-2002 Cable & Wireless Deutschland <http://www.cw.com/de/>
+dnl ##  Copyright (c) 2001-2003 Ralf S. Engelschall <rse@engelschall.com>
+dnl ##  Copyright (c) 2001-2003 The OSSP Project <http://www.ossp.org/>
+dnl ##  Copyright (c) 2001-2003 Cable & Wireless Deutschland <http://www.cw.com/de/>
 dnl ##
 dnl ##  This file is part of OSSP sa, a socket abstraction library which
 dnl ##  can be found at http://www.ossp.org/pkg/lib/sa/.
@@ -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
@@ -72,10 +114,12 @@
     AC_CHECK_HEADERS(string.h sys/types.h sys/socket.h netdb.h netinet/in.h)
 
     #   check for system functions
-    AC_CHECK_FUNCS(inet_addr inet_aton inet_pton inet_ntoa inet_ntop snprintf)
+    AC_CHECK_FUNCS(inet_addr inet_aton inet_pton inet_ntoa inet_ntop snprintf getaddrinfo)
 
     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