require 'mkmf'

def print(*args)
  STDOUT.print *args
  STDOUT.flush
end


$CFLAGS << ' -std=c89 -pedantic -Wall -Wno-long-long'
$defs << ' -DNDEBUG'


print 'checking for allocation framework... '
if Object.respond_to?(:allocate)
  print "yes\n"
  $defs << '-DHAVE_OBJECT_ALLOCATE'
else
  print "no\n"
end

have_func('rb_obj_init_copy')
have_func('rb_block_proc')
have_func('rb_yield_values')
have_func('rb_marshal_dump')
have_func('rb_marshal_load')

print 'checking for inline keyword... '
inline = ['inline', '__inline', '__inline__', ''].find {|e|
  try_link(<<EOS)
int main() { return 0; }
#{e} void foo() {}
EOS
}
print "#{inline}\n"
$defs << "-Dinline=#{inline}"


create_makefile('rbtree')
