[libvirt] [PATCH v2] autogen.sh: Improve and generalize