aboutsummaryrefslogtreecommitdiff
path: root/sim/ppc/config.hdr
blob: 98fa86b1f1f4d72e510be4775ae377f4c19b0464 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#! /bin/sh

# Helper script to turn --enable-sim-xxx switches into defines

# Arg 1 -- header name
# Arg 2 -- define name
# Arg 3 -- --enable-sim switch spelling
# Arg 4 -- --enable-sim switch value
# the remaining switches are paired, with the first being the value to test arg 4 against
# and the second is the value to put in the define if it matches

hdr="$1"
shift

define="$1"
shift

switch="$1"
shift

value="$1"
shift

while test $# -gt 1; do
	test_value="$1"
	shift

	set_value="$1"
	shift

	if test x"$value" = x"$test_value" -o x"$test_value" = x"*"; then
		echo "Defining $define=$set_value"
		(echo ""
		 if test x"$value" = x""; then
			 echo "/* no $switch */"
		 elif test x"$value" = x"yes"; then
			 echo "/* $switch */"
		 else
			 echo "/* $switch=$value */"
		 fi

		 echo "#ifndef $define"
		 echo "#define $define $set_value"
		 echo "#endif") >> $hdr
		exit 0;
	fi
done

if test x"$value" != x"" -a x"$value" != x"no"; then
	echo "$switch=$value is not supported" 1>&2
	exit 1
fi