2010-06-07 13:52:07 +03:00
|
|
|
require 'rbconfig'
|
|
|
|
|
|
|
|
def x86_64_from_build_cpu
|
|
|
|
RbConfig::MAKEFILE_CONFIG['build_cpu'] == 'x86_64'
|
|
|
|
end
|
|
|
|
|
|
|
|
def x86_64_from_byte_length
|
|
|
|
['foo'].pack('p').size == 8
|
|
|
|
end
|
|
|
|
|
|
|
|
def x86_64_from_arch_flag
|
|
|
|
RbConfig::MAKEFILE_CONFIG['ARCH_FLAG'] =~ /x86_64/
|
|
|
|
end
|
|
|
|
|
|
|
|
def rubinius?
|
|
|
|
Object.const_defined?(:RUBY_ENGINE) && RUBY_ENGINE == "rbx"
|
|
|
|
end
|
|
|
|
|
|
|
|
def x64?
|
2010-06-16 18:17:22 +03:00
|
|
|
if rubinius?
|
|
|
|
x86_64_from_build_cpu || x86_64_from_arch_flag
|
2010-06-07 13:52:07 +03:00
|
|
|
else
|
2010-06-16 18:17:22 +03:00
|
|
|
x86_64_from_byte_length
|
2010-06-07 13:52:07 +03:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
puts x64? ? "x64" : "ia32"
|