1#!/bin/sh
2#
3# Get the best compiler to use for the local platform
4#
5# Usage:
6#
7#    getcompiler.sh cc		To get the C compiler
8#    getcompiler.sh cxx		To get the C++ compiler
9#
10
11if test $# != 1; then
12	echo "Usage: getcompiler.sh {cc|cxx}"
13	exit 1
14fi
15
16case "$1" in
17	cc)
18		if test -x /usr/bin/clang; then
19			echo /usr/bin/clang
20		else
21			echo /usr/bin/gcc
22		fi
23		;;
24	cxx)
25		if test -x /usr/bin/clang++; then
26			echo /usr/bin/clang++
27		else
28			echo /usr/bin/g++
29		fi
30		;;
31	*)
32		echo "Usage: getcompiler.sh {cc|cxx}"
33		exit 1
34		;;
35esac
36