Skip to content

Commit 5c4ff6e

Browse files
committed
Improve builds and error handling
1 parent d797072 commit 5c4ff6e

File tree

3 files changed

+71
-9
lines changed

3 files changed

+71
-9
lines changed

configure.ac

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ AC_ARG_ENABLE([libindicator],
7070
[], [enable_libindicator=yes])
7171

7272
AC_ARG_WITH([libindicator], AS_HELP_STRING([--with-libindicator=ayatana|unity], [Preferred indicator backend [default=ayatana]]))
73+
have_indicator_ng=no
7374

7475
AS_IF([test "x$enable_libindicator" = "xyes"], [
7576
AS_IF([test "x$with_libindicator" != "xunity" && $PKG_CONFIG --exists "$AYATANA_INDICATOR_PKG >= $AYATANA_INDICATOR_REQUIRED_VERSION" >/dev/null 2>&1], [
@@ -86,6 +87,7 @@ AS_IF([test "x$enable_libindicator" = "xyes"], [
8687
CPPFLAGS_OLD="$CPPFLAGS"
8788
CPPFLAGS=`$PKG_CONFIG --cflags ${AYATANA_INDICATOR_PKG}`
8889
AC_CHECK_HEADER([libayatana-indicator/indicator-ng.h], [
90+
have_indicator_ng=yes
8991
AC_DEFINE([HAVE_LIBINDICATOR_NG], [1], [Define if "libayatana-indicator/indicator-ng.h" is present])
9092
AC_DEFINE([HAVE_AYATANA_LIBINDICATOR_NG], [1], [Define if "libayatana-indicator/indicator-ng.h" is present])
9193
], [], [-])
@@ -110,6 +112,7 @@ AS_IF([test "x$enable_libindicator" = "xyes"], [
110112
CPPFLAGS_OLD="$CPPFLAGS"
111113
CPPFLAGS=`$PKG_CONFIG --cflags ${UNITY_INDICATOR_PKG}`
112114
AC_CHECK_HEADER([libindicator/indicator-ng.h], [
115+
have_indicator_ng=yes
113116
AC_DEFINE([HAVE_LIBINDICATOR_NG], [1], [Define if "libindicator/indicator-ng.h" is present])
114117
AC_DEFINE([HAVE_UNITY_LIBINDICATOR_NG], [1], [Define if "libindicator/indicator-ng.h" is present])
115118
], [], [-])
@@ -127,16 +130,26 @@ AS_IF([test "x$enable_libindicator" = "xyes"], [
127130

128131
AM_CONDITIONAL([HAVE_UNITY_LIBINDICATOR], [test "x$have_unity_libindicator" = "xyes"])
129132

133+
AC_ARG_WITH([systemd-service-dir], AS_HELP_STRING([--with-systemd-service-dir=path], [Path where systemd indicator service units are stored]))
134+
AS_IF([test "x$with_systemd_service_dir" = "x" || test "x$with_systemd_service_dir" = "x"], [
135+
with_systemd_service_dir="/usr/lib/systemd/user"
136+
], [])
137+
SYSTEMD_SERVICE_DIR="$with_systemd_service_dir"
138+
AC_SUBST(SYSTEMD_SERVICE_DIR)
139+
130140
dnl ###########################################################################
131141

132142
AC_ARG_ENABLE([libido],
133143
AC_HELP_STRING([--enable-libido], [Enable libido support])
134144
AC_HELP_STRING([--disable-libido], [Disable libido support]),
135145
[], [enable_libido=yes])
136146

147+
have_ido=no
148+
137149
AS_IF([test "x$enable_libido" = "xyes" && test "x$have_libindicator" = "xyes"], [
138150
AS_IF([test "x$have_ayatana_libindicator" = "xyes" && $PKG_CONFIG --exists "$AYATANA_IDO_PKG" >/dev/null 2>&1], [
139151
PKG_CHECK_MODULES([AYATANA_LIBIDO], [$AYATANA_IDO_PKG >= $AYATANA_IDO_REQUIRED_VERSION], [
152+
have_ido=yes
140153
AC_DEFINE([HAVE_LIBIDO], [1], [Define if "$AYATANA_IDO_PKG" is present])
141154
AC_DEFINE([HAVE_AYATANA_LIBIDO], [1], [Define if "$AYATANA_IDO_PKG" is present])
142155
])
@@ -147,6 +160,7 @@ AS_IF([test "x$enable_libido" = "xyes" && test "x$have_libindicator" = "xyes"],
147160
], [])
148161
AS_IF([$PKG_CONFIG --exists "$UNITY_IDO_PKG" >/dev/null 2>&1], [
149162
PKG_CHECK_MODULES([UNITY_LIBIDO], [$UNITY_IDO_PKG >= $UNITY_IDO_REQUIRED_VERSION], [
163+
have_ido=yes
150164
AC_DEFINE([HAVE_LIBIDO], [1], [Define if "$UNITY_IDO_PKG" is present])
151165
AC_DEFINE([HAVE_UNITY_LIBIDO], [1], [Define if "$UNITY_IDO_PKG" is present])
152166
])
@@ -169,7 +183,9 @@ AS_IF([test "x$with_libxklavier" = "xyes"],
169183
PKG_CHECK_MODULES([LIBXKLAVIER], [libxklavier], [have_xklavier=yes])
170184
AC_DEFINE([HAVE_LIBXKLAVIER], [1], [Define if "libxklavier" is present])
171185
],
172-
[])
186+
[
187+
with_libxklavier=no
188+
])
173189

174190
dnl ###########################################################################
175191

@@ -237,3 +253,37 @@ po/Makefile.in
237253
src/Makefile
238254
])
239255
AC_OUTPUT
256+
257+
AS_IF([test "x$have_libindicator" = "xyes"], [
258+
AS_IF([test "x$have_ayatana_libindicator" = "xyes"], [
259+
indicator_backend="ayatana"
260+
], [
261+
indicator_backend="unity"
262+
])
263+
], [
264+
indicator_backend="disabled"
265+
])
266+
267+
echo "
268+
------------------------------------------------------
269+
LightDM GTK+ Greeter $VERSION
270+
====================================
271+
272+
Installation:
273+
=============
274+
Prefix: $prefix
275+
AT-SPI Service: $enable_at_spi_command
276+
Use libxklavier: $with_libxklavier
277+
Enable SIGTERM Handler: $enable_kill_on_sigterm
278+
279+
Indicators:
280+
===========
281+
Indicator Support: $indicator_backend
282+
Indicator Services Command: $enable_indicator_services_command
283+
systemd Services: $with_systemd_service_dir
284+
Indicator NG: $have_indicator_ng
285+
IDO: $have_ido
286+
287+
------------------------------------------------------
288+
289+
Configuration finished, type make to compile"

src/Makefile.am

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ AM_CPPFLAGS = \
4141
-DINDICATOR_DIR=\""$(INDICATORDIR)"\" \
4242
-DUNITY_INDICATOR_DIR=\""$(UNITY_INDICATORDIR)"\" \
4343
-DAYATANA_INDICATOR_DIR=\""$(AYATANA_INDICATORDIR)"\" \
44+
-DSYSTEMD_SERVICE_DIR=\""$(SYSTEMD_SERVICE_DIR)"\" \
4445
$(WARN_CFLAGS)
4546

4647
lightdm_gtk_greeter_CFLAGS = \

src/lightdm-gtk-greeter.c

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1569,7 +1569,7 @@ find_indicator_exec (const gchar *name)
15691569
} else {
15701570
g_free (desktop);
15711571

1572-
desktop = g_strdup_printf ("/usr/lib/systemd/user/%s.service", indicator);
1572+
desktop = g_strdup_printf ("%s/%s.service", SYSTEMD_SERVICE_DIR, indicator);
15731573

15741574
if (g_key_file_load_from_file (keyfile, desktop, G_KEY_FILE_NONE, NULL)) {
15751575
exec = g_key_file_get_string (keyfile, "Service", "ExecStart", NULL);
@@ -1590,6 +1590,7 @@ init_indicators (void)
15901590
gpointer iter_value;
15911591
gsize length = 0;
15921592
guint i;
1593+
GError *error = NULL;
15931594

15941595
#ifdef HAVE_LIBINDICATOR
15951596
IndicatorObject *io = NULL;
@@ -1676,11 +1677,6 @@ init_indicators (void)
16761677
#ifdef HAVE_LIBINDICATOR_NG
16771678
else
16781679
{ /* service file */
1679-
gchar *exec = find_indicator_exec (names[i]);
1680-
if (exec) {
1681-
spawn_line_pid (exec, G_SPAWN_SEARCH_PATH, NULL);
1682-
g_free (exec);
1683-
}
16841680
#ifdef HAVE_UNITY_LIBINDICATOR_NG
16851681
if (strchr (names[i], '.'))
16861682
path = g_strdup_printf ("%s/%s", UNITY_INDICATOR_DIR, names[i]);
@@ -1692,7 +1688,14 @@ init_indicators (void)
16921688
else
16931689
path = g_strdup_printf ("%s/org.ayatana.indicator.%s", AYATANA_INDICATOR_DIR, names[i]);
16941690
#endif
1695-
io = INDICATOR_OBJECT (indicator_ng_new_for_profile (path, "desktop_greeter", NULL));
1691+
io = INDICATOR_OBJECT (indicator_ng_new_for_profile (path, "desktop_greeter", &error));
1692+
if (io) {
1693+
gchar *exec = find_indicator_exec (names[i]);
1694+
if (exec) {
1695+
spawn_line_pid (exec, G_SPAWN_SEARCH_PATH, NULL);
1696+
g_free (exec);
1697+
}
1698+
}
16961699
}
16971700
#endif
16981701

@@ -1720,9 +1723,17 @@ init_indicators (void)
17201723
}
17211724
else
17221725
{
1723-
g_warning ("Indicator \"%s\": failed to load", names[i]);
1726+
if (error != NULL) {
1727+
g_warning ("Indicator \"%s\": Failed to load from %s: %s", names[i], path, error->message);
1728+
g_clear_error (&error);
1729+
} else {
1730+
g_warning ("Indicator \"%s\": failed to load", names[i]);
1731+
}
17241732
}
17251733

1734+
if (error != NULL)
1735+
g_clear_error (&error);
1736+
17261737
g_free (path);
17271738
#endif
17281739
}

0 commit comments

Comments
 (0)