diff options
author | Aleksander Morgado <aleksander@aleksander.es> | 2021-01-22 14:24:14 +0100 |
---|---|---|
committer | Aleksander Morgado <aleksander@aleksander.es> | 2021-04-14 10:35:06 +0200 |
commit | 866c1d4ab6e9cc8f629a80603ed49b9568c12b8b (patch) | |
tree | 6de0c35351f9da20807e7480620469e0d0051b95 | |
parent | da24b7d45046790fca7f4e8abb5fbbb2d7c0ac97 (diff) |
build: look for libqrtr-glib with pkg-config
The WITH_QRTR symbol in config.h will let us know both if libqrtr-glib
is found and if libqmi-glib is compiled with QRTR support (as per the
exposed "qmi_qrtr_supported" variable in pkg-config).
-rw-r--r-- | configure.ac | 37 | ||||
-rw-r--r-- | src/Makefile.am | 5 |
2 files changed, 42 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac index 5485e263..d500b093 100644 --- a/configure.ac +++ b/configure.ac @@ -422,6 +422,42 @@ case $with_qmi in esac dnl----------------------------------------------------------------------------- +dnl QRTR support (both as libqrtr-glib and libqmi-glib apis) +dnl + +LIBQRTR_VERSION=1.0.0 +PKG_CHECK_MODULES(QRTR, [qrtr-glib >= $LIBQRTR_VERSION],[have_qrtr=yes],[have_qrtr=no]) +qmi_qrtr_supported=$($PKG_CONFIG --variable=qmi_qrtr_supported qmi-glib) + +AC_ARG_WITH(qrtr, AS_HELP_STRING([--without-qrtr], [Build without QRTR support]), [], [with_qrtr=auto]) +if test "x$with_qrtr" = "xauto"; then + if test "x$qmi_qrtr_supported" = "x1" && test "x$with_qmi" = "xyes" && test "x$have_qrtr" = "xyes"; then + with_qrtr=yes + else + with_qrtr=no + fi +fi +case $with_qrtr in + yes) + if test "x$with_qmi" = "xno"; then + AC_MSG_ERROR([QRTR support requires QMI enabled. Configure using --with-qmi, or otherwise configure using --without-qrtr to disable QRTR support.]) + elif test "x$have_qrtr" = "xno"; then + AC_MSG_ERROR([Couldn't find libqrtr-glib >= $LIBQRTR_VERSION. Install it, or otherwise configure using --without-qrtr to disable QRTR support.]) + elif test "x$qmi_qrtr_supported" != "x1"; then + AC_MSG_ERROR([Couldn't find QRTR support in libqmi-glib. Install it, or otherwise configure using --without-qrtr to disable QRTR support.]) + else + AC_DEFINE(WITH_QRTR, 1, [Define if you want QRTR support]) + AC_SUBST(QRTR_CFLAGS) + AC_SUBST(QRTR_LIBS) + fi + ;; + *) + with_qrtr=no + ;; +esac +AM_CONDITIONAL(WITH_QRTR, test "x$with_qrtr" = "xyes") + +dnl----------------------------------------------------------------------------- dnl Distribution version string dnl AC_ARG_WITH(dist-version, AS_HELP_STRING([--with-dist-version=<mm-dist-version>], [Define the custom version (like distribution package name and revision)]), ac_distver=$withval, ac_distver="") @@ -592,6 +628,7 @@ echo " policykit: ${with_polkit} mbim: ${with_mbim} qmi: ${with_qmi} + qrtr: ${with_qrtr} systemd suspend/resume: ${with_systemd_suspend_resume} systemd journal: ${with_systemd_journal} at command via dbus: ${with_at_command_via_dbus} diff --git a/src/Makefile.am b/src/Makefile.am index 120503e1..c00e8ac3 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -33,6 +33,11 @@ AM_LDFLAGS = \ $(GUDEV_LIBS) \ $(NULL) +if WITH_QRTR +AM_CFLAGS += $(QRTR_CFLAGS) +AM_LDFLAGS += $(QRTR_LIBS) +endif + if WITH_QMI AM_CFLAGS += $(QMI_CFLAGS) AM_LDFLAGS += $(QMI_LIBS) |