* ext/dbm/dbm.c: use db_version() instead of DB_VERSION_STRING for

detect runtime Berkeley DB version.
  use dpversion instead of _QDBM_VERSION for detect runtime QDBM
  [ruby-dev:44948]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33963 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2011-12-06 10:21:12 +00:00
Родитель 1ff15071d0
Коммит bb1875175b
3 изменённых файлов: 20 добавлений и 7 удалений

Просмотреть файл

@ -1,3 +1,11 @@
Tue Dec 6 18:26:33 2011 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]
Tue Dec 6 12:30:41 2011 Tanaka Akira <akr@fsij.org>
* ext/dbm/extconf.rb: detect gdbm_version in libgdbm.

Просмотреть файл

@ -1076,21 +1076,21 @@ Init_dbm(void)
*/
rb_define_const(rb_cDBM, "NEWDB", INT2FIX(O_RDWR|O_CREAT|O_TRUNC|RUBY_DBM_RW_BIT));
#if defined(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. */
{
/* ndbm.h doesn't declare gdbm_version until gdbm 1.8.3.
* See extconf.rb for more information. */
extern char *gdbm_version;
rb_define_const(rb_cDBM, "VERSION", rb_str_new2(gdbm_version));
}
#elif defined(_QDBM_VERSION)
rb_define_const(rb_cDBM, "VERSION", rb_str_new2("QDBM " _QDBM_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

Просмотреть файл

@ -80,12 +80,17 @@ def headers.db_check2(db, hdr)
(db == 'libc' ? have_func('dbm_open("", 0, 0)', hdr, hsearch) :
have_library(db, 'dbm_open("", 0, 0)', hdr, hsearch)) and
have_func('dbm_clearerr((DBM *)0)', hdr, hsearch)
if /gdbm/ =~ db
case db
when /\Adb\d?\z/
have_func('db_version((int *)0, (int *)0, (int *)0)', hdr, hsearch)
when /\Agdbm/
have_var("gdbm_version", hdr, hsearch)
# 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, hsearch)
when /\Aqdbm\z/
have_var("dpversion", hdr, hsearch)
end
if hsearch
$defs << hsearch