Improve configure.ac and fix dependencies files generation