1 # SPDX-License-Identifier: GPL-2.0-or-later
4 AC_INIT([openocd], [0.11.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([dirent.h])
59 AC_CHECK_HEADERS([fcntl.h])
60 AC_CHECK_HEADERS([malloc.h])
61 AC_CHECK_HEADERS([netdb.h])
62 AC_CHECK_HEADERS([poll.h])
63 AC_CHECK_HEADERS([pthread.h])
64 AC_CHECK_HEADERS([strings.h])
65 AC_CHECK_HEADERS([sys/ioctl.h])
66 AC_CHECK_HEADERS([sys/param.h])
67 AC_CHECK_HEADERS([sys/select.h])
68 AC_CHECK_HEADERS([sys/stat.h])
69 AC_CHECK_HEADERS([sys/sysctl.h])
70 AC_CHECK_HEADERS([sys/time.h])
71 AC_CHECK_HEADERS([sys/types.h])
72 AC_CHECK_HEADERS([unistd.h])
73 AC_CHECK_HEADERS([arpa/inet.h ifaddrs.h netinet/in.h netinet/tcp.h net/if.h], [], [], [dnl
83 #ifdef HAVE_SYS_SOCKET_H
84 # include <sys/socket.h>
93 AC_CHECK_FUNCS([strndup])
94 AC_CHECK_FUNCS([strnlen])
95 AC_CHECK_FUNCS([gettimeofday])
96 AC_CHECK_FUNCS([usleep])
97 AC_CHECK_FUNCS([vasprintf])
98 AC_CHECK_FUNCS([realpath])
100 # guess-rev.sh only exists in the repository, not in the released archives
101 AC_MSG_CHECKING([whether to build a release])
102 AS_IF([test -x "$srcdir/guess-rev.sh"], [
107 AC_MSG_RESULT([$build_release])
110 # 1st column -- configure option
111 # 2nd column -- description
112 # 3rd column -- symbol used for both config.h and automake
113 m4_define([ADAPTER_ARG], [m4_argn([1], $1)])
114 m4_define([ADAPTER_DESC], [m4_argn([2], $1)])
115 m4_define([ADAPTER_SYM], [m4_argn([3], $1)])
116 m4_define([ADAPTER_VAR], [enable_[]ADAPTER_ARG($1)])
117 m4_define([ADAPTER_OPT], [m4_translit(ADAPTER_ARG($1), [_], [-])])
119 m4_define([USB1_ADAPTERS],
120 [[[ftdi], [MPSSE mode of FTDI based devices], [FTDI]],
121 [[stlink], [ST-Link Programmer], [HLADAPTER_STLINK]],
122 [[ti_icdi], [TI ICDI JTAG Programmer], [HLADAPTER_ICDI]],
123 [[ulink], [Keil ULINK JTAG Programmer], [ULINK]],
124 [[usb_blaster_2], [Altera USB-Blaster II Compatible], [USB_BLASTER_2]],
125 [[ft232r], [Bitbang mode of FT232R based devices], [FT232R]],
126 [[vsllink], [Versaloon-Link JTAG Programmer], [VSLLINK]],
127 [[xds110], [TI XDS110 Debug Probe], [XDS110]],
128 [[cmsis_dap_v2], [CMSIS-DAP v2 Compliant Debugger], [CMSIS_DAP_USB]],
129 [[osbdm], [OSBDM (JTAG only) Programmer], [OSBDM]],
130 [[opendous], [eStick/opendous JTAG Programmer], [OPENDOUS]],
131 [[armjtagew], [Olimex ARM-JTAG-EW Programmer], [ARMJTAGEW]],
132 [[rlink], [Raisonance RLink JTAG Programmer], [RLINK]],
133 [[usbprog], [USBProg JTAG Programmer], [USBPROG]],
134 [[esp_usb_jtag], [Espressif JTAG Programmer], [ESP_USB_JTAG]]])
136 m4_define([DEPRECATED_USB1_ADAPTERS],
137 [[[aice], [Andes JTAG Programmer (deprecated)], [AICE]]])
139 m4_define([HIDAPI_ADAPTERS],
140 [[[cmsis_dap], [CMSIS-DAP Compliant Debugger], [CMSIS_DAP_HID]],
141 [[nulink], [Nu-Link Programmer], [HLADAPTER_NULINK]]])
143 m4_define([HIDAPI_USB1_ADAPTERS],
144 [[[kitprog], [Cypress KitProg Programmer], [KITPROG]]])
146 m4_define([LIBFTDI_ADAPTERS],
147 [[[usb_blaster], [Altera USB-Blaster Compatible], [USB_BLASTER]],
148 [[presto], [ASIX Presto Adapter], [PRESTO]]])
150 m4_define([LIBFTDI_USB1_ADAPTERS],
151 [[[openjtag], [OpenJTAG Adapter], [OPENJTAG]]])
153 m4_define([LIBGPIOD_ADAPTERS],
154 [[[linuxgpiod], [Linux GPIO bitbang through libgpiod], [LINUXGPIOD]]])
156 m4_define([LIBJAYLINK_ADAPTERS],
157 [[[jlink], [SEGGER J-Link Programmer], [JLINK]]])
159 m4_define([PCIE_ADAPTERS],
160 [[[xlnx_pcie_xvc], [Xilinx XVC/PCIe], [XLNX_PCIE_XVC]]])
162 m4_define([SERIAL_PORT_ADAPTERS],
163 [[[buspirate], [Bus Pirate], [BUS_PIRATE]]])
165 m4_define([OPTIONAL_LIBRARIES],
166 [[[capstone], [Use Capstone disassembly framework], []]])
168 AC_ARG_ENABLE([doxygen-html],
169 AS_HELP_STRING([--disable-doxygen-html],
170 [Disable building Doxygen manual as HTML.]),
171 [doxygen_as_html=$enableval], [doxygen_as_html=yes])
172 AC_SUBST([doxygen_as_html])
173 AC_MSG_CHECKING([whether to build Doxygen as HTML])
174 AC_MSG_RESULT([$doxygen_as_html])
176 AC_ARG_ENABLE([doxygen-pdf],
177 AS_HELP_STRING([--enable-doxygen-pdf],
178 [Enable building Doxygen manual as PDF.]),
179 [doxygen_as_pdf=$enableval], [doxygen_as_pdf=no])
180 AC_SUBST([doxygen_as_pdf])
181 AC_MSG_CHECKING([whether to build Doxygen as PDF])
182 AC_MSG_RESULT([$doxygen_as_pdf])
184 AC_ARG_ENABLE([gccwarnings],
185 AS_HELP_STRING([--disable-gccwarnings], [Disable compiler warnings]),
186 [gcc_warnings=$enableval], [gcc_warnings=yes])
188 AC_ARG_ENABLE([wextra],
189 AS_HELP_STRING([--disable-wextra], [Disable extra compiler warnings]),
190 [gcc_wextra=$enableval], [gcc_wextra=$gcc_warnings])
192 AC_ARG_ENABLE([werror],
193 AS_HELP_STRING([--disable-werror], [Do not treat warnings as errors]),
194 [gcc_werror=$enableval], [gcc_werror=$gcc_warnings])
196 # set default verbose options, overridden by following options
200 AC_ARG_ENABLE([verbose],
201 AS_HELP_STRING([--enable-verbose],
202 [Enable verbose JTAG I/O messages (for debugging).]),
204 debug_usb_io=$enableval
205 debug_usb_comms=$enableval
208 AC_ARG_ENABLE([verbose_usb_io],
209 AS_HELP_STRING([--enable-verbose-usb-io],
210 [Enable verbose USB I/O messages (for debugging)]),
211 [debug_usb_io=$enableval], [])
213 AC_ARG_ENABLE([verbose_usb_comms],
214 AS_HELP_STRING([--enable-verbose-usb-comms],
215 [Enable verbose USB communication messages (for debugging)]),
216 [debug_usb_comms=$enableval], [])
218 AC_MSG_CHECKING([whether to enable verbose USB I/O messages]);
219 AC_MSG_RESULT([$debug_usb_io])
220 AS_IF([test "x$debug_usb_io" = "xyes"], [
221 AC_DEFINE([_DEBUG_USB_IO_],[1], [Print verbose USB I/O messages])
224 AC_MSG_CHECKING([whether to enable verbose USB communication messages]);
225 AC_MSG_RESULT([$debug_usb_comms])
226 AS_IF([test "x$debug_usb_comms" = "xyes"], [
227 AC_DEFINE([_DEBUG_USB_COMMS_],[1], [Print verbose USB communication messages])
231 AC_ARG_ENABLE([malloc_logging],
232 AS_HELP_STRING([--enable-malloc-logging],
233 [Include free space in logging messages (requires malloc.h).]),
234 [debug_malloc=$enableval], [])
236 AC_MSG_CHECKING([whether to enable malloc free space logging]);
237 AC_MSG_RESULT([$debug_malloc])
238 AS_IF([test "x$debug_malloc" = "xyes"], [
239 AC_DEFINE([_DEBUG_FREE_SPACE_],[1], [Include malloc free space in logging])
242 AC_ARG_ENABLE([dummy],
243 AS_HELP_STRING([--enable-dummy], [Enable building the dummy port driver]),
244 [build_dummy=$enableval], [build_dummy=no])
246 AC_ARG_ENABLE([rshim],
247 AS_HELP_STRING([--enable-rshim], [Enable building the rshim driver]),
248 [build_rshim=$enableval], [build_rshim=no])
250 m4_define([AC_ARG_ADAPTERS], [
251 m4_foreach([adapter], [$1],
252 [AC_ARG_ENABLE(ADAPTER_OPT([adapter]),
253 AS_HELP_STRING([--enable-ADAPTER_OPT([adapter])],
254 [Enable building support for the ]ADAPTER_DESC([adapter])[ (default is $2)]),
255 [], [ADAPTER_VAR([adapter])=$2])
262 HIDAPI_USB1_ADAPTERS,
264 LIBFTDI_USB1_ADAPTERS
266 SERIAL_PORT_ADAPTERS,
270 AC_ARG_ADAPTERS([DEPRECATED_USB1_ADAPTERS],[no])
272 AC_ARG_ENABLE([parport],
273 AS_HELP_STRING([--enable-parport], [Enable building the pc parallel port driver]),
274 [build_parport=$enableval], [build_parport=no])
276 AC_ARG_ENABLE([parport_ppdev],
277 AS_HELP_STRING([--disable-parport-ppdev],
278 [Disable use of ppdev (/dev/parportN) for parport (for x86 only)]),
279 [parport_use_ppdev=$enableval], [parport_use_ppdev=yes])
281 AC_ARG_ENABLE([parport_giveio],
282 AS_HELP_STRING([--enable-parport-giveio],
283 [Enable use of giveio for parport (for CygWin only)]),
284 [parport_use_giveio=$enableval], [parport_use_giveio=])
286 AC_ARG_ENABLE([jtag_vpi],
287 AS_HELP_STRING([--enable-jtag_vpi], [Enable building support for JTAG VPI]),
288 [build_jtag_vpi=$enableval], [build_jtag_vpi=no])
290 AC_ARG_ENABLE([vdebug],
291 AS_HELP_STRING([--enable-vdebug], [Enable building support for Cadence Virtual Debug Interface]),
292 [build_vdebug=$enableval], [build_vdebug=no])
294 AC_ARG_ENABLE([jtag_dpi],
295 AS_HELP_STRING([--enable-jtag_dpi], [Enable building support for JTAG DPI]),
296 [build_jtag_dpi=$enableval], [build_jtag_dpi=no])
298 AC_ARG_ENABLE([amtjtagaccel],
299 AS_HELP_STRING([--enable-amtjtagaccel], [Enable building the Amontec JTAG-Accelerator driver]),
300 [build_amtjtagaccel=$enableval], [build_amtjtagaccel=no])
302 AS_CASE(["${host_cpu}"],
304 AC_ARG_ENABLE([bcm2835gpio],
305 AS_HELP_STRING([--enable-bcm2835gpio], [Enable building support for bitbanging on BCM2835 (as found in Raspberry Pi)]),
306 [build_bcm2835gpio=$enableval], [build_bcm2835gpio=no])
307 AC_ARG_ENABLE([imx_gpio],
308 AS_HELP_STRING([--enable-imx_gpio], [Enable building support for bitbanging on NXP IMX processors]),
309 [build_imx_gpio=$enableval], [build_imx_gpio=no])
310 AC_ARG_ENABLE([am335xgpio],
311 AS_HELP_STRING([--enable-am335xgpio], [Enable building support for bitbanging on AM335x (as found in Beaglebones)]),
312 [build_am335xgpio=$enableval], [build_am335xgpio=no])
320 AS_CASE(["${host_cpu}"],
322 AC_ARG_ENABLE([ep93xx],
323 AS_HELP_STRING([--enable-ep93xx], [Enable building support for EP93xx based SBCs]),
324 [build_ep93xx=$enableval], [build_ep93xx=no])
326 AC_ARG_ENABLE([at91rm9200],
327 AS_HELP_STRING([--enable-at91rm9200], [Enable building support for AT91RM9200 based SBCs]),
328 [build_at91rm9200=$enableval], [build_at91rm9200=no])
335 AC_ARG_ENABLE([gw16012],
336 AS_HELP_STRING([--enable-gw16012], [Enable building support for the Gateworks GW16012 JTAG Programmer]),
337 [build_gw16012=$enableval], [build_gw16012=no])
339 AC_ARG_ENABLE([sysfsgpio],
340 AS_HELP_STRING([--enable-sysfsgpio], [Enable building support for programming driven via sysfs gpios.]),
341 [build_sysfsgpio=$enableval], [build_sysfsgpio=no])
343 AC_ARG_ENABLE([xlnx_pcie_xvc],
344 AS_HELP_STRING([--enable-xlnx-pcie-xvc], [Enable building support for Xilinx XVC/PCIe.]),
345 [build_xlnx_pcie_xvc=$enableval], [build_xlnx_pcie_xvc=no])
350 AS_IF([test "x$build_sysfsgpio" = "xyes"], [
351 AC_MSG_ERROR([sysfsgpio is only available on linux])
354 AS_IF([test "x$enable_linuxgpiod" = "xyes"], [
355 AC_MSG_ERROR([linuxgpiod is only available on linux])
358 AS_IF([test "x$build_xlnx_pcie_xvc" = "xyes"], [
359 AC_MSG_ERROR([xlnx_pcie_xvc is only available on linux])
362 AS_CASE([$host_os], [freebsd*], [],
364 AS_IF([test "x$build_rshim" = "xyes"], [
365 AC_MSG_ERROR([build_rshim is only available on linux or freebsd])
370 AC_ARG_ENABLE([internal-jimtcl],
371 AS_HELP_STRING([--disable-internal-jimtcl], [Disable building internal jimtcl]),
372 [use_internal_jimtcl=$enableval], [use_internal_jimtcl=yes])
374 AC_ARG_ENABLE([jimtcl-maintainer],
375 AS_HELP_STRING([--enable-jimtcl-maintainer], [Enable maintainer mode when building internal jimtcl]),
376 [use_internal_jimtcl_maintainer=$enableval], [use_internal_jimtcl_maintainer=no])
378 AC_ARG_ENABLE([internal-libjaylink],
379 AS_HELP_STRING([--disable-internal-libjaylink],
380 [Disable building internal libjaylink]),
381 [use_internal_libjaylink=$enableval], [use_internal_libjaylink=yes])
383 AC_ARG_ENABLE([remote-bitbang],
384 AS_HELP_STRING([--enable-remote-bitbang], [Enable building support for the Remote Bitbang jtag driver]),
385 [build_remote_bitbang=$enableval], [build_remote_bitbang=no])
387 AS_CASE(["${host_cpu}"],
390 AS_IF([test "x$parport_use_ppdev" = "xno"], [
391 AC_MSG_WARN([--disable-parport-ppdev is not supported by the host CPU])
393 parport_use_ppdev=yes
401 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[return __MINGW32__;]])],
402 [is_mingw=yes],[is_mingw=no])
403 AS_IF([test "x$is_mingw" = "xyes"], [
404 AS_IF([test "x$parport_use_giveio" = "xno"], [
405 AC_MSG_WARN([--disable-parport-giveio is not supported by MinGW32 hosts])
407 parport_use_giveio=yes
411 # sys/io.h needed under cygwin for parport access
412 AS_IF([test "x$build_parport" = "xyes"], [
413 AC_CHECK_HEADERS([sys/io.h],[],AC_MSG_ERROR([Please install the cygwin ioperm package]))
417 [*-mingw* | *-msys*], [
422 AS_IF([test "x$parport_use_giveio" = "xno"], [
423 AC_MSG_WARN([--disable-parport-giveio is not supported by MinGW32 hosts])
425 parport_use_giveio=yes
427 AS_IF([test "x$enable_buspirate" = "xyes"], [
428 AC_MSG_ERROR([buspirate currently not supported by MinGW32 hosts])
431 # In case enable_buspirate=auto, make sure it will not be built.
434 AC_SUBST([HOST_CPPFLAGS], [-D__USE_MINGW_ANSI_STDIO])
439 AS_IF([test "x$parport_use_giveio" = "xyes"], [
440 AC_MSG_WARN([--enable-parport-giveio cannot be used by Darwin hosts])
442 parport_use_giveio=no
445 AS_IF([test "x$parport_use_giveio" = "xyes"], [
446 AC_MSG_WARN([--enable-parport-giveio cannot be used by ]$host[ hosts])
448 parport_use_giveio=no
451 AS_IF([test "x$is_cygwin" = "xyes"], [
452 AC_DEFINE([IS_CYGWIN], [1], [1 if building for Cygwin.])
454 AC_DEFINE([IS_CYGWIN], [0], [0 if not building for Cygwin.])
457 AS_IF([test "x$is_mingw" = "xyes"], [
458 AC_DEFINE([IS_MINGW], [1], [1 if building for Mingw.])
460 AC_DEFINE([IS_MINGW], [0], [0 if not building for Mingw.])
463 AS_IF([test "x$is_win32" = "xyes"], [
464 AC_DEFINE([IS_WIN32], [1], [1 if building for Win32.])
466 AC_DEFINE([IS_WIN32], [0], [0 if not building for Win32.])
469 AS_IF([test "x$is_darwin" = "xyes"], [
470 AC_DEFINE([IS_DARWIN], [1], [1 if building for Darwin.])
472 AC_DEFINE([IS_DARWIN], [0], [0 if not building for Darwin.])
475 AS_IF([test "x$build_parport" = "xyes"], [
477 AC_DEFINE([BUILD_PARPORT], [1], [1 if you want parport.])
479 AC_DEFINE([BUILD_PARPORT], [0], [0 if you don't want parport.])
482 AS_IF([test "x$build_rshim" = "xyes"], [
483 AC_DEFINE([BUILD_RSHIM], [1], [1 if you want to debug BlueField SoC via rshim.])
485 AC_DEFINE([BUILD_RSHIM], [0], [0 if you don't want to debug BlueField SoC via rshim.])
488 AS_IF([test "x$build_dummy" = "xyes"], [
490 AC_DEFINE([BUILD_DUMMY], [1], [1 if you want dummy driver.])
492 AC_DEFINE([BUILD_DUMMY], [0], [0 if you don't want dummy driver.])
495 AS_IF([test "x$build_ep93xx" = "xyes"], [
497 AC_DEFINE([BUILD_EP93XX], [1], [1 if you want ep93xx.])
499 AC_DEFINE([BUILD_EP93XX], [0], [0 if you don't want ep93xx.])
502 AS_IF([test "x$build_at91rm9200" = "xyes"], [
504 AC_DEFINE([BUILD_AT91RM9200], [1], [1 if you want at91rm9200.])
506 AC_DEFINE([BUILD_AT91RM9200], [0], [0 if you don't want at91rm9200.])
509 AS_IF([test "x$build_bcm2835gpio" = "xyes"], [
511 AC_DEFINE([BUILD_BCM2835GPIO], [1], [1 if you want bcm2835gpio.])
513 AC_DEFINE([BUILD_BCM2835GPIO], [0], [0 if you don't want bcm2835gpio.])
516 AS_IF([test "x$build_imx_gpio" = "xyes"], [
518 AC_DEFINE([BUILD_IMX_GPIO], [1], [1 if you want imx_gpio.])
520 AC_DEFINE([BUILD_IMX_GPIO], [0], [0 if you don't want imx_gpio.])
523 AS_IF([test "x$build_am335xgpio" = "xyes"], [
525 AC_DEFINE([BUILD_AM335XGPIO], [1], [1 if you want am335xgpio.])
527 AC_DEFINE([BUILD_AM335XGPIO], [0], [0 if you don't want am335xgpio.])
530 AS_IF([test "x$parport_use_ppdev" = "xyes"], [
531 AC_DEFINE([PARPORT_USE_PPDEV], [1], [1 if you want parport to use ppdev.])
533 AC_DEFINE([PARPORT_USE_PPDEV], [0], [0 if you don't want parport to use ppdev.])
536 AS_IF([test "x$parport_use_giveio" = "xyes"], [
537 AC_DEFINE([PARPORT_USE_GIVEIO], [1], [1 if you want parport to use giveio.])
539 AC_DEFINE([PARPORT_USE_GIVEIO], [0], [0 if you don't want parport to use giveio.])
542 AS_IF([test "x$build_jtag_vpi" = "xyes"], [
543 AC_DEFINE([BUILD_JTAG_VPI], [1], [1 if you want JTAG VPI.])
545 AC_DEFINE([BUILD_JTAG_VPI], [0], [0 if you don't want JTAG VPI.])
548 AS_IF([test "x$build_vdebug" = "xyes"], [
549 AC_DEFINE([BUILD_VDEBUG], [1], [1 if you want Cadence vdebug interface.])
551 AC_DEFINE([BUILD_VDEBUG], [0], [0 if you don't want Cadence vdebug interface.])
554 AS_IF([test "x$build_jtag_dpi" = "xyes"], [
555 AC_DEFINE([BUILD_JTAG_DPI], [1], [1 if you want JTAG DPI.])
557 AC_DEFINE([BUILD_JTAG_DPI], [0], [0 if you don't want JTAG DPI.])
561 AS_IF([test "x$build_amtjtagaccel" = "xyes"], [
562 AC_DEFINE([BUILD_AMTJTAGACCEL], [1], [1 if you want the Amontec JTAG-Accelerator driver.])
564 AC_DEFINE([BUILD_AMTJTAGACCEL], [0], [0 if you don't want the Amontec JTAG-Accelerator driver.])
567 AS_IF([test "x$build_gw16012" = "xyes"], [
568 AC_DEFINE([BUILD_GW16012], [1], [1 if you want the Gateworks GW16012 driver.])
570 AC_DEFINE([BUILD_GW16012], [0], [0 if you don't want the Gateworks GW16012 driver.])
573 AS_IF([test "x$enable_buspirate" != "xno"], [
574 AC_DEFINE([BUILD_BUSPIRATE], [1], [1 if you want the Buspirate JTAG driver.])
576 AC_DEFINE([BUILD_BUSPIRATE], [0], [0 if you don't want the Buspirate JTAG driver.])
579 AS_IF([test "x$use_internal_jimtcl" = "xyes"], [
580 AS_IF([test -f "$srcdir/jimtcl/configure.ac"], [
581 AS_IF([test "x$use_internal_jimtcl_maintainer" = "xyes"], [
582 jimtcl_config_options="--disable-install-jim --with-ext=json --maintainer"
584 jimtcl_config_options="--disable-install-jim --with-ext=json"
586 AX_CONFIG_SUBDIR_OPTION([jimtcl], [$jimtcl_config_options])
588 AC_MSG_ERROR([jimtcl not found, run git submodule init and git submodule update.])
592 AS_IF([test "x$build_remote_bitbang" = "xyes"], [
594 AC_DEFINE([BUILD_REMOTE_BITBANG], [1], [1 if you want the Remote Bitbang JTAG driver.])
596 AC_DEFINE([BUILD_REMOTE_BITBANG], [0], [0 if you don't want the Remote Bitbang JTAG driver.])
599 AS_IF([test "x$build_sysfsgpio" = "xyes"], [
601 AC_DEFINE([BUILD_SYSFSGPIO], [1], [1 if you want the SysfsGPIO driver.])
603 AC_DEFINE([BUILD_SYSFSGPIO], [0], [0 if you don't want SysfsGPIO driver.])
606 AS_IF([test "x$build_xlnx_pcie_xvc" = "xyes"], [
607 build_xlnx_pcie_xvc=yes
608 AC_DEFINE([BUILD_XLNX_PCIE_XVC], [1], [1 if you want the Xilinx XVC/PCIe driver.])
610 AC_DEFINE([BUILD_XLNX_PCIE_XVC], [0], [0 if you don't want Xilinx XVC/PCIe driver.])
613 PKG_CHECK_MODULES([LIBUSB1], [libusb-1.0], [
615 AC_DEFINE([HAVE_LIBUSB1], [1], [Define if you have libusb-1.x])
616 LIBUSB1_CFLAGS=`echo $LIBUSB1_CFLAGS | sed 's/-I/-isystem /'`
617 AC_MSG_NOTICE([libusb-1.0 header bug workaround: LIBUSB1_CFLAGS changed to "$LIBUSB1_CFLAGS"])
618 PKG_CHECK_EXISTS([libusb-1.0 >= 1.0.16],
619 [AC_DEFINE([HAVE_LIBUSB_GET_PORT_NUMBERS], [1], [Define if your libusb has libusb_get_port_numbers()])])
622 AC_MSG_WARN([libusb-1.x not found, trying legacy libusb-0.1 as a fallback; consider installing libusb-1.x instead])
625 AC_ARG_WITH([capstone],
626 AS_HELP_STRING([--with-capstone], [Use Capstone disassembly library (default=auto)])
628 enable_capstone=$withval
633 AS_IF([test "x$enable_capstone" != xno], [
634 PKG_CHECK_MODULES([CAPSTONE], [capstone], [
635 AC_DEFINE([HAVE_CAPSTONE], [1], [1 if you have Capstone disassembly framework.])
637 AC_DEFINE([HAVE_CAPSTONE], [0], [0 if you don't have Capstone disassembly framework.])
638 if test "x$enable_capstone" != xauto; then
639 AC_MSG_ERROR([--with-capstone was given, but test for Capstone failed])
645 for hidapi_lib in hidapi hidapi-hidraw hidapi-libusb; do
646 PKG_CHECK_MODULES([HIDAPI],[$hidapi_lib],[
654 PKG_CHECK_MODULES([LIBFTDI], [libftdi1], [
656 PKG_CHECK_EXISTS([libftdi1 >= 1.5],
657 [AC_DEFINE([HAVE_LIBFTDI_TCIOFLUSH], [1], [Define if your libftdi has ftdi_tcioflush()])])
659 PKG_CHECK_MODULES([LIBFTDI], [libftdi], [use_libftdi=yes], [use_libftdi=no])
662 PKG_CHECK_MODULES([LIBGPIOD], [libgpiod], [use_libgpiod=yes], [use_libgpiod=no])
664 PKG_CHECK_MODULES([LIBJAYLINK], [libjaylink >= 0.2],
665 [use_libjaylink=yes], [use_libjaylink=no])
667 m4_define([PROCESS_ADAPTERS], [
668 m4_foreach([adapter], [$1], [
670 AS_IF([test "x$ADAPTER_VAR([adapter])" != "xno"], [
671 AC_DEFINE([BUILD_]ADAPTER_SYM([adapter]), [1], [1 if you want the ]ADAPTER_DESC([adapter]).)
673 AC_DEFINE([BUILD_]ADAPTER_SYM([adapter]), [0], [0 if you do not want the ]ADAPTER_DESC([adapter]).)
676 AS_IF([test "x$ADAPTER_VAR([adapter])" = "xyes"], [
677 AC_MSG_ERROR([$3 is required for the ADAPTER_DESC([adapter])])
679 ADAPTER_VAR([adapter])=no
680 AC_DEFINE([BUILD_]ADAPTER_SYM([adapter]), [0], [0 if you do not want the ]ADAPTER_DESC([adapter]).)
682 AM_CONDITIONAL(ADAPTER_SYM([adapter]), [test "x$ADAPTER_VAR([adapter])" != "xno"])
686 PROCESS_ADAPTERS([USB1_ADAPTERS], ["x$use_libusb1" = "xyes"], [libusb-1.x])
687 PROCESS_ADAPTERS([DEPRECATED_USB1_ADAPTERS], ["x$use_libusb1" = "xyes"], [libusb-1.x])
688 PROCESS_ADAPTERS([HIDAPI_ADAPTERS], ["x$use_hidapi" = "xyes"], [hidapi])
689 PROCESS_ADAPTERS([HIDAPI_USB1_ADAPTERS], ["x$use_hidapi" = "xyes" -a "x$use_libusb1" = "xyes"], [hidapi and libusb-1.x])
690 PROCESS_ADAPTERS([LIBFTDI_ADAPTERS], ["x$use_libftdi" = "xyes"], [libftdi])
691 PROCESS_ADAPTERS([LIBFTDI_USB1_ADAPTERS], ["x$use_libftdi" = "xyes" -a "x$use_libusb1" = "xyes"], [libftdi and libusb-1.x])
692 PROCESS_ADAPTERS([LIBGPIOD_ADAPTERS], ["x$use_libgpiod" = "xyes"], [libgpiod])
693 PROCESS_ADAPTERS([LIBJAYLINK_ADAPTERS], ["x$use_internal_libjaylink" = "xyes" -o "x$use_libjaylink" = "xyes"], [libjaylink-0.2])
695 AS_IF([test "x$enable_linuxgpiod" != "xno"], [
699 AS_IF([test "x$enable_stlink" != "xno" -o "x$enable_ti_icdi" != "xno" -o "x$enable_nulink" != "xno"], [
700 AC_DEFINE([BUILD_HLADAPTER], [1], [1 if you want the High Level JTAG driver.])
701 AM_CONDITIONAL([HLADAPTER], [true])
703 AC_DEFINE([BUILD_HLADAPTER], [0], [0 if you want the High Level JTAG driver.])
704 AM_CONDITIONAL([HLADAPTER], [false])
706 AM_CONDITIONAL([HLADAPTER_STLINK], [test "x$enable_stlink" != "xno"])
707 AM_CONDITIONAL([HLADAPTER_ICDI], [test "x$enable_ti_icdi" != "xno"])
708 AM_CONDITIONAL([HLADAPTER_NULINK], [test "x$enable_nulink" != "xno"])
710 AS_IF([test "x$enable_jlink" != "xno"], [
711 AS_IF([test "x$use_internal_libjaylink" = "xyes"], [
712 AS_IF([test -f "$srcdir/src/jtag/drivers/libjaylink/configure.ac"], [
713 AX_CONFIG_SUBDIR_OPTION([src/jtag/drivers/libjaylink],
714 [--enable-subproject-build])
716 AC_MSG_ERROR([Internal libjaylink not found, run either 'git submodule init' and 'git submodule update' or disable internal libjaylink with --disable-internal-libjaylink.])
721 # Presto needs the bitq module
722 AS_IF([test "x$enable_presto" != "xno"], [
726 # esp-usb-jtag also needs the bitq module
727 AS_IF([test "x$enable_esp_usb_jtag" != "xno"], [
731 AM_CONDITIONAL([RELEASE], [test "x$build_release" = "xyes"])
732 AM_CONDITIONAL([PARPORT], [test "x$build_parport" = "xyes"])
733 AM_CONDITIONAL([DUMMY], [test "x$build_dummy" = "xyes"])
734 AM_CONDITIONAL([GIVEIO], [test "x$parport_use_giveio" = "xyes"])
735 AM_CONDITIONAL([EP93XX], [test "x$build_ep93xx" = "xyes"])
736 AM_CONDITIONAL([AT91RM9200], [test "x$build_at91rm9200" = "xyes"])
737 AM_CONDITIONAL([BCM2835GPIO], [test "x$build_bcm2835gpio" = "xyes"])
738 AM_CONDITIONAL([IMX_GPIO], [test "x$build_imx_gpio" = "xyes"])
739 AM_CONDITIONAL([AM335XGPIO], [test "x$build_am335xgpio" = "xyes"])
740 AM_CONDITIONAL([BITBANG], [test "x$build_bitbang" = "xyes"])
741 AM_CONDITIONAL([JTAG_VPI], [test "x$build_jtag_vpi" = "xyes"])
742 AM_CONDITIONAL([VDEBUG], [test "x$build_vdebug" = "xyes"])
743 AM_CONDITIONAL([JTAG_DPI], [test "x$build_jtag_dpi" = "xyes"])
744 AM_CONDITIONAL([USB_BLASTER_DRIVER], [test "x$enable_usb_blaster" != "xno" -o "x$enable_usb_blaster_2" != "xno"])
745 AM_CONDITIONAL([AMTJTAGACCEL], [test "x$build_amtjtagaccel" = "xyes"])
746 AM_CONDITIONAL([GW16012], [test "x$build_gw16012" = "xyes"])
747 AM_CONDITIONAL([REMOTE_BITBANG], [test "x$build_remote_bitbang" = "xyes"])
748 AM_CONDITIONAL([BUSPIRATE], [test "x$enable_buspirate" != "xno"])
749 AM_CONDITIONAL([SYSFSGPIO], [test "x$build_sysfsgpio" = "xyes"])
750 AM_CONDITIONAL([XLNX_PCIE_XVC], [test "x$build_xlnx_pcie_xvc" = "xyes"])
751 AM_CONDITIONAL([USE_LIBUSB1], [test "x$use_libusb1" = "xyes"])
752 AM_CONDITIONAL([IS_CYGWIN], [test "x$is_cygwin" = "xyes"])
753 AM_CONDITIONAL([IS_MINGW], [test "x$is_mingw" = "xyes"])
754 AM_CONDITIONAL([IS_WIN32], [test "x$is_win32" = "xyes"])
755 AM_CONDITIONAL([IS_DARWIN], [test "x$is_darwin" = "xyes"])
756 AM_CONDITIONAL([BITQ], [test "x$build_bitq" = "xyes"])
757 AM_CONDITIONAL([USE_LIBFTDI], [test "x$use_libftdi" = "xyes"])
758 AM_CONDITIONAL([USE_LIBGPIOD], [test "x$use_libgpiod" = "xyes"])
759 AM_CONDITIONAL([USE_HIDAPI], [test "x$use_hidapi" = "xyes"])
760 AM_CONDITIONAL([USE_LIBJAYLINK], [test "x$use_libjaylink" = "xyes"])
761 AM_CONDITIONAL([RSHIM], [test "x$build_rshim" = "xyes"])
762 AM_CONDITIONAL([HAVE_CAPSTONE], [test "x$enable_capstone" != "xno"])
764 AM_CONDITIONAL([INTERNAL_JIMTCL], [test "x$use_internal_jimtcl" = "xyes"])
765 AM_CONDITIONAL([INTERNAL_LIBJAYLINK], [test "x$use_internal_libjaylink" = "xyes"])
767 # Look for environ alternatives. Possibility #1: is environ in unistd.h or stdlib.h?
768 AC_MSG_CHECKING([for environ in unistd.h and stdlib.h])
769 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
773 ]], [[char **ep = environ;]]
780 # Possibility #2: can environ be found in an available library?
781 AC_MSG_CHECKING([for extern environ])
782 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
783 extern char **environ;
784 ]], [[char **ep = environ;]]
786 AC_DEFINE(NEED_ENVIRON_EXTERN, [1], [Must declare 'environ' to use it.])
791 AC_MSG_RESULT([${has_environ}])
794 AS_IF([test "x${has_environ}" != "xyes" ], [
795 AC_MSG_FAILURE([Could not find 'environ' in unistd.h or available libraries.])
798 AC_DEFINE([_GNU_SOURCE],[1],[Use GNU C library extensions (e.g. stdndup).])
800 # set default gcc warnings
801 GCC_WARNINGS="-Wall -Wstrict-prototypes -Wformat-security -Wshadow"
802 AS_IF([test "x${gcc_wextra}" = "xyes"], [
803 GCC_WARNINGS="${GCC_WARNINGS} -Wextra -Wno-unused-parameter"
804 GCC_WARNINGS="${GCC_WARNINGS} -Wbad-function-cast"
805 GCC_WARNINGS="${GCC_WARNINGS} -Wcast-align"
806 GCC_WARNINGS="${GCC_WARNINGS} -Wredundant-decls"
807 GCC_WARNINGS="${GCC_WARNINGS} -Wpointer-arith"
808 GCC_WARNINGS="${GCC_WARNINGS} -Wundef"
810 AS_IF([test "x${gcc_werror}" = "xyes"], [
811 GCC_WARNINGS="${GCC_WARNINGS} -Werror"
814 # override default gcc cflags
815 AS_IF([test "x$gcc_warnings" = "xyes"], [
816 AC_SUBST([GCC_WARNINGS], [$GCC_WARNINGS])
819 AC_SUBST(EXTRA_DIST_NEWS, ["$(echo $srcdir/NEWS-*)"])
828 echo OpenOCD configuration summary
829 echo --------------------------------------------------
830 m4_foreach([adapter], [USB1_ADAPTERS,
831 DEPRECATED_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)'