GConf comes with an m4 file to ease its usage from third party configure scripts; it provides a macro, known as AM_GCONF_SOURCE_2, which provides many features (and most importantly, encapsulates all GConf related stuff). Among these, it is used to determine the directory where .schemas files should be installed, a setting that can be fine-tuned by the end user through the --with-gconf-schema-file-dir argument.

However, many configure scripts use this macro incorrectly. That is, they call it from the configure script to detect the presence of gconftool-2, but later, in Makefile.am files, they don't use the variables defined by the macro.

For example, resuming my previous example: I've found lots of packages that have this in their Makefile.am:

schemasdir = $(sysconfdir)/gconf/schemas

To (almost) all Linux users, this will look completely sane, as that is the usual directory where schemas get installed. But this will fail miserably if the user has chosen another location (for example, pkgsrc uses /usr/pkg/share/gconf/schemas to store them). The solution is very simple, because all you have to do is to use a variable defined by the macro; that is, the Makefile.am has to be modified to say:

schemasdir = $(GCONF_SCHEMA_FILE_DIR)

Another problem I often find comes from the usage of the GCONF_SCHEMAS_INSTALL conditional, also defined by that macro. This conditional is provided to determine whether gconftool-2 has to be executed during a make install to register the schemas into GConf's system-wide database or not. Some Makefile.am files don't use this feature at all; others fail to define the "false" case, leading to problems with the BSD Make utility ("missing target").

Consider that you have the following code:

install-data-local: install-schemas
install-schemas:
GCONF_CONFIG_SOURCE=$(GCONF_SCHEMA_CONFIG_SOURCE) $(GCONFTOOL) --makefile-install-rule foobar.schemas

You should rewrite it to look like the following code; i.e., surround it with an Automake conditional, and define the install-data-local in the "false" case to do nothing. This fixes the two problems mentioned previously:

if GCONF_SCHEMAS_INSTALL
install-data-local: install-schemas
install-schemas:
GCONF_CONFIG_SOURCE=$(GCONF_SCHEMA_CONFIG_SOURCE) $(GCONFTOOL) --makefile-install-rule foobar.schemas
else
install-data-local:
endif