Fix the autotools build system

For some reason, I had lots of issues building hexchat under modern autotools.

Attached patches fix it for me.