Build changes to support work on the BSDs.

This does still contain some FreeBSD-specific bits, but
it's a pain to do partial diffs.

R=rsc
https://golang.org/cl/152138
diff --git a/test/run b/test/run
index 00cfede..47f300f 100755
--- a/test/run
+++ b/test/run
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 # Copyright 2009 The Go Authors. All rights reserved.
 # Use of this source code is governed by a BSD-style
 # license that can be found in the LICENSE file.