[xiph-commits] r14802 - trunk/speex

jm at svn.xiph.org jm at svn.xiph.org
Sat Apr 26 03:03:23 PDT 2008


Author: jm
Date: 2008-04-26 03:03:23 -0700 (Sat, 26 Apr 2008)
New Revision: 14802

Modified:
   trunk/speex/configure.ac
Log:
Patch by Thorvald Natvig to detect when SSE can be safely used with the selected
arch.


Modified: trunk/speex/configure.ac
===================================================================
--- trunk/speex/configure.ac	2008-04-25 22:21:40 UTC (rev 14801)
+++ trunk/speex/configure.ac	2008-04-26 10:03:23 UTC (rev 14802)
@@ -72,6 +72,23 @@
 )
 AC_MSG_RESULT($has_alloca)
 
+AC_MSG_CHECKING(for SSE in current arch/CFLAGS)
+AC_LINK_IFELSE([
+AC_LANG_PROGRAM([[
+#include <xmmintrin.h>
+__m128 testfunc(float *a, float *b) {
+  return _mm_add_ps(_mm_loadu_ps(a), _mm_loadu_ps(b));
+}
+]])],
+[
+has_sse=yes
+],
+[
+has_sse=no
+]
+)
+AC_MSG_RESULT($has_sse)  
+
 SAVE_CFLAGS="$CFLAGS"
 CFLAGS="$CFLAGS -fvisibility=hidden"
 AC_MSG_CHECKING(for ELF visibility)
@@ -123,12 +140,19 @@
   AC_DEFINE([ENABLE_VALGRIND], , [Enable valgrind extra checks])
 fi])
 
-AC_ARG_ENABLE(sse, [  --enable-sse            Enable SSE support], [if test "$enableval" = yes; then
-AC_DEFINE([_USE_SSE], , [Enable SSE support])
+AC_ARG_ENABLE(sse, [  --enable-sse            Enable SSE support], [
+if test "x$enableval" != xno; then
+has_sse=yes
 CFLAGS="$CFLAGS -O3 -msse"
+else
+has_sse=no
 fi
 ])
 
+if test "$has_sse" = yes; then
+  AC_DEFINE([_USE_SSE], , [Enable SSE support])
+fi
+
 AC_ARG_ENABLE(fixed-point, [  --enable-fixed-point    Compile as fixed-point],
 [if test "$enableval" = yes; then
   AC_DEFINE([FIXED_POINT], , [Compile as fixed-point])



More information about the commits mailing list