set arch = `uname -m`

if ( ! -e /usr/bin/gcc-config ) then
    exit
endif

# begin compiler selection
echo "* checking for gcc version $1"
if ( ! -e /etc/env.d/gcc/${arch}-pc-linux-gnu-$1 ) then 
    echo "* gcc version $1 not found!"
	exit `geterrno ENOPKG`
endif
echo "* setting gcc version to $1"
if(!($?LD_LIBRARY_PATH)) then
    setenv LD_LIBRARY_PATH `gcc-config -L ${arch}-pc-linux-gnu-$1`
else
    setenv LD_LIBRARY_PATH `gcc-config -L ${arch}-pc-linux-gnu-$1`:$LD_LIBRARY_PATH
endif 
setenv PATH `gcc-config -B ${arch}-pc-linux-gnu-$1`:$PATH
setenv FC g77
# end compiler selection
