1 |
#!/bin/bash |
2 |
# |
3 |
# $Header: /u/gcmpack/MITgcm/tools/build_options/linux_amd64_g77,v 1.8 2011/05/16 19:03:37 jmc Exp $ |
4 |
# $Name: $ |
5 |
# |
6 |
# Build options for g77 compiler (compat-gcc-34-g77) on Linux AMD64 platform |
7 |
# Tested on Linux 2.4.21-102-smp (x86_64), |
8 |
# on Fedora Core 8, 10 (e.g.: dickens), 13 (e.g.: baudelaire), |
9 |
# 14, 15 (e.g.: acesgrid), 17, 19 |
10 |
|
11 |
CC=gcc34 |
12 |
FC=g77 |
13 |
DEFINES='-D_BYTESWAPIO -DWORDLENGTH=4 -DNML_EXTENDED_F77' |
14 |
EXTENDED_SRC_FLAG='-ffixed-line-length-132' |
15 |
GET_FC_VERSION="--version" |
16 |
|
17 |
NOOPTFLAGS='-O0' |
18 |
CFLAGS='-O0' |
19 |
|
20 |
# For IEEE, use the "-ffloat-store" option |
21 |
if test "x$IEEE" = x ; then |
22 |
FFLAGS='-Wimplicit -Wunused -Wuninitialized' |
23 |
FOPTIM='-O3 -funroll-loops' |
24 |
else |
25 |
FFLAGS='-Wimplicit -Wunused -ffloat-store' |
26 |
# FFLAGS="$FFLAGS -g -mfpmath=sse -msse -msse2 -fbounds-check" |
27 |
FOPTIM='-O0' |
28 |
fi |
29 |
|
30 |
#- for big setups, compile & link with "-fPIC" or set memory-model to "medium": |
31 |
#CFLAGS="$CFLAGS -fPIC" |
32 |
#FFLAGS="$FFLAGS -fPIC" |
33 |
#- with FC 19, need to use this without -fPIC (which cancels -mcmodel option): |
34 |
CFLAGS="$CFLAGS -mcmodel=medium" |
35 |
FFLAGS="$FFLAGS -mcmodel=medium" |
36 |
|
37 |
if test -d /usr/include/netcdf-3 ; then |
38 |
#-- some FedoraCore standard location used to be "netcdf-3" |
39 |
INCLUDES='-I/usr/include/netcdf-3' |
40 |
if test -d /usr/lib64/netcdf-3 ; then |
41 |
if test -f /usr/lib64/netcdf-3/libnetcdf_g77.a ; then |
42 |
LIBS='-L/usr/lib64/netcdf-3 -lnetcdf_g77' |
43 |
else |
44 |
LIBS='-L/usr/lib64/netcdf-3' |
45 |
fi |
46 |
elif test -d /usr/lib/netcdf-3 ; then |
47 |
if test -f /usr/lib/netcdf-3/libnetcdf_g77.a ; then |
48 |
LIBS='-L/usr/lib/netcdf-3 -lnetcdf_g77' |
49 |
else |
50 |
LIBS='-L/usr/lib/netcdf-3' |
51 |
fi |
52 |
fi |
53 |
elif test -d /usr/include/netcdf -o -f /usr/include/netcdf.h ; then |
54 |
#-- allows a "compat"(gcc 3.4) 2nd version of libs for g77 , next to the |
55 |
# standard one (for gfortran, gcc 4.x). But uses same include files. |
56 |
if test -d /usr/include/netcdf ; then |
57 |
INCLUDES='-I/usr/include/netcdf' |
58 |
fi |
59 |
if test -d /usr/lib64/netcdf34 ; then |
60 |
if test -f /usr/lib64/netcdf34/libnetcdf_g77.a ; then |
61 |
LIBS='-L/usr/lib64/netcdf34 -lnetcdf_g77' |
62 |
else |
63 |
LIBS='-L/usr/lib64/netcdf34' |
64 |
fi |
65 |
elif test -d /usr/lib/netcdf34 ; then |
66 |
if test -f /usr/lib/netcdf34/libnetcdf_g77.a ; then |
67 |
LIBS='-L/usr/lib/netcdf34 -lnetcdf_g77' |
68 |
else |
69 |
LIBS='-L/usr/lib/netcdf34' |
70 |
fi |
71 |
fi |
72 |
elif test -d /usr/local/netcdf ; then |
73 |
INCLUDES='-I/usr/local/netcdf/include' |
74 |
LIBS='-L/usr/local/netcdf/lib' |
75 |
fi |