aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xPETSc.sh20
1 files changed, 18 insertions, 2 deletions
diff --git a/PETSc.sh b/PETSc.sh
index af1953e..231654a 100755
--- a/PETSc.sh
+++ b/PETSc.sh
@@ -96,10 +96,26 @@ if [ -z "$PETSC_ARCH_LIBS" ]; then
esac
fi
+# Set version-specific library directory
+# (version 2.3.0 and newer use different library directories)
+if [ -e "$PETSC_DIR/lib/$PETSC_ARCH" ]; then
+ PETSC_LIB_INFIX=''
+else
+ PETSC_LIB_INFIX='/libO'
+fi
+
+# Set version-specific libraries
+# (version 2.2.0 and newer do not have libpetscsles.a any more)
+if [ -e "$PETSC_DIR/lib$PETSC_LIB_INFIX/$PETSC_ARCH/libpetscksp.a" ]; then
+ PETSC_SLES_LIBS="petscksp"
+else
+ PETSC_SLES_LIBS="petscsles"
+fi
+
# Set the PETSc libs, libdirs and includedirs
PETSC_INC_DIRS='$(PETSC_DIR)/include $(PETSC_DIR)/bmake/$(PETSC_ARCH)'
-PETSC_LIB_DIRS='$(PETSC_DIR)/lib/libO/$(PETSC_ARCH)'
-PETSC_LIBS="petscts petscsnes petscsles petscdm petscmat petscvec petsc $PETSC_ARCH_LIBS"
+PETSC_LIB_DIRS='$(PETSC_DIR)/lib'$PETSC_LIB_INFIX'/$(PETSC_ARCH)'
+PETSC_LIBS="petscts petscsnes $PETSC_SLES_LIBS petscdm petscmat petscvec petsc $PETSC_ARCH_LIBS"
echo 'BEGIN MAKE_DEFINITION'
echo "PETSC_DIR = $PETSC_DIR"