diff --git a/configure b/configure
index b4eb5c5dd980b5041b8bc621119a5464fe88b4e4..1e9a2e2b28a84f3b6e586b8ba6708b1ad24a11e5 100755
--- a/configure
+++ b/configure
@@ -11574,84 +11574,6 @@ fi
 
 
 
-# SunOS doesn't handle negative byte comparisons properly with +/- return
-echo "$as_me:$LINENO: checking for working memcmp" >&5
-echo $ECHO_N "checking for working memcmp... $ECHO_C" >&6
-if test "${ac_cv_func_memcmp_working+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  if test "$cross_compiling" = yes; then
-  ac_cv_func_memcmp_working=no
-else
-  cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
-
-#ifdef F77_DUMMY_MAIN
-#  ifdef __cplusplus
-     extern "C"
-#  endif
-   int F77_DUMMY_MAIN() { return 1; }
-#endif
-int
-main ()
-{
-
-  /* Some versions of memcmp are not 8-bit clean.  */
-  char c0 = 0x40, c1 = 0x80, c2 = 0x81;
-  if (memcmp(&c0, &c2, 1) >= 0 || memcmp(&c1, &c2, 1) >= 0)
-    exit (1);
-
-  /* The Next x86 OpenStep bug shows up only when comparing 16 bytes
-     or more and with at least one buffer not starting on a 4-byte boundary.
-     William Lewis provided this test program.   */
-  {
-    char foo[21];
-    char bar[21];
-    int i;
-    for (i = 0; i < 4; i++)
-      {
-        char *a = foo + i;
-        char *b = bar + i;
-        strcpy (a, "--------01111111");
-        strcpy (b, "--------10000000");
-        if (memcmp (a, b, 16) >= 0)
-          exit (1);
-      }
-    exit (0);
-  }
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_func_memcmp_working=yes
-else
-  echo "$as_me: program exited with status $ac_status" >&5
-echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
-( exit $ac_status )
-ac_cv_func_memcmp_working=no
-fi
-rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
-fi
-fi
-echo "$as_me:$LINENO: result: $ac_cv_func_memcmp_working" >&5
-echo "${ECHO_T}$ac_cv_func_memcmp_working" >&6
-test $ac_cv_func_memcmp_working = no && LIBOBJS="$LIBOBJS memcmp.$ac_objext"
-
-
 
 
 
@@ -12002,7 +11924,7 @@ fi
 # We use our snprintf.c emulation if either snprintf() or vsnprintf()
 # is missing.  Yes, there are machines that have only one.  We may
 # also decide to use snprintf.c if snprintf() is present but does not
-# have working "long long int" support -- see below.
+# have all the features we need --- see below.
 
 pgac_need_repl_snprintf=no
 
@@ -12162,61 +12084,6 @@ fi
 done
 
 
-echo "$as_me:$LINENO: checking whether printf supports argument control" >&5
-echo $ECHO_N "checking whether printf supports argument control... $ECHO_C" >&6
-if test "${pgac_cv_printf_arg_control+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  if test "$cross_compiling" = yes; then
-  pgac_cv_printf_arg_control=cross
-else
-  cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
-#include <stdio.h>
-#include <string.h>
-
-int main()
-{
-  char buf[100];
-
-  /* can it swap arguments? */
-  snprintf(buf, 100, "%2\$d %1\$d", 3, 4);
-  if (strcmp(buf, "4 3") != 0)
-    return 1;
-  return 0;
-}
-_ACEOF
-rm -f conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  pgac_cv_printf_arg_control=yes
-else
-  echo "$as_me: program exited with status $ac_status" >&5
-echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
-( exit $ac_status )
-pgac_cv_printf_arg_control=no
-fi
-rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
-fi
-
-fi
-echo "$as_me:$LINENO: result: $pgac_cv_printf_arg_control" >&5
-echo "${ECHO_T}$pgac_cv_printf_arg_control" >&6
-
-# cross compiler should use our snprintf too
-if test $pgac_cv_printf_arg_control != yes ; then
-  pgac_need_repl_snprintf=yes
-fi
 
 # Check whether <stdio.h> declares snprintf() and vsnprintf(); if not,
 # include/c.h will provide declarations.  Note this is a separate test
@@ -15044,6 +14911,64 @@ cat >>confdefs.h <<_ACEOF
 _ACEOF
 
 
+# Also force use of our snprintf if system's doesn't do arg control
+if test $pgac_need_repl_snprintf = no; then
+  echo "$as_me:$LINENO: checking whether printf supports argument control" >&5
+echo $ECHO_N "checking whether printf supports argument control... $ECHO_C" >&6
+if test "${pgac_cv_printf_arg_control+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test "$cross_compiling" = yes; then
+  pgac_cv_printf_arg_control=cross
+else
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+#include <stdio.h>
+#include <string.h>
+
+int main()
+{
+  char buf[100];
+
+  /* can it swap arguments? */
+  snprintf(buf, 100, "%2\$d %1\$d", 3, 4);
+  if (strcmp(buf, "4 3") != 0)
+    return 1;
+  return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  pgac_cv_printf_arg_control=yes
+else
+  echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+( exit $ac_status )
+pgac_cv_printf_arg_control=no
+fi
+rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+
+fi
+echo "$as_me:$LINENO: result: $pgac_cv_printf_arg_control" >&5
+echo "${ECHO_T}$pgac_cv_printf_arg_control" >&6
+
+  if test $pgac_cv_printf_arg_control != yes ; then
+    pgac_need_repl_snprintf=yes
+  fi
+fi
+
 if test $pgac_need_repl_snprintf = yes; then
   LIBOBJS="$LIBOBJS snprintf.$ac_objext"
 fi
@@ -17947,6 +17872,84 @@ fi
 
 fi
 
+# SunOS doesn't handle negative byte comparisons properly with +/- return
+echo "$as_me:$LINENO: checking for working memcmp" >&5
+echo $ECHO_N "checking for working memcmp... $ECHO_C" >&6
+if test "${ac_cv_func_memcmp_working+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test "$cross_compiling" = yes; then
+  ac_cv_func_memcmp_working=no
+else
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+
+#ifdef F77_DUMMY_MAIN
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+#endif
+int
+main ()
+{
+
+  /* Some versions of memcmp are not 8-bit clean.  */
+  char c0 = 0x40, c1 = 0x80, c2 = 0x81;
+  if (memcmp(&c0, &c2, 1) >= 0 || memcmp(&c1, &c2, 1) >= 0)
+    exit (1);
+
+  /* The Next x86 OpenStep bug shows up only when comparing 16 bytes
+     or more and with at least one buffer not starting on a 4-byte boundary.
+     William Lewis provided this test program.   */
+  {
+    char foo[21];
+    char bar[21];
+    int i;
+    for (i = 0; i < 4; i++)
+      {
+        char *a = foo + i;
+        char *b = bar + i;
+        strcpy (a, "--------01111111");
+        strcpy (b, "--------10000000");
+        if (memcmp (a, b, 16) >= 0)
+          exit (1);
+      }
+    exit (0);
+  }
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_func_memcmp_working=yes
+else
+  echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+( exit $ac_status )
+ac_cv_func_memcmp_working=no
+fi
+rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_func_memcmp_working" >&5
+echo "${ECHO_T}$ac_cv_func_memcmp_working" >&6
+test $ac_cv_func_memcmp_working = no && LIBOBJS="$LIBOBJS memcmp.$ac_objext"
+
+
 
 # Select semaphore implementation type.
 if test x"$USE_NAMED_POSIX_SEMAPHORES" = x"1" ; then
diff --git a/configure.in b/configure.in
index 9c81ad5f5aa7d8a76ad55eb54de81c3a0e621b9c..ff5a858240ba44e34d3cc23b373da535e6951e49 100644
--- a/configure.in
+++ b/configure.in
@@ -1,5 +1,5 @@
 dnl Process this file with autoconf to produce a configure script.
-dnl $PostgreSQL: pgsql/configure.in,v 1.400 2005/02/22 03:55:12 momjian Exp $
+dnl $PostgreSQL: pgsql/configure.in,v 1.401 2005/02/24 02:12:15 tgl Exp $
 dnl
 dnl Developers, please strive to achieve this order:
 dnl
@@ -841,9 +841,6 @@ PGAC_VAR_INT_TIMEZONE
 AC_FUNC_ACCEPT_ARGTYPES
 PGAC_FUNC_GETTIMEOFDAY_1ARG
 
-# SunOS doesn't handle negative byte comparisons properly with +/- return
-AC_FUNC_MEMCMP
-
 AC_CHECK_FUNCS([cbrt dlopen fcvt fdatasync getpeereid memmove poll pstat readlink setproctitle setsid sigprocmask symlink sysconf towlower utime utimes waitpid wcstombs])
 
 AC_CHECK_DECLS(fdatasync, [], [], [#include <unistd.h>])
@@ -875,17 +872,12 @@ fi
 # We use our snprintf.c emulation if either snprintf() or vsnprintf()
 # is missing.  Yes, there are machines that have only one.  We may
 # also decide to use snprintf.c if snprintf() is present but does not
-# have working "long long int" support -- see below.
+# have all the features we need --- see below.
 
 pgac_need_repl_snprintf=no
 AC_CHECK_FUNCS(snprintf, [], pgac_need_repl_snprintf=yes)
 AC_CHECK_FUNCS(vsnprintf, [], pgac_need_repl_snprintf=yes)
 
-PGAC_FUNC_PRINTF_ARG_CONTROL
-# cross compiler should use our snprintf too
-if test $pgac_cv_printf_arg_control != yes ; then
-  pgac_need_repl_snprintf=yes
-fi
 
 # Check whether <stdio.h> declares snprintf() and vsnprintf(); if not,
 # include/c.h will provide declarations.  Note this is a separate test
@@ -1074,8 +1066,6 @@ AC_MSG_ERROR([[
 [AC_MSG_RESULT([cross-compiling])])
 
 
-dnl  64-bit section
-dnl
 dnl Check to see if we have a working 64-bit integer type.
 dnl This breaks down into two steps:
 dnl (1) figure out if the compiler has a 64-bit int type with working
@@ -1141,6 +1131,14 @@ AC_DEFINE_UNQUOTED(INT64_FORMAT, $INT64_FORMAT,
 AC_DEFINE_UNQUOTED(UINT64_FORMAT, $UINT64_FORMAT,
                    [Define to the appropriate snprintf format for unsigned 64-bit ints, if any.])
 
+# Also force use of our snprintf if system's doesn't do arg control
+if test $pgac_need_repl_snprintf = no; then
+  PGAC_FUNC_PRINTF_ARG_CONTROL
+  if test $pgac_cv_printf_arg_control != yes ; then
+    pgac_need_repl_snprintf=yes
+  fi
+fi
+
 if test $pgac_need_repl_snprintf = yes; then
   AC_LIBOBJ(snprintf)
 fi
@@ -1197,6 +1195,9 @@ if test $ac_cv_func_fseeko = yes; then
 AC_SYS_LARGEFILE
 fi
 
+# SunOS doesn't handle negative byte comparisons properly with +/- return
+AC_FUNC_MEMCMP
+
 
 # Select semaphore implementation type.
 if test x"$USE_NAMED_POSIX_SEMAPHORES" = x"1" ; then