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 JTAG 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 [[vsllink], [Versaloon-Link JTAG Programmer], [VSLLINK]]])
119 m4_define([USB_ADAPTERS],
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([LIBFTDI_ADAPTERS],
133 [[[usb_blaster], [Altera USB-Blaster Compatible], [USB_BLASTER]],
134 [[presto], [ASIX Presto Adapter], [PRESTO]],
135 [[openjtag], [OpenJTAG Adapter], [OPENJTAG]]])
137 m4_define([LIBJAYLINK_ADAPTERS],
138 [[[jlink], [SEGGER J-Link Programmer], [JLINK]]])
141 AC_ARG_ENABLE([doxygen-html],
142 AS_HELP_STRING([--disable-doxygen-html],
143 [Disable building Doxygen manual as HTML.]),
144 [doxygen_as_html=$enableval], [doxygen_as_html=yes])
145 AC_SUBST([doxygen_as_html])
146 AC_MSG_CHECKING([whether to build Doxygen as HTML])
147 AC_MSG_RESULT([$doxygen_as_html])
149 AC_ARG_ENABLE([doxygen-pdf],
150 AS_HELP_STRING([--enable-doxygen-pdf],
151 [Enable building Doxygen manual as PDF.]),
152 [doxygen_as_pdf=$enableval], [doxygen_as_pdf=no])
153 AC_SUBST([doxygen_as_pdf])
154 AC_MSG_CHECKING([whether to build Doxygen as PDF])
155 AC_MSG_RESULT([$doxygen_as_pdf])
157 AC_ARG_ENABLE([gccwarnings],
158 AS_HELP_STRING([--disable-gccwarnings], [Disable compiler warnings]),
159 [gcc_warnings=$enableval], [gcc_warnings=yes])
161 AC_ARG_ENABLE([wextra],
162 AS_HELP_STRING([--disable-wextra], [Disable extra compiler warnings]),
163 [gcc_wextra=$enableval], [gcc_wextra=$gcc_warnings])
165 AC_ARG_ENABLE([werror],
166 AS_HELP_STRING([--disable-werror], [Do not treat warnings as errors]),
167 [gcc_werror=$enableval], [gcc_werror=$gcc_warnings])
169 # set default verbose options, overridden by following options
174 AC_ARG_ENABLE([verbose],
175 AS_HELP_STRING([--enable-verbose],
176 [Enable verbose JTAG I/O messages (for debugging).]),
178 debug_jtag_io=$enableval
179 debug_usb_io=$enableval
180 debug_usb_comms=$enableval
183 AC_ARG_ENABLE([verbose_jtag_io],
184 AS_HELP_STRING([--enable-verbose-jtag-io],
185 [Enable verbose JTAG I/O messages (for debugging).]),
186 [debug_jtag_io=$enableval], [])
188 AC_ARG_ENABLE([verbose_usb_io],
189 AS_HELP_STRING([--enable-verbose-usb-io],
190 [Enable verbose USB I/O messages (for debugging)]),
191 [debug_usb_io=$enableval], [])
193 AC_ARG_ENABLE([verbose_usb_comms],
194 AS_HELP_STRING([--enable-verbose-usb-comms],
195 [Enable verbose USB communication messages (for debugging)]),
196 [debug_usb_comms=$enableval], [])
198 AC_MSG_CHECKING([whether to enable verbose JTAG I/O messages]);
199 AC_MSG_RESULT([$debug_jtag_io])
200 AS_IF([test "x$debug_jtag_io" = "xyes"], [
201 AC_DEFINE([_DEBUG_JTAG_IO_],[1], [Print verbose JTAG I/O messages])
204 AC_MSG_CHECKING([whether to enable verbose USB I/O messages]);
205 AC_MSG_RESULT([$debug_usb_io])
206 AS_IF([test "x$debug_usb_io" = "xyes"], [
207 AC_DEFINE([_DEBUG_USB_IO_],[1], [Print verbose USB I/O messages])
210 AC_MSG_CHECKING([whether to enable verbose USB communication messages]);
211 AC_MSG_RESULT([$debug_usb_comms])
212 AS_IF([test "x$debug_usb_comms" = "xyes"], [
213 AC_DEFINE([_DEBUG_USB_COMMS_],[1], [Print verbose USB communication messages])
217 AC_ARG_ENABLE([malloc_logging],
218 AS_HELP_STRING([--enable-malloc-logging],
219 [Include free space in logging messages (requires malloc.h).]),
220 [debug_malloc=$enableval], [])
222 AC_MSG_CHECKING([whether to enable malloc free space logging]);
223 AC_MSG_RESULT([$debug_malloc])
224 AS_IF([test "x$debug_malloc" = "xyes"], [
225 AC_DEFINE([_DEBUG_FREE_SPACE_],[1], [Include malloc free space in logging])
228 AC_ARG_ENABLE([dummy],
229 AS_HELP_STRING([--enable-dummy], [Enable building the dummy port driver]),
230 [build_dummy=$enableval], [build_dummy=no])
232 m4_define([AC_ARG_ADAPTERS], [
233 m4_foreach([adapter], [$1],
234 [AC_ARG_ENABLE(ADAPTER_OPT([adapter]),
235 AS_HELP_STRING([--enable-ADAPTER_OPT([adapter])],
236 [Enable building support for the ]ADAPTER_DESC([adapter])[ (default is $2)]),
237 [], [ADAPTER_VAR([adapter])=$2])
250 AC_ARG_ENABLE([parport],
251 AS_HELP_STRING([--enable-parport], [Enable building the pc parallel port driver]),
252 [build_parport=$enableval], [build_parport=no])
254 AC_ARG_ENABLE([parport_ppdev],
255 AS_HELP_STRING([--disable-parport-ppdev],
256 [Disable use of ppdev (/dev/parportN) for parport (for x86 only)]),
257 [parport_use_ppdev=$enableval], [parport_use_ppdev=yes])
259 AC_ARG_ENABLE([parport_giveio],
260 AS_HELP_STRING([--enable-parport-giveio],
261 [Enable use of giveio for parport (for CygWin only)]),
262 [parport_use_giveio=$enableval], [parport_use_giveio=])
264 AC_ARG_ENABLE([jtag_vpi],
265 AS_HELP_STRING([--enable-jtag_vpi], [Enable building support for JTAG VPI]),
266 [build_jtag_vpi=$enableval], [build_jtag_vpi=no])
268 AC_ARG_ENABLE([amtjtagaccel],
269 AS_HELP_STRING([--enable-amtjtagaccel], [Enable building the Amontec JTAG-Accelerator driver]),
270 [build_amtjtagaccel=$enableval], [build_amtjtagaccel=no])
272 AC_ARG_ENABLE([zy1000_master],
273 AS_HELP_STRING([--enable-zy1000-master], [Use ZY1000 JTAG master registers]),
274 [build_zy1000_master=$enableval], [build_zy1000_master=no])
276 AC_ARG_ENABLE([zy1000],
277 AS_HELP_STRING([--enable-zy1000], [Enable ZY1000 interface]),
278 [build_zy1000=$enableval], [build_zy1000=no])
280 AC_ARG_ENABLE([ioutil],
281 AS_HELP_STRING([--enable-ioutil], [Enable ioutil functions - useful for standalone OpenOCD implementations]),
282 [build_ioutil=$enableval], [build_ioutil=no])
284 AS_CASE(["${host_cpu}"],
286 AC_ARG_ENABLE([ep93xx],
287 AS_HELP_STRING([--enable-ep93xx], [Enable building support for EP93xx based SBCs]),
288 [build_ep93xx=$enableval], [build_ep93xx=no])
290 AC_ARG_ENABLE([at91rm9200],
291 AS_HELP_STRING([--enable-at91rm9200], [Enable building support for AT91RM9200 based SBCs]),
292 [build_at91rm9200=$enableval], [build_at91rm9200=no])
294 AC_ARG_ENABLE([bcm2835gpio],
295 AS_HELP_STRING([--enable-bcm2835gpio], [Enable building support for bitbanging on BCM2835 (as found in Raspberry Pi)]),
296 [build_bcm2835gpio=$enableval], [build_bcm2835gpio=no])
304 AC_ARG_ENABLE([gw16012],
305 AS_HELP_STRING([--enable-gw16012], [Enable building support for the Gateworks GW16012 JTAG Programmer]),
306 [build_gw16012=$enableval], [build_gw16012=no])
308 AC_ARG_ENABLE([oocd_trace],
309 AS_HELP_STRING([--enable-oocd_trace],
310 [Enable building support for some prototype OpenOCD+trace ETM capture hardware]),
311 [build_oocd_trace=$enableval], [build_oocd_trace=no])
313 AC_ARG_ENABLE([buspirate],
314 AS_HELP_STRING([--enable-buspirate], [Enable building support for the Buspirate]),
315 [build_buspirate=$enableval], [build_buspirate=no])
317 AC_ARG_ENABLE([sysfsgpio],
318 AS_HELP_STRING([--enable-sysfsgpio], [Enable building support for programming driven via sysfs gpios.]),
319 [build_sysfsgpio=$enableval], [build_sysfsgpio=no])
324 AS_IF([test "x$build_sysfsgpio" = "xyes"], [
325 AC_MSG_ERROR([sysfsgpio is only available on linux])
329 AC_ARG_ENABLE([minidriver_dummy],
330 AS_HELP_STRING([--enable-minidriver-dummy], [Enable the dummy minidriver.]),
331 [build_minidriver_dummy=$enableval], [build_minidriver_dummy=no])
333 AC_ARG_ENABLE([internal-jimtcl],
334 AS_HELP_STRING([--disable-internal-jimtcl], [Disable building internal jimtcl]),
335 [use_internal_jimtcl=$enableval], [use_internal_jimtcl=yes])
337 AC_ARG_ENABLE([internal-libjaylink],
338 AS_HELP_STRING([--disable-internal-libjaylink],
339 [Disable building internal libjaylink]),
340 [use_internal_libjaylink=$enableval], [use_internal_libjaylink=yes])
342 AC_ARG_ENABLE([target64],
343 AS_HELP_STRING([--disable-target64], [Disable 64-bit target address]),
344 [build_target64=$enableval], [build_target64=yes])
347 AC_MSG_CHECKING([whether to enable ZY1000 minidriver])
348 AS_IF([test "x$build_zy1000" = "xyes"], [
349 AS_IF([test "x$build_minidriver" = "xyes"], [
350 AC_MSG_ERROR([Multiple minidriver options have been enabled.])
352 AC_DEFINE([HAVE_JTAG_MINIDRIVER_H], [1],
353 [Define to 1 if you have the <jtag_minidriver.h> header file.])
356 AC_MSG_RESULT([$build_zy1000])
358 AC_ARG_ENABLE([remote-bitbang],
359 AS_HELP_STRING([--enable-remote-bitbang], [Enable building support for the Remote Bitbang jtag driver]),
360 [build_remote_bitbang=$enableval], [build_remote_bitbang=no])
362 AC_MSG_CHECKING([whether to enable dummy minidriver])
363 AS_IF([test "x$build_minidriver_dummy" = "xyes"], [
364 AS_IF([test "x$build_minidriver" = "xyes"], [
365 AC_MSG_ERROR([Multiple minidriver options have been enabled.])
368 AC_DEFINE([BUILD_MINIDRIVER_DUMMY], [1], [Use the dummy minidriver.])
369 AC_DEFINE([HAVE_JTAG_MINIDRIVER_H], [1],
370 [Define to 1 if you have the <jtag_minidriver.h> header file.])
372 AC_MSG_RESULT([$build_minidriver_dummy])
374 AC_MSG_CHECKING([whether standard drivers can be built])
375 AS_IF([test "x$build_minidriver" = "xyes"], [
377 AC_MSG_WARN([Using the minidriver disables all other drivers.])
383 AS_CASE(["${host_cpu}"],
386 AS_IF([test "x$parport_use_ppdev" = "xno"], [
387 AC_MSG_WARN([--disable-parport-ppdev is not supported by the host CPU])
389 parport_use_ppdev=yes
397 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[return __MINGW32__;]])],
398 [is_mingw=yes],[is_mingw=no])
399 AS_IF([test "x$is_mingw" = "xyes"], [
400 AS_IF([test "x$parport_use_giveio" = "xno"], [
401 AC_MSG_WARN([--disable-parport-giveio is not supported by MinGW32 hosts])
403 parport_use_giveio=yes
407 # sys/io.h needed under cygwin for parport access
408 AS_IF([test "x$build_parport" = "xyes"], [
409 AC_CHECK_HEADERS([sys/io.h],[],AC_MSG_ERROR([Please install the cygwin ioperm package]))
413 [*-mingw* | *-msys*], [
418 AS_IF([test "x$parport_use_giveio" = "xno"], [
419 AC_MSG_WARN([--disable-parport-giveio is not supported by MinGW32 hosts])
421 parport_use_giveio=yes
423 AS_IF([test "x$build_buspirate" = "xyes"], [
424 AC_MSG_ERROR([buspirate currently not supported by MinGW32 hosts])
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_dummy" = "xyes"], [
477 AC_DEFINE([BUILD_DUMMY], [1], [1 if you want dummy driver.])
479 AC_DEFINE([BUILD_DUMMY], [0], [0 if you don't want dummy driver.])
482 AS_IF([test "x$build_ep93xx" = "xyes"], [
484 AC_DEFINE([BUILD_EP93XX], [1], [1 if you want ep93xx.])
486 AC_DEFINE([BUILD_EP93XX], [0], [0 if you don't want ep93xx.])
489 AS_IF([test "x$build_zy1000" = "xyes"], [
490 AC_DEFINE([BUILD_ZY1000], [1], [1 if you want ZY1000.])
492 AC_DEFINE([BUILD_ZY1000], [0], [0 if you don't want ZY1000.])
495 AS_IF([test "x$build_zy1000_master" = "xyes"], [
496 AC_DEFINE([BUILD_ZY1000_MASTER], [1], [1 if you want ZY1000 JTAG master registers.])
498 AC_DEFINE([BUILD_ZY1000_MASTER], [0], [0 if you don't want ZY1000 JTAG master registers.])
501 AS_IF([test "x$build_at91rm9200" = "xyes"], [
503 AC_DEFINE([BUILD_AT91RM9200], [1], [1 if you want at91rm9200.])
505 AC_DEFINE([BUILD_AT91RM9200], [0], [0 if you don't want at91rm9200.])
508 AS_IF([test "x$build_bcm2835gpio" = "xyes"], [
510 AC_DEFINE([BUILD_BCM2835GPIO], [1], [1 if you want bcm2835gpio.])
512 AC_DEFINE([BUILD_BCM2835GPIO], [0], [0 if you don't want bcm2835gpio.])
515 AS_IF([test "x$parport_use_ppdev" = "xyes"], [
516 AC_DEFINE([PARPORT_USE_PPDEV], [1], [1 if you want parport to use ppdev.])
518 AC_DEFINE([PARPORT_USE_PPDEV], [0], [0 if you don't want parport to use ppdev.])
521 AS_IF([test "x$parport_use_giveio" = "xyes"], [
522 AC_DEFINE([PARPORT_USE_GIVEIO], [1], [1 if you want parport to use giveio.])
524 AC_DEFINE([PARPORT_USE_GIVEIO], [0], [0 if you don't want parport to use giveio.])
527 AS_IF([test "x$build_jtag_vpi" = "xyes"], [
528 AC_DEFINE([BUILD_JTAG_VPI], [1], [1 if you want JTAG VPI.])
530 AC_DEFINE([BUILD_JTAG_VPI], [0], [0 if you don't want JTAG VPI.])
533 AS_IF([test "x$build_amtjtagaccel" = "xyes"], [
534 AC_DEFINE([BUILD_AMTJTAGACCEL], [1], [1 if you want the Amontec JTAG-Accelerator driver.])
536 AC_DEFINE([BUILD_AMTJTAGACCEL], [0], [0 if you don't want the Amontec JTAG-Accelerator driver.])
539 AS_IF([test "x$build_gw16012" = "xyes"], [
540 AC_DEFINE([BUILD_GW16012], [1], [1 if you want the Gateworks GW16012 driver.])
542 AC_DEFINE([BUILD_GW16012], [0], [0 if you don't want the Gateworks GW16012 driver.])
545 AS_IF([test "x$build_oocd_trace" = "xyes"], [
546 AC_DEFINE([BUILD_OOCD_TRACE], [1], [1 if you want the OpenOCD+trace ETM capture driver.])
548 AC_DEFINE([BUILD_OOCD_TRACE], [0], [0 if you don't want the OpenOCD+trace ETM capture driver.])
551 AS_IF([test "x$build_buspirate" = "xyes"], [
552 AC_DEFINE([BUILD_BUSPIRATE], [1], [1 if you want the Buspirate JTAG driver.])
554 AC_DEFINE([BUILD_BUSPIRATE], [0], [0 if you don't want the Buspirate JTAG driver.])
557 AS_IF([test "x$use_internal_jimtcl" = "xyes"], [
558 AS_IF([test -f "$srcdir/jimtcl/configure.ac"], [
559 AX_CONFIG_SUBDIR_OPTION([jimtcl], [--disable-install-jim --with-ext="eventloop array clock regexp stdlib tclcompat" --without-ext="default"])
561 AC_MSG_ERROR([jimtcl not found, run git submodule init and git submodule update.])
565 AS_IF([test "x$build_remote_bitbang" = "xyes"], [
567 AC_DEFINE([BUILD_REMOTE_BITBANG], [1], [1 if you want the Remote Bitbang JTAG driver.])
569 AC_DEFINE([BUILD_REMOTE_BITBANG], [0], [0 if you don't want the Remote Bitbang JTAG driver.])
572 AS_IF([test "x$build_sysfsgpio" = "xyes"], [
574 AC_DEFINE([BUILD_SYSFSGPIO], [1], [1 if you want the SysfsGPIO driver.])
576 AC_DEFINE([BUILD_SYSFSGPIO], [0], [0 if you don't want SysfsGPIO driver.])
579 AS_IF([test "x$build_target64" = "xyes"], [
580 AC_DEFINE([BUILD_TARGET64], [1], [1 if you want 64-bit addresses.])
582 AC_DEFINE([BUILD_TARGET64], [0], [0 if you don't want 64-bit addresses.])
586 PKG_CHECK_MODULES([LIBUSB1], [libusb-1.0], [
588 AC_DEFINE([HAVE_LIBUSB1], [1], [Define if you have libusb-1.x])
589 PKG_CHECK_EXISTS([libusb-1.0 >= 1.0.9],
590 [AC_DEFINE([HAVE_LIBUSB_ERROR_NAME], [1], [Define if your libusb has libusb_error_name()])],
591 [AC_MSG_WARN([libusb-1.x older than 1.0.9 detected, consider updating])])
592 LIBUSB1_CFLAGS=`echo $LIBUSB1_CFLAGS | sed 's/-I/-isystem /'`
593 AC_MSG_NOTICE([libusb-1.0 header bug workaround: LIBUSB1_CFLAGS changed to "$LIBUSB1_CFLAGS"])
594 PKG_CHECK_EXISTS([libusb-1.0 >= 1.0.16],
595 [AC_DEFINE([HAVE_LIBUSB_GET_PORT_NUMBERS], [1], [Define if your libusb has libusb_get_port_numbers()])])
598 AC_MSG_WARN([libusb-1.x not found, trying legacy libusb-0.1 as a fallback; consider installing libusb-1.x instead])
601 PKG_CHECK_MODULES([LIBUSB0], [libusb], [use_libusb0=yes], [use_libusb0=no])
603 for hidapi_lib in hidapi hidapi-hidraw hidapi-libusb; do
604 PKG_CHECK_MODULES([HIDAPI],[$hidapi_lib],[
612 PKG_CHECK_MODULES([LIBFTDI], [libftdi1], [use_libftdi=yes], [
613 PKG_CHECK_MODULES([LIBFTDI], [libftdi], [use_libftdi=yes], [use_libftdi=no])
616 PKG_CHECK_MODULES([LIBJAYLINK], [libjaylink >= 0.1],
617 [use_libjaylink=yes], [use_libjaylink=no])
619 m4_define([PROCESS_ADAPTERS], [
620 m4_foreach([adapter], [$1], [
622 AS_IF([test "x$ADAPTER_VAR([adapter])" != "xno"], [
623 AC_DEFINE([BUILD_]ADAPTER_SYM([adapter]), [1], [1 if you want the ]ADAPTER_DESC([adapter]).)
625 AC_DEFINE([BUILD_]ADAPTER_SYM([adapter]), [0], [0 if you do not want the ]ADAPTER_DESC([adapter]).)
628 AS_IF([test "x$ADAPTER_VAR([adapter])" = "xyes"], [
629 AC_MSG_ERROR([$3 is required for the ADAPTER_DESC([adapter])])
631 ADAPTER_VAR([adapter])=no
633 AM_CONDITIONAL(ADAPTER_SYM([adapter]), [test "x$ADAPTER_VAR([adapter])" != "xno"])
637 PROCESS_ADAPTERS([USB1_ADAPTERS], ["x$use_libusb1" = "xyes"], [libusb-1.x])
638 PROCESS_ADAPTERS([USB_ADAPTERS], ["x$use_libusb1" = "xyes" -o "x$use_libusb0" = "xyes"], [libusb-1.x or libusb-0.1])
639 PROCESS_ADAPTERS([USB0_ADAPTERS], ["x$use_libusb0" = "xyes"], [libusb-0.1])
640 PROCESS_ADAPTERS([HIDAPI_ADAPTERS], ["x$use_hidapi" = "xyes"], [hidapi])
641 PROCESS_ADAPTERS([LIBFTDI_ADAPTERS], ["x$use_libftdi" = "xyes"], [libftdi])
642 PROCESS_ADAPTERS([LIBJAYLINK_ADAPTERS], ["x$use_libusb1" = "xyes" -a "x$use_internal_libjaylink" = "xyes" -o "x$use_libjaylink" = "xyes"], [libusb-1.x or libjaylink-0.1])
644 AS_IF([test "x$build_openjtag" = "xyes"], [
645 AS_IF([test "x$use_libusb1" != "xyes" -a "x$use_libusb0" != "xyes"], [
646 AC_MSG_ERROR([libusb-1.x or libusb-0.1 is required for the OpenJTAG Programmer])
651 AS_IF([test "x$enable_stlink" != "xno" -o "x$enable_ti_icdi" != "xno"], [
652 AC_DEFINE([BUILD_HLADAPTER], [1], [1 if you want the High Level JTAG driver.])
654 AC_DEFINE([BUILD_HLADAPTER], [0], [0 if you want the High Level JTAG driver.])
656 AM_CONDITIONAL([HLADAPTER], [test "x$enable_stlink" != "xno" -o "x$enable_ti_icdi" != "xno"])
658 AS_IF([test "x$enable_jlink" != "xno"], [
659 AS_IF([test "x$use_internal_libjaylink" = "xyes"], [
660 AS_IF([test -f "$srcdir/src/jtag/drivers/libjaylink/configure.ac"], [
661 AX_CONFIG_SUBDIR_OPTION([src/jtag/drivers/libjaylink],
662 [--enable-subproject-build])
664 AC_MSG_ERROR([Internal libjaylink not found, run either 'git submodule init' and 'git submodule update' or disable internal libjaylink with --disable-internal-libjaylink.])
669 # Presto needs the bitq module
670 AS_IF([test "x$enable_presto" != "xno"], [
674 AM_CONDITIONAL([RELEASE], [test "x$build_release" = "xyes"])
675 AM_CONDITIONAL([PARPORT], [test "x$build_parport" = "xyes"])
676 AM_CONDITIONAL([DUMMY], [test "x$build_dummy" = "xyes"])
677 AM_CONDITIONAL([GIVEIO], [test "x$parport_use_giveio" = "xyes"])
678 AM_CONDITIONAL([EP93XX], [test "x$build_ep93xx" = "xyes"])
679 AM_CONDITIONAL([ZY1000], [test "x$build_zy1000" = "xyes"])
680 AM_CONDITIONAL([ZY1000_MASTER], [test "x$build_zy1000_master" = "xyes"])
681 AM_CONDITIONAL([IOUTIL], [test "x$build_ioutil" = "xyes"])
682 AM_CONDITIONAL([AT91RM9200], [test "x$build_at91rm9200" = "xyes"])
683 AM_CONDITIONAL([BCM2835GPIO], [test "x$build_bcm2835gpio" = "xyes"])
684 AM_CONDITIONAL([BITBANG], [test "x$build_bitbang" = "xyes"])
685 AM_CONDITIONAL([JTAG_VPI], [test "x$build_jtag_vpi" = "xyes" -o "x$build_jtag_vpi" = "xyes"])
686 AM_CONDITIONAL([USB_BLASTER_DRIVER], [test "x$enable_usb_blaster" != "xno" -o "x$enable_usb_blaster_2" != "xno"])
687 AM_CONDITIONAL([AMTJTAGACCEL], [test "x$build_amtjtagaccel" = "xyes"])
688 AM_CONDITIONAL([GW16012], [test "x$build_gw16012" = "xyes"])
689 AM_CONDITIONAL([OOCD_TRACE], [test "x$build_oocd_trace" = "xyes"])
690 AM_CONDITIONAL([REMOTE_BITBANG], [test "x$build_remote_bitbang" = "xyes"])
691 AM_CONDITIONAL([BUSPIRATE], [test "x$build_buspirate" = "xyes"])
692 AM_CONDITIONAL([SYSFSGPIO], [test "x$build_sysfsgpio" = "xyes"])
693 AM_CONDITIONAL([USE_LIBUSB0], [test "x$use_libusb0" = "xyes"])
694 AM_CONDITIONAL([USE_LIBUSB1], [test "x$use_libusb1" = "xyes"])
695 AM_CONDITIONAL([IS_CYGWIN], [test "x$is_cygwin" = "xyes"])
696 AM_CONDITIONAL([IS_MINGW], [test "x$is_mingw" = "xyes"])
697 AM_CONDITIONAL([IS_WIN32], [test "x$is_win32" = "xyes"])
698 AM_CONDITIONAL([IS_DARWIN], [test "x$is_darwin" = "xyes"])
699 AM_CONDITIONAL([BITQ], [test "x$build_bitq" = "xyes"])
700 AM_CONDITIONAL([USE_LIBFTDI], [test "x$use_libftdi" = "xyes"])
701 AM_CONDITIONAL([USE_HIDAPI], [test "x$use_hidapi" = "xyes"])
702 AM_CONDITIONAL([USE_LIBJAYLINK], [test "x$use_libjaylink" = "xyes"])
703 AM_CONDITIONAL([TARGET64], [test "x$build_target64" = "xyes"])
705 AM_CONDITIONAL([MINIDRIVER], [test "x$build_minidriver" = "xyes"])
706 AM_CONDITIONAL([MINIDRIVER_DUMMY], [test "x$build_minidriver_dummy" = "xyes"])
708 AM_CONDITIONAL([INTERNAL_JIMTCL], [test "x$use_internal_jimtcl" = "xyes"])
709 AM_CONDITIONAL([INTERNAL_LIBJAYLINK], [test "x$use_internal_libjaylink" = "xyes"])
711 # Look for environ alternatives. Possibility #1: is environ in unistd.h or stdlib.h?
712 AC_MSG_CHECKING([for environ in unistd.h and stdlib.h])
713 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
717 ]], [[char **ep = environ;]]
724 # Possibility #2: can environ be found in an available library?
725 AC_MSG_CHECKING([for extern environ])
726 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
727 extern char **environ;
728 ]], [[char **ep = environ;]]
730 AC_DEFINE(NEED_ENVIRON_EXTERN, [1], [Must declare 'environ' to use it.])
735 AC_MSG_RESULT([${has_environ}])
738 AS_IF([test "x${has_environ}" != "xyes" ], [
739 AC_MSG_FAILURE([Could not find 'environ' in unistd.h or available libraries.])
742 AC_DEFINE([_GNU_SOURCE],[1],[Use GNU C library extensions (e.g. stdndup).])
744 # set default gcc warnings
745 GCC_WARNINGS="-Wall -Wstrict-prototypes -Wformat-security -Wshadow"
746 AS_IF([test "x${gcc_wextra}" = "xyes"], [
747 GCC_WARNINGS="${GCC_WARNINGS} -Wextra -Wno-unused-parameter"
748 GCC_WARNINGS="${GCC_WARNINGS} -Wbad-function-cast"
749 GCC_WARNINGS="${GCC_WARNINGS} -Wcast-align"
750 GCC_WARNINGS="${GCC_WARNINGS} -Wredundant-decls"
752 AS_IF([test "x${gcc_werror}" = "xyes"], [
753 GCC_WARNINGS="${GCC_WARNINGS} -Werror"
756 # overide default gcc cflags
757 AS_IF([test "x$gcc_warnings" = "xyes"], [
758 AC_SUBST([GCC_WARNINGS], [$GCC_WARNINGS])
768 echo OpenOCD configuration summary
769 echo --------------------------------------------------
770 m4_foreach([adapter], [USB1_ADAPTERS, USB_ADAPTERS, USB0_ADAPTERS,
771 HIDAPI_ADAPTERS, LIBFTDI_ADAPTERS, LIBJAYLINK_ADAPTERS],
772 [s=m4_format(["%-40s"], ADAPTER_DESC([adapter]))
773 AS_CASE([$ADAPTER_VAR([adapter])],
775 echo "$s"yes '(auto)'
786 AS_IF([test "x$build_oocd_trace" = "xyes"], [
787 echo 'WARNING! Deprecated configure option (--enable-oocd_trace)'
788 echo 'The oocd_trace driver is deprecated and will be removed in the next release.'
789 echo 'If you regularly use this driver, please report to the OpenOCD Mailing List.'
793 AS_IF([test "x$build_zy1000" = "xyes" -o "x$build_zy1000_master" = "xyes"], [
794 echo 'WARNING! Deprecated configure option (--enable-zy1000, --enable-zy1000-master)'
795 echo 'Support for the ZY1000 platform is deprecated and will be removed in the next'
796 echo 'release. If you regularly use this platform, please report to the OpenOCD'
801 AS_IF([test "x$build_ioutil" = "xyes"], [
802 echo 'WARNING! Deprecated configure option (--enable-ioutil)'
803 echo 'Support for the ioutil functions is deprecated and will be removed in the next'
804 echo 'release. If you regularly depend on this functionality, please report to the'
805 echo 'OpenOCD Mailing List.'