Browse Source

Extract libusrp, adjust to be buildable standalone

* $ git \
    filter-branch \
    --prune-empty \
    --tree-filter \
    'find \! -path "./usrp/*" -a -type f -delete' \
    HEAD
* Craft custom configure.ac
* Update m4 macros
* Small fixes here and there

The code in doc/, firmware/ and host/swig does _not_ build at the
moment, due to m4 macros not being adhered and is disabled therefore.
changes/39/5939/1
Alexander Huemer 5 years ago
parent
commit
ec6adccbbd
  1. 5
      .gitignore
  2. 4
      Makefile.am
  3. 137
      Makefile.common
  4. 77
      Makefile.par.gen
  5. 208
      Makefile.swig
  6. 144
      Makefile.swig.gen.t
  7. 95
      configure.ac
  8. 4
      doc/Makefile.am
  9. 7
      host/include/usrp/libusb_types.h.in
  10. 30
      host/lib/Makefile.am
  11. 145
      host/swig/Makefile.swig.gen
  12. 301
      m4/ax_boost_base.m4
  13. 113
      m4/ax_boost_date_time.m4
  14. 118
      m4/ax_boost_filesystem.m4
  15. 116
      m4/ax_boost_iostreams.m4
  16. 108
      m4/ax_boost_program_options.m4
  17. 121
      m4/ax_boost_python.m4
  18. 111
      m4/ax_boost_regex.m4
  19. 117
      m4/ax_boost_serialization.m4
  20. 114
      m4/ax_boost_signals.m4
  21. 121
      m4/ax_boost_system.m4
  22. 139
      m4/ax_boost_test_exec_monitor.m4
  23. 163
      m4/ax_boost_thread.m4
  24. 137
      m4/ax_boost_unit_test_framework.m4
  25. 116
      m4/ax_boost_wserialization.m4
  26. 109
      m4/gr_swig.m4
  27. 8387
      m4/libtool.m4
  28. 437
      m4/ltoptions.m4
  29. 124
      m4/ltsugar.m4
  30. 23
      m4/ltversion.m4
  31. 99
      m4/lt~obsolete.m4
  32. 87
      m4/usrp_fusb_tech.m4
  33. 273
      m4/usrp_libusb.m4
  34. 75
      m4/usrp_sdcc.m4

5
.gitignore vendored

