1#!/bin/bash
2
3# Copyright (C) 2010-2017 Erik de Castro Lopo <erikd@mega-nerd.com>
4#
5# All rights reserved.
6#
7# Redistribution and use in source and binary forms, with or without
8# modification, are permitted provided that the following conditions are
9# met:
10#
11#     * Redistributions of source code must retain the above copyright
12#       notice, this list of conditions and the following disclaimer.
13#     * Redistributions in binary form must reproduce the above copyright
14#       notice, this list of conditions and the following disclaimer in
15#       the documentation and/or other materials provided with the
16#       distribution.
17#     * Neither the author nor the names of any contributors may be used
18#       to endorse or promote products derived from this software without
19#       specific prior written permission.
20#
21# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
23# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
24# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
25# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
26# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
27# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
28# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
29# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
30# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
31# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32
33
34if test ! -f @top_srcdir@/tests/sfversion.c ; then
35	exit 0
36	fi
37
38echo -n "    Pedantic header test           : "
39
40# Only do this if the compiler is GCC.
41if test -n "@GCC_MAJOR_VERSION@" ; then
42
43	CC=`echo "@CC@" | sed "s/.*shave cc //"`
44	# Compile with -Werror and -pedantic.
45	$CC -std=c99 -Werror -pedantic -I@top_srcdir@/src -I@abs_top_builddir@/src -I@abs_top_builddir@/include -c @top_srcdir@/tests/sfversion.c -o /dev/null
46
47	# Check compiler return status.
48	if test $? -ne 0 ; then
49		echo
50		exit 1
51		fi
52
53	echo "ok"
54else
55	echo "n/a"
56	fi
57
58exit 0
59