Automate autotools setup and cleaning.

This probably could be cleaned up a little.