summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--ext/socket/extconf.rb43
2 files changed, 26 insertions, 21 deletions
diff --git a/ChangeLog b/ChangeLog
index 670ff12..ee7f337 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
diff --git a/ext/socket/extconf.rb b/ext/socket/extconf.rb
index 052e479..d4e998b 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")