summaryrefslogtreecommitdiff
path: root/ext/socket/extconf.rb
diff options
context:
space:
mode:
authorYusuke Endoh <mame@ruby-lang.org>2021-11-02 23:41:01 +0900
committerYusuke Endoh <mame@ruby-lang.org>2021-11-02 23:41:01 +0900
commit8413749ec0edb07eede8a936d5473431a1a40966 (patch)
tree9f8651ed02e93d0f07b4efe767d10e2c99dee5c4 /ext/socket/extconf.rb
parente0915ba67964d843832148aeca29a1f8244ca7b1 (diff)
ext/socket/extconf.rb: Fix the chech if if_indextoname is available
The check had not work because "headers" were not passed.
Diffstat (limited to 'ext/socket/extconf.rb')
-rw-r--r--ext/socket/extconf.rb7
1 files changed, 5 insertions, 2 deletions
diff --git a/ext/socket/extconf.rb b/ext/socket/extconf.rb
index c86cc8f8c0..b70a862414 100644
--- a/ext/socket/extconf.rb
+++ b/ext/socket/extconf.rb
@@ -484,6 +484,9 @@ EOF
have_func("getpeerucred(0, (ucred_t **)NULL)", headers) # SunOS
have_func_decl = proc do |name, headers|
+ # check if there is a declaration of <name> by trying to declare
+ # both "int <name>(void)" and "void <name>(void)"
+ # (at least one attempt should fail if there is a declaration)
if !checking_for("declaration of #{name}()") {!%w[int void].all? {|ret| try_compile(<<EOF)}}
#{cpp_include(headers)}
#{ret} #{name}(void);
@@ -492,10 +495,10 @@ EOF
end
end
if have_func('if_indextoname(0, "")', headers)
- have_func_decl["if_indextoname"]
+ have_func_decl["if_indextoname", headers]
end
if have_func('if_nametoindex("")', headers)
- have_func_decl["if_nametoindex"]
+ have_func_decl["if_nametoindex", headers]
end
have_func("hsterror", headers)