-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfigure.balfrin.gcc
executable file
·118 lines (98 loc) · 2.82 KB
/
configure.balfrin.gcc
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
#! /bin/bash
#
set -eu
set -o history
#_______________________________________________________________________________
#
function banner {
typeset line
line=______________________________________________________________________
echo
echo $line
echo
echo "$*"
echo $line
echo
}
#_______________________________________________________________________________
#
banner "Configuration for balfrin.cscs.ch with GCC"
#_______________________________________________________________________________
#
this_script=${0}
extpar_dir=$(cd ${this_script%/*} && pwd)
#_______________________________________________________________________________
#
banner "Define system specific environment"
module use $USER_ENV_ROOT/modules
module load python
module load gcc
module load cdo
module load netcdf-c
# Must be the last module loaded, as "--with-netcdf-fortran ..." depends on it.
module load netcdf-fortran
CC=gcc
CPPFLAGS=""
CFLAGS="-Wall -pedantic -O3 -g"
FC=gfortran
FCFLAGS="-cpp -Wall -pedantic -fbacktrace -O3 -g -ffree-line-length-256"
LDFLAGS=""
LIB=""
EXTRA_CONFIG_ARGS="--enable-rpaths "
EXTRA_CONFIG_ARGS+="--enable-openmp "
# Depends on the fact that netcdf-fortran is the last module loaded.
EXTRA_CONFIG_ARGS+="--with-netcdf-fortran=$(echo $PATH | cut -d':' -f1 | sed 's|/bin$||') "
EXTRA_CONFIG_ARGS+="--with-netcdf=$(echo $PATH | cut -d':' -f2 | sed 's|/bin$||') "
EXTRA_CONFIG_ARGS+="--with-cdi=bundled "
#_______________________________________________________________________________
#
gcc_version=$(gcc --version | awk 'NR==1{print $3}')
gfortran_version=$(gfortran --version | awk 'NR==1{print $4}')
echo "Software tree installation "
echo
echo "C compiler : ${gcc_version}"
echo "C compiler flags : ${CFLAGS}"
echo "C preprocessor flags : ${CPPFLAGS}"
echo
echo "Fortran compiler : ${gfortran_version}"
echo "Fortran compiler flags: ${FCFLAGS}"
echo
echo "Configure flags:"
for extra_arg in ${EXTRA_CONFIG_ARGS}
do
echo " $extra_arg"
done
#_______________________________________________________________________________
#
banner "Configure ..."
"${extpar_dir}/configure" \
CC="${CC}" \
CFLAGS="${CFLAGS}" \
CPPFLAGS="${CPPFLAGS}" \
FC="${FC}" \
FCFLAGS="${FCFLAGS}" \
LDFLAGS="${LDFLAGS}" \
LIBS="${LIB}" \
${EXTRA_CONFIG_ARGS} \
"$@"
banner "Run make ..."
if [[ -e modules.env ]]
then
rm -f modules.env
fi
while read module_command
do
echo " ${module_command}"
done < <(history | awk '/^[ ]*[0-9]+[ ]+module/{$1=""; print $0 >> "modules.env"}')
echo
echo "To be compatible with the configure environment run:"
echo
echo "source modules.env"
echo
echo "in your terminal, where the make command will be run."
echo
#_______________________________________________________________________________
#
exit
#_______________________________________________________________________________
#