summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2007-01-12 00:37:42 +0000
committerMarcel Holtmann <marcel@holtmann.org>2007-01-12 00:37:42 +0000
commitc97480f11bdfdc3cbb867b8127074bcb6b047024 (patch)
tree885dff3c4d9f46567af438af0e266acdc932f281
parentb6f6c5cf2f85f27b277b891acf0a22c4a068bbbe (diff)
Allow compilation against GLib
-rw-r--r--audio/Makefile.am14
-rw-r--r--audio/headset.c8
-rw-r--r--common/Makefile.am17
-rw-r--r--common/dbus.c1
-rw-r--r--common/glib-ectomy.h8
-rw-r--r--daemon/Makefile.am12
-rw-r--r--daemon/main.c4
-rw-r--r--hcid/Makefile.am12
-rw-r--r--hcid/dbus-adapter.c1
-rw-r--r--hcid/dbus-hci.c1
-rw-r--r--hcid/dbus-rfcomm.c1
-rw-r--r--hcid/dbus-sdp.c1
-rw-r--r--hcid/dbus-security.c1
-rw-r--r--hcid/dbus-test.c1
-rw-r--r--hcid/main.c6
-rw-r--r--hcid/sdp.c1
-rw-r--r--input/Makefile.am12
-rw-r--r--input/main.c3
-rw-r--r--sdpd/Makefile.am12
-rw-r--r--sdpd/main.c4
20 files changed, 94 insertions, 26 deletions
diff --git a/audio/Makefile.am b/audio/Makefile.am
index 85025d5b..45afab3c 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 02938768..144d2668 100644
--- a/audio/headset.c
+++ b/audio/headset.c
@@ -27,12 +27,12 @@
#include <stdio.h>
#include <errno.h>
-#include <getopt.h>
-#include <stdlib.h>
-#include <string.h>
#include <fcntl.h>
#include <unistd.h>
+#include <stdlib.h>
#include <signal.h>
+#include <string.h>
+#include <getopt.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
@@ -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 182d574e..3774edf9 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 c8ed07e4..eb8c77f3 100644
--- a/common/dbus.c
+++ b/common/dbus.c
@@ -29,6 +29,7 @@
#include <errno.h>
#include <unistd.h>
#include <string.h>
+#include <stdlib.h>
#include <stdint.h>
#include <dbus/dbus.h>
diff --git a/common/glib-ectomy.h b/common/glib-ectomy.h
index 411cc25f..8502deb5 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 <glib.h>
+#define g_timeout_remove g_source_remove
+#define g_io_remove_watch g_source_remove
+#else
+
#include <stdlib.h>
#include <sys/poll.h>
@@ -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 67758137..be4b738f 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 a534cdb0..ef8ae67a 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 afab067f..167c9bdf 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 a4ca8712..f27e2ccf 100644
--- a/hcid/dbus-adapter.c
+++ b/hcid/dbus-adapter.c
@@ -30,6 +30,7 @@
#include <errno.h>
#include <fcntl.h>
#include <unistd.h>
+#include <stdlib.h>
#include <time.h>
#include <sys/param.h>
#include <sys/ioctl.h>
diff --git a/hcid/dbus-hci.c b/hcid/dbus-hci.c
index 8fd443b6..fc316620 100644
--- a/hcid/dbus-hci.c
+++ b/hcid/dbus-hci.c
@@ -29,6 +29,7 @@
#include <stdio.h>
#include <errno.h>
#include <unistd.h>
+#include <stdlib.h>
#include <string.h>
#include <sys/param.h>
#include <sys/ioctl.h>
diff --git a/hcid/dbus-rfcomm.c b/hcid/dbus-rfcomm.c
index 479763fa..d238669c 100644
--- a/hcid/dbus-rfcomm.c
+++ b/hcid/dbus-rfcomm.c
@@ -29,6 +29,7 @@
#include <errno.h>
#include <fcntl.h>
#include <unistd.h>
+#include <stdlib.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
diff --git a/hcid/dbus-sdp.c b/hcid/dbus-sdp.c
index 028a0670..2e3d563a 100644
--- a/hcid/dbus-sdp.c
+++ b/hcid/dbus-sdp.c
@@ -29,6 +29,7 @@
#include <errno.h>
#include <fcntl.h>
#include <unistd.h>
+#include <stdlib.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/param.h>
diff --git a/hcid/dbus-security.c b/hcid/dbus-security.c
index 1b5f0067..012114aa 100644
--- a/hcid/dbus-security.c
+++ b/hcid/dbus-security.c
@@ -28,6 +28,7 @@
#include <stdio.h>
#include <errno.h>
+#include <stdlib.h>
#include <sys/socket.h>
#include <bluetooth/bluetooth.h>
diff --git a/hcid/dbus-test.c b/hcid/dbus-test.c
index 4dea5780..988fd5f0 100644
--- a/hcid/dbus-test.c
+++ b/hcid/dbus-test.c
@@ -27,6 +27,7 @@
#include <stdio.h>
#include <errno.h>
+#include <stdlib.h>
#include <dbus/dbus.h>
diff --git a/hcid/main.c b/hcid/main.c
index 722a3b15..d0490cfe 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 9cde4951..31bcd229 100644
--- a/hcid/sdp.c
+++ b/hcid/sdp.c
@@ -28,6 +28,7 @@
#include <stdio.h>
#include <errno.h>
#include <unistd.h>
+#include <stdlib.h>
#include <sys/socket.h>
#include <bluetooth/bluetooth.h>
diff --git a/input/Makefile.am b/input/Makefile.am
index b578645c..cafc03a6 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 df3b5160..5523b67f 100644
--- a/input/main.c
+++ b/input/main.c
@@ -26,11 +26,14 @@
#endif
#include <stdio.h>
+#include <errno.h>
#include <unistd.h>
+#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <signal.h>
#include <getopt.h>
+
#include <dbus/dbus.h>
#include "dbus.h"
diff --git a/sdpd/Makefile.am b/sdpd/Makefile.am
index d29932da..e87b03a9 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 e64d805b..ab258e93 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);