This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Populate metaconfig branch.
[metaconfig.git] / dist-3.0at70b / mcon / U / i_db.U
1 ?RCS: $Id: i_db.U,v 3.0.1.3 1995/07/25 14:10:22 ram Exp $
2 ?RCS:
3 ?RCS: Copyright (c) 1991-1993, Raphael Manfredi
4 ?RCS: 
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.
10 ?RCS:
11 ?RCS: Original Author: Andy Dougherty <doughera@lafcol.lafayette.edu>
12 ?RCS:
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)
16 ?RCS:
17 ?RCS: Revision 3.0.1.2  1995/05/12  12:14:42  ram
18 ?RCS: patch54: extended for more intimate DB probing (ADO)
19 ?RCS:
20 ?RCS: Revision 3.0.1.1  1994/08/29  16:21:50  ram
21 ?RCS: patch32: created by ADO
22 ?RCS:
23 ?MAKE:i_db db_hashtype db_prefixtype: Inhdr +cc +ccflags rm contains cat \
24                 d_const
25 ?MAKE:  -pick add $@ %<
26 ?S:i_db:
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>.
29 ?S:.
30 ?S:db_hashtype:
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.
34 ?S:.
35 ?S:db_prefixtype:
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.
39 ?S:.
40 ?C:I_DB:
41 ?C:     This symbol, if defined, indicates to the C program that it should
42 ?C:     include Berkeley's DB include file <db.h>.
43 ?C:.
44 ?C:DB_Prefix_t:
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.
48 ?C:.
49 ?C:DB_Hash_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.
53 ?C:.
54 ?H:#$i_db I_DB          /**/
55 ?H:#define DB_Hash_t    $db_hashtype            /**/
56 ?H:#define DB_Prefix_t  $db_prefixtype          /**/
57 ?H:.
58 ?LINT:set i_db
59 : see if this is a db.h system
60 set db.h i_db
61 eval $inhdr
62
63 @if DB_Hash_t
64 case "$i_db" in
65 define)
66         : Check the return type needed for hash 
67         echo " "
68         echo "Checking return type needed for hash for Berkeley DB ..." >&4
69         $cat >try.c <<EOCP
70 #$d_const HASCONST
71 #ifndef HASCONST
72 #define const
73 #endif
74 #include <sys/types.h>
75 #include <db.h>
76 u_int32_t hash_cb (ptr, size)
77 const void *ptr;
78 size_t size;
79 {
80 }
81 HASHINFO info;
82 main()
83 {
84         info.hash = hash_cb;
85 }
86 EOCP
87         if $cc $ccflags -c try.c >try.out 2>&1 ; then
88                 if $contains warning try.out >>/dev/null 2>&1 ; then
89                         db_hashtype='int'
90                 else
91                         db_hashtype='u_int32_t'
92                 fi
93         else
94                 echo "I can't seem to compile the test program." >&4
95                 db_hashtype=int
96         fi
97         $rm -f try.*
98         echo "Your version of Berkeley DB uses $db_hashtype for hash."
99         ;;
100 *)      db_hashtype=int
101         ;;
102 esac
103
104 @end
105 @if DB_Prefix_t
106 case "$i_db" in
107 define)
108         : Check the return type needed for prefix 
109         echo " "
110         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
111         cat >try.c <<EOCP
112 #$d_const HASCONST
113 #ifndef HASCONST
114 #define const
115 #endif
116 #include <sys/types.h>
117 #include <db.h>
118 size_t prefix_cb (key1, key2)
119 const DBT *key1;
120 const DBT *key2;
121 {
122 }
123 BTREEINFO info;
124 main()
125 {
126         info.prefix = prefix_cb;
127 }
128 EOCP
129         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
130                 if $contains warning try.out >>/dev/null 2>&1 ; then
131                         db_prefixtype='int'
132                 else
133                         db_prefixtype='size_t'
134                 fi
135         else
136                 echo "I can't seem to compile the test program." >&4
137                 db_prefixtype='int'
138         fi
139         $rm -f try.*
140         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
141         ;;
142 *)      db_prefixtype='int'
143         ;;
144 esac
145
146 @end