1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* ext/socket/extconf.rb: test functions just after struct members.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39211 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2013-02-12 20:51:19 +00:00
parent caa0e40f4d
commit d7923c8279
2 changed files with 142 additions and 133 deletions

View file

@ -1,3 +1,7 @@
Wed Feb 13 05:49:21 2013 Tanaka Akira <akr@fsij.org>
* ext/socket/extconf.rb: test functions just after struct members.
Tue Feb 12 12:02:35 2013 NARUSE, Yui <naruse@ruby-lang.org>
* ext/json: merge JSON 1.7.7.

View file

@ -96,6 +96,53 @@ end
have_struct_member('struct msghdr', 'msg_control', ['sys/types.h', 'sys/socket.h'])
have_struct_member('struct msghdr', 'msg_accrights', ['sys/types.h', 'sys/socket.h'])
if have_func(test_func)
have_func("sendmsg")
have_func("recvmsg")
have_func("freehostent")
have_func("freeaddrinfo")
if /haiku/ !~ RUBY_PLATFORM and have_func("gai_strerror")
if checking_for("gai_strerror() returns const pointer") {!try_compile(<<EOF)}
#{cpp_include(headers)}
#include <stdlib.h>
void
conftest_gai_strerror_is_const()
{
*gai_strerror(0) = 0;
}
EOF
$defs << "-DGAI_STRERROR_CONST"
end
end
have_func("accept4")
have_func('inet_ntop(0, (const void *)0, (char *)0, 0)') or
have_func("inet_ntoa(*(struct in_addr *)NULL)")
have_func('inet_pton(0, "", (void *)0)') or have_func('inet_aton("", (struct in_addr *)0)')
have_func('getservbyport(0, "")')
have_func("getifaddrs")
have_func("getpeereid")
have_func("getpeerucred")
have_func("if_indextoname")
have_func("hsterror")
have_func("getipnodebyname")
have_func("gethostbyname2")
if !have_func("socketpair(0, 0, 0, 0)") and have_func("rb_w32_socketpair(0, 0, 0, 0)")
$defs << "-Dsocketpair(a,b,c,d)=rb_w32_socketpair((a),(b),(c),(d))"
$defs << "-DHAVE_SOCKETPAIR"
end
unless have_func("gethostname((char *)0, 0)")
have_func("uname")
end
ipv6 = false
default_ipv6 = /cygwin|beos|haiku/ !~ RUBY_PLATFORM
if enable_config("ipv6", default_ipv6)
@ -161,9 +208,6 @@ if !have_macro("IPPROTO_IPV6", headers) && have_const("IPPROTO_IPV6", headers)
}
end
have_func("sendmsg")
have_func("recvmsg")
if checking_for("recvmsg() with MSG_PEEK allocate file descriptors") {try_run(cpp_include(headers) + <<'EOF')}
#include <stdlib.h>
#include <stdio.h>
@ -420,24 +464,6 @@ Fatal: invalid value for --with-lookup-order-hack (expected INET, INET6 or UNSPE
EOS
end
have_func("freehostent")
have_func("freeaddrinfo")
if /haiku/ !~ RUBY_PLATFORM and have_func("gai_strerror")
if checking_for("gai_strerror() returns const pointer") {!try_compile(<<EOF)}
#{cpp_include(headers)}
#include <stdlib.h>
void
conftest_gai_strerror_is_const()
{
*gai_strerror(0) = 0;
}
EOF
$defs << "-DGAI_STRERROR_CONST"
end
end
have_func("accept4")
$objs = [
"init.#{$OBJEXT}",
"constants.#{$OBJEXT}",
@ -469,33 +495,11 @@ if getaddr_info_ok == :wide or
$defs << "-DGETADDRINFO_EMU"
end
have_func('inet_ntop(0, (const void *)0, (char *)0, 0)') or
have_func("inet_ntoa(*(struct in_addr *)NULL)")
have_func('inet_pton(0, "", (void *)0)') or have_func('inet_aton("", (struct in_addr *)0)')
have_func('getservbyport(0, "")')
have_func("getifaddrs")
have_func("getpeereid")
have_func("getpeerucred")
have_func("if_indextoname")
# workaround for recent Windows SDK
$defs << "-DIPPROTO_IPV6=IPPROTO_IPV6" if $defs.include?("-DHAVE_CONST_IPPROTO_IPV6") && !have_macro("IPPROTO_IPV6")
$distcleanfiles << "constants.h" << "constdefs.*"
if have_func(test_func)
have_func("hsterror")
have_func("getipnodebyname") or have_func("gethostbyname2")
if !have_func("socketpair(0, 0, 0, 0)") and have_func("rb_w32_socketpair(0, 0, 0, 0)")
$defs << "-Dsocketpair(a,b,c,d)=rb_w32_socketpair((a),(b),(c),(d))"
$defs << "-DHAVE_SOCKETPAIR"
end
unless have_func("gethostname((char *)0, 0)")
have_func("uname")
end
if enable_config("socks", ENV["SOCKS_SERVER"])
if have_library("socks5", "SOCKSinit")
$defs << "-DSOCKS5" << "-DSOCKS"
@ -503,6 +507,7 @@ if have_func(test_func)
$defs << "-DSOCKS"
end
end
hdr = "netinet6/in6.h"
if /darwin/ =~ RUBY_PLATFORM and !try_compile(<<"SRC", nil, :werror=>true)
#include <netinet/in.h>