]> git.ipfire.org Git - thirdparty/squid.git/blame - test-suite/testheaders.sh
Docs: Copyright updates for 2018 (#114)
[thirdparty/squid.git] / test-suite / testheaders.sh
CommitLineData
43c58c85 1#!/bin/sh
e1f7507e 2#
5b74111a 3## Copyright (C) 1996-2018 The Squid Software Foundation and contributors
4e0938ef
AJ
4##
5## Squid software is distributed under GPLv2+ license and includes
6## contributions from numerous individuals and organizations.
7## Please see the COPYING and CONTRIBUTORS files for details.
8##
9
e1f7507e
AJ
10# test all header files (.h) for dependancy issues.
11#
12# Ideally this test should be performed twice before any code is accepted.
13# With or without inline enabled. This is needed because the .cci files
14# are only included into the .h files when inline mode is enabled.
15#
16# This script should be run from the makefile with the directory path and ccflags
17#
18cc="${1}"
a0fdc9bf 19shift
96ccb411
FC
20for dir in /usr/bin /usr/local/bin /usr/gnu/bin
21do
22 test -x ${dir}/true && TRUE=${dir}/true
23done
24TRUE=${TRUE:-/bin/true}
e1f7507e 25
d18e40db
AR
26exitCode=0
27
a0fdc9bf
FC
28for f in $@; do
29 echo -n "Testing ${f} ..."
30 t="testhdr_`basename ${f}`"
31 if [ ! -f "$t.o" -o $f -nt "$t.o" ]; then
32 echo >$t.cc <<EOF
33/* This file is AUTOMATICALLY GENERATED. DO NOT ALTER IT */
f7f3304a 34#include "squid.h"
a0fdc9bf
FC
35#include "${f}"
36int main( int argc, char* argv[] ) { return 0; }
37EOF
38 if ${cc} -c -o $t.o $t.cc ; then
39 echo "Ok."
40 else
41 echo "Fail."
42 exitCode=1
43 fi
44 rm $t.cc $t.o
45 fi
46 test $exitCode -eq 0 || break
e1f7507e 47done
d18e40db 48
a0fdc9bf 49#who ever said that the test program needs to be meaningful?
96ccb411 50test $exitCode -eq 0 && cp ${TRUE} testHeaders
d18e40db 51exit $exitCode