added a check for offsetof(struct sockaddr,sa_family)
This commit is contained in:
parent
51e7d93f63
commit
92413034f6
37
moo/configure
vendored
37
moo/configure
vendored
@ -21357,6 +21357,25 @@ $as_echo "#define MOO_SA_FAMILY_T_IS_SIGNED 1" >>confdefs.h
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking offset of sa_family in struct sockaddr" >&5
|
||||
$as_echo_n "checking offset of sa_family in struct sockaddr... " >&6; }
|
||||
if ac_fn_c_compute_int "$LINENO" "offsetof(struct sockaddr, sa_family)" "ac_cv_offsetof_sa_family" "#include <stddef.h>
|
||||
#include <winsock2.h>
|
||||
#include <ws2tcpip.h>"; then :
|
||||
|
||||
else
|
||||
ac_cv_offsteof_sa_family=0
|
||||
fi
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_offsetof_sa_family" >&5
|
||||
$as_echo "$ac_cv_offsetof_sa_family" >&6; }
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define MOO_OFFSETOF_SA_FAMILY ${ac_cv_offsetof_sa_family}
|
||||
_ACEOF
|
||||
|
||||
|
||||
else
|
||||
# The cast to long int works around a bug in the HP C Compiler
|
||||
# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
|
||||
@ -21704,6 +21723,24 @@ $as_echo "#define MOO_SA_FAMILY_T_IS_SIGNED 1" >>confdefs.h
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking offset of sa_family in struct sockaddr" >&5
|
||||
$as_echo_n "checking offset of sa_family in struct sockaddr... " >&6; }
|
||||
if ac_fn_c_compute_int "$LINENO" "offsetof(struct sockaddr, sa_family)" "ac_cv_offsetof_sa_family" "#include <stddef.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>"; then :
|
||||
|
||||
else
|
||||
ac_cv_offsteof_sa_family=0
|
||||
fi
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_offsetof_sa_family" >&5
|
||||
$as_echo "$ac_cv_offsetof_sa_family" >&6; }
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define MOO_OFFSETOF_SA_FAMILY ${ac_cv_offsetof_sa_family}
|
||||
_ACEOF
|
||||
|
||||
fi
|
||||
|
||||
if test ${ac_cv_sizeof___int128_t} -gt 0
|
||||
|
@ -369,6 +369,16 @@ then
|
||||
[#include <winsock2.h>
|
||||
#include <ws2tcpip.h>])
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING([offset of sa_family in struct sockaddr])
|
||||
AC_COMPUTE_INT([ac_cv_offsetof_sa_family],
|
||||
[[offsetof(struct sockaddr, sa_family)]],
|
||||
[#include <stddef.h>
|
||||
#include <winsock2.h>
|
||||
#include <ws2tcpip.h>], [ac_cv_offsteof_sa_family=0])
|
||||
AC_MSG_RESULT([$ac_cv_offsetof_sa_family])
|
||||
AC_DEFINE_UNQUOTED(MOO_OFFSETOF_SA_FAMILY, ${ac_cv_offsetof_sa_family}, [offsetof(struct sockaddr, sa_family)])
|
||||
|
||||
else
|
||||
AC_CHECK_SIZEOF(struct sockaddr_in,,[
|
||||
#include <sys/types.h>
|
||||
@ -417,6 +427,15 @@ else
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>])
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING([offset of sa_family in struct sockaddr])
|
||||
AC_COMPUTE_INT([ac_cv_offsetof_sa_family],
|
||||
[[offsetof(struct sockaddr, sa_family)]],
|
||||
[#include <stddef.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>], [ac_cv_offsteof_sa_family=0])
|
||||
AC_MSG_RESULT([$ac_cv_offsetof_sa_family])
|
||||
AC_DEFINE_UNQUOTED(MOO_OFFSETOF_SA_FAMILY, ${ac_cv_offsetof_sa_family}, [offsetof(struct sockaddr, sa_family)])
|
||||
fi
|
||||
|
||||
dnl gcc 3.4.3 on opensolaris x86 gave this warning without -msse or
|
||||
|
@ -416,6 +416,9 @@
|
||||
/* MB_LEN_MAX */
|
||||
#undef MOO_MBLEN_MAX
|
||||
|
||||
/* offsetof(struct sockaddr, sa_family) */
|
||||
#undef MOO_OFFSETOF_SA_FAMILY
|
||||
|
||||
/* Author */
|
||||
#undef MOO_PACKAGE_AUTHOR
|
||||
|
||||
|
@ -102,6 +102,9 @@ struct sck_t
|
||||
|
||||
struct sck_addr_t
|
||||
{
|
||||
#if defined(MOO_OFFSETOF_SA_FAMILY) && (MOO_OFFSETOF_SA_FAMILY > 0)
|
||||
moo_uint8_t filler[MOO_OFFSETOF_SA_FAMILY];
|
||||
#endif
|
||||
sck_addr_family_t family;
|
||||
moo_uint8_t data[1];
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user