]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Finalize the external library hinting and write some documentation
authormaier <maier@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 24 Sep 2012 12:22:00 +0000 (12:22 +0000)
committermaier <maier@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 24 Sep 2012 12:22:00 +0000 (12:22 +0000)
git-svn-id: https://svn.dealii.org/branches/branch_cmake@26656 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/README_CMAKE
deal.II/cmake/features.m4
deal.II/cmake/modules/FindAMD.cmake
deal.II/cmake/modules/FindMETIS.cmake
deal.II/cmake/modules/FindP4EST.cmake
deal.II/cmake/modules/FindPETSC.cmake [new file with mode: 0644]
deal.II/cmake/modules/FindSC.cmake
deal.II/cmake/modules/FindTRILINOS.cmake
deal.II/cmake/modules/FindUMFPACK.cmake
deal.II/cmake/petsc.m4 [new file with mode: 0644]

index b3be990d38a3f9f58c105e1cd08f572b4e31d2dc..7d5a57178afe567126ee3abde44589db282e209e 100644 (file)
@@ -28,6 +28,8 @@ TABLE OF CONTENTS
 
       Feature configuration
 
+      External library locations
+
       Component selection
 
       Build configuration
@@ -225,6 +227,50 @@ CONFIGURATION
     separately.
 
 
+  External library locations
+  ==========================
+
+  External libraries will be searched depending on hints in the following
+  order:
+
+  1.) Paths specified via CMAKE_PREFIX_PATH take precedence, e.g. with
+
+          $ cmake -DCMAKE_PREFIX_PATH=~/workspace/local ../deal.II
+
+      libraries from ~/workspace/local will be preferred for dependency
+      resolution.
+
+  2.) Hints given by <library>_DIR via command line or environment for
+      _some_ libraries:
+
+          $ cmake -DP4EST_DIR=~/workspace/p4est-install/ ../deal.II
+      or
+          $ export P4EST_DIR=~/workspace/p4est-install/
+          $ cmake ../deal.II
+      where -D<library>_DIR takes precedence over environment.
+
+      Currently, the following variables will be considered:
+
+        METIS_DIR,
+        P4EST_DIR,
+        PETSC_DIR (and SC_DIR),
+        TRILINOS_DIR,
+        UMFPACK_DIR (and AMD_DIR)
+
+
+  Alternatively, cached variables set by the Find<Module> mechanism may be
+  set, hinted or overwritten directly!
+
+  These variables are usually called <library>_INCLUDE_DIR(S) and
+  <library>_(LIBRARY|LIBRARIES) (highly dependend of the actual library...).
+
+  You can get a list via
+
+      $ ccmake ../deal.II
+
+  and entering advanced configuration mode by pressing [t].
+  Variables that could not be determined are suffixed with -NOTFOUND and
+  may be set by hand.
 
 
   Component selection
