зеркало из https://github.com/github/ruby.git
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:
Родитель
d9bc7904fa
Коммит
32c19cdc39
|
@ -565,29 +565,15 @@ EOS
|
||||||
case enable_config("wide-getaddrinfo")
|
case enable_config("wide-getaddrinfo")
|
||||||
when true
|
when true
|
||||||
getaddr_info_ok = :wide
|
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)
|
if have_func("getnameinfo", headers) and have_func("getaddrinfo", headers)
|
||||||
getaddr_info_ok = :os
|
if CROSS_COMPILING ||
|
||||||
if !CROSS_COMPILING &&
|
checking_for("system getaddrinfo working") {
|
||||||
!checking_for("system getaddrinfo working") {
|
|
||||||
try_run(cpp_include(headers) + GETADDRINFO_GETNAMEINFO_TEST)
|
try_run(cpp_include(headers) + GETADDRINFO_GETNAMEINFO_TEST)
|
||||||
}
|
}
|
||||||
getaddr_info_ok = :wide
|
getaddr_info_ok = :os
|
||||||
end
|
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
|
end
|
||||||
else
|
else
|
||||||
raise "unexpected enable_config() value"
|
raise "unexpected enable_config() value"
|
||||||
|
|
Загрузка…
Ссылка в новой задаче