Merge branch 'dbus-1.4'

This commit is contained in:
Simon McVittie 2011-05-25 17:39:34 +01:00
commit fd99c3a1c1
5 changed files with 42 additions and 10 deletions

View file

@ -83,6 +83,11 @@
#endif
#cmakedefine DBUS_BUILD_X11 1
/* For the moment, the cmake build system doesn't have an equivalent of
* the autoconf build system's --disable-x11-autolaunch */
#ifdef DBUS_BUILD_X11
# define DBUS_ENABLE_X11_AUTOLAUNCH 1
#endif
#define _DBUS_VA_COPY_ASSIGN(a1,a2) { a1 = a2; }

View file

@ -1100,9 +1100,6 @@ if test "x$dbus_win" = xyes; then
fi
enable_x11_autolaunch=no
fi
if test "x$enable_x11_autolaunch" = xno; then
have_x11=no
else
AC_PATH_XTRA
@ -1120,11 +1117,17 @@ if test "x$enable_x11_autolaunch,$have_x11" = xyes,no; then
AC_MSG_ERROR([X11 auto-launch requires X headers/libraries])
else
# move from "auto" to "yes" or "no" if necessary
enable_x11_autolaunch="$have_x11"
if test "x$enable_x11_autolaunch" != xno; then
enable_x11_autolaunch="$have_x11"
fi
fi
if test "x$have_x11" = xyes ; then
AC_DEFINE([DBUS_BUILD_X11], [1], [Define to build X11 functionality])
fi
if test "x$enable_x11_autolaunch" = xyes ; then
AC_DEFINE([DBUS_BUILD_X11], [1], [Define to enable X11 auto-launch])
AC_DEFINE([DBUS_ENABLE_X11_AUTOLAUNCH], [1], [Define to enable X11 auto-launch])
fi
AC_SUBST([DBUS_X_CFLAGS])

View file

@ -3257,7 +3257,7 @@ _dbus_get_autolaunch_address (const char *scope,
DBusString *address,
DBusError *error)
{
#ifdef DBUS_BUILD_X11
#ifdef DBUS_ENABLE_X11_AUTOLAUNCH
/* 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.) */

View file

@ -19,6 +19,8 @@ main (int argc, char *argv[])
dbus_error_init (&error);
conn = dbus_bus_get (DBUS_BUS_SESSION, &error);
#ifdef DBUS_ENABLE_X11_AUTOLAUNCH
if (dbus_error_is_set (&error))
{
fprintf (stderr, "*** Failed to autolaunch session bus: %s\n",
@ -26,6 +28,23 @@ main (int argc, char *argv[])
dbus_error_free (&error);
return 1;
}
#else
/* We don't necessarily expect it to *work* without X (although it might -
* for instance on Mac OS it might have used launchd). Just check that the
* results are consistent. */
if (dbus_error_is_set (&error) && conn != NULL)
{
fprintf (stderr, "*** Autolaunched session bus, but an error was set!\n");
return 1;
}
#endif
if (!dbus_error_is_set (&error) && conn == NULL)
{
fprintf (stderr, "*** Failed to autolaunch session bus but no error was set\n");
return 1;
}
return 0;
}

View file

@ -917,7 +917,11 @@ main (int argc, char **argv)
fprintf (stderr, "Autolaunch requested, but X11 support not compiled in.\n"
"Cannot continue.\n");
exit (1);
#else
#else /* DBUS_BUILD_X11 */
#ifndef DBUS_ENABLE_X11_AUTOLAUNCH
fprintf (stderr, "X11 autolaunch support disabled at compile time.\n");
exit (1);
#else /* DBUS_ENABLE_X11_AUTOLAUNCH */
char *address;
pid_t pid;
long wid;
@ -954,11 +958,12 @@ main (int argc, char **argv)
bourne_shell_syntax, binary_syntax, argc, argv, remaining_args);
exit (0);
}
#endif /* DBUS_ENABLE_X11_AUTOLAUNCH */
}
else if (read_machine_uuid_if_needed())
else if (read_machine_uuid_if_needed())
{
x11_init();
#endif
#endif /* DBUS_BUILD_X11 */
}
@ -1177,7 +1182,7 @@ main (int argc, char **argv)
close (bus_pid_to_launcher_pipe[READ_END]);
#ifdef DBUS_BUILD_X11
#ifdef DBUS_ENABLE_X11_AUTOLAUNCH
if (xdisplay != NULL)
{
verbose("Saving x11 address\n");