summaryrefslogtreecommitdiffstats
path: root/src/check-header-compile.in
blob: ca9eb6a621c3f5c56a2d0c59d2b7c9713b493645 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#! /bin/sh
# Check that each .h file has all the includes it needs.

# Probably requires gnu find (for -printf '%P\n').

# This script hereby placed into the public domain.

set -e
mydir=`dirname "$0"`
cd "$mydir"
srcdir="@srcdir@"
CXX="@CXX@"
INCLUDES="@GNOME_VFS_CFLAGS@ @POPPLER_GLIB_CFLAGS@ @INKSCAPE_CFLAGS@"
OBJEXT="@OBJEXT@"
config_h_dir=..

check_compile () {
	(echo "#include <config.h>"; echo "#include <$1>"; echo "int header_tst_dummy;") > header-tst.cpp
	$CXX -c -I. -I"$srcdir" -I$config_h_dir $INCLUDES header-tst.cpp
}

if [ $# = 0 ]; then
	for i in `find "$srcdir"	\
		   -name bonobo -prune	\
		-o -name dom -prune	\
		-o -name ecma -prune	\
		-o -name render -prune	\
		-o -name xpath -prune	\
		-o -path '*/extension/script/js' -prune	\
		-o -name '*.h' \
		   \! -name gnome.h \! -name nr-type-gnome.h \! -name Livarot.h \! -name radial.h \
		   \! -name '*-test.h'	\
		   \! -name test-helpers.h	\
		   \! -name PylogFormatter.h	\
		   \! -name TRPIFormatter.h	\
		   \! -name win32.h	\
		   \! -name '*-w32.h'	\
		   \! -name '*-win32.h'	\
		   -printf '%P\n'`
	do
		check_compile "$i"
	done
else
	for i in "$@"; do
		check_compile "$i"
	done
fi
rm header-tst.cpp header-tst.$OBJEXT