1dnl Determine socklen_t type. Code from lftp. 2AC_MSG_CHECKING([for socklen_t]) 3AC_CACHE_VAL([ac_cv_socklen_t], 4[ 5 ac_cv_socklen_t=no 6 AC_TRY_COMPILE([ 7 #include <sys/types.h> 8 #include <sys/socket.h> 9 ], 10 [ 11 socklen_t len; 12 getpeername(0,0,&len); 13 ], 14 [ 15 ac_cv_socklen_t=yes 16 ]) 17]) 18AC_MSG_RESULT([$ac_cv_socklen_t]) 19 if test $ac_cv_socklen_t = no; then 20 AC_MSG_CHECKING([for socklen_t equivalent]) 21 AC_CACHE_VAL([ac_cv_socklen_t_equiv], 22 [ 23 ac_cv_socklen_t_equiv=int 24 for t in int size_t unsigned long "unsigned long"; do 25 AC_TRY_COMPILE([ 26 #include <sys/types.h> 27 #include <sys/socket.h> 28 ], 29 [ 30 $t len; 31 getpeername(0,0,&len); 32 ], 33 [ 34 ac_cv_socklen_t_equiv="$t" 35 break 36 ]) 37 done 38 ]) 39 AC_MSG_RESULT([$ac_cv_socklen_t_equiv]) 40 AC_DEFINE_UNQUOTED([socklen_t], $ac_cv_socklen_t_equiv, [Define to "int" if <sys/socket.h> does not define.]) 41fi 42