Updated FSF address in all files. Fixes ticket:51
[debian/gnuradio] / gr-howto-write-a-block / config / usrp_sdcc.m4
1 # Check for sdcc support.                       -*- Autoconf -*-
2
3 # Copyright 2004 Free Software Foundation, Inc.
4
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2, or (at your option)
8 # any later version.
9
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 # GNU General Public License for more details.
14
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 51 Franklin Street, Boston, MA
18 # 02110-1301, USA.
19
20 AC_DEFUN([USRP_SDCC],
21 [
22         AC_CHECK_PROG(XCC, sdcc, sdcc -mmcs51 --no-xinit-opt,no)
23         AC_CHECK_PROG(XAS, asx8051, asx8051 -plosgff,no)
24
25         if test "$XCC" = "no" -o "$XAS" = "no" ; then
26                 AC_MSG_ERROR([USRP requires sdcc. sdcc not found, stop. See http://sdcc.sf.net])
27         fi
28
29         sdcc_version_min=$1
30
31         sdcc_version=`sdcc --version 2>&1 | \
32                 sed  's/\(SDCC.* \)\([[0-9]]*\.[[0-9]]*\.[[0-9]]*\)\( .*$\)/\2/'`
33
34         AC_MSG_CHECKING([sdcc_version "$sdcc_version"])
35
36         sdcc_major_version=`echo $sdcc_version | \
37                 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
38         sdcc_minor_version=`echo $sdcc_version | \
39                 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
40         sdcc_micro_version=`echo $sdcc_version | \
41                 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
42
43         sdcc_major_min=`echo $sdcc_version_min | \
44                 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
45         sdcc_minor_min=`echo $sdcc_version_min | \
46                 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
47         sdcc_micro_min=`echo $sdcc_version_min | \
48                 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
49
50         sdcc_version_proper=`expr \
51                 "$sdcc_major_version" \> "$sdcc_major_min" \| \
52                 "$sdcc_major_version" \= "$sdcc_major_min" \& \
53                 "$sdcc_minor_version" \> "$sdcc_minor_min" \| \
54                 "$sdcc_major_version" \= "$sdcc_major_min" \& \
55                 "$sdcc_minor_version" \= "$sdcc_minor_min" \& \
56                 "$sdcc_micro_version" \>= "$sdcc_micro_min" `
57
58         if test "$sdcc_version_proper" = "1" ; then
59                 AC_MSG_RESULT([$sdcc_major_version.$sdcc_minor_version.$sdcc_micro_version])
60         else
61                 AC_MSG_ERROR([USRP requires sdcc >= $sdcc_version_min. sdcc not found, stop. See http://sdcc.sf.net])
62         fi
63
64         AC_SUBST(XCC)
65         AC_SUBST(XAS)
66
67 ])