summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xsrc/make.bash4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/make.bash b/src/make.bash
index bfcb5d58e..0b130b668 100755
--- a/src/make.bash
+++ b/src/make.bash
@@ -125,6 +125,10 @@ if [ "$(uname)" == "Darwin" ]; then
# golang.org/issue/5261
mflag="$mflag -mmacosx-version-min=10.6"
fi
+# if gcc does not exist and $CC is not set, try clang if available.
+if [ -z "$CC" -a -z "$(type -t gcc)" -a -n "$(type -t clang)" ]; then
+ export CC=clang CXX=clang++
+fi
${CC:-gcc} $mflag -O2 -Wall -Werror -o cmd/dist/dist -Icmd/dist "$DEFGOROOT" cmd/dist/*.c
# -e doesn't propagate out of eval, so check success by hand.