Changed to autotools, and made several code changes.