dnsmasq is a very small (one .c file) caching and forwarding DNS server. It can automatically configure itself from your upstream connection (static/DHCP/PPP).
The sources can be found at http://www.thekelleys.org.uk/dnsmasq/dnsmasq-0.992.tar.gz
To compile it :
[cedric@tron src]$ tar xvzf dnsmasq-0.992.tar.gz [cedric@tron src]$ cd dnsmasq-0.992 [cedric@tron dnsmasq-0.992]$ gcc -o dnsmasq dnsmasq.c