summaryrefslogtreecommitdiff
path: root/ext/socket/mkconstants.rb
diff options
context:
space:
mode:
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