#!/bin/sh

declare OS_FOUND=`uname -s`-`uname -m | sed -e 's/i[0-9]/iX/' -e 's/sun4./sun4X/'`

case ${OS_FOUND} in
#    "SunOS-sun4X")
#	export TARGET_ARCH=gccsparcOS5
#	export EXE_SUFFIX=
#	;;
    "Linux-iX86")
	export TARGET_ARCH=linux
	export EXE_SUFFIX=
	;;
#    "FreeBSD-iX86")
#	export TARGET_ARCH=freebsd
#	export EXE_SUFFIX=
#	;;
#    "CYGWIN_NT-5.1-iX86")
#	export TARGET_ARCH=cygwin
#	export EXE_SUFFIX=.exe
#    	;;	
    *) 
     echo "Unknown OS found"
esac

# Export environement
export MORPHEO_LOCALIZATION="labs_network";
export MORPHEO_TOPLEVEL=${PWD};
export MORPHEO_SCRIPT=${MORPHEO_TOPLEVEL}/IPs/systemC/processor/Morpheo/Script;
export MORPHEO_HOME=${HOME}/.Morpheo;
       MORPHEO_XTTY=${MORPHEO_TOPLEVEL}/IPs/systemC/Environment/TTY/xtty;

case ${MORPHEO_LOCALIZATION} in
    "labs_network")
	export MORPHEO_PREFIX=/users/chaos/kane/Morpheo;
	export MORPHEO_TMP=${MORPHEO_PREFIX};
	;;
    "labs_local")
	export MORPHEO_PREFIX=/dsk/l1/misc/Morpheo;
	export MORPHEO_TMP=${MORPHEO_PREFIX};
	;;
    "home")
	export MORPHEO_PREFIX=${HOME}/tmp/Morpheo;
	export MORPHEO_TMP=${MORPHEO_PREFIX};
	;;
    *)
	echo "Bad localization : \"${MORPHEO_LOCALIZATION}\"";
	;;
esac

echo ""
echo "OS found : ${OS_FOUND}"
echo ""
echo "Modification of environement's variable :"
echo " - MORPHEO_LOCALIZATION is set to ${MORPHEO_LOCALIZATION}"
echo " - MORPHEO_TOPLEVEL     is set to ${MORPHEO_TOPLEVEL}"
echo " - MORPHEO_SCRIPT       is set to ${MORPHEO_SCRIPT}"
echo " - MORPHEO_HOME         is set to ${MORPHEO_HOME}"
echo " - MORPHEO_PREFIX       is set to ${MORPHEO_PREFIX}"
echo " - MORPHEO_TMP          is set to ${MORPHEO_TMP}"

#----------
# Path : add xtty and script directory.
#        test if already in path : no multiple addition
#----------

echo ${PATH} |grep -q ${MORPHEO_SCRIPT};
if test $? -eq 1; then
    export  PATH=${PATH}:${MORPHEO_SCRIPT}
    echo " - PATH             add       ${MORPHEO_SCRIPT}"
fi;

echo ${PATH} |grep -q ${MORPHEO_XTTY};

if test $? -eq 1; then
    export  PATH=${PATH}:${MORPHEO_XTTY}
    echo " - PATH             add       ${MORPHEO_XTTY}"
fi;

echo ""
