echo "RUNNING SETUP_CHANNEL FOR THE SOCK 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
#

found_dir="no"
for sys in $devsubsystems ; do
    if test "$sys" = "src/mpid/common/sock" ; then
       found_dir="yes"
       break
    fi
done
if test "$found_dir" = "no" ; then
   devsubsystems="$devsubsystems src/mpid/common/sock"
fi

# FIXME: The setup file has a weird requirement that it needs to be
# run *before* the MPICH2 device (not the setup directory itself) is
# configured, but the actual configuration of the associated directory
# needs to be done *after* the device is configured.
file=${master_top_srcdir}/src/mpid/common/sock/setup
if test -f $file ; then
   echo sourcing $file
   . $file
fi

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