2 dnl Defines GSETTINGS_SCHEMAS_INSTALL which controls whether
3 dnl the schema should be compiled
6 AC_DEFUN([GLIB_GSETTINGS],
8 m4_pattern_allow([AM_V_GEN])
9 AC_ARG_ENABLE(schemas-compile,
10 AS_HELP_STRING([--disable-schemas-compile],
11 [Disable regeneration of gschemas.compiled on install]),
13 yes) GSETTINGS_DISABLE_SCHEMAS_COMPILE="" ;;
14 no) GSETTINGS_DISABLE_SCHEMAS_COMPILE="1" ;;
15 *) AC_MSG_ERROR([bad value ${enableval} for --enable-schemas-compile]) ;;
17 AC_SUBST([GSETTINGS_DISABLE_SCHEMAS_COMPILE])
18 PKG_PROG_PKG_CONFIG([0.16])
19 AC_SUBST(gsettingsschemadir, [${datadir}/glib-2.0/schemas])
20 if test x$cross_compiling != xyes; then
21 GLIB_COMPILE_SCHEMAS=`$PKG_CONFIG --variable glib_compile_schemas gio-2.0`
23 AC_PATH_PROG(GLIB_COMPILE_SCHEMAS, glib-compile-schemas)
25 AC_SUBST(GLIB_COMPILE_SCHEMAS)
26 if test "x$GLIB_COMPILE_SCHEMAS" = "x"; then
27 ifelse([$2],,[AC_MSG_ERROR([glib-compile-schemas not found.])],[$2])
29 ifelse([$1],,[:],[$1])
33 .PHONY : uninstall-gsettings-schemas install-gsettings-schemas clean-gsettings-schemas
35 mostlyclean-am: clean-gsettings-schemas
37 gsettings__enum_file = $(addsuffix .enums.xml,$(gsettings_ENUM_NAMESPACE))
39 %.gschema.valid: %.gschema.xml $(gsettings__enum_file)
40 $(AM_V_GEN) $(GLIB_COMPILE_SCHEMAS) --strict --dry-run $(addprefix --schema-file=,$(gsettings__enum_file)) --schema-file=$< && mkdir -p [$](@D) && touch [$]@
42 all-am: $(gsettings_SCHEMAS:.xml=.valid)
43 uninstall-am: uninstall-gsettings-schemas
44 install-data-am: install-gsettings-schemas
46 .SECONDARY: $(gsettings_SCHEMAS)
48 install-gsettings-schemas: $(gsettings_SCHEMAS) $(gsettings__enum_file)
50 if test -n "$^"; then \
51 test -z "$(gsettingsschemadir)" || $(MKDIR_P) "$(DESTDIR)$(gsettingsschemadir)"; \
52 $(INSTALL_DATA) $^ "$(DESTDIR)$(gsettingsschemadir)"; \
53 test -n "$(GSETTINGS_DISABLE_SCHEMAS_COMPILE)$(DESTDIR)" || $(GLIB_COMPILE_SCHEMAS) $(gsettingsschemadir); \
56 uninstall-gsettings-schemas:
58 @list='\''$(gsettings_SCHEMAS) $(gsettings__enum_file)'\''; test -n "$(gsettingsschemadir)" || list=; \
59 files=`for p in $$list; do echo $$p; done | sed -e '\''s|^.*/||'\''`; \
60 test -n "$$files" || exit 0; \
61 echo " ( cd '\''$(DESTDIR)$(gsettingsschemadir)'\'' && rm -f" $$files ")"; \
62 cd "$(DESTDIR)$(gsettingsschemadir)" && rm -f $$files
63 test -n "$(GSETTINGS_DISABLE_SCHEMAS_COMPILE)$(DESTDIR)" || $(GLIB_COMPILE_SCHEMAS) $(gsettingsschemadir)
65 clean-gsettings-schemas:
66 rm -f $(gsettings_SCHEMAS:.xml=.valid) $(gsettings__enum_file)
68 ifdef gsettings_ENUM_NAMESPACE
69 $(gsettings__enum_file): $(gsettings_ENUM_FILES)
70 $(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 [$]@
73 _GSETTINGS_SUBST(GSETTINGS_RULES)
76 dnl _GSETTINGS_SUBST(VARIABLE)
77 dnl Abstract macro to do either _AM_SUBST_NOTMAKE or AC_SUBST
78 AC_DEFUN([_GSETTINGS_SUBST],
81 m4_ifdef([_AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE([$1])])