ruby-changes:15894
From: yugui <ko1@a...>
Date: Sun, 16 May 2010 21:16:59 +0900 (JST)
Subject: [ruby-changes:15894] Ruby:r27834 (ruby_1_9_2): merges r27742 and r27746 from trunk into ruby_1_9_2.
yugui 2010-05-16 21:15:27 +0900 (Sun, 16 May 2010) New Revision: 27834 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=27834 Log: merges r27742 and r27746 from trunk into ruby_1_9_2. -- * ext/socket/extconf.rb: test IPPROTO_IP and IPPROTO_IPV6 constants. * ext/socket/mkconstants.rb: define macros for enum. [ruby-dev:38849] -- * ext/socket/extconf.rb: test all IPPROTO_* constants for recent Win32 SDK. Modified files: branches/ruby_1_9_2/ChangeLog branches/ruby_1_9_2/ext/socket/extconf.rb branches/ruby_1_9_2/ext/socket/mkconstants.rb Index: ruby_1_9_2/ChangeLog =================================================================== --- ruby_1_9_2/ChangeLog (revision 27833) +++ ruby_1_9_2/ChangeLog (revision 27834) @@ -1,3 +1,16 @@ +Wed May 12 11:39:10 2010 NAKAMURA Usaku <usa@r...> + + * ext/socket/extconf.rb: test all IPPROTO_* constants for recent Win32 + SDK. + +Tue May 11 23:07:22 2010 Tanaka Akira <akr@f...> + + * ext/socket/extconf.rb: test IPPROTO_IP and IPPROTO_IPV6 constants. + + * ext/socket/mkconstants.rb: define macros for enum. + + [ruby-dev:38849] + Wed May 12 09:21:05 2010 NARUSE, Yui <naruse@r...> * re.c (rb_reg_initialize_m): fix wrong index for the lang Index: ruby_1_9_2/ext/socket/mkconstants.rb =================================================================== --- ruby_1_9_2/ext/socket/mkconstants.rb (revision 27833) +++ ruby_1_9_2/ext/socket/mkconstants.rb (revision 27834) @@ -73,11 +73,15 @@ ERB.new(<<'EOS', nil, '%').def_method(Object, "gen_const_decls") % each_const {|guard, make_value, name, default_value| -% if default_value -#ifndef <%=name%> -# define <%=name%> <%=default_value%> +#if !defined(<%=name%>) +# if defined(HAVE_CONST_<%=name.upcase%>) +# define <%=name%> <%=name%> +%if default_value +# else +# define <%=name%> <%=default_value%> +%end +# endif #endif -% end % } EOS Index: ruby_1_9_2/ext/socket/extconf.rb =================================================================== --- ruby_1_9_2/ext/socket/extconf.rb (revision 27833) +++ ruby_1_9_2/ext/socket/extconf.rb (revision 27834) @@ -110,6 +110,12 @@ have_header("netinet/tcp.h") if /cygwin/ !~ RUBY_PLATFORM # for cygwin 1.1.5 have_header("netinet/udp.h") +if !have_macro("IPPROTO_IPV6", headers) && have_const("IPPROTO_IPV6", headers) + IO.read(File.join(File.dirname(__FILE__), "mkconstants.rb")).sub(/\A.*^__END__$/m, '').split(/\r?\n/).grep(/\AIPPROTO_\w*/){$&}.each {|name| + have_const(name, headers) unless $defs.include?("-DHAVE_CONST_#{name.upcase}") + } +end + if (have_func("sendmsg") | have_func("recvmsg")) && /64-darwin/ !~ RUBY_PLATFORM # CMSG_ macros are broken on 64bit darwin, because of use of __DARWIN_ALIGN. have_struct_member('struct msghdr', 'msg_control', ['sys/types.h', 'sys/socket.h']) @@ -335,7 +341,7 @@ have_func("getpeerucred") # workaround for recent Windows SDK -$defs << "-DIPPROTO_IPV6=IPPROTO_IPV6" if have_const("IPPROTO_IPV6") && !have_macro("IPPROTO_IPV6") +$defs << "-DIPPROTO_IPV6=IPPROTO_IPV6" if $defs.include?("-DHAVE_CONST_IPPROTO_IPV6") && !have_macro("IPPROTO_IPV6") $distcleanfiles << "constants.h" << "constdefs.*" -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/