summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-11-17 20:20:44 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-11-17 20:20:44 +0000
commit2696f3fdc32c279560dc886a6bd05208a06d9ccf (patch)
treec12cae538f5b74b688e3681caa66b8c487bcb922 /lib
parentddba4cc5de23c52e04eeb36c65efc6aeba69fe0d (diff)
downloadruby-2696f3fdc32c279560dc886a6bd05208a06d9ccf.tar.gz
ruby-2696f3fdc32c279560dc886a6bd05208a06d9ccf.tar.xz
ruby-2696f3fdc32c279560dc886a6bd05208a06d9ccf.zip
* lib/mkmf.rb (have_struct_member): define HAVE_type_member.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@13953 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r--lib/mkmf.rb11
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/mkmf.rb b/lib/mkmf.rb
index 6d1aa3592..b1281e322 100644
--- a/lib/mkmf.rb
+++ b/lib/mkmf.rb
@@ -766,10 +766,12 @@ end
# (in addition to the common header files).
#
# If found, a macro is passed as a preprocessor constant to the compiler using
-# the member name, in uppercase, prepended with 'HAVE_ST_'.
+# the type name and the member name, in uppercase, prepended with 'HAVE_'.
#
-# For example, if have_struct_member('foo', 'bar') returned true, then the
-# HAVE_ST_BAR preprocessor macro would be passed to the compiler.
+# For example, if have_struct_member('struct foo', 'bar') returned true, then the
+# HAVE_STRUCT_FOO_BAR preprocessor macro would be passed to the compiler.
+#
+# HAVE_ST_BAR is also defined for backward compatibility.
#
def have_struct_member(type, member, headers = nil, &b)
checking_for checking_message("#{type}.#{member}", headers) do
@@ -780,7 +782,8 @@ def have_struct_member(type, member, headers = nil, &b)
int main() { return 0; }
int s = (char *)&((#{type}*)0)->#{member} - (char *)0;
SRC
- $defs.push(format("-DHAVE_ST_%s", member.upcase))
+ $defs.push(format("-DHAVE_%s_%s", type.strip.upcase.tr_s("^A-Z0-9_", "_"), member.upcase))
+ $defs.push(format("-DHAVE_ST_%s", member.upcase)) # backward compatibility
true
else
false