From a661bcd086064c2d7ba0eee54c8a708a7bac8ba1 Mon Sep 17 00:00:00 2001 From: Neels Hofmeyr Date: Thu, 29 Mar 2018 16:47:41 +0200 Subject: configure: fix --enable-sysmocom-dsp and --with-sysmobts flags Fix multiple problems around the sysmobts DSP access and headers: - Use the proper variable name to detect the choice: $enable_sysmocom_bts was not set anywhere and would actually be used from the current user env, if present, instead of from configure args. - Quote the $CPPFLAGS when assigning to oldCPPFLAGS and back. - When checking SYSMOBTS_INCDIR, do not allow an empty "-I" without a dir. - Ensure the --with-sysmobts path is used as an absolute path. - Error out if --with-sysmobts is paired with --disable-sysmocom-dsp. Also tweak reporting. The resulting behavior now is: ./configure --disable-sysmocom-dsp checking whether to enable direct DSP access for PDCH of sysmocom-bts... no ./configure --enable-sysmocom-dsp checking whether to enable direct DSP access for PDCH of sysmocom-bts... yes checking for sysmocom/femtobts/superfemto.h... no configure: error: sysmocom/femtobts/superfemto.h can not be found, see --with-sysmobts ./configure --disable-sysmocom-dsp --with-sysmobts=../../../sysmobts/layer1-api checking whether to enable direct DSP access for PDCH of sysmocom-bts... error configure: error: --with-sysmobts does not work with --disable-sysmocom-dsp ./configure --enable-sysmocom-dsp --with-sysmobts=../../../sysmobts/layer1-api checking whether to enable direct DSP access for PDCH of sysmocom-bts... yes, using -I/n/s/sysmobts/layer1-api checking for sysmocom/femtobts/superfemto.h... yes ./configure --with-sysmobts=../../../sysmobts/layer1-api checking whether to enable direct DSP access for PDCH of sysmocom-bts... yes, using -I/n/s/sysmobts/layer1-api checking for sysmocom/femtobts/superfemto.h... yes ./configure --with-sysmobts=/nonexisting/path checking whether to enable direct DSP access for PDCH of sysmocom-bts... yes, using -I/nonexisting/path checking for sysmocom/femtobts/superfemto.h... no configure: error: sysmocom/femtobts/superfemto.h can not be found in -I/nonexisting/path, see --with-sysmobts ./configure --with-sysmobts=/var/log checking whether to enable direct DSP access for PDCH of sysmocom-bts... yes, using -I/var/log checking for sysmocom/femtobts/superfemto.h... no configure: error: sysmocom/femtobts/superfemto.h can not be found in -I/var/log, see --with-sysmobts Change-Id: I2f5988730dbbcf3b21d8c647c499623843ed3da9 --- configure.ac | 46 ++++++++++++++++++++++++++++++++++------------ 1 file changed, 34 insertions(+), 12 deletions(-) (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index 8cddd1a6..5135c197 100644 --- a/configure.ac +++ b/configure.ac @@ -80,21 +80,43 @@ PKG_CHECK_MODULES(LIBOSMOGB, libosmogb >= 0.5.1.4) AC_MSG_CHECKING([whether to enable direct DSP access for PDCH of sysmocom-bts]) AC_ARG_ENABLE(sysmocom-dsp, - AC_HELP_STRING([--enable-sysmocom-dsp], - [enable code for sysmocom DSP [default=no]]), - [enable_sysmocom_dsp="$enableval"],[enable_sysmocom_dsp="no"]) -AC_ARG_WITH([sysmobts], [AS_HELP_STRING([--with-sysmobts=INCLUDE_DIR], [Location of the sysmobts API header files])], - [sysmobts_incdir="$withval"],[sysmobts_incdir="$incdir"]) -AC_SUBST([SYSMOBTS_INCDIR], $sysmobts_incdir) -AC_MSG_RESULT([$enable_sysmocom_dsp]) + AC_HELP_STRING([--enable-sysmocom-dsp], + [enable code for direct sysmocom DSP access[default=no]]), + [enable_sysmocom_dsp="$enableval"], [enable_sysmocom_dsp="unset"]) +AC_ARG_WITH([sysmobts], + [AS_HELP_STRING([--with-sysmobts=INCLUDE_DIR], + [Location of the sysmobts API header files, implies --enable-sysmocom-dsp])], + [sysmobts_incdir="$withval"], [sysmobts_incdir=""]) +if test "x$sysmobts_incdir" != "x"; then + # --with-sysmobts was passed, imply enable_sysmocom_dsp + if test "x$enable_sysmocom_dsp" = "xno"; then + AC_MSG_RESULT([error]) + AC_MSG_ERROR([--with-sysmobts does not work with --disable-sysmocom-dsp]) + fi + enable_sysmocom_dsp="yes" + # 'readlink' should make an absolute path, but must not return empty if the path does not exist, + # so we can still report on it below. + sysmobts_incdir="$(readlink -fm "$sysmobts_incdir")" + AC_SUBST([SYSMOBTS_INCDIR], $sysmobts_incdir) + AC_MSG_RESULT([yes, using -I$SYSMOBTS_INCDIR]) +else + AC_SUBST([SYSMOBTS_INCDIR], "") + AC_MSG_RESULT([$enable_sysmocom_dsp]) +fi AM_CONDITIONAL(ENABLE_SYSMODSP, test "x$enable_sysmocom_dsp" = "xyes") -if test "$enable_sysmocom_bts" = "yes"; then - oldCPPFLAGS=$CPPFLAGS - CPPFLAGS="$CPPFLAGS -I$SYSMOBTS_INCDIR -I$srcdir/include $LIBOSMOCORE_CFLAGS" +if test "x$enable_sysmocom_dsp" = "xyes"; then + oldCPPFLAGS="$CPPFLAGS" + _sysmobts_include="" + _sysmobts_include_msg="" + if test -n "$SYSMOBTS_INCDIR"; then + _sysmobts_include="-I$SYSMOBTS_INCDIR" + _sysmobts_include_msg=" in -I$SYSMOBTS_INCDIR" + fi + CPPFLAGS="$CPPFLAGS $_sysmobts_include -I$srcdir/include $LIBOSMOCORE_CFLAGS" AC_CHECK_HEADER([sysmocom/femtobts/superfemto.h],[], - [AC_MSG_ERROR([sysmocom/femtobts/superfemto.h can not be found in $sysmobts_incdir])], + [AC_MSG_ERROR([sysmocom/femtobts/superfemto.h can not be found$_sysmobts_include_msg, see --with-sysmobts])], [#include ]) - CPPFLAGS=$oldCPPFLAGS + CPPFLAGS="$oldCPPFLAGS" fi AC_MSG_CHECKING([whether to enable direct PHY access for PDCH of NuRAN Wireless Litecell 1.5 BTS]) -- cgit v1.2.3