diff --git a/audio/Makefile.am b/audio/Makefile.am index 85025d5be..45afab3c5 100644 --- a/audio/Makefile.am +++ b/audio/Makefile.am @@ -1,15 +1,23 @@ +if GLIB +glib_cflags = @GLIB_CFLAGS@ +glib_ldadd = @GLIB_LIBS@ +else +glib_cflags = +glib_ldadd = +endif + noinst_PROGRAMS = bt.audiod bt.headsetd bt_audiod_SOURCES = main.c -bt_audiod_LDADD = @DBUS_LIBS@ @BLUEZ_LIBS@ $(top_builddir)/common/libhelper.a +bt_audiod_LDADD = $(glib_ldadd) @DBUS_LIBS@ @BLUEZ_LIBS@ $(top_builddir)/common/libhelper.a bt_headsetd_SOURCES = headset.c -bt_headsetd_LDADD = @DBUS_LIBS@ @BLUEZ_LIBS@ $(top_builddir)/common/libhelper.a +bt_headsetd_LDADD = $(glib_ldadd) @DBUS_LIBS@ @BLUEZ_LIBS@ $(top_builddir)/common/libhelper.a -AM_CFLAGS = @BLUEZ_CFLAGS@ @DBUS_CFLAGS@ +AM_CFLAGS = @BLUEZ_CFLAGS@ @DBUS_CFLAGS@ $(glib_cflags) INCLUDES = -I$(top_srcdir)/common diff --git a/audio/headset.c b/audio/headset.c index 029387689..144d26684 100644 --- a/audio/headset.c +++ b/audio/headset.c @@ -27,12 +27,12 @@ #include #include -#include -#include -#include #include #include +#include #include +#include +#include #include #include @@ -48,7 +48,7 @@ #include "dbus.h" #include "logging.h" -#include "glib-ectomy.c" +#include "glib-ectomy.h" #define BUF_SIZE 1024 diff --git a/common/Makefile.am b/common/Makefile.am index 182d574e1..3774edf9e 100644 --- a/common/Makefile.am +++ b/common/Makefile.am @@ -5,19 +5,28 @@ else sdp_sources = sdp-dummy.c endif +if GLIB +glib_sources = +glib_cflags = @GLIB_CFLAGS@ +else +glib_sources = glib-ectomy.c +glib_cflags = +endif + noinst_LIBRARIES = libhelper.a libhelper_a_SOURCES = oui.h oui.c list.h list.c \ textfile.h textfile.c helper.h helper.c \ - glib-ectomy.h glib-ectomy.c logging.h logging.c \ - dbus.h dbus.c sdp-xml.h sdp-xml.c $(sdp_sources) + logging.h logging.c dbus.h dbus.c \ + sdp-xml.h sdp-xml.c $(sdp_sources) \ + glib-ectomy.h $(glib_sources) noinst_PROGRAMS = test_textfile test_textfile_LDADD = libhelper.a -AM_CFLAGS = @DBUS_CFLAGS@ +AM_CFLAGS = @DBUS_CFLAGS@ $(glib_cflags) -EXTRA_DIST = ppoll.h sdp-dummy.c sdp-expat.c +EXTRA_DIST = ppoll.h sdp-dummy.c sdp-expat.c glib-ectomy.c MAINTAINERCLEANFILES = Makefile.in diff --git a/common/dbus.c b/common/dbus.c index c8ed07e46..eb8c77f3a 100644 --- a/common/dbus.c +++ b/common/dbus.c @@ -29,6 +29,7 @@ #include #include #include +#include #include #include diff --git a/common/glib-ectomy.h b/common/glib-ectomy.h index 411cc25f5..8502deb52 100644 --- a/common/glib-ectomy.h +++ b/common/glib-ectomy.h @@ -1,6 +1,12 @@ #ifndef __GLIB_ECTOMY_H #define __GLIB_ECTOMY_H +#ifdef HAVE_GLIB +#include +#define g_timeout_remove g_source_remove +#define g_io_remove_watch g_source_remove +#else + #include #include @@ -106,4 +112,6 @@ gboolean g_utf8_validate(const gchar *str, gssize max_len, const gchar **end); #define g_main_quit(loop) g_main_loop_quit(loop) #define g_main_unref(loop) g_main_loop_unref(loop) +#endif + #endif /* __GLIB_ECTOMY_H */ diff --git a/daemon/Makefile.am b/daemon/Makefile.am index 67758137d..be4b738f8 100644 --- a/daemon/Makefile.am +++ b/daemon/Makefile.am @@ -1,9 +1,17 @@ +if GLIB +glib_cflags = @GLIB_CFLAGS@ +glib_ldadd = @GLIB_LIBS@ +else +glib_cflags = +glib_ldadd = +endif + noinst_PROGRAMS = bluetoothd bluetoothd_SOURCES = main.c -bluetoothd_LDADD = @DBUS_LIBS@ @BLUEZ_LIBS@ \ +bluetoothd_LDADD = $(glib_ldadd) @DBUS_LIBS@ @BLUEZ_LIBS@ \ $(top_builddir)/hcid/libhciserver.a \ $(top_builddir)/sdpd/libsdpserver.a \ $(top_builddir)/common/libhelper.a @@ -12,7 +20,7 @@ if EXPAT bluetoothd_LDADD += -lexpat endif -AM_CFLAGS = @BLUEZ_CFLAGS@ @DBUS_CFLAGS@ +AM_CFLAGS = @BLUEZ_CFLAGS@ @DBUS_CFLAGS@ $(glib_cflags) INCLUDES = -I$(top_srcdir)/common -I$(top_srcdir)/hcid -I$(top_srcdir)/sdpd diff --git a/daemon/main.c b/daemon/main.c index a534cdb01..ef8ae67ae 100644 --- a/daemon/main.c +++ b/daemon/main.c @@ -108,11 +108,11 @@ int main(int argc, char *argv[]) enable_debug(); - event_loop = g_main_new(FALSE); + event_loop = g_main_loop_new(NULL, FALSE); g_main_run(event_loop); - g_main_unref(event_loop); + g_main_loop_unref(event_loop); info("Exit"); diff --git a/hcid/Makefile.am b/hcid/Makefile.am index afab067fa..167c9bdf7 100644 --- a/hcid/Makefile.am +++ b/hcid/Makefile.am @@ -13,6 +13,14 @@ dbusdir = $(sysconfdir)/dbus-1/system.d dbus_DATA = bluetooth.conf endif +if GLIB +glib_cflags = @GLIB_CFLAGS@ +glib_ldadd = @GLIB_LIBS@ +else +glib_cflags = +glib_ldadd = +endif + noinst_LIBRARIES = libhciserver.a libhciserver_a_SOURCES = hcid.h security.c device.c storage.c \ @@ -30,7 +38,7 @@ noinst_PROGRAMS = passkey-agent service-agent auth-agent hcid_SOURCES = main.c -hcid_LDADD = @DBUS_LIBS@ @BLUEZ_LIBS@ \ +hcid_LDADD = $(glib_ldadd) @DBUS_LIBS@ @BLUEZ_LIBS@ \ libhciserver.a $(top_builddir)/common/libhelper.a if EXPAT @@ -49,7 +57,7 @@ auth_agent_SOURCES = auth-agent.c auth_agent_LDADD = @DBUS_LIBS@ -AM_CFLAGS = @BLUEZ_CFLAGS@ @DBUS_CFLAGS@ +AM_CFLAGS = @BLUEZ_CFLAGS@ @DBUS_CFLAGS@ $(glib_cflags) INCLUDES = -I$(top_srcdir)/common diff --git a/hcid/dbus-adapter.c b/hcid/dbus-adapter.c index a4ca87127..f27e2ccff 100644 --- a/hcid/dbus-adapter.c +++ b/hcid/dbus-adapter.c @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include diff --git a/hcid/dbus-hci.c b/hcid/dbus-hci.c index 8fd443b6f..fc316620b 100644 --- a/hcid/dbus-hci.c +++ b/hcid/dbus-hci.c @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include diff --git a/hcid/dbus-rfcomm.c b/hcid/dbus-rfcomm.c index 479763fab..d238669c7 100644 --- a/hcid/dbus-rfcomm.c +++ b/hcid/dbus-rfcomm.c @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include diff --git a/hcid/dbus-sdp.c b/hcid/dbus-sdp.c index 028a06709..2e3d563ac 100644 --- a/hcid/dbus-sdp.c +++ b/hcid/dbus-sdp.c @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include diff --git a/hcid/dbus-security.c b/hcid/dbus-security.c index 1b5f00675..012114aa1 100644 --- a/hcid/dbus-security.c +++ b/hcid/dbus-security.c @@ -28,6 +28,7 @@ #include #include +#include #include #include diff --git a/hcid/dbus-test.c b/hcid/dbus-test.c index 4dea57802..988fd5f0f 100644 --- a/hcid/dbus-test.c +++ b/hcid/dbus-test.c @@ -27,6 +27,7 @@ #include #include +#include #include diff --git a/hcid/main.c b/hcid/main.c index 722a3b157..d0490cfe4 100644 --- a/hcid/main.c +++ b/hcid/main.c @@ -524,7 +524,7 @@ static void init_defaults(void) static void sig_term(int sig) { - g_main_quit(event_loop); + g_main_loop_quit(event_loop); } static void sig_hup(int sig) @@ -728,7 +728,7 @@ int main(int argc, char *argv[]) init_security_data(); /* Create event loop */ - event_loop = g_main_new(FALSE); + event_loop = g_main_loop_new(NULL, FALSE); ctl_io = g_io_channel_unix_new(hcid.sock); g_io_channel_set_close_on_unref(ctl_io, TRUE); @@ -753,7 +753,7 @@ int main(int argc, char *argv[]) cleanup_sdp_session(); - g_main_unref(event_loop); + g_main_loop_unref(event_loop); g_io_channel_unref(ctl_io); diff --git a/hcid/sdp.c b/hcid/sdp.c index 9cde4951c..31bcd2299 100644 --- a/hcid/sdp.c +++ b/hcid/sdp.c @@ -28,6 +28,7 @@ #include #include #include +#include #include #include diff --git a/input/Makefile.am b/input/Makefile.am index b578645c6..cafc03a60 100644 --- a/input/Makefile.am +++ b/input/Makefile.am @@ -5,13 +5,21 @@ dbusdir = $(sysconfdir)/dbus-1/system.d dbus_DATA = bluetooth-input.conf endif +if GLIB +glib_cflags = @GLIB_CFLAGS@ +glib_ldadd = @GLIB_LIBS@ +else +glib_cflags = +glib_ldadd = +endif + noinst_PROGRAMS = bt.inputd bt_inputd_SOURCES = main.c input-service.h input-service.c -bt_inputd_LDADD = @DBUS_LIBS@ @BLUEZ_LIBS@ $(top_builddir)/common/libhelper.a +bt_inputd_LDADD = $(glib_ldadd) @DBUS_LIBS@ @BLUEZ_LIBS@ $(top_builddir)/common/libhelper.a -AM_CFLAGS = @BLUEZ_CFLAGS@ @DBUS_CFLAGS@ +AM_CFLAGS = @BLUEZ_CFLAGS@ @DBUS_CFLAGS@ $(glib_cflags) INCLUDES = -I$(top_srcdir)/common diff --git a/input/main.c b/input/main.c index df3b5160a..5523b67f9 100644 --- a/input/main.c +++ b/input/main.c @@ -26,11 +26,14 @@ #endif #include +#include #include +#include #include #include #include #include + #include #include "dbus.h" diff --git a/sdpd/Makefile.am b/sdpd/Makefile.am index d29932dac..e87b03a97 100644 --- a/sdpd/Makefile.am +++ b/sdpd/Makefile.am @@ -1,4 +1,12 @@ +if GLIB +glib_cflags = @GLIB_CFLAGS@ +glib_ldadd = @GLIB_LIBS@ +else +glib_cflags = +glib_ldadd = +endif + noinst_LIBRARIES = libsdpserver.a libsdpserver_a_SOURCES = sdpd.h cstate.c request.c service.c servicedb.c @@ -7,9 +15,9 @@ sbin_PROGRAMS = sdpd sdpd_SOURCES = main.c -sdpd_LDADD = @BLUEZ_LIBS@ libsdpserver.a $(top_builddir)/common/libhelper.a +sdpd_LDADD = $(glib_ldadd) @BLUEZ_LIBS@ libsdpserver.a $(top_builddir)/common/libhelper.a -AM_CFLAGS = @BLUEZ_CFLAGS@ +AM_CFLAGS = @BLUEZ_CFLAGS@ $(glib_cflags) INCLUDES = -I$(top_srcdir)/common diff --git a/sdpd/main.c b/sdpd/main.c index e64d805b1..ab258e933 100644 --- a/sdpd/main.c +++ b/sdpd/main.c @@ -500,7 +500,7 @@ int main(int argc, char *argv[]) } /* Create event loop */ - event_loop = g_main_new(FALSE); + event_loop = g_main_loop_new(NULL, FALSE); l2cap_io = g_io_channel_unix_new(l2cap_sock); g_io_channel_set_close_on_unref(l2cap_io, TRUE); @@ -517,7 +517,7 @@ int main(int argc, char *argv[]) sdp_svcdb_reset(); - g_main_unref(event_loop); + g_main_loop_unref(event_loop); g_io_channel_unref(unix_io);