index cd377359687ba8c1b9328f4d4cd24fef919bbdc8..02e0474e235d8a11943fdb249f0b314a5f9270c0 100644 (file)
@@ -70,315 +70,6 @@ AC_DEFUN(DEAL_II_CONFIGURE_TECPLOT, dnl
 
 
 
-dnl ------------------------------------------------------------
-dnl Check whether PETSc is installed, and if so store the
-dnl respective links
-dnl
-dnl Usage: DEAL_II_CONFIGURE_PETSC
-dnl
-dnl ------------------------------------------------------------
-AC_DEFUN(DEAL_II_CONFIGURE_PETSC, dnl
-[
-  dnl First check for the PETSc directory
-  AC_MSG_CHECKING([for PETSc library directory])
-
-  AC_ARG_WITH(petsc,
-              [AS_HELP_STRING([--with-petsc=path/to/petsc],
-              [Specify the path to the PETSc installation, of which the include and library directories are subdirs; use this if you want to override the PETSC_DIR environment variable.])],
-     [
-        dnl Special case when someone does --with-petsc=no
-        if test "x$withval" = "xno" ; then
-          AC_MSG_RESULT([explicitly disabled])
-          USE_CONTRIB_PETSC=no
-        else
-          USE_CONTRIB_PETSC=yes
-          DEAL_II_PETSC_DIR="$withval"
-          AC_MSG_RESULT($DEAL_II_PETSC_DIR)
-
-          dnl Make sure that what was specified is actually correct
-          if test ! -d $DEAL_II_PETSC_DIR/include \
-               ; then
-            AC_MSG_ERROR([Path to PETSc specified with --with-petsc does not point to a complete PETSc installation])
-          fi
-        fi
-     ],
-     [
-        dnl Take something from the environment variables, if it is there
-        if test "x$PETSC_DIR" != "x" ; then
-          USE_CONTRIB_PETSC=yes
-          DEAL_II_PETSC_DIR="$PETSC_DIR"
-          AC_MSG_RESULT($DEAL_II_PETSC_DIR)
-
-          dnl Make sure that what this is actually correct
-          if test ! -d $DEAL_II_PETSC_DIR/include \
-               ; then
-            AC_MSG_ERROR([The path to PETSc specified in the PETSC_DIR environment variable does not point to a complete PETSc installation])
-          fi
-        else
-          USE_CONTRIB_PETSC=no
-          DEAL_II_PETSC_DIR=""
-          AC_MSG_RESULT([not found])
-        fi
-     ])
-  if test "$USE_CONTRIB_PETSC" = "yes" ; then
-    AC_DEFINE([DEAL_II_USE_PETSC], [1],
-              [Defined if a PETSc 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 PETSc, then the value of this variable expands to
-    dnl defining the string "DEAL_II_USE_PETSC" for the preprocessor. If
-    dnl we don't have no PETSc, then it does not define this string.
-    DEAL_II_DEFINE_DEAL_II_USE_PETSC=DEAL_II_USE_PETSC
-
-    dnl Also work around a stupidity in PETSc that makes sure it interferes in
-    dnl a completely obnoxious way with boost.
-    AC_DEFINE([PETSC_SKIP_UNDERSCORE_CHKERR], [1],
-              [Make sure PETSc doesn't re-define the underscore through the preprocessor, since this interferes with boost. PETSc redefines the underscore to be "__gterr =", but then forgets to undef this thing. Boost simply wants to concatenate the underscore with another string to form a class name, which then of course isn't valid any more. See mails in early Feb 2006.])
-  fi
-
-  dnl If we have found PETSc, determine additional pieces of data
-  if test "$USE_CONTRIB_PETSC" = "yes" ; then
-    DEAL_II_CONFIGURE_PETSC_VERSION
-    DEAL_II_CONFIGURE_PETSC_ARCH
-
-    DEAL_II_CONFIGURE_PETSC_MPIUNI_LIB
-    DEAL_II_CHECK_PETSC_MPI_CONSISTENCY
-    DEAL_II_CONFIGURE_PETSC_COMPLEX
-
-    DEAL_II_EXPAND_PETSC_VECTOR="PETScWrappers::Vector"
-    DEAL_II_EXPAND_PETSC_MPI_VECTOR="PETScWrappers::MPI::Vector"
-    DEAL_II_EXPAND_PETSC_BLOCKVECTOR="PETScWrappers::BlockVector"
-    DEAL_II_EXPAND_PETSC_MPI_BLOCKVECTOR="PETScWrappers::MPI::BlockVector"
-
-    dnl Finally set with_petsc if this hasn't happened yet
-    if test "x$with_petsc" = "x" ; then
-      with_petsc="yes"
-    fi
-  fi
-
-  dnl Make sure that the right values for PETSC vectors are written
-  dnl into common/template-arguments.in
-  AC_SUBST(DEAL_II_EXPAND_PETSC_VECTOR)
-  AC_SUBST(DEAL_II_EXPAND_PETSC_MPI_VECTOR)
-  AC_SUBST(DEAL_II_EXPAND_PETSC_BLOCKVECTOR)
-  AC_SUBST(DEAL_II_EXPAND_PETSC_MPI_BLOCKVECTOR)
-])
-
-
-
-dnl ------------------------------------------------------------
-dnl Figure out the architecture used for PETSc, since that
-dnl determines where object and configuration files will be found.
-dnl
-dnl Usage: DEAL_II_CONFIGURE_PETSC_ARCH
-dnl
-dnl ------------------------------------------------------------
-AC_DEFUN(DEAL_II_CONFIGURE_PETSC_ARCH, dnl
-[
-  AC_MSG_CHECKING([for PETSc library architecture])
-
-  AC_ARG_WITH(petsc-arch,
-              [AS_HELP_STRING([--with-petsc-arch=architecture],
-              [Specify the architecture for your PETSc installation; use this if you want to override the PETSC_ARCH environment variable.])],
-              [DEAL_II_PETSC_ARCH="$withval"
-               AC_MSG_RESULT($DEAL_II_PETSC_ARCH)
-              ],
-              [dnl Take something from the environment variables
-               if test "x$PETSC_ARCH" != "x" ; then
-                 DEAL_II_PETSC_ARCH="$PETSC_ARCH"
-                 AC_MSG_RESULT($DEAL_II_PETSC_ARCH)
-               else
-                 AC_MSG_ERROR([If PETSc is used, you must specify the architecture either through the PETSC_ARCH environment variable, or through the --with-petsc-arch flag])
-               fi
-              ])
-
-  if test "x$PETSC_ARCH" != "x" ; then
-
-    dnl PETSc change the locations where they store their libraries
-    dnl from time-to-time; so make sure that what was specified is
-    dnl actually correct.
-    case "${DEAL_II_PETSC_VERSION_MAJOR}.${DEAL_II_PETSC_VERSION_MINOR}.${DEAL_II_PETSC_VERSION_SUBMINOR}" in
-      3.*) dnl
-        if test ! -d $DEAL_II_PETSC_DIR/$DEAL_II_PETSC_ARCH/lib \
-           ; then
-          AC_MSG_ERROR([PETSc has not been compiled for the architecture specified with --with-petsc-arch])
-        fi
-        ;;
-      *)    dnl
-        AC_MSG_ERROR([Unknown PETSc version ${DEAL_II_PETSC_VERSION_MAJOR}.${DEAL_II_PETSC_VERSION_MINOR}.${DEAL_II_PETSC_VERSION_SUBMINOR}])
-        ;;
-    esac
-  fi
-])
-
-
-
-dnl ------------------------------------------------------------
-dnl Figure out the version numbers of PETSc. This is unfortunately
-dnl necessary since PETSc has a habit to change function signatures,
-dnl library names, etc, in random ways between versions...
-dnl
-dnl Usage: DEAL_II_CONFIGURE_PETSC_VERSION
-dnl
-dnl ------------------------------------------------------------
-AC_DEFUN(DEAL_II_CONFIGURE_PETSC_VERSION, dnl
-[
-  AC_MSG_CHECKING([for PETSc version])
-  DEAL_II_PETSC_VERSION_MAJOR=`cat $DEAL_II_PETSC_DIR/include/petscversion.h \
-                               | grep "#define PETSC_VERSION_MAJOR" \
-                               | perl -pi -e 's/.*MAJOR\s+//g;'`
-  DEAL_II_PETSC_VERSION_MINOR=`cat $DEAL_II_PETSC_DIR/include/petscversion.h \
-                               | grep "#define PETSC_VERSION_MINOR" \
-                               | perl -pi -e 's/.*MINOR\s+//g;'`
-  DEAL_II_PETSC_VERSION_SUBMINOR=`cat $DEAL_II_PETSC_DIR/include/petscversion.h \
-                               | grep "#define PETSC_VERSION_SUBMINOR" \
-                               | perl -pi -e 's/.*MINOR\s+//g;'`
-  PETSC_VERSION="$DEAL_II_PETSC_VERSION_MAJOR.$DEAL_II_PETSC_VERSION_MINOR.$DEAL_II_PETSC_VERSION_SUBMINOR"
-
-  dnl Here is where we check if the PETSc version we have is a
-  dnl release but do nothing about it.
-  PETSC_RELEASE=`cat $DEAL_II_PETSC_DIR/include/petscversion.h \
-                     | grep "#define PETSC_VERSION_RELEASE" \
-                     | perl -pi -e 's/.*RELEASE\s+//g;'`
-  if test "$PETSC_RELEASE" = "0" ; then
-    PETSC_VERSION+="-dev"
-    DEAL_II_PETSC_VERSION_DEV=yes
-    AC_DEFINE([DEAL_II_USE_PETSC_DEV], [1],
-              [Defined if a PETSc installation was found and is not a release])
-  else
-    DEAL_II_PETSC_VERSION_DEV=no
-  fi
-
-  AC_MSG_RESULT($PETSC_VERSION)
-])
-
-
-dnl -------------------------------------------------------------
-dnl Make sure that if PETSc and deal.II were built with the same
-dnl MPI enabled (or disabled) functionality.
-dnl
-dnl Usage: DEAL_II_CHECK_PETSC_MPI_CONSISTENCY
-dnl
-dnl -------------------------------------------------------------
-AC_DEFUN(DEAL_II_CHECK_PETSC_MPI_CONSISTENCY, dnl
-[
-  dnl Then check for MPI consistency.
-  AC_MSG_CHECKING(for consistency of PETSc and deal.II MPI settings)
-
-  if test "x$DEAL_II_USE_MPI" = "xyes" ; then
-
-  dnl So we support MPI. Check that our PETSc installation does
-  dnl too. PETSc sets the variable PETSC_HAVE_MPIUNI to 1 in case
-  dnl he *does not* support MPI, so just read out that information.
-  dnl
-  dnl Like always, we have to cake care of version control!
-    case "${DEAL_II_PETSC_VERSION_MAJOR}.${DEAL_II_PETSC_VERSION_MINOR}.${DEAL_II_PETSC_VERSION_SUBMINOR}" in
-      3.*) dnl
-        AC_TRY_COMPILE(
-        [#include "$DEAL_II_PETSC_DIR/$DEAL_II_PETSC_ARCH/include/petscconf.h"
-        ],
-        [#ifdef PETSC_HAVE_MPIUNI
-           compile error;
-         #endif
-        ],
-        [AC_MSG_RESULT(yes)],
-        [AC_MSG_ERROR([PETSc was not built for MPI, but deal.II is!]
-        )])
-      ;;
-      *) dnl
-        AC_MSG_ERROR([Unknown PETSc version ${DEAL_II_PETSC_VERSION_MAJOR}.${DEAL_II_PETSC_VERSION_MINOR}.${DEAL_II_PETSC_VERSION_SUBMINOR}])
-      ;;
-    esac
-  else
-    case "${DEAL_II_PETSC_VERSION_MAJOR}.${DEAL_II_PETSC_VERSION_MINOR}.${DEAL_II_PETSC_VERSION_SUBMINOR}" in
-      3.*) dnl
-        AC_TRY_COMPILE(
-        [#include "$DEAL_II_PETSC_DIR/$DEAL_II_PETSC_ARCH/include/petscconf.h"
-        ],
-        [#ifndef PETSC_HAVE_MPIUNI
-           compile error;
-         #endif],
-        [AC_MSG_RESULT(yes)],
-        [AC_MSG_ERROR([PETSc was built for MPI, but deal.II is not!])
-        ])
-      ;;
-      *) dnl
-        AC_MSG_ERROR([Unknown PETSc version ${DEAL_II_PETSC_VERSION_MAJOR}.${DEAL_II_PETSC_VERSION_MINOR}.${DEAL_II_PETSC_VERSION_SUBMINOR}])
-      ;;
-    esac
-  fi
-])
-
-
-dnl ------------------------------------------------------------
-dnl See if there is a library libmpiuni.a/so available. We need
-dnl to link with it on some systems where PETSc is built without
-dnl a real MPI and we need to handle trivial (one process) MPI
-dnl functionality.
-dnl
-dnl Usage: DEAL_II_CONFIGURE_PETSC_MPIUNI_LIB
-dnl
-dnl ------------------------------------------------------------
-AC_DEFUN(DEAL_II_CONFIGURE_PETSC_MPIUNI_LIB, dnl
-[
-  AC_MSG_CHECKING([for PETSc libmpiuni library])
-  case "${DEAL_II_PETSC_VERSION_MAJOR}.${DEAL_II_PETSC_VERSION_MINOR}.${DEAL_II_PETSC_VERSION_SUBMINOR}" in
-    3.*) dnl
-      if test -f $DEAL_II_PETSC_DIR/$DEAL_II_PETSC_ARCH/lib/libmpiuni.a ; then
-        DEAL_II_PETSC_MPIUNI_LIB="$DEAL_II_PETSC_DIR/$DEAL_II_PETSC_ARCH/lib/libmpiuni.a"
-      fi
-      ;;
-    *)    dnl
-      AC_MSG_ERROR([Unknown PETSc version ${DEAL_II_PETSC_VERSION_MAJOR}.${DEAL_II_PETSC_VERSION_MINOR}.${DEAL_II_PETSC_VERSION_SUBMINOR}])
-    ;;
-  esac
-
-  if test "$DEAL_II_PETSC_MPIUNI_LIB" = "" ; then
-     AC_MSG_RESULT([not found])
-  else
-     AC_MSG_RESULT($DEAL_II_PETSC_MPIUNI_LIB)
-  fi
-])
-
-
-dnl ------------------------------------------------------------
-dnl Figure out PETSc was compiled with --scalar-type=complex by
-dnl scanning PETSc configuration file.
-dnl
-dnl Warning: Up tp now, PETSc>3.0.0 is being supported and
-dnl deal.II will not safely compile if this option is "yes".
-dnl
-dnl Usage: DEAL_II_CONFIGURE_PETSC_COMPLEX
-dnl
-dnl ------------------------------------------------------------
-AC_DEFUN(DEAL_II_CONFIGURE_PETSC_COMPLEX, dnl
-[
-  case "${DEAL_II_PETSC_VERSION_MAJOR}.${DEAL_II_PETSC_VERSION_MINOR}.${DEAL_II_PETSC_VERSION_SUBMINOR}" in
-    3.3*)
-      AC_MSG_CHECKING([for PETSc scalar complex])
-      DEAL_II_PETSC_COMPLEX=`cat $DEAL_II_PETSC_DIR/$DEAL_II_PETSC_ARCH/include/petscconf.h \
-                               | grep "#define PETSC_USE_COMPLEX" \
-                               | perl -pi -e 's/.*COMPLEX\s+//g;'`
-      if test "$DEAL_II_PETSC_COMPLEX" = "1" ; then
-         AC_MSG_RESULT(yes)
-      else
-         AC_MSG_RESULT(no)
-      fi
-
-      dnl If we have previously found PETSc and here with a complex
-      dnl scalar type then set the DEAL_II_USE_COMPLEX macro
-      if test "$USE_CONTRIB_PETSC" = "yes" ; then
-        if test "$DEAL_II_PETSC_COMPLEX" = "1" ; then
-        AC_DEFINE([DEAL_II_USE_PETSC_COMPLEX], [1],
-                  [Defined if a PETSc installation was found with complex scalar type and is going to be used])
-      fi fi
-    ;;
-  esac
-])
-
-
-
 dnl ------------------------------------------------------------
 dnl Check whether SLEPc is installed, and if so store the
 dnl respective links.
