echo "RUNNING SETUP_CHANNEL FOR THE NEMESIS CHANNEL"

#
# NOTE: This file is sourced from the setup_device with the current working
# directory set to the top-level build directory.
#

#
# Variables of interest...
#
# $with_device - device name and arguments
# $device_name - name of the device
# $device_args - contains name of channel select plus an channel args
# $channel_name - name of the channel
# $master_top_srcdir - top-level source directory
# $master_top_builddir - top-level build directory
# $ac_configure_args - all arguments passed to configure
#

file=${master_top_srcdir}/src/mpid/${device_name}/channels/${channel_name}/setup_channel.args
if test -f ${file} ; then
    . ${file}
else
    echo "Error: ${file} not found"
    exit 1
fi

pathlist=""
pathlist="$pathlist src/mpid/${device_name}/channels/${channel_name}/include"
for path in $pathlist ; do
    CPPFLAGS="$CPPFLAGS -I${master_top_builddir}/${path}"
    CPPFLAGS="$CPPFLAGS -I${master_top_srcdir}/${path}"
done

#ARCH=`uname -m | sed -es/i.86/i386/`
#CPPFLAGS="$CPPFLAGS -D${ARCH}"

# include prototype
prototype_dir=${master_top_srcdir}/src/mpid/${device_name}/channels/${channel_name}/nemesis
CPPFLAGS="$CPPFLAGS -I${prototype_dir}/include -I${prototype_dir}/utils/monitor"

# Only include papi in CPPFLAGS configure will handle libs, and checking that it exists, etc.
# We do this here because we want to make sure that this is added to CPPFLAGS in configures above this one.
# By the time configure for nemesis is run, the ch3 configure has already AC_SUBSTed CPPFLAGS.
# This is run from the top of ch3's configure.
if test -n "${papi_dir}" ; then
    CPPFLAGS="$CPPFLAGS -I${papi_dir}/include"
#    CPPFLAGS="$CPPFLAGS -I${perfctr_dir}/include -I${papi_dir}/include"
#    LIBS="$LIBS ${papi_dir}/lib/libpapi.a ${papi_dir}/lib/libperfctr.a"
fi

if [ "${enable_fast}x" == "yesx" ] ; then
    CFLAGS="$CFLAGS -O3"
fi


export nemesis_network
