summaryrefslogtreecommitdiff
path: root/mcon/U/i_db.U
blob: 9391a7ccc1f21afebff5d50a72a7285eb003fb24 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
?RCS: $Id: i_db.U 167 2013-05-08 17:58:00Z rmanfredi $
?RCS:
?RCS: Copyright (c) 1991-1997, 2004-2006, Raphael Manfredi
?RCS: 
?RCS: You may redistribute only under the terms of the Artistic License,
?RCS: as specified in the README file that comes with the distribution.
?RCS: You may reuse parts of this distribution only within the terms of
?RCS: that same Artistic License; a copy of which may be found at the root
?RCS: of the source tree for dist 4.0.
?RCS:
?RCS: Original Author: Andy Dougherty <doughera@lafcol.lafayette.edu>
?RCS:
?RCS: $Log: i_db.U,v $
?RCS: Revision 3.0.1.3  1995/07/25  14:10:22  ram
?RCS: patch56: conditionally use const in test programs (ADO)
?RCS:
?RCS: Revision 3.0.1.2  1995/05/12  12:14:42  ram
?RCS: patch54: extended for more intimate DB probing (ADO)
?RCS:
?RCS: Revision 3.0.1.1  1994/08/29  16:21:50  ram
?RCS: patch32: created by ADO
?RCS:
?MAKE:i_db db_hashtype db_prefixtype: Inhdr +cc +ccflags rm contains cat \
		d_const
?MAKE:	-pick add $@ %<
?S:i_db:
?S:	This variable conditionally defines the I_DB symbol, and indicates
?S:	whether a C program may include Berkeley's DB include file <db.h>.
?S:.
?S:db_hashtype:
?S:	This variable contains the type of the hash structure element
?S:	in the <db.h> header file.  In older versions of DB, it was
?S:	int, while in newer ones it is u_int32_t.
?S:.
?S:db_prefixtype:
?S:	This variable contains the type of the prefix structure element
?S:	in the <db.h> header file.  In older versions of DB, it was
?S:	int, while in newer ones it is size_t.
?S:.
?C:I_DB:
?C:	This symbol, if defined, indicates to the C program that it should
?C:	include Berkeley's DB include file <db.h>.
?C:.
?C:DB_Prefix_t:
?C:	This symbol contains the type of the prefix structure element
?C:	in the <db.h> header file.  In older versions of DB, it was
?C:	int, while in newer ones it is u_int32_t.
?C:.
?C:DB_Hash_t:
?C:	This symbol contains the type of the prefix structure element
?C:	in the <db.h> header file.  In older versions of DB, it was
?C:	int, while in newer ones it is size_t.
?C:.
?H:#$i_db I_DB		/**/
?H:#define DB_Hash_t	$db_hashtype		/**/
?H:#define DB_Prefix_t	$db_prefixtype  	/**/
?H:.
?LINT:set i_db
: see if this is a db.h system
set db.h i_db
eval $inhdr

@if DB_Hash_t
case "$i_db" in
define)
	: Check the return type needed for hash 
	echo " "
	echo "Checking return type needed for hash for Berkeley DB ..." >&4
	$cat >try.c <<EOCP
#$d_const HASCONST
#ifndef HASCONST
#define const
#endif
#include <sys/types.h>
#include <db.h>
u_int32_t hash_cb (ptr, size)
const void *ptr;
size_t size;
{
}
HASHINFO info;
int main()
{
	info.hash = hash_cb;
}
EOCP
	if $cc $ccflags -c try.c >try.out 2>&1 ; then
		if $contains warning try.out >>/dev/null 2>&1 ; then
			db_hashtype='int'
		else
			db_hashtype='u_int32_t'
		fi
	else
		echo "I can't seem to compile the test program." >&4
		db_hashtype=int
	fi
	$rm -f try.*
	echo "Your version of Berkeley DB uses $db_hashtype for hash."
	;;
*)	db_hashtype=int
	;;
esac

@end
@if DB_Prefix_t
case "$i_db" in
define)
	: Check the return type needed for prefix 
	echo " "
	echo "Checking return type needed for prefix for Berkeley DB ..." >&4
	cat >try.c <<EOCP
#$d_const HASCONST
#ifndef HASCONST
#define const
#endif
#include <sys/types.h>
#include <db.h>
size_t prefix_cb (key1, key2)
const DBT *key1;
const DBT *key2;
{
}
BTREEINFO info;
int main()
{
	info.prefix = prefix_cb;
}
EOCP
	if $cc $ccflags -c try.c  >try.out 2>&1 ; then
		if $contains warning try.out >>/dev/null 2>&1 ; then
			db_prefixtype='int'
		else
			db_prefixtype='size_t'
		fi
	else
		echo "I can't seem to compile the test program." >&4
		db_prefixtype='int'
	fi
	$rm -f try.*
	echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
	;;
*)	db_prefixtype='int'
	;;
esac

@end