Make configure checks able to build with -Werror

Also fix a few compiler warnings, this combined with pull #82 allows me to build
with CFLAGS="-Werror -Wall".