aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@aleksander.es>2016-06-06 15:38:48 +0200
committerAleksander Morgado <aleksander@aleksander.es>2016-07-07 19:18:02 +0200
commitf1f398ca7a7108dcaa4a13a60e97cb5febd17f59 (patch)
tree5fe6bb3d58f073f8dd9ba68c36f092eb6a30ad16
parent7f85b32e68431d89094f63d8926890739a886b89 (diff)
downloadexternal_libqmi-f1f398ca7a7108dcaa4a13a60e97cb5febd17f59.zip
external_libqmi-f1f398ca7a7108dcaa4a13a60e97cb5febd17f59.tar.gz
external_libqmi-f1f398ca7a7108dcaa4a13a60e97cb5febd17f59.tar.bz2
build: update `--enable-mbim-qmux' rules
If libmbim 1.14.0 found, enable QMI over MBIM support.
-rw-r--r--configure.ac21
-rw-r--r--src/libqmi-glib/qmi-device.c18
2 files changed, 25 insertions, 14 deletions
diff --git a/configure.ac b/configure.ac
index fe6225e..9b25655 100644
--- a/configure.ac
+++ b/configure.ac
@@ -96,17 +96,26 @@ fi
AM_CONDITIONAL([QMI_USERNAME_ENABLED], [test "x$QMI_USERNAME_ENABLED" = "xyes"])
# MBIM QMUX service support
+MBIM_GLIB_VERSION=1.14.0
+PKG_CHECK_MODULES([MBIM], [mbim-glib >= ${MBIM_GLIB_VERSION}], [have_mbim=yes], [have_mbim=no])
AC_ARG_ENABLE(mbim-qmux,
- AS_HELP_STRING([--enable-mbim-qmux], [support QMI over MBIM QMUX service]))
-if test -n "$enable_mbim_qmux"; then
- PKG_CHECK_MODULES(MBIM, mbim-glib >= 1.13)
- MBIM_CFLAGS="$MBIM_CFLAGS -DMBIM_QMUX"
+ AS_HELP_STRING([--enable-mbim-qmux], [Enable support for QMI over MBIM QMUX service [default=auto]]),
+ [enable_mbim_qmux=$enableval],
+ [enable_mbim_qmux=auto])
+
+if test "x$enable_mbim_qmux" = "xauto"; then
+ enable_mbim_qmux=$have_mbim
+fi
+
+if test "x$enable_mbim_qmux" = "xyes"; then
+ if test "xhave_mbim" = "xno"; then
+ AC_MSG_ERROR([Couldn't find `libmbim-glib` >= ${MBIM_GLIB_VERSION}. Install it, or otherwise configure using --disable-mbim-qmux to disable the QMI over MBIM QMUX service.])
+ fi
+ AC_DEFINE(MBIM_QMUX_ENABLED, 1, [Define if MBIM QMUX support enabled])
AC_SUBST(MBIM_CFLAGS)
AC_SUBST(MBIM_LIBS)
fi
-AM_CONDITIONAL(MBIM_QMUX, [test -n "$MBIM_CFLAGS"])
-
# udev base directory
AC_ARG_WITH(udev-base-dir, AS_HELP_STRING([--with-udev-base-dir=DIR], [where udev base directory is]))
if test -n "$with_udev_base_dir" ; then
diff --git a/src/libqmi-glib/qmi-device.c b/src/libqmi-glib/qmi-device.c
index 7479fcd..fee7004 100644
--- a/src/libqmi-glib/qmi-device.c
+++ b/src/libqmi-glib/qmi-device.c
@@ -21,6 +21,8 @@
* Copyright (C) 2012-2015 Aleksander Morgado <aleksander@aleksander.es>
*/
+#include <config.h>
+
#include <stdio.h>
#include <errno.h>
#include <string.h>
@@ -32,7 +34,7 @@
#include <gio/gunixoutputstream.h>
#include <gio/gunixsocketaddress.h>
-#ifdef MBIM_QMUX
+#if defined MBIM_QMUX_ENABLED
#include <libmbim-glib.h>
#endif
@@ -97,7 +99,7 @@ struct _QmiDevicePrivate {
gboolean no_file_check;
gchar *proxy_path;
gboolean mbim_qmux;
-#ifdef MBIM_QMUX
+#if defined MBIM_QMUX_ENABLED
MbimDevice *mbimdev;
#endif
@@ -2141,7 +2143,7 @@ internal_proxy_open_ready (QmiClientCtl *client_ctl,
device_open_context_step (ctx);
}
-#ifdef MBIM_QMUX
+#if defined MBIM_QMUX_ENABLED
static void
mbim_device_open_ready (MbimDevice *dev,
GAsyncResult *res,
@@ -2223,7 +2225,7 @@ device_open_context_step (DeviceOpenContext *ctx)
/* Fall down */
case DEVICE_OPEN_CONTEXT_STEP_CREATE_IOSTREAM:
-#ifdef MBIM_QMUX
+#if defined MBIM_QMUX_ENABLED
if (ctx->flags & QMI_DEVICE_OPEN_FLAGS_MBIM) {
GFile *file;
@@ -2441,7 +2443,7 @@ destroy_iostream (QmiDevice *self,
return TRUE;
}
-#ifdef MBIM_QMUX
+#if defined MBIM_QMUX_ENABLED
static void
mbim_device_close_ready (MbimDevice *dev,
GAsyncResult *res)
@@ -2473,7 +2475,7 @@ qmi_device_close (QmiDevice *self,
{
g_return_val_if_fail (QMI_IS_DEVICE (self), FALSE);
-#ifdef MBIM_QMUX
+#if defined MBIM_QMUX_ENABLED
if (self->priv->mbim_qmux)
mbim_device_close (self->priv->mbimdev,
15,
@@ -2490,7 +2492,7 @@ qmi_device_close (QmiDevice *self,
return TRUE;
}
-#ifdef MBIM_QMUX
+#if defined MBIM_QMUX_ENABLED
static void
mbim_device_command_ready (MbimDevice *dev,
GAsyncResult *res,
@@ -2662,7 +2664,7 @@ qmi_device_command (QmiDevice *self,
g_free (printable);
}
-#ifdef MBIM_QMUX
+#if defined MBIM_QMUX_ENABLED
/* wrap QMUX in MBIM? */
if (self->priv->mbim_qmux) {
MbimMessage *mbim;