Top Level Namespace
Defined Under Namespace
Modules: TinyTds
Constant Summary collapse
- FREETDS_LIBRARIES =
['iconv','sybdb']
- FREETDS_HEADERS =
['sybfront.h', 'sybdb.h']
Instance Method Summary collapse
- #find_freetds_include_path ⇒ Object
- #find_freetds_libraries_path ⇒ Object
- #have_freetds? ⇒ Boolean
- #have_freetds_headers?(*headers) ⇒ Boolean
- #have_freetds_libraries?(*libraries) ⇒ Boolean
- #root_paths ⇒ Object
Instance Method Details
#find_freetds_include_path ⇒ Object
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'ext/tiny_tds/extconf.rb', line 47 def find_freetds_include_path root_paths.detect do |path| [['include'],['include','freetds']].detect do |ipaths| dir = File.join path, *ipaths = "looking for include directory #{dir} ..." if File.directory?(dir) puts "#{} yes" if with_cppflags("#{$CPPFLAGS} -I#{dir}".strip) { have_freetds_headers?(*FREETDS_HEADERS) } $CPPFLAGS = "-I#{dir} #{$CPPFLAGS}".strip true else false end else puts "#{} no" false end end end end |
#find_freetds_libraries_path ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'ext/tiny_tds/extconf.rb', line 22 def find_freetds_libraries_path root_paths.detect do |path| [['lib'],['lib','freetds']].detect do |lpaths| dir = File.join path, *lpaths = "looking for library directory #{dir} ..." if File.directory?(dir) puts "#{} yes" if with_ldflags("#{$LDFLAGS} -L#{dir}".strip) { have_freetds_libraries?(*FREETDS_LIBRARIES) } $LDFLAGS = "-L#{dir} #{$LDFLAGS}".strip true else false end else puts "#{} no" false end end end end |
#have_freetds? ⇒ Boolean
68 69 70 |
# File 'ext/tiny_tds/extconf.rb', line 68 def have_freetds? find_freetds_libraries_path && find_freetds_include_path end |
#have_freetds_headers?(*headers) ⇒ Boolean
43 44 45 |
# File 'ext/tiny_tds/extconf.rb', line 43 def have_freetds_headers?(*headers) headers.all? { |h| have_header(h) } end |
#have_freetds_libraries?(*libraries) ⇒ Boolean
18 19 20 |
# File 'ext/tiny_tds/extconf.rb', line 18 def have_freetds_libraries?(*libraries) libraries.all? { |l| have_library(l) } end |
#root_paths ⇒ Object
9 10 11 12 13 14 15 16 |
# File 'ext/tiny_tds/extconf.rb', line 9 def root_paths eop_regexp = /#{File::SEPARATOR}bin$/ paths = ENV['PATH'] paths = paths.gsub(File::ALT_SEPARATOR, File::SEPARATOR) if File::ALT_SEPARATOR paths = paths.split(File::PATH_SEPARATOR) bin_paths = paths.select{ |p| p =~ eop_regexp } bin_paths.map{ |p| p.sub(eop_regexp,'') }.compact.reject{ |p| p.empty? }.uniq end |