Merged r7478:7608 from michaelld/t186 into trunk. Adds ability to compile GNU Radio...
[debian/gnuradio] / config / grc_usrp.m4
1 dnl Copyright 2001,2002,2003,2004,2005,2006,2007,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 AC_DEFUN([GRC_USRP],[
21     GRC_ENABLE([usrp])
22     GRC_WITH([usrp])
23     passed=no
24     if test x$with_usrp = xyes; then
25         if test x$enable_usrp = xyes; then
26             AC_MSG_ERROR([Component usrp: Cannot use both --enable and --with])
27         else
28             # the following is required, for whatever reason; ignore the output
29             USRP_SET_FUSB_TECHNIQUE([],[passed=no;AC_MSG_RESULT([Unable to set fast USB technique.])])
30             passed=no
31             # on to the regular routine
32             PKG_CHECK_MODULES(USRP, usrp, passed=with,
33                     AC_MSG_RESULT([Component usrp: PKGCONFIG cannot find info]))
34             if test x$passed = xwith; then
35                 usrp_INCLUDES=`$PKG_CONFIG --cflags-only-I usrp`
36                 usrp_LA=$USRP_LIBS
37                 passed=no
38                 PKG_CHECK_MODULES(USRP_INBAND, usrp-inband, passed=with,
39                     AC_MSG_RESULT([Component usrp-inband: PKGCONFIG cannot find info]))
40                 if test x$passed = xwith; then
41                     usrp_inband_INCLUDES=`$PKG_CONFIG --cflags-only-I usrp-inband`
42                     usrp_inband_LA=$USRP_INBAND_LIBS
43                 fi
44             fi
45         fi
46     fi
47     dnl if $passed = with, then "--with" worked; ignore the "--enable" stuff
48     dnl otherwise, $passed = no; check the "--enable" stuff
49     if test x$passed = xno; then
50         AC_CONFIG_FILES([ \
51             usrp/Makefile \
52             usrp/usrp.pc \
53             usrp/usrp-inband.pc \
54             usrp/usrp.iss \
55             usrp/doc/Doxyfile \
56             usrp/doc/Makefile \
57             usrp/doc/other/Makefile \
58             usrp/host/Makefile \
59             usrp/host/misc/Makefile \
60             usrp/host/lib/Makefile \
61             usrp/host/lib/inband/Makefile \
62             usrp/host/lib/legacy/Makefile \
63             usrp/host/lib/legacy/std_paths.h \
64             usrp/host/swig/Makefile \
65             usrp/host/apps/Makefile \
66             usrp/host/apps-inband/Makefile \
67             usrp/firmware/Makefile \
68             usrp/firmware/include/Makefile \
69             usrp/firmware/lib/Makefile \
70             usrp/firmware/src/Makefile \
71             usrp/firmware/src/common/Makefile \
72             usrp/firmware/src/usrp2/Makefile \
73             usrp/fpga/Makefile \
74             usrp/fpga/rbf/Makefile \
75         ])
76
77         # gnulib.
78         # FIXME: this needs to fail gracefully and continue, not implemented yet
79         UTILS_FUNC_MKSTEMP
80
81         # These checks don't fail
82         AC_C_BIGENDIAN
83         AC_CHECK_HEADERS([byteswap.h linux/compiler.h])
84         AC_CHECK_FUNCS([getrusage sched_setscheduler pthread_setschedparam])
85         AC_CHECK_FUNCS([sigaction snprintf])
86
87         # There are 2 pkg-config files; the one for usrp requires omnithread
88         # for Darwin only.
89         case "$host_os" in
90             darwin*)
91                 # for usrp.pc.in
92                 usrp_darwin_omnithread_pc_requires="gnuradio-omnithread"
93                 usrp_darwin_omnithread_pc_la="-lgromnithread"
94                 ;;
95             *)
96                 # for usrp.pc.in (blanks)
97                 usrp_darwin_omnithread_pc_requires=""
98                 usrp_darwin_omnithread_pc_la=""
99                 ;;
100         esac
101         passed=yes
102         # Don't do usrp if omnithread, mblock, or pmt skipped
103         if test x$omnithread_skipped = xyes; then
104              AC_MSG_RESULT([Component usrp requires omnithread, which is not being built or specified via pre-installed files.])
105             passed=no
106         fi
107         if test x$mblock_skipped = xyes; then
108             AC_MSG_RESULT([Component usrp requires mblock, which is not being built or specified via pre-installed files.])
109             passed=no
110         fi
111         if test x$pmt_skipped = xyes; then
112             AC_MSG_RESULT([Component usrp requires pmt, which is not being built or specified via pre-installed files.])
113             passed=no
114         fi
115         # Don't do mblock if guile not available (inband requires it)
116         AC_PATH_PROG(GUILE,guile)
117         if test "$GUILE" = "" ; then
118             AC_MSG_RESULT([Component mblock requires guile, which was not found.])
119             passed=no
120         fi
121         USRP_LIBUSB([],[passed=no;AC_MSG_RESULT([Unable to configure USB dependency.])])
122         USRP_SET_FUSB_TECHNIQUE([],[passed=no;AC_MSG_RESULT([Unable to set fast USB technique.])])
123         USRP_SDCC([2.4.0],[],[passed=no;AC_MSG_RESULT([Unable to find firmware compiler.])])
124
125         usrp_INCLUDES="-I\${abs_top_srcdir}/usrp/host/lib/legacy \
126                 -I\${abs_top_srcdir}/usrp/firmware/include"
127         usrp_LA="\${abs_top_builddir}/usrp/host/lib/legacy/libusrp.la"
128         usrp_inband_INCLUDES="-I\${abs_top_srcdir}/usrp/host/lib/inband"
129         usrp_inband_LA="\${abs_top_builddir}/usrp/host/lib/inband/libusrp_inband.la"
130     fi
131
132     GRC_BUILD_CONDITIONAL([usrp])
133
134     AC_SUBST(usrp_INCLUDES)
135     AC_SUBST(usrp_LA)
136     AC_SUBST(usrp_inband_INCLUDES)
137     AC_SUBST(usrp_inband_LA)
138     AC_SUBST(usrp_darwin_omnithread_pc_requires)
139     AC_SUBST(usrp_darwin_omnithread_pc_la)
140 ])