A few more grammar and typo fixes from the User's Guide.
[openocd.git] / configure.ac
1 AC_PREREQ(2.64)
2 AC_INIT([openocd], [0.8.0-dev],
3 [OpenOCD Mailing List <openocd-devel@lists.sourceforge.net>])
4 AC_CONFIG_SRCDIR([src/openocd.c])
5
6 m4_include([config_subdir.m4])dnl
7
8 AM_INIT_AUTOMAKE([-Wall -Wno-portability dist-bzip2 dist-zip subdir-objects])
9
10 AC_CONFIG_HEADERS([config.h])
11 AH_BOTTOM([
12 #include <helper/system.h>
13 #include <helper/types.h>
14 #include <helper/replacements.h>
15 ])
16
17 AC_LANG_C
18 AC_PROG_CC
19 AC_PROG_CC_C99
20 AM_PROG_CC_C_O
21 AC_PROG_RANLIB
22 PKG_PROG_PKG_CONFIG([0.23])
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], [:])
28 AC_DISABLE_SHARED
29 AC_PROG_LIBTOOL
30 AC_SUBST([LIBTOOL_DEPS])
31
32 dnl configure checks required for Jim files (these are obsolete w/ C99)
33 AC_C_CONST
34 AC_TYPE_LONG_LONG_INT
35
36 AC_SEARCH_LIBS([ioperm], [ioperm])
37 AC_SEARCH_LIBS([dlopen], [dl])
38
39 AC_CHECK_HEADERS([sys/socket.h])
40 AC_CHECK_HEADERS([arpa/inet.h], [], [], [dnl
41 #include <stdio.h>
42 #ifdef STDC_HEADERS
43 # include <stdlib.h>
44 # include <stddef.h>
45 #else
46 # ifdef HAVE_STDLIB_H
47 # include <stdlib.h>
48 # endif
49 #endif
50 #ifdef HAVE_SYS_SOCKET_H
51 # include <sys/socket.h>
52 #endif
53 ])
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
58 #include <stdio.h>
59 #ifdef STDC_HEADERS
60 # include <stdlib.h>
61 # include <stddef.h>
62 #else
63 # ifdef HAVE_STDLIB_H
64 # include <stdlib.h>
65 # endif
66 #endif
67 #ifdef HAVE_SYS_SOCKET_H
68 # include <sys/socket.h>
69 #endif
70 ])
71 AC_CHECK_HEADERS([malloc.h])
72 AC_CHECK_HEADERS([netdb.h])
73 AC_CHECK_HEADERS([netinet/in.h], [], [], [dnl
74 #include <stdio.h>
75 #ifdef STDC_HEADERS
76 # include <stdlib.h>
77 # include <stddef.h>
78 #else
79 # ifdef HAVE_STDLIB_H
80 # include <stdlib.h>
81 # endif
82 #endif
83 #ifdef HAVE_SYS_SOCKET_H
84 # include <sys/socket.h>
85 #endif
86 ])
87 AC_CHECK_HEADERS([netinet/tcp.h], [], [], [dnl
88 #include <stdio.h>
89 #ifdef STDC_HEADERS
90 # include <stdlib.h>
91 # include <stddef.h>
92 #else
93 # ifdef HAVE_STDLIB_H
94 # include <stdlib.h>
95 # endif
96 #endif
97 #ifdef HAVE_SYS_SOCKET_H
98 # include <sys/socket.h>
99 #endif
100 ])
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
112 #include <stdio.h>
113 #ifdef STDC_HEADERS
114 # include <stdlib.h>
115 # include <stddef.h>
116 #else
117 # ifdef HAVE_STDLIB_H
118 # include <stdlib.h>
119 # endif
120 #endif
121 #ifdef HAVE_SYS_SOCKET_H
122 # include <sys/socket.h>
123 #endif
124 ])
125
126 AC_HEADER_ASSERT
127 AC_HEADER_STDBOOL
128 AC_HEADER_TIME
129
130 AC_C_BIGENDIAN
131
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])
137
138 build_bitbang=no
139 build_bitq=no
140 is_cygwin=no
141 is_mingw=no
142 is_win32=no
143 is_darwin=no
144
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
148 build_release=no
149 else
150 build_release=yes
151 fi
152 AC_MSG_RESULT([$build_release])
153
154 AC_ARG_WITH(ftd2xx,
155 AS_HELP_STRING([--with-ftd2xx=<PATH>],[This option has been removed.]),
156 [
157 # Option Given.
158 cat << __EOF__
159
160 The option: --with-ftd2xx=<PATH> has been removed.
161 On Linux, the new option is:
162
163 --with-ftd2xx-linux-tardir=/path/to/files
164
165 Where <path> is the path the the directory where the "tar.gz" file
166 from FTDICHIP.COM was unpacked, for example:
167
168 --with-ftd2xx-linux-tardir=${HOME}/libftd2xx0.4.16
169
170 On Cygwin/MingW32, the new option is:
171
172 --with-ftd2xx-win32-zipdir=/path/to/files
173
174 Where <path> is the path to the directory where the "zip" file from
175 FTDICHIP.COM was unpacked, for example:
176
177 --with-ftd2xx-win32-zipdir=${HOME}/ftd2xx.cdm.files
178
179 __EOF__
180
181 AC_MSG_ERROR([Sorry Cannot continue])
182 ], [true])
183
184 # Adapter drivers
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), [_], [-])])
193
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
200 m4_define([USB_ADAPTERS],
201 [[[jlink], [Segger J-Link JTAG Programmer], [JLINK]],
202 [[osbdm], [OSBDM (JTAG only) Programmer], [OSBDM]],
203 [[opendous], [eStick/opendous JTAG Programmer], [OPENDOUS]],
204 [[aice], [Andes JTAG Programmer], [AICE]]])
205
206 m4_define([USB0_ADAPTERS],
207 [[[vsllink], [Versaloon-Link JTAG Programmer], [VSLLINK]],
208 [[usbprog], [USBProg JTAG Programmer], [USBPROG]],
209 [[rlink], [Raisonance RLink JTAG Programmer], [RLINK]],
210 [[armjtagew], [Olimex ARM-JTAG-EW Programmer], [ARMJTAGEW]]])
211
212 m4_define([HIDAPI_ADAPTERS],
213 [[[cmsis_dap], [CMSIS-DAP Compliant Debugger], [CMSIS_DAP]]])
214
215 #========================================
216 # FTD2XXX support comes in 4 forms.
217 # (1) win32 - via a zip file
218 # (2) linux - via a tar file
219 # (3) linux/cygwin/mingw - via libftdi
220 # (4) darwin - installed under /usr/local
221 #
222 # In case (1) and (2) we need to know where the package was unpacked.
223
224 AC_ARG_WITH(ftd2xx-win32-zipdir,
225 AS_HELP_STRING([--with-ftd2xx-win32-zipdir],[Where (CYGWIN/MINGW) the zip file from ftdichip.com was unpacked (default=search)]),
226 [
227 # option present
228 if test -d $with_ftd2xx_win32_zipdir
229 then
230 with_ftd2xx_win32_zipdir=`cd $with_ftd2xx_win32_zipdir && pwd`
231 AC_MSG_NOTICE([Using: ftdichip.com library: $with_ftd2xx_win32_zipdir])
232 else
233 AC_MSG_ERROR([Parameter to --with-ftd2xx-win32-zipdir is not a dir: $with_ftd2xx_win32_zipdir])
234 fi
235 ], [true])
236
237 AC_ARG_WITH(ftd2xx-linux-tardir,
238 AS_HELP_STRING([--with-ftd2xx-linux-tardir], [Where (Linux/Unix) the tar file from ftdichip.com was unpacked (default=search)]),
239 [
240 # Option present
241 if test $is_win32 = yes ; then
242 AC_MSG_ERROR([The option: --with-ftd2xx-linux-tardir is only usable on linux])
243 fi
244 if test -d $with_ftd2xx_linux_tardir
245 then
246 with_ftd2xx_linux_tardir=`cd $with_ftd2xx_linux_tardir && pwd`
247 AC_MSG_NOTICE([Using: ftdichip.com library: $with_ftd2xx_linux_tardir])
248 else
249 AC_MSG_ERROR([Parameter to --with-ftd2xx-linux-tardir is not a dir: $with_ftd2xx_linux_tardir])
250 fi
251 ], [true])
252
253 AC_ARG_WITH(ftd2xx-lib,
254 AS_HELP_STRING([--with-ftd2xx-lib],
255 [Use static or shared ftd2xx libs (default=static)]),
256 [
257 case "$withval" in
258 static)
259 with_ftd2xx_lib=$withval
260 ;;
261 shared)
262 with_ftd2xx_lib=$withval
263 ;;
264 *)
265 AC_MSG_ERROR([Option: --with-ftd2xx-lib=static or --with-ftd2xx-lib=shared not, $withval])
266 ;;
267 esac
268 ], [
269 # Default is static - it is simpler :-(
270 with_ftd2xx_lib=static
271 ])
272
273 AC_ARG_ENABLE([doxygen-html],
274 AS_HELP_STRING([--disable-doxygen-html],
275 [Disable building Doxygen manual as HTML.]),
276 [doxygen_as_html=$enableval], [doxygen_as_html=yes])
277 AC_SUBST([doxygen_as_html])
278 AC_MSG_CHECKING([whether to build Doxygen as HTML])
279 AC_MSG_RESULT([$doxygen_as_html])
280
281 AC_ARG_ENABLE([doxygen-pdf],
282 AS_HELP_STRING([--enable-doxygen-pdf],
283 [Enable building Doxygen manual as PDF.]),
284 [doxygen_as_pdf=$enableval], [doxygen_as_pdf=no])
285 AC_SUBST([doxygen_as_pdf])
286 AC_MSG_CHECKING([whether to build Doxygen as PDF])
287 AC_MSG_RESULT([$doxygen_as_pdf])
288
289 AC_ARG_ENABLE([gccwarnings],
290 AS_HELP_STRING([--disable-gccwarnings], [Disable compiler warnings]),
291 [gcc_warnings=$enableval], [gcc_warnings=yes])
292
293 AC_ARG_ENABLE([wextra],
294 AS_HELP_STRING([--disable-wextra], [Disable extra compiler warnings]),
295 [gcc_wextra=$enableval], [gcc_wextra=$gcc_warnings])
296
297 AC_ARG_ENABLE([werror],
298 AS_HELP_STRING([--disable-werror], [Do not treat warnings as errors]),
299 [gcc_werror=$enableval], [gcc_werror=$gcc_warnings])
300
301 # set default verbose options, overridden by following options
302 debug_jtag_io=no
303 debug_usb_io=no
304 debug_usb_comms=no
305
306 AC_ARG_ENABLE([verbose],
307 AS_HELP_STRING([--enable-verbose],
308 [Enable verbose JTAG I/O messages (for debugging).]),
309 [
310 debug_jtag_io=$enableval
311 debug_usb_io=$enableval
312 debug_usb_comms=$enableval
313 ], [])
314
315 AC_ARG_ENABLE([verbose_jtag_io],
316 AS_HELP_STRING([--enable-verbose-jtag-io],
317 [Enable verbose JTAG I/O messages (for debugging).]),
318 [debug_jtag_io=$enableval], [])
319
320 AC_ARG_ENABLE([verbose_usb_io],
321 AS_HELP_STRING([--enable-verbose-usb-io],
322 [Enable verbose USB I/O messages (for debugging)]),
323 [debug_usb_io=$enableval], [])
324
325 AC_ARG_ENABLE([verbose_usb_comms],
326 AS_HELP_STRING([--enable-verbose-usb-comms],
327 [Enable verbose USB communication messages (for debugging)]),
328 [debug_usb_comms=$enableval], [])
329
330 AC_MSG_CHECKING([whether to enable verbose JTAG I/O messages]);
331 AC_MSG_RESULT([$debug_jtag_io])
332 if test $debug_jtag_io = yes; then
333 AC_DEFINE([_DEBUG_JTAG_IO_],[1], [Print verbose JTAG I/O messages])
334 fi
335
336 AC_MSG_CHECKING([whether to enable verbose USB I/O messages]);
337 AC_MSG_RESULT([$debug_usb_io])
338 if test $debug_usb_io = yes; then
339 AC_DEFINE([_DEBUG_USB_IO_],[1], [Print verbose USB I/O messages])
340 fi
341
342 AC_MSG_CHECKING([whether to enable verbose USB communication messages]);
343 AC_MSG_RESULT([$debug_usb_comms])
344 if test $debug_usb_comms = yes; then
345 AC_DEFINE([_DEBUG_USB_COMMS_],[1], [Print verbose USB communication messages])
346 fi
347
348 debug_malloc=no
349 AC_ARG_ENABLE([malloc_logging],
350 AS_HELP_STRING([--enable-malloc-logging],
351 [Include free space in logging messages (requires malloc.h).]),
352 [debug_malloc=$enableval], [])
353
354 AC_MSG_CHECKING([whether to enable malloc free space logging]);
355 AC_MSG_RESULT([$debug_malloc])
356 if test $debug_malloc = yes; then
357 AC_DEFINE([_DEBUG_FREE_SPACE_],[1], [Include malloc free space in logging])
358 fi
359
360 AC_ARG_ENABLE([dummy],
361 AS_HELP_STRING([--enable-dummy], [Enable building the dummy port driver]),
362 [build_dummy=$enableval], [build_dummy=no])
363
364 m4_define([AC_ARG_ADAPTERS], [
365 m4_foreach([adapter], [$1],
366 [AC_ARG_ENABLE(ADAPTER_OPT([adapter]),
367 AS_HELP_STRING([--enable-ADAPTER_OPT([adapter])],
368 [Enable building support for the ]ADAPTER_DESC([adapter])[ (default is $2)]),
369 [], [ADAPTER_VAR([adapter])=$2])
370 ])
371 ])
372
373 AC_ARG_ADAPTERS([USB1_ADAPTERS, USB_ADAPTERS, USB0_ADAPTERS, HIDAPI_ADAPTERS], [auto])
374
375 AC_ARG_ENABLE([parport],
376 AS_HELP_STRING([--enable-parport], [Enable building the pc parallel port driver]),
377 [build_parport=$enableval], [build_parport=no])
378
379 AC_ARG_ENABLE([parport_ppdev],
380 AS_HELP_STRING([--disable-parport-ppdev],
381 [Disable use of ppdev (/dev/parportN) for parport (for x86 only)]),
382 [parport_use_ppdev=$enableval], [parport_use_ppdev=yes])
383
384 AC_ARG_ENABLE([parport_giveio],
385 AS_HELP_STRING([--enable-parport-giveio],
386 [Enable use of giveio for parport (for CygWin only)]),
387 [parport_use_giveio=$enableval], [parport_use_giveio=])
388
389 AC_ARG_ENABLE([ft2232_libftdi],
390 AS_HELP_STRING([--enable-ft2232_libftdi], [Enable building support for FT2232 based devices using the libftdi driver, opensource alternate of FTD2XX]),
391 [build_ft2232_libftdi=$enableval], [build_ft2232_libftdi=no])
392
393 AC_ARG_ENABLE([ft2232_ftd2xx],
394 AS_HELP_STRING([--enable-ft2232_ftd2xx], [Enable building support for FT2232 based devices using the FTD2XX driver from ftdichip.com]),
395 [build_ft2232_ftd2xx=$enableval], [build_ft2232_ftd2xx=no])
396
397 AC_ARG_ENABLE([jtag_vpi],
398 AS_HELP_STRING([--enable-jtag_vpi], [Enable building support for JTAG VPI]),
399 [build_jtag_vpi=$enableval], [build_jtag_vpi=no])
400
401 AC_ARG_ENABLE([usb_blaster_libftdi],
402 AS_HELP_STRING([--enable-usb_blaster_libftdi], [Enable building support for the Altera USB-Blaster using the libftdi driver, opensource alternate of FTD2XX]),
403 [build_usb_blaster_libftdi=$enableval], [build_usb_blaster_libftdi=no])
404
405 AC_ARG_ENABLE([usb_blaster_ftd2xx],
406 AS_HELP_STRING([--enable-usb_blaster_ftd2xx], [Enable building support for the Altera USB-Blaster using the FTD2XX driver from ftdichip.com]),
407 [build_usb_blaster_ftd2xx=$enableval], [build_usb_blaster_ftd2xx=no])
408
409 AC_ARG_ENABLE([amtjtagaccel],
410 AS_HELP_STRING([--enable-amtjtagaccel], [Enable building the Amontec JTAG-Accelerator driver]),
411 [build_amtjtagaccel=$enableval], [build_amtjtagaccel=no])
412
413 AC_ARG_ENABLE([zy1000_master],
414 AS_HELP_STRING([--enable-zy1000-master], [Use ZY1000 JTAG master registers]),
415 [build_zy1000_master=$enableval], [build_zy1000_master=no])
416
417 AC_ARG_ENABLE([zy1000],
418 AS_HELP_STRING([--enable-zy1000], [Enable ZY1000 interface]),
419 [build_zy1000=$enableval], [build_zy1000=no])
420
421 AC_ARG_ENABLE([ioutil],
422 AS_HELP_STRING([--enable-ioutil], [Enable ioutil functions - useful for standalone OpenOCD implementations]),
423 [build_ioutil=$enableval], [build_ioutil=no])
424
425 case "${host_cpu}" in
426 arm*)
427 AC_ARG_ENABLE([ep93xx],
428 AS_HELP_STRING([--enable-ep93xx], [Enable building support for EP93xx based SBCs]),
429 [build_ep93xx=$enableval], [build_ep93xx=no])
430
431 AC_ARG_ENABLE([at91rm9200],
432 AS_HELP_STRING([--enable-at91rm9200], [Enable building support for AT91RM9200 based SBCs]),
433 [build_at91rm9200=$enableval], [build_at91rm9200=no])
434
435 AC_ARG_ENABLE([bcm2835gpio],
436 AS_HELP_STRING([--enable-bcm2835gpio], [Enable building support for bitbanging on BCM2835 (as found in Raspberry Pi)]),
437 [build_bcm2835gpio=$enableval], [build_bcm2835gpio=no])
438 ;;
439
440 *)
441 build_ep93xx=no
442 build_at91rm9200=no
443 build_bcm2835gpio=no
444 ;;
445 esac
446
447 AC_ARG_ENABLE([gw16012],
448 AS_HELP_STRING([--enable-gw16012], [Enable building support for the Gateworks GW16012 JTAG Programmer]),
449 [build_gw16012=$enableval], [build_gw16012=no])
450
451 AC_ARG_ENABLE([presto_libftdi],
452 AS_HELP_STRING([--enable-presto_libftdi], [Enable building support for ASIX Presto Programmer using the libftdi driver]),
453 [build_presto_libftdi=$enableval], [build_presto_libftdi=no])
454
455 AC_ARG_ENABLE([presto_ftd2xx],
456 AS_HELP_STRING([--enable-presto_ftd2xx], [Enable building support for ASIX Presto Programmer using the FTD2XX driver]),
457 [build_presto_ftd2xx=$enableval], [build_presto_ftd2xx=no])
458
459 AC_ARG_ENABLE([openjtag_ftd2xx],
460 AS_HELP_STRING([--enable-openjtag_ftd2xx], [Enable building support for the OpenJTAG Programmer with ftd2xx driver]),
461 [build_openjtag_ftd2xx=$enableval], [build_openjtag_ftd2xx=no])
462
463 AC_ARG_ENABLE([openjtag_ftdi],
464 AS_HELP_STRING([--enable-openjtag_ftdi], [Enable building support for the OpenJTAG Programmer with ftdi driver]),
465 [build_openjtag_ftdi=$enableval], [build_openjtag_ftdi=no])
466
467 AC_ARG_ENABLE([oocd_trace],
468 AS_HELP_STRING([--enable-oocd_trace],
469 [Enable building support for some prototype OpenOCD+trace ETM capture hardware]),
470 [build_oocd_trace=$enableval], [build_oocd_trace=no])
471
472 AC_ARG_ENABLE([buspirate],
473 AS_HELP_STRING([--enable-buspirate], [Enable building support for the Buspirate]),
474 [build_buspirate=$enableval], [build_buspirate=no])
475
476 AC_ARG_ENABLE([sysfsgpio],
477 AS_HELP_STRING([--enable-sysfsgpio], [Enable building support for programming driven via sysfs gpios.]),
478 [build_sysfsgpio=$enableval], [build_sysfsgpio=no])
479
480 AC_ARG_ENABLE([minidriver_dummy],
481 AS_HELP_STRING([--enable-minidriver-dummy], [Enable the dummy minidriver.]),
482 [build_minidriver_dummy=$enableval], [build_minidriver_dummy=no])
483
484 AC_ARG_ENABLE([internal-jimtcl],
485 AS_HELP_STRING([--disable-internal-jimtcl], [Disable building internal jimtcl]),
486 [use_internal_jimtcl=$enableval], [use_internal_jimtcl=yes])
487
488 build_minidriver=no
489 AC_MSG_CHECKING([whether to enable ZY1000 minidriver])
490 if test $build_zy1000 = yes; then
491 if test $build_minidriver = yes; then
492 AC_MSG_ERROR([Multiple minidriver options have been enabled.])
493 fi
494 AC_DEFINE([HAVE_JTAG_MINIDRIVER_H], [1],
495 [Define to 1 if you have the <jtag_minidriver.h> header file.])
496 build_minidriver=yes
497 fi
498 AC_MSG_RESULT([$build_zy1000])
499
500 AC_ARG_ENABLE([remote-bitbang],
501 AS_HELP_STRING([--enable-remote-bitbang], [Enable building support for the Remote Bitbang jtag driver]),
502 [build_remote_bitbang=$enableval], [build_remote_bitbang=no])
503
504 AC_MSG_CHECKING([whether to enable dummy minidriver])
505 if test $build_minidriver_dummy = yes; then
506 if test $build_minidriver = yes; then
507 AC_MSG_ERROR([Multiple minidriver options have been enabled.])
508 fi
509 build_minidriver=yes
510 AC_DEFINE([BUILD_MINIDRIVER_DUMMY], [1], [Use the dummy minidriver.])
511 AC_DEFINE([HAVE_JTAG_MINIDRIVER_H], [1],
512 [Define to 1 if you have the <jtag_minidriver.h> header file.])
513 fi
514 AC_MSG_RESULT([$build_minidriver_dummy])
515
516 AC_MSG_CHECKING([whether standard drivers can be built])
517 if test "$build_minidriver" = yes; then
518 AC_MSG_RESULT([no])
519 AC_MSG_WARN([Using the minidriver disables all other drivers.])
520 sleep 2
521 else
522 AC_MSG_RESULT([yes])
523 fi
524
525 case "${host_cpu}" in
526 i?86|x86*)
527 ;;
528 *)
529 if test x$parport_use_ppdev = xno; then
530 AC_MSG_WARN([--disable-parport-ppdev is not supported by the host CPU])
531 fi
532 parport_use_ppdev=yes
533 ;;
534 esac
535
536 case $host in
537 *-cygwin*)
538 is_win32=yes
539 parport_use_ppdev=no
540
541 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[return __MINGW32__;]])],
542 [is_mingw=yes],[is_mingw=no])
543 if test $is_mingw = yes; then
544 AC_DEFINE([IS_MINGW], [1], [1 if building for MinGW.])
545 if test x$parport_use_giveio = xno; then
546 AC_MSG_WARN([--disable-parport-giveio is not supported by MinGW32 hosts])
547 fi
548 parport_use_giveio=yes
549 is_cygwin=no
550 else
551 is_cygwin=yes
552 AC_DEFINE([IS_CYGWIN], [1], [1 if building for Cygwin.])
553 # sys/io.h needed under cygwin for parport access
554 if test $build_parport = yes; then
555 AC_CHECK_HEADERS([sys/io.h],[],AC_MSG_ERROR([Please install the cygwin ioperm package]))
556 fi
557 fi
558
559 AC_DEFINE([IS_WIN32], [1], [1 if building for Win32.])
560 AC_DEFINE([IS_DARWIN], [0], [0 if not building for Darwin.])
561 ;;
562 *-mingw*)
563 is_mingw=yes
564 is_win32=yes
565 parport_use_ppdev=no
566
567 if test x$parport_use_giveio = xno; then
568 AC_MSG_WARN([--disable-parport-giveio is not supported by MinGW32 hosts])
569 fi
570 parport_use_giveio=yes
571
572 if test x$build_buspirate = xyes; then
573 AC_MSG_ERROR([buspirate currently not supported by MinGW32 hosts])
574 fi
575
576 CFLAGS="$CFLAGS -D__USE_MINGW_ANSI_STDIO"
577
578 AC_DEFINE([IS_MINGW], [1], [1 if building for MinGW.])
579 AC_DEFINE([IS_WIN32], [1], [1 if building for Win32.])
580 AC_DEFINE([IS_DARWIN], [0], [0 if not building for Darwin.])
581 ;;
582 *darwin*)
583 is_darwin=yes
584
585 if test x$parport_use_giveio = xyes; then
586 AC_MSG_WARN([--enable-parport-giveio cannot be used by Darwin hosts])
587 fi
588 parport_use_giveio=no
589
590 AC_DEFINE([IS_CYGWIN], [0], [0 if not building for Cygwin.])
591 AC_DEFINE([IS_WIN32], [0], [0 if not building for Win32.])
592 AC_DEFINE([IS_DARWIN], [1], [1 if building for Darwin.])
593 ;;
594 *)
595 if test x$parport_use_giveio = xyes; then
596 AC_MSG_WARN([--enable-parport-giveio cannot be used by ]$host[ hosts])
597 fi
598 parport_use_giveio=no
599 AC_DEFINE([IS_CYGWIN], [0], [0 if not building for Cygwin.])
600 AC_DEFINE([IS_WIN32], [0], [0 if not building for Win32.])
601 AC_DEFINE([IS_DARWIN], [0], [0 if not building for Darwin.])
602 ;;
603 esac
604
605 if test $build_parport = yes; then
606 build_bitbang=yes
607 AC_DEFINE([BUILD_PARPORT], [1], [1 if you want parport.])
608 else
609 AC_DEFINE([BUILD_PARPORT], [0], [0 if you don't want parport.])
610 fi
611
612 if test $build_dummy = yes; then
613 build_bitbang=yes
614 AC_DEFINE([BUILD_DUMMY], [1], [1 if you want dummy driver.])
615 else
616 AC_DEFINE([BUILD_DUMMY], [0], [0 if you don't want dummy driver.])
617 fi
618
619 if test $build_ep93xx = yes; then
620 build_bitbang=yes
621 AC_DEFINE([BUILD_EP93XX], [1], [1 if you want ep93xx.])
622 else
623 AC_DEFINE([BUILD_EP93XX], [0], [0 if you don't want ep93xx.])
624 fi
625
626 if test $build_zy1000 = yes; then
627 AC_DEFINE([BUILD_ZY1000], [1], [1 if you want ZY1000.])
628 else
629 AC_DEFINE([BUILD_ZY1000], [0], [0 if you don't want ZY1000.])
630 fi
631
632 if test $build_zy1000_master = yes; then
633 AC_DEFINE([BUILD_ZY1000_MASTER], [1], [1 if you want ZY1000 JTAG master registers.])
634 else
635 AC_DEFINE([BUILD_ZY1000_MASTER], [0], [0 if you don't want ZY1000 JTAG master registers.])
636 fi
637
638 if test $build_at91rm9200 = yes; then
639 build_bitbang=yes
640 AC_DEFINE([BUILD_AT91RM9200], [1], [1 if you want at91rm9200.])
641 else
642 AC_DEFINE([BUILD_AT91RM9200], [0], [0 if you don't want at91rm9200.])
643 fi
644
645 if test $build_bcm2835gpio = yes; then
646 build_bitbang=yes
647 AC_DEFINE([BUILD_BCM2835GPIO], [1], [1 if you want bcm2835gpio.])
648 else
649 AC_DEFINE([BUILD_BCM2835GPIO], [0], [0 if you don't want bcm2835gpio.])
650 fi
651
652 if test x$parport_use_ppdev = xyes; then
653 AC_DEFINE([PARPORT_USE_PPDEV], [1], [1 if you want parport to use ppdev.])
654 else
655 AC_DEFINE([PARPORT_USE_PPDEV], [0], [0 if you don't want parport to use ppdev.])
656 fi
657
658 if test x$parport_use_giveio = xyes; then
659 AC_DEFINE([PARPORT_USE_GIVEIO], [1], [1 if you want parport to use giveio.])
660 else
661 AC_DEFINE([PARPORT_USE_GIVEIO], [0], [0 if you don't want parport to use giveio.])
662 fi
663
664 if test $build_bitbang = yes; then
665 AC_DEFINE([BUILD_BITBANG], [1], [1 if you want a bitbang interface.])
666 else
667 AC_DEFINE([BUILD_BITBANG], [0], [0 if you don't want a bitbang interface.])
668 fi
669
670 if test $build_ft2232_libftdi = yes; then
671 AC_DEFINE([BUILD_FT2232_LIBFTDI], [1], [1 if you want libftdi ft2232.])
672 else
673 AC_DEFINE([BUILD_FT2232_LIBFTDI], [0], [0 if you don't want libftdi ft2232.])
674 fi
675
676 if test $build_ft2232_ftd2xx = yes; then
677 AC_DEFINE([BUILD_FT2232_FTD2XX], [1], [1 if you want ftd2xx ft2232.])
678 else
679 AC_DEFINE([BUILD_FT2232_FTD2XX], [0], [0 if you don't want ftd2xx ft2232.])
680 fi
681
682 if test $build_usb_blaster_libftdi = yes; then
683 AC_DEFINE([BUILD_USB_BLASTER_LIBFTDI], [1], [1 if you want libftdi usb_blaster.])
684 else
685 AC_DEFINE([BUILD_USB_BLASTER_LIBFTDI], [0], [0 if you don't want libftdi usb_blaster.])
686 fi
687
688 if test $build_jtag_vpi = yes; then
689 AC_DEFINE([BUILD_JTAG_VPI], [1], [1 if you want JTAG VPI.])
690 else
691 AC_DEFINE([BUILD_JTAG_VPI], [0], [0 if you don't want JTAG VPI.])
692 fi
693
694 if test $build_usb_blaster_ftd2xx = yes; then
695 AC_DEFINE([BUILD_USB_BLASTER_FTD2XX], [1], [1 if you want ftd2xx usb_blaster.])
696 else
697 AC_DEFINE([BUILD_USB_BLASTER_FTD2XX], [0], [0 if you don't want ftd2xx usb_blaster.])
698 fi
699
700 if test $build_amtjtagaccel = yes; then
701 AC_DEFINE([BUILD_AMTJTAGACCEL], [1], [1 if you want the Amontec JTAG-Accelerator driver.])
702 else
703 AC_DEFINE([BUILD_AMTJTAGACCEL], [0], [0 if you don't want the Amontec JTAG-Accelerator driver.])
704 fi
705
706 if test $build_gw16012 = yes; then
707 AC_DEFINE([BUILD_GW16012], [1], [1 if you want the Gateworks GW16012 driver.])
708 else
709 AC_DEFINE([BUILD_GW16012], [0], [0 if you don't want the Gateworks GW16012 driver.])
710 fi
711
712 if test $build_presto_libftdi = yes; then
713 build_bitq=yes
714 AC_DEFINE([BUILD_PRESTO_LIBFTDI], [1], [1 if you want the ASIX PRESTO driver using libftdi.])
715 else
716 AC_DEFINE([BUILD_PRESTO_LIBFTDI], [0], [0 if you don't want the ASIX PRESTO driver using libftdi.])
717 fi
718
719 if test $build_presto_ftd2xx = yes; then
720 build_bitq=yes
721 AC_DEFINE([BUILD_PRESTO_FTD2XX], [1], [1 if you want the ASIX PRESTO driver using FTD2XX.])
722 else
723 AC_DEFINE([BUILD_PRESTO_FTD2XX], [0], [0 if you don't want the ASIX PRESTO driver using FTD2XX.])
724 fi
725
726 if test $build_bitq = yes; then
727 AC_DEFINE([BUILD_BITQ], [1], [1 if you want a bitq interface.])
728 else
729 AC_DEFINE([BUILD_BITQ], [0], [0 if you don't want a bitq interface.])
730 fi
731
732 AC_DEFINE([BUILD_OPENJTAG], [0], [0 if you don't want the OpenJTAG driver.])
733 AC_DEFINE([BUILD_OPENJTAG_FTD2XX], [0], [0 if you don't want the OpenJTAG driver with FTD2XX driver.])
734 AC_DEFINE([BUILD_OPENJTAG_LIBFTDI], [0], [0 if you don't want to build OpenJTAG driver with libftdi.])
735
736 if test $build_openjtag_ftd2xx = yes; then
737 AC_DEFINE([BUILD_OPENJTAG], [1], [1 if you want the OpenJTAG driver.])
738 AC_DEFINE([BUILD_OPENJTAG_FTD2XX], [1], [1 if you want the OpenJTAG driver with FTD2XX driver.])
739 fi
740 if test $build_openjtag_ftdi = yes; then
741 AC_DEFINE([BUILD_OPENJTAG], [1], [1 if you want the OpenJTAG drvier.])
742 AC_DEFINE([BUILD_OPENJTAG_LIBFTDI], [1], [1 if you want to build OpenJTAG with FTDI driver.])
743 fi
744
745 if test $build_oocd_trace = yes; then
746 AC_DEFINE([BUILD_OOCD_TRACE], [1], [1 if you want the OpenOCD+trace ETM capture driver.])
747 else
748 AC_DEFINE([BUILD_OOCD_TRACE], [0], [0 if you don't want the OpenOCD+trace ETM capture driver.])
749 fi
750
751 if test $build_buspirate = yes; then
752 AC_DEFINE([BUILD_BUSPIRATE], [1], [1 if you want the Buspirate JTAG driver.])
753 else
754 AC_DEFINE([BUILD_BUSPIRATE], [0], [0 if you don't want the Buspirate JTAG driver.])
755 fi
756
757 if test $use_internal_jimtcl = yes; then
758 if test -f "$srcdir/jimtcl/configure.ac"; then
759 AX_CONFIG_SUBDIR_OPTION([jimtcl], [--disable-install-jim])
760 else
761 AC_MSG_ERROR([jimtcl not found, run git submodule init and git submodule update.])
762 fi
763 fi
764
765 if test $build_remote_bitbang = yes; then
766 build_bitbang=yes
767 AC_DEFINE([BUILD_REMOTE_BITBANG], [1], [1 if you want the Remote Bitbang JTAG driver.])
768 else
769 AC_DEFINE([BUILD_REMOTE_BITBANG], [0], [0 if you don't want the Remote Bitbang JTAG driver.])
770 fi
771
772 if test $build_sysfsgpio = yes; then
773 build_bitbang=yes
774 AC_DEFINE([BUILD_SYSFSGPIO], [1], [1 if you want the SysfsGPIO driver.])
775 else
776 AC_DEFINE([BUILD_SYSFSGPIO], [0], [0 if you don't want SysfsGPIO driver.])
777 fi
778 #-- Deal with MingW/Cygwin FTD2XX issues
779
780 if test $is_win32 = yes; then
781 if test "${with_ftd2xx_linux_tardir+set}" = set
782 then
783 AC_MSG_ERROR([The option: with_ftd2xx_linux_tardir is for LINUX only.])
784 fi
785
786 if test $build_ft2232_ftd2xx = yes -o $build_presto_ftd2xx = yes -o $build_usb_blaster_ftd2xx = yes -o $build_openjtag_ftd2xx = yes; then
787 AC_MSG_CHECKING([for ftd2xx.lib exists (win32)])
788
789 # if we are given a zipdir...
790 if test "${with_ftd2xx_win32_zipdir+set}" = set
791 then
792 # Set the CFLAGS for "ftd2xx.h"
793 f=$with_ftd2xx_win32_zipdir/ftd2xx.h
794 if test ! -f $f ; then
795 AC_MSG_ERROR([File: $f cannot be found])
796 fi
797 CFLAGS="$CFLAGS -I$with_ftd2xx_win32_zipdir"
798
799 # And calculate the LDFLAGS for the machine
800 case "$host_cpu" in
801 i?86|x86_32)
802 LDFLAGS="$LDFLAGS -L$with_ftd2xx_win32_zipdir/i386"
803 LIBS="$LIBS -lftd2xx"
804 f=$with_ftd2xx_win32_zipdir/i386/ftd2xx.lib
805 ;;
806 amd64|x86_64)
807 LDFLAGS="$LDFLAGS -L$with_ftd2xx_win32_zipdir/amd64"
808 LIBS="$LIBS -lftd2xx"
809 f=$with_ftd2xx_win32_zipdir/amd64/ftd2xx.lib
810 ;;
811 *)
812 AC_MSG_ERROR([Unknown Win32 host cpu: $host_cpu])
813 ;;
814 esac
815 if test ! -f $f ; then
816 AC_MSG_ERROR([Library: $f not found])
817 fi
818 else
819 LIBS="$LIBS -lftd2xx"
820 AC_MSG_WARN([ASSUMPTION: The (win32) FTDICHIP.COM files: ftd2xx.h and ftd2xx.lib are in a proper place])
821 fi
822 fi
823 fi # win32
824
825 if test $is_darwin = yes ; then
826 if test "${with_ftd2xx_win32_zipdir+set}" = set
827 then
828 AC_MSG_ERROR([The option: --with-ftd2xx-win32-zipdir is for win32 only])
829 fi
830 if test "${with_ftd2xx_linux_tardir+set}" = set
831 then
832 AC_MSG_ERROR([The option: with_ftd2xx_linux_tardir is for LINUX only.])
833 fi
834
835 if test $build_ft2232_ftd2xx = yes -o $build_presto_ftd2xx = yes -o $build_usb_blaster_ftd2xx = yes ; then
836 AC_MSG_CHECKING([for libftd2xx.a (darwin)])
837
838 if test ! -f /usr/local/include/ftd2xx.h ; then
839 AC_MSG_ERROR([ftd2xx library from FTDICHIP.com seems to be missing, cannot find: /usr/local/include/ftd2xx.h])
840 fi
841
842 CFLAGS="$CFLAGS -I/usr/local/include"
843 LDFLAGS="$LDFLAGS -L/usr/local/lib"
844 LIBS="$LIBS -lftd2xx"
845 AC_MSG_RESULT([-L/usr/local/lib -lftd2xx])
846 fi
847 fi # darwin
848
849 if test $is_win32 = no && test $is_darwin = no ; then
850
851 if test "${with_ftd2xx_win32_zipdir+set}" = set
852 then
853 AC_MSG_ERROR([The option: --with-ftd2xx-win32-zipdir is for win32 only])
854 fi
855
856 if test $build_ft2232_ftd2xx = yes -o $build_presto_ftd2xx = yes -o $build_usb_blaster_ftd2xx = yes -o $build_openjtag_ftd2xx = yes; then
857 # Must be linux
858 if test $host_os != linux-gnu && test $host_os != linux ; then
859 AC_MSG_ERROR([The (linux) ftd2xx library from FTDICHIP.com is linux only. Try --enable-ft2232-libftdi instead])
860 fi
861 # Are we given a TAR directory?
862 if test "${with_ftd2xx_linux_tardir+set}" = set
863 then
864 AC_MSG_CHECKING([uninstalled ftd2xx distribution])
865 # The .H file is simple..
866 FTD2XX_H=$with_ftd2xx_linux_tardir/ftd2xx.h
867 if test ! -f "${FTD2XX_H}"; then
868 AC_MSG_ERROR([Option: --with-ftd2xx-linux-tardir appears wrong, cannot find: ${FTD2XX_H}])
869 fi
870 CFLAGS="$CFLAGS -I$with_ftd2xx_linux_tardir"
871 if test $with_ftd2xx_lib = shared; then
872 FTD2XX_LDFLAGS="-L$with_ftd2xx_linux_tardir"
873 FTD2XX_LIB="-lftd2xx"
874 else
875 # Test #1 - v1.0.x
876 case "$host_cpu" in
877 i?86|x86_32)
878 dir=build/i386;;
879 amd64|x86_64)
880 dir=build/x86_64;;
881 *)
882 dir=none;;
883 esac
884 if test -f "$with_ftd2xx_linux_tardir/$dir/libftd2xx.a"; then
885 FTD2XX_LDFLAGS="-L$with_ftd2xx_linux_tardir/$dir"
886 # Also needs -lrt
887 FTD2XX_LIB="-lftd2xx -lrt"
888 else
889 # Test Number2.
890 # Grr.. perhaps it exists as a version number?
891 FTD2XX_LIB="$with_ftd2xx_linux_tardir/static_lib/libftd2xx.a.*.*.*"
892 count=`ls ${FTD2XX_LIB} | wc -l`
893 if test $count -gt 1 ; then
894 AC_MSG_ERROR([Multiple libftd2xx.a files found in: $with_ftd2xx_linux_tardir/static_lib sorry cannot handle this yet])
895 fi
896 if test $count -ne 1 ; then
897 AC_MSG_ERROR([Not found: $f, option: --with-ftd2xx-linux-tardir appears to be wrong])
898 fi
899 # Because the "-l" rules do not understand version numbers...
900 # we will just stuff the absolute path onto the LIBS variable
901 FTD2XX_LIB="`ls ${FTD2XX_LIB}` -lpthread"
902 FTD2XX_LDFLAGS=""
903 fi
904 fi
905 LDFLAGS="${LDFLAGS} ${FTD2XX_LDFLAGS}"
906 LIBS="${FTD2XX_LIB} ${LIBS}"
907 AC_MSG_RESULT([${FTD2XX_LDFLAGS} ${FTD2XX_LIB}])
908 else
909 AC_CHECK_HEADER([ftd2xx.h],[],[
910 AC_MSG_ERROR([You seem to be missing the FTD2xx driver header file.])
911 ])
912 AC_SEARCH_LIBS([FT_GetLibraryVersion],[ftd2xx],,[
913 AC_MSG_ERROR([You appear to be missing the FTD2xx driver library.])
914 ],[-lrt -lusb-1.0])
915 fi
916 fi
917 fi # linux
918
919 if test $build_ft2232_ftd2xx = yes -o $build_presto_ftd2xx = yes -o $build_usb_blaster_ftd2xx = yes ; then
920
921 # Before we go any further - make sure we can *BUILD* and *RUN*
922 # a simple app with the "ftd2xx.lib" file - in what ever form we where given
923 # We should be able to compile, link and run this test program now
924 AC_MSG_CHECKING([whether ftd2xx library works])
925
926 #
927 # Save the LDFLAGS for later..
928 LDFLAGS_SAVE=$LDFLAGS
929 CFLAGS_SAVE=$CFLAGS
930 _LDFLAGS=`eval echo $LDFLAGS`
931 _CFLAGS=`eval echo $CFLAGS`
932 LDFLAGS=$_LDFLAGS
933 CFLAGS=$_CFLAGS
934
935 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
936 #include "confdefs.h"
937 #if IS_WIN32
938 #include "windows.h"
939 #endif
940 #include <stdio.h>
941 #include <ftd2xx.h>
942 ]], [[
943 DWORD x;
944 FT_GetLibraryVersion( &x );
945 ]])], [
946 AC_MSG_RESULT([Success!])
947 ], [
948 AC_MSG_ERROR([Cannot build & run test program using ftd2xx.lib])
949 ], [
950 AC_MSG_RESULT([Skipping as we are cross-compiling])
951 ])
952
953 AC_MSG_CHECKING([for ftd2xx highspeed device support])
954 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
955 #include "confdefs.h"
956 #if IS_WIN32
957 #include "windows.h"
958 #endif
959 #include <stdio.h>
960 #include <ftd2xx.h>
961
962 DWORD x = FT_DEVICE_4232H;
963 ]], [])], [
964 AC_DEFINE([BUILD_FT2232_HIGHSPEED], [1],
965 [Support FT2232H/FT4232HS with FTD2XX or libftdi.])
966 build_ft2232_highspeed=yes
967 ], [
968 build_ft2232_highspeed=no
969 ])
970 AC_MSG_RESULT([$build_ft2232_highspeed])
971
972 if test $build_ft2232_highspeed = no; then
973 AC_MSG_WARN([You need a newer FTD2XX driver (version 2.04.16 or later).])
974 fi
975
976 AC_MSG_CHECKING([for ftd2xx FT232H device support])
977 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
978 #include "confdefs.h"
979 #if IS_WIN32
980 #include "windows.h"
981 #endif
982 #include <stdio.h>
983 #include <ftd2xx.h>
984
985 DWORD x = FT_DEVICE_232H;
986 ]], [])], [
987 AC_DEFINE([HAS_ENUM_FT232H], [1],
988 [Support FT232H with FTD2XX or libftdi.])
989 has_enum_ft232h=yes
990 ], [
991 has_enum_ft232h=no
992 ])
993 AC_MSG_RESULT([$has_enum_ft232h])
994
995 if test $has_enum_ft232h = no; then
996 AC_MSG_WARN([You need a newer FTD2XX driver (version 2.08.12 or later).])
997 fi
998
999 LDFLAGS=$LDFLAGS_SAVE
1000 CFLAGS=$CFLAGS_SAVE
1001 fi
1002
1003 if test $build_ft2232_libftdi = yes -o $build_usb_blaster_libftdi = yes -o \
1004 $build_openjtag_ftdi = yes; then
1005
1006 # we can have libftdi or libftdi1, so check it and use the latest one
1007 PKG_CHECK_MODULES([LIBFTDI], [libftdi1], [use_libftdi=yes], [use_libftdi=no])
1008 if test $use_libftdi = no; then
1009 PKG_CHECK_MODULES([LIBFTDI], [libftdi], [use_libftdi=yes], [use_libftdi=no])
1010 fi
1011 if test $use_libftdi = no; then
1012 AC_MSG_ERROR([The libftdi driver is not present on your system.])
1013 fi
1014
1015 #
1016 # Try to build a small program.
1017 AC_MSG_CHECKING([Build & Link with libftdi...])
1018
1019 LDFLAGS_SAVE=$LDFLAGS
1020 CFLAGS_SAVE=$CFLAGS
1021 LIBS_SAVE=$LIBS
1022 _LDFLAGS=`eval echo $LDFLAGS`
1023 _CFLAGS=`eval echo $CFLAGS`
1024 _LIBS=`eval echo $LIBS`
1025 LDFLAGS=$_LDFLAGS
1026 CFLAGS="$_CFLAGS $LIBFTDI_CFLAGS"
1027 LIBS="$_LIBS $LIBFTDI_LIBS"
1028
1029 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
1030 #include <stdio.h>
1031 #include <ftdi.h>
1032 ]], [[
1033 struct ftdi_context *p;
1034 p = ftdi_new();
1035 if( p != NULL ){
1036 return 0;
1037 } else {
1038 fprintf( stderr, "calling ftdi_new() failed\n");
1039 return 1;
1040 }
1041 ]])], [
1042 AC_MSG_RESULT([Success])
1043 ], [
1044 AC_MSG_ERROR([Cannot build & run test program using libftdi])
1045 ], [
1046 AC_MSG_RESULT([Skipping as we are cross-compiling, trying build only])
1047 AC_SEARCH_LIBS([ftdi_new], [], [], [AC_MSG_ERROR([Cannot link with libftdi])])
1048 ])
1049
1050 AC_MSG_CHECKING([for libftdi highspeed device support])
1051 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1052 #include <stdio.h>
1053 #include <ftdi.h>
1054 ]], [[
1055 enum ftdi_chip_type x = TYPE_2232H;
1056 ]])], [
1057 AC_DEFINE([BUILD_FT2232_HIGHSPEED], [1],
1058 [Support FT2232H/FT4232HS with FTD2XX or libftdi.])
1059 build_ft2232_highspeed=yes
1060 ], [
1061 build_ft2232_highspeed=no
1062 ])
1063 AC_MSG_RESULT([$build_ft2232_highspeed])
1064
1065 if test $build_ft2232_highspeed = no; then
1066 AC_MSG_WARN([You need a newer libftdi version (0.16 or later).])
1067 fi
1068
1069 AC_MSG_CHECKING([for libftdi FT232H device support])
1070 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1071 #include <stdio.h>
1072 #include <ftdi.h>
1073 ]], [[
1074 enum ftdi_chip_type x = TYPE_232H;
1075 ]])], [
1076 AC_DEFINE([HAS_ENUM_FT232H], [1],
1077 [Support FT232H with FTD2XX or libftdi.])
1078 has_enum_ft232h=yes
1079 ], [
1080 has_enum_ft232h=no
1081 ])
1082 AC_MSG_RESULT([$has_enum_ft232h])
1083
1084 if test $has_enum_ft232h = no; then
1085 AC_MSG_WARN([You need a newer libftdi version (0.20 or later).])
1086 fi
1087
1088 # Restore the 'unexpanded ldflags'
1089 LDFLAGS=$LDFLAGS_SAVE
1090 CFLAGS=$CFLAGS_SAVE
1091 LIBS=$LIBS_SAVE
1092 fi
1093
1094 PKG_CHECK_MODULES([LIBUSB1], [libusb-1.0], [
1095 use_libusb1=yes
1096 AC_DEFINE([HAVE_LIBUSB1], [1], [Define if you have libusb-1.x])
1097 PKG_CHECK_EXISTS([libusb-1.0 >= 1.0.9],
1098 [AC_DEFINE([HAVE_LIBUSB_ERROR_NAME], [1], [Define if your libusb has libusb_error_name()])],
1099 [AC_MSG_WARN([libusb-1.x older than 1.0.9 detected, consider updating])])
1100 LIBUSB1_CFLAGS=`echo $LIBUSB1_CFLAGS | sed 's/-I/-isystem /'`
1101 AC_MSG_NOTICE([libusb-1.0 header bug workaround: LIBUSB1_CFLAGS changed to "$LIBUSB1_CFLAGS"])
1102 ], [
1103 use_libusb1=no
1104 AC_MSG_WARN([libusb-1.x not found, trying legacy libusb-0.1 as a fallback; consider installing libusb-1.x instead])
1105 ])
1106
1107 PKG_CHECK_MODULES([LIBUSB0], [libusb], [use_libusb0=yes], [use_libusb0=no])
1108
1109 for hidapi_lib in hidapi hidapi-hidraw hidapi-libusb; do
1110 PKG_CHECK_MODULES([HIDAPI],[$hidapi_lib],[
1111 use_hidapi=yes
1112 break
1113 ],[
1114 use_hidapi=no
1115 ])
1116 done
1117
1118 m4_define([PROCESS_ADAPTERS], [
1119 m4_foreach([adapter], [$1], [
1120 if test $2; then
1121 if test $ADAPTER_VAR([adapter]) != no; then
1122 AC_DEFINE([BUILD_]ADAPTER_SYM([adapter]), [1], [1 if you want the ]ADAPTER_DESC([adapter]).)
1123 else
1124 AC_DEFINE([BUILD_]ADAPTER_SYM([adapter]), [0], [0 if you do not want the ]ADAPTER_DESC([adapter]).)
1125 fi
1126 else
1127 if test $ADAPTER_VAR([adapter]) = yes; then
1128 AC_MSG_ERROR([$3 is required for the ADAPTER_DESC([adapter])])
1129 fi
1130 ADAPTER_VAR([adapter])=no
1131 fi
1132 AM_CONDITIONAL(ADAPTER_SYM([adapter]), [test $ADAPTER_VAR([adapter]) != no])
1133 ])
1134 ])
1135
1136 PROCESS_ADAPTERS([USB1_ADAPTERS], [$use_libusb1 = yes], [libusb-1.x])
1137 PROCESS_ADAPTERS([USB_ADAPTERS], [$use_libusb1 = yes -o $use_libusb0 = yes], [libusb-1.x or libusb-0.1])
1138 PROCESS_ADAPTERS([USB0_ADAPTERS], [$use_libusb0 = yes], [libusb-0.1])
1139 PROCESS_ADAPTERS([HIDAPI_ADAPTERS], [$use_hidapi = yes], [hidapi])
1140
1141 if test $enable_stlink != no -o $enable_ti_icdi != no; then
1142 AC_DEFINE([BUILD_HLADAPTER], [1], [1 if you want the High Level JTAG driver.])
1143 else
1144 AC_DEFINE([BUILD_HLADAPTER], [0], [0 if you want the High Level JTAG driver.])
1145 fi
1146 AM_CONDITIONAL([HLADAPTER], [test $enable_stlink != no -o $enable_ti_icdi != no])
1147
1148 AM_CONDITIONAL([RELEASE], [test $build_release = yes])
1149 AM_CONDITIONAL([PARPORT], [test $build_parport = yes])
1150 AM_CONDITIONAL([DUMMY], [test $build_dummy = yes])
1151 AM_CONDITIONAL([GIVEIO], [test x$parport_use_giveio = xyes])
1152 AM_CONDITIONAL([EP93XX], [test $build_ep93xx = yes])
1153 AM_CONDITIONAL([ZY1000], [test $build_zy1000 = yes])
1154 AM_CONDITIONAL([ZY1000_MASTER], [test $build_zy1000_master = yes])
1155 AM_CONDITIONAL([IOUTIL], [test $build_ioutil = yes])
1156 AM_CONDITIONAL([AT91RM9200], [test $build_at91rm9200 = yes])
1157 AM_CONDITIONAL([BCM2835GPIO], [test $build_bcm2835gpio = yes])
1158 AM_CONDITIONAL([BITBANG], [test $build_bitbang = yes])
1159 AM_CONDITIONAL([FT2232_LIBFTDI], [test $build_ft2232_libftdi = yes])
1160 AM_CONDITIONAL([FT2232_DRIVER], [test $build_ft2232_ftd2xx = yes -o $build_ft2232_libftdi = yes])
1161 AM_CONDITIONAL([USB_BLASTER_LIBFTDI], [test $build_usb_blaster_libftdi = yes])
1162 AM_CONDITIONAL([USB_BLASTER_FTD2XX], [test $build_usb_blaster_ftd2xx = yes])
1163 AM_CONDITIONAL([JTAG_VPI], [test $build_jtag_vpi = yes -o $build_jtag_vpi = yes])
1164 AM_CONDITIONAL([USB_BLASTER_DRIVER], [test $build_usb_blaster_ftd2xx = yes -o $build_usb_blaster_libftdi = yes])
1165 AM_CONDITIONAL([AMTJTAGACCEL], [test $build_amtjtagaccel = yes])
1166 AM_CONDITIONAL([GW16012], [test $build_gw16012 = yes])
1167 AM_CONDITIONAL([PRESTO_LIBFTDI], [test $build_presto_libftdi = yes])
1168 AM_CONDITIONAL([PRESTO_DRIVER], [test $build_presto_ftd2xx = yes -o $build_presto_libftdi = yes])
1169 AM_CONDITIONAL([OPENJTAG], [test $build_openjtag_ftd2xx = yes -o $build_openjtag_ftdi = yes])
1170 AM_CONDITIONAL([OOCD_TRACE], [test $build_oocd_trace = yes])
1171 AM_CONDITIONAL([REMOTE_BITBANG], [test $build_remote_bitbang = yes])
1172 AM_CONDITIONAL([BUSPIRATE], [test $build_buspirate = yes])
1173 AM_CONDITIONAL([SYSFSGPIO], [test $build_sysfsgpio = yes])
1174 AM_CONDITIONAL([USE_LIBUSB0], [test $use_libusb0 = yes])
1175 AM_CONDITIONAL([USE_LIBUSB1], [test $use_libusb1 = yes])
1176 AM_CONDITIONAL([IS_CYGWIN], [test $is_cygwin = yes])
1177 AM_CONDITIONAL([IS_MINGW], [test $is_mingw = yes])
1178 AM_CONDITIONAL([IS_WIN32], [test $is_win32 = yes])
1179 AM_CONDITIONAL([IS_DARWIN], [test $is_darwin = yes])
1180 AM_CONDITIONAL([BITQ], [test $build_bitq = yes])
1181 AM_CONDITIONAL([CMSIS_DAP], [test $use_hidapi = yes])
1182
1183 AM_CONDITIONAL([MINIDRIVER], [test $build_minidriver = yes])
1184 AM_CONDITIONAL([MINIDRIVER_DUMMY], [test $build_minidriver_dummy = yes])
1185
1186 AM_CONDITIONAL([INTERNAL_JIMTCL], [test $use_internal_jimtcl = yes])
1187
1188 # Look for environ alternatives. Possibility #1: is environ in unistd.h or stdlib.h?
1189 AC_MSG_CHECKING([for environ in unistd.h and stdlib.h])
1190 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1191 #define _GNU_SOURCE
1192 #include <unistd.h>
1193 #include <stdlib.h>
1194 ]], [[char **ep = environ;]]
1195 )], [
1196 AC_MSG_RESULT([yes])
1197 has_environ=yes
1198 ], [
1199 AC_MSG_RESULT([no])
1200
1201 # Possibility #2: can environ be found in an available library?
1202 AC_MSG_CHECKING([for extern environ])
1203 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1204 extern char **environ;
1205 ]], [[char **ep = environ;]]
1206 )], [
1207 AC_DEFINE(NEED_ENVIRON_EXTERN, [1], [Must declare 'environ' to use it.])
1208 has_environ=yes
1209 ], [
1210 has_environ=no
1211 ])
1212 AC_MSG_RESULT([${has_environ}])
1213 ])
1214
1215 if test "${has_environ}" != "yes" ; then
1216 AC_MSG_FAILURE([Could not find 'environ' in unistd.h or available libraries.])
1217 fi
1218
1219 AC_DEFINE([_GNU_SOURCE],[1],[Use GNU C library extensions (e.g. stdndup).])
1220
1221 # set default gcc warnings
1222 GCC_WARNINGS="-Wall -Wstrict-prototypes -Wformat-security -Wshadow"
1223 if test "${gcc_wextra}" = yes; then
1224 GCC_WARNINGS="${GCC_WARNINGS} -Wextra -Wno-unused-parameter"
1225 GCC_WARNINGS="${GCC_WARNINGS} -Wbad-function-cast"
1226 GCC_WARNINGS="${GCC_WARNINGS} -Wcast-align"
1227 GCC_WARNINGS="${GCC_WARNINGS} -Wredundant-decls"
1228 fi
1229 if test "${gcc_werror}" = yes; then
1230 GCC_WARNINGS="${GCC_WARNINGS} -Werror"
1231 fi
1232
1233 # overide default gcc cflags
1234 if test $gcc_warnings = yes; then
1235 CFLAGS="$CFLAGS $GCC_WARNINGS"
1236 fi
1237
1238 # Setup for compiling build tools
1239 AC_MSG_CHECKING([for a C compiler for build tools])
1240 if test $cross_compiling = yes; then
1241 AC_CHECK_PROGS(CC_FOR_BUILD, gcc cc)
1242 CFLAGS_FOR_BUILD="-g -O2 $GCC_WARNINGS"
1243 else
1244 CC_FOR_BUILD=$CC
1245 CFLAGS_FOR_BUILD=$CFLAGS
1246 fi
1247
1248 AC_MSG_RESULT([$CC_FOR_BUILD])
1249 AC_SUBST([CC_FOR_BUILD])
1250 AC_SUBST([CFLAGS_FOR_BUILD])
1251
1252 AC_MSG_CHECKING([for suffix of executable build tools])
1253 if test $cross_compiling = yes; then
1254 cat >conftest.c <<\_______EOF
1255 int main ()
1256 {
1257 exit (0);
1258 }
1259 _______EOF
1260 for i in .exe ""; do
1261 compile="$CC_FOR_BUILD conftest.c -o conftest$i"
1262 if AC_TRY_EVAL(compile); then
1263 if (./conftest) 2>&AC_FD_CC; then
1264 EXEEXT_FOR_BUILD=$i
1265 break
1266 fi
1267 fi
1268 done
1269 rm -f conftest*
1270 if test "${EXEEXT_FOR_BUILD+set}" != set; then
1271 AC_MSG_ERROR([Cannot determine suffix of executable build tools])
1272 fi
1273 else
1274 EXEEXT_FOR_BUILD=$EXEEXT
1275 fi
1276 AC_MSG_RESULT([$EXEEXT_FOR_BUILD])
1277 AC_SUBST([EXEEXT_FOR_BUILD])
1278
1279 AC_CONFIG_FILES([
1280 Makefile
1281 src/Makefile
1282 src/helper/Makefile
1283 src/jtag/Makefile
1284 src/jtag/drivers/Makefile
1285 src/jtag/drivers/usb_blaster/Makefile
1286 src/jtag/hla/Makefile
1287 src/jtag/aice/Makefile
1288 src/transport/Makefile
1289 src/target/openrisc/Makefile
1290 src/xsvf/Makefile
1291 src/svf/Makefile
1292 src/target/Makefile
1293 src/rtos/Makefile
1294 src/server/Makefile
1295 src/flash/Makefile
1296 src/flash/nor/Makefile
1297 src/flash/nand/Makefile
1298 src/pld/Makefile
1299 doc/Makefile
1300 ])
1301 AC_OUTPUT
1302
1303 echo
1304 echo
1305 echo OpenOCD configuration summary
1306 echo --------------------------------------------------
1307 m4_foreach([adapter], [USB1_ADAPTERS, USB_ADAPTERS, USB0_ADAPTERS, HIDAPI_ADAPTERS],
1308 [echo -n m4_format(["%-40s"], ADAPTER_DESC([adapter]))
1309 case $ADAPTER_VAR([adapter]) in
1310 auto)
1311 echo yes '(auto)'
1312 ;;
1313 yes)
1314 echo yes
1315 ;;
1316 no)
1317 echo no
1318 ;;
1319 esac
1320 ])
1321 echo

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)