Linux Audio

Check our new training course

Loading...
v4.17
 1#!/bin/sh
 2# SPDX-License-Identifier: GPL-2.0
 3srctree=$(dirname "$0")
 4
 5SHOW_ERROR=
 6if [ "$1" = "--show-error" ] ; then
 7	SHOW_ERROR=1
 8	shift || true
 9fi
10
11gccplugins_dir=$($3 -print-file-name=plugin)
12plugincc=$($1 -E -x c++ - -o /dev/null -I"${srctree}"/gcc-plugins -I"${gccplugins_dir}"/include 2>&1 <<EOF
13#include "gcc-common.h"
14#if BUILDING_GCC_VERSION >= 4008 || defined(ENABLE_BUILD_WITH_CXX)
15#warning $2 CXX
16#else
17#warning $1 CC
18#endif
19EOF
20)
21
22if [ $? -ne 0 ]
23then
24	if [ -n "$SHOW_ERROR" ] ; then
25		echo "${plugincc}" >&2
26	fi
27	exit 1
28fi
29
30case "$plugincc" in
31	*"$1 CC"*)
32		echo "$1"
33		exit 0
34		;;
35
36	*"$2 CXX"*)
37		# the c++ compiler needs another test, see below
38		;;
39
40	*)
41		exit 1
42		;;
43esac
44
45# we need a c++ compiler that supports the designated initializer GNU extension
46plugincc=$($2 -c -x c++ -std=gnu++98 - -fsyntax-only -I"${srctree}"/gcc-plugins -I"${gccplugins_dir}"/include 2>&1 <<EOF
47#include "gcc-common.h"
48class test {
49public:
50	int test;
51} test = {
52	.test = 1
53};
54EOF
55)
56
57if [ $? -eq 0 ]
58then
59	echo "$2"
60	exit 0
61fi
62
63if [ -n "$SHOW_ERROR" ] ; then
64	echo "${plugincc}" >&2
65fi
66exit 1
v4.10.11
 1#!/bin/sh
 
 2srctree=$(dirname "$0")
 3
 4SHOW_ERROR=
 5if [ "$1" = "--show-error" ] ; then
 6	SHOW_ERROR=1
 7	shift || true
 8fi
 9
10gccplugins_dir=$($3 -print-file-name=plugin)
11plugincc=$($1 -E -x c++ - -o /dev/null -I"${srctree}"/gcc-plugins -I"${gccplugins_dir}"/include 2>&1 <<EOF
12#include "gcc-common.h"
13#if BUILDING_GCC_VERSION >= 4008 || defined(ENABLE_BUILD_WITH_CXX)
14#warning $2 CXX
15#else
16#warning $1 CC
17#endif
18EOF
19)
20
21if [ $? -ne 0 ]
22then
23	if [ -n "$SHOW_ERROR" ] ; then
24		echo "${plugincc}" >&2
25	fi
26	exit 1
27fi
28
29case "$plugincc" in
30	*"$1 CC"*)
31		echo "$1"
32		exit 0
33		;;
34
35	*"$2 CXX"*)
36		# the c++ compiler needs another test, see below
37		;;
38
39	*)
40		exit 1
41		;;
42esac
43
44# we need a c++ compiler that supports the designated initializer GNU extension
45plugincc=$($2 -c -x c++ -std=gnu++98 - -fsyntax-only -I"${srctree}"/gcc-plugins -I"${gccplugins_dir}"/include 2>&1 <<EOF
46#include "gcc-common.h"
47class test {
48public:
49	int test;
50} test = {
51	.test = 1
52};
53EOF
54)
55
56if [ $? -eq 0 ]
57then
58	echo "$2"
59	exit 0
60fi
61
62if [ -n "$SHOW_ERROR" ] ; then
63	echo "${plugincc}" >&2
64fi
65exit 1