1 |
edhill |
1.1 |
#!/bin/bash |
2 |
|
|
# |
3 |
jahn |
1.6 |
# $Header: /u/gcmpack/MITgcm/tools/build_options/linux_amd64_gfortran,v 1.5 2009/03/29 23:20:28 jmc Exp $ |
4 |
edhill |
1.1 |
# $Name: $ |
5 |
|
|
# |
6 |
|
|
|
7 |
jmc |
1.5 |
# Tested with gcc-gfortran v4.1.x as shipped with Fedora Core 6,7,8 |
8 |
|
|
# with gcc-gfortran v4.3.x as shipped with Fedora Core 9,10 |
9 |
|
|
# It fixes the ' \' versus ' &' terminator ; |
10 |
|
|
# with older versions (v4.0): namelist problems with syntax such as: |
11 |
edhill |
1.1 |
# fields(1,1) = 'UVELSLT ','VVELSLT ','WVELSLT ', |
12 |
jmc |
1.5 |
# which results in run-time errors.) |
13 |
edhill |
1.1 |
|
14 |
|
|
|
15 |
|
|
FC=gfortran |
16 |
ce107 |
1.2 |
F90C=gfortran |
17 |
edhill |
1.1 |
CC=gcc |
18 |
ce107 |
1.2 |
DEFINES='-DWORDLENGTH=4 -DNML_TERMINATOR' |
19 |
edhill |
1.1 |
CPP='cpp -traditional -P' |
20 |
|
|
NOOPTFLAGS='-O0' |
21 |
jmc |
1.4 |
EXTENDED_SRC_FLAG='-ffixed-line-length-132' |
22 |
edhill |
1.1 |
|
23 |
ce107 |
1.2 |
if test "x$DEVEL" != x ; then |
24 |
|
|
FFLAGS='-g -Wall -W -ffpe-trap=invalid,zero,overflow -fbounds-check' |
25 |
|
|
else |
26 |
|
|
FFLAGS='' |
27 |
|
|
fi |
28 |
|
|
|
29 |
|
|
# Requires gfortran from 2006 onwards for -fconvert=big-endian |
30 |
|
|
FFLAGS="$FFLAGS -fconvert=big-endian -fimplicit-none" |
31 |
|
|
|
32 |
edhill |
1.1 |
if test "x$IEEE" = x ; then |
33 |
|
|
# No need for IEEE-754 |
34 |
ce107 |
1.3 |
FOPTIM='-O3 -funroll-loops' |
35 |
edhill |
1.1 |
else |
36 |
|
|
# Try to follow IEEE-754 |
37 |
jahn |
1.6 |
# these may also be useful, but require specific gfortran versions: |
38 |
|
|
# -Wnonstd-intrinsics for gfortran <= 4.3 |
39 |
|
|
# -Wintrinsics-std for gfortran >= 4.4 |
40 |
|
|
# -Wno-tabs for gfortran >= 4.3 |
41 |
|
|
FFLAGS="$FFLAGS -Waliasing -Wampersand -Wsurprising -Wline-truncation" |
42 |
jmc |
1.5 |
# to get plenty of warnings : |
43 |
|
|
# FFLAGS="$FFLAGS -Wconversion -Wimplicit-interface -Wunused-labels" |
44 |
ce107 |
1.2 |
FOPTIM='-O0' |
45 |
jmc |
1.5 |
# for automatic testing with testreport (but no relation with IEEE arithmetic): |
46 |
|
|
FOPTIM="$FOPTIM -g -ffpe-trap=invalid,zero,overflow -fbounds-check" |
47 |
edhill |
1.1 |
fi |
48 |
ce107 |
1.2 |
F90FLAGS=$FFLAGS |
49 |
|
|
F90OPTIM=$FOPTIM |
50 |
|
|
CFLAGS=$FOPTIM |
51 |
|
|
|
52 |
|
|
if [ "x$NETCDF_ROOT" != x ] ; then |
53 |
|
|
INCLUDEDIR="${NETCDF_ROOT}/include" |
54 |
|
|
INCLUDES="-I${NETCDF_ROOT}/include" |
55 |
|
|
LIBDIR="${NETCDF_ROOT}/lib" |
56 |
|
|
LIBS="-L${NETCDF_ROOT}/lib" |
57 |
|
|
elif [ "x$NETCDF_HOME" != x ]; then |
58 |
|
|
INCLUDEDIR="${NETCDF_HOME}/include" |
59 |
|
|
INCLUDES="-I${NETCDF_HOME}/include" |
60 |
|
|
LIBDIR="${NETCDF_HOME}/lib" |
61 |
|
|
LIBS="-L${NETCDF_HOME}/lib" |
62 |
|
|
elif [ "x$NETCDF_INC" != x -a "x$NETCDF_LIB" != x ]; then |
63 |
|
|
NETCDF_INC=`echo $NETCDF_INC | sed 's/-I//g'` |
64 |
|
|
NETCDF_LIB=`echo $NETCDF_LIB | sed 's/-L//g'` |
65 |
|
|
INCLUDEDIR="${NETCDF_INC}" |
66 |
|
|
INCLUDES="-I${NETCDF_INC}" |
67 |
|
|
LIBDIR="${NETCDF_LIB}" |
68 |
|
|
LIBS="-L${NETCDF_LIB}" |
69 |
|
|
elif [ "x$NETCDF_INCDIR" != x -a "x$NETCDF_LIBDIR" != x ]; then |
70 |
|
|
INCLUDEDIR="${NETCDF_INCDIR}" |
71 |
|
|
INCLUDES="-I${NETCDF_INCDIR}" |
72 |
|
|
LIBDIR="${NETCDF_LIBDIR}" |
73 |
|
|
LIBS="-L${NETCDF_LIBDIR}" |
74 |
|
|
elif test -d /usr/include/netcdf-3 ; then |
75 |
edhill |
1.1 |
INCLUDES='-I/usr/include/netcdf-3' |
76 |
|
|
LIBS='-L/usr/lib/netcdf-3 -L/usr/lib64/netcdf-3' |
77 |
|
|
elif test -d /usr/include/netcdf ; then |
78 |
|
|
INCLUDES='-I/usr/include/netcdf' |
79 |
|
|
elif test -d /usr/local/netcdf ; then |
80 |
|
|
INCLUDES='-I/usr/local/netcdf/include' |
81 |
|
|
LIBS='-L/usr/local/netcdf/lib' |
82 |
ce107 |
1.2 |
elif test -d /usr/local/include/netcdf.inc ; then |
83 |
|
|
INCLUDES='-I/usr/local/include' |
84 |
|
|
LIBS='-L/usr/local/lib64' |
85 |
edhill |
1.1 |
fi |