1 ?RCS: $Id: i_db.U,v 3.0.1.3 1995/07/25 14:10:22 ram Exp $
3 ?RCS: Copyright (c) 1991-1993, Raphael Manfredi
5 ?RCS: You may redistribute only under the terms of the Artistic Licence,
6 ?RCS: as specified in the README file that comes with the distribution.
7 ?RCS: You may reuse parts of this distribution only within the terms of
8 ?RCS: that same Artistic Licence; a copy of which may be found at the root
9 ?RCS: of the source tree for dist 3.0.
11 ?RCS: Original Author: Andy Dougherty <doughera@lafcol.lafayette.edu>
13 ?RCS: $Log: i_db.U,v $
14 ?RCS: Revision 3.0.1.3 1995/07/25 14:10:22 ram
15 ?RCS: patch56: conditionally use const in test programs (ADO)
17 ?RCS: Revision 3.0.1.2 1995/05/12 12:14:42 ram
18 ?RCS: patch54: extended for more intimate DB probing (ADO)
20 ?RCS: Revision 3.0.1.1 1994/08/29 16:21:50 ram
21 ?RCS: patch32: created by ADO
23 ?MAKE:i_db db_hashtype db_prefixtype: Inhdr +cc +ccflags rm contains cat \
24 Compile d_const libs sed
25 ?MAKE: -pick add $@ %<
27 ?S: This variable conditionally defines the I_DB symbol, and indicates
28 ?S: whether a C program may include Berkeley's DB include file <db.h>.
31 ?S: This variable contains the type of the hash structure element
32 ?S: in the <db.h> header file. In older versions of DB, it was
33 ?S: int, while in newer ones it is u_int32_t.
36 ?S: This variable contains the type of the prefix structure element
37 ?S: in the <db.h> header file. In older versions of DB, it was
38 ?S: int, while in newer ones it is size_t.
41 ?C: This symbol, if defined, indicates to the C program that it should
42 ?C: include Berkeley's DB include file <db.h>.
45 ?C: This symbol contains the type of the prefix structure element
46 ?C: in the <db.h> header file. In older versions of DB, it was
47 ?C: int, while in newer ones it is u_int32_t.
50 ?C: This symbol contains the type of the prefix structure element
51 ?C: in the <db.h> header file. In older versions of DB, it was
52 ?C: int, while in newer ones it is size_t.
55 ?H:#define DB_Hash_t $db_hashtype /**/
56 ?H:#define DB_Prefix_t $db_prefixtype /**/
60 : see if this is a db.h system
68 echo "Checking Berkeley DB version ..." >&4
74 #include <sys/types.h>
79 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
80 int Major, Minor, Patch ;
81 unsigned long Version ;
82 (void)db_version(&Major, &Minor, &Patch) ;
83 printf("You have Berkeley DB Version 2 or greater\n");
85 printf("db.h is from Berkeley DB Version %d.%d.%d\n",
86 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
87 printf("libdb is from Berkeley DB Version %d.%d.%d\n",
88 Major, Minor, Patch) ;
90 /* check that db.h & libdb are compatible */
91 if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
92 printf("db.h and libdb are incompatible\n") ;
96 printf("db.h and libdb are compatible\n") ;
98 Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
101 /* needs to be >= 2.3.4 */
102 if (Version < 2003004) {
103 /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
104 printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
110 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
111 printf("You have Berkeley DB Version 1\n");
112 exit(0); /* DB version < 2: the coast is clear. */
114 exit(1); /* <db.h> not Berkeley DB? */
120 if eval $compile_ok && ./try; then
123 echo "I can't use Berkeley DB with your <db.h>. I'll disable Berkeley DB." >&4
127 : Remove db from list of libraries to use
128 echo "Removing unusable -ldb from library list" >&4
129 set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
132 echo "libs = $libs" >&4
143 : Check the return type needed for hash
145 echo "Checking return type needed for hash for Berkeley DB ..." >&4
151 #include <sys/types.h>
154 #ifndef DB_VERSION_MAJOR
155 u_int32_t hash_cb (ptr, size)
167 if $cc $ccflags -c try.c >try.out 2>&1 ; then
168 if $contains warning try.out >>/dev/null 2>&1 ; then
171 db_hashtype='u_int32_t'
174 : XXX Maybe we should just give up here.
175 db_hashtype=u_int32_t
177 echo "Help: I can't seem to compile the db test program." >&4
178 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
181 echo "Your version of Berkeley DB uses $db_hashtype for hash."
183 *) db_hashtype=u_int32_t
190 : Check the return type needed for prefix
192 echo "Checking return type needed for prefix for Berkeley DB ..." >&4
198 #include <sys/types.h>
201 #ifndef DB_VERSION_MAJOR
202 size_t prefix_cb (key1, key2)
210 info.prefix = prefix_cb;
214 if $cc $ccflags -c try.c >try.out 2>&1 ; then
215 if $contains warning try.out >>/dev/null 2>&1 ; then
218 db_prefixtype='size_t'
221 db_prefixtype='size_t'
222 : XXX Maybe we should just give up here.
224 echo "Help: I can't seem to compile the db test program." >&4
225 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
228 echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
230 *) db_prefixtype='size_t'