]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Detect and use PETSc version string to work around gratuious incompatibilities in...
authorwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 19 Mar 2004 20:33:28 +0000 (20:33 +0000)
committerwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 19 Mar 2004 20:33:28 +0000 (20:33 +0000)
git-svn-id: https://svn.dealii.org/trunk@8834 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/aclocal.m4
deal.II/common/Make.global_options.in
deal.II/configure
deal.II/configure.in
deal.II/lib/Makefile

index db0cd419f6d709e6cae45140119ea131b5fdd13d..86c24c063eededcb3dd18dfbeb1dec4c9937a5a7 100644 (file)
@@ -3675,47 +3675,87 @@ AC_DEFUN(DEAL_II_CONFIGURE_PETSC, dnl
   fi
 
 
-  dnl Secondly, check for the PETSc architecture, since that determines
-  dnl where object and configuration files will be found. Do so only
-  dnl if we are interested in this information at all.
+  dnl If we have found PETSc, determine additional pieces of data
   if test "$USE_CONTRIB_PETSC" = "yes" ; then
-    AC_MSG_CHECKING(for PETSc library architecture)
+    DEAL_II_CONFIGURE_PETSC_ARCH
+    DEAL_II_CONFIGURE_PETSC_VERSION
+  fi
+])
+
 
-    AC_ARG_WITH(petsc-arch,
-    [  --with-petsc-arch=architecture  Specify the architecture for your PETSc
+
+dnl ------------------------------------------------------------
+dnl Figure out the architecture used for PETSc, since that determines
+dnl 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,
+  [  --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
+     [
+        DEAL_II_PETSC_ARCH=$withval
+       AC_MSG_RESULT($DEAL_II_PETSC_ARCH)
+
+        dnl Make sure that what was specified is actually correct
+        if test ! -d $DEAL_II_PETSC_DIR/lib/libg_c++/$DEAL_II_PETSC_ARCH \
+             ; then
+          AC_MSG_ERROR([PETSc has not been compiled for the architecture
+                        specified with --with-petsc-arch])
+       fi
+     ],
+     [
+        dnl Take something from the environment variables, if it is there
+        if test "x$PETSC_ARCH" != "x" ; then
+          DEAL_II_PETSC_ARCH="$PETSC_ARCH"
          AC_MSG_RESULT($DEAL_II_PETSC_ARCH)
 
-          dnl Make sure that what was specified is actually correct
+          dnl Make sure that what this is actually correct
           if test ! -d $DEAL_II_PETSC_DIR/lib/libg_c++/$DEAL_II_PETSC_ARCH \
-               ; then
+             ; then
             AC_MSG_ERROR([PETSc has not been compiled for the architecture
-                          specified with --with-petsc-arch])
-         fi
-       ],
-       [
-          dnl Take something from the environment variables, if it is there
-          if test "x$PETSC_ARCH" != "x" ; then
-            DEAL_II_PETSC_ARCH="$PETSC_ARCH"
-           AC_MSG_RESULT($DEAL_II_PETSC_ARCH)
-
-            dnl Make sure that what this is actually correct
-            if test ! -d $DEAL_II_PETSC_DIR/lib/libg_c++/$DEAL_II_PETSC_ARCH \
-               ; then
-              AC_MSG_ERROR([PETSc has not been compiled for the architecture
-                            specified in the PETSC_ARCH environment variable])
-            fi
-          else
-           AC_MSG_ERROR([If PETSc is used, you must specify the architectur
-                          either through the PETSC_ARCH environment variable,
-                          or through the --with-petsc-arch flag])
+                          specified in the PETSC_ARCH environment variable])
           fi
-       ])
-  fi
+        else
+         AC_MSG_ERROR([If PETSc is used, you must specify the architectur
+                        either through the PETSC_ARCH environment variable,
+                        or through the --with-petsc-arch flag])
+        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"
+  AC_MSG_RESULT($PETSC_VERSION)
 ])
 
 
index 6d02737a585b484018ab871bddca3f1879c02fcd..13dd908137f315c2fb68a27ce35a0219fbdd0fc5 100644 (file)
@@ -40,14 +40,22 @@ with-multithreading  = @withmultithreading@
 enable-shared        = @enableshared@
 DEAL_II_MAJOR        = @DEAL_II_MAJOR@
 DEAL_II_MINOR        = @DEAL_II_MINOR@
