Autotools: read git commit hash at compile time

Also do as cmake to avoid full recompilation when the hash changes.
Fix bug in 81badf: char_type and double do not have the same size