Some autoconf cleanups

The patch allows to use autoreconf, replaces some long obsolete
constructs and does some other minor cleanups. Also, the file
configure.in is renamed to configure.ac, as the old name has been
deprecated for a long time.
Thanks to Ruben Kerkhof for the patchset.