diff options
-rw-r--r-- | config/grc_gr_uhd.m4 | 4 | ||||
-rw-r--r-- | gr-uhd/swig/Makefile.swig.gen | 10 | ||||
-rw-r--r-- | gr-uhd/swig/uhd_swig.i | 7 |
3 files changed, 20 insertions, 1 deletions
diff --git a/config/grc_gr_uhd.m4 b/config/grc_gr_uhd.m4 index 00892867d..a9404425a 100644 --- a/config/grc_gr_uhd.m4 +++ b/config/grc_gr_uhd.m4 @@ -32,6 +32,10 @@ AC_DEFUN([GRC_GR_UHD],[ UHD_CPPFLAGS="${UHD_CPPFLAGS} -I\${abs_top_srcdir}/gr-uhd/lib" AC_SUBST(UHD_CPPFLAGS) AC_SUBST(UHD_LIBS) + + # Use this to tell the Makefile whether to define + # GR_HAVE_UHD for swig. + AM_CONDITIONAL([GR_DEFINE_HAVE_UHD],[test $passed = yes]) fi AC_CONFIG_FILES([ \ diff --git a/gr-uhd/swig/Makefile.swig.gen b/gr-uhd/swig/Makefile.swig.gen index 3804461a4..f764332f2 100644 --- a/gr-uhd/swig/Makefile.swig.gen +++ b/gr-uhd/swig/Makefile.swig.gen @@ -200,7 +200,15 @@ $(DEPDIR)/uhd_swig-generate-stamp: ## Call SWIG to generate the various output files; special ## post-processing on 'mingw32' host OS for the dependency file. ## - if $(SWIG) $(STD_SWIG_PYTHON_ARGS) $(uhd_swig_swig_args) \ + +## If UHD was installed, defined GR_HAVE_UHD for swigging headers +if GR_DEFINE_HAVE_UHD + MY_SWIG_PYTHON_ARGS = $(STD_SWIG_PYTHON_ARGS) -DGR_HAVE_UHD +else + MY_SWIG_PYTHON_ARGS = $(STD_SWIG_PYTHON_ARGS) +endif + + if $(SWIG) $(MY_SWIG_PYTHON_ARGS) $(uhd_swig_swig_args) \ -MD -MF $(DEPDIR)/uhd_swig.Std \ -module uhd_swig -o uhd_swig.cc $(WHAT); then \ if test $(host_os) = mingw32; then \ diff --git a/gr-uhd/swig/uhd_swig.i b/gr-uhd/swig/uhd_swig.i index 695cf1cd2..4acf2dc83 100644 --- a/gr-uhd/swig/uhd_swig.i +++ b/gr-uhd/swig/uhd_swig.i @@ -20,6 +20,10 @@ * Boston, MA 02110-1301, USA. */ +// Defined during configure; avoids trying to locate +// header files if UHD was not installed. +#ifdef GR_HAVE_UHD + //////////////////////////////////////////////////////////////////////// // Language independent exception handler //////////////////////////////////////////////////////////////////////// @@ -104,3 +108,6 @@ GR_SWIG_BLOCK_MAGIC(uhd,single_usrp_sink) static const size_t ALL_MBOARDS = uhd::usrp::multi_usrp::ALL_MBOARDS; %} static const size_t ALL_MBOARDS; + +#endif + |