mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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:
parent
1ff15071d0
commit
bb1875175b
3 changed files with 20 additions and 7 deletions
|
@ -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>
|
Tue Dec 6 12:30:41 2011 Tanaka Akira <akr@fsij.org>
|
||||||
|
|
||||||
* ext/dbm/extconf.rb: detect gdbm_version in libgdbm.
|
* 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));
|
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 */
|
/* 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)
|
#elif defined(HAVE_GDBM_VERSION)
|
||||||
/* since gdbm 1.9 */
|
/* since gdbm 1.9 */
|
||||||
rb_define_const(rb_cDBM, "VERSION", rb_str_new2(gdbm_version));
|
rb_define_const(rb_cDBM, "VERSION", rb_str_new2(gdbm_version));
|
||||||
#elif defined(HAVE_LIBVAR_GDBM_VERSION)
|
#elif defined(HAVE_LIBVAR_GDBM_VERSION)
|
||||||
{
|
|
||||||
/* ndbm.h doesn't declare gdbm_version until gdbm 1.8.3.
|
/* ndbm.h doesn't declare gdbm_version until gdbm 1.8.3.
|
||||||
* See extconf.rb for more information. */
|
* See extconf.rb for more information. */
|
||||||
|
{
|
||||||
extern char *gdbm_version;
|
extern char *gdbm_version;
|
||||||
rb_define_const(rb_cDBM, "VERSION", rb_str_new2(gdbm_version));
|
rb_define_const(rb_cDBM, "VERSION", rb_str_new2(gdbm_version));
|
||||||
}
|
}
|
||||||
#elif defined(_QDBM_VERSION)
|
#elif defined(HAVE_DPVERSION)
|
||||||
rb_define_const(rb_cDBM, "VERSION", rb_str_new2("QDBM " _QDBM_VERSION));
|
rb_define_const(rb_cDBM, "VERSION", rb_sprintf("QDBM %s", dpversion));
|
||||||
#elif defined(_DB_H_)
|
#elif defined(_DB_H_)
|
||||||
rb_define_const(rb_cDBM, "VERSION", rb_str_new2("Berkeley DB (unknown)"));
|
rb_define_const(rb_cDBM, "VERSION", rb_str_new2("Berkeley DB (unknown)"));
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -80,12 +80,17 @@ def headers.db_check2(db, hdr)
|
||||||
(db == 'libc' ? have_func('dbm_open("", 0, 0)', hdr, hsearch) :
|
(db == 'libc' ? have_func('dbm_open("", 0, 0)', hdr, hsearch) :
|
||||||
have_library(db, 'dbm_open("", 0, 0)', hdr, hsearch)) and
|
have_library(db, 'dbm_open("", 0, 0)', hdr, hsearch)) and
|
||||||
have_func('dbm_clearerr((DBM *)0)', hdr, hsearch)
|
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)
|
have_var("gdbm_version", hdr, hsearch)
|
||||||
# gdbm_version is not declared by ndbm.h until gdbm 1.8.3.
|
# 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.
|
# 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.
|
# ndbm.h includes gdbm.h and gdbm_version is declared since gdbm 1.9.
|
||||||
have_libvar(["gdbm_version", "char *"], hdr, hsearch)
|
have_libvar(["gdbm_version", "char *"], hdr, hsearch)
|
||||||
|
when /\Aqdbm\z/
|
||||||
|
have_var("dpversion", hdr, hsearch)
|
||||||
end
|
end
|
||||||
if hsearch
|
if hsearch
|
||||||
$defs << hsearch
|
$defs << hsearch
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue