usual bunch of autotools fixes

Hope you don't mind. :)

I'm also adding a pkgconfig file.