1 |
#!/bin/bash |
2 |
# |
3 |
# $Header: /u/gcmpack/MITgcm/tools/build_options/linux_amd64_gfortran,v 1.3 2007/08/20 20:31:00 ce107 Exp $ |
4 |
# $Name: $ |
5 |
# |
6 |
|
7 |
# 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 |
# fields(1,1) = 'UVELSLT ','VVELSLT ','WVELSLT ', |
12 |
# which results in run-time errors.) |
13 |
|
14 |
|
15 |
FC=gfortran |
16 |
F90C=gfortran |
17 |
CC=gcc |
18 |
DEFINES='-DWORDLENGTH=4 -DNML_TERMINATOR' |
19 |
CPP='cpp -traditional -P' |
20 |
NOOPTFLAGS='-O0' |
21 |
EXTENDED_SRC_FLAG='-ffixed-line-length-132' |
22 |
|
23 |
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 |
if test "x$IEEE" = x ; then |
33 |
# No need for IEEE-754 |
34 |
FOPTIM='-O3 -funroll-loops' |
35 |
else |
36 |
# Try to follow IEEE-754 |
37 |
FFLAGS="$FFLAGS -Waliasing -Wampersand -Wnonstd-intrinsics -Wsurprising -Wline-truncation" |
38 |
# to get plenty of warnings : |
39 |
# FFLAGS="$FFLAGS -Wconversion -Wimplicit-interface -Wunused-labels" |
40 |
FOPTIM='-O0' |
41 |
# for automatic testing with testreport (but no relation with IEEE arithmetic): |
42 |
FOPTIM="$FOPTIM -g -ffpe-trap=invalid,zero,overflow -fbounds-check" |
43 |
fi |
44 |
F90FLAGS=$FFLAGS |
45 |
F90OPTIM=$FOPTIM |
46 |
CFLAGS=$FOPTIM |
47 |
|
48 |
if [ "x$NETCDF_ROOT" != x ] ; then |
49 |
INCLUDEDIR="${NETCDF_ROOT}/include" |
50 |
INCLUDES="-I${NETCDF_ROOT}/include" |
51 |
LIBDIR="${NETCDF_ROOT}/lib" |
52 |
LIBS="-L${NETCDF_ROOT}/lib" |
53 |
elif [ "x$NETCDF_HOME" != x ]; then |
54 |
INCLUDEDIR="${NETCDF_HOME}/include" |
55 |
INCLUDES="-I${NETCDF_HOME}/include" |
56 |
LIBDIR="${NETCDF_HOME}/lib" |
57 |
LIBS="-L${NETCDF_HOME}/lib" |
58 |
elif [ "x$NETCDF_INC" != x -a "x$NETCDF_LIB" != x ]; then |
59 |
NETCDF_INC=`echo $NETCDF_INC | sed 's/-I//g'` |
60 |
NETCDF_LIB=`echo $NETCDF_LIB | sed 's/-L//g'` |
61 |
INCLUDEDIR="${NETCDF_INC}" |
62 |
INCLUDES="-I${NETCDF_INC}" |
63 |
LIBDIR="${NETCDF_LIB}" |
64 |
LIBS="-L${NETCDF_LIB}" |
65 |
elif [ "x$NETCDF_INCDIR" != x -a "x$NETCDF_LIBDIR" != x ]; then |
66 |
INCLUDEDIR="${NETCDF_INCDIR}" |
67 |
INCLUDES="-I${NETCDF_INCDIR}" |
68 |
LIBDIR="${NETCDF_LIBDIR}" |
69 |
LIBS="-L${NETCDF_LIBDIR}" |
70 |
elif test -d /usr/include/netcdf-3 ; then |
71 |
INCLUDES='-I/usr/include/netcdf-3' |
72 |
LIBS='-L/usr/lib/netcdf-3 -L/usr/lib64/netcdf-3' |
73 |
elif test -d /usr/include/netcdf ; then |
74 |
INCLUDES='-I/usr/include/netcdf' |
75 |
elif test -d /usr/local/netcdf ; then |
76 |
INCLUDES='-I/usr/local/netcdf/include' |
77 |
LIBS='-L/usr/local/netcdf/lib' |
78 |
elif test -d /usr/local/include/netcdf.inc ; then |
79 |
INCLUDES='-I/usr/local/include' |
80 |
LIBS='-L/usr/local/lib64' |
81 |
fi |