source: trunk/third/rpm/db/dist/s_include @ 19079

Revision 19079, 4.2 KB checked in by ghudson, 22 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r19078, which included commits to RCS files with non-trunk default branches.
  • Property svn:executable set to *
Line 
1#!/bin/sh -
2#       Id: s_include,v 1.19 2002/03/27 04:31:50 bostic Exp
3#
4# Build the automatically generated function prototype files.
5
6msgc="/* DO NOT EDIT: automatically built by dist/s_include. */"
7
8. ./RELEASE
9
10head()
11{
12        defonly=0
13        while :
14                do case "$1" in
15                space)
16                        echo ""; shift;;
17                defonly)
18                        defonly=1; shift;;
19                *)
20                        name="$1"; break;;
21                esac
22        done
23
24        echo "$msgc"
25        echo "#ifndef   $name"
26        echo "#define   $name"
27        echo ""
28        if [ $defonly -eq 0 ]; then
29                echo "#if defined(__cplusplus)"
30                echo "extern \"C\" {"
31                echo "#endif"
32                echo ""
33        fi
34}
35
36tail()
37{
38        defonly=0
39        while :
40                do case "$1" in
41                defonly)
42                        defonly=1; shift;;
43                *)
44                        name="$1"; break;;
45                esac
46        done
47
48        echo ""
49        if [ $defonly -eq 0 ]; then
50                echo "#if defined(__cplusplus)"
51                echo "}"
52                echo "#endif"
53        fi
54        echo "#endif /* !$name */"
55}
56
57# We are building several files:
58#       1 external #define file
59#       1 external prototype file
60#       1 internal #define file
61#       N internal prototype files
62e_dfile=/tmp/__db_c.$$
63e_pfile=/tmp/__db_a.$$
64i_dfile=/tmp/__db_d.$$
65i_pfile=/tmp/__db_b.$$
66trap 'rm -f $e_dfile $e_pfile $i_dfile $i_pfile; exit 0' 0 1 2 3 13 15
67
68head defonly space _DB_EXT_DEF_IN_ > $e_dfile
69head space _DB_EXT_PROT_IN_ > $e_pfile
70head defonly _DB_INT_DEF_IN_ > $i_dfile
71
72# Process the standard directories, creating per-directory prototype
73# files and adding to the external prototype and #define files.
74for i in db btree clib common crypto dbreg env fileops hash hmac \
75    lock log mp mutex os qam rep rpc_client rpc_server tcl txn xa; do
76        head "_${i}_ext_h_" > $i_pfile
77
78        f="../$i/*.c"
79        [ $i = os ] && f="$f ../os_win32/*.c"
80        [ $i = rpc_server ] && f="../$i/c/*.c"
81        [ $i = crypto ] && f="../$i/*.c ../$i/*/*.c"
82        awk -f gen_inc.awk \
83            -v db_version_unique_name=$DB_VERSION_UNIQUE_NAME \
84            -v e_dfile=$e_dfile \
85            -v e_pfile=$e_pfile \
86            -v i_dfile=$i_dfile \
87            -v i_pfile=$i_pfile $f
88
89        tail "_${i}_ext_h_" >> $i_pfile
90
91        f=../dbinc_auto/${i}_ext.h
92        cmp $i_pfile $f > /dev/null 2>&1 ||
93            (echo "Building $f" && rm -f $f && cp $i_pfile $f && chmod 444 $f)
94done
95
96# Process directories which only add to the external prototype and #define
97# files.
98for i in dbm hsearch; do
99        f="../$i/*.c"
100        awk -f gen_inc.awk \
101            -v db_version_unique_name=$DB_VERSION_UNIQUE_NAME \
102            -v e_dfile=$e_dfile \
103            -v e_pfile=$e_pfile \
104            -v i_dfile="" \
105            -v i_pfile="" $f
106done
107
108# RPC uses rpcgen to generate a header file; post-process it to add more
109# interfaces to the internal #define file.
110sed -e '/extern bool_t xdr___/{' \
111    -e 's/.* //' \
112    -e 's/();//' \
113    -e 's/.*/#define & &@DB_VERSION_UNIQUE_NAME@/' \
114    -e 'p' \
115    -e '}' \
116    -e d < ../dbinc_auto/db_server.h >> $i_dfile
117
118# There are a few globals in DB -- add them to the external/internal
119# #define files.
120(echo "#define __db_global_values __db_global_values@DB_VERSION_UNIQUE_NAME@";
121    echo "#define __db_jump __db_jump@DB_VERSION_UNIQUE_NAME@") >> $i_dfile
122(echo "#define db_xa_switch db_xa_switch@DB_VERSION_UNIQUE_NAME@") >> $e_dfile
123
124# Wrap up the external #defines/prototypes, and internal #defines.
125tail defonly _DB_EXT_DEF_IN_ >> $e_dfile
126f=../dbinc_auto/ext_def.in
127cmp $e_dfile $f > /dev/null 2>&1 ||
128    (echo "Building $f" && rm -f $f && cp $e_dfile $f && chmod 444 $f)
129
130tail _DB_EXT_PROT_IN_ >> $e_pfile
131f=../dbinc_auto/ext_prot.in
132cmp $e_pfile $f > /dev/null 2>&1 ||
133    (echo "Building $f" && rm -f $f && cp $e_pfile $f && chmod 444 $f)
134
135tail defonly _DB_INT_DEF_IN_ >> $i_dfile
136f=../dbinc_auto/int_def.in
137cmp $i_dfile $f > /dev/null 2>&1 ||
138    (echo "Building $f" && rm -f $f && cp $i_dfile $f && chmod 444 $f)
139
140# DB185 compatibility support.
141head space defonly _DB_EXT_185_DEF_IN_ > $e_dfile
142head space _DB_EXT_185_PROT_IN_ > $e_pfile
143
144f="../db185/*.c"
145awk -f gen_inc.awk \
146    -v db_version_unique_name=$DB_VERSION_UNIQUE_NAME \
147    -v e_dfile=$e_dfile \
148    -v e_pfile=$e_pfile \
149    -v i_dfile="" \
150    -v i_pfile="" $f
151
152tail defonly _DB_EXT_185_DEF_IN_ >> $e_dfile
153f=../dbinc_auto/ext_185_def.in
154cmp $e_dfile $f > /dev/null 2>&1 ||
155    (echo "Building $f" && rm -f $f && cp $e_dfile $f && chmod 444 $f)
156
157tail _DB_EXT_185_PROT_IN_ >> $e_pfile
158f=../dbinc_auto/ext_185_prot.in
159cmp $e_pfile $f > /dev/null 2>&1 ||
160    (echo "Building $f" && rm -f $f && cp $e_pfile $f && chmod 444 $f)
Note: See TracBrowser for help on using the repository browser.