--- gimp/configure.in.orig	2005-07-07 21:27:32.000000000 -0400
+++ gimp/configure.in	2005-07-07 22:33:52.000000000 -0400
@@ -594,6 +594,44 @@
 
 fi
 
+if test "x$enable_mmx" = xyes; then
+
+  mmx_flag=
+  for flag in '-mmmx'; do
+    if test -z "$mmx_flag"; then
+      mmx_save_CFLAGS="$CFLAGS"
+      CFLAGS="$mmx_save_CFLAGS $flag"
+      AC_MSG_CHECKING([whether [$]CC understands [$]flag])
+      AC_TRY_COMPILE([], [], [mmx_flag_works=yes], [mmx_flag_works=no])
+      AC_MSG_RESULT($mmx_flag_works)
+      CFLAGS="$mmx_save_CFLAGS"
+      if test "x$mmx_flag_works" = "xyes"; then
+        mmx_flag="$flag"
+      fi
+    fi
+  done
+
+  if test "x$enable_sse" = xyes; then
+
+    sse_flag=
+    for flag in '-msse'; do
+      if test -z "$sse_flag"; then
+	sse_save_CFLAGS="$CFLAGS"
+	CFLAGS="$sse_save_CFLAGS $flag"
+	AC_MSG_CHECKING([whether [$]CC understands [$]flag])
+	AC_TRY_COMPILE([], [], [sse_flag_works=yes], [sse_flag_works=no])
+	AC_MSG_RESULT($sse_flag_works)
+	CFLAGS="$sse_save_CFLAGS"
+	if test "x$sse_flag_works" = "xyes"; then
+	  sse_flag="$flag"
+	fi
+      fi
+    done
+
+  fi
+
+fi
+
 
 ############################
 # Check for AltiVec assembly
@@ -605,7 +643,7 @@
 
 if test "x$enable_altivec" = xyes; then
 
-  altivec_flag= 
+  altivec_flag=
   for flag in '-faltivec' '-maltivec -mabi=altivec'; do
     if test -z "$altivec_flag"; then
       altivec_save_CFLAGS="$CFLAGS"
