| 1 | #!/bin/sh - |
| 2 | # $Id$ |
| 3 | # |
| 4 | # Build structure signature code. |
| 5 | |
| 6 | a=/tmp/__db_a.$$ |
| 7 | b=/tmp/__db_b.$$ |
| 8 | c=/tmp/__db_c.$$ |
| 9 | trap 'rm -f $a $b $c; exit 0' 0 1 2 3 13 15 |
| 10 | |
| 11 | cat ../src/dbinc/db.in ../src/dbinc/db_int.in ../src/dbinc/*.h | |
| 12 | sed -e '/.*struct.*mutex.*{[ ]*\/\* SHARED \*\/.*/i\ |
| 13 | #ifdef HAVE_MUTEX_SUPPORT' \ |
| 14 | -e '/.*struct.*mutex.*{[ ]*\/\* SHARED \*\/.*/a\ |
| 15 | #endif' \ |
| 16 | -e 's/.*[ ]*\(__[a-z_]*\)[ ]*{[ ]*\/\* SHARED \*\/.*/ __ADD(\1);/p' \ |
| 17 | -e d > $a |
| 18 | |
| 19 | cat ../src/dbinc/db.in ../src/dbinc/db_int.in ../src/dbinc/*.h | |
| 20 | sed -e '/__addrinfo/d' \ |
| 21 | -e '/__aes_cipher/d' \ |
| 22 | -e '/__cipher/d' \ |
| 23 | -e '/__channel/d' \ |
| 24 | -e '/__queued_output/d' \ |
| 25 | -e '/__repmgr_connection/d' \ |
| 26 | -e '/__repmgr_message/d' \ |
| 27 | -e '/__repmgr_response/d' \ |
| 28 | -e '/__repmgr_retry/d' \ |
| 29 | -e '/__repmgr_runnable/d' \ |
| 30 | -e '/__repmgr_site/d' \ |
| 31 | -e '/.*[ ]*\(__[a-z_]*\)[ ]*{[ ]*\/\* SHARED \*\/.*/d' \ |
| 32 | -e '/struct.*mutex.*{/i\ |
| 33 | #ifdef HAVE_MUTEX_SUPPORT' \ |
| 34 | -e '/struct.*mutex.*{/a\ |
| 35 | #endif' \ |
| 36 | -e 's/.*[ ]*struct[ ]*\(__[a-z_]*\)[ ]*{.*/ __ADD(\1);/p' \ |
| 37 | -e d > $c |
| 38 | |
| 39 | cnt1=`sed -e '$=' -e d $a` |
| 40 | cnt2=`sed -e '$=' -e d $c` |
| 41 | |
| 42 | cat << END_OF_TEXT > $b |
| 43 | /*- |
| 44 | * DO NOT EDIT: automatically built by dist/s_sig. |
| 45 | * |
| 46 | * \$Id$ |
| 47 | */ |
| 48 | |
| 49 | #include "db_config.h" |
| 50 | |
| 51 | #include "db_int.h" |
| 52 | |
| 53 | #include "dbinc/db_page.h" |
| 54 | #include "dbinc/btree.h" |
| 55 | #include "dbinc/crypto.h" |
| 56 | #include "dbinc/db_join.h" |
| 57 | #include "dbinc/db_verify.h" |
| 58 | #include "dbinc/hash.h" |
| 59 | #include "dbinc/heap.h" |
| 60 | #include "dbinc/lock.h" |
| 61 | #include "dbinc/log_verify.h" |
| 62 | #include "dbinc/mp.h" |
| 63 | #include "dbinc/partition.h" |
| 64 | #include "dbinc/qam.h" |
| 65 | #include "dbinc/txn.h" |
| 66 | |
| 67 | END_OF_TEXT |
| 68 | cat << END_OF_TEXT >> $b |
| 69 | /* |
| 70 | * For a pure 32bit/64bit environment, we check all structures and calculate a |
| 71 | * signature. For compatible environment, we only check the structures in |
| 72 | * shared memory. |
| 73 | */ |
| 74 | END_OF_TEXT |
| 75 | echo "#ifdef HAVE_MIXED_SIZE_ADDRESSING" >> $b |
| 76 | echo "#define __STRUCTURE_COUNT $cnt1" >> $b |
| 77 | echo "#else" >> $b |
| 78 | echo "#define __STRUCTURE_COUNT ($cnt1 + $cnt2)" >> $b |
| 79 | echo "#endif" >> $b |
| 80 | |
| 81 | cat << END_OF_TEXT >> $b |
| 82 | |
| 83 | /* |
| 84 | * __env_struct_sig -- |
| 85 | * Compute signature of structures. |
| 86 | * |
| 87 | * PUBLIC: u_int32_t __env_struct_sig __P((void)); |
| 88 | */ |
| 89 | u_int32_t |
| 90 | __env_struct_sig() |
| 91 | { |
| 92 | u_short t[__STRUCTURE_COUNT + 5]; |
| 93 | u_int i; |
| 94 | |
| 95 | i = 0; |
| 96 | #define __ADD(s) (t[i++] = sizeof(struct s)) |
| 97 | |
| 98 | END_OF_TEXT |
| 99 | |
| 100 | cat $a >> $b |
| 101 | |
| 102 | cat << END_OF_TEXT >> $b |
| 103 | |
| 104 | #ifndef HAVE_MIXED_SIZE_ADDRESSING |
| 105 | END_OF_TEXT |
| 106 | |
| 107 | cat $c >> $b |
| 108 | |
| 109 | echo "#endif" >> $b |
| 110 | |
| 111 | cat << END_OF_TEXT >> $b |
| 112 | |
| 113 | return (__ham_func5(NULL, t, i * sizeof(t[0]))); |
| 114 | } |
| 115 | END_OF_TEXT |
| 116 | |
| 117 | f=../src/env/env_sig.c |
| 118 | cmp $b $f > /dev/null 2>&1 || |
| 119 | (echo "Building $f" && rm -f $f && cp $b $f) |