ddbcd8337b9c86474cc28383375f674158b343a6
[framework/uifw/harfbuzz.git] / src / check-header-guards.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 for x in $HBHEADERS $HBSOURCES; do
16         echo "$x" | grep '[^h]$' -q && continue;
17         x=`echo "$x" | sed 's@.*/@@'`
18         tag=`echo "$x" | tr 'a-z.-' 'A-Z_'`
19         lines=`grep "\<$tag\>" "$x" | wc -l`
20         if test "x$lines" != x3; then
21                 echo "Ouch, header file $x does not have correct preprocessor guards"
22                 stat=1
23         fi
24 done
25
26 exit $stat