[PATCH] osmo-pcu[master]: configure: fix --enable-sysmocom-dsp and --with-sysmobts flags

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Thu Mar 29 15:15:09 UTC 2018


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
---
M configure.ac
1 file changed, 34 insertions(+), 12 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/82/7582/2

diff --git a/configure.ac b/configure.ac
index 8cddd1a..5135c19 100644
--- a/configure.ac
+++ b/configure.ac
@@ -80,21 +80,43 @@
 
 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 <sysmocom/femtobts/superfemto.h>])
-	CPPFLAGS=$oldCPPFLAGS
+	CPPFLAGS="$oldCPPFLAGS"
 fi
 
 AC_MSG_CHECKING([whether to enable direct PHY access for PDCH of NuRAN Wireless Litecell 1.5 BTS])

-- 
To view, visit https://gerrit.osmocom.org/7582
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I2f5988730dbbcf3b21d8c647c499623843ed3da9
Gerrit-PatchSet: 2
Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder



More information about the gerrit-log mailing list