+
 USE_CONTRIB_HSL      = @USE_CONTRIB_HSL@
+
 USE_CONTRIB_PETSC    = @USE_CONTRIB_PETSC@
 DEAL_II_PETSC_DIR    = @DEAL_II_PETSC_DIR@
 DEAL_II_PETSC_ARCH   = @DEAL_II_PETSC_ARCH@
+DEAL_II_PETSC_VERSION_MAJOR    = @DEAL_II_PETSC_VERSION_MAJOR@
+DEAL_II_PETSC_VERSION_MINOR    = @DEAL_II_PETSC_VERSION_MINOR@
+DEAL_II_PETSC_VERSION_SUBMINOR = @DEAL_II_PETSC_VERSION_SUBMINOR@
+
 USE_CONTRIB_METIS    = @USE_CONTRIB_METIS@
 DEAL_II_METIS_DIR    = @DEAL_II_METIS_DIR@
+
 TECIO_INCLUDE        = @TECPLOT_INCLUDE_PATH@
 TECIO_LIBRARY        = @TECPLOT_LIBRARY_PATH@
+
 TARGET               = @target@
 
 # if HSL sublibs are used, add F77 libs to linker flags
index 9c1dffba40aa626cc293d06e72c88f99ed813c04..3337785869d2ed38d6c4d591823c28b228cb9392 100755 (executable)
@@ -273,7 +273,7 @@ PACKAGE_BUGREPORT=
 
 ac_unique_file="deal.II"
 ac_subdirs_all="$ac_subdirs_all contrib tests"
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS DEAL_II_VERSION DEAL_II_MAJOR DEAL_II_MINOR DEAL_II_PATH DEAL2_DIR build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CXX CXXFLAGS ac_ct_CXX GXX_VERSION CXXFLAGSG CXXFLAGSO CXXFLAGSPIC SHLIBLD LDFLAGSPIC enablemultithreading withmultithreading F77 F77_VERSION F77FLAGSO F77FLAGSG F77FLAGSPIC F77LIBS enableshared lib_suffix AR RANLIB ac_ct_RANLIB enablemultigrid TECPLOT_LIBRARY_PATH TECPLOT_INCLUDE_PATH USE_CONTRIB_HSL USE_CONTRIB_PETSC DEAL_II_PETSC_DIR DEAL_II_PETSC_ARCH USE_CONTRIB_METIS DEAL_II_METIS_DIR kdocdir kdocversion DOXYGEN PERL subdirs LIBOBJS LTLIBOBJS'
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS DEAL_II_VERSION DEAL_II_MAJOR DEAL_II_MINOR DEAL_II_PATH DEAL2_DIR build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CXX CXXFLAGS ac_ct_CXX GXX_VERSION CXXFLAGSG CXXFLAGSO CXXFLAGSPIC SHLIBLD LDFLAGSPIC enablemultithreading withmultithreading F77 F77_VERSION F77FLAGSO F77FLAGSG F77FLAGSPIC F77LIBS enableshared lib_suffix AR RANLIB ac_ct_RANLIB enablemultigrid TECPLOT_LIBRARY_PATH TECPLOT_INCLUDE_PATH USE_CONTRIB_HSL USE_CONTRIB_PETSC DEAL_II_PETSC_DIR DEAL_II_PETSC_ARCH DEAL_II_PETSC_VERSION_MAJOR DEAL_II_PETSC_VERSION_MINOR DEAL_II_PETSC_VERSION_SUBMINOR USE_CONTRIB_METIS DEAL_II_METIS_DIR kdocdir kdocversion DOXYGEN PERL subdirs LIBOBJS LTLIBOBJS'
 ac_subst_files=''
 
 # Initialize some variables set by options.
@@ -7758,8 +7758,9 @@ _ACEOF
   fi
 
 
-        if test "$USE_CONTRIB_PETSC" = "yes" ; then
-    echo "$as_me:$LINENO: checking for PETSc library architecture" >&5
+    if test "$USE_CONTRIB_PETSC" = "yes" ; then
+
+  echo "$as_me:$LINENO: checking for PETSc library architecture" >&5
 echo $ECHO_N "checking for PETSc library architecture... $ECHO_C" >&6
 
 
