njn | 107bc57 | 2009-02-16 00:42:10 +0000 | [diff] [blame] | 1 | #! /bin/sh |
| 2 | |
| 3 | # This script determines which platforms that this Valgrind installation |
| 4 | # supports. |
| 5 | # We return: |
| 6 | # - 0 if the machine matches the asked-for platform |
| 7 | # - 1 if it didn't match, but did match the name of another platform |
| 8 | # - 2 otherwise |
| 9 | |
| 10 | # Nb: When updating this file for a new platform, add the name to |
| 11 | # 'all_platforms'. |
| 12 | |
| 13 | all_platforms= |
| 14 | all_platforms="$all_platforms x86-linux amd64-linux ppc32-linux ppc64-linux" |
| 15 | all_platforms="$all_platforms ppc32-aix5 ppc64-aix5" |
njn | f76d27a | 2009-05-28 01:53:07 +0000 | [diff] [blame] | 16 | all_platforms="$all_platforms x86-darwin amd64-darwin" |
njn | 107bc57 | 2009-02-16 00:42:10 +0000 | [diff] [blame] | 17 | |
| 18 | if [ $# -ne 2 ] ; then |
| 19 | echo "usage: platform_test <arch-type> <OS-type>" |
| 20 | exit 2; |
| 21 | fi |
| 22 | |
| 23 | # Get the directory holding the arch_test and os_test, which will be the same |
| 24 | # as the one holding this script. |
| 25 | dir=`dirname $0` |
| 26 | |
njn | 61485ab | 2009-03-04 04:15:16 +0000 | [diff] [blame] | 27 | if $dir/arch_test $1 && $dir/os_test $2 ; then |
njn | 107bc57 | 2009-02-16 00:42:10 +0000 | [diff] [blame] | 28 | exit 0; # Matches this platform. |
| 29 | fi |
| 30 | |
| 31 | for p in $all_platforms ; do |
| 32 | if [ $1-$2 = $p ] ; then |
| 33 | exit 1; # Matches another Valgrind-supported platform. |
| 34 | fi |
| 35 | done |
| 36 | |
| 37 | exit 2; # Doesn't match any Valgrind-supported platform. |