usrp2-firmware: fix missing files in tarball
[debian/gnuradio] / config / usrp_fusb_tech.m4
1 dnl
2 dnl Copyright 2003,2008,2009 Free Software Foundation, Inc.
3 dnl 
4 dnl This file is part of GNU Radio
5 dnl 
6 dnl GNU Radio is free software; you can redistribute it and/or modify
7 dnl it under the terms of the GNU General Public License as published by
8 dnl the Free Software Foundation; either version 3, or (at your option)
9 dnl any later version.
10 dnl 
11 dnl GNU Radio is distributed in the hope that it will be useful,
12 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
13 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 dnl GNU General Public License for more details.
15 dnl 
16 dnl You should have received a copy of the GNU General Public License
17 dnl along with GNU Radio; see the file COPYING.  If not, write to
18 dnl the Free Software Foundation, Inc., 51 Franklin Street,
19 dnl Boston, MA 02110-1301, USA.
20 dnl 
21
22 # $1 is $enable_usrp:
23 #   yes : do these tests
24 #   no  : do not do these tests
25 #   ""  : do these tests
26
27 AC_DEFUN([USRP_SET_FUSB_TECHNIQUE],[
28   req_libusb1=no
29   USE_LIBUSB1=0
30   AC_ARG_WITH([fusb-tech],
31               AC_HELP_STRING([--with-fusb-tech=OS],
32                              [Set fast USB technique (default=auto)]),
33               [cf_with_fusb_tech="$withval"],
34               [cf_with_fusb_tech="$host_os"])
35   if test [x]$1 != xno; then
36       case "$cf_with_fusb_tech" in
37         libusb1*)
38           FUSB_TECH=libusb1
39           req_libusb1=yes
40           USE_LIBUSB1=1
41           ;;
42         linux*)
43           AC_CHECK_HEADER([linux/usbdevice_fs.h],
44                           [x_have_usbdevice_fs_h=yes],
45                           [x_have_usbdevice_fs_h=no])
46           if test x${x_have_usbdevice_fs_h} = xyes; then
47               FUSB_TECH=linux
48           else
49               FUSB_TECH=generic
50           fi
51           ;;
52         darwin*)
53           FUSB_TECH=darwin
54           ;;
55         cygwin*|win*|mingw*)
56           FUSB_TECH=win32
57           ;;
58         *bsd*)
59           AC_MSG_CHECKING([for RA/WB])
60           AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <dev/usb/usb.h>]],
61                                              [[struct usb_bulk_ra_wb_opt o;
62                                                ioctl(0, USB_SET_BULK_RA, &o);]])],
63                             [FUSB_TECH=ra_wb],
64                             [FUSB_TECH=generic])
65           ;;
66         *)
67           FUSB_TECH=generic
68           ;;
69       esac
70
71       AC_MSG_CHECKING([for fast usb technique to use])
72       AC_MSG_RESULT($FUSB_TECH)
73       AC_SUBST(FUSB_TECH)
74   fi
75
76   AM_CONDITIONAL(FUSB_TECH_darwin,   test x$FUSB_TECH = xdarwin)
77   AM_CONDITIONAL(FUSB_TECH_win32,    test x$FUSB_TECH = xwin32)
78   AM_CONDITIONAL(FUSB_TECH_generic,  test x$FUSB_TECH = xgeneric)
79   AM_CONDITIONAL(FUSB_TECH_linux,    test x$FUSB_TECH = xlinux)
80   AM_CONDITIONAL(FUSB_TECH_libusb1,  test x$FUSB_TECH = xlibusb1)
81   AM_CONDITIONAL(FUSB_TECH_ra_wb,    test x$FUSB_TECH = xra_wb)
82
83   AC_SUBST(USE_LIBUSB1)
84   AC_CONFIG_FILES([\
85         usrp/host/include/usrp/libusb_types.h \
86   ])
87 ])