I've been looking at the socklen_t mess - systems define it but do not use it, use void*length instead of socklen_t*length, and so on. Just how messy is this - is there even any point in trying to cover enough possibilities that configure can fail if it doesn't find the correct type? The following code comes from examining just 4 systems - Linux, HP-UX, Solaris, OSF1. Googling around I found tests that check for more intger types as well: unsigned, long, unsigned long in addition to socklen_t, int and size_t. Which systems need these? Also, do systems use the same type (or at least a type of the same size) for getsockopt()'s and accept()'s last arg, or do I need a separate getsockopt() test? AC_CHECK_TYPE([socklen_t],,, [$ac_includes_default #ifdef HAVE_SYS_SOCKET_H #include <sys/socket.h> #endif]) dnl accept() sockaddr-length type. Notes: dnl - The system might define socklen_t without actually using it. dnl POSIX has moved from int to size_t to socklen_t, and at dnl least HP-UX now has switches to select which version to use. dnl - Look for the length type in the connect() prototype if we dnl encounter accept(<...>, void *length). Happens on Solaris, dnl even though their accept() manpage says socklen_t *length. dnl - If we do not find the type, but socklen_t, int and size_t dnl have the same size, we can likely use either if it compiles. dnl With a chaos like this, such a fallback seems prudent. dnl - Hopefully we do not need separate types for getsockopt(). AC_CACHE_CHECK([for accept() sockaddr-length type],ol_cv_type_lber_socklen_t,[ vtype=void sltype=socklen_t ; test "$ac_cv_type_socklen_t" = yes || sltype= step2=2 ; test "$ac_cv_sizeof_int" = "$ac_cv_sizeof_long" || step2= for step in 0 1 $step2 ; do test $step = 2 && vtype= for lentype in $sltype int size_t ; do for addrtype in "struct sockaddr" $vtype ; do AC_COMPILE_IFELSE([AC_LANG_PROGRAM([$ac_includes_default #ifdef HAVE_SYS_SOCKET_H #include <sys/socket.h> #endif #if $step == 0 extern int accept(int s, $addrtype *ap, $lentype *lp); #elif $step == 1 /* Solaris hack */ extern int accept(int s, $addrtype *ap, void *lp); extern int connect(int s, const $addrtype *ap, $lentype l); #else /* $step == 2: default if candidate types have the same size. */ enum { Check = sizeof($lentype)==sizeof(int) && sizeof(int)==sizeof(size_t) }; struct { int d: Check ? 1 : -1; } dummy[Check ? 1 : -1]; /* error if !Check */ #endif /* $step */ ], [ static struct sockaddr *addrp; static $lentype len; accept(0, addrp, &len); ])], [ol_cv_type_lber_socklen_t=$lentype; break 3]) done done done]) if test -z "$ol_cv_type_lber_socklen_t" ; then AC_MSG_FAILURE([accept() sockaddr-length type not found]) fi AC_DEFINE_UNQUOTED(LBER_SOCKLEN_T, $ol_cv_type_lber_socklen_t, [define to sockaddr-length type used by accept()]) -- Regards, Hallvard _______________________________________________ Autoconf mailing list Autoconf@xxxxxxx http://lists.gnu.org/mailman/listinfo/autoconf