@ -1,3 +1,5 @@
*.o
/*.cache
/*.la
/*.lo
@ -29,3 +31,6 @@
/stamp-h.in
/stamp-h1
/usrp.iss
/compile
/config.guess
/config.sub

4
Makefile.am

@ -21,12 +21,14 @@
include $(top_srcdir)/Makefile.common
ACLOCAL_AMFLAGS = -I m4
EXTRA_DIST += \
usrp.pc.in \
usrp.iss.in \
usrp.inf
SUBDIRS = host firmware fpga doc
SUBDIRS = host fpga
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = \

137
Makefile.common

@ -0,0 +1,137 @@
# -*- Makefile -*-
#
# Copyright 2004,2006,2007,2008,2009,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 GNU Radio; see the file COPYING. If not, write to
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.
#
# Every Makefile starts with common vars so we can
# consistently use +=
BUILT_SOURCES =
CLEANFILES = guile.log
DISTCLEANFILES =
EXTRA_DIST =
STAMPS =
# Make rebuilds less verbose with stuff we can safely ignore
# about GNU make only extensions.
AUTOMAKE += -Wno-portability -Wnone
#AM_CFLAGS = @autoconf_default_CFLAGS@ @lf_CFLAGS@
#AM_CXXFLAGS = @autoconf_default_CXXFLAGS@ @lf_CXXFLAGS@
# Sets ABI version in SONAME and appends -LIBVER to filename
LTVERSIONFLAGS = -version-info 0:0:0 -release $(VERSION)
# includes
grincludedir = $(includedir)/gnuradio
# swig includes
swigincludedir = $(grincludedir)/swig
# Guile scheme code ends up under here:
guiledir = $(prefix)/share/guile/site
# Install the gnuradio stuff in the appropriate subdirectory
# This usually ends up at:
# ${prefix}/lib/python${python_version}/site-packages/gnuradio
grpythondir = $(pythondir)/gnuradio
grpyexecdir = $(pyexecdir)/gnuradio
# Install the non-gnuradio usrp stuff in the appropriate subdirectory
# This usually ends up at:
# ${prefix}/lib/python${python_version}/site-packages/usrpm
usrppythondir = $(pythondir)/usrpm
usrppyexecdir = $(pyexecdir)/usrpm
# gcell includes
gcellincludedir = $(includedir)/gcell
gcellspuincludedir = $(includedir)/gcell/spu
# Cell spu libs
libspudir = $(libdir)spu
# This used to be set in configure.ac but is now defined here for all
# Makefiles when this fragment is included.
STD_DEFINES_AND_INCLUDES = $(DEFINES) $(GNURADIO_INCLUDES) \
$(GRUEL_INCLUDES) $(VOLK_INCLUDES) $(BOOST_CPPFLAGS)
# when including for compilation from pre-installed libraries and such,
# need to make sure those are put last on the compile command
WITH_INCLUDES = #@with_INCLUDES@
WITH_SWIG_INCLUDES = @with_SWIG_INCLUDES@
# Where to find gnuradio include files in the current build tree
# top_srcdir for original stuff, top_builddir for generated files
GNURADIO_INCLUDES = @gnuradio_core_INCLUDES@
# How to link in GNU Radio core library from inside the tree
GNURADIO_CORE_LA = @gnuradio_core_LA@
# How to link in the GRUEL library from inside the tree
GRUEL_INCLUDES = @gruel_INCLUDES@
GRUEL_LA = @gruel_LA@
# How to link in the VOLK library from inside the tree
VOLK_INCLUDES = @volk_INCLUDES@
VOLK_LA = @volk_LA@
# How to link in the USRP library from inside the tree
USRP_INCLUDES = \
-I$(abs_top_srcdir)/ost/include \
-I$(abs_top_builddir)/host/include \
-I$(abs_top_srcdir)/firmware/include \
$(NULL)
USRP_LA = $(abs_top_builddir)/host/lib/libusrp.la
# How to link the gcell library from inside the tree (the PPU part)
GCELL_INCLUDES = @gcell_INCLUDES@
GCELL_LA = @gcell_LA@
# How to link the gcell library from inside the tree (the SPU part)
GCELL_SPU_INCLUDES = @gcell_spu_INCLUDES@
GCELL_SPU_LA = @gcell_spu_LA@
# libtool aware wrapper for ppu-embedspu
GCELL_EMBEDSPU_LIBTOOL = @abs_top_srcdir@/gcell/lib/runtime/gcell-embedspu-libtool
# Fix for BSD make not defining $(RM). We define it now in configure.ac
# using AM_PATH_PROG, but now here have to add a -f to be like GNU make
RM=$(RM_PROG) -f
RUN_GUILE = GUILE_LOAD_PATH="@abs_top_srcdir@/gruel/src/scheme" @GUILE@ -e main -s
# Base directory for example applications
exampledir = $(datadir)/gnuradio/examples
# Base directory for documentation (docdir undefined in autoconf < 1.60)
docdir ?= $(datadir)/doc/$(PACKAGE)
gr_docdir = $(docdir)-$(DOCVER)
# System configuration files
gr_prefsdir = $(GR_PREFSDIR)
# Data directory for grc block wrappers
grc_blocksdir = $(pkgdatadir)/grc/blocks
# Other common defines; use "+=" to add to these
MOSTLYCLEANFILES = $(BUILT_SOURCES) $(STAMPS) *.pyc *.pyo *~ *.tmp *.loT \
.unittests/* .unittests/python/*

77
Makefile.par.gen

@ -0,0 +1,77 @@
# -*- Makefile -*-
#
# Copyright 2009 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# GNU Radio is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3, or (at your option)
# any later version.
#
# GNU Radio is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GNU Radio; see the file COPYING. If not, write to
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.
#
STAMPS ?=
EXTRA_DIST ?=
MOSTLYCLEANFILES ?=
## ----------------------------------------------------------------
## Special rules for generating sources. Include this file when there
## are multiple targets ('gen_sources') being created using a single
## command. In this case, parallel build protection is required, and
## is provided by this file using a reasonably generic ruleset. For
## more info, see:
##
## http://sources.redhat.com/automake/automake.html#Multiple-Outputs
##
## If a single source is being created, then normal rules can be used;
## using this parallel protection will not hurt, but it also won't help.
##
## Define the variable 'par_gen_command' to be the command that
## creates the sources 'gen_sources' from the dependency files
## 'gen_sources_deps'.
##
## These STAMPS will be removed upon "make clean", but are otherwise
## not used.
STAMPS += $(DEPDIR)/stamp-sources-generate*
## The following STAMP will be included in the archive, to show that
## this these rules have been followed.
EXTRA_DIST += stamp-sources-generate
MOSTLYCLEANFILES += stamp-sources-generate
stamp-sources-generate: $(gen_sources_deps)
@rm -f $(DEPDIR)/stamp-sources-generate-tmp
@touch $(DEPDIR)/stamp-sources-generate-tmp
$(par_gen_command)
@mv -f $(DEPDIR)/stamp-sources-generate-tmp $@
$(gen_sources): stamp-sources-generate
## Recover from the removal of $@
@if test -f $@; then :; else \
trap 'rm -rf $(DEPDIR)/stamp-sources-generate-*' 1 2 13 15; \
if mkdir $(DEPDIR)/stamp-sources-generate-lock 2>/dev/null; then \
## This code is being executed by the first process.
rm -f stamp-sources-generate; \
$(MAKE) $(AM_MAKEFLAGS) stamp-sources-generate; \
rmdir $(DEPDIR)/stamp-sources-generate-lock; \
else \
## This code is being executed by the follower processes.
## Wait until the first process is done.
while test -d $(DEPDIR)/stamp-sources-generate-lock; do sleep 1; done; \
## Succeed iff the first process succeeded.
test -f stamp-sources-generate; exit $$?; \
fi; \
fi;

208
Makefile.swig

@ -0,0 +1,208 @@
# -*- Makefile -*-
#
# Copyright 2009,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 GNU Radio; see the file COPYING. If not, write to
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.
#
## This makefile should be included using
## include $(top_srcdir)/Makefile.swig
## 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
## the local builddir (which should always be '.')
## In some older autotools, $(builddir) is not defined, so
## just use '.' instead.
SWIG_PYTHON_FLAGS = \
-fvirtual \
-python \
-modern \
-keyword \
-w511 \
-outdir .
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 = \
$(PYTHON_LDFLAGS) \
-module \
-avoid-version \
$(NO_UNDEFINED)
## standard SWIG library additions for library creation
STD_SWIG_LA_LIB_ADD = -lstdc++
## standard SWIG CXXFLAGS
## This allows for code to be compiled with "-O1" instead of "-g -O2"
## for some systems, avoiding some optimization issues.
STD_SWIG_CXX_FLAGS = @swig_CXXFLAGS@
# 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.
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
## full path to the file and full filename including extension. This
## Makefile addition will be made only if either it does not exist or
## if the top-level template has been modified.
generate-makefile-swig $(srcdir)/Makefile.swig.genX: $(top_srcdir)/Makefile.swig.gen.t
## recreate $(srcdir)/Makefile.swig.gen only if ...
@do_recreate=0; \
if test -f $(srcdir)/Makefile.swig.gen; then \
## the file exists and can be removed; or ...
if $(RM) $(srcdir)/Makefile.swig.gen 2>/dev/null; then \
if touch $(srcdir)/Makefile.swig.gen 2>/dev/null; then \
do_recreate=1; \
fi; \
fi; \
else \
## the file doesn't exist, but can be created (e.g., by touching it).
if touch $(srcdir)/Makefile.swig.gen 2>/dev/null; then \
do_recreate=1; \
fi; \
fi; \
if test "$$do_recreate" == "1"; then \
echo "Regenerating $(srcdir)/Makefile.swig.gen"; \
for TFILE in $(TOP_SWIG_IFILES); do \
## retrieve just the filename, without path or extension
TNAME=`python -c "import os.path as op; (dN, fN) = op.split ('$$TFILE'); (fbN, fE) = op.splitext (fN); print fbN;"`; \
## Replace the @-named strings in the template Makefile for SWIG.
$(SED) -e 's|@NAME@|'$$TNAME'|g;' < $(top_srcdir)/Makefile.swig.gen.t >> $(srcdir)/Makefile.swig.gen; \
echo "" >> $(srcdir)/Makefile.swig.gen; \
done; \
else \
echo "Cannot recreate $(srcdir)/Makefile.swig.gen because the directory or file is write-protected."; \
exit -1; \
fi;

144
Makefile.swig.gen.t

@ -0,0 +1,144 @@
# -*- Makefile -*-
#
# Copyright 2009 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# GNU Radio is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3, or (at your option)
# any later version.
#
# GNU Radio is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GNU Radio; see the file COPYING. If not, write to
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.
#
# Makefile.swig.gen for @NAME@.i
## Default install locations for these files:
##
## Default location for the Python directory is:
## ${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/[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_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.
@NAME@_swigincludedir = $(swigincludedir)
## This is a template file for a "generated" Makefile addition (in
## this case, "Makefile.swig.gen"). By including the top-level
## Makefile.swig, this file will be used to generate the SWIG
## dependencies. Assign the variable TOP_SWIG_FILES to be the list of
## SWIG .i files to generated wrappings for; there can be more than 1
## so long as the names are unique (no sorting is done on the
## TOP_SWIG_FILES list). This file explicitly assumes that a SWIG .i
## file will generate .cc, .py, and possibly .h files -- meaning that
## all of these files will have the same base name (that provided for
## the SWIG .i file).
##
## This code is setup to ensure parallel MAKE ("-j" or "-jN") does the
## right thing. For more info, see <
## http://sources.redhat.com/automake/automake.html#Multiple-Outputs >
## Other cleaned files: dependency files generated by SWIG or this Makefile
MOSTLYCLEANFILES += $(DEPDIR)/*.S*
## Various SWIG variables. These can be overloaded in the including
## Makefile.am by setting the variable value there, then including
## Makefile.swig .
@NAME@_swiginclude_HEADERS = \
@NAME@.i \
$(@NAME@_swiginclude_headers)
if PYTHON
@NAME@_pylib_LTLIBRARIES = \
_@NAME@.la
_@NAME@_la_SOURCES = \
python/@NAME@.cc \
$(@NAME@_la_swig_sources)
@NAME@_python_PYTHON = \
@NAME@.py \
$(@NAME@_python)
_@NAME@_la_LIBADD = \
$(STD_SWIG_LA_LIB_ADD) \
$(@NAME@_la_swig_libadd)
_@NAME@_la_LDFLAGS = \
$(STD_SWIG_LA_LD_FLAGS) \
$(@NAME@_la_swig_ldflags)
_@NAME@_la_CXXFLAGS = \
$(STD_SWIG_CXX_FLAGS) \
-I$(top_builddir) \
$(@NAME@_la_swig_cxxflags)
python/@NAME@.cc: @NAME@.py
@NAME@.py: @NAME@.i
# Include the python dependencies for this file
-include python/@NAME@.d
endif # end of if python
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
endif # end of GUILE

95
configure.ac

@ -0,0 +1,95 @@
AC_INIT([libusrp], [3.4.2])
AM_INIT_AUTOMAKE([foreign subdir-objects silent-rules])
AM_SILENT_RULES([yes])
AC_CONFIG_MACRO_DIRS([m4])
AC_PROG_CXX
LT_INIT([pic-only disable-static])
PKG_CHECK_MODULES([USB], [libusb-1.0])
AX_BOOST_BASE([1.37], [true], [AC_MSG_ERROR([boost is required, bailing out])])
AX_BOOST_THREAD
CXXFLAGS="$CXXFLAGS $BOOST_CXXFLAGS" dnl often picks up a -pthread or something similar
CFLAGS="$CFLAGS $BOOST_CXXFLAGS" dnl often picks up a -pthread or something similar
dnl
dnl all the rest of these call AC_SUBST(BOOST_<foo>_LIB) and define HAVE_BOOST_<foo>
dnl
AX_BOOST_DATE_TIME
AX_BOOST_FILESYSTEM
dnl AX_BOOST_IOSTREAMS
AX_BOOST_PROGRAM_OPTIONS
dnl AX_BOOST_REGEX
dnl AX_BOOST_SERIALIZATION
dnl AX_BOOST_SIGNALS
AX_BOOST_SYSTEM
dnl AX_BOOST_TEST_EXEC_MONITOR
dnl AX_BOOST_UNIT_TEST_FRAMEWORK
dnl AX_BOOST_WSERIALIZATION
# Allow user to choose whether to generate SWIG/Python
# Default is enabled
AC_ARG_ENABLE([python],
[AS_HELP_STRING([--enable-python],
[generate SWIG/Python components (default is yes)])],
[case "${enableval}" in
yes) enable_python=yes ;;
no) enable_python=no ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-python]) ;;
esac],
[enable_python=no]
)
# Allow user to choose whether to generate SWIG/Guile
# 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_PATH_PYTHON
AM_CONDITIONAL([PYTHON], [test x$enable_python = xyes])
AM_CONDITIONAL([GUILE], [test x$enable_guile = xyes])
AC_CHECK_PROG([XMLTO],[xmlto],[yes],[])
AM_CONDITIONAL([HAS_XMLTO], [test x$XMLTO = xyes])
AC_CONFIG_FILES([
Makefile
usrp.pc
usrp.iss
doc/Doxyfile
doc/Makefile
doc/other/Makefile
host/Makefile
host/include/Makefile
host/include/usrp/Makefile
host/include/usrp/libusb_types.h
host/misc/Makefile
host/lib/Makefile
host/lib/std_paths.h
host/swig/Makefile
host/apps/Makefile
firmware/Makefile
firmware/include/Makefile
firmware/lib/Makefile
firmware/src/Makefile
firmware/src/common/Makefile
firmware/src/usrp2/Makefile
fpga/Makefile
fpga/rbf/Makefile
fpga/rbf/rev2/Makefile
fpga/rbf/rev4/Makefile
])
AC_OUTPUT

4
doc/Makefile.am

@ -44,7 +44,7 @@ DOCBOOK_HTML_FILES=
all-local: dox
endif
dist_usrp_doc_DATA = $(top_srcdir)/usrp/README
dist_usrp_doc_DATA = $(top_srcdir)/README
dox: html/index.html
html/index.html:
@ -54,7 +54,7 @@ html/index.html:
docbook-html: usrp_guide.html
usrp_guide.html: usrp_guide.xml
xmlto html-nochunks $(top_srcdir)/usrp/doc/usrp_guide.xml
xmlto html-nochunks $(top_srcdir)/doc/usrp_guide.xml
install-data-local:
$(MKDIR_P) $(DESTDIR)$(usrp_docdir)/html

7
host/include/usrp/libusb_types.h.in

@ -23,16 +23,9 @@
#ifndef _LIBUSB_TYPES_H_
#define _LIBUSB_TYPES_H_
#if @USE_LIBUSB1@
#include <libusb-1.0/libusb.h>
struct libusb_device;
struct libusb_device_handle;
struct libusb_device_descriptor;
#else
#include <usb.h>
typedef struct usb_device libusb_device;
typedef struct usb_dev_handle libusb_device_handle;
typedef struct usb_device_descriptor libusb_device_descriptor;
#endif
#endif /* _LIBUSB_TYPES_H_ */

