From d497b054a51bc049640c1d43cb54ca3d54ffdb4a Mon Sep 17 00:00:00 2001 From: eb Date: Wed, 1 Oct 2008 23:11:11 +0000 Subject: [PATCH] Fixes ticket:297. Refactors how usrp2/firmware is built. Now AC_CONFIG_SUBDIRS is always called, and there's a AM_CONDITIONAL in usrp2/firmware that decides whether anything really gets built or not. I think this will fix the "double cross" issue (cross-compiling the bulk of this for cell while cross-compiling the usrp2 firmware at the same time), though it's not tested yet. git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@9695 221aa14e-8319-0410-a670-987f0aec2ac5 --- config/grc_usrp2.m4 | 14 +- usrp2/Makefile.am | 17 -- usrp2/firmware/Makefile.am | 17 +- usrp2/firmware/README | 2 +- usrp2/firmware/bootstrap | 2 +- usrp2/firmware/config/Makefile.am | 33 +++ usrp2/firmware/config/grc_build.m4 | 287 ++++++++++++++++++++ usrp2/firmware/config/grc_usrp2_firmware.m4 | 69 +++++ usrp2/firmware/config/grc_usrp2_stub.m4 | 23 ++ usrp2/firmware/configure.ac | 144 +++++++++- usrp2/firmware/configure.gnu | 11 + 11 files changed, 573 insertions(+), 46 deletions(-) create mode 100644 usrp2/firmware/config/Makefile.am create mode 100644 usrp2/firmware/config/grc_build.m4 create mode 100644 usrp2/firmware/config/grc_usrp2_firmware.m4 create mode 100644 usrp2/firmware/config/grc_usrp2_stub.m4 create mode 100755 usrp2/firmware/configure.gnu diff --git a/config/grc_usrp2.m4 b/config/grc_usrp2.m4 index 71757bfc..f7064c91 100644 --- a/config/grc_usrp2.m4 +++ b/config/grc_usrp2.m4 @@ -20,6 +20,9 @@ dnl Boston, MA 02110-1301, USA. AC_DEFUN([GRC_USRP2],[ GRC_ENABLE(usrp2) + dnl firmware uses a subsidiary configure.ac + AC_CONFIG_SUBDIRS([usrp2/firmware]) + dnl Don't do usrp if omnithread or gruel is skipped GRC_CHECK_DEPENDENCY(usrp2, gruel) GRC_CHECK_DEPENDENCY(usrp2, omnithread) @@ -33,7 +36,6 @@ AC_DEFUN([GRC_USRP2],[ *) AC_MSG_RESULT([no]) AC_MSG_NOTICE([USRP2 currently requires Linux host OS, not found]) - AM_CONDITIONAL([BUILDING_USRP2_FIRMWARE],[0]) passed="no" ;; esac @@ -43,16 +45,6 @@ AC_DEFUN([GRC_USRP2],[ dnl yes : if the --enable code passed muster and all dependencies are met dnl no : otherwise if test $passed = yes; then - dnl Only do firmware if mb-gcc can be found - AC_CHECK_PROG([MB_GCC],[mb-gcc],[yes],[no]) - if test $MB_GCC = yes; then - dnl Adds usrp2/firmware to $(subdirs), hierarchical build - AC_CONFIG_SUBDIRS([usrp2/firmware]) - else - AC_MSG_WARN([usrp2/firmware is not being built]) - fi - AM_CONDITIONAL([BUILDING_USRP2_FIRMWARE],[test $MB_GCC = yes]) - dnl Needed for usrp2_socket_opener AC_CHECK_HEADERS(arpa/inet.h byteswap.h linux/if_packet.h sys/socket.h sys/un.h) AC_CHECK_MEMBERS([struct msghdr.msg_control, diff --git a/usrp2/Makefile.am b/usrp2/Makefile.am index c478df9b..1ea05890 100644 --- a/usrp2/Makefile.am +++ b/usrp2/Makefile.am @@ -21,20 +21,3 @@ include $(top_srcdir)/Makefile.common SUBDIRS = host - -# KLUDGE ALERT! -# -# This kludge gets the files the host code needs into the tarball even if -# we're not building the firmware. -# -if !BUILDING_USRP2_FIRMWARE -EXTRA_DIST = \ - firmware/include/usrp2_cdefs.h \ - firmware/include/usrp2_cdefs.h \ - firmware/include/usrp2_eth_packet.h \ - firmware/include/usrp2_fpga_regs.h \ - firmware/include/usrp2_i2c_addr.h \ - firmware/include/usrp2_mac_addr.h \ - firmware/include/usrp2_mimo_config.h \ - firmware/include/usrp2_types.h -endif diff --git a/usrp2/firmware/Makefile.am b/usrp2/firmware/Makefile.am index 437f2322..62b2d5ba 100644 --- a/usrp2/firmware/Makefile.am +++ b/usrp2/firmware/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright 2007 Free Software Foundation, Inc. +# Copyright 2007,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 @@ -15,7 +15,20 @@ # along with this program. If not, see . # +ACLOCAL_AMFLAGS = -I config + include $(top_srcdir)/Makefile.common -SUBDIRS = include lib apps +EXTRA_DIST = \ + bootstrap \ + configure \ + configure.gnu + + +SUBDIRS = config + +if BUILDING_USRP2_FIRMWARE +SUBDIRS += include lib apps +endif + diff --git a/usrp2/firmware/README b/usrp2/firmware/README index 8b72bf9c..61d5ec4f 100644 --- a/usrp2/firmware/README +++ b/usrp2/firmware/README @@ -1,5 +1,5 @@ Stay tuned for additional info as it becomes available ... $ ./bootstrap - $ ./configure + $ ./configure.gnu $ make diff --git a/usrp2/firmware/bootstrap b/usrp2/firmware/bootstrap index 5b4ab09a..4106d474 100755 --- a/usrp2/firmware/bootstrap +++ b/usrp2/firmware/bootstrap @@ -22,7 +22,7 @@ rm -fr config.cache autom4te*.cache -aclocal +aclocal -I config autoconf autoheader # libtoolize --automake diff --git a/usrp2/firmware/config/Makefile.am b/usrp2/firmware/config/Makefile.am new file mode 100644 index 00000000..06b15c68 --- /dev/null +++ b/usrp2/firmware/config/Makefile.am @@ -0,0 +1,33 @@ +# +# Copyright 2008 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. +# + +include $(top_srcdir)/Makefile.common + +# Install m4 macros in this directory +m4datadir = $(datadir)/aclocal + +# List your m4 macros here +m4macros = \ + grc_build.m4 \ + grc_usrp2_stub.m4 \ + grc_usrp2_firmware.m4 + +EXTRA_DIST = $(m4macros) diff --git a/usrp2/firmware/config/grc_build.m4 b/usrp2/firmware/config/grc_build.m4 new file mode 100644 index 00000000..bf33d0da --- /dev/null +++ b/usrp2/firmware/config/grc_build.m4 @@ -0,0 +1,287 @@ +dnl Copyright 2006,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 Create --enable-foo argument for named component, create variables as needed +dnl $1 is component name +AC_DEFUN([GRC_ENABLE], [ + _GRC_ENABLE($1,m4_bpatsubst($1,-,_)) +]) +dnl $2 is the '_'d component name +dnl on exit variable enable_$2 will be set to [yes|no]; +dnl passed will be [yes|no] (same as enable_$2) + +AC_DEFUN([_GRC_ENABLE],[ + passed=yes + AC_ARG_ENABLE([$1], + AC_HELP_STRING([--enable-$1], + [Stop if $1 fails configuration]), + [],[ + [enable_]$2=$enable_all_components + if test x$enable_all_components = xno; then + passed=no + fi + ]) +]) +dnl Component specific configuration +dnl The order of the GR_ macros determines the order of compilation +dnl For -any- checks on $enable_all_components +dnl use the following guildlines: +dnl yes : --enable-all-components was specified, so error out if any +dnl components do not pass configuration checks. +dnl no : --disable-all-components was specified, so try to build the +dnl --enable'd components, and error out if any do not pass +dnl configuration checks. +dnl "" : this option was not specified on the command line; try to +dnl build all components that are not --with'd, but don't +dnl error out if any component does not pass configuration checks. +dnl +dnl For each --enable-foo component, if that flag is not specified on +dnl the command line, the related variable $enable_foo will be set to +dnl $enable_all_components . + +dnl Create --with-foo argument for named compoment, create variables as needed +dnl $1 is component name +dnl $2 is what to do on success +dnl $3 is the PKG_CONFIG name; if not given, then $1 +AC_DEFUN([GRC_WITH], [ + if test [x]$3 = x; then + pc_comp_name="$1" + else + pc_comp_name="$3" + fi + _GRC_WITH($1,[$2],${pc_comp_name},m4_bpatsubst($1,-,_)) +]) +dnl $3 is the pkg-config component name +dnl $4 is the '_'d component name +dnl on exit variable passed will be [yes|no|with]: +dnl yes: if --enable-$1 and/or --enable-all-components was specified, +dnl but --with was not; +dnl with: if --with-$1 was specified, and passed checks; +dnl no: all other conditions +AC_DEFUN([_GRC_WITH],[ + AC_ARG_WITH([$1], + AC_HELP_STRING([--with-$1@<:@=PATH@:>@], + [Use package $1 if installed in PATH (if specified) or PKG_CONFIG_PATH (if PATH not specified); stop if $1 not found]), + [if test "x$withval" != "xyes"; then + [with_]$4[_val]=$withval + [with_]$4=yes + fi], + []) + if test x$[with_]$4 = xyes; then + if test x$[enable_]$4 = xyes; then + AC_MSG_ERROR([Component $1: Cannot use both --enable and --with]) + else + _GRC_WITH_PKG_CONFIG_CHECK($1,$3,$4) + ifelse([$2], , :, [$2]) + fi + fi +]) + +dnl Use 'pkgconfig' to check for a package +dnl $1 is the --with component name +dnl $2 is the pkg-config component name, if provided; otherwise use $1 for this +dnl on success, resulting INCLUDES, INCLUDEDIR, LA, and LIBDIRPATH variables +dnl will be set; on failure, will exit with an error. +AC_DEFUN([GRC_WITH_PKG_CONFIG_CHECK], [ + if test [x]$2 = x; then + pc_comp_name="$1" + else + pc_comp_name="$2" + fi + _GRC_WITH_PKG_CONFIG_CHECK($1,${pc_comp_name},m4_bpatsubst($1,-,_)) +]) +dnl $2 is the pkg-config component name +dnl $3 is the '_'d component name +AC_DEFUN([_GRC_WITH_PKG_CONFIG_CHECK],[ + dnl save PKG_CONFIG_PATH, restore at the end + s_PKG_CONFIG_PATH=$PKG_CONFIG_PATH + + dnl create the PKG_CONFIG_PATH, via this component arg, if provided; + dnl else use the environment PKG_CONFIG_PATH + l_PKG_CONFIG_PATH=$[with_]$3[_val] + if test "x$l_PKG_CONFIG_PATH" != "x"; then + export PKG_CONFIG_PATH=$l_PKG_CONFIG_PATH + + dnl verify that the file exists; if not, no point in continuing + if ! test -r ${l_PKG_CONFIG_PATH}/$2[.pc]; then + AC_MSG_ERROR([Component $1: PKGCONFIG cannot find info for $2, with provided PKG_CONFIG_PATH = @<:@ $l_PKG_CONFIG_PATH @:>@ .]) + fi + fi + + dnl do the check; error out if not found + PKG_CHECK_EXISTS($2, [passed=with; check1=yes], [ + check1=no + dnl pkg-config returned an error; this might be that the .pc + dnl file was not valid, or the Requires: were not met. + dnl If the arg was provided and the input PKG_CONFIG_PATH , then try + dnl again appending the whole PKG_CONFIG_PATH. + if test "x$l_PKG_CONFIG_PATH" != "x"; then + if test "x$s_PKG_CONFIG_PATH" != "x"; then + export PKG_CONFIG_PATH=${PKG_CONFIG_PATH}:${s_PKG_CONFIG_PATH} + PKG_CHECK_EXISTS($2, passed=with, passed=no) + fi + fi + if test $passed != with; then + AC_MSG_ERROR([Component $1: PKGCONFIG cannot find info for $2, with PKG_CONFIG_PATH = @<:@ $PKG_CONFIG_PATH @:>@ .]) + fi + dnl pkg-config Requires are now met; save the new PKG_CONFIG_PATH + s_PKG_CONFIG_PATH=$PKG_CONFIG_PATH + ]) + + dnl if PKG_CHECK_EXISTS returned, then this component's .pc file was + dnl found in the provided 'arg' PKG_CONFIG_PATH; + dnl retrieve various parameters + $3[_INCLUDES]=`$PKG_CONFIG --cflags-only-I $2` + $3[_LA]=`$PKG_CONFIG --libs $2` + $3[_INCLUDEDIR]=`$PKG_CONFIG --variable=includedir $2` + + if test x$check1 = xyes; then + dnl prepend the args PKG_CONFIG_PATH to the saved one, if the + dnl saved version was not empty + if test "x$s_PKG_CONFIG_PATH" != "x"; then + export PKG_CONFIG_PATH=${PKG_CONFIG_PATH}:${s_PKG_CONFIG_PATH} + fi + fi +]) + +dnl Check the $prefix versus the --with libdirpath for this component +dnl $1 is the prefix +dnl $2 is the --with component name +dnl $3 is the --with component library path +AC_DEFUN([GRC_PREFIX_LDFLAGS],[ + $2[_LIBDIRPATH]=$3 + dnl create LDFLAGS for this --with, if different from the provided $prefix + if test [x]$1[/lib] != [x]$3; then + $2[_LDFLAG]=[-L]$3 + else + $2[_LDFLAG]= + fi +]) + +dnl Check to make sure this dependency is fulfilled for this component +dnl $1 is the component's name +dnl $2 is the component dependency name +dnl On input and exit, $passed will be: +dnl with : if --with passed muster +dnl yes : if --enable passed muster +dnl no : otherwise +dnl If trying --with, will error-out if any dependency was not --with'd +AC_DEFUN([GRC_CHECK_DEPENDENCY],[ +dnl f0=[enable_]m4_bpatsubst($1,-,_) +dnl f1=[$enable_]m4_bpatsubst($1,-,_) +dnl echo +dnl echo "$1 : Checking Dependency $2" +dnl echo "$1 : enable_all_components is '$enable_all_components'" +dnl echo "$1 : $f0 is '$f1'" +dnl echo "$1 : passed is '$passed'" +dnl echo + if test $passed != no; then + if test $passed = yes; then + dnl make sure this dependency was not skipped + if test [x$]m4_bpatsubst($2,-,_)[_skipped] = xyes; then + AC_MSG_RESULT([Component $1 requires $2, which is not being built or specified via pre-installed files.]) + passed=no + fi + else + dnl make sure this dependency was --with'd only; not --enable'd + if test [x$]m4_bpatsubst($2,-,_)[_with] = xno; then + AC_MSG_ERROR([Component $1 requires $2 to be included as --with-$1@<:@=arg@:>@]) + fi + fi + fi +]) + +dnl Check to make sure GUILE is available +dnl $1 is the component name +AC_DEFUN([GRC_CHECK_GUILE],[ + if test x"$GUILE" = x; then + AC_MSG_RESULT([Component $1 requires guile, which was not found.]) + passed=no + fi +]) + +dnl Add the specified "with" list; clear the provided variable +dnl $1 is the component name +dnl $2 is the path list name suffix +dnl $3 is the separator (for paths, ":"; for includes " ") +AC_DEFUN([GRC_ADD_TO_LIST],[ + if test "x${$1[_]$2}" != "x"; then + if test "x$[with_]$2" = "x"; then + [with_]$2="${$1[_]$2}" + else + [with_]$2="${$1[_]$2}"$3"$[with_]$2" + fi + $1[_]$2= + fi +]) + +dnl Conditionally build named component. +dnl $1 is component name +dnl $2 is executed if configuration passes and build is desired +AC_DEFUN([GRC_BUILD_CONDITIONAL],[ + _GRC_BUILD_CONDITIONAL($1, $2, m4_bpatsubst($1,-,_)) +]) +dnl $3=m4_bpatsubst($1,-,_) +dnl Use $passed=no to indicate configuration failure; +dnl Use $passed=with to indicate the use of pre-installed libraries and headers; +dnl Any other value of $passed, including blank, assumes success; +dnl Defines $3_with=[yes|no] depending on if $passed=with or not (respectively) +dnl Defines $3_skipped=[yes|no] depending on if $passed=no or not (respectively) +AC_DEFUN([_GRC_BUILD_CONDITIONAL],[ + $3[_with]=no + if test $passed = no; then + if test x$[enable_]$3 = xyes; then + AC_MSG_ERROR([Component $1 has errors; stopping.]) + else + AC_MSG_RESULT([Not building component $1.]) + fi + else + if test $passed = with; then + with_dirs="$with_dirs $1" + GRC_ADD_TO_LIST($3, INCLUDES, " ") + GRC_ADD_TO_LIST($3, SWIG_INCLUDES, " ") + GRC_ADD_TO_LIST($3, PYDIRPATH, ":") + GRC_ADD_TO_LIST($3, SWIGDIRPATH, ":") + GRC_ADD_TO_LIST($3, LIBDIRPATH, ":") + AC_MSG_RESULT([Component $1 will be included from a pre-installed library and includes.]) + $3[_with]=yes + else + $3[_LDFLAG]= + if test x$[enable_]$3 != xno; then + ifelse([$2], , :, [$2]) + build_dirs="$build_dirs $1" + AC_MSG_RESULT([Component $1 passed configuration checks; building.]) + else + passed=no + AC_MSG_RESULT([Component $1 passed configuration checks; but not building.]) + fi + fi + fi + if test $passed = no; then + skipped_dirs="$skipped_dirs $1" + $3[_skipped]=yes + else + $3[_skipped]=no + fi + AC_SUBST($3[_INCLUDES]) + AC_SUBST($3[_LA]) + AC_SUBST($3[_INCLUDEDIR]) + AC_SUBST($3[_LIBDIRPATH]) + AC_SUBST($3[_LDFLAG]) +]) diff --git a/usrp2/firmware/config/grc_usrp2_firmware.m4 b/usrp2/firmware/config/grc_usrp2_firmware.m4 new file mode 100644 index 00000000..6832c42f --- /dev/null +++ b/usrp2/firmware/config/grc_usrp2_firmware.m4 @@ -0,0 +1,69 @@ +dnl Copyright 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([GRC_USRP2_FIRMWARE],[ + dnl we use --enable-usrp2-firmware to enable this + GRC_ENABLE(usrp2-firmware) + + GRC_CHECK_DEPENDENCY(usrp2-firmware, usrp2) + + AC_REQUIRE([AC_PROG_CC]) + AC_REQUIRE([AC_PROG_CPP]) + AC_REQUIRE([AC_PROG_RANLIB]) + + + AC_CHECK_HEADERS(arpa/inet.h netinet/in.h byteswap.h) + AC_C_BIGENDIAN + + dnl If execution gets to here, $passed will be: + dnl with : if the --with code didn't error out + dnl yes : if the --enable code passed muster and all dependencies are met + dnl no : otherwise + if test $passed = yes; then + + dnl Only do firmware if mb-gcc can be found + AC_CHECK_PROG([MB_GCC],[mb-gcc],[yes],[no]) + if test $MB_GCC = no; then + AC_MSG_RESULT([usrp2 firmware requires mb-gcc. Not found]) + passed=no + fi + fi + if test $passed != with; then + dnl how and where to find INCLUDES and LA + dnl USRP2_INCLUDES="-I\${abs_top_srcdir}/usrp2/host/include \ + dnl -I\${abs_top_srcdir}/usrp2/firmware/include" + dnl USRP2_LA="\${abs_top_builddir}/usrp2/host/lib/libusrp2.la" + : + fi + + dnl Include the usrp2 INCLUDES and LA + dnl AC_SUBST(USRP2_INCLUDES) + dnl AC_SUBST(USRP2_LA) + + AC_CONFIG_FILES([ \ + apps/Makefile \ + include/Makefile \ + lib/Makefile \ + ]) + + dnl Slightly non-standard: we handle this with an AM_CONDITIONAL + AM_CONDITIONAL(BUILDING_USRP2_FIRMWARE, [test $passed = yes && test "$enable_usrp2_firmware" != no]) + + GRC_BUILD_CONDITIONAL(usrp2-firmware) +]) diff --git a/usrp2/firmware/config/grc_usrp2_stub.m4 b/usrp2/firmware/config/grc_usrp2_stub.m4 new file mode 100644 index 00000000..57aa86c0 --- /dev/null +++ b/usrp2/firmware/config/grc_usrp2_stub.m4 @@ -0,0 +1,23 @@ +dnl Copyright 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([GRC_USRP2_STUB],[ + GRC_ENABLE(usrp2) + GRC_BUILD_CONDITIONAL(usrp2) +]) diff --git a/usrp2/firmware/configure.ac b/usrp2/firmware/configure.ac index bbb223c0..f3ff0cd8 100644 --- a/usrp2/firmware/configure.ac +++ b/usrp2/firmware/configure.ac @@ -1,5 +1,5 @@ dnl -dnl Copyright 2007 Free Software Foundation, Inc. +dnl Copyright 2007,2008 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,26 +21,142 @@ AM_CONFIG_HEADER(config.h) AC_CONFIG_AUX_DIR([.]) AC_CONFIG_SRCDIR([lib/u2_init.c]) -AM_INIT_AUTOMAKE(u2f,0.0svn) +AM_INIT_AUTOMAKE(usrp2-firmware,0.0svn) -cross_compiling=yes +dnl Component specific configuration +dnl The order of the GR_ macros determines the order of compilation +dnl For -any- checks on $enable_all_components +dnl use the following guidelines: +dnl yes : --enable-all-components was specified, so error out if any +dnl components do not pass configuration checks. +dnl no : --disable-all-components was specified, so try to build the +dnl --enable'd components, and error out if any do not pass +dnl configuration checks. +dnl "" : this option was not specified on the command line; try to +dnl build all components that are not --with'd, but don't +dnl error out if any component does not pass configuration checks. +dnl +dnl For each --enable-foo component, if that flag is not specified on +dnl the command line, the related variable $enable_foo will be set to +dnl $enable_all_components . + +AC_ARG_ENABLE( + [all-components], + [ --enable-all-components Build all configurable components (default), or stop on failed dependencies] +) -AC_PROG_CC([mb-gcc]) -dnl AC_PROG_LD([mb-ld]) +#build_dirs="config" +build_dirs= +GRC_USRP2_STUB +GRC_USRP2_FIRMWARE -RANLIB=mb-ranlib -AC_SUBST(RANLIB) -dnl AC_PROG_RANLIB([mb-ranlib]) +# Each component is now either to be built, was skipped, will be +# included from pre-installed libraries and includes, or failed +# dependencies. +AC_SUBST([build_dirs], [$build_dirs]) +AC_SUBST([skipped_dirs], [$skipped_dirs]) +AC_SUBST([with_dirs], [$with_dirs]) -AC_CHECK_HEADERS(arpa/inet.h netinet/in.h byteswap.h) -AC_C_BIGENDIAN +# fix for older autotools that don't define "abs_top_YYY" by default +AC_SUBST(abs_top_srcdir) +AC_SUBST(abs_top_builddir) -AC_CONFIG_FILES([\ +# 'with' variables - the pre-installed libraries, includes, and paths +# - must always come last in the lists, so they require special +# treatment. +AC_SUBST(with_INCLUDES) +AC_SUBST(with_SWIG_INCLUDES) +AC_SUBST(with_PYDIRPATH) +AC_SUBST(with_SWIGDIRPATH) +AC_SUBST(with_LIBDIRPATH) + +AC_CONFIG_FILES([ \ Makefile \ - apps/Makefile \ - include/Makefile \ - lib/Makefile \ + config/Makefile \ ]) AC_OUTPUT + +# +# trim usrp2 out of dirs; we only use it as a controlling dependency +# +t= +for d in $build_dirs +do + if test $d != usrp2; then + if test -z "$t"; then + t="$d" + else + t="$t $d" + fi + fi +done +build_dirs=$t + +t= +for d in $skipped_dirs +do + if test $d != usrp2; then + if test -z "$t"; then + t="$d" + else + t="$t $d" + fi + fi +done +skipped_dirs=$t + +t= +for d in $with_dirs +do + if test $d != usrp2; then + if test -z "$t"; then + t="$d" + else + t="$t $d" + fi + fi +done +with_dirs=$t + +if test "$build_dirs" != ""; then + echo + echo "*********************************************************************" + echo The following GNU Radio components have been successfully configured: + echo + for dir in $build_dirs + do + echo $dir + done + echo + echo You my now run the 'make' command to build these components. + echo +fi + +if test "$skipped_dirs" != ""; then + echo "*********************************************************************" + echo The following components were skipped either because you asked not + echo to build them or they didn\'t pass configuration checks: + echo + for dir in $skipped_dirs + do + echo $dir + done + echo + echo These components will not be built. + echo +fi +if test "$with_dirs" != ""; then + echo "*********************************************************************" + echo The following components will be included from pre-installed + echo libraries and includes: + echo + for dir in $with_dirs + do + echo $dir + done + echo + echo These components will not be built. + echo +fi diff --git a/usrp2/firmware/configure.gnu b/usrp2/firmware/configure.gnu new file mode 100755 index 00000000..a63462a9 --- /dev/null +++ b/usrp2/firmware/configure.gnu @@ -0,0 +1,11 @@ +#!/bin/sh +# +# wrapper to setup cross-compilation of firmware +# + +for v in CC CXX AR NM RANLIB STRIP F77 CPPFLAGS LDFLAGS +do + unset $v +done + +`dirname $0`/configure "$@" --host=mb -- 2.30.2