1 # Increment this whenever this file is changed.
5 dnl Defines GSETTINGS_SCHEMAS_INSTALL which controls whether
6 dnl the schema should be compiled
9 AC_DEFUN([GLIB_GSETTINGS],
11 m4_pattern_allow([AM_V_GEN])
12 AC_ARG_ENABLE(schemas-compile,
13 AS_HELP_STRING([--disable-schemas-compile],
14 [Disable regeneration of gschemas.compiled on install]),
16 yes) GSETTINGS_DISABLE_SCHEMAS_COMPILE="" ;;
17 no) GSETTINGS_DISABLE_SCHEMAS_COMPILE="1" ;;
18 *) AC_MSG_ERROR([bad value ${enableval} for --enable-schemas-compile]) ;;
20 AC_SUBST([GSETTINGS_DISABLE_SCHEMAS_COMPILE])
21 PKG_PROG_PKG_CONFIG([0.16])
22 AC_SUBST(gsettingsschemadir, [${datadir}/glib-2.0/schemas])
23 if test x$cross_compiling != xyes; then
24 GLIB_COMPILE_SCHEMAS=`$PKG_CONFIG --variable glib_compile_schemas gio-2.0`
26 AC_PATH_PROG(GLIB_COMPILE_SCHEMAS, glib-compile-schemas)
28 AC_SUBST(GLIB_COMPILE_SCHEMAS)
29 if test "x$GLIB_COMPILE_SCHEMAS" = "x"; then
30 ifelse([$2],,[AC_MSG_ERROR([glib-compile-schemas not found.])],[$2])
32 ifelse([$1],,[:],[$1])
36 .PHONY : uninstall-gsettings-schemas install-gsettings-schemas clean-gsettings-schemas
38 mostlyclean-am: clean-gsettings-schemas
40 gsettings__enum_file = $(addsuffix .enums.xml,$(gsettings_ENUM_NAMESPACE))
42 %.gschema.valid: %.gschema.xml $(gsettings__enum_file)
43 $(AM_V_GEN) $(GLIB_COMPILE_SCHEMAS) --strict --dry-run $(addprefix --schema-file=,$(gsettings__enum_file)) --schema-file=$< && mkdir -p [$](@D) && touch [$]@
45 all-am: $(gsettings_SCHEMAS:.xml=.valid)
46 uninstall-am: uninstall-gsettings-schemas
47 install-data-am: install-gsettings-schemas
49 .SECONDARY: $(gsettings_SCHEMAS)
51 install-gsettings-schemas: $(gsettings_SCHEMAS) $(gsettings__enum_file)
53 if test -n "$^"; then \
54 test -z "$(gsettingsschemadir)" || $(MKDIR_P) "$(DESTDIR)$(gsettingsschemadir)"; \
55 $(INSTALL_DATA) $^ "$(DESTDIR)$(gsettingsschemadir)"; \
56 test -n "$(GSETTINGS_DISABLE_SCHEMAS_COMPILE)$(DESTDIR)" || $(GLIB_COMPILE_SCHEMAS) $(gsettingsschemadir); \
59 uninstall-gsettings-schemas:
61 @list='\''$(gsettings_SCHEMAS) $(gsettings__enum_file)'\''; test -n "$(gsettingsschemadir)" || list=; \
62 files=`for p in $$list; do echo $$p; done | sed -e '\''s|^.*/||'\''`; \
63 test -n "$$files" || exit 0; \
64 echo " ( cd '\''$(DESTDIR)$(gsettingsschemadir)'\'' && rm -f" $$files ")"; \
65 cd "$(DESTDIR)$(gsettingsschemadir)" && rm -f $$files
66 test -n "$(GSETTINGS_DISABLE_SCHEMAS_COMPILE)$(DESTDIR)" || $(GLIB_COMPILE_SCHEMAS) $(gsettingsschemadir)
68 clean-gsettings-schemas:
69 rm -f $(gsettings_SCHEMAS:.xml=.valid) $(gsettings__enum_file)
71 ifdef gsettings_ENUM_NAMESPACE
72 $(gsettings__enum_file): $(gsettings_ENUM_FILES)
73 $(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 [$]@
76 _GSETTINGS_SUBST(GSETTINGS_RULES)
79 dnl _GSETTINGS_SUBST(VARIABLE)
80 dnl Abstract macro to do either _AM_SUBST_NOTMAKE or AC_SUBST
81 AC_DEFUN([_GSETTINGS_SUBST],
84 m4_ifdef([_AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE([$1])])