aclocal.m4on commit checkout: avoid unnecessary match_pathspec calls (e721c15)
   1dnl Check for socklen_t: historically on BSD it is an int, and in
   2dnl POSIX 1g it is a type of its own, but some platforms use different
   3dnl types for the argument to getsockopt, getpeername, etc.  So we
   4dnl have to test to find something that will work.
   5AC_DEFUN([TYPE_SOCKLEN_T],
   6[
   7   AC_CHECK_TYPE([socklen_t], ,[
   8      AC_MSG_CHECKING([for socklen_t equivalent])
   9      AC_CACHE_VAL([git_cv_socklen_t_equiv],
  10      [
  11         # Systems have either "struct sockaddr *" or
  12         # "void *" as the second argument to getpeername
  13         git_cv_socklen_t_equiv=
  14         for arg2 in "struct sockaddr" void; do
  15            for t in int size_t unsigned long "unsigned long"; do
  16               AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
  17                  #include <sys/types.h>
  18                  #include <sys/socket.h>
  19
  20                  int getpeername (int, $arg2 *, $t *);
  21               ],[
  22                  $t len;
  23                  getpeername(0,0,&len);
  24               ])],[
  25                  git_cv_socklen_t_equiv="$t"
  26                  break 2
  27               ])
  28            done
  29         done
  30
  31         if test "x$git_cv_socklen_t_equiv" = x; then
  32            AC_MSG_ERROR([Cannot find a type to use in place of socklen_t])
  33         fi
  34      ])
  35      AC_MSG_RESULT($git_cv_socklen_t_equiv)
  36      AC_DEFINE_UNQUOTED(socklen_t, $git_cv_socklen_t_equiv,
  37                        [type to use in place of socklen_t if not defined])],
  38      [#include <sys/types.h>
  39#include <sys/socket.h>])
  40])