diff --git a/contrib/bootstrap b/contrib/bootstrap
index 090385552252a9cad0dd8dd3407e911a6c9e0b7b..fb81a9fe08a82e574b3de3120d49bdf5ea7e3961 100755
--- a/contrib/bootstrap
+++ b/contrib/bootstrap
@@ -86,7 +86,7 @@ done
 if test -z "$BUILD"
 then
 	echo -n "Guessing build system... "
-	BUILD="`${CC:-cc} -dumpmachine`"
+	BUILD="`${CC:-$(command -v cc || command -v gcc)} -dumpmachine`"
 	if test -z "$BUILD"; then
 		echo "FAIL!"
 		exit 1