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:
parent
f06362a4f9
commit
5e6bf721d5
2 changed files with 28 additions and 34 deletions
|
@ -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:
|
* Makefile.in, common.in, instruby.rb, ext/extmk.rb, lib/mkmf.rb:
|
||||||
use instruby.rb to install extensions instead of ext/extmk.rb.
|
use instruby.rb to install extensions instead of ext/extmk.rb.
|
||||||
|
|
||||||
* instruby.rb: store installed list into the file.
|
* 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>
|
Sat Sep 16 11:03:49 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
* array.c (ary_shared_first): should create embedded copies
|
* array.c (ary_shared_first): should create embedded copies
|
||||||
|
|
|
@ -2,9 +2,13 @@ require 'mkmf'
|
||||||
|
|
||||||
dir_config("dbm")
|
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"],
|
"db" => ["db.h"],
|
||||||
"db1" => ["db1/ndbm.h", "db1.h", "ndbm.h"],
|
"db1" => ["db1/ndbm.h", "db1.h", "ndbm.h"],
|
||||||
"db2" => ["db2/db.h", "db2.h", "db.h"],
|
"db2" => ["db2/db.h", "db2.h", "db.h"],
|
||||||
|
@ -14,48 +18,36 @@ $dbm_conf_headers = {
|
||||||
"qdbm" => ["relic.h"],
|
"qdbm" => ["relic.h"],
|
||||||
}
|
}
|
||||||
|
|
||||||
def db_check(db)
|
def headers.db_check(db)
|
||||||
$dbm_conf_db_prefix = ""
|
db_prefix = nil
|
||||||
$dbm_conf_have_gdbm = false
|
have_gdbm = false
|
||||||
hsearch = ""
|
hsearch = nil
|
||||||
|
|
||||||
case db
|
case db
|
||||||
when /^db2?$/
|
when /^db2?$/
|
||||||
$dbm_conf_db_prefix = "__db_n"
|
db_prefix = "__db_n"
|
||||||
hsearch = "-DDB_DBM_HSEARCH "
|
hsearch = "-DDB_DBM_HSEARCH "
|
||||||
when "gdbm"
|
when "gdbm"
|
||||||
$dbm_conf_have_gdbm = true
|
have_gdbm = true
|
||||||
when "gdbm_compat"
|
when "gdbm_compat"
|
||||||
$dbm_conf_have_gdbm = true
|
have_gdbm = true
|
||||||
have_library("gdbm") or return false
|
have_library("gdbm") or return false
|
||||||
end
|
end
|
||||||
|
db_prefix ||= ""
|
||||||
|
|
||||||
if have_library(db, db_prefix("dbm_open")) || have_func(db_prefix("dbm_open"))
|
if (have_library(db, db_prefix+"dbm_open") || have_func(db_prefix+"dbm_open")) and
|
||||||
for hdr in $dbm_conf_headers.fetch(db, ["ndbm.h"])
|
hdr = self.fetch(db, ["ndbm.h"]).find {|hdr| have_type("DBM", hdr, hsearch)}
|
||||||
if have_header(hdr.dup) and have_type("DBM", hdr.dup, hsearch)
|
have_func(db_prefix+"dbm_clearerr") unless have_gdbm
|
||||||
$defs << hsearch << '-DDBM_HDR="<'+hdr+'>"'
|
$defs << hsearch if hsearch
|
||||||
return true
|
$defs << '-DDBM_HDR="<'+hdr+'>"'
|
||||||
end
|
true
|
||||||
end
|
else
|
||||||
end
|
false
|
||||||
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)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
have_header("cdefs.h")
|
if dblib.any? {|db| headers.db_check(db)}
|
||||||
have_header("sys/cdefs.h")
|
have_header("cdefs.h")
|
||||||
if dbm_hdr and have_func(db_prefix("dbm_open"))
|
have_header("sys/cdefs.h")
|
||||||
have_func(db_prefix("dbm_clearerr")) unless $dbm_conf_have_gdbm
|
|
||||||
create_makefile("dbm")
|
create_makefile("dbm")
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue