Make to compile cleanly and fix tests to run under Ruby 1.8.7, 1.9.3, 2.0 and 2.1.