summaryrefslogtreecommitdiff
path: root/gr-howto-write-a-block/config
diff options
context:
space:
mode:
Diffstat (limited to 'gr-howto-write-a-block/config')
-rw-r--r--gr-howto-write-a-block/config/Makefile.am5
-rw-r--r--gr-howto-write-a-block/config/gr_guile.m465
-rw-r--r--gr-howto-write-a-block/config/gr_scripting.m410
-rw-r--r--gr-howto-write-a-block/config/gr_set_md_cpu.m42
-rw-r--r--gr-howto-write-a-block/config/gr_standalone.m426
-rw-r--r--gr-howto-write-a-block/config/gr_swig.m430
-rw-r--r--gr-howto-write-a-block/config/pkg.m419
7 files changed, 146 insertions, 11 deletions
diff --git a/gr-howto-write-a-block/config/Makefile.am b/gr-howto-write-a-block/config/Makefile.am
index 23f4a4b16..aaaf0db7c 100644
--- a/gr-howto-write-a-block/config/Makefile.am
+++ b/gr-howto-write-a-block/config/Makefile.am
@@ -1,5 +1,5 @@
#
-# Copyright 2001 Free Software Foundation, Inc.
+# Copyright 2001,2010 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -51,6 +51,7 @@ m4macros = \
gr_fortran.m4 \
gr_git.m4 \
gr_gprof.m4 \
+ gr_guile.m4 \
gr_lib64.m4 \
gr_libgnuradio_core_extra_ldflags.m4 \
gr_no_undefined.m4 \
@@ -80,4 +81,4 @@ m4macros = \
# Don't install m4 macros anymore
# m4data_DATA = $(m4macros)
-EXTRA_DIST = $(m4macros)
+EXTRA_DIST = $(m4macros)
diff --git a/gr-howto-write-a-block/config/gr_guile.m4 b/gr-howto-write-a-block/config/gr_guile.m4
new file mode 100644
index 000000000..1f0793944
--- /dev/null
+++ b/gr-howto-write-a-block/config/gr_guile.m4
@@ -0,0 +1,65 @@
+dnl
+dnl Copyright 2003,2004,2005 Free Software Foundation, Inc.
+dnl
+dnl This file is part of GNU Radio
+dnl
+dnl GNU Radio is free software; you can redistribute it and/or modify
+dnl it under the terms of the GNU General Public License as published by
+dnl the Free Software Foundation; either version 3, or (at your option)
+dnl any later version.
+dnl
+dnl GNU Radio is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+dnl GNU General Public License for more details.
+dnl
+dnl You should have received a copy of the GNU General Public License
+dnl along with GNU Radio; see the file COPYING. If not, write to
+dnl the Free Software Foundation, Inc., 51 Franklin Street,
+dnl Boston, MA 02110-1301, USA.
+dnl
+
+# GUILE_DEVEL()
+#
+# Checks for Guile and tries to get the include path to 'Guile.h'.
+# It sets the $(GUILE_CPPFLAGS), $(GUILE_LDFLAGS) and $(guiledir) output variables,
+#
+AC_DEFUN([GUILE_DEVEL],[
+ dnl see if GUILE is installed
+ AC_PATH_PROG(GUILE, guile)
+ dnl get the config program
+ AC_PATH_PROG(GUILE_CONFIG, guile-config)
+ if test x${GUILE_CONFIG} != x; then
+ GUILE_CFLAGS="`${GUILE_CONFIG} compile`"
+ GUILE_LIBS="`${GUILE_CONFIG} link`"
+ GUILE_PKLIBDIR="`${GUILE_CONFIG} info pkglibdir`"
+ GUILE_PKDATADIR="`${GUILE_CONFIG} info pkgdatadir`/site"
+ else
+ GUILE_CFLAGS=""
+ GUILE_PKLIBDIR=""
+ GUILE_LIBS="Wl,-Bsymbolic-functions -lguile -lgmp -lcrypt"
+ fi
+ AC_SUBST(GUILE_CFLAGS)
+ AC_SUBST(GUILE_PKLIBDIR)
+ AC_SUBST(GUILE_PKDATADIR)
+ AC_SUBST(GUILE_LIBS)
+])
+
+# GUILE_CHECK_MODULE
+#
+# Determines if a particular Guile module can be imported
+#
+# $1 - module name
+# $2 - module description
+# $3 - action if found
+# $4 - action if not found
+# $5 - test command
+
+AC_DEFUN([GUILE_CHECK_MODULE],[
+ AC_MSG_CHECKING([for $2])
+ dnl ########################################
+ dnl # import and test checking
+ dnl ########################################
+ dnl if test x${enable_guile} = xyes; then
+ dnl fi
+])
diff --git a/gr-howto-write-a-block/config/gr_scripting.m4 b/gr-howto-write-a-block/config/gr_scripting.m4
index e030a8102..866b7e017 100644
--- a/gr-howto-write-a-block/config/gr_scripting.m4
+++ b/gr-howto-write-a-block/config/gr_scripting.m4
@@ -26,5 +26,13 @@ AC_DEFUN([GR_SCRIPTING],[
SWIG_PROG(1.3.31)
SWIG_ENABLE_CXX
- SWIG_PYTHON
+ dnl We need python at build time, as it's used as for utilities. If python
+ dnl isn't enabled, then we don't want the SWIG support for python.
+ AC_REQUIRE([AM_PATH_PYTHON])
+ if test x${enable_python} = xyes; then
+ SWIG_PYTHON
+ fi
+ if test x${enable_guile} = xyes; then
+ SWIG_GUILE
+ fi
])
diff --git a/gr-howto-write-a-block/config/gr_set_md_cpu.m4 b/gr-howto-write-a-block/config/gr_set_md_cpu.m4
index 7ebf88a66..cb5fb5aac 100644
--- a/gr-howto-write-a-block/config/gr_set_md_cpu.m4
+++ b/gr-howto-write-a-block/config/gr_set_md_cpu.m4
@@ -80,7 +80,7 @@ AC_DEFUN([GR_SET_MD_CPU],[
x86 | i[[3-7]]86) MD_CPU=x86 MD_SUBCPU=x86 ;;
x86_64) MD_CPU=x86 MD_SUBCPU=x86_64 ;;
powerpc*) MD_CPU=powerpc ;;
- arm)
+ arm*)
_FIND_ARM_ISA
if test $is_armv5 = yes; then MD_CPU=armv5;
elif test $is_armv7_a = yes; then MD_CPU=armv7_a;
diff --git a/gr-howto-write-a-block/config/gr_standalone.m4 b/gr-howto-write-a-block/config/gr_standalone.m4
index 3f8ddf1d6..beb98204c 100644
--- a/gr-howto-write-a-block/config/gr_standalone.m4
+++ b/gr-howto-write-a-block/config/gr_standalone.m4
@@ -1,5 +1,5 @@
dnl
-dnl Copyright 2008,2009 Free Software Foundation, Inc.
+dnl Copyright 2008,2009,2010 Free Software Foundation, Inc.
dnl
dnl This file is part of GNU Radio
dnl
@@ -111,6 +111,11 @@ m4_define([GR_STANDALONE],
PKG_CHECK_MODULES(GNURADIO_CORE, gnuradio-core >= 3)
LIBS="$LIBS $GNURADIO_CORE_LIBS"
+ gnuradio_core_GUILE_LOAD_PATH="`pkg-config --variable=guile_load_path gnuradio-core`"
+ gnuradio_core_LIBDIRPATH="`pkg-config --variable=libdir gnuradio-core`"
+ AC_SUBST(gnuradio_core_GUILE_LOAD_PATH)
+ AC_SUBST(gnuradio_core_LIBDIRPATH)
+
dnl Allow user to choose whether to generate SWIG/Python
dnl Default is enabled
AC_ARG_ENABLE([python],
@@ -125,6 +130,25 @@ m4_define([GR_STANDALONE],
)
AM_CONDITIONAL([PYTHON], [test x$enable_python = xyes])
+ dnl Allow user to choose whether to generate SWIG/Guile
+ dnl Default is disabled
+ AC_ARG_ENABLE([guile],
+ [AS_HELP_STRING([--enable-guile],
+ [generate SWIG/Guile components (default is no)])],
+ [case "${enableval}" in
+ yes) enable_guile=yes ;;
+ no) enable_guile=no ;;
+ *) AC_MSG_ERROR([bad value ${enableval} for --enable-guile]) ;;
+ esac],
+ [enable_guile=no]
+ )
+ AM_CONDITIONAL([GUILE], [test x$enable_guile = xyes])
+
+ dnl see if GUILE is installed
+ if test x${enable_guile} == xyes; then
+ AC_PATH_PROG(GUILE,guile)
+ fi
+
dnl Define where to look for cppunit includes and libs
dnl sets CPPUNIT_CFLAGS and CPPUNIT_LIBS
dnl Try using pkg-config first, then fall back to cppunit-config.
diff --git a/gr-howto-write-a-block/config/gr_swig.m4 b/gr-howto-write-a-block/config/gr_swig.m4
index cdb28055c..dcc2e72dc 100644
--- a/gr-howto-write-a-block/config/gr_swig.m4
+++ b/gr-howto-write-a-block/config/gr_swig.m4
@@ -26,7 +26,7 @@ dnl
# is greater or equal to the value of the argument. It should have the format:
# N[.N[.N]] (N is a number between 0 and 999. Only the first N is mandatory.)
AC_DEFUN([SWIG_PROG],[
- AC_REQUIRE([AC_PROG_MAKE_SET])
+ AC_REQUIRE([AC_PROG_MAKE_SET])
AC_CHECK_PROG(SWIG,swig,[`which swig`])
if test -z "$SWIG" ; then
AC_MSG_ERROR([Cannot find 'swig' program. SWIG version >= $1 required])
@@ -56,9 +56,9 @@ AC_DEFUN([SWIG_PROG],[
AC_DEFUN([SWIG_ENABLE_CXX],[
AC_REQUIRE([SWIG_PROG])
AC_REQUIRE([AC_PROG_CXX])
- if test "$SWIG" != "false" ; then
+ if test "$SWIG" != "false" ; then
SWIG="$SWIG -c++"
- fi
+ fi
])
# SWIG_PYTHON([use-shadow-classes])
@@ -83,3 +83,27 @@ dnl AC_SUBST(SWIG_PYTHON_OPT,[-python$swig_shadow])
fi
AC_SUBST(SWIG_PYTHON_CPPFLAGS,[$PYTHON_CPPFLAGS])
])
+
+AC_DEFUN([SWIG_TCL],[
+ AC_REQUIRE([SWIG_PROG])
+ AC_REQUIRE([TCL_DEVEL])
+ if test "$SWIG" != "false" ; then
+ AC_SUBST(SWIG_TCL_LIB,[-ltcl])
+dnl test ! "x$1" = "xno" && swig_shadow=" -shadow" || swig_shadow=""
+dnl AC_SUBST(SWIG_PYTHON_OPT,[-python$swig_shadow])
+ AC_SUBST(SWIG_TCL_OPT,[-tcl])
+ fi
+ AC_SUBST(SWIG_TCL_CPPFLAGS,[$TCL_CPPFLAGS])
+])
+
+AC_DEFUN([SWIG_GUILE],[
+ AC_REQUIRE([SWIG_PROG])
+ AC_REQUIRE([GUILE_DEVEL])
+ if test "$SWIG" != "false" ; then
+ AC_SUBST(SWIG_GUILE_LIB,[-lguile])
+dnl test ! "x$1" = "xno" && swig_shadow=" -shadow" || swig_shadow=""
+dnl AC_SUBST(SWIG_PYTHON_OPT,[-python$swig_shadow])
+ AC_SUBST(SWIG_GUILE_OPT,[-guile])
+ fi
+ AC_SUBST(SWIG_GUILE_CPPFLAGS,[$GUILE_CPPFLAGS])
+])
diff --git a/gr-howto-write-a-block/config/pkg.m4 b/gr-howto-write-a-block/config/pkg.m4
index 80bdfed4c..2d4d96109 100644
--- a/gr-howto-write-a-block/config/pkg.m4
+++ b/gr-howto-write-a-block/config/pkg.m4
@@ -111,8 +111,11 @@ fi[]dnl
# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
#
# --------------------------------------------------------------
-AC_DEFUN([PKG_CHECK_MODULES],
-[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
+AC_DEFUN([PKG_CHECK_MODULES],[
+AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
+AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+
AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
AC_ARG_VAR([$1][_INCLUDEDIR], [includedir for $1, overriding pkg-config])dnl
@@ -124,7 +127,17 @@ _PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
if test x$cross_compiling = xyes
then
- _PKG_CONFIG([$1][_LIBS], [libs-only-l --static], [$2])
+ dnl _PKG_CONFIG([$1][_LIBS], [libs-only-l --static], [$2])
+ _PKG_CONFIG([$1][_LIBS], [libs --static], [$2])
+ dnl prune out any -L/lib or -L/usr/lib since they're pointing to the wrong filesystem root
+ _pkg_tmp=
+ for flag in [$]pkg_cv_[$1][_LIBS]; do
+ case $flag in
+ (-L/lib* | -L/usr/lib* ) ;; # ignore
+ (*) _pkg_tmp="$_pkg_tmp $flag" ;;
+ esac
+ done
+ pkg_cv_[$1][_LIBS]="$_pkg_tmp"
else
_PKG_CONFIG([$1][_LIBS], [libs --static], [$2])
fi