#!/bin/sh
# This script is here to copy the correct makefile for the platform
# It is not very clever...
if [ $# -eq 1 ]
then
	if [ "$1" = "--help" ] || [ "$1" = "-h" ]
	then
		echo "Usage: ./configure [platform]" >&2
		echo ""
		echo "Platforms:"
		echo "linux"
		echo "sun|sunos"
		echo "osf|osf1|tru64"
		echo "hpux|hp-ux"
		echo "irix|irix64"
		exit 0
	fi
	my_plat="$1"
else 
	 my_plat=`uname -s`
fi
if echo ":$my_plat:" |egrep -i ":linux:" >/dev/null
then
	cp Makefile.linux Makefile
	echo "configured for $my_plat"
	echo "type make to build"
elif  echo ":$my_plat:" |egrep -i ":sunos:|:sun:" >/dev/null
then
	cp Makefile.sun Makefile
	echo "configured for $my_plat"
	echo "type make to build"
elif  echo ":$my_plat:" |egrep -i ":hpux:|:hp-ux:" >/dev/null
then
	if `swlist | egrep -qi hpuxbase64`
	then
		cp Makefile.hp-ux64 Makefile
	else
		cp Makefile.hp-ux32 Makefile
	fi
	echo "configured for $my_plat"
	echo "type make to build"
elif  echo ":$my_plat:" |egrep -i ":osf:|:osf1:|:tru64" >/dev/null
then
	cp Makefile.osf Makefile
	echo "configured for $my_plat"
	echo "type make to build"
elif  echo ":$my_plat:" |egrep -i ":irix:" >/dev/null
then
	cp Makefile.irix Makefile
	echo "configured for $my_plat"
elif  echo ":$my_plat:" |egrep -i ":irix64:" >/dev/null
then
        cp Makefile.irix64 Makefile
        echo "configured for $my_plat"
else
	cp Makefile.unknown Makefile
	cat make.common >>Makefile
	echo "Unknown platform $my_plat"
	echo "Edit Makefile to suit your needs"
fi
