Revert "Do not dlopen libpython" + various fixes and cleanups

The big change is the revert of d63756bd11b097f11f115d5477110893b7ee16a2 which is causing issues like issue https://github.com/mate-desktop/python-caja/issues/5. A slightly smaller change it to make gtk-docs building work.

.The rest are small fixes for autofoo, make dist and distcheck.