diff options
Diffstat (limited to 'ext/socket')
-rw-r--r-- | ext/socket/extconf.rb | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/ext/socket/extconf.rb b/ext/socket/extconf.rb index 37ff216560..4ca0983c68 100644 --- a/ext/socket/extconf.rb +++ b/ext/socket/extconf.rb @@ -347,10 +347,22 @@ have_type("struct sockaddr_storage", headers) have_type("struct addrinfo", headers) -if have_type("socklen_t", headers) - if try_static_assert("sizeof(socklen_t) >= sizeof(long)", headers) - $defs << "-DRSTRING_SOCKLEN=(socklen_t)RSTRING_LEN" +def check_socklen(headers) + def (fmt = "none").%(x) + x || self + end + s = checking_for("RSTRING_SOCKLEN", fmt) do + if try_static_assert("sizeof(socklen_t) >= sizeof(long)", headers) + "RSTRING_LEN" + else + "RSTRING_LENINT" + end end + $defs << "-DRSTRING_SOCKLEN=(socklen_t)"+s +end + +if have_type("socklen_t", headers) + check_socklen(headers) end have_type("struct in_pktinfo", headers) {|src| |