forked from plasmasim/sceptic3D
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setcomp
executable file
·53 lines (45 loc) · 1.07 KB
/
setcomp
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
#!/bin/bash
# Script to choose (return) compiler version for specified language (f77, f90, etc.)
case $1 in
f77)
if [ "`which mpif77`" ] ; then
# By default use mpif77
COMPILER=mpif77
if [[ "$2" == "nonmpi" ]] ; then
# If non-mpi requested, figure out which compiler mpi uses
if [ "`mpif77 -show`" ] ; then
COMPILER=`mpif77 -show | awk '{ print $1}'`
fi
fi
elif [ "`which gfortran`" ] ; then
# Else use gfortran
COMPILER=gfortran
elif [ "`which g77`" ] ; then
# Else use g77
COMPILER=g77
else
# Or whatever was specified
COMPILER=$G77
fi
;;
f90)
if [ "`which mpif90`" ] ; then
# By default use mpif90
COMPILER=mpif90
if [[ "$2" == "nonmpi" ]] ; then
# If non-mpi requested, figure out which compiler mpi uses
if [ "`mpif90 -show`" ] ; then
COMPILER=`mpif90 -show | awk '{ print $1}'`
fi
fi
elif [ "`which gfortran`" ] ; then
# Else use gfortran
COMPILER=gfortran
else
# Or whatever was specified
COMPILER=$G90
fi
;;
esac
# Return compiler choice
echo $COMPILER