]> Cypherpunks repositories - gostls13.git/commitdiff
make.bash: if CC is not set, and gcc doesn't exist, try clang/clang++.
authorShenghou Ma <minux.ma@gmail.com>
Tue, 29 Apr 2014 04:32:16 +0000 (00:32 -0400)
committerShenghou Ma <minux.ma@gmail.com>
Tue, 29 Apr 2014 04:32:16 +0000 (00:32 -0400)
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

index bfcb5d58eab07f49e7b4affa10edee67083d2b9e..0b130b668d1590cb93c0f5dd2d81e869541a55a8 100755 (executable)
@@ -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.