OSDN Git Service

Prepare for ADFE-FlashWriter 1.0.4
[pf3gnuchains/urjtag.git] / jtag / configure.ac
1 #
2 # $Id$
3 #
4 # Copyright (C) 2007, 2008 Kolja Waschk and other
5 #    UrJTAG.org developers, (C) 2002, 2003 ETC s.r.o.
6 #
7 # This program is free software; you can redistribute it and/or
8 # modify it under the terms of the GNU General Public License
9 # as published by the Free Software Foundation; either version 2
10 # of the License, or (at your option) any later version.
11 #
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 # GNU General Public License for more details.
16 #
17 # You should have received a copy of the GNU General Public License
18 # along with this program; if not, write to the Free Software
19 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
20 # 02111-1307, USA.
21 #
22 # Written by Marcel Telka <marcel@telka.sk>, 2002, 2003,
23 #  and other UrJTAG authors, 2007, 2008, ...
24 #
25
26 AC_INIT(UrJTAG,0.10,http://urjtag.org,urjtag)
27
28 AC_PREREQ(2.54)
29 AC_COPYRIGHT([Copyright (C) 2007/08 Kolja Waschk and other UrJTAG authors; 2002/03 ETC s.r.o.])
30 AC_REVISION($Revision$)
31
32 # Get SVN Revision - idea from xfce-power-manager (C) 2007 by B.Tarricone
33 dnl get svn revision
34 AC_MSG_CHECKING([code revision])
35 SVN=`which svn`
36 SVN_REVISION=0
37 if test -n "$SVN" -a -x "$SVN"; then
38     SVN_REVISION=`LC_ALL=C svn info -R "$srcdir" | awk 'BEGIN { x=0 } /^Revision: / { if($2>x) x=$2; } END { printf "%d\n",x }'`
39     if test "$SVN_REVISION" -ne "0" ; then
40         AC_MSG_RESULT([from svn info: $SVN_REVISION])
41     fi
42 fi
43 if test "$SVN_REVISION" -eq 0 -a -e "$srcdir/ChangeLog"; then
44     SVN_REVISION=`awk 'BEGIN { x=0 } /Revision: / { if($2>x) x=$2; } END { printf "%d\n",x }' "$srcdir/ChangeLog"`
45     if test "$SVN_REVISION" -ne "0" ; then
46         AC_MSG_RESULT([from ChangeLog: $SVN_REVISION])
47     fi
48 fi
49 if test "$SVN_REVISION" -eq "0" ; then
50     AC_MSG_RESULT([unknown, using 0])
51 fi
52 AC_DEFINE_UNQUOTED([SVN_REVISION], "$SVN_REVISION", [subversion revision number])
53 AC_SUBST([SVN_REVISION])
54
55 AC_CONFIG_AUX_DIR(tools)
56
57 AM_INIT_AUTOMAKE([check-news dist-bzip2])
58
59 AC_CONFIG_FILES(
60         Makefile
61         doc/Makefile
62         data/Makefile
63         include/Makefile
64         src/Makefile
65         src/lib/Makefile
66         src/tap/Makefile
67         src/part/Makefile
68         src/bus/Makefile
69         src/flash/Makefile
70         src/cmd/Makefile
71         src/svf/Makefile
72         src/bsdl/Makefile
73         src/jim/Makefile
74         po/Makefile.in
75 )
76
77 AM_MAINTAINER_MODE
78
79 AM_CONFIG_HEADER(config.h)
80
81 AC_GNU_SOURCE
82
83 AM_GNU_GETTEXT(external)
84 AM_GNU_GETTEXT_VERSION(0.14.1)
85
86 AC_PROG_CC
87 AC_PROG_RANLIB
88 AC_PROG_YACC
89
90
91 AC_SEARCH_LIBS([ioperm], [ioperm])
92 if test "$ac_cv_search_ioperm" != "no"; then
93         AC_DEFINE(HAVE_IOPERM, 1, [Define to 1 if you have the ioperm() function])
94         HAVE_IOPERM="yes"
95 else
96         AC_SEARCH_LIBS([i386_set_ioperm], [i386])
97         if test "$ac_cv_search_i386_set_ioperm" != "no"; then
98                 AC_DEFINE(HAVE_I386_SET_IOPERM, 1,
99                         [Define to 1 if you have the i386_set_ioperm() function])
100                 HAVE_I386_SET_IOPERM="yes"
101         fi
102 fi
103
104 AC_CHECK_FUNCS(getline getdelim)
105 AC_CHECK_FUNCS(swprintf)
106
107 AC_CHECK_FUNC(clock_gettime, [], [ AC_CHECK_LIB(rt, clock_gettime) ])
108
109 AC_CHECK_HEADERS([linux/ppdev.h], [HAVE_LINUX_PPDEV_H="yes"])
110 AC_CHECK_HEADERS([dev/ppbus/ppi.h], [HAVE_DEV_PPBUS_PPI_H="yes"])
111 AC_CHECK_HEADERS(stropts.h)
112 AC_CHECK_HEADERS(wchar.h)
113
114 VL_LIB_READLINE
115
116
117 dnl check for libusb-config
118
119 AC_ARG_WITH([libusb],
120   [AS_HELP_STRING([--with-libusb],
121     [use libusb for some USB JTAG cables])],,
122     [with_libusb=check])
123
124 AS_IF([test "x$with_libusb" != xno], [
125   save_LIBS=$LIBS
126   save_CPPFLAGS=$CPPFLAGS
127   AS_IF([test "x$with_libusb" != xyes -a "x$with_libusb" != xcheck], [
128     case $host in
129     *cygwin*)
130       USBLIBS="-L$with_libusb/lib/gcc -lusb"
131       USBCFLAGS="-I$with_libusb/include"
132       ;;
133     *)
134       USBLIBS="-Lwith_libusb -lusb"
135       USBCFLAGS="-I$with_libusb"
136       ;;
137     esac
138   ],[
139     AC_PATH_TOOL(LIBUSB_CONFIG, libusb-config, no) 
140     AS_IF([test "$LIBUSB_CONFIG" != "no"],[
141       USBLIBS=`$LIBUSB_CONFIG --libs`
142       USBCFLAGS=`$LIBUSB_CONFIG --cflags`
143     ],)
144   ])
145   LIBS="$LIBS $USBLIBS"
146   CPPFLAGS="$CPPFLAGS $USBCFLAGS"
147   AC_CHECK_FUNC([usb_find_devices], [
148     AC_DEFINE(HAVE_LIBUSB, 1, [Define if you have libusb])
149     HAVELIBUSB=yes
150   ],[
151     AC_MSG_WARN([*** libusb not detected. No support for USB JTAG cables via libusb.])
152     LIBS=$save_LIBS
153     CPPFLAGS=$save_CPPFLAGS
154   ])
155 ],)
156
157 AS_IF([test "x$HAVELIBUSB" = "xyes"],[
158   AM_CONDITIONAL(HAVE_LIBUSB, true)
159 ],[
160   AM_CONDITIONAL(HAVE_LIBUSB, false)
161 ])
162
163
164 dnl Use FTDI library?
165
166 AC_ARG_WITH([libftdi],
167   [AS_HELP_STRING([--with-libftdi],
168     [use libftdi for FTDI-based cables])],
169     [], [with_libftdi=check])
170
171 AS_IF([test "x$with_libftdi" != xno], [
172   save_LIBS=$LIBS
173   save_CPPFLAGS=$CPPFLAGS
174   AS_IF([test "x$with_libftdi" != xyes -a "x$with_libftdi" != xcheck], [
175     FTDILIBS="-L$with_libftdi -lftdi"
176     FTDICFLAGS="-I$with_libftdi"
177   ],[
178     AC_PATH_TOOL(LIBFTDI_CONFIG, libftdi-config, no) 
179     AS_IF([test "$LIBFTDI_CONFIG" != "no"],[
180       FTDILIBS=`$LIBFTDI_CONFIG --libs`
181       FTDICFLAGS=`$LIBFTDI_CONFIG --cflags`
182     ],)
183   ])
184   LIBS="$FTDILIBS $LIBS"
185   CPPFLAGS="$CPPFLAGS $FTDICFLAGS"
186   AC_CHECK_FUNC([ftdi_usb_open], [
187     AC_DEFINE(HAVE_LIBFTDI, 1, [Define if you have libftdi])
188     HAVELIBFTDI=yes
189   ],[
190     AC_MSG_WARN([*** libftdi not detected. No support for FTDI-based USB JTAG cables via libftdi.])
191     LIBS=$save_LIBS
192     CPPFLAGS=$save_CPPFLAGS
193   ])
194 ],)
195
196 AS_IF([test "x$HAVELIBFTDI" = "xyes"],[
197   AM_CONDITIONAL(HAVE_LIBFTDI, true)
198 ],[
199   AM_CONDITIONAL(HAVE_LIBFTDI, false)
200 ])
201
202
203 dnl Use FTDI ftd2xx library?
204
205 AC_ARG_WITH([ftd2xx],
206   [AS_HELP_STRING([--with-ftd2xx],
207     [use ftd2xx library for FTDI-based cables])],
208     [], [with_ftd2xx=check])
209
210 FTD2XXLIB=
211 AS_IF([test "x$with_ftd2xx" = xyes -o "x$with_ftd2xx" = xcheck], [
212   AC_CHECK_LIB([ftd2xx], [FT_OpenEx], [
213     HAVELIBFTD2XX=yes
214     LIBS="-lftd2xx $LIBS"
215   ],[
216     AC_MSG_WARN([*** libftd2xx not found. No support for FTDI-based USB JTAG cables via libftd2xx.])
217   ])
218 ],[
219   AS_IF([test "x$with_ftd2xx" != xno], [
220     HAVELIBFTD2XX=yes
221     case $host in
222     *cygwin*|*mingw*)
223       CFLAGS="$CFLAGS -I$with_ftd2xx"
224       AS_IF([test -d "$with_ftd2xx/i386"], [
225         FTD2XXLIB="$with_ftd2xx/i386/ftd2xx.lib"
226       ],[
227         FTD2XXLIB="$with_ftd2xx/ftd2xx.lib"
228       ])
229       ;;
230     *)
231       CFLAGS="$CFLAGS -I$with_ftd2xx -L$with_ftd2xx"
232       LIBS="-lftd2xx $LIBS"
233       ;;
234     esac
235   ],)
236 ])
237 AS_IF([test "x$HAVELIBFTD2XX" = xyes], [
238   AM_CONDITIONAL(HAVE_LIBFTD2XX, true)
239   AC_DEFINE(HAVE_LIBFTD2XX, 1, [define if you have libftd2xx])
240 ],[
241   AM_CONDITIONAL(HAVE_LIBFTD2XX, false)
242 ])
243 AC_SUBST(FTD2XXLIB)
244
245
246 dnl Use InpOut I/O library?
247 dnl http://www.highrez.co.uk/Downloads/InpOut32/default.htm
248
249 AC_ARG_WITH([inpout32],
250   [AS_HELP_STRING([--with-inpout32],
251     [use InpOut32.dll for parallel port access on Windows])],
252     [], [with_inpout32=no])
253
254 case $host in
255   *cygwin*|*mingw*) ;;
256   *) with_inpout32=no ;;
257 esac
258
259 AS_IF([test "x$with_inpout32" = xyes], [
260   AM_CONDITIONAL(HAVE_INPOUTXX, true)
261   AC_DEFINE(HAVE_INPOUTXX, 1, [define if you have inpout32.dll])
262 ],[
263   AM_CONDITIONAL(HAVE_INPOUTXX, false)
264 ])
265
266
267 CFLAGS="$CFLAGS -Wall"
268 CPPFLAGS="-I\$(top_srcdir) -I\$(top_srcdir)/include $CPPFLAGS"
269
270
271 # check for lex/flex
272 AC_PROG_LEX
273 # check for modern version of flex
274 AC_PROG_AWK
275 AC_PROG_SED
276
277 AS_IF([test "$LEX" = flex], [
278    ver_ge_ver () {
279       v1=$1
280       v2=$2
281       v3=$3
282       ref_v1=$4
283       ref_v2=$5
284       ref_v3=$6
285
286       AS_IF([test -n "$v1" -a "$v1" -gt "$ref_v1"], [
287          return 0
288       ])
289       AS_IF([test -n "$v1" -a "$v1" -eq "$ref_v1"], [
290          AS_IF([test "$v2" -gt "$ref_v2"], [
291             return 0
292          ])
293          AS_IF([test "$v2" -eq "$ref_v2"], [
294             AS_IF([test "$v3" -ge "$ref_v3"], [
295                return 0
296             ])
297          ])
298       ])
299
300       return 1
301    }
302
303    flex_version=`$LEX --version | $AWK '{print $2}'`
304    AS_IF([test "$flex_version" = "version"], [
305        flex_version=`$LEX --version | $AWK '{print $3}'`
306    ])
307
308    flex_v1=`echo $flex_version | $AWK -F . '{print $1}' | $SED -e 's/[a-zA-Z]//g'`
309    flex_v2=`echo $flex_version | $AWK -F . '{print $2}' | $SED -e 's/[a-zA-Z]//g'`
310    flex_v3=`echo $flex_version | $AWK -F . '{print $3}' | $SED -e 's/[a-zA-Z]//g'`
311
312    # svf and bsdl lexer require flex >= 2.5.33
313    flex_ref_v1=2
314    flex_ref_v2=5
315    flex_ref_v3=33
316    flex_ref_version="$flex_ref_v1.$flex_ref_v2.$flex_ref_v3"
317    AC_MSG_CHECKING([for flex >= $flex_ref_version, required for SVF and BSDL lexer])
318    #
319    AS_IF([ver_ge_ver $flex_v1 $flex_v2 $flex_v3 $flex_ref_v1 $flex_ref_v2 $flex_ref_v3], [
320       AC_MSG_RESULT([yes - flex $flex_version])
321       svf_lexer=true
322       bsdl_lexer=true
323    ], [
324       AC_MSG_RESULT([no - flex $flex_version])
325       svf_lexer=false
326       bsdl_lexer=false
327    ])
328 ], [
329    svf_lexer=false
330    bsdl_lexer=false
331 ])
332
333
334 dnl If the transformed svf_flex.c is already existing, it doesn't matter
335 dnl that flex is too old for building the lexer.
336 AS_IF([test "x$svf_lexer" = xfalse], [
337    AS_IF([test -r src/svf/svf_bison.h], [
338       svf_lexer=true
339    ])
340 ])
341
342 dnl Enable SVF player?
343 AC_ARG_ENABLE(svf,
344 [AS_HELP_STRING([--disable-svf], [Disable SVF player])],
345 [case "${enableval}" in
346    yes) svf=true ;;
347    no)  svf=false ;;
348    *)   AC_MSG_ERROR(bad value ${enableval} for --enable-svf) ;;
349  esac],
350 [svf=$svf_lexer])
351 AS_IF([test "x$svf" = xtrue], [
352   AM_CONDITIONAL(ENABLE_SVF, true)
353   AC_DEFINE(ENABLE_SVF, 1, [define if SVF player is enabled])
354 ],[
355   AM_CONDITIONAL(ENABLE_SVF, false)
356
357   # SVF is disabled, but the generated files are still required for
358   # POTFILES. They simply have to exist as empty files.
359   AS_IF([test ! -r src/svf/svf_flex.c], [
360     touch src/svf/svf_flex.c
361   ])
362   AS_IF([test ! -r src/svf/svf_bison.c], [
363     touch src/svf/svf_bison.c
364   ])
365 ])
366
367
368 dnl If the transformed bsdl_flex.c is already existing, it doesn't matter
369 dnl that flex is too old for building the lexer.
370 AS_IF([test "x$bsdl_lexer" = xfalse], [
371    AS_IF([test -r src/bsdl/bsdl_bison.h], [
372       bsdl_lexer=true
373    ])
374 ])
375
376 dnl Enable BSDL subsystem?
377 AC_ARG_ENABLE(bsdl,
378 [AS_HELP_STRING([--disable-bsdl], [Disable BSDL subsystem])],
379 [case "${enableval}" in
380    yes) bsdl=true ;;
381    no)  bsdl=false ;;
382    *)   AC_MSG_ERROR(bad value ${enableval} for --enable-bsdl) ;;
383  esac],
384 [bsdl=$bsdl_lexer])
385 AS_IF([test "x$bsdl" = xtrue], [
386   AM_CONDITIONAL(ENABLE_BSDL, true)
387   AC_DEFINE(ENABLE_BSDL, 1, [define if BSDL subsystem is enabled])
388 ],[
389   AM_CONDITIONAL(ENABLE_BSDL, false)
390
391   # BSDL is disabled, but the generated files are still required for
392   # POTFILES. They simply have to exist as empty files.
393   AS_IF([test ! -r src/bsdl/vhdl_flex.c], [
394     touch src/bsdl/vhdl_flex.c
395   ])
396   AS_IF([test ! -r src/bsdl/vhdl_bison.c], [
397     touch src/bsdl/vhdl_bison.c
398   ])
399   AS_IF([test ! -r src/bsdl/bsdl_flex.c], [
400     touch src/bsdl/bsdl_flex.c
401   ])
402   AS_IF([test ! -r src/bsdl/bsdl_bison.c], [
403     touch src/bsdl/bsdl_bison.c
404   ])
405 ])
406
407 dnl Enable experimental brute-force JEDEC flash autodetection?
408 AC_ARG_ENABLE(jedec-exp,
409 [AS_HELP_STRING([--enable-jedec-exp], [Enable experimental JEDEC flash detection])],
410 [case "${enableval}" in
411    yes) jedecexp=true ;;
412    no)  jedecexp=false ;;
413    *)   AC_MSG_ERROR(bad value ${enableval} for --enable-jedec-exp) ;;
414  esac],
415 [jedecexp=false])
416 AS_IF([test "x$jedecexp" = xtrue], [
417   AM_CONDITIONAL(JEDEC_EXP, true)
418   AC_DEFINE(JEDEC_EXP, 1, [define if experimental JEDEC flash detection is enabled])
419 ],[
420   AM_CONDITIONAL(JEDEC_EXP, false)
421 ])
422
423
424 # Macro for driver include check
425 AC_DEFUN([CHECK_DRIVER], [
426     AS_IF([echo "$1" | $GREP -q $3], [
427        AC_DEFINE([$4], 1, [define if $3 is enabled])
428        AM_CONDITIONAL([$4], true)
429        $2="${$2}$3 "
430     ], [
431        AM_CONDITIONAL([$4], false)
432     ])
433 ])
434
435
436 # Enable bus drivers
437 AC_DEFUN([DEF_ENABLE_BUSDRIVERS], [\
438 au1500 avr32 bcm1250 bf526_ezkit bf527_ezkit bf533_stamp bf533_ezkit bf537_stamp bf537_ezkit bf538f_ezkit bf548_ezkit bf561_ezkit bscoach ejtag ejtag_dma\
439 fjmem ixp425 jopcyc h7202 lh7a400  mpc5200 mpc824x ppc405ep ppc440gx_ebc8 prototype pxa2x0 pxa27x \
440 s3c4510 sa1110 sh7727 sh7750r sh7751r sharc_21065L sharc_21369_ezkit slsup3 tx4925 zefant_xs3])
441 AC_ARG_ENABLE(bus,
442 [AS_HELP_STRING([--enable-bus], [Enable default set or specific bus drivers:])]
443 [AS_HELP_STRING([],             ['default' enables:])]
444 [AS_HELP_STRING([],DEF_ENABLE_BUSDRIVERS)]
445 ,
446 [AS_CASE([${enableval}],
447     [yes],  [busdrivers=default],
448     [no],   [busdrivers=none],
449     [none], [busdrivers=none],
450             [busdrivers=`echo ${enableval} | $SED -e 's/,/ /g'`])],
451 [busdrivers=default])
452 # expand 'default' to default enabled busdrivers
453 busdrivers=`echo ${busdrivers} | $SED -e "s/default/DEF_ENABLE_BUSDRIVERS/"`
454 #
455 enabled_bus_drivers=''
456 CHECK_DRIVER([$busdrivers], [enabled_bus_drivers], [au1500],        [ENABLE_BUS_AU1500])
457 CHECK_DRIVER([$busdrivers], [enabled_bus_drivers], [avr32],         [ENABLE_BUS_AVR32])
458 CHECK_DRIVER([$busdrivers], [enabled_bus_drivers], [bcm1250],       [ENABLE_BUS_BCM1250])
459 CHECK_DRIVER([$busdrivers], [enabled_bus_drivers], [bf526_ezkit],   [ENABLE_BUS_BF526_EZKIT])
460 CHECK_DRIVER([$busdrivers], [enabled_bus_drivers], [bf527_ezkit],   [ENABLE_BUS_BF527_EZKIT])
461 CHECK_DRIVER([$busdrivers], [enabled_bus_drivers], [bf533_stamp],   [ENABLE_BUS_BF533_STAMP])
462 CHECK_DRIVER([$busdrivers], [enabled_bus_drivers], [bf533_ezkit],   [ENABLE_BUS_BF533_EZKIT])
463 CHECK_DRIVER([$busdrivers], [enabled_bus_drivers], [bf537_stamp],   [ENABLE_BUS_BF537_STAMP])
464 CHECK_DRIVER([$busdrivers], [enabled_bus_drivers], [bf537_ezkit],   [ENABLE_BUS_BF537_EZKIT])
465 CHECK_DRIVER([$busdrivers], [enabled_bus_drivers], [bf538f_ezkit],   [ENABLE_BUS_BF538F_EZKIT])
466 CHECK_DRIVER([$busdrivers], [enabled_bus_drivers], [bf548_ezkit],   [ENABLE_BUS_BF548_EZKIT])
467 CHECK_DRIVER([$busdrivers], [enabled_bus_drivers], [bf561_ezkit],   [ENABLE_BUS_BF561_EZKIT])
468 CHECK_DRIVER([$busdrivers], [enabled_bus_drivers], [bscoach],       [ENABLE_BUS_BSCOACH])
469 CHECK_DRIVER([$busdrivers], [enabled_bus_drivers], [ejtag],         [ENABLE_BUS_EJTAG])
470 CHECK_DRIVER([$busdrivers], [enabled_bus_drivers], [ejtag_dma],     [ENABLE_BUS_EJTAG_DMA])
471 CHECK_DRIVER([$busdrivers], [enabled_bus_drivers], [fjmem],         [ENABLE_BUS_FJMEM])
472 CHECK_DRIVER([$busdrivers], [enabled_bus_drivers], [ixp425],        [ENABLE_BUS_IXP425])
473 CHECK_DRIVER([$busdrivers], [enabled_bus_drivers], [jopcyc],        [ENABLE_BUS_JOPCYC])
474 CHECK_DRIVER([$busdrivers], [enabled_bus_drivers], [h7202],         [ENABLE_BUS_H7202])
475 CHECK_DRIVER([$busdrivers], [enabled_bus_drivers], [lh7a400],       [ENABLE_BUS_LH7A400])
476 CHECK_DRIVER([$busdrivers], [enabled_bus_drivers], [mpc5200],       [ENABLE_BUS_MPC5200])
477 CHECK_DRIVER([$busdrivers], [enabled_bus_drivers], [mpc824x],       [ENABLE_BUS_MPC824X])
478 CHECK_DRIVER([$busdrivers], [enabled_bus_drivers], [ppc405ep],      [ENABLE_BUS_PPC405EP])
479 CHECK_DRIVER([$busdrivers], [enabled_bus_drivers], [ppc440gx_ebc8], [ENABLE_BUS_PPC440GX_EBC8])
480 CHECK_DRIVER([$busdrivers], [enabled_bus_drivers], [prototype],     [ENABLE_BUS_PROTOTYPE])
481 CHECK_DRIVER([$busdrivers], [enabled_bus_drivers], [pxa2x0],        [ENABLE_BUS_PXA2X0])
482 CHECK_DRIVER([$busdrivers], [enabled_bus_drivers], [pxa27x],        [ENABLE_BUS_PXA27X])
483 CHECK_DRIVER([$busdrivers], [enabled_bus_drivers], [s3c4510],       [ENABLE_BUS_S3C4510])
484 CHECK_DRIVER([$busdrivers], [enabled_bus_drivers], [sa1110],        [ENABLE_BUS_SA1110])
485 CHECK_DRIVER([$busdrivers], [enabled_bus_drivers], [sh7727],        [ENABLE_BUS_SH7727])
486 CHECK_DRIVER([$busdrivers], [enabled_bus_drivers], [sh7750r],       [ENABLE_BUS_SH7750R])
487 CHECK_DRIVER([$busdrivers], [enabled_bus_drivers], [sh7751r],       [ENABLE_BUS_SH7751R])
488 CHECK_DRIVER([$busdrivers], [enabled_bus_drivers], [sharc_21065L],  [ENABLE_BUS_SHARC_21065L])
489 CHECK_DRIVER([$busdrivers], [enabled_bus_drivers], [sharc_21369_ezkit],  [ENABLE_BUS_SHARC_21369_EZKIT])
490 CHECK_DRIVER([$busdrivers], [enabled_bus_drivers], [slsup3],        [ENABLE_BUS_SLSUP3])
491 CHECK_DRIVER([$busdrivers], [enabled_bus_drivers], [tx4925],        [ENABLE_BUS_TX4925])
492 CHECK_DRIVER([$busdrivers], [enabled_bus_drivers], [zefant_xs3],    [ENABLE_BUS_ZEFANT_XS3])
493
494 # Enable cable drivers
495 AC_DEFUN([DEF_ENABLE_CABLEDRIVERS], [\
496 arcom byteblaster dlc5 ea253 ei012 ft2232 igloo jlink keithkoep lattice mpcbdm triton usbblaster wiggler xpc])
497 AC_DEFUN([DEF_DISABLE_CABLEDRIVERS], [ep9307 jim ts7800])
498 AC_ARG_ENABLE(cable,
499 [AS_HELP_STRING([--enable-cable], [Enable default set or specific cable drivers.])]
500 [AS_HELP_STRING([],               ['default' enables:])]
501 [AS_HELP_STRING([],DEF_ENABLE_CABLEDRIVERS)]
502 [AS_HELP_STRING([],               [Disabled by default are:])]
503 [AS_HELP_STRING([],DEF_DISABLE_CABLEDRIVERS)]
504 ,
505 [AS_CASE([${enableval}],
506     [yes],  [cabledrivers=default],
507     [no],   [cabledrivers=none],
508     [none], [cabledrivers=none],
509             [cabledrivers=`echo ${enableval} | $SED -e 's/,/ /g'`])],
510 [cabledrivers=default])
511 # expand 'default' to default enabled cabledrivers
512 cabledrivers=`echo ${cabledrivers} | $SED -e "s/default/DEF_ENABLE_CABLEDRIVERS/"`
513 # automatically disable cable drivers when a required feature is not available
514 AS_IF([test "x$HAVELIBFTDI" != "xyes" -a "x$HAVELIBFTD2XX" != "xyes"], [
515     cabledrivers=`echo ${cabledrivers} | $SED -e "s/ft2232//" -e "s/usbblaster//"`
516 ])
517 AS_IF([test "x$HAVELIBUSB" != "xyes"], [
518     cabledrivers=`echo ${cabledrivers} | $SED -e "s/jlink//" -e "s/xpc//"`
519 ])
520 #
521 enabled_cable_drivers=''
522 CHECK_DRIVER([$cabledrivers], [enabled_cable_drivers], [arcom],       [ENABLE_CABLE_ARCOM])
523 CHECK_DRIVER([$cabledrivers], [enabled_cable_drivers], [byteblaster], [ENABLE_CABLE_BYTEBLASTER])
524 CHECK_DRIVER([$cabledrivers], [enabled_cable_drivers], [dlc5],        [ENABLE_CABLE_DLC5])
525 CHECK_DRIVER([$cabledrivers], [enabled_cable_drivers], [ea253],       [ENABLE_CABLE_EA253])
526 CHECK_DRIVER([$cabledrivers], [enabled_cable_drivers], [ei012],       [ENABLE_CABLE_EI012])
527 CHECK_DRIVER([$cabledrivers], [enabled_cable_drivers], [ep9307],      [ENABLE_CABLE_EP9307])
528 CHECK_DRIVER([$cabledrivers], [enabled_cable_drivers], [ft2232],      [ENABLE_CABLE_FT2232])
529 CHECK_DRIVER([$cabledrivers], [enabled_cable_drivers], [igloo],       [ENABLE_CABLE_IGLOO])
530 CHECK_DRIVER([$cabledrivers], [enabled_cable_drivers], [jim],         [ENABLE_JIM])
531 CHECK_DRIVER([$cabledrivers], [enabled_cable_drivers], [jlink],       [ENABLE_CABLE_JLINK])
532 CHECK_DRIVER([$cabledrivers], [enabled_cable_drivers], [keithkoep],   [ENABLE_CABLE_KEITHKOEP])
533 CHECK_DRIVER([$cabledrivers], [enabled_cable_drivers], [lattice],     [ENABLE_CABLE_LATTICE])
534 CHECK_DRIVER([$cabledrivers], [enabled_cable_drivers], [mpcbdm],      [ENABLE_CABLE_MPCBDM])
535 CHECK_DRIVER([$cabledrivers], [enabled_cable_drivers], [triton],      [ENABLE_CABLE_TRITON])
536 CHECK_DRIVER([$cabledrivers], [enabled_cable_drivers], [usbblaster],  [ENABLE_CABLE_USBBLASTER])
537 CHECK_DRIVER([$cabledrivers], [enabled_cable_drivers], [wiggler],     [ENABLE_CABLE_WIGGLER])
538 CHECK_DRIVER([$cabledrivers], [enabled_cable_drivers], [xpc],         [ENABLE_CABLE_XPC])
539 CHECK_DRIVER([$cabledrivers], [enabled_cable_drivers], [ts7800],      [ENABLE_CABLE_TS7800])
540
541
542 # Enable lowlevel drivers
543 AC_DEFUN([DEF_ENABLE_LOWLEVELDRIVERS], [\
544 direct ftdi ftd2xx ppdev ppi])
545 AC_ARG_ENABLE(lowlevel,
546 [AS_HELP_STRING([--enable-lowlevel], [Enable default set or specific lowlevel drivers:])]
547 [AS_HELP_STRING([],                  ['default' enables:])]
548 [AS_HELP_STRING([],DEF_ENABLE_LOWLEVELDRIVERS)]
549 ,
550 [AS_CASE([${enableval}],
551     [yes],  [lowleveldrivers=default],
552     [no],   [lowleveldrivers=none],
553     [none], [lowleveldrivers=none],
554             [lowleveldrivers=`echo ${enableval} | $SED -e 's/,/ /g'`])],
555 [lowleveldrivers=default])
556 # expand 'default' to default enabled lowlevel drivers
557 lowleveldrivers=`echo ${lowleveldrivers} | $SED -e "s/default/DEF_ENABLE_LOWLEVELDRIVERS/"`
558 # automatically disable lowlevel drivers when a required feature is not available
559 AS_IF([test "x$HAVELIBFTDI" != "xyes"], [
560     lowleveldrivers=`echo ${lowleveldrivers} | $SED -e "s/ftdi//"`
561 ])
562 AS_IF([test "x$HAVELIBFTD2XX" != "xyes"], [
563     lowleveldrivers=`echo ${lowleveldrivers} | $SED -e "s/ftd2xx//"`
564 ])
565 AS_IF([test "x$HAVE_LINUX_PPDEV_H" != "xyes"], [
566     lowleveldrivers=`echo ${lowleveldrivers} | $SED -e "s/ppdev//"`
567 ])
568 AS_IF([test "x$HAVE_DEV_PPBUS_PPI_H" != "xyes"], [
569     lowleveldrivers=`echo ${lowleveldrivers} | $SED -e "s/ppi//"`
570 ])
571 AS_IF([test "x$HAVE_IOPERM" != "xyes" -a "x$HAVE_I386_SET_IOPERM" != "xyes" -a "x$HAVE_INPOUTXX" != "xyes" ], [
572     lowleveldrivers=`echo ${lowleveldrivers} | $SED -e "s/direct//"`
573 ])
574 #
575 enabled_lowlevel_drivers=''
576 CHECK_DRIVER([$lowleveldrivers], [enabled_lowlevel_drivers], [direct], [ENABLE_LOWLEVEL_DIRECT])
577 CHECK_DRIVER([$lowleveldrivers], [enabled_lowlevel_drivers], [ftd2xx], [ENABLE_LOWLEVEL_FTD2XX])
578 CHECK_DRIVER([$lowleveldrivers], [enabled_lowlevel_drivers], [ftdi],   [ENABLE_LOWLEVEL_FTDI])
579 CHECK_DRIVER([$lowleveldrivers], [enabled_lowlevel_drivers], [ppdev],  [ENABLE_LOWLEVEL_PPDEV])
580 CHECK_DRIVER([$lowleveldrivers], [enabled_lowlevel_drivers], [ppi],    [ENABLE_LOWLEVEL_PPI])
581
582
583 dnl Enable a relocatable jtag?
584 AC_ARG_ENABLE(relocatable,
585 [AS_HELP_STRING([--enable-relocatable], [Enable relocatable paths])],
586 [relocatable=$enableval], [relocatable=no])
587 AS_IF([test "x$relocatable" = xyes], [
588   AM_CONDITIONAL(JTAG_RELOCATABLE, true)
589   AC_DEFINE(JTAG_RELOCATABLE, 1, [define for relocatable paths])
590 ],[
591   AM_CONDITIONAL(JTAG_RELOCATABLE, false)
592 ])
593
594
595 dnl Is fmax() provided by libm?
596 AC_CHECK_LIB([m], [fmax], [
597   AC_DEFINE(HAVE_FMAX, 1, [Define if -lm provides fmax()])
598 ])
599
600
601 dnl Enable use of DMALLOC library?
602 AC_ARG_ENABLE(dmalloc,
603 [AS_HELP_STRING([--enable-dmalloc], [Enable heap debugging with dmalloc library])],
604 [dmalloc=$enableval], [dmalloc=no])
605 AS_IF([test "x$dmalloc" = xyes], [
606   AM_CONDITIONAL(DMALLOC, true)
607   AC_DEFINE(DMALLOC, 1, [define for dmalloc library])
608 ],[
609   AM_CONDITIONAL(DMALLOC, false)
610 ])
611
612
613 # Enable flash multi-byte write mode?
614 AC_ARG_ENABLE(flash-multi-byte,
615 [AS_HELP_STRING([--disable-flash-multi-byte], [Disable flash multi-byte write mode])],
616 [flash_multi_byte=$enableval], [flash_multi_byte=yes])
617 AS_IF([test "x$flash_multi_byte" = xyes], [
618   AC_DEFINE(FLASH_MULTI_BYTE, 1, [define for flash multi-byte write mode])
619 ])
620
621
622 AC_OUTPUT
623
624 dnl
625 dnl Configuration summary
626 dnl
627 AS_IF([test ${HAVELIBFTDI:-no} != no], [
628    FLAG_HAVELIBFTDI=yes
629 ], [
630    FLAG_HAVELIBFTDI=no
631 ])
632 AS_IF([test ${HAVELIBUSB:-no} != no], [
633    FLAG_HAVELIBUSB=yes
634 ], [
635    FLAG_HAVELIBUSB=no
636 ])
637 AS_IF([test ${HAVELIBFTD2XX:-no} != no], [
638    FLAG_HAVELIBFTD2XX=yes
639 ], [
640    FLAG_HAVELIBFTD2XX=no
641 ])
642 AS_IF([test ${HAVEINPOUTXX:-no} != no], [
643    FLAG_HAVEINPOUTXX=yes
644 ], [
645    FLAG_HAVEINPOUTXX=no
646 ])
647 AS_IF([test ${svf:-false} != false], [
648    FLAG_SVF=yes
649 ], [
650    FLAG_SVF=no
651 ])
652 AS_IF([test ${bsdl:-false} != false], [
653    FLAG_BSDL=yes
654 ], [
655    FLAG_BSDL=no
656 ])
657 AC_MSG_NOTICE([
658
659 jtag is now configured for
660
661   Detected libusb      : $FLAG_HAVELIBUSB
662   Detected libftdi     : $FLAG_HAVELIBFTDI
663   Detected libftd2xx   : $FLAG_HAVELIBFTD2XX
664   Detected inpout32    : $FLAG_HAVEINPOUTXX
665   Build SVF player     : $FLAG_SVF
666   Build BSDL subsystem : $FLAG_BSDL
667   Bus drivers          : $enabled_bus_drivers
668   Cable drivers        : $enabled_cable_drivers
669   Lowlevel drivers     : $enabled_lowlevel_drivers
670 ])