]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Autodetect SLEPc based on the PETSc config
authoryoung <young@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 27 Nov 2008 01:44:02 +0000 (01:44 +0000)
committeryoung <young@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 27 Nov 2008 01:44:02 +0000 (01:44 +0000)
git-svn-id: https://svn.dealii.org/trunk@17758 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/aclocal.m4
deal.II/base/include/base/config.h.in
deal.II/common/Make.global_options.in
deal.II/configure.in
deal.II/deal.II/Makefile
deal.II/doc/doxygen/options.dox.in
deal.II/lac/Makefile

index d0188d75424d44a44b6a5c62277b28a5a9250b85..e10212eecb4cbeab7fa7dccd034563ef9a3c272b 100644 (file)
@@ -5431,6 +5431,181 @@ AC_DEFUN(DEAL_II_CONFIGURE_PETSC_MPIUNI_LIB, dnl
 
 
 
+dnl ------------------------------------------------------------
+dnl Check whether SLEPc is installed, and if so store the 
+dnl respective links
+dnl
+dnl Usage: DEAL_II_CONFIGURE_SLEPC
+dnl
+dnl ------------------------------------------------------------
+AC_DEFUN(DEAL_II_CONFIGURE_SLEPC, dnl
+[
+  dnl First check for the SLEPc directory
+  AC_MSG_CHECKING(for SLEPc library directory)
+
+  AC_ARG_WITH(slepc,
+  [  --with-slepc=/path/to/slepc  Specify the path to the SLEPc installation,
+                          of which the include and library directories
+                          are subdirs; use this if you want to override
+                          the SLEPC_DIR environment variable.],
+     [
+        dnl Special case when someone does --with-slepc=no
+        if test "x$withval" = "xno" ; then
+          AC_MSG_RESULT([explicitly disabled])
+          USE_CONTRIB_SLEPC=no
+        else
+         USE_CONTRIB_SLEPC=yes
+          DEAL_II_SLEPC_DIR=$withval
+         AC_MSG_RESULT($DEAL_II_SLEPC_DIR)
+
+          dnl Make sure that what was specified is actually correct
+          if test ! -d $DEAL_II_SLEPC_DIR/include \
+               -o ! -d $DEAL_II_SLEPC_DIR/lib ; then
+            AC_MSG_ERROR([Path to SLEPc specified with --with-slepc does not
+                         point to a complete SLEPc installation])
+         fi
+        fi
+     ],
+     [
+        dnl Take something from the environment variables, if it is there
+        if test "x$SLEPC_DIR" != "x" ; then
+         USE_CONTRIB_SLEPC=yes
+          DEAL_II_SLEPC_DIR="$SLEPC_DIR"
+         AC_MSG_RESULT($DEAL_II_SLEPC_DIR)
+
+          dnl Make sure that what this is actually correct
+          if test ! -d $DEAL_II_SLEPC_DIR/include \
+               -o ! -d $DEAL_II_SLEPC_DIR/lib ; then
+            AC_MSG_ERROR([The path to SLEPc specified in the SLEPC_DIR
+                         environment variable does not
+                         point to a complete SLEPc installation])
+         fi
+        else
+         USE_CONTRIB_SLEPC=no
+          DEAL_II_SLEPC_DIR=""
+          AC_MSG_RESULT(not found)
+        fi
+     ])
+  if test "$USE_CONTRIB_SLEPC" = "yes" ; then
+    AC_DEFINE(DEAL_II_USE_SLEPC, 1,
+              [Defined if a SLEPc 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 SLEPc, then the value of this variable expands to
+    dnl defining the string "DEAL_II_USE_SLEPC" for the preprocessor. If
+    dnl we don't have no SLEPc, then it does not define this string.
+    DEAL_II_DEFINE_DEAL_II_USE_SLEPC=DEAL_II_USE_SLEPC
+
+  fi
+
+
+  dnl If we have found SLEPc, determine additional pieces of data
+  if test "$USE_CONTRIB_SLEPC" = "yes" ; then
+    DEAL_II_CONFIGURE_SLEPC_VERSION
+    DEAL_II_CONFIGURE_SLEPC_ARCH
+
+    dnl Finally set with_slepc if this hasn't happened yet
+    if test "x$with_slepc" = "x" ; then
+      with_slepc="yes"
+    fi
+  fi
+])
+
+
+
+dnl ------------------------------------------------------------
+dnl Figure out the architecture used for SLEPc, since that determines
+dnl where object and configuration files will be found.
+dnl
+dnl Usage: DEAL_II_CONFIGURE_SLEPC_ARCH
+dnl
+dnl ------------------------------------------------------------
+AC_DEFUN(DEAL_II_CONFIGURE_SLEPC_ARCH, dnl
+[
+  AC_MSG_CHECKING(for SLEPc library architecture)
+
+  AC_ARG_WITH(slepc-arch,
+  [  --with-slepc-arch=architecture  Specify the architecture for your SLEPc
+                          installation; use this if you want to override
+                          the SLEPC_ARCH environment variable.],
+     [
+        DEAL_II_SLEPC_ARCH=$withval
+       AC_MSG_RESULT($DEAL_II_SLEPC_ARCH)
+     ],
+     [
+        dnl Take something from the environment variables, if it is there
+        if test "x$SLEPC_ARCH" != "x" ; then
+          DEAL_II_SLEPC_ARCH="$SLEPC_ARCH"
+         AC_MSG_RESULT($DEAL_II_SLEPC_ARCH)
+        else
+         AC_MSG_ERROR([If SLEPc is used, you must specify the architecture
+                        either through the SLEPC_ARCH environment variable,
+                        or through the --with-slepc-arch flag])
+        fi
+     ])
+
+
+  if test "x$SLEPC_ARCH" != "x" ; then
+    dnl Make sure that what was specified is actually correct.
+    if test ! -d $DEAL_II_SLEPC_DIR/lib/$DEAL_II_SLEPC_ARCH \
+         ; then
+      AC_MSG_ERROR([SLEPc has not been compiled for the architecture
+                    specified with --with-slepc-arch])
+    fi
+  fi
+
+  dnl Then check that PETSc and SLEPc architectures are compatible 
+  dnl ie. that they are the same.
+  if test "$DEAL_II_SLEPC_ARCH" != "$DEAL_II_PETSC_ARCH" ; then
+         AC_MSG_ERROR([If SLEPc is used, you must specify the same 
+                        architecture as your PETSc Installation either
+                        through the SLEPC_ARCH environment variable,
+                        or through the --with-slepc-arch flag])
+  fi 
+])
+
+
+
+dnl ------------------------------------------------------------
+dnl Figure out the version numbers of SLEPc and compare with 
+dnl version numbers of PETSc. This is not strictly necessary
+dnl but highly recommended that major, minor, and subminor
+dnl version match. We blissfully ignor patch versions and hope
+dnl for the best. If you want to overide all this you can.
+dnl
+dnl Usage: DEAL_II_CONFIGURE_SLEPC_VERSION
+dnl
+dnl ------------------------------------------------------------
+AC_DEFUN(DEAL_II_CONFIGURE_SLEPC_VERSION, dnl
+[
+  AC_MSG_CHECKING(for SLEPc version)
+
+  DEAL_II_SLEPC_VERSION_MAJOR=`cat $DEAL_II_SLEPC_DIR/include/slepcversion.h \
+                               | grep "#define SLEPC_VERSION_MAJOR" \
+                               | perl -pi -e 's/.*MAJOR\s+//g;'`
+  DEAL_II_SLEPC_VERSION_MINOR=`cat $DEAL_II_SLEPC_DIR/include/slepcversion.h \
+                               | grep "#define SLEPC_VERSION_MINOR" \
+                               | perl -pi -e 's/.*MINOR\s+//g;'`
+  DEAL_II_SLEPC_VERSION_SUBMINOR=`cat $DEAL_II_SLEPC_DIR/include/slepcversion.h \
+                               | grep "#define SLEPC_VERSION_SUBMINOR" \
+                               | perl -pi -e 's/.*MINOR\s+//g;'`
+  SLEPC_VERSION="$DEAL_II_SLEPC_VERSION_MAJOR.$DEAL_II_SLEPC_VERSION_MINOR.$DEAL_II_SLEPC_VERSION_SUBMINOR"
+  AC_MSG_RESULT($SLEPC_VERSION)
+
+  dnl Then check that PETSc and SLEPc versions are compatible 
+  dnl ie. that they are equivalent.
+  if test "${DEAL_II_PETSC_VERSION_MAJOR}"    != "${DEAL_II_SLEPC_VERSION_MAJOR}" \
+       -o "${DEAL_II_PETSC_VERSION_MINOR}"    != "${DEAL_II_SLEPC_VERSION_MINOR}" \
+       -o "${DEAL_II_PETSC_VERSION_SUBMINOR}" != "${DEAL_II_SLEPC_VERSION_SUBMINOR}" ; then
+         AC_MSG_ERROR([If SLEPc is used, you must use the same version
+                        number as your PETSc Installation])
+  fi 
+])
+
+
+
 dnl ------------------------------------------------------------
 dnl Check whether Trilinos is installed, and if so store the 
 dnl respective links
index 684d4b1f237842730a09b2fd8f6d7540dc48c840..6f1354ec43f52a5b144d4c8f043419fcf942e4c0 100644 (file)
 /* Defined if a PETSc installation was found and is going to be used */
 #undef DEAL_II_USE_PETSC
 
+/* Defined if a SLEPc installation was found and is going to be used */
+#undef DEAL_II_USE_SLEPC
+
 /* Defined if a Trilinos installation was found and is going to be used */
 #undef DEAL_II_USE_TRILINOS
 
index 4c316eada2a8040fa973d3b8c12759dd73b4f247..d61ed07a91d06af2f697074a829a8718fdacf5b9 100644 (file)
@@ -54,6 +54,13 @@ DEAL_II_PETSC_VERSION_MINOR    = @DEAL_II_PETSC_VERSION_MINOR@
 DEAL_II_PETSC_VERSION_SUBMINOR = @DEAL_II_PETSC_VERSION_SUBMINOR@
 DEAL_II_PETSC_MPIUNI_LIB = @DEAL_II_PETSC_MPIUNI_LIB@
 
+USE_CONTRIB_SLEPC    = @USE_CONTRIB_SLEPC@
+DEAL_II_SLEPC_DIR    = @DEAL_II_SLEPC_DIR@
+DEAL_II_SLEPC_ARCH   = @DEAL_II_SLEPC_ARCH@
+DEAL_II_SLEPC_VERSION_MAJOR    = @DEAL_II_SLEPC_VERSION_MAJOR@
+DEAL_II_SLEPC_VERSION_MINOR    = @DEAL_II_SLEPC_VERSION_MINOR@
+DEAL_II_SLEPC_VERSION_SUBMINOR = @DEAL_II_SLEPC_VERSION_SUBMINOR@
+
 USE_CONTRIB_TRILINOS = @USE_CONTRIB_TRILINOS@
 DEAL_II_TRILINOS_INCDIR = @DEAL_II_TRILINOS_INCDIR@
 DEAL_II_TRILINOS_LIBDIR = @DEAL_II_TRILINOS_LIBDIR@
@@ -161,11 +168,12 @@ else
   endif
 endif  
 
+# similar (and simpler) for slepc
+ lib-contrib-slepc = $(DEAL_II_SLEPC_DIR)/lib/$(DEAL_II_SLEPC_ARCH)/libslepc$(lib-suffix)
 
 # same for metis, except that there is only one library in that case
 lib-contrib-metis = $(DEAL_II_METIS_LIBDIR)/libmetis.a
 
-
 # if PETSC is used, we need to add a number of libraries to what
 # we link for LAC
 ifeq ($(USE_CONTRIB_PETSC),yes)
@@ -174,6 +182,11 @@ ifeq ($(USE_CONTRIB_PETSC),yes)
   LIBS += $(DEAL_II_PETSC_MPIUNI_LIB)
 endif
 
+# if SLEPC is used, we need to add one library to the lac libs
+ifeq ($(USE_CONTRIB_SLEPC),yes)
+  lib-lac.g += $(lib-contrib-slepc)
+  lib-lac.o += $(lib-contrib-slepc)
+endif
 
 # If METIS was detected, add it to the lac libs, since this is where we call
 # them
@@ -182,13 +195,14 @@ ifeq ($(USE_CONTRIB_METIS),yes)
   lib-lac.o += $(lib-contrib-metis)
 endif
 
-
 # include paths. do not take into account a possibly existing
 # environment variable, since the compiler will evaluate the value of
 # that anyway at compile time
 
 include-path-petsc           = $(DEAL_II_PETSC_DIR)/include
 include-path-petsc-bmake     = $(DEAL_II_PETSC_DIR)/bmake/$(DEAL_II_PETSC_ARCH)
+include-path-slepc           = $(DEAL_II_SLEPC_DIR)/include
+include-path-slepc-bmake     = $(DEAL_II_SLEPC_DIR)/bmake/$(DEAL_II_SLEPC_ARCH)
 include-path-trilinos        = $(DEAL_II_TRILINOS_INCDIR)
 include-path-metis           = $(DEAL_II_METIS_INCDIR)
 
@@ -200,7 +214,7 @@ INCLUDE = -I$D/base/include -I$D/lac/include -I$D/deal.II/include \
           @UMFPACK_INCLUDE_DIR@ @HSL_INCLUDE_DIR@ \
          -I$D/contrib
 
-# add PETSc, Trilinos and METIS include path if necessary. this rule
+# add PETSc, SLEPSc, Trilinos and METIS include path if necessary. this rule
 # (and the one further down below to get correct flags) should eventually
 # be replaced by something where we do not blindly include PETSc make files
 # (and thus import all of its variables), but rather set up a scheme to
@@ -215,6 +229,10 @@ ifeq ($(USE_CONTRIB_PETSC),yes)
              $(MPI_INCLUDE)
 endif
 
+ifeq ($(USE_CONTRIB_SLEPC),yes)
+  INCLUDE += -I$(include-path-slepc) -I$(include-path-slepc-bmake)
+endif
+
 ifeq ($(USE_CONTRIB_TRILINOS),yes)
   INCLUDE += -I$(include-path-trilinos)
 
@@ -286,4 +304,3 @@ ifeq ($(USE_CONTRIB_PETSC),yes)
   CXXFLAGS.o += $(OCXX_PETSCFLAGS)
 endif
 
-
index 03371f18f178c1005d9a7db4e5da7b4a30f25ba3..66eacc7011b8bfb4b7ba7abf6afa8aef61dca4c4 100644 (file)
@@ -23,7 +23,7 @@ dnl clearing the cache
 define([AC_CACHE_LOAD], )dnl
 define([AC_CACHE_SAVE], )dnl
 
-AC_INIT(deal.II, 6.2.pre, dealii@dealii.org, deal.II)
+AC_INIT(projekt, 6.2.pre, tyoung@ippt.gov.pl, projekt)
 
 AC_REVISION($Revision$)
 AC_PREREQ(2.61)
@@ -399,6 +399,15 @@ AC_SUBST(DEAL_II_PETSC_VERSION_SUBMINOR)
 AC_SUBST(DEAL_II_PETSC_MPIUNI_LIB)
 AC_SUBST(DEAL_II_DEFINE_DEAL_II_USE_PETSC)
 
+DEAL_II_CONFIGURE_SLEPC
+AC_SUBST(USE_CONTRIB_SLEPC)
+AC_SUBST(DEAL_II_SLEPC_DIR)
+AC_SUBST(DEAL_II_SLEPC_ARCH)
+AC_SUBST(DEAL_II_SLEPC_VERSION_MAJOR)
+AC_SUBST(DEAL_II_SLEPC_VERSION_MINOR)
+AC_SUBST(DEAL_II_SLEPC_VERSION_SUBMINOR)
+AC_SUBST(DEAL_II_DEFINE_DEAL_II_USE_SLEPC)
+
 DEAL_II_CONFIGURE_TRILINOS
 AC_SUBST(USE_CONTRIB_TRILINOS)
 AC_SUBST(DEAL_II_TRILINOS_INCDIR)
index c6c64c93581ed81402a454b38f9c18c45e2831df..3981d1a0b4f843016ff8ec7b3c1e714a102cacc6 100644 (file)
@@ -101,6 +101,12 @@ ifneq ($(GXX-VERSION),compaq_cxx)
     deplibs.o += $(lib-contrib-petsc.o)
   endif
 
+  # same with SLEPC
+  ifeq ($(USE_CONTRIB_SLEPC),yes)
+    deplibs.g += $(lib-contrib-slepc)
+    deplibs.o += $(lib-contrib-slepc)
+  endif
+
   # and METIS
   ifeq ($(USE_CONTRIB_METIS),yes)
     deplibs.g += $(lib-contrib-metis)
index bc54f25dac1534b36e6f78df2525b72825f4d070..7cebae0ae9bfc0719ab71b13dde970251da52f5f 100644 (file)
@@ -1013,6 +1013,7 @@ INCLUDE_FILE_PATTERNS  =
 PREDEFINED             = DOXYGEN=1 \
                          DEBUG=1 \
                          DEAL_II_USE_PETSC=1 \
+                         DEAL_II_USE_SLEPC=1 \
                          DEAL_II_USE_TRILINOS=1 \
                          DEAL_II_USE_MT=1 \
                          DEAL_II_USE_MT_POSIX=1
index aa8ee1fe6ba0942a52452a80d4dc8da4ab689a50..852d875bb16d1379411439a0134f3948189a8feb 100644 (file)
@@ -73,7 +73,13 @@ ifneq ($(GXX-VERSION),compaq_cxx)
     deplibs.o += $(lib-contrib-petsc.o)
   endif
 
-  # same with PETSC
+  # same with SLEPC
+  ifeq ($(USE_CONTRIB_SLEPC),yes)
+    deplibs.g += $(lib-contrib-slepc)
+    deplibs.o += $(lib-contrib-slepc)
+  endif
+
+  # same with TRILINOS
   ifeq ($(USE_CONTRIB_TRILINOS),yes)
     deplibs.g += $(lib-contrib-trilinos)
     deplibs.o += $(lib-contrib-trilinos)

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.