• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src-rt-6.x.4708/router/db-4.8.30/dist/aclocal/
1dnl Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
2dnl This file is free software; the Free Software Foundation
3dnl gives unlimited permission to copy and/or distribute it,
4dnl with or without modifications, as long as this notice is preserved.
5
6dnl From Albert Chin, Windows fixes from Simon Josefsson.
7
8dnl Check for socklen_t: historically on BSD it is an int, and in
9dnl POSIX 1g it is a type of its own, but some platforms use different
10dnl types for the argument to getsockopt, getpeername, etc.  So we
11dnl have to test to find something that will work.
12
13dnl On mingw32, socklen_t is in ws2tcpip.h ('int'), so we try to find
14dnl it there first.  That file is included by gnulib's socket_.h, which
15dnl all users of this module should include.  Cygwin must not include
16dnl ws2tcpip.h.
17
18dnl Windows fixes removed for Berkeley DB. Functions renamed, basic check
19dnl remains the same though.
20dnl !!!
21dnl The original version had fixes for MinGW -- if you need those, go back
22dnl and look at the original code.
23
24AC_DEFUN([AM_SOCKLEN_T],[
25   AC_CHECK_TYPE([socklen_t], ,
26     [AC_MSG_CHECKING([for socklen_t equivalent])
27      AC_CACHE_VAL([db_cv_socklen_t_equiv],
28	[# Systems have either "struct sockaddr *" or
29	 # "void *" as the second argument to getpeername
30	 db_cv_socklen_t_equiv=
31	 for arg2 in "struct sockaddr" void; do
32	   for t in int size_t "unsigned int" "long int" "unsigned long int"; do
33	     AC_TRY_COMPILE([$db_includes
34#ifdef HAVE_SYS_SOCKET_H
35#include <sys/socket.h>
36#endif
37		int getpeername (int, $arg2 *, $t *);],
38	       [$t len;
39		getpeername (0, 0, &len);],
40	       [db_cv_socklen_t_equiv="$t"])
41	     test "$db_cv_socklen_t_equiv" != "" && break
42	   done
43	   test "$db_cv_socklen_t_equiv" != "" && break
44	 done
45      ])
46      if test "$db_cv_socklen_t_equiv" = ""; then
47	AC_MSG_ERROR([Cannot find a type to use in place of socklen_t])
48      fi
49      AC_MSG_RESULT([$db_cv_socklen_t_equiv])
50      AC_DEFINE_UNQUOTED([socklen_t], [$db_cv_socklen_t_equiv],
51	[type to use in place of socklen_t if not defined])],
52	[$db_includes
53#ifdef HAVE_SYS_SOCKET_H
54#include <sys/socket.h>
55#endif])])
56