Method: MakeMakefile#try_const
- Defined in:
- lib/mkmf.rb
#try_const(const, headers = nil, opt = "", &b) ⇒ Object
Returns whether or not the constant const is defined.
See also have_const
1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 |
# File 'lib/mkmf.rb', line 1287 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 |