diff --git a/configure b/configure
index eb20880..7f230ce 100755
--- a/configure
+++ b/configure
@@ -81,10 +81,13 @@ build_config()
 		if [ "$optimisations" = "true" ]
 		then
 			echo "OPTIMISATIONS=-O2 -pipe"
-			# Since gcc 4.6, this optimization enabled with -O1 causes filter_line_sse2 to crash.
-			echo "OPTIMISATIONS+=-fno-tree-dominator-opts"
-			# Since gcc 4.6, this optimization enabled with -O2 causes filter_line_sse2 to crash.
-			echo "OPTIMISATIONS+=-fno-tree-pre"
+			"$CC" --version | grep gcc >/dev/null
+			if [ "$?" = "0" ]; then
+				# Since gcc 4.6, this optimization enabled with -O1 causes filter_line_sse2 to crash.
+				echo "OPTIMISATIONS+=-fno-tree-dominator-opts"
+				# Since gcc 4.6, this optimization enabled with -O2 causes filter_line_sse2 to crash.
+				echo "OPTIMISATIONS+=-fno-tree-pre"
+			fi
 		fi
 
 		echo "CFLAGS+=-Wall -DPIC \$(TARGETARCH) \$(TARGETCPU) \$(OPTIMISATIONS) \$(MMX_FLAGS) \$(SSE_FLAGS) \$(SSE2_FLAGS) \$(DEBUG_FLAGS) \$(LARGE_FILE)"