echo "RUNNING SETUP_DEVICE FOR THE CH3 DEVICE"

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

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

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

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

dir=${master_top_srcdir}/src/mpid/${device_name}/channels/${channel_name}
if test ! -d $dir ; then
    echo "ERROR: ${dir} does not exist"
    exit 1
fi
file=${dir}/setup_channel
if test -f $file ; then
    echo sourcing $file
    . $file
fi
