diff options
Diffstat (limited to 'sim/ppc/config.hdr')
-rwxr-xr-x | sim/ppc/config.hdr | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/sim/ppc/config.hdr b/sim/ppc/config.hdr new file mode 100755 index 0000000..98fa86b --- /dev/null +++ b/sim/ppc/config.hdr @@ -0,0 +1,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 |