aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/acinclude.m434
-rw-r--r--src/configure.ac2
2 files changed, 35 insertions, 1 deletions
diff --git a/src/acinclude.m4 b/src/acinclude.m4
index daf0c11..7922bc8 100644
--- a/src/acinclude.m4
+++ b/src/acinclude.m4
@@ -160,3 +160,37 @@ if test "$fat_binary" != no; then
undefine([Name])
fi
])# AC_CHECK_FAT
+
+AC_DEFUN([AC_CHECK_SIMD],
+[
+AC_ARG_ENABLE(simd,
+ [ --enable-simd=ARCHS
+ enable SIMD optimization;
+ valid arguments are: SSE2
+ ],
+ [simd=$enableval], [simd=no])
+if test "$simd" != no; then
+ AC_MSG_CHECKING([SIMD optimization])
+
+ # Respect SIMD given to --enable-simd if present.
+ if test "$simd" != yes; then
+ SIMD=`echo "$simd" | tr ',' ' '`
+ else
+ # Choose a default set of architectures based upon platform.
+ SIMD="SSE2"
+ fi
+ AC_MSG_RESULT([$SIMD])
+
+ for smd in $SIMD
+ do
+ case "${smd}" in
+ SSE2|sse2)
+ AC_CHECK_CFLAGS([-mfpmath=sse -msse])
+ ;;
+ *)
+ AC_MSG_RESULT([unknown SIMD instructions: ${smd}])
+ ;;
+ esac
+ done
+fi
+])# AC_CHECK_SIMD
diff --git a/src/configure.ac b/src/configure.ac
index d0fc17e..f015216 100644
--- a/src/configure.ac
+++ b/src/configure.ac
@@ -164,7 +164,7 @@ if test "x$enable_PIC" != "xno"; then
AC_CHECK_CFLAGS([-fPIC])
fi
-AC_CHECK_CFLAGS([-mfpmath=sse -msse])
+AC_CHECK_SIMD
dnl if we don't have $LD set, we set it to $(CC)
dnl LD=${LD:=$CC}