1 |
edhill |
1.1 |
#!/bin/bash |
2 |
|
|
# |
3 |
ce107 |
1.3 |
# $Header: /u/gcmpack/MITgcm/tools/build_options/linux_amd64_gfortran,v 1.2 2007/01/31 21:43:34 ce107 Exp $ |
4 |
edhill |
1.1 |
# $Name: $ |
5 |
|
|
# |
6 |
|
|
|
7 |
|
|
# Tested with gcc-gfortran v4.0.x as shipped with Fedora Core 4. |
8 |
|
|
# It fixes the ' \' versus ' &' terminator problem but some |
9 |
|
|
# namelist problems remain. The biggest seems to be the inability |
10 |
|
|
# of current gfortran versions to support namelist syntax such as: |
11 |
|
|
# |
12 |
|
|
# fields(1,1) = 'UVELSLT ','VVELSLT ','WVELSLT ', |
13 |
|
|
# |
14 |
|
|
# which results in run-time errors. |
15 |
|
|
|
16 |
|
|
|
17 |
|
|
FC=gfortran |
18 |
ce107 |
1.2 |
F90C=gfortran |
19 |
edhill |
1.1 |
CC=gcc |
20 |
ce107 |
1.2 |
DEFINES='-DWORDLENGTH=4 -DNML_TERMINATOR' |
21 |
edhill |
1.1 |
CPP='cpp -traditional -P' |
22 |
|
|
NOOPTFLAGS='-O0' |
23 |
|
|
|
24 |
ce107 |
1.2 |
if test "x$DEVEL" != x ; then |
25 |
|
|
FFLAGS='-g -Wall -W -ffpe-trap=invalid,zero,overflow -fbounds-check' |
26 |
|
|
else |
27 |
|
|
FFLAGS='' |
28 |
|
|
fi |
29 |
|
|
|
30 |
|
|
# Requires gfortran from 2006 onwards for -fconvert=big-endian |
31 |
|
|
FFLAGS="$FFLAGS -fconvert=big-endian -fimplicit-none" |
32 |
|
|
|
33 |
edhill |
1.1 |
if test "x$IEEE" = x ; then |
34 |
|
|
# No need for IEEE-754 |
35 |
ce107 |
1.3 |
FOPTIM='-O3 -funroll-loops' |
36 |
edhill |
1.1 |
else |
37 |
|
|
# Try to follow IEEE-754 |
38 |
ce107 |
1.2 |
FOPTIM='-O0' |
39 |
edhill |
1.1 |
fi |
40 |
ce107 |
1.2 |
F90FLAGS=$FFLAGS |
41 |
|
|
F90OPTIM=$FOPTIM |
42 |
|
|
CFLAGS=$FOPTIM |
43 |
|
|
|
44 |
|
|
if [ "x$NETCDF_ROOT" != x ] ; then |
45 |
|
|
INCLUDEDIR="${NETCDF_ROOT}/include" |
46 |
|
|
INCLUDES="-I${NETCDF_ROOT}/include" |
47 |
|
|
LIBDIR="${NETCDF_ROOT}/lib" |
48 |
|
|
LIBS="-L${NETCDF_ROOT}/lib" |
49 |
|
|
elif [ "x$NETCDF_HOME" != x ]; then |
50 |
|
|
INCLUDEDIR="${NETCDF_HOME}/include" |
51 |
|
|
INCLUDES="-I${NETCDF_HOME}/include" |
52 |
|
|
LIBDIR="${NETCDF_HOME}/lib" |
53 |
|
|
LIBS="-L${NETCDF_HOME}/lib" |
54 |
|
|
elif [ "x$NETCDF_INC" != x -a "x$NETCDF_LIB" != x ]; then |
55 |
|
|
NETCDF_INC=`echo $NETCDF_INC | sed 's/-I//g'` |
56 |
|
|
NETCDF_LIB=`echo $NETCDF_LIB | sed 's/-L//g'` |
57 |
|
|
INCLUDEDIR="${NETCDF_INC}" |
58 |
|
|
INCLUDES="-I${NETCDF_INC}" |
59 |
|
|
LIBDIR="${NETCDF_LIB}" |
60 |
|
|
LIBS="-L${NETCDF_LIB}" |
61 |
|
|
elif [ "x$NETCDF_INCDIR" != x -a "x$NETCDF_LIBDIR" != x ]; then |
62 |
|
|
INCLUDEDIR="${NETCDF_INCDIR}" |
63 |
|
|
INCLUDES="-I${NETCDF_INCDIR}" |
64 |
|
|
LIBDIR="${NETCDF_LIBDIR}" |
65 |
|
|
LIBS="-L${NETCDF_LIBDIR}" |
66 |
|
|
elif test -d /usr/include/netcdf-3 ; then |
67 |
edhill |
1.1 |
INCLUDES='-I/usr/include/netcdf-3' |
68 |
|
|
LIBS='-L/usr/lib/netcdf-3 -L/usr/lib64/netcdf-3' |
69 |
|
|
elif test -d /usr/include/netcdf ; then |
70 |
|
|
INCLUDES='-I/usr/include/netcdf' |
71 |
|
|
elif test -d /usr/local/netcdf ; then |
72 |
|
|
INCLUDES='-I/usr/local/netcdf/include' |
73 |
|
|
LIBS='-L/usr/local/netcdf/lib' |
74 |
ce107 |
1.2 |
elif test -d /usr/local/include/netcdf.inc ; then |
75 |
|
|
INCLUDES='-I/usr/local/include' |
76 |
|
|
LIBS='-L/usr/local/lib64' |
77 |
edhill |
1.1 |
fi |