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.am2
-rw-r--r--gr-howto-write-a-block/config/gr_fortran.m41
-rw-r--r--gr-howto-write-a-block/config/gr_git.m435
-rw-r--r--gr-howto-write-a-block/config/gr_pwin32.m43
-rw-r--r--gr-howto-write-a-block/config/gr_python.m444
-rw-r--r--gr-howto-write-a-block/config/gr_set_md_cpu.m481
-rw-r--r--gr-howto-write-a-block/config/gr_standalone.m46
-rw-r--r--gr-howto-write-a-block/config/gr_version.m474
-rw-r--r--gr-howto-write-a-block/config/lf_warnings.m447
-rw-r--r--gr-howto-write-a-block/config/usrp_fusb_tech.m415
10 files changed, 269 insertions, 39 deletions
diff --git a/gr-howto-write-a-block/config/Makefile.am b/gr-howto-write-a-block/config/Makefile.am
index 5858d2219..23f4a4b16 100644
--- a/gr-howto-write-a-block/config/Makefile.am
+++ b/gr-howto-write-a-block/config/Makefile.am
@@ -49,6 +49,7 @@ m4macros = \
gr_check_usrp.m4 \
gr_doxygen.m4 \
gr_fortran.m4 \
+ gr_git.m4 \
gr_gprof.m4 \
gr_lib64.m4 \
gr_libgnuradio_core_extra_ldflags.m4 \
@@ -63,6 +64,7 @@ m4macros = \
gr_subversion.m4 \
gr_swig.m4 \
gr_sysv_shm.m4 \
+ gr_version.m4 \
lf_cc.m4 \
lf_cxx.m4 \
lf_warnings.m4 \
diff --git a/gr-howto-write-a-block/config/gr_fortran.m4 b/gr-howto-write-a-block/config/gr_fortran.m4
index b5b0470f4..033ef0307 100644
--- a/gr-howto-write-a-block/config/gr_fortran.m4
+++ b/gr-howto-write-a-block/config/gr_fortran.m4
@@ -29,4 +29,5 @@ AC_DEFUN([GR_FORTRAN],[
AC_PROG_F77
AC_F77_LIBRARY_LDFLAGS
fi
+ AC_PROG_CC dnl bug fix to restore $ac_ext
])
diff --git a/gr-howto-write-a-block/config/gr_git.m4 b/gr-howto-write-a-block/config/gr_git.m4
new file mode 100644
index 000000000..5fe424808
--- /dev/null
+++ b/gr-howto-write-a-block/config/gr_git.m4
@@ -0,0 +1,35 @@
+dnl Copyright 2009 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_GIT],[
+ dnl Identify git binary
+ AC_PATH_PROG([GIT],[git])
+
+ dnl If it exists, get either 'git describe' or fallback to current commit
+ if test x$GIT != x ; then
+ if (cd $srcdir && $GIT describe >/dev/null 2>&1); then
+ GIT_VERSION=`cd $srcdir && $GIT describe --abbrev=8 | cut -f 2- -d '-'`
+ else
+ if (cd $srcdir && $GIT describe --always --abbrev=8 >/dev/null 2>&1); then
+ GIT_VERSION=`cd $srcdir && $GIT describe --always --abbrev=8`
+ fi
+ fi
+ fi
+])
diff --git a/gr-howto-write-a-block/config/gr_pwin32.m4 b/gr-howto-write-a-block/config/gr_pwin32.m4
index 7b99cba6b..495e9dd4d 100644
--- a/gr-howto-write-a-block/config/gr_pwin32.m4
+++ b/gr-howto-write-a-block/config/gr_pwin32.m4
@@ -99,6 +99,9 @@ struct timespec {
long tv_nsec;
};
#endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
static inline int nanosleep(const struct timespec *req, struct timespec *rem) { return usleep(req->tv_sec*1000000+req->tv_nsec/1000); }
#endif
diff --git a/gr-howto-write-a-block/config/gr_python.m4 b/gr-howto-write-a-block/config/gr_python.m4
index 6c862bba3..43ccfc015 100644
--- a/gr-howto-write-a-block/config/gr_python.m4
+++ b/gr-howto-write-a-block/config/gr_python.m4
@@ -123,6 +123,50 @@ print path
;;
esac
+ case $host_os in
+ *mingw* )
+ # Python 2.5 requires ".pyd" instead of ".dll" for extensions
+ PYTHON_LDFLAGS="-shrext .pyd ${PYTHON_LDFLAGS}"
+ esac
+
AC_SUBST(PYTHON_LDFLAGS)
fi
])
+
+# PYTHON_CHECK_MODULE
+#
+# Determines if a particular Python module can be imported
+#
+# $1 - module name
+# $2 - module description
+# $3 - action if found
+# $4 - action if not found
+# $5 - test command
+
+AC_DEFUN([PYTHON_CHECK_MODULE],[
+ AC_MSG_CHECKING([for $2])
+ dnl ########################################
+ dnl # import and test checking
+ dnl ########################################
+ if test "$5"; then
+ python_cmd='
+try:
+ import $1
+ assert $5
+except: exit(1)'
+ dnl ########################################
+ dnl # import checking only
+ dnl ########################################
+ else
+ python_cmd='
+try: import $1
+except: exit(1)'
+ fi
+ if ! $PYTHON -c "$python_cmd" 2> /dev/null; then
+ AC_MSG_RESULT([no])
+ $4
+ else
+ AC_MSG_RESULT([yes])
+ $3
+ 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 b9c570ede..7ebf88a66 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,2008 Free Software Foundation, Inc.
+dnl Copyright 2003,2008,2009 Free Software Foundation, Inc.
dnl
dnl This file is part of GNU Radio
dnl
@@ -19,20 +19,89 @@ dnl the Free Software Foundation, Inc., 51 Franklin Street,
dnl Boston, MA 02110-1301, USA.
dnl
+AC_DEFUN([_TRY_ADD_ALTIVEC],
+[
+ LF_CHECK_CC_FLAG([-mabi=altivec -maltivec])
+ LF_CHECK_CXX_FLAG([-mabi=altivec -maltivec])
+])
+
+AC_DEFUN([_FIND_ARM_ISA],
+[
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
+ [[#ifndef __ARM_ARCH_5__
+ #error "Not armv5"
+ #endif
+ ]])],
+ [is_armv5=yes],
+ [is_armv5=no])
+
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
+ [[#ifndef __ARM_ARCH_7A__
+ #error "Not armv7-a"
+ #endif
+ ]])],
+ [is_armv7_a=yes],
+ [is_armv7_a=no])
+
+])
+
AC_DEFUN([GR_SET_MD_CPU],[
AC_REQUIRE([AC_CANONICAL_HOST])
AC_ARG_WITH(md-cpu,
- [ --with-md-cpu=ARCH set machine dependent speedups (auto)],
+ AC_HELP_STRING([--with-md-cpu=ARCH],[set machine dependent speedups (auto)]),
[cf_with_md_cpu="$withval"],
- [cf_with_md_cpu="$host_cpu"])
-
- AC_MSG_CHECKING([for machine dependent speedups])
+ [
+ dnl see if the user has specified --host or --build, via 'cross_compiling'
+ if test "$cross_compiling" != no; then
+ dnl when cross-compiling, because the user specified it either via
+ dnl --target or --build, just keep the user's specs & hope for the best.
+ cf_with_md_cpu="$host_cpu"
+ else
+ dnl when the user didn't specify --target or --build, on Darwin 10
+ dnl (OSX 10.6.0 and .1) and GNU libtoool 2.2.6, 'configure' doesn't
+ dnl figure out the CPU type correctly, so do it by hand here using
+ dnl the sizeof (void*): if 4 then use i386, and otherwise use x86_64.
+ case "$host_os" in
+ *darwin*10*)
+ AC_CHECK_SIZEOF(void*)
+ if test "$ac_cv_sizeof_voidp" = 4; then
+ cf_with_md_cpu="i386"
+ else
+ cf_with_md_cpu="x86_64"
+ fi
+ ;;
+ *)
+ cf_with_md_cpu="$host_cpu"
+ ;;
+ esac
+ fi
+ ])
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 ;;
powerpc*) MD_CPU=powerpc ;;
+ arm)
+ _FIND_ARM_ISA
+ if test $is_armv5 = yes; then MD_CPU=armv5;
+ elif test $is_armv7_a = yes; then MD_CPU=armv7_a;
+ else MD_CPU=generic; fi
+ ;;
*) MD_CPU=generic ;;
esac
+
+ AC_ARG_ENABLE(altivec,
+ AC_HELP_STRING([--enable-altivec],[enable altivec on PowerPC (yes)]),
+ [ if test $MD_CPU = powerpc; then
+ case "$enableval" in
+ (no) MD_CPU=generic ;;
+ (yes) _TRY_ADD_ALTIVEC ;;
+ (*) AC_MSG_ERROR([Invalid argument ($enableval) to --enable-altivec]) ;;
+ esac
+ fi],
+ [ if test $MD_CPU = powerpc; then _TRY_ADD_ALTIVEC fi])
+
+
+ AC_MSG_CHECKING([for machine dependent speedups])
AC_MSG_RESULT($MD_CPU)
AC_SUBST(MD_CPU)
AC_SUBST(MD_SUBCPU)
@@ -40,5 +109,7 @@ AC_DEFUN([GR_SET_MD_CPU],[
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_armv5, test "$MD_CPU" = "armv5")
+ AM_CONDITIONAL(MD_CPU_armv7_a, test "$MD_CPU" = "armv7_a")
AM_CONDITIONAL(MD_CPU_generic, test "$MD_CPU" = "generic")
])
diff --git a/gr-howto-write-a-block/config/gr_standalone.m4 b/gr-howto-write-a-block/config/gr_standalone.m4
index 2f8851676..593583e2d 100644
--- a/gr-howto-write-a-block/config/gr_standalone.m4
+++ b/gr-howto-write-a-block/config/gr_standalone.m4
@@ -31,12 +31,6 @@ m4_define([GR_STANDALONE],
AC_CONFIG_SRCDIR([config/gr_standalone.m4])
AM_CONFIG_HEADER(config.h)
- AC_CANONICAL_BUILD
- AC_CANONICAL_HOST
- AC_CANONICAL_TARGET
-
- AM_INIT_AUTOMAKE
-
dnl Remember if the user explicity set CXXFLAGS
if test -n "${CXXFLAGS}"; then
user_set_cxxflags=yes
diff --git a/gr-howto-write-a-block/config/gr_version.m4 b/gr-howto-write-a-block/config/gr_version.m4
new file mode 100644
index 000000000..3360b7d54
--- /dev/null
+++ b/gr-howto-write-a-block/config/gr_version.m4
@@ -0,0 +1,74 @@
+dnl Copyright 2009 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_VERSION],[
+ dnl Computed version based on version.sh
+ dnl Does not force recompile on rev change
+ dnl
+ dnl Source the variables describing the release version
+ dnl
+ dnl MAJOR_VERSION Major release generation (2.x, 3.x, etc.)
+ dnl API_COMPAT API compatibility version (3.2.x, 3.3.x, etc.)
+ dnl MINOR_VERSION Minor release version
+ dnl MAINT_VERSION Pure bugfix additions to make maintenance release
+ dnl
+ dnl The last two fields can have 'git' instead of a number to indicate
+ dnl that this branch is between versions.
+ . $srcdir/version.sh
+ RELEASE=$MAJOR_VERSION.$API_COMPAT
+
+ dnl Get git version if available
+ GR_GIT
+
+ dnl Test if we should use git version
+ if test "$MINOR_VERSION" == "git"; then
+ dnl 3.3git-xxx-gxxxxxxxx
+ RELEASE=$RELEASE$MINOR_VERSION
+ DOCVER=$RELEASE
+ if test "$GIT_VERSION" != "" ; then
+ RELEASE=$RELEASE-$GIT_VERSION
+ fi
+ else
+ if test "$MAINT_VERSION" == "git" ; then
+ dnl 3.3.1git-xxx-gxxxxxxxx
+ RELEASE=$RELEASE.$MINOR_VERSION$MAINT_VERSION
+ DOCVER=$RELEASE
+ if test "$GIT_VERSION" != "" ; then
+ RELEASE=$RELEASE-$GIT_VERSION
+ fi
+ else
+ dnl This is a numbered reelase.
+ dnl Test if minor version is 0, which we don't encode, unless it is also
+ dnl a maintenance release
+ if test "$MINOR_VERSION" != "0" -o "$MAINT_VERSION" != "0"; then
+ dnl 3.3.1
+ RELEASE=$RELEASE.$MINOR_VERSION
+ if test "$MAINT_VERSION" != "0"; then
+ dnl 3.3.0.1, 3.3.1.1
+ RELEASE=$RELEASE.$MAINT_VERSION
+ fi
+ DOCVER=$RELEASE
+ fi
+ fi
+ fi
+
+ AC_MSG_NOTICE([GNU Radio Release $RELEASE])
+ AC_SUBST(RELEASE)
+ AC_SUBST(DOCVER)
+])
diff --git a/gr-howto-write-a-block/config/lf_warnings.m4 b/gr-howto-write-a-block/config/lf_warnings.m4
index 4e2ca9111..d40c77f14 100644
--- a/gr-howto-write-a-block/config/lf_warnings.m4
+++ b/gr-howto-write-a-block/config/lf_warnings.m4
@@ -1,4 +1,5 @@
dnl Copyright (C) 1988 Eleftherios Gkioulekas <lf@amath.washington.edu>
+dnl Copyright (C) 2009 Free Software Foundation, Inc.
dnl
dnl This program is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU General Public License as published by
@@ -21,7 +22,7 @@ dnl distribution terms that you use for the rest of that program.
# --------------------------------------------------------------------------
# Check whether the C++ compiler accepts a certain flag
-# If it does it adds the flag to CXXFLAGS
+# If it does it adds the flag to lf_CXXFLAGS
# If it does not then it returns an error to lf_ok
# Usage:
# LF_CHECK_CXX_FLAG(-flag1 -flag2 -flag3 ...)
@@ -34,18 +35,19 @@ AC_DEFUN([LF_CHECK_CXX_FLAG],[
AC_MSG_CHECKING([whether $CXX accepts $i])
if test -z "`${CXX} $i -c conftest.cc 2>&1`"
then
- CXXFLAGS="${CXXFLAGS} $i"
+ lf_CXXFLAGS="${lf_CXXFLAGS} $i"
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
done
rm -f conftest.cc conftest.o
+ AC_SUBST(lf_CXXFLAGS)
])
# --------------------------------------------------------------------------
# Check whether the C compiler accepts a certain flag
-# If it does it adds the flag to CFLAGS
+# If it does it adds the flag to lf_CFLAGS
# If it does not then it returns an error to lf_ok
# Usage:
# LF_CHECK_CC_FLAG(-flag1 -flag2 -flag3 ...)
@@ -58,18 +60,19 @@ AC_DEFUN([LF_CHECK_CC_FLAG],[
AC_MSG_CHECKING([whether $CC accepts $i])
if test -z "`${CC} $i -c conftest.c 2>&1`"
then
- CFLAGS="${CFLAGS} $i"
+ lf_CFLAGS="${lf_CFLAGS} $i"
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
done
rm -f conftest.c conftest.o
+ AC_SUBST(lf_CFLAGS)
])
# --------------------------------------------------------------------------
# Check whether the Fortran compiler accepts a certain flag
-# If it does it adds the flag to FFLAGS
+# If it does it adds the flag to lf_FFLAGS
# If it does not then it returns an error to lf_ok
# Usage:
# LF_CHECK_F77_FLAG(-flag1 -flag2 -flag3 ...)
@@ -87,42 +90,32 @@ EOF
AC_MSG_CHECKING([whether $F77 accepts $i])
if test -z "`${F77} $i -c conftest.f 2>&1`"
then
- FFLAGS="${FFLAGS} $i"
+ lf_FFLAGS="${lf_FFLAGS} $i"
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
done
rm -f conftest.f conftest.o
+ AC_SUBST(lf_FFLAGS)
])
# ----------------------------------------------------------------------
-# Provide the configure script with an --with-warnings option that
-# turns on warnings. Call this command AFTER you have configured ALL your
-# compilers.
+# Enable compiler warnings.
+# Call this command AFTER you have configured ALL your compilers.
# ----------------------------------------------------------------------
AC_DEFUN([LF_SET_WARNINGS],[
- dnl Check for --with-warnings
- AC_MSG_CHECKING([whether user wants warnings])
- AC_ARG_WITH(warnings,
- [ --with-warnings Turn on warnings],
- [ lf_warnings=yes ], [ lf_warnings=no ])
- lf_warnings=yes # hard code for now -eb
- AC_MSG_RESULT($lf_warnings)
-
dnl Warnings for the two main compilers
- cc_warning_flags="-Wall"
+ dnl add -Wextra when you're got time to fix a bunch of them ;-)
+ cc_warning_flags="-Wall -Werror-implicit-function-declaration"
cxx_warning_flags="-Wall -Woverloaded-virtual"
- if test $lf_warnings = yes
+ if test -n "${CC}"
then
- if test -n "${CC}"
- then
- LF_CHECK_CC_FLAG($cc_warning_flags)
- fi
- if test -n "${CXX}"
- then
- LF_CHECK_CXX_FLAG($cxx_warning_flags)
- fi
+ LF_CHECK_CC_FLAG($cc_warning_flags)
+ fi
+ if test -n "${CXX}"
+ then
+ LF_CHECK_CXX_FLAG($cxx_warning_flags)
fi
])
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 db857249b..b99cf2432 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,2008 Free Software Foundation, Inc.
+dnl Copyright 2003,2008,2009 Free Software Foundation, Inc.
dnl
dnl This file is part of GNU Radio
dnl
@@ -25,6 +25,8 @@ dnl
# "" : do these tests
AC_DEFUN([USRP_SET_FUSB_TECHNIQUE],[
+ req_libusb1=no
+ USE_LIBUSB1=0
AC_ARG_WITH([fusb-tech],
AC_HELP_STRING([--with-fusb-tech=OS],
[Set fast USB technique (default=auto)]),
@@ -32,6 +34,11 @@ AC_DEFUN([USRP_SET_FUSB_TECHNIQUE],[
[cf_with_fusb_tech="$host_os"])
if test [x]$1 != xno; then
case "$cf_with_fusb_tech" in
+ libusb1*)
+ FUSB_TECH=libusb1
+ req_libusb1=yes
+ USE_LIBUSB1=1
+ ;;
linux*)
AC_CHECK_HEADER([linux/usbdevice_fs.h],
[x_have_usbdevice_fs_h=yes],
@@ -70,5 +77,11 @@ AC_DEFUN([USRP_SET_FUSB_TECHNIQUE],[
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_libusb1, test x$FUSB_TECH = xlibusb1)
AM_CONDITIONAL(FUSB_TECH_ra_wb, test x$FUSB_TECH = xra_wb)
+
+ AC_SUBST(USE_LIBUSB1)
+ AC_CONFIG_FILES([\
+ usrp/host/include/usrp/libusb_types.h \
+ ])
])