summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
Diffstat (limited to 'ext')
-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 20df7b598d0..23993f99fa1 100644
--- a/ext/socket/mkconstants.rb
+++ b/ext/socket/mkconstants.rb
@@ -197,13 +197,17 @@ init_constants(VALUE mConst)
% if guard
#if <%=guard%>
% end
-#if defined(<%=name%>)
- <%=define%>(<%=c_str name%>, <%=name%>);
% if default_value
-#else
- <%=define%>(<%=c_str name%>, <%=default_value%>);
+#ifndef <%=name%>
+#define <%=name%> <%=default_value%>
+#endif
+% else
+#if defined(<%=name%>)
% end
+ <%=define%>(<%=c_str name%>, <%=name%>);
+% unless default_value
#endif
+% end
% if guard
#endif
% end