added socklen_t test and sa_family_t test into configure.ac
This commit is contained in:
parent
b31049f808
commit
b95102f953
175
moo/configure
vendored
175
moo/configure
vendored
@ -21047,7 +21047,6 @@ cat >>confdefs.h <<_ACEOF
|
||||
_ACEOF
|
||||
|
||||
|
||||
|
||||
if test ${ac_cv_sizeof_socklen_t} -gt 0
|
||||
then
|
||||
|
||||
@ -21085,6 +21084,85 @@ $as_echo "$ac_res" >&6; }
|
||||
|
||||
$as_echo "#define MOO_SOCKLEN_T_IS_SIGNED 1" >>confdefs.h
|
||||
|
||||
elif eval "test \"\${ax_cv_decl_${typename}_signed}\" = \"no\""; then
|
||||
$as_echo_n ""
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
# 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
|
||||
# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
|
||||
# This bug is HP SR number 8606223364.
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of sa_family_t" >&5
|
||||
$as_echo_n "checking size of sa_family_t... " >&6; }
|
||||
if ${ac_cv_sizeof_sa_family_t+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (sa_family_t))" "ac_cv_sizeof_sa_family_t" "
|
||||
#include <winsock2.h>
|
||||
#include <ws2tcpip.h>
|
||||
"; then :
|
||||
|
||||
else
|
||||
if test "$ac_cv_type_sa_family_t" = yes; then
|
||||
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
|
||||
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
|
||||
as_fn_error 77 "cannot compute sizeof (sa_family_t)
|
||||
See \`config.log' for more details" "$LINENO" 5; }
|
||||
else
|
||||
ac_cv_sizeof_sa_family_t=0
|
||||
fi
|
||||
fi
|
||||
|
||||
fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_sa_family_t" >&5
|
||||
$as_echo "$ac_cv_sizeof_sa_family_t" >&6; }
|
||||
|
||||
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define SIZEOF_SA_FAMILY_T $ac_cv_sizeof_sa_family_t
|
||||
_ACEOF
|
||||
|
||||
|
||||
if test ${ac_cv_sizeof_sa_family_t} -gt 0
|
||||
then
|
||||
|
||||
typename=`echo sa_family_t | sed "s/[^a-zA-Z0-9_]/_/g"`
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether sa_family_t is signed" >&5
|
||||
$as_echo_n "checking whether sa_family_t is signed... " >&6; }
|
||||
if eval \${ax_cv_decl_${typename}_signed+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
#include <winsock2.h>
|
||||
#include <ws2tcpip.h>
|
||||
int
|
||||
main ()
|
||||
{
|
||||
int foo [ 1 - 2 * !(((sa_family_t) -1) < 0) ]
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
if ac_fn_c_try_compile "$LINENO"; then :
|
||||
eval "ax_cv_decl_${typename}_signed=\"yes\""
|
||||
else
|
||||
eval "ax_cv_decl_${typename}_signed=\"no\""
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||
fi
|
||||
eval ac_res=\$ax_cv_decl_${typename}_signed
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
|
||||
$as_echo "$ac_res" >&6; }
|
||||
symbolname=`echo sa_family_t | sed "s/[^a-zA-Z0-9_]/_/g" | tr "a-z" "A-Z"`
|
||||
if eval "test \"\${ax_cv_decl_${typename}_signed}\" = \"yes\""; then
|
||||
|
||||
$as_echo "#define MOO_SA_FAMILY_T_IS_SIGNED 1" >>confdefs.h
|
||||
|
||||
elif eval "test \"\${ax_cv_decl_${typename}_signed}\" = \"no\""; then
|
||||
$as_echo_n ""
|
||||
fi
|
||||
@ -21272,6 +21350,8 @@ cat >>confdefs.h <<_ACEOF
|
||||
_ACEOF
|
||||
|
||||
|
||||
|
||||
|
||||
# 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
|
||||
# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
|
||||
@ -21281,9 +21361,7 @@ $as_echo_n "checking size of socklen_t... " >&6; }
|
||||
if ${ac_cv_sizeof_socklen_t+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (socklen_t))" "ac_cv_sizeof_socklen_t" "
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (socklen_t))" "ac_cv_sizeof_socklen_t" "#include <sys/socket.h>
|
||||
"; then :
|
||||
|
||||
else
|
||||
@ -21308,7 +21386,6 @@ cat >>confdefs.h <<_ACEOF
|
||||
_ACEOF
|
||||
|
||||
|
||||
|
||||
if test ${ac_cv_sizeof_socklen_t} -gt 0
|
||||
then
|
||||
|
||||
@ -21345,6 +21422,84 @@ $as_echo "$ac_res" >&6; }
|
||||
|
||||
$as_echo "#define MOO_SOCKLEN_T_IS_SIGNED 1" >>confdefs.h
|
||||
|
||||
elif eval "test \"\${ax_cv_decl_${typename}_signed}\" = \"no\""; then
|
||||
$as_echo_n ""
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
# 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
|
||||
# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
|
||||
# This bug is HP SR number 8606223364.
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of sa_family_t" >&5
|
||||
$as_echo_n "checking size of sa_family_t... " >&6; }
|
||||
if ${ac_cv_sizeof_sa_family_t+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (sa_family_t))" "ac_cv_sizeof_sa_family_t" "
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
"; then :
|
||||
|
||||
else
|
||||
if test "$ac_cv_type_sa_family_t" = yes; then
|
||||
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
|
||||
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
|
||||
as_fn_error 77 "cannot compute sizeof (sa_family_t)
|
||||
See \`config.log' for more details" "$LINENO" 5; }
|
||||
else
|
||||
ac_cv_sizeof_sa_family_t=0
|
||||
fi
|
||||
fi
|
||||
|
||||
fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_sa_family_t" >&5
|
||||
$as_echo "$ac_cv_sizeof_sa_family_t" >&6; }
|
||||
|
||||
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define SIZEOF_SA_FAMILY_T $ac_cv_sizeof_sa_family_t
|
||||
_ACEOF
|
||||
|
||||
|
||||
if test ${ac_cv_sizeof_sa_family_t} -gt 0
|
||||
then
|
||||
|
||||
typename=`echo sa_family_t | sed "s/[^a-zA-Z0-9_]/_/g"`
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether sa_family_t is signed" >&5
|
||||
$as_echo_n "checking whether sa_family_t is signed... " >&6; }
|
||||
if eval \${ax_cv_decl_${typename}_signed+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
#include <sys/socket.h>
|
||||
int
|
||||
main ()
|
||||
{
|
||||
int foo [ 1 - 2 * !(((sa_family_t) -1) < 0) ]
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
if ac_fn_c_try_compile "$LINENO"; then :
|
||||
eval "ax_cv_decl_${typename}_signed=\"yes\""
|
||||
else
|
||||
eval "ax_cv_decl_${typename}_signed=\"no\""
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||
fi
|
||||
eval ac_res=\$ax_cv_decl_${typename}_signed
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
|
||||
$as_echo "$ac_res" >&6; }
|
||||
symbolname=`echo sa_family_t | sed "s/[^a-zA-Z0-9_]/_/g" | tr "a-z" "A-Z"`
|
||||
if eval "test \"\${ax_cv_decl_${typename}_signed}\" = \"yes\""; then
|
||||
|
||||
$as_echo "#define MOO_SA_FAMILY_T_IS_SIGNED 1" >>confdefs.h
|
||||
|
||||
elif eval "test \"\${ax_cv_decl_${typename}_signed}\" = \"no\""; then
|
||||
$as_echo_n ""
|
||||
fi
|
||||
@ -21687,6 +21842,16 @@ _ACEOF
|
||||
|
||||
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define MOO_SIZEOF_SOCKLEN_T ${ac_cv_sizeof_socklen_t}
|
||||
_ACEOF
|
||||
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define MOO_SIZEOF_SA_FAMILY_T ${ac_cv_sizeof_sa_family_t}
|
||||
_ACEOF
|
||||
|
||||
|
||||
moo_package_version_major="`echo ${PACKAGE_VERSION} | cut -d. -f1`"
|
||||
moo_package_version_minor="`echo ${PACKAGE_VERSION} | cut -d. -f2`"
|
||||
moo_package_version_patch="`echo ${PACKAGE_VERSION} | cut -d. -f3`"
|
||||
|
@ -304,7 +304,6 @@ then
|
||||
AC_CHECK_SIZEOF(socklen_t,, [
|
||||
#include <winsock2.h>
|
||||
#include <ws2tcpip.h>])
|
||||
|
||||
if test ${ac_cv_sizeof_socklen_t} -gt 0
|
||||
then
|
||||
AX_CHECK_SIGN([socklen_t],
|
||||
@ -313,6 +312,18 @@ then
|
||||
[#include <winsock2.h>
|
||||
#include <ws2tcpip.h>])
|
||||
fi
|
||||
|
||||
AC_CHECK_SIZEOF(sa_family_t,, [
|
||||
#include <winsock2.h>
|
||||
#include <ws2tcpip.h>])
|
||||
if test ${ac_cv_sizeof_sa_family_t} -gt 0
|
||||
then
|
||||
AX_CHECK_SIGN([sa_family_t],
|
||||
[ AC_DEFINE(MOO_SA_FAMILY_T_IS_SIGNED, 1, [Define if sa_family_t is signed]) ],
|
||||
[ AS_ECHO_N("") ],
|
||||
[#include <winsock2.h>
|
||||
#include <ws2tcpip.h>])
|
||||
fi
|
||||
else
|
||||
AC_CHECK_SIZEOF(struct sockaddr_in,,[
|
||||
#include <sys/socket.h>
|
||||
@ -330,10 +341,9 @@ else
|
||||
#include <sys/socket.h>
|
||||
#include <sys/types.h>
|
||||
#include <net/if_dl.h>])
|
||||
AC_CHECK_SIZEOF(socklen_t,, [
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>])
|
||||
|
||||
|
||||
AC_CHECK_SIZEOF(socklen_t,, [#include <sys/socket.h>])
|
||||
if test ${ac_cv_sizeof_socklen_t} -gt 0
|
||||
then
|
||||
AX_CHECK_SIGN([socklen_t],
|
||||
@ -341,6 +351,17 @@ else
|
||||
[ AS_ECHO_N("") ],
|
||||
[#include <sys/socket.h>])
|
||||
fi
|
||||
|
||||
AC_CHECK_SIZEOF(sa_family_t,, [
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>])
|
||||
if test ${ac_cv_sizeof_sa_family_t} -gt 0
|
||||
then
|
||||
AX_CHECK_SIGN([sa_family_t],
|
||||
[ AC_DEFINE(MOO_SA_FAMILY_T_IS_SIGNED, 1, [Define if sa_family_t is signed]) ],
|
||||
[ AS_ECHO_N("") ],
|
||||
[#include <sys/socket.h>])
|
||||
fi
|
||||
fi
|
||||
|
||||
dnl gcc 3.4.3 on opensolaris x86 gave this warning without -msse or
|
||||
@ -476,6 +497,8 @@ AC_DEFINE_UNQUOTED(MOO_SIZEOF_STRUCT_SOCKADDR_LL, ${ac_cv_sizeof_struct_sockaddr
|
||||
AC_DEFINE_UNQUOTED(MOO_SIZEOF_STRUCT_SOCKADDR_UN, ${ac_cv_sizeof_struct_sockaddr_un}, [sizeof(struct sockaddr_un)])
|
||||
AC_DEFINE_UNQUOTED(MOO_SIZEOF_STRUCT_SOCKADDR_DL, ${ac_cv_sizeof_struct_sockaddr_dl}, [sizeof(struct sockaddr_dl)])
|
||||
|
||||
AC_DEFINE_UNQUOTED(MOO_SIZEOF_SOCKLEN_T, ${ac_cv_sizeof_socklen_t}, [sizeof(socklen_t)])
|
||||
AC_DEFINE_UNQUOTED(MOO_SIZEOF_SA_FAMILY_T, ${ac_cv_sizeof_sa_family_t}, [sizeof(sa_family_t)])
|
||||
|
||||
moo_package_version_major="`echo ${PACKAGE_VERSION} | cut -d. -f1`"
|
||||
moo_package_version_minor="`echo ${PACKAGE_VERSION} | cut -d. -f2`"
|
||||
|
@ -413,6 +413,9 @@
|
||||
/* Patch level */
|
||||
#undef MOO_PACKAGE_VERSION_PATCH
|
||||
|
||||
/* Define if sa_family_t is signed */
|
||||
#undef MOO_SA_FAMILY_T_IS_SIGNED
|
||||
|
||||
/* sizeof(char) */
|
||||
#undef MOO_SIZEOF_CHAR
|
||||
|
||||
@ -443,9 +446,15 @@
|
||||
/* sizeof(off_t) */
|
||||
#undef MOO_SIZEOF_OFF_T
|
||||
|
||||
/* sizeof(sa_family_t) */
|
||||
#undef MOO_SIZEOF_SA_FAMILY_T
|
||||
|
||||
/* sizeof(short) */
|
||||
#undef MOO_SIZEOF_SHORT
|
||||
|
||||
/* sizeof(socklen_t) */
|
||||
#undef MOO_SIZEOF_SOCKLEN_T
|
||||
|
||||
/* sizeof(struct sockaddr_dl) */
|
||||
#undef MOO_SIZEOF_STRUCT_SOCKADDR_DL
|
||||
|
||||
@ -555,6 +564,9 @@
|
||||
/* The size of `off_t', as computed by sizeof. */
|
||||
#undef SIZEOF_OFF_T
|
||||
|
||||
/* The size of `sa_family_t', as computed by sizeof. */
|
||||
#undef SIZEOF_SA_FAMILY_T
|
||||
|
||||
/* The size of `short', as computed by sizeof. */
|
||||
#undef SIZEOF_SHORT
|
||||
|
||||
|
@ -38,6 +38,76 @@ struct sck_t
|
||||
/* there are more fields in the actual object */
|
||||
};
|
||||
|
||||
#if (MOO_SIZEOF_SOCKLEN_T > 0)
|
||||
//#error x
|
||||
#endif
|
||||
|
||||
#if (MOO_SIZEOF_INT8_T > 0)
|
||||
#error x
|
||||
#endif
|
||||
|
||||
#if (MOO_SIZEOF_SOCKLEN_T == 1)
|
||||
#if defined(MOO_SOCKLEN_T_IS_SIGNED)
|
||||
typedef moo_int8_t sck_len_t;
|
||||
#else
|
||||
typedef moo_uint8_t sck_len_t;
|
||||
#endif
|
||||
#elif (MOO_SIZEOF_SOCKLEN_T == 2)
|
||||
#if defined(MOO_SOCKLEN_T_IS_SIGNED)
|
||||
typedef moo_int16_t sck_len_t;
|
||||
#else
|
||||
typedef moo_uint16_t sck_len_t;
|
||||
#endif
|
||||
#elif (MOO_SIZEOF_SOCKLEN_T == 4)
|
||||
#if defined(MOO_SOCKLEN_T_IS_SIGNED)
|
||||
typedef moo_int32_t sck_len_t;
|
||||
#else
|
||||
typedef moo_uint32_t sck_len_t;
|
||||
#endif
|
||||
#elif (MOO_SIZEOF_SOCKLEN_T == 8)
|
||||
#if defined(MOO_SOCKLEN_T_IS_SIGNED)
|
||||
typedef moo_int64_t sck_len_t;
|
||||
#else
|
||||
typedef moo_uint64_t sck_len_t;
|
||||
#endif
|
||||
#else
|
||||
# error UNSUPPORT sck_len_t size
|
||||
#endif
|
||||
|
||||
#if (MOO_SIZEOF_SA_FAMILY_T == 1)
|
||||
#if defined(MOO_SA_FAMILY_T_IS_SIGNED)
|
||||
typedef moo_int8_t sck_addr_family_t;
|
||||
#else
|
||||
typedef moo_uint8_t sck_addr_family_t;
|
||||
#endif
|
||||
#elif (MOO_SIZEOF_SA_FAMILY_T == 2)
|
||||
#if defined(MOO_SA_FAMILY_T_IS_SIGNED)
|
||||
typedef moo_int16_t sck_addr_family_t;
|
||||
#else
|
||||
typedef moo_uint16_t sck_addr_family_t;
|
||||
#endif
|
||||
#elif (MOO_SIZEOF_SA_FAMILY_T == 4)
|
||||
#if defined(MOO_SA_FAMILY_T_IS_SIGNED)
|
||||
typedef moo_int32_t sck_addr_family_t;
|
||||
#else
|
||||
typedef moo_uint32_t sck_addr_family_t;
|
||||
#endif
|
||||
#elif (MOO_SIZEOF_SA_FAMILY_T == 8)
|
||||
#if defined(MOO_SA_FAMILY_T_IS_SIGNED)
|
||||
typedef moo_int64_t sck_addr_family_t;
|
||||
#else
|
||||
typedef moo_uint64_t sck_addr_family_t;
|
||||
#endif
|
||||
#else
|
||||
# error UNSUPPORT sck_addr_family_t size
|
||||
#endif
|
||||
|
||||
struct sck_addr_t
|
||||
{
|
||||
sck_addr_family_t family;
|
||||
moo_uint8_t data[1];
|
||||
};
|
||||
typedef struct sck_addr_t sck_addr_t;
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
|
@ -400,7 +400,7 @@ TODO:
|
||||
moo_seterrbfmt (moo, MOO_EINVAL, "scope id too large");
|
||||
return -1; /* overflow */
|
||||
}
|
||||
nwad->in6.sin6_scope_id= x;
|
||||
nwad->in6.sin6_scope_id = x;
|
||||
p++;
|
||||
}
|
||||
while (p < end && *p >= '0' && *p <= '9');
|
||||
|
@ -143,31 +143,28 @@ static moo_pfrc_t pf_connect (moo_t* moo, moo_ooi_t nargs)
|
||||
oop_sck_t sck;
|
||||
int fd, oldfl, n;
|
||||
moo_errnum_t errnum;
|
||||
moo_oop_t arg;
|
||||
|
||||
sck = (oop_sck_t)MOO_STACK_GETRCV(moo, nargs);
|
||||
arg = MOO_STACK_GETARG(moo, nargs, 1);
|
||||
|
||||
MOO_PF_CHECK_RCV (moo,
|
||||
MOO_OOP_IS_POINTER(sck) &&
|
||||
MOO_OBJ_BYTESOF(sck) >= (MOO_SIZEOF(*sck) - MOO_SIZEOF(moo_obj_t)) &&
|
||||
MOO_OOP_IS_SMOOI(sck->handle));
|
||||
MOO_PF_CHECK_ARGS (moo, nargs, MOO_OBJ_IS_BYTE_POINTER(arg));
|
||||
|
||||
fd = MOO_OOP_TO_SMOOI(sck->handle);
|
||||
|
||||
oldfl = fcntl(fd, F_GETFL, 0);
|
||||
if (oldfl == -1 || fcntl(fd, F_SETFL, oldfl | O_NONBLOCK) == -1) goto oops_syserr;
|
||||
|
||||
{
|
||||
|
||||
struct sockaddr_in sin;
|
||||
memset (&sin, 0, sizeof(sin));
|
||||
sin.sin_family = AF_INET;
|
||||
sin.sin_addr.s_addr = inet_addr ("192.168.1.145");
|
||||
sin.sin_port = htons(12345);
|
||||
do
|
||||
{
|
||||
n = connect(fd, (struct sockaddr*)&sin, sizeof(sin));
|
||||
//n = connect(fd, (struct sockaddr*)MOO_OBJ_GET_BYTE_SLOT(arg), addrlen);
|
||||
}
|
||||
while (n == -1 && errno == EINTR);
|
||||
}
|
||||
|
||||
|
||||
if (n == -1 && errno != EINPROGRESS)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user