index 57a7f191d93c278736e53d67d128149eb573508c..b084d2f8d866d341b18a635865d56c586a34d464 100644 (file)
@@ -5,10 +5,20 @@
 INCLUDE(FindPackageHandleStandardArgs)
 
 FIND_PATH(AMD_INCLUDE_DIR amd.h
+  HINTS
+    ${AMD_DIR}/include
+    $ENV{AMD_DIR}/include
+    ${UMFPACK_DIR}/include
+    $ENV{UMFPACK_DIR}/include
 )
 
 FIND_LIBRARY(AMD_LIBRARY
   NAMES amd
+  HINTS
+    ${AMD_DIR}
+    $ENV{AMD_DIR}
+    ${UMFPACK_DIR}
+    $ENV{UMFPACK_DIR}
   PATH_SUFFIXES lib${LIB_SUFFIX} lib64 lib
 )
 
index ac25f0c713555e43fd9adbae556619bed843e0a2..ba7357566f5461ee104607f46026229001b516cd 100644 (file)
@@ -5,11 +5,17 @@
 INCLUDE(FindPackageHandleStandardArgs)
 
 FIND_PATH(METIS_INCLUDE_DIR metis.h
+  HINTS
+    ${METIS_DIR}/include
+    $ENV{METIS_DIR}/include
   PATH_SUFFIXES metis
   )
 
 FIND_LIBRARY(METIS_LIBRARY
   NAMES metis
+  HINTS
+    ${METIS_DIR}
+    $ENV{METIS_DIR}
   PATH_SUFFIXES lib${LIB_SUFFIX} lib64 lib
   )
 
