changed configure.ac to check the offset of sa_family in struct sockaddr
This commit is contained in:
parent
b7e540d6cf
commit
46cd39cabb
36
qse/configure
vendored
36
qse/configure
vendored
@ -22344,6 +22344,25 @@ $as_echo "#define QSE_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 QSE_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
|
||||
@ -22690,6 +22709,23 @@ $as_echo "#define QSE_SA_FAMILY_T_IS_SIGNED 1" >>confdefs.h
|
||||
|
||||
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 QSE_OFFSETOF_SA_FAMILY ${ac_cv_offsetof_sa_family}
|
||||
_ACEOF
|
||||
|
||||
fi
|
||||
|
||||
|
||||
|
@ -463,6 +463,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(QSE_OFFSETOF_SA_FAMILY, ${ac_cv_offsetof_sa_family}, [offsetof(struct sockaddr, sa_family)])
|
||||
|
||||
else
|
||||
AC_CHECK_SIZEOF(struct sockaddr_in,,[
|
||||
#include <sys/types.h>
|
||||
@ -510,6 +520,14 @@ else
|
||||
#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(QSE_OFFSETOF_SA_FAMILY, ${ac_cv_offsetof_sa_family}, [offsetof(struct sockaddr, sa_family)])
|
||||
fi
|
||||
|
||||
|
||||
|
@ -936,6 +936,9 @@
|
||||
/* Define if mode_t is signed */
|
||||
#undef QSE_MODE_T_IS_SIGNED
|
||||
|
||||
/* offsetof(struct sockaddr, sa_family) */
|
||||
#undef QSE_OFFSETOF_SA_FAMILY
|
||||
|
||||
/* Author */
|
||||
#undef QSE_PACKAGE_AUTHOR
|
||||
|
||||
|
@ -197,7 +197,13 @@ struct qse_skad_t
|
||||
/* TODO: is this large enough?? */
|
||||
union
|
||||
{
|
||||
qse_skaf_t family;
|
||||
struct
|
||||
{
|
||||
#if defined(QSE_OFFSETOF_SA_FAMILY) && (QSE_OFFSET_OF_SA_FAMILY > 0)
|
||||
qse_uint8_t filler[QSE_OFFSETOF_SA_FAMILY];
|
||||
#endif
|
||||
qse_skaf_t family;
|
||||
} sa;
|
||||
qse_uint8_t data[QSE_SKAD_DATA_SIZE];
|
||||
} u;
|
||||
|
||||
|
@ -106,7 +106,7 @@ typedef union sockaddr_t sockaddr_t;
|
||||
#endif
|
||||
*/
|
||||
|
||||
#define FAMILY(x) (((qse_skad_t*)x)->u.family)
|
||||
#define FAMILY(x) (((qse_skad_t*)x)->u.sa.family)
|
||||
|
||||
static QSE_INLINE int skad_to_nwad (const sockaddr_t* skad, qse_nwad_t* nwad)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user