summaryrefslogtreecommitdiff
path: root/gr-howto-write-a-block
diff options
context:
space:
mode:
Diffstat (limited to 'gr-howto-write-a-block')
-rw-r--r--gr-howto-write-a-block/Makefile.am2
-rw-r--r--gr-howto-write-a-block/Makefile.common10
-rw-r--r--gr-howto-write-a-block/config/Makefile.am1
-rw-r--r--gr-howto-write-a-block/config/gr_guile.m465
-rw-r--r--gr-howto-write-a-block/config/gr_scripting.m410
-rw-r--r--gr-howto-write-a-block/config/gr_set_md_cpu.m42
-rw-r--r--gr-howto-write-a-block/config/gr_swig.m432
-rw-r--r--gr-howto-write-a-block/config/pkg.m419
8 files changed, 124 insertions, 17 deletions
diff --git a/gr-howto-write-a-block/Makefile.am b/gr-howto-write-a-block/Makefile.am
index 98368c211..4ceb210ba 100644
--- a/gr-howto-write-a-block/Makefile.am
+++ b/gr-howto-write-a-block/Makefile.am
@@ -38,4 +38,4 @@ SUBDIRS = config lib swig python grc apps
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA =
-DISTCLEANFILES = gr-howto-write-a-block*.tar.gz
+DISTCLEANFILES += gr-howto-write-a-block*.tar.gz
diff --git a/gr-howto-write-a-block/Makefile.common b/gr-howto-write-a-block/Makefile.common
index cfcbce9c8..d89cbaa16 100644
--- a/gr-howto-write-a-block/Makefile.common
+++ b/gr-howto-write-a-block/Makefile.common
@@ -79,14 +79,9 @@ grc_blocksdir = $(prefix)/share/gnuradio/grc/blocks
# here have to add a -f to be like GNU make.
RM=$(RM_PROG) -f
-# Other common defines; use "+=" to add to these
-STAMPS =
-MOSTLYCLEANFILES = $(BUILT_SOURCES) $(STAMPS) *.pyc *.pyo *~ *.tmp *.loT
-
## SWIG suffixes for automake to know about
SUFFIXES = .i .scm .py
-if GUILE
# Compile a .i to what guile needs. We use -o to set the output file name,
# or even with -outdir guile in SWIG_GUILE_ARGS, swig keeps putting a
# gnuradio_core_*_wrap.cxx in the source directory.
@@ -101,7 +96,6 @@ gnuradio/%.scm : %.i
$(SED) -i -e 's/<--dummy-[0-9]\+-->/<top>/g' gnuradio/$*.scm
$(SED) -i -e 's/^(export /(export-safely /' gnuradio/$*.scm
$(RM) guile/$*.Std
-endif
# Compile a .i file to what python needs
.i.py:
@@ -113,9 +107,9 @@ endif
$(SED) -e 's|python/\(.*\)\.cc:|\1.py:|' python/$*.Std > python/$*.d
$(RM) python/$*.Std
-# Don't distribute the files defined in the variable 'no_dist_files'
+
dist-hook:
@for file in $(no_dist_files); do \
echo $(RM) $(distdir)/$$file; \
$(RM) $(distdir)/$$file; \
- done;
+ done
diff --git a/gr-howto-write-a-block/config/Makefile.am b/gr-howto-write-a-block/config/Makefile.am
index eb2ee6283..aaaf0db7c 100644
--- a/gr-howto-write-a-block/config/Makefile.am
+++ b/gr-howto-write-a-block/config/Makefile.am
@@ -51,6 +51,7 @@ m4macros = \
gr_fortran.m4 \
gr_git.m4 \
gr_gprof.m4 \
+ gr_guile.m4 \
gr_lib64.m4 \
gr_libgnuradio_core_extra_ldflags.m4 \
gr_no_undefined.m4 \
diff --git a/gr-howto-write-a-block/config/gr_guile.m4 b/gr-howto-write-a-block/config/gr_guile.m4
new file mode 100644
index 000000000..1f0793944
--- /dev/null
+++ b/gr-howto-write-a-block/config/gr_guile.m4
@@ -0,0 +1,65 @@
+dnl
+dnl Copyright 2003,2004,2005 Free Software Foundation, Inc.
+dnl
+dnl This file is part of GNU Radio
+dnl
+dnl GNU Radio is free software; you can redistribute it and/or modify
+dnl it under the terms of the GNU General Public License as published by
+dnl the Free Software Foundation; either version 3, or (at your option)
+dnl any later version.
+dnl
+dnl GNU Radio is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+dnl GNU General Public License for more details.
+dnl
+dnl You should have received a copy of the GNU General Public License
+dnl along with GNU Radio; see the file COPYING. If not, write to
+dnl the Free Software Foundation, Inc., 51 Franklin Street,
+dnl Boston, MA 02110-1301, USA.
+dnl
+
+# GUILE_DEVEL()
+#
+# Checks for Guile and tries to get the include path to 'Guile.h'.
+# It sets the $(GUILE_CPPFLAGS), $(GUILE_LDFLAGS) and $(guiledir) output variables,
+#
+AC_DEFUN([GUILE_DEVEL],[
+ dnl see if GUILE is installed
+ AC_PATH_PROG(GUILE, guile)
+ dnl get the config program
+ AC_PATH_PROG(GUILE_CONFIG, guile-config)
+ if test x${GUILE_CONFIG} != x; then
+ GUILE_CFLAGS="`${GUILE_CONFIG} compile`"
+ GUILE_LIBS="`${GUILE_CONFIG} link`"
+ GUILE_PKLIBDIR="`${GUILE_CONFIG} info pkglibdir`"
+ GUILE_PKDATADIR="`${GUILE_CONFIG} info pkgdatadir`/site"
+ else
+ GUILE_CFLAGS=""
+ GUILE_PKLIBDIR=""
+ GUILE_LIBS="Wl,-Bsymbolic-functions -lguile -lgmp -lcrypt"
+ fi
+ AC_SUBST(GUILE_CFLAGS)
+ AC_SUBST(GUILE_PKLIBDIR)
+ AC_SUBST(GUILE_PKDATADIR)
+ AC_SUBST(GUILE_LIBS)
+])
+
+# GUILE_CHECK_MODULE
+#
+# Determines if a particular Guile module can be imported
+#
+# $1 - module name
+# $2 - module description
+# $3 - action if found
+# $4 - action if not found
+# $5 - test command
+
+AC_DEFUN([GUILE_CHECK_MODULE],[
+ AC_MSG_CHECKING([for $2])
+ dnl ########################################
+ dnl # import and test checking
+ dnl ########################################
+ dnl if test x${enable_guile} = xyes; then
+ dnl fi
+])
diff --git a/gr-howto-write-a-block/config/gr_scripting.m4 b/gr-howto-write-a-block/config/gr_scripting.m4
index e030a8102..866b7e017 100644
--- a/gr-howto-write-a-block/config/gr_scripting.m4
+++ b/gr-howto-write-a-block/config/gr_scripting.m4
@@ -26,5 +26,13 @@ AC_DEFUN([GR_SCRIPTING],[
SWIG_PROG(1.3.31)
SWIG_ENABLE_CXX
- SWIG_PYTHON
+ dnl We need python at build time, as it's used as for utilities. If python
+ dnl isn't enabled, then we don't want the SWIG support for python.
+ AC_REQUIRE([AM_PATH_PYTHON])
+ if test x${enable_python} = xyes; then
+ SWIG_PYTHON
+ fi
+ if test x${enable_guile} = xyes; then
+ SWIG_GUILE
+ fi
])
diff --git a/gr-howto-write-a-block/config/gr_set_md_cpu.m4 b/gr-howto-write-a-block/config/gr_set_md_cpu.m4
index 7ebf88a66..cb5fb5aac 100644
--- a/gr-howto-write-a-block/config/gr_set_md_cpu.m4
+++ b/gr-howto-write-a-block/config/gr_set_md_cpu.m4
@@ -80,7 +80,7 @@ AC_DEFUN([GR_SET_MD_CPU],[
x86 | i[[3-7]]86) MD_CPU=x86 MD_SUBCPU=x86 ;;
x86_64) MD_CPU=x86 MD_SUBCPU=x86_64 ;;
powerpc*) MD_CPU=powerpc ;;
- arm)
+ arm*)
_FIND_ARM_ISA
if test $is_armv5 = yes; then MD_CPU=armv5;
elif test $is_armv7_a = yes; then MD_CPU=armv7_a;
diff --git a/gr-howto-write-a-block/config/gr_swig.m4 b/gr-howto-write-a-block/config/gr_swig.m4
index cdb28055c..e03390994 100644
--- a/gr-howto-write-a-block/config/gr_swig.m4
+++ b/gr-howto-write-a-block/config/gr_swig.m4
@@ -26,7 +26,7 @@ dnl
# is greater or equal to the value of the argument. It should have the format:
# N[.N[.N]] (N is a number between 0 and 999. Only the first N is mandatory.)
AC_DEFUN([SWIG_PROG],[
- AC_REQUIRE([AC_PROG_MAKE_SET])
+ AC_REQUIRE([AC_PROG_MAKE_SET])
AC_CHECK_PROG(SWIG,swig,[`which swig`])
if test -z "$SWIG" ; then
AC_MSG_ERROR([Cannot find 'swig' program. SWIG version >= $1 required])
@@ -56,9 +56,11 @@ AC_DEFUN([SWIG_PROG],[
AC_DEFUN([SWIG_ENABLE_CXX],[
AC_REQUIRE([SWIG_PROG])
AC_REQUIRE([AC_PROG_CXX])
- if test "$SWIG" != "false" ; then
+ if test x${enable_python} = xyes -o x${enable_guile} = xyes; then
+ if test "$SWIG" != "false" ; then
SWIG="$SWIG -c++"
- fi
+ fi
+ fi
])
# SWIG_PYTHON([use-shadow-classes])
@@ -83,3 +85,27 @@ dnl AC_SUBST(SWIG_PYTHON_OPT,[-python$swig_shadow])
fi
AC_SUBST(SWIG_PYTHON_CPPFLAGS,[$PYTHON_CPPFLAGS])
])
+
+AC_DEFUN([SWIG_TCL],[
+ AC_REQUIRE([SWIG_PROG])
+ AC_REQUIRE([TCL_DEVEL])
+ if test "$SWIG" != "false" ; then
+ AC_SUBST(SWIG_TCL_LIB,[-ltcl])
+dnl test ! "x$1" = "xno" && swig_shadow=" -shadow" || swig_shadow=""
+dnl AC_SUBST(SWIG_PYTHON_OPT,[-python$swig_shadow])
+ AC_SUBST(SWIG_TCL_OPT,[-tcl])
+ fi
+ AC_SUBST(SWIG_TCL_CPPFLAGS,[$TCL_CPPFLAGS])
+])
+
+AC_DEFUN([SWIG_GUILE],[
+ AC_REQUIRE([SWIG_PROG])
+ AC_REQUIRE([GUILE_DEVEL])
+ if test "$SWIG" != "false" ; then
+ AC_SUBST(SWIG_GUILE_LIB,[-lguile])
+dnl test ! "x$1" = "xno" && swig_shadow=" -shadow" || swig_shadow=""
+dnl AC_SUBST(SWIG_PYTHON_OPT,[-python$swig_shadow])
+ AC_SUBST(SWIG_GUILE_OPT,[-guile])
+ fi
+ AC_SUBST(SWIG_GUILE_CPPFLAGS,[$GUILE_CPPFLAGS])
+])
diff --git a/gr-howto-write-a-block/config/pkg.m4 b/gr-howto-write-a-block/config/pkg.m4
index 80bdfed4c..2d4d96109 100644
--- a/gr-howto-write-a-block/config/pkg.m4
+++ b/gr-howto-write-a-block/config/pkg.m4
@@ -111,8 +111,11 @@ fi[]dnl
# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
#
# --------------------------------------------------------------
-AC_DEFUN([PKG_CHECK_MODULES],
-[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
+AC_DEFUN([PKG_CHECK_MODULES],[
+AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
+AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+
AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
AC_ARG_VAR([$1][_INCLUDEDIR], [includedir for $1, overriding pkg-config])dnl
@@ -124,7 +127,17 @@ _PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
if test x$cross_compiling = xyes
then
- _PKG_CONFIG([$1][_LIBS], [libs-only-l --static], [$2])
+ dnl _PKG_CONFIG([$1][_LIBS], [libs-only-l --static], [$2])
+ _PKG_CONFIG([$1][_LIBS], [libs --static], [$2])
+ dnl prune out any -L/lib or -L/usr/lib since they're pointing to the wrong filesystem root
+ _pkg_tmp=
+ for flag in [$]pkg_cv_[$1][_LIBS]; do
+ case $flag in
+ (-L/lib* | -L/usr/lib* ) ;; # ignore
+ (*) _pkg_tmp="$_pkg_tmp $flag" ;;
+ esac
+ done
+ pkg_cv_[$1][_LIBS]="$_pkg_tmp"
else
_PKG_CONFIG([$1][_LIBS], [libs --static], [$2])
fi