File: extconf.rb

package info (click to toggle)
ruby-hiredis 0.6.1-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 256 kB
  • ctags: 275
  • sloc: ruby: 973; ansic: 503; makefile: 5
file content (36 lines) | stat: -rw-r--r-- 828 bytes parent folder | download | duplicates (4)
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