2 AC_INIT([openocd], [0.10.0+dev],
3 [OpenOCD Mailing List <openocd-devel@lists.sourceforge.net>])
4 AC_CONFIG_SRCDIR([src/openocd.c])
6 m4_include([config_subdir.m4])dnl
8 # check for makeinfo before calling AM_INIT_AUTOMAKE
9 AC_CHECK_PROG([MAKEINFO], [makeinfo], [makeinfo])
10 AS_IF([test "x$MAKEINFO" = "x"], [
11 MAKEINFO='echo makeinfo missing; true'
12 AC_MSG_WARN([Info documentation will not be built.])
16 AM_INIT_AUTOMAKE([-Wall -Wno-portability dist-bzip2 dist-zip subdir-objects])
18 AC_CONFIG_HEADERS([config.h])
20 #include <helper/system.h>
21 #include <helper/types.h>
22 #include <helper/replacements.h>
30 PKG_PROG_PKG_CONFIG([0.23])
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], [:])
38 AC_SUBST([LIBTOOL_DEPS])
40 dnl configure checks required for Jim files (these are obsolete w/ C99)
44 AC_SEARCH_LIBS([ioperm], [ioperm])
45 AC_SEARCH_LIBS([dlopen], [dl])
47 AC_CHECK_HEADERS([sys/socket.h])
48 AC_CHECK_HEADERS([elf.h])
49 AC_CHECK_HEADERS([dirent.h])
50 AC_CHECK_HEADERS([fcntl.h])
51 AC_CHECK_HEADERS([malloc.h])
52 AC_CHECK_HEADERS([netdb.h])
53 AC_CHECK_HEADERS([poll.h])
54 AC_CHECK_HEADERS([pthread.h])
55 AC_CHECK_HEADERS([strings.h])
56 AC_CHECK_HEADERS([sys/ioctl.h])
57 AC_CHECK_HEADERS([sys/param.h])
58 AC_CHECK_HEADERS([sys/select.h])
59 AC_CHECK_HEADERS([sys/stat.h])
60 AC_CHECK_HEADERS([sys/sysctl.h])
61 AC_CHECK_HEADERS([sys/time.h])
62 AC_CHECK_HEADERS([sys/types.h])
63 AC_CHECK_HEADERS([unistd.h])
64 AC_CHECK_HEADERS([arpa/inet.h ifaddrs.h netinet/in.h netinet/tcp.h net/if.h], [], [], [dnl
74 #ifdef HAVE_SYS_SOCKET_H
75 # include <sys/socket.h>
85 AC_CHECK_FUNCS([strndup])
86 AC_CHECK_FUNCS([strnlen])
87 AC_CHECK_FUNCS([gettimeofday])
88 AC_CHECK_FUNCS([usleep])
89 AC_CHECK_FUNCS([vasprintf])
90 AC_CHECK_FUNCS([realpath])
92 # guess-rev.sh only exists in the repository, not in the released archives
93 AC_MSG_CHECKING([whether to build a release])
94 AS_IF([test -x "$srcdir/guess-rev.sh"], [
99 AC_MSG_RESULT([$build_release])
102 # 1st column -- configure option
103 # 2nd column -- description
104 # 3rd column -- symbol used for both config.h and automake
105 m4_define([ADAPTER_ARG], [m4_argn([1], $1)])
106 m4_define([ADAPTER_DESC], [m4_argn([2], $1)])
107 m4_define([ADAPTER_SYM], [m4_argn([3], $1)])
108 m4_define([ADAPTER_VAR], [enable_[]ADAPTER_ARG($1)])
109 m4_define([ADAPTER_OPT], [m4_translit(ADAPTER_ARG($1), [_], [-])])
111 m4_define([USB1_ADAPTERS],
112 [[[ftdi], [MPSSE mode of FTDI based devices], [FTDI]],
113 [[stlink], [ST-Link Programmer], [HLADAPTER_STLINK]],
114 [[ti_icdi], [TI ICDI JTAG Programmer], [HLADAPTER_ICDI]],
115 [[ulink], [Keil ULINK JTAG Programmer], [ULINK]],
116 [[usb_blaster_2], [Altera USB-Blaster II Compatible], [USB_BLASTER_2]],
117 [[ft232r], [Bitbang mode of FT232R based devices], [FT232R]],
118 [[vsllink], [Versaloon-Link JTAG Programmer], [VSLLINK]],
119 [[xds110], [TI XDS110 Debug Probe], [XDS110]],
120 [[osbdm], [OSBDM (JTAG only) Programmer], [OSBDM]],
121 [[opendous], [eStick/opendous JTAG Programmer], [OPENDOUS]],
122 [[aice], [Andes JTAG Programmer], [AICE]]])
124 m4_define([USB0_ADAPTERS],
125 [[[usbprog], [USBProg JTAG Programmer], [USBPROG]],
126 [[rlink], [Raisonance RLink JTAG Programmer], [RLINK]],
127 [[armjtagew], [Olimex ARM-JTAG-EW Programmer], [ARMJTAGEW]]])
129 m4_define([HIDAPI_ADAPTERS],
130 [[[cmsis_dap], [CMSIS-DAP Compliant Debugger], [CMSIS_DAP]]])
132 m4_define([HIDAPI_USB1_ADAPTERS],
133 [[[kitprog], [Cypress KitProg Programmer], [KITPROG]]])
135 m4_define([LIBFTDI_ADAPTERS],
136 [[[usb_blaster], [Altera USB-Blaster Compatible], [USB_BLASTER]],
137 [[presto], [ASIX Presto Adapter], [PRESTO]],
138 [[openjtag], [OpenJTAG Adapter], [OPENJTAG]]])
140 m4_define([LIBJAYLINK_ADAPTERS],
141 [[[jlink], [SEGGER J-Link Programmer], [JLINK]]])
143 m4_define([PCIE_ADAPTERS],
144 [[[xlnx_pcie_xvc], [Xilinx XVC/PCIe], [XLNX_PCIE_XVC]]])
147 AC_ARG_ENABLE([doxygen-html],
148 AS_HELP_STRING([--disable-doxygen-html],
149 [Disable building Doxygen manual as HTML.]),
150 [doxygen_as_html=$enableval], [doxygen_as_html=yes])
151 AC_SUBST([doxygen_as_html])
152 AC_MSG_CHECKING([whether to build Doxygen as HTML])
153 AC_MSG_RESULT([$doxygen_as_html])
155 AC_ARG_ENABLE([doxygen-pdf],
156 AS_HELP_STRING([--enable-doxygen-pdf],
157 [Enable building Doxygen manual as PDF.]),
158 [doxygen_as_pdf=$enableval], [doxygen_as_pdf=no])
159 AC_SUBST([doxygen_as_pdf])
160 AC_MSG_CHECKING([whether to build Doxygen as PDF])
161 AC_MSG_RESULT([$doxygen_as_pdf])
163 AC_ARG_ENABLE([gccwarnings],
164 AS_HELP_STRING([--disable-gccwarnings], [Disable compiler warnings]),
165 [gcc_warnings=$enableval], [gcc_warnings=yes])
167 AC_ARG_ENABLE([wextra],
168 AS_HELP_STRING([--disable-wextra], [Disable extra compiler warnings]),
169 [gcc_wextra=$enableval], [gcc_wextra=$gcc_warnings])
171 AC_ARG_ENABLE([werror],
172 AS_HELP_STRING([--disable-werror], [Do not treat warnings as errors]),
173 [gcc_werror=$enableval], [gcc_werror=$gcc_warnings])
175 # set default verbose options, overridden by following options
179 AC_ARG_ENABLE([verbose],
180 AS_HELP_STRING([--enable-verbose],
181 [Enable verbose JTAG I/O messages (for debugging).]),
183 debug_usb_io=$enableval
184 debug_usb_comms=$enableval
187 AC_ARG_ENABLE([verbose_usb_io],
188 AS_HELP_STRING([--enable-verbose-usb-io],
189 [Enable verbose USB I/O messages (for debugging)]),
190 [debug_usb_io=$enableval], [])
192 AC_ARG_ENABLE([verbose_usb_comms],
193 AS_HELP_STRING([--enable-verbose-usb-comms],
194 [Enable verbose USB communication messages (for debugging)]),
195 [debug_usb_comms=$enableval], [])
197 AC_MSG_CHECKING([whether to enable verbose USB I/O messages]);
198 AC_MSG_RESULT([$debug_usb_io])
199 AS_IF([test "x$debug_usb_io" = "xyes"], [
200 AC_DEFINE([_DEBUG_USB_IO_],[1], [Print verbose USB I/O messages])
203 AC_MSG_CHECKING([whether to enable verbose USB communication messages]);
204 AC_MSG_RESULT([$debug_usb_comms])
205 AS_IF([test "x$debug_usb_comms" = "xyes"], [
206 AC_DEFINE([_DEBUG_USB_COMMS_],[1], [Print verbose USB communication messages])
210 AC_ARG_ENABLE([malloc_logging],
211 AS_HELP_STRING([--enable-malloc-logging],
212 [Include free space in logging messages (requires malloc.h).]),
213 [debug_malloc=$enableval], [])
215 AC_MSG_CHECKING([whether to enable malloc free space logging]);
216 AC_MSG_RESULT([$debug_malloc])
217 AS_IF([test "x$debug_malloc" = "xyes"], [
218 AC_DEFINE([_DEBUG_FREE_SPACE_],[1], [Include malloc free space in logging])
221 AC_ARG_ENABLE([dummy],
222 AS_HELP_STRING([--enable-dummy], [Enable building the dummy port driver]),
223 [build_dummy=$enableval], [build_dummy=no])
225 AC_ARG_ENABLE([rshim],
226 AS_HELP_STRING([--enable-rshim], [Enable building the rshim driver]),
227 [build_rshim=$enableval], [build_rshim=no])
229 m4_define([AC_ARG_ADAPTERS], [
230 m4_foreach([adapter], [$1],
231 [AC_ARG_ENABLE(ADAPTER_OPT([adapter]),
232 AS_HELP_STRING([--enable-ADAPTER_OPT([adapter])],
233 [Enable building support for the ]ADAPTER_DESC([adapter])[ (default is $2)]),
234 [], [ADAPTER_VAR([adapter])=$2])
242 HIDAPI_USB1_ADAPTERS,
247 AC_ARG_ENABLE([parport],
248 AS_HELP_STRING([--enable-parport], [Enable building the pc parallel port driver]),
249 [build_parport=$enableval], [build_parport=no])
251 AC_ARG_ENABLE([parport_ppdev],
252 AS_HELP_STRING([--disable-parport-ppdev],
253 [Disable use of ppdev (/dev/parportN) for parport (for x86 only)]),
254 [parport_use_ppdev=$enableval], [parport_use_ppdev=yes])
256 AC_ARG_ENABLE([parport_giveio],
257 AS_HELP_STRING([--enable-parport-giveio],
258 [Enable use of giveio for parport (for CygWin only)]),
259 [parport_use_giveio=$enableval], [parport_use_giveio=])
261 AC_ARG_ENABLE([jtag_vpi],
262 AS_HELP_STRING([--enable-jtag_vpi], [Enable building support for JTAG VPI]),
263 [build_jtag_vpi=$enableval], [build_jtag_vpi=no])
265 AC_ARG_ENABLE([amtjtagaccel],
266 AS_HELP_STRING([--enable-amtjtagaccel], [Enable building the Amontec JTAG-Accelerator driver]),
267 [build_amtjtagaccel=$enableval], [build_amtjtagaccel=no])
269 AC_ARG_ENABLE([zy1000_master],
270 AS_HELP_STRING([--enable-zy1000-master], [Use ZY1000 JTAG master registers]),
271 [build_zy1000_master=$enableval], [build_zy1000_master=no])
273 AC_ARG_ENABLE([zy1000],
274 AS_HELP_STRING([--enable-zy1000], [Enable ZY1000 interface]),
275 [build_zy1000=$enableval], [build_zy1000=no])
277 AC_ARG_ENABLE([ioutil],
278 AS_HELP_STRING([--enable-ioutil], [Enable ioutil functions - useful for standalone OpenOCD implementations]),
279 [build_ioutil=$enableval], [build_ioutil=no])
281 AS_CASE(["${host_cpu}"],
283 AC_ARG_ENABLE([bcm2835gpio],
284 AS_HELP_STRING([--enable-bcm2835gpio], [Enable building support for bitbanging on BCM2835 (as found in Raspberry Pi)]),
285 [build_bcm2835gpio=$enableval], [build_bcm2835gpio=no])
286 AC_ARG_ENABLE([imx_gpio],
287 AS_HELP_STRING([--enable-imx_gpio], [Enable building support for bitbanging on NXP IMX processors]),
288 [build_imx_gpio=$enableval], [build_imx_gpio=no])
295 AS_CASE(["${host_cpu}"],
297 AC_ARG_ENABLE([ep93xx],
298 AS_HELP_STRING([--enable-ep93xx], [Enable building support for EP93xx based SBCs]),
299 [build_ep93xx=$enableval], [build_ep93xx=no])
301 AC_ARG_ENABLE([at91rm9200],
302 AS_HELP_STRING([--enable-at91rm9200], [Enable building support for AT91RM9200 based SBCs]),
303 [build_at91rm9200=$enableval], [build_at91rm9200=no])
310 AC_ARG_ENABLE([gw16012],
311 AS_HELP_STRING([--enable-gw16012], [Enable building support for the Gateworks GW16012 JTAG Programmer]),
312 [build_gw16012=$enableval], [build_gw16012=no])
314 AC_ARG_ENABLE([oocd_trace],
315 AS_HELP_STRING([--enable-oocd_trace],
316 [Enable building support for some prototype OpenOCD+trace ETM capture hardware]),
317 [build_oocd_trace=$enableval], [build_oocd_trace=no])
319 AC_ARG_ENABLE([buspirate],
320 AS_HELP_STRING([--enable-buspirate], [Enable building support for the Buspirate]),
321 [build_buspirate=$enableval], [build_buspirate=no])
323 AC_ARG_ENABLE([sysfsgpio],
324 AS_HELP_STRING([--enable-sysfsgpio], [Enable building support for programming driven via sysfs gpios.]),
325 [build_sysfsgpio=$enableval], [build_sysfsgpio=no])
327 AC_ARG_ENABLE([xlnx_pcie_xvc],
328 AS_HELP_STRING([--enable-xlnx-pcie-xvc], [Enable building support for Xilinx XVC/PCIe.]),
329 [build_xlnx_pcie_xvc=$enableval], [build_xlnx_pcie_xvc=no])
334 AS_IF([test "x$build_sysfsgpio" = "xyes"], [
335 AC_MSG_ERROR([sysfsgpio is only available on linux])
338 AS_IF([test "x$build_xlnx_pcie_xvc" = "xyes"], [
339 AC_MSG_ERROR([xlnx_pcie_xvc is only available on linux])
342 AS_CASE([$host_os], [freebsd*], [],
344 AS_IF([test "x$build_rshim" = "xyes"], [
345 AC_MSG_ERROR([build_rshim is only available on linux or freebsd])
350 AC_ARG_ENABLE([minidriver_dummy],
351 AS_HELP_STRING([--enable-minidriver-dummy], [Enable the dummy minidriver.]),
352 [build_minidriver_dummy=$enableval], [build_minidriver_dummy=no])
354 AC_ARG_ENABLE([internal-jimtcl],
355 AS_HELP_STRING([--disable-internal-jimtcl], [Disable building internal jimtcl]),
356 [use_internal_jimtcl=$enableval], [use_internal_jimtcl=yes])
358 AC_ARG_ENABLE([internal-libjaylink],
359 AS_HELP_STRING([--disable-internal-libjaylink],
360 [Disable building internal libjaylink]),
361 [use_internal_libjaylink=$enableval], [use_internal_libjaylink=yes])
364 AC_MSG_CHECKING([whether to enable ZY1000 minidriver])
365 AS_IF([test "x$build_zy1000" = "xyes"], [
366 AS_IF([test "x$build_minidriver" = "xyes"], [
367 AC_MSG_ERROR([Multiple minidriver options have been enabled.])
369 AC_DEFINE([HAVE_JTAG_MINIDRIVER_H], [1],
370 [Define to 1 if you have the <jtag_minidriver.h> header file.])
373 AC_MSG_RESULT([$build_zy1000])
375 AC_ARG_ENABLE([remote-bitbang],
376 AS_HELP_STRING([--enable-remote-bitbang], [Enable building support for the Remote Bitbang jtag driver]),
377 [build_remote_bitbang=$enableval], [build_remote_bitbang=no])
379 AC_MSG_CHECKING([whether to enable dummy minidriver])
380 AS_IF([test "x$build_minidriver_dummy" = "xyes"], [
381 AS_IF([test "x$build_minidriver" = "xyes"], [
382 AC_MSG_ERROR([Multiple minidriver options have been enabled.])
385 AC_DEFINE([BUILD_MINIDRIVER_DUMMY], [1], [Use the dummy minidriver.])
386 AC_DEFINE([HAVE_JTAG_MINIDRIVER_H], [1],
387 [Define to 1 if you have the <jtag_minidriver.h> header file.])
389 AC_MSG_RESULT([$build_minidriver_dummy])
391 AC_MSG_CHECKING([whether standard drivers can be built])
392 AS_IF([test "x$build_minidriver" = "xyes"], [
394 AC_MSG_WARN([Using the minidriver disables all other drivers.])
400 AS_CASE(["${host_cpu}"],
403 AS_IF([test "x$parport_use_ppdev" = "xno"], [
404 AC_MSG_WARN([--disable-parport-ppdev is not supported by the host CPU])
406 parport_use_ppdev=yes
414 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[return __MINGW32__;]])],
415 [is_mingw=yes],[is_mingw=no])
416 AS_IF([test "x$is_mingw" = "xyes"], [
417 AS_IF([test "x$parport_use_giveio" = "xno"], [
418 AC_MSG_WARN([--disable-parport-giveio is not supported by MinGW32 hosts])
420 parport_use_giveio=yes
424 # sys/io.h needed under cygwin for parport access
425 AS_IF([test "x$build_parport" = "xyes"], [
426 AC_CHECK_HEADERS([sys/io.h],[],AC_MSG_ERROR([Please install the cygwin ioperm package]))
430 [*-mingw* | *-msys*], [
435 AS_IF([test "x$parport_use_giveio" = "xno"], [
436 AC_MSG_WARN([--disable-parport-giveio is not supported by MinGW32 hosts])
438 parport_use_giveio=yes
440 AS_IF([test "x$build_buspirate" = "xyes"], [
441 AC_MSG_ERROR([buspirate currently not supported by MinGW32 hosts])
444 AC_SUBST([HOST_CPPFLAGS], [-D__USE_MINGW_ANSI_STDIO])
449 AS_IF([test "x$parport_use_giveio" = "xyes"], [
450 AC_MSG_WARN([--enable-parport-giveio cannot be used by Darwin hosts])
452 parport_use_giveio=no
455 AS_IF([test "x$parport_use_giveio" = "xyes"], [
456 AC_MSG_WARN([--enable-parport-giveio cannot be used by ]$host[ hosts])
458 parport_use_giveio=no
461 AS_IF([test "x$is_cygwin" = "xyes"], [
462 AC_DEFINE([IS_CYGWIN], [1], [1 if building for Cygwin.])
464 AC_DEFINE([IS_CYGWIN], [0], [0 if not building for Cygwin.])
467 AS_IF([test "x$is_mingw" = "xyes"], [
468 AC_DEFINE([IS_MINGW], [1], [1 if building for Mingw.])
470 AC_DEFINE([IS_MINGW], [0], [0 if not building for Mingw.])
473 AS_IF([test "x$is_win32" = "xyes"], [
474 AC_DEFINE([IS_WIN32], [1], [1 if building for Win32.])
476 AC_DEFINE([IS_WIN32], [0], [0 if not building for Win32.])
479 AS_IF([test "x$is_darwin" = "xyes"], [
480 AC_DEFINE([IS_DARWIN], [1], [1 if building for Darwin.])
482 AC_DEFINE([IS_DARWIN], [0], [0 if not building for Darwin.])
485 AS_IF([test "x$build_parport" = "xyes"], [
487 AC_DEFINE([BUILD_PARPORT], [1], [1 if you want parport.])
489 AC_DEFINE([BUILD_PARPORT], [0], [0 if you don't want parport.])
492 AS_IF([test "x$build_rshim" = "xyes"], [
493 AC_DEFINE([BUILD_RSHIM], [1], [1 if you want to debug BlueField SoC via rshim.])
495 AC_DEFINE([BUILD_RSHIM], [0], [0 if you don't want to debug BlueField SoC via rshim.])
498 AS_IF([test "x$build_dummy" = "xyes"], [
500 AC_DEFINE([BUILD_DUMMY], [1], [1 if you want dummy driver.])
502 AC_DEFINE([BUILD_DUMMY], [0], [0 if you don't want dummy driver.])
505 AS_IF([test "x$build_ep93xx" = "xyes"], [
507 AC_DEFINE([BUILD_EP93XX], [1], [1 if you want ep93xx.])
509 AC_DEFINE([BUILD_EP93XX], [0], [0 if you don't want ep93xx.])
512 AS_IF([test "x$build_zy1000" = "xyes"], [
513 AC_DEFINE([BUILD_ZY1000], [1], [1 if you want ZY1000.])
515 AC_DEFINE([BUILD_ZY1000], [0], [0 if you don't want ZY1000.])
518 AS_IF([test "x$build_zy1000_master" = "xyes"], [
519 AC_DEFINE([BUILD_ZY1000_MASTER], [1], [1 if you want ZY1000 JTAG master registers.])
521 AC_DEFINE([BUILD_ZY1000_MASTER], [0], [0 if you don't want ZY1000 JTAG master registers.])
524 AS_IF([test "x$build_at91rm9200" = "xyes"], [
526 AC_DEFINE([BUILD_AT91RM9200], [1], [1 if you want at91rm9200.])
528 AC_DEFINE([BUILD_AT91RM9200], [0], [0 if you don't want at91rm9200.])
531 AS_IF([test "x$build_bcm2835gpio" = "xyes"], [
533 AC_DEFINE([BUILD_BCM2835GPIO], [1], [1 if you want bcm2835gpio.])
535 AC_DEFINE([BUILD_BCM2835GPIO], [0], [0 if you don't want bcm2835gpio.])
538 AS_IF([test "x$build_imx_gpio" = "xyes"], [
540 AC_DEFINE([BUILD_IMX_GPIO], [1], [1 if you want imx_gpio.])
542 AC_DEFINE([BUILD_IMX_GPIO], [0], [0 if you don't want imx_gpio.])
545 AS_IF([test "x$parport_use_ppdev" = "xyes"], [
546 AC_DEFINE([PARPORT_USE_PPDEV], [1], [1 if you want parport to use ppdev.])
548 AC_DEFINE([PARPORT_USE_PPDEV], [0], [0 if you don't want parport to use ppdev.])
551 AS_IF([test "x$parport_use_giveio" = "xyes"], [
552 AC_DEFINE([PARPORT_USE_GIVEIO], [1], [1 if you want parport to use giveio.])
554 AC_DEFINE([PARPORT_USE_GIVEIO], [0], [0 if you don't want parport to use giveio.])
557 AS_IF([test "x$build_jtag_vpi" = "xyes"], [
558 AC_DEFINE([BUILD_JTAG_VPI], [1], [1 if you want JTAG VPI.])
560 AC_DEFINE([BUILD_JTAG_VPI], [0], [0 if you don't want JTAG VPI.])
563 AS_IF([test "x$build_amtjtagaccel" = "xyes"], [
564 AC_DEFINE([BUILD_AMTJTAGACCEL], [1], [1 if you want the Amontec JTAG-Accelerator driver.])
566 AC_DEFINE([BUILD_AMTJTAGACCEL], [0], [0 if you don't want the Amontec JTAG-Accelerator driver.])
569 AS_IF([test "x$build_gw16012" = "xyes"], [
570 AC_DEFINE([BUILD_GW16012], [1], [1 if you want the Gateworks GW16012 driver.])
572 AC_DEFINE([BUILD_GW16012], [0], [0 if you don't want the Gateworks GW16012 driver.])
575 AS_IF([test "x$build_oocd_trace" = "xyes"], [
576 AC_DEFINE([BUILD_OOCD_TRACE], [1], [1 if you want the OpenOCD+trace ETM capture driver.])
578 AC_DEFINE([BUILD_OOCD_TRACE], [0], [0 if you don't want the OpenOCD+trace ETM capture driver.])
581 AS_IF([test "x$build_buspirate" = "xyes"], [
582 AC_DEFINE([BUILD_BUSPIRATE], [1], [1 if you want the Buspirate JTAG driver.])
584 AC_DEFINE([BUILD_BUSPIRATE], [0], [0 if you don't want the Buspirate JTAG driver.])
587 AS_IF([test "x$use_internal_jimtcl" = "xyes"], [
588 AS_IF([test -f "$srcdir/jimtcl/configure.ac"], [
589 AX_CONFIG_SUBDIR_OPTION([jimtcl], [--disable-install-jim])
591 AC_MSG_ERROR([jimtcl not found, run git submodule init and git submodule update.])
595 AS_IF([test "x$build_remote_bitbang" = "xyes"], [
597 AC_DEFINE([BUILD_REMOTE_BITBANG], [1], [1 if you want the Remote Bitbang JTAG driver.])
599 AC_DEFINE([BUILD_REMOTE_BITBANG], [0], [0 if you don't want the Remote Bitbang JTAG driver.])
602 AS_IF([test "x$build_sysfsgpio" = "xyes"], [
604 AC_DEFINE([BUILD_SYSFSGPIO], [1], [1 if you want the SysfsGPIO driver.])
606 AC_DEFINE([BUILD_SYSFSGPIO], [0], [0 if you don't want SysfsGPIO driver.])
609 AS_IF([test "x$build_xlnx_pcie_xvc" = "xyes"], [
610 build_xlnx_pcie_xvc=yes
611 AC_DEFINE([BUILD_XLNX_PCIE_XVC], [1], [1 if you want the Xilinx XVC/PCIe driver.])
613 AC_DEFINE([BUILD_XLNX_PCIE_XVC], [0], [0 if you don't want Xilinx XVC/PCIe driver.])
616 PKG_CHECK_MODULES([LIBUSB1], [libusb-1.0], [
618 AC_DEFINE([HAVE_LIBUSB1], [1], [Define if you have libusb-1.x])
619 PKG_CHECK_EXISTS([libusb-1.0 >= 1.0.9],
620 [AC_DEFINE([HAVE_LIBUSB_ERROR_NAME], [1], [Define if your libusb has libusb_error_name()])],
621 [AC_MSG_WARN([libusb-1.x older than 1.0.9 detected, consider updating])])
622 LIBUSB1_CFLAGS=`echo $LIBUSB1_CFLAGS | sed 's/-I/-isystem /'`
623 AC_MSG_NOTICE([libusb-1.0 header bug workaround: LIBUSB1_CFLAGS changed to "$LIBUSB1_CFLAGS"])
624 PKG_CHECK_EXISTS([libusb-1.0 >= 1.0.16],
625 [AC_DEFINE([HAVE_LIBUSB_GET_PORT_NUMBERS], [1], [Define if your libusb has libusb_get_port_numbers()])])
628 AC_MSG_WARN([libusb-1.x not found, trying legacy libusb-0.1 as a fallback; consider installing libusb-1.x instead])
631 PKG_CHECK_MODULES([LIBUSB0], [libusb], [use_libusb0=yes], [use_libusb0=no])
633 for hidapi_lib in hidapi hidapi-hidraw hidapi-libusb; do
634 PKG_CHECK_MODULES([HIDAPI],[$hidapi_lib],[
642 PKG_CHECK_MODULES([LIBFTDI], [libftdi1], [use_libftdi=yes], [
643 PKG_CHECK_MODULES([LIBFTDI], [libftdi], [use_libftdi=yes], [use_libftdi=no])
646 PKG_CHECK_MODULES([LIBJAYLINK], [libjaylink >= 0.2],
647 [use_libjaylink=yes], [use_libjaylink=no])
649 m4_define([PROCESS_ADAPTERS], [
650 m4_foreach([adapter], [$1], [
651 AS_IF([test "x$build_zy1000" = "xyes"], [
652 ADAPTER_VAR([adapter])=no
655 AS_IF([test "x$ADAPTER_VAR([adapter])" != "xno"], [
656 AC_DEFINE([BUILD_]ADAPTER_SYM([adapter]), [1], [1 if you want the ]ADAPTER_DESC([adapter]).)
658 AC_DEFINE([BUILD_]ADAPTER_SYM([adapter]), [0], [0 if you do not want the ]ADAPTER_DESC([adapter]).)
661 AS_IF([test "x$ADAPTER_VAR([adapter])" = "xyes"], [
662 AC_MSG_ERROR([$3 is required for the ADAPTER_DESC([adapter])])
664 ADAPTER_VAR([adapter])=no
666 AM_CONDITIONAL(ADAPTER_SYM([adapter]), [test "x$ADAPTER_VAR([adapter])" != "xno"])
670 PROCESS_ADAPTERS([USB1_ADAPTERS], ["x$use_libusb1" = "xyes"], [libusb-1.x])
671 PROCESS_ADAPTERS([USB0_ADAPTERS], ["x$use_libusb0" = "xyes"], [libusb-0.1])
672 PROCESS_ADAPTERS([HIDAPI_ADAPTERS], ["x$use_hidapi" = "xyes"], [hidapi])
673 PROCESS_ADAPTERS([HIDAPI_USB1_ADAPTERS], ["x$use_hidapi" = "xyes" -a "x$use_libusb1" = "xyes"], [hidapi and libusb-1.x])
674 PROCESS_ADAPTERS([LIBFTDI_ADAPTERS], ["x$use_libftdi" = "xyes"], [libftdi])
675 PROCESS_ADAPTERS([LIBJAYLINK_ADAPTERS], ["x$use_internal_libjaylink" = "xyes" -o "x$use_libjaylink" = "xyes"], [libjaylink-0.2])
677 AS_IF([test "x$build_openjtag" = "xyes"], [
678 AS_IF([test "x$use_libusb1" != "xyes" -a "x$use_libusb0" != "xyes"], [
679 AC_MSG_ERROR([libusb-1.x or libusb-0.1 is required for the OpenJTAG Programmer])
684 AS_IF([test "x$enable_stlink" != "xno" -o "x$enable_ti_icdi" != "xno"], [
685 AC_DEFINE([BUILD_HLADAPTER], [1], [1 if you want the High Level JTAG driver.])
687 AC_DEFINE([BUILD_HLADAPTER], [0], [0 if you want the High Level JTAG driver.])
689 AM_CONDITIONAL([HLADAPTER], [test "x$enable_stlink" != "xno" -o "x$enable_ti_icdi" != "xno"])
691 AS_IF([test "x$enable_jlink" != "xno"], [
692 AS_IF([test "x$use_internal_libjaylink" = "xyes"], [
693 AS_IF([test -f "$srcdir/src/jtag/drivers/libjaylink/configure.ac"], [
694 AX_CONFIG_SUBDIR_OPTION([src/jtag/drivers/libjaylink],
695 [--enable-subproject-build])
697 AC_MSG_ERROR([Internal libjaylink not found, run either 'git submodule init' and 'git submodule update' or disable internal libjaylink with --disable-internal-libjaylink.])
702 # Presto needs the bitq module
703 AS_IF([test "x$enable_presto" != "xno"], [
707 AM_CONDITIONAL([RELEASE], [test "x$build_release" = "xyes"])
708 AM_CONDITIONAL([PARPORT], [test "x$build_parport" = "xyes"])
709 AM_CONDITIONAL([DUMMY], [test "x$build_dummy" = "xyes"])
710 AM_CONDITIONAL([GIVEIO], [test "x$parport_use_giveio" = "xyes"])
711 AM_CONDITIONAL([EP93XX], [test "x$build_ep93xx" = "xyes"])
712 AM_CONDITIONAL([ZY1000], [test "x$build_zy1000" = "xyes"])
713 AM_CONDITIONAL([ZY1000_MASTER], [test "x$build_zy1000_master" = "xyes"])
714 AM_CONDITIONAL([IOUTIL], [test "x$build_ioutil" = "xyes"])
715 AM_CONDITIONAL([AT91RM9200], [test "x$build_at91rm9200" = "xyes"])
716 AM_CONDITIONAL([BCM2835GPIO], [test "x$build_bcm2835gpio" = "xyes"])
717 AM_CONDITIONAL([IMX_GPIO], [test "x$build_imx_gpio" = "xyes"])
718 AM_CONDITIONAL([BITBANG], [test "x$build_bitbang" = "xyes"])
719 AM_CONDITIONAL([JTAG_VPI], [test "x$build_jtag_vpi" = "xyes" -o "x$build_jtag_vpi" = "xyes"])
720 AM_CONDITIONAL([USB_BLASTER_DRIVER], [test "x$enable_usb_blaster" != "xno" -o "x$enable_usb_blaster_2" != "xno"])
721 AM_CONDITIONAL([AMTJTAGACCEL], [test "x$build_amtjtagaccel" = "xyes"])
722 AM_CONDITIONAL([GW16012], [test "x$build_gw16012" = "xyes"])
723 AM_CONDITIONAL([OOCD_TRACE], [test "x$build_oocd_trace" = "xyes"])
724 AM_CONDITIONAL([REMOTE_BITBANG], [test "x$build_remote_bitbang" = "xyes"])
725 AM_CONDITIONAL([BUSPIRATE], [test "x$build_buspirate" = "xyes"])
726 AM_CONDITIONAL([SYSFSGPIO], [test "x$build_sysfsgpio" = "xyes"])
727 AM_CONDITIONAL([XLNX_PCIE_XVC], [test "x$build_xlnx_pcie_xvc" = "xyes"])
728 AM_CONDITIONAL([USE_LIBUSB0], [test "x$use_libusb0" = "xyes"])
729 AM_CONDITIONAL([USE_LIBUSB1], [test "x$use_libusb1" = "xyes"])
730 AM_CONDITIONAL([IS_CYGWIN], [test "x$is_cygwin" = "xyes"])
731 AM_CONDITIONAL([IS_MINGW], [test "x$is_mingw" = "xyes"])
732 AM_CONDITIONAL([IS_WIN32], [test "x$is_win32" = "xyes"])
733 AM_CONDITIONAL([IS_DARWIN], [test "x$is_darwin" = "xyes"])
734 AM_CONDITIONAL([BITQ], [test "x$build_bitq" = "xyes"])
735 AM_CONDITIONAL([USE_LIBFTDI], [test "x$use_libftdi" = "xyes"])
736 AM_CONDITIONAL([USE_HIDAPI], [test "x$use_hidapi" = "xyes"])
737 AM_CONDITIONAL([USE_LIBJAYLINK], [test "x$use_libjaylink" = "xyes"])
738 AM_CONDITIONAL([RSHIM], [test "x$build_rshim" = "xyes"])
740 AM_CONDITIONAL([MINIDRIVER], [test "x$build_minidriver" = "xyes"])
741 AM_CONDITIONAL([MINIDRIVER_DUMMY], [test "x$build_minidriver_dummy" = "xyes"])
743 AM_CONDITIONAL([INTERNAL_JIMTCL], [test "x$use_internal_jimtcl" = "xyes"])
744 AM_CONDITIONAL([INTERNAL_LIBJAYLINK], [test "x$use_internal_libjaylink" = "xyes"])
746 # Look for environ alternatives. Possibility #1: is environ in unistd.h or stdlib.h?
747 AC_MSG_CHECKING([for environ in unistd.h and stdlib.h])
748 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
752 ]], [[char **ep = environ;]]
759 # Possibility #2: can environ be found in an available library?
760 AC_MSG_CHECKING([for extern environ])
761 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
762 extern char **environ;
763 ]], [[char **ep = environ;]]
765 AC_DEFINE(NEED_ENVIRON_EXTERN, [1], [Must declare 'environ' to use it.])
770 AC_MSG_RESULT([${has_environ}])
773 AS_IF([test "x${has_environ}" != "xyes" ], [
774 AC_MSG_FAILURE([Could not find 'environ' in unistd.h or available libraries.])
777 AC_DEFINE([_GNU_SOURCE],[1],[Use GNU C library extensions (e.g. stdndup).])
779 # set default gcc warnings
780 GCC_WARNINGS="-Wall -Wstrict-prototypes -Wformat-security -Wshadow"
781 AS_IF([test "x${gcc_wextra}" = "xyes"], [
782 GCC_WARNINGS="${GCC_WARNINGS} -Wextra -Wno-unused-parameter"
783 GCC_WARNINGS="${GCC_WARNINGS} -Wbad-function-cast"
784 GCC_WARNINGS="${GCC_WARNINGS} -Wcast-align"
785 GCC_WARNINGS="${GCC_WARNINGS} -Wredundant-decls"
787 AS_IF([test "x${gcc_werror}" = "xyes"], [
788 GCC_WARNINGS="${GCC_WARNINGS} -Werror"
791 # override default gcc cflags
792 AS_IF([test "x$gcc_warnings" = "xyes"], [
793 AC_SUBST([GCC_WARNINGS], [$GCC_WARNINGS])
803 echo OpenOCD configuration summary
804 echo --------------------------------------------------
805 m4_foreach([adapter], [USB1_ADAPTERS, USB0_ADAPTERS,
806 HIDAPI_ADAPTERS, HIDAPI_USB1_ADAPTERS, LIBFTDI_ADAPTERS,
807 LIBJAYLINK_ADAPTERS, PCIE_ADAPTERS],
808 [s=m4_format(["%-40s"], ADAPTER_DESC([adapter]))
809 AS_CASE([$ADAPTER_VAR([adapter])],
811 echo "$s"yes '(auto)'
822 AS_IF([test "x$build_oocd_trace" = "xyes"], [
823 echo 'WARNING! Deprecated configure option (--enable-oocd_trace)'
824 echo 'The oocd_trace driver is deprecated and will be removed in the next release.'
825 echo 'If you regularly use this driver, please report to the OpenOCD Mailing List.'
829 AS_IF([test "x$build_zy1000" = "xyes" -o "x$build_zy1000_master" = "xyes"], [
830 echo 'WARNING! Deprecated configure option (--enable-zy1000, --enable-zy1000-master)'
831 echo 'Support for the ZY1000 platform is deprecated and will be removed in the next'
832 echo 'release. If you regularly use this platform, please report to the OpenOCD'
837 AS_IF([test "x$build_ioutil" = "xyes"], [
838 echo 'WARNING! Deprecated configure option (--enable-ioutil)'
839 echo 'Support for the ioutil functions is deprecated and will be removed in the next'
840 echo 'release. If you regularly depend on this functionality, please report to the'
841 echo 'OpenOCD Mailing List.'