ruby-changes:21914
From: akr <ko1@a...>
Date: Tue, 6 Dec 2011 19:21:22 +0900 (JST)
Subject: [ruby-changes:21914] akr:r33963 (trunk): * ext/dbm/dbm.c: use db_version() instead of DB_VERSION_STRING for
akr 2011-12-06 19:21:12 +0900 (Tue, 06 Dec 2011) New Revision: 33963 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=33963 Log: * 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] Modified files: trunk/ChangeLog trunk/ext/dbm/dbm.c trunk/ext/dbm/extconf.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 33962) +++ ChangeLog (revision 33963) @@ -1,3 +1,11 @@ +Tue Dec 6 18:26:33 2011 Tanaka Akira <akr@f...> + + * 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@f...> * ext/dbm/extconf.rb: detect gdbm_version in libgdbm. Index: ext/dbm/dbm.c =================================================================== --- ext/dbm/dbm.c (revision 33962) +++ ext/dbm/dbm.c (revision 33963) @@ -1076,21 +1076,21 @@ */ 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 Index: ext/dbm/extconf.rb =================================================================== --- ext/dbm/extconf.rb (revision 33962) +++ ext/dbm/extconf.rb (revision 33963) @@ -80,12 +80,17 @@ (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 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/