#!/bin/sh -
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
cat <<ENDOFSEDTEXT > $s
/@inttypes_h_decl@/d
/@stdint_h_decl@/d
s/@stddef_h_decl@//@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\\
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\\
}
/@FILE_t_decl@/d
/@size_t_decl@/d
/@ssize_t_decl@/{
i\\
typedef int64_t ssize_t;\\
typedef int32_t ssize_t;\\
d
}
/@time_t_decl@/d
s/@uintmax_t_decl@/typedef u_int64_t uintmax_t;/
/@uintptr_t_decl@/{
i\\
typedef u_int64_t uintptr_t;\\
typedef u_int32_t uintptr_t;\\
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.\\
\ */\\
typedef int64_t off_t;
d
}
/@platform_header@/{
i\\
/*\\
\ * Turn off inappropriate compiler warnings\\
\ */\\
/*\\
\ * 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.\\
\ */\\
d
}
/@platform_footer@/{
i\\
/* Restore default compiler warnings */\\
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@/s/@DB_PROTO2@/ENDOFSEDTEXT
(echo "$msgc" &&
sed -f $s ../dbinc/db.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)
cat <<ENDOFSEDTEXT > $s
s/@cxx_have_stdheaders@/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)
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)
check_config()
{
egrep '^ (egrep ' egrep '^ 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)
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 '/^ 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)
cat <<ENDOFSEDTEXT > $s
s/@INT64_FMT@/s/@UINT64_FMT@/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)
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