@@ -7767,45 +7768,63 @@ echo $ECHO_N "checking for PETSc library architecture... $ECHO_C" >&6
 if test "${with_petsc_arch+set}" = set; then
   withval="$with_petsc_arch"
 
-          DEAL_II_PETSC_ARCH=$withval
-         echo "$as_me:$LINENO: result: $DEAL_II_PETSC_ARCH" >&5
+        DEAL_II_PETSC_ARCH=$withval
+       echo "$as_me:$LINENO: result: $DEAL_II_PETSC_ARCH" >&5
 echo "${ECHO_T}$DEAL_II_PETSC_ARCH" >&6
 
-                    if test ! -d $DEAL_II_PETSC_DIR/lib/libg_c++/$DEAL_II_PETSC_ARCH \
-               ; then
-            { { echo "$as_me:$LINENO: error: PETSc has not been compiled for the architecture
-                          specified with --with-petsc-arch" >&5
+                if test ! -d $DEAL_II_PETSC_DIR/lib/libg_c++/$DEAL_II_PETSC_ARCH \
+             ; then
+          { { echo "$as_me:$LINENO: error: PETSc has not been compiled for the architecture
+                        specified with --with-petsc-arch" >&5
 echo "$as_me: error: PETSc has not been compiled for the architecture
-                          specified with --with-petsc-arch" >&2;}
+                        specified with --with-petsc-arch" >&2;}
    { (exit 1); exit 1; }; }
-         fi
+       fi
 
 else
 
-                    if test "x$PETSC_ARCH" != "x" ; then
-            DEAL_II_PETSC_ARCH="$PETSC_ARCH"
-           echo "$as_me:$LINENO: result: $DEAL_II_PETSC_ARCH" >&5
+                if test "x$PETSC_ARCH" != "x" ; then
+          DEAL_II_PETSC_ARCH="$PETSC_ARCH"
+         echo "$as_me:$LINENO: result: $DEAL_II_PETSC_ARCH" >&5
 echo "${ECHO_T}$DEAL_II_PETSC_ARCH" >&6
 
-                        if test ! -d $DEAL_II_PETSC_DIR/lib/libg_c++/$DEAL_II_PETSC_ARCH \
-               ; then
-              { { echo "$as_me:$LINENO: error: PETSc has not been compiled for the architecture
-                            specified in the PETSC_ARCH environment variable" >&5
+                    if test ! -d $DEAL_II_PETSC_DIR/lib/libg_c++/$DEAL_II_PETSC_ARCH \
+             ; then
+            { { echo "$as_me:$LINENO: error: PETSc has not been compiled for the architecture
+                          specified in the PETSC_ARCH environment variable" >&5
 echo "$as_me: error: PETSc has not been compiled for the architecture
-                            specified in the PETSC_ARCH environment variable" >&2;}
+                          specified in the PETSC_ARCH environment variable" >&2;}
    { (exit 1); exit 1; }; }
-            fi
-          else
-           { { echo "$as_me:$LINENO: error: If PETSc is used, you must specify the architectur
-                          either through the PETSC_ARCH environment variable,
-                          or through the --with-petsc-arch flag" >&5
+          fi
+        else
+         { { echo "$as_me:$LINENO: error: If PETSc is used, you must specify the architectur
+                        either through the PETSC_ARCH environment variable,
+                        or through the --with-petsc-arch flag" >&5
 echo "$as_me: error: If PETSc is used, you must specify the architectur
-                          either through the PETSC_ARCH environment variable,
-                          or through the --with-petsc-arch flag" >&2;}
+                        either through the PETSC_ARCH environment variable,
+                        or through the --with-petsc-arch flag" >&2;}
    { (exit 1); exit 1; }; }
-          fi
+        fi
 
 fi;
+
+
+  echo "$as_me:$LINENO: checking for PETSc version" >&5
+echo $ECHO_N "checking for PETSc version... $ECHO_C" >&6
+
+  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"
+  echo "$as_me:$LINENO: result: $PETSC_VERSION" >&5
+echo "${ECHO_T}$PETSC_VERSION" >&6
+
   fi
 
 
@@ -7813,6 +7832,9 @@ fi;
 
 
 
+
+
+
     echo "$as_me:$LINENO: checking for Metis library directory" >&5
 echo $ECHO_N "checking for Metis library directory... $ECHO_C" >&6
 
@@ -8826,6 +8848,9 @@ s,@USE_CONTRIB_HSL@,$USE_CONTRIB_HSL,;t t
 s,@USE_CONTRIB_PETSC@,$USE_CONTRIB_PETSC,;t t
 s,@DEAL_II_PETSC_DIR@,$DEAL_II_PETSC_DIR,;t t
 s,@DEAL_II_PETSC_ARCH@,$DEAL_II_PETSC_ARCH,;t t
+s,@DEAL_II_PETSC_VERSION_MAJOR@,$DEAL_II_PETSC_VERSION_MAJOR,;t t
+s,@DEAL_II_PETSC_VERSION_MINOR@,$DEAL_II_PETSC_VERSION_MINOR,;t t
+s,@DEAL_II_PETSC_VERSION_SUBMINOR@,$DEAL_II_PETSC_VERSION_SUBMINOR,;t t
 s,@USE_CONTRIB_METIS@,$USE_CONTRIB_METIS,;t t
 s,@DEAL_II_METIS_DIR@,$DEAL_II_METIS_DIR,;t t
 s,@kdocdir@,$kdocdir,;t t
index 6c479d0387350d5db98276a12a34bb60d78d9d1f..4c6bdb3aff3ce9b28a0aab77a998264c096bfc56 100644 (file)
@@ -341,6 +341,9 @@ DEAL_II_CONFIGURE_PETSC
 AC_SUBST(USE_CONTRIB_PETSC)
 AC_SUBST(DEAL_II_PETSC_DIR)
 AC_SUBST(DEAL_II_PETSC_ARCH)
+AC_SUBST(DEAL_II_PETSC_VERSION_MAJOR)
+AC_SUBST(DEAL_II_PETSC_VERSION_MINOR)
+AC_SUBST(DEAL_II_PETSC_VERSION_SUBMINOR)
 
 DEAL_II_CONFIGURE_METIS
 AC_SUBST(USE_CONTRIB_METIS)
index a4364818ef1fdab2b8e4b517ee055abd9f05ab82..869111e26a5d7a13baa8e6bdf77977d2839b7f66 100644 (file)
@@ -34,14 +34,23 @@ ifeq ($(USE_CONTRIB_PETSC),yes)
   # have now centralized this part to one single place, and are back to where
   # we want to be: have different libraries for debug and optimized mode,
   # but in the same directory. And, voila, our build system works again :-)
+  #
+  # There is one gotcha: PETSc has a habit of making incompatible changes by
+  # simply changing the names of libraries between different versions. That
+  # really is too bad, so we have to conditionalize things.
   lib-contrib-petsc-path.g = $(DEAL_II_PETSC_DIR)/lib/libg_c++/$(DEAL_II_PETSC_ARCH)
   lib-contrib-petsc-path.o = $(DEAL_II_PETSC_DIR)/lib/libO_c++/$(DEAL_II_PETSC_ARCH)
-  xlib.g = $(lib-contrib-petsc-path.g)/libpetscsles.so \
+ifeq (DEAL_II_PETSC_VERSION_MINOR,1)
+  xlib-ksp=libpetscsles
+else
+  xlib-ksp=libpetscksp
+endif
+  xlib.g = $(lib-contrib-petsc-path.g)/$(xlib-ksp).so \
            $(lib-contrib-petsc-path.g)/libpetscdm.so \
            $(lib-contrib-petsc-path.g)/libpetscmat.so \
            $(lib-contrib-petsc-path.g)/libpetscvec.so \
            $(lib-contrib-petsc-path.g)/libpetsc.so
-  xlib.o = $(lib-contrib-petsc-path.o)/libpetscsles.so \
+  xlib.o = $(lib-contrib-petsc-path.o)/$(xlib-ksp).so \
            $(lib-contrib-petsc-path.o)/libpetscdm.so \
            $(lib-contrib-petsc-path.o)/libpetscmat.so \
            $(lib-contrib-petsc-path.o)/libpetscvec.so \

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.