From 8c6dc264b2636ee54c98684e1716076d47ea5fec Mon Sep 17 00:00:00 2001 From: danj Date: Mon, 24 Apr 2006 19:40:00 +0000 Subject: [PATCH] make extconf.rb accept --va so the library can coexist with bdb2 release prior to transactions. Note, howerver the two libraries cannot be used at the same time --- bdb.c | 3 +++ extconf.rb | 24 +++++++++++++++++++----- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/bdb.c b/bdb.c index 157b669..f3b2e8a 100644 --- a/bdb.c +++ b/bdb.c @@ -1650,3 +1650,6 @@ void Init_bdb2() { rb_define_method(cTxn,"tid",txn_id,0); rb_define_method(cTxn,"set_timeout",txn_set_timeout,2); } +void Init_bdb2a() { + Init_bdb2(); +} diff --git a/extconf.rb b/extconf.rb index 96f0468..fa05a5e 100644 --- a/extconf.rb +++ b/extconf.rb @@ -1,7 +1,21 @@ #!/usr/bin/env ruby - +require 'getoptlong' require 'mkmf' +target="bdb2" + +opts = GetoptLong.new( + [ "--va", GetoptLong::NO_ARGUMENT] + ) +opts.each do |opt,arg| + case opt + when '--va' + target="bdb2a" + end +end + +message "Target is #{target}\n" + if CONFIG['INSTALL'] =~ %r{./install-sh} CONFIG.delete("INSTALL") end @@ -13,7 +27,7 @@ if ri < 1008004 exit(3) end -inc_dir,lib_dir = dir_config('bdb2') +inc_dir,lib_dir = dir_config(target) $stderr.puts("lib_dir=#{lib_dir} inc_dir=#{inc_dir}") @@ -54,7 +68,7 @@ message("header is #{header_loc}\n") inc="#include <#{this_h}>" n=0 -message("Writing bdb_aux.c (defines), this takes a while") +message("Writing bdb_aux._c (defines), this takes a while\n") defines=[] File.open(header_loc) {|fd| File.open("bdb_aux._c","w") {|hd| @@ -71,14 +85,14 @@ File.open(header_loc) {|fd| end } } + message("\nwrote #{n} defines\n") } unless File.exist?("bdb_aux._c") -message("\nwrote #{n} defines\n") $defs << $INCFLAGS if lib_ok and inc_ok create_header - create_makefile('bdb2') + create_makefile(target) else $stderr.puts("cannot create Makefile") end