build: fix version number if we don't have git

Please read the commit message for more info.

BTW I see that now you are using the package version also for the library version.  Maybe you want to reconsider this according to the libtool manual 
http://www.gnu.org/software/libtool/manual/libtool.html#Versioning
Specially point 7.3:
"Never try to set the interface numbers so that they correspond to the release number of your package. This is an abuse that only fosters misunderstanding of the purpose of library versions."