summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Nocera <hadess@hadess.net>2010-04-21 12:25:23 +0100
committerBastien Nocera <hadess@hadess.net>2010-04-21 16:19:09 +0100
commit0d322e77a55c3b457361ede40c391a6a0b825c78 (patch)
tree2a3ea6338237e5d9d80374c502739938643cd634
parent12b801cab4d639f3ac86f1009e6bfb3f589729c5 (diff)
downloadglib-0d322e77a55c3b457361ede40c391a6a0b825c78.tar.gz
glib-0d322e77a55c3b457361ede40c391a6a0b825c78.tar.bz2
glib-0d322e77a55c3b457361ede40c391a6a0b825c78.zip
Add GSettings m4 macros helper
https://bugzilla.gnome.org/show_bug.cgi?id=616312
-rw-r--r--m4macros/Makefile.am2
-rw-r--r--m4macros/gsettings.m443
2 files changed, 44 insertions, 1 deletions
diff --git a/m4macros/Makefile.am b/m4macros/Makefile.am
index 0284b4e77..75a9ca05a 100644
--- a/m4macros/Makefile.am
+++ b/m4macros/Makefile.am
@@ -1,6 +1,6 @@
include $(top_srcdir)/Makefile.decl
-installed_m4= glib-2.0.m4 glib-gettext.m4
+installed_m4= glib-2.0.m4 glib-gettext.m4 gsettings.m4
EXTRA_DIST+=$(installed_m4)
diff --git a/m4macros/gsettings.m4 b/m4macros/gsettings.m4
new file mode 100644
index 000000000..254fde8a6
--- /dev/null
+++ b/m4macros/gsettings.m4
@@ -0,0 +1,43 @@
+dnl AM_GSETTINGS
+dnl Defines GSETTINGS_SCHEMAS_INSTALL which controls whether
+dnl the schema should be compiled
+dnl
+
+AC_DEFUN([AM_GSETTINGS],
+[
+ AC_ARG_ENABLE(schemas-install,
+ AC_HELP_STRING([--disable-schemas-install],
+ [Disable the schemas installation]),
+ [case ${enableval} in
+ yes|no) ;;
+ *) AC_MSG_ERROR([bad value ${enableval} for --enable-schemas-install]) ;;
+ esac])
+ AM_CONDITIONAL([GSETTINGS_SCHEMAS_INSTALL], [test "$enable_schemas_install" != no])
+
+ AC_SUBST(gsettingsschemadir, [${datadir}/glib-2.0/schemas])
+ AC_SUBST(gsettingsupdateschemacache, `pkg-config --variable gsettingsupdateschemacache gio-2.0`)
+
+ GSETTINGS_CHECK_RULE='
+.PHONY : check-gsettings-schema
+
+gschema_xml_files := $(wildcard *.gschema.xml)
+check-gsettings-schema: gsettings_schema_validate_stamp
+CLEANFILES += gsettings_schema_validate_stamp
+gsettings_schema_validate_stamp: $(gschema_xml_files)
+ $(gsettingsupdateschemacache) --dry-run --schema-files $?
+ touch [$]@
+
+all: check-gsettings-schema
+'
+
+ _GSETTINGS_SUBST(GSETTINGS_CHECK_RULE)
+])
+
+dnl _GSETTINGS_SUBST(VARIABLE)
+dnl Abstract macro to do either _AM_SUBST_NOTMAKE or AC_SUBST
+AC_DEFUN([_GSETTINGS_SUBST],
+[
+AC_SUBST([$1])
+m4_ifdef([_AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE([$1])])
+]
+)