#!/bin/bash
w="Warning:"

compiler="";
options="-Wall";

if ! [ -f "/proc/net/dev" ]
then echo "$w You don't have \"/proc/net/dev\" file. This program need it! "
fi

if [ -n "`type g++ 2>/dev/null`" ]
then 	echo "You have g++. Good ... to see you !"
	compiler=g++;
else 	echo "$w You don't have g++ in your \$PATH."
	if [ -n "`type gcc 2>/dev/null`" ]
	then echo "... But you have gcc. Good too !"
	compiler=gcc;
	else	echo "$w You don't have gcc in your \$PATH."
		if [ -n "`type cc 2>/dev/null`" ]
	 	then 	echo "...But you have cc. Goot too !"
			compiler=cc;
		else	echo "$w You don't have gcc in your \$PATH."
		fi
	fi		
fi

if [ -z "$compiler" ]
then 	echo "$w I don't see the compiler. Let's pray !"
	echo "You can try to use the binary file from \"bin\""	
fi

echo "CC=$compiler" > Makefile
echo "OPTIONS=$options" >> Makefile
cat Makefile.txt >> Makefile


