public
Description: The tokyo cabinet ruby interface wrapped up in a gem
Homepage:
Clone URL: git://github.com/careo/tokyocabinet-ruby.git
Norman Clarke (author)
Wed May 20 09:05:47 -0700 2009
careo (committer)
Wed May 20 11:17:43 -0700 2009
tokyocabinet-ruby / extconf.rb
100644 29 lines (22 sloc) 0.911 kb
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
require "mkmf"
 
dir_config('tokyocabinet')
 
home = ENV["HOME"]
ENV["PATH"] = ENV["PATH"] + ":/usr/local/bin:$home/bin:.:..:../.."
tccflags = `tcucodec conf -i 2>/dev/null`.chomp
tcldflags = `tcucodec conf -l 2>/dev/null`.chomp
tcldflags = tcldflags.gsub(/-l[\S]+/, "").strip
tclibs = `tcucodec conf -l 2>/dev/null`.chomp
tclibs = tclibs.gsub(/-L[\S]+/, "").strip
 
tccflags = "-I/usr/local/include" if(tccflags.length < 1)
tcldflags = "-L/usr/local/lib" if(tcldflags.length < 1)
tclibs = "-ltokyocabinet -lz -lbz2 -lpthread -lm -lc" if(tclibs.length < 1)
 
$CFLAGS = "-I. -I.. -I../.. #{tccflags} -Wall #{$CFLAGS} -O2"
$LDFLAGS = "#{$LDFLAGS} -L. -L.. -L../.. #{tcldflags}"
$libs = "#{$libs} #{tclibs}"
 
printf("setting variables ...\n")
printf(" \$CFLAGS = %s\n", $CFLAGS)
printf(" \$LDFLAGS = %s\n", $LDFLAGS)
printf(" \$libs = %s\n", $libs)
 
if have_header('tcutil.h')
  create_makefile('tokyocabinet')
end