79323a74fb23bdcbf35f147105412015c3812fb4
[platform/upstream/harfbuzz.git] / src / check-includes.sh
1 #!/bin/sh
2
3 LC_ALL=C
4 export LC_ALL
5
6 test -z "$srcdir" && srcdir=.
7 stat=0
8
9 test "x$HBHEADERS" = x && HBHEADERS=`find . -maxdepth 1 -name 'hb*.h'`
10 test "x$HBSOURCES" = x && HBSOURCES=`find . -maxdepth 1 -name 'hb-*.cc' -or -name 'hb-*.hh'`
11
12
13 cd "$srcdir"
14
15
16 echo 'Checking that public header files #include "hb-common.h" or "hb.h" first (or none)'
17
18 for x in $HBHEADERS; do
19         grep '#.*\<include\>' "$x" /dev/null | head -n 1
20 done |
21 grep -v '"hb-common[.]h"' |
22 grep -v '"hb[.]h"' |
23 grep -v 'hb-common[.]h:' |
24 grep -v 'hb[.]h:' |
25 grep . >&2 && stat=1
26
27
28 echo 'Checking that source files #include "hb-*private.hh" first (or none)'
29
30 for x in $HBSOURCES; do
31         grep '#.*\<include\>' "$x" /dev/null | head -n 1
32 done |
33 grep -v '"hb-.*private[.]hh"' |
34 grep -v 'hb-private[.]hh:' |
35 grep . >&2 && stat=1
36
37
38 echo 'Checking that there is no #include <hb.*.h>'
39 grep '#.*\<include\>.*<.*hb' $HBHEADERS $HBSOURCES >&2 && stat=1
40
41
42 exit $stat