Modernize and simplify autotools setup.
Assume config.h exists.
Use asprintf to construct error message.
Use pure and const function attributes where possible.