1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* lib/mkmf.rb (have_struct_member): define HAVE_type_member.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13953 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2007-11-17 20:20:44 +00:00
parent 24dcd39f19
commit aa7ce1ece1
2 changed files with 11 additions and 4 deletions

View file

@ -1,3 +1,7 @@
Sun Nov 18 05:19:46 2007 Tanaka Akira <akr@fsij.org>
* lib/mkmf.rb (have_struct_member): define HAVE_type_member.
Sat Nov 17 23:51:29 2007 Masaki Suketa <masaki.suketa@nifty.ne.jp>
* ext/win32ole/win32ole.c (ole_invoke): bug fix. [ruby-talk:279100]

View file

@ -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