* ext/socket/extconf.rb: Use a block of enable_config() for

--{enable,disable}-close-fds-by-recvmsg-with-peek configure option



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40479 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2013-04-26 09:42:14 +00:00
Родитель 847fe27e31
Коммит 56e982d447
2 изменённых файлов: 55 добавлений и 46 удалений

Просмотреть файл

@ -1,3 +1,8 @@
Fri Apr 26 18:41:04 2013 Tanaka Akira <akr@fsij.org>
* ext/socket/extconf.rb: Use a block of enable_config() for
--{enable,disable}-close-fds-by-recvmsg-with-peek configure option
Fri Apr 26 18:08:08 2013 Tanaka Akira <akr@fsij.org> Fri Apr 26 18:08:08 2013 Tanaka Akira <akr@fsij.org>
* dir.c (dir_set_pos): Fix a compilation error when seekdir() is not * dir.c (dir_set_pos): Fix a compilation error when seekdir() is not

Просмотреть файл

@ -427,12 +427,7 @@ EOS
} }
end end
case enable_config("close-fds-by-recvmsg-with-peek") if enable_config("close-fds-by-recvmsg-with-peek") {
when true
$defs << "-DFD_PASSING_WORK_WITH_RECVMSG_MSG_PEEK"
when false
# nothing to do.
else
if have_msg_control && have_recvmsg && if have_msg_control && have_recvmsg &&
have_const('AF_UNIX', headers) && have_const('SCM_RIGHTS', headers) have_const('AF_UNIX', headers) && have_const('SCM_RIGHTS', headers)
case RUBY_PLATFORM case RUBY_PLATFORM
@ -449,38 +444,41 @@ EOS
close_fds = nil close_fds = nil
end end
if !CROSS_COMPILING if !CROSS_COMPILING
if checking_for("recvmsg() with MSG_PEEK allocate file descriptors") {try_run(cpp_include(headers) + RECVMSG_WITH_MSG_PEEK_ALLOCATE_FD_TEST)} if checking_for("recvmsg() with MSG_PEEK allocate file descriptors") {
try_run(cpp_include(headers) + RECVMSG_WITH_MSG_PEEK_ALLOCATE_FD_TEST)
}
if close_fds == false if close_fds == false
warn "unexpected recvmsg() with MSG_PEEK behavor on #{RUBY_PLATFORM}: fd allocation unexpected." warn "unexpected fd-passing recvmsg() with MSG_PEEK behavor on #{RUBY_PLATFORM}: fd allocation unexpected."
elsif close_fds == nil elsif close_fds == nil
puts "info: #{RUBY_PLATFORM} recvmsg() with MSG_PEEK allocates fds." puts "info: #{RUBY_PLATFORM} recvmsg() with MSG_PEEK allocates fds on fd-passing."
end end
close_fds = true close_fds = true
else else
if close_fds == true if close_fds == true
warn "unexpected recvmsg() with MSG_PEEK behavor on #{RUBY_PLATFORM}: fd allocation expected." warn "unexpected fd-passing recvmsg() with MSG_PEEK behavor on #{RUBY_PLATFORM}: fd allocation expected."
elsif close_fds == nil elsif close_fds == nil
puts "info: #{RUBY_PLATFORM}: recvmsg() with MSG_PEEK doesn't allocates fds." puts "info: #{RUBY_PLATFORM}: recvmsg() with MSG_PEEK doesn't allocates fds on fd-passing."
end end
close_fds = false close_fds = false
end end
end end
if close_fds == nil if close_fds == nil
abort <<EOS abort <<EOS
Fatal: cannot test recvmsg() with MSG_PEEK allocate file descriptors or not Fatal: cannot test fd-passing recvmsg() with MSG_PEEK behavor
because cross-compilation. because cross-compilation for #{RUBY_PLATFORM}.
Specify a configure option.
If recvmsg() with MSG_PEEK allocates fds on fd passing: If recvmsg() with MSG_PEEK allocates fds on fd passing:
--enable-close-fds-by-recvmsg-with-peek --enable-close-fds-by-recvmsg-with-peek
If recvmsg() with MSG_PEEK doesn't allocate fds on fd passing: If recvmsg() with MSG_PEEK doesn't allocate fds on fd passing:
--disable-close-fds-by-recvmsg-with-peek --disable-close-fds-by-recvmsg-with-peek
EOS EOS
end end
if close_fds close_fds
else
false
end
}
$defs << "-DFD_PASSING_WORK_WITH_RECVMSG_MSG_PEEK" $defs << "-DFD_PASSING_WORK_WITH_RECVMSG_MSG_PEEK"
end end
end
end
case enable_config("wide-getaddrinfo") case enable_config("wide-getaddrinfo")
when true when true
@ -488,7 +486,10 @@ EOS
when nil when 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 getaddr_info_ok = :os
if !CROSS_COMPILING && !checking_for("system getaddrinfo working") {try_run(cpp_include(headers) + GETADDRINFO_GETNAMEINFO_TEST)} if !CROSS_COMPILING &&
!checking_for("system getaddrinfo working") {
try_run(cpp_include(headers) + GETADDRINFO_GETNAMEINFO_TEST)
}
getaddr_info_ok = :wide getaddr_info_ok = :wide
end end
else else
@ -497,7 +498,10 @@ EOS
when false when false
if have_func("getnameinfo", headers) and have_func("getaddrinfo", headers) if have_func("getnameinfo", headers) and have_func("getaddrinfo", headers)
getaddr_info_ok = :os getaddr_info_ok = :os
if !CROSS_COMPILING && !checking_for("system getaddrinfo working") {try_run(cpp_include(headers) + GETADDRINFO_GETNAMEINFO_TEST)} if !CROSS_COMPILING &&
!checking_for("system getaddrinfo working") {
try_run(cpp_include(headers) + GETADDRINFO_GETNAMEINFO_TEST)
}
getaddr_info_ok = nil getaddr_info_ok = nil
end end
else else