summaryrefslogtreecommitdiff
path: root/ext/socket
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-02-10 11:58:53 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-02-10 11:58:53 +0000
commit5b057eeff2c42178ecae22173c8e931cad9622b1 (patch)
tree50cc8f19e5ff23f852909d7acd29c9ac81d1490b /ext/socket
parentaa70f1fd7ee868251e50d593e14ebdc577584acd (diff)
* 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
Diffstat (limited to 'ext/socket')
-rw-r--r--ext/socket/extconf.rb43
1 files changed, 22 insertions, 21 deletions
diff --git a/ext/socket/extconf.rb b/ext/socket/extconf.rb
index 052e479917..d4e998b19a 100644
--- a/ext/socket/extconf.rb
+++ b/ext/socket/extconf.rb
@@ -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")