Autofoo fixes

A bunch of autoconf, automake, fixes. Primarily fixing the following use cases:

 * Build out of tree
 * make distcheck