From 382cc8cb398c011a1701c410b747f1e80fa66687 Mon Sep 17 00:00:00 2001 From: Shenghou Ma Date: Tue, 29 Apr 2014 00:32:16 -0400 Subject: [PATCH] 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 --- src/make.bash | 4 ++++ 1 file changed, 4 insertions(+) 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. -- 2.50.0