index 86423030132f25aec81e0baaf91a3687ed4578be..c09d32ad3b4cb700bf1eac4b243c8021c98d7315 100644 (file)
@@ -4,17 +4,27 @@
 
 INCLUDE(FindPackageHandleStandardArgs)
 
-FIND_PATH(P4EST_INCLUDE_DIR p4est.h)
+FIND_PATH(P4EST_INCLUDE_DIR p4est.h
+  HINTS
+    ${P4EST_DIR}/include
+    $ENV{P4EST_DIR}/include
+  )
 
 FIND_LIBRARY(P4EST_LIBRARY
   NAMES p4est
+  HINTS
+    ${P4EST_DIR}
+    $ENV{P4EST_DIR}
   PATH_SUFFIXES lib${LIB_SUFFIX} lib64 lib
-)
+  )
 
 FIND_LIBRARY(P4EST_DEBUG_LIBRARY
   NAMES p4est_debug p4est.g
+  HINTS
+    ${P4EST_DIR}
+    $ENV{P4EST_DIR}
   PATH_SUFFIXES lib${LIB_SUFFIX} lib64 lib
-)
+  )
 
 FIND_PACKAGE_HANDLE_STANDARD_ARGS(P4EST DEFAULT_MSG P4EST_LIBRARY P4EST_INCLUDE_DIR)
 FIND_PACKAGE_HANDLE_STANDARD_ARGS(P4EST_DEBUG DEFAULT_MSG P4EST_DEBUG_LIBRARY P4EST_INCLUDE_DIR)
