#!/bin/bash
#
#  $Header: /u/gcmpack/MITgcm/tools/build_options/linux_amd64_g77,v 1.4 2009/07/21 19:55:13 jmc Exp $
#  $Name:  $
#
# Build options for Suse 9 Opteron
# tested on Linux 2.4.21-102-smp (x86_64), 
#           Linux 2.6.26.8-57.fc8 (x86_64), Linux 2.6.27.9-159.fc10.x86_64
#

FC=g77
DEFINES='-D_BYTESWAPIO -DWORDLENGTH=4'
CPP='cpp  -traditional -P'
NOOPTFLAGS='-O0'
EXTENDED_SRC_FLAG='-ffixed-line-length-132'
#MAKEDEPEND=/usr/X11R6/bin/gccmakedep
#MAKEDEPEND=/usr/X11R6/bin/makedepend
#  For IEEE, use the "-ffloat-store" option
if test "x$IEEE" = x ; then
    FFLAGS='-Wimplicit -Wunused -Wuninitialized'
    FOPTIM='-O3 -funroll-loops'
else
    FFLAGS='-Wimplicit -Wunused -ffloat-store'
#   FFLAGS="$FFLAGS -g -mfpmath=sse -msse -msse2 -fbounds-check"
    FOPTIM='-O0'
fi

if test -d /usr/include/netcdf-3 ; then
#-- some FedoraCore standard location used to be "netcdf-3"
    INCLUDES='-I/usr/include/netcdf-3'
    if test -d /usr/lib64/netcdf-3 ; then
        if test -f /usr/lib64/netcdf-3/libnetcdf_g77.a ; then
            LIBS='-L/usr/lib64/netcdf-3 -lnetcdf_g77'
        else
            LIBS='-L/usr/lib64/netcdf-3'
        fi
    elif test -d /usr/lib/netcdf-3 ; then
        if test -f /usr/lib/netcdf-3/libnetcdf_g77.a ; then
            LIBS='-L/usr/lib/netcdf-3 -lnetcdf_g77'
        else
            LIBS='-L/usr/lib/netcdf-3'
        fi
    fi
elif test -d /usr/include/netcdf ; then
#-- allows a "compat"(gcc 3.4) 2nd version of libs for g77 , next to the
#   standard one (for gfortran, gcc 4.x). But uses same include files.
    INCLUDES='-I/usr/include/netcdf'
    if test -d /usr/lib64/netcdf34 ; then
        if test -f /usr/lib64/netcdf34/libnetcdf_g77.a ; then
            LIBS='-L/usr/lib64/netcdf34 -lnetcdf_g77'
        else
            LIBS='-L/usr/lib64/netcdf34'
        fi
    elif test -d /usr/lib/netcdf34 ; then
        if test -f /usr/lib/netcdf34/libnetcdf_g77.a ; then
            LIBS='-L/usr/lib/netcdf34 -lnetcdf_g77'
        else
            LIBS='-L/usr/lib/netcdf34'
        fi
    fi
elif test -d /usr/local/netcdf ; then
    INCLUDES='-I/usr/local/netcdf/include'
    LIBS='-L/usr/local/netcdf/lib'
fi

