updated for version 7.0210
diff --git a/src/configure.in b/src/configure.in
index 574e2df..60609ec 100644
--- a/src/configure.in
+++ b/src/configure.in
@@ -32,7 +32,7 @@
   gccversion=`"$CC" --version | sed -e '2,$d;s/^[[^0-9]]*\(darwin.[[^0-9]]*\)*\([[0-9]]\.[[0-9.]]*\).*$/\2/g'`
   dnl version 4.0.1 was reported to cause trouble on Macintosh by Marcin Dalecki
   if test "$gccversion" = "3.0.1" -o "$gccversion" = "3.0.2" -o "$gccversion" = "4.0.1"; then
-    echo 'GCC [34].0.[12] has a bug in the optimizer, disabling "-O#"'
+    echo 'GCC [[34]].0.[[12]] has a bug in the optimizer, disabling "-O#"'
     CFLAGS=`echo "$CFLAGS" | sed 's/-O[[23456789]]/-O/'`
   else
     if test "$gccversion" = "3.1" -o "$gccversion" = "3.2" -o "$gccversion" = "3.2.1" && `echo "$CFLAGS" | grep -v fno-strength-reduce >/dev/null`; then
@@ -105,48 +105,53 @@
   AC_MSG_CHECKING(--with-mac-arch argument)
   AC_ARG_WITH(mac-arch, [  --with-mac-arch=ARCH    intel, ppc or both],
 	MACARCH="$withval"; AC_MSG_RESULT($MACARCH),
-	MACARCH="both"; AC_MSG_RESULT(Defaulting to $MACARCH))
+	MACARCH="both"; AC_MSG_RESULT(defaulting to $MACARCH))
 
   if test "x$MACARCH" = "xboth"; then
-    AC_MSG_CHECKING(if both architectures are supported)
+    AC_MSG_CHECKING(for 10.4 universal SDK)
+    dnl There is a terrible inconsistency (but we appear to get away with it):
+    dnl $CFLAGS uses the 10.4u SDK library for the headers, while $CPPFLAGS
+    dnl doesn't, because "gcc -E" doesn't grok it.  That means the configure
+    dnl tests using the preprocessor are actually done with the wrong header
+    dnl files. $LDFLAGS is set at the end, because configure uses it together
+    dnl with $CFLAGS and we can only have one -sysroot argument.
     save_cppflags="$CPPFLAGS"
+    save_cflags="$CFLAGS"
     save_ldflags="$LDFLAGS"
-    CPPFLAGS="$CPPFLAGS -arch i386 -arch ppc"
-    LDFLAGS="$LDFLAGS -arch i386 -arch ppc"
+    CFLAGS="$CFLAGS -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc"
     AC_TRY_LINK([ ], [ ],
-	AC_MSG_RESULT(yes),
-	AC_MSG_RESULT(no)
-	    AC_MSG_CHECKING(if Intel architecture is supported)
-	    CPPFLAGS="$save_cppflags -arch i386"
-	    LDFLAGS="$save_ldflags -arch i386"
-	    AC_TRY_LINK([ ], [ ],
-		AC_MSG_RESULT(yes); MACARCH="intel",
-		AC_MSG_RESULT(no); MACARCH="ppc"))
-    CPPFLAGS="$save_cppflags"
-    LDFLAGS="$save_ldflags"
+	AC_MSG_RESULT(found, will make universal binary),
+
+	AC_MSG_RESULT(not found)
+	CFLAGS="save_cflags"
+	AC_MSG_CHECKING(if Intel architecture is supported)
+	CPPFLAGS="$CPPFLAGS -arch i386"
+	LDFLAGS="$save_ldflags -arch i386"
+	AC_TRY_LINK([ ], [ ],
+	    AC_MSG_RESULT(yes); MACARCH="intel",
+	    AC_MSG_RESULT(no, using PowerPC)
+	        MACARCH="ppc"
+		CPPFLAGS="$save_cppflags -arch ppc"
+		LDFLAGS="$save_ldflags -arch ppc"))
+  elif test "x$MACARCH" = "xintel"; then
+    CPPFLAGS="$CPPFLAGS -arch intel"
+    LDFLAGS="$LDFLAGS -arch intel"
+  else
+    CPPFLAGS="$CPPFLAGS -arch ppc"
+    LDFLAGS="$LDFLAGS -arch ppc"
   fi
 
-  case "$MACARCH" in
-    intel)	MAC_OSX_ARCH="-arch i386";;
-    both)	MAC_OSX_ARCH="-arch i386 -arch ppc";;
-    ppc)	MAC_OSX_ARCH="-arch ppc";;
-    *)		MAC_OSX_ARCH="";;
-  esac
-
-  dnl avoid a bug with -O2 for intel
-  if test "$MACARCH" = "intel" -o "$MACARCH" = "both"; then
-    CFLAGS=`echo "$CFLAGS" | sed 's/-O[[23456789]]/-O/'`
-  fi
-
-  CPPFLAGS="$CPPFLAGS $MAC_OSX_ARCH"
-  LDFLAGS="$LDFLAGS $MAC_OSX_ARCH"
-
   if test "$enable_darwin" = "yes"; then
     MACOSX=yes
     OS_EXTRA_SCR="os_macosx.c os_mac_conv.c";
     OS_EXTRA_OBJ="objects/os_macosx.o objects/os_mac_conv.o"
     dnl TODO: use -arch i386 on Intel machines
-    CPPFLAGS="$CPPFLAGS -DMACOS_X_UNIX -I/Developer/Headers/FlatCarbon -no-cpp-precomp"
+    CPPFLAGS="$CPPFLAGS -DMACOS_X_UNIX -no-cpp-precomp"
+    if test "x$MACARCH" = "xboth"; then
+      CPPFLAGS="$CPPFLAGS -I/Developer/SDKs/MacOSX10.4u.sdk/Developer/Headers/FlatCarbon"
+    else
+      CPPFLAGS="$CPPFLAGS -I/Developer/Headers/FlatCarbon"
+    fi
 
     dnl If Carbon is found, assume we don't want X11
     dnl unless it was specifically asked for (--with-x)
@@ -159,6 +164,14 @@
     fi
   fi
 
+  dnl avoid a bug with -O2 for intel
+  if test "$MACARCH" = "intel" -o "$MACARCH" = "both"; then
+    CFLAGS=`echo "$CFLAGS" | sed 's/-O[[23456789]]/-Oz/'`
+  fi
+
+  CPPFLAGS="$CPPFLAGS $MAC_OSX_ARCH"
+  LDFLAGS="$LDFLAGS $MAC_OSX_ARCH"
+
 else
   AC_MSG_RESULT(no)
 fi
@@ -2794,6 +2807,9 @@
     AC_MSG_RESULT(no)
   fi
 fi
+if test "x$MACARCH" = "xboth"; then
+  LDFLAGS="$LDFLAGS -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc"
+fi
 
 dnl gcc 3.1 changed the meaning of -MM.  The only solution appears to be to
 dnl use "-isystem" instead of "-I" for all non-Vim include dirs.