494
dnl Check for socklen_t: historically on BSD it is an int, and in
495
dnl POSIX 1g it is a type of its own, but some platforms use different
496
dnl types for the argument to getsockopt, getpeername, etc. So we
497
dnl have to test to find something that will work.
498
AC_DEFUN([TYPE_SOCKLEN_T],
500
AC_CHECK_TYPE([socklen_t], ,[
501
AC_MSG_CHECKING([for socklen_t equivalent])
502
AC_CACHE_VAL([socklen_t_equiv],
504
# Systems have either "struct sockaddr *" or
505
# "void *" as the second argument to getpeername
507
for arg2 in "struct sockaddr" void; do
508
for t in int size_t unsigned long "unsigned long"; do
510
#include <sys/types.h>
511
#include <sys/socket.h>
513
int getpeername (int, $arg2 *, $t *);
516
getpeername(0,0,&len);
524
if test "x$socklen_t_equiv" = x; then
525
AC_MSG_ERROR([Cannot find a type to use in place of socklen_t])
528
AC_MSG_RESULT($socklen_t_equiv)
529
AC_DEFINE_UNQUOTED(socklen_t, $socklen_t_equiv,
530
[type to use in place of socklen_t if not defined])],
531
[#include <sys/types.h>
532
#include <sys/socket.h>])
494
535
dnl quote from SunOS-5.8 sys/inttypes.h:
495
536
dnl Use at your own risk. As of February 1996, the committee is squarely
496
537
dnl behind the fixed sized types; the "least" and "fast" types are still being