summaryrefslogtreecommitdiff
path: root/ext/socket/extconf.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-05-14 14:24:42 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-05-14 14:24:42 +0000
commit5ec5c6d52c69517d97cddd5daeb0b5c9af80ff81 (patch)
tree55bceed1296f72beaaa023ce046e4c08d5cc44c0 /ext/socket/extconf.rb
parentb6decf289fb90e579733ed29571f0870c7a7c169 (diff)
socket: fix build error and warnings on mingw
* ext/socket/extconf.rb: check for if_nametoindex() for i686-w64-mingw32, and check for declarations of if_indextoname() and if_nametoindex(). * ext/socket/ifaddr.c (ifaddr_ifindex): not-implement unless if_nametoindex() is available. * ext/socket/rubysocket.h: declare if_indextoname() and if_nametoindex() if available but not declared. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40738 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/socket/extconf.rb')
-rw-r--r--ext/socket/extconf.rb15
1 files changed, 14 insertions, 1 deletions
diff --git a/ext/socket/extconf.rb b/ext/socket/extconf.rb
index 88e7366..458871f 100644
--- a/ext/socket/extconf.rb
+++ b/ext/socket/extconf.rb
@@ -421,7 +421,20 @@ EOF
have_func("getpeerucred(0, (ucred_t **)NULL)", headers) # SunOS
- have_func('if_indextoname(0, "")', headers)
+ have_func_decl = proc do |name, headers|
+ if !checking_for("declaration of #{name}()") {!%w[int void].all? {|ret| try_compile(<<EOF)}}
+#{cpp_include(headers)}
+#{ret} #{name}(void);
+EOF
+ $defs << "-DNEED_#{name.tr_cpp}_DECL"
+ end
+ end
+ if have_func('if_indextoname(0, "")', headers)
+ have_func_decl["if_indextoname"]
+ end
+ if have_func('if_nametoindex("")', headers)
+ have_func_decl["if_nametoindex"]
+ end
have_func("hsterror", headers)
have_func('getipnodebyname("", 0, 0, (int *)0)', headers) # RFC 2553