From 11693c0faa69701f8966ca6c7f328eb7a51cb7d5 Mon Sep 17 00:00:00 2001
From: Daniel Stenberg <daniel@haxx.se>
Date: Fri, 9 Mar 2001 15:38:59 +0000
Subject: [PATCH] the socklen_t check is more involved now, but works on linux
 at least

---
 configure.in | 23 +++++++++++++++++++++--
 1 file changed, 21 insertions(+), 2 deletions(-)

diff --git a/configure.in b/configure.in
index 805a0bcd54..6451473a61 100644
--- a/configure.in
+++ b/configure.in
@@ -693,8 +693,27 @@ AC_CHECK_SIZEOF(long long, 4)
 # check for ssize_t
 AC_CHECK_TYPE(ssize_t, int)
 
-# check for socklen_t (getsockname() wants that)
-AC_CHECK_TYPE(socklen_t, int)
+dnl
+dnl We can't just AC_CHECK_TYPE() for socklen_t since it doesn't appear
+dnl in the standard headers. We egrep for it in the socket headers and
+dnl if it is used there we assume we have the type defined, otherwise
+dnl we search for it with AC_CHECK_TYPE() the "normal" way
+dnl
+
+if test "$ac_cv_header_sys_socket_h" = "yes"; then
+   AC_MSG_CHECKING(for socklen_t in sys/socket.h)
+   AC_EGREP_HEADER(socklen_t,
+    sys/socket.h,
+    socklen_t=yes
+    AC_MSG_RESULT(yes),
+    AC_MSG_RESULT(no))
+fi
+
+if test "$socklen_t" != "yes"; then
+  # check for socklen_t the standard way if it wasn't found before
+  AC_CHECK_TYPE(socklen_t, int)
+fi
+
 
 dnl Get system canonical name
 AC_CANONICAL_HOST
-- 
GitLab