From 0e60d964b3a95065b6164e5e9dd77b72a162d8f9 Mon Sep 17 00:00:00 2001 From: Aleksander Morgado Date: Wed, 17 Apr 2013 15:34:23 +0200 Subject: [PATCH] build: MBIM support is auto Use it if found, don't use it if not found. Can be explicitly requested with --with-mbim. --- configure.ac | 39 +++++++++++++++++++++++++-------------- 1 file changed, 25 insertions(+), 14 deletions(-) diff --git a/configure.ac b/configure.ac index e7826f3e..4699042f 100644 --- a/configure.ac +++ b/configure.ac @@ -171,21 +171,32 @@ case $with_tests in esac dnl -dnl MBIM support (enabled by default) +dnl MBIM support (auto by default) dnl -AC_ARG_WITH(mbim, AS_HELP_STRING([--without-mbim], [Build without MBIM support]), [], [with_mbim=yes]) -AM_CONDITIONAL(WITH_MBIM, test "x$with_mbim" = "xyes") -case $with_mbim in - yes) - PKG_CHECK_MODULES(MBIM, mbim-glib) - AC_DEFINE(WITH_MBIM, 1, [Define if you want MBIM support]) - AC_SUBST(MBIM_CFLAGS) - AC_SUBST(MBIM_LIBS) - ;; - *) - with_mbim=no - ;; -esac +AC_ARG_WITH(mbim, AS_HELP_STRING([--without-mbim], [Build without MBIM support]), [], [with_mbim=auto]) +if (test "${with_mbim}" != "no"); then + PKG_CHECK_MODULES(MBIM, + [mbim-glib], + [have_libmbim_glib=yes], + [have_libmbim_glib=no]) + AC_SUBST(MBIM_CFLAGS) + AC_SUBST(MBIM_LIBS) + + if (test "${have_libmbim_glib}" = "no"); then + if (test "${with_mbim}" = "yes"); then + AC_MSG_ERROR([Couldn't find libmbim-glib]) + else + with_mbim="no" + fi + else + with_mbim="yes" + fi +fi + +if (test "${with_mbim}" = "yes"); then + AC_DEFINE(WITH_MBIM, 1, [Define if you want MBIM support]) +fi +AM_CONDITIONAL(WITH_MBIM, test "${with_mbim}" = "yes") dnl dnl QMI support (enabled by default)