THIS IS A TEST INSTANCE ONLY! REPOSITORIES CAN BE DELETED AT ANY TIME!

Git Source Code Mirror - This is a publish-only repository and all pull requests are ignored. Please follow Documentation/SubmittingPatches procedure for any of your improvements.
git
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
1.4KB

  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. AC_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. int getpeername (int, $arg2 *, $t *);
  20. ],[
  21. $t len;
  22. getpeername(0,0,&len);
  23. ])],[
  24. git_cv_socklen_t_equiv="$t"
  25. break 2
  26. ])
  27. done
  28. done
  29. if test "x$git_cv_socklen_t_equiv" = x; then
  30. AC_MSG_ERROR([Cannot find a type to use in place of socklen_t])
  31. fi
  32. ])
  33. AC_MSG_RESULT($git_cv_socklen_t_equiv)
  34. AC_DEFINE_UNQUOTED(socklen_t, $git_cv_socklen_t_equiv,
  35. [type to use in place of socklen_t if not defined])],
  36. [#include <sys/types.h>
  37. #include <sys/socket.h>])
  38. ])