Clean up build scripts

Remove some unneeded params. Add configure checks from the scanner. Add
glib >= 2.38 requirement. Fix formatting and add comments.

Fixes some warnings and generally makes things nicer to read.