aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--m4/gsettings.m437
1 files changed, 26 insertions, 11 deletions
diff --git a/m4/gsettings.m4 b/m4/gsettings.m4
index 76b808ae6..7b2f9a233 100644
--- a/m4/gsettings.m4
+++ b/m4/gsettings.m4
@@ -7,7 +7,7 @@ AC_DEFUN([GLIB_GSETTINGS],
[
m4_pattern_allow([AM_V_GEN])
AC_ARG_ENABLE(schemas-compile,
- AC_HELP_STRING([--disable-schemas-compile],
+ AS_HELP_STRING([--disable-schemas-compile],
[Disable regeneration of gschemas.compiled on install]),
[case ${enableval} in
yes) GSETTINGS_DISABLE_SCHEMAS_COMPILE="" ;;
@@ -17,9 +17,16 @@ AC_DEFUN([GLIB_GSETTINGS],
AC_SUBST([GSETTINGS_DISABLE_SCHEMAS_COMPILE])
PKG_PROG_PKG_CONFIG([0.16])
AC_SUBST(gsettingsschemadir, [${datadir}/glib-2.0/schemas])
- AC_SUBST(GLIB_COMPILE_SCHEMAS, `$PKG_CONFIG --variable glib_compile_schemas gio-2.0`)
+ 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
+ AC_SUBST(GLIB_COMPILE_SCHEMAS)
if test "x$GLIB_COMPILE_SCHEMAS" = "x"; then
- AC_MSG_ERROR([glib-compile-schemas not found.])
+ ifelse([$2],,[AC_MSG_ERROR([glib-compile-schemas not found.])],[$2])
+ else
+ ifelse([$1],,[:],[$1])
fi
GSETTINGS_RULES='
@@ -27,8 +34,10 @@ AC_DEFUN([GLIB_GSETTINGS],
mostlyclean-am: clean-gsettings-schemas
-%.gschema.valid: %.gschema.xml
- $(AM_V_GEN) if test -f "$^"; then d=; else d="$(srcdir)/"; fi; $(GLIB_COMPILE_SCHEMAS) --dry-run --schema-file=$${d}$^ && touch [$]@
+gsettings__enum_file = $(addsuffix .enums.xml,$(gsettings_ENUM_NAMESPACE))
+
+%.gschema.valid: %.gschema.xml $(gsettings__enum_file)
+ $(AM_V_GEN) if test -f "$<"; then d=; else d="$(srcdir)/"; fi; $(GLIB_COMPILE_SCHEMAS) --strict --dry-run $(addprefix --schema-file=,$(gsettings__enum_file)) --schema-file=$${d}$< && touch [$]@
all-am: $(gsettings_SCHEMAS:.xml=.valid)
uninstall-am: uninstall-gsettings-schemas
@@ -38,22 +47,28 @@ install-data-am: install-gsettings-schemas
install-gsettings-schemas: $(gsettings_SCHEMAS) $(gsettings__enum_file)
@$(NORMAL_INSTALL)
- test -z "$(gsettingsschemadir)" || $(MKDIR_P) "$(DESTDIR)$(gsettingsschemadir)"
- $(INSTALL_DATA) $^ "$(DESTDIR)$(gsettingsschemadir)"
- test -n "$(GSETTINGS_DISABLE_SCHEMAS_COMPILE)$(DESTDIR)" || $(GLIB_COMPILE_SCHEMAS) $(gsettingsschemadir)
+ 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
uninstall-gsettings-schemas:
@$(NORMAL_UNINSTALL)
- @list='\''$(gsettings_SCHEMAS)'\''; test -n "$(gsettingsschemadir)" || list=; \
+ @list='\''$(gsettings_SCHEMAS) $(gsettings__enum_file)'\''; test -n "$(gsettingsschemadir)" || list=; \
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
- test -n "$(GSETTINGS_DISABLE_SCHEMAS_COMPILE)$(DESTDIR)" || $(GLIB_COMPILE_SCHEMAS) --uninstall $(gsettingsschemadir)
+ test -n "$(GSETTINGS_DISABLE_SCHEMAS_COMPILE)$(DESTDIR)" || $(GLIB_COMPILE_SCHEMAS) $(gsettingsschemadir)
clean-gsettings-schemas:
- rm -f $(gsettings_SCHEMAS:.xml=.valid)
+ rm -f $(gsettings_SCHEMAS:.xml=.valid) $(gsettings__enum_file)
+ifdef gsettings_ENUM_NAMESPACE
+$(gsettings__enum_file): $(gsettings_ENUM_FILES)
+ $(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 [$]@
+endif
'
_GSETTINGS_SUBST(GSETTINGS_RULES)
])