mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
merge revision(s) 33959,33963,34265:
* ext/dbm/extconf.rb: detect gdbm_version in libgdbm. * ext/dbm/dbm.c: make DBM::VERSION more informative for gdbm, qdbm and Berkeley DB 1.x. [ruby-dev:44944] * ext/dbm/dbm.c: use db_version() instead of DB_VERSION_STRING to detect runtime Berkeley DB version. use dpversion instead of _QDBM_VERSION to detect runtime QDBM version. [ruby-dev:44948] * ext/dbm/dbm.c (Init_dbm): fix a build error on mswin32. use `extern __declspec(dllimport)` for dll link with VC. [ruby-core:41996] [Bug #5869] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@34502 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
e0f8351d55
commit
6b3ba6912a
4 changed files with 128 additions and 29 deletions
21
ChangeLog
21
ChangeLog
|
|
@ -1,3 +1,24 @@
|
|||
Thu Feb 9 11:11:15 2012 Hiroshi Shirosaki <h.shirosaki@gmail.com>
|
||||
|
||||
* ext/dbm/dbm.c (Init_dbm): fix a build error on mswin32.
|
||||
use `extern __declspec(dllimport)` for dll link with VC.
|
||||
[ruby-core:41996] [Bug #5869]
|
||||
|
||||
Thu Feb 9 11:11:15 2012 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* ext/dbm/dbm.c: use db_version() instead of DB_VERSION_STRING to
|
||||
detect runtime Berkeley DB version.
|
||||
use dpversion instead of _QDBM_VERSION to detect runtime QDBM
|
||||
version.
|
||||
[ruby-dev:44948]
|
||||
|
||||
Thu Feb 9 11:11:15 2012 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* ext/dbm/extconf.rb: detect gdbm_version in libgdbm.
|
||||
|
||||
* ext/dbm/dbm.c: make DBM::VERSION more informative for gdbm, qdbm and
|
||||
Berkeley DB 1.x. [ruby-dev:44944]
|
||||
|
||||
Thu Feb 9 07:32:40 2012 NARUSE, Yui <naruse@ruby-lang.org>
|
||||
|
||||
* numeric.c (rb_enc_uint_char): raise RangeError when added codepoint
|
||||
|
|
|
|||
|
|
@ -901,10 +901,13 @@ fdbm_reject(VALUE obj)
|
|||
* The exact library used depends on how Ruby was compiled. It could be any
|
||||
* of the following:
|
||||
*
|
||||
* - The original ndbm library is released in 4.3BSD.
|
||||
* It is based on dbm library in Unix Version 7 but has different API to
|
||||
* support multiple databases in a process.
|
||||
* - {Berkeley DB}[http://en.wikipedia.org/wiki/Berkeley_DB] versions
|
||||
* 1 thru 5, also known as BDB and Sleepycat DB, now owned by Oracle
|
||||
* Corporation.
|
||||
* - ndbm, aka Berkeley DB 1.x, still found in FreeBSD and OpenBSD.
|
||||
* - Berkeley DB 1.x, still found in FreeBSD and OpenBSD.
|
||||
* - {gdbm}[http://www.gnu.org/software/gdbm/], the GNU implementation of dbm.
|
||||
* - {qdbm}[http://fallabs.com/qdbm/index.html], another open source
|
||||
* reimplementation of dbm.
|
||||
|
|
@ -1016,9 +1019,23 @@ Init_dbm(void)
|
|||
*/
|
||||
rb_define_const(rb_cDBM, "NEWDB", INT2FIX(O_RDWR|O_CREAT|O_TRUNC|RUBY_DBM_RW_BIT));
|
||||
|
||||
#ifdef DB_VERSION_STRING
|
||||
#if defined(HAVE_DB_VERSION)
|
||||
/* The version of the dbm library, if using Berkeley DB */
|
||||
rb_define_const(rb_cDBM, "VERSION", rb_str_new2(DB_VERSION_STRING));
|
||||
rb_define_const(rb_cDBM, "VERSION", rb_str_new2(db_version(NULL, NULL, NULL)));
|
||||
#elif defined(HAVE_GDBM_VERSION)
|
||||
/* since gdbm 1.9 */
|
||||
rb_define_const(rb_cDBM, "VERSION", rb_str_new2(gdbm_version));
|
||||
#elif defined(HAVE_LIBVAR_GDBM_VERSION)
|
||||
/* ndbm.h doesn't declare gdbm_version until gdbm 1.8.3.
|
||||
* See extconf.rb for more information. */
|
||||
{
|
||||
RUBY_EXTERN char *gdbm_version;
|
||||
rb_define_const(rb_cDBM, "VERSION", rb_str_new2(gdbm_version));
|
||||
}
|
||||
#elif defined(HAVE_DPVERSION)
|
||||
rb_define_const(rb_cDBM, "VERSION", rb_sprintf("QDBM %s", dpversion));
|
||||
#elif defined(_DB_H_)
|
||||
rb_define_const(rb_cDBM, "VERSION", rb_str_new2("Berkeley DB (unknown)"));
|
||||
#else
|
||||
rb_define_const(rb_cDBM, "VERSION", rb_str_new2("unknown"));
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -5,52 +5,113 @@ dir_config("dbm")
|
|||
if dblib = with_config("dbm-type", nil)
|
||||
dblib = dblib.split(/[ ,]+/)
|
||||
else
|
||||
dblib = %w(db db2 db1 db5 db4 db3 dbm gdbm gdbm_compat qdbm)
|
||||
dblib = %w(libc db db2 db1 db5 db4 db3 dbm gdbm gdbm_compat qdbm)
|
||||
end
|
||||
|
||||
headers = {
|
||||
"libc" => ["ndbm.h"], # 4.4BSD libc contains Berkeley DB 1.
|
||||
"db" => ["db.h"],
|
||||
"db1" => ["db1/ndbm.h", "db1.h", "ndbm.h"],
|
||||
"db2" => ["db2/db.h", "db2.h", "db.h"],
|
||||
"db3" => ["db3/db.h", "db3.h", "db.h"],
|
||||
"db4" => ["db4/db.h", "db4.h", "db.h"],
|
||||
"db5" => ["db5/db.h", "db5.h", "db.h"],
|
||||
"dbm" => ["ndbm.h"],
|
||||
"gdbm" => ["gdbm-ndbm.h", "ndbm.h", "gdbm/ndbm.h"],
|
||||
"gdbm_compat" => ["gdbm-ndbm.h", "ndbm.h", "gdbm/ndbm.h"],
|
||||
"dbm" => ["ndbm.h"], # traditional ndbm (4.3BSD)
|
||||
"gdbm" => ["gdbm-ndbm.h", "ndbm.h", "gdbm/ndbm.h"], # gdbm until 1.8.0
|
||||
"gdbm_compat" => ["gdbm-ndbm.h", "ndbm.h", "gdbm/ndbm.h"], # gdbm since 1.8.1
|
||||
"qdbm" => ["relic.h", "qdbm/relic.h"],
|
||||
}
|
||||
|
||||
def headers.db_check(db)
|
||||
db_prefix = nil
|
||||
have_gdbm = false
|
||||
hsearch = nil
|
||||
class << headers
|
||||
attr_accessor :found
|
||||
attr_accessor :defs
|
||||
end
|
||||
headers.found = []
|
||||
headers.defs = nil
|
||||
|
||||
case db
|
||||
when /^db[2-5]?$/
|
||||
db_prefix = "__db_n"
|
||||
hsearch = "-DDB_DBM_HSEARCH "
|
||||
when "gdbm"
|
||||
have_gdbm = true
|
||||
when "gdbm_compat"
|
||||
have_gdbm = true
|
||||
have_library("gdbm") or return false
|
||||
def headers.db_check(db, hdr)
|
||||
old_libs = $libs.dup
|
||||
old_defs = $defs.dup
|
||||
result = db_check2(db, hdr)
|
||||
if !result
|
||||
$libs = old_libs
|
||||
$defs = old_defs
|
||||
end
|
||||
db_prefix ||= ""
|
||||
result
|
||||
end
|
||||
|
||||
if (have_library(db, db_prefix+"dbm_open") || have_func(db_prefix+"dbm_open")) and
|
||||
hdr = self.fetch(db, ["ndbm.h"]).find {|h| have_type("DBM", h, hsearch)} or
|
||||
hdr = self.fetch(db, ["ndbm.h"]).find {|h| have_type("DBM", ["db.h", h], hsearch)}
|
||||
have_func(db_prefix+"dbm_clearerr") unless have_gdbm
|
||||
$defs << hsearch if hsearch
|
||||
$defs << '-DDBM_HDR="<'+hdr+'>"'
|
||||
def have_libvar(var, headers = nil, opt = "", &b)
|
||||
checking_for checking_message([*var].compact.join(' '), headers, opt) do
|
||||
try_libvar(var, headers, opt, &b)
|
||||
end
|
||||
end
|
||||
|
||||
def try_libvar(var, headers = nil, opt = "", &b)
|
||||
var, type = *var
|
||||
if try_link(<<"SRC", opt, &b)
|
||||
#{cpp_include(headers)}
|
||||
/*top*/
|
||||
int main(int argc, char *argv[]) {
|
||||
typedef #{type || 'int'} conftest_type;
|
||||
extern conftest_type #{var};
|
||||
conftest_type *conftest_var = &#{var};
|
||||
return 0;
|
||||
}
|
||||
SRC
|
||||
$defs.push(format("-DHAVE_LIBVAR_%s", var.tr_cpp))
|
||||
true
|
||||
else
|
||||
false
|
||||
end
|
||||
end
|
||||
|
||||
if dblib.any? {|db| headers.db_check(db)}
|
||||
|
||||
def headers.db_check2(db, hdr)
|
||||
db_prefix = ''
|
||||
have_gdbm = false
|
||||
hsearch = nil
|
||||
|
||||
case db
|
||||
when /^db[2-5]?$/
|
||||
db_prefix = "__db_n"
|
||||
hsearch = "-DDB_DBM_HSEARCH"
|
||||
when "gdbm"
|
||||
have_gdbm = true
|
||||
when "gdbm_compat"
|
||||
have_gdbm = true
|
||||
have_library("gdbm") or return false
|
||||
end
|
||||
|
||||
if (have_library(db, db_prefix+"dbm_open") || have_func(db_prefix+"dbm_open")) and
|
||||
hdr = self.fetch(db, ["ndbm.h"]).find {|h| have_type("DBM", h, hsearch)} or
|
||||
hdr = self.fetch(db, ["ndbm.h"]).find {|h| have_type("DBM", ["db.h", h], hsearch)}
|
||||
have_func(db_prefix+"dbm_clearerr") unless have_gdbm
|
||||
$defs << hsearch if hsearch
|
||||
case db
|
||||
when /\Adb\d?\z/
|
||||
have_func('db_version')
|
||||
when /\Agdbm/
|
||||
have_var("gdbm_version", hdr)
|
||||
# gdbm_version is not declared by ndbm.h until gdbm 1.8.3.
|
||||
# We can't include ndbm.h and gdbm.h because they both define datum type.
|
||||
# ndbm.h includes gdbm.h and gdbm_version is declared since gdbm 1.9.
|
||||
have_libvar(["gdbm_version", "char *"], hdr)
|
||||
when /\Aqdbm\z/
|
||||
have_var("dpversion", hdr)
|
||||
end
|
||||
if hsearch
|
||||
$defs << hsearch
|
||||
@defs = hsearch
|
||||
end
|
||||
$defs << '-DDBM_HDR="<'+hdr+'>"'
|
||||
@found << hdr
|
||||
true
|
||||
else
|
||||
false
|
||||
end
|
||||
end
|
||||
|
||||
if dblib.any? {|db| headers.fetch(db, ["ndbm.h"]).any? {|hdr| headers.db_check(db, hdr) } }
|
||||
have_header("cdefs.h")
|
||||
have_header("sys/cdefs.h")
|
||||
create_makefile("dbm")
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#define RUBY_VERSION "1.9.3"
|
||||
#define RUBY_PATCHLEVEL 71
|
||||
#define RUBY_PATCHLEVEL 72
|
||||
|
||||
#define RUBY_RELEASE_DATE "2012-02-09"
|
||||
#define RUBY_RELEASE_YEAR 2012
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue