#!/bin/bash
#
#
#== Warning ==> comments below have been copied from optfile linux_amd64_open64
#               and do not strickly apply to this file <==
# Build options for Fedore Core 4 x86-64 Opteron
# tested on (Linux batsi.mit.edu 2.6.14-1.1656_FC4smp #1 SMP Thu Jan 5 22:26:33 EST 2006 x86_64 x86_64 x86_64 GNU/Linux) system 20071121
#
# Multithreaded tests require
#       export OMP_SLAVE_STACK_SIZE=400m
#       export OMP_NUM_THREADS=2

CC=opencc
FC=openf90
F90C=openf90
LINK=openf90

DEFINES='-DWORDLENGTH=4'
CPP='cpp -traditional -P'
#MAKEDEPEND=/usr/X11R6/bin/makedepend
EXTENDED_SRC_FLAG='-extend-source'
F90FIXEDFORMAT='-fixedform -x f95'
GET_FC_VERSION="--version"
OMPFLAG='-openmp'
#OMPFLAG='-openmp -OPT:early_mp=ON'

NOOPTFLAGS='-O0 -g'
NOOPTFILES=''

FFLAGS="$FFLAGS -convert big_endian"

if test "x$DEVEL" != x ; then
    FFLAGS="$FFLAGS -ffortran-bounds-check -trapuv -g"
fi

if test "x$IEEE" = x ; then     #- with optimisation:
    FOPTIM='-O3 -LNO:fusion=2 -OPT:roundoff=1:IEEE_arithmetic=3' # -funsafe-math-optimizations'
else                            #- no optimisation + IEEE :
    FOPTIM='-O0 -OPT:roundoff=0:IEEE_arithmetic=1 -fmath-errno -fno-fast-math'
fi

F90FLAGS=$FFLAGS
F90OPTIM=$FOPTIM
CFLAGS='-O0'
GSLLIB='-lgsl -lgslcblas'

if [ "x$NETCDF_ROOT" != x ] ; then
    INCLUDEDIR="${NETCDF_ROOT}/include"
    INCLUDES="-I${NETCDF_ROOT}/include"
    LIBDIR="${NETCDF_ROOT}/lib"
    LIBS="-L${NETCDF_ROOT}/lib"
elif [ "x$NETCDF_HOME" != x ]; then
    INCLUDEDIR="${NETCDF_HOME}/include"
    INCLUDES="-I${NETCDF_HOME}/include"
    LIBDIR="${NETCDF_HOME}/lib"
    LIBS="-L${NETCDF_HOME}/lib"
elif [ "x$NETCDF_INC" != x -a "x$NETCDF_LIB" != x ]; then
    NETCDF_INC=`echo $NETCDF_INC | sed 's/-I//g'`
    NETCDF_LIB=`echo $NETCDF_LIB | sed 's/-L//g'`
    INCLUDEDIR="${NETCDF_INC}"
    INCLUDES="-I${NETCDF_INC}"
    LIBDIR="${NETCDF_LIB}"
    LIBS="-L${NETCDF_LIB}"
elif [ "x$NETCDF_INCDIR" != x -a "x$NETCDF_LIBDIR" != x ]; then
    INCLUDEDIR="${NETCDF_INCDIR}"
    INCLUDES="-I${NETCDF_INCDIR}"
    LIBDIR="${NETCDF_LIBDIR}"
    LIBS="-L${NETCDF_LIBDIR}"
elif test -d /usr/include/netcdf-3 ; then
    INCLUDES='-I/usr/include/netcdf-3'
    LIBS='-L/usr/lib/netcdf-3 -lnetcdf_g77'
elif test -d /usr/include/netcdf ; then
    INCLUDES='-I/usr/include/netcdf'
elif test -d /usr/local/netcdf ; then
    INCLUDES='-I/usr/local/netcdf/include'
    LIBS='-L/usr/local/netcdf/lib'
elif test -d /usr/local/include/netcdf.inc ; then
    INCLUDES='-I/usr/local/include'
    LIBS='-L/usr/local/lib'
fi

