class FFI::Compiler::CompileTask

def try_compile(src, *opts)

def try_compile(src, *opts)
  Dir.mktmpdir do |dir|
    path = File.join(dir, 'ffi-test.c')
    File.open(path, 'w') do |f|
      f << src
    end
    cflags = shelljoin(opts)
    output = File.join(dir, 'ffi-test')
    begin
      return system "#{cc} #{cflags} -o #{shellescape(output)} -c #{shellescape(path)} > #{shellescape(path)}.log 2>&1"
    rescue
      return false
    end
  end
end