30
host/lib/Makefile.am

@ -31,16 +31,9 @@ libusrp_la_common_LIBADD = \
$(BOOST_THREAD_LIB) \
../misc/libmisc.la
# darwin fusb requires gruel (for threading)
if FUSB_TECH_darwin
AM_CPPFLAGS = $(GRUEL_INCLUDES) $(common_INCLUDES) $(BOOST_CPPFLAGS) $(WITH_INCLUDES)
libusrp_la_LIBADD = $(libusrp_la_common_LIBADD) $(GRUEL_LA)
libusrp_la_LDFLAGS = $(libusrp_la_common_LDFLAGS) -framework CoreFoundation
else
AM_CPPFLAGS = $(common_INCLUDES) $(BOOST_CPPFLAGS) $(WITH_INCLUDES)
libusrp_la_LIBADD = $(libusrp_la_common_LIBADD)
libusrp_la_LDFLAGS = $(libusrp_la_common_LDFLAGS)
endif
EXTRA_DIST += \
std_paths.h.in \
@ -132,30 +125,7 @@ libusrp_la_common_SOURCES = \
db_dtt768.cc \
db_util.cc
if FUSB_TECH_generic
libusrp_la_SOURCES = $(libusrp_la_common_SOURCES) $(generic_CODE)
endif
if FUSB_TECH_darwin
libusrp_la_SOURCES = $(libusrp_la_common_SOURCES) $(darwin_CODE)
endif
if FUSB_TECH_win32
libusrp_la_SOURCES = $(libusrp_la_common_SOURCES) $(win32_CODE)
endif
if FUSB_TECH_linux
libusrp_la_SOURCES = $(libusrp_la_common_SOURCES) $(linux_CODE)
endif
if FUSB_TECH_ra_wb
libusrp_la_SOURCES = $(libusrp_la_common_SOURCES) $(ra_wb_CODE)
endif
if FUSB_TECH_libusb1
libusrp_la_SOURCES = $(libusrp_la_common_SOURCES) $(libusb1_CODE)
endif
noinst_HEADERS = \
ad9862.h \

