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

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)