Massive roll-up of changes.  See CHANGES.txt.
diff --git a/autogen.sh b/autogen.sh
index 519bb8f..04d65b1 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -4,6 +4,8 @@
 # be included in the distribution.  These files are not checked in because they
 # are automatically generated.
 
+set -e
+
 # Check that we're being run from the right directory.
 if test ! -f src/google/protobuf/stubs/common.h; then
   cat >&2 << __EOF__
@@ -13,6 +15,14 @@
   exit 1
 fi
 
+# Check that gtest is present.  Usually it is already there since the
+# directory is set up as an SVN external.
+if test ! -e gtest; then
+  echo "Google Test not present.  Fetching gtest-1.3.0 from the web..."
+  curl http://googletest.googlecode.com/files/gtest-1.3.0.tar.bz2 | tar jx
+  mv gtest-1.3.0 gtest
+fi
+
 set -ex
 
 # Temporary hack:  Must change C runtime library to "multi-threaded DLL",