4 # XXX let me know if this works for you...
5 if ! defined?(RUBY_VERSION) || RUBY_VERSION !~ /\A1\.[89]\./
6 raise "Invalid RUBY_VERSION for C extension"
9 have_header('ruby.h') or raise "ruby.h header not found!"
11 if have_header('fcntl.h')
12 have_macro('F_GETFL', %w(fcntl.h))
13 have_macro('O_NONBLOCK', %w(unistd.h fcntl.h))
16 have_func('localtime_r', 'time.h') or raise "localtime_r needed"
17 have_func('gmtime_r', 'time.h') or raise "gmtime_r needed"
18 have_func('rb_str_set_len', 'ruby.h')
19 dir_config('clogger_ext')
20 create_makefile('clogger_ext')
22 warn "E: #{err.inspect}"
23 warn "Skipping C extension, pure Ruby version will be used instead"
25 # generate a dummy Makefile to fool rubygems installer
26 targets = %w(all static clean distclean realclean
27 install install-so install-rb install-rb-default
28 pre-install-rb pre-install-rb-default
29 site-install site-install-so site-install-rb)
30 File.open(File.dirname(__FILE__) << "/Makefile", "wb") do |fp|
31 fp.puts targets.join(' ') << ":"
32 fp.puts "\techo >&2 extension disabled"