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