diff options
-rw-r--r-- | projects/fastthread/ext/fastthread/extconf.rb | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/projects/fastthread/ext/fastthread/extconf.rb b/projects/fastthread/ext/fastthread/extconf.rb index fcacfd9..5f3fa2c 100644 --- a/projects/fastthread/ext/fastthread/extconf.rb +++ b/projects/fastthread/ext/fastthread/extconf.rb @@ -1,3 +1,28 @@ require 'mkmf' -create_makefile('fastthread') +version_components = RUBY_VERSION.split('.').map { |c| c.to_i } + +need_fastthread = ( !defined? RUBY_ENGINE ) +need_fastthread &= ( RUBY_PLATFORM != 'java' ) +need_fastthread &= ( version_components[0..1] == [1, 8] && ( version_components[2] < 6 || version_components[2] == 6 && RUBY_PATCHLEVEL < 111 ) ) + +if need_fastthread + create_makefile('fastthread') +else + File.open('Makefile', 'w') do |stream| + CONFIG.each do |key, value| + stream.puts "#{key} = #{value}" + end + stream.puts + stream << <<EOS +RUBYARCHDIR = $(sitearchdir)$(target_prefix) + +default: + +install: + mkdir -p $(RUBYARCHDIR) + touch $(RUBYARCHDIR)/fastthread.rb + +EOS + end +end |