#!/bin/bash
#
#
#== Warning ==> comments below have been copied from optfile linux_amd64_pathf90
#               and do not strickly apply to this file <==
# Build options for Fedore Core 3 x86-64 Opteron
# tested on (Linux batsi 2.6.10-1.766_FC3smp #1 SMP Wed Feb 9 23:17:48 EST 2005 x86_64 x86_64 x86_64 GNU/Linux) system 20051802
#
# Multithreaded tests require
#     export PSC_OMP_STACK_SIZE=400m
#     export OMP_NUM_THREADS=2

CC=pathcc
FC=pathf90
LINK=pathf90

DEFINES='-DWORDLENGTH=4'
CPP='cpp -traditional -P'
#MAKEDEPEND=/usr/X11R6/bin/makedepend
OMPFLAG='-openmp'
#OMPFLAG='-openmp -OPT:early_mp=ON'

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

FFLAGS="$FFLAGS -m32 -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='-Ofast -LNO:fusion=2 -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 -m32'

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 -L/usr/lib64/netcdf-3'
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/lib64'
fi

