From c9809ac05224ccf3a7fce1dda8c7eddedbbf3a56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ch=C3=AD-Thanh=20Christopher=20Nguy=E1=BB=85n?= Date: Wed, 5 Feb 2014 03:21:37 +0100 Subject: [PATCH] gsm-receiver: build against gnuradio-3.7 This is the result of blindly following http://gnuradio.org/redmine/projects/gnuradio/wiki/Move_3-6_to_3-7 The result builds, but it may or may not work. --- gsm-receiver/Makefile.common | 7 ++-- gsm-receiver/config/Makefile.am | 2 +- .../config/gr_libgnuradio_core_extra_ldflags.m4 | 40 ---------------------- .../config/gr_libgnuradio_runtime_extra_ldflags.m4 | 40 ++++++++++++++++++++++ gsm-receiver/config/gr_standalone.m4 | 5 ++- gsm-receiver/gsm-receiver.pc.in | 2 +- gsm-receiver/src/lib/gsm.i | 15 ++++++-- gsm-receiver/src/lib/gsm_receiver_cf.cc | 16 ++++----- gsm-receiver/src/lib/gsm_receiver_cf.h | 18 +++++----- 9 files changed, 76 insertions(+), 69 deletions(-) delete mode 100644 gsm-receiver/config/gr_libgnuradio_core_extra_ldflags.m4 create mode 100644 gsm-receiver/config/gr_libgnuradio_runtime_extra_ldflags.m4 diff --git a/gsm-receiver/Makefile.common b/gsm-receiver/Makefile.common index b5dcb2e..0592f70 100644 --- a/gsm-receiver/Makefile.common +++ b/gsm-receiver/Makefile.common @@ -28,7 +28,7 @@ AM_CPPFLAGS = \ $(STD_DEFINES_AND_INCLUDES) \ $(PYTHON_CPPFLAGS) \ $(CPPUNIT_INCLUDES) \ - $(GNURADIO_CORE_CPPFLAGS) + $(GNURADIO_RUNTIME_CPPFLAGS) #!! remove this TCH_DECODER_INCLUDEDIR = $(top_srcdir)/src/lib/decoder/openbtsstuff @@ -36,9 +36,8 @@ TCH_DECODER_INCLUDEDIR = $(top_srcdir)/src/lib/decoder/openbtsstuff STD_DEFINES_AND_INCLUDES = \ -I$(DECODER_INCLUDEDIR) \ -I$(MAIN_INCLUDEDIR) \ - -I$(GNURADIO_CORE_INCLUDEDIR) \ - -I$(GNURADIO_CORE_INCLUDEDIR)/swig \ - -I$(GRUEL_INCLUDEDIR)/gruel/swig \ + -I$(GNURADIO_RUNTIME_INCLUDEDIR) \ + -I$(GNURADIO_RUNTIME_INCLUDEDIR)/gnuradio/swig \ $(LIBOSMOCORE_CFLAGS) \ -I$(TCH_DECODER_INCLUDEDIR) diff --git a/gsm-receiver/config/Makefile.am b/gsm-receiver/config/Makefile.am index 5858d22..1fdc0e5 100644 --- a/gsm-receiver/config/Makefile.am +++ b/gsm-receiver/config/Makefile.am @@ -51,7 +51,7 @@ m4macros = \ gr_fortran.m4 \ gr_gprof.m4 \ gr_lib64.m4 \ - gr_libgnuradio_core_extra_ldflags.m4 \ + gr_libgnuradio_runtime_extra_ldflags.m4 \ gr_no_undefined.m4 \ gr_omnithread.m4 \ gr_pwin32.m4 \ diff --git a/gsm-receiver/config/gr_libgnuradio_core_extra_ldflags.m4 b/gsm-receiver/config/gr_libgnuradio_core_extra_ldflags.m4 deleted file mode 100644 index 43f872c..0000000 --- a/gsm-receiver/config/gr_libgnuradio_core_extra_ldflags.m4 +++ /dev/null @@ -1,40 +0,0 @@ -# Check for (MinGW)win32 extra ld options. -*- Autoconf -*- - -# Copyright 2003,2004,2005 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GNU Radio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. - -dnl -AC_DEFUN([GR_LIBGNURADIO_CORE_EXTRA_LDFLAGS], [ -AC_REQUIRE([AC_PROG_LD]) -# on Mingw32 extra LDFLAGS are required to ease global variable linking -LIBGNURADIO_CORE_EXTRA_LDFLAGS="" - -AC_MSG_CHECKING([whether $LD accepts --enable-runtime-pseudo-reloc]) -if ${LD} --enable-runtime-pseudo-reloc --version >/dev/null 2>&1 -then - # libtool requires the quotes - LIBGNURADIO_CORE_EXTRA_LDFLAGS="\"-Wl,--enable-runtime-pseudo-reloc\"" - AC_MSG_RESULT(yes) -else - AC_MSG_RESULT(no) -fi - -AC_SUBST(LIBGNURADIO_CORE_EXTRA_LDFLAGS) - -]) diff --git a/gsm-receiver/config/gr_libgnuradio_runtime_extra_ldflags.m4 b/gsm-receiver/config/gr_libgnuradio_runtime_extra_ldflags.m4 new file mode 100644 index 0000000..92e8c97 --- /dev/null +++ b/gsm-receiver/config/gr_libgnuradio_runtime_extra_ldflags.m4 @@ -0,0 +1,40 @@ +# Check for (MinGW)win32 extra ld options. -*- Autoconf -*- + +# Copyright 2003,2004,2005 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +dnl +AC_DEFUN([GR_LIBGNURADIO_RUNTIME_EXTRA_LDFLAGS], [ +AC_REQUIRE([AC_PROG_LD]) +# on Mingw32 extra LDFLAGS are required to ease global variable linking +LIBGNURADIO_RUNTIME_EXTRA_LDFLAGS="" + +AC_MSG_CHECKING([whether $LD accepts --enable-runtime-pseudo-reloc]) +if ${LD} --enable-runtime-pseudo-reloc --version >/dev/null 2>&1 +then + # libtool requires the quotes + LIBGNURADIO_RUNTIME_EXTRA_LDFLAGS="\"-Wl,--enable-runtime-pseudo-reloc\"" + AC_MSG_RESULT(yes) +else + AC_MSG_RESULT(no) +fi + +AC_SUBST(LIBGNURADIO_RUNTIME_EXTRA_LDFLAGS) + +]) diff --git a/gsm-receiver/config/gr_standalone.m4 b/gsm-receiver/config/gr_standalone.m4 index 4e097d2..14f286c 100644 --- a/gsm-receiver/config/gr_standalone.m4 +++ b/gsm-receiver/config/gr_standalone.m4 @@ -114,7 +114,6 @@ m4_define([GR_STANDALONE], AC_CHECK_PROG([XMLTO],[xmlto],[yes],[]) AM_CONDITIONAL([HAS_XMLTO], [test x$XMLTO = xyes]) - PKG_CHECK_MODULES(GNURADIO_CORE, gnuradio-core >= 3) - LIBS="$LIBS $GNURADIO_CORE_LIBS" - PKG_CHECK_MODULES(GRUEL, gruel >= 3) + PKG_CHECK_MODULES(GNURADIO_RUNTIME, gnuradio-runtime >= 3) + LIBS="$LIBS $GNURADIO_RUNTIME_LIBS" ]) diff --git a/gsm-receiver/gsm-receiver.pc.in b/gsm-receiver/gsm-receiver.pc.in index 0a18d4b..9ceca56 100644 --- a/gsm-receiver/gsm-receiver.pc.in +++ b/gsm-receiver/gsm-receiver.pc.in @@ -5,7 +5,7 @@ includedir=@includedir@ Name: gsm-receiver Description: The GSM receiver block which does FCCH burst search, sch decoding and normal burst demodulation -Requires: gnuradio-core +Requires: gnuradio-runtime Version: @VERSION@ Libs: -L${libdir} -lgsm-receiver Cflags: -I${includedir} diff --git a/gsm-receiver/src/lib/gsm.i b/gsm-receiver/src/lib/gsm.i index b3c1d81..3f58e16 100644 --- a/gsm-receiver/src/lib/gsm.i +++ b/gsm-receiver/src/lib/gsm.i @@ -37,18 +37,27 @@ #include "gsm_receiver_cf.h" #include /* #include "gsm_constants.h" */ +#include +#include +#include +#include +#include +#include +#include +#include +#include %} // ---------------------------------------------------------------- GR_SWIG_BLOCK_MAGIC(gsm,receiver_cf); -gsm_receiver_cf_sptr gsm_make_receiver_cf ( gr_feval_dd *tuner, gr_feval_dd *synchronizer, int osr, std::string key, std::string configuration); +gsm_receiver_cf_sptr gsm_make_receiver_cf ( gr::feval_dd *tuner, gr::feval_dd *synchronizer, int osr, std::string key, std::string configuration); -class gsm_receiver_cf : public gr_block +class gsm_receiver_cf : public gr::block { private: - gsm_receiver_cf ( gr_feval_dd *tuner, gr_feval_dd *synchronizer, int osr); + gsm_receiver_cf ( gr::feval_dd *tuner, gr::feval_dd *synchronizer, int osr); }; // ---------------------------------------------------------------- diff --git a/gsm-receiver/src/lib/gsm_receiver_cf.cc b/gsm-receiver/src/lib/gsm_receiver_cf.cc index b4e7a69..6bfdf5d 100644 --- a/gsm-receiver/src/lib/gsm_receiver_cf.cc +++ b/gsm-receiver/src/lib/gsm_receiver_cf.cc @@ -24,8 +24,8 @@ #include "config.h" #endif -#include -#include +#include +#include #include #include #include @@ -289,7 +289,7 @@ typedef std::vector vector_float; typedef boost::circular_buffer circular_buffer_float; gsm_receiver_cf_sptr -gsm_make_receiver_cf(gr_feval_dd *tuner, gr_feval_dd *synchronizer, int osr, std::string key, std::string configuration) +gsm_make_receiver_cf(gr::feval_dd *tuner, gr::feval_dd *synchronizer, int osr, std::string key, std::string configuration) { return gsm_receiver_cf_sptr(new gsm_receiver_cf(tuner, synchronizer, osr, key, configuration)); } @@ -302,10 +302,10 @@ static const int MAX_OUT = 1; // maximum number of output streams /* * The private constructor */ -gsm_receiver_cf::gsm_receiver_cf(gr_feval_dd *tuner, gr_feval_dd *synchronizer, int osr, std::string key, std::string configuration) - : gr_block("gsm_receiver", - gr_make_io_signature(MIN_IN, MAX_IN, sizeof(gr_complex)), - gr_make_io_signature(MIN_OUT, MAX_OUT, 142 * sizeof(float))), +gsm_receiver_cf::gsm_receiver_cf(gr::feval_dd *tuner, gr::feval_dd *synchronizer, int osr, std::string key, std::string configuration) + : gr::block("gsm_receiver", + gr::io_signature::make(MIN_IN, MAX_IN, sizeof(gr_complex)), + gr::io_signature::make(MIN_OUT, MAX_OUT, 142 * sizeof(float))), d_OSR(osr), d_chan_imp_length(CHAN_IMP_RESP_LENGTH), d_tuner(tuner), @@ -751,7 +751,7 @@ void gsm_receiver_cf::set_frequency(double freq_offset) inline float gsm_receiver_cf::compute_phase_diff(gr_complex val1, gr_complex val2) { gr_complex conjprod = val1 * conj(val2); - return gr_fast_atan2f(imag(conjprod), real(conjprod)); + return gr::fast_atan2f(imag(conjprod), real(conjprod)); } bool gsm_receiver_cf::reach_sch_burst(const int nitems) diff --git a/gsm-receiver/src/lib/gsm_receiver_cf.h b/gsm-receiver/src/lib/gsm_receiver_cf.h index 039a774..3478585 100644 --- a/gsm-receiver/src/lib/gsm_receiver_cf.h +++ b/gsm-receiver/src/lib/gsm_receiver_cf.h @@ -24,9 +24,9 @@ #include #include -#include -#include -#include +#include +#include +#include #include #include @@ -42,7 +42,7 @@ class gsm_receiver_cf; typedef boost::shared_ptr gsm_receiver_cf_sptr; typedef std::vector vector_complex; -gsm_receiver_cf_sptr gsm_make_receiver_cf(gr_feval_dd *tuner, gr_feval_dd *synchronizer, int osr, std::string key, std::string configuration); +gsm_receiver_cf_sptr gsm_make_receiver_cf(gr::feval_dd *tuner, gr::feval_dd *synchronizer, int osr, std::string key, std::string configuration); /** GSM Receiver GNU Radio block * @@ -52,7 +52,7 @@ gsm_receiver_cf_sptr gsm_make_receiver_cf(gr_feval_dd *tuner, gr_feval_dd *synch * \ingroup block */ -class gsm_receiver_cf : public gr_block +class gsm_receiver_cf : public gr::block { private: std::map d_hex_to_int; @@ -76,8 +76,8 @@ class gsm_receiver_cf : public gr_block gr_complex d_sch_training_seq[N_SYNC_BITS]; ///