Merge branch 'm4macros' into 'master'

m4macros: Allow information from pkg-config to be overridden

See merge request GNOME/glib!375
This commit is contained in:
Philip Withnall 2018-10-08 22:43:46 +00:00
commit 3b10fc035d
2 changed files with 25 additions and 22 deletions

View File

@ -2,7 +2,7 @@
# Owen Taylor 1997-2001
# Increment this whenever this file is changed.
#serial 1
#serial 2
dnl AM_PATH_GLIB_2_0([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]])
dnl Test for GLIB, and define GLIB_CFLAGS and GLIB_LIBS, if gmodule, gobject,
@ -12,10 +12,16 @@ AC_DEFUN([AM_PATH_GLIB_2_0],
[dnl
dnl Get the cflags and libraries from pkg-config
dnl
dnl We can't use PKG_PREREQ because that needs 0.29.
m4_ifndef([PKG_PROG_PKG_CONFIG],
[pkg.m4 version 0.28 or later is required])
AC_ARG_ENABLE(glibtest, [ --disable-glibtest do not try to compile and run a test GLIB program],
, enable_glibtest=yes)
pkg_config_args=glib-2.0
min_glib_version=ifelse([$1], [], [2.0.0], [$1])
pkg_config_args="glib-2.0 >= $min_glib_version"
for module in . $4
do
case "$module" in
@ -46,7 +52,15 @@ AC_ARG_ENABLE(glibtest, [ --disable-glibtest do not try to compile and run
PKG_CONFIG=no
fi
min_glib_version=ifelse([$1], ,2.0.0,$1)
dnl For GLIB_CFLAGS and GLIB_LIBS
PKG_CHECK_MODULES([GLIB], [$pkg_config_args >= $min_glib_version], [:], [:])
dnl For the tools
PKG_CHECK_VAR([GLIB_GENMARSHAL], [glib-2.0], [glib_genmarshal])
PKG_CHECK_VAR([GOBJECT_QUERY], [glib-2.0], [gobject_query])
PKG_CHECK_VAR([GLIB_MKENUMS], [glib-2.0], [glib_mkenums])
PKG_CHECK_VAR([GLIB_COMPILE_RESOURCES], [gio-2.0], [glib_compile_resources])
AC_MSG_CHECKING(for GLIB - version >= $min_glib_version)
if test x$PKG_CONFIG != xno ; then
@ -64,13 +78,6 @@ AC_ARG_ENABLE(glibtest, [ --disable-glibtest do not try to compile and run
fi
if test x"$no_glib" = x ; then
GLIB_GENMARSHAL=`$PKG_CONFIG --variable=glib_genmarshal glib-2.0`
GOBJECT_QUERY=`$PKG_CONFIG --variable=gobject_query glib-2.0`
GLIB_MKENUMS=`$PKG_CONFIG --variable=glib_mkenums glib-2.0`
GLIB_COMPILE_RESOURCES=`$PKG_CONFIG --variable=glib_compile_resources gio-2.0`
GLIB_CFLAGS=`$PKG_CONFIG --cflags $pkg_config_args`
GLIB_LIBS=`$PKG_CONFIG --libs $pkg_config_args`
glib_config_major_version=`$PKG_CONFIG --modversion glib-2.0 | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
glib_config_minor_version=`$PKG_CONFIG --modversion glib-2.0 | \
@ -204,11 +211,5 @@ main (void)
GLIB_COMPILE_RESOURCES=""
ifelse([$3], , :, [$3])
fi
AC_SUBST(GLIB_CFLAGS)
AC_SUBST(GLIB_LIBS)
AC_SUBST(GLIB_GENMARSHAL)
AC_SUBST(GOBJECT_QUERY)
AC_SUBST(GLIB_MKENUMS)
AC_SUBST(GLIB_COMPILE_RESOURCES)
rm -f conf.glibtest
])

View File

@ -1,5 +1,5 @@
# Increment this whenever this file is changed.
#serial 1
#serial 2
dnl GLIB_GSETTINGS
dnl Defines GSETTINGS_SCHEMAS_INSTALL which controls whether
@ -8,6 +8,10 @@ dnl
AC_DEFUN([GLIB_GSETTINGS],
[
dnl We can't use PKG_PREREQ because that needs 0.29.
m4_ifndef([PKG_PROG_PKG_CONFIG],
[pkg.m4 version 0.28 or later is required])
m4_pattern_allow([AM_V_GEN])
AC_ARG_ENABLE(schemas-compile,
AS_HELP_STRING([--disable-schemas-compile],
@ -20,11 +24,9 @@ AC_DEFUN([GLIB_GSETTINGS],
AC_SUBST([GSETTINGS_DISABLE_SCHEMAS_COMPILE])
PKG_PROG_PKG_CONFIG([0.16])
AC_SUBST(gsettingsschemadir, [${datadir}/glib-2.0/schemas])
if test x$cross_compiling != xyes; then
GLIB_COMPILE_SCHEMAS=`$PKG_CONFIG --variable glib_compile_schemas gio-2.0`
else
AC_PATH_PROG(GLIB_COMPILE_SCHEMAS, glib-compile-schemas)
fi
AS_IF([test x$cross_compiling != xyes],
[PKG_CHECK_VAR([GLIB_COMPILE_SCHEMAS], [gio-2.0], [glib_compile_schemas])],
[AC_PATH_PROG([GLIB_COMPILE_SCHEMAS], [glib-compile-schemas])])
AC_SUBST(GLIB_COMPILE_SCHEMAS)
if test "x$GLIB_COMPILE_SCHEMAS" = "x"; then
ifelse([$2],,[AC_MSG_ERROR([glib-compile-schemas not found.])],[$2])