Top Level Namespace

Defined Under Namespace

Modules: SmarterJSON

Instance Method Summary collapse

Instance Method Details

#compiler_accepts?(flag) ⇒ Boolean

Probe whether the compiler accepts a flag by compiling a trivial program with it. Lets us skip flags the toolchain rejects (e.g. -march=native on Clang/ARM, or GCC-only flags on MSVC) instead of breaking the build. Replaces the old RUBY_PLATFORM string guesses: ask the actual compiler, don't infer from the OS.

Returns:

  • (Boolean)


17
18
19
# File 'ext/smarter_json/extconf.rb', line 17

def compiler_accepts?(flag)
  try_compile("int main(void){return 0;}", flag)
end