1 dnl @synopsis TYPE_SOCKLEN_T
3 dnl Check to see what type we should pass where some systems want socklen_t.
4 dnl Note that some versions of HP-UX define socklen_t yet want int, so just
5 dnl checking if socklen_t is defined isn't good enough.
8 dnl http://mail.gnome.org/archives/xml/2001-August/msg00061.html
10 dnl Original author: Albert Chin
11 AC_DEFUN([TYPE_SOCKLEN_T],
13 AC_MSG_CHECKING([for type to use for 5th parameter to getsockopt])
14 AC_CACHE_VAL([xo_cv_socklen_t_equiv],
16 for t in socklen_t int size_t unsigned long "unsigned long"; do
18 #include <sys/types.h>
19 #if defined __WIN32__ || defined _WIN32
20 # include <winsock2.h>
22 # include <sys/socket.h>
26 getsockopt(0, 0, 0, 0, &len);
28 xo_cv_socklen_t_equiv="$t"
32 if test -z "$xo_cv_socklen_t_equiv"; then
33 AC_MSG_RESULT([not found])
34 AC_MSG_ERROR([Failed to find type for 5th parameter to getsockopt])
37 AC_MSG_RESULT([$xo_cv_socklen_t_equiv])
38 AC_DEFINE_UNQUOTED(SOCKLEN_T, [$xo_cv_socklen_t_equiv],
39 [type to use for 5th parameter to getsockopt])