Setup GLib and D-Bus threading support
authorMarcel Holtmann <marcel@holtmann.org>
Sun, 13 Apr 2008 23:08:08 +0000 (01:08 +0200)
committerMarcel Holtmann <marcel@holtmann.org>
Sun, 13 Apr 2008 23:08:08 +0000 (01:08 +0200)
configure.in
src/Makefile.am
src/main.c

index 6830105..402120d 100644 (file)
@@ -44,6 +44,11 @@ AC_ARG_ENABLE(pie, AC_HELP_STRING([--enable-pie],
 AC_PATH_PROG(DHCLIENT, [dhclient])
 AC_PATH_PROG(WPASUPPLICANT, [wpa_supplicant])
 
+PKG_CHECK_MODULES(GTHREAD, gthread-2.0, dummy=yes,
+                               AC_MSG_ERROR(gthread is required))
+AC_SUBST(GTHREAD_CFLAGS)
+AC_SUBST(GTHREAD_LIBS)
+
 PKG_CHECK_MODULES(GMODULE, gmodule-2.0, dummy=yes,
                                AC_MSG_ERROR(gmodule is required))
 AC_SUBST(GMODULE_CFLAGS)
index 1637b24..1f585c7 100644 (file)
@@ -15,7 +15,7 @@ connmand_SOURCES = main.c connman.h log.c manager.c agent.c plugin.c \
                        iface.c iface-storage.c iface-helper.c iface-inet.c \
                                        network.c rtnl.c dhcp.c resolver.c
 
-connmand_LDADD = @HAL_LIBS@ @GDBUS_LIBS@ @GMODULE_LIBS@
+connmand_LDADD = @HAL_LIBS@ @GDBUS_LIBS@ @GMODULE_LIBS@ @GTHREAD_LIBS@
  
 statedir = $(localstatedir)/run/connman
 
@@ -27,7 +27,7 @@ else
 plugindir = $(libdir)/connman/plugins
 endif
 
-AM_CFLAGS = @GMODULE_CFLAGS@ @GDBUS_CFLAGS@ @HAL_CFLAGS@ \
+AM_CFLAGS = @GTHREAD_CFLAGS@ @GMODULE_CFLAGS@ @GDBUS_CFLAGS@ @HAL_CFLAGS@ \
                        -DSTATEDIR=\""$(statedir)"\" \
                        -DSTORAGEDIR=\""$(storagedir)\"" \
                        -DPLUGINDIR=\""$(plugindir)"\"
index 402ccf4..dc8439d 100644 (file)
@@ -115,8 +115,16 @@ int main(int argc, char *argv[])
        mkdir(STORAGEDIR, S_IRUSR | S_IWUSR | S_IXUSR |
                        S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH);
 
+       if (g_thread_supported() == FALSE)
+               g_thread_init(NULL);
+
        main_loop = g_main_loop_new(NULL, FALSE);
 
+       if (dbus_threads_init_default() == FALSE) {
+               fprintf(stderr, "Can't init usage of threads\n");
+               exit(1);
+       }
+
        dbus_error_init(&err);
 
        conn = g_dbus_setup_bus(DBUS_BUS_SYSTEM, CONNMAN_SERVICE, &err);