aboutsummaryrefslogtreecommitdiff
path: root/src/run.bash
diff options
context:
space:
mode:
authorShenghou Ma <minux.ma@gmail.com>2014-04-29 14:43:10 -0400
committerShenghou Ma <minux.ma@gmail.com>2014-04-29 14:43:10 -0400
commit6f3f2d0ab825ee1ab77d62766828b6c191f92622 (patch)
tree5e0ac991cc4017b9fb252e016b321c429b565558 /src/run.bash
parentf999e14f025b69516dd3e126d04dd309adb2fce0 (diff)
downloadgo-6f3f2d0ab825ee1ab77d62766828b6c191f92622.tar.gz
go-6f3f2d0ab825ee1ab77d62766828b6c191f92622.zip
run.bash: skip -static cgo test if -static linking isn't possible.
Some system doesn't have libc.a available. While we're at here, also export GOROOT in run.bash, so that one doesn't need to set GOROOT to run run.bash. LGTM=iant R=iant CC=golang-codereviews https://golang.org/cl/99870043
Diffstat (limited to 'src/run.bash')
-rwxr-xr-xsrc/run.bash7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/run.bash b/src/run.bash
index 0f3e4e0f36..876b5d757d 100755
--- a/src/run.bash
+++ b/src/run.bash
@@ -6,6 +6,7 @@
set -e
eval $(go env)
+export GOROOT # the api test requires GOROOT to be set.
unset CDPATH # in case user has it set
unset GOPATH # we disallow local import for non-local packages, if $GOROOT happens
@@ -140,7 +141,11 @@ dragonfly-386 | dragonfly-amd64 | freebsd-386 | freebsd-amd64 | freebsd-arm | li
# static linking on FreeBSD/ARM with clang. (cgo depends on
# -fPIC fundamentally.)
*)
- go test -ldflags '-linkmode=external -extldflags "-static -pthread"' ../testtls || exit 1
+ if ! $CC -xc -o /dev/null -static - 2>/dev/null <<<'int main() {}' ; then
+ echo "No support for static linking found (lacks libc.a?), skip cgo static linking test."
+ else
+ go test -ldflags '-linkmode=external -extldflags "-static -pthread"' ../testtls || exit 1
+ fi
;;
esac
;;