diff options
Diffstat (limited to 'gr-howto-write-a-block')
28 files changed, 762 insertions, 558 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..3c76ee4b4 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 ?= @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 e3a2116a7..dc84c68ef 100755 --- a/gr-howto-write-a-block/config.guess +++ b/gr-howto-write-a-block/config.guess @@ -4,7 +4,7 @@ # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 # Free Software Foundation, Inc. -timestamp='2009-06-10' +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 @@ -27,16 +27,16 @@ timestamp='2009-06-10' # the same distribution terms that you use for the rest of that program. -# Originally written by Per Bothner <per@bothner.com>. -# Please send patches to <config-patches@gnu.org>. Submit a context -# diff and a properly formatted ChangeLog entry. +# Originally written by Per Bothner. Please send patches (context +# diff format) to <config-patches@gnu.org> and include a ChangeLog +# entry. # # This script attempts to guess a canonical system name similar to # config.sub. If it succeeds, it prints the system name on stdout, and # exits with 0. Otherwise, it exits with 1. # -# The plan is that this can be called by configure scripts if you -# don't specify an explicit build system type. +# You can get the latest version of this script from: +# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD me=`echo "$0" | sed -e 's,.*/,,'` @@ -333,6 +333,9 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; + i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) + echo i386-pc-auroraux${UNAME_RELEASE} + exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) eval $set_cc_for_build SUN_ARCH="i386" @@ -807,12 +810,12 @@ EOF i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit ;; - *:Interix*:[3456]*) + *:Interix*:*) case ${UNAME_MACHINE} in x86) echo i586-pc-interix${UNAME_RELEASE} exit ;; - EM64T | authenticamd | genuineintel) + authenticamd | genuineintel | EM64T) echo x86_64-unknown-interix${UNAME_RELEASE} exit ;; IA64) @@ -854,6 +857,20 @@ EOF i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; + alpha:Linux:*:*) + case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in + EV5) UNAME_MACHINE=alphaev5 ;; + EV56) UNAME_MACHINE=alphaev56 ;; + PCA56) UNAME_MACHINE=alphapca56 ;; + PCA57) UNAME_MACHINE=alphapca56 ;; + EV6) UNAME_MACHINE=alphaev6 ;; + EV67) UNAME_MACHINE=alphaev67 ;; + EV68*) UNAME_MACHINE=alphaev68 ;; + esac + objdump --private-headers /bin/sh | grep -q ld.so.1 + if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi + echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} + exit ;; arm*:Linux:*:*) eval $set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ @@ -876,6 +893,17 @@ EOF frv:Linux:*:*) echo frv-unknown-linux-gnu exit ;; + i*86:Linux:*:*) + LIBC=gnu + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #ifdef __dietlibc__ + LIBC=dietlibc + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` + echo "${UNAME_MACHINE}-pc-linux-${LIBC}" + exit ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; @@ -901,39 +929,18 @@ EOF #endif #endif EOF - eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' - /^CPU/{ - s: ::g - p - }'`" + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; or32:Linux:*:*) echo or32-unknown-linux-gnu exit ;; - ppc:Linux:*:*) - echo powerpc-unknown-linux-gnu - exit ;; - ppc64:Linux:*:*) - echo powerpc64-unknown-linux-gnu - exit ;; - alpha:Linux:*:*) - case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in - EV5) UNAME_MACHINE=alphaev5 ;; - EV56) UNAME_MACHINE=alphaev56 ;; - PCA56) UNAME_MACHINE=alphapca56 ;; - PCA57) UNAME_MACHINE=alphapca56 ;; - EV6) UNAME_MACHINE=alphaev6 ;; - EV67) UNAME_MACHINE=alphaev67 ;; - EV68*) UNAME_MACHINE=alphaev68 ;; - esac - objdump --private-headers /bin/sh | grep -q ld.so.1 - if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi - echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} - exit ;; padre:Linux:*:*) echo sparc-unknown-linux-gnu exit ;; + parisc64:Linux:*:* | hppa64:Linux:*:*) + echo hppa64-unknown-linux-gnu + exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in @@ -942,8 +949,11 @@ EOF *) echo hppa-unknown-linux-gnu ;; esac exit ;; - parisc64:Linux:*:* | hppa64:Linux:*:*) - echo hppa64-unknown-linux-gnu + ppc64:Linux:*:*) + echo powerpc64-unknown-linux-gnu + exit ;; + ppc:Linux:*:*) + echo powerpc-unknown-linux-gnu exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux @@ -966,58 +976,6 @@ EOF xtensa*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; - i*86:Linux:*:*) - # The BFD linker knows what the default object file format is, so - # first see if it will tell us. cd to the root directory to prevent - # problems with other programs or directories called `ld' in the path. - # Set LC_ALL=C to ensure ld outputs messages in English. - ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ - | sed -ne '/supported targets:/!d - s/[ ][ ]*/ /g - s/.*supported targets: *// - s/ .*// - p'` - case "$ld_supported_targets" in - elf32-i386) - TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" - ;; - esac - # Determine whether the default compiler is a.out or elf - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include <features.h> - #ifdef __ELF__ - # ifdef __GLIBC__ - # if __GLIBC__ >= 2 - LIBC=gnu - # else - LIBC=gnulibc1 - # endif - # else - LIBC=gnulibc1 - # endif - #else - #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC) - LIBC=gnu - #else - LIBC=gnuaout - #endif - #endif - #ifdef __dietlibc__ - LIBC=dietlibc - #endif -EOF - eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' - /^LIBC/{ - s: ::g - p - }'`" - test x"${LIBC}" != x && { - echo "${UNAME_MACHINE}-pc-linux-${LIBC}" - exit - } - test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; } - ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both @@ -1247,6 +1205,16 @@ EOF *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown case $UNAME_PROCESSOR in + i386) + eval $set_cc_for_build + if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then + if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + UNAME_PROCESSOR="x86_64" + fi + fi ;; unknown) UNAME_PROCESSOR=powerpc ;; esac echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} diff --git a/gr-howto-write-a-block/config.sub b/gr-howto-write-a-block/config.sub index eb0389a69..2a55a5075 100755 --- a/gr-howto-write-a-block/config.sub +++ b/gr-howto-write-a-block/config.sub @@ -4,7 +4,7 @@ # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 # Free Software Foundation, Inc. -timestamp='2009-06-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 @@ -32,13 +32,16 @@ timestamp='2009-06-11' # Please send patches to <config-patches@gnu.org>. Submit a context -# diff and a properly formatted ChangeLog entry. +# diff and a properly formatted GNU ChangeLog entry. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. +# You can get the latest version of this script from: +# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD + # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. @@ -149,7 +152,7 @@ case $os in -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ - -apple | -axis | -knuth | -cray) + -apple | -axis | -knuth | -cray | -microblaze) os= basic_machine=$1 ;; @@ -284,6 +287,7 @@ case $basic_machine in | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ | pyramid \ + | rx \ | score \ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ @@ -291,13 +295,14 @@ case $basic_machine in | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ | spu | strongarm \ | tahoe | thumb | tic4x | tic80 | tron \ + | ubicom32 \ | v850 | v850e \ | we32k \ | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \ | z8k | z80) basic_machine=$basic_machine-unknown ;; - m6811 | m68hc11 | m6812 | m68hc12) + m6811 | m68hc11 | m6812 | m68hc12 | picochip) # Motorola 68HC11/12. basic_machine=$basic_machine-unknown os=-none @@ -340,7 +345,7 @@ case $basic_machine in | lm32-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ - | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ + | m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ @@ -368,7 +373,7 @@ case $basic_machine in | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ | pyramid-* \ - | romp-* | rs6000-* \ + | romp-* | rs6000-* | rx-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ @@ -377,6 +382,7 @@ case $basic_machine in | tahoe-* | thumb-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* | tile-* \ | tron-* \ + | ubicom32-* \ | v850-* | v850e-* | vax-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \ @@ -726,6 +732,9 @@ case $basic_machine in basic_machine=ns32k-utek os=-sysv ;; + microblaze) + basic_machine=microblaze-xilinx + ;; mingw32) basic_machine=i386-pc os=-mingw32 @@ -1247,6 +1256,9 @@ case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. + -auroraux) + os=-auroraux + ;; -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; @@ -1268,8 +1280,8 @@ case $os in # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ - | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ - | -kopensolaris* \ + | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ + | -sym* | -kopensolaris* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* | -aros* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ @@ -1290,7 +1302,7 @@ case $os in | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ - | -skyos* | -haiku* | -rdos* | -toppers* | -drops*) + | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) 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..326004235 100644 --- a/gr-howto-write-a-block/swig/Makefile.am +++ b/gr-howto-write-a-block/swig/Makefile.am @@ -20,35 +20,39 @@ # 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_swig_pythondir_category = $(modname) -howto_la_swig_libadd = \ +# additional libraries for linking with the SWIG-generated library +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 +nobase_guile_DATA = \ + gnuradio/howto_swig.scm endif + +EXTRA_DIST += $(nobase_guile_DATA) diff --git a/gr-howto-write-a-block/swig/Makefile.swig.gen b/gr-howto-write-a-block/swig/Makefile.swig.gen index 6c6e66290..6b7be2185 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 ?= 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..dc257a61e --- /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_swig)) + + +(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 605200711..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=2 -MAINT_VERSION=git +API_COMPAT=4 +MINOR_VERSION=git +MAINT_VERSION=0 |