aboutsummaryrefslogtreecommitdiff
path: root/src/make.bash
diff options
context:
space:
mode:
authorShenghou Ma <minux.ma@gmail.com>2014-04-29 00:32:16 -0400
committerShenghou Ma <minux.ma@gmail.com>2014-04-29 00:32:16 -0400
commit382cc8cb398c011a1701c410b747f1e80fa66687 (patch)
tree2814161adaabc2d1ba511fdebc67c2d937c4fee4 /src/make.bash
parent7e41abbc6b9f00f84374c69f3acb63b56fcf4728 (diff)
downloadgo-382cc8cb398c011a1701c410b747f1e80fa66687.tar.gz
go-382cc8cb398c011a1701c410b747f1e80fa66687.zip
make.bash: if CC is not set, and gcc doesn't exist, try clang/clang++.
This should make Go build without setting CC and CXX on newer FreeBSDs. LGTM=iant R=golang-codereviews, dave, gobot, iant CC=golang-codereviews https://golang.org/cl/89230045
Diffstat (limited to 'src/make.bash')
-rwxr-xr-xsrc/make.bash4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/make.bash b/src/make.bash
index bfcb5d58ea..0b130b668d 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.