Clean up autoconfig stuff a bit, add headers.
Build fix.