diff --git a/tests/test-headers.sh b/tests/test-headers.sh index e8fb8eed9c..ae483744d7 100644 --- a/tests/test-headers.sh +++ b/tests/test-headers.sh @@ -1,36 +1,44 @@ #!/bin/sh # # Check public headers for c++ compatibility and consistent protection #ifdefs # # INCLUDE_FILES="`find ../include/ -name \*.h -a \! -name \*internal.h`" for i in $INCLUDE_FILES do NAME="`echo $i | cut -c12-`" # config.h is generated by autoconf # gettext.h is supplied by gettext if [ "$NAME" = "config.h" ] || [ "$NAME" = "gettext.h" ] then continue fi PROTECT="PCMK__`echo $NAME | tr '[:lower:]' '[:upper:]' | tr '/\.' '_' |tr '-' '_' `" PROTECT=`echo $PROTECT|sed 's/_H/__H/'` # PCMK uses double underscore for .h (eg NAME__H) echo "#include <$NAME>" > _test_file.c echo "#ifndef $PROTECT" >> _test_file.c echo "#error no header protector in file $i" >> _test_file.c echo "#endif" >> _test_file.c echo "int main(void) {return 0;}" >> _test_file.c # Not including ${CFLAGS} because it seems to break header detection. But we're not really building here ${CC} -I ../include -DHAVE_CONFIG_H ${CPPFLAGS} ${LIBS} _test_file.c -o /dev/null + if [ $? -ne 0 ] + then + exit 1 + fi if [ "$CXX" ] then ${CXX} ${CXXFLAGS} ${CPPFLAGS} ${LIBS} -I ../include _test_file.c -o /dev/null + if [ $? -ne 0 ] + then + exit 1 + fi echo -n fi rm -f _test_file.c done