Improve GNU Build System scripts and packaging

Hi Radu,

I'm sending this pull request because I wanted to fix two things:

  * `make distcheck` is broken (because of touches in `dist-hook`)
  * Out-of-tree builds are broken (because imports of headers in subdirs won't work in an out-of-tree build unless CPP flags are set appropriately.

I fixed it and took advantage of this task to do some additional improvements:

  * Use Autoconf output files to fill variables in man pages instead of manually processing the files in `dist-hook`.
  * Fixed missing quotes on `AC_LANG_PROGRAM` (only detected by newer Autoconf versions).
  * Fixed a permission problem in dist-hook for out-of-tree builds.
  * Rewrote `autogen.sh` so that it just invoked `autoreconf` instead of manually invoking tools (which could break with newer GNU Build System versions).  Furthermore, the existing `autogen.sh` did not take into account environment variable such as `LIBTOOLIZE` which are used to decouple the script from the name of a binary, since it could have some prefix in certain distributions.  Just using `autoreconf` is simpler.
  * Removed a `docdir` redefinition which I think it's obscure (and triggered a warning).

Cheers!
-- Enrico