* ext/socket/extconf.rb: test types just after headers test.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39196 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2013-02-10 11:58:53 +00:00
Родитель aa70f1fd7e
Коммит 5b057eeff2
2 изменённых файлов: 26 добавлений и 21 удалений

Просмотреть файл

@ -1,3 +1,7 @@
Sun Feb 10 20:58:17 2013 Tanaka Akira <akr@fsij.org>
* ext/socket/extconf.rb: test types just after headers test.
Sun Feb 10 16:00:00 2013 Zachary Scott <zachary@zacharyscott.net>
* lib/rake/doc/MIT-LICENSE: Add license file from upstream

Просмотреть файл

@ -54,6 +54,28 @@ have_header("sys/uio.h")
have_header("ucred.h", headers)
have_type("struct addrinfo", headers)
unless have_type("socklen_t", headers)
$defs << "-Dsocklen_t=int"
end
have_type("struct in_pktinfo", headers) {|src|
src.sub(%r'^/\*top\*/', '\&'"\n#if defined(IPPROTO_IP) && defined(IP_PKTINFO)") <<
"#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|
src.sub(%r'^/\*top\*/', '\&'"\n#if defined(IPPROTO_IPV6) && defined(IPV6_PKTINFO)") <<
"#else\n" << "#error\n" << ">>>>>> no in6_pktinfo <<<<<<\n" << "#endif\n"
}
have_type("struct sockcred", headers)
have_type("struct cmsgcred", headers)
have_type("struct ip_mreq", headers) # 4.4BSD
have_type("struct ip_mreqn", headers) # Linux 2.4
have_type("struct ipv6_mreq", headers) # RFC 3493
ipv6 = false
default_ipv6 = /cygwin|beos|haiku/ !~ RUBY_PLATFORM
if enable_config("ipv6", default_ipv6)
@ -397,7 +419,6 @@ Fatal: invalid value for --with-lookup-order-hack (expected INET, INET6 or UNSPE
EOS
end
have_type("struct addrinfo", headers)
have_func("freehostent")
have_func("freeaddrinfo")
if /haiku/ !~ RUBY_PLATFORM and have_func("gai_strerror")
@ -453,32 +474,12 @@ have_func('inet_pton(0, "", (void *)0)') or have_func('inet_aton("", (struct in_
have_func('getservbyport(0, "")')
have_func("getifaddrs")
unless have_type("socklen_t", headers)
$defs << "-Dsocklen_t=int"
end
have_type("struct in_pktinfo", headers) {|src|
src.sub(%r'^/\*top\*/', '\&'"\n#if defined(IPPROTO_IP) && defined(IP_PKTINFO)") <<
"#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|
src.sub(%r'^/\*top\*/', '\&'"\n#if defined(IPPROTO_IPV6) && defined(IPV6_PKTINFO)") <<
"#else\n" << "#error\n" << ">>>>>> no in6_pktinfo <<<<<<\n" << "#endif\n"
}
have_type("struct sockcred", headers)
have_type("struct cmsgcred", headers)
have_func("getpeereid")
have_func("getpeerucred")
have_func("if_indextoname")
have_type("struct ip_mreq", headers) # 4.4BSD
have_type("struct ip_mreqn", headers) # Linux 2.4
have_type("struct ipv6_mreq", headers) # RFC 3493
# workaround for recent Windows SDK
$defs << "-DIPPROTO_IPV6=IPPROTO_IPV6" if $defs.include?("-DHAVE_CONST_IPPROTO_IPV6") && !have_macro("IPPROTO_IPV6")