#!/bin/bash
#
#  $Header: /u/gcmpack/MITgcm/tools/build_options/linux_ia32_g77,v 1.25 2009/01/02 20:40:42 jmc Exp $
#  $Name:  $
#


FC=g77
CC=gcc
DEFINES='-D_BYTESWAPIO -DWORDLENGTH=4'
# CPP='gcc -E -traditional -P -'
CPP='cpp  -traditional -P'
NOOPTFLAGS='-O0'
EXTENDED_SRC_FLAG='-ffixed-line-length-132'

if test "x$IEEE" = x ; then
    #  No need for IEEE-754
    FFLAGS='-Wimplicit -Wunused -Wuninitialized'
    FOPTIM='-O3 -malign-double -funroll-loops'
else
    #  Try to follow IEEE-754
    has_sse2=f
    grep flags /proc/cpuinfo | grep sse2 > /dev/null 2>&1  &&  has_sse2=t

    if test "x$has_sse2" = xt ; then
	FFLAGS='-Wimplicit -Wunused -mfpmath=sse -msse -msse2'
    else
	FFLAGS='-Wimplicit -Wunused -ffloat-store'
    fi
    #  echo 'FFLAGS="'$FFLAGS'"'
    FOPTIM='-O0 -malign-double'
fi

if test -d /usr/include/netcdf-3 ; then
    INCLUDES='-I/usr/include/netcdf-3'
    if 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
    INCLUDES='-I/usr/include/netcdf'
elif test -d /usr/local/netcdf ; then
    INCLUDES='-I/usr/local/netcdf/include'
    LIBS='-L/usr/local/netcdf/lib'
fi
GSLINC=''
GSLLIB='-lgsl -lgslcblas'
PAPIINC='-I/usr/local/pkg/papi/papi-3.0.8.1/p4/include'
PAPILIB='-L/usr/local/pkg/papi/papi-3.0.8.1/p4/lib -lpapi'

