End of Life Ruby 3.1 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
MakeMakefile#try_const
try_const(const, headers = nil, opt = "", &b)
lib/mkmf.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.1.3/lib/mkmf.rb, line 1319
def try_const(const, headers = nil, opt = "", &b)
const, type = *const
if try_compile(<<"SRC", opt, &b)
#{cpp_include(headers)}
/*top*/
typedef #{type || 'int'} conftest_type;
conftest_type conftestval = #{type ? '' : '(int)'}#{const};
SRC
$defs.push(format("-DHAVE_CONST_%s", const.tr_cpp))
true
else
false
end
end
Returns whether or not the constant const is defined.
See also have_const