Improve tests in configure and chklref

We rename configure.in to configure.ac and rewrite some to improve the
detections of several paths. We rewrite the option processing part in
chklref without using getopt.
Move the documentation from src/ to doc/

While moving the documentation, we also update the different Makefiles.