--- /dev/null
+#
+# Configuration for the trilinos library:
+#
+
+INCLUDE(CheckCXXSourceCompiles)
+INCLUDE(CheckIncludeFile)
+
+
+MACRO(FEATURE_TRILINOS_FIND_EXTERNAL var)
+
+ FIND_PACKAGE(TRILINOS)
+
+ IF(TRILINOS_FOUND)
+ SET(${var} TRUE)
+ #
+ # So, we have a library. Let's see whether we can use it:
+ #
+
+
+ #
+ # Trilinos 10.6 had quite a number of bugs we ran into, see
+ # for example
+ # https://software.sandia.gov/bugzilla/show_bug.cgi?id=5062
+ # https://software.sandia.gov/bugzilla/show_bug.cgi?id=5319
+ #
+ IF(TRILINOS_MAJOR EQUAL 10 AND TRILINOS_MINOR EQUAL 6)
+ MESSAGE(WARNING "
+Trilinos versions ${TRILINOS_MAJOR}.${TRILINOS_MINOR}.x have bugs that make
+it incompatible with deal.II. Please use versions before 10.6 or after
+10.8.1.
+
+")
+ SET(${var} FALSE)
+ ENDIF()
+
+
+ #
+ # The same is unfortunately true for 10.8.[01]:
+ # https://software.sandia.gov/bugzilla/show_bug.cgi?id=5370
+ #
+ IF( TRILINOS_MAJOR EQUAL 10 AND
+ TRILINOS_MINOR EQUAL 8 AND
+ TRILINOS_SUBMINOR LESS 2 )
+ MESSAGE(WARNING "
+Trilinos versions 10.8.0 and 10.8.1 have bugs that make
+it incompatible with deal.II. Please use versions before 10.6 or after
+10.8.1.
+
+")
+ SET(${var} FALSE)
+ ENDIF()
+
+
+ #
+ # Trilinos has to be configured with the same MPI configuration as
+ # deal.II. So check this:
+ #
+ # TODO: Refine this check...
+ #
+ IF("${TRILINOS_MPI_LIBRARIES}" EQUAL "")
+ SET(TRILINOS_USE_MPI TRUE)
+ ENDIF()
+ IF( (TRILINOS_USE_MPI AND NOT DEAL_II_COMPILER_SUPPORTS_MPI) OR
+ (NOT TRILINOS_USE_MPI AND DEAL_II_COMPILER_SUPPORTS_MPI))
+ MESSAGE(WARNING "
+Trilinos has to be configured with the same MPI configuration as deal.II.
+
+")
+ SET(${var} FALSE)
+ ENDIF()
+
+
+ #
+ # Some verions of Sacado_cmath.hpp does things that aren't compatible
+ # with the -std=c++0x flag of GCC, see deal.II FAQ.
+ # Test whether that is indeed the case
+ #
+ LIST(APPEND CMAKE_REQUIRED_INCLUDES ${TRILINOS_INCLUDE_DIR})
+ LIST(APPEND CMAKE_REQUIRED_FLAGS "-std=c++0x")
+ CHECK_CXX_SOURCE_COMPILES(
+ "
+ #include <Sacado_cmath.hpp>
+ int main(){ return 0; }
+ "
+ TRILINOS_SUPPORTS_CPP11)
+ LIST(REMOVE_ITEM CMAKE_REQUIRED_FLAGS "-std=c++0x")
+ LIST(REMOVE_ITEM CMAKE_REQUIRED_INCLUDES ${TRILINOS_INCLUDE_DIR})
+
+ IF(DEAL_II_CAN_USE_CXX11 AND NOT TRILINOS_SUPPORTS_CPP11)
+ MESSAGE(WARNING "
+Your Trilinos installation is not compatible with the C++ standard selected for this compiler.
+See the deal.II FAQ page for a solution.
+
+")
+ SET(${var} FALSE)
+ ENDIF()
+
+
+ #
+ # Check whether we can find all header files used in deal.II:
+ #
+ LIST(APPEND CMAKE_REQUIRED_INCLUDES ${TRILINOS_INCLUDE_DIR})
+ CHECK_INCLUDE_FILE("Amesos.h" TRILINOS_HAVE_AMESOS_H)
+ CHECK_INCLUDE_FILE("Epetra_CrsGraph.h" TRILINOS_HAVE_EPETRA_CRSGRAPH_H)
+ CHECK_INCLUDE_FILE("Epetra_CrsMatrix.h" TRILINOS_HAVE_EPETRA_CRSMATRIX_H)
+ CHECK_INCLUDE_FILE("Epetra_Import.h" TRILINOS_HAVE_EPETRA_H)
+ CHECK_INCLUDE_FILE("Epetra_LinearProblem.h" TRILINOS_HAVE_EPETRA_H)
+ CHECK_INCLUDE_FILE("Epetra_Map.h" TRILINOS_HAVE_EPETRA_H)
+ CHECK_INCLUDE_FILE("Epetra_MultiVector.h" TRILINOS_HAVE_EPETRA_H)
+ CHECK_INCLUDE_FILE("Epetra_Operator.h" TRILINOS_HAVE_EPETRA_H)
+ CHECK_INCLUDE_FILE("Epetra_SerialComm.h" TRILINOS_HAVE_EPETRA_H)
+ CHECK_INCLUDE_FILE("Epetra_Vector.h" TRILINOS_HAVE_EPETRA_H)
+ CHECK_INCLUDE_FILE("Ifpack.h" TRILINOS_HAVE_IFPACK_H)
+ CHECK_INCLUDE_FILE("ml_MultiLevelPreconditioner.h" TRILINOS_HAVE_ML_MULTILEVELPRECONDITIONER_H)
+ CHECK_INCLUDE_FILE("AztecOO.h" TRILINOS_HAVE_AZTECOO_H)
+ CHECK_INCLUDE_FILE("AztecOO_Operator.h" TRILINOS_HAVE_AZTECOO_OPERATOR_H)
+ CHECK_INCLUDE_FILE("Sacado.hpp" TRILINOS_HAVE_SACADO_HPP)
+ CHECK_INCLUDE_FILE("Teuchos_ParameterList.hpp" TRILINOS_HAVE_TEUCHOS_PARAMETERLIST_HPP)
+ CHECK_INCLUDE_FILE("Teuchos_RCP.hpp" TRILINOS_HAVE_TEUCHOS_RCP_HPP)
+ CHECK_INCLUDE_FILE("Teuchos_RefCountPtr.hpp" TRILINOS_HAVE_TEUCHOS_REFCOUNTPTR_HPP)
+ LIST(REMOVE_ITEM CMAKE_REQUIRED_INCLUDES ${TRILINOS_INCLUDE_DIR})
+
+ #
+ # TODO:
+ #
+ IF(NOT
+ (TRILINOS_HAVE_AMESOS_H AND
+ TRILINOS_HAVE_EPETRA_CRSGRAPH_H AND
+ TRILINOS_HAVE_EPETRA_CRSMATRIX_H AND
+ TRILINOS_HAVE_EPETRA_H AND
+ TRILINOS_HAVE_EPETRA_H AND
+ TRILINOS_HAVE_EPETRA_H AND
+ TRILINOS_HAVE_EPETRA_H AND
+ TRILINOS_HAVE_EPETRA_H AND
+ TRILINOS_HAVE_EPETRA_H AND
+ TRILINOS_HAVE_EPETRA_H AND
+ TRILINOS_HAVE_IFPACK_H AND
+ TRILINOS_HAVE_ML_MULTILEVELPRECONDITIONER_H AND
+ TRILINOS_HAVE_AZTECOO_H AND
+ TRILINOS_HAVE_AZTECOO_OPERATOR_H AND
+ TRILINOS_HAVE_SACADO_HPP AND
+ TRILINOS_HAVE_TEUCHOS_PARAMETERLIST_HPP AND
+ TRILINOS_HAVE_TEUCHOS_RCP_HPP AND
+ TRILINOS_HAVE_TEUCHOS_REFCOUNTPTR_HPP))
+# MESSAGE(WARNING "
+#The Trilinos installation is missing one or more header files necessary for
+#the deal.II Trilinos interfaces. Please re-install Trilinos with the missing
+#Trilinos subpackages enabled.
+#
+#")
+# SET(${var} FALSE)
+ ENDIF()
+
+ ENDIF(TRILINOS_FOUND)
+
+ENDMACRO()
+
+
+MACRO(FEATURE_TRILINOS_CONFIGURE_EXTERNAL var)
+
+ INCLUDE_DIRECTORIES(${TRILINOS_INCLUDE_DIR})
+
+ LIST(APPEND deal_ii_external_libraries
+ ${TRILINOS_LIBRARIES}
+ ${Trilinos_TPL_LIBRARIES}
+ )
+
+ SET(DEAL_II_USE_TRILINOS TRUE)
+
+ SET(DEAL_II_EXPAND_TRILINOS_VECTOR "TrilinosWrappers::Vector")
+ SET(DEAL_II_EXPAND_TRILINOS_MPI_VECTOR "TrilinosWrappers::MPI::Vector")
+ SET(DEAL_II_EXPAND_TRILINOS_BLOCKVECTOR "TrilinosWrappers::BlockVector")
+ SET(DEAL_II_EXPAND_TRILINOS_MPI_BLOCKVECTOR "TrilinosWrappers::MPI::BlockVector")
+ SET(DEAL_II_EXPAND_TRILINOS_SPARSITY_PATTERN "TrilinosWrappers::SparsityPattern")
+ SET(DEAL_II_EXPAND_TRILINOS_BLOCK_SPARSITY_PATTERN "TrilinosWrappers::BlockSparsityPattern")
+
+
+ #
+ # used with -W -Wall (which includes -Wunused). Regrettable
+ # though it may be, these warnings pretty much drown everything
+ # else and we better disable some of the warnings to enable us
+ # to see through the clutter.
+ #
+ CHECK_CXX_COMPILER_FLAG(
+ "-Wno-unused"
+ DEAL_II_HAVE_WNO_UNUSED_FLAG
+ )
+ IF(DEAL_II_HAVE_WNO_UNUSED_FLAG)
+ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused")
+ ENDIF()
+
+ CHECK_CXX_COMPILER_FLAG(
+ "-Wno-overloaded-virtual"
+ DEAL_II_HAVE_WNO_OVERLOADED_VIRTUAL_FLAG
+ )
+ IF(DEAL_II_HAVE_WNO_OVERLOADED_VIRTUAL_FLAG)
+ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-overloaded-virtual")
+ ENDIF()
+
+ CHECK_CXX_COMPILER_FLAG(
+ "-Wno-extra"
+ DEAL_II_HAVE_WNO_EXTRA_FLAG
+ )
+ IF(DEAL_II_HAVE_WNO_EXTRA_FLAG)
+ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-extra")
+ ENDIF()
+
+
+ SET(${var} TRUE)
+
+ENDMACRO()
+
+
+CONFIGURE_FEATURE(TRILINOS)
-dnl ------------------------------------------------------------
-dnl Check whether Trilinos is installed, and if so store the
-dnl respective links
-dnl
-dnl Usage: DEAL_II_CONFIGURE_TRILINOS
-dnl
-dnl ------------------------------------------------------------
-AC_DEFUN(DEAL_II_CONFIGURE_TRILINOS, dnl
-[
- AC_MSG_CHECKING(for Trilinos directory)
-
- AC_ARG_WITH(trilinos,
- [AS_HELP_STRING([--with-trilinos=/path/to/trilinos],
- [Specify the path to the Trilinos installation, of which the include and lib directories are subdirs; use this if you want to override the TRILINOS_DIR environment variable.])],
- [
- dnl Special case when someone does --with-trilinos=no
- if test "x$withval" = "xno" ; then
- AC_MSG_RESULT([explicitly disabled])
- USE_CONTRIB_TRILINOS=no
- else
- USE_CONTRIB_TRILINOS=yes
- DEAL_II_TRILINOS_DIR="$withval"
- AC_MSG_RESULT($DEAL_II_TRILINOS_DIR)
-
- dnl Make sure that what was specified is actually correct
- if test ! -d $DEAL_II_TRILINOS_DIR/include \
- -o ! -d $DEAL_II_TRILINOS_DIR/lib ; then
- AC_MSG_ERROR([Path to Trilinos specified with --with-trilinos does not point to a complete Trilinos installation])
- fi
-
- DEAL_II_TRILINOS_INCDIR="$DEAL_II_TRILINOS_DIR/include"
- DEAL_II_TRILINOS_LIBDIR="$DEAL_II_TRILINOS_DIR/lib"
- fi
- ],
- [
- dnl Take something from the environment variables, if it is there
- if test "x$TRILINOS_DIR" != "x" ; then
- dnl Special case when someone does --with-trilinos=no
- if test "x$withval" = "xno" ; then
- AC_MSG_RESULT([explicitly disabled])
- USE_CONTRIB_TRILINOS=no
- else
- USE_CONTRIB_TRILINOS=yes
- DEAL_II_TRILINOS_DIR="$TRILINOS_DIR"
- AC_MSG_RESULT($DEAL_II_TRILINOS_DIR)
-
- dnl Make sure that what this is actually correct
- if test ! -d $DEAL_II_TRILINOS_DIR/include \
- -o ! -d $DEAL_II_TRILINOS_DIR/lib ; then
- AC_MSG_ERROR([The path to Trilinos specified in the TRILINOS_DIR environment variable does not point to a complete Trilinos installation])
- fi
- DEAL_II_TRILINOS_INCDIR="$DEAL_II_TRILINOS_DIR/include"
- DEAL_II_TRILINOS_LIBDIR="$DEAL_II_TRILINOS_DIR/lib"
- fi
- else
- USE_CONTRIB_TRILINOS=no
- DEAL_II_TRILINOS_DIR=""
- AC_MSG_RESULT(not found)
- fi
- ])
-
- AC_MSG_CHECKING(for Trilinos header directory)
-
- AC_ARG_WITH(trilinos-include,
- [AS_HELP_STRING([--with-trilinos-include=/path/to/trilinos],
- [Specify the path to the Trilinos include; use this if you want to override the TRILINOS_INCDIR environment variable.])],
- [
- dnl Special case when someone does --with-trilinos=no
- if test "x$withval" = "xno" ; then
- AC_MSG_RESULT([explicitly disabled])
- USE_CONTRIB_TRILINOS=no
- else
- USE_CONTRIB_TRILINOS=yes
- DEAL_II_TRILINOS_INCDIR="$withval"
- AC_MSG_RESULT($DEAL_II_TRILINOS_INCDIR)
-
- dnl Make sure that what was specified is actually correct
- if test ! -d $DEAL_II_TRILINOS_INCDIR ; then
- AC_MSG_ERROR([Path to Trilinos specified with --with-trilinos-include does not point to a complete Trilinos installation])
- fi
- fi
- ],
- [
- dnl Take something from the environment variables, if it is there
- if test "x$TRILINOS_INCDIR" != "x" ; then
- USE_CONTRIB_TRILINOS=yes
- DEAL_II_TRILINOS_INCDIR="$TRILINOS_INCDIR"
- AC_MSG_RESULT($DEAL_II_TRILINOS_INCDIR)
-
- dnl Make sure that what this is actually correct
- if test ! -d $DEAL_II_TRILINOS_INCDIR ; then
- AC_MSG_ERROR([The path to Trilinos includes specified in the TRILINOS_INCDIR environment variable does not point to a valid directory])
- fi
- else
- dnl --with-trilinos-include not explicitly specified. do
- dnl nothing if --with-trilinos has previously been specified,
- dnl otherwise say no to trilinos
- if test "x${USE_CONTRIB_TRILINOS}" != "xyes" ; then
- USE_CONTRIB_TRILINOS=no
- DEAL_II_TRILINOS_INCDIR=""
- AC_MSG_RESULT(not found)
- else
- AC_MSG_RESULT(not explicitly specified)
- fi
- fi
- ])
-
- AC_MSG_CHECKING(for Trilinos library directory)
-
- AC_ARG_WITH(trilinos-libs,
- [AS_HELP_STRING([--with-trilinos-libs=/path/to/trilinos],
- [Specify the path to the Trilinos libraries; use this if you want to override the TRILINOS_LIBDIR environment variable.])],
- [
- dnl Special case when someone does --with-trilinos=no
- if test "x$withval" = "xno" ; then
- AC_MSG_RESULT([explicitly disabled])
- USE_CONTRIB_TRILINOS=no
- else
- USE_CONTRIB_TRILINOS=yes
- DEAL_II_TRILINOS_LIBDIR="$withval"
- AC_MSG_RESULT($DEAL_II_TRILINOS_LIBDIR)
-
- dnl Make sure that what was specified is actually correct
- if test ! -d $DEAL_II_TRILINOS_LIBDIR ; then
- AC_MSG_ERROR([Path to Trilinos libraries with --with-trilinos-libs does not point to a valid directory])
- fi
- fi
- ],
- [
- dnl Take something from the environment variables, if it is there
- if test "x$TRILINOS_LIBDIR" != "x" ; then
- USE_CONTRIB_TRILINOS=yes
- DEAL_II_TRILINOS_LIBDIR="$TRILINOS_LIBDIR"
- AC_MSG_RESULT($DEAL_II_TRILINOS_LIBDIR)
-
- dnl Make sure that what this is actually correct
- if test ! -d $DEAL_II_TRILINOS_LIBDIR ; then
- AC_MSG_ERROR([The path to Trilinos specified in the TRILINOS_LIBDIR environment variable does not point to a complete Trilinos installation])
- fi
- else
- dnl --with-trilinos-libs not explicitly specified. do
- dnl nothing if --with-trilinos has previously been specified,
- dnl otherwise say no to trilinos
- if test "x${USE_CONTRIB_TRILINOS}" != "xyes" ; then
- USE_CONTRIB_TRILINOS=no
- DEAL_II_TRILINOS_LIBDIR=""
- AC_MSG_RESULT(not found)
- else
- AC_MSG_RESULT(not explicitly specified)
- fi
- fi
- ])
-
- dnl If we have found Trilinos, determine and set additional pieces of data
- if test "$USE_CONTRIB_TRILINOS" = "yes" ; then
- AC_DEFINE(DEAL_II_USE_TRILINOS, 1,
- [Defined if a Trilinos installation was found and is going
- to be used])
-
- dnl Set an additional variable (not via AC_DEFINE, since we don't want
- dnl to have it in config.h) which we can use in doc/doxygen/options.dox.in.
- dnl If we have Trilinos, then the value of this variable expands to
- dnl defining the string "DEAL_II_USE_TRILINOS" for the preprocessor. If
- dnl we don't have no Trilinos, then it does not define this string.
- DEAL_II_DEFINE_DEAL_II_USE_TRILINOS=DEAL_II_USE_TRILINOS
-
- 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
-
- DEAL_II_EXPAND_TRILINOS_VECTOR="TrilinosWrappers::Vector"
- DEAL_II_EXPAND_TRILINOS_MPI_VECTOR="TrilinosWrappers::MPI::Vector"
- DEAL_II_EXPAND_TRILINOS_BLOCKVECTOR="TrilinosWrappers::BlockVector"
- DEAL_II_EXPAND_TRILINOS_MPI_BLOCKVECTOR="TrilinosWrappers::MPI::BlockVector"
- DEAL_II_EXPAND_TRILINOS_SPARSITY_PATTERN="TrilinosWrappers::SparsityPattern"
- DEAL_II_EXPAND_TRILINOS_BLOCK_SPARSITY_PATTERN="TrilinosWrappers::BlockSparsityPattern"
-
- dnl Finally set with_trilinos if this hasn't happened yet
- if test "x$with_trilinos" = "x" ; then
- with_trilinos="yes"
- fi
- fi
-
- dnl Make sure that the right values for Trilinos vectors are written into
- dnl common/template-arguments.in
- AC_SUBST(DEAL_II_EXPAND_TRILINOS_VECTOR)
- AC_SUBST(DEAL_II_EXPAND_TRILINOS_MPI_VECTOR)
- AC_SUBST(DEAL_II_EXPAND_TRILINOS_BLOCKVECTOR)
- AC_SUBST(DEAL_II_EXPAND_TRILINOS_MPI_BLOCKVECTOR)
- AC_SUBST(DEAL_II_EXPAND_TRILINOS_SPARSITY_PATTERN)
- AC_SUBST(DEAL_II_EXPAND_TRILINOS_BLOCK_SPARSITY_PATTERN)
-])
-
-
-
-dnl ------------------------------------------------------------
-dnl Figure out the version numbers of Trilinos.
-dnl
-dnl Usage: DEAL_II_CONFIGURE_TRILINOS_VERSION
-dnl
-dnl ------------------------------------------------------------
-AC_DEFUN(DEAL_II_CONFIGURE_TRILINOS_VERSION, dnl
-[
- AC_MSG_CHECKING([for Trilinos version])
- DEAL_II_TRILINOS_VERSION_MAJOR=`cat $DEAL_II_TRILINOS_INCDIR/Trilinos_version.h \
- | grep "#define TRILINOS_MAJOR_VERSION" \
- | perl -pi -e 's/.*VERSION\s+//g;'`
- DEAL_II_TRILINOS_VERSION_MINOR=`cat $DEAL_II_TRILINOS_INCDIR/Trilinos_version.h \
- | grep "#define TRILINOS_MAJOR_MINOR_VERSION" \
- | perl -pi -e 's/.*VERSION\s+\d?\d(\d\d)\d\d/\1/g;' \
- | perl -pi -e 's/0(\d)/\1/g;'`
- DEAL_II_TRILINOS_VERSION_SUBMINOR=`cat $DEAL_II_TRILINOS_INCDIR/Trilinos_version.h \
- | grep "#define TRILINOS_MAJOR_MINOR_VERSION" \
- | 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
-
- dnl Trilinos 10.6 had quite a number of bugs we ran into, see
- dnl for example
- dnl https://software.sandia.gov/bugzilla/show_bug.cgi?id=5062
- dnl https://software.sandia.gov/bugzilla/show_bug.cgi?id=5319
- dnl The same is unfortunately true for 10.8.[01]:
- dnl https://software.sandia.gov/bugzilla/show_bug.cgi?id=5370
- if test "$DEAL_II_TRILINOS_VERSION_MAJOR" = 10 -a "$DEAL_II_TRILINOS_VERSION_MINOR" = 6 ; then
- AC_MSG_ERROR([Trilinos versions 10.6.x have bugs that make it incompatible
- with deal.II. Please use versions before 10.6 or after 10.8.1.])
- fi
- if test "$DEAL_II_TRILINOS_VERSION_MAJOR" = 10 \
- -a "$DEAL_II_TRILINOS_VERSION_MINOR" = 8 \
- -a "$DEAL_II_TRILINOS_VERSION_SUBMINOR" -lt 2 ; then
- AC_MSG_ERROR([Trilinos versions 10.8.0 and 10.8.1 have bugs that make it incompatible
- with deal.II. Please use versions before 10.6 or after 10.8.1.])
- fi
-
- AC_SUBST(DEAL_II_TRILINOS_VERSION_MAJOR)
- AC_SUBST(DEAL_II_TRILINOS_VERSION_MINOR)
- AC_SUBST(DEAL_II_TRILINOS_VERSION_SUBMINOR)
- AC_SUBST(DEAL_II_TRILINOS_LIBPREFIX)
-])
-
-
-
-dnl -------------------------------------------------------------
-dnl Make sure that if Trilinos was built with/without MPI, then
-dnl deal.II was built with the same flags.
-dnl
-dnl Usage: DEAL_II_CHECK_TRILINOS_MPI_CONSISTENCY
-dnl
-dnl -------------------------------------------------------------
-AC_DEFUN(DEAL_II_CHECK_TRILINOS_MPI_CONSISTENCY, dnl
-[
- dnl Check for presence of Epetra_config.h that we need to detect MPI
- dnl settings
- AC_MSG_CHECKING(Epetra_config.h presence)
- if test -f $DEAL_II_TRILINOS_INCDIR/Epetra_config.h ; then
- AC_MSG_RESULT(yes)
- else
- AC_MSG_RESULT(no)
- exit 1;
- fi
-
- AC_MSG_CHECKING(for consistency of Trilinos and deal.II MPI settings)
- AC_LANG(C++)
-
- OLD_CXXFLAGS="$CXXFLAGS"
- CXXFLAGS="$CXXFLAGS -I$DEAL_II_TRILINOS_INCDIR"
-
- dnl Trilinos Epetra's Epetra_config.h might provide
- dnl #define PACKAGE_BUGREPORT
- dnl #define PACKAGE_NAME
- dnl #define PACKAGE_STRING
- dnl #define PACKAGE_TARNAME
- dnl #define PACKAGE_VERSION
- dnl which is already set for the deal.II package. So undefine them for
- dnl this test.
- cp confdefs.h confdefs.h.bak
- echo "#undef PACKAGE_BUGREPORT" >> confdefs.h
- echo "#undef PACKAGE_NAME" >> confdefs.h
- echo "#undef PACKAGE_STRING" >> confdefs.h
- echo "#undef PACKAGE_TARNAME" >> confdefs.h
- echo "#undef PACKAGE_VERSION" >> confdefs.h
-
- if test "x$DEAL_II_USE_MPI" = "xyes" ; then
- dnl So we support MPI. Check that our Trilinos installation
- dnl does too. Epetra sets the variable HAVE_MPI to 1 in case
- dnl supports MPI, and does not set it otherwise, so just read
- dnl out that information.
- AC_TRY_COMPILE(
- [
- #include <Epetra_config.h>
- ],
- [
- #ifndef HAVE_MPI
- compile error;
- #endif
- ],
- [
- AC_MSG_RESULT(yes)
- ],
- [
- AC_MSG_ERROR([Trilinos was not built for MPI, but deal.II is!])
- exit 1;
- ])
- else
- dnl So we don't support MPI. Check that our Trilinos installation
- dnl doesn't either.
- AC_TRY_COMPILE(
- [
- #include <Epetra_config.h>
- ],
- [
- #ifdef HAVE_MPI
- compile error;
- #endif
- ],
- [
- AC_MSG_RESULT(yes)
- ],
- [
- AC_MSG_ERROR([Trilinos was built for MPI, but deal.II is not!])
- exit 1;
- ])
- fi
-
- mv confdefs.h.bak confdefs.h
- CXXFLAGS="${OLD_CXXFLAGS}"
-])
-
-
-
-dnl ------------------------------------------------------------
-dnl Check whether the installed version of Trilinos uses shared
-dnl or static libs, or both. Produce an error if this doesn't
-dnl match the kind of libraries we produce here
-dnl
-dnl Usage: DEAL_II_CHECK_TRILINOS_SHARED_STATIC
-dnl
-dnl ------------------------------------------------------------
-AC_DEFUN(DEAL_II_CHECK_TRILINOS_SHARED_STATIC, dnl
-[
- dnl Check using the epetra library since that should always be there
- dnl The problem is that on Debian, the library isn't called
- dnl libepetra.so, but instead libtrilinos_epetra.so, so
- dnl record this prefix in a variable of its own
- AC_MSG_CHECKING(whether Trilinos uses shared libraries)
- if test -f $DEAL_II_TRILINOS_LIBDIR/libepetra${shared_lib_suffix} ; then
- AC_MSG_RESULT(yes)
- DEAL_II_TRILINOS_SHARED=yes
- elif test -f $DEAL_II_TRILINOS_LIBDIR/libtrilinos_epetra${shared_lib_suffix} ; then
- AC_MSG_RESULT(yes)
- DEAL_II_TRILINOS_SHARED=yes
- DEAL_II_TRILINOS_LIBPREFIX="trilinos_"
- else
- AC_MSG_RESULT(no)
- fi
-
- AC_MSG_CHECKING(whether Trilinos uses static libraries)
- if test -f $DEAL_II_TRILINOS_LIBDIR/libepetra${static_lib_suffix} ; then
- AC_MSG_RESULT(yes)
- DEAL_II_TRILINOS_STATIC=yes
- elif test -f $DEAL_II_TRILINOS_LIBDIR/libtrilinos_epetra${static_lib_suffix} ; then
- AC_MSG_RESULT(yes)
- DEAL_II_TRILINOS_STATIC=yes
- DEAL_II_TRILINOS_LIBPREFIX="libtrilinos_"
- else
- AC_MSG_RESULT(no)
- fi
-
- dnl Make sure something is set at least
- if test "x${DEAL_II_TRILINOS_SHARED}${DEAL_II_TRILINOS_STATIC}" = "x" ; then
- AC_MSG_ERROR([Unable to determine whether Trilinos uses shared or static libraries.])
- fi
-
-
- dnl Now make sure the Trilinos libs are of the same kind as the ones we
- dnl produce here
- if test "x$enableshared" = "xyes" -a "x$DEAL_II_TRILINOS_SHARED" != "xyes" ; then
- AC_MSG_ERROR([When building deal.II with shared libraries, Trilinos also needs to be built with shared libraries])
- fi
-
- if test "x$enableshared" = "xno" -a "x$DEAL_II_TRILINOS_STATIC" != "xyes" ; then
- AC_MSG_ERROR([When building deal.II with shared libraries, Trilinos also needs to be built with shared libraries])
- fi
-
- dnl If we use shared libs (and we've made sure above that Trilinos provides
- dnl these as well), then set some of the LD_FLAGS and similar
- if test "x$enableshared" = "xyes" ; then
- LDFLAGS="$LDFLAGS -L$DEAL_II_TRILINOS_LIBDIR"
- if test "x$LD_PATH_OPTION" != "xno" ; then
- LDFLAGS="$LDFLAGS $LD_PATH_OPTION$DEAL_II_TRILINOS_LIBDIR"
- fi
- fi
-])
-
-
-
-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. Unfortunately, it has
- 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;'`"
-
- dnl Above, we may have set DEAL_II_TRILINOS_LIBPREFIX="trilinos_" to deal
- dnl with alternate naming conventions on Debian. However, if
- dnl we can get the list of libraries from Trilinos directly we
- dnl don't really need to do this any more
- DEAL_II_TRILINOS_LIBPREFIX=""
- 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;'`"
-
- dnl Same as above
- DEAL_II_TRILINOS_LIBPREFIX=""
- else
- dnl Fall back to the fixed list. This should only be necessary
- dnl for Trilinos versions before 10.4. If, for a later version,
- dnl this happens, we don't want to fall back to this list, so
- dnl add an assertion.
- if test $DEAL_II_TRILINOS_VERSION_MAJOR = 10 -a \
- $DEAL_II_TRILINOS_VERSION_MINOR -lt 4 ; then
- :
- else
- AC_MSG_ERROR([package file TrilinosConfig.cmake not found])
- fi
- 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)
-])
-
-
-
-dnl ------------------------------------------------------------
-dnl Trilinos has headers that produce tons of warnings when
-dnl used with -W -Wall (which includes -Wunused). Regrettable
-dnl though it may be, these warnings pretty much drown everything
-dnl else and we better disable some of the warnings to enable us
-dnl to see through the clutter.
-dnl
-dnl Usage: DEAL_II_CHECK_TRILINOS_WARNINGS
-dnl
-dnl ------------------------------------------------------------
-AC_DEFUN(DEAL_II_CHECK_TRILINOS_WARNINGS, dnl
-[
- OLD_CXXFLAGS="$CXXFLAGS"
-
- if test "$GXX" = yes ; then
- AC_MSG_CHECKING(whether we can use -Wno-unused to suppress Trilinos warnings)
- CXXFLAGS=-Wno-unused
- AC_TRY_COMPILE([], [;],
- [
- AC_MSG_RESULT(yes)
- CXXFLAGSG="$CXXFLAGSG -Wno-unused"
- ],
- [
- AC_MSG_RESULT(no)
- ])
-
- AC_MSG_CHECKING(whether we can use -Wno-overloaded-virtual to suppress Trilinos warnings)
- CXXFLAGS=-Wno-overloaded-virtual
- AC_TRY_COMPILE([], [;],
- [
- AC_MSG_RESULT(yes)
- CXXFLAGSG="$CXXFLAGSG -Wno-overloaded-virtual"
- ],
- [
- AC_MSG_RESULT(no)
- ])
-
- AC_MSG_CHECKING(whether we can use -Wno-extra to suppress Trilinos warnings)
- CXXFLAGS=-Wno-extra
- AC_TRY_COMPILE([], [;],
- [
- AC_MSG_RESULT(yes)
- CXXFLAGSG="$CXXFLAGSG -Wno-extra"
- ],
- [
- AC_MSG_RESULT(no)
- ])
- fi
-
- CXXFLAGS="${OLD_CXXFLAGS}"
-])
-
-
-
-dnl ------------------------------------------------------------
-dnl Trilinos consists of a number of individual packages. We
-dnl need several of those so we should make sure at configure
-dnl that all necessary Trilinos packages were compiled and installed
-dnl when Trilinos was built.
-dnl
-dnl Usage: DEAL_II_CHECK_TRILINOS_HEADER_FILES
-dnl
-dnl ------------------------------------------------------------
-AC_DEFUN(DEAL_II_CHECK_TRILINOS_HEADER_FILES, dnl
-[
- OLD_CXXFLAGS="$CXXFLAGS"
- OLD_CPPFLAGS="$CPPFLAGS"
-
- CPPFLAGS="-I$DEAL_II_TRILINOS_INCDIR $CPPFLAGS"
- CXXFLAGS="-I$DEAL_II_TRILINOS_INCDIR $CXXFLAGS"
-
- dnl This is a subtle problem: Trilinos ML's ml_config.h has a
- dnl #define HAVE_INTTYPES_H
- dnl without giving it a value. On the other hand, the previous
- dnl autoconf test for this header file will have put a
- dnl #define HAVE_INTTYPES_H 1
- dnl into confdefs.h, which will lead to an error. Avoid this
- dnl problem by #undefining HAVE_INTTYPES_H for now and undoing
- dnl this later on again.
- dnl
- dnl Note that we have to do essentially the same trick as
- dnl well during compile time; see the block in AH_BOTTOM in
- dnl configure.in that goes into base/include/base/config.h
- cp confdefs.h confdefs.h.bak
- echo "#ifdef HAVE_INTTYPES_H" >> confdefs.h
- echo "#undef HAVE_INTTYPES_H" >> confdefs.h
- echo "#endif" >> confdefs.h
-
- dnl Sacado_cmath.hpp does things that aren't compatible
- dnl with the -std=c++0x flag of GCC, see deal.II FAQ.
- dnl Test whether that is indeed the case
- if test -f $DEAL_II_TRILINOS_INCDIR/Sacado_cmath.hpp ; then
- CXX_FLAGS_SAVED="$CXXFLAGS"
- CXXFLAGS="$CXXFLAGSG -I$DEAL_II_TRILINOS_INCDIR"
- AC_MSG_CHECKING([whether Sacado_cmath.hpp is C++11 compatible])
- AC_TRY_COMPILE(
- [
- #include <Sacado_cmath.hpp>
- ],
- [;],
- [
- AC_MSG_RESULT([yes])
- ],
- [
- AC_MSG_RESULT([no])
- AC_MSG_ERROR([*** Your Trilinos installation is not compatible with the C++ standard selected for this compiler. See the deal.II FAQ page for a solution. ***])
- ])
- else
- AC_MSG_ERROR([File $DEAL_II_TRILINOS_INCDIR/Sacado_cmath.hpp not found.])
- fi
-
- dnl Now just check that all headers we need are in fact there
- AC_CHECK_HEADERS([Amesos.h \
- Epetra_CrsGraph.h \
- Epetra_CrsMatrix.h \
- Epetra_Import.h \
- Epetra_LinearProblem.h \
- Epetra_Map.h \
- Epetra_MultiVector.h \
- Epetra_Operator.h \
- Epetra_SerialComm.h \
- Epetra_Vector.h \
- Ifpack.h \
- ml_MultiLevelPreconditioner.h \
- AztecOO.h \
- AztecOO_Operator.h \
- Sacado.hpp \
- Teuchos_ParameterList.hpp \
- Teuchos_RCP.hpp \
- Teuchos_RefCountPtr.hpp
- ],
- [],
- [
- AC_MSG_ERROR([The Trilinos installation is missing one or more header files necessary for the deal.II Trilinos interfaces. Please re-install Trilinos with the missing Trilinos sub-packages enabled.])
- ],
- [])
- mv confdefs.h.bak confdefs.h
-
- CPPFLAGS="${OLD_CPPFLAGS}"
- CXXFLAGS="${OLD_CXXFLAGS}"
-])
-
-
-
-
dnl ------------------------------------------------------------
dnl Check whether MUMPS is installed; and, if so, then check for
dnl two known dependecies, namely, SCALAPACK and BLACS.