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