3
version.c -- Perl 5 interface to Berkeley DB
5
written by Paul Marquess <Paul.Marquess@btinternet.com>
6
last modified 2nd Jan 2002
9
All comments/suggestions/problems are welcome
11
Copyright (c) 1995-2002 Paul Marquess. All rights reserved.
12
This program is free software; you can redistribute it and/or
13
modify it under the same terms as Perl itself.
16
1.71 - Support for Berkeley DB version 3.
17
Support for Berkeley DB 2/3's backward compatability mode.
19
1.73 - Added support for threading
20
1.74 - Added Perl core patch 7801.
25
#define PERL_NO_GET_CONTEXT
34
__getBerkeleyDBInfo(void)
42
SV * version_sv = perl_get_sv("DB_File::db_version", GV_ADD|GV_ADDMULTI) ;
43
SV * ver_sv = perl_get_sv("DB_File::db_ver", GV_ADD|GV_ADDMULTI) ;
44
SV * compat_sv = perl_get_sv("DB_File::db_185_compat", GV_ADD|GV_ADDMULTI) ;
46
#ifdef DB_VERSION_MAJOR
47
int Major, Minor, Patch ;
49
(void)db_version(&Major, &Minor, &Patch) ;
51
/* Check that the versions of db.h and libdb.a are the same */
52
if (Major != DB_VERSION_MAJOR || Minor != DB_VERSION_MINOR
53
|| Patch != DB_VERSION_PATCH)
54
croak("\nDB_File needs compatible versions of libdb & db.h\n\tyou have db.h version %d.%d.%d and libdb version %d.%d.%d\n",
55
DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
56
Major, Minor, Patch) ;
58
/* check that libdb is recent enough -- we need 2.3.4 or greater */
59
if (Major == 2 && (Minor < 3 || (Minor == 3 && Patch < 4)))
60
croak("DB_File needs Berkeley DB 2.3.4 or greater, you have %d.%d.%d\n",
61
Major, Minor, Patch) ;
65
sprintf(buffer, "%d.%d", Major, Minor) ;
66
sv_setpv(version_sv, buffer) ;
67
sprintf(buffer, "%d.%03d%03d", Major, Minor, Patch) ;
68
sv_setpv(ver_sv, buffer) ;
71
#else /* ! DB_VERSION_MAJOR */
72
sv_setiv(version_sv, 1) ;
74
#endif /* ! DB_VERSION_MAJOR */
77
sv_setiv(compat_sv, 1) ;
78
#else /* ! COMPAT185 */
79
sv_setiv(compat_sv, 0) ;
80
#endif /* ! COMPAT185 */