#! /bin/sh
#
# Globus2 device installation
#

#
# get Globus2 configuration information
#
. ${top_srcdir}/mpid/$DEVICE/mpich-globus2-settings

#
# Copy device specific compiler scripts
#
for compiler in cc cxx f77 f90 ; do
    if test -f ${binbuild_dir}/mpich-globus2-$compiler ; then
        CopyFile ${binbuild_dir}/mpich-globus2-$compiler ${bindir} $XMODE
    fi
done

#
# Copy device specific header files
#
if test $VMPI -ne 0 ; then
    CopyFile ${top_srcdir}/mpid/$DEVICE/mpid_defs.h ${includedir}
fi
if test $F77_SED -ne 0 ; then
    CopyFile ${top_srcdir}/mpid/$DEVICE/mpid_fortdefs.h  ${includedir}
fi

#
# Correct paths in mpich compiler scripts
#
for compiler in cc CC f77 f90 ; do
    if test -f ${bindir}/mpi${compiler} ; then
        mv -f ${bindir}/mpi${compiler} ${bindir}/mpi${compiler}.orig
        sed -e "s!BASE=\" *${binbuild_dir}!BASE=\"${bindir}!" \
	    ${bindir}/mpi${compiler}.orig > ${bindir}/mpi${compiler}
        chmod $XMODE ${bindir}/mpi${compiler}
    fi
done
