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: backported from 1.7.

* ext/dbm/dbm.c: ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_6@3142 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
eban 2002-12-13 14:55:30 +00:00
parent e71c9d1c4a
commit f360ad8106
3 changed files with 56 additions and 6 deletions

View file

@ -1,3 +1,9 @@
Fri Dec 13 23:39:09 2002 WATANABE Hirofumi <eban@ruby-lang.org>
* ext/dbm/extconf.rb: backported from 1.7.
* ext/dbm/dbm.c: ditto.
Thu Dec 12 16:26:31 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
* marshal.c (r_object0): singleton class instance can't be loaded.

View file

@ -18,7 +18,7 @@
#ifdef HAVE_SYS_CDEFS_H
# include <sys/cdefs.h>
#endif
#include <ndbm.h>
#include DBM_HDR
#include <fcntl.h>
#include <errno.h>

View file

@ -1,13 +1,57 @@
require 'mkmf'
dir_config("dbm")
if have_library("gdbm", "dbm_open")
gdbm = true
dblib = with_config("dbm-type", nil)
$dbm_conf_headers = {
"db" => ["db.h"],
"db1" => ["db1/ndbm.h", "db1.h", "ndbm.h"],
"db2" => ["db2/db.h", "db2.h", "db.h"],
"dbm" => ["ndbm.h"],
"gdbm" => ["gdbm-ndbm.h", "ndbm.h"],
"gdbm_compat" => ["gdbm-ndbm.h", "ndbm.h"],
}
def db_check(db)
$dbm_conf_db_prefix = ""
$dbm_conf_have_gdbm = false
hsearch = ""
case db
when /^db2?$/
$dbm_conf_db_prefix = "__db_n"
hsearch = "-DDB_DBM_HSEARCH "
when "gdbm"
$dbm_conf_have_gdbm = true
end
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)
$CFLAGS += " " + hsearch + "-DDBM_HDR='<"+hdr+">'"
return true
end
end
end
return false
end
gdbm or have_library("db", "dbm_open") or have_library("dbm", "dbm_open")
def db_prefix(func)
$dbm_conf_db_prefix+func
end
if dblib
db_check(dblib)
else
for dblib in %w(db db2 db1 dbm gdbm)
db_check(dblib) and break
end
end
have_header("cdefs.h")
have_header("sys/cdefs.h")
if have_header("ndbm.h") and have_func("dbm_open")
have_func("dbm_clearerr") unless gdbm
if /DBM_HDR/ =~ $CFLAGS and have_func(db_prefix("dbm_open"))
have_func(db_prefix("dbm_clearerr")) unless $dbm_conf_have_gdbm
create_makefile("dbm")
end