diff --git a/deal.II/cmake/modules/FindPETSC.cmake b/deal.II/cmake/modules/FindPETSC.cmake
new file mode 100644 (file)
index 0000000..97e7da4
--- /dev/null
@@ -0,0 +1,32 @@
+#
+# Try to find the petsc library
+#
+
+INCLUDE(FindPackageHandleStandardArgs)
+
+FIND_PATH(PETSC_INCLUDE_DIR petscconf.h
+  HINTS
+    # petsc is special. Account for that
+    ${PETSC_DIR}/${PETSC_ARCH}/include
+    $ENV{PETSC_DIR}/$ENV{PETSC_ARCH}/include
+  PATH_SUFFIXES petsc
+)
+
+FIND_LIBRARY(PETSC_LIBRARY
+  NAMES petsc
+  HINTS
+    # petsc is special. Account for that
+    ${PETSC_DIR}/${PETSC_ARCH}
+    $ENV{PETSC_DIR}/$ENV{PETSC_ARCH}
+  PATH_SUFFIXES lib${LIB_SUFFIX} lib64 lib
+)
+
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(PETSC DEFAULT_MSG PETSC_LIBRARY PETSC_INCLUDE_DIR)
+
+IF(PETSC_FOUND)
+  MARK_AS_ADVANCED(
+    PETSC_LIBRARY
+    PETSC_INCLUDE_DIR
+  )
+ENDIF()
+
index 3d93f92243dde1dc9f70189063d8dc0d46fce131..33353498796b0a19a522eb8e1d8e0f954f58ebe1 100644 (file)
@@ -2,18 +2,34 @@
 
 INCLUDE(FindPackageHandleStandardArgs)
 
-FIND_PATH(SC_INCLUDE_DIR sc.h)
+FIND_PATH(SC_INCLUDE_DIR sc.h
+  HINTS
+    ${SC_DIR}/include
+    $ENV{SC_DIR}/include
+    ${P4EST_DIR}/include
+    $ENV{P4EST_DIR}/include
+  )
 
 
 FIND_LIBRARY(SC_LIBRARY
   NAMES sc
+  HINTS
+    ${SC_DIR}
+    $ENV{SC_DIR}
+    ${P4EST_DIR}
+    $ENV{P4EST_DIR}
   PATH_SUFFIXES lib${LIB_SUFFIX} lib64 lib
-)
+  )
 
 FIND_LIBRARY(SC_DEBUG_LIBRARY
   NAMES sc_debug sc.g
+  HINTS
+    ${SC_DIR}
+    $ENV{SC_DIR}
+    ${P4EST_DIR}
+    $ENV{P4EST_DIR}
   PATH_SUFFIXES lib${LIB_SUFFIX} lib64 lib
-)
+  )
 
 FIND_PACKAGE_HANDLE_STANDARD_ARGS(SC DEFAULT_MSG SC_LIBRARY SC_INCLUDE_DIR)
 FIND_PACKAGE_HANDLE_STANDARD_ARGS(SC_DEBUG DEFAULT_MSG SC_DEBUG_LIBRARY SC_INCLUDE_DIR)
index 20dc792500fd2f3f0fd98079cdee8298bd5be6d6..325d6e1c5ed8e88248eed271d5b76605bbec0e06 100644 (file)
@@ -10,8 +10,13 @@ INCLUDE(FindPackageHandleStandardArgs)
 find_package(TRILINOS
   QUIET CONFIG
   NAMES Trilinos TRILINOS
-  HINTS ${TRILINOS_DIR}
-  PATH_PREFIXES lib64/cmake/Trilinos lib/cmake/Trilinos
+  HINTS
+    ${TRILINOS_DIR}
+    $ENV{TRILINOS_DIR}
+  PATH_SUFFIXES
+    lib${LIB_SUFFIX}/cmake/Trilinos
+    lib64/cmake/Trilinos
+    lib/cmake/Trilinos
   )
 
 #
