#! /bin/sh

./configure --prefix=`pwd`/..
make
make install

if [ -f ../bin/nomad ]
then
        echo "Scalar executable successfully created in ../bin"
fi

if [ -f ../bin/nomad.MPI ]
then
        echo "MPI executable successfully created in ../bin"
fi

if [ -f ../lib/libnomad.a ]
then
	mv ../lib/libnomad.a ../lib/nomad.a
	echo "Scalar library successfully created in ../lib"
fi

if [ -f ../lib/libnomad.MPI.a ]
then
        mv ../lib/libnomad.MPI.a ../lib/nomad.MPI.a
        echo "MPI library successfully created in ../lib"
fi

if [ ! -f ../bin/nomad.MPI ]
then
	echo -n "The MPI installation failed: "
 	if [ -z `which mpic++` ]
	then
		echo "mpic++ is not installed"
	else
		echo "unknown error"
	fi
fi
