-
Notifications
You must be signed in to change notification settings - Fork 24
/
configure
executable file
·73 lines (63 loc) · 1.42 KB
/
configure
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
#!/bin/sh
# Shell script for configuring Sirocco radiative transfer code compilation
# James Matthews, University of Southampton
# Questions: [email protected]
# Usage: ./configure
# Parse any command line arguments or switches
while [ $# -gt 0 ]; do
case "$1" in
--with-cuda)
with_cuda=true
shift
;;
*)
printf "Unknown option: $1\n"
exit 1
;;
esac
done
printf "Configuring Makefile for Python radiative transfer code\n"
printf "Checking for mpicc..."
if hash mpicc 2>/dev/null; then
printf "yes\n"
MPICC_IN=1
else
printf "no\n"
MPICC_IN=0
fi
printf "Checking for gcc..."
if hash gcc 2>/dev/null; then
printf "yes\n"
GCC_IN=1
else
printf "no\n"
GCC_IN=0
fi
# when --with-cuda is enabled, we gotta do something to modify the Makefiles
if [ "$with_cuda" = true ]; then
printf "Checking for nvcc..."
if hash nvcc 2>/dev/null; then
printf "yes\n"
sed -i -e "s/^NVCC =.*/NVCC = nvcc/" source/Makefile
else
printf "no\n"
sed -i -e "s/^NVCC =.*/NVCC = /" source/Makefile
fi
else
sed -i -e "s/^NVCC =.*/NVCC = /" source/Makefile
fi
printf "Preparing Makefile..."
if [ "$MPICC_IN" -eq 0 ]
then
if [ "$GCC_IN" -eq 1 ]
then
cp Makefile.in Makefile
sed -i -e 's/mpicc/gcc/' Makefile
printf "Done.\n"
else
printf "failed.\nNo gcc or mpicc installed. You need a C compiler!\n"
fi
else
cp Makefile.in Makefile
printf "Done.\n"
fi