1#!/bin/sh -
2#
3# $Id: chk.include,v 12.4 2007/05/17 19:38:09 bostic Exp $
4#
5# Check for inclusion of files already included in db_int.h.
6
7d=../..
8
9# Test must be run from the top-level directory, not from a test directory.
10[ -f $d/LICENSE ] || {
11	echo 'FAIL: cannot find source distribution directory.'
12	exit 1
13}
14
15t1=__1
16t2=__2
17
18egrep -- '#include[	 ]' $d/dbinc/db_int.in |
19sed -e '/[	 ]db\.h'/d \
20    -e 's/^#include.//' \
21    -e 's/[<>"]//g' \
22    -e 's/[	 ].*//' > $t1
23
24for i in `cat $t1`; do
25	(cd $d && egrep "^#include[	 ].*[<\"]$i[>\"]" */*.[ch])
26done |
27sed -e '/^build/d' \
28    -e '/^db_codegen\/code_capi.c/d' \
29    -e '/^db_dump185/d' \
30    -e '/^dbinc\/mutex_int.h.*<sys\/mman.h>/d' \
31    -e '/^dbinc\/win_db.h:/d' \
32    -e '/^examples_c/d' \
33    -e '/^libdb_java.*errno.h/d' \
34    -e '/^libdb_java.*java_util.h/d' \
35    -e '/^libdb_java\/db_java_wrap.c/d' \
36    -e '/^mod_db4/d' \
37    -e '/^mutex\/tm.c/d' \
38    -e '/^os\/os_map.c.*<sys\/mman.h>/d' \
39    -e '/^perl/d' \
40    -e '/^php_db4/d' \
41    -e '/^test_/d' \
42    > $t2
43
44[ -s $t2 ] && {
45	echo 'FAIL: found extraneous includes in the source'
46	cat $t2
47	exit 1
48}
49exit 0
50