mirror of git://git.sysmocom.de/ofono
build: Add optional ell dependency
This commit is contained in:
parent
abe70b50e3
commit
8dc66c11bd
|
@ -602,6 +602,11 @@ builtin_sources += plugins/push-notification.c
|
|||
builtin_modules += allowed_apns
|
||||
builtin_sources += plugins/allowed-apns.c
|
||||
|
||||
if ELL
|
||||
builtin_cflags += @ELL_CFLAGS@
|
||||
builtin_libadd += @ELL_LIBS@
|
||||
endif
|
||||
|
||||
sbin_PROGRAMS = src/ofonod
|
||||
|
||||
src_ofonod_SOURCES = $(builtin_sources) $(gatchat_sources) src/ofono.ver \
|
||||
|
|
14
configure.ac
14
configure.ac
|
@ -218,6 +218,20 @@ AC_ARG_ENABLE(upower, AC_HELP_STRING([--disable-upower],
|
|||
[enable_upower=${enableval}])
|
||||
AM_CONDITIONAL(UPOWER, test "${enable_power}" != "no")
|
||||
|
||||
AC_ARG_ENABLE(ell, AC_HELP_STRING([--enable-ell],
|
||||
[enable support for ell]),
|
||||
[enable_ell=${enableval}])
|
||||
|
||||
if (test "${enable_ell}" = "yes"); then
|
||||
AC_DEFINE(HAVE_ELL, 1, [Defined if Ell is enabled])
|
||||
PKG_CHECK_MODULES(ELL, ell >= 0.2, dummy=yes,
|
||||
AC_MSG_ERROR(ell library >= 0.2 is required))
|
||||
AC_SUBST(ELL_CFLAGS)
|
||||
AC_SUBST(ELL_LIBS)
|
||||
fi
|
||||
|
||||
AM_CONDITIONAL(ELL, test "${enable_ell}" != "no")
|
||||
|
||||
AC_ARG_ENABLE(datafiles, AC_HELP_STRING([--disable-datafiles],
|
||||
[do not install configuration and data files]),
|
||||
[enable_datafiles=${enableval}])
|
||||
|
|
54
src/main.c
54
src/main.c
|
@ -32,6 +32,10 @@
|
|||
|
||||
#include <gdbus.h>
|
||||
|
||||
#ifdef HAVE_ELL
|
||||
#include <ell/ell.h>
|
||||
#endif
|
||||
|
||||
#include "ofono.h"
|
||||
|
||||
#define SHUTDOWN_GRACE_SECONDS 10
|
||||
|
@ -170,6 +174,32 @@ static GOptionEntry options[] = {
|
|||
{ NULL },
|
||||
};
|
||||
|
||||
#ifdef HAVE_ELL
|
||||
struct ell_event_source {
|
||||
GSource source;
|
||||
GPollFD pollfd;
|
||||
};
|
||||
|
||||
static gboolean event_prepare(GSource *source, gint *timeout)
|
||||
{
|
||||
int r = l_main_prepare();
|
||||
*timeout = r;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean event_check(GSource *source)
|
||||
{
|
||||
l_main_iterate(0);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static GSourceFuncs event_funcs = {
|
||||
.prepare = event_prepare,
|
||||
.check = event_check,
|
||||
};
|
||||
#endif
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
GOptionContext *context;
|
||||
|
@ -177,6 +207,9 @@ int main(int argc, char **argv)
|
|||
DBusConnection *conn;
|
||||
DBusError error;
|
||||
guint signal;
|
||||
#ifdef HAVE_ELL
|
||||
struct ell_event_source *source;
|
||||
#endif
|
||||
|
||||
#ifdef NEED_THREADS
|
||||
if (g_thread_supported() == FALSE)
|
||||
|
@ -220,6 +253,23 @@ int main(int argc, char **argv)
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_ELL
|
||||
l_log_set_stderr();
|
||||
l_debug_enable("*");
|
||||
l_main_init();
|
||||
|
||||
source = (struct ell_event_source *) g_source_new(&event_funcs,
|
||||
sizeof(struct ell_event_source));
|
||||
|
||||
source->pollfd.fd = l_main_get_epoll_fd();
|
||||
source->pollfd.events = G_IO_IN | G_IO_HUP | G_IO_ERR;
|
||||
|
||||
g_source_add_poll((GSource *)source, &source->pollfd);
|
||||
g_source_attach((GSource *) source,
|
||||
g_main_loop_get_context(event_loop));
|
||||
#endif
|
||||
|
||||
|
||||
signal = setup_signalfd();
|
||||
|
||||
__ofono_log_init(argv[0], option_debug, option_detach);
|
||||
|
@ -267,6 +317,10 @@ int main(int argc, char **argv)
|
|||
cleanup:
|
||||
g_source_remove(signal);
|
||||
|
||||
#ifdef HAVE_ELL
|
||||
g_source_destroy((GSource *) source);
|
||||
l_main_exit();
|
||||
#endif
|
||||
g_main_loop_unref(event_loop);
|
||||
|
||||
__ofono_log_cleanup();
|
||||
|
|
Loading…
Reference in New Issue