build: simplify check for glib2
Instead of hand-crafting a pkg-config check, just use the PKG_CHECK_MODULES autoconf macro.