change File.open {}.read to File.read
[god.git] / ext / god / extconf.rb
blob46835750ca5ccd01f96e5c2160a7ace79e21cb3f
1 require 'mkmf'
3 fail = false
5 def create_dummy_makefile
6   File.open("Makefile", 'w') do |f|
7     f.puts "all:"
8     f.puts "install:"
9   end
10 end
12 case RUBY_PLATFORM
13 when /bsd/i, /darwin/i
14   unless have_header('sys/event.h')
15     puts
16     puts "Missing 'sys/event.h' header"
17     fail = true
18   end
19   
20   if fail
21     puts
22     puts "Events handler could not be compiled (see above error). Your god installation will not support event conditions."
23     create_dummy_makefile
24   else
25     create_makefile 'kqueue_handler_ext'
26   end
27 when /linux/i
28   unless have_header('linux/netlink.h')
29     puts
30     puts "Missing 'linux/netlink.h' header(s)"
31     puts "You may need to install a header package for your system"
32     fail = true
33   end
34   
35   unless have_header('linux/connector.h') && have_header('linux/cn_proc.h')
36     puts
37     puts "Missing 'linux/connector.h', or 'linux/cn_proc.h' header(s)"
38     puts "These are only available in Linux kernel 2.6.15 and later (run `uname -a` to find yours)"
39     puts "You may need to install a header package for your system"
40     fail = true
41   end
42   
43   if fail
44     puts
45     puts "Events handler could not be compiled (see above error). Your god installation will not support event conditions."
46     create_dummy_makefile
47   else
48     create_makefile 'netlink_handler_ext'
49   end
50 else
51   puts
52   puts "Unsupported platform '#{RUBY_PLATFORM}'. Supported platforms are BSD, DARWIN, and LINUX."
53   puts "Your god installation will not support event conditions."
54   create_dummy_makefile
55 end