Ensure Eigen is at least 3.1.0 for Eigen/SparseCore.

- Eigen/SparseCore is required by covariance_impl, this was added in
  v 3.1.0 of Eigen, and thus without at least this version Ceres will
  not compile.
- Note that Ubuntu 12.04 provides only version 3.0.5 in the mainline
  repository.
- Update docs to match CMake check for Eigen >= 3.2.2 to avoid warning
  about reduced sparse performance.

Change-Id: I291bb185d1c76e1e1422429169a76e3f1b828163
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1812df4..1565413 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -262,6 +262,12 @@
 HANDLE_LEGACY_INCLUDE_DEPENDENCY_HINT(EIGEN_INCLUDE EIGEN_INCLUDE_DIR_HINTS)
 FIND_PACKAGE(Eigen REQUIRED)
 IF (EIGEN_FOUND)
+  IF (EIGEN_VERSION VERSION_LESS 3.1.0)
+    MESSAGE(FATAL_ERROR "-- Ceres requires Eigen version >= 3.1.0 in order "
+      "that Eigen/SparseCore be available, detected version of Eigen is: "
+      "$EIGEN_VERSION")
+  ENDIF (EIGEN_VERSION VERSION_LESS 3.1.0)
+
   MESSAGE("-- Found Eigen version ${EIGEN_VERSION}: ${EIGEN_INCLUDE_DIRS}")
   # Ensure that only MPL2 licensed code is part of the default build.
   MESSAGE("")
diff --git a/docs/source/building.rst b/docs/source/building.rst
index fd86e7e..9d6ab82 100644
--- a/docs/source/building.rst
+++ b/docs/source/building.rst
@@ -26,7 +26,7 @@
 :ref:`section-customizing` .
 
 - `Eigen <http://eigen.tuxfamily.org/index.php?title=Main_Page>`_
-  3.2.1 or later.  **Required**
+  3.2.2 or later **strongly** recommended, 3.1.0 or later **required**.
 
   .. NOTE ::