Separate the detections of s6_addr16 and s6_addr32

pull/212/head
papadave 2018-01-08 20:42:43 +08:00
parent 7807321f09
commit e20e0e8b5d
2 changed files with 14 additions and 8 deletions

20
configure vendored
View File

@ -141,13 +141,19 @@ if [ -z "$CC" ] ; then
CC=cc
fi
check_compile 'whether netinet/in.h defines s6_addr16' "" \
'#include <netinet/in.h>\nint main(int a, char**c){struct in6_addr x={.s6_addr32[0]=a};return x.s6_addr16[0]; }' \
|| {
check_compile 'whether netinet/in.h defines __u6_addr.__u6_addr16' \
'-Ds6_addr16=__u6_addr.__u6_addr16 -Ds6_addr32=__u6_addr.__u6_addr32' \
'#include <netinet/in.h>\nint main(int a, char**c){struct in6_addr x={.s6_addr32[0]=a};return x.s6_addr16[0]; }'
}
for i in 16 32; do
check_compile "whether netinet/in.h defines s6_addr$i" "" \
'#include <netinet/in.h>\nint main(int a, char**c){'"struct in6_addr x={.s6_addr$i[0]=a};return x.s6_addr$i[0];"' }' \
|| {
check_compile "whether netinet/in.h defines __u6_addr.__u6_addr$i" \
"-Ds6_addr$i=__u6_addr.__u6_addr$i" \
'#include <netinet/in.h>\nint main(int a, char**c){'"struct in6_addr x={.s6_addr$i[0]=a};return x.s6_addr$i[0];"' }' || \
check_compile "whether netinet/in.h defines _S6_un._S6_u$i" \
"-Ds6_addr$i=_S6_un._S6_u$i" \
'#include <netinet/in.h>\nint main(int a, char**c){'"struct in6_addr x={.s6_addr$i[0]=a};return x.s6_addr$i[0];"' }' || \
OUR_CPPFLAGS="$OUR_CPPFLAGS -DNO_S6_ADDR$i"
}
done
check_define __OpenBSD__ && \
check_compile_run 'whether OpenBSDs fclose() (illegally) calls close()' \

View File

@ -336,7 +336,7 @@ int close(int fd) {
}
static int is_v4inv6(const struct in6_addr *a) {
return a->s6_addr32[0] == 0 && a->s6_addr32[1] == 0 &&
#ifdef IS_SOLARIS
#ifdef NO_S6_ADDR16
a->s6_addr[8] == 0 && a->s6_addr[9] == 0 && a->s6_addr[10] == 0xff && a->s6_addr[11] == 0xff;
#else
a->s6_addr16[4] == 0 && a->s6_addr16[5] == 0xffff;