From 2ce45ad63210562da71f194404a1389eb82b2ed7 Mon Sep 17 00:00:00 2001
From: bangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Date: Sat, 1 Oct 2011 13:00:44 +0000
Subject: [PATCH] Fall back to a list of Trilinos libs if we can't find the
 file in which it should be listed.

git-svn-id: https://svn.dealii.org/trunk@24498 0785d39b-7218-0410-832d-ea1e28bc413d
---
 deal.II/aclocal.m4 | 25 +++++++++++++++++--------
 deal.II/configure  | 13 +++++++++++--
 2 files changed, 28 insertions(+), 10 deletions(-)

diff --git a/deal.II/aclocal.m4 b/deal.II/aclocal.m4
index 73384ace33..33d1428915 100644
--- a/deal.II/aclocal.m4
+++ b/deal.II/aclocal.m4
@@ -6523,17 +6523,26 @@ AC_DEFUN(DEAL_II_CHECK_TRILINOS_LIBS, dnl
   dnl Trilinos' cmake invokation stores the set of libraries
   dnl in a special file for consumption of cmake at a later
   dnl time. We'll simply grep through it. Unfortunately, it has
-  dnl changed place in Trilinos starting from version 10.8.0, so 
-  dnl manually detected prior version
-  if test "$DEAL_II_TRILINOS_VERSION_MAJOR" = 10 -a "$DEAL_II_TRILINOS_VERSION_MINOR" -lt 8 ; then
-    DEAL_II_TRILINOS_LIBS="`grep Trilinos_LIBRARIES $DEAL_II_TRILINOS_INCDIR/TrilinosConfig.cmake \
-      | perl -pi -e 's/.*\"(.*)\".*/\1/g; s/;/ /g;'`"
-    AC_MSG_RESULT([$DEAL_II_TRILINOS_LIBS])
-  else
+  dnl changed place in Trilinos starting from version 10.8.0, and
+  dnl at least 10.0.4 did not have the file at all. So test
+  dnl whether the file is available at one location or another
+  dnl and if it is at neither then fall back to a hardcoded
+  dnl list of libraries
+  if test -f $DEAL_II_TRILINOS_LIBDIR/cmake/Trilinos/TrilinosConfig.cmake ; then
+    dnl This is the location for 10.8 and following
     DEAL_II_TRILINOS_LIBS="`grep Trilinos_LIBRARIES $DEAL_II_TRILINOS_LIBDIR/cmake/Trilinos/TrilinosConfig.cmake \
       | perl -pi -e 's/.*\"(.*)\".*/\1/g; s/;/ /g;'`"
-    AC_MSG_RESULT([$DEAL_II_TRILINOS_LIBS])
+  else
+    if test -f $DEAL_II_TRILINOS_INCDIR/TrilinosConfig.cmake ; then
+      dnl The location prior to 10.8
+      DEAL_II_TRILINOS_LIBS="`grep Trilinos_LIBRARIES $DEAL_II_TRILINOS_INCDIR/TrilinosConfig.cmake \
+        | perl -pi -e 's/.*\"(.*)\".*/\1/g; s/;/ /g;'`"
+    else
+      dnl Fall back to the fixed list
+      DEAL_II_TRILINOS_LIBS="stratimikosamesos stratimikosaztecoo stratimikosifpack stratimikosml stratimikos ml amesos belos ifpack aztecoo rtop sacado thyra thyraepetra thyraepetraext epetraext epetra teuchos triutils"
+    fi
   fi
+  AC_MSG_RESULT([$DEAL_II_TRILINOS_LIBS])
   AC_SUBST(DEAL_II_TRILINOS_LIBS)
 ])
 
diff --git a/deal.II/configure b/deal.II/configure
index 37888e4601..705789881e 100755
--- a/deal.II/configure
+++ b/deal.II/configure
@@ -10871,8 +10871,17 @@ $as_echo "no" >&6; }
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for the set of Trilinos libraries" >&5
 $as_echo_n "checking for the set of Trilinos libraries... " >&6; }
 
-        DEAL_II_TRILINOS_LIBS="`grep Trilinos_LIBRARIES $DEAL_II_TRILINOS_INCDIR/TrilinosConfig.cmake \
-    | perl -pi -e 's/.*\"(.*)\".*/\1/g; s/;/ /g;'`"
+                  if test -f $DEAL_II_TRILINOS_LIBDIR/cmake/Trilinos/TrilinosConfig.cmake ; then
+        DEAL_II_TRILINOS_LIBS="`grep Trilinos_LIBRARIES $DEAL_II_TRILINOS_LIBDIR/cmake/Trilinos/TrilinosConfig.cmake \
+      | perl -pi -e 's/.*\"(.*)\".*/\1/g; s/;/ /g;'`"
+  else
+    if test -f $DEAL_II_TRILINOS_INCDIR/TrilinosConfig.cmake ; then
+            DEAL_II_TRILINOS_LIBS="`grep Trilinos_LIBRARIES $DEAL_II_TRILINOS_INCDIR/TrilinosConfig.cmake \
+        | perl -pi -e 's/.*\"(.*)\".*/\1/g; s/;/ /g;'`"
+    else
+            DEAL_II_TRILINOS_LIBS="stratimikosamesos stratimikosaztecoo stratimikosifpack stratimikosml stratimikos ml amesos belos ifpack aztecoo rtop sacado thyra thyraepetra thyraepetraext epetraext epetra teuchos triutils"
+    fi
+  fi
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DEAL_II_TRILINOS_LIBS" >&5
 $as_echo "$DEAL_II_TRILINOS_LIBS" >&6; }
 
-- 
2.39.5