diff --git a/ChangeLog b/ChangeLog
index c043df7..8e7facc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2008-11-15  Ali Bahrami  <ali_gnu@emvision.com>
+	    Ben Elliston  <bje@gnu.org>
+
+	* config.guess: Add support for detecting x86_64 Solaris.
+	* testsuite/config-guess.data: Add a previously missing test case
+	for i86pc SunOS.
+
 2008-09-28  Ben Elliston  <bje@gnu.org>
 	    Dann Corbit <DCorbit@connx.com>
 
diff --git a/config.guess b/config.guess
index f0f0d36..c0d5198 100755
--- a/config.guess
+++ b/config.guess
@@ -4,7 +4,7 @@
 #   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
 #   Free Software Foundation, Inc.
 
-timestamp='2008-09-28'
+timestamp='2008-11-15'
 
 # This file is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by
@@ -331,7 +331,20 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
 	echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
 	exit ;;
     i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
-	echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	eval $set_cc_for_build
+	SUN_ARCH="i386"
+	# If there is a compiler, see if it is configured for 64-bit objects.
+	# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
+	# This test works for both compilers.
+	if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
+	    if /usr/bin/echo '\n#ifdef __amd64\nIS_64BIT_ARCH\n#endif' | \
+		(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
+		grep IS_64BIT_ARCH >/dev/null
+	    then
+		SUN_ARCH="x86_64"
+	    fi
+	fi
+	echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
 	exit ;;
     sun4*:SunOS:6*:*)
 	# According to config.sub, this is the proper way to canonicalize
diff --git a/testsuite/config-guess.data b/testsuite/config-guess.data
index 2293f9c..37d55e0 100644
--- a/testsuite/config-guess.data
+++ b/testsuite/config-guess.data
@@ -33,6 +33,7 @@ x86_64	1.0			MINGW		ignored	x86_64-pc-mingw32
 i386	1.0			MINGW		ignored	i386-pc-mingw32
 SX-8R	1.0			SUPER-UX	ignored	sx8r-nec-superux1.0
 i86xen	5.6			SunOS		ignored	i386-pc-solaris2.6
+i86pc	5.6			SunOS		ignored	i386-pc-solaris2.6
 IA64	6.0			Interix		ignored	ia64-unknown-interix6.0
 BePC	1.0			Haiku		ignored	i586-pc-haiku
 padre	2.6.15			Linux		ignored	sparc-unknown-linux-gnu