From: bangerth Date: Wed, 29 Jun 2011 17:04:32 +0000 (+0000) Subject: Auto-detect the Trilinos sub-libs we need to link with and their order. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9d60d3a158f1c5577e8f0fbc1474f20a28096aa3;p=dealii-svn.git Auto-detect the Trilinos sub-libs we need to link with and their order. git-svn-id: https://svn.dealii.org/trunk@23877 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/aclocal.m4 b/deal.II/aclocal.m4 index 2836f4efe6..a83764eec3 100644 --- a/deal.II/aclocal.m4 +++ b/deal.II/aclocal.m4 @@ -6214,6 +6214,7 @@ AC_DEFUN(DEAL_II_CONFIGURE_TRILINOS, dnl DEAL_II_CONFIGURE_TRILINOS_VERSION DEAL_II_CHECK_TRILINOS_MPI_CONSISTENCY DEAL_II_CHECK_TRILINOS_SHARED_STATIC + DEAL_II_CHECK_TRILINOS_LIBS DEAL_II_CHECK_TRILINOS_WARNINGS DEAL_II_CHECK_TRILINOS_HEADER_FILES @@ -6263,6 +6264,15 @@ AC_DEFUN(DEAL_II_CONFIGURE_TRILINOS_VERSION, dnl | perl -pi -e 's/.*VERSION\s+\d?\d\d\d(\d\d)/\1/g;' \ | perl -pi -e 's/0(\d)/\1/g;'` AC_MSG_RESULT([$DEAL_II_TRILINOS_VERSION_MAJOR.$DEAL_II_TRILINOS_VERSION_MINOR.$DEAL_II_TRILINOS_VERSION_SUBMINOR]) + + dnl Verify that we have at least Trilinos 10. This is the + dnl version where Trilinos started using cmake, which allow + dnl us to figure out which libraries Trilinos has built + dnl and in which order they need to be linked + if test "$DEAL_II_TRILINOS_VERSION_MAJOR" -lt 10 ; then + AC_MSG_ERROR([Trilinos versions prior to 10.0 are no longer supported with deal.II.]) + fi + AC_SUBST(DEAL_II_TRILINOS_VERSION_MAJOR) AC_SUBST(DEAL_II_TRILINOS_VERSION_MINOR) AC_SUBST(DEAL_II_TRILINOS_VERSION_SUBMINOR) @@ -6423,6 +6433,28 @@ AC_DEFUN(DEAL_II_CHECK_TRILINOS_SHARED_STATIC, dnl +dnl ------------------------------------------------------------ +dnl Figure out which libraries Trilinos has built and that we +dnl need to link against. Also make sure we know their order +dnl +dnl Usage: DEAL_II_CHECK_TRILINOS_LIBS +dnl +dnl ------------------------------------------------------------ +AC_DEFUN(DEAL_II_CHECK_TRILINOS_LIBS, dnl +[ + AC_MSG_CHECKING(for the set of Trilinos libraries) + + 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 + 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]) + AC_SUBST(DEAL_II_TRILINOS_LIBS) +]) + + + dnl ------------------------------------------------------------ dnl Trilinos has headers that produce tons of warnings when dnl used with -W -Wall (which includes -Wunused). Regrettable diff --git a/deal.II/common/Make.global_options.in b/deal.II/common/Make.global_options.in index 1cb22d2309..285d816de0 100644 --- a/deal.II/common/Make.global_options.in +++ b/deal.II/common/Make.global_options.in @@ -202,31 +202,10 @@ ifeq ($(USE_CONTRIB_METIS),yes) endif # List all trilinos libraries that we want to link with. These must be sorted -# in dependency order to allow for static linking where the order on the -# command line matters. Note that we check the availability of all these -# libraries in aclocal.m4; the two lists should therefore be kept in -# sync. +# in dependency order for linking. Fortunately, we can get the set of +# libraries from Trilinos's cmake files. ifeq ($(USE_CONTRIB_TRILINOS),yes) - DEAL_II_TRILINOS_LIBS = \ - $(DEAL_II_TRILINOS_LIBPREFIX)stratimikosamesos \ - $(DEAL_II_TRILINOS_LIBPREFIX)stratimikosaztecoo \ - $(DEAL_II_TRILINOS_LIBPREFIX)stratimikosifpack \ - $(DEAL_II_TRILINOS_LIBPREFIX)stratimikosml \ - $(DEAL_II_TRILINOS_LIBPREFIX)stratimikos \ - $(DEAL_II_TRILINOS_LIBPREFIX)ml \ - $(DEAL_II_TRILINOS_LIBPREFIX)amesos \ - $(DEAL_II_TRILINOS_LIBPREFIX)belos \ - $(DEAL_II_TRILINOS_LIBPREFIX)ifpack \ - $(DEAL_II_TRILINOS_LIBPREFIX)aztecoo \ - $(DEAL_II_TRILINOS_LIBPREFIX)rtop \ - $(DEAL_II_TRILINOS_LIBPREFIX)sacado \ - $(DEAL_II_TRILINOS_LIBPREFIX)thyra \ - $(DEAL_II_TRILINOS_LIBPREFIX)thyraepetra \ - $(DEAL_II_TRILINOS_LIBPREFIX)thyraepetraext \ - $(DEAL_II_TRILINOS_LIBPREFIX)epetraext \ - $(DEAL_II_TRILINOS_LIBPREFIX)epetra \ - $(DEAL_II_TRILINOS_LIBPREFIX)teuchos \ - $(DEAL_II_TRILINOS_LIBPREFIX)triutils + DEAL_II_TRILINOS_LIBS = $(addprefix $(DEAL_II_TRILINOS_LIBPREFIX), @DEAL_II_TRILINOS_LIBS@) ifeq ($(enable-shared),yes) lib-contrib-trilinos = \ diff --git a/deal.II/configure b/deal.II/configure index 54512b42ca..910c711d9e 100755 --- a/deal.II/configure +++ b/deal.II/configure @@ -650,6 +650,7 @@ DEAL_II_EXPAND_TRILINOS_MPI_BLOCKVECTOR DEAL_II_EXPAND_TRILINOS_BLOCKVECTOR DEAL_II_EXPAND_TRILINOS_MPI_VECTOR DEAL_II_EXPAND_TRILINOS_VECTOR +DEAL_II_TRILINOS_LIBS DEAL_II_TRILINOS_LIBPREFIX DEAL_II_TRILINOS_VERSION_SUBMINOR DEAL_II_TRILINOS_VERSION_MINOR @@ -10628,6 +10629,11 @@ $as_echo_n "checking for Trilinos version... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DEAL_II_TRILINOS_VERSION_MAJOR.$DEAL_II_TRILINOS_VERSION_MINOR.$DEAL_II_TRILINOS_VERSION_SUBMINOR" >&5 $as_echo "$DEAL_II_TRILINOS_VERSION_MAJOR.$DEAL_II_TRILINOS_VERSION_MINOR.$DEAL_II_TRILINOS_VERSION_SUBMINOR" >&6; } + if test "$DEAL_II_TRILINOS_VERSION_MAJOR" -lt 10 ; then + as_fn_error $? "Trilinos versions prior to 10.0 are no longer supported with deal.II." "$LINENO" 5 + fi + + @@ -10783,6 +10789,16 @@ $as_echo "no" >&6; } fi + { $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;'`" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DEAL_II_TRILINOS_LIBS" >&5 +$as_echo "$DEAL_II_TRILINOS_LIBS" >&6; } + + + OLD_CXXFLAGS="$CXXFLAGS" if test "$GXX" = yes ; then diff --git a/deal.II/doc/news/changes.h b/deal.II/doc/news/changes.h index 576ab4d75e..0cb92dc3c7 100644 --- a/deal.II/doc/news/changes.h +++ b/deal.II/doc/news/changes.h @@ -21,6 +21,10 @@ inconvenience this causes.

    +
  1. Removed: deal.II no longer supports Trilinos versions prior to 10.0. +
    +(Wolfgang Bangerth, 2011/06/29) +
  2. Changed: deal.II has a namespace std_cxx1x that was used to import classes from BOOST that are part of the upcoming C++ 1x standard. On the other hand, if your compiler supported a sufficiently large subset @@ -61,6 +65,14 @@ changed to use std_cxx1x::_1, std_cxx1x::_2, etc from now on.

    General

      +
    1. Fixed: deal.II can link with Trilinos but previously it required a +very specific set of Trilinos sub-libraries; if Trilinos had been compiled +with a larger set of sub-libraries, linking would sometimes fail. This +has now been made more generic and deal.II obtains the proper set of +libraries from Trilinos. +
      +(Wolfgang Bangerth, 2011/06/29) +
    2. Fixed: On Mac OS X, linking with some external libraries such as Trilinos sometimes failed due to a misconfiguration of linker flags. This should now be fixed.