changeset 2820:33ddad305f3d

Make sure that we don't generate floating point code that would cause illegal instruction exceptions on older processors, unless someone passes --enable-ssemath to configure.
author Sam Lantinga <slouken@libsdl.org>
date Mon, 01 Dec 2008 23:09:09 +0000
parents 222aa027e650
children c4eccbd21d16
files configure.in
diffstat 1 files changed, 24 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/configure.in	Mon Dec 01 09:45:01 2008 +0000
+++ b/configure.in	Mon Dec 01 23:09:09 2008 +0000
@@ -394,6 +394,30 @@
         fi
     fi
 
+    # Make sure that we don't generate floating point code that would
+    # cause illegal instruction exceptions on older processors
+    case "$host" in
+        *-*-darwin*)
+            # Don't need to worry about Apple hardware, it's all SSE capable
+            default_ssemath=yes
+            ;;
+        *64-*-*)
+            # x86 64-bit architectures all have SSE instructions
+            default_ssemath=yes
+            ;;
+	*)
+            default_ssemath=no
+            ;;
+    esac
+    AC_ARG_ENABLE(ssemath,
+AC_HELP_STRING([--enable-ssemath], [Allow GCC to use SSE floating point math [[default=no]]]),
+                  , enable_ssemath=$default_ssemath)
+    if test x$enable_ssemath = xno; then
+        if test x$have_gcc_sse = xyes -o x$have_gcc_sse2 = xyes; then
+            EXTRA_CFLAGS="$EXTRA_CFLAGS -mfpmath=387"
+        fi
+    fi
+
     AC_ARG_ENABLE(altivec,
 AC_HELP_STRING([--enable-altivec], [use Altivec assembly routines [[default=yes]]]),
                   , enable_altivec=yes)