fix solaris install problems

master
danj 2006-03-06 17:44:47 +00:00
parent 20a230483c
commit 612e248d08
2 changed files with 24 additions and 3 deletions

7
bdb.h
View File

@ -4,8 +4,13 @@
#include <ruby.h>
#include <version.h>
#include <db4/db.h>
#include <extconf.h>
#ifdef INC_DB4
#include <db4/db.h>
#else
#include <db.h>
#endif
#define NOTXN NULL

View File

@ -2,6 +2,10 @@
require 'mkmf'
if CONFIG['INSTALL'] =~ %r{./install-sh}
CONFIG.delete("INSTALL")
end
mj,mi,rv=RUBY_VERSION.split('.').collect {|s| s.to_i}
ri=(((mj*1000)+mi)*1000)+rv
if ri < 1008004
@ -30,6 +34,15 @@ h_headers=%w(db4/db.h db.h)
until h_headers.empty?
(inc_ok=find_header(this_h=h_headers.shift,*h_locations)) && break
end
puts "db header is #{this_h} #{inc_ok} #$INCFLAGS"
if this_h == "db4/db.h"
$defs << "-DINC_DB4"
else
$defs << "-UINC_DB4"
end
puts "defs: "+$defs.inspect
# Find db.h, not sure this will work everywhere, gcc is ok
src=create_tmpsrc("#include <#{this_h}>")
@ -48,7 +61,7 @@ File.open(header_loc) {|fd|
hd.puts("/* This file automatically generated by extconf.rb */\n")
fd.each_line {|l|
if l =~ %r{^#define\s+(DBC?_\w*)\s+(\"?)} and macro_defined?($1,inc)
if $2 == '"'
if $2 == '\"'
hd.print(%Q{ cs(mBdb,%s);\n}%[$1])
else
hd.print(%Q{ ci(mBdb,%s);\n}%[$1])
@ -58,10 +71,13 @@ File.open(header_loc) {|fd|
end
}
}
}
} unless File.exist?("bdb_aux._c")
message("\nwrote #{n} defines\n")
$defs << $INCFLAGS
if lib_ok and inc_ok
create_header
create_makefile('bdb2')
else
$stderr.puts("cannot create Makefile")