File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / rsync / m4 / socklen_t.m4
Revision 1.1.1.2 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Wed Mar 17 00:32:36 2021 UTC (3 years, 3 months ago) by misho
Branches: rsync, MAIN
CVS tags: v3_2_3, HEAD
rsync 3.2.3

    1: dnl Check for socklen_t: historically on BSD it is an int, and in
    2: dnl POSIX 1g it is a type of its own, but some platforms use different
    3: dnl types for the argument to getsockopt, getpeername, etc.  So we
    4: dnl have to test to find something that will work.
    5: 
    6: dnl This is no good, because passing the wrong pointer on C compilers is
    7: dnl likely to only generate a warning, not an error.  We don't call this at
    8: dnl the moment.
    9: 
   10: AC_DEFUN([TYPE_SOCKLEN_T],
   11: [
   12:    AC_CHECK_TYPE([socklen_t], ,[
   13:       AC_MSG_CHECKING([for socklen_t equivalent])
   14:       AC_CACHE_VAL([rsync_cv_socklen_t_equiv],
   15:       [
   16:          # Systems have either "struct sockaddr *" or
   17:          # "void *" as the second argument to getpeername
   18:          rsync_cv_socklen_t_equiv=
   19:          for arg2 in "struct sockaddr" void; do
   20:             for t in int size_t unsigned long "unsigned long"; do
   21:                AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
   22: #include <sys/types.h>
   23: #include <sys/socket.h>
   24: 
   25:                   int getpeername (int, $arg2 *, $t *);
   26:                ]],[[
   27:                   $t len;
   28:                   getpeername(0,0,&len);
   29:                ]])],[
   30:                   rsync_cv_socklen_t_equiv="$t"
   31:                   break
   32:                ])
   33:             done
   34:          done
   35: 
   36:          if test "x$rsync_cv_socklen_t_equiv" = x; then
   37:             AC_MSG_ERROR([Cannot find a type to use in place of socklen_t])
   38:          fi
   39:       ])
   40:       AC_MSG_RESULT($rsync_cv_socklen_t_equiv)
   41:       AC_DEFINE_UNQUOTED(socklen_t, $rsync_cv_socklen_t_equiv,
   42: 			[type to use in place of socklen_t if not defined])],
   43:       [#include <sys/types.h>
   44: #include <sys/socket.h>])
   45: ])

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>