1#!/bin/sh -
2#	$Id: s_sig,v 12.4 2008/03/25 12:18:09 mjc Exp $
3#
4# Build structure signature code.
5
6a=/tmp/__db_a.$$
7b=/tmp/__db_b.$$
8trap 'rm -f $a $b; exit 0' 0 1 2 3 13 15
9
10cat ../dbinc/*.in ../dbinc/*.h | 
11sed -e '/__addrinfo/d' \
12    -e '/__aes_cipher/d' \
13    -e '/__cipher/d' \
14    -e '/__queued_output/d' \
15    -e '/__repmgr_connection/d' \
16    -e '/__repmgr_message/d' \
17    -e '/__repmgr_retry/d' \
18    -e '/__repmgr_runnable/d' \
19    -e '/__repmgr_site/d' \
20    -e '/struct.*mutex.*{/i\
21#ifdef	HAVE_MUTEX_SUPPORT' \
22    -e '/struct.*mutex.*{/a\
23#endif' \
24    -e 's/.*[	 ]*struct[	 ]*\(__[a-z_]*\)[	 ]*{.*/	__ADD(\1);/p' \
25    -e d > $a
26
27cnt=`sed -e '$=' -e d $a`
28
29cat << END_OF_TEXT > $b
30/*-
31 * DO NOT EDIT: automatically built by dist/s_sig.
32 *
33 * $Id: s_sig,v 12.4 2008/03/25 12:18:09 mjc Exp $
34 */
35
36#include "db_config.h"
37
38#define	__INCLUDE_NETWORKING	1
39#define __INCLUDE_SELECT_H      1
40#include "db_int.h"
41
42#include "dbinc/db_page.h"
43#include "dbinc/btree.h"
44#include "dbinc/crypto.h"
45#include "dbinc/db_join.h"
46#include "dbinc/db_verify.h"
47#include "dbinc/hash.h"
48#include "dbinc/lock.h"
49#include "dbinc/log.h"
50#include "dbinc/mp.h"
51#ifdef HAVE_MUTEX_SUPPORT
52#include "dbinc/mutex_int.h"
53#endif
54#include "dbinc/qam.h"
55#include "dbinc/txn.h"
56
57END_OF_TEXT
58
59echo "#define	__STRUCTURE_COUNT	$cnt" >> $b
60
61cat << END_OF_TEXT >> $b
62
63/*
64 * __env_struct_sig --
65 *	Compute signature of structures.
66 *
67 * PUBLIC: u_int32_t __env_struct_sig __P((void));
68 */
69u_int32_t
70__env_struct_sig()
71{
72	u_short t[__STRUCTURE_COUNT + 5];
73	u_int i;
74
75	i = 0;
76#define	__ADD(s)	(t[i++] = sizeof(struct s))
77
78END_OF_TEXT
79
80cat $a >> $b
81
82cat << END_OF_TEXT >> $b
83
84	return (__ham_func5(NULL, t, i * sizeof(t[0])));
85}
86END_OF_TEXT
87
88f=../env/env_sig.c
89cmp $b $f > /dev/null 2>&1 ||
90    (echo "Building $f" && rm -f $f && cp $b $f && chmod 444 $f)
91