summarylogtreecommitdiffstats
path: root/test_optdepends.sh
blob: 11a0d3be9b6acf7ab97d2e69e71597da22549e69 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#!/bin/bash

# Test if external packages for PETSC are installed

CONFOPTS=""

## External downloads
#for external_pkg in hypre; do
	#CONFOPTS="${CONFOPTS} --download-${external_pkg}=1"
#done

# Kokkos
if [ -f "/usr/lib/libkokkoscore.so" ]; then
  CONFOPTS="${CONFOPTS} --with-kokkos=1"
fi

# Add hypre support
if [ -f "/usr/lib/libHYPRE.so" ]; then
  VERSION_MIN=2.14.0
  VERSION=$(readlink -f '/usr/lib/libHYPRE.so' | sed -r 's/^.*libHYPRE-(.*)\.so/\1/')

	if [ "$VERSION_MIN" = "$(printf '%s\n' "$VERSION_MIN" "$VERSION" | sort -V | head -n1)" ]; then
		CONFOPTS="${CONFOPTS} --with-hypre-lib=/usr/lib/libHYPRE.so --with-hypre-include=/usr/include/hypre"
	else
		(>&2 echo "WARNING: COMPILING PETSc WITHOUT HYPRE.")
		(>&2 echo "HYPRE $VERSION FOUND BUT AT LEAST $VERSION_MIN IS REQUIRED.")
	fi
fi

# Add mumps support
if [ -f "/usr/lib/libmumps_common.so" ]; then
	CONFOPTS="${CONFOPTS} --with-mumps=1"
fi

# Add triangle support
if [ -f "/usr/lib/libtriangle.so" ]; then
	CONFOPTS="${CONFOPTS} --with-triangle=1"
fi

# Add scalapack support
if [ -f "/usr/lib/pkgconfig/scalapack.pc" ]; then
	CONFOPTS="${CONFOPTS} --with-scalapack=1"
fi

# Add metis support
if [ -f "/usr/include/metis.h" ]; then
	CONFOPTS="${CONFOPTS} --with-metis=1"
	# Add parmetis support
	if [ -f "/usr/include/parmetis.h" ]; then
		CONFOPTS="${CONFOPTS} --with-parmetis=1"
	fi
fi

# Add scotch support
SCOTCH_DIR="/usr/include"
if [ -f "/usr/include/scotch.h" ]; then
	SCOTCH_LIBS="libesmumps.so,libptscotch.so,libptscotcherr.so,libscotch.so,libscotcherr.so"
	# Include bzip2 if scotch was build with bzip2 support
	if [ -f /usr/include/bzlib.h ];then
		SCOTCH_LIBS="${SCOTCH_LIBS},libbz2.so"
	fi
	SCOTCH_LIBS="[${SCOTCH_LIBS}]"
	CONFOPTS="${CONFOPTS} --with-ptscotch=1 --with-ptscotch-lib=${SCOTCH_LIBS} --with-ptscotch-include=${SCOTCH_DIR}"
fi

# Add superlu_dist support
SUPERLU_DIST_DIR="/usr/include/superlu_dist"
if [ -d "${SUPERLU_DIST_DIR}" ]; then
	CONFOPTS="${CONFOPTS} --with-superlu_dist=1 --with-superlu_dist-lib=-lsuperlu_dist --with-superlu_dist-include=${SUPERLU_DIST_DIR}"
fi

# Add pastix support
PASTIX_CONF=$(which pastix-conf)
if [ -f "${PASTIX_CONF}" ]; then
	PASTIX_DIR="$($PASTIX_CONF --incs | sed 's/-I//')"
	if [ ! -d ${PASTIX_DIR} ]; then
		PASTIX_DIR="[]"
	fi
	#PASTIX_LIBS="$($PASTIX_CONF --libs)"
	PASTIX_LIBS="[libpastix.a,librt.so,libhwloc.so,libpthread.a]"
	CONFOPTS="${CONFOPTS} --with-pastix=1 --with-pastix-lib=${PASTIX_LIBS} --with-pastix-include=${PASTIX_DIR}"
fi

# Add zoltan support
if [ -f "/usr/include/zoltan.h" ]; then
	CONFOPTS="${CONFOPTS} --with-zoltan=1"
fi

# Add ml support (complex-scalar is not supported)
if [ -f "/usr/lib/libml.so" ]; then
	CONFOPTS="${CONFOPTS} --with-ml=0"
	# Add boost support (may be useful for trilinos)
	CONFOPTS="${CONFOPTS} --with-boost=1"
fi

# Add valgrind support
if [ -f "/usr/lib/pkgconfig/valgrind.pc" ]; then
	CONFOPTS="${CONFOPTS} --with-valgrind=1"
fi

echo "${CONFOPTS}"