1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
|
require 'mkmf'
build_hiredis = true
unless have_header('sys/socket.h')
puts "Could not find <sys/socket.h> (Likely Windows)."
puts "Skipping building hiredis. The slower, pure-ruby implementation will be used instead."
build_hiredis = false
end
RbConfig::MAKEFILE_CONFIG['CC'] = ENV['CC'] if ENV['CC']
RbConfig::CONFIG['configure_args'] =~ /with-make-prog\=(\w+)/
make_program = $1 || ENV['make']
make_program ||= case RUBY_PLATFORM
when /mswin/
'nmake'
when /(bsd|solaris)/
'gmake'
else
'make'
end
if build_hiredis
# Debian: use system hiredis
$CFLAGS << " -I/usr/include/hiredis"
$LDFLAGS << " -lhiredis"
have_func("rb_thread_fd_select")
create_makefile('hiredis/ext/hiredis_ext')
else
File.open("Makefile", "wb") do |f|
dummy_makefile(".").each do |line|
f.puts(line)
end
end
end
|