1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* ext/socket/extconf.rb: use have_struct_member.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26210 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2009-12-30 21:01:13 +00:00
parent 1069e0f335
commit 815fccb4dc
2 changed files with 5 additions and 8 deletions

View file

@ -394,7 +394,7 @@ ancillary_int(VALUE self)
return INT2NUM(i); return INT2NUM(i);
} }
#if defined(IPPROTO_IP) && defined(IP_PKTINFO) && defined(HAVE_TYPE_STRUCT_IN_PKTINFO) && defined(HAVE_IPI_SPEC_DST) /* GNU/Linux */ #if defined(IPPROTO_IP) && defined(IP_PKTINFO) && defined(HAVE_STRUCT_IN_PKTINFO_IPI_SPEC_DST) /* GNU/Linux */
/* /*
* call-seq: * call-seq:
* Socket::AncillaryData.ip_pktinfo(addr, ifindex) => ancdata * Socket::AncillaryData.ip_pktinfo(addr, ifindex) => ancdata
@ -458,7 +458,7 @@ ancillary_s_ip_pktinfo(int argc, VALUE *argv, VALUE self)
#define ancillary_s_ip_pktinfo rb_f_notimplement #define ancillary_s_ip_pktinfo rb_f_notimplement
#endif #endif
#if defined(IPPROTO_IP) && defined(IP_PKTINFO) && defined(HAVE_TYPE_STRUCT_IN_PKTINFO) && defined(HAVE_IPI_SPEC_DST) /* GNU/Linux */ #if defined(IPPROTO_IP) && defined(IP_PKTINFO) && defined(HAVE_STRUCT_IN_PKTINFO_IPI_SPEC_DST) /* GNU/Linux */
/* /*
* call-seq: * call-seq:
* ancdata.ip_pktinfo => [addr, ifindex, spec_dst] * ancdata.ip_pktinfo => [addr, ifindex, spec_dst]
@ -793,7 +793,7 @@ anc_inspect_ip_recvdstaddr(int level, int type, VALUE data, VALUE ret)
} }
#endif #endif
#if defined(IPPROTO_IP) && defined(IP_PKTINFO) && defined(HAVE_TYPE_STRUCT_IN_PKTINFO) && defined(HAVE_IPI_SPEC_DST) /* GNU/Linux */ #if defined(IPPROTO_IP) && defined(IP_PKTINFO) && defined(HAVE_STRUCT_IN_PKTINFO_IPI_SPEC_DST) /* GNU/Linux */
static int static int
anc_inspect_ip_pktinfo(int level, int type, VALUE data, VALUE ret) anc_inspect_ip_pktinfo(int level, int type, VALUE data, VALUE ret)
{ {
@ -1045,7 +1045,7 @@ ancillary_inspect(VALUE self)
# if defined(IP_RECVDSTADDR) /* 4.4BSD */ # if defined(IP_RECVDSTADDR) /* 4.4BSD */
case IP_RECVDSTADDR: inspected = anc_inspect_ip_recvdstaddr(level, type, data, ret); break; case IP_RECVDSTADDR: inspected = anc_inspect_ip_recvdstaddr(level, type, data, ret); break;
# endif # endif
# if defined(IP_PKTINFO) && defined(HAVE_TYPE_STRUCT_IN_PKTINFO) && defined(HAVE_IPI_SPEC_DST) /* GNU/Linux */ # if defined(IP_PKTINFO) && defined(HAVE_STRUCT_IN_PKTINFO_IPI_SPEC_DST) /* GNU/Linux */
case IP_PKTINFO: inspected = anc_inspect_ip_pktinfo(level, type, data, ret); break; case IP_PKTINFO: inspected = anc_inspect_ip_pktinfo(level, type, data, ret); break;
# endif # endif
} }

View file

@ -319,14 +319,11 @@ have_header("sys/uio.h")
have_type("struct in_pktinfo", headers) {|src| have_type("struct in_pktinfo", headers) {|src|
src.sub(%r'^/\*top\*/', '\1'"\n#if defined(IPPROTO_IP) && defined(IP_PKTINFO)") << src.sub(%r'^/\*top\*/', '\1'"\n#if defined(IPPROTO_IP) && defined(IP_PKTINFO)") <<
"#else\n" << "#error\n" << ">>>>>> no in_pktinfo <<<<<<\n" << "#endif\n" "#else\n" << "#error\n" << ">>>>>> no in_pktinfo <<<<<<\n" << "#endif\n"
} } and have_struct_member("struct in_pktinfo", "ipi_spec_dst", headers)
have_type("struct in6_pktinfo", headers) {|src| have_type("struct in6_pktinfo", headers) {|src|
src.sub(%r'^/\*top\*/', '\1'"\n#if defined(IPPROTO_IPV6) && defined(IPV6_PKTINFO)") << src.sub(%r'^/\*top\*/', '\1'"\n#if defined(IPPROTO_IPV6) && defined(IPV6_PKTINFO)") <<
"#else\n" << "#error\n" << ">>>>>> no in6_pktinfo <<<<<<\n" << "#endif\n" "#else\n" << "#error\n" << ">>>>>> no in6_pktinfo <<<<<<\n" << "#endif\n"
} }
if have_struct_member("struct in_pktinfo", "ipi_spec_dst", headers)
$defs[-1] = "-DHAVE_IPI_SPEC_DST"
end
have_type("struct sockcred", headers) have_type("struct sockcred", headers)
have_type("struct cmsgcred", headers) have_type("struct cmsgcred", headers)