There's an easy way to install gcc 3.4 and g77:
add to /etc/sources.list the ubuntu 8.04 hardy repositories:
deb http://hu.archive.ubuntu.com/ubuntu/ hardy universe
deb-src http://hu.archive.ubuntu.com/ubuntu/ hardy universe
deb http://hu.archive.ubuntu.com/ubuntu/ hardy-updates universe
deb-src http://hu.archive.ubuntu.com/ubuntu/ hardy-updates universe
then in the terminal:
sudo aptitude update
sudo aptitude isntall g77
remove or comment the ubuntu 8.04 repositories in sources.list
that's it