mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* ext/dbm/dbm.c (Init_dbm): refine DBM::VERSION definition.
* ext/dbm/extconf.rb: provide RUBYDBM_GDBM_HEADER macro. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34696 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
87a15a6981
commit
95f3f9829f
3 changed files with 29 additions and 12 deletions
|
@ -1,3 +1,9 @@
|
|||
Sun Feb 19 23:01:01 2012 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* ext/dbm/dbm.c (Init_dbm): refine DBM::VERSION definition.
|
||||
|
||||
* ext/dbm/extconf.rb: provide RUBYDBM_GDBM_HEADER macro.
|
||||
|
||||
Sun Feb 19 17:07:27 2012 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* test/dbm/test_dbm.rb (test_dbmfile_suffix): check pag and dir is
|
||||
|
|
|
@ -1079,27 +1079,35 @@ Init_dbm(void)
|
|||
*/
|
||||
rb_define_const(rb_cDBM, "NEWDB", INT2FIX(O_RDWR|O_CREAT|O_TRUNC|RUBY_DBM_RW_BIT));
|
||||
|
||||
#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(NULL, NULL, NULL)));
|
||||
#elif defined(HAVE_DECLARED_LIBVAR_GDBM_VERSION)
|
||||
#if defined(_DBM_IOERR)
|
||||
rb_define_const(rb_cDBM, "VERSION", rb_str_new2("NDBM (4.3BSD)"));
|
||||
#elif defined(RUBYDBM_GDBM_HEADER)
|
||||
# if defined(HAVE_DECLARED_LIBVAR_GDBM_VERSION)
|
||||
/* since gdbm 1.9 */
|
||||
rb_define_const(rb_cDBM, "VERSION", rb_str_new2(gdbm_version));
|
||||
#elif defined(HAVE_UNDECLARED_LIBVAR_GDBM_VERSION)
|
||||
# elif defined(HAVE_UNDECLARED_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)"));
|
||||
#elif defined(_GDBM_H_) || defined(HAVE_EMPTY_MACRO_DBM_CLEARERR)
|
||||
# else
|
||||
rb_define_const(rb_cDBM, "VERSION", rb_str_new2("GDBM (unknown)"));
|
||||
#elif defined(_DBM_IOERR)
|
||||
rb_define_const(rb_cDBM, "VERSION", rb_str_new2("NDBM (4.3BSD)"));
|
||||
# endif
|
||||
#elif defined(_DB_H_)
|
||||
# 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(NULL, NULL, NULL)));
|
||||
# else
|
||||
rb_define_const(rb_cDBM, "VERSION", rb_str_new2("Berkeley DB (unknown)"));
|
||||
# endif
|
||||
#elif defined(_RELIC_H)
|
||||
# if defined(HAVE_DPVERSION)
|
||||
rb_define_const(rb_cDBM, "VERSION", rb_sprintf("QDBM %s", dpversion));
|
||||
# else
|
||||
rb_define_const(rb_cDBM, "VERSION", rb_str_new2("QDBM (unknown)"));
|
||||
# endif
|
||||
#else
|
||||
rb_define_const(rb_cDBM, "VERSION", rb_str_new2("unknown"));
|
||||
#endif
|
||||
|
|
|
@ -173,6 +173,9 @@ def headers.db_check2(db, hdr)
|
|||
end
|
||||
|
||||
have_gdbm_header_macro = have_gdbm_header_macro1 | have_gdbm_header_macro2
|
||||
if have_gdbm_header_macro
|
||||
$defs.push('-DRUBYDBM_GDBM_HEADER')
|
||||
end
|
||||
|
||||
# ndbm.h is provided by the original (4.3BSD) dbm,
|
||||
# Berkeley DB 1 in libc of 4.4BSD and
|
||||
|
|
Loading…
Reference in a new issue