Autoconf: Use a standard test for socklen_t
authorSimon Wilkinson <sxw@inf.ed.ac.uk>
Sun, 16 May 2010 21:56:13 +0000 (22:56 +0100)
committerDerrick Brashear <shadow@dementia.org>
Mon, 17 May 2010 11:48:10 +0000 (04:48 -0700)
Use the standard AC_CHECK_TYPES mechanism to check for the existence
of socklen_t, and to typedef it as an int if it's not found, rather
than growing our own.

Change-Id: Ib5aeb600750558167f63833dd4a7480dbe312b8a
Reviewed-on: http://gerrit.openafs.org/1972
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

acinclude.m4
src/cf/socklen.m4 [deleted file]
src/config/afsconfig-windows.h
src/config/stds.h

index 2852499..2dcc7c2 100644 (file)
@@ -1271,7 +1271,6 @@ else
     AC_MSG_RESULT(no)
 fi
 
-AC_TYPE_SOCKLEN_T
 AC_TYPE_SIGNAL
 AC_CHECK_SIZEOF(void *)
 AC_CHECK_SIZEOF(unsigned long long)
@@ -1283,6 +1282,9 @@ AC_CHECK_TYPES([ssize_t])
 AC_CHECK_TYPES([sig_atomic_t],[],[],
 [#include <sys/types.h>
 #include <signal.h>])
+AC_CHECK_TYPES([socklen_t],[],[],
+[#include <sys/types.h>
+#include <sys/socket.h>])
 AC_SIZEOF_TYPE(long)
 
 AC_HEADER_PAM_CONST
diff --git a/src/cf/socklen.m4 b/src/cf/socklen.m4
deleted file mode 100644 (file)
index 50ee10f..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-AC_DEFUN([AC_TYPE_SOCKLEN_T],
-[
-AC_CACHE_CHECK([for socklen_t], 
-ac_cv_type_socklen_t, [
-        AC_TRY_COMPILE([
-                      #include <sys/types.h>
-                      #include <sys/socket.h>
-              ],
-              [
-                      socklen_t len = 42; return 0;
-              ],
-              ac_cv_type_socklen_t="yes", ac_cv_type_socklen_t="no")
-        ])
-
-        if test "x$ac_cv_type_socklen_t" = "xno"; then
-              AC_DEFINE(socklen_t, int, [the type of the last argument to getsockopt etc])
-        fi
-])
index d41eea8..b8e89c2 100644 (file)
 #endif
 
 /* Windows does not provide socklen_t prior to WDK 6.0 */
-typedef int socklen_t;
+#undef HAVE_SOCKLEN_T
index a9d22f5..d7358c5 100644 (file)
@@ -59,6 +59,10 @@ typedef int ssize_t;
 typedef int sig_atomic_t;
 #endif
 
+#ifndef HAVE_SOCKLEN_T
+typedef int socklen_t;
+#endif
+
 typedef short afs_int16;
 typedef unsigned short afs_uint16;
 #ifdef  AFS_64BIT_ENV