Conversion to cmake build system, contributed by Stephen Just. Simplify version labelling. Simplify build system by not generating headers. Adjust types and add casts to avoid compiler warnings. Remove unused and undocumented REG_DUMP flag. Make regerror more robust.