Added configure check for the soname of libraries that we load dynamically. Added a few other configure macros, and moved all macros into aclocal.m4.