summaryrefslogtreecommitdiff
path: root/ext/socket/mkconstants.rb
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-05-11 14:10:34 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-05-11 14:10:34 +0000
commit01cd3467fbd3e9ea212063d0a7405642b8746b94 (patch)
tree4b5e03ee9f2429e1573f1dda29b136461e0a4671 /ext/socket/mkconstants.rb
parent709bff4f2b7564c34754feb5f33440a72f802fca (diff)
* ext/socket/extconf.rb: test IPPROTO_IP and IPPROTO_IPV6 constants.
* ext/socket/mkconstants.rb: define macros for enum. [ruby-dev:38849] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27742 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/socket/mkconstants.rb')
-rw-r--r--ext/socket/mkconstants.rb12
1 files changed, 8 insertions, 4 deletions
diff --git a/ext/socket/mkconstants.rb b/ext/socket/mkconstants.rb
index c796cb4870..fe00f30e3d 100644
--- a/ext/socket/mkconstants.rb
+++ b/ext/socket/mkconstants.rb
@@ -73,11 +73,15 @@ end
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