Allow X11 autolaunch to be disabled even if the headers/libraries are there
[platform/upstream/dbus.git] / dbus / dbus-sysdeps-unix.c
index ff902ff..e9ea253 100644 (file)
@@ -3257,6 +3257,11 @@ _dbus_get_autolaunch_address (const char *scope,
                               DBusString *address,
                               DBusError  *error)
 {
+#ifdef DBUS_BUILD_X11
+  /* Perform X11-based autolaunch. (We also support launchd-based autolaunch,
+   * but that's done elsewhere, and if it worked, this function wouldn't
+   * be called.) */
+  const char *display;
   static char *argv[6];
   int i;
   DBusString uuid;
@@ -3273,7 +3278,7 @@ _dbus_get_autolaunch_address (const char *scope,
   if (display == NULL || display[0] == '\0')
     {
       dbus_set_error_const (error, DBUS_ERROR_NOT_SUPPORTED,
-          "Unable to autolaunch a dbus-daemon without DISPLAY set");
+          "Unable to autolaunch a dbus-daemon without a $DISPLAY for X11");
       return FALSE;
     }
 
@@ -3312,6 +3317,12 @@ _dbus_get_autolaunch_address (const char *scope,
  out:
   _dbus_string_free (&uuid);
   return retval;
+#else
+  dbus_set_error_const (error, DBUS_ERROR_NOT_SUPPORTED,
+      "Using X11 for dbus-daemon autolaunch was disabled at compile time, "
+      "set your DBUS_SESSION_BUS_ADDRESS instead");
+  return FALSE;
+#endif
 }
 
 /**