summary refs log tree commit diff
diff options
context:
space:
mode:
-rwxr-xr-xtools/test.sh8
1 files changed, 7 insertions, 1 deletions
diff --git a/tools/test.sh b/tools/test.sh
index 384d585..6e55447 100755
--- a/tools/test.sh
+++ b/tools/test.sh
@@ -10,6 +10,11 @@ asm=$tmp.s
 exe=$tmp.exe
 out=$tmp.out
 
+testcc() {
+	echo "int main() { }" | $1 -x C -o /dev/null - >/dev/null 2>&1
+	return $?
+}
+
 init() {
 	case "$TARGET" in
 	arm64)
@@ -31,7 +36,7 @@ init() {
 			echo "Cannot find arm64 compiler or qemu."
 			exit 1
 		fi
-                bin="$bin -t arm64"
+		bin="$bin -t arm64"
 		;;
 	"")
 		case `uname` in
@@ -46,6 +51,7 @@ init() {
 			;;
 		*)
 			cc="cc -no-pie"
+			testcc $cc || cc="cc"
 			;;
 		esac
 		;;