From 5c02ea03e1226ed706abeede426f0e1727f1ea25 Mon Sep 17 00:00:00 2001 From: eb Date: Thu, 21 Aug 2008 00:01:21 +0000 Subject: [PATCH] Updated gr-howto-write-a-block; mostly the .m4 macros and configure.ac. Also modified pkg.m4 to restore the FOO_INCLUDEDIR functionality and to add the FOO_CPPFLAGS variable for those times when you want only the -I, -D and -U flags from FOO_CFLAGS. git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@9362 221aa14e-8319-0410-a670-987f0aec2ac5 --- config/pkg.m4 | 26 +- configure.ac | 20 +- gr-howto-write-a-block/INSTALL | 5 +- gr-howto-write-a-block/config/acx_pthread.m4 | 147 ++++++-- .../config/ax_boost_base.m4 | 334 ++++++++++++++++++ .../config/ax_boost_date_time.m4 | 34 ++ .../config/ax_boost_filesystem.m4 | 45 +++ .../config/ax_boost_iostreams.m4 | 39 ++ .../config/ax_boost_program_options.m4 | 35 ++ .../config/ax_boost_python.m4 | 92 +++++ .../config/ax_boost_regex.m4 | 35 ++ .../config/ax_boost_serialization.m4 | 38 ++ .../config/ax_boost_signals.m4 | 35 ++ .../config/ax_boost_system.m4 | 40 +++ .../config/ax_boost_test_exec_monitor.m4 | 35 ++ .../config/ax_boost_thread.m4 | 72 ++++ .../config/ax_boost_unit_test_framework.m4 | 36 ++ .../config/ax_boost_wserialization.m4 | 46 +++ gr-howto-write-a-block/config/gr_boost.m4 | 111 ------ gr-howto-write-a-block/config/gr_doxygen.m4 | 15 +- gr-howto-write-a-block/config/gr_fortran.m4 | 32 ++ gr-howto-write-a-block/config/gr_lib64.m4 | 85 +++++ .../config/gr_omnithread.m4 | 9 +- gr-howto-write-a-block/config/gr_python.m4 | 135 +++---- gr-howto-write-a-block/config/gr_scripting.m4 | 2 +- .../config/gr_set_md_cpu.m4 | 18 +- .../config/{gr_x86_64.m4 => gr_subversion.m4} | 31 +- gr-howto-write-a-block/config/lf_cxx.m4 | 54 --- gr-howto-write-a-block/config/pkg.m4 | 246 +++++++++---- .../config/usrp_fusb_tech.m4 | 82 +++-- gr-howto-write-a-block/config/usrp_libusb.m4 | 81 +++-- gr-howto-write-a-block/config/usrp_sdcc.m4 | 72 ++-- gr-howto-write-a-block/configure.ac | 68 +++- gr-howto-write-a-block/src/lib/Makefile.am | 5 +- 34 files changed, 1673 insertions(+), 487 deletions(-) create mode 100644 gr-howto-write-a-block/config/ax_boost_base.m4 create mode 100644 gr-howto-write-a-block/config/ax_boost_date_time.m4 create mode 100644 gr-howto-write-a-block/config/ax_boost_filesystem.m4 create mode 100644 gr-howto-write-a-block/config/ax_boost_iostreams.m4 create mode 100644 gr-howto-write-a-block/config/ax_boost_program_options.m4 create mode 100644 gr-howto-write-a-block/config/ax_boost_python.m4 create mode 100644 gr-howto-write-a-block/config/ax_boost_regex.m4 create mode 100644 gr-howto-write-a-block/config/ax_boost_serialization.m4 create mode 100644 gr-howto-write-a-block/config/ax_boost_signals.m4 create mode 100644 gr-howto-write-a-block/config/ax_boost_system.m4 create mode 100644 gr-howto-write-a-block/config/ax_boost_test_exec_monitor.m4 create mode 100644 gr-howto-write-a-block/config/ax_boost_thread.m4 create mode 100644 gr-howto-write-a-block/config/ax_boost_unit_test_framework.m4 create mode 100644 gr-howto-write-a-block/config/ax_boost_wserialization.m4 delete mode 100644 gr-howto-write-a-block/config/gr_boost.m4 create mode 100644 gr-howto-write-a-block/config/gr_fortran.m4 create mode 100644 gr-howto-write-a-block/config/gr_lib64.m4 rename gr-howto-write-a-block/config/{gr_x86_64.m4 => gr_subversion.m4} (60%) diff --git a/config/pkg.m4 b/config/pkg.m4 index b85cf3a3..80bdfed4 100644 --- a/config/pkg.m4 +++ b/config/pkg.m4 @@ -1,6 +1,7 @@ # pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- # # Copyright © 2004 Scott James Remnant . +# Copyright © 2008 Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -96,8 +97,14 @@ fi[]dnl # # E.g., # PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not) -# defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page -# also defines GSTUFF_PKG_ERRORS on error +# defines: +# +# GSTUFF_LIBS +# GSTUFF_CFLAGS +# GSTUFF_INCLUDEDIR +# GSTUFF_CPPFLAGS # the -I, -D and -U's out of CFLAGS +# +# see pkg-config man page also defines GSTUFF_PKG_ERRORS on error # # Note that if there is a possibility the first call to # PKG_CHECK_MODULES might not happen, you should be sure to include an @@ -108,6 +115,7 @@ AC_DEFUN([PKG_CHECK_MODULES], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])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 pkg_failed=no AC_MSG_CHECKING([for $1]) @@ -121,6 +129,9 @@ else _PKG_CONFIG([$1][_LIBS], [libs --static], [$2]) fi +_PKG_CONFIG([$1][_INCLUDEDIR], [variable=includedir], [$2]) + + m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS and $1[]_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details.]) @@ -160,6 +171,17 @@ To get pkg-config, see .])], else $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS $1[]_LIBS=$pkg_cv_[]$1[]_LIBS + $1[]_INCLUDEDIR=$pkg_cv_[]$1[]_INCLUDEDIR + + $1[]_CPPFLAGS="" + for flag in $$1[]_CFLAGS; do + case $flag in + -I* | -D* | -U*) $1[]_CPPFLAGS="$$1[]_CPPFLAGS $flag" ;; + esac + done + pkg_cv_[]$1[]_CPPFLAGS=$$1[]_CPPFLAGS + AC_SUBST($1[]_CPPFLAGS) + AC_MSG_RESULT([yes]) ifelse([$3], , :, [$3]) fi[]dnl diff --git a/configure.ac b/configure.ac index 389d7478..8c1ceccd 100644 --- a/configure.ac +++ b/configure.ac @@ -28,14 +28,6 @@ AC_CANONICAL_TARGET AM_INIT_AUTOMAKE(gnuradio,3.1svn) -dnl add ${prefix}/lib/pkgconfig to the head of the PKG_CONFIG_PATH -if test x${PKG_CONFIG_PATH} = x; then - PKG_CONFIG_PATH=${prefix}/lib/pkgconfig -else - PKG_CONFIG_PATH=${prefix}/lib/pkgconfig:${PKG_CONFIG_PATH} -fi -export PKG_CONFIG_PATH - DEFINES="" AC_SUBST(DEFINES) @@ -75,6 +67,16 @@ fi AC_SUBST(autoconf_default_CXXFLAGS) AC_SUBST(swig_CXXFLAGS) + +dnl add ${prefix}/lib${gr_libdir_suffix}/pkgconfig to the head of the PKG_CONFIG_PATH +if test x${PKG_CONFIG_PATH} = x; then + PKG_CONFIG_PATH=${prefix}/lib${gr_libdir_suffix}/pkgconfig +else + PKG_CONFIG_PATH=${prefix}/lib${gr_libdir_suffix}/pkgconfig:${PKG_CONFIG_PATH} +fi +export PKG_CONFIG_PATH + + LF_SET_WARNINGS GR_SET_GPROF GR_SET_PROF @@ -105,6 +107,7 @@ GR_OMNITHREAD CFLAGS="$CFLAGS $PTHREAD_CFLAGS" CXXFLAGS="$CXXFLAGS $PTHREAD_CFLAGS" +dnl Set the c++ compiler that we use for the build system when cross compiling if test x$CXX_FOR_BUILD = x then if test x$cross_compiling = xno; then @@ -113,7 +116,6 @@ then CXX_FOR_BUILD=g++ fi fi - AC_SUBST(CXX_FOR_BUILD) dnl Check for SysV shm (mandatory) diff --git a/gr-howto-write-a-block/INSTALL b/gr-howto-write-a-block/INSTALL index 5458714e..d3c5b40a 100644 --- a/gr-howto-write-a-block/INSTALL +++ b/gr-howto-write-a-block/INSTALL @@ -2,7 +2,7 @@ Installation Instructions ************************* Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005, -2006 Free Software Foundation, Inc. +2006, 2007 Free Software Foundation, Inc. This file is free documentation; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. @@ -67,6 +67,9 @@ The simplest way to compile this package is: all sorts of other programs in order to regenerate files that came with the distribution. + 6. Often, you can also type `make uninstall' to remove the installed + files again. + Compilers and Options ===================== diff --git a/gr-howto-write-a-block/config/acx_pthread.m4 b/gr-howto-write-a-block/config/acx_pthread.m4 index d318ab01..eb09f5ac 100644 --- a/gr-howto-write-a-block/config/acx_pthread.m4 +++ b/gr-howto-write-a-block/config/acx_pthread.m4 @@ -1,6 +1,84 @@ -dnl Available from the GNU Autoconf Macro Archive at: -dnl http://www.gnu.org/software/ac-archive/htmldoc/acx_pthread.html -dnl +# =========================================================================== +# http://autoconf-archive.cryp.to/acx_pthread.html +# =========================================================================== +# +# SYNOPSIS +# +# ACX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) +# +# DESCRIPTION +# +# This macro figures out how to build C programs using POSIX threads. It +# sets the PTHREAD_LIBS output variable to the threads library and linker +# flags, and the PTHREAD_CFLAGS output variable to any special C compiler +# flags that are needed. (The user can also force certain compiler +# flags/libs to be tested by setting these environment variables.) +# +# Also sets PTHREAD_CC to any special C compiler that is needed for +# multi-threaded programs (defaults to the value of CC otherwise). (This +# is necessary on AIX to use the special cc_r compiler alias.) +# +# NOTE: You are assumed to not only compile your program with these flags, +# but also link it with them as well. e.g. you should link with +# $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS $LIBS +# +# If you are only building threads programs, you may wish to use these +# variables in your default LIBS, CFLAGS, and CC: +# +# LIBS="$PTHREAD_LIBS $LIBS" +# CFLAGS="$CFLAGS $PTHREAD_CFLAGS" +# CC="$PTHREAD_CC" +# +# In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute constant +# has a nonstandard name, defines PTHREAD_CREATE_JOINABLE to that name +# (e.g. PTHREAD_CREATE_UNDETACHED on AIX). +# +# ACTION-IF-FOUND is a list of shell commands to run if a threads library +# is found, and ACTION-IF-NOT-FOUND is a list of commands to run it if it +# is not found. If ACTION-IF-FOUND is not specified, the default action +# will define HAVE_PTHREAD. +# +# Please let the authors know if this macro fails on any platform, or if +# you have any other suggestions or comments. This macro was based on work +# by SGJ on autoconf scripts for FFTW (http://www.fftw.org/) (with help +# from M. Frigo), as well as ac_pthread and hb_pthread macros posted by +# Alejandro Forero Cuervo to the autoconf macro repository. We are also +# grateful for the helpful feedback of numerous users. +# +# LAST MODIFICATION +# +# 2008-04-12 +# +# COPYLEFT +# +# Copyright (c) 2008 Steven G. Johnson +# +# This program 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 of the License, or (at your +# option) any later version. +# +# This program 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 . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Macro Archive. When you make and +# distribute a modified version of the Autoconf Macro, you may extend this +# special exception to the GPL to apply to your modified version as well. + AC_DEFUN([ACX_PTHREAD], [ AC_REQUIRE([AC_CANONICAL_HOST]) AC_LANG_SAVE @@ -37,9 +115,10 @@ fi # Create a list of thread flags to try. Items starting with a "-" are # C compiler flags, and other items are library names, except for "none" -# which indicates that we try without any flags at all. +# which indicates that we try without any flags at all, and "pthread-config" +# which is a program returning the flags for the Pth emulation library. -acx_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt" +acx_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config" # The ordering *is* (sometimes) important. Some notes on the # individual items follow: @@ -56,21 +135,23 @@ acx_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -m # -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it # doesn't hurt to check since this sometimes defines pthreads too; # also defines -D_REENTRANT) +# ... -mt is also the pthreads flag for HP/aCC # pthread: Linux, etcetera # --thread-safe: KAI C++ +# pthread-config: use pthread-config program (for GNU Pth library) case "${host_cpu}-${host_os}" in *solaris*) # On Solaris (at least, for some versions), libc contains stubbed # (non-functional) versions of the pthreads routines, so link-based - # tests will erroneously succeed. (We need to link with -pthread or + # tests will erroneously succeed. (We need to link with -pthreads/-mt/ # -lpthread.) (The stubs are missing pthread_cleanup_push, or rather # a function called by this macro, so we could check for that, but # who knows whether they'll stub that too in a future libc.) So, # we'll just look for -pthreads and -lpthread first: - acx_pthread_flags="-pthread -pthreads pthread -mt $acx_pthread_flags" + acx_pthread_flags="-pthreads pthread -mt -pthread $acx_pthread_flags" ;; esac @@ -87,6 +168,13 @@ for flag in $acx_pthread_flags; do PTHREAD_CFLAGS="$flag" ;; + pthread-config) + AC_CHECK_PROG(acx_pthread_config, pthread-config, yes, no) + if test x"$acx_pthread_config" = xno; then continue; fi + PTHREAD_CFLAGS="`pthread-config --cflags`" + PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`" + ;; + *) AC_MSG_CHECKING([for the pthreads library -l$flag]) PTHREAD_LIBS="-l$flag" @@ -133,43 +221,40 @@ if test "x$acx_pthread_ok" = xyes; then save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $PTHREAD_CFLAGS" - # Detect AIX lossage: threads are created detached by default - # and the JOINABLE attribute has a nonstandard name (UNDETACHED). - AC_MSG_CHECKING([for joinable pthread attribute]) - AC_TRY_LINK([#include ], - [int attr=PTHREAD_CREATE_JOINABLE;], - ok=PTHREAD_CREATE_JOINABLE, ok=unknown) - if test x"$ok" = xunknown; then - AC_TRY_LINK([#include ], - [int attr=PTHREAD_CREATE_UNDETACHED;], - ok=PTHREAD_CREATE_UNDETACHED, ok=unknown) - fi - if test x"$ok" != xPTHREAD_CREATE_JOINABLE; then - AC_DEFINE(PTHREAD_CREATE_JOINABLE, $ok, - [Define to the necessary symbol if this constant - uses a non-standard name on your system.]) - fi - AC_MSG_RESULT(${ok}) - if test x"$ok" = xunknown; then - AC_MSG_WARN([we do not know how to create joinable pthreads]) + # Detect AIX lossage: JOINABLE attribute is called UNDETACHED. + AC_MSG_CHECKING([for joinable pthread attribute]) + attr_name=unknown + for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do + AC_TRY_LINK([#include ], [int attr=$attr; return attr;], + [attr_name=$attr; break]) + done + AC_MSG_RESULT($attr_name) + if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then + AC_DEFINE_UNQUOTED(PTHREAD_CREATE_JOINABLE, $attr_name, + [Define to necessary symbol if this constant + uses a non-standard name on your system.]) fi AC_MSG_CHECKING([if more special flags are required for pthreads]) flag=no case "${host_cpu}-${host_os}" in - *-aix* | *-freebsd*) flag="-D_THREAD_SAFE";; - *solaris* | *-osf* | *-hpux*) flag="-D_REENTRANT";; + *-aix* | *-freebsd* | *-darwin*) flag="-D_THREAD_SAFE";; + *solaris* | *-osf* | *-hpux*) flag="-D_REENTRANT";; esac AC_MSG_RESULT(${flag}) if test "x$flag" != xno; then - PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS" + PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS" fi LIBS="$save_LIBS" CFLAGS="$save_CFLAGS" - # More AIX lossage: must compile with cc_r - AC_CHECK_PROG(PTHREAD_CC, cc_r, cc_r, ${CC}) + # More AIX lossage: must compile with xlc_r or cc_r + if test x"$GCC" != xyes; then + AC_CHECK_PROGS(PTHREAD_CC, xlc_r cc_r, ${CC}) + else + PTHREAD_CC=$CC + fi else PTHREAD_CC="$CC" fi diff --git a/gr-howto-write-a-block/config/ax_boost_base.m4 b/gr-howto-write-a-block/config/ax_boost_base.m4 new file mode 100644 index 00000000..e9790227 --- /dev/null +++ b/gr-howto-write-a-block/config/ax_boost_base.m4 @@ -0,0 +1,334 @@ +# =========================================================================== +# http://autoconf-archive.cryp.to/ax_boost_base.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_BOOST_BASE([MINIMUM-VERSION]) +# +# 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 +# . +# +# This macro calls: +# +# AC_SUBST(BOOST_CPPFLAGS) / AC_SUBST(BOOST_LDFLAGS) +# +# And sets: +# +# HAVE_BOOST +# +# LAST MODIFICATION +# +# 2008-04-12 +# +# COPYLEFT +# +# Copyright (c) 2008 Thomas Porschberg +# Copyright (c) 2008 Free Software Foundation, Inc. +# +# 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. + +AC_DEFUN([AX_BOOST_BASE], +[ +AC_REQUIRE([GR_LIB64]) +AC_ARG_WITH([boost], + AS_HELP_STRING([--with-boost@<:@=DIR@:>@], + [use boost (default is yes) - it is possible to specify the root directory for boost (optional)]), + [ + if test "$withval" = "no"; then + want_boost="no" + elif test "$withval" = "yes"; then + want_boost="yes" + ac_boost_path="" + else + want_boost="yes" + ac_boost_path="$withval" + fi + ], + [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 overwrite library path detection, so use this parameter + only if default library detection fails and you know exactly + where your boost libraries are located.]), + [ + if test -d $withval + then + ac_boost_lib_path="$withval" + else + AC_MSG_ERROR(--with-boost-libdir expected directory name) + fi + ], + [ac_boost_lib_path=""] +) + +if test "x$want_boost" = "xyes"; then + boost_lib_version_req=ifelse([$1], ,1.20.0,$1) + boost_lib_version_req_shorten=`expr $boost_lib_version_req : '\([[0-9]]*\.[[0-9]]*\)'` + boost_lib_version_req_major=`expr $boost_lib_version_req : '\([[0-9]]*\)'` + boost_lib_version_req_minor=`expr $boost_lib_version_req : '[[0-9]]*\.\([[0-9]]*\)'` + boost_lib_version_req_sub_minor=`expr $boost_lib_version_req : '[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)'` + if test "x$boost_lib_version_req_sub_minor" = "x" ; then + boost_lib_version_req_sub_minor="0" + fi + WANT_BOOST_VERSION=`expr $boost_lib_version_req_major \* 100000 \+ $boost_lib_version_req_minor \* 100 \+ $boost_lib_version_req_sub_minor` + AC_MSG_CHECKING(for boost >= $boost_lib_version_req) + succeeded=no + + 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 + if test "$ac_boost_path" != ""; then + dnl Look first where we think they ought to be, accounting for a possible "64" suffix on lib. + dnl If that directory doesn't exist, fall back to the default behavior + if test -d "$ac_boost_path/lib${gr_libdir_suffix}"; then + BOOST_LDFLAGS="-L$ac_boost_path/lib${gr_libdir_suffix}" + else + BOOST_LDFLAGS="-L$ac_boost_path/lib" + fi + BOOST_CPPFLAGS="-I$ac_boost_path/include" + else + for ac_boost_path_tmp in /usr /usr/local /opt /opt/local ; do + if test -d "$ac_boost_path_tmp/include/boost" && test -r "$ac_boost_path_tmp/include/boost"; then + dnl Look first where we think they ought to be, accounting for a possible "64" suffix on lib. + dnl If that directory doesn't exist, fall back to the default behavior + if test -d "$ac_boost_path_tmp/lib${gr_libdir_suffix}"; then + BOOST_LDFLAGS="-L$ac_boost_path_tmp/lib${gr_libdir_suffix}" + else + BOOST_LDFLAGS="-L$ac_boost_path_tmp/lib" + fi + BOOST_CPPFLAGS="-I$ac_boost_path_tmp/include" + break; + fi + done + fi + + dnl overwrite ld flags if we have required special directory with + dnl --with-boost-libdir parameter + if test "$ac_boost_lib_path" != ""; then + BOOST_LDFLAGS="-L$ac_boost_lib_path" + fi + + CPPFLAGS_SAVED="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" + export CPPFLAGS + + LDFLAGS_SAVED="$LDFLAGS" + LDFLAGS="$LDFLAGS $BOOST_LDFLAGS" + export LDFLAGS + + AC_LANG_PUSH(C++) + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ + @%:@include + ]], [[ + #if BOOST_VERSION >= $WANT_BOOST_VERSION + // Everything is okay + #else + # error Boost version is too old + #endif + ]])],[AC_MSG_RESULT(yes) + succeeded=yes + found_system=yes + ], + []) + AC_LANG_POP([C++]) + CPPFLAGS="$CPPFLAGS_SAVED" + LDFLAGS="$LDFLAGS_SAVED" + + + dnl if we found no boost with system layout we search for boost libraries + dnl built and installed without the --layout=system option + if test "$succeeded" != "yes"; then + _version=0 + + if test "$ac_boost_path" != ""; then + path_list="$ac_boost_path" + else + path_list="/usr /usr/local /opt /opt/local" + fi + for ac_boost_path in $path_list ; do + if test -d "$ac_boost_path" && test -r "$ac_boost_path"; then + for i in `ls -d $ac_boost_path/include/boost-* 2>/dev/null`; do + _version_tmp=`echo $i | sed "s#$ac_boost_path##" | sed 's,/include/boost-,,; s,_,.,'` + V_CHECK=`expr $_version_tmp \> $_version` + if test "$V_CHECK" = "1" ; then + _version=$_version_tmp + best_path=$ac_boost_path + fi + done + fi + done + + VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'` + BOOST_CPPFLAGS="-I$best_path/include/boost-$VERSION_UNDERSCORE" + + if test "$ac_boost_lib_path" = ""; then + dnl Look first where we think they ought to be, accounting for a possible "64" suffix on lib. + dnl If that directory doesn't exist, fall back to the default behavior + if test -d "$best_path/lib${gr_libdir_suffix}"; then + BOOST_LDFLAGS="-L$best_path/lib${gr_libdir_suffix}" + else + BOOST_LDFLAGS="-L$best_path/lib" + fi + fi + + CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" + export CPPFLAGS + LDFLAGS="$LDFLAGS $BOOST_LDFLAGS" + export LDFLAGS + + AC_LANG_PUSH(C++) + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ + @%:@include + ]], [[ + #if BOOST_VERSION >= $WANT_BOOST_VERSION + // Everything is okay + #else + # error Boost version is too old + #endif + ]])],[AC_MSG_RESULT(yes) + succeeded=yes + found_system=yes + ], + []) + AC_LANG_POP([C++]) + CPPFLAGS="$CPPFLAGS_SAVED" + LDFLAGS="$LDFLAGS_SAVED" + fi + + if test "$succeeded" != "yes" ; then + AC_MSG_RESULT([no]) + if test "$_version" = "0" ; then + AC_MSG_ERROR([[we could not detect the boost libraries (version $boost_lib_version_req_shorten or higher). +If you are sure you have boost installed, then check your version number looking in .]]) + else + AC_MSG_ERROR([your boost libraries seem to old (version $_version).]) + fi + else + AC_SUBST(BOOST_CPPFLAGS) + AC_SUBST(BOOST_LDFLAGS) + AC_DEFINE(HAVE_BOOST,1,[Define if the Boost headers are available]) + fi +fi +]) + +dnl +dnl Macros used by the boost items that need libraries. +dnl + +dnl $1 is unit name. E.g., boost_thread +AC_DEFUN([_AX_BOOST_CHECK_LIB],[ + _AX_BOOST_CHECK_LIB_($1,HAVE_[]m4_toupper($1),m4_toupper($1)_LIB) +]) + +dnl $1 is unit name. E.g., boost_thread +dnl $2 is AC_DEFINE name. E.g., HAVE_BOOST_THREAD +dnl $3 is lib var name. E.g., BOOST_THREAD_LIB +AC_DEFUN([_AX_BOOST_CHECK_LIB_],[ + AC_LANG_PUSH([C++]) + AC_DEFINE($2,1,[Define if the $1 library is available]) + BOOSTLIBDIR=`echo $BOOST_LDFLAGS | sed -e 's/@<:@^\/@:>@*//'` + + dnl See if we can find a usable library + link_ok="no" + if test "$ax_boost_user_lib" != ""; then + dnl use what the user supplied + for ax_lib in $ax_boost_user_lib $1-${ax_boost_user_lib}; do + AC_CHECK_LIB($ax_lib, exit, + [$3="-l$ax_lib"; AC_SUBST($3) link_ok="yes"; break]) + done + else + dnl Look in BOOSTLIBDIR for possible candidates + head=$BOOSTLIBDIR/lib[]$1 + for f in ${head}*.so* ${head}*.a* ${head}*.dll* ${head}*.dylib; do + dnl echo 1: $f + case $f in + *\**) continue;; + esac + f=`echo $f | sed -e 's,.*/,,' -e 's,^lib,,'` + dnl echo 2: $f + f=`echo $f | sed -e 's,\($1.*\)\.so.*$,\1,' -e 's,\($1.*\)\.a.*$,\1,' -e 's,\($1.*\)\.dll.*$,\1,' -e 's,\($1.*\)\.dylib.*$,\1,'` + dnl echo 3: $f + + ax_lib=$f + AC_CHECK_LIB($ax_lib, exit, + [$3="-l$ax_lib"; AC_SUBST($3) link_ok="yes"; break]) + done + fi + + if test "$link_ok" != "yes"; then + AC_MSG_ERROR([Could not link against lib[$1]!]) + fi + AC_LANG_POP([C++]) +]) + + +dnl $1 is unit name. E.g., boost_thread +AC_DEFUN([_AX_BOOST_WITH],[ + _AX_BOOST_WITH_($1,m4_bpatsubst($1,_,-)) +]) + +dnl $1 is unit name. E.g., boost_thread +dnl $2 is hyphenated unit name. E.g., boost-thread +AC_DEFUN([_AX_BOOST_WITH_],[ + AC_ARG_WITH([$2], + AC_HELP_STRING([--with-$2@<:@=special-lib@:>@], + [Use the m4_substr($1,6) library from boost. It is possible to specify a certain + library to the linker. E.g., --with-$2=$1-gcc41-mt-1_35]), + [ + if test "$withval" = "no"; then + want_boost="no" + elif test "$withval" = "yes"; then + want_boost="yes" + ax_boost_user_lib="" + else + want_boost="yes" + ax_boost_user_lib="$withval" + fi + ], + [want_boost="yes"]) +]) + +dnl $1 is unit name. E.g., boost_thread +dnl $2 is AC_LANG_PROGRAM argument 1 +dnl $3 is AC_LANG_PROGRAM argument 2 +dnl $4 is cv variable name. E.g., ax_cv_boost_thread +AC_DEFUN([_AX_BOOST_CHECK_],[ + _AX_BOOST_WITH($1) + if test "$want_boost" = "yes"; then + AC_REQUIRE([AC_PROG_CC]) + AC_REQUIRE([AC_PROG_CXX]) + CPPFLAGS_SAVED="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" + LDFLAGS_SAVED="$LDFLAGS" + LDFLAGS="$LDFLAGS $BOOST_LDFLAGS" + AC_CACHE_CHECK([whether the boost::m4_substr([$1],6) includes are available], [$4], + [AC_LANG_PUSH([C++]) + AC_COMPILE_IFELSE(AC_LANG_PROGRAM([$2],[$3]),[$4]=yes,[$4]=no) + AC_LANG_POP([C++]) + ]) + if test "$[$4]" = "yes"; then + _AX_BOOST_CHECK_LIB([$1]) + fi + CPPFLAGS="$CPPFLAGS_SAVED" + LDFLAGS="$LDFLAGS_SAVED" + fi +]) + +dnl $1 is unit name. E.g., boost_thread +dnl $2 is AC_LANG_PROGRAM argument 1 +dnl $3 is AC_LANG_PROGRAM argument 2 +AC_DEFUN([_AX_BOOST_CHECK],[ + _AX_BOOST_CHECK_($1,$2,$3,ax_cv_$1) +]) diff --git a/gr-howto-write-a-block/config/ax_boost_date_time.m4 b/gr-howto-write-a-block/config/ax_boost_date_time.m4 new file mode 100644 index 00000000..7b3f0fe3 --- /dev/null +++ b/gr-howto-write-a-block/config/ax_boost_date_time.m4 @@ -0,0 +1,34 @@ +# +# SYNOPSIS +# +# AX_BOOST_DATE_TIME +# +# DESCRIPTION +# +# Test for date_time library from the Boost C++ libraries. +# +# This macro calls: +# +# AC_SUBST(BOOST_DATE_TIME_LIB) +# +# And sets: +# +# HAVE_BOOST_DATE_TIME +# +# COPYLEFT +# +# Copyright (c) 2008 Thomas Porschberg +# Copyright (c) 2008 Michael Tindal +# Copyright (c) 2008 Free Software Foundation, Inc. +# +# 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. + +AC_DEFUN([AX_BOOST_DATE_TIME], +[ + AC_REQUIRE([AX_BOOST_BASE]) + _AX_BOOST_CHECK([boost_date_time], + [@%:@include ], + [using namespace boost::gregorian; date d(2002,Jan,10); return 0;]) +]) diff --git a/gr-howto-write-a-block/config/ax_boost_filesystem.m4 b/gr-howto-write-a-block/config/ax_boost_filesystem.m4 new file mode 100644 index 00000000..bcb3fa44 --- /dev/null +++ b/gr-howto-write-a-block/config/ax_boost_filesystem.m4 @@ -0,0 +1,45 @@ +# +# SYNOPSIS +# +# AX_BOOST_FILESYSTEM +# +# DESCRIPTION +# +# Test for Filesystem library from the Boost C++ libraries. The macro +# requires a preceding call to AX_BOOST_BASE. +# +# This macro calls: +# +# AC_SUBST(BOOST_FILESYSTEM_LIB) +# +# And sets: +# +# HAVE_BOOST_FILESYSTEM +# +# COPYLEFT +# +# Copyright (c) 2008 Thomas Porschberg +# Copyright (c) 2008 Michael Tindal +# Copyright (c) 2008 Free Software Foundation, Inc. +# +# 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. + +AC_DEFUN([AX_BOOST_FILESYSTEM], +[ + AC_REQUIRE([AX_BOOST_BASE]) + + dnl depends on boost_system + AC_REQUIRE([AX_BOOST_SYSTEM]) + axbf_LDFLAGS_SAVED=$LDFLAGS + LDFLAGS="$LDFLAGS $BOOST_SYSTEM_LIB" + + _AX_BOOST_CHECK([boost_filesystem], + [@%:@include ], + [using namespace boost::filesystem; + path my_path( "foo/bar/data.txt" ); + return 0;]) + + LDFLAGS=$axbf_LDFLAGS_SAVED +]) diff --git a/gr-howto-write-a-block/config/ax_boost_iostreams.m4 b/gr-howto-write-a-block/config/ax_boost_iostreams.m4 new file mode 100644 index 00000000..181b1e75 --- /dev/null +++ b/gr-howto-write-a-block/config/ax_boost_iostreams.m4 @@ -0,0 +1,39 @@ +# +# SYNOPSIS +# +# AX_BOOST_IOSTREAMS +# +# DESCRIPTION +# +# Test for IOStreams library from the Boost C++ libraries. The macro +# requires a preceding call to AX_BOOST_BASE. +# +# This macro calls: +# +# AC_SUBST(BOOST_IOSTREAMS_LIB) +# +# And sets: +# +# HAVE_BOOST_IOSTREAMS +# +# COPYLEFT +# +# Copyright (c) 2008 Thomas Porschberg +# Copyright (c) 2008 Free Software Foundation, Inc. +# +# 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. + +AC_DEFUN([AX_BOOST_IOSTREAMS], +[ + AC_REQUIRE([AX_BOOST_BASE]) + _AX_BOOST_CHECK([boost_iostreams], + [@%:@include + @%:@include ], + [std::string input = "Hello World!"; + namespace io = boost::iostreams; + io::filtering_istream in(boost::make_iterator_range(input)); + return 0;]) + +]) diff --git a/gr-howto-write-a-block/config/ax_boost_program_options.m4 b/gr-howto-write-a-block/config/ax_boost_program_options.m4 new file mode 100644 index 00000000..3829373b --- /dev/null +++ b/gr-howto-write-a-block/config/ax_boost_program_options.m4 @@ -0,0 +1,35 @@ +# +# SYNOPSIS +# +# AX_BOOST_PROGRAM_OPTIONS +# +# DESCRIPTION +# +# Test for program options library from the Boost C++ libraries. The macro +# requires a preceding call to AX_BOOST_BASE. +# +# This macro calls: +# +# AC_SUBST(BOOST_PROGRAM_OPTIONS_LIB) +# +# And sets: +# +# HAVE_BOOST_PROGRAM_OPTIONS +# +# COPYLEFT +# +# Copyright (c) 2008 Thomas Porschberg +# Copyright (c) 2008 Free Software Foundation, Inc. +# +# 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. + +AC_DEFUN([AX_BOOST_PROGRAM_OPTIONS], +[ + AC_REQUIRE([AX_BOOST_BASE]) + _AX_BOOST_CHECK([boost_program_options], + [@%:@include ], + [boost::program_options::options_description generic("Generic options"); + return 0;]) +]) diff --git a/gr-howto-write-a-block/config/ax_boost_python.m4 b/gr-howto-write-a-block/config/ax_boost_python.m4 new file mode 100644 index 00000000..3c6c666f --- /dev/null +++ b/gr-howto-write-a-block/config/ax_boost_python.m4 @@ -0,0 +1,92 @@ +# =========================================================================== +# http://autoconf-archive.cryp.to/ax_boost_python.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_BOOST_PYTHON +# +# DESCRIPTION +# +# This macro checks to see if the Boost.Python library is installed. It +# also attempts to guess the currect library name using several attempts. +# It tries to build the library name using a user supplied name or suffix +# and then just the raw library. +# +# If the library is found, HAVE_BOOST_PYTHON is defined and +# BOOST_PYTHON_LIB is set to the name of the library. +# +# This macro calls AC_SUBST(BOOST_PYTHON_LIB). +# +# In order to ensure that the Python headers are specified on the include +# path, this macro requires AX_PYTHON to be called. +# +# LAST MODIFICATION +# +# 2008-04-12 +# +# COPYLEFT +# +# Copyright (c) 2008 Michael Tindal +# +# This program 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 2 of the License, or (at your +# option) any later version. +# +# This program 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 . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Macro Archive. When you make and +# distribute a modified version of the Autoconf Macro, you may extend this +# special exception to the GPL to apply to your modified version as well. + +AC_DEFUN([AX_BOOST_PYTHON], +[AC_REQUIRE([AX_PYTHON])dnl +AC_CACHE_CHECK(whether the Boost::Python library is available, +ac_cv_boost_python, +[AC_LANG_SAVE + AC_LANG_CPLUSPLUS + CPPFLAGS_SAVE=$CPPFLAGS + if test x$PYTHON_INCLUDE_DIR != x; then + CPPFLAGS=-I$PYTHON_INCLUDE_DIR $CPPFLAGS + fi + AC_COMPILE_IFELSE(AC_LANG_PROGRAM([[ + #include + using namespace boost::python; + BOOST_PYTHON_MODULE(test) { throw "Boost::Python test."; }]], + [[return 0;]]), + ac_cv_boost_python=yes, ac_cv_boost_python=no) + AC_LANG_RESTORE + CPPFLAGS=$CPPFLAGS_SAVE +]) +if test "$ac_cv_boost_python" = "yes"; then + AC_LANG_PUSH([C++]) + AC_DEFINE(HAVE_BOOST_PYTHON,,[define if the Boost::Python library is available]) + ax_python_lib=boost_python + AC_ARG_WITH([boost-python],AS_HELP_STRING([--with-boost-python],[specify the boost python library or suffix to use]), + [if test "x$with_boost_python" != "xno"; then + ax_python_lib=$with_boost_python + ax_boost_python_lib=boost_python-$with_boost_python + fi]) + for ax_lib in $ax_python_lib $ax_boost_python_lib boost_python; do + AC_CHECK_LIB($ax_lib, exit, [BOOST_PYTHON_LIB=$ax_lib break]) + done + AC_SUBST(BOOST_PYTHON_LIB) + AC_LANG_POP([C++]) +fi +])dnl diff --git a/gr-howto-write-a-block/config/ax_boost_regex.m4 b/gr-howto-write-a-block/config/ax_boost_regex.m4 new file mode 100644 index 00000000..32b53136 --- /dev/null +++ b/gr-howto-write-a-block/config/ax_boost_regex.m4 @@ -0,0 +1,35 @@ +# +# SYNOPSIS +# +# AX_BOOST_REGEX +# +# DESCRIPTION +# +# Test for Regex library from the Boost C++ libraries. The macro requires +# a preceding call to AX_BOOST_BASE. +# +# This macro calls: +# +# AC_SUBST(BOOST_REGEX_LIB) +# +# And sets: +# +# HAVE_BOOST_REGEX +# +# COPYLEFT +# +# Copyright (c) 2008 Thomas Porschberg +# Copyright (c) 2008 Michael Tindal +# Copyright (c) 2008 Free Software Foundation, Inc. +# +# 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. + +AC_DEFUN([AX_BOOST_REGEX], +[ + AC_REQUIRE([AX_BOOST_BASE]) + _AX_BOOST_CHECK([boost_regex], + [@%:@include ], + [boost::regex r(); return 0;]) +]) diff --git a/gr-howto-write-a-block/config/ax_boost_serialization.m4 b/gr-howto-write-a-block/config/ax_boost_serialization.m4 new file mode 100644 index 00000000..78c95007 --- /dev/null +++ b/gr-howto-write-a-block/config/ax_boost_serialization.m4 @@ -0,0 +1,38 @@ +# +# SYNOPSIS +# +# AX_BOOST_SERIALIZATION +# +# DESCRIPTION +# +# Test for Serialization library from the Boost C++ libraries. The macro +# requires a preceding call to AX_BOOST_BASE. +# +# This macro calls: +# +# AC_SUBST(BOOST_SERIALIZATION_LIB) +# +# And sets: +# +# HAVE_BOOST_SERIALIZATION +# +# COPYLEFT +# +# Copyright (c) 2008 Thomas Porschberg +# Copyright (c) 2008 Free Software Foundation, Inc. +# +# 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. + +AC_DEFUN([AX_BOOST_SERIALIZATION], +[ + AC_REQUIRE([AX_BOOST_BASE]) + _AX_BOOST_CHECK([boost_serialization], + [@%:@include + @%:@include + @%:@include ], + [std::ofstream ofs("filename"); + boost::archive::text_oarchive oa(ofs); + return 0;]) +]) diff --git a/gr-howto-write-a-block/config/ax_boost_signals.m4 b/gr-howto-write-a-block/config/ax_boost_signals.m4 new file mode 100644 index 00000000..3c497174 --- /dev/null +++ b/gr-howto-write-a-block/config/ax_boost_signals.m4 @@ -0,0 +1,35 @@ +# +# SYNOPSIS +# +# AX_BOOST_SIGNALS +# +# DESCRIPTION +# +# Test for Signals library from the Boost C++ libraries. The macro +# requires a preceding call to AX_BOOST_BASE. +# +# This macro calls: +# +# AC_SUBST(BOOST_SIGNALS_LIB) +# +# And sets: +# +# HAVE_BOOST_SIGNALS +# +# COPYLEFT +# +# Copyright (c) 2008 Thomas Porschberg +# Copyright (c) 2008 Michael Tindal +# Copyright (c) 2008 Free Software Foundation, Inc. +# +# 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. + +AC_DEFUN([AX_BOOST_SIGNALS], +[ + AC_REQUIRE([AX_BOOST_BASE]) + _AX_BOOST_CHECK([boost_signals], + [@%:@include ], + [boost::signal sig; return 0;]) +]) diff --git a/gr-howto-write-a-block/config/ax_boost_system.m4 b/gr-howto-write-a-block/config/ax_boost_system.m4 new file mode 100644 index 00000000..cb73f257 --- /dev/null +++ b/gr-howto-write-a-block/config/ax_boost_system.m4 @@ -0,0 +1,40 @@ +# =========================================================================== +# started with this: http://autoconf-archive.cryp.to/ax_boost_system.html, +# virtually nothing left +# =========================================================================== +# +# SYNOPSIS +# +# AX_BOOST_SYSTEM +# +# DESCRIPTION +# +# Test for System library from the Boost C++ libraries. The macro requires +# a preceding call to AX_BOOST_BASE. +# +# This macro calls: +# +# AC_SUBST(BOOST_SYSTEM_LIB) +# +# And sets: +# +# HAVE_BOOST_SYSTEM +# +# COPYLEFT +# +# Copyright (c) 2008 Thomas Porschberg +# Copyright (c) 2008 Michael Tindal +# Copyright (c) 2008 Daniel Casimiro +# Copyright (c) 2008 Free Software Foundation, Inc. +# +# 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. + +AC_DEFUN([AX_BOOST_SYSTEM], +[ + AC_REQUIRE([AX_BOOST_BASE]) + _AX_BOOST_CHECK([boost_system], + [@%:@include ], + [boost::system::system_category]) +]) diff --git a/gr-howto-write-a-block/config/ax_boost_test_exec_monitor.m4 b/gr-howto-write-a-block/config/ax_boost_test_exec_monitor.m4 new file mode 100644 index 00000000..2c30c0b4 --- /dev/null +++ b/gr-howto-write-a-block/config/ax_boost_test_exec_monitor.m4 @@ -0,0 +1,35 @@ +# +# SYNOPSIS +# +# AX_BOOST_TEST_EXEC_MONITOR +# +# DESCRIPTION +# +# Test for Test_Exec_Monitor library from the Boost C++ libraries. The +# macro requires a preceding call to AX_BOOST_BASE. +# +# This macro calls: +# +# AC_SUBST(BOOST_TEST_EXEC_MONITOR_LIB) +# +# And sets: +# +# HAVE_BOOST_TEST_EXEC_MONITOR +# +# COPYLEFT +# +# Copyright (c) 2008 Dodji Seketeli +# Copyright (c) 2008 Thomas Porschberg +# Copyright (c) 2008 Free Software Foundation, Inc. +# +# 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. + +AC_DEFUN([AX_BOOST_TEST_EXEC_MONITOR], +[ + AC_REQUIRE([AX_BOOST_BASE]) + _AX_BOOST_CHECK([boost_test_exec_monitor], + [@%:@include ], + [int i=1 ; BOOST_REQUIRE(i==1); ; return 0;]) +]) diff --git a/gr-howto-write-a-block/config/ax_boost_thread.m4 b/gr-howto-write-a-block/config/ax_boost_thread.m4 new file mode 100644 index 00000000..4df23224 --- /dev/null +++ b/gr-howto-write-a-block/config/ax_boost_thread.m4 @@ -0,0 +1,72 @@ +# +# SYNOPSIS +# +# AX_BOOST_THREAD +# +# DESCRIPTION +# +# Test for Thread library from the Boost C++ libraries. +# +# This macro calls: +# +# AC_SUBST(BOOST_THREAD_LIB) +# AC_SUBST(BOOST_CXXFLAGS) +# +# And sets: +# +# HAVE_BOOST_THREAD +# +# COPYLEFT +# +# Copyright (c) 2008 Thomas Porschberg +# Copyright (c) 2008 Michael Tindal +# Copyright (c) 2008 Free Software Foundation, Inc. +# +# 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. + + +AC_DEFUN([AX_BOOST_THREAD], +[ + AC_REQUIRE([AX_BOOST_BASE]) + AC_REQUIRE([ACX_PTHREAD]) + _AX_BOOST_WITH([boost_thread]) + + if test "$want_boost" = "yes"; then + AC_REQUIRE([AC_PROG_CC]) + AC_REQUIRE([AC_PROG_CXX]) + AC_REQUIRE([AC_CANONICAL_HOST]) + + CPPFLAGS_SAVED="$CPPFLAGS" + LDFLAGS_SAVED="$LDFLAGS" + CXXFLAGS_SAVED="$CXXFLAGS" + + CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" + LDFLAGS="$LDFLAGS $BOOST_LDFLAGS $PTHREAD_LIBS" + CXXFLAGS="$CXXFLAGS $PTHREAD_CFLAGS" + + AC_CACHE_CHECK(whether the boost::thread includes are available, + ax_cv_boost_thread, + [AC_LANG_PUSH([C++]) + AC_COMPILE_IFELSE(AC_LANG_PROGRAM([[@%:@include ]], + [[boost::thread_group thrds; + return 0;]]), + ax_cv_boost_thread=yes, ax_cv_boost_thread=no) + AC_LANG_POP([C++]) + ]) + + if test "$ax_cv_boost_thread" = "yes"; then + BOOST_CXXFLAGS="$PTHREAD_CFLAGS" + AC_SUBST(BOOST_CXXFLAGS) + _AX_BOOST_CHECK_LIB([boost_thread]) + if test "$link_ok" = "yes" && test -n "$PTHREAD_LIBS"; then + BOOST_THREAD_LIB="$BOOST_THREAD_LIB $PTHREAD_LIBS" + fi + fi + + CPPFLAGS="$CPPFLAGS_SAVED" + LDFLAGS="$LDFLAGS_SAVED" + CXXFLAGS="$CXXFLAGS_SAVED" + fi +]) diff --git a/gr-howto-write-a-block/config/ax_boost_unit_test_framework.m4 b/gr-howto-write-a-block/config/ax_boost_unit_test_framework.m4 new file mode 100644 index 00000000..73affccf --- /dev/null +++ b/gr-howto-write-a-block/config/ax_boost_unit_test_framework.m4 @@ -0,0 +1,36 @@ +# +# SYNOPSIS +# +# AX_BOOST_UNIT_TEST_FRAMEWORK +# +# DESCRIPTION +# +# Test for Unit_Test_Framework library from the Boost C++ libraries. The +# macro requires a preceding call to AX_BOOST_BASE. +# +# This macro calls: +# +# AC_SUBST(BOOST_UNIT_TEST_FRAMEWORK_LIB) +# +# And sets: +# +# HAVE_BOOST_UNIT_TEST_FRAMEWORK +# +# COPYLEFT +# +# Copyright (c) 2008 Thomas Porschberg +# Copyright (c) 2008 Free Software Foundation, Inc. +# +# 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. + +AC_DEFUN([AX_BOOST_UNIT_TEST_FRAMEWORK], +[ + AC_REQUIRE([AX_BOOST_BASE]) + _AX_BOOST_CHECK([boost_unit_test_framework], + [@%:@include ], + [using boost::unit_test::test_suite; + test_suite* test= BOOST_TEST_SUITE( "Unit test example 1" ); + return 0;]) +]) diff --git a/gr-howto-write-a-block/config/ax_boost_wserialization.m4 b/gr-howto-write-a-block/config/ax_boost_wserialization.m4 new file mode 100644 index 00000000..f384988c --- /dev/null +++ b/gr-howto-write-a-block/config/ax_boost_wserialization.m4 @@ -0,0 +1,46 @@ +# +# SYNOPSIS +# +# AX_BOOST_WSERIALIZATION +# +# DESCRIPTION +# +# Test for WSerialization library from the Boost C++ libraries. The macro +# requires a preceding call to AX_BOOST_BASE. +# +# This macro calls: +# +# AC_SUBST(BOOST_WSERIALIZATION_LIB) +# +# And sets: +# +# HAVE_BOOST_WSERIALIZATION +# +# COPYLEFT +# +# Copyright (c) 2008 Thomas Porschberg +# Copyright (c) 2008 Free Software Foundation, Inc. +# +# 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. + +AC_DEFUN([AX_BOOST_WSERIALIZATION], +[ + AC_REQUIRE([AX_BOOST_BASE]) + + dnl depends on BOOST_SERIALIZATION + AC_REQUIRE([AX_BOOST_SERIALIZATION]) + axbws_LDFLAGS_SAVED=$LDFLAGS + LDFLAGS="$LDFLAGS $BOOST_SERIALIZATION_LIB" + + _AX_BOOST_CHECK([boost_wserialization], + [@%:@include + @%:@include + @%:@include ], + [std::ofstream ofs("filename"); + boost::archive::text_oarchive oa(ofs); + return 0;]) + + LDFLAGS=$axbf_LDFLAGS_SAVED +]) diff --git a/gr-howto-write-a-block/config/gr_boost.m4 b/gr-howto-write-a-block/config/gr_boost.m4 deleted file mode 100644 index 0664d36f..00000000 --- a/gr-howto-write-a-block/config/gr_boost.m4 +++ /dev/null @@ -1,111 +0,0 @@ -dnl -dnl Copyright 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 - -dnl This tries to do the "right thing" to locate the boost include files. -dnl If the user explicitly specified --with-boost-include-dir= -dnl we believe them and use it. Otherwise, -dnl -dnl We look for boost/shared_ptr.hpp in the "normal places". That is, -dnl wherever AC_CHECK_HEADER looks. If the boost includes are in /usr/local/include -dnl this step will find them. -dnl -dnl Otherwise, we check to see if the boost stuff was installed in a version-specific -dnl directory under /usr/local/include. These look like: /usr/local/include/boost-1_33_1 -dnl If there's more than one version installed, we select the -dnl lexicographically greatest one. -dnl -dnl If none of these work, we bail. - -AC_DEFUN([GR_REQUIRE_BOOST_INCLUDES], -[ - AC_LANG_PUSH(C++) - gr_boost_include_dir= - AC_ARG_WITH([boost-include-dir], - AC_HELP_STRING([--with-boost-include-dir=], - [path to boost c++ include files]), - [ - # "yes" and "no" are bogus answers - if test x"$with_boost_include_dir" = xyes || - test x"$with_boost_include_dir" = xno; then - gr_boost_include_dir= - else - gr_boost_include_dir=$with_boost_include_dir - fi - ]) - echo "gr_boost_include_dir = $gr_boost_include_dir" - if test x$gr_boost_include_dir != x; then - # - # If the user specified a directory, then we use it - # - OLD_CPPFLAGS=$CPPFLAGS - CPPFLAGS="$CPPFLAGS -I$gr_boost_include_dir" - AC_CHECK_HEADER([boost/shared_ptr.hpp], - [BOOST_CFLAGS="-I$gr_boost_include_dir"], - [AC_MSG_ERROR( - [Failed to locate boost/shared_ptr.hpp. -Try using --with-boost-include-dir=, -E.g., --with-boost-include-dir=/usr/local/include/boost-1_33_1])]) - CPPFLAGS=$OLD_CPPFLAGS - else - # - # Otherwise we check in the default places - # - AC_CHECK_HEADER([boost/shared_ptr.hpp], - [BOOST_CFLAGS=""], - [ # Nope, look for latest version if any in $prefix/include/boost-* - - # Wipe out cached value. KLUDGE: AC should have API for this - unset AS_TR_SH([ac_cv_header_boost/shared_ptr.hpp]) - - boost_last_match(){ - #echo "boost_last_match: [$]*" - pattern="[$]1" - shift - if test "[$]pattern" = "[$]1" - then - LM='' - else - shift `expr [$]# - 1` - LM=[$]1 - fi - #echo "LM(1)='[$]LM'" - } - - pattern="/usr/local/include/boost-*" - boost_last_match "$pattern" $pattern - #echo "LM(2)='$LM'" - - OLD_CPPFLAGS=$CPP_FLAGS - CPPFLAGS="$CPPFLAGS -I$LM" - AC_CHECK_HEADER([boost/shared_ptr.hpp], - [BOOST_CFLAGS="-I$LM"], - [AC_MSG_ERROR( - [Failed to locate boost/shared_ptr.hpp. -Try using --with-boost-include-dir=, -E.g., --with-boost-include-dir=/usr/local/include/boost-1_33_1])]) - CPPFLAGS=$OLD_CPPFLAGS - ]) - - fi - unset boost_last_match LM - AC_LANG_POP - AC_SUBST(BOOST_CFLAGS) -]) diff --git a/gr-howto-write-a-block/config/gr_doxygen.m4 b/gr-howto-write-a-block/config/gr_doxygen.m4 index 4670c29d..43433098 100644 --- a/gr-howto-write-a-block/config/gr_doxygen.m4 +++ b/gr-howto-write-a-block/config/gr_doxygen.m4 @@ -20,10 +20,17 @@ dnl Boston, MA 02110-1301, USA. dnl AC_DEFUN([GR_CHECK_DOXYGEN],[ - AC_ARG_ENABLE(doxygen, [ --enable-doxygen enable documentation generation with doxygen (no)]) - AC_ARG_ENABLE(dot, [ --enable-dot use 'dot' to generate graphs in doxygen (auto)]) - AC_ARG_ENABLE(html-docs, [ --enable-html-docs enable HTML generation with doxygen (yes)], [], [ enable_html_docs=yes]) - AC_ARG_ENABLE(latex-docs, [ --enable-latex-docs enable LaTeX doc generation with doxygen (no)], [], [ enable_latex_docs=no]) + AC_ARG_ENABLE(doxygen, + AC_HELP_STRING([--enable-doxygen], + [enable documentation generation with doxygen (no)])) + AC_ARG_ENABLE(dot, AC_HELP_STRING([--enable-dot],[use 'dot' to generate graphs in doxygen (auto)])) + AC_ARG_ENABLE(html-docs, + AC_HELP_STRING([--enable-html-docs],[enable HTML generation with doxygen (yes)]), + [], [ enable_html_docs=yes]) + AC_ARG_ENABLE(latex-docs, + AC_HELP_STRING([--enable-latex-docs], + [enable LaTeX doc generation with doxygen (no)]), + [], [ enable_latex_docs=no]) if test "x$enable_doxygen" = xyes; then AC_PATH_PROG(DOXYGEN, doxygen, , $PATH) diff --git a/gr-howto-write-a-block/config/gr_fortran.m4 b/gr-howto-write-a-block/config/gr_fortran.m4 new file mode 100644 index 00000000..b5b0470f --- /dev/null +++ b/gr-howto-write-a-block/config/gr_fortran.m4 @@ -0,0 +1,32 @@ +dnl Copyright 2001,2002,2003,2004,2005,2006 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. + +AC_DEFUN([GR_FORTRAN],[ + dnl if you want to generate a different table of interpolator taps, you need fortran. + dnl we default to off, since almost no one wants to do this. + AC_ARG_ENABLE(fortran, AC_HELP_STRING([--enable-fortran],[enable fortran (no)]), + [], [enable_fortran=no]) + AM_CONDITIONAL(ENABLE_FORTRAN, test "x$enable_fortran" = xyes) + + if test "x$enable_fortran" = xyes + then + AC_PROG_F77 + AC_F77_LIBRARY_LDFLAGS + fi +]) diff --git a/gr-howto-write-a-block/config/gr_lib64.m4 b/gr-howto-write-a-block/config/gr_lib64.m4 new file mode 100644 index 00000000..751f774b --- /dev/null +++ b/gr-howto-write-a-block/config/gr_lib64.m4 @@ -0,0 +1,85 @@ +dnl +dnl Copyright 2005,2008 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 + +dnl GR_LIB64() +dnl +dnl Checks to see if we're on a x86_64 or powerpc64 machine, and if so, determine +dnl if libdir should end in "64" or not. +dnl +dnl Sets gr_libdir_suffix to "" or "64" and calls AC_SUBST(gr_libdir_suffix) +dnl May append "64" to libdir. +dnl +dnl The current heuristic is: +dnl if the host_cpu isn't x86_64 or powerpc64, then "" +dnl if the host_os isn't linux, then "" +dnl if we're cross-compiling, ask the linker, by way of the selected compiler +dnl if we're x86_64 and there's a /lib64 and it's not a symlink, then "64", else "" +dnl else ask the compiler +dnl +AC_DEFUN([GR_LIB64],[ + AC_REQUIRE([AC_CANONICAL_HOST]) + AC_REQUIRE([AC_PROG_CXX]) + + AC_MSG_CHECKING([gr_libdir_suffix]) + gr_libdir_suffix="" + AC_SUBST(gr_libdir_suffix) + + case "$host_os" in + linux*) is_linux=yes ;; + *) is_linux=no ;; + esac + + if test "$is_linux" = no || test "$host_cpu" != "x86_64" && test "$host_cpu" != "powerpc64"; then + gr_libdir_suffix="" + elif test "$cross_compiling" = yes; then + _GR_LIB64_ASK_COMPILER + elif test "$host_cpu" = "x86_64"; then + if test -d /lib64 && test ! -L /lib64; then + gr_libdir_suffix=64 + fi + else + _GR_LIB64_ASK_COMPILER + fi + AC_MSG_RESULT([$gr_libdir_suffix]) + + + AC_MSG_CHECKING([whether to append 64 to libdir]) + t=${libdir##*/lib} + if test "$t" != 64 && test "$gr_libdir_suffix" = "64"; then + libdir=${libdir}64 + AC_MSG_RESULT([yes. Setting libdir to $libdir]) + else + AC_MSG_RESULT([no]) + fi +]) + +dnl If we're using g++, extract the first SEARCH_DIR("...") entry from the linker script +dnl and see if it contains a suffix after the final .../lib part of the path. +dnl (This works because the linker script varies depending on whether we're generating +dnl 32-bit or 64-bit executables) +dnl +AC_DEFUN([_GR_LIB64_ASK_COMPILER],[ + if test "$ac_cv_cxx_compiler_gnu" = "yes"; + then + gr_libdir_suffix=`$CXX -Wl,--verbose 2>/dev/null | sed -n -e '/SEARCH_DIR/{s/;.*$//; s,^.*/,,; s/".*$//; s/^lib//; p}'` + fi +]) + diff --git a/gr-howto-write-a-block/config/gr_omnithread.m4 b/gr-howto-write-a-block/config/gr_omnithread.m4 index b5e40909..054f0782 100644 --- a/gr-howto-write-a-block/config/gr_omnithread.m4 +++ b/gr-howto-write-a-block/config/gr_omnithread.m4 @@ -1,6 +1,6 @@ # Check for Omnithread (pthread/NT) thread support. -*- Autoconf -*- -# Copyright 2003 Free Software Foundation, Inc. +# Copyright 2003,2007 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -21,8 +21,9 @@ AC_DEFUN([GR_OMNITHREAD], [ # Check first for POSIX ACX_PTHREAD( - [ ot_posix="yes" - AC_DEFINE(OMNITHREAD_POSIX,[1],[Define to 1 to enable pthread]) + [ AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]) + ot_posix="yes" + DEFINES="$DEFINES -DOMNITHREAD_POSIX=1" ],[ # If no POSIX support found, then check for NT threads AC_MSG_CHECKING([for NT threads]) @@ -34,7 +35,7 @@ AC_DEFUN([GR_OMNITHREAD], ], [ ot_nt="yes" - AC_DEFINE(OMNITHREAD_NT,[1],[Define to 1 to enable NT thread]) + DEFINES="$DEFINES -DOMNITHREAD_NT=1" ], [AC_MSG_FAILURE([GNU Radio requires POSIX threads. pthreads not found.])] ) diff --git a/gr-howto-write-a-block/config/gr_python.m4 b/gr-howto-write-a-block/config/gr_python.m4 index 5816b276..6c862bba 100644 --- a/gr-howto-write-a-block/config/gr_python.m4 +++ b/gr-howto-write-a-block/config/gr_python.m4 @@ -22,27 +22,43 @@ dnl # PYTHON_DEVEL() # # Checks for Python and tries to get the include path to 'Python.h'. -# It provides the $(PYTHON_CPPFLAGS) and $(PYTHON_LDFLAGS) output variables. +# It sets the $(PYTHON_CPPFLAGS), $(PYTHON_LDFLAGS) and $(pythondir) output variables, # AC_DEFUN([PYTHON_DEVEL],[ AC_REQUIRE([AM_PATH_PYTHON]) AC_REQUIRE([AC_CANONICAL_HOST]) - # For Fedora Core 5 and 6, see ticket:39 in Trac - if test -f '/etc/redhat-release'; then - if (echo $pyexecdir | grep -q lib64); then - pythondir="$pyexecdir" - fi - fi + AC_ARG_WITH(pythondir, + AC_HELP_STRING([--with-pythondir=DIR], + [python installation directory (cross-compiling) [[default=$prefix/lib/python2.5/site-packages]]]), + [with_pythondir=${withval}],[with_pythondir=${prefix}/lib/python2.5/site-packages]) - # Check for Python include path - AC_MSG_CHECKING([for Python include path]) - if test -z "$PYTHON" ; then - AC_MSG_ERROR([cannot find Python path]) - fi + # if we're cross-compiling, asking the host python about any of + # this is completely useless... + + if test x$cross_compiling != xno + then + pythondir=$with_pythondir + pyexecdir=$with_pythondir + AC_SUBST(PYTHON_CPPFLAGS) + AC_SUBST(PYTHON_LDFLAGS) + else + + # For Fedora Core 5 and 6, see ticket:39 in Trac + if test -f '/etc/redhat-release'; then + if (echo $pyexecdir | grep -q lib64); then + pythondir="$pyexecdir" + fi + fi - # ask distutils which include path we should use - python_cmd=' + # Check for Python include path + AC_MSG_CHECKING([for Python include path]) + if test -z "$PYTHON" ; then + AC_MSG_ERROR([cannot find Python path]) + fi + + # ask distutils which include path we should use + python_cmd=' import distutils.sysconfig import os path = distutils.sysconfig.get_python_inc(plat_specific=False) @@ -50,30 +66,30 @@ if os.sep == "\\": path = path.replace("\\", "/") print path ' - python_path=`$PYTHON -c "$python_cmd"` - AC_MSG_RESULT([$python_path]) - if test -z "$python_path" ; then - AC_MSG_ERROR([cannot find Python include path]) - fi + python_path=`$PYTHON -c "$python_cmd"` + AC_MSG_RESULT([$python_path]) + if test -z "$python_path" ; then + AC_MSG_ERROR([cannot find Python include path]) + fi - AC_SUBST(PYTHON_CPPFLAGS,[-I$python_path]) + AC_SUBST(PYTHON_CPPFLAGS,[-I$python_path]) - # Check for Python headers usability - python_save_CPPFLAGS=$CPPFLAGS - CPPFLAGS="$CPPFLAGS $PYTHON_CPPFLAGS" - AC_CHECK_HEADERS([Python.h], [], - [AC_MSG_ERROR([cannot find usable Python headers])]) - CPPFLAGS="$python_save_CPPFLAGS" + # Check for Python headers usability + python_save_CPPFLAGS=$CPPFLAGS + CPPFLAGS="$CPPFLAGS $PYTHON_CPPFLAGS" + AC_CHECK_HEADERS([Python.h], [], + [AC_MSG_ERROR([cannot find usable Python headers])]) + CPPFLAGS="$python_save_CPPFLAGS" - # Only set this on mingw and cygwin hosts, (only implemented - # for mingw host, for crosscompiling you need to trick this) + # Only set this on mingw and cygwin hosts, (only implemented + # for mingw host, for crosscompiling you need to trick this) - PYTHON_LDFLAGS="" - case $host_os in - *mingw* | *cygwin* ) - AC_MSG_CHECKING([for Python LDFLAGS]) + PYTHON_LDFLAGS="" + case $host_os in + *mingw* | *cygwin* ) + AC_MSG_CHECKING([for Python LDFLAGS]) - python_cmd=' + python_cmd=' import distutils.sysconfig import os path = distutils.sysconfig.get_config_var("LIBPL") @@ -82,30 +98,31 @@ if path == None: if os.sep == "\\": path = path.replace("\\", "/") print path -' - python_stdlib_path=`$PYTHON -c "$python_cmd"` - - python_version_nodot=`echo $PYTHON_VERSION | sed "s,\.,,"` - libpython_name="python$PYTHON_VERSION" - - # Standard install of python for win32 has libpython24.a - # instead of libpython2.4.a so we check for the library - # without the dot in the version number. - - python_stdlib_filename=`find $python_stdlib_path -type f -name libpython$python_version_nodot.* -print | sed "1q"` - if test -n "$python_stdlib_filename" ; then - libpython_name="python$python_version_nodot" - fi - - PYTHON_LDFLAGS="-L$python_stdlib_path -l$libpython_name" - AC_MSG_RESULT($PYTHON_LDFLAGS) - # Replace all backslashes in PYTHON Paths with forward slashes - pythondir=`echo $pythondir |sed 's,\\\\,/,g'` - pkgpythondir=`echo $pkgpythondir |sed 's,\\\\,/,g'` - pyexecdir=`echo $pyexecdir |sed 's,\\\\,/,g'` - pkgpyexecdir=`echo $pkgpyexecdir |sed 's,\\\\,/,g'` - ;; - esac - - AC_SUBST([PYTHON_LDFLAGS]) +' + python_stdlib_path=`$PYTHON -c "$python_cmd"` + + python_version_nodot=`echo $PYTHON_VERSION | sed "s,\.,,"` + libpython_name="python$PYTHON_VERSION" + + # Standard install of python for win32 has libpython24.a + # instead of libpython2.4.a so we check for the library + # without the dot in the version number. + + python_stdlib_filename=`find $python_stdlib_path -type f -name libpython$python_version_nodot.* -print | sed "1q"` + if test -n "$python_stdlib_filename" ; then + libpython_name="python$python_version_nodot" + fi + + PYTHON_LDFLAGS="-L$python_stdlib_path -l$libpython_name" + AC_MSG_RESULT($PYTHON_LDFLAGS) + # Replace all backslashes in PYTHON Paths with forward slashes + pythondir=`echo $pythondir |sed 's,\\\\,/,g'` + pkgpythondir=`echo $pkgpythondir |sed 's,\\\\,/,g'` + pyexecdir=`echo $pyexecdir |sed 's,\\\\,/,g'` + pkgpyexecdir=`echo $pkgpyexecdir |sed 's,\\\\,/,g'` + ;; + esac + + AC_SUBST(PYTHON_LDFLAGS) + fi ]) diff --git a/gr-howto-write-a-block/config/gr_scripting.m4 b/gr-howto-write-a-block/config/gr_scripting.m4 index 86870e7c..e030a810 100644 --- a/gr-howto-write-a-block/config/gr_scripting.m4 +++ b/gr-howto-write-a-block/config/gr_scripting.m4 @@ -24,7 +24,7 @@ AC_DEFUN([GR_SCRIPTING],[ AC_REQUIRE([AC_PROG_CXX]) AC_REQUIRE([AC_PROG_LIBTOOL]) - SWIG_PROG(1.3.23) + SWIG_PROG(1.3.31) SWIG_ENABLE_CXX SWIG_PYTHON ]) 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 ebc1fad9..b9c570ed 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 @@ -1,5 +1,5 @@ dnl -dnl Copyright 2003 Free Software Foundation, Inc. +dnl Copyright 2003,2008 Free Software Foundation, Inc. dnl dnl This file is part of GNU Radio dnl @@ -28,17 +28,17 @@ AC_DEFUN([GR_SET_MD_CPU],[ AC_MSG_CHECKING([for machine dependent speedups]) case "$cf_with_md_cpu" in - x86 | i[[3-7]]86) MD_CPU=x86 MD_SUBCPU=x86 ;; - x86_64) MD_CPU=x86 MD_SUBCPU=x86_64 ;; -# sparc) MD_CPU=sparc ;; - *) MD_CPU=generic ;; + x86 | i[[3-7]]86) MD_CPU=x86 MD_SUBCPU=x86 ;; + x86_64) MD_CPU=x86 MD_SUBCPU=x86_64 ;; + powerpc*) MD_CPU=powerpc ;; + *) MD_CPU=generic ;; esac AC_MSG_RESULT($MD_CPU) AC_SUBST(MD_CPU) AC_SUBST(MD_SUBCPU) - AM_CONDITIONAL(MD_CPU_x86, test $MD_CPU = x86) - AM_CONDITIONAL(MD_SUBCPU_x86_64, test $MD_SUBCPU = x86_64) - AM_CONDITIONAL(MD_CPU_generic, test $MD_CPU = generic) + AM_CONDITIONAL(MD_CPU_x86, test "$MD_CPU" = "x86") + AM_CONDITIONAL(MD_SUBCPU_x86_64, test "$MD_SUBCPU" = "x86_64") + AM_CONDITIONAL(MD_CPU_powerpc, test "$MD_CPU" = "powerpc") + AM_CONDITIONAL(MD_CPU_generic, test "$MD_CPU" = "generic") ]) - diff --git a/gr-howto-write-a-block/config/gr_x86_64.m4 b/gr-howto-write-a-block/config/gr_subversion.m4 similarity index 60% rename from gr-howto-write-a-block/config/gr_x86_64.m4 rename to gr-howto-write-a-block/config/gr_subversion.m4 index 3f56c061..849d7a9f 100644 --- a/gr-howto-write-a-block/config/gr_x86_64.m4 +++ b/gr-howto-write-a-block/config/gr_subversion.m4 @@ -1,5 +1,5 @@ dnl -dnl Copyright 2005 Free Software Foundation, Inc. +dnl Copyright 2007 Free Software Foundation, Inc. dnl dnl This file is part of GNU Radio dnl @@ -19,21 +19,18 @@ dnl the Free Software Foundation, Inc., 51 Franklin Street, dnl Boston, MA 02110-1301, USA. dnl -# GR_X86_64() +# GR_SUBVERSION() # -# Checks to see if we're on a x86_64 machine, and if so, ensure -# that libdir ends in "64" -# -AC_DEFUN([GR_X86_64],[ - AC_REQUIRE([AC_CANONICAL_HOST]) - if test "$host_cpu" = "x86_64"; then - AC_MSG_CHECKING([libdir for lib64 suffix]) - t=${libdir##*/lib} - if test "$t" != 64 && test -d /lib64 && ! test -L /lib64; then - libdir=${libdir}64 - AC_MSG_RESULT([no. Setting libdir to $libdir]) - else - AC_MSG_RESULT([yes]) - fi - fi +# Test for presence of subversion, and create variables for +# current repository version and last changed date. + +AC_DEFUN([GR_SUBVERSION],[ + AC_PATH_PROG([SVN],[svn]) + if test "$SVN" != "" -a -d .svn ; then + SVNVERSION=`$SVN info . | grep '^Revision' | cut -f 2- -d ' '` + SVNDATE=`$SVN info . | grep 'Last Changed Date' | cut -f 4-6 -d ' '` + fi + + AC_SUBST(SVNVERSION) + AC_SUBST(SVNDATE) ]) diff --git a/gr-howto-write-a-block/config/lf_cxx.m4 b/gr-howto-write-a-block/config/lf_cxx.m4 index c581c9b0..dfc6bfbf 100644 --- a/gr-howto-write-a-block/config/lf_cxx.m4 +++ b/gr-howto-write-a-block/config/lf_cxx.m4 @@ -37,11 +37,6 @@ AC_DEFUN([LF_CONFIGURE_CXX],[ # ----------------------------------------------------------------------- # This macro tests the C++ compiler for various portability problem. -# 1. Defines CXX_HAS_NO_BOOL if the compiler does not support the bool -# data type -# 2. Defines CXX_HAS_BUGGY_FOR_LOOPS if the compiler has buggy -# scoping for the for-loop -# 3. Defines USE_ASSERT if the user wants to use assertions # ----------------------------------------------------------------------- @@ -56,32 +51,6 @@ AC_DEFUN([LF_CXX_PORTABILITY],[ AC_LANG_SAVE AC_LANG_CPLUSPLUS - dnl Check whether we have bool - AC_MSG_CHECKING(whether C++ has bool) - AC_TRY_RUN([main() { bool b1=true; bool b2=false; }], - [ AC_MSG_RESULT(yes) ], - [ AC_MSG_RESULT(no) - AC_DEFINE(CXX_HAS_NO_BOOL,[],[Define if C++ is missing bool type]) ], - [ AC_MSG_WARN(Don't cross-compile)] - ) - - dnl Test whether C++ has buggy for-loops - AC_MSG_CHECKING(whether C++ has buggy scoping in for-loops) - AC_TRY_COMPILE([#include ], [ - for (int i=0;i<10;i++) { } - for (int i=0;i<10;i++) { } -], [ AC_MSG_RESULT(no) ], - [ AC_MSG_RESULT(yes) - AC_DEFINE(CXX_HAS_BUGGY_FOR_LOOPS,[],[Define if for loop scoping is broken]) ]) - - dnl Test whether the user wants to enable assertions - AC_MSG_CHECKING(whether user wants assertions) - AC_ARG_ENABLE(assert, - [ --disable-assert don't use cpp.h assert], - [ AC_DEFINE(NDEBUG,[],[Define to disable asserts (don't doit!)]) - AC_MSG_RESULT(no) ], - [ AC_MSG_RESULT(yes) ], - ) dnl Test whether C++ has std::isnan AC_MSG_CHECKING(whether C++ has std::isnan) @@ -96,26 +65,3 @@ AC_DEFUN([LF_CXX_PORTABILITY],[ AC_LANG_RESTORE ]) -AH_BOTTOM([// Workaround for compilers with buggy for-loop scoping -// That's quite a few compilers actually including recent versions of -// Dec Alpha cxx, HP-UX CC and SGI CC. -// The trivial "if" statement provides the correct scoping to the -// for loop - -#ifdef CXX_HAS_BUGGY_FOR_LOOPS -#undef for -#define for if(1) for -#endif -]) - -AH_BOTTOM([// If the C++ compiler we use doesn't have bool, then -// the following is a near-perfect work-around. -// You must make sure your code does not depend on "int" and "bool" -// being two different types, in overloading for instance. - -#ifdef CXX_HAS_NO_BOOL -#define bool int -#define true 1 -#define false 0 -#endif -]) diff --git a/gr-howto-write-a-block/config/pkg.m4 b/gr-howto-write-a-block/config/pkg.m4 index 770f0629..80bdfed4 100644 --- a/gr-howto-write-a-block/config/pkg.m4 +++ b/gr-howto-write-a-block/config/pkg.m4 @@ -1,68 +1,188 @@ -dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not) -dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page -dnl also defines GSTUFF_PKG_ERRORS on error -AC_DEFUN([PKG_CHECK_MODULES], [ - succeeded=no - - if test -z "$PKG_CONFIG"; then - AC_PATH_PROG(PKG_CONFIG, pkg-config, no) - fi - - if test "$PKG_CONFIG" = "no" ; then - echo "*** The pkg-config script could not be found. Make sure it is" - echo "*** in your path, or set the PKG_CONFIG environment variable" - echo "*** to the full path to pkg-config." - echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config." - else - dnl If PKG_CONFIG_PATH is not already set, add /usr/local/lib/pkgconfig. - dnl If it's set, assume the user knows what they're doing. - dnl This should help avoid failures while looking for fftw3f - if test -z "$PKG_CONFIG_PATH"; then - export PKG_CONFIG_PATH="/usr/local/lib/pkgconfig" - fi - - PKG_CONFIG_MIN_VERSION=0.9.0 - if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then - AC_MSG_CHECKING(for $2) - - if $PKG_CONFIG --exists "$2" ; then - AC_MSG_RESULT(yes) - succeeded=yes - - AC_MSG_CHECKING($1_CFLAGS) - $1_CFLAGS=`$PKG_CONFIG --cflags "$2"` - AC_MSG_RESULT($$1_CFLAGS) - - AC_MSG_CHECKING($1_LIBS) - $1_LIBS=`$PKG_CONFIG --libs "$2"` - AC_MSG_RESULT($$1_LIBS) - - AC_MSG_CHECKING($1_INCLUDEDIR) - $1_INCLUDEDIR=`$PKG_CONFIG --variable=includedir "$2"` - AC_MSG_RESULT($$1_INCLUDEDIR) - else - $1_CFLAGS="" - $1_LIBS="" - ## If we have a custom action on failure, don't print errors, but - ## do set a variable so people can do so. - $1_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"` - ifelse([$4], ,echo $$1_PKG_ERRORS,) +# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- +# +# Copyright © 2004 Scott James Remnant . +# Copyright © 2008 Free Software Foundation, Inc. +# +# This program 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 2 of the License, or +# (at your option) any later version. +# +# This program 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, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# PKG_PROG_PKG_CONFIG([MIN-VERSION]) +# ---------------------------------- +AC_DEFUN([PKG_PROG_PKG_CONFIG], +[m4_pattern_forbid([^_?PKG_[A-Z_]+$]) +m4_pattern_allow([^PKG_CONFIG(_PATH)?$]) +AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then + AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) +fi +if test -n "$PKG_CONFIG"; then + _pkg_min_version=m4_default([$1], [0.18]) + AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + PKG_CONFIG="" + fi + +fi[]dnl +])# PKG_PROG_PKG_CONFIG + +# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +# +# Check to see whether a particular set of modules exists. Similar +# to PKG_CHECK_MODULES(), but does not set variables or print errors. +# +# +# Similar to PKG_CHECK_MODULES, make sure that the first instance of +# this or PKG_CHECK_MODULES is called, or make sure to call +# PKG_CHECK_EXISTS manually +# -------------------------------------------------------------- +AC_DEFUN([PKG_CHECK_EXISTS], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +if test -n "$PKG_CONFIG" && \ + AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then + m4_ifval([$2], [$2], [:]) +m4_ifvaln([$3], [else + $3])dnl +fi]) + + +# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) +# --------------------------------------------- +m4_define([_PKG_CONFIG], +[if test -n "$PKG_CONFIG"; then + if test -n "$$1"; then + pkg_cv_[]$1="$$1" + else + PKG_CHECK_EXISTS([$3], + [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`], + [pkg_failed=yes]) + fi +else + pkg_failed=untried +fi[]dnl +])# _PKG_CONFIG + +# _PKG_SHORT_ERRORS_SUPPORTED +# ----------------------------- +AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG]) +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi[]dnl +])# _PKG_SHORT_ERRORS_SUPPORTED + + +# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], +# [ACTION-IF-NOT-FOUND]) +# +# E.g., +# PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not) +# defines: +# +# GSTUFF_LIBS +# GSTUFF_CFLAGS +# GSTUFF_INCLUDEDIR +# GSTUFF_CPPFLAGS # the -I, -D and -U's out of CFLAGS +# +# see pkg-config man page also defines GSTUFF_PKG_ERRORS on error +# +# Note that if there is a possibility the first call to +# PKG_CHECK_MODULES might not happen, you should be sure to include an +# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac +# +# -------------------------------------------------------------- +AC_DEFUN([PKG_CHECK_MODULES], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])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 + +pkg_failed=no +AC_MSG_CHECKING([for $1]) + +_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) + +if test x$cross_compiling = xyes +then + _PKG_CONFIG([$1][_LIBS], [libs-only-l --static], [$2]) +else + _PKG_CONFIG([$1][_LIBS], [libs --static], [$2]) +fi + +_PKG_CONFIG([$1][_INCLUDEDIR], [variable=includedir], [$2]) + + +m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS +and $1[]_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details.]) + +if test $pkg_failed = yes; then + _PKG_SHORT_ERRORS_SUPPORTED + if test $_pkg_short_errors_supported = yes; then + $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "$2"` + else + $1[]_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"` fi + # Put the nasty error message in config.log where it belongs + echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD + + ifelse([$4], , [AC_MSG_ERROR(dnl +[Package requirements ($2) were not met: + +$$1_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +_PKG_TEXT +])], + [AC_MSG_RESULT([no]) + $4]) +elif test $pkg_failed = untried; then + ifelse([$4], , [AC_MSG_FAILURE(dnl +[The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. - AC_SUBST($1_CFLAGS) - AC_SUBST($1_LIBS) - AC_SUBST($1_INCLUDEDIR) - else - echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer." - echo "*** See http://www.freedesktop.org/software/pkgconfig" - fi - fi +_PKG_TEXT - if test $succeeded = yes; then - ifelse([$3], , :, [$3]) - else - ifelse([$4], , AC_MSG_ERROR([Library requirements ($2) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them.]), [$4]) - fi -]) +To get pkg-config, see .])], + [$4]) +else + $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS + $1[]_LIBS=$pkg_cv_[]$1[]_LIBS + $1[]_INCLUDEDIR=$pkg_cv_[]$1[]_INCLUDEDIR + $1[]_CPPFLAGS="" + for flag in $$1[]_CFLAGS; do + case $flag in + -I* | -D* | -U*) $1[]_CPPFLAGS="$$1[]_CPPFLAGS $flag" ;; + esac + done + pkg_cv_[]$1[]_CPPFLAGS=$$1[]_CPPFLAGS + AC_SUBST($1[]_CPPFLAGS) + AC_MSG_RESULT([yes]) + ifelse([$3], , :, [$3]) +fi[]dnl +])# PKG_CHECK_MODULES diff --git a/gr-howto-write-a-block/config/usrp_fusb_tech.m4 b/gr-howto-write-a-block/config/usrp_fusb_tech.m4 index b5a930b9..db857249 100644 --- a/gr-howto-write-a-block/config/usrp_fusb_tech.m4 +++ b/gr-howto-write-a-block/config/usrp_fusb_tech.m4 @@ -1,5 +1,5 @@ dnl -dnl Copyright 2003 Free Software Foundation, Inc. +dnl Copyright 2003,2008 Free Software Foundation, Inc. dnl dnl This file is part of GNU Radio dnl @@ -19,38 +19,56 @@ dnl the Free Software Foundation, Inc., 51 Franklin Street, dnl Boston, MA 02110-1301, USA. dnl -AC_DEFUN([USRP_SET_FUSB_TECHNIQUE],[ - AC_REQUIRE([AC_CANONICAL_HOST]) - AC_ARG_WITH(fusb-tech, - [ --with-fusb-tech=OS set fast usb technique (auto)], - [cf_with_fusb_tech="$withval"], - [cf_with_fusb_tech="$host_os"]) - - - AC_CHECK_HEADER([linux/usbdevice_fs.h], - [x_have_usbdevice_fs_h=yes], - [x_have_usbdevice_fs_h=no]) - - AC_MSG_CHECKING([for fast usb technique to use]) - case "$cf_with_fusb_tech" in - linux*) if test x${x_have_usbdevice_fs_h} = xyes; - then - FUSB_TECH=linux - else - FUSB_TECH=generic - fi ;; +# $1 is $enable_usrp: +# yes : do these tests +# no : do not do these tests +# "" : do these tests - darwin*) FUSB_TECH=darwin ;; - cygwin*|win*|mingw*) FUSB_TECH=win32 ;; - *) FUSB_TECH=generic ;; - esac +AC_DEFUN([USRP_SET_FUSB_TECHNIQUE],[ + AC_ARG_WITH([fusb-tech], + AC_HELP_STRING([--with-fusb-tech=OS], + [Set fast USB technique (default=auto)]), + [cf_with_fusb_tech="$withval"], + [cf_with_fusb_tech="$host_os"]) + if test [x]$1 != xno; then + case "$cf_with_fusb_tech" in + linux*) + AC_CHECK_HEADER([linux/usbdevice_fs.h], + [x_have_usbdevice_fs_h=yes], + [x_have_usbdevice_fs_h=no]) + if test x${x_have_usbdevice_fs_h} = xyes; then + FUSB_TECH=linux + else + FUSB_TECH=generic + fi + ;; + darwin*) + FUSB_TECH=darwin + ;; + cygwin*|win*|mingw*) + FUSB_TECH=win32 + ;; + *bsd*) + AC_MSG_CHECKING([for RA/WB]) + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]], + [[struct usb_bulk_ra_wb_opt o; + ioctl(0, USB_SET_BULK_RA, &o);]])], + [FUSB_TECH=ra_wb], + [FUSB_TECH=generic]) + ;; + *) + FUSB_TECH=generic + ;; + esac - AC_MSG_RESULT($FUSB_TECH) - AC_SUBST(FUSB_TECH) + AC_MSG_CHECKING([for fast usb technique to use]) + AC_MSG_RESULT($FUSB_TECH) + AC_SUBST(FUSB_TECH) + fi - AM_CONDITIONAL(FUSB_TECH_darwin, test $FUSB_TECH = darwin) - AM_CONDITIONAL(FUSB_TECH_win32, test $FUSB_TECH = win32) - AM_CONDITIONAL(FUSB_TECH_generic, test $FUSB_TECH = generic) - AM_CONDITIONAL(FUSB_TECH_linux, test $FUSB_TECH = linux) + AM_CONDITIONAL(FUSB_TECH_darwin, test x$FUSB_TECH = xdarwin) + AM_CONDITIONAL(FUSB_TECH_win32, test x$FUSB_TECH = xwin32) + AM_CONDITIONAL(FUSB_TECH_generic, test x$FUSB_TECH = xgeneric) + AM_CONDITIONAL(FUSB_TECH_linux, test x$FUSB_TECH = xlinux) + AM_CONDITIONAL(FUSB_TECH_ra_wb, test x$FUSB_TECH = xra_wb) ]) - diff --git a/gr-howto-write-a-block/config/usrp_libusb.m4 b/gr-howto-write-a-block/config/usrp_libusb.m4 index 9fe4753e..cb3130c8 100644 --- a/gr-howto-write-a-block/config/usrp_libusb.m4 +++ b/gr-howto-write-a-block/config/usrp_libusb.m4 @@ -1,43 +1,48 @@ -# Check for libusb support. -*- Autoconf -*- - -# Copyright 2003 Free Software Foundation, Inc. - -# This program 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. - -# This program 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, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Boston, MA -# 02110-1301, USA. - -AC_DEFUN([USRP_LIBUSB], -[ - AC_REQUIRE([AC_CANONICAL_HOST]) - AC_LANG_PUSH(C) +dnl Copyright 2003,2008 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. + +AC_DEFUN([USRP_LIBUSB], [ + libusbok=yes + PKG_CHECK_MODULES(USB, libusb, [], [ + AC_LANG_PUSH(C) + + AC_CHECK_HEADERS([usb.h], [], [libusbok=no; AC_MSG_RESULT([USRP requires libusb. usb.h not found. See http://libusb.sf.net])]) + + save_LIBS="$LIBS" + case "$host_os" in + darwin*) + LIBS="$LIBS -lIOKit" + ;; + *) ;; + esac - AC_CHECK_HEADERS([usb.h], - [], - [ AC_MSG_ERROR([USRP requires libusb. usb.h not found, stop. See http://libusb.sf.net]) ] - ) + AC_SEARCH_LIBS(usb_bulk_write, [usb], [USB_LIBS="$LIBS"], [libusbok=no; AC_MSG_RESULT([USRP requires libusb. usb_bulk_write not found. See http://libusb.sf.net])]) - save_LIBS="$LIBS" - case "$host_os" in - darwin*) LIBS="$LIBS -lIOKit" ;; - *) ;; - esac - AC_SEARCH_LIBS(usb_bulk_write, [usb], - [ USB_LIBS="$LIBS" ], - [ AC_MSG_ERROR([USRP requires libusb. usb_bulk_write not found, stop. See http://libusb.sf.net]) ] - ) LIBS="$save_LIBS" - AC_LANG_POP - AC_SUBST(USB_LIBS) + AC_LANG_POP + ]) + + if test x$libusbok = xyes; then + AC_SUBST(USB_LIBS) + ifelse([$1], , :, [$1]) + else + ifelse([$2], , :, [$2]) + fi ]) diff --git a/gr-howto-write-a-block/config/usrp_sdcc.m4 b/gr-howto-write-a-block/config/usrp_sdcc.m4 index 37ce7c35..86f6429e 100644 --- a/gr-howto-write-a-block/config/usrp_sdcc.m4 +++ b/gr-howto-write-a-block/config/usrp_sdcc.m4 @@ -19,49 +19,57 @@ AC_DEFUN([USRP_SDCC], [ + sdccok=yes AC_CHECK_PROG(XCC, sdcc, sdcc -mmcs51 --no-xinit-opt,no) AC_CHECK_PROG(XAS, asx8051, asx8051 -plosgff,no) if test "$XCC" = "no" -o "$XAS" = "no" ; then - AC_MSG_ERROR([USRP requires sdcc. sdcc not found, stop. See http://sdcc.sf.net]) - fi + AC_MSG_RESULT([USRP requires sdcc. sdcc not found. See http://sdcc.sf.net]) + sdccok=no + else + sdcc_version_min=$1 - sdcc_version_min=$1 + sdcc_version=`sdcc --version 2>&1 | \ + sed 's/\(SDCC.* \)\([[0-9]]*\.[[0-9]]*\.[[0-9]]*\)\( .*$\)/\2/'` - sdcc_version=`sdcc --version 2>&1 | \ - sed 's/\(SDCC.* \)\([[0-9]]*\.[[0-9]]*\.[[0-9]]*\)\( .*$\)/\2/'` + AC_MSG_CHECKING([sdcc_version "$sdcc_version"]) - AC_MSG_CHECKING([sdcc_version "$sdcc_version"]) + sdcc_major_version=`echo $sdcc_version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` + sdcc_minor_version=`echo $sdcc_version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` + sdcc_micro_version=`echo $sdcc_version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` - sdcc_major_version=`echo $sdcc_version | \ - sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` - sdcc_minor_version=`echo $sdcc_version | \ - sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` - sdcc_micro_version=`echo $sdcc_version | \ - sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` + sdcc_major_min=`echo $sdcc_version_min | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` + sdcc_minor_min=`echo $sdcc_version_min | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` + sdcc_micro_min=`echo $sdcc_version_min | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` - sdcc_major_min=`echo $sdcc_version_min | \ - sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` - sdcc_minor_min=`echo $sdcc_version_min | \ - sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` - sdcc_micro_min=`echo $sdcc_version_min | \ - sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` + sdcc_version_proper=`expr \ + "$sdcc_major_version" \> "$sdcc_major_min" \| \ + "$sdcc_major_version" \= "$sdcc_major_min" \& \ + "$sdcc_minor_version" \> "$sdcc_minor_min" \| \ + "$sdcc_major_version" \= "$sdcc_major_min" \& \ + "$sdcc_minor_version" \= "$sdcc_minor_min" \& \ + "$sdcc_micro_version" \>= "$sdcc_micro_min" ` - sdcc_version_proper=`expr \ - "$sdcc_major_version" \> "$sdcc_major_min" \| \ - "$sdcc_major_version" \= "$sdcc_major_min" \& \ - "$sdcc_minor_version" \> "$sdcc_minor_min" \| \ - "$sdcc_major_version" \= "$sdcc_major_min" \& \ - "$sdcc_minor_version" \= "$sdcc_minor_min" \& \ - "$sdcc_micro_version" \>= "$sdcc_micro_min" ` + if test "$sdcc_version_proper" = "1" ; then + AC_MSG_RESULT([$sdcc_major_version.$sdcc_minor_version.$sdcc_micro_version]) + else + sdccok=no + AC_MSG_RESULT([USRP requires sdcc >= $sdcc_version_min. sdcc not found. See http://sdcc.sf.net]) + fi - if test "$sdcc_version_proper" = "1" ; then - AC_MSG_RESULT([$sdcc_major_version.$sdcc_minor_version.$sdcc_micro_version]) - else - AC_MSG_ERROR([USRP requires sdcc >= $sdcc_version_min. sdcc not found, stop. See http://sdcc.sf.net]) + AC_SUBST(XCC) + AC_SUBST(XAS) fi - AC_SUBST(XCC) - AC_SUBST(XAS) - + if test $sdccok = yes; then + ifelse([$2], , :, [$2]) + else + ifelse([$3], , :, [$3]) + fi ]) diff --git a/gr-howto-write-a-block/configure.ac b/gr-howto-write-a-block/configure.ac index 4137858a..66482637 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 Free Software Foundation, Inc. +dnl Copyright 2004,2005,2007,2008 Free Software Foundation, Inc. dnl dnl This file is part of GNU Radio dnl @@ -23,12 +23,26 @@ AC_INIT AC_PREREQ(2.57) AC_CONFIG_SRCDIR([src/lib/howto.i]) AM_CONFIG_HEADER(config.h) -AC_CANONICAL_TARGET([]) + +AC_CANONICAL_BUILD +AC_CANONICAL_HOST +AC_CANONICAL_TARGET + AM_INIT_AUTOMAKE(gr-howto-write-a-block,3.1.svn) -GR_X86_64 -dnl LF_CONFIGURE_CC +LF_CONFIGURE_CC LF_CONFIGURE_CXX +GR_LIB64 dnl check for lib64 suffix after choosing compilers + + +dnl add ${prefix}/lib${gr_libdir_suffix}/pkgconfig to the head of the PKG_CONFIG_PATH +if test x${PKG_CONFIG_PATH} = x; then + PKG_CONFIG_PATH=${prefix}/lib${gr_libdir_suffix}/pkgconfig +else + PKG_CONFIG_PATH=${prefix}/lib${gr_libdir_suffix}/pkgconfig:${PKG_CONFIG_PATH} +fi +export PKG_CONFIG_PATH + LF_SET_WARNINGS GR_SET_GPROF GR_SET_PROF @@ -42,19 +56,18 @@ AC_LIBTOOL_WIN32_DLL AC_ENABLE_SHARED dnl do build shared libraries AC_DISABLE_STATIC dnl don't build static libraries m4_ifdef([LT_INIT],[LT_INIT],[AC_PROG_LIBTOOL]) +dnl GR_FORTRAN -dnl Locate python, SWIG, etc -GR_NO_UNDEFINED -GR_SCRIPTING +GR_NO_UNDEFINED dnl do we need the -no-undefined linker flag +GR_SCRIPTING dnl Locate python, SWIG, etc -dnl Checks for libraries. +AC_CHECK_PROG([XMLTO],[xmlto],[yes],[]) +AM_CONDITIONAL([HAS_XMLTO], [test x$XMLTO = xyes]) -dnl check for threads (mandatory) -GR_OMNITHREAD -CFLAGS="${CFLAGS} $PTHREAD_CFLAGS" -CXXFLAGS="${CXXFLAGS} $PTHREAD_CFLAGS" +dnl Checks for libraries. +dnl Set the c++ compiler that we use for the build system when cross compiling if test "x$CXX_FOR_BUILD" = x then CXX_FOR_BUILD=${CXX} @@ -72,6 +85,8 @@ AC_C_CONST AC_C_INLINE AC_TYPE_SIZE_T AC_HEADER_TIME +AC_C_BIGENDIAN + dnl Checks for library functions. AC_CHECK_FUNCS([]) @@ -82,11 +97,30 @@ GR_PWIN32 PKG_CHECK_MODULES(GNURADIO_CORE, gnuradio-core >= 3) LIBS="$LIBS $GNURADIO_CORE_LIBS" -dnl Define where to find boost includes -dnl defines BOOST_CFLAGS -GR_REQUIRE_BOOST_INCLUDES - -STD_DEFINES_AND_INCLUDES="$GNURADIO_CORE_CFLAGS $BOOST_CFLAGS" +dnl We pick up the boost cppflags, cxxflags and thread lib via GNURADIO_CORE +dnl +dnl If you need additional boost libraries, you'll need to +dnl uncomment AX_BOOST_BASE, plus some of the following: +dnl +dnl calls AC_SUBST(BOOST_CPPFLAGS), AC_SUBST(BOOST_LDFLAGS) and defines HAVE_BOOST +dnl AX_BOOST_BASE([1.35]) +dnl +dnl All the rest of these call AC_SUBST(BOOST__LIB) and define HAVE_BOOST_ +dnl +dnl AX_BOOST_DATE_TIME +dnl AX_BOOST_FILESYSTEM +dnl AX_BOOST_IOSTREAMS +dnl AX_BOOST_PROGRAM_OPTIONS +dnl AX_BOOST_REGEX +dnl AX_BOOST_SERIALIZATION +dnl AX_BOOST_SIGNALS +dnl AX_BOOST_SYSTEM +dnl AX_BOOST_TEST_EXEC_MONITOR +dnl AX_BOOST_UNIT_TEST_FRAMEWORK +dnl AX_BOOST_WSERIALIZATION + + +STD_DEFINES_AND_INCLUDES="$GNURADIO_CORE_CFLAGS" AC_SUBST(STD_DEFINES_AND_INCLUDES) AC_CONFIG_FILES([\ diff --git a/gr-howto-write-a-block/src/lib/Makefile.am b/gr-howto-write-a-block/src/lib/Makefile.am index 3a0a0a3f..04bac39d 100644 --- a/gr-howto-write-a-block/src/lib/Makefile.am +++ b/gr-howto-write-a-block/src/lib/Makefile.am @@ -28,10 +28,9 @@ include $(top_srcdir)/Makefile.common ourpythondir = $(grpythondir) ourlibdir = $(grpyexecdir) -AM_CPPFLAGS = $(STD_DEFINES_AND_INCLUDES) $(PYTHON_CPPFLAGS) $(WITH_INCLUDES) +AM_CPPFLAGS = $(STD_DEFINES_AND_INCLUDES) $(PYTHON_CPPFLAGS) -SWIGPYTHONARGS = $(SWIGPYTHONFLAGS) $(SWIGGRFLAGS) $(WITH_SWIG_INCLUDES) \ - $(WITH_INCLUDES) +SWIGPYTHONARGS = $(SWIGPYTHONFLAGS) $(SWIGGRFLAGS) ALL_IFILES = \ $(LOCAL_IFILES) \ -- 2.30.2