[前][次][番号順一覧][スレッド一覧]

ruby-changes:69567

From: Yusuke <ko1@a...>
Date: Tue, 2 Nov 2021 23:43:34 +0900 (JST)
Subject: [ruby-changes:69567] 8413749ec0 (master): ext/socket/extconf.rb: Fix the chech if if_indextoname is available

https://git.ruby-lang.org/ruby.git/commit/?id=8413749ec0

From 8413749ec0edb07eede8a936d5473431a1a40966 Mon Sep 17 00:00:00 2001
From: Yusuke Endoh <mame@r...>
Date: Tue, 2 Nov 2021 23:41:01 +0900
Subject: ext/socket/extconf.rb: Fix the chech if if_indextoname is available

The check had not work because "headers" were not passed.
---
 ext/socket/extconf.rb | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/ext/socket/extconf.rb b/ext/socket/extconf.rb
index c86cc8f8c03..b70a8624149 100644
--- a/ext/socket/extconf.rb
+++ b/ext/socket/extconf.rb
@@ -484,6 +484,9 @@ EOF https://github.com/ruby/ruby/blob/trunk/ext/socket/extconf.rb#L484
   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 https://github.com/ruby/ruby/blob/trunk/ext/socket/extconf.rb#L495
     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)
-- 
cgit v1.2.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]