summaryrefslogtreecommitdiff
path: root/ext/dbm
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-05-24 05:28:15 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-05-24 05:28:15 +0000
commit2287c526be0074e3d6e8e2b2927247866c237bd0 (patch)
tree8128aa5b4a8b4de781bdaee01bf36ce6d13454bf /ext/dbm
parent315cd8341823e129ba5df0f420443e9d06d62c6f (diff)
* 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
Diffstat (limited to 'ext/dbm')
-rw-r--r--ext/dbm/extconf.rb37
1 files changed, 28 insertions, 9 deletions
diff --git a/ext/dbm/extconf.rb b/ext/dbm/extconf.rb
index f9dc708..1c1abd0 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