2017-10-24 14:06:49 +02:00
|
|
|
# Increment this whenever this file is changed.
|
m4macros: Allow information from pkg-config to be overridden
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.
Signed-off-by: Simon McVittie <smcv@collabora.com>
2018-10-04 21:13:32 +02:00
|
|
|
#serial 2
|
2017-10-24 14:06:49 +02:00
|
|
|
|
2010-04-23 15:39:44 +02:00
|
|
|
dnl GLIB_GSETTINGS
|
2010-04-21 13:25:23 +02:00
|
|
|
dnl Defines GSETTINGS_SCHEMAS_INSTALL which controls whether
|
|
|
|
dnl the schema should be compiled
|
|
|
|
dnl
|
|
|
|
|
2010-04-23 15:39:44 +02:00
|
|
|
AC_DEFUN([GLIB_GSETTINGS],
|
2010-04-21 13:25:23 +02:00
|
|
|
[
|
m4macros: Allow information from pkg-config to be overridden
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.
Signed-off-by: Simon McVittie <smcv@collabora.com>
2018-10-04 21:13:32 +02:00
|
|
|
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])
|
|
|
|
|
2010-05-19 00:28:39 +02:00
|
|
|
m4_pattern_allow([AM_V_GEN])
|
|
|
|
AC_ARG_ENABLE(schemas-compile,
|
2011-05-16 13:51:59 +02:00
|
|
|
AS_HELP_STRING([--disable-schemas-compile],
|
2010-05-19 00:28:39 +02:00
|
|
|
[Disable regeneration of gschemas.compiled on install]),
|
|
|
|
[case ${enableval} in
|
|
|
|
yes) GSETTINGS_DISABLE_SCHEMAS_COMPILE="" ;;
|
|
|
|
no) GSETTINGS_DISABLE_SCHEMAS_COMPILE="1" ;;
|
|
|
|
*) AC_MSG_ERROR([bad value ${enableval} for --enable-schemas-compile]) ;;
|
|
|
|
esac])
|
|
|
|
AC_SUBST([GSETTINGS_DISABLE_SCHEMAS_COMPILE])
|
2010-04-23 23:27:26 +02:00
|
|
|
PKG_PROG_PKG_CONFIG([0.16])
|
2010-04-21 13:25:23 +02:00
|
|
|
AC_SUBST(gsettingsschemadir, [${datadir}/glib-2.0/schemas])
|
m4macros: Allow information from pkg-config to be overridden
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.
Signed-off-by: Simon McVittie <smcv@collabora.com>
2018-10-04 21:13:32 +02:00
|
|
|
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])])
|
2010-06-15 06:39:46 +02:00
|
|
|
AC_SUBST(GLIB_COMPILE_SCHEMAS)
|
2010-04-23 23:27:26 +02:00
|
|
|
if test "x$GLIB_COMPILE_SCHEMAS" = "x"; then
|
2010-06-19 04:59:43 +02:00
|
|
|
ifelse([$2],,[AC_MSG_ERROR([glib-compile-schemas not found.])],[$2])
|
|
|
|
else
|
|
|
|
ifelse([$1],,[:],[$1])
|
2010-04-23 23:27:26 +02:00
|
|
|
fi
|
2010-04-21 13:25:23 +02:00
|
|
|
|
2010-05-19 00:28:39 +02:00
|
|
|
GSETTINGS_RULES='
|
|
|
|
.PHONY : uninstall-gsettings-schemas install-gsettings-schemas clean-gsettings-schemas
|
2010-04-21 13:25:23 +02:00
|
|
|
|
2010-05-19 00:28:39 +02:00
|
|
|
mostlyclean-am: clean-gsettings-schemas
|
2010-04-21 13:25:23 +02:00
|
|
|
|
2010-06-30 19:12:19 +02:00
|
|
|
gsettings__enum_file = $(addsuffix .enums.xml,$(gsettings_ENUM_NAMESPACE))
|
|
|
|
|
|
|
|
%.gschema.valid: %.gschema.xml $(gsettings__enum_file)
|
2013-11-18 20:28:15 +01:00
|
|
|
$(AM_V_GEN) $(GLIB_COMPILE_SCHEMAS) --strict --dry-run $(addprefix --schema-file=,$(gsettings__enum_file)) --schema-file=$< && mkdir -p [$](@D) && touch [$]@
|
2010-05-19 00:28:39 +02:00
|
|
|
|
|
|
|
all-am: $(gsettings_SCHEMAS:.xml=.valid)
|
|
|
|
uninstall-am: uninstall-gsettings-schemas
|
|
|
|
install-data-am: install-gsettings-schemas
|
|
|
|
|
2010-05-22 02:08:49 +02:00
|
|
|
.SECONDARY: $(gsettings_SCHEMAS)
|
|
|
|
|
2010-10-04 07:51:11 +02:00
|
|
|
install-gsettings-schemas: $(gsettings_SCHEMAS) $(gsettings__enum_file)
|
2010-05-19 00:28:39 +02:00
|
|
|
@$(NORMAL_INSTALL)
|
2010-11-04 20:23:22 +01:00
|
|
|
if test -n "$^"; then \
|
|
|
|
test -z "$(gsettingsschemadir)" || $(MKDIR_P) "$(DESTDIR)$(gsettingsschemadir)"; \
|
|
|
|
$(INSTALL_DATA) $^ "$(DESTDIR)$(gsettingsschemadir)"; \
|
|
|
|
test -n "$(GSETTINGS_DISABLE_SCHEMAS_COMPILE)$(DESTDIR)" || $(GLIB_COMPILE_SCHEMAS) $(gsettingsschemadir); \
|
|
|
|
fi
|
2010-05-19 00:28:39 +02:00
|
|
|
|
|
|
|
uninstall-gsettings-schemas:
|
|
|
|
@$(NORMAL_UNINSTALL)
|
2010-06-30 19:12:19 +02:00
|
|
|
@list='\''$(gsettings_SCHEMAS) $(gsettings__enum_file)'\''; test -n "$(gsettingsschemadir)" || list=; \
|
2010-05-19 00:28:39 +02:00
|
|
|
files=`for p in $$list; do echo $$p; done | sed -e '\''s|^.*/||'\''`; \
|
|
|
|
test -n "$$files" || exit 0; \
|
|
|
|
echo " ( cd '\''$(DESTDIR)$(gsettingsschemadir)'\'' && rm -f" $$files ")"; \
|
|
|
|
cd "$(DESTDIR)$(gsettingsschemadir)" && rm -f $$files
|
2010-06-28 20:06:32 +02:00
|
|
|
test -n "$(GSETTINGS_DISABLE_SCHEMAS_COMPILE)$(DESTDIR)" || $(GLIB_COMPILE_SCHEMAS) $(gsettingsschemadir)
|
2010-05-19 00:28:39 +02:00
|
|
|
|
|
|
|
clean-gsettings-schemas:
|
2010-06-30 19:12:19 +02:00
|
|
|
rm -f $(gsettings_SCHEMAS:.xml=.valid) $(gsettings__enum_file)
|
2010-05-19 00:28:39 +02:00
|
|
|
|
2010-06-30 19:12:19 +02:00
|
|
|
ifdef gsettings_ENUM_NAMESPACE
|
|
|
|
$(gsettings__enum_file): $(gsettings_ENUM_FILES)
|
2010-11-16 19:22:10 +01:00
|
|
|
$(AM_V_GEN) glib-mkenums --comments '\''<!-- @comment@ -->'\'' --fhead "<schemalist>" --vhead " <@type@ id='\''$(gsettings_ENUM_NAMESPACE).@EnumName@'\''>" --vprod " <value nick='\''@valuenick@'\'' value='\''@valuenum@'\''/>" --vtail " </@type@>" --ftail "</schemalist>" [$]^ > [$]@.tmp && mv [$]@.tmp [$]@
|
2010-06-30 19:12:19 +02:00
|
|
|
endif
|
2010-05-19 00:28:39 +02:00
|
|
|
'
|
|
|
|
_GSETTINGS_SUBST(GSETTINGS_RULES)
|
2010-04-21 13:25:23 +02:00
|
|
|
])
|
|
|
|
|
|
|
|
dnl _GSETTINGS_SUBST(VARIABLE)
|
|
|
|
dnl Abstract macro to do either _AM_SUBST_NOTMAKE or AC_SUBST
|
|
|
|
AC_DEFUN([_GSETTINGS_SUBST],
|
|
|
|
[
|
|
|
|
AC_SUBST([$1])
|
|
|
|
m4_ifdef([_AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE([$1])])
|
|
|
|
]
|
|
|
|
)
|