Martin Buchholz <[EMAIL PROTECTED]> writes:
> Functions like accept are known to have THREE different prototypes:
> 
> int accept (int, struct sockaddr *, socklen_t *); /* Linux, Unix98 */
> int accept (int, struct sockaddr *, size_t *); /* Solaris 2.6 */
> int accept (int, struct sockaddr *, int *); /* DEC OSF 4.0e */
> 
> 
> I think autoconf should have a
> 
> AC_TYPE_SOCKLEN_T
> 
> with obvious semantics.
> 
> I include this start:
> 
> dnl check for socklen_t (in Unix98)
> AC_MSG_CHECKING(for socklen_t)
> AC_TRY_COMPILE([#include <sys/socket.h>
> socklen_t x;
> ],[],[AC_MSG_RESULT(yes)],[
> AC_TRY_COMPILE([#include <sys/socket.h>
> int accept (int, struct sockaddr *, size_t *);
> ],[],[
> AC_MSG_RESULT(size_t)
> AC_DEFINE(socklen_t,size_t)], [
> AC_MSG_RESULT(int)
> AC_DEFINE(socklen_t,int)])])

For comparision, this is what I use in an application of mine.  I
haven't heard any complaints from Solaris users, but I guess they have
just ignored any compilations warnings.

dnl HTTPTUNNEL_TYPE_SOCKLEN_T
dnl Check for the existance of type socklen_t.

AC_DEFUN(HTTPTUNNEL_TYPE_SOCKLEN_T,
[AC_CACHE_CHECK([for socklen_t], ac_cv_httptunnel_type_socklen_t,
[
  AC_TRY_COMPILE(
  [#include <sys/types.h>
   #include <sys/socket.h>],
  [socklen_t len = 42; return 0;],
  ac_cv_httptunnel_type_socklen_t=yes,
  ac_cv_httptunnel_type_socklen_t=no)
])
  if test $ac_cv_httptunnel_type_socklen_t != yes; then
    AC_DEFINE(socklen_t, int)
  fi
])

Reply via email to