1 # SPDX-License-Identifier: GPL-2.0-or-later
4 AC_INIT([openocd], [0.12.0+dev],
5 [OpenOCD Mailing List <openocd-devel@lists.sourceforge.net>])
6 AC_CONFIG_SRCDIR([src/openocd.c])
7 AC_CONFIG_AUX_DIR([build-aux])
9 m4_include([config_subdir.m4])dnl
11 # check for makeinfo before calling AM_INIT_AUTOMAKE
12 AC_CHECK_PROG([MAKEINFO], [makeinfo], [makeinfo])
13 AS_IF([test "x$MAKEINFO" = "x"], [
14 MAKEINFO='echo makeinfo missing; true'
15 AC_MSG_WARN([Info documentation will not be built.])
19 AM_INIT_AUTOMAKE([-Wall -Wno-portability dist-bzip2 dist-zip subdir-objects])
21 AC_CONFIG_HEADERS([config.h])
25 # autoconf 2.70 obsoletes AC_PROG_CC_C99 and includes it in AC_PROG_CC
26 m4_version_prereq([2.70],[],[AC_PROG_CC_C99])
30 # If macro PKG_PROG_PKG_CONFIG is not available, Autoconf generates a misleading error message,
31 # so check for existence first, and otherwise provide helpful advice.
32 m4_ifndef([PKG_PROG_PKG_CONFIG], [m4_fatal(m4_normalize([
33 Macro PKG_PROG_PKG_CONFIG is not available.
34 It is usually defined in file pkg.m4 provided by package pkg-config.]))])
35 PKG_PROG_PKG_CONFIG([0.23])
37 dnl disable checks for C++, Fortran and GNU Java Compiler
38 m4_defun([_LT_AC_LANG_CXX_CONFIG], [:])
39 m4_defun([_LT_AC_LANG_F77_CONFIG], [:])
40 m4_defun([_LT_AC_LANG_GCJ_CONFIG], [:])
43 AC_SUBST([LIBTOOL_DEPS])
45 dnl configure checks required for Jim files (these are obsolete w/ C99)
49 AC_SEARCH_LIBS([ioperm], [ioperm])
50 AC_SEARCH_LIBS([dlopen], [dl])
51 AC_SEARCH_LIBS([openpty], [util])
53 AC_CHECK_HEADERS([sys/socket.h])
54 AC_CHECK_HEADERS([elf.h])
55 AC_EGREP_HEADER(Elf64_Ehdr, [elf.h], [
56 AC_DEFINE([HAVE_ELF64], [1], [Define to 1 if the system has the type `Elf64_Ehdr'.])
58 AC_CHECK_HEADERS([fcntl.h])
59 AC_CHECK_HEADERS([malloc.h])
60 AC_CHECK_HEADERS([netdb.h])
61 AC_CHECK_HEADERS([poll.h])
62 AC_CHECK_HEADERS([strings.h])
63 AC_CHECK_HEADERS([sys/ioctl.h])
64 AC_CHECK_HEADERS([sys/param.h])
65 AC_CHECK_HEADERS([sys/select.h])
66 AC_CHECK_HEADERS([sys/stat.h])
67 AC_CHECK_HEADERS([sys/sysctl.h])
68 AC_CHECK_HEADERS([sys/time.h])
69 AC_CHECK_HEADERS([sys/types.h])
70 AC_CHECK_HEADERS([unistd.h])
71 AC_CHECK_HEADERS([arpa/inet.h netinet/in.h netinet/tcp.h], [], [], [dnl
81 #ifdef HAVE_SYS_SOCKET_H
82 # include <sys/socket.h>
91 AC_CHECK_FUNCS([strndup])
92 AC_CHECK_FUNCS([strnlen])
93 AC_CHECK_FUNCS([gettimeofday])
94 AC_CHECK_FUNCS([usleep])
95 AC_CHECK_FUNCS([realpath])
97 # guess-rev.sh only exists in the repository, not in the released archives
98 AC_MSG_CHECKING([whether to build a release])
99 AS_IF([test -x "$srcdir/guess-rev.sh"], [
104 AC_MSG_RESULT([$build_release])
107 # 1st column -- configure option
108 # 2nd column -- description
109 # 3rd column -- symbol used for both config.h and automake
110 m4_define([ADAPTER_ARG], [m4_argn([1], $1)])
111 m4_define([ADAPTER_DESC], [m4_argn([2], $1)])
112 m4_define([ADAPTER_SYM], [m4_argn([3], $1)])
113 m4_define([ADAPTER_VAR], [enable_[]ADAPTER_ARG($1)])
114 m4_define([ADAPTER_OPT], [m4_translit(ADAPTER_ARG($1), [_], [-])])
116 m4_define([USB1_ADAPTERS],
117 [[[ftdi], [MPSSE mode of FTDI based devices], [FTDI]],
118 [[stlink], [ST-Link Programmer], [HLADAPTER_STLINK]],
119 [[ti_icdi], [TI ICDI JTAG Programmer], [HLADAPTER_ICDI]],
120 [[ulink], [Keil ULINK JTAG Programmer], [ULINK]],
121 [[angie], [ANGIE Adapter], [ANGIE]],
122 [[usb_blaster_2], [Altera USB-Blaster II Compatible], [USB_BLASTER_2]],
123 [[ft232r], [Bitbang mode of FT232R based devices], [FT232R]],
124 [[vsllink], [Versaloon-Link JTAG Programmer], [VSLLINK]],
125 [[xds110], [TI XDS110 Debug Probe], [XDS110]],
126 [[cmsis_dap_v2], [CMSIS-DAP v2 Compliant Debugger], [CMSIS_DAP_USB]],
127 [[osbdm], [OSBDM (JTAG only) Programmer], [OSBDM]],
128 [[opendous], [eStick/opendous JTAG Programmer], [OPENDOUS]],
129 [[armjtagew], [Olimex ARM-JTAG-EW Programmer], [ARMJTAGEW]],
130 [[rlink], [Raisonance RLink JTAG Programmer], [RLINK]],
131 [[usbprog], [USBProg JTAG Programmer], [USBPROG]],
132 [[esp_usb_jtag], [Espressif JTAG Programmer], [ESP_USB_JTAG]]])
134 m4_define([HIDAPI_ADAPTERS],
135 [[[cmsis_dap], [CMSIS-DAP Compliant Debugger], [CMSIS_DAP_HID]],
136 [[nulink], [Nu-Link Programmer], [HLADAPTER_NULINK]]])
138 m4_define([HIDAPI_USB1_ADAPTERS],
139 [[[kitprog], [Cypress KitProg Programmer], [KITPROG]]])
141 m4_define([LIBFTDI_ADAPTERS],
142 [[[usb_blaster], [Altera USB-Blaster Compatible], [USB_BLASTER]],
143 [[presto], [ASIX Presto Adapter], [PRESTO]]])
145 m4_define([LIBFTDI_USB1_ADAPTERS],
146 [[[openjtag], [OpenJTAG Adapter], [OPENJTAG]]])
148 m4_define([LIBGPIOD_ADAPTERS],
149 [[[linuxgpiod], [Linux GPIO bitbang through libgpiod], [LINUXGPIOD]]])
151 m4_define([LIBJAYLINK_ADAPTERS],
152 [[[jlink], [SEGGER J-Link Programmer], [JLINK]]])
154 m4_define([PCIE_ADAPTERS],
155 [[[xlnx_pcie_xvc], [Xilinx XVC/PCIe], [XLNX_PCIE_XVC]]])
157 m4_define([SERIAL_PORT_ADAPTERS],
158 [[[buspirate], [Bus Pirate], [BUS_PIRATE]]])
160 m4_define([OPTIONAL_LIBRARIES],
161 [[[capstone], [Use Capstone disassembly framework], []]])
163 AC_ARG_ENABLE([doxygen-html],
164 AS_HELP_STRING([--disable-doxygen-html],
165 [Disable building Doxygen manual as HTML.]),
166 [doxygen_as_html=$enableval], [doxygen_as_html=yes])
167 AC_SUBST([doxygen_as_html])
168 AC_MSG_CHECKING([whether to build Doxygen as HTML])
169 AC_MSG_RESULT([$doxygen_as_html])
171 AC_ARG_ENABLE([doxygen-pdf],
172 AS_HELP_STRING([--enable-doxygen-pdf],
173 [Enable building Doxygen manual as PDF.]),
174 [doxygen_as_pdf=$enableval], [doxygen_as_pdf=no])
175 AC_SUBST([doxygen_as_pdf])
176 AC_MSG_CHECKING([whether to build Doxygen as PDF])
177 AC_MSG_RESULT([$doxygen_as_pdf])
179 AC_ARG_ENABLE([gccwarnings],
180 AS_HELP_STRING([--disable-gccwarnings], [Disable compiler warnings]),
181 [gcc_warnings=$enableval], [gcc_warnings=yes])
183 AC_ARG_ENABLE([wextra],
184 AS_HELP_STRING([--disable-wextra], [Disable extra compiler warnings]),
185 [gcc_wextra=$enableval], [gcc_wextra=$gcc_warnings])
187 AC_ARG_ENABLE([werror],
188 AS_HELP_STRING([--disable-werror], [Do not treat warnings as errors]),
189 [gcc_werror=$enableval], [gcc_werror=$gcc_warnings])
191 # set default verbose options, overridden by following options
195 AC_ARG_ENABLE([verbose],
196 AS_HELP_STRING([--enable-verbose],
197 [Enable verbose JTAG I/O messages (for debugging).]),
199 debug_usb_io=$enableval
200 debug_usb_comms=$enableval
203 AC_ARG_ENABLE([verbose_usb_io],
204 AS_HELP_STRING([--enable-verbose-usb-io],
205 [Enable verbose USB I/O messages (for debugging)]),
206 [debug_usb_io=$enableval], [])
208 AC_ARG_ENABLE([verbose_usb_comms],
209 AS_HELP_STRING([--enable-verbose-usb-comms],
210 [Enable verbose USB communication messages (for debugging)]),
211 [debug_usb_comms=$enableval], [])
213 AC_MSG_CHECKING([whether to enable verbose USB I/O messages]);
214 AC_MSG_RESULT([$debug_usb_io])
215 AS_IF([test "x$debug_usb_io" = "xyes"], [
216 AC_DEFINE([_DEBUG_USB_IO_],[1], [Print verbose USB I/O messages])
219 AC_MSG_CHECKING([whether to enable verbose USB communication messages]);
220 AC_MSG_RESULT([$debug_usb_comms])
221 AS_IF([test "x$debug_usb_comms" = "xyes"], [
222 AC_DEFINE([_DEBUG_USB_COMMS_],[1], [Print verbose USB communication messages])
226 AC_ARG_ENABLE([malloc_logging],
227 AS_HELP_STRING([--enable-malloc-logging],
228 [Include free space in logging messages (requires malloc.h).]),
229 [debug_malloc=$enableval], [])
231 AC_MSG_CHECKING([whether to enable malloc free space logging]);
232 AC_MSG_RESULT([$debug_malloc])
233 AS_IF([test "x$debug_malloc" = "xyes"], [
234 AC_DEFINE([_DEBUG_FREE_SPACE_],[1], [Include malloc free space in logging])
237 AC_ARG_ENABLE([dummy],
238 AS_HELP_STRING([--enable-dummy], [Enable building the dummy port driver]),
239 [build_dummy=$enableval], [build_dummy=no])
241 AC_ARG_ENABLE([rshim],
242 AS_HELP_STRING([--enable-rshim], [Enable building the rshim driver]),
243 [build_rshim=$enableval], [build_rshim=no])
245 m4_define([AC_ARG_ADAPTERS], [
246 m4_foreach([adapter], [$1],
247 [AC_ARG_ENABLE(ADAPTER_OPT([adapter]),
248 AS_HELP_STRING([--enable-ADAPTER_OPT([adapter])],
249 [Enable building support for the ]ADAPTER_DESC([adapter])[ (default is $2)]),
250 [], [ADAPTER_VAR([adapter])=$2])
257 HIDAPI_USB1_ADAPTERS,
259 LIBFTDI_USB1_ADAPTERS
261 SERIAL_PORT_ADAPTERS,
265 AC_ARG_ENABLE([parport],
266 AS_HELP_STRING([--enable-parport], [Enable building the pc parallel port driver]),
267 [build_parport=$enableval], [build_parport=no])
269 AC_ARG_ENABLE([parport_ppdev],
270 AS_HELP_STRING([--disable-parport-ppdev],
271 [Disable use of ppdev (/dev/parportN) for parport (for x86 only)]),
272 [parport_use_ppdev=$enableval], [parport_use_ppdev=yes])
274 AC_ARG_ENABLE([parport_giveio],
275 AS_HELP_STRING([--enable-parport-giveio],
276 [Enable use of giveio for parport (for CygWin only)]),
277 [parport_use_giveio=$enableval], [parport_use_giveio=])
279 AC_ARG_ENABLE([jtag_vpi],
280 AS_HELP_STRING([--enable-jtag_vpi], [Enable building support for JTAG VPI]),
281 [build_jtag_vpi=$enableval], [build_jtag_vpi=no])
283 AC_ARG_ENABLE([vdebug],
284 AS_HELP_STRING([--enable-vdebug], [Enable building support for Cadence Virtual Debug Interface]),
285 [build_vdebug=$enableval], [build_vdebug=no])
287 AC_ARG_ENABLE([jtag_dpi],
288 AS_HELP_STRING([--enable-jtag_dpi], [Enable building support for JTAG DPI]),
289 [build_jtag_dpi=$enableval], [build_jtag_dpi=no])
291 AC_ARG_ENABLE([amtjtagaccel],
292 AS_HELP_STRING([--enable-amtjtagaccel], [Enable building the Amontec JTAG-Accelerator driver]),
293 [build_amtjtagaccel=$enableval], [build_amtjtagaccel=no])
295 AS_CASE(["${host_cpu}"],
297 AC_ARG_ENABLE([bcm2835gpio],
298 AS_HELP_STRING([--enable-bcm2835gpio], [Enable building support for bitbanging on BCM2835 (as found in Raspberry Pi)]),
299 [build_bcm2835gpio=$enableval], [build_bcm2835gpio=no])
300 AC_ARG_ENABLE([imx_gpio],
301 AS_HELP_STRING([--enable-imx_gpio], [Enable building support for bitbanging on NXP IMX processors]),
302 [build_imx_gpio=$enableval], [build_imx_gpio=no])
303 AC_ARG_ENABLE([am335xgpio],
304 AS_HELP_STRING([--enable-am335xgpio], [Enable building support for bitbanging on AM335x (as found in Beaglebones)]),
305 [build_am335xgpio=$enableval], [build_am335xgpio=no])
313 AS_CASE(["${host_cpu}"],
315 AC_ARG_ENABLE([ep93xx],
316 AS_HELP_STRING([--enable-ep93xx], [Enable building support for EP93xx based SBCs]),
317 [build_ep93xx=$enableval], [build_ep93xx=no])
319 AC_ARG_ENABLE([at91rm9200],
320 AS_HELP_STRING([--enable-at91rm9200], [Enable building support for AT91RM9200 based SBCs]),
321 [build_at91rm9200=$enableval], [build_at91rm9200=no])
328 AC_ARG_ENABLE([gw16012],
329 AS_HELP_STRING([--enable-gw16012], [Enable building support for the Gateworks GW16012 JTAG Programmer]),
330 [build_gw16012=$enableval], [build_gw16012=no])
332 AC_ARG_ENABLE([sysfsgpio],
333 AS_HELP_STRING([--enable-sysfsgpio], [Enable building support for programming driven via sysfs gpios.]),
334 [build_sysfsgpio=$enableval], [build_sysfsgpio=no])
336 AC_ARG_ENABLE([xlnx_pcie_xvc],
337 AS_HELP_STRING([--enable-xlnx-pcie-xvc], [Enable building support for Xilinx XVC/PCIe.]),
338 [build_xlnx_pcie_xvc=$enableval], [build_xlnx_pcie_xvc=no])
343 AS_IF([test "x$build_sysfsgpio" = "xyes"], [
344 AC_MSG_ERROR([sysfsgpio is only available on linux])
347 AS_IF([test "x$enable_linuxgpiod" = "xyes"], [
348 AC_MSG_ERROR([linuxgpiod is only available on linux])
351 AS_IF([test "x$build_xlnx_pcie_xvc" = "xyes"], [
352 AC_MSG_ERROR([xlnx_pcie_xvc is only available on linux])
355 AS_CASE([$host_os], [freebsd*], [],
357 AS_IF([test "x$build_rshim" = "xyes"], [
358 AC_MSG_ERROR([build_rshim is only available on linux or freebsd])
363 AC_ARG_ENABLE([internal-jimtcl],
364 AS_HELP_STRING([--disable-internal-jimtcl], [Disable building internal jimtcl]),
365 [use_internal_jimtcl=$enableval], [use_internal_jimtcl=yes])
367 AC_ARG_ENABLE([jimtcl-maintainer],
368 AS_HELP_STRING([--enable-jimtcl-maintainer], [Enable maintainer mode when building internal jimtcl]),
369 [use_internal_jimtcl_maintainer=$enableval], [use_internal_jimtcl_maintainer=no])
371 AC_ARG_ENABLE([internal-libjaylink],
372 AS_HELP_STRING([--enable-internal-libjaylink],
373 [Enable building internal libjaylink]),
374 [use_internal_libjaylink=$enableval], [use_internal_libjaylink=no])
376 AC_ARG_ENABLE([remote-bitbang],
377 AS_HELP_STRING([--enable-remote-bitbang], [Enable building support for the Remote Bitbang jtag driver]),
378 [build_remote_bitbang=$enableval], [build_remote_bitbang=no])
380 AS_CASE(["${host_cpu}"],
383 AS_IF([test "x$parport_use_ppdev" = "xno"], [
384 AC_MSG_WARN([--disable-parport-ppdev is not supported by the host CPU])
386 parport_use_ppdev=yes
394 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[return __MINGW32__;]])],
395 [is_mingw=yes],[is_mingw=no])
396 AS_IF([test "x$is_mingw" = "xyes"], [
397 AS_IF([test "x$parport_use_giveio" = "xno"], [
398 AC_MSG_WARN([--disable-parport-giveio is not supported by MinGW32 hosts])
400 parport_use_giveio=yes
404 # sys/io.h needed under cygwin for parport access
405 AS_IF([test "x$build_parport" = "xyes"], [
406 AC_CHECK_HEADERS([sys/io.h],[],AC_MSG_ERROR([Please install the cygwin ioperm package]))
410 [*-mingw* | *-msys*], [
415 AS_IF([test "x$parport_use_giveio" = "xno"], [
416 AC_MSG_WARN([--disable-parport-giveio is not supported by MinGW32 hosts])
418 parport_use_giveio=yes
420 AS_IF([test "x$enable_buspirate" = "xyes"], [
421 AC_MSG_ERROR([buspirate currently not supported by MinGW32 hosts])
424 # In case enable_buspirate=auto, make sure it will not be built.
427 AC_SUBST([HOST_CPPFLAGS], [-D__USE_MINGW_ANSI_STDIO])
432 AS_IF([test "x$parport_use_giveio" = "xyes"], [
433 AC_MSG_WARN([--enable-parport-giveio cannot be used by Darwin hosts])
435 parport_use_giveio=no
438 AS_IF([test "x$parport_use_giveio" = "xyes"], [
439 AC_MSG_WARN([--enable-parport-giveio cannot be used by ]$host[ hosts])
441 parport_use_giveio=no
444 AS_IF([test "x$is_cygwin" = "xyes"], [
445 AC_DEFINE([IS_CYGWIN], [1], [1 if building for Cygwin.])
447 AC_DEFINE([IS_CYGWIN], [0], [0 if not building for Cygwin.])
450 AS_IF([test "x$is_mingw" = "xyes"], [
451 AC_DEFINE([IS_MINGW], [1], [1 if building for Mingw.])
453 AC_DEFINE([IS_MINGW], [0], [0 if not building for Mingw.])
456 AS_IF([test "x$is_win32" = "xyes"], [
457 AC_DEFINE([IS_WIN32], [1], [1 if building for Win32.])
459 AC_DEFINE([IS_WIN32], [0], [0 if not building for Win32.])
462 AS_IF([test "x$is_darwin" = "xyes"], [
463 AC_DEFINE([IS_DARWIN], [1], [1 if building for Darwin.])
465 AC_DEFINE([IS_DARWIN], [0], [0 if not building for Darwin.])
468 AS_IF([test "x$build_parport" = "xyes"], [
470 AC_DEFINE([BUILD_PARPORT], [1], [1 if you want parport.])
472 AC_DEFINE([BUILD_PARPORT], [0], [0 if you don't want parport.])
475 AS_IF([test "x$build_rshim" = "xyes"], [
476 AC_DEFINE([BUILD_RSHIM], [1], [1 if you want to debug BlueField SoC via rshim.])
478 AC_DEFINE([BUILD_RSHIM], [0], [0 if you don't want to debug BlueField SoC via rshim.])
481 AS_IF([test "x$build_dummy" = "xyes"], [
483 AC_DEFINE([BUILD_DUMMY], [1], [1 if you want dummy driver.])
485 AC_DEFINE([BUILD_DUMMY], [0], [0 if you don't want dummy driver.])
488 AS_IF([test "x$build_ep93xx" = "xyes"], [
490 AC_DEFINE([BUILD_EP93XX], [1], [1 if you want ep93xx.])
492 AC_DEFINE([BUILD_EP93XX], [0], [0 if you don't want ep93xx.])
495 AS_IF([test "x$build_at91rm9200" = "xyes"], [
497 AC_DEFINE([BUILD_AT91RM9200], [1], [1 if you want at91rm9200.])
499 AC_DEFINE([BUILD_AT91RM9200], [0], [0 if you don't want at91rm9200.])
502 AS_IF([test "x$build_bcm2835gpio" = "xyes"], [
504 AC_DEFINE([BUILD_BCM2835GPIO], [1], [1 if you want bcm2835gpio.])
506 AC_DEFINE([BUILD_BCM2835GPIO], [0], [0 if you don't want bcm2835gpio.])
509 AS_IF([test "x$build_imx_gpio" = "xyes"], [
511 AC_DEFINE([BUILD_IMX_GPIO], [1], [1 if you want imx_gpio.])
513 AC_DEFINE([BUILD_IMX_GPIO], [0], [0 if you don't want imx_gpio.])
516 AS_IF([test "x$build_am335xgpio" = "xyes"], [
518 AC_DEFINE([BUILD_AM335XGPIO], [1], [1 if you want am335xgpio.])
520 AC_DEFINE([BUILD_AM335XGPIO], [0], [0 if you don't want am335xgpio.])
523 AS_IF([test "x$parport_use_ppdev" = "xyes"], [
524 AC_DEFINE([PARPORT_USE_PPDEV], [1], [1 if you want parport to use ppdev.])
526 AC_DEFINE([PARPORT_USE_PPDEV], [0], [0 if you don't want parport to use ppdev.])
529 AS_IF([test "x$parport_use_giveio" = "xyes"], [
530 AC_DEFINE([PARPORT_USE_GIVEIO], [1], [1 if you want parport to use giveio.])
532 AC_DEFINE([PARPORT_USE_GIVEIO], [0], [0 if you don't want parport to use giveio.])
535 AS_IF([test "x$build_jtag_vpi" = "xyes"], [
536 AC_DEFINE([BUILD_JTAG_VPI], [1], [1 if you want JTAG VPI.])
538 AC_DEFINE([BUILD_JTAG_VPI], [0], [0 if you don't want JTAG VPI.])
541 AS_IF([test "x$build_vdebug" = "xyes"], [
542 AC_DEFINE([BUILD_VDEBUG], [1], [1 if you want Cadence vdebug interface.])
544 AC_DEFINE([BUILD_VDEBUG], [0], [0 if you don't want Cadence vdebug interface.])
547 AS_IF([test "x$build_jtag_dpi" = "xyes"], [
548 AC_DEFINE([BUILD_JTAG_DPI], [1], [1 if you want JTAG DPI.])
550 AC_DEFINE([BUILD_JTAG_DPI], [0], [0 if you don't want JTAG DPI.])
554 AS_IF([test "x$build_amtjtagaccel" = "xyes"], [
555 AC_DEFINE([BUILD_AMTJTAGACCEL], [1], [1 if you want the Amontec JTAG-Accelerator driver.])
557 AC_DEFINE([BUILD_AMTJTAGACCEL], [0], [0 if you don't want the Amontec JTAG-Accelerator driver.])
560 AS_IF([test "x$build_gw16012" = "xyes"], [
561 AC_DEFINE([BUILD_GW16012], [1], [1 if you want the Gateworks GW16012 driver.])
563 AC_DEFINE([BUILD_GW16012], [0], [0 if you don't want the Gateworks GW16012 driver.])
566 AS_IF([test "x$enable_buspirate" != "xno"], [
567 AC_DEFINE([BUILD_BUSPIRATE], [1], [1 if you want the Buspirate JTAG driver.])
569 AC_DEFINE([BUILD_BUSPIRATE], [0], [0 if you don't want the Buspirate JTAG driver.])
572 AS_IF([test "x$use_internal_jimtcl" = "xyes"], [
573 AS_IF([test -f "$srcdir/jimtcl/configure"], [
574 AS_IF([test "x$use_internal_jimtcl_maintainer" = "xyes"], [
575 jimtcl_config_options="--disable-install-jim --with-ext=json --minimal --disable-ssl --maintainer"
577 jimtcl_config_options="--disable-install-jim --with-ext=json --minimal --disable-ssl"
579 AX_CONFIG_SUBDIR_OPTION([jimtcl], [$jimtcl_config_options])
581 AC_MSG_ERROR([jimtcl not found, run git submodule init and git submodule update.])
585 AS_IF([test "x$build_remote_bitbang" = "xyes"], [
587 AC_DEFINE([BUILD_REMOTE_BITBANG], [1], [1 if you want the Remote Bitbang JTAG driver.])
589 AC_DEFINE([BUILD_REMOTE_BITBANG], [0], [0 if you don't want the Remote Bitbang JTAG driver.])
592 AS_IF([test "x$build_sysfsgpio" = "xyes"], [
594 AC_DEFINE([BUILD_SYSFSGPIO], [1], [1 if you want the SysfsGPIO driver.])
596 AC_DEFINE([BUILD_SYSFSGPIO], [0], [0 if you don't want SysfsGPIO driver.])
599 AS_IF([test "x$build_xlnx_pcie_xvc" = "xyes"], [
600 build_xlnx_pcie_xvc=yes
601 AC_DEFINE([BUILD_XLNX_PCIE_XVC], [1], [1 if you want the Xilinx XVC/PCIe driver.])
603 AC_DEFINE([BUILD_XLNX_PCIE_XVC], [0], [0 if you don't want Xilinx XVC/PCIe driver.])
606 PKG_CHECK_MODULES([LIBUSB1], [libusb-1.0], [
608 AC_DEFINE([HAVE_LIBUSB1], [1], [Define if you have libusb-1.x])
609 LIBUSB1_CFLAGS=`echo $LIBUSB1_CFLAGS | sed 's/-I/-isystem /'`
610 AC_MSG_NOTICE([libusb-1.0 header bug workaround: LIBUSB1_CFLAGS changed to "$LIBUSB1_CFLAGS"])
611 PKG_CHECK_EXISTS([libusb-1.0 >= 1.0.16],
612 [AC_DEFINE([HAVE_LIBUSB_GET_PORT_NUMBERS], [1], [Define if your libusb has libusb_get_port_numbers()])])
615 AC_MSG_WARN([libusb-1.x not found, trying legacy libusb-0.1 as a fallback; consider installing libusb-1.x instead])
618 AC_ARG_WITH([capstone],
619 AS_HELP_STRING([--with-capstone], [Use Capstone disassembly library (default=auto)])
621 enable_capstone=$withval
626 AS_IF([test "x$enable_capstone" != xno], [
627 PKG_CHECK_MODULES([CAPSTONE], [capstone], [
628 AC_DEFINE([HAVE_CAPSTONE], [1], [1 if you have Capstone disassembly framework.])
630 if test "x$enable_capstone" != xauto; then
631 AC_MSG_ERROR([--with-capstone was given, but test for Capstone failed])
637 AS_IF([test "x$enable_capstone" == xno], [
638 AC_DEFINE([HAVE_CAPSTONE], [0], [0 if you don't have Capstone disassembly framework.])
641 for hidapi_lib in hidapi hidapi-hidraw hidapi-libusb; do
642 PKG_CHECK_MODULES([HIDAPI],[$hidapi_lib],[
650 PKG_CHECK_MODULES([LIBFTDI], [libftdi1], [
652 PKG_CHECK_EXISTS([libftdi1 >= 1.5],
653 [AC_DEFINE([HAVE_LIBFTDI_TCIOFLUSH], [1], [Define if your libftdi has ftdi_tcioflush()])])
655 PKG_CHECK_MODULES([LIBFTDI], [libftdi], [use_libftdi=yes], [use_libftdi=no])
658 PKG_CHECK_MODULES([LIBGPIOD], [libgpiod], [use_libgpiod=yes], [use_libgpiod=no])
660 PKG_CHECK_MODULES([LIBJAYLINK], [libjaylink >= 0.2],
661 [use_libjaylink=yes], [use_libjaylink=no])
663 m4_define([PROCESS_ADAPTERS], [
664 m4_foreach([adapter], [$1], [
666 AS_IF([test "x$ADAPTER_VAR([adapter])" != "xno"], [
667 AC_DEFINE([BUILD_]ADAPTER_SYM([adapter]), [1], [1 if you want the ]ADAPTER_DESC([adapter]).)
669 AC_DEFINE([BUILD_]ADAPTER_SYM([adapter]), [0], [0 if you do not want the ]ADAPTER_DESC([adapter]).)
672 AS_IF([test "x$ADAPTER_VAR([adapter])" = "xyes"], [
673 AC_MSG_ERROR([$3 is required for the ADAPTER_DESC([adapter])])
675 ADAPTER_VAR([adapter])=no
676 AC_DEFINE([BUILD_]ADAPTER_SYM([adapter]), [0], [0 if you do not want the ]ADAPTER_DESC([adapter]).)
678 AM_CONDITIONAL(ADAPTER_SYM([adapter]), [test "x$ADAPTER_VAR([adapter])" != "xno"])
682 PROCESS_ADAPTERS([USB1_ADAPTERS], ["x$use_libusb1" = "xyes"], [libusb-1.x])
683 PROCESS_ADAPTERS([HIDAPI_ADAPTERS], ["x$use_hidapi" = "xyes"], [hidapi])
684 PROCESS_ADAPTERS([HIDAPI_USB1_ADAPTERS], ["x$use_hidapi" = "xyes" -a "x$use_libusb1" = "xyes"], [hidapi and libusb-1.x])
685 PROCESS_ADAPTERS([LIBFTDI_ADAPTERS], ["x$use_libftdi" = "xyes"], [libftdi])
686 PROCESS_ADAPTERS([LIBFTDI_USB1_ADAPTERS], ["x$use_libftdi" = "xyes" -a "x$use_libusb1" = "xyes"], [libftdi and libusb-1.x])
687 PROCESS_ADAPTERS([LIBGPIOD_ADAPTERS], ["x$use_libgpiod" = "xyes"], [libgpiod])
688 PROCESS_ADAPTERS([LIBJAYLINK_ADAPTERS], ["x$use_internal_libjaylink" = "xyes" -o "x$use_libjaylink" = "xyes"], [libjaylink-0.2])
690 AS_IF([test "x$enable_linuxgpiod" != "xno"], [
694 AS_IF([test "x$enable_stlink" != "xno" -o "x$enable_ti_icdi" != "xno" -o "x$enable_nulink" != "xno"], [
695 AC_DEFINE([BUILD_HLADAPTER], [1], [1 if you want the High Level JTAG driver.])
696 AM_CONDITIONAL([HLADAPTER], [true])
698 AC_DEFINE([BUILD_HLADAPTER], [0], [0 if you want the High Level JTAG driver.])
699 AM_CONDITIONAL([HLADAPTER], [false])
701 AM_CONDITIONAL([HLADAPTER_STLINK], [test "x$enable_stlink" != "xno"])
702 AM_CONDITIONAL([HLADAPTER_ICDI], [test "x$enable_ti_icdi" != "xno"])
703 AM_CONDITIONAL([HLADAPTER_NULINK], [test "x$enable_nulink" != "xno"])
705 AS_IF([test "x$enable_jlink" != "xno"], [
706 AS_IF([test "x$use_internal_libjaylink" = "xyes"], [
707 AS_IF([test -f "$srcdir/src/jtag/drivers/libjaylink/configure.ac"], [
708 AX_CONFIG_SUBDIR_OPTION([src/jtag/drivers/libjaylink],
709 [--enable-subproject-build])
711 AC_MSG_ERROR([Internal libjaylink not found, run 'git submodule init' and 'git submodule update'.])
716 # Presto needs the bitq module
717 AS_IF([test "x$enable_presto" != "xno"], [
721 # esp-usb-jtag also needs the bitq module
722 AS_IF([test "x$enable_esp_usb_jtag" != "xno"], [
726 AM_CONDITIONAL([RELEASE], [test "x$build_release" = "xyes"])
727 AM_CONDITIONAL([PARPORT], [test "x$build_parport" = "xyes"])
728 AM_CONDITIONAL([DUMMY], [test "x$build_dummy" = "xyes"])
729 AM_CONDITIONAL([GIVEIO], [test "x$parport_use_giveio" = "xyes"])
730 AM_CONDITIONAL([EP93XX], [test "x$build_ep93xx" = "xyes"])
731 AM_CONDITIONAL([AT91RM9200], [test "x$build_at91rm9200" = "xyes"])
732 AM_CONDITIONAL([BCM2835GPIO], [test "x$build_bcm2835gpio" = "xyes"])
733 AM_CONDITIONAL([IMX_GPIO], [test "x$build_imx_gpio" = "xyes"])
734 AM_CONDITIONAL([AM335XGPIO], [test "x$build_am335xgpio" = "xyes"])
735 AM_CONDITIONAL([BITBANG], [test "x$build_bitbang" = "xyes"])
736 AM_CONDITIONAL([JTAG_VPI], [test "x$build_jtag_vpi" = "xyes"])
737 AM_CONDITIONAL([VDEBUG], [test "x$build_vdebug" = "xyes"])
738 AM_CONDITIONAL([JTAG_DPI], [test "x$build_jtag_dpi" = "xyes"])
739 AM_CONDITIONAL([USB_BLASTER_DRIVER], [test "x$enable_usb_blaster" != "xno" -o "x$enable_usb_blaster_2" != "xno"])
740 AM_CONDITIONAL([AMTJTAGACCEL], [test "x$build_amtjtagaccel" = "xyes"])
741 AM_CONDITIONAL([GW16012], [test "x$build_gw16012" = "xyes"])
742 AM_CONDITIONAL([REMOTE_BITBANG], [test "x$build_remote_bitbang" = "xyes"])
743 AM_CONDITIONAL([BUSPIRATE], [test "x$enable_buspirate" != "xno"])
744 AM_CONDITIONAL([SYSFSGPIO], [test "x$build_sysfsgpio" = "xyes"])
745 AM_CONDITIONAL([XLNX_PCIE_XVC], [test "x$build_xlnx_pcie_xvc" = "xyes"])
746 AM_CONDITIONAL([USE_LIBUSB1], [test "x$use_libusb1" = "xyes"])
747 AM_CONDITIONAL([IS_CYGWIN], [test "x$is_cygwin" = "xyes"])
748 AM_CONDITIONAL([IS_MINGW], [test "x$is_mingw" = "xyes"])
749 AM_CONDITIONAL([IS_WIN32], [test "x$is_win32" = "xyes"])
750 AM_CONDITIONAL([IS_DARWIN], [test "x$is_darwin" = "xyes"])
751 AM_CONDITIONAL([BITQ], [test "x$build_bitq" = "xyes"])
752 AM_CONDITIONAL([USE_LIBFTDI], [test "x$use_libftdi" = "xyes"])
753 AM_CONDITIONAL([USE_LIBGPIOD], [test "x$use_libgpiod" = "xyes"])
754 AM_CONDITIONAL([USE_HIDAPI], [test "x$use_hidapi" = "xyes"])
755 AM_CONDITIONAL([USE_LIBJAYLINK], [test "x$use_libjaylink" = "xyes"])
756 AM_CONDITIONAL([RSHIM], [test "x$build_rshim" = "xyes"])
757 AM_CONDITIONAL([HAVE_CAPSTONE], [test "x$enable_capstone" != "xno"])
759 AM_CONDITIONAL([INTERNAL_JIMTCL], [test "x$use_internal_jimtcl" = "xyes"])
760 AM_CONDITIONAL([INTERNAL_LIBJAYLINK], [test "x$use_internal_libjaylink" = "xyes"])
762 # Look for environ alternatives. Possibility #1: is environ in unistd.h or stdlib.h?
763 AC_MSG_CHECKING([for environ in unistd.h and stdlib.h])
764 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
768 ]], [[char **ep = environ;]]
775 # Possibility #2: can environ be found in an available library?
776 AC_MSG_CHECKING([for extern environ])
777 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
778 extern char **environ;
779 ]], [[char **ep = environ;]]
781 AC_DEFINE(NEED_ENVIRON_EXTERN, [1], [Must declare 'environ' to use it.])
786 AC_MSG_RESULT([${has_environ}])
789 AS_IF([test "x${has_environ}" != "xyes" ], [
790 AC_MSG_FAILURE([Could not find 'environ' in unistd.h or available libraries.])
793 AC_DEFINE([_GNU_SOURCE],[1],[Use GNU C library extensions (e.g. stdndup).])
795 # set default gcc warnings
796 GCC_WARNINGS="-Wall -Wstrict-prototypes -Wformat-security -Wshadow"
797 AS_IF([test "x${gcc_wextra}" = "xyes"], [
798 GCC_WARNINGS="${GCC_WARNINGS} -Wextra -Wno-unused-parameter"
799 GCC_WARNINGS="${GCC_WARNINGS} -Wbad-function-cast"
800 GCC_WARNINGS="${GCC_WARNINGS} -Wcast-align"
801 GCC_WARNINGS="${GCC_WARNINGS} -Wredundant-decls"
802 GCC_WARNINGS="${GCC_WARNINGS} -Wpointer-arith"
803 GCC_WARNINGS="${GCC_WARNINGS} -Wundef"
805 AS_IF([test "x${gcc_werror}" = "xyes"], [
806 GCC_WARNINGS="${GCC_WARNINGS} -Werror"
809 # override default gcc cflags
810 AS_IF([test "x$gcc_warnings" = "xyes"], [
811 AC_SUBST([GCC_WARNINGS], [$GCC_WARNINGS])
814 AC_SUBST(EXTRA_DIST_NEWS, ["$(echo $srcdir/NEWS-*)"])
821 AS_IF([test "x$enable_jlink" != "xno"], [
822 AS_IF([test "x$use_internal_libjaylink" = "xyes"], [
823 AC_MSG_WARN([Using the internal libjaylink is deprecated and will not be possible in the future.])
829 echo OpenOCD configuration summary
830 echo --------------------------------------------------
831 m4_foreach([adapter], [USB1_ADAPTERS,
832 HIDAPI_ADAPTERS, HIDAPI_USB1_ADAPTERS, LIBFTDI_ADAPTERS,
833 LIBFTDI_USB1_ADAPTERS,
835 LIBJAYLINK_ADAPTERS, PCIE_ADAPTERS, SERIAL_PORT_ADAPTERS,
837 [s=m4_format(["%-40s"], ADAPTER_DESC([adapter]))
838 AS_CASE([$ADAPTER_VAR([adapter])],
840 echo "$s"yes '(auto)'