--- gimp/configure.in	21 Jul 2005 07:51:26 -0000	1.681
+++ gimp/configure.in	27 Jul 2005 02:34:13 -0000
@@ -594,6 +594,46 @@
 
 fi
 
+if test "x$enable_mmx" = xyes; then
+
+  MMX_EXTRA_CFLAGS=
+  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_EXTRA_CFLAGS="$MMX_EXTRA_CFLAGS $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
+          MMX_EXTRA_CFLAGS="$MMX_EXTRA_CFLAGS $flag"
+	fi
+      fi
+    done
+
+  fi
+  AC_SUBST(MMX_EXTRA_CFLAGS)
+
+fi
+
 
 ############################
 # Check for AltiVec assembly
--- gimp/app/composite/Makefile.am	6 Mar 2005 08:38:19 -0000	1.37
+++ gimp/app/composite/Makefile.am	27 Jul 2005 02:34:36 -0000
@@ -5,6 +5,7 @@
 AM_CPPFLAGS = \
 	-DG_LOG_DOMAIN=\"Gimp-Composite\"	\
 	$(ALTIVEC_EXTRA_CFLAGS)			\
+	$(MMX_EXTRA_CFLAGS)			\
 	@GTHREAD_CFLAGS@
 
 AM_CCASFLAGS = \
