build: Directly encode maximum GLib version

If we use the GLIB_VERSION_2_38 macro, compilation will fail with older
versions of GLib which do not have that macro defined. Use the
underlying G_ENCODE_VERSION() macro instead.