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