From 612e248d0884682ea4851a690859c23b458a3d15 Mon Sep 17 00:00:00 2001 From: danj Date: Mon, 6 Mar 2006 17:44:47 +0000 Subject: [PATCH] fix solaris install problems --- bdb.h | 7 ++++++- extconf.rb | 20 ++++++++++++++++++-- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/bdb.h b/bdb.h index 43cd420..5e5b3f8 100644 --- a/bdb.h +++ b/bdb.h @@ -4,8 +4,13 @@ #include #include -#include +#include +#ifdef INC_DB4 +#include +#else +#include +#endif #define NOTXN NULL diff --git a/extconf.rb b/extconf.rb index 31ade46..96f0468 100644 --- a/extconf.rb +++ b/extconf.rb @@ -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")