/[MITgcm]/MITgcm/tools/build_options/linux_amd64_gfortran
ViewVC logotype

Contents of /MITgcm/tools/build_options/linux_amd64_gfortran

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.11 - (show annotations) (download)
Tue Dec 14 21:15:54 2010 UTC (13 years, 4 months ago) by jmc
Branch: MAIN
Changes since 1.10: +2 -1 lines
add the GET_FC_VERSION option

1 #!/bin/bash
2
3 # $Header: /u/gcmpack/MITgcm/tools/build_options/linux_amd64_gfortran,v 1.10 2010/10/14 23:54:58 jmc 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 # OpenMP : Tested on dickens with gcc-gfortran v4.3.2 as shipped with FC 10
15 #-------
16 # run with OpenMP: needs to set environment var. OMP_NUM_THREADS
17 # and generally, needs to increase the thread stack-size:
18 # - sh,bash:
19 # > export OMP_NUM_THREADS=2
20 # > export GOMP_STACKSIZE=400m
21 # - csh,tcsh:
22 # > setenv OMP_NUM_THREADS 2
23 # > setenv GOMP_STACKSIZE 400m
24 #-------
25
26 FC=gfortran
27 F90C=gfortran
28 CC=gcc
29 DEFINES='-DWORDLENGTH=4 -DNML_TERMINATOR'
30 CPP='cpp -traditional -P'
31 NOOPTFLAGS='-O0'
32 EXTENDED_SRC_FLAG='-ffixed-line-length-132'
33 GET_FC_VERSION="-v"
34 OMPFLAG='-fopenmp'
35
36 if test "x$DEVEL" != x ; then
37 FFLAGS='-g -Wall -W -ffpe-trap=invalid,zero,overflow -fbounds-check'
38 else
39 FFLAGS=''
40 fi
41
42 # Requires gfortran from 2006 onwards for -fconvert=big-endian
43 FFLAGS="$FFLAGS -fconvert=big-endian -fimplicit-none"
44 # for big objects:
45 FFLAGS="$FFLAGS -fPIC"
46
47 if test "x$IEEE" = x ; then
48 # No need for IEEE-754
49 FOPTIM='-O3 -funroll-loops'
50 else
51 # Try to follow IEEE-754
52 # these may also be useful, but require specific gfortran versions:
53 # -Wnonstd-intrinsics for gfortran <= 4.3
54 # -Wintrinsics-std for gfortran >= 4.4
55 # -Wno-tabs for gfortran >= 4.3
56 FFLAGS="$FFLAGS -Waliasing -Wampersand -Wsurprising -Wline-truncation"
57 # to get plenty of warnings :
58 # FFLAGS="$FFLAGS -Wconversion -Wimplicit-interface -Wunused-labels"
59 FOPTIM='-O0'
60 # for automatic testing with testreport (but no relation with IEEE arithmetic):
61 FOPTIM="$FOPTIM -g -ffpe-trap=invalid,zero,overflow -fbounds-check"
62 fi
63 F90FLAGS=$FFLAGS
64 F90OPTIM=$FOPTIM
65 CFLAGS='-O0 -fPIC'
66
67 if [ "x$NETCDF_ROOT" != x ] ; then
68 INCLUDEDIR="${NETCDF_ROOT}/include"
69 INCLUDES="-I${NETCDF_ROOT}/include"
70 LIBDIR="${NETCDF_ROOT}/lib"
71 LIBS="-L${NETCDF_ROOT}/lib"
72 elif [ "x$NETCDF_HOME" != x ]; then
73 INCLUDEDIR="${NETCDF_HOME}/include"
74 INCLUDES="-I${NETCDF_HOME}/include"
75 LIBDIR="${NETCDF_HOME}/lib"
76 LIBS="-L${NETCDF_HOME}/lib"
77 elif [ "x$NETCDF_INC" != x -a "x$NETCDF_LIB" != x ]; then
78 NETCDF_INC=`echo $NETCDF_INC | sed 's/-I//g'`
79 NETCDF_LIB=`echo $NETCDF_LIB | sed 's/-L//g'`
80 INCLUDEDIR="${NETCDF_INC}"
81 INCLUDES="-I${NETCDF_INC}"
82 LIBDIR="${NETCDF_LIB}"
83 LIBS="-L${NETCDF_LIB}"
84 elif [ "x$NETCDF_INCDIR" != x -a "x$NETCDF_LIBDIR" != x ]; then
85 INCLUDEDIR="${NETCDF_INCDIR}"
86 INCLUDES="-I${NETCDF_INCDIR}"
87 LIBDIR="${NETCDF_LIBDIR}"
88 LIBS="-L${NETCDF_LIBDIR}"
89 elif test -d /usr/include/netcdf-3 ; then
90 INCLUDES='-I/usr/include/netcdf-3'
91 LIBS='-L/usr/lib/netcdf-3 -L/usr/lib64/netcdf-3'
92 elif test -d /usr/include/netcdf ; then
93 INCLUDES='-I/usr/include/netcdf'
94 elif test -d /usr/local/netcdf ; then
95 INCLUDES='-I/usr/local/netcdf/include'
96 LIBS='-L/usr/local/netcdf/lib'
97 elif test -d /usr/local/include/netcdf.inc ; then
98 INCLUDES='-I/usr/local/include'
99 LIBS='-L/usr/local/lib64'
100 fi

  ViewVC Help
Powered by ViewVC 1.1.22