#!/bin/sh

set -e 

if [ "$1" = "configure" ]; then

    update-alternatives \
	--install /usr/include/@DEB_HOST_MULTIARCH@/mpi		mpi-@DEB_HOST_MULTIARCH@		/usr/include/lam	30 \
	--slave /usr/lib/@DEB_HOST_MULTIARCH@/libmpi.so		libmpi.so-@DEB_HOST_MULTIARCH@		/usr/lib/@DEB_HOST_MULTIARCH@/liblam.so \
	--slave /usr/lib/@DEB_HOST_MULTIARCH@/libmpio.so	libmpio.so-@DEB_HOST_MULTIARCH@		/usr/lib/@DEB_HOST_MULTIARCH@/liblamio.so \
	--slave /usr/lib/@DEB_HOST_MULTIARCH@/libmpi++.so	libmpi++.so-@DEB_HOST_MULTIARCH@	/usr/lib/@DEB_HOST_MULTIARCH@/liblam++.so \
	--slave /usr/lib/@DEB_HOST_MULTIARCH@/libmpi.a		libmpi.a-@DEB_HOST_MULTIARCH@		/usr/lib/@DEB_HOST_MULTIARCH@/liblam.a \
	--slave /usr/lib/@DEB_HOST_MULTIARCH@/libmpio.a		libmpio.a-@DEB_HOST_MULTIARCH@		/usr/lib/@DEB_HOST_MULTIARCH@/liblamio.a \
	--slave /usr/lib/@DEB_HOST_MULTIARCH@/libmpi++.a	libmpi++.a-@DEB_HOST_MULTIARCH@		/usr/lib/@DEB_HOST_MULTIARCH@/liblam++.a
    
    update-alternatives \
	--install /usr/bin/mpicc mpi /usr/bin/mpicc.lam 30 \
	--slave /usr/share/man/man1/mpicc.1.gz mpicc.1.gz /usr/share/man/man1/mpicc.lam.1.gz \
	--slave /usr/bin/mpif77 mpif77 /usr/bin/mpif77.lam \
	--slave /usr/share/man/man1/mpif77.1.gz mpif77.1.gz /usr/share/man/man1/mpif77.lam.1.gz \
	--slave /usr/bin/mpiCC mpiCC /usr/bin/mpic++.lam \
	--slave /usr/share/man/man1/mpiCC.1.gz mpiCC.1.gz /usr/share/man/man1/mpiCC.lam.1.gz \
	--slave /usr/bin/mpic++ mpic++ /usr/bin/mpic++.lam \
	--slave /usr/share/man/man1/mpic++.1.gz mpic++.1.gz /usr/share/man/man1/mpic++.lam.1.gz
    
    update-alternatives \
	--install /usr/share/man/man3/MPI_Comm_set_name.3.gz MPI_Comm_set_name.3.gz /usr/share/man/man3/MPI_Comm_set_name_lam4-dev.3.gz 10
    
fi

#DEBHELPER#