145
host/swig/Makefile.swig.gen

@ -1,145 +0,0 @@
# -*- Makefile -*-
#
# Copyright 2009 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# GNU Radio is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3, or (at your option)
# any later version.
#
# GNU Radio is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GNU Radio; see the file COPYING. If not, write to
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.
#
# Makefile.swig.gen for usrp_prims.i
## Default install locations for these files:
##
## Default location for the Python directory is:
## ${prefix}/lib/python${python_version}/site-packages/[category]/usrp_prims
## Default location for the Python exec directory is:
## ${exec_prefix}/lib/python${python_version}/site-packages/[category]/usrp_prims
##
## 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.
usrp_prims_pythondir_category ?= gnuradio/usrp_prims
usrp_prims_pylibdir_category ?= $(usrp_prims_pythondir_category)
usrp_prims_pythondir = $(pythondir)/$(usrp_prims_pythondir_category)
usrp_prims_pylibdir = $(pyexecdir)/$(usrp_prims_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.
usrp_prims_scmlibdir = $(libdir)
# The scm files for the guile modules get installed where ever guile
# is installed, usually /usr/share/guile/site/usrp_prims
# FIXME: determince whether these should be installed with gnuradio.
usrp_prims_scmdir = $(guiledir)
## SWIG headers are always installed into the same directory.
usrp_prims_swigincludedir = $(swigincludedir)
## This is a template file for a "generated" Makefile addition (in
## this case, "Makefile.swig.gen"). By including the top-level
## Makefile.swig, this file will be used to generate the SWIG
## dependencies. Assign the variable TOP_SWIG_FILES to be the list of
## SWIG .i files to generated wrappings for; there can be more than 1
## so long as the names are unique (no sorting is done on the
## TOP_SWIG_FILES list). This file explicitly assumes that a SWIG .i
## file will generate .cc, .py, and possibly .h files -- meaning that
## all of these files will have the same base name (that provided for
## the SWIG .i file).
##
## This code is setup to ensure parallel MAKE ("-j" or "-jN") does the
## right thing. For more info, see <
## http://sources.redhat.com/automake/automake.html#Multiple-Outputs >
## Other cleaned files: dependency files generated by SWIG or this Makefile
MOSTLYCLEANFILES += $(DEPDIR)/*.S*
## Various SWIG variables. These can be overloaded in the including
## Makefile.am by setting the variable value there, then including
## Makefile.swig .
usrp_prims_swiginclude_HEADERS = \
usrp_prims.i \
$(usrp_prims_swiginclude_headers)
if PYTHON
usrp_prims_pylib_LTLIBRARIES = \
_usrp_prims.la
_usrp_prims_la_SOURCES = \
python/usrp_prims.cc \
$(usrp_prims_la_swig_sources)
usrp_prims_python_PYTHON = \
usrp_prims.py \
$(usrp_prims_python)
_usrp_prims_la_LIBADD = \
$(STD_SWIG_LA_LIB_ADD) \
$(usrp_prims_la_swig_libadd)
_usrp_prims_la_LDFLAGS = \
$(STD_SWIG_LA_LD_FLAGS) \
$(usrp_prims_la_swig_ldflags)
_usrp_prims_la_CXXFLAGS = \
$(STD_SWIG_CXX_FLAGS) \
-I$(top_builddir) \
$(usrp_prims_la_swig_cxxflags)
python/usrp_prims.cc: usrp_prims.py
usrp_prims.py: usrp_prims.i
# Include the python dependencies for this file
-include python/usrp_prims.d
endif # end of if python
if GUILE
usrp_prims_scmlib_LTLIBRARIES = \
libguile-gnuradio-usrp_prims.la
libguile_gnuradio_usrp_prims_la_SOURCES = \
guile/usrp_prims.cc \
$(usrp_prims_la_swig_sources)
nobase_usrp_prims_scm_DATA = \
gnuradio/usrp_prims.scm \
gnuradio/usrp_prims-primitive.scm
libguile_gnuradio_usrp_prims_la_LIBADD = \
$(STD_SWIG_LA_LIB_ADD) \
$(usrp_prims_la_swig_libadd)
libguile_gnuradio_usrp_prims_la_LDFLAGS = \
$(STD_SWIG_LA_LD_FLAGS) \
$(usrp_prims_la_swig_ldflags)
libguile_gnuradio_usrp_prims_la_CXXFLAGS = \
$(STD_SWIG_CXX_FLAGS) \
-I$(top_builddir) \
$(usrp_prims_la_swig_cxxflags)
guile/usrp_prims.cc: gnuradio/usrp_prims.scm
gnuradio/usrp_prims.scm: usrp_prims.i
gnuradio/usrp_prims-primitive.scm: gnuradio/usrp_prims.scm
# Include the guile dependencies for this file
-include guile/usrp_prims.d
endif # end of GUILE

301
m4/ax_boost_base.m4

@ -0,0 +1,301 @@
# ===========================================================================
# https://www.gnu.org/software/autoconf-archive/ax_boost_base.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_BOOST_BASE([MINIMUM-VERSION], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
#
# DESCRIPTION
#
# Test for the Boost C++ libraries of a particular version (or newer)
#
# If no path to the installed boost library is given the macro searchs
# under /usr, /usr/local, /opt and /opt/local and evaluates the
# $BOOST_ROOT environment variable. Further documentation is available at
# <http://randspringer.de/boost/index.html>.
#
# This macro calls:
#
# AC_SUBST(BOOST_CPPFLAGS) / AC_SUBST(BOOST_LDFLAGS)
#
# And sets:
#
# HAVE_BOOST
#
# LICENSE
#
# Copyright (c) 2008 Thomas Porschberg <thomas@randspringer.de>
# Copyright (c) 2009 Peter Adolphs
#
# Copying and distribution of this file, with or without modification, are
# permitted in any medium without royalty provided the copyright notice
# and this notice are preserved. This file is offered as-is, without any
# warranty.
#serial 43
# example boost program (need to pass version)
m4_define([_AX_BOOST_BASE_PROGRAM],
[AC_LANG_PROGRAM([[
#include <boost/version.hpp>
]],[[
(void) ((void)sizeof(char[1 - 2*!!((BOOST_VERSION) < ($1))]));
]])])
AC_DEFUN([AX_BOOST_BASE],
[
AC_ARG_WITH([boost],
[AS_HELP_STRING([--with-boost@<:@=ARG@:>@],
[use Boost library from a standard location (ARG=yes),
from the specified location (ARG=<path>),
or disable it (ARG=no)
@<:@ARG=yes@:>@ ])],
[
AS_CASE([$withval],
[no],[want_boost="no";_AX_BOOST_BASE_boost_path=""],
[yes],[want_boost="yes";_AX_BOOST_BASE_boost_path=""],
[want_boost="yes";_AX_BOOST_BASE_boost_path="$withval"])
],
[want_boost="yes"])
AC_ARG_WITH([boost-libdir],
[AS_HELP_STRING([--with-boost-libdir=LIB_DIR],
[Force given directory for boost libraries.
Note that this will override library path detection,
so use this parameter only if default library detection fails
and you know exactly where your boost libraries are located.])],
[
AS_IF([test -d "$withval"],
[_AX_BOOST_BASE_boost_lib_path="$withval"],
[AC_MSG_ERROR([--with-boost-libdir expected directory name])])
],
[_AX_BOOST_BASE_boost_lib_path=""])
BOOST_LDFLAGS=""
BOOST_CPPFLAGS=""
AS_IF([test "x$want_boost" = "xyes"],
[_AX_BOOST_BASE_RUNDETECT([$1],[$2],[$3])])
AC_SUBST(BOOST_CPPFLAGS)
AC_SUBST(BOOST_LDFLAGS)
])
# convert a version string in $2 to numeric and affect to polymorphic var $1
AC_DEFUN([_AX_BOOST_BASE_TONUMERICVERSION],[
AS_IF([test "x$2" = "x"],[_AX_BOOST_BASE_TONUMERICVERSION_req="1.20.0"],[_AX_BOOST_BASE_TONUMERICVERSION_req="$2"])
_AX_BOOST_BASE_TONUMERICVERSION_req_shorten=`expr $_AX_BOOST_BASE_TONUMERICVERSION_req : '\([[0-9]]*\.[[0-9]]*\)'`
_AX_BOOST_BASE_TONUMERICVERSION_req_major=`expr $_AX_BOOST_BASE_TONUMERICVERSION_req : '\([[0-9]]*\)'`
AS_IF([test "x$_AX_BOOST_BASE_TONUMERICVERSION_req_major" = "x"],
[AC_MSG_ERROR([You should at least specify libboost major version])])
_AX_BOOST_BASE_TONUMERICVERSION_req_minor=`expr $_AX_BOOST_BASE_TONUMERICVERSION_req : '[[0-9]]*\.\([[0-9]]*\)'`
AS_IF([test "x$_AX_BOOST_BASE_TONUMERICVERSION_req_minor" = "x"],
[_AX_BOOST_BASE_TONUMERICVERSION_req_minor="0"])
_AX_BOOST_BASE_TONUMERICVERSION_req_sub_minor=`expr $_AX_BOOST_BASE_TONUMERICVERSION_req : '[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)'`
AS_IF([test "X$_AX_BOOST_BASE_TONUMERICVERSION_req_sub_minor" = "X"],
[_AX_BOOST_BASE_TONUMERICVERSION_req_sub_minor="0"])
_AX_BOOST_BASE_TONUMERICVERSION_RET=`expr $_AX_BOOST_BASE_TONUMERICVERSION_req_major \* 100000 \+ $_AX_BOOST_BASE_TONUMERICVERSION_req_minor \* 100 \+ $_AX_BOOST_BASE_TONUMERICVERSION_req_sub_minor`
AS_VAR_SET($1,$_AX_BOOST_BASE_TONUMERICVERSION_RET)
])
dnl Run the detection of boost should be run only if $want_boost
AC_DEFUN([_AX_BOOST_BASE_RUNDETECT],[
_AX_BOOST_BASE_TONUMERICVERSION(WANT_BOOST_VERSION,[$1])
succeeded=no
AC_REQUIRE([AC_CANONICAL_HOST])
dnl On 64-bit systems check for system libraries in both lib64 and lib.
dnl The former is specified by FHS, but e.g. Debian does not adhere to
dnl this (as it rises problems for generic multi-arch support).
dnl The last entry in the list is chosen by default when no libraries
dnl are found, e.g. when only header-only libraries are installed!
AS_CASE([${host_cpu}],
[x86_64],[libsubdirs="lib64 libx32 lib lib64"],
[ppc64|s390x|sparc64|aarch64|ppc64le],[libsubdirs="lib64 lib lib64"],
[libsubdirs="lib"]
)
dnl allow for real multi-arch paths e.g. /usr/lib/x86_64-linux-gnu. Give
dnl them priority over the other paths since, if libs are found there, they
dnl are almost assuredly the ones desired.
AS_CASE([${host_cpu}],
[i?86],[multiarch_libsubdir="lib/i386-${host_os}"],
[multiarch_libsubdir="lib/${host_cpu}-${host_os}"]
)
dnl first we check the system location for boost libraries
dnl this location ist chosen if boost libraries are installed with the --layout=system option
dnl or if you install boost with RPM
AS_IF([test "x$_AX_BOOST_BASE_boost_path" != "x"],[
AC_MSG_CHECKING([for boostlib >= $1 ($WANT_BOOST_VERSION) includes in "$_AX_BOOST_BASE_boost_path/include"])
AS_IF([test -d "$_AX_BOOST_BASE_boost_path/include" && test -r "$_AX_BOOST_BASE_boost_path/include"],[
AC_MSG_RESULT([yes])
BOOST_CPPFLAGS="-I$_AX_BOOST_BASE_boost_path/include"
for _AX_BOOST_BASE_boost_path_tmp in $multiarch_libsubdir $libsubdirs; do
AC_MSG_CHECKING([for boostlib >= $1 ($WANT_BOOST_VERSION) lib path in "$_AX_BOOST_BASE_boost_path/$_AX_BOOST_BASE_boost_path_tmp"])
AS_IF([test -d "$_AX_BOOST_BASE_boost_path/$_AX_BOOST_BASE_boost_path_tmp" && test -r "$_AX_BOOST_BASE_boost_path/$_AX_BOOST_BASE_boost_path_tmp" ],[
AC_MSG_RESULT([yes])
BOOST_LDFLAGS="-L$_AX_BOOST_BASE_boost_path/$_AX_BOOST_BASE_boost_path_tmp";
break;
],
[AC_MSG_RESULT([no])])
done],[
AC_MSG_RESULT([no])])
],[
if test X"$cross_compiling" = Xyes; then
search_libsubdirs=$multiarch_libsubdir
else
search_libsubdirs="$multiarch_libsubdir $libsubdirs"
fi
for _AX_BOOST_BASE_boost_path_tmp in /usr /usr/local /opt /opt/local ; do
if test -d "$_AX_BOOST_BASE_boost_path_tmp/include/boost" && test -r "$_AX_BOOST_BASE_boost_path_tmp/include/boost" ; then
for libsubdir in $search_libsubdirs ; do
if ls "$_AX_BOOST_BASE_boost_path_tmp/$libsubdir/libboost_"* >/dev/null 2>&1 ; then break; fi
done
BOOST_LDFLAGS="-L$_AX_BOOST_BASE_boost_path_tmp/$libsubdir"
BOOST_CPPFLAGS="-I$_AX_BOOST_BASE_boost_path_tmp/include"
break;
fi
done
])
dnl overwrite ld flags if we have required special directory with
dnl --with-boost-libdir parameter
AS_IF([test "x$_AX_BOOST_BASE_boost_lib_path" != "x"],
[BOOST_LDFLAGS="-L$_AX_BOOST_BASE_boost_lib_path"])
AC_MSG_CHECKING([for boostlib >= $1 ($WANT_BOOST_VERSION)])
CPPFLAGS_SAVED="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
export CPPFLAGS
LDFLAGS_SAVED="$LDFLAGS"
LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
export LDFLAGS
AC_REQUIRE([AC_PROG_CXX])
AC_LANG_PUSH(C++)
AC_COMPILE_IFELSE([_AX_BOOST_BASE_PROGRAM($WANT_BOOST_VERSION)],[
AC_MSG_RESULT(yes)
succeeded=yes
found_system=yes
],[
])
AC_LANG_POP([C++])
dnl if we found no boost with system layout we search for boost libraries
dnl built and installed without the --layout=system option or for a staged(not installed) version
if test "x$succeeded" != "xyes" ; then
CPPFLAGS="$CPPFLAGS_SAVED"
LDFLAGS="$LDFLAGS_SAVED"
BOOST_CPPFLAGS=
if test -z "$_AX_BOOST_BASE_boost_lib_path" ; then
BOOST_LDFLAGS=
fi
_version=0
if test -n "$_AX_BOOST_BASE_boost_path" ; then
if test -d "$_AX_BOOST_BASE_boost_path" && test -r "$_AX_BOOST_BASE_boost_path"; then
for i in `ls -d $_AX_BOOST_BASE_boost_path/include/boost-* 2>/dev/null`; do
_version_tmp=`echo $i | sed "s#$_AX_BOOST_BASE_boost_path##" | sed 's/\/include\/boost-//' | sed 's/_/./'`
V_CHECK=`expr $_version_tmp \> $_version`
if test "x$V_CHECK" = "x1" ; then
_version=$_version_tmp
fi
VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'`
BOOST_CPPFLAGS="-I$_AX_BOOST_BASE_boost_path/include/boost-$VERSION_UNDERSCORE"
done
dnl if nothing found search for layout used in Windows distributions
if test -z "$BOOST_CPPFLAGS"; then
if test -d "$_AX_BOOST_BASE_boost_path/boost" && test -r "$_AX_BOOST_BASE_boost_path/boost"; then
BOOST_CPPFLAGS="-I$_AX_BOOST_BASE_boost_path"
fi
fi
dnl if we found something and BOOST_LDFLAGS was unset before
dnl (because "$_AX_BOOST_BASE_boost_lib_path" = ""), set it here.
if test -n "$BOOST_CPPFLAGS" && test -z "$BOOST_LDFLAGS"; then
for libsubdir in $libsubdirs ; do
if ls "$_AX_BOOST_BASE_boost_path/$libsubdir/libboost_"* >/dev/null 2>&1 ; then break; fi
done
BOOST_LDFLAGS="-L$_AX_BOOST_BASE_boost_path/$libsubdir"
fi
fi
else
if test "x$cross_compiling" != "xyes" ; then
for _AX_BOOST_BASE_boost_path in /usr /usr/local /opt /opt/local ; do
if test -d "$_AX_BOOST_BASE_boost_path" && test -r "$_AX_BOOST_BASE_boost_path" ; then
for i in `ls -d $_AX_BOOST_BASE_boost_path/include/boost-* 2>/dev/null`; do
_version_tmp=`echo $i | sed "s#$_AX_BOOST_BASE_boost_path##" | sed 's/\/include\/boost-//' | sed 's/_/./'`
V_CHECK=`expr $_version_tmp \> $_version`
if test "x$V_CHECK" = "x1" ; then
_version=$_version_tmp
best_path=$_AX_BOOST_BASE_boost_path
fi
done
fi
done
VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'`
BOOST_CPPFLAGS="-I$best_path/include/boost-$VERSION_UNDERSCORE"
if test -z "$_AX_BOOST_BASE_boost_lib_path" ; then
for libsubdir in $libsubdirs ; do
if ls "$best_path/$libsubdir/libboost_"* >/dev/null 2>&1 ; then break; fi
done
BOOST_LDFLAGS="-L$best_path/$libsubdir"
fi
fi
if test -n "$BOOST_ROOT" ; then
for libsubdir in $libsubdirs ; do
if ls "$BOOST_ROOT/stage/$libsubdir/libboost_"* >/dev/null 2>&1 ; then break; fi
done
if test -d "$BOOST_ROOT" && test -r "$BOOST_ROOT" && test -d "$BOOST_ROOT/stage/$libsubdir" && test -r "$BOOST_ROOT/stage/$libsubdir"; then
version_dir=`expr //$BOOST_ROOT : '.*/\(.*\)'`
stage_version=`echo $version_dir | sed 's/boost_//' | sed 's/_/./g'`
stage_version_shorten=`expr $stage_version : '\([[0-9]]*\.[[0-9]]*\)'`
V_CHECK=`expr $stage_version_shorten \>\= $_version`
if test "x$V_CHECK" = "x1" && test -z "$_AX_BOOST_BASE_boost_lib_path" ; then
AC_MSG_NOTICE(We will use a staged boost library from $BOOST_ROOT)
BOOST_CPPFLAGS="-I$BOOST_ROOT"
BOOST_LDFLAGS="-L$BOOST_ROOT/stage/$libsubdir"
fi
fi
fi
fi
CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
export CPPFLAGS
LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
export LDFLAGS
AC_LANG_PUSH(C++)
AC_COMPILE_IFELSE([_AX_BOOST_BASE_PROGRAM($WANT_BOOST_VERSION)],[
AC_MSG_RESULT(yes)
succeeded=yes
found_system=yes
],[
])
AC_LANG_POP([C++])
fi
if test "x$succeeded" != "xyes" ; then
if test "x$_version" = "x0" ; then
AC_MSG_NOTICE([[We could not detect the boost libraries (version $1 or higher). If you have a staged boost library (still not installed) please specify \$BOOST_ROOT in your environment and do not give a PATH to --with-boost option. If you are sure you have boost installed, then check your version number looking in <boost/version.hpp>. See http://randspringer.de/boost for more documentation.]])
else
AC_MSG_NOTICE([Your boost libraries seems to old (version $_version).])
fi
# execute ACTION-IF-NOT-FOUND (if present):
ifelse([$3], , :, [$3])
else
AC_DEFINE(HAVE_BOOST,,[define if the Boost library is available])
# execute ACTION-IF-FOUND (if present):
ifelse([$2], , :, [$2])
fi
CPPFLAGS="$CPPFLAGS_SAVED"
LDFLAGS="$LDFLAGS_SAVED"
])

113
m4/ax_boost_date_time.m4

@ -0,0 +1,113 @@
# ===========================================================================
# https://www.gnu.org/software/autoconf-archive/ax_boost_date_time.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_BOOST_DATE_TIME
#
# DESCRIPTION
#
# Test for Date_Time library from the Boost C++ libraries. The macro
# requires a preceding call to AX_BOOST_BASE. Further documentation is
# available at <http://randspringer.de/boost/index.html>.
#
# This macro calls:
#
# AC_SUBST(BOOST_DATE_TIME_LIB)
#
# And sets:
#
# HAVE_BOOST_DATE_TIME
#
# LICENSE
#
# Copyright (c) 2008 Thomas Porschberg <thomas@randspringer.de>
# Copyright (c) 2008 Michael Tindal
#
# Copying and distribution of this file, with or without modification, are
# permitted in any medium without royalty provided the copyright notice
# and this notice are preserved. This file is offered as-is, without any
# warranty.
#serial 22
AC_DEFUN([AX_BOOST_DATE_TIME],
[
AC_ARG_WITH([boost-date-time],
AS_HELP_STRING([--with-boost-date-time@<:@=special-lib@:>@],
[use the Date_Time library from boost - it is possible to specify a certain library for the linker
e.g. --with-boost-date-time=boost_date_time-gcc-mt-d-1_33_1 ]),
[
if test "$withval" = "no"; then
want_boost="no"
elif test "$withval" = "yes"; then
want_boost="yes"
ax_boost_user_date_time_lib=""
else
want_boost="yes"
ax_boost_user_date_time_lib="$withval"
fi
],
[want_boost="yes"]
)
if test "x$want_boost" = "xyes"; then
AC_REQUIRE([AC_PROG_CC])
CPPFLAGS_SAVED="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
export CPPFLAGS
LDFLAGS_SAVED="$LDFLAGS"
LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
export LDFLAGS
AC_CACHE_CHECK(whether the Boost::Date_Time library is available,
ax_cv_boost_date_time,
[AC_LANG_PUSH([C++])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include <boost/date_time/gregorian/gregorian_types.hpp>]],
[[using namespace boost::gregorian; date d(2002,Jan,10);
return 0;
]])],
ax_cv_boost_date_time=yes, ax_cv_boost_date_time=no)
AC_LANG_POP([C++])
])
if test "x$ax_cv_boost_date_time" = "xyes"; then
AC_DEFINE(HAVE_BOOST_DATE_TIME,,[define if the Boost::Date_Time library is available])
BOOSTLIBDIR=`echo $BOOST_LDFLAGS | sed -e 's/@<:@^\/@:>@*//'`
if test "x$ax_boost_user_date_time_lib" = "x"; then
for libextension in `ls $BOOSTLIBDIR/libboost_date_time*.so* $BOOSTLIBDIR/libboost_date_time*.dylib* $BOOSTLIBDIR/libboost_date_time*.a* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^lib\(boost_date_time.*\)\.so.*$;\1;' -e 's;^lib\(boost_date_time.*\)\.dylib.*$;\1;' -e 's;^lib\(boost_date_time.*\)\.a*$;\1;'` ; do
ax_lib=${libextension}
AC_CHECK_LIB($ax_lib, exit,
[BOOST_DATE_TIME_LIB="-l$ax_lib"; AC_SUBST(BOOST_DATE_TIME_LIB) link_date_time="yes"; break],
[link_date_time="no"])
done
if test "x$link_date_time" != "xyes"; then
for libextension in `ls $BOOSTLIBDIR/boost_date_time*.dll* $BOOSTLIBDIR/boost_date_time*.a* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^\(boost_date_time.*\)\.dll.*$;\1;' -e 's;^\(boost_date_time.*\)\.a.*$;\1;'` ; do
ax_lib=${libextension}
AC_CHECK_LIB($ax_lib, exit,
[BOOST_DATE_TIME_LIB="-l$ax_lib"; AC_SUBST(BOOST_DATE_TIME_LIB) link_date_time="yes"; break],
[link_date_time="no"])
done
fi
else
for ax_lib in $ax_boost_user_date_time_lib boost_date_time-$ax_boost_user_date_time_lib; do
AC_CHECK_LIB($ax_lib, main,
[BOOST_DATE_TIME_LIB="-l$ax_lib"; AC_SUBST(BOOST_DATE_TIME_LIB) link_date_time="yes"; break],
[link_date_time="no"])
done
fi
if test "x$ax_lib" = "x"; then
AC_MSG_ERROR(Could not find a version of the library!)
fi
if test "x$link_date_time" != "xyes"; then
AC_MSG_ERROR(Could not link against $ax_lib !)
fi
fi
CPPFLAGS="$CPPFLAGS_SAVED"
LDFLAGS="$LDFLAGS_SAVED"
fi
])

