1dnl GLIB_GSETTINGS 2dnl Defines GSETTINGS_SCHEMAS_INSTALL which controls whether 3dnl the schema should be compiled 4dnl 5 6AC_DEFUN([GLIB_GSETTINGS], 7[ 8 m4_pattern_allow([AM_V_GEN]) 9 AC_ARG_ENABLE(schemas-compile, 10 AC_HELP_STRING([--disable-schemas-compile], 11 [Disable regeneration of gschemas.compiled on install]), 12 [case ${enableval} in 13 yes) GSETTINGS_DISABLE_SCHEMAS_COMPILE="" ;; 14 no) GSETTINGS_DISABLE_SCHEMAS_COMPILE="1" ;; 15 *) AC_MSG_ERROR([bad value ${enableval} for --enable-schemas-compile]) ;; 16 esac]) 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` 22 else 23 AC_PATH_PROG(GLIB_COMPILE_SCHEMAS, glib-compile-schemas) 24 fi 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]) 28 else 29 ifelse([$1],,[:],[$1]) 30 fi 31 32 GSETTINGS_RULES=' 33.PHONY : uninstall-gsettings-schemas install-gsettings-schemas clean-gsettings-schemas 34 35mostlyclean-am: clean-gsettings-schemas 36 37gsettings__enum_file = $(addsuffix .enums.xml,$(gsettings_ENUM_NAMESPACE)) 38 39%.gschema.valid: %.gschema.xml $(gsettings__enum_file) 40 $(AM_V_GEN) if test -f "$<"; then d=; else d="$(srcdir)/"; fi; $(GLIB_COMPILE_SCHEMAS) --dry-run $(addprefix --schema-file=,$(gsettings__enum_file)) --schema-file=$${d}$< && touch [$]@ 41 42all-am: $(gsettings_SCHEMAS:.xml=.valid) 43uninstall-am: uninstall-gsettings-schemas 44install-data-am: install-gsettings-schemas 45 46.SECONDARY: $(gsettings_SCHEMAS) 47 48gsettings__base_list = \ 49 sed "$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g" | \ 50 sed "$$!N;$$!N;$$!N;$$!N;s/\n/ /g" 51 52install-gsettings-schemas: $(gsettings_SCHEMAS:.xml=.valid) $(gsettings__enum_file) 53 @$(NORMAL_INSTALL) 54 test -z "$(gsettingsschemadir)" || $(MKDIR_P) "$(DESTDIR)$(gsettingsschemadir)" 55 @list='\''$(gsettings__enum_file) $(gsettings_SCHEMAS)'\''; test -n "$(gsettingsschemadir)" || list=; \ 56 for p in $$list; do \ 57 if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ 58 echo "$$d$$p"; \ 59 done | $(gsettings__base_list) | \ 60 while read files; do \ 61 echo " $(INSTALL_DATA) $$files '\''$(DESTDIR)$(gsettingsschemadir)'\''"; \ 62 $(INSTALL_DATA) $$files "$(DESTDIR)$(gsettingsschemadir)" || exit $$?; \ 63 done 64 test -n "$(GSETTINGS_DISABLE_SCHEMAS_COMPILE)$(DESTDIR)" || $(GLIB_COMPILE_SCHEMAS) $(gsettingsschemadir) 65 66uninstall-gsettings-schemas: 67 @$(NORMAL_UNINSTALL) 68 @list='\''$(gsettings_SCHEMAS) $(gsettings__enum_file)'\''; test -n "$(gsettingsschemadir)" || list=; \ 69 files=`for p in $$list; do echo $$p; done | sed -e '\''s|^.*/||'\''`; \ 70 test -n "$$files" || exit 0; \ 71 echo " ( cd '\''$(DESTDIR)$(gsettingsschemadir)'\'' && rm -f" $$files ")"; \ 72 cd "$(DESTDIR)$(gsettingsschemadir)" && rm -f $$files 73 test -n "$(GSETTINGS_DISABLE_SCHEMAS_COMPILE)$(DESTDIR)" || $(GLIB_COMPILE_SCHEMAS) $(gsettingsschemadir) 74 75clean-gsettings-schemas: 76 rm -f $(gsettings_SCHEMAS:.xml=.valid) $(gsettings__enum_file) 77 78ifdef gsettings_ENUM_NAMESPACE 79$(gsettings__enum_file): $(gsettings_ENUM_FILES) 80 $(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>" $(gsettings_ENUM_FILES) > [$]@.tmp && mv [$]@.tmp [$]@ 81endif 82' 83 _GSETTINGS_SUBST(GSETTINGS_RULES) 84]) 85 86dnl _GSETTINGS_SUBST(VARIABLE) 87dnl Abstract macro to do either _AM_SUBST_NOTMAKE or AC_SUBST 88AC_DEFUN([_GSETTINGS_SUBST], 89[ 90AC_SUBST([$1]) 91m4_ifdef([_AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE([$1])]) 92] 93) 94