Configure dependencies better.

In order to avoid installing things over and over again when running
'make install'. Although I have the feeling that the dependencies are
still not quite right.