1#!/bin/sh 2# 3## Copyright (C) 1996-2021 The Squid Software Foundation and contributors 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 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}" 19shift 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} 25 26exitCode=0 27 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 */ 34#include "squid.h" 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 47done 48 49#who ever said that the test program needs to be meaningful? 50test $exitCode -eq 0 && cp ${TRUE} testHeaders 51exit $exitCode 52