1 dnl This comes from libcurl's acinclude.m4. it is not clear if this 2 dnl is original libcurl code, or other code, so we include the libcurl 3 dnl copyright here 4 dnl 5 dnl 6 dnl Copyright (c) 1996 - 2005, Daniel Stenberg, <daniel (a] haxx.se>. 7 dnl 8 dnl All rights reserved. 9 dnl 10 dnl Permission to use, copy, modify, and distribute this software for any purpose 11 dnl with or without fee is hereby granted, provided that the above copyright 12 dnl notice and this permission notice appear in all copies. 13 dnl 14 dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 dnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 dnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN 17 dnl NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 18 dnl DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 19 dnl OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE 20 dnl OR OTHER DEALINGS IN THE SOFTWARE. 21 dnl 22 dnl Except as contained in this notice, the name of a copyright holder shall not 23 dnl be used in advertising or otherwise to promote the sale, use or other dealings 24 dnl in this Software without prior written authorization of the copyright holder. 25 26 dnl Check for socklen_t: historically on BSD it is an int, and in 27 dnl POSIX 1g it is a type of its own, but some platforms use different 28 dnl types for the argument to getsockopt, getpeername, etc. So we 29 dnl have to test to find something that will work. 30 31 dnl Remove the AC_CHECK_TYPE - on HP-UX it would find a socklen_t, but the 32 dnl function prototypes for getsockopt et al will not actually use 33 dnl socklen_t args unless _XOPEN_SOURCE_EXTENDED is defined. so, the 34 dnl AC_CHECK_TYPE will find a socklen_t and think all is happiness and 35 dnl joy when you will really get warnings about mismatch types - type 36 dnl mismatches that would be possibly Bad (tm) in a 64-bit compile. 37 dnl raj 2005-05-11 this change may be redistributed at will 38 39 dnl also, added "extern" to the "int getpeername" in an attempt to resolve 40 dnl an issue with this code under Solaris 2.9. this too may be 41 dnl redistributed at will 42 43 AC_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