1# Increment this whenever this file is changed. 2#serial 2 3 4dnl GLIB_GSETTINGS 5dnl Defines GSETTINGS_SCHEMAS_INSTALL which controls whether 6dnl the schema should be compiled 7dnl 8 9AC_DEFUN([GLIB_GSETTINGS], 10[ 11 dnl We can't use PKG_PREREQ because that needs 0.29. 12 m4_ifndef([PKG_PROG_PKG_CONFIG], 13 [pkg.m4 version 0.28 or later is required]) 14 15 m4_pattern_allow([AM_V_GEN]) 16 AC_ARG_ENABLE(schemas-compile, 17 AS_HELP_STRING([--disable-schemas-compile], 18 [Disable regeneration of gschemas.compiled on install]), 19 [case ${enableval} in 20 yes) GSETTINGS_DISABLE_SCHEMAS_COMPILE="" ;; 21 no) GSETTINGS_DISABLE_SCHEMAS_COMPILE="1" ;; 22 *) AC_MSG_ERROR([bad value ${enableval} for --enable-schemas-compile]) ;; 23 esac]) 24 AC_SUBST([GSETTINGS_DISABLE_SCHEMAS_COMPILE]) 25 PKG_PROG_PKG_CONFIG([0.16]) 26 AC_SUBST(gsettingsschemadir, [${datadir}/glib-2.0/schemas]) 27 AS_IF([test x$cross_compiling != xyes], 28 [PKG_CHECK_VAR([GLIB_COMPILE_SCHEMAS], [gio-2.0], [glib_compile_schemas])], 29 [AC_PATH_PROG([GLIB_COMPILE_SCHEMAS], [glib-compile-schemas])]) 30 AC_SUBST(GLIB_COMPILE_SCHEMAS) 31 if test "x$GLIB_COMPILE_SCHEMAS" = "x"; then 32 ifelse([$2],,[AC_MSG_ERROR([glib-compile-schemas not found.])],[$2]) 33 else 34 ifelse([$1],,[:],[$1]) 35 fi 36 37 GSETTINGS_RULES=' 38.PHONY : uninstall-gsettings-schemas install-gsettings-schemas clean-gsettings-schemas 39 40mostlyclean-am: clean-gsettings-schemas 41 42gsettings__enum_file = $(addsuffix .enums.xml,$(gsettings_ENUM_NAMESPACE)) 43 44%.gschema.valid: %.gschema.xml $(gsettings__enum_file) 45 $(AM_V_GEN) $(GLIB_COMPILE_SCHEMAS) --strict --dry-run $(addprefix --schema-file=,$(gsettings__enum_file)) --schema-file=$< && mkdir -p [$](@D) && touch [$]@ 46 47all-am: $(gsettings_SCHEMAS:.xml=.valid) 48uninstall-am: uninstall-gsettings-schemas 49install-data-am: install-gsettings-schemas 50 51.SECONDARY: $(gsettings_SCHEMAS) 52 53install-gsettings-schemas: $(gsettings_SCHEMAS) $(gsettings__enum_file) 54 @$(NORMAL_INSTALL) 55 if test -n "$^"; then \ 56 test -z "$(gsettingsschemadir)" || $(MKDIR_P) "$(DESTDIR)$(gsettingsschemadir)"; \ 57 $(INSTALL_DATA) $^ "$(DESTDIR)$(gsettingsschemadir)"; \ 58 test -n "$(GSETTINGS_DISABLE_SCHEMAS_COMPILE)$(DESTDIR)" || $(GLIB_COMPILE_SCHEMAS) $(gsettingsschemadir); \ 59 fi 60 61uninstall-gsettings-schemas: 62 @$(NORMAL_UNINSTALL) 63 @list='\''$(gsettings_SCHEMAS) $(gsettings__enum_file)'\''; test -n "$(gsettingsschemadir)" || list=; \ 64 files=`for p in $$list; do echo $$p; done | sed -e '\''s|^.*/||'\''`; \ 65 test -n "$$files" || exit 0; \ 66 echo " ( cd '\''$(DESTDIR)$(gsettingsschemadir)'\'' && rm -f" $$files ")"; \ 67 cd "$(DESTDIR)$(gsettingsschemadir)" && rm -f $$files 68 test -n "$(GSETTINGS_DISABLE_SCHEMAS_COMPILE)$(DESTDIR)" || $(GLIB_COMPILE_SCHEMAS) $(gsettingsschemadir) 69 70clean-gsettings-schemas: 71 rm -f $(gsettings_SCHEMAS:.xml=.valid) $(gsettings__enum_file) 72 73ifdef gsettings_ENUM_NAMESPACE 74$(gsettings__enum_file): $(gsettings_ENUM_FILES) 75 $(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 [$]@ 76endif 77' 78 _GSETTINGS_SUBST(GSETTINGS_RULES) 79]) 80 81dnl _GSETTINGS_SUBST(VARIABLE) 82dnl Abstract macro to do either _AM_SUBST_NOTMAKE or AC_SUBST 83AC_DEFUN([_GSETTINGS_SUBST], 84[ 85AC_SUBST([$1]) 86m4_ifdef([_AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE([$1])]) 87] 88) 89