Allow compilation against GLib

This commit is contained in:
Marcel Holtmann 2007-01-12 00:37:42 +00:00
parent b6f6c5cf2f
commit c97480f11b
20 changed files with 94 additions and 26 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -29,6 +29,7 @@
#include <errno.h>
#include <unistd.h>
#include <string.h>
#include <stdlib.h>
#include <stdint.h>
#include <dbus/dbus.h>

View File

@ -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 */

View File

@ -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

View File

@ -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");

View File

@ -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

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -28,6 +28,7 @@
#include <stdio.h>
#include <errno.h>
#include <stdlib.h>
#include <sys/socket.h>
#include <bluetooth/bluetooth.h>

View File

@ -27,6 +27,7 @@
#include <stdio.h>
#include <errno.h>
#include <stdlib.h>
#include <dbus/dbus.h>

View File

@ -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);

View File

@ -28,6 +28,7 @@
#include <stdio.h>
#include <errno.h>
#include <unistd.h>
#include <stdlib.h>
#include <sys/socket.h>
#include <bluetooth/bluetooth.h>

View File

@ -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

View File

@ -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"

View File

@ -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

View File

@ -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);