summaryrefslogtreecommitdiff
path: root/gr-howto-write-a-block
diff options
context:
space:
mode:
authorBen Reynwar2011-01-30 09:50:36 -0700
committerBen Reynwar2011-01-30 09:50:36 -0700
commitd1d4c8fd9dcf852cef9c274363182209c6761145 (patch)
tree54ddbd617c5ffffbbfc4e766f2d2281669919a73 /gr-howto-write-a-block
parentf6547e103e6cae44ff2a81b0f83675ccc897f2e9 (diff)
parent023167ca8a85ab597f9e59302733f71809a8afbd (diff)
downloadgnuradio-d1d4c8fd9dcf852cef9c274363182209c6761145.tar.gz
gnuradio-d1d4c8fd9dcf852cef9c274363182209c6761145.tar.bz2
gnuradio-d1d4c8fd9dcf852cef9c274363182209c6761145.zip
Merged upstream from next
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.common24
-rw-r--r--gr-howto-write-a-block/Makefile.swig119
-rw-r--r--gr-howto-write-a-block/Makefile.swig.gen.t234
-rwxr-xr-xgr-howto-write-a-block/config.guess18
-rwxr-xr-xgr-howto-write-a-block/config.sub76
-rw-r--r--gr-howto-write-a-block/config/Makefile.am5
-rw-r--r--gr-howto-write-a-block/config/gr_guile.m465
-rw-r--r--gr-howto-write-a-block/config/gr_pwin32.m413
-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_standalone.m426
-rw-r--r--gr-howto-write-a-block/config/gr_swig.m430
-rw-r--r--gr-howto-write-a-block/config/lf_cxx.m417
-rw-r--r--gr-howto-write-a-block/config/mkstemp.m411
-rw-r--r--gr-howto-write-a-block/config/pkg.m419
-rw-r--r--gr-howto-write-a-block/configure.ac16
-rw-r--r--gr-howto-write-a-block/lib/test_all.cc7
-rw-r--r--gr-howto-write-a-block/python/Makefile.am2
-rw-r--r--gr-howto-write-a-block/setup_guile_test_env.in140
-rw-r--r--gr-howto-write-a-block/swig/.gitignore3
-rw-r--r--gr-howto-write-a-block/swig/Makefile.am30
-rw-r--r--gr-howto-write-a-block/swig/Makefile.swig.gen252
-rw-r--r--gr-howto-write-a-block/swig/howto.i11
-rw-r--r--gr-howto-write-a-block/swig/howto.test69
-rw-r--r--gr-howto-write-a-block/swig/howto_swig.i21
-rw-r--r--gr-howto-write-a-block/swig/run_guile_tests.in14
-rw-r--r--gr-howto-write-a-block/version.sh4
28 files changed, 712 insertions, 528 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 15a521698..fca6133c1 100644
--- a/gr-howto-write-a-block/Makefile.common
+++ b/gr-howto-write-a-block/Makefile.common
@@ -20,9 +20,23 @@
# Boston, MA 02110-1301, USA.
#
+# Every Makefile starts with common vars so we can
+# consistently use +=
+BUILT_SOURCES =
+MOSTLYCLEANFILES = $(BUILT_SOURCES) $(STAMPS) *.pyc *.pyo *~ *.tmp *.loT
+CLEANFILES = guile.log
+DISTCLEANFILES =
+#EXTRA_DIST =
+STAMPS =
+
+
# The name of this "out-of-tree" module
modname = howto
+# Make rebuilds less verbose with stuff we can safely ignore
+# about GNU make only extensions.
+AUTOMAKE += -Wno-portability -Wnone
+
# these flags are used when compiling non-SWIG-wrapper files
# when going in to non-SWIG libraries
AM_CXXFLAGS = @autoconf_default_CXXFLAGS@
@@ -50,6 +64,9 @@ modincludedir = $(includedir)/$(modname)
# swig includes
swigincludedir = $(modincludedir)/swig
+# Guile scheme code ends up under here:
+guiledir = $(prefix)/share/guile/site
+
# Install this stuff in the appropriate subdirectory
# This usually ends up at:
# ${prefix}/lib/python${python_version}/site-packages/$(modname)
@@ -65,13 +82,8 @@ 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
-
-# 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/Makefile.swig b/gr-howto-write-a-block/Makefile.swig
index 9e14835e5..2ed69c6c7 100644
--- a/gr-howto-write-a-block/Makefile.swig
+++ b/gr-howto-write-a-block/Makefile.swig
@@ -1,6 +1,6 @@
# -*- Makefile -*-
#
-# Copyright 2009 Free Software Foundation, Inc.
+# Copyright 2009,2010 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -25,6 +25,11 @@
## in Makefile.am's which require SWIG wrapping / compilation.
## For just installing .i files, this Makefile is not required.
+
+## include the built Makefile.swig.gen, always the one from the srcdir
+include $(srcdir)/Makefile.swig.gen
+
+
## swig flags
## -w511 turns off keyword argument warning
## "-outdir $(builddir)" writes all generated output files to
@@ -40,14 +45,33 @@ SWIG_PYTHON_FLAGS = \
-w511 \
-outdir .
-## standard swig flags used by most components
-
STD_SWIG_PYTHON_ARGS = \
$(SWIG_PYTHON_FLAGS) \
$(STD_DEFINES_AND_INCLUDES) \
$(WITH_SWIG_INCLUDES) \
$(WITH_INCLUDES)
+# NOTE: -Linkage passive and -Linkage module don't define SWIG_init()
+SWIG_GUILE_FLAGS = \
+ -guile \
+ -scm \
+ -scmstub \
+ -package gnuradio \
+ -Linkage module \
+ -proxy \
+ -goopsprefix gr: \
+ -emit-slot-accessors \
+ -emit-setters \
+ -outdir .
+
+## standard swig flags used by most components
+
+STD_SWIG_GUILE_ARGS = \
+ $(SWIG_GUILE_FLAGS) \
+ $(STD_DEFINES_AND_INCLUDES) \
+ $(WITH_SWIG_INCLUDES) \
+ $(WITH_INCLUDES)
+
## standard SWIG LD flags for library creation
STD_SWIG_LA_LD_FLAGS = \
@@ -58,8 +82,7 @@ STD_SWIG_LA_LD_FLAGS = \
## standard SWIG library additions for library creation
-STD_SWIG_LA_LIB_ADD = \
- -lstdc++
+STD_SWIG_LA_LIB_ADD = -lstdc++
## standard SWIG CXXFLAGS
## This allows for code to be compiled with "-O1" instead of "-g -O2"
@@ -67,10 +90,85 @@ STD_SWIG_LA_LIB_ADD = \
STD_SWIG_CXX_FLAGS = @swig_CXXFLAGS@
-## SWIG suffix for automake to know about
+# We drive the dependencies off of swig_built_sources. This variable
+# ends up containing only the generated .py and/or .scm files, not the .h
+# or .cc files. This allows us to use the pattern rules defined
+# below to generate all the pieces without the parallel make
+# problems that occur when both the .py's and .cc's are in swig_built_sources.
-SUFFIXES = .i
+swig_built_sources =
+# swig_all_built_sources contains swig_built_sources plus the .cc and .h files.
+# It contains the files to remove from the distribution and the files to
+# remove for make clean.
+
+swig_all_built_sources =
+
+if PYTHON
+# Create a list of .py files based on the top level .i files.
+PYTHON_GEN = $(foreach IFILE,$(TOP_SWIG_IFILES), $(subst .i,.py,$(IFILE)))
+swig_built_sources += $(PYTHON_GEN)
+swig_all_built_sources += $(PYTHON_GEN)
+
+# Now add .h, .cc to _all_
+swig_all_built_sources += $(foreach IFILE,$(TOP_SWIG_IFILES), $(patsubst %.i,python/%.h,$(IFILE)))
+swig_all_built_sources += $(foreach IFILE,$(TOP_SWIG_IFILES), $(patsubst %.i,python/%.cc,$(IFILE)))
+endif
+
+if GUILE
+# Create a list of .scm files based on the top level .i files.
+GUILE_GEN = $(foreach IFILE,$(TOP_SWIG_IFILES), $(patsubst %.i,gnuradio/%.scm,$(IFILE)))
+swig_built_sources += $(GUILE_GEN)
+swig_all_built_sources += $(GUILE_GEN)
+
+# Now add -primitive.scm, .cc to _all_
+swig_all_built_sources += $(foreach IFILE,$(TOP_SWIG_IFILES), $(patsubst %.i,gnuradio/%-primitive.scm,$(IFILE)))
+swig_all_built_sources += $(foreach IFILE,$(TOP_SWIG_IFILES), $(patsubst %.i,guile/%.cc,$(IFILE)))
+endif
+
+# N.B. Only $(swig_built_sources), not $(swig_all_built_sources)
+BUILT_SOURCES += $(swig_built_sources)
+
+# Don't distribute any of the swig generated files
+no_dist_files = $(swig_all_built_sources)
+
+CLEANFILES += $(swig_all_built_sources)
+CLEANFILES += python/*.lo python/*.o python/*.d
+CLEANFILES += guile/*.lo guile/*.o guile/*.d
+
+
+## SWIG suffixes for automake to know about
+SUFFIXES = .i .scm .py
+
+# 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.
+gnuradio/%.scm : %.i
+ @echo "Compile .i to .scm"
+ @test -d "guile" || $(mkinstalldirs) "guile"
+ @test -d "gnuradio" || $(mkinstalldirs) "gnuradio"
+ $(SWIG) $(STD_SWIG_GUILE_ARGS) $($*_swig_args) \
+ -MD -MF guile/$*.Std \
+ -module $* -o guile/$*.cc $<
+ $(SED) -e 's|guile/\(.*\)\.cc:|gnuradio/\1.scm:|' guile/$*.Std > guile/$*.d
+ $(SED) -i -e 's/<--dummy-[0-9]\+-->/<top>/g' gnuradio/$*.scm
+ $(SED) -i -e 's/^(export /(export-safely /' gnuradio/$*.scm
+ $(RM) guile/$*.Std
+
+# Compile a .i file to what python needs
+.i.py:
+ @echo "Compile .i to .py"
+ @test -d "python" || $(mkinstalldirs) "python"
+ $(SWIG) $(STD_SWIG_PYTHON_ARGS) $($*_swig_args) \
+ -MD -MF python/$*.Std \
+ -module $* -o python/$*.cc -oh python/$*.h $<
+ $(SED) -e 's|python/\(.*\)\.cc:|\1.py:|' python/$*.Std > python/$*.d
+ $(RM) python/$*.Std
+
+## ------------------------------------------------------------------------
+## Rule that (re)generates Makefile.swig.gen using TOP_SWIG_IFILES and
+## Makefile.swig.gen.t
+##
## Create $(srcdir)/Makefile.swig.gen, containing all of the rules
## for running SWIG to generate or re-generate outputs. SWIG file
## names are to be defined in TOP_SWIG_IFILES, and must include the
@@ -108,10 +206,3 @@ generate-makefile-swig $(srcdir)/Makefile.swig.gen: $(top_srcdir)/Makefile.swig.
exit -1; \
fi;
-swig_built_sources =
-
-## include the built Makefile.swig.gen, always the one from the
-## srcdir; this must be included as the last item, because it depends
-## on variables defined above.
-
-include $(srcdir)/Makefile.swig.gen
diff --git a/gr-howto-write-a-block/Makefile.swig.gen.t b/gr-howto-write-a-block/Makefile.swig.gen.t
index 686117f83..4d37e0e21 100644
--- a/gr-howto-write-a-block/Makefile.swig.gen.t
+++ b/gr-howto-write-a-block/Makefile.swig.gen.t
@@ -25,16 +25,28 @@
## Default install locations for these files:
##
## Default location for the Python directory is:
-## ${prefix}/lib/python${python_version}/site-packages/@NAME@
+## ${prefix}/lib/python${python_version}/site-packages/[category]/@NAME@
## Default location for the Python exec directory is:
-## ${exec_prefix}/lib/python${python_version}/site-packages/@NAME@
+## ${exec_prefix}/lib/python${python_version}/site-packages/[category]/@NAME@
##
## The following can be overloaded to change the install location, but
## this has to be done in the including Makefile.am -before-
## Makefile.swig is included.
-@NAME@_pythondir = $(pythondir)/@NAME@
-@NAME@_pylibdir = $(pyexecdir)/@NAME@
+@NAME@_pythondir_category ?= gnuradio/@NAME@
+@NAME@_pylibdir_category ?= $(@NAME@_pythondir_category)
+@NAME@_pythondir = $(pythondir)/$(@NAME@_pythondir_category)
+@NAME@_pylibdir = $(pyexecdir)/$(@NAME@_pylibdir_category)
+
+# The .so libraries for the guile modules get installed whereever guile
+# is installed, usually /usr/lib/guile/gnuradio/
+# FIXME: determince whether these should be installed with gnuradio.
+@NAME@_scmlibdir = $(libdir)
+
+# The scm files for the guile modules get installed where ever guile
+# is installed, usually /usr/share/guile/site/@NAME@
+# FIXME: determince whether these should be installed with gnuradio.
+@NAME@_scmdir = $(guiledir)
## SWIG headers are always installed into the same directory.
@@ -55,23 +67,10 @@
## right thing. For more info, see <
## http://sources.redhat.com/automake/automake.html#Multiple-Outputs >
-## Stamps used to ensure parallel make does the right thing. These
-## are removed by "make clean", but otherwise unused except during the
-## parallel built. These will not be included in a tarball, because
-## the SWIG-generated files will be removed from the distribution.
-
-STAMPS += $(DEPDIR)/@NAME@-generate-*
-
## Other cleaned files: dependency files generated by SWIG or this Makefile
MOSTLYCLEANFILES += $(DEPDIR)/*.S*
-## Add the .py and .cc files to the list of SWIG built sources. The
-## .h file is sometimes built, but not always ... so that one has to
-## be added manually by the including Makefile.am .
-
-swig_built_sources += @NAME@_swig.py @NAME@_swig.cc
-
## Various SWIG variables. These can be overloaded in the including
## Makefile.am by setting the variable value there, then including
## Makefile.swig .
@@ -80,177 +79,66 @@ swig_built_sources += @NAME@_swig.py @NAME@_swig.cc
@NAME@.i \
$(@NAME@_swiginclude_headers)
+if PYTHON
@NAME@_pylib_LTLIBRARIES = \
- _@NAME@_swig.la
+ _@NAME@.la
-_@NAME@_swig_la_SOURCES = \
- @NAME@_swig.cc \
+_@NAME@_la_SOURCES = \
+ python/@NAME@.cc \
$(@NAME@_la_swig_sources)
-_@NAME@_swig_la_LIBADD = \
+@NAME@_python_PYTHON = \
+ @NAME@.py \
+ $(@NAME@_python)
+
+_@NAME@_la_LIBADD = \
$(STD_SWIG_LA_LIB_ADD) \
$(@NAME@_la_swig_libadd)
-_@NAME@_swig_la_LDFLAGS = \
+_@NAME@_la_LDFLAGS = \
$(STD_SWIG_LA_LD_FLAGS) \
$(@NAME@_la_swig_ldflags)
-_@NAME@_swig_la_CXXFLAGS = \
+_@NAME@_la_CXXFLAGS = \
$(STD_SWIG_CXX_FLAGS) \
+ -I$(top_builddir) \
$(@NAME@_la_swig_cxxflags)
-@NAME@_python_PYTHON = \
- @NAME@_swig.py \
- $(@NAME@_python)
+python/@NAME@.cc: @NAME@.py
+@NAME@.py: @NAME@.i
-## Entry rule for running SWIG
+# Include the python dependencies for this file
+-include python/@NAME@.d
-@NAME@.h @NAME@_swig.py @NAME@_swig.cc: @NAME@.i
-## This rule will get called only when MAKE decides that one of the
-## targets needs to be created or re-created, because:
-##
-## * The .i file is newer than any or all of the generated files;
-##
-## * Any or all of the .cc, .h, or .py files does not exist and is
-## needed (in the case this file is not needed, the rule for it is
-## ignored); or
-##
-## * Some SWIG-based dependecy of the .cc file isn't met and hence the
-## .cc file needs be be regenerated. Explanation: Because MAKE
-## knows how to handle dependencies for .cc files (regardless of
-## their name or extension), then the .cc file is used as a target
-## instead of the .i file -- but with the dependencies of the .i
-## file. It is this last reason why the line:
-##
-## if test -f $@; then :; else
-##
-## cannot be used in this case: If a .i file dependecy is not met,
-## then the .cc file needs to be rebuilt. But if the stamp is newer
-## than the .cc file, and the .cc file exists, then in the original
-## version (with the 'test' above) the internal MAKE call will not
-## be issued and hence the .cc file will not be rebuilt.
-##
-## Once execution gets to here, it should always proceed no matter the
-## state of a stamp (as discussed in link above). The
-## $(DEPDIR)/@NAME@-generate stuff is used to allow for parallel
-## builds to "do the right thing". The stamp has no relationship with
-## either the target files or dependency file; it is used solely for
-## the protection of multiple builds during a given call to MAKE.
-##
-## Catch signals SIGHUP (1), SIGINT (2), SIGPIPE (13), and SIGTERM
-## (15). At a caught signal, the quoted command will be issued before
-## exiting. In this case, remove any stamp, whether temporary of not.
-## The trap is valid until the process exits; the process includes all
-## commands appended via "\"s.
-##
- trap 'rm -rf $(DEPDIR)/@NAME@-generate-*' 1 2 13 15; \
-##
-## Create a temporary directory, which acts as a lock. The first
-## process to create the directory will succeed and issue the MAKE
-## command to do the actual work, while all subsequent processes will
-## fail -- leading them to wait for the first process to finish.
-##
- if mkdir $(DEPDIR)/@NAME@-generate-lock 2>/dev/null; then \
-##
-## This code is being executed by the first process to succeed in
-## creating the directory lock.
-##
-## Remove the stamp associated with this filename.
-##
- rm -f $(DEPDIR)/@NAME@-generate-stamp; \
-##
-## Tell MAKE to run the rule for creating this stamp.
-##
- $(MAKE) $(AM_MAKEFLAGS) $(DEPDIR)/@NAME@-generate-stamp WHAT=$<; \
-##
-## Now that the .cc, .h, and .py files have been (re)created from the
-## .i file, future checking of this rule during the same MAKE
-## execution will come back that the rule doesn't need to be executed
-## because none of the conditions mentioned at the start of this rule
-## will be positive. Remove the the directory lock, which frees up
-## any waiting process(es) to continue.
-##
- rmdir $(DEPDIR)/@NAME@-generate-lock; \
- else \
-##
-## This code is being executed by any follower processes while the
-## directory lock is in place.
-##
-## Wait until the first process is done, testing once per second.
-##
- while test -d $(DEPDIR)/@NAME@-generate-lock; do \
- sleep 1; \
- done; \
-##
-## Succeed if and only if the first process succeeded; exit this
-## process returning the status of the generated stamp.
-##
- test -f $(DEPDIR)/@NAME@-generate-stamp; \
- exit $$?; \
- fi;
+endif # end of if python
-$(DEPDIR)/@NAME@-generate-stamp:
-## This rule will be called only by the first process issuing the
-## above rule to succeed in creating the lock directory, after
-## removing the actual stamp file in order to guarantee that MAKE will
-## execute this rule.
-##
-## 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) $(@NAME@_swig_args) \
- -MD -MF $(DEPDIR)/@NAME@.Std \
- -module @NAME@_swig -o @NAME@_swig.cc $(WHAT); then \
- if test $(host_os) = mingw32; then \
- $(RM) $(DEPDIR)/@NAME@.Sd; \
- $(SED) 's,\\\\,/,g' < $(DEPDIR)/@NAME@.Std \
- > $(DEPDIR)/@NAME@.Sd; \
- $(RM) $(DEPDIR)/@NAME@.Std; \
- $(MV) $(DEPDIR)/@NAME@.Sd $(DEPDIR)/@NAME@.Std; \
- fi; \
- else \
- $(RM) $(DEPDIR)/@NAME@.S*; exit 1; \
- fi;
-##
-## Mess with the SWIG output .Std dependency file, to create a
-## dependecy file valid for the input .i file: Basically, simulate the
-## dependency file created for libraries by GNU's libtool for C++,
-## where all of the dependencies for the target are first listed, then
-## each individual dependency is listed as a target with no further
-## dependencies.
-##
-## (1) remove the current dependency file
-##
- $(RM) $(DEPDIR)/@NAME@.d
-##
-## (2) Copy the whole SWIG file:
-##
- cp $(DEPDIR)/@NAME@.Std $(DEPDIR)/@NAME@.d
-##
-## (3) all a carriage return to the end of the dependency file.
-##
- echo "" >> $(DEPDIR)/@NAME@.d
-##
-## (4) from the SWIG file, remove the first line (the target); remove
-## trailing " \" and " " from each line. Append ":" to each line,
-## followed by 2 carriage returns, then append this to the end of
-## the dependency file.
-##
- $(SED) -e '1d;s, \\,,g;s, ,,g' < $(DEPDIR)/@NAME@.Std | \
- awk '{ printf "%s:\n\n", $$0 }' >> $(DEPDIR)/@NAME@.d
-##
-## (5) remove the SWIG-generated file
-##
- $(RM) $(DEPDIR)/@NAME@.Std
-##
-## Create the stamp for this filename generation, to signal success in
-## executing this rule; allows other threads waiting on this process
-## to continue.
-##
- touch $(DEPDIR)/@NAME@-generate-stamp
+if GUILE
+
+@NAME@_scmlib_LTLIBRARIES = \
+ libguile-gnuradio-@NAME@.la
+libguile_gnuradio_@NAME@_la_SOURCES = \
+ guile/@NAME@.cc \
+ $(@NAME@_la_swig_sources)
+nobase_@NAME@_scm_DATA = \
+ gnuradio/@NAME@.scm \
+ gnuradio/@NAME@-primitive.scm
+libguile_gnuradio_@NAME@_la_LIBADD = \
+ $(STD_SWIG_LA_LIB_ADD) \
+ $(@NAME@_la_swig_libadd)
+libguile_gnuradio_@NAME@_la_LDFLAGS = \
+ $(STD_SWIG_LA_LD_FLAGS) \
+ $(@NAME@_la_swig_ldflags)
+libguile_gnuradio_@NAME@_la_CXXFLAGS = \
+ $(STD_SWIG_CXX_FLAGS) \
+ -I$(top_builddir) \
+ $(@NAME@_la_swig_cxxflags)
+
+guile/@NAME@.cc: gnuradio/@NAME@.scm
+gnuradio/@NAME@.scm: @NAME@.i
+gnuradio/@NAME@-primitive.scm: gnuradio/@NAME@.scm
+
+# Include the guile dependencies for this file
+-include guile/@NAME@.d
-# KLUDGE: Force runtime include of a SWIG dependency file. This is
-# not guaranteed to be portable, but will probably work. If it works,
-# we have accurate dependencies for our swig stuff, which is good.
+endif # end of GUILE
-@am__include@ @am__quote@./$(DEPDIR)/@NAME@.d@am__quote@
diff --git a/gr-howto-write-a-block/config.guess b/gr-howto-write-a-block/config.guess
index 285237846..dc84c68ef 100755
--- a/gr-howto-write-a-block/config.guess
+++ b/gr-howto-write-a-block/config.guess
@@ -1,10 +1,10 @@
#! /bin/sh
# Attempt to guess a canonical system name.
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
# Free Software Foundation, Inc.
-timestamp='2010-08-21'
+timestamp='2009-11-20'
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
@@ -56,9 +56,8 @@ version="\
GNU config.guess ($timestamp)
Originally written by Per Bothner.
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free
-Software Foundation, Inc.
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
+2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -92,7 +91,7 @@ if test $# != 0; then
exit 1
fi
-trap 'exit 1' HUP INT TERM
+trap 'exit 1' 1 2 15
# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
# compiler to aid in system detection is discouraged as it requires
@@ -106,7 +105,7 @@ trap 'exit 1' HUP INT TERM
set_cc_for_build='
trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
-trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" HUP INT PIPE TERM ;
+trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
: ${TMPDIR=/tmp} ;
{ tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
{ test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
@@ -552,7 +551,7 @@ EOF
echo rs6000-ibm-aix3.2
fi
exit ;;
- *:AIX:*:[4567])
+ *:AIX:*:[456])
IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
IBM_ARCH=rs6000
@@ -968,9 +967,6 @@ EOF
sparc:Linux:*:* | sparc64:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
- tile*:Linux:*:*)
- echo ${UNAME_MACHINE}-tilera-linux-gnu
- exit ;;
vax:Linux:*:*)
echo ${UNAME_MACHINE}-dec-linux-gnu
exit ;;
diff --git a/gr-howto-write-a-block/config.sub b/gr-howto-write-a-block/config.sub
index 320e30388..2a55a5075 100755
--- a/gr-howto-write-a-block/config.sub
+++ b/gr-howto-write-a-block/config.sub
@@ -1,10 +1,10 @@
#! /bin/sh
# Configuration validation subroutine script.
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
# Free Software Foundation, Inc.
-timestamp='2010-09-11'
+timestamp='2009-11-20'
# This file is (in principle) common to ALL GNU software.
# The presence of a machine in this file suggests that SOME GNU software
@@ -75,9 +75,8 @@ Report bugs and patches to <config-patches@gnu.org>."
version="\
GNU config.sub ($timestamp)
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free
-Software Foundation, Inc.
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
+2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -124,9 +123,8 @@ esac
# Here we must recognize all the valid KERNEL-OS combinations.
maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
case $maybe_os in
- nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
- linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
- knetbsd*-gnu* | netbsd*-gnu* | \
+ nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \
+ uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \
kopensolaris*-gnu* | \
storm-chaos* | os2-emx* | rtmk-nova*)
os=-$maybe_os
@@ -283,7 +281,6 @@ case $basic_machine in
| moxie \
| mt \
| msp430 \
- | nds32 | nds32le | nds32be \
| nios | nios2 \
| ns16k | ns32k \
| or32 \
@@ -297,7 +294,7 @@ case $basic_machine in
| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
| sparcv8 | sparcv9 | sparcv9b | sparcv9v \
| spu | strongarm \
- | tahoe | thumb | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
+ | tahoe | thumb | tic4x | tic80 | tron \
| ubicom32 \
| v850 | v850e \
| we32k \
@@ -305,15 +302,6 @@ case $basic_machine in
| z8k | z80)
basic_machine=$basic_machine-unknown
;;
- c54x)
- basic_machine=tic54x-unknown
- ;;
- c55x)
- basic_machine=tic55x-unknown
- ;;
- c6x)
- basic_machine=tic6x-unknown
- ;;
m6811 | m68hc11 | m6812 | m68hc12 | picochip)
# Motorola 68HC11/12.
basic_machine=$basic_machine-unknown
@@ -345,7 +333,7 @@ case $basic_machine in
| arm-* | armbe-* | armle-* | armeb-* | armv*-* \
| avr-* | avr32-* \
| bfin-* | bs2000-* \
- | c[123]* | c30-* | [cjt]90-* | c4x-* \
+ | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
| clipper-* | craynv-* | cydra-* \
| d10v-* | d30v-* | dlx-* \
| elxsi-* \
@@ -379,7 +367,6 @@ case $basic_machine in
| mmix-* \
| mt-* \
| msp430-* \
- | nds32-* | nds32le-* | nds32be-* \
| nios-* | nios2-* \
| none-* | np1-* | ns16k-* | ns32k-* \
| orion-* \
@@ -393,8 +380,7 @@ case $basic_machine in
| sparclite-* \
| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \
| tahoe-* | thumb-* \
- | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
- | tile-* | tilegx-* \
+ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* | tile-* \
| tron-* \
| ubicom32-* \
| v850-* | v850e-* | vax-* \
@@ -494,15 +480,6 @@ case $basic_machine in
basic_machine=powerpc-ibm
os=-cnk
;;
- c54x-*)
- basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- c55x-*)
- basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- c6x-*)
- basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
c90)
basic_machine=c90-cray
os=-unicos
@@ -862,12 +839,6 @@ case $basic_machine in
np1)
basic_machine=np1-gould
;;
- neo-tandem)
- basic_machine=neo-tandem
- ;;
- nse-tandem)
- basic_machine=nse-tandem
- ;;
nsr-tandem)
basic_machine=nsr-tandem
;;
@@ -1102,10 +1073,17 @@ case $basic_machine in
basic_machine=t90-cray
os=-unicos
;;
- # This must be matched before tile*.
- tilegx*)
- basic_machine=tilegx-unknown
- os=-linux-gnu
+ tic54x | c54x*)
+ basic_machine=tic54x-unknown
+ os=-coff
+ ;;
+ tic55x | c55x*)
+ basic_machine=tic55x-unknown
+ os=-coff
+ ;;
+ tic6x | c6x*)
+ basic_machine=tic6x-unknown
+ os=-coff
;;
tile*)
basic_machine=tile-unknown
@@ -1316,8 +1294,7 @@ case $os in
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
| -chorusos* | -chorusrdb* | -cegcc* \
| -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
- | -mingw32* | -linux-gnu* | -linux-android* \
- | -linux-newlib* | -linux-uclibc* \
+ | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \
| -uxpv* | -beos* | -mpeix* | -udk* \
| -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
| -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
@@ -1458,8 +1435,6 @@ case $os in
-dicos*)
os=-dicos
;;
- -nacl*)
- ;;
-none)
;;
*)
@@ -1500,15 +1475,6 @@ case $basic_machine in
c4x-* | tic4x-*)
os=-coff
;;
- tic54x-*)
- os=-coff
- ;;
- tic55x-*)
- os=-coff
- ;;
- tic6x-*)
- os=-coff
- ;;
# This must come before the *-dec entry.
pdp10-*)
os=-tops20
diff --git a/gr-howto-write-a-block/config/Makefile.am b/gr-howto-write-a-block/config/Makefile.am
index 23f4a4b16..aaaf0db7c 100644
--- a/gr-howto-write-a-block/config/Makefile.am
+++ b/gr-howto-write-a-block/config/Makefile.am
@@ -1,5 +1,5 @@
#
-# Copyright 2001 Free Software Foundation, Inc.
+# Copyright 2001,2010 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -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 \
@@ -80,4 +81,4 @@ m4macros = \
# Don't install m4 macros anymore
# m4data_DATA = $(m4macros)
-EXTRA_DIST = $(m4macros)
+EXTRA_DIST = $(m4macros)
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_pwin32.m4 b/gr-howto-write-a-block/config/gr_pwin32.m4
index 495e9dd4d..6b27b439f 100644
--- a/gr-howto-write-a-block/config/gr_pwin32.m4
+++ b/gr-howto-write-a-block/config/gr_pwin32.m4
@@ -1,6 +1,6 @@
# Check for (mingw)win32 POSIX replacements. -*- Autoconf -*-
-# Copyright 2003,2004,2005 Free Software Foundation, Inc.
+# Copyright 2003,2004,2005,2011 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -61,17 +61,6 @@ AC_TRY_LINK([ #include <windows.h>
AC_MSG_RESULT(no)
)
-dnl Under Win32, mkdir prototype in io.h has only one arg
-AC_MSG_CHECKING(whether mkdir accepts only one arg)
-AC_TRY_COMPILE([#include <sys/types.h>
- #include <sys/stat.h>
- #include <fcntl.h>], [
- mkdir("")
- ], [ AC_MSG_RESULT(yes)
- AC_DEFINE(MKDIR_TAKES_ONE_ARG,[],[Define if mkdir accepts only one arg]) ],
- [ AC_MSG_RESULT(no)
- ])
-
AH_BOTTOM(
[
/* Define missing prototypes, implemented in replacement lib */
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_standalone.m4 b/gr-howto-write-a-block/config/gr_standalone.m4
index 3f8ddf1d6..beb98204c 100644
--- a/gr-howto-write-a-block/config/gr_standalone.m4
+++ b/gr-howto-write-a-block/config/gr_standalone.m4
@@ -1,5 +1,5 @@
dnl
-dnl Copyright 2008,2009 Free Software Foundation, Inc.
+dnl Copyright 2008,2009,2010 Free Software Foundation, Inc.
dnl
dnl This file is part of GNU Radio
dnl
@@ -111,6 +111,11 @@ m4_define([GR_STANDALONE],
PKG_CHECK_MODULES(GNURADIO_CORE, gnuradio-core >= 3)
LIBS="$LIBS $GNURADIO_CORE_LIBS"
+ gnuradio_core_GUILE_LOAD_PATH="`pkg-config --variable=guile_load_path gnuradio-core`"
+ gnuradio_core_LIBDIRPATH="`pkg-config --variable=libdir gnuradio-core`"
+ AC_SUBST(gnuradio_core_GUILE_LOAD_PATH)
+ AC_SUBST(gnuradio_core_LIBDIRPATH)
+
dnl Allow user to choose whether to generate SWIG/Python
dnl Default is enabled
AC_ARG_ENABLE([python],
@@ -125,6 +130,25 @@ m4_define([GR_STANDALONE],
)
AM_CONDITIONAL([PYTHON], [test x$enable_python = xyes])
+ dnl Allow user to choose whether to generate SWIG/Guile
+ dnl Default is disabled
+ AC_ARG_ENABLE([guile],
+ [AS_HELP_STRING([--enable-guile],
+ [generate SWIG/Guile components (default is no)])],
+ [case "${enableval}" in
+ yes) enable_guile=yes ;;
+ no) enable_guile=no ;;
+ *) AC_MSG_ERROR([bad value ${enableval} for --enable-guile]) ;;
+ esac],
+ [enable_guile=no]
+ )
+ AM_CONDITIONAL([GUILE], [test x$enable_guile = xyes])
+
+ dnl see if GUILE is installed
+ if test x${enable_guile} == xyes; then
+ AC_PATH_PROG(GUILE,guile)
+ fi
+
dnl Define where to look for cppunit includes and libs
dnl sets CPPUNIT_CFLAGS and CPPUNIT_LIBS
dnl Try using pkg-config first, then fall back to cppunit-config.
diff --git a/gr-howto-write-a-block/config/gr_swig.m4 b/gr-howto-write-a-block/config/gr_swig.m4
index cdb28055c..dcc2e72dc 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,9 @@ 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 "$SWIG" != "false" ; then
SWIG="$SWIG -c++"
- fi
+ fi
])
# SWIG_PYTHON([use-shadow-classes])
@@ -83,3 +83,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/lf_cxx.m4 b/gr-howto-write-a-block/config/lf_cxx.m4
index dfc6bfbfe..7cce5f8a4 100644
--- a/gr-howto-write-a-block/config/lf_cxx.m4
+++ b/gr-howto-write-a-block/config/lf_cxx.m4
@@ -46,22 +46,5 @@ AC_DEFUN([LF_CXX_PORTABILITY],[
dnl Check for common C++ portability problems
dnl
- dnl AC_LANG_PUSH
- dnl AC_LANG_CPLUSPLUS
- AC_LANG_SAVE
- AC_LANG_CPLUSPLUS
-
-
- dnl Test whether C++ has std::isnan
- AC_MSG_CHECKING(whether C++ has std::isnan)
- AC_TRY_COMPILE([#include <cmath>], [
- std::isnan(0);
-], [ AC_MSG_RESULT(yes)
- AC_DEFINE(CXX_HAS_STD_ISNAN,[],[Define if has std::isnan]) ],
- [ AC_MSG_RESULT(no) ])
-
- dnl Done with the portability checks
- dnl AC_LANG_POP([C++])
- AC_LANG_RESTORE
])
diff --git a/gr-howto-write-a-block/config/mkstemp.m4 b/gr-howto-write-a-block/config/mkstemp.m4
index 4af0f0a9b..2d1fbee9b 100644
--- a/gr-howto-write-a-block/config/mkstemp.m4
+++ b/gr-howto-write-a-block/config/mkstemp.m4
@@ -75,15 +75,4 @@ AC_DEFUN([jm_PREREQ_TEMPNAME],
AC_CHECK_FUNCS(__secure_getenv gettimeofday lstat)
AC_CHECK_DECLS_ONCE(getenv)
# AC_REQUIRE([jm_AC_TYPE_UINTMAX_T])
-
- dnl Under Win32, mkdir prototype in io.h has only one arg
- AC_MSG_CHECKING(whether mkdir accepts only one arg)
- AC_TRY_COMPILE([#include <sys/types.h>
- #include <sys/stat.h>
- #include <fcntl.h>], [
- mkdir("")
- ], [ AC_MSG_RESULT(yes)
- AC_DEFINE(MKDIR_TAKES_ONE_ARG,[],[Define if mkdir accepts only one arg]) ],
- [ AC_MSG_RESULT(no)
- ])
])
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
diff --git a/gr-howto-write-a-block/configure.ac b/gr-howto-write-a-block/configure.ac
index 52c4639bb..ef5c98eeb 100644
--- a/gr-howto-write-a-block/configure.ac
+++ b/gr-howto-write-a-block/configure.ac
@@ -1,5 +1,5 @@
dnl
-dnl Copyright 2004,2005,2007,2008,2009 Free Software Foundation, Inc.
+dnl Copyright 2004,2005,2007,2008,2009,2010 Free Software Foundation, Inc.
dnl
dnl This file is part of GNU Radio
dnl
@@ -24,6 +24,12 @@ AC_INIT
AC_PREREQ(2.57)
AC_CONFIG_AUX_DIR([.])
+dnl Set the prefix to the default when --prefix is not specified.
+dnl This is critical for variable substitutions in the configure.
+if test "${prefix}" = "NONE"; then
+ prefix=${ac_default_prefix}
+fi
+
AC_CANONICAL_BUILD
AC_CANONICAL_HOST
AC_CANONICAL_TARGET
@@ -71,6 +77,7 @@ dnl AX_BOOST_WSERIALIZATION
AC_CONFIG_FILES([\
Makefile \
+ setup_guile_test_env \
apps/Makefile \
config/Makefile \
grc/Makefile \
@@ -78,10 +85,15 @@ AC_CONFIG_FILES([\
python/Makefile \
python/run_tests \
swig/Makefile \
+ swig/run_guile_tests \
])
dnl run_tests is created from run_tests.in. Make it executable.
-AC_CONFIG_COMMANDS([run_tests], [chmod +x python/run_tests])
+AC_CONFIG_COMMANDS([run_tests],
+ [
+ chmod +x python/run_tests
+ chmod +x swig/run_guile_tests
+ ])
AC_OUTPUT
diff --git a/gr-howto-write-a-block/lib/test_all.cc b/gr-howto-write-a-block/lib/test_all.cc
index ac1e83839..c12958691 100644
--- a/gr-howto-write-a-block/lib/test_all.cc
+++ b/gr-howto-write-a-block/lib/test_all.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2009,2010 Free Software Foundation, Inc.
+ * Copyright 2009,2010,2011 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -29,11 +29,8 @@
int
main (int argc, char **argv)
{
- char path[200];
- get_unittest_path ("gr_howto_write_a_block.xml", path, 200);
-
CppUnit::TextTestRunner runner;
- std::ofstream xmlfile(path);
+ std::ofstream xmlfile(get_unittest_path("gr_howto_write_a_block.xml").c_str());
CppUnit::XmlOutputter *xmlout = new CppUnit::XmlOutputter(&runner.result(), xmlfile);
runner.addTest(qa_howto::suite ());
diff --git a/gr-howto-write-a-block/python/Makefile.am b/gr-howto-write-a-block/python/Makefile.am
index ae36ea665..c216cca29 100644
--- a/gr-howto-write-a-block/python/Makefile.am
+++ b/gr-howto-write-a-block/python/Makefile.am
@@ -21,8 +21,8 @@
include $(top_srcdir)/Makefile.common
-EXTRA_DIST = run_tests.in
TESTS = run_tests
+EXTRA_DIST = run_tests.in
modpython_PYTHON = \
__init__.py
diff --git a/gr-howto-write-a-block/setup_guile_test_env.in b/gr-howto-write-a-block/setup_guile_test_env.in
new file mode 100644
index 000000000..3437fab44
--- /dev/null
+++ b/gr-howto-write-a-block/setup_guile_test_env.in
@@ -0,0 +1,140 @@
+#
+# Copyright 2010 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 this program. If not, see <http://www.gnu.org/licenses/>.
+#
+
+# This is sourced by run_guile_tests to establish the environment
+# variables required to run the tests in the build tree.
+
+# add_local_paths is the only "public" function in this file
+
+# 1st argument is absolute path to hand coded guile source directory
+# 2nd argument is absolute path to component C++ shared library build directory
+# 3nd argument is absolute path to component SWIG build directory
+
+add_local_paths() {
+ if [ $# -ne 3 ]
+ then
+ echo "$0: requires 3 args" 1>&2
+ exit 1
+ fi
+
+ # Add local dirs to the front
+ prepend_to_guile_load_path "$1"
+ prepend_to_libpath "$2/.libs"
+ [ "$2" != "$3" ] && prepend_to_libpath "$3/.libs"
+ prepend_to_guile_load_path "$3"
+}
+
+# ------------------------------------------------------------------------
+
+abs_top_srcdir=@abs_top_srcdir@
+abs_top_builddir=@abs_top_builddir@
+
+# usage: prepend <path-varname> <dir>
+prepend() {
+ if [ $# -ne 2 ]
+ then
+ echo "$0: prepend needs 2 args" 1>&2
+ exit 1
+ fi
+ local path="$1" dir="$2" contents=""
+ eval "contents=\$$path"
+ if [ "$dir" != "" ]
+ then
+ if [ "$contents" = "" ]
+ then
+ eval "$path=\"$dir\""
+ else
+ eval "$path=\"$dir:$contents\""
+ fi
+ fi
+ #echo end-of-prepend: $path=${!path}
+}
+
+# usage: append <path-varname> <dir>
+append() {
+ if [ $# -ne 2 ]
+ then
+ echo "$0: append needs 2 args" 1>&2
+ exit 1
+ fi
+ local path="$1" dir="$2" contents=""
+ eval "contents=\$$path"
+ if [ "$dir" != "" ]
+ then
+ if [ "$contents" = "" ]
+ then
+ eval "$path=\"$dir\""
+ else
+ eval "$path=\"$contents:$dir\""
+ fi
+ fi
+ #echo end-of-append: $path=${!path}
+}
+
+prepend_to_guile_load_path() {
+ prepend GUILE_LOAD_PATH "$1"
+ export GUILE_LOAD_PATH
+}
+
+append_to_guile_load_path() {
+ append GUILE_LOAD_PATH "$1"
+ export GUILE_LOAD_PATH
+}
+
+prepend_to_libpath() {
+ prepend LTDL_LIBRARY_PATH "$1"
+ export LTDL_LIBRARY_PATH
+ case "@host_os@" in
+ darwin*)
+ prepend DYLD_LIBRARY_PATH "$1"
+ export DYLD_LIBRARY_PATH
+ ;;
+ cygwin*|win*|mingw*)
+ prepend PATH "$1"
+ export PATH
+ ;;
+ esac
+}
+
+append_to_libpath() {
+ append LTDL_LIBRARY_PATH "$1"
+ export LTDL_LIBRARY_PATH
+ case "@host_os@" in
+ darwin*)
+ append DYLD_LIBRARY_PATH "$1"
+ export DYLD_LIBRARY_PATH
+ ;;
+ cygwin*|win*|mingw*)
+ append PATH "$1"
+ export PATH
+ ;;
+ esac
+}
+
+# ------------------------------------------------------------------------
+# Start with gnuradio_core_LIBDIRPATH and gnuradio_core_GUILE_LOAD_PATH
+# ------------------------------------------------------------------------
+
+# Where to search for gnuradio-core shared libraries
+prepend_to_libpath @gnuradio_core_LIBDIRPATH@
+
+# Where to seach for gnuradio-core guile code
+prepend_to_guile_load_path @gnuradio_core_GUILE_LOAD_PATH@
+
+export GUILE_WARN_DEPRECATED=no
diff --git a/gr-howto-write-a-block/swig/.gitignore b/gr-howto-write-a-block/swig/.gitignore
index 7f4c478d9..696b1ae84 100644
--- a/gr-howto-write-a-block/swig/.gitignore
+++ b/gr-howto-write-a-block/swig/.gitignore
@@ -4,3 +4,6 @@
/Makefile
/howto_swig.cc
/howto_swig.py
+/gnuradio
+/guile
+/python
diff --git a/gr-howto-write-a-block/swig/Makefile.am b/gr-howto-write-a-block/swig/Makefile.am
index 4737ad619..ba660f1b3 100644
--- a/gr-howto-write-a-block/swig/Makefile.am
+++ b/gr-howto-write-a-block/swig/Makefile.am
@@ -20,35 +20,37 @@
#
include $(top_srcdir)/Makefile.common
+include $(top_srcdir)/Makefile.swig
+
+noinst_GUILE = howto.test
-AM_CPPFLAGS += -I$(top_srcdir)/lib
+AM_CPPFLAGS += -I$(top_srcdir)/lib
-if PYTHON
###################################
-# SWIG Python interface and library
+# SWIG interfaces and libraries
TOP_SWIG_IFILES = \
- howto.i
+ howto_swig.i
# Install so that they end up available as:
# import howto
# This ends up at:
# ${prefix}/lib/python${python_version}/site-packages/$(modname)
-
-howto_la_swig_libadd = \
+howto_swig_la_swig_libadd = \
$(top_builddir)/lib/libgnuradio-howto.la
-include $(top_srcdir)/Makefile.swig
-
-# add some of the variables generated inside the Makefile.swig.gen
-BUILT_SOURCES = $(swig_built_sources)
-
-# Do not distribute the output of SWIG
-no_dist_files = $(swig_built_sources)
-
# additional SWIG files to be installed
howto_swiginclude_headers = \
howto_square_ff.i \
howto_square2_ff.i
+EXTRA_DIST = $(howto_swiginclude_headers)
+
+
+if GUILE
+TESTS = run_guile_tests
+EXTRA_DIST += $(nobase_guile_DATA)
+
+nobase_guile_DATA = \
+ gnuradio/howto.scm
endif
diff --git a/gr-howto-write-a-block/swig/Makefile.swig.gen b/gr-howto-write-a-block/swig/Makefile.swig.gen
index 6c6e66290..310cfb8da 100644
--- a/gr-howto-write-a-block/swig/Makefile.swig.gen
+++ b/gr-howto-write-a-block/swig/Makefile.swig.gen
@@ -20,25 +20,37 @@
# Boston, MA 02110-1301, USA.
#
-# Makefile.swig.gen for howto.i
+# Makefile.swig.gen for howto_swig.i
## Default install locations for these files:
##
## Default location for the Python directory is:
-## ${prefix}/lib/python${python_version}/site-packages/howto
+## ${prefix}/lib/python${python_version}/site-packages/[category]/howto_swig
## Default location for the Python exec directory is:
-## ${exec_prefix}/lib/python${python_version}/site-packages/howto
+## ${exec_prefix}/lib/python${python_version}/site-packages/[category]/howto_swig
##
## The following can be overloaded to change the install location, but
## this has to be done in the including Makefile.am -before-
## Makefile.swig is included.
-howto_pythondir = $(pythondir)/howto
-howto_pylibdir = $(pyexecdir)/howto
+howto_swig_pythondir_category ?= gnuradio/howto_swig
+howto_swig_pylibdir_category ?= $(howto_swig_pythondir_category)
+howto_swig_pythondir = $(pythondir)/$(howto_swig_pythondir_category)
+howto_swig_pylibdir = $(pyexecdir)/$(howto_swig_pylibdir_category)
+
+# The .so libraries for the guile modules get installed whereever guile
+# is installed, usually /usr/lib/guile/gnuradio/
+# FIXME: determince whether these should be installed with gnuradio.
+howto_swig_scmlibdir = $(libdir)
+
+# The scm files for the guile modules get installed where ever guile
+# is installed, usually /usr/share/guile/site/howto_swig
+# FIXME: determince whether these should be installed with gnuradio.
+howto_swig_scmdir = $(guiledir)
## SWIG headers are always installed into the same directory.
-howto_swigincludedir = $(swigincludedir)
+howto_swig_swigincludedir = $(swigincludedir)
## This is a template file for a "generated" Makefile addition (in
## this case, "Makefile.swig.gen"). By including the top-level
@@ -55,203 +67,79 @@ howto_swigincludedir = $(swigincludedir)
## right thing. For more info, see <
## http://sources.redhat.com/automake/automake.html#Multiple-Outputs >
-## Stamps used to ensure parallel make does the right thing. These
-## are removed by "make clean", but otherwise unused except during the
-## parallel built. These will not be included in a tarball, because
-## the SWIG-generated files will be removed from the distribution.
-
-STAMPS += $(DEPDIR)/howto-generate-*
-
## Other cleaned files: dependency files generated by SWIG or this Makefile
MOSTLYCLEANFILES += $(DEPDIR)/*.S*
-## Add the .py and .cc files to the list of SWIG built sources. The
-## .h file is sometimes built, but not always ... so that one has to
-## be added manually by the including Makefile.am .
-
-swig_built_sources += howto_swig.py howto_swig.cc
-
## Various SWIG variables. These can be overloaded in the including
## Makefile.am by setting the variable value there, then including
## Makefile.swig .
-howto_swiginclude_HEADERS = \
- howto.i \
- $(howto_swiginclude_headers)
+howto_swig_swiginclude_HEADERS = \
+ howto_swig.i \
+ $(howto_swig_swiginclude_headers)
-howto_pylib_LTLIBRARIES = \
+if PYTHON
+howto_swig_pylib_LTLIBRARIES = \
_howto_swig.la
-_howto_swig_la_SOURCES = \
- howto_swig.cc \
- $(howto_la_swig_sources)
+_howto_swig_la_SOURCES = \
+ python/howto_swig.cc \
+ $(howto_swig_la_swig_sources)
-_howto_swig_la_LIBADD = \
+howto_swig_python_PYTHON = \
+ howto_swig.py \
+ $(howto_swig_python)
+
+_howto_swig_la_LIBADD = \
$(STD_SWIG_LA_LIB_ADD) \
- $(howto_la_swig_libadd)
+ $(howto_swig_la_swig_libadd)
-_howto_swig_la_LDFLAGS = \
+_howto_swig_la_LDFLAGS = \
$(STD_SWIG_LA_LD_FLAGS) \
- $(howto_la_swig_ldflags)
+ $(howto_swig_la_swig_ldflags)
-_howto_swig_la_CXXFLAGS = \
+_howto_swig_la_CXXFLAGS = \
$(STD_SWIG_CXX_FLAGS) \
- $(howto_la_swig_cxxflags)
+ -I$(top_builddir) \
+ $(howto_swig_la_swig_cxxflags)
-howto_python_PYTHON = \
- howto_swig.py \
- $(howto_python)
+python/howto_swig.cc: howto_swig.py
+howto_swig.py: howto_swig.i
-## Entry rule for running SWIG
+# Include the python dependencies for this file
+-include python/howto_swig.d
-howto.h howto_swig.py howto_swig.cc: howto.i
-## This rule will get called only when MAKE decides that one of the
-## targets needs to be created or re-created, because:
-##
-## * The .i file is newer than any or all of the generated files;
-##
-## * Any or all of the .cc, .h, or .py files does not exist and is
-## needed (in the case this file is not needed, the rule for it is
-## ignored); or
-##
-## * Some SWIG-based dependecy of the .cc file isn't met and hence the
-## .cc file needs be be regenerated. Explanation: Because MAKE
-## knows how to handle dependencies for .cc files (regardless of
-## their name or extension), then the .cc file is used as a target
-## instead of the .i file -- but with the dependencies of the .i
-## file. It is this last reason why the line:
-##
-## if test -f $@; then :; else
-##
-## cannot be used in this case: If a .i file dependecy is not met,
-## then the .cc file needs to be rebuilt. But if the stamp is newer
-## than the .cc file, and the .cc file exists, then in the original
-## version (with the 'test' above) the internal MAKE call will not
-## be issued and hence the .cc file will not be rebuilt.
-##
-## Once execution gets to here, it should always proceed no matter the
-## state of a stamp (as discussed in link above). The
-## $(DEPDIR)/howto-generate stuff is used to allow for parallel
-## builds to "do the right thing". The stamp has no relationship with
-## either the target files or dependency file; it is used solely for
-## the protection of multiple builds during a given call to MAKE.
-##
-## Catch signals SIGHUP (1), SIGINT (2), SIGPIPE (13), and SIGTERM
-## (15). At a caught signal, the quoted command will be issued before
-## exiting. In this case, remove any stamp, whether temporary of not.
-## The trap is valid until the process exits; the process includes all
-## commands appended via "\"s.
-##
- trap 'rm -rf $(DEPDIR)/howto-generate-*' 1 2 13 15; \
-##
-## Create a temporary directory, which acts as a lock. The first
-## process to create the directory will succeed and issue the MAKE
-## command to do the actual work, while all subsequent processes will
-## fail -- leading them to wait for the first process to finish.
-##
- if mkdir $(DEPDIR)/howto-generate-lock 2>/dev/null; then \
-##
-## This code is being executed by the first process to succeed in
-## creating the directory lock.
-##
-## Remove the stamp associated with this filename.
-##
- rm -f $(DEPDIR)/howto-generate-stamp; \
-##
-## Tell MAKE to run the rule for creating this stamp.
-##
- $(MAKE) $(AM_MAKEFLAGS) $(DEPDIR)/howto-generate-stamp WHAT=$<; \
-##
-## Now that the .cc, .h, and .py files have been (re)created from the
-## .i file, future checking of this rule during the same MAKE
-## execution will come back that the rule doesn't need to be executed
-## because none of the conditions mentioned at the start of this rule
-## will be positive. Remove the the directory lock, which frees up
-## any waiting process(es) to continue.
-##
- rmdir $(DEPDIR)/howto-generate-lock; \
- else \
-##
-## This code is being executed by any follower processes while the
-## directory lock is in place.
-##
-## Wait until the first process is done, testing once per second.
-##
- while test -d $(DEPDIR)/howto-generate-lock; do \
- sleep 1; \
- done; \
-##
-## Succeed if and only if the first process succeeded; exit this
-## process returning the status of the generated stamp.
-##
- test -f $(DEPDIR)/howto-generate-stamp; \
- exit $$?; \
- fi;
+endif # end of if python
-$(DEPDIR)/howto-generate-stamp:
-## This rule will be called only by the first process issuing the
-## above rule to succeed in creating the lock directory, after
-## removing the actual stamp file in order to guarantee that MAKE will
-## execute this rule.
-##
-## 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) $(howto_swig_args) \
- -MD -MF $(DEPDIR)/howto.Std \
- -module howto_swig -o howto_swig.cc $(WHAT); then \
- if test $(host_os) = mingw32; then \
- $(RM) $(DEPDIR)/howto.Sd; \
- $(SED) 's,\\\\,/,g' < $(DEPDIR)/howto.Std \
- > $(DEPDIR)/howto.Sd; \
- $(RM) $(DEPDIR)/howto.Std; \
- $(MV) $(DEPDIR)/howto.Sd $(DEPDIR)/howto.Std; \
- fi; \
- else \
- $(RM) $(DEPDIR)/howto.S*; exit 1; \
- fi;
-##
-## Mess with the SWIG output .Std dependency file, to create a
-## dependecy file valid for the input .i file: Basically, simulate the
-## dependency file created for libraries by GNU's libtool for C++,
-## where all of the dependencies for the target are first listed, then
-## each individual dependency is listed as a target with no further
-## dependencies.
-##
-## (1) remove the current dependency file
-##
- $(RM) $(DEPDIR)/howto.d
-##
-## (2) Copy the whole SWIG file:
-##
- cp $(DEPDIR)/howto.Std $(DEPDIR)/howto.d
-##
-## (3) all a carriage return to the end of the dependency file.
-##
- echo "" >> $(DEPDIR)/howto.d
-##
-## (4) from the SWIG file, remove the first line (the target); remove
-## trailing " \" and " " from each line. Append ":" to each line,
-## followed by 2 carriage returns, then append this to the end of
-## the dependency file.
-##
- $(SED) -e '1d;s, \\,,g;s, ,,g' < $(DEPDIR)/howto.Std | \
- awk '{ printf "%s:\n\n", $$0 }' >> $(DEPDIR)/howto.d
-##
-## (5) remove the SWIG-generated file
-##
- $(RM) $(DEPDIR)/howto.Std
-##
-## Create the stamp for this filename generation, to signal success in
-## executing this rule; allows other threads waiting on this process
-## to continue.
-##
- touch $(DEPDIR)/howto-generate-stamp
+if GUILE
+
+howto_swig_scmlib_LTLIBRARIES = \
+ libguile-gnuradio-howto_swig.la
+libguile_gnuradio_howto_swig_la_SOURCES = \
+ guile/howto_swig.cc \
+ $(howto_swig_la_swig_sources)
+nobase_howto_swig_scm_DATA = \
+ gnuradio/howto_swig.scm \
+ gnuradio/howto_swig-primitive.scm
+libguile_gnuradio_howto_swig_la_LIBADD = \
+ $(STD_SWIG_LA_LIB_ADD) \
+ $(howto_swig_la_swig_libadd)
+libguile_gnuradio_howto_swig_la_LDFLAGS = \
+ $(STD_SWIG_LA_LD_FLAGS) \
+ $(howto_swig_la_swig_ldflags)
+libguile_gnuradio_howto_swig_la_CXXFLAGS = \
+ $(STD_SWIG_CXX_FLAGS) \
+ -I$(top_builddir) \
+ $(howto_swig_la_swig_cxxflags)
+
+guile/howto_swig.cc: gnuradio/howto_swig.scm
+gnuradio/howto_swig.scm: howto_swig.i
+gnuradio/howto_swig-primitive.scm: gnuradio/howto_swig.scm
+
+# Include the guile dependencies for this file
+-include guile/howto_swig.d
-# KLUDGE: Force runtime include of a SWIG dependency file. This is
-# not guaranteed to be portable, but will probably work. If it works,
-# we have accurate dependencies for our swig stuff, which is good.
+endif # end of GUILE
-@am__include@ @am__quote@./$(DEPDIR)/howto.d@am__quote@
diff --git a/gr-howto-write-a-block/swig/howto.i b/gr-howto-write-a-block/swig/howto.i
deleted file mode 100644
index 8dc502010..000000000
--- a/gr-howto-write-a-block/swig/howto.i
+++ /dev/null
@@ -1,11 +0,0 @@
-/* -*- c++ -*- */
-
-%include "gnuradio.i" // the common stuff
-
-%{
-#include "howto_square_ff.h"
-#include "howto_square2_ff.h"
-%}
-
-%include "howto_square_ff.i"
-%include "howto_square2_ff.i"
diff --git a/gr-howto-write-a-block/swig/howto.test b/gr-howto-write-a-block/swig/howto.test
new file mode 100644
index 000000000..ffe7251cd
--- /dev/null
+++ b/gr-howto-write-a-block/swig/howto.test
@@ -0,0 +1,69 @@
+;;; -*- Scheme -*-
+;;;
+;;; Copyright 2010 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 this program. If not, see <http://www.gnu.org/licenses/>.
+;;;
+
+;;; If you're using Emacs's Scheme mode:
+;;; (put 'with-test-prefix 'scheme-indent-function 1)
+
+;;; See the comments in gnuradio/test-suite/lib.scm for info on writing tests.
+;;; See also the very end of the file, where the test-equal, test-eqv
+;;; and test-eq macros are defined.
+
+(define-module (test-module)
+ #:use-module (oop goops)
+ #:use-module (gnuradio core)
+ #:use-module (gnuradio test-suite lib)
+ #:duplicates (merge-generics replace check))
+
+
+;; Use our module
+(use-modules (gnuradio howto))
+
+
+(define (vector-map f v)
+ (list->vector (map f (vector->list v))))
+
+
+(with-test-prefix "square-ff"
+ (let* ((src-data #(-3. 4. -5.5 2. 3.))
+ (expected-result (vector-map (lambda (x) (* x x)) src-data))
+ (tb (gr:top-block-swig "QA top block"))
+ (src (gr:vector-source-f src-data #f))
+ (op (gr:howto-square-ff))
+ (dst (gr:vector-sink-f)))
+
+ (gr:connect tb src op dst)
+
+ (gr:run tb)
+ (test-equal expected-result (gr:data dst))))
+
+
+(with-test-prefix "square2-ff"
+ (let* ((src-data #(-3. 4. -5.5 2. 3.))
+ (expected-result (vector-map (lambda (x) (* x x)) src-data))
+ (tb (gr:top-block-swig "QA top block"))
+ (src (gr:vector-source-f src-data #f))
+ (op (gr:howto-square2-ff))
+ (dst (gr:vector-sink-f)))
+
+ (gr:connect tb src op dst)
+
+ (gr:run tb)
+ (test-equal expected-result (gr:data dst))))
+
diff --git a/gr-howto-write-a-block/swig/howto_swig.i b/gr-howto-write-a-block/swig/howto_swig.i
new file mode 100644
index 000000000..d0bbcdc11
--- /dev/null
+++ b/gr-howto-write-a-block/swig/howto_swig.i
@@ -0,0 +1,21 @@
+/* -*- c++ -*- */
+
+%include "gnuradio.i" // the common stuff
+
+%{
+#include "howto_square_ff.h"
+#include "howto_square2_ff.h"
+%}
+
+%include "howto_square_ff.i"
+%include "howto_square2_ff.i"
+
+#if SWIGGUILE
+%scheme %{
+(load-extension-global "libguile-gnuradio-howto_swig" "scm_init_gnuradio_howto_swig_module")
+%}
+
+%goops %{
+(use-modules (gnuradio gnuradio_core_runtime))
+%}
+#endif
diff --git a/gr-howto-write-a-block/swig/run_guile_tests.in b/gr-howto-write-a-block/swig/run_guile_tests.in
new file mode 100644
index 000000000..5d08b0dd5
--- /dev/null
+++ b/gr-howto-write-a-block/swig/run_guile_tests.in
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+. @top_builddir@/setup_guile_test_env
+
+# 1st argument is absolute path to hand coded guile source directory
+# 2nd argument is absolute path to component C++ shared library build directory
+# 3nd argument is absolute path to component SWIG build directory
+
+add_local_paths \
+ @srcdir@ \
+ @abs_builddir@ \
+ @abs_builddir@
+
+@GUILE@ -e main -c '(use-modules (gnuradio test-suite guile-test))' -t @srcdir@
diff --git a/gr-howto-write-a-block/version.sh b/gr-howto-write-a-block/version.sh
index 01a47b5d9..0d6cc96f0 100644
--- a/gr-howto-write-a-block/version.sh
+++ b/gr-howto-write-a-block/version.sh
@@ -1,4 +1,4 @@
MAJOR_VERSION=3
-API_COMPAT=3
-MINOR_VERSION=0
+API_COMPAT=4
+MINOR_VERSION=git
MAINT_VERSION=0