From b256c5fb8f58f85b40659b046bdef1549dc7b361 Mon Sep 17 00:00:00 2001 From: nobu Date: Mon, 2 Feb 2009 22:58:03 +0000 Subject: [PATCH] * ext/socket/extconf.rb (in_pktinfo, in6_pktinfo), ext/socket/ancdata.c: defined in w32api/ws2tcpip.h on cygwin but cannot compile for some reason. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21985 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 6 ++++++ ext/socket/ancdata.c | 10 +++++----- ext/socket/extconf.rb | 8 ++++++++ 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index affee951f4..4efbe7e21e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Tue Feb 3 07:57:58 2009 Nobuyoshi Nakada + + * ext/socket/extconf.rb (in_pktinfo, in6_pktinfo), + ext/socket/ancdata.c: defined in w32api/ws2tcpip.h on cygwin but + cannot compile for some reason. + Tue Feb 3 07:02:11 2009 Nobuyoshi Nakada * missing/langinfo.c (nl_langinfo_codeset): accepts iso-8859 diff --git a/ext/socket/ancdata.c b/ext/socket/ancdata.c index 5cc5c49d98..d62f0e5588 100644 --- a/ext/socket/ancdata.c +++ b/ext/socket/ancdata.c @@ -188,7 +188,7 @@ ancillary_int(VALUE self) static VALUE ancillary_s_ip_pktinfo(VALUE self, VALUE v_addr, VALUE v_ifindex, VALUE v_spec_dst) { -#if defined(IPPROTO_IP) && defined(IP_PKTINFO) /* GNU/Linux */ +#if defined(IPPROTO_IP) && defined(IP_PKTINFO) && defined(HAVE_TYPE_STRUCT_IN_PKTINFO) /* GNU/Linux */ unsigned int ifindex; struct sockaddr_in sa; struct in_pktinfo pktinfo; @@ -226,7 +226,7 @@ ancillary_s_ip_pktinfo(VALUE self, VALUE v_addr, VALUE v_ifindex, VALUE v_spec_d static VALUE ancillary_ip_pktinfo(VALUE self) { -#if defined(IPPROTO_IP) && defined(IP_PKTINFO) /* GNU/Linux */ +#if defined(IPPROTO_IP) && defined(IP_PKTINFO) && defined(HAVE_TYPE_STRUCT_IN_PKTINFO) /* GNU/Linux */ int level, type; VALUE data; struct in_pktinfo pktinfo; @@ -397,7 +397,7 @@ anc_inspect_ip_recvdstaddr(int level, int type, VALUE data, VALUE ret) } #endif -#if defined(IPPROTO_IP) && defined(IP_PKTINFO) /* GNU/Linux */ +#if defined(IPPROTO_IP) && defined(IP_PKTINFO) && defined(HAVE_TYPE_STRUCT_IN_PKTINFO) /* GNU/Linux */ static int anc_inspect_ip_pktinfo(int level, int type, VALUE data, VALUE ret) { @@ -426,7 +426,7 @@ anc_inspect_ip_pktinfo(int level, int type, VALUE data, VALUE ret) } #endif -#if defined(IPPROTO_IPV6) && defined(IPV6_PKTINFO) /* IPv6 RFC3542 */ +#if defined(IPPROTO_IPV6) && defined(IPV6_PKTINFO) && defined(HAVE_TYPE_STRUCT_IN6_PKTINFO) /* IPv6 RFC3542 */ static int anc_inspect_ipv6_pktinfo(int level, int type, VALUE data, VALUE ret) { @@ -508,7 +508,7 @@ ancillary_inspect(VALUE self) # if defined(IP_RECVDSTADDR) /* 4.4BSD */ case IP_RECVDSTADDR: if (anc_inspect_ip_recvdstaddr(level, type, data, ret) == -1) goto dump; break; # endif -# if defined(IP_PKTINFO) /* GNU/Linux */ +# if defined(IP_PKTINFO) && defined(HAVE_TYPE_STRUCT_IN_PKTINFO) /* GNU/Linux */ case IP_PKTINFO: if (anc_inspect_ip_pktinfo(level, type, data, ret) == -1) goto dump; break; # endif default: goto dump; diff --git a/ext/socket/extconf.rb b/ext/socket/extconf.rb index c82bacbe48..f4d92066b9 100644 --- a/ext/socket/extconf.rb +++ b/ext/socket/extconf.rb @@ -299,6 +299,14 @@ end have_header("sys/un.h") have_header("sys/uio.h") +have_type("struct in_pktinfo") {|src| + src.sub(%r'^/\*top\*/', '\1'"\n#if defined(IPPROTO_IP) && defined(IP_PKTINFO)") << + "#else\n" << "#error\n" << ">>>>>> no in_pktinfo <<<<<<\n" << "#endif\n" +} +have_type("struct in6_pktinfo") {|src| + src.sub(%r'^/\*top\*/', '\1'"\n#if defined(IPPROTO_IPV6) && defined(IPV6_PKTINFO)") << + "#else\n" << "#error\n" << ">>>>>> no in6_pktinfo <<<<<<\n" << "#endif\n" +} $distcleanfiles << "constants.h" << "constdefs.*"