@@ -37,9 +42,9 @@ SET(TRILINOS_INCLUDE_DIRS ${Trilinos_INCLUDE_DIRS})
 # exports a list with short names...
 # So we check again for every lib and store the full path:
 #
-FOREACH(macro_library ${Trilinos_LIBRARIES})
+FOREACH(library ${Trilinos_LIBRARIES})
   FIND_LIBRARY(TRILINOS_LIBRARY_${macro_library}
-    NAMES ${macro_library}
+    NAMES ${library}
     HINTS ${Trilinos_LIBRARY_DIRS}
     )
   MARK_AS_ADVANCED(TRILINOS_LIBRARY_${macro_library})
index da92c6462dc18039fb00046a0c30e862cf528fc8..efc2a706c0ee8969c91976c5a1afcd99bdf15924 100644 (file)
@@ -5,10 +5,17 @@
 INCLUDE(FindPackageHandleStandardArgs)
 
 FIND_PATH(UMFPACK_INCLUDE_DIR umfpack.h
+  HINTS
+    ${UMFPACK_DIR}/include
+    $ENV{UMFPACK_DIR}/include
+  PATH_SUFFIXES umfpack
 )
 
 FIND_LIBRARY(UMFPACK_LIBRARY
   NAMES umfpack
+  HINTS
+    ${UMFPACK_DIR}
+    $ENV{UMFPACK_DIR}
   PATH_SUFFIXES lib${LIB_SUFFIX} lib64 lib
 )
 
