$OpenBSD: patch-gr-dtv_lib_CMakeLists_txt,v 1.1 2019/10/03 13:39:45 naddy Exp $

Make SSE2 check clang compatible on ARM
https://github.com/gnuradio/gnuradio/commit/83c0b7c0651a1959ac118c67154fce50541755df

Index: gr-dtv/lib/CMakeLists.txt
--- gr-dtv/lib/CMakeLists.txt.orig
+++ gr-dtv/lib/CMakeLists.txt
@@ -117,7 +117,12 @@ if (MSVC)
 		CHECK_C_COMPILER_FLAG ("/arch:SSE2" SSE2_SUPPORTED)
 	endif(CMAKE_SIZEOF_VOID_P EQUAL 8)
 else ()
-	CHECK_C_COMPILER_FLAG ("-msse2" SSE2_SUPPORTED)
+	# The "correct" way to test this would be to run
+	# check_c_compiler_flag("-msse2")
+	# ...but that's not reliable, in particular, on Clang and ARM, it will
+	# return TRUE when it shouldn't. Hence, we compile this snippet
+	# manually.
+	check_c_source_compiles("#include <emmintrin.h>\nint main(){__m128i m0, m1, m2; m0 = _mm_add_epi8(m1, m2);}" SSE2_SUPPORTED)
 endif(MSVC)
 
 if(SSE2_SUPPORTED)
