1 |
#!/bin/bash |
#!/bin/bash |
2 |
# |
|
3 |
# $Header$ |
# $Header$ |
4 |
# $Name$ |
# $Name$ |
|
# |
|
5 |
|
|
6 |
# Tested with gcc-gfortran v4.0.x as shipped with Fedora Core 4. |
# Tested with gcc-gfortran v4.1.x as shipped with Fedora Core 6,7,8 |
7 |
# It fixes the ' \' versus ' &' terminator problem but some |
# with gcc-gfortran v4.3.x as shipped with Fedora Core 9,10 |
|
# namelist problems remain. The biggest seems to be the inability |
|
|
# of current gfortran versions to support namelist syntax such as: |
|
|
# |
|
|
# fields(1,1) = 'UVELSLT ','VVELSLT ','WVELSLT ', |
|
|
# |
|
|
# which results in run-time errors. |
|
8 |
|
|
9 |
|
# OpenMP : Tested on dickens with gcc-gfortran v4.3.2 as shipped with FC 10 |
10 |
|
# and on baudelaire with gcc-gfortran v4.4.5 as shipped with FC 13 |
11 |
|
# also on danton with gcc-gfortran v4.5.1 as shipped with FC 14 |
12 |
|
#------- |
13 |
|
# run with OpenMP: needs to set environment var. OMP_NUM_THREADS |
14 |
|
# and generally, needs to increase the thread stack-size: |
15 |
|
# - sh,bash: |
16 |
|
# > export OMP_NUM_THREADS=2 |
17 |
|
# > export GOMP_STACKSIZE=400m |
18 |
|
# - csh,tcsh: |
19 |
|
# > setenv OMP_NUM_THREADS 2 |
20 |
|
# > setenv GOMP_STACKSIZE 400m |
21 |
|
#------- |
22 |
|
|
23 |
FC=gfortran |
FC=gfortran |
24 |
F90C=gfortran |
F90C=gfortran |
26 |
DEFINES='-DWORDLENGTH=4 -DNML_TERMINATOR' |
DEFINES='-DWORDLENGTH=4 -DNML_TERMINATOR' |
27 |
CPP='cpp -traditional -P' |
CPP='cpp -traditional -P' |
28 |
NOOPTFLAGS='-O0' |
NOOPTFLAGS='-O0' |
29 |
|
EXTENDED_SRC_FLAG='-ffixed-line-length-132' |
30 |
|
GET_FC_VERSION="--version" |
31 |
|
OMPFLAG='-fopenmp' |
32 |
|
|
33 |
if test "x$DEVEL" != x ; then |
if test "x$DEVEL" != x ; then |
34 |
FFLAGS='-g -Wall -W -ffpe-trap=invalid,zero,overflow -fbounds-check' |
FFLAGS='-g -Wall -W -ffpe-trap=invalid,zero,overflow -fbounds-check' |
38 |
|
|
39 |
# Requires gfortran from 2006 onwards for -fconvert=big-endian |
# Requires gfortran from 2006 onwards for -fconvert=big-endian |
40 |
FFLAGS="$FFLAGS -fconvert=big-endian -fimplicit-none" |
FFLAGS="$FFLAGS -fconvert=big-endian -fimplicit-none" |
41 |
|
# for big objects: |
42 |
|
FFLAGS="$FFLAGS -fPIC" |
43 |
|
|
44 |
if test "x$IEEE" = x ; then |
if test "x$IEEE" = x ; then |
45 |
# No need for IEEE-754 |
# No need for IEEE-754 |
46 |
FOPTIM='-O3 -funroll-loops -ffast-math' |
FOPTIM='-O3 -funroll-loops' |
47 |
else |
else |
48 |
# Try to follow IEEE-754 |
# Try to follow IEEE-754 |
49 |
|
# these may also be useful, but require specific gfortran versions: |
50 |
|
# -Wnonstd-intrinsics for gfortran <= 4.3 |
51 |
|
# -Wintrinsics-std for gfortran >= 4.4 |
52 |
|
# -Wno-tabs for gfortran >= 4.3 |
53 |
|
FFLAGS="$FFLAGS -Waliasing -Wampersand -Wsurprising -Wline-truncation" |
54 |
|
# to get plenty of warnings : |
55 |
|
# FFLAGS="$FFLAGS -Wconversion -Wimplicit-interface -Wunused-labels" |
56 |
FOPTIM='-O0' |
FOPTIM='-O0' |
57 |
|
# for automatic testing with testreport (but no relation with IEEE arithmetic): |
58 |
|
FOPTIM="$FOPTIM -g -ffpe-trap=invalid,zero,overflow -fbounds-check" |
59 |
fi |
fi |
60 |
F90FLAGS=$FFLAGS |
F90FLAGS=$FFLAGS |
61 |
F90OPTIM=$FOPTIM |
F90OPTIM=$FOPTIM |
62 |
CFLAGS=$FOPTIM |
CFLAGS='-O0 -fPIC' |
63 |
|
|
64 |
if [ "x$NETCDF_ROOT" != x ] ; then |
if [ "x$NETCDF_ROOT" != x ] ; then |
65 |
INCLUDEDIR="${NETCDF_ROOT}/include" |
INCLUDEDIR="${NETCDF_ROOT}/include" |