switch source package format to 3.0 quilt
[debian/gnuradio] / usrp2 / firmware / config / grc_usrp2_firmware.m4
1 dnl Copyright 2008 Free Software Foundation, Inc.
2 dnl 
3 dnl This file is part of GNU Radio
4 dnl 
5 dnl GNU Radio is free software; you can redistribute it and/or modify
6 dnl it under the terms of the GNU General Public License as published by
7 dnl the Free Software Foundation; either version 3, or (at your option)
8 dnl any later version.
9 dnl 
10 dnl GNU Radio is distributed in the hope that it will be useful,
11 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
12 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 dnl GNU General Public License for more details.
14 dnl 
15 dnl You should have received a copy of the GNU General Public License
16 dnl along with GNU Radio; see the file COPYING.  If not, write to
17 dnl the Free Software Foundation, Inc., 51 Franklin Street,
18 dnl Boston, MA 02110-1301, USA.
19
20 dnl Fix 2.64 cross compile detection for AVR and RTEMS
21 dnl by not trying to compile fopen.
22 m4_if(m4_defn([m4_PACKAGE_VERSION]), [2.64],
23   [m4_foreach([_GCC_LANG], [C, C++, Fortran, Fortran 77],
24      [m4_define([_AC_LANG_IO_PROGRAM(]_GCC_LANG[)], m4_defn([AC_LANG_PROGRAM(]_GCC_LANG[)]))])]) 
25
26 AC_DEFUN([GRC_USRP2_FIRMWARE],[
27     dnl we use  --enable-usrp2-firmware to enable this
28     GRC_ENABLE(usrp2-firmware)
29
30     GRC_CHECK_DEPENDENCY(usrp2-firmware, usrp2)
31
32     AC_REQUIRE([AC_PROG_CC])
33     AC_REQUIRE([AC_PROG_CPP])
34     AC_REQUIRE([AM_PROG_AS])
35     AC_REQUIRE([AC_PROG_RANLIB])
36
37
38     AC_CHECK_HEADERS(arpa/inet.h netinet/in.h byteswap.h)
39     AC_C_BIGENDIAN
40
41     dnl If execution gets to here, $passed will be:
42     dnl   with : if the --with code didn't error out
43     dnl   yes  : if the --enable code passed muster and all dependencies are met
44     dnl   no   : otherwise
45     if test $passed = yes; then
46
47         dnl Only do firmware if mb-gcc can be found
48         AC_CHECK_PROG([MB_GCC],[mb-gcc],[yes],[no])
49         if test $MB_GCC = no; then
50             AC_MSG_RESULT([usrp2 firmware requires mb-gcc.  Not found])
51             passed=no
52         fi
53     fi
54     if test $passed != with; then
55         dnl how and where to find INCLUDES and LA
56         dnl USRP2_INCLUDES="-I\${abs_top_srcdir}/usrp2/host/include \
57         dnl     -I\${abs_top_srcdir}/usrp2/firmware/include"
58         dnl USRP2_LA="\${abs_top_builddir}/usrp2/host/lib/libusrp2.la"
59         :
60     fi
61
62     dnl Include the usrp2 INCLUDES and LA
63     dnl AC_SUBST(USRP2_INCLUDES)
64     dnl AC_SUBST(USRP2_LA)
65
66     AC_CONFIG_FILES([ \
67         apps/Makefile \
68         include/Makefile \
69         lib/Makefile \
70     ])
71
72     dnl Slightly non-standard:  we handle this with an AM_CONDITIONAL
73     AM_CONDITIONAL(BUILDING_USRP2_FIRMWARE, [test $passed = yes && test "$enable_usrp2_firmware" != no])
74
75     GRC_BUILD_CONDITIONAL(usrp2-firmware)
76 ])