mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
socket/extconf.rb: reduce duplicated code
* ext/socket/extconf.rb: reduce duplicated code. set fallback value first, then check OS-provided functions. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49539 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
d9bc7904fa
commit
32c19cdc39
1 changed files with 5 additions and 19 deletions
|
@ -565,29 +565,15 @@ EOS
|
|||
case enable_config("wide-getaddrinfo")
|
||||
when true
|
||||
getaddr_info_ok = :wide
|
||||
when nil
|
||||
when nil, false
|
||||
getaddr_info_ok = (:wide if getaddr_info_ok.nil?)
|
||||
if have_func("getnameinfo", headers) and have_func("getaddrinfo", headers)
|
||||
getaddr_info_ok = :os
|
||||
if !CROSS_COMPILING &&
|
||||
!checking_for("system getaddrinfo working") {
|
||||
if CROSS_COMPILING ||
|
||||
checking_for("system getaddrinfo working") {
|
||||
try_run(cpp_include(headers) + GETADDRINFO_GETNAMEINFO_TEST)
|
||||
}
|
||||
getaddr_info_ok = :wide
|
||||
getaddr_info_ok = :os
|
||||
end
|
||||
else
|
||||
getaddr_info_ok = :wide
|
||||
end
|
||||
when false
|
||||
if have_func("getnameinfo", headers) and have_func("getaddrinfo", headers)
|
||||
getaddr_info_ok = :os
|
||||
if !CROSS_COMPILING &&
|
||||
!checking_for("system getaddrinfo working") {
|
||||
try_run(cpp_include(headers) + GETADDRINFO_GETNAMEINFO_TEST)
|
||||
}
|
||||
getaddr_info_ok = nil
|
||||
end
|
||||
else
|
||||
getaddr_info_ok = nil
|
||||
end
|
||||
else
|
||||
raise "unexpected enable_config() value"
|
||||
|
|
Loading…
Reference in a new issue