2 AC_INIT([openocd], [0.8.0-dev],
3 [OpenOCD Mailing List <openocd-devel@lists.sourceforge.net>])
4 AC_CONFIG_SRCDIR([src/openocd.c])
6 m4_include([config_subdir.m4])dnl
8 AM_INIT_AUTOMAKE([-Wall -Wno-portability dist-bzip2 dist-zip subdir-objects])
10 AC_CONFIG_HEADERS([config.h])
12 #include <helper/system.h>
13 #include <helper/types.h>
14 #include <helper/replacements.h>
22 PKG_PROG_PKG_CONFIG([0.23])
24 dnl disable checks for C++, Fortran and GNU Java Compiler
25 m4_defun([_LT_AC_LANG_CXX_CONFIG], [:])
26 m4_defun([_LT_AC_LANG_F77_CONFIG], [:])
27 m4_defun([_LT_AC_LANG_GCJ_CONFIG], [:])
30 AC_SUBST([LIBTOOL_DEPS])
32 dnl configure checks required for Jim files (these are obsolete w/ C99)
36 AC_SEARCH_LIBS([ioperm], [ioperm])
37 AC_SEARCH_LIBS([dlopen], [dl])
39 AC_CHECK_HEADERS([sys/socket.h])
40 AC_CHECK_HEADERS([arpa/inet.h], [], [], [dnl
50 #ifdef HAVE_SYS_SOCKET_H
51 # include <sys/socket.h>
54 AC_CHECK_HEADERS([elf.h])
55 AC_CHECK_HEADERS([dirent.h])
56 AC_CHECK_HEADERS([fcntl.h])
57 AC_CHECK_HEADERS([ifaddrs.h], [], [], [dnl
67 #ifdef HAVE_SYS_SOCKET_H
68 # include <sys/socket.h>
71 AC_CHECK_HEADERS([malloc.h])
72 AC_CHECK_HEADERS([netdb.h])
73 AC_CHECK_HEADERS([netinet/in.h], [], [], [dnl
83 #ifdef HAVE_SYS_SOCKET_H
84 # include <sys/socket.h>
87 AC_CHECK_HEADERS([netinet/tcp.h], [], [], [dnl
97 #ifdef HAVE_SYS_SOCKET_H
98 # include <sys/socket.h>
101 AC_CHECK_HEADERS([pthread.h])
102 AC_CHECK_HEADERS([strings.h])
103 AC_CHECK_HEADERS([sys/ioctl.h])
104 AC_CHECK_HEADERS([sys/param.h])
105 AC_CHECK_HEADERS([sys/poll.h])
106 AC_CHECK_HEADERS([sys/select.h])
107 AC_CHECK_HEADERS([sys/stat.h])
108 AC_CHECK_HEADERS([sys/time.h])
109 AC_CHECK_HEADERS([sys/types.h])
110 AC_CHECK_HEADERS([unistd.h])
111 AC_CHECK_HEADERS([net/if.h], [], [], [dnl
117 # ifdef HAVE_STDLIB_H
121 #ifdef HAVE_SYS_SOCKET_H
122 # include <sys/socket.h>
132 AC_CHECK_FUNCS([strndup])
133 AC_CHECK_FUNCS([strnlen])
134 AC_CHECK_FUNCS([gettimeofday])
135 AC_CHECK_FUNCS([usleep])
136 AC_CHECK_FUNCS([vasprintf])
145 # guess-rev.sh only exists in the repository, not in the released archives
146 AC_MSG_CHECKING([whether to build a release])
147 if test -x $srcdir/guess-rev.sh ; then
152 AC_MSG_RESULT([$build_release])
155 AS_HELP_STRING([--with-ftd2xx=<PATH>],[This option has been removed.]),
160 The option: --with-ftd2xx=<PATH> has been removed.
161 On Linux, the new option is:
163 --with-ftd2xx-linux-tardir=/path/to/files
165 Where <path> is the path the the directory where the "tar.gz" file
166 from FTDICHIP.COM was unpacked, for example:
168 --with-ftd2xx-linux-tardir=${HOME}/libftd2xx0.4.16
170 On Cygwin/MingW32, the new option is:
172 --with-ftd2xx-win32-zipdir=/path/to/files
174 Where <path> is the path to the directory where the "zip" file from
175 FTDICHIP.COM was unpacked, for example:
177 --with-ftd2xx-win32-zipdir=${HOME}/ftd2xx.cdm.files
181 AC_MSG_ERROR([Sorry Cannot continue])
185 # 1st column -- configure option
186 # 2nd column -- description
187 # 3rd column -- symbol used for both config.h and automake
188 m4_define([ADAPTER_ARG], [m4_argn([1], $1)])
189 m4_define([ADAPTER_DESC], [m4_argn([2], $1)])
190 m4_define([ADAPTER_SYM], [m4_argn([3], $1)])
191 m4_define([ADAPTER_VAR], [enable_[]ADAPTER_ARG($1)])
192 m4_define([ADAPTER_OPT], [m4_translit(ADAPTER_ARG($1), [_], [-])])
194 m4_define([USB1_ADAPTERS],
195 [[[ftdi], [MPSSE mode of FTDI based devices], [FTDI]],
196 [[stlink], [ST-Link JTAG Programmer], [HLADAPTER_STLINK]],
197 [[ti_icdi], [TI ICDI JTAG Programmer], [HLADAPTER_ICDI]],
198 [[ulink], [Keil ULINK JTAG Programmer], [ULINK]],
199 [[usb_blaster_2], [Altera USB-Blaster II Compatible], [USB_BLASTER_2]]])
201 m4_define([USB_ADAPTERS],
202 [[[jlink], [Segger J-Link JTAG Programmer], [JLINK]],
203 [[osbdm], [OSBDM (JTAG only) Programmer], [OSBDM]],
204 [[opendous], [eStick/opendous JTAG Programmer], [OPENDOUS]],
205 [[aice], [Andes JTAG Programmer], [AICE]]])
207 m4_define([USB0_ADAPTERS],
208 [[[vsllink], [Versaloon-Link JTAG Programmer], [VSLLINK]],
209 [[usbprog], [USBProg JTAG Programmer], [USBPROG]],
210 [[rlink], [Raisonance RLink JTAG Programmer], [RLINK]],
211 [[armjtagew], [Olimex ARM-JTAG-EW Programmer], [ARMJTAGEW]]])
213 m4_define([HIDAPI_ADAPTERS],
214 [[[cmsis_dap], [CMSIS-DAP Compliant Debugger], [CMSIS_DAP]]])
216 #========================================
217 # FTD2XXX support comes in 4 forms.
218 # (1) win32 - via a zip file
219 # (2) linux - via a tar file
220 # (3) linux/cygwin/mingw - via libftdi
221 # (4) darwin - installed under /usr/local
223 # In case (1) and (2) we need to know where the package was unpacked.
225 AC_ARG_WITH(ftd2xx-win32-zipdir,
226 AS_HELP_STRING([--with-ftd2xx-win32-zipdir],[Where (CYGWIN/MINGW) the zip file from ftdichip.com was unpacked (default=search)]),
229 if test -d $with_ftd2xx_win32_zipdir
231 with_ftd2xx_win32_zipdir=`cd $with_ftd2xx_win32_zipdir && pwd`
232 AC_MSG_NOTICE([Using: ftdichip.com library: $with_ftd2xx_win32_zipdir])
234 AC_MSG_ERROR([Parameter to --with-ftd2xx-win32-zipdir is not a dir: $with_ftd2xx_win32_zipdir])
238 AC_ARG_WITH(ftd2xx-linux-tardir,
239 AS_HELP_STRING([--with-ftd2xx-linux-tardir], [Where (Linux/Unix) the tar file from ftdichip.com was unpacked (default=search)]),
242 if test $is_win32 = yes ; then
243 AC_MSG_ERROR([The option: --with-ftd2xx-linux-tardir is only usable on linux])
245 if test -d $with_ftd2xx_linux_tardir
247 with_ftd2xx_linux_tardir=`cd $with_ftd2xx_linux_tardir && pwd`
248 AC_MSG_NOTICE([Using: ftdichip.com library: $with_ftd2xx_linux_tardir])
250 AC_MSG_ERROR([Parameter to --with-ftd2xx-linux-tardir is not a dir: $with_ftd2xx_linux_tardir])
254 AC_ARG_WITH(ftd2xx-lib,
255 AS_HELP_STRING([--with-ftd2xx-lib],
256 [Use static or shared ftd2xx libs (default=static)]),
260 with_ftd2xx_lib=$withval
263 with_ftd2xx_lib=$withval
266 AC_MSG_ERROR([Option: --with-ftd2xx-lib=static or --with-ftd2xx-lib=shared not, $withval])
270 # Default is static - it is simpler :-(
271 with_ftd2xx_lib=static
274 AC_ARG_ENABLE([doxygen-html],
275 AS_HELP_STRING([--disable-doxygen-html],
276 [Disable building Doxygen manual as HTML.]),
277 [doxygen_as_html=$enableval], [doxygen_as_html=yes])
278 AC_SUBST([doxygen_as_html])
279 AC_MSG_CHECKING([whether to build Doxygen as HTML])
280 AC_MSG_RESULT([$doxygen_as_html])
282 AC_ARG_ENABLE([doxygen-pdf],
283 AS_HELP_STRING([--enable-doxygen-pdf],
284 [Enable building Doxygen manual as PDF.]),
285 [doxygen_as_pdf=$enableval], [doxygen_as_pdf=no])
286 AC_SUBST([doxygen_as_pdf])
287 AC_MSG_CHECKING([whether to build Doxygen as PDF])
288 AC_MSG_RESULT([$doxygen_as_pdf])
290 AC_ARG_ENABLE([gccwarnings],
291 AS_HELP_STRING([--disable-gccwarnings], [Disable compiler warnings]),
292 [gcc_warnings=$enableval], [gcc_warnings=yes])
294 AC_ARG_ENABLE([wextra],
295 AS_HELP_STRING([--disable-wextra], [Disable extra compiler warnings]),
296 [gcc_wextra=$enableval], [gcc_wextra=$gcc_warnings])
298 AC_ARG_ENABLE([werror],
299 AS_HELP_STRING([--disable-werror], [Do not treat warnings as errors]),
300 [gcc_werror=$enableval], [gcc_werror=$gcc_warnings])
302 # set default verbose options, overridden by following options
307 AC_ARG_ENABLE([verbose],
308 AS_HELP_STRING([--enable-verbose],
309 [Enable verbose JTAG I/O messages (for debugging).]),
311 debug_jtag_io=$enableval
312 debug_usb_io=$enableval
313 debug_usb_comms=$enableval
316 AC_ARG_ENABLE([verbose_jtag_io],
317 AS_HELP_STRING([--enable-verbose-jtag-io],
318 [Enable verbose JTAG I/O messages (for debugging).]),
319 [debug_jtag_io=$enableval], [])
321 AC_ARG_ENABLE([verbose_usb_io],
322 AS_HELP_STRING([--enable-verbose-usb-io],
323 [Enable verbose USB I/O messages (for debugging)]),
324 [debug_usb_io=$enableval], [])
326 AC_ARG_ENABLE([verbose_usb_comms],
327 AS_HELP_STRING([--enable-verbose-usb-comms],
328 [Enable verbose USB communication messages (for debugging)]),
329 [debug_usb_comms=$enableval], [])
331 AC_MSG_CHECKING([whether to enable verbose JTAG I/O messages]);
332 AC_MSG_RESULT([$debug_jtag_io])
333 if test $debug_jtag_io = yes; then
334 AC_DEFINE([_DEBUG_JTAG_IO_],[1], [Print verbose JTAG I/O messages])
337 AC_MSG_CHECKING([whether to enable verbose USB I/O messages]);
338 AC_MSG_RESULT([$debug_usb_io])
339 if test $debug_usb_io = yes; then
340 AC_DEFINE([_DEBUG_USB_IO_],[1], [Print verbose USB I/O messages])
343 AC_MSG_CHECKING([whether to enable verbose USB communication messages]);
344 AC_MSG_RESULT([$debug_usb_comms])
345 if test $debug_usb_comms = yes; then
346 AC_DEFINE([_DEBUG_USB_COMMS_],[1], [Print verbose USB communication messages])
350 AC_ARG_ENABLE([malloc_logging],
351 AS_HELP_STRING([--enable-malloc-logging],
352 [Include free space in logging messages (requires malloc.h).]),
353 [debug_malloc=$enableval], [])
355 AC_MSG_CHECKING([whether to enable malloc free space logging]);
356 AC_MSG_RESULT([$debug_malloc])
357 if test $debug_malloc = yes; then
358 AC_DEFINE([_DEBUG_FREE_SPACE_],[1], [Include malloc free space in logging])
361 AC_ARG_ENABLE([dummy],
362 AS_HELP_STRING([--enable-dummy], [Enable building the dummy port driver]),
363 [build_dummy=$enableval], [build_dummy=no])
365 m4_define([AC_ARG_ADAPTERS], [
366 m4_foreach([adapter], [$1],
367 [AC_ARG_ENABLE(ADAPTER_OPT([adapter]),
368 AS_HELP_STRING([--enable-ADAPTER_OPT([adapter])],
369 [Enable building support for the ]ADAPTER_DESC([adapter])[ (default is $2)]),
370 [], [ADAPTER_VAR([adapter])=$2])
374 AC_ARG_ADAPTERS([USB1_ADAPTERS, USB_ADAPTERS, USB0_ADAPTERS, HIDAPI_ADAPTERS], [auto])
376 AC_ARG_ENABLE([parport],
377 AS_HELP_STRING([--enable-parport], [Enable building the pc parallel port driver]),
378 [build_parport=$enableval], [build_parport=no])
380 AC_ARG_ENABLE([parport_ppdev],
381 AS_HELP_STRING([--disable-parport-ppdev],
382 [Disable use of ppdev (/dev/parportN) for parport (for x86 only)]),
383 [parport_use_ppdev=$enableval], [parport_use_ppdev=yes])
385 AC_ARG_ENABLE([parport_giveio],
386 AS_HELP_STRING([--enable-parport-giveio],
387 [Enable use of giveio for parport (for CygWin only)]),
388 [parport_use_giveio=$enableval], [parport_use_giveio=])
390 AC_ARG_ENABLE([ft2232_libftdi],
391 AS_HELP_STRING([--enable-ft2232_libftdi], [Enable building support for FT2232 based devices using the libftdi driver, opensource alternate of FTD2XX]),
392 [build_ft2232_libftdi=$enableval], [build_ft2232_libftdi=no])
394 AC_ARG_ENABLE([ft2232_ftd2xx],
395 AS_HELP_STRING([--enable-ft2232_ftd2xx], [Enable building support for FT2232 based devices using the FTD2XX driver from ftdichip.com]),
396 [build_ft2232_ftd2xx=$enableval], [build_ft2232_ftd2xx=no])
398 AC_ARG_ENABLE([jtag_vpi],
399 AS_HELP_STRING([--enable-jtag_vpi], [Enable building support for JTAG VPI]),
400 [build_jtag_vpi=$enableval], [build_jtag_vpi=no])
402 AC_ARG_ENABLE([usb_blaster_libftdi],
403 AS_HELP_STRING([--enable-usb_blaster_libftdi], [Enable building support for the Altera USB-Blaster using the libftdi driver, opensource alternate of FTD2XX]),
404 [build_usb_blaster_libftdi=$enableval], [build_usb_blaster_libftdi=no])
406 AC_ARG_ENABLE([usb_blaster_ftd2xx],
407 AS_HELP_STRING([--enable-usb_blaster_ftd2xx], [Enable building support for the Altera USB-Blaster using the FTD2XX driver from ftdichip.com]),
408 [build_usb_blaster_ftd2xx=$enableval], [build_usb_blaster_ftd2xx=no])
410 AC_ARG_ENABLE([amtjtagaccel],
411 AS_HELP_STRING([--enable-amtjtagaccel], [Enable building the Amontec JTAG-Accelerator driver]),
412 [build_amtjtagaccel=$enableval], [build_amtjtagaccel=no])
414 AC_ARG_ENABLE([zy1000_master],
415 AS_HELP_STRING([--enable-zy1000-master], [Use ZY1000 JTAG master registers]),
416 [build_zy1000_master=$enableval], [build_zy1000_master=no])
418 AC_ARG_ENABLE([zy1000],
419 AS_HELP_STRING([--enable-zy1000], [Enable ZY1000 interface]),
420 [build_zy1000=$enableval], [build_zy1000=no])
422 AC_ARG_ENABLE([ioutil],
423 AS_HELP_STRING([--enable-ioutil], [Enable ioutil functions - useful for standalone OpenOCD implementations]),
424 [build_ioutil=$enableval], [build_ioutil=no])
426 case "${host_cpu}" in
428 AC_ARG_ENABLE([ep93xx],
429 AS_HELP_STRING([--enable-ep93xx], [Enable building support for EP93xx based SBCs]),
430 [build_ep93xx=$enableval], [build_ep93xx=no])
432 AC_ARG_ENABLE([at91rm9200],
433 AS_HELP_STRING([--enable-at91rm9200], [Enable building support for AT91RM9200 based SBCs]),
434 [build_at91rm9200=$enableval], [build_at91rm9200=no])
436 AC_ARG_ENABLE([bcm2835gpio],
437 AS_HELP_STRING([--enable-bcm2835gpio], [Enable building support for bitbanging on BCM2835 (as found in Raspberry Pi)]),
438 [build_bcm2835gpio=$enableval], [build_bcm2835gpio=no])
448 AC_ARG_ENABLE([gw16012],
449 AS_HELP_STRING([--enable-gw16012], [Enable building support for the Gateworks GW16012 JTAG Programmer]),
450 [build_gw16012=$enableval], [build_gw16012=no])
452 AC_ARG_ENABLE([presto_libftdi],
453 AS_HELP_STRING([--enable-presto_libftdi], [Enable building support for ASIX Presto Programmer using the libftdi driver]),
454 [build_presto_libftdi=$enableval], [build_presto_libftdi=no])
456 AC_ARG_ENABLE([presto_ftd2xx],
457 AS_HELP_STRING([--enable-presto_ftd2xx], [Enable building support for ASIX Presto Programmer using the FTD2XX driver]),
458 [build_presto_ftd2xx=$enableval], [build_presto_ftd2xx=no])
460 AC_ARG_ENABLE([openjtag_ftd2xx],
461 AS_HELP_STRING([--enable-openjtag_ftd2xx], [Enable building support for the OpenJTAG Programmer with ftd2xx driver]),
462 [build_openjtag_ftd2xx=$enableval], [build_openjtag_ftd2xx=no])
464 AC_ARG_ENABLE([openjtag_ftdi],
465 AS_HELP_STRING([--enable-openjtag_ftdi], [Enable building support for the OpenJTAG Programmer with ftdi driver]),
466 [build_openjtag_ftdi=$enableval], [build_openjtag_ftdi=no])
468 AC_ARG_ENABLE([oocd_trace],
469 AS_HELP_STRING([--enable-oocd_trace],
470 [Enable building support for some prototype OpenOCD+trace ETM capture hardware]),
471 [build_oocd_trace=$enableval], [build_oocd_trace=no])
473 AC_ARG_ENABLE([buspirate],
474 AS_HELP_STRING([--enable-buspirate], [Enable building support for the Buspirate]),
475 [build_buspirate=$enableval], [build_buspirate=no])
477 AC_ARG_ENABLE([sysfsgpio],
478 AS_HELP_STRING([--enable-sysfsgpio], [Enable building support for programming driven via sysfs gpios.]),
479 [build_sysfsgpio=$enableval], [build_sysfsgpio=no])
481 AC_ARG_ENABLE([minidriver_dummy],
482 AS_HELP_STRING([--enable-minidriver-dummy], [Enable the dummy minidriver.]),
483 [build_minidriver_dummy=$enableval], [build_minidriver_dummy=no])
485 AC_ARG_ENABLE([internal-jimtcl],
486 AS_HELP_STRING([--disable-internal-jimtcl], [Disable building internal jimtcl]),
487 [use_internal_jimtcl=$enableval], [use_internal_jimtcl=yes])
490 AC_MSG_CHECKING([whether to enable ZY1000 minidriver])
491 if test $build_zy1000 = yes; then
492 if test $build_minidriver = yes; then
493 AC_MSG_ERROR([Multiple minidriver options have been enabled.])
495 AC_DEFINE([HAVE_JTAG_MINIDRIVER_H], [1],
496 [Define to 1 if you have the <jtag_minidriver.h> header file.])
499 AC_MSG_RESULT([$build_zy1000])
501 AC_ARG_ENABLE([remote-bitbang],
502 AS_HELP_STRING([--enable-remote-bitbang], [Enable building support for the Remote Bitbang jtag driver]),
503 [build_remote_bitbang=$enableval], [build_remote_bitbang=no])
505 AC_MSG_CHECKING([whether to enable dummy minidriver])
506 if test $build_minidriver_dummy = yes; then
507 if test $build_minidriver = yes; then
508 AC_MSG_ERROR([Multiple minidriver options have been enabled.])
511 AC_DEFINE([BUILD_MINIDRIVER_DUMMY], [1], [Use the dummy minidriver.])
512 AC_DEFINE([HAVE_JTAG_MINIDRIVER_H], [1],
513 [Define to 1 if you have the <jtag_minidriver.h> header file.])
515 AC_MSG_RESULT([$build_minidriver_dummy])
517 AC_MSG_CHECKING([whether standard drivers can be built])
518 if test "$build_minidriver" = yes; then
520 AC_MSG_WARN([Using the minidriver disables all other drivers.])
526 case "${host_cpu}" in
530 if test x$parport_use_ppdev = xno; then
531 AC_MSG_WARN([--disable-parport-ppdev is not supported by the host CPU])
533 parport_use_ppdev=yes
542 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[return __MINGW32__;]])],
543 [is_mingw=yes],[is_mingw=no])
544 if test $is_mingw = yes; then
545 AC_DEFINE([IS_MINGW], [1], [1 if building for MinGW.])
546 if test x$parport_use_giveio = xno; then
547 AC_MSG_WARN([--disable-parport-giveio is not supported by MinGW32 hosts])
549 parport_use_giveio=yes
553 AC_DEFINE([IS_CYGWIN], [1], [1 if building for Cygwin.])
554 # sys/io.h needed under cygwin for parport access
555 if test $build_parport = yes; then
556 AC_CHECK_HEADERS([sys/io.h],[],AC_MSG_ERROR([Please install the cygwin ioperm package]))
560 AC_DEFINE([IS_WIN32], [1], [1 if building for Win32.])
561 AC_DEFINE([IS_DARWIN], [0], [0 if not building for Darwin.])
568 if test x$parport_use_giveio = xno; then
569 AC_MSG_WARN([--disable-parport-giveio is not supported by MinGW32 hosts])
571 parport_use_giveio=yes
573 if test x$build_buspirate = xyes; then
574 AC_MSG_ERROR([buspirate currently not supported by MinGW32 hosts])
577 CFLAGS="$CFLAGS -D__USE_MINGW_ANSI_STDIO"
579 AC_DEFINE([IS_MINGW], [1], [1 if building for MinGW.])
580 AC_DEFINE([IS_WIN32], [1], [1 if building for Win32.])
581 AC_DEFINE([IS_DARWIN], [0], [0 if not building for Darwin.])
586 if test x$parport_use_giveio = xyes; then
587 AC_MSG_WARN([--enable-parport-giveio cannot be used by Darwin hosts])
589 parport_use_giveio=no
591 AC_DEFINE([IS_CYGWIN], [0], [0 if not building for Cygwin.])
592 AC_DEFINE([IS_WIN32], [0], [0 if not building for Win32.])
593 AC_DEFINE([IS_DARWIN], [1], [1 if building for Darwin.])
596 if test x$parport_use_giveio = xyes; then
597 AC_MSG_WARN([--enable-parport-giveio cannot be used by ]$host[ hosts])
599 parport_use_giveio=no
600 AC_DEFINE([IS_CYGWIN], [0], [0 if not building for Cygwin.])
601 AC_DEFINE([IS_WIN32], [0], [0 if not building for Win32.])
602 AC_DEFINE([IS_DARWIN], [0], [0 if not building for Darwin.])
606 if test $build_parport = yes; then
608 AC_DEFINE([BUILD_PARPORT], [1], [1 if you want parport.])
610 AC_DEFINE([BUILD_PARPORT], [0], [0 if you don't want parport.])
613 if test $build_dummy = yes; then
615 AC_DEFINE([BUILD_DUMMY], [1], [1 if you want dummy driver.])
617 AC_DEFINE([BUILD_DUMMY], [0], [0 if you don't want dummy driver.])
620 if test $build_ep93xx = yes; then
622 AC_DEFINE([BUILD_EP93XX], [1], [1 if you want ep93xx.])
624 AC_DEFINE([BUILD_EP93XX], [0], [0 if you don't want ep93xx.])
627 if test $build_zy1000 = yes; then
628 AC_DEFINE([BUILD_ZY1000], [1], [1 if you want ZY1000.])
630 AC_DEFINE([BUILD_ZY1000], [0], [0 if you don't want ZY1000.])
633 if test $build_zy1000_master = yes; then
634 AC_DEFINE([BUILD_ZY1000_MASTER], [1], [1 if you want ZY1000 JTAG master registers.])
636 AC_DEFINE([BUILD_ZY1000_MASTER], [0], [0 if you don't want ZY1000 JTAG master registers.])
639 if test $build_at91rm9200 = yes; then
641 AC_DEFINE([BUILD_AT91RM9200], [1], [1 if you want at91rm9200.])
643 AC_DEFINE([BUILD_AT91RM9200], [0], [0 if you don't want at91rm9200.])
646 if test $build_bcm2835gpio = yes; then
648 AC_DEFINE([BUILD_BCM2835GPIO], [1], [1 if you want bcm2835gpio.])
650 AC_DEFINE([BUILD_BCM2835GPIO], [0], [0 if you don't want bcm2835gpio.])
653 if test x$parport_use_ppdev = xyes; then
654 AC_DEFINE([PARPORT_USE_PPDEV], [1], [1 if you want parport to use ppdev.])
656 AC_DEFINE([PARPORT_USE_PPDEV], [0], [0 if you don't want parport to use ppdev.])
659 if test x$parport_use_giveio = xyes; then
660 AC_DEFINE([PARPORT_USE_GIVEIO], [1], [1 if you want parport to use giveio.])
662 AC_DEFINE([PARPORT_USE_GIVEIO], [0], [0 if you don't want parport to use giveio.])
665 if test $build_bitbang = yes; then
666 AC_DEFINE([BUILD_BITBANG], [1], [1 if you want a bitbang interface.])
668 AC_DEFINE([BUILD_BITBANG], [0], [0 if you don't want a bitbang interface.])
671 if test $build_ft2232_libftdi = yes; then
672 AC_DEFINE([BUILD_FT2232_LIBFTDI], [1], [1 if you want libftdi ft2232.])
674 AC_DEFINE([BUILD_FT2232_LIBFTDI], [0], [0 if you don't want libftdi ft2232.])
677 if test $build_ft2232_ftd2xx = yes; then
678 AC_DEFINE([BUILD_FT2232_FTD2XX], [1], [1 if you want ftd2xx ft2232.])
680 AC_DEFINE([BUILD_FT2232_FTD2XX], [0], [0 if you don't want ftd2xx ft2232.])
683 if test $build_usb_blaster_libftdi = yes; then
684 AC_DEFINE([BUILD_USB_BLASTER_LIBFTDI], [1], [1 if you want libftdi usb_blaster.])
686 AC_DEFINE([BUILD_USB_BLASTER_LIBFTDI], [0], [0 if you don't want libftdi usb_blaster.])
689 if test $build_jtag_vpi = yes; then
690 AC_DEFINE([BUILD_JTAG_VPI], [1], [1 if you want JTAG VPI.])
692 AC_DEFINE([BUILD_JTAG_VPI], [0], [0 if you don't want JTAG VPI.])
695 if test $build_usb_blaster_ftd2xx = yes; then
696 AC_DEFINE([BUILD_USB_BLASTER_FTD2XX], [1], [1 if you want ftd2xx usb_blaster.])
698 AC_DEFINE([BUILD_USB_BLASTER_FTD2XX], [0], [0 if you don't want ftd2xx usb_blaster.])
701 if test $build_amtjtagaccel = yes; then
702 AC_DEFINE([BUILD_AMTJTAGACCEL], [1], [1 if you want the Amontec JTAG-Accelerator driver.])
704 AC_DEFINE([BUILD_AMTJTAGACCEL], [0], [0 if you don't want the Amontec JTAG-Accelerator driver.])
707 if test $build_gw16012 = yes; then
708 AC_DEFINE([BUILD_GW16012], [1], [1 if you want the Gateworks GW16012 driver.])
710 AC_DEFINE([BUILD_GW16012], [0], [0 if you don't want the Gateworks GW16012 driver.])
713 if test $build_presto_libftdi = yes; then
715 AC_DEFINE([BUILD_PRESTO_LIBFTDI], [1], [1 if you want the ASIX PRESTO driver using libftdi.])
717 AC_DEFINE([BUILD_PRESTO_LIBFTDI], [0], [0 if you don't want the ASIX PRESTO driver using libftdi.])
720 if test $build_presto_ftd2xx = yes; then
722 AC_DEFINE([BUILD_PRESTO_FTD2XX], [1], [1 if you want the ASIX PRESTO driver using FTD2XX.])
724 AC_DEFINE([BUILD_PRESTO_FTD2XX], [0], [0 if you don't want the ASIX PRESTO driver using FTD2XX.])
727 if test $build_bitq = yes; then
728 AC_DEFINE([BUILD_BITQ], [1], [1 if you want a bitq interface.])
730 AC_DEFINE([BUILD_BITQ], [0], [0 if you don't want a bitq interface.])
733 AC_DEFINE([BUILD_OPENJTAG], [0], [0 if you don't want the OpenJTAG driver.])
734 AC_DEFINE([BUILD_OPENJTAG_FTD2XX], [0], [0 if you don't want the OpenJTAG driver with FTD2XX driver.])
735 AC_DEFINE([BUILD_OPENJTAG_LIBFTDI], [0], [0 if you don't want to build OpenJTAG driver with libftdi.])
737 if test $build_openjtag_ftd2xx = yes; then
738 AC_DEFINE([BUILD_OPENJTAG], [1], [1 if you want the OpenJTAG driver.])
739 AC_DEFINE([BUILD_OPENJTAG_FTD2XX], [1], [1 if you want the OpenJTAG driver with FTD2XX driver.])
741 if test $build_openjtag_ftdi = yes; then
742 AC_DEFINE([BUILD_OPENJTAG], [1], [1 if you want the OpenJTAG drvier.])
743 AC_DEFINE([BUILD_OPENJTAG_LIBFTDI], [1], [1 if you want to build OpenJTAG with FTDI driver.])
746 if test $build_oocd_trace = yes; then
747 AC_DEFINE([BUILD_OOCD_TRACE], [1], [1 if you want the OpenOCD+trace ETM capture driver.])
749 AC_DEFINE([BUILD_OOCD_TRACE], [0], [0 if you don't want the OpenOCD+trace ETM capture driver.])
752 if test $build_buspirate = yes; then
753 AC_DEFINE([BUILD_BUSPIRATE], [1], [1 if you want the Buspirate JTAG driver.])
755 AC_DEFINE([BUILD_BUSPIRATE], [0], [0 if you don't want the Buspirate JTAG driver.])
758 if test $use_internal_jimtcl = yes; then
759 if test -f "$srcdir/jimtcl/configure.ac"; then
760 AX_CONFIG_SUBDIR_OPTION([jimtcl], [--disable-install-jim])
762 AC_MSG_ERROR([jimtcl not found, run git submodule init and git submodule update.])
766 if test $build_remote_bitbang = yes; then
768 AC_DEFINE([BUILD_REMOTE_BITBANG], [1], [1 if you want the Remote Bitbang JTAG driver.])
770 AC_DEFINE([BUILD_REMOTE_BITBANG], [0], [0 if you don't want the Remote Bitbang JTAG driver.])
773 if test $build_sysfsgpio = yes; then
775 AC_DEFINE([BUILD_SYSFSGPIO], [1], [1 if you want the SysfsGPIO driver.])
777 AC_DEFINE([BUILD_SYSFSGPIO], [0], [0 if you don't want SysfsGPIO driver.])
779 #-- Deal with MingW/Cygwin FTD2XX issues
781 if test $is_win32 = yes; then
782 if test "${with_ftd2xx_linux_tardir+set}" = set
784 AC_MSG_ERROR([The option: with_ftd2xx_linux_tardir is for LINUX only.])
787 if test $build_ft2232_ftd2xx = yes -o $build_presto_ftd2xx = yes -o $build_usb_blaster_ftd2xx = yes -o $build_openjtag_ftd2xx = yes; then
788 AC_MSG_CHECKING([for ftd2xx.lib exists (win32)])
790 # if we are given a zipdir...
791 if test "${with_ftd2xx_win32_zipdir+set}" = set
793 # Set the CFLAGS for "ftd2xx.h"
794 f=$with_ftd2xx_win32_zipdir/ftd2xx.h
795 if test ! -f $f ; then
796 AC_MSG_ERROR([File: $f cannot be found])
798 CFLAGS="$CFLAGS -I$with_ftd2xx_win32_zipdir"
800 # And calculate the LDFLAGS for the machine
803 LDFLAGS="$LDFLAGS -L$with_ftd2xx_win32_zipdir/i386"
804 LIBS="$LIBS -lftd2xx"
805 f=$with_ftd2xx_win32_zipdir/i386/ftd2xx.lib
808 LDFLAGS="$LDFLAGS -L$with_ftd2xx_win32_zipdir/amd64"
809 LIBS="$LIBS -lftd2xx"
810 f=$with_ftd2xx_win32_zipdir/amd64/ftd2xx.lib
813 AC_MSG_ERROR([Unknown Win32 host cpu: $host_cpu])
816 if test ! -f $f ; then
817 AC_MSG_ERROR([Library: $f not found])
820 LIBS="$LIBS -lftd2xx"
821 AC_MSG_WARN([ASSUMPTION: The (win32) FTDICHIP.COM files: ftd2xx.h and ftd2xx.lib are in a proper place])
826 if test $is_darwin = yes ; then
827 if test "${with_ftd2xx_win32_zipdir+set}" = set
829 AC_MSG_ERROR([The option: --with-ftd2xx-win32-zipdir is for win32 only])
831 if test "${with_ftd2xx_linux_tardir+set}" = set
833 AC_MSG_ERROR([The option: with_ftd2xx_linux_tardir is for LINUX only.])
836 if test $build_ft2232_ftd2xx = yes -o $build_presto_ftd2xx = yes -o $build_usb_blaster_ftd2xx = yes ; then
837 AC_MSG_CHECKING([for libftd2xx.a (darwin)])
839 if test ! -f /usr/local/include/ftd2xx.h ; then
840 AC_MSG_ERROR([ftd2xx library from FTDICHIP.com seems to be missing, cannot find: /usr/local/include/ftd2xx.h])
843 CFLAGS="$CFLAGS -I/usr/local/include"
844 LDFLAGS="$LDFLAGS -L/usr/local/lib"
845 LIBS="$LIBS -lftd2xx"
846 AC_MSG_RESULT([-L/usr/local/lib -lftd2xx])
850 if test $is_win32 = no && test $is_darwin = no ; then
852 if test "${with_ftd2xx_win32_zipdir+set}" = set
854 AC_MSG_ERROR([The option: --with-ftd2xx-win32-zipdir is for win32 only])
857 if test $build_ft2232_ftd2xx = yes -o $build_presto_ftd2xx = yes -o $build_usb_blaster_ftd2xx = yes -o $build_openjtag_ftd2xx = yes; then
859 if test $host_os != linux-gnu && test $host_os != linux ; then
860 AC_MSG_ERROR([The (linux) ftd2xx library from FTDICHIP.com is linux only. Try --enable-ft2232-libftdi instead])
862 # Are we given a TAR directory?
863 if test "${with_ftd2xx_linux_tardir+set}" = set
865 AC_MSG_CHECKING([uninstalled ftd2xx distribution])
866 # The .H file is simple..
867 FTD2XX_H=$with_ftd2xx_linux_tardir/ftd2xx.h
868 if test ! -f "${FTD2XX_H}"; then
869 AC_MSG_ERROR([Option: --with-ftd2xx-linux-tardir appears wrong, cannot find: ${FTD2XX_H}])
871 CFLAGS="$CFLAGS -I$with_ftd2xx_linux_tardir"
872 if test $with_ftd2xx_lib = shared; then
873 FTD2XX_LDFLAGS="-L$with_ftd2xx_linux_tardir"
874 FTD2XX_LIB="-lftd2xx"
885 if test -f "$with_ftd2xx_linux_tardir/$dir/libftd2xx.a"; then
886 FTD2XX_LDFLAGS="-L$with_ftd2xx_linux_tardir/$dir"
888 FTD2XX_LIB="-lftd2xx -lrt"
891 # Grr.. perhaps it exists as a version number?
892 FTD2XX_LIB="$with_ftd2xx_linux_tardir/static_lib/libftd2xx.a.*.*.*"
893 count=`ls ${FTD2XX_LIB} | wc -l`
894 if test $count -gt 1 ; then
895 AC_MSG_ERROR([Multiple libftd2xx.a files found in: $with_ftd2xx_linux_tardir/static_lib sorry cannot handle this yet])
897 if test $count -ne 1 ; then
898 AC_MSG_ERROR([Not found: $f, option: --with-ftd2xx-linux-tardir appears to be wrong])
900 # Because the "-l" rules do not understand version numbers...
901 # we will just stuff the absolute path onto the LIBS variable
902 FTD2XX_LIB="`ls ${FTD2XX_LIB}` -lpthread"
906 LDFLAGS="${LDFLAGS} ${FTD2XX_LDFLAGS}"
907 LIBS="${FTD2XX_LIB} ${LIBS}"
908 AC_MSG_RESULT([${FTD2XX_LDFLAGS} ${FTD2XX_LIB}])
910 AC_CHECK_HEADER([ftd2xx.h],[],[
911 AC_MSG_ERROR([You seem to be missing the FTD2xx driver header file.])
913 AC_SEARCH_LIBS([FT_GetLibraryVersion],[ftd2xx],,[
914 AC_MSG_ERROR([You appear to be missing the FTD2xx driver library.])
920 if test $build_ft2232_ftd2xx = yes -o $build_presto_ftd2xx = yes -o $build_usb_blaster_ftd2xx = yes ; then
922 # Before we go any further - make sure we can *BUILD* and *RUN*
923 # a simple app with the "ftd2xx.lib" file - in what ever form we where given
924 # We should be able to compile, link and run this test program now
925 AC_MSG_CHECKING([whether ftd2xx library works])
928 # Save the LDFLAGS for later..
929 LDFLAGS_SAVE=$LDFLAGS
931 _LDFLAGS=`eval echo $LDFLAGS`
932 _CFLAGS=`eval echo $CFLAGS`
936 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
937 #include "confdefs.h"
945 FT_GetLibraryVersion( &x );
947 AC_MSG_RESULT([Success!])
949 AC_MSG_ERROR([Cannot build & run test program using ftd2xx.lib])
951 AC_MSG_RESULT([Skipping as we are cross-compiling])
954 AC_MSG_CHECKING([for ftd2xx highspeed device support])
955 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
956 #include "confdefs.h"
963 DWORD x = FT_DEVICE_4232H;
965 AC_DEFINE([BUILD_FT2232_HIGHSPEED], [1],
966 [Support FT2232H/FT4232HS with FTD2XX or libftdi.])
967 build_ft2232_highspeed=yes
969 build_ft2232_highspeed=no
971 AC_MSG_RESULT([$build_ft2232_highspeed])
973 if test $build_ft2232_highspeed = no; then
974 AC_MSG_WARN([You need a newer FTD2XX driver (version 2.04.16 or later).])
977 AC_MSG_CHECKING([for ftd2xx FT232H device support])
978 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
979 #include "confdefs.h"
986 DWORD x = FT_DEVICE_232H;
988 AC_DEFINE([HAS_ENUM_FT232H], [1],
989 [Support FT232H with FTD2XX or libftdi.])
994 AC_MSG_RESULT([$has_enum_ft232h])
996 if test $has_enum_ft232h = no; then
997 AC_MSG_WARN([You need a newer FTD2XX driver (version 2.08.12 or later).])
1000 LDFLAGS=$LDFLAGS_SAVE
1004 if test $build_ft2232_libftdi = yes -o $build_usb_blaster_libftdi = yes -o \
1005 $build_openjtag_ftdi = yes; then
1007 # we can have libftdi or libftdi1, so check it and use the latest one
1008 PKG_CHECK_MODULES([LIBFTDI], [libftdi1], [use_libftdi=yes], [use_libftdi=no])
1009 if test $use_libftdi = no; then
1010 PKG_CHECK_MODULES([LIBFTDI], [libftdi], [use_libftdi=yes], [use_libftdi=no])
1012 if test $use_libftdi = no; then
1013 AC_MSG_ERROR([The libftdi driver is not present on your system.])
1017 # Try to build a small program.
1018 AC_MSG_CHECKING([Build & Link with libftdi...])
1020 LDFLAGS_SAVE=$LDFLAGS
1023 _LDFLAGS=`eval echo $LDFLAGS`
1024 _CFLAGS=`eval echo $CFLAGS`
1025 _LIBS=`eval echo $LIBS`
1027 CFLAGS="$_CFLAGS $LIBFTDI_CFLAGS"
1028 LIBS="$_LIBS $LIBFTDI_LIBS"
1030 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
1034 struct ftdi_context *p;
1039 fprintf( stderr, "calling ftdi_new() failed\n");
1043 AC_MSG_RESULT([Success])
1045 AC_MSG_ERROR([Cannot build & run test program using libftdi])
1047 AC_MSG_RESULT([Skipping as we are cross-compiling, trying build only])
1048 AC_SEARCH_LIBS([ftdi_new], [], [], [AC_MSG_ERROR([Cannot link with libftdi])])
1051 AC_MSG_CHECKING([for libftdi highspeed device support])
1052 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1056 enum ftdi_chip_type x = TYPE_2232H;
1058 AC_DEFINE([BUILD_FT2232_HIGHSPEED], [1],
1059 [Support FT2232H/FT4232HS with FTD2XX or libftdi.])
1060 build_ft2232_highspeed=yes
1062 build_ft2232_highspeed=no
1064 AC_MSG_RESULT([$build_ft2232_highspeed])
1066 if test $build_ft2232_highspeed = no; then
1067 AC_MSG_WARN([You need a newer libftdi version (0.16 or later).])
1070 AC_MSG_CHECKING([for libftdi FT232H device support])
1071 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1075 enum ftdi_chip_type x = TYPE_232H;
1077 AC_DEFINE([HAS_ENUM_FT232H], [1],
1078 [Support FT232H with FTD2XX or libftdi.])
1083 AC_MSG_RESULT([$has_enum_ft232h])
1085 if test $has_enum_ft232h = no; then
1086 AC_MSG_WARN([You need a newer libftdi version (0.20 or later).])
1089 # Restore the 'unexpanded ldflags'
1090 LDFLAGS=$LDFLAGS_SAVE
1095 PKG_CHECK_MODULES([LIBUSB1], [libusb-1.0], [
1097 AC_DEFINE([HAVE_LIBUSB1], [1], [Define if you have libusb-1.x])
1098 PKG_CHECK_EXISTS([libusb-1.0 >= 1.0.9],
1099 [AC_DEFINE([HAVE_LIBUSB_ERROR_NAME], [1], [Define if your libusb has libusb_error_name()])],
1100 [AC_MSG_WARN([libusb-1.x older than 1.0.9 detected, consider updating])])
1101 LIBUSB1_CFLAGS=`echo $LIBUSB1_CFLAGS | sed 's/-I/-isystem /'`
1102 AC_MSG_NOTICE([libusb-1.0 header bug workaround: LIBUSB1_CFLAGS changed to "$LIBUSB1_CFLAGS"])
1105 AC_MSG_WARN([libusb-1.x not found, trying legacy libusb-0.1 as a fallback; consider installing libusb-1.x instead])
1108 PKG_CHECK_MODULES([LIBUSB0], [libusb], [use_libusb0=yes], [use_libusb0=no])
1110 for hidapi_lib in hidapi hidapi-hidraw hidapi-libusb; do
1111 PKG_CHECK_MODULES([HIDAPI],[$hidapi_lib],[
1119 m4_define([PROCESS_ADAPTERS], [
1120 m4_foreach([adapter], [$1], [
1122 if test $ADAPTER_VAR([adapter]) != no; then
1123 AC_DEFINE([BUILD_]ADAPTER_SYM([adapter]), [1], [1 if you want the ]ADAPTER_DESC([adapter]).)
1125 AC_DEFINE([BUILD_]ADAPTER_SYM([adapter]), [0], [0 if you do not want the ]ADAPTER_DESC([adapter]).)
1128 if test $ADAPTER_VAR([adapter]) = yes; then
1129 AC_MSG_ERROR([$3 is required for the ADAPTER_DESC([adapter])])
1131 ADAPTER_VAR([adapter])=no
1133 AM_CONDITIONAL(ADAPTER_SYM([adapter]), [test $ADAPTER_VAR([adapter]) != no])
1137 PROCESS_ADAPTERS([USB1_ADAPTERS], [$use_libusb1 = yes], [libusb-1.x])
1138 PROCESS_ADAPTERS([USB_ADAPTERS], [$use_libusb1 = yes -o $use_libusb0 = yes], [libusb-1.x or libusb-0.1])
1139 PROCESS_ADAPTERS([USB0_ADAPTERS], [$use_libusb0 = yes], [libusb-0.1])
1140 PROCESS_ADAPTERS([HIDAPI_ADAPTERS], [$use_hidapi = yes], [hidapi])
1142 if test $enable_stlink != no -o $enable_ti_icdi != no; then
1143 AC_DEFINE([BUILD_HLADAPTER], [1], [1 if you want the High Level JTAG driver.])
1145 AC_DEFINE([BUILD_HLADAPTER], [0], [0 if you want the High Level JTAG driver.])
1147 AM_CONDITIONAL([HLADAPTER], [test $enable_stlink != no -o $enable_ti_icdi != no])
1149 AM_CONDITIONAL([RELEASE], [test $build_release = yes])
1150 AM_CONDITIONAL([PARPORT], [test $build_parport = yes])
1151 AM_CONDITIONAL([DUMMY], [test $build_dummy = yes])
1152 AM_CONDITIONAL([GIVEIO], [test x$parport_use_giveio = xyes])
1153 AM_CONDITIONAL([EP93XX], [test $build_ep93xx = yes])
1154 AM_CONDITIONAL([ZY1000], [test $build_zy1000 = yes])
1155 AM_CONDITIONAL([ZY1000_MASTER], [test $build_zy1000_master = yes])
1156 AM_CONDITIONAL([IOUTIL], [test $build_ioutil = yes])
1157 AM_CONDITIONAL([AT91RM9200], [test $build_at91rm9200 = yes])
1158 AM_CONDITIONAL([BCM2835GPIO], [test $build_bcm2835gpio = yes])
1159 AM_CONDITIONAL([BITBANG], [test $build_bitbang = yes])
1160 AM_CONDITIONAL([FT2232_LIBFTDI], [test $build_ft2232_libftdi = yes])
1161 AM_CONDITIONAL([FT2232_DRIVER], [test $build_ft2232_ftd2xx = yes -o $build_ft2232_libftdi = yes])
1162 AM_CONDITIONAL([USB_BLASTER_LIBFTDI], [test $build_usb_blaster_libftdi = yes])
1163 AM_CONDITIONAL([USB_BLASTER_FTD2XX], [test $build_usb_blaster_ftd2xx = yes])
1164 AM_CONDITIONAL([JTAG_VPI], [test $build_jtag_vpi = yes -o $build_jtag_vpi = yes])
1165 AM_CONDITIONAL([USB_BLASTER_DRIVER], [test $build_usb_blaster_ftd2xx = yes -o $build_usb_blaster_libftdi = yes -o $use_libusb1 = yes])
1166 AM_CONDITIONAL([AMTJTAGACCEL], [test $build_amtjtagaccel = yes])
1167 AM_CONDITIONAL([GW16012], [test $build_gw16012 = yes])
1168 AM_CONDITIONAL([PRESTO_LIBFTDI], [test $build_presto_libftdi = yes])
1169 AM_CONDITIONAL([PRESTO_DRIVER], [test $build_presto_ftd2xx = yes -o $build_presto_libftdi = yes])
1170 AM_CONDITIONAL([OPENJTAG], [test $build_openjtag_ftd2xx = yes -o $build_openjtag_ftdi = yes])
1171 AM_CONDITIONAL([OOCD_TRACE], [test $build_oocd_trace = yes])
1172 AM_CONDITIONAL([REMOTE_BITBANG], [test $build_remote_bitbang = yes])
1173 AM_CONDITIONAL([BUSPIRATE], [test $build_buspirate = yes])
1174 AM_CONDITIONAL([SYSFSGPIO], [test $build_sysfsgpio = yes])
1175 AM_CONDITIONAL([USE_LIBUSB0], [test $use_libusb0 = yes])
1176 AM_CONDITIONAL([USE_LIBUSB1], [test $use_libusb1 = yes])
1177 AM_CONDITIONAL([IS_CYGWIN], [test $is_cygwin = yes])
1178 AM_CONDITIONAL([IS_MINGW], [test $is_mingw = yes])
1179 AM_CONDITIONAL([IS_WIN32], [test $is_win32 = yes])
1180 AM_CONDITIONAL([IS_DARWIN], [test $is_darwin = yes])
1181 AM_CONDITIONAL([BITQ], [test $build_bitq = yes])
1182 AM_CONDITIONAL([CMSIS_DAP], [test $use_hidapi = yes])
1184 AM_CONDITIONAL([MINIDRIVER], [test $build_minidriver = yes])
1185 AM_CONDITIONAL([MINIDRIVER_DUMMY], [test $build_minidriver_dummy = yes])
1187 AM_CONDITIONAL([INTERNAL_JIMTCL], [test $use_internal_jimtcl = yes])
1189 # Look for environ alternatives. Possibility #1: is environ in unistd.h or stdlib.h?
1190 AC_MSG_CHECKING([for environ in unistd.h and stdlib.h])
1191 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1195 ]], [[char **ep = environ;]]
1197 AC_MSG_RESULT([yes])
1202 # Possibility #2: can environ be found in an available library?
1203 AC_MSG_CHECKING([for extern environ])
1204 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1205 extern char **environ;
1206 ]], [[char **ep = environ;]]
1208 AC_DEFINE(NEED_ENVIRON_EXTERN, [1], [Must declare 'environ' to use it.])
1213 AC_MSG_RESULT([${has_environ}])
1216 if test "${has_environ}" != "yes" ; then
1217 AC_MSG_FAILURE([Could not find 'environ' in unistd.h or available libraries.])
1220 AC_DEFINE([_GNU_SOURCE],[1],[Use GNU C library extensions (e.g. stdndup).])
1222 # set default gcc warnings
1223 GCC_WARNINGS="-Wall -Wstrict-prototypes -Wformat-security -Wshadow"
1224 if test "${gcc_wextra}" = yes; then
1225 GCC_WARNINGS="${GCC_WARNINGS} -Wextra -Wno-unused-parameter"
1226 GCC_WARNINGS="${GCC_WARNINGS} -Wbad-function-cast"
1227 GCC_WARNINGS="${GCC_WARNINGS} -Wcast-align"
1228 GCC_WARNINGS="${GCC_WARNINGS} -Wredundant-decls"
1230 if test "${gcc_werror}" = yes; then
1231 GCC_WARNINGS="${GCC_WARNINGS} -Werror"
1234 # overide default gcc cflags
1235 if test $gcc_warnings = yes; then
1236 CFLAGS="$CFLAGS $GCC_WARNINGS"
1239 # Setup for compiling build tools
1240 AC_MSG_CHECKING([for a C compiler for build tools])
1241 if test $cross_compiling = yes; then
1242 AC_CHECK_PROGS(CC_FOR_BUILD, gcc cc)
1243 CFLAGS_FOR_BUILD="-g -O2 $GCC_WARNINGS"
1246 CFLAGS_FOR_BUILD=$CFLAGS
1249 AC_MSG_RESULT([$CC_FOR_BUILD])
1250 AC_SUBST([CC_FOR_BUILD])
1251 AC_SUBST([CFLAGS_FOR_BUILD])
1253 AC_MSG_CHECKING([for suffix of executable build tools])
1254 if test $cross_compiling = yes; then
1255 cat >conftest.c <<\_______EOF
1261 for i in .exe ""; do
1262 compile="$CC_FOR_BUILD conftest.c -o conftest$i"
1263 if AC_TRY_EVAL(compile); then
1264 if (./conftest) 2>&AC_FD_CC; then
1271 if test "${EXEEXT_FOR_BUILD+set}" != set; then
1272 AC_MSG_ERROR([Cannot determine suffix of executable build tools])
1275 EXEEXT_FOR_BUILD=$EXEEXT
1277 AC_MSG_RESULT([$EXEEXT_FOR_BUILD])
1278 AC_SUBST([EXEEXT_FOR_BUILD])
1285 src/jtag/drivers/Makefile
1286 src/jtag/drivers/usb_blaster/Makefile
1287 src/jtag/hla/Makefile
1288 src/jtag/aice/Makefile
1289 src/transport/Makefile
1290 src/target/openrisc/Makefile
1297 src/flash/nor/Makefile
1298 src/flash/nand/Makefile
1306 echo OpenOCD configuration summary
1307 echo --------------------------------------------------
1308 m4_foreach([adapter], [USB1_ADAPTERS, USB_ADAPTERS, USB0_ADAPTERS, HIDAPI_ADAPTERS],
1309 [echo -n m4_format(["%-40s"], ADAPTER_DESC([adapter]))
1310 case $ADAPTER_VAR([adapter]) in