summaryrefslogtreecommitdiff
path: root/ext/socket/extconf.rb
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-05-12 02:40:09 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-05-12 02:40:09 +0000
commit851a023843ac4db27c3fb4dc2c4e1a523e0d3831 (patch)
tree08a6088cd264e4386227c0c3b3d1b3136f40c9be /ext/socket/extconf.rb
parent07b314f07b0fa45838474b4f8c7ef32c746c6536 (diff)
* ext/socket/extconf.rb: test all IPPROTO_* constants for recent Win32
SDK. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27746 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/socket/extconf.rb')
-rw-r--r--ext/socket/extconf.rb13
1 files changed, 6 insertions, 7 deletions
diff --git a/ext/socket/extconf.rb b/ext/socket/extconf.rb
index 9125ec1..71deaa2 100644
--- a/ext/socket/extconf.rb
+++ b/ext/socket/extconf.rb
@@ -110,12 +110,11 @@ end
have_header("netinet/tcp.h") if /cygwin/ !~ RUBY_PLATFORM # for cygwin 1.1.5
have_header("netinet/udp.h")
-%w[
- IPPROTO_IP
- IPPROTO_IPV6
-].each {|name|
- have_const(name, headers)
-}
+if !have_macro("IPPROTO_IPV6", headers) && have_const("IPPROTO_IPV6", headers)
+ IO.read(File.join(File.dirname(__FILE__), "mkconstants.rb")).sub(/\A.*^__END__$/m, '').split(/\r?\n/).grep(/\AIPPROTO_\w*/){$&}.each {|name|
+ have_const(name, headers) unless $defs.include?("-DHAVE_CONST_#{name.upcase}")
+ }
+end
if (have_func("sendmsg") | have_func("recvmsg")) && /64-darwin/ !~ RUBY_PLATFORM
# CMSG_ macros are broken on 64bit darwin, because of use of __DARWIN_ALIGN.
@@ -342,7 +341,7 @@ have_header("ucred.h", headers)
have_func("getpeerucred")
# workaround for recent Windows SDK
-$defs << "-DIPPROTO_IPV6=IPPROTO_IPV6" if have_const("IPPROTO_IPV6") && !have_macro("IPPROTO_IPV6")
+$defs << "-DIPPROTO_IPV6=IPPROTO_IPV6" if $defs.include?("-DHAVE_CONST_IPPROTO_IPV6") && !have_macro("IPPROTO_IPV6")
$distcleanfiles << "constants.h" << "constdefs.*"