Warning, /tools/build_options/linux_ia32_gfortran is written in an unsupported language. File is not indexed.
view on githubraw file Latest commit add29e06 on 2018-01-31 20:35:05 UTC
5091a7a172 Ed H*0001 #!/bin/bash
0002 #
0003 #
0004
a0a6149eed Jean*0005 # Tested with gcc-gfortran v4.1.1 on FC5, FC6, FC8, using flags
0006 # formally for gcc-gfortran 4.3*
0007 # + with gcc-gfortran v4.3.0 on FC9
5091a7a172 Ed H*0008
c9d6de1de1 Jean*0009 #-------
0010 # run with OpenMP: needs to set environment var. OMP_NUM_THREADS
0011 # and generally, needs to increase the thread stack-size:
0012 # - sh,bash:
0013 # > export OMP_NUM_THREADS=2
0014 # > export GOMP_STACKSIZE=400m
0015 # - csh,tcsh:
0016 # > setenv OMP_NUM_THREADS 2
0017 # > setenv GOMP_STACKSIZE 400m
0018 #-------
5091a7a172 Ed H*0019
2092f3b71c Jean*0020 if test "x$MPI" = xtrue ; then
0021 CC=${CC:=mpicc -m32}
0022 FC=${FC:=mpif77 -m32}
0023 F90C=${F90C:=mpif90 -m32}
0024 else
0025 CC=gcc
0026 FC=gfortran
0027 F90C=gfortran
0028 fi
0029
a0a6149eed Jean*0030 DEFINES='-DWORDLENGTH=4 -DNML_TERMINATOR'
0031 CPP='cpp -traditional -P'
881ea683bc Jean*0032 EXTENDED_SRC_FLAG='-ffixed-line-length-132'
a5566b88fb Jean*0033 GET_FC_VERSION="--version"
c9d6de1de1 Jean*0034 OMPFLAG='-fopenmp'
5091a7a172 Ed H*0035
2092f3b71c Jean*0036 NOOPTFLAGS='-O0'
0037 NOOPTFILES=''
a0a6149eed Jean*0038
eff2dad815 Jean*0039 has_sse2=f
0040 grep flags /proc/cpuinfo | grep sse2 > /dev/null 2>&1 && has_sse2=t
0041
a0a6149eed Jean*0042 # Requires gfortran from 2006 onwards for -fconvert=big-endian
0043 FFLAGS="$FFLAGS -fconvert=big-endian -fimplicit-none"
0044 #- otherwise, switch to the home-made byte-swap:
0045 #DEFINES="-D_BYTESWAPIO $DEFINES"
0046
2092f3b71c Jean*0047 if test "x$IEEE" = x ; then #- with optimisation:
a0a6149eed Jean*0048 FOPTIM='-O3 -funroll-loops'
eff2dad815 Jean*0049 #if test "x$has_sse2" = xt ; then
0050 # FOPTIM="$FOPTIM -ftree-vectorize -msse -msse2" # <-- from optfile gfortran4.4
0051 #fi
5091a7a172 Ed H*0052 else
2092f3b71c Jean*0053 if test "x$DEVEL" = x ; then #- no optimisation + IEEE :
5091a7a172 Ed H*0054 if test "x$has_sse2" = xt ; then
a0a6149eed Jean*0055 FOPTIM='-O0 -mfpmath=sse -msse -msse2'
5091a7a172 Ed H*0056 else
a0a6149eed Jean*0057 FOPTIM='-O0 -ffloat-store'
5091a7a172 Ed H*0058 fi
2092f3b71c Jean*0059 else #- development/check options:
0060 FOPTIM='-O0 -ffloat-store'
0061 FOPTIM="$FOPTIM -g -ffpe-trap=invalid,zero,overflow -fbounds-check"
0062 fi
5091a7a172 Ed H*0063 fi
a0a6149eed Jean*0064 # version 4.3.0 has problems with option "-malign-double" ;
0065 # may want to put it back with older/newer version (when it works)
0066 #FOPTIM="$FOPTIM -malign-double"
0067 F90FLAGS=$FFLAGS
0068 F90OPTIM=$FOPTIM
2092f3b71c Jean*0069 CFLAGS='-O0'
0070
0071 INCLUDEDIRS=''
0072 INCLUDES=''
0073 LIBS=''
5091a7a172 Ed H*0074
a0a6149eed Jean*0075 if [ "x$NETCDF_ROOT" != x ] ; then
0076 INCLUDEDIR="${NETCDF_ROOT}/include"
0077 INCLUDES="-I${NETCDF_ROOT}/include"
0078 LIBDIR="${NETCDF_ROOT}/lib"
0079 LIBS="-L${NETCDF_ROOT}/lib"
0080 elif [ "x$NETCDF_HOME" != x ]; then
0081 INCLUDEDIR="${NETCDF_HOME}/include"
0082 INCLUDES="-I${NETCDF_HOME}/include"
0083 LIBDIR="${NETCDF_HOME}/lib"
0084 LIBS="-L${NETCDF_HOME}/lib"
0085 elif [ "x$NETCDF_INC" != x -a "x$NETCDF_LIB" != x ]; then
0086 NETCDF_INC=`echo $NETCDF_INC | sed 's/-I//g'`
0087 NETCDF_LIB=`echo $NETCDF_LIB | sed 's/-L//g'`
0088 INCLUDEDIR="${NETCDF_INC}"
0089 INCLUDES="-I${NETCDF_INC}"
0090 LIBDIR="${NETCDF_LIB}"
0091 LIBS="-L${NETCDF_LIB}"
0092 elif [ "x$NETCDF_INCDIR" != x -a "x$NETCDF_LIBDIR" != x ]; then
0093 INCLUDEDIR="${NETCDF_INCDIR}"
0094 INCLUDES="-I${NETCDF_INCDIR}"
0095 LIBDIR="${NETCDF_LIBDIR}"
0096 LIBS="-L${NETCDF_LIBDIR}"
0097 elif test -d /usr/include/netcdf-3 ; then
5091a7a172 Ed H*0098 INCLUDES='-I/usr/include/netcdf-3'
29fa75326d Jean*0099 LIBS='-L/usr/lib/netcdf-3'
5091a7a172 Ed H*0100 elif test -d /usr/include/netcdf ; then
0101 INCLUDES='-I/usr/include/netcdf'
0102 elif test -d /usr/local/netcdf ; then
0103 INCLUDES='-I/usr/local/netcdf/include'
0104 LIBS='-L/usr/local/netcdf/lib'
a0a6149eed Jean*0105 elif test -d /usr/local/include/netcdf.inc ; then
0106 INCLUDES='-I/usr/local/include'
29fa75326d Jean*0107 LIBS='-L/usr/local/lib'
5091a7a172 Ed H*0108 fi
2092f3b71c Jean*0109
0110 if [ -n "$MPI_INC_DIR" -a "x$MPI" = xtrue ] ; then
0111 INCLUDES="$INCLUDES -I$MPI_INC_DIR"
0112 INCLUDEDIRS="$INCLUDEDIRS $MPI_INC_DIR"
15978f0412 Jean*0113 #- used for parallel (MPI) DIVA
2092f3b71c Jean*0114 MPIINCLUDEDIR="$MPI_INC_DIR"
15978f0412 Jean*0115 #MPI_HEADER_FILES='mpif.h mpiof.h'
2092f3b71c Jean*0116 fi