Method: MakeMakefile#try_compile
- Defined in:
- lib/mkmf.rb
#try_compile(src, opt = "", *opts, &b) ⇒ Object
Returns whether or not the src can be compiled as a C source. opt is passed to the C compiler as options. Note that $CFLAGS is also passed to the compiler.
If a block given, it is called with the source before compilation. You can modify the source in the block.
src-
a String which contains a C source
opt-
a String which contains compiler options
570 571 572 573 574 575 |
# File 'lib/mkmf.rb', line 570 def try_compile(src, opt="", *opts, &b) with_werror(opt, *opts) {|_opt, *| try_do(src, cc_command(_opt), *opts, &b)} and File.file?("#{CONFTEST}.#{$OBJEXT}") ensure MakeMakefile.rm_f "#{CONFTEST}*" end |