Skip to content

m4macros: Allow information from pkg-config to be overridden

Simon McVittie requested to merge smcv/glib:m4macros into master

By using PKG_CHECK_VAR, we declare $GLIB_COMPILE_SCHEMAS, $GLIB_GENMARSHAL, $GOBJECT_QUERY, $GLIB_MKENUMS and $GLIB_COMPILE_RESOURCES as Autoconf "precious variables" with AC_ARG_VAR, similar to $PKG_CONFIG and $CC, so that they can be put on a configure command line:

./configure GLIB_COMPILE_RESOURCES=my-glib-compile-resources

If they are set to a non-empty value, PKG_CHECK_VAR will use that instead of auto-detecting from pkg-config, so that builders can override them, for example when cross-compiling.

Similarly, use the standard PKG_CHECK_MODULES macro to get GLib's CFLAGS and LIBS.

It's possible that most of the rest of each macro can also disappear, but for the moment I've given them the benefit of the doubt.

This does result in printing "checking for GLIB" twice (once for PKG_CHECK_MODULES and once for GLib's custom checks), but if you're using Autotools, you probably don't have a strong objection to overly verbose output.

Related to discussion on #1521 (closed).

Merge request reports