/config/ac_socklen_t.m4

https://code.google.com/ · m4 · 36 lines · 16 code · 3 blank · 17 comment · 0 complexity · 3e2f238cff33891d336491b1e991cbdc MD5 · raw file

  1. ##*****************************************************************************
  2. ## $Id$
  3. ##*****************************************************************************
  4. # AUTHOR:
  5. # Lars Brinkhoff <lars@nocrew.org>
  6. #
  7. # SYNOPSIS:
  8. # TYPE_SOCKLEN_T
  9. #
  10. # DESCRIPTION:
  11. # Check whether sys/socket.h defines type socklen_t.
  12. # Please note that some systems require sys/types.h to be included
  13. # before sys/socket.h can be compiled.
  14. ##*****************************************************************************
  15. AC_DEFUN([TYPE_SOCKLEN_T],
  16. [AC_CACHE_CHECK([for socklen_t], ac_cv_type_socklen_t,
  17. [
  18. AC_TRY_COMPILE(
  19. [#include <sys/types.h>
  20. #include <sys/socket.h>],
  21. [socklen_t len = 42; return 0;],
  22. ac_cv_type_socklen_t=yes,
  23. ac_cv_type_socklen_t=no)
  24. ])
  25. if test "$ac_cv_type_socklen_t" = "yes"; then
  26. AC_DEFINE([HAVE_SOCKLEN_T], [1], [Define if you have the socklen_t type.])
  27. fi
  28. AH_VERBATIM([HAVE_SOCKLEN_T_],
  29. [#ifndef HAVE_SOCKLEN_T
  30. # define HAVE_SOCKLEN_T
  31. typedef int socklen_t;
  32. #endif])
  33. ])