a47a18417a6708af833e183b06f0aaf422eb9252
[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 # Adapter drivers
163 # 1st column -- configure option
164 # 2nd column -- description
165 # 3rd column -- symbol used for both config.h and automake
166 m4_define([ADAPTER_ARG], [m4_argn([1], $1)])
167 m4_define([ADAPTER_DESC], [m4_argn([2], $1)])
168 m4_define([ADAPTER_SYM], [m4_argn([3], $1)])
169 m4_define([ADAPTER_VAR], [enable_[]ADAPTER_ARG($1)])
170 m4_define([ADAPTER_OPT], [m4_translit(ADAPTER_ARG($1), [_], [-])])
171
172 m4_define([USB1_ADAPTERS],
173 [[[ftdi], [MPSSE mode of FTDI based devices], [FTDI]],
174 [[stlink], [ST-Link JTAG Programmer], [HLADAPTER_STLINK]],
175 [[ti_icdi], [TI ICDI JTAG Programmer], [HLADAPTER_ICDI]],
176 [[ulink], [Keil ULINK JTAG Programmer], [ULINK]],
177 [[usb_blaster_2], [Altera USB-Blaster II Compatible], [USB_BLASTER_2]],
178 [[vsllink], [Versaloon-Link JTAG Programmer], [VSLLINK]]])
179
180 m4_define([USB_ADAPTERS],
181 [[[osbdm], [OSBDM (JTAG only) Programmer], [OSBDM]],
182 [[opendous], [eStick/opendous JTAG Programmer], [OPENDOUS]],
183 [[aice], [Andes JTAG Programmer], [AICE]]])
184
185 m4_define([USB0_ADAPTERS],
186 [[[usbprog], [USBProg JTAG Programmer], [USBPROG]],
187 [[rlink], [Raisonance RLink JTAG Programmer], [RLINK]],
188 [[armjtagew], [Olimex ARM-JTAG-EW Programmer], [ARMJTAGEW]]])
189
190 m4_define([HIDAPI_ADAPTERS],
191 [[[cmsis_dap], [CMSIS-DAP Compliant Debugger], [CMSIS_DAP]]])
192
193 m4_define([LIBJAYLINK_ADAPTERS],
194 [[[jlink], [SEGGER J-Link Programmer], [JLINK]]])
195
196
197 AC_ARG_ENABLE([doxygen-html],
198 AS_HELP_STRING([--disable-doxygen-html],
199 [Disable building Doxygen manual as HTML.]),
200 [doxygen_as_html=$enableval], [doxygen_as_html=yes])
201 AC_SUBST([doxygen_as_html])
202 AC_MSG_CHECKING([whether to build Doxygen as HTML])
203 AC_MSG_RESULT([$doxygen_as_html])
204
205 AC_ARG_ENABLE([doxygen-pdf],
206 AS_HELP_STRING([--enable-doxygen-pdf],
207 [Enable building Doxygen manual as PDF.]),
208 [doxygen_as_pdf=$enableval], [doxygen_as_pdf=no])
209 AC_SUBST([doxygen_as_pdf])
210 AC_MSG_CHECKING([whether to build Doxygen as PDF])
211 AC_MSG_RESULT([$doxygen_as_pdf])
212
213 AC_ARG_ENABLE([gccwarnings],
214 AS_HELP_STRING([--disable-gccwarnings], [Disable compiler warnings]),
215 [gcc_warnings=$enableval], [gcc_warnings=yes])
216
217 AC_ARG_ENABLE([wextra],
218 AS_HELP_STRING([--disable-wextra], [Disable extra compiler warnings]),
219 [gcc_wextra=$enableval], [gcc_wextra=$gcc_warnings])
220
221 AC_ARG_ENABLE([werror],
222 AS_HELP_STRING([--disable-werror], [Do not treat warnings as errors]),
223 [gcc_werror=$enableval], [gcc_werror=$gcc_warnings])
224
225 # set default verbose options, overridden by following options
226 debug_jtag_io=no
227 debug_usb_io=no
228 debug_usb_comms=no
229
230 AC_ARG_ENABLE([verbose],
231 AS_HELP_STRING([--enable-verbose],
232 [Enable verbose JTAG I/O messages (for debugging).]),
233 [
234 debug_jtag_io=$enableval
235 debug_usb_io=$enableval
236 debug_usb_comms=$enableval
237 ], [])
238
239 AC_ARG_ENABLE([verbose_jtag_io],
240 AS_HELP_STRING([--enable-verbose-jtag-io],
241 [Enable verbose JTAG I/O messages (for debugging).]),
242 [debug_jtag_io=$enableval], [])
243
244 AC_ARG_ENABLE([verbose_usb_io],
245 AS_HELP_STRING([--enable-verbose-usb-io],
246 [Enable verbose USB I/O messages (for debugging)]),
247 [debug_usb_io=$enableval], [])
248
249 AC_ARG_ENABLE([verbose_usb_comms],
250 AS_HELP_STRING([--enable-verbose-usb-comms],
251 [Enable verbose USB communication messages (for debugging)]),
252 [debug_usb_comms=$enableval], [])
253
254 AC_MSG_CHECKING([whether to enable verbose JTAG I/O messages]);
255 AC_MSG_RESULT([$debug_jtag_io])
256 if test $debug_jtag_io = yes; then
257 AC_DEFINE([_DEBUG_JTAG_IO_],[1], [Print verbose JTAG I/O messages])
258 fi
259
260 AC_MSG_CHECKING([whether to enable verbose USB I/O messages]);
261 AC_MSG_RESULT([$debug_usb_io])
262 if test $debug_usb_io = yes; then
263 AC_DEFINE([_DEBUG_USB_IO_],[1], [Print verbose USB I/O messages])
264 fi
265
266 AC_MSG_CHECKING([whether to enable verbose USB communication messages]);
267 AC_MSG_RESULT([$debug_usb_comms])
268 if test $debug_usb_comms = yes; then
269 AC_DEFINE([_DEBUG_USB_COMMS_],[1], [Print verbose USB communication messages])
270 fi
271
272 debug_malloc=no
273 AC_ARG_ENABLE([malloc_logging],
274 AS_HELP_STRING([--enable-malloc-logging],
275 [Include free space in logging messages (requires malloc.h).]),
276 [debug_malloc=$enableval], [])
277
278 AC_MSG_CHECKING([whether to enable malloc free space logging]);
279 AC_MSG_RESULT([$debug_malloc])
280 if test $debug_malloc = yes; then
281 AC_DEFINE([_DEBUG_FREE_SPACE_],[1], [Include malloc free space in logging])
282 fi
283
284 AC_ARG_ENABLE([dummy],
285 AS_HELP_STRING([--enable-dummy], [Enable building the dummy port driver]),
286 [build_dummy=$enableval], [build_dummy=no])
287
288 m4_define([AC_ARG_ADAPTERS], [
289 m4_foreach([adapter], [$1],
290 [AC_ARG_ENABLE(ADAPTER_OPT([adapter]),
291 AS_HELP_STRING([--enable-ADAPTER_OPT([adapter])],
292 [Enable building support for the ]ADAPTER_DESC([adapter])[ (default is $2)]),
293 [], [ADAPTER_VAR([adapter])=$2])
294 ])
295 ])
296
297 AC_ARG_ADAPTERS([USB1_ADAPTERS, USB_ADAPTERS, USB0_ADAPTERS, HIDAPI_ADAPTERS, LIBJAYLINK_ADAPTERS], [auto])
298
299 AC_ARG_ENABLE([parport],
300 AS_HELP_STRING([--enable-parport], [Enable building the pc parallel port driver]),
301 [build_parport=$enableval], [build_parport=no])
302
303 AC_ARG_ENABLE([parport_ppdev],
304 AS_HELP_STRING([--disable-parport-ppdev],
305 [Disable use of ppdev (/dev/parportN) for parport (for x86 only)]),
306 [parport_use_ppdev=$enableval], [parport_use_ppdev=yes])
307
308 AC_ARG_ENABLE([parport_giveio],
309 AS_HELP_STRING([--enable-parport-giveio],
310 [Enable use of giveio for parport (for CygWin only)]),
311 [parport_use_giveio=$enableval], [parport_use_giveio=])
312
313 AC_ARG_ENABLE([jtag_vpi],
314 AS_HELP_STRING([--enable-jtag_vpi], [Enable building support for JTAG VPI]),
315 [build_jtag_vpi=$enableval], [build_jtag_vpi=no])
316
317 AC_ARG_ENABLE([usb_blaster_libftdi],
318 AS_HELP_STRING([--enable-usb_blaster_libftdi], [Enable building support for the Altera USB-Blaster using the libftdi driver]),
319 [build_usb_blaster=$enableval], [build_usb_blaster=no])
320
321 AC_ARG_ENABLE([amtjtagaccel],
322 AS_HELP_STRING([--enable-amtjtagaccel], [Enable building the Amontec JTAG-Accelerator driver]),
323 [build_amtjtagaccel=$enableval], [build_amtjtagaccel=no])
324
325 AC_ARG_ENABLE([zy1000_master],
326 AS_HELP_STRING([--enable-zy1000-master], [Use ZY1000 JTAG master registers]),
327 [build_zy1000_master=$enableval], [build_zy1000_master=no])
328
329 AC_ARG_ENABLE([zy1000],
330 AS_HELP_STRING([--enable-zy1000], [Enable ZY1000 interface]),
331 [build_zy1000=$enableval], [build_zy1000=no])
332
333 AC_ARG_ENABLE([ioutil],
334 AS_HELP_STRING([--enable-ioutil], [Enable ioutil functions - useful for standalone OpenOCD implementations]),
335 [build_ioutil=$enableval], [build_ioutil=no])
336
337 case "${host_cpu}" in
338 arm*)
339 AC_ARG_ENABLE([ep93xx],
340 AS_HELP_STRING([--enable-ep93xx], [Enable building support for EP93xx based SBCs]),
341 [build_ep93xx=$enableval], [build_ep93xx=no])
342
343 AC_ARG_ENABLE([at91rm9200],
344 AS_HELP_STRING([--enable-at91rm9200], [Enable building support for AT91RM9200 based SBCs]),
345 [build_at91rm9200=$enableval], [build_at91rm9200=no])
346
347 AC_ARG_ENABLE([bcm2835gpio],
348 AS_HELP_STRING([--enable-bcm2835gpio], [Enable building support for bitbanging on BCM2835 (as found in Raspberry Pi)]),
349 [build_bcm2835gpio=$enableval], [build_bcm2835gpio=no])
350 ;;
351
352 *)
353 build_ep93xx=no
354 build_at91rm9200=no
355 build_bcm2835gpio=no
356 ;;
357 esac
358
359 AC_ARG_ENABLE([gw16012],
360 AS_HELP_STRING([--enable-gw16012], [Enable building support for the Gateworks GW16012 JTAG Programmer]),
361 [build_gw16012=$enableval], [build_gw16012=no])
362
363 AC_ARG_ENABLE([presto_libftdi],
364 AS_HELP_STRING([--enable-presto_libftdi], [Enable building support for ASIX Presto Programmer using the libftdi library]),
365 [build_presto=$enableval], [build_presto=no])
366
367 AC_ARG_ENABLE([openjtag_ftdi],
368 AS_HELP_STRING([--enable-openjtag_ftdi], [Enable building support for the OpenJTAG Programmer with libftdi library]),
369 [build_openjtag=$enableval], [build_openjtag=no])
370
371 AC_ARG_ENABLE([oocd_trace],
372 AS_HELP_STRING([--enable-oocd_trace],
373 [Enable building support for some prototype OpenOCD+trace ETM capture hardware]),
374 [build_oocd_trace=$enableval], [build_oocd_trace=no])
375
376 AC_ARG_ENABLE([buspirate],
377 AS_HELP_STRING([--enable-buspirate], [Enable building support for the Buspirate]),
378 [build_buspirate=$enableval], [build_buspirate=no])
379
380 AC_ARG_ENABLE([sysfsgpio],
381 AS_HELP_STRING([--enable-sysfsgpio], [Enable building support for programming driven via sysfs gpios.]),
382 [build_sysfsgpio=$enableval], [build_sysfsgpio=no])
383
384 AC_ARG_ENABLE([minidriver_dummy],
385 AS_HELP_STRING([--enable-minidriver-dummy], [Enable the dummy minidriver.]),
386 [build_minidriver_dummy=$enableval], [build_minidriver_dummy=no])
387
388 AC_ARG_ENABLE([internal-jimtcl],
389 AS_HELP_STRING([--disable-internal-jimtcl], [Disable building internal jimtcl]),
390 [use_internal_jimtcl=$enableval], [use_internal_jimtcl=yes])
391
392 AC_ARG_ENABLE([internal-libjaylink],
393 AS_HELP_STRING([--disable-internal-libjaylink],
394 [Disable building internal libjaylink]),
395 [use_internal_libjaylink=$enableval], [use_internal_libjaylink=yes])
396
397 build_minidriver=no
398 AC_MSG_CHECKING([whether to enable ZY1000 minidriver])
399 if test $build_zy1000 = yes; then
400 if test $build_minidriver = yes; then
401 AC_MSG_ERROR([Multiple minidriver options have been enabled.])
402 fi
403 AC_DEFINE([HAVE_JTAG_MINIDRIVER_H], [1],
404 [Define to 1 if you have the <jtag_minidriver.h> header file.])
405 build_minidriver=yes
406 fi
407 AC_MSG_RESULT([$build_zy1000])
408
409 AC_ARG_ENABLE([remote-bitbang],
410 AS_HELP_STRING([--enable-remote-bitbang], [Enable building support for the Remote Bitbang jtag driver]),
411 [build_remote_bitbang=$enableval], [build_remote_bitbang=no])
412
413 AC_MSG_CHECKING([whether to enable dummy minidriver])
414 if test $build_minidriver_dummy = yes; then
415 if test $build_minidriver = yes; then
416 AC_MSG_ERROR([Multiple minidriver options have been enabled.])
417 fi
418 build_minidriver=yes
419 AC_DEFINE([BUILD_MINIDRIVER_DUMMY], [1], [Use the dummy minidriver.])
420 AC_DEFINE([HAVE_JTAG_MINIDRIVER_H], [1],
421 [Define to 1 if you have the <jtag_minidriver.h> header file.])
422 fi
423 AC_MSG_RESULT([$build_minidriver_dummy])
424
425 AC_MSG_CHECKING([whether standard drivers can be built])
426 if test "$build_minidriver" = yes; then
427 AC_MSG_RESULT([no])
428 AC_MSG_WARN([Using the minidriver disables all other drivers.])
429 sleep 2
430 else
431 AC_MSG_RESULT([yes])
432 fi
433
434 case "${host_cpu}" in
435 i?86|x86*)
436 ;;
437 *)
438 if test x$parport_use_ppdev = xno; then
439 AC_MSG_WARN([--disable-parport-ppdev is not supported by the host CPU])
440 fi
441 parport_use_ppdev=yes
442 ;;
443 esac
444
445 case $host in
446 *-cygwin*)
447 is_win32=yes
448 parport_use_ppdev=no
449
450 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[return __MINGW32__;]])],
451 [is_mingw=yes],[is_mingw=no])
452 if test $is_mingw = yes; then
453 AC_DEFINE([IS_MINGW], [1], [1 if building for MinGW.])
454 if test x$parport_use_giveio = xno; then
455 AC_MSG_WARN([--disable-parport-giveio is not supported by MinGW32 hosts])
456 fi
457 parport_use_giveio=yes
458 is_cygwin=no
459 else
460 is_cygwin=yes
461 AC_DEFINE([IS_CYGWIN], [1], [1 if building for Cygwin.])
462 # sys/io.h needed under cygwin for parport access
463 if test $build_parport = yes; then
464 AC_CHECK_HEADERS([sys/io.h],[],AC_MSG_ERROR([Please install the cygwin ioperm package]))
465 fi
466 fi
467
468 AC_DEFINE([IS_WIN32], [1], [1 if building for Win32.])
469 AC_DEFINE([IS_DARWIN], [0], [0 if not building for Darwin.])
470 ;;
471 *-mingw* | *-msys*)
472 is_mingw=yes
473 is_win32=yes
474 parport_use_ppdev=no
475
476 if test x$parport_use_giveio = xno; then
477 AC_MSG_WARN([--disable-parport-giveio is not supported by MinGW32 hosts])
478 fi
479 parport_use_giveio=yes
480
481 if test x$build_buspirate = xyes; then
482 AC_MSG_ERROR([buspirate currently not supported by MinGW32 hosts])
483 fi
484
485 CFLAGS="$CFLAGS -D__USE_MINGW_ANSI_STDIO"
486
487 AC_DEFINE([IS_MINGW], [1], [1 if building for MinGW.])
488 AC_DEFINE([IS_WIN32], [1], [1 if building for Win32.])
489 AC_DEFINE([IS_DARWIN], [0], [0 if not building for Darwin.])
490 ;;
491 *darwin*)
492 is_darwin=yes
493
494 if test x$parport_use_giveio = xyes; then
495 AC_MSG_WARN([--enable-parport-giveio cannot be used by Darwin hosts])
496 fi
497 parport_use_giveio=no
498
499 AC_DEFINE([IS_CYGWIN], [0], [0 if not building for Cygwin.])
500 AC_DEFINE([IS_WIN32], [0], [0 if not building for Win32.])
501 AC_DEFINE([IS_DARWIN], [1], [1 if building for Darwin.])
502 ;;
503 *)
504 if test x$parport_use_giveio = xyes; then
505 AC_MSG_WARN([--enable-parport-giveio cannot be used by ]$host[ hosts])
506 fi
507 parport_use_giveio=no
508 AC_DEFINE([IS_CYGWIN], [0], [0 if not building for Cygwin.])
509 AC_DEFINE([IS_WIN32], [0], [0 if not building for Win32.])
510 AC_DEFINE([IS_DARWIN], [0], [0 if not building for Darwin.])
511 ;;
512 esac
513
514 if test $is_win32 = yes; then
515 AC_DEFINE([WIN32_LEAN_AND_MEAN], [1], [1 to exclude old conflicting definitions when building on Windows])
516 fi
517
518 if test $build_parport = yes; then
519 build_bitbang=yes
520 AC_DEFINE([BUILD_PARPORT], [1], [1 if you want parport.])
521 else
522 AC_DEFINE([BUILD_PARPORT], [0], [0 if you don't want parport.])
523 fi
524
525 if test $build_dummy = yes; then
526 build_bitbang=yes
527 AC_DEFINE([BUILD_DUMMY], [1], [1 if you want dummy driver.])
528 else
529 AC_DEFINE([BUILD_DUMMY], [0], [0 if you don't want dummy driver.])
530 fi
531
532 if test $build_ep93xx = yes; then
533 build_bitbang=yes
534 AC_DEFINE([BUILD_EP93XX], [1], [1 if you want ep93xx.])
535 else
536 AC_DEFINE([BUILD_EP93XX], [0], [0 if you don't want ep93xx.])
537 fi
538
539 if test $build_zy1000 = yes; then
540 AC_DEFINE([BUILD_ZY1000], [1], [1 if you want ZY1000.])
541 else
542 AC_DEFINE([BUILD_ZY1000], [0], [0 if you don't want ZY1000.])
543 fi
544
545 if test $build_zy1000_master = yes; then
546 AC_DEFINE([BUILD_ZY1000_MASTER], [1], [1 if you want ZY1000 JTAG master registers.])
547 else
548 AC_DEFINE([BUILD_ZY1000_MASTER], [0], [0 if you don't want ZY1000 JTAG master registers.])
549 fi
550
551 if test $build_at91rm9200 = yes; then
552 build_bitbang=yes
553 AC_DEFINE([BUILD_AT91RM9200], [1], [1 if you want at91rm9200.])
554 else
555 AC_DEFINE([BUILD_AT91RM9200], [0], [0 if you don't want at91rm9200.])
556 fi
557
558 if test $build_bcm2835gpio = yes; then
559 build_bitbang=yes
560 AC_DEFINE([BUILD_BCM2835GPIO], [1], [1 if you want bcm2835gpio.])
561 else
562 AC_DEFINE([BUILD_BCM2835GPIO], [0], [0 if you don't want bcm2835gpio.])
563 fi
564
565 if test x$parport_use_ppdev = xyes; then
566 AC_DEFINE([PARPORT_USE_PPDEV], [1], [1 if you want parport to use ppdev.])
567 else
568 AC_DEFINE([PARPORT_USE_PPDEV], [0], [0 if you don't want parport to use ppdev.])
569 fi
570
571 if test x$parport_use_giveio = xyes; then
572 AC_DEFINE([PARPORT_USE_GIVEIO], [1], [1 if you want parport to use giveio.])
573 else
574 AC_DEFINE([PARPORT_USE_GIVEIO], [0], [0 if you don't want parport to use giveio.])
575 fi
576
577 if test $build_bitbang = yes; then
578 AC_DEFINE([BUILD_BITBANG], [1], [1 if you want a bitbang interface.])
579 else
580 AC_DEFINE([BUILD_BITBANG], [0], [0 if you don't want a bitbang interface.])
581 fi
582
583 if test $build_usb_blaster = yes; then
584 AC_DEFINE([BUILD_USB_BLASTER], [1], [1 if you want libftdi usb_blaster.])
585 else
586 AC_DEFINE([BUILD_USB_BLASTER], [0], [0 if you don't want libftdi usb_blaster.])
587 fi
588
589 if test $build_jtag_vpi = yes; then
590 AC_DEFINE([BUILD_JTAG_VPI], [1], [1 if you want JTAG VPI.])
591 else
592 AC_DEFINE([BUILD_JTAG_VPI], [0], [0 if you don't want JTAG VPI.])
593 fi
594
595 if test $build_amtjtagaccel = yes; then
596 AC_DEFINE([BUILD_AMTJTAGACCEL], [1], [1 if you want the Amontec JTAG-Accelerator driver.])
597 else
598 AC_DEFINE([BUILD_AMTJTAGACCEL], [0], [0 if you don't want the Amontec JTAG-Accelerator driver.])
599 fi
600
601 if test $build_gw16012 = yes; then
602 AC_DEFINE([BUILD_GW16012], [1], [1 if you want the Gateworks GW16012 driver.])
603 else
604 AC_DEFINE([BUILD_GW16012], [0], [0 if you don't want the Gateworks GW16012 driver.])
605 fi
606
607 if test $build_presto = yes; then
608 build_bitq=yes
609 AC_DEFINE([BUILD_PRESTO], [1], [1 if you want the ASIX PRESTO driver using libftdi.])
610 else
611 AC_DEFINE([BUILD_PRESTO], [0], [0 if you don't want the ASIX PRESTO driver using libftdi.])
612 fi
613
614 if test $build_bitq = yes; then
615 AC_DEFINE([BUILD_BITQ], [1], [1 if you want a bitq interface.])
616 else
617 AC_DEFINE([BUILD_BITQ], [0], [0 if you don't want a bitq interface.])
618 fi
619
620
621 if test $build_openjtag = yes; then
622 AC_DEFINE([BUILD_OPENJTAG], [1], [1 if you want the OpenJTAG driver.])
623 else
624 AC_DEFINE([BUILD_OPENJTAG], [0], [0 if you don't want the OpenJTAG driver.])
625 fi
626
627 if test $build_oocd_trace = yes; then
628 AC_DEFINE([BUILD_OOCD_TRACE], [1], [1 if you want the OpenOCD+trace ETM capture driver.])
629 else
630 AC_DEFINE([BUILD_OOCD_TRACE], [0], [0 if you don't want the OpenOCD+trace ETM capture driver.])
631 fi
632
633 if test $build_buspirate = yes; then
634 AC_DEFINE([BUILD_BUSPIRATE], [1], [1 if you want the Buspirate JTAG driver.])
635 else
636 AC_DEFINE([BUILD_BUSPIRATE], [0], [0 if you don't want the Buspirate JTAG driver.])
637 fi
638
639 if test $use_internal_jimtcl = yes; then
640 if test -f "$srcdir/jimtcl/configure.ac"; then
641 AX_CONFIG_SUBDIR_OPTION([jimtcl], [--disable-install-jim])
642 else
643 AC_MSG_ERROR([jimtcl not found, run git submodule init and git submodule update.])
644 fi
645 fi
646
647 if test $build_remote_bitbang = yes; then
648 build_bitbang=yes
649 AC_DEFINE([BUILD_REMOTE_BITBANG], [1], [1 if you want the Remote Bitbang JTAG driver.])
650 else
651 AC_DEFINE([BUILD_REMOTE_BITBANG], [0], [0 if you don't want the Remote Bitbang JTAG driver.])
652 fi
653
654 if test $build_sysfsgpio = yes; then
655 build_bitbang=yes
656 AC_DEFINE([BUILD_SYSFSGPIO], [1], [1 if you want the SysfsGPIO driver.])
657 else
658 AC_DEFINE([BUILD_SYSFSGPIO], [0], [0 if you don't want SysfsGPIO driver.])
659 fi
660
661 if test $build_usb_blaster = yes -o $build_openjtag = yes -o $build_presto = yes; then
662
663 # we can have libftdi or libftdi1, so check it and use the latest one
664 PKG_CHECK_MODULES([LIBFTDI], [libftdi1], [use_libftdi=yes], [use_libftdi=no])
665 if test $use_libftdi = no; then
666 PKG_CHECK_MODULES([LIBFTDI], [libftdi], [use_libftdi=yes], [use_libftdi=no])
667 fi
668 if test $use_libftdi = no; then
669 AC_MSG_ERROR([The libftdi driver is not present on your system.])
670 fi
671
672 #
673 # Try to build a small program.
674 AC_MSG_CHECKING([Build & Link with libftdi...])
675
676 LDFLAGS_SAVE=$LDFLAGS
677 CFLAGS_SAVE=$CFLAGS
678 LIBS_SAVE=$LIBS
679 _LDFLAGS=`eval echo $LDFLAGS`
680 _CFLAGS=`eval echo $CFLAGS`
681 _LIBS=`eval echo $LIBS`
682 LDFLAGS=$_LDFLAGS
683 CFLAGS="$_CFLAGS $LIBFTDI_CFLAGS"
684 LIBS="$_LIBS $LIBFTDI_LIBS"
685
686 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
687 #include <stdio.h>
688 #include <ftdi.h>
689 ]], [[
690 struct ftdi_context *p;
691 p = ftdi_new();
692 if( p != NULL ){
693 return 0;
694 } else {
695 fprintf( stderr, "calling ftdi_new() failed\n");
696 return 1;
697 }
698 ]])], [
699 AC_MSG_RESULT([Success])
700 ], [
701 AC_MSG_ERROR([Cannot build & run test program using libftdi])
702 ], [
703 AC_MSG_RESULT([Skipping as we are cross-compiling, trying build only])
704 AC_SEARCH_LIBS([ftdi_new], [], [], [AC_MSG_ERROR([Cannot link with libftdi])])
705 ])
706
707 AC_MSG_CHECKING([for libftdi FT232H device support])
708 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
709 #include <stdio.h>
710 #include <ftdi.h>
711 ]], [[
712 enum ftdi_chip_type x = TYPE_232H;
713 ]])], [
714 AC_DEFINE([HAS_ENUM_FT232H], [1],
715 [Support FT232H with libftdi.])
716 has_enum_ft232h=yes
717 ], [
718 has_enum_ft232h=no
719 ])
720 AC_MSG_RESULT([$has_enum_ft232h])
721
722 if test $has_enum_ft232h = no; then
723 AC_MSG_WARN([You need a newer libftdi version (0.20 or later).])
724 fi
725
726 # Restore the 'unexpanded ldflags'
727 LDFLAGS=$LDFLAGS_SAVE
728 CFLAGS=$CFLAGS_SAVE
729 LIBS=$LIBS_SAVE
730 fi
731
732 PKG_CHECK_MODULES([LIBUSB1], [libusb-1.0], [
733 use_libusb1=yes
734 AC_DEFINE([HAVE_LIBUSB1], [1], [Define if you have libusb-1.x])
735 PKG_CHECK_EXISTS([libusb-1.0 >= 1.0.9],
736 [AC_DEFINE([HAVE_LIBUSB_ERROR_NAME], [1], [Define if your libusb has libusb_error_name()])],
737 [AC_MSG_WARN([libusb-1.x older than 1.0.9 detected, consider updating])])
738 LIBUSB1_CFLAGS=`echo $LIBUSB1_CFLAGS | sed 's/-I/-isystem /'`
739 AC_MSG_NOTICE([libusb-1.0 header bug workaround: LIBUSB1_CFLAGS changed to "$LIBUSB1_CFLAGS"])
740 PKG_CHECK_EXISTS([libusb-1.0 >= 1.0.16],
741 [AC_DEFINE([HAVE_LIBUSB_GET_PORT_NUMBERS], [1], [Define if your libusb has libusb_get_port_numbers()])])
742 ], [
743 use_libusb1=no
744 AC_MSG_WARN([libusb-1.x not found, trying legacy libusb-0.1 as a fallback; consider installing libusb-1.x instead])
745 ])
746
747 PKG_CHECK_MODULES([LIBUSB0], [libusb], [use_libusb0=yes], [use_libusb0=no])
748
749 for hidapi_lib in hidapi hidapi-hidraw hidapi-libusb; do
750 PKG_CHECK_MODULES([HIDAPI],[$hidapi_lib],[
751 use_hidapi=yes
752 break
753 ],[
754 use_hidapi=no
755 ])
756 done
757
758 PKG_CHECK_MODULES([libjaylink], [libjaylink >= 0.1],
759 [HAVE_LIBJAYLINK=yes], [HAVE_LIBJAYLINK=no])
760
761 m4_define([PROCESS_ADAPTERS], [
762 m4_foreach([adapter], [$1], [
763 if test $2; then
764 if test $ADAPTER_VAR([adapter]) != no; then
765 AC_DEFINE([BUILD_]ADAPTER_SYM([adapter]), [1], [1 if you want the ]ADAPTER_DESC([adapter]).)
766 else
767 AC_DEFINE([BUILD_]ADAPTER_SYM([adapter]), [0], [0 if you do not want the ]ADAPTER_DESC([adapter]).)
768 fi
769 else
770 if test $ADAPTER_VAR([adapter]) = yes; then
771 AC_MSG_ERROR([$3 is required for the ADAPTER_DESC([adapter])])
772 fi
773 ADAPTER_VAR([adapter])=no
774 fi
775 AM_CONDITIONAL(ADAPTER_SYM([adapter]), [test $ADAPTER_VAR([adapter]) != no])
776 ])
777 ])
778
779 PROCESS_ADAPTERS([USB1_ADAPTERS], [$use_libusb1 = yes], [libusb-1.x])
780 PROCESS_ADAPTERS([USB_ADAPTERS], [$use_libusb1 = yes -o $use_libusb0 = yes], [libusb-1.x or libusb-0.1])
781 PROCESS_ADAPTERS([USB0_ADAPTERS], [$use_libusb0 = yes], [libusb-0.1])
782 PROCESS_ADAPTERS([HIDAPI_ADAPTERS], [$use_hidapi = yes], [hidapi])
783 PROCESS_ADAPTERS([LIBJAYLINK_ADAPTERS], [$use_libusb1 = yes -a $use_internal_libjaylink = yes -o $HAVE_LIBJAYLINK = yes], [libusb-1.x or libjaylink-0.1])
784
785 if test $enable_stlink != no -o $enable_ti_icdi != no; then
786 AC_DEFINE([BUILD_HLADAPTER], [1], [1 if you want the High Level JTAG driver.])
787 else
788 AC_DEFINE([BUILD_HLADAPTER], [0], [0 if you want the High Level JTAG driver.])
789 fi
790 AM_CONDITIONAL([HLADAPTER], [test $enable_stlink != no -o $enable_ti_icdi != no])
791
792 if test $enable_jlink != no; then
793 if test $use_internal_libjaylink = yes; then
794 if test -f "$srcdir/src/jtag/drivers/libjaylink/configure.ac"; then
795 AX_CONFIG_SUBDIR_OPTION([src/jtag/drivers/libjaylink],
796 [--enable-subproject-build])
797 else
798 AC_MSG_ERROR([Internal libjaylink not found, run either 'git submodule init' and 'git submodule update' or disable internal libjaylink with --disable-internal-libjaylink.])
799 fi
800 fi
801 fi
802
803 AM_CONDITIONAL([RELEASE], [test $build_release = yes])
804 AM_CONDITIONAL([PARPORT], [test $build_parport = yes])
805 AM_CONDITIONAL([DUMMY], [test $build_dummy = yes])
806 AM_CONDITIONAL([GIVEIO], [test x$parport_use_giveio = xyes])
807 AM_CONDITIONAL([EP93XX], [test $build_ep93xx = yes])
808 AM_CONDITIONAL([ZY1000], [test $build_zy1000 = yes])
809 AM_CONDITIONAL([ZY1000_MASTER], [test $build_zy1000_master = yes])
810 AM_CONDITIONAL([IOUTIL], [test $build_ioutil = yes])
811 AM_CONDITIONAL([AT91RM9200], [test $build_at91rm9200 = yes])
812 AM_CONDITIONAL([BCM2835GPIO], [test $build_bcm2835gpio = yes])
813 AM_CONDITIONAL([BITBANG], [test $build_bitbang = yes])
814 AM_CONDITIONAL([JTAG_VPI], [test $build_jtag_vpi = yes -o $build_jtag_vpi = yes])
815 AM_CONDITIONAL([USB_BLASTER_DRIVER], [test $build_usb_blaster = yes -o $enable_usb_blaster_2 != no])
816 AM_CONDITIONAL([USB_BLASTER], [test $build_usb_blaster = yes])
817 AM_CONDITIONAL([AMTJTAGACCEL], [test $build_amtjtagaccel = yes])
818 AM_CONDITIONAL([GW16012], [test $build_gw16012 = yes])
819 AM_CONDITIONAL([PRESTO], [test $build_presto = yes])
820 AM_CONDITIONAL([OPENJTAG], [test $build_openjtag = yes])
821 AM_CONDITIONAL([OOCD_TRACE], [test $build_oocd_trace = yes])
822 AM_CONDITIONAL([REMOTE_BITBANG], [test $build_remote_bitbang = yes])
823 AM_CONDITIONAL([BUSPIRATE], [test $build_buspirate = yes])
824 AM_CONDITIONAL([SYSFSGPIO], [test $build_sysfsgpio = yes])
825 AM_CONDITIONAL([USE_LIBUSB0], [test $use_libusb0 = yes])
826 AM_CONDITIONAL([USE_LIBUSB1], [test $use_libusb1 = yes])
827 AM_CONDITIONAL([IS_CYGWIN], [test $is_cygwin = yes])
828 AM_CONDITIONAL([IS_MINGW], [test $is_mingw = yes])
829 AM_CONDITIONAL([IS_WIN32], [test $is_win32 = yes])
830 AM_CONDITIONAL([IS_DARWIN], [test $is_darwin = yes])
831 AM_CONDITIONAL([BITQ], [test $build_bitq = yes])
832 AM_CONDITIONAL([CMSIS_DAP], [test $use_hidapi = yes])
833
834 AM_CONDITIONAL([MINIDRIVER], [test $build_minidriver = yes])
835 AM_CONDITIONAL([MINIDRIVER_DUMMY], [test $build_minidriver_dummy = yes])
836
837 AM_CONDITIONAL([INTERNAL_JIMTCL], [test $use_internal_jimtcl = yes])
838 AM_CONDITIONAL([INTERNAL_LIBJAYLINK], [test $use_internal_libjaylink = yes])
839
840 # Look for environ alternatives. Possibility #1: is environ in unistd.h or stdlib.h?
841 AC_MSG_CHECKING([for environ in unistd.h and stdlib.h])
842 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
843 #define _GNU_SOURCE
844 #include <unistd.h>
845 #include <stdlib.h>
846 ]], [[char **ep = environ;]]
847 )], [
848 AC_MSG_RESULT([yes])
849 has_environ=yes
850 ], [
851 AC_MSG_RESULT([no])
852
853 # Possibility #2: can environ be found in an available library?
854 AC_MSG_CHECKING([for extern environ])
855 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
856 extern char **environ;
857 ]], [[char **ep = environ;]]
858 )], [
859 AC_DEFINE(NEED_ENVIRON_EXTERN, [1], [Must declare 'environ' to use it.])
860 has_environ=yes
861 ], [
862 has_environ=no
863 ])
864 AC_MSG_RESULT([${has_environ}])
865 ])
866
867 if test "${has_environ}" != "yes" ; then
868 AC_MSG_FAILURE([Could not find 'environ' in unistd.h or available libraries.])
869 fi
870
871 AC_DEFINE([_GNU_SOURCE],[1],[Use GNU C library extensions (e.g. stdndup).])
872
873 # set default gcc warnings
874 GCC_WARNINGS="-Wall -Wstrict-prototypes -Wformat-security -Wshadow"
875 if test "${gcc_wextra}" = yes; then
876 GCC_WARNINGS="${GCC_WARNINGS} -Wextra -Wno-unused-parameter"
877 GCC_WARNINGS="${GCC_WARNINGS} -Wbad-function-cast"
878 GCC_WARNINGS="${GCC_WARNINGS} -Wcast-align"
879 GCC_WARNINGS="${GCC_WARNINGS} -Wredundant-decls"
880 fi
881 if test "${gcc_werror}" = yes; then
882 GCC_WARNINGS="${GCC_WARNINGS} -Werror"
883 fi
884
885 # overide default gcc cflags
886 if test $gcc_warnings = yes; then
887 CFLAGS="$CFLAGS $GCC_WARNINGS"
888 fi
889
890 AC_CONFIG_FILES([
891 Makefile
892 src/Makefile
893 src/helper/Makefile
894 src/jtag/Makefile
895 src/jtag/drivers/Makefile
896 src/jtag/drivers/usb_blaster/Makefile
897 src/jtag/hla/Makefile
898 src/jtag/aice/Makefile
899 src/transport/Makefile
900 src/target/openrisc/Makefile
901 src/xsvf/Makefile
902 src/svf/Makefile
903 src/target/Makefile
904 src/rtos/Makefile
905 src/server/Makefile
906 src/flash/Makefile
907 src/flash/nor/Makefile
908 src/flash/nand/Makefile
909 src/pld/Makefile
910 doc/Makefile
911 ])
912 AC_OUTPUT
913
914 echo
915 echo
916 echo OpenOCD configuration summary
917 echo --------------------------------------------------
918 m4_foreach([adapter], [USB1_ADAPTERS, USB_ADAPTERS, USB0_ADAPTERS,
919 HIDAPI_ADAPTERS, LIBJAYLINK_ADAPTERS],
920 [s=m4_format(["%-40s"], ADAPTER_DESC([adapter]))
921 case $ADAPTER_VAR([adapter]) in
922 auto)
923 echo "$s"yes '(auto)'
924 ;;
925 yes)
926 echo "$s"yes
927 ;;
928 no)
929 echo "$s"no
930 ;;
931 esac
932 ])
933 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)