3 # AMANDA_SOCKLEN_T_EQUIV
7 # Find a type which will work like socklen_t should. Unfortunately,
8 # HP/UX systems define socklen_t, but use int * as the result parameter
9 # for socket functions returning a socket length.
11 # This check defines a type socklen_t_equiv which is of the appropriate
12 # size to be used with socket functions.
14 AC_DEFUN([AMANDA_SOCKLEN_T_EQUIV],
16 ## lifted from config/gnulib/socklen.m4
17 AC_REQUIRE([gl_HEADER_SYS_SOCKET])dnl
18 AC_MSG_CHECKING([for socklen_t equivalent])
19 AC_CACHE_VAL([gl_cv_socklen_t_equiv],
20 [# Systems have either "struct sockaddr *" or
21 # "void *" as the second argument to getpeername
22 gl_cv_socklen_t_equiv=
23 for arg2 in "struct sockaddr" void; do
24 for t in socklen_t int size_t "unsigned int" "long int" "unsigned long int"; do
26 [#include <sys/types.h>
27 #include <sys/socket.h>
29 int getpeername (int, $arg2 *, $t *);],
31 getpeername (0, 0, &len);],
32 [gl_cv_socklen_t_equiv="$t"])
33 test "$gl_cv_socklen_t_equiv" != "" && break
35 test "$gl_cv_socklen_t_equiv" != "" && break
38 ## end lifting from config/gnulib/socklen.m4
39 # fallback if the check fails
40 if test "$gl_cv_socklen_t_equiv" = ""; then
41 gl_cv_socklen_t_equiv=socklen_t
43 AC_MSG_RESULT([$gl_cv_socklen_t_equiv])
45 AC_DEFINE_UNQUOTED([socklen_t_equiv], [$gl_cv_socklen_t_equiv],
46 [type to use for socket length parameters; use instead of socklen_t])