118
m4/ax_boost_filesystem.m4

@ -0,0 +1,118 @@
# ===========================================================================
# https://www.gnu.org/software/autoconf-archive/ax_boost_filesystem.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_BOOST_FILESYSTEM
#
# DESCRIPTION
#
# Test for Filesystem library from the Boost C++ libraries. The macro
# requires a preceding call to AX_BOOST_BASE. Further documentation is
# available at <http://randspringer.de/boost/index.html>.
#
# This macro calls:
#
# AC_SUBST(BOOST_FILESYSTEM_LIB)
#
# And sets:
#
# HAVE_BOOST_FILESYSTEM
#
# LICENSE
#
# Copyright (c) 2009 Thomas Porschberg <thomas@randspringer.de>
# Copyright (c) 2009 Michael Tindal
# Copyright (c) 2009 Roman Rybalko <libtorrent@romanr.info>
#
# Copying and distribution of this file, with or without modification, are
# permitted in any medium without royalty provided the copyright notice
# and this notice are preserved. This file is offered as-is, without any
# warranty.
#serial 27
AC_DEFUN([AX_BOOST_FILESYSTEM],
[
AC_ARG_WITH([boost-filesystem],
AS_HELP_STRING([--with-boost-filesystem@<:@=special-lib@:>@],
[use the Filesystem library from boost - it is possible to specify a certain library for the linker
e.g. --with-boost-filesystem=boost_filesystem-gcc-mt ]),
[
if test "$withval" = "no"; then
want_boost="no"
elif test "$withval" = "yes"; then
want_boost="yes"
ax_boost_user_filesystem_lib=""
else
want_boost="yes"
ax_boost_user_filesystem_lib="$withval"
fi
],
[want_boost="yes"]
)
if test "x$want_boost" = "xyes"; then
AC_REQUIRE([AC_PROG_CC])
CPPFLAGS_SAVED="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
export CPPFLAGS
LDFLAGS_SAVED="$LDFLAGS"
LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
export LDFLAGS
LIBS_SAVED=$LIBS
LIBS="$LIBS $BOOST_SYSTEM_LIB"
export LIBS
AC_CACHE_CHECK(whether the Boost::Filesystem library is available,
ax_cv_boost_filesystem,
[AC_LANG_PUSH([C++])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include <boost/filesystem/path.hpp>]],
[[using namespace boost::filesystem;
path my_path( "foo/bar/data.txt" );
return 0;]])],
ax_cv_boost_filesystem=yes, ax_cv_boost_filesystem=no)
AC_LANG_POP([C++])
])
if test "x$ax_cv_boost_filesystem" = "xyes"; then
AC_DEFINE(HAVE_BOOST_FILESYSTEM,,[define if the Boost::Filesystem library is available])
BOOSTLIBDIR=`echo $BOOST_LDFLAGS | sed -e 's/@<:@^\/@:>@*//'`
if test "x$ax_boost_user_filesystem_lib" = "x"; then
for libextension in `ls -r $BOOSTLIBDIR/libboost_filesystem* 2>/dev/null | sed 's,.*/lib,,' | sed 's,\..*,,'` ; do
ax_lib=${libextension}
AC_CHECK_LIB($ax_lib, exit,
[BOOST_FILESYSTEM_LIB="-l$ax_lib"; AC_SUBST(BOOST_FILESYSTEM_LIB) link_filesystem="yes"; break],
[link_filesystem="no"])
done
if test "x$link_filesystem" != "xyes"; then
for libextension in `ls -r $BOOSTLIBDIR/boost_filesystem* 2>/dev/null | sed 's,.*/,,' | sed -e 's,\..*,,'` ; do
ax_lib=${libextension}
AC_CHECK_LIB($ax_lib, exit,
[BOOST_FILESYSTEM_LIB="-l$ax_lib"; AC_SUBST(BOOST_FILESYSTEM_LIB) link_filesystem="yes"; break],
[link_filesystem="no"])
done
fi
else
for ax_lib in $ax_boost_user_filesystem_lib boost_filesystem-$ax_boost_user_filesystem_lib; do
AC_CHECK_LIB($ax_lib, exit,
[BOOST_FILESYSTEM_LIB="-l$ax_lib"; AC_SUBST(BOOST_FILESYSTEM_LIB) link_filesystem="yes"; break],
[link_filesystem="no"])
done
fi
if test "x$ax_lib" = "x"; then
AC_MSG_ERROR(Could not find a version of the library!)
fi
if test "x$link_filesystem" != "xyes"; then
AC_MSG_ERROR(Could not link against $ax_lib !)
fi
fi
CPPFLAGS="$CPPFLAGS_SAVED"
LDFLAGS="$LDFLAGS_SAVED"
LIBS="$LIBS_SAVED"
fi
])

