1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* ext/dbm/extconf.rb: allow multiple candidates for dbm-type.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10944 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2006-09-16 07:14:37 +00:00
parent f06362a4f9
commit 5e6bf721d5
2 changed files with 28 additions and 34 deletions

View file

@ -1,10 +1,12 @@
Mon Jan 16 16:06:20 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
Sat Sep 16 16:13:50 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
* Makefile.in, common.in, instruby.rb, ext/extmk.rb, lib/mkmf.rb:
use instruby.rb to install extensions instead of ext/extmk.rb.
* instruby.rb: store installed list into the file.
* ext/dbm/extconf.rb: allow multiple candidates for dbm-type.
Sat Sep 16 11:03:49 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
* array.c (ary_shared_first): should create embedded copies

View file

@ -2,9 +2,13 @@ require 'mkmf'
dir_config("dbm")
dblib = with_config("dbm-type", nil)
if dblib = with_config("dbm-type", nil)
dblib = dblib.split(/[ ,]+/)
else
dblib = %w(db db2 db1 dbm gdbm gdbm_compat qdbm)
end
$dbm_conf_headers = {
headers = {
"db" => ["db.h"],
"db1" => ["db1/ndbm.h", "db1.h", "ndbm.h"],
"db2" => ["db2/db.h", "db2.h", "db.h"],
@ -14,48 +18,36 @@ $dbm_conf_headers = {
"qdbm" => ["relic.h"],
}
def db_check(db)
$dbm_conf_db_prefix = ""
$dbm_conf_have_gdbm = false
hsearch = ""
def headers.db_check(db)
db_prefix = nil
have_gdbm = false
hsearch = nil
case db
when /^db2?$/
$dbm_conf_db_prefix = "__db_n"
db_prefix = "__db_n"
hsearch = "-DDB_DBM_HSEARCH "
when "gdbm"
$dbm_conf_have_gdbm = true
have_gdbm = true
when "gdbm_compat"
$dbm_conf_have_gdbm = true
have_gdbm = true
have_library("gdbm") or return false
end
db_prefix ||= ""
if have_library(db, db_prefix("dbm_open")) || have_func(db_prefix("dbm_open"))
for hdr in $dbm_conf_headers.fetch(db, ["ndbm.h"])
if have_header(hdr.dup) and have_type("DBM", hdr.dup, hsearch)
$defs << hsearch << '-DDBM_HDR="<'+hdr+'>"'
return true
end
end
end
return false
end
def db_prefix(func)
$dbm_conf_db_prefix+func
end
if dblib
dbm_hdr = db_check(dblib)
else
dbm_hdr = %w(db db2 db1 dbm gdbm gdbm_compat qdbm).any? do |dblib|
db_check(dblib)
if (have_library(db, db_prefix+"dbm_open") || have_func(db_prefix+"dbm_open")) and
hdr = self.fetch(db, ["ndbm.h"]).find {|hdr| have_type("DBM", hdr, hsearch)}
have_func(db_prefix+"dbm_clearerr") unless have_gdbm
$defs << hsearch if hsearch
$defs << '-DDBM_HDR="<'+hdr+'>"'
true
else
false
end
end
have_header("cdefs.h")
have_header("sys/cdefs.h")
if dbm_hdr and have_func(db_prefix("dbm_open"))
have_func(db_prefix("dbm_clearerr")) unless $dbm_conf_have_gdbm
if dblib.any? {|db| headers.db_check(db)}
have_header("cdefs.h")
have_header("sys/cdefs.h")
create_makefile("dbm")
end