AC_SUBST(LIBTOOL_EXPORT_OPTIONS)
+AC_ARG_ENABLE(relocate, [ --enable-relocate Relocate to coexist with CORBA [default=yes]], enable_relocate="$enableval", enable_relocate=yes)
+if test x$enable_relocate = xyes ; then
+ AC_DEFINE(RELOCATE, , [Relocate to coexist with CORBA])
+fi
+AM_CONDITIONAL(RELOCATE, test x$enable_relocate = xyes)
+
AC_CONFIG_FILES([Makefile
xml/Makefile
registryd/Makefile])
#include <string.h>
#include <glib.h>
#include <stdio.h>
+#include <dlfcn.h>
#include <dbus/dbus.h>
#include <dbus/dbus-glib.h>
#error "No introspection XML directory defined"
#endif
+#ifdef RELOCATE
+#define DBUS_GCONF_KEY "/desktop/gnome/interface/at-spi-dbus"
+#else
+#define CORBA_GCONF_KEY "/desktop/gnome/interface/at-spi-corba"
+#endif
+
+static gboolean need_to_quit ();
+
static GMainLoop *mainloop;
static gchar *dbus_name = NULL;
static gboolean use_gnome_session = FALSE;
/*---------------------------------------------------------------------------*/
+typedef GObject *(*gconf_client_get_default_t) ();
+typedef gboolean (*gconf_client_get_bool_t)(GObject *, const char *, void *);
+
int
main (int argc, char **argv)
{
DBusError error;
int ret;
+ if (need_to_quit ())
+ return 0;
+
g_type_init();
/*Parse command options*/
g_main_loop_run (mainloop);
return 0;
}
+
+static gboolean
+need_to_quit ()
+{
+ void *gconf = NULL;
+ gconf_client_get_default_t gconf_client_get_default = NULL;
+ gconf_client_get_bool_t gconf_client_get_bool = NULL;
+ GObject *gconf_client; /* really a GConfClient */
+ gboolean ret;
+
+ gconf = dlopen ("libgconf-2.so", RTLD_LAZY);
+ if (gconf)
+ {
+ gconf_client_get_default = dlsym (gconf, "gconf_client_get_default");
+ gconf_client_get_bool = dlsym (gconf, "gconf_client_get_bool");
+ }
+
+ if (!gconf_client || !gconf_client_get_bool)
+ {
+ if (gconf)
+ dlclose (gconf);
+ return FALSE;
+ }
+
+ /* If we've been relocated, we will exit if the at-spi-corba gconf key
+ * has been set. If we have not been relocated, we will only run if the
+ * at-spi-dbus gconf key has been set.
+ */
+ gconf_client = gconf_client_get_default ();
+#ifdef RELOCATE
+ ret = !gconf_client_get_bool (gconf_client, DBUS_GCONF_KEY, NULL);
+#else
+ ret = gconf_client_get_bool (gconf_client, CORBA_GCONF_KEY, NULL);
+#endif
+ g_object_unref (gconf_client);
+
+ return ret;
+}