summaryrefslogtreecommitdiff
path: root/ext/socket/extconf.rb
diff options
context:
space:
mode:
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)