#!/bin/sh
#
# $Id: configure 351 2009-07-10 13:22:45Z tamentis $
#
# Configure script for 'rezerwar'
# Copyright (c) Bertrand Janin (tamentis@neopulsar.org)
#
#


OS=$(uname)
if [ -n "$*" ]; then
	OS="$*"
fi


# setup_for routine
# $1 - Makefile
# $2 - MkConf
# $3 - config.h
setup_for() {
	rm -f Makefile MkConf config.h
	cp -f mkfiles/Makefile.$1 Makefile
	cp -f mkfiles/MkConf.$2 MkConf
	cp -f mkfiles/config_h_$3 config.h
}


#
# Operating system picker
#
case $OS in
Linux|Unix|POSIX)
	setup_for unix unix unix
	;;
Debug)
	setup_for unix debug debug
	;;
Win32|MINGW32*)
	setup_for win32 win32 win32
	;;
Wii)
	if [ -z "$DEVKITPRO" ]; then
		echo "DevKitPro doesn't seem to be installed (missing DEVKITPRO environment"
		echo "variable). Please install DevKitPro and re-run ./configure"
		exit
	fi
	setup_for wii unix wii
	;;
*)
	echo
	echo "Sorry but '$OS' is currently unsupported, if your OS is POSIX compliant you"
	echo "can give 'POSIX' a chance as first parameter to ./configure. Here is the list"
	echo "of supported platforms:"
	echo
	echo "  - Linux		Requires SDL"
	echo "  - Wii		Cross-compiled, requires DevKitPro"
	echo 
	echo "Feel free to update ./configure and send it my way!"
	echo
	exit
esac



echo "'Makefile' generated for '$OS', run 'make' to compile."

