Various build/distcheck fixes.