1 # Check for sdcc support. -*- Autoconf -*-
3 # Copyright 2004 Free Software Foundation, Inc.
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 3, or (at your option)
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.
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
22 AC_CHECK_PROG(XCC, sdcc, sdcc -mmcs51 --no-xinit-opt,no)
23 AC_CHECK_PROG(XAS, asx8051, asx8051 -plosgff,no)
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])
31 sdcc_version=`sdcc --version 2>&1 | \
32 sed 's/\(SDCC.* \)\([[0-9]]*\.[[0-9]]*\.[[0-9]]*\)\( .*$\)/\2/'`
34 AC_MSG_CHECKING([sdcc_version "$sdcc_version"])
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/'`
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/'`
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" `
58 if test "$sdcc_version_proper" = "1" ; then
59 AC_MSG_RESULT([$sdcc_major_version.$sdcc_minor_version.$sdcc_micro_version])
61 AC_MSG_ERROR([USRP requires sdcc >= $sdcc_version_min. sdcc not found, stop. See http://sdcc.sf.net])