ruby-changes:26895
From: nobu <ko1@a...>
Date: Sat, 26 Jan 2013 11:31:53 +0900 (JST)
Subject: [ruby-changes:26895] nobu:r38946 (trunk): extconf.rb: fix warnings
nobu 2013-01-26 11:31:40 +0900 (Sat, 26 Jan 2013) New Revision: 38946 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=38946 Log: extconf.rb: fix warnings * ext/socket/extconf.rb: fix warnings from IN6_IS_ADDR_ macros in apple's netinet6/in6.rb. Modified files: trunk/ext/socket/extconf.rb Index: ext/socket/extconf.rb =================================================================== --- ext/socket/extconf.rb (revision 38945) +++ ext/socket/extconf.rb (revision 38946) @@ -497,5 +497,29 @@ if have_func(test_func) https://github.com/ruby/ruby/blob/trunk/ext/socket/extconf.rb#L497 $defs << "-DSOCKS" end end + hdr = "netinet6/in6.h" + if /darwin/ =~ RUBY_PLATFORM and !try_compile(<<"SRC", nil, :werror=>true) +#include <netinet/in.h> +int t(struct in6_addr *addr) {return IN6_IS_ADDR_UNSPECIFIED(addr);} +SRC + print "fixing apple's netinet6/in6.rb ..."; $stdout.flush + in6 = File.read("/usr/include/#{hdr}") + if in6.gsub!(/\*\(const\s+__uint32_t\s+\*\)\(const\s+void\s+\*\)\(&(\(\w+\))->s6_addr\[(\d+)\]\)/) do + i, r = $2.to_i.divmod(4) + if r.zero? + "#$1->__u6_addr.__u6_addr32[#{i}]" + else + $& + end + end + FileUtils.mkdir_p(File.dirname(hdr)) + open(hdr, "w") {|f| f.write(in6)} + $distcleanfiles << hdr + $distcleandirs << File.dirname(hdr) + puts "done" + else + puts "not needed" + end + end create_makefile("socket") end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/