diff --git a/deal.II/cmake/petsc.m4 b/deal.II/cmake/petsc.m4
new file mode 100644 (file)
index 0000000..e9be2b4
--- /dev/null
@@ -0,0 +1,258 @@
+
+    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 PETSc, then the value of this variable expands to
+    dnl defining the string "DEAL_II_USE_PETSC" for the preprocessor. If
+    dnl we don't have no PETSc, then it does not define this string.
+    DEAL_II_DEFINE_DEAL_II_USE_PETSC=DEAL_II_USE_PETSC
+
+
+
+    dnl Also work around a stupidity in PETSc that makes sure it interferes in
+    dnl a completely obnoxious way with boost.
+    AC_DEFINE([PETSC_SKIP_UNDERSCORE_CHKERR], [1],
+              [Make sure PETSc doesn't re-define the underscore through the preprocessor, since this interferes with boost. PETSc redefines the underscore to be "__gterr =", but then forgets to undef this thing. Boost simply wants to concatenate the underscore with another string to form a class name, which then of course isn't valid any more. See mails in early Feb 2006.])
+  fi
+
+
+
+  dnl If we have found PETSc, determine additional pieces of data
+  if test "$USE_CONTRIB_PETSC" = "yes" ; then
+    DEAL_II_CONFIGURE_PETSC_VERSION
+    DEAL_II_CONFIGURE_PETSC_ARCH
+
+    DEAL_II_CONFIGURE_PETSC_MPIUNI_LIB
+    DEAL_II_CHECK_PETSC_MPI_CONSISTENCY
+    DEAL_II_CONFIGURE_PETSC_COMPLEX
+
+    DEAL_II_EXPAND_PETSC_VECTOR="PETScWrappers::Vector"
+    DEAL_II_EXPAND_PETSC_MPI_VECTOR="PETScWrappers::MPI::Vector"
+    DEAL_II_EXPAND_PETSC_BLOCKVECTOR="PETScWrappers::BlockVector"
+    DEAL_II_EXPAND_PETSC_MPI_BLOCKVECTOR="PETScWrappers::MPI::BlockVector"
+
+    dnl Finally set with_petsc if this hasn't happened yet
+    if test "x$with_petsc" = "x" ; then
+      with_petsc="yes"
+    fi
+  fi
+
+  dnl Make sure that the right values for PETSC vectors are written
+  dnl into common/template-arguments.in
+  AC_SUBST(DEAL_II_EXPAND_PETSC_VECTOR)
+  AC_SUBST(DEAL_II_EXPAND_PETSC_MPI_VECTOR)
+  AC_SUBST(DEAL_II_EXPAND_PETSC_BLOCKVECTOR)
+  AC_SUBST(DEAL_II_EXPAND_PETSC_MPI_BLOCKVECTOR)
+])
+
+
+
+dnl ------------------------------------------------------------
+dnl Figure out the architecture used for PETSc, since that
+dnl determines where object and configuration files will be found.
+dnl
+dnl Usage: DEAL_II_CONFIGURE_PETSC_ARCH
+dnl
+dnl ------------------------------------------------------------
+AC_DEFUN(DEAL_II_CONFIGURE_PETSC_ARCH, dnl
+[
+  AC_MSG_CHECKING([for PETSc library architecture])
+
+  AC_ARG_WITH(petsc-arch,
+              [AS_HELP_STRING([--with-petsc-arch=architecture],
+              [Specify the architecture for your PETSc installation; use this if you want to override the PETSC_ARCH environment variable.])],
+              [DEAL_II_PETSC_ARCH="$withval"
+               AC_MSG_RESULT($DEAL_II_PETSC_ARCH)
+              ],
+              [dnl Take something from the environment variables
+               if test "x$PETSC_ARCH" != "x" ; then
+                 DEAL_II_PETSC_ARCH="$PETSC_ARCH"
+                 AC_MSG_RESULT($DEAL_II_PETSC_ARCH)
+               else
+                 AC_MSG_ERROR([If PETSc is used, you must specify the architecture either through the PETSC_ARCH environment variable, or through the --with-petsc-arch flag])
+               fi
+              ])
+
+  if test "x$PETSC_ARCH" != "x" ; then
+
+    dnl PETSc change the locations where they store their libraries
+    dnl from time-to-time; so make sure that what was specified is
+    dnl actually correct.
+    case "${DEAL_II_PETSC_VERSION_MAJOR}.${DEAL_II_PETSC_VERSION_MINOR}.${DEAL_II_PETSC_VERSION_SUBMINOR}" in
+      3.*) dnl
+        if test ! -d $DEAL_II_PETSC_DIR/$DEAL_II_PETSC_ARCH/lib \
+           ; then
+          AC_MSG_ERROR([PETSc has not been compiled for the architecture specified with --with-petsc-arch])
+        fi
+        ;;
+      *)    dnl
+        AC_MSG_ERROR([Unknown PETSc version ${DEAL_II_PETSC_VERSION_MAJOR}.${DEAL_II_PETSC_VERSION_MINOR}.${DEAL_II_PETSC_VERSION_SUBMINOR}])
+        ;;
+    esac
+  fi
+])
+
+
+
+dnl ------------------------------------------------------------
+dnl Figure out the version numbers of PETSc. This is unfortunately
+dnl necessary since PETSc has a habit to change function signatures,
+dnl library names, etc, in random ways between versions...
+dnl
+dnl Usage: DEAL_II_CONFIGURE_PETSC_VERSION
+dnl
+dnl ------------------------------------------------------------
+AC_DEFUN(DEAL_II_CONFIGURE_PETSC_VERSION, dnl
+[
+  AC_MSG_CHECKING([for PETSc version])
+  DEAL_II_PETSC_VERSION_MAJOR=`cat $DEAL_II_PETSC_DIR/include/petscversion.h \
+                               | grep "#define PETSC_VERSION_MAJOR" \
+                               | perl -pi -e 's/.*MAJOR\s+//g;'`
+  DEAL_II_PETSC_VERSION_MINOR=`cat $DEAL_II_PETSC_DIR/include/petscversion.h \
+                               | grep "#define PETSC_VERSION_MINOR" \
+                               | perl -pi -e 's/.*MINOR\s+//g;'`
+  DEAL_II_PETSC_VERSION_SUBMINOR=`cat $DEAL_II_PETSC_DIR/include/petscversion.h \
+                               | grep "#define PETSC_VERSION_SUBMINOR" \
+                               | perl -pi -e 's/.*MINOR\s+//g;'`
+  PETSC_VERSION="$DEAL_II_PETSC_VERSION_MAJOR.$DEAL_II_PETSC_VERSION_MINOR.$DEAL_II_PETSC_VERSION_SUBMINOR"
+
+  dnl Here is where we check if the PETSc version we have is a
+  dnl release but do nothing about it.
+  PETSC_RELEASE=`cat $DEAL_II_PETSC_DIR/include/petscversion.h \
+                     | grep "#define PETSC_VERSION_RELEASE" \
+                     | perl -pi -e 's/.*RELEASE\s+//g;'`
+  if test "$PETSC_RELEASE" = "0" ; then
+    PETSC_VERSION+="-dev"
+    DEAL_II_PETSC_VERSION_DEV=yes
+    AC_DEFINE([DEAL_II_USE_PETSC_DEV], [1],
+              [Defined if a PETSc installation was found and is not a release])
+  else
+    DEAL_II_PETSC_VERSION_DEV=no
+  fi
+
+  AC_MSG_RESULT($PETSC_VERSION)
+])
+
+
+dnl -------------------------------------------------------------
+dnl Make sure that if PETSc and deal.II were built with the same
+dnl MPI enabled (or disabled) functionality.
+dnl
+dnl Usage: DEAL_II_CHECK_PETSC_MPI_CONSISTENCY
+dnl
+dnl -------------------------------------------------------------
+AC_DEFUN(DEAL_II_CHECK_PETSC_MPI_CONSISTENCY, dnl
+[
+  dnl Then check for MPI consistency.
+  AC_MSG_CHECKING(for consistency of PETSc and deal.II MPI settings)
+
+  if test "x$DEAL_II_USE_MPI" = "xyes" ; then
+
+  dnl So we support MPI. Check that our PETSc installation does
+  dnl too. PETSc sets the variable PETSC_HAVE_MPIUNI to 1 in case
+  dnl he *does not* support MPI, so just read out that information.
+  dnl
+  dnl Like always, we have to cake care of version control!
+    case "${DEAL_II_PETSC_VERSION_MAJOR}.${DEAL_II_PETSC_VERSION_MINOR}.${DEAL_II_PETSC_VERSION_SUBMINOR}" in
+      3.*) dnl
+        AC_TRY_COMPILE(
+        [#include "$DEAL_II_PETSC_DIR/$DEAL_II_PETSC_ARCH/include/petscconf.h"
+        ],
+        [#ifdef PETSC_HAVE_MPIUNI
+           compile error;
+         #endif
+        ],
+        [AC_MSG_RESULT(yes)],
+        [AC_MSG_ERROR([PETSc was not built for MPI, but deal.II is!]
+        )])
+      ;;
+      *) dnl
+        AC_MSG_ERROR([Unknown PETSc version ${DEAL_II_PETSC_VERSION_MAJOR}.${DEAL_II_PETSC_VERSION_MINOR}.${DEAL_II_PETSC_VERSION_SUBMINOR}])
+      ;;
+    esac
+  else
+    case "${DEAL_II_PETSC_VERSION_MAJOR}.${DEAL_II_PETSC_VERSION_MINOR}.${DEAL_II_PETSC_VERSION_SUBMINOR}" in
+      3.*) dnl
+        AC_TRY_COMPILE(
+        [#include "$DEAL_II_PETSC_DIR/$DEAL_II_PETSC_ARCH/include/petscconf.h"
+        ],
+        [#ifndef PETSC_HAVE_MPIUNI
+           compile error;
+         #endif],
+        [AC_MSG_RESULT(yes)],
+        [AC_MSG_ERROR([PETSc was built for MPI, but deal.II is not!])
+        ])
+      ;;
+      *) dnl
+        AC_MSG_ERROR([Unknown PETSc version ${DEAL_II_PETSC_VERSION_MAJOR}.${DEAL_II_PETSC_VERSION_MINOR}.${DEAL_II_PETSC_VERSION_SUBMINOR}])
+      ;;
+    esac
+  fi
+])
+
+
+dnl ------------------------------------------------------------
+dnl See if there is a library libmpiuni.a/so available. We need
+dnl to link with it on some systems where PETSc is built without
+dnl a real MPI and we need to handle trivial (one process) MPI
+dnl functionality.
+dnl
+dnl Usage: DEAL_II_CONFIGURE_PETSC_MPIUNI_LIB
+dnl
+dnl ------------------------------------------------------------
+AC_DEFUN(DEAL_II_CONFIGURE_PETSC_MPIUNI_LIB, dnl
+[
+  AC_MSG_CHECKING([for PETSc libmpiuni library])
+  case "${DEAL_II_PETSC_VERSION_MAJOR}.${DEAL_II_PETSC_VERSION_MINOR}.${DEAL_II_PETSC_VERSION_SUBMINOR}" in
+    3.*) dnl
+      if test -f $DEAL_II_PETSC_DIR/$DEAL_II_PETSC_ARCH/lib/libmpiuni.a ; then
+        DEAL_II_PETSC_MPIUNI_LIB="$DEAL_II_PETSC_DIR/$DEAL_II_PETSC_ARCH/lib/libmpiuni.a"
+      fi
+      ;;
+    *)    dnl
+      AC_MSG_ERROR([Unknown PETSc version ${DEAL_II_PETSC_VERSION_MAJOR}.${DEAL_II_PETSC_VERSION_MINOR}.${DEAL_II_PETSC_VERSION_SUBMINOR}])
+    ;;
+  esac
+
+  if test "$DEAL_II_PETSC_MPIUNI_LIB" = "" ; then
+     AC_MSG_RESULT([not found])
+  else
+     AC_MSG_RESULT($DEAL_II_PETSC_MPIUNI_LIB)
+  fi
+])
+
+
+dnl ------------------------------------------------------------
+dnl Figure out PETSc was compiled with --scalar-type=complex by
+dnl scanning PETSc configuration file.
+dnl
+dnl Warning: Up tp now, PETSc>3.0.0 is being supported and
+dnl deal.II will not safely compile if this option is "yes".
+dnl
+dnl Usage: DEAL_II_CONFIGURE_PETSC_COMPLEX
+dnl
+dnl ------------------------------------------------------------
+AC_DEFUN(DEAL_II_CONFIGURE_PETSC_COMPLEX, dnl
+[
+  case "${DEAL_II_PETSC_VERSION_MAJOR}.${DEAL_II_PETSC_VERSION_MINOR}.${DEAL_II_PETSC_VERSION_SUBMINOR}" in
+    3.3*)
+      AC_MSG_CHECKING([for PETSc scalar complex])
+      DEAL_II_PETSC_COMPLEX=`cat $DEAL_II_PETSC_DIR/$DEAL_II_PETSC_ARCH/include/petscconf.h \
+                               | grep "#define PETSC_USE_COMPLEX" \
+                               | perl -pi -e 's/.*COMPLEX\s+//g;'`
+      if test "$DEAL_II_PETSC_COMPLEX" = "1" ; then
+         AC_MSG_RESULT(yes)
+      else
+         AC_MSG_RESULT(no)
+      fi
+
+      dnl If we have previously found PETSc and here with a complex
+      dnl scalar type then set the DEAL_II_USE_COMPLEX macro
+      if test "$USE_CONTRIB_PETSC" = "yes" ; then
+        if test "$DEAL_II_PETSC_COMPLEX" = "1" ; then
+        AC_DEFINE([DEAL_II_USE_PETSC_COMPLEX], [1],
+                  [Defined if a PETSc installation was found with complex scalar type and is going to be used])
+      fi fi
+    ;;
+  esac
+])
+

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.