• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1dnl This comes from libcurl's acinclude.m4.  it is not clear if this
2dnl is original libcurl code, or other code, so we include the libcurl
3dnl copyright here
4dnl
5dnl
6dnl Copyright (c) 1996 - 2005, Daniel Stenberg, <daniel@haxx.se>.
7dnl
8dnl All rights reserved.
9dnl
10dnl Permission to use, copy, modify, and distribute this software for any purpose
11dnl with or without fee is hereby granted, provided that the above copyright
12dnl notice and this permission notice appear in all copies.
13dnl
14dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15dnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16dnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN
17dnl NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
18dnl DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
19dnl OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
20dnl OR OTHER DEALINGS IN THE SOFTWARE.
21dnl
22dnl Except as contained in this notice, the name of a copyright holder shall not
23dnl be used in advertising or otherwise to promote the sale, use or other dealings
24dnl in this Software without prior written authorization of the copyright holder.
25
26dnl Check for socklen_t: historically on BSD it is an int, and in
27dnl POSIX 1g it is a type of its own, but some platforms use different
28dnl types for the argument to getsockopt, getpeername, etc.  So we
29dnl have to test to find something that will work.
30
31dnl Remove the AC_CHECK_TYPE - on HP-UX it would find a socklen_t, but the
32dnl function prototypes for getsockopt et al will not actually use
33dnl socklen_t args unless _XOPEN_SOURCE_EXTENDED is defined. so, the
34dnl AC_CHECK_TYPE will find a socklen_t and think all is happiness and
35dnl joy when you will really get warnings about mismatch types - type
36dnl mismatches that would be possibly Bad (tm) in a 64-bit compile.
37dnl raj 2005-05-11 this change may be redistributed at will
38
39dnl also, added "extern" to the "int getpeername" in an attempt to resolve
40dnl an issue with this code under Solaris 2.9.  this too may be
41dnl redistributed at will
42
43AC_DEFUN([OLD_TYPE_SOCKLEN_T],
44[
45      AC_MSG_CHECKING([for socklen_t equivalent])
46      AC_CACHE_VAL([curl_cv_socklen_t_equiv],
47      [
48         # Systems have either "struct sockaddr *" or
49         # "void *" as the second argument to getpeername
50         curl_cv_socklen_t_equiv=
51         for arg2 in "struct sockaddr" void; do
52            for t in int size_t unsigned long "unsigned long" socklen_t; do
53               AC_TRY_COMPILE([
54                  #ifdef HAVE_SYS_TYPES_H
55                  #include <sys/types.h>
56                  #endif
57                  #ifdef HAVE_SYS_SOCKET_H
58                  #include <sys/socket.h>
59                  #endif
60
61                  extern int getpeername (int, $arg2 *, $t *);
62               ],[
63                  $t len;
64                  getpeername(0,0,&len);
65               ],[
66                  curl_cv_socklen_t_equiv="$t"
67                  break
68               ])
69            done
70         done
71
72         if test "x$curl_cv_socklen_t_equiv" = x; then
73	# take a wild guess
74            curl_cv_socklen_t_equiv="socklen_t"
75            AC_MSG_WARN([Cannot find a type to use in place of socklen_t, guessing socklen_t])
76         fi
77      ])
78      AC_MSG_RESULT($curl_cv_socklen_t_equiv)
79      AC_DEFINE_UNQUOTED(netperf_socklen_t, $curl_cv_socklen_t_equiv,
80                        [type to use in place of socklen_t if not defined])
81])
82