From 2287c526be0074e3d6e8e2b2927247866c237bd0 Mon Sep 17 00:00:00 2001 From: matz Date: Thu, 24 May 2001 05:28:15 +0000 Subject: [PATCH] * eval.c (rb_yield_0): need argument adjustment for C defined blocks too. * ext/dbm/extconf.rb: header search added. [new] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1443 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/dbm/extconf.rb | 37 ++++++++++++++++++++++++++++--------- 1 file changed, 28 insertions(+), 9 deletions(-) diff --git a/ext/dbm/extconf.rb b/ext/dbm/extconf.rb index f9dc708556..1c1abd00dc 100644 --- a/ext/dbm/extconf.rb +++ b/ext/dbm/extconf.rb @@ -4,23 +4,42 @@ dir_config("dbm") dblib = with_config("dbm-type", nil) +$dbm_conf_headers = { + "db" => ["db.h"], + "db1" => ["db1/ndbm.h", "db1.h"], + "db2" => ["db2/db.h", "db2.h", "db.h"], + "dbm" => ["ndbm.h"], + "gdbm" => ["gdbm-ndbm.h", "gdbm.h"], +} + def db_check(db) - $db_hdr = "ndbm.h" - $db_prefix = "" + $dbm_conf_db_prefix = "" + $dbm_conf_have_gdbm = false + hsearch = "" case db when /^db2?$/ - $db_prefix = "__db_n" - $db_hdr = db+".h" + $dbm_conf_db_prefix = "__db_n" + hsearch = "-DDB_DBM_HSEARCH " when "gdbm" - $have_gdbm = true + $dbm_conf_have_gdbm = true end - have_func(db_prefix("dbm_open")) || have_library(db, db_prefix("dbm_open")) + if have_func(db_prefix("dbm_open")) || have_library(db, db_prefix("dbm_open")) + for hdr in $dbm_conf_headers.fetch(db, ["ndbm.h"]) + if have_header(hdr.dup) + $CFLAGS = "-DDBM_HDR='<"+hdr+">'" + break + end + end + $CFLAGS = hsearch + "-DDBM_HDR='<"+hdr+">'" + return true + end + return false end def db_prefix(func) - $db_prefix+func + $dbm_conf_db_prefix+func end if dblib @@ -33,7 +52,7 @@ end have_header("cdefs.h") have_header("sys/cdefs.h") -if have_header($db_hdr) and have_func(db_prefix("dbm_open")) - have_func(db_prefix("dbm_clearerr")) unless $have_gdbm +if have_func(db_prefix("dbm_open")) + have_func(db_prefix("dbm_clearerr")) unless $dbm_conf_have_gdbm create_makefile("dbm") end