From 8275198354c9bd6908eb7cc2135e30745842da2f Mon Sep 17 00:00:00 2001 From: nobu Date: Thu, 19 Mar 2009 09:49:51 +0000 Subject: * configure.in (RUBY_CHECK_SIZEOF): allows qualified name. * configure.in (RUBY_REPLACE_TYPE): checks more strictly. * configure.in (struct stat.st_size, struct stat.st_blocks), (struct stat.st_ino): check for size. * lib/mkmf.rb (check_sizeof): allows qualified name. * file.c (rb_stat_ino, rb_stat_blocks): check by size. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@23005 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/mkmf.rb | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) (limited to 'lib') diff --git a/lib/mkmf.rb b/lib/mkmf.rb index cfc5453ac..f27f286d0 100644 --- a/lib/mkmf.rb +++ b/lib/mkmf.rb @@ -65,6 +65,7 @@ $os2 = /os2/ =~ RUBY_PLATFORM $beos = /beos/ =~ RUBY_PLATFORM $haiku = /haiku/ =~ RUBY_PLATFORM $solaris = /solaris/ =~ RUBY_PLATFORM +$universal = /universal/ =~ RUBY_PLATFORM $dest_prefix_pattern = (File::PATH_SEPARATOR == ';' ? /\A([[:alpha:]]:)?/ : /\A/) # :stopdoc: @@ -440,7 +441,7 @@ end def cpp_include(header) if header header = [header] unless header.kind_of? Array - header.map {|h| "#include <#{h}>\n"}.join + header.map {|h| String === h ? "#include <#{h}>\n" : h}.join else "" end @@ -977,14 +978,23 @@ end # SIZEOF_MYSTRUCT=12 preprocessor macro would be passed to the compiler. # def check_sizeof(type, headers = nil, &b) - expr = "sizeof(#{type})" - fmt = "%d" + typename, member = type.split('.', 2) + prelude = cpp_include(headers).split(/$/) + prelude << "typedef #{typename} rbcv_typedef_;\n" + prelude << "static rbcv_typedef_ *rbcv_ptr_;\n" + prelude = [prelude] + expr = "sizeof((*rbcv_ptr_)#{"."<