From: Shenghou Ma Date: Tue, 29 Apr 2014 04:32:16 +0000 (-0400) Subject: make.bash: if CC is not set, and gcc doesn't exist, try clang/clang++. X-Git-Tag: go1.3beta2~168 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=382cc8cb398c011a1701c410b747f1e80fa66687;p=gostls13.git 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 --- 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.