116
m4/ax_boost_iostreams.m4

@ -0,0 +1,116 @@
# ===========================================================================
# https://www.gnu.org/software/autoconf-archive/ax_boost_iostreams.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_BOOST_IOSTREAMS
#
# DESCRIPTION
#
# Test for IOStreams library from the Boost C++ libraries. The macro
# requires a preceding call to AX_BOOST_BASE. Further documentation is
# available at <http://randspringer.de/boost/index.html>.
#
# This macro calls:
#
# AC_SUBST(BOOST_IOSTREAMS_LIB)
#
# And sets:
#
# HAVE_BOOST_IOSTREAMS
#
# LICENSE
#
# Copyright (c) 2008 Thomas Porschberg <thomas@randspringer.de>
#
# Copying and distribution of this file, with or without modification, are
# permitted in any medium without royalty provided the copyright notice
# and this notice are preserved. This file is offered as-is, without any
# warranty.
#serial 21
AC_DEFUN([AX_BOOST_IOSTREAMS],
[
AC_ARG_WITH([boost-iostreams],
AS_HELP_STRING([--with-boost-iostreams@<:@=special-lib@:>@],
[use the IOStreams library from boost - it is possible to specify a certain library for the linker
e.g. --with-boost-iostreams=boost_iostreams-gcc-mt-d-1_33_1 ]),
[
if test "$withval" = "no"; then
want_boost="no"
elif test "$withval" = "yes"; then
want_boost="yes"
ax_boost_user_iostreams_lib=""
else
want_boost="yes"
ax_boost_user_iostreams_lib="$withval"
fi
],
[want_boost="yes"]
)
if test "x$want_boost" = "xyes"; then
AC_REQUIRE([AC_PROG_CC])
CPPFLAGS_SAVED="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
export CPPFLAGS
LDFLAGS_SAVED="$LDFLAGS"
LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
export LDFLAGS
AC_CACHE_CHECK(whether the Boost::IOStreams library is available,
ax_cv_boost_iostreams,
[AC_LANG_PUSH([C++])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include <boost/iostreams/filtering_stream.hpp>
@%:@include <boost/range/iterator_range.hpp>
]],
[[std::string input = "Hello World!";
namespace io = boost::iostreams;
io::filtering_istream in(boost::make_iterator_range(input));
return 0;
]])],
ax_cv_boost_iostreams=yes, ax_cv_boost_iostreams=no)
AC_LANG_POP([C++])
])
if test "x$ax_cv_boost_iostreams" = "xyes"; then
AC_DEFINE(HAVE_BOOST_IOSTREAMS,,[define if the Boost::IOStreams library is available])
BOOSTLIBDIR=`echo $BOOST_LDFLAGS | sed -e 's/@<:@^\/@:>@*//'`
if test "x$ax_boost_user_iostreams_lib" = "x"; then
for libextension in `ls $BOOSTLIBDIR/libboost_iostreams*.so* $BOOSTLIBDIR/libboost_iostream*.dylib* $BOOSTLIBDIR/libboost_iostreams*.a* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^lib\(boost_iostreams.*\)\.so.*$;\1;' -e 's;^lib\(boost_iostream.*\)\.dylib.*$;\1;' -e 's;^lib\(boost_iostreams.*\)\.a.*$;\1;'` ; do
ax_lib=${libextension}
AC_CHECK_LIB($ax_lib, exit,
[BOOST_IOSTREAMS_LIB="-l$ax_lib"; AC_SUBST(BOOST_IOSTREAMS_LIB) link_iostreams="yes"; break],
[link_iostreams="no"])
done
if test "x$link_iostreams" != "xyes"; then