diff --git a/configure b/configure
index 40ba33c9efbc15305bd741361c567f976529fff9..f20c8a2d301c520a97af74ca0026a280e08b2c77 100755
--- a/configure
+++ b/configure
@@ -17787,22 +17787,7 @@ esac
 fi
 
 # Similarly, use system's getopt_long() only if system provides struct option.
-# Solaris' getopt() doesn't do what we want for long options, so always use
-# our versions on that platform.
-if test "$PORTNAME" = "solaris"; then
-  case " $LIBOBJS " in
-  *" getopt.$ac_objext "* ) ;;
-  *) LIBOBJS="$LIBOBJS getopt.$ac_objext"
- ;;
-esac
-
-  case " $LIBOBJS " in
-  *" getopt_long.$ac_objext "* ) ;;
-  *) LIBOBJS="$LIBOBJS getopt_long.$ac_objext"
- ;;
-esac
-
-elif test x"$ac_cv_type_struct_option" = xyes ; then
+if test x"$ac_cv_type_struct_option" = xyes ; then
 
 for ac_func in getopt_long
 do
@@ -17914,6 +17899,17 @@ esac
 
 fi
 
+# Solaris' getopt() doesn't do what we want for long options, so always use
+# our version on that platform.
+if test "$PORTNAME" = "solaris"; then
+  case " $LIBOBJS " in
+  *" getopt.$ac_objext "* ) ;;
+  *) LIBOBJS="$LIBOBJS getopt.$ac_objext"
+ ;;
+esac
+
+fi
+
 # Win32 support
 if test "$PORTNAME" = "win32"; then
 
diff --git a/configure.in b/configure.in
index 93230792e70f7f0a74b67f0106acdbcc74d0fcd3..33560af351c4921b12d4fd2a43c9531f0f2d248e 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.591 2009/02/12 15:12:47 adunstan Exp $
+dnl $PostgreSQL: pgsql/configure.in,v 1.592 2009/03/27 19:58:11 tgl Exp $
 dnl
 dnl Developers, please strive to achieve this order:
 dnl
@@ -1270,17 +1270,18 @@ else
 fi
 
 # Similarly, use system's getopt_long() only if system provides struct option.
-# Solaris' getopt() doesn't do what we want for long options, so always use
-# our versions on that platform.
-if test "$PORTNAME" = "solaris"; then
-  AC_LIBOBJ(getopt)
-  AC_LIBOBJ(getopt_long)
-elif test x"$ac_cv_type_struct_option" = xyes ; then
+if test x"$ac_cv_type_struct_option" = xyes ; then
   AC_REPLACE_FUNCS([getopt_long])
 else
   AC_LIBOBJ(getopt_long)
 fi
 
+# Solaris' getopt() doesn't do what we want for long options, so always use
+# our version on that platform.
+if test "$PORTNAME" = "solaris"; then
+  AC_LIBOBJ(getopt)
+fi
+
 # Win32 support
 if test "$PORTNAME" = "win32"; then
 AC_REPLACE_FUNCS(gettimeofday)