blob: eae21ec542c7232cbb82007c4c9c3de63cac8ca3 (
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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
|
#!/bin/sh -
# $Id$
#
# Build Windows include files.
msgc="/* DO NOT EDIT: automatically built by dist/s_windows. */"
msgw="; DO NOT EDIT: automatically built by dist/s_windows."
. RELEASE
s=/tmp/__db_a$$
t=/tmp/__db_b$$
rm -f $s $t
trap 'rm -f $s $t ; exit 1' 1 2 3 13 15
# Build the Windows db.h
cat <<ENDOFSEDTEXT > $s
/@inttypes_h_decl@/d
/@stdint_h_decl@/d
s/@stddef_h_decl@/#include <stddef.h>/
/@unistd_h_decl@/d
/@thread_h_decl@/d
s/@u_int8_decl@/typedef unsigned char u_int8_t;/
s/@int16_decl@/typedef short int16_t;/
s/@u_int16_decl@/typedef unsigned short u_int16_t;/
s/@int32_decl@/typedef int int32_t;/
s/@u_int32_decl@/typedef unsigned int u_int32_t;/
s/@int64_decl@/typedef __int64 int64_t;/
s/@u_int64_decl@/typedef unsigned __int64 u_int64_t;/
s/@db_seq_decl@/typedef int64_t db_seq_t;/
s/@db_threadid_t_decl@/typedef u_int32_t db_threadid_t;/
s/@pid_t_decl@/typedef int pid_t;/
/@u_char_decl@/{
i\\
#ifndef _WINSOCKAPI_
s/@u_char_decl@/typedef unsigned char u_char;/
}
s/@u_short_decl@/typedef unsigned short u_short;/
s/@u_int_decl@/typedef unsigned int u_int;/
/@u_long_decl@/{
s/@u_long_decl@/typedef unsigned long u_long;/
a\\
#endif
}
/@FILE_t_decl@/d
/@size_t_decl@/d
/@ssize_t_decl@/{
i\\
#ifdef _WIN64\\
typedef int64_t ssize_t;\\
#else\\
typedef int32_t ssize_t;\\
#endif
d
}
/@time_t_decl@/d
/@uintmax_t_decl@/{
i\\
#if defined(_MSC_VER) && _MSC_VER < 1300\\
typedef u_int32_t uintmax_t;\\
#else\\
typedef u_int64_t uintmax_t;\\
#endif
d
}
/@uintptr_t_decl@/{
i\\
#ifdef _WIN64\\
typedef u_int64_t uintptr_t;\\
#else\\
typedef u_int32_t uintptr_t;\\
#endif
d
}
/@off_t_decl@/{
i\\
/*\\
\ * Windows defines off_t to long (i.e., 32 bits). We need to pass 64-bit\\
\ * file offsets, so we declare our own.\\
\ */\\
#define off_t __db_off_t\\
typedef int64_t off_t;
d
}
/@platform_header@/{
i\\
/*\\
\ * Turn off inappropriate compiler warnings\\
\ */\\
#ifdef _MSC_VER\\
/*\\
\ * This warning is explicitly disabled in Visual C++ by default.\\
\ * It is necessary to explicitly enable the /Wall flag to generate this\\
\ * warning.\\
\ * Since this is a shared include file it should compile without warnings\\
\ * at the highest warning level, so third party applications can use\\
\ * higher warning levels cleanly.\\
\ *\\
\ * 4820: 'bytes' bytes padding added after member 'member'\\
\ * The type and order of elements caused the compiler to\\
\ * add padding to the end of a struct.\\
\ */\\
#pragma warning(push)\\
#pragma warning(disable: 4820)\\
#endif /* _MSC_VER */
d
}
/@platform_footer@/{
i\\
/* Restore default compiler warnings */\\
#ifdef _MSC_VER\\
#pragma warning(pop)\\
#endif
d
}
s/@DB_VERSION_MAJOR@/$DB_VERSION_MAJOR/
s/@DB_VERSION_MINOR@/$DB_VERSION_MINOR/
s/@DB_VERSION_PATCH@/$DB_VERSION_PATCH/
s/@DB_VERSION_STRING@/"$DB_VERSION_STRING"/
s/@DB_VERSION_UNIQUE_NAME@//
s/@DB_CONST@//
s/@DB_PROTO1@/#undef __P/
s/@DB_PROTO2@/#define __P(protos) protos/
ENDOFSEDTEXT
# The db.h, db_int.h files are identical between Windows and WinCE.
# This may change in the future, for now have the script copy
# the headers into the build_wince directory.
# WinCE does not support the C++ API, so don't need to copy db_cxx.h
(echo "$msgc" &&
sed -f $s ../dbinc/db.in &&
cat ../dbinc_auto/api_flags.in &&
cat ../dbinc_auto/ext_prot.in) > $t
test `egrep '@.*@' $t` && {
egrep '@.*@' $t
echo 'Unexpanded autoconf variables found in Windows db.h.'
exit 1
}
f=../build_windows/db.h
cmp $t $f > /dev/null 2>&1 ||
(echo "Building $f" && rm -f $f && cp $t $f && chmod 444 $f)
f=../build_wince/db.h
cmp $t $f > /dev/null 2>&1 ||
(echo "Building $f" && rm -f $f && cp $t $f && chmod 444 $f)
# Build the Windows db_cxx.h.
cat <<ENDOFSEDTEXT > $s
s/@cxx_have_stdheaders@/#define HAVE_CXX_STDHEADERS 1/
ENDOFSEDTEXT
(echo "$msgc" && sed -f $s ../dbinc/db_cxx.in) > $t
test `egrep '@.*@' $t` && {
egrep '@.*@' $t
echo 'Unexpanded autoconf variables found in Windows db_cxx.h.'
exit 1
}
f=../build_windows/db_cxx.h
cmp $t $f > /dev/null 2>&1 ||
(echo "Building $f" && rm -f $f && cp $t $f && chmod 444 $f)
# Build the Windows db_int.h.
cat <<ENDOFSEDTEXT > $s
s/@PATH_SEPARATOR@/\\\\\\\\\/:/
s/@db_int_def@//
ENDOFSEDTEXT
(echo "$msgc" && sed -f $s ../dbinc/db_int.in) > $t
test `egrep '@.*@' $t` && {
egrep '@.*@' $t
echo 'Unexpanded autoconf variables found in Windows db_int.h.'
exit 1
}
f=../build_windows/db_int.h
cmp $t $f > /dev/null 2>&1 ||
(echo "Building $f" && rm -f $f && cp $t $f && chmod 444 $f)
f=../build_wince/db_int.h
cmp $t $f > /dev/null 2>&1 ||
(echo "Building $f" && rm -f $f && cp $t $f && chmod 444 $f)
# Build the Windows and WinCE db_config.h.
# We don't fail, but we complain if the win_config.in file isn't up-to-date.
check_config()
{
egrep '^#undef' config.hin | awk '{print $2}' | sort > $s
(egrep '#undef' $1 | awk '{print $3}'
egrep '^#define' $1 | awk '{print $2}') | sed '/__STDC__/d' | sort > $t
cmp $s $t > /dev/null || {
echo "config.hin and $1 differ"
echo "<<< config.hin >>> $1"
diff $s $t
}
}
check_config win_config.in
f=../build_windows/db_config.h
(echo "$msgc" && sed "s/__EDIT_DB_VERSION__/$DB_VERSION/" win_config.in) > $t
cmp $t $f > /dev/null 2>&1 ||
(echo "Building $f" && rm -f $f && cp $t $f && chmod 444 $f)
check_config wince_config.in
f=../build_wince/db_config.h
(echo "$msgc" && sed "s/__EDIT_DB_VERSION__/$DB_VERSION/" wince_config.in) > $t
cmp $t $f > /dev/null 2>&1 ||
(echo "Building $f" && rm -f $f && cp $t $f && chmod 444 $f)
# Build the Windows libdb.rc and libdb.def.
f=../build_windows/libdb.rc
cat <<ENDOFSEDTEXT > $s
s/%MAJOR%/$DB_VERSION_MAJOR/
s/%MINOR%/$DB_VERSION_MINOR/
s/%PATCH%/$DB_VERSION_PATCH/
ENDOFSEDTEXT
sed -f $s ../build_windows/libdbrc.src > $t
cmp $t $f > /dev/null 2>&1 ||
(echo "Building $f" && rm -f $f && cp $t $f && chmod 444 $f)
f=../build_windows/libdb.def
(echo $msgw &&
echo &&
echo EXPORTS;
a=1
for i in `sed -e '/^$/d' -e '/^#/d' win_exports.in`; do
echo " $i @$a"
a=`expr $a + 1`
done) > $t
cmp $t $f > /dev/null 2>&1 ||
(echo "Building $f" && rm -f $f && cp $t $f && chmod 444 $f)
# Build the Windows clib_port.h.
cat <<ENDOFSEDTEXT > $s
s/@INT64_FMT@/#define INT64_FMT "%I64d"/
s/@UINT64_FMT@/#define UINT64_FMT "%I64u"/
ENDOFSEDTEXT
sed -f $s clib_port.in > $t
test `egrep '@.*@' $t` && {
egrep '@.*@' $t
echo 'Unexpanded autoconf variables found in Windows clib_port.h.'
exit 1
}
f=../build_windows/clib_port.h
cmp $t $f > /dev/null 2>&1 ||
(echo "Building $f" && rm -f $f && cp $t $f && chmod 444 $f)
f=../build_wince/clib_port.h
cmp $t $f > /dev/null 2>&1 ||
(echo "Building $f" && rm -f $f && cp $t $f && chmod 444 $f)
# Build the Windows dbstl_common.h.
cat <<ENDOFSEDTEXT > $s
s/@WSTRING_decl@/#define HAVE_WSTRING 1/
s/@TLS_decl@/#define TLS_DECL_MODIFIER __declspec(thread)/
s/@TLS_defn@/#define TLS_DEFN_MODIFIER __declspec(thread)/
ENDOFSEDTEXT
sed -f $s ../stl/dbstl_common.in > $t
f=../build_windows/dbstl_common.h
cmp $t $f > /dev/null 2>&1 ||
(echo "Building $f" && rm -f $f && cp $t $f && chmod 444 $f)
# Copy in errno.h.
f=../build_wince/errno.h
cmp errno.h $f > /dev/null 2>&1 ||
(echo "Building $f" && rm -f $f && cp errno.h $f && chmod 444 $f)
rm -f $s $t
|