You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

configure.ac 27 KiB

Improve J-Link driver and introduce libjaylink. This patch uses libjaylink which is a library to access J-Link devices. As other tools which are not in the scope of OpenOCD also need to access J-Link devices a library is used. A firmware upgrade tool and an advanced configuration tool for J-Link devices are under development. Further versions of libjaylink will support additional features OpenOCD could benefit from. This includes TCP/IP as additional possibility to connect to J-Link devices as well as power tracing and device internal communication. The latter is used to access peripherals on some development boards (e.g EFM32 STK and DVK). Integration of libjaylink is realized with a git submodule like jimtcl. As libjaylink depends on libusb-1.0 only, no additional dependency is introduced for OpenOCD. All low-level JTAG and SWD implementations of the current driver are left untouched and therefore no incompabilities are to be expected. Improvements of this patch: * Support for more USB Product IDs, including those with the new scheme (0x10xx). The corresponding udev rules are also updated. * Device selection with serial number and USB address. * Adaptive clocking is now correctly implemented and only usable for devices with the corresponding capability. * The target power supply can now be switched without the need for changing configuration and power cycling the device. * Device configuration is more restrictive and only allowed if the required capabilities are available. * Device configuration now shows the changes between the current configuration of the device and the values that will be applied. * Device configuration is verified after it is written to the device exactly as the vendor software does. * Connection registration is now handled properly and checks if the maximum number of connections on a device is reached. This is also necessary for devices which are attached via USB to OpenOCD as some device models also support connections on TCP/IP. * Serial Wire Output (SWO) can now be captured. This feature is not documented by SEGGER however it is completely supported by libjaylink. This patch and libjaylink were tested on Ubuntu 14.04 (i386), Debian 7 (amd64), FreeBSD 10.0 (amd64) and Windows XP SP3 (32-bit) with the following device and target configurations: * JTAG: J-Link v8.0, v9.0 and v9.3 with AT91SAM7S256 * SWD: SiLabs EFM32 STK 3700 (EFM32GG990F1024) * SWD: J-Link v8.0, v9.0 and v9.3 with EFM32GG990F1024 * SWD: XMC 2Go (XMC1100) * SWD: XMC1100 Boot Kit (XMC1100) * SWD: IAR Systems / Olimex Eval Board (LPC1343F) * SWD: Nordic Semiconductor nRF51 Dongle (nRF51422) * SWD: SiLabs EZR32 WSTK 6220A (EZR32WG330FG60G) Except for Windows XP all builds are tested with Clang in addition to GCC. This patch and libjaylink are not tested on OSX yet. Change-Id: I8476c57d37c6091c4b892b183da682c548ca1786 Signed-off-by: Marc Schink <openocd-dev@marcschink.de> Reviewed-on: http://openocd.zylin.com/2598 Tested-by: jenkins Reviewed-by: Andreas Färber <afaerber@suse.de> Reviewed-by: Paul Fertser <fercerpav@gmail.com> Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
9 years ago
Add BCM2835 (as found in Raspberry Pi) interface driver This adds support for JTAG programming by bitbanging GPIOs exposed on the RaspberryPi's expansion header. Tested by connecting directly to an STM32VLDiscovery board, without any additional circuity. I observed maximum about 4MHz on the TCK pin with an old analogue 'scope and about 100kHz when setting the speed to 100kHz. Busyloop waiting is needed because even with a single 0ns nanosleep call (with FIFO priority) it lowers the TCK speed to ~30kHz which is way too low to be useful. The speed testing with adapter_khz 2000 gave the following results: sudo chrt -f 1 nice -n -19 ./src/openocd \ -f interface/raspberrypi-native.cfg \ -c "set WORKAREASIZE 0x2000" \ -f target/stm32f1x.cfg -c "adapter_khz 2000" wrote 131072 bytes from file random.bin in 3.973677s (32.212 KiB/s) dumped 131072 bytes in 1.445699s (88.538 KiB/s) This is 3.7 times faster for writing and 14.3 times faster for reading compared to the generic sysfsgpio driver; probably the writing speed is limited by the target itself here and reading speed might be considerably higher too with appropriate connection and a capable target. BCM2835 name is choosen over BCM2708 because the published peripherals datasheet uses the particular model name and not family name. Change-Id: Ib78168be27f53c2a3c88c3dd8154d1190c318c78 Signed-off-by: Paul Fertser <fercerpav@gmail.com> Reviewed-on: http://openocd.zylin.com/758 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
12 years ago
Add BCM2835 (as found in Raspberry Pi) interface driver This adds support for JTAG programming by bitbanging GPIOs exposed on the RaspberryPi's expansion header. Tested by connecting directly to an STM32VLDiscovery board, without any additional circuity. I observed maximum about 4MHz on the TCK pin with an old analogue 'scope and about 100kHz when setting the speed to 100kHz. Busyloop waiting is needed because even with a single 0ns nanosleep call (with FIFO priority) it lowers the TCK speed to ~30kHz which is way too low to be useful. The speed testing with adapter_khz 2000 gave the following results: sudo chrt -f 1 nice -n -19 ./src/openocd \ -f interface/raspberrypi-native.cfg \ -c "set WORKAREASIZE 0x2000" \ -f target/stm32f1x.cfg -c "adapter_khz 2000" wrote 131072 bytes from file random.bin in 3.973677s (32.212 KiB/s) dumped 131072 bytes in 1.445699s (88.538 KiB/s) This is 3.7 times faster for writing and 14.3 times faster for reading compared to the generic sysfsgpio driver; probably the writing speed is limited by the target itself here and reading speed might be considerably higher too with appropriate connection and a capable target. BCM2835 name is choosen over BCM2708 because the published peripherals datasheet uses the particular model name and not family name. Change-Id: Ib78168be27f53c2a3c88c3dd8154d1190c318c78 Signed-off-by: Paul Fertser <fercerpav@gmail.com> Reviewed-on: http://openocd.zylin.com/758 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
12 years ago
Add BCM2835 (as found in Raspberry Pi) interface driver This adds support for JTAG programming by bitbanging GPIOs exposed on the RaspberryPi's expansion header. Tested by connecting directly to an STM32VLDiscovery board, without any additional circuity. I observed maximum about 4MHz on the TCK pin with an old analogue 'scope and about 100kHz when setting the speed to 100kHz. Busyloop waiting is needed because even with a single 0ns nanosleep call (with FIFO priority) it lowers the TCK speed to ~30kHz which is way too low to be useful. The speed testing with adapter_khz 2000 gave the following results: sudo chrt -f 1 nice -n -19 ./src/openocd \ -f interface/raspberrypi-native.cfg \ -c "set WORKAREASIZE 0x2000" \ -f target/stm32f1x.cfg -c "adapter_khz 2000" wrote 131072 bytes from file random.bin in 3.973677s (32.212 KiB/s) dumped 131072 bytes in 1.445699s (88.538 KiB/s) This is 3.7 times faster for writing and 14.3 times faster for reading compared to the generic sysfsgpio driver; probably the writing speed is limited by the target itself here and reading speed might be considerably higher too with appropriate connection and a capable target. BCM2835 name is choosen over BCM2708 because the published peripherals datasheet uses the particular model name and not family name. Change-Id: Ib78168be27f53c2a3c88c3dd8154d1190c318c78 Signed-off-by: Paul Fertser <fercerpav@gmail.com> Reviewed-on: http://openocd.zylin.com/758 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
12 years ago
Improve J-Link driver and introduce libjaylink. This patch uses libjaylink which is a library to access J-Link devices. As other tools which are not in the scope of OpenOCD also need to access J-Link devices a library is used. A firmware upgrade tool and an advanced configuration tool for J-Link devices are under development. Further versions of libjaylink will support additional features OpenOCD could benefit from. This includes TCP/IP as additional possibility to connect to J-Link devices as well as power tracing and device internal communication. The latter is used to access peripherals on some development boards (e.g EFM32 STK and DVK). Integration of libjaylink is realized with a git submodule like jimtcl. As libjaylink depends on libusb-1.0 only, no additional dependency is introduced for OpenOCD. All low-level JTAG and SWD implementations of the current driver are left untouched and therefore no incompabilities are to be expected. Improvements of this patch: * Support for more USB Product IDs, including those with the new scheme (0x10xx). The corresponding udev rules are also updated. * Device selection with serial number and USB address. * Adaptive clocking is now correctly implemented and only usable for devices with the corresponding capability. * The target power supply can now be switched without the need for changing configuration and power cycling the device. * Device configuration is more restrictive and only allowed if the required capabilities are available. * Device configuration now shows the changes between the current configuration of the device and the values that will be applied. * Device configuration is verified after it is written to the device exactly as the vendor software does. * Connection registration is now handled properly and checks if the maximum number of connections on a device is reached. This is also necessary for devices which are attached via USB to OpenOCD as some device models also support connections on TCP/IP. * Serial Wire Output (SWO) can now be captured. This feature is not documented by SEGGER however it is completely supported by libjaylink. This patch and libjaylink were tested on Ubuntu 14.04 (i386), Debian 7 (amd64), FreeBSD 10.0 (amd64) and Windows XP SP3 (32-bit) with the following device and target configurations: * JTAG: J-Link v8.0, v9.0 and v9.3 with AT91SAM7S256 * SWD: SiLabs EFM32 STK 3700 (EFM32GG990F1024) * SWD: J-Link v8.0, v9.0 and v9.3 with EFM32GG990F1024 * SWD: XMC 2Go (XMC1100) * SWD: XMC1100 Boot Kit (XMC1100) * SWD: IAR Systems / Olimex Eval Board (LPC1343F) * SWD: Nordic Semiconductor nRF51 Dongle (nRF51422) * SWD: SiLabs EZR32 WSTK 6220A (EZR32WG330FG60G) Except for Windows XP all builds are tested with Clang in addition to GCC. This patch and libjaylink are not tested on OSX yet. Change-Id: I8476c57d37c6091c4b892b183da682c548ca1786 Signed-off-by: Marc Schink <openocd-dev@marcschink.de> Reviewed-on: http://openocd.zylin.com/2598 Tested-by: jenkins Reviewed-by: Andreas Färber <afaerber@suse.de> Reviewed-by: Paul Fertser <fercerpav@gmail.com> Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
9 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801
  1. AC_PREREQ([2.69])
  2. AC_INIT([openocd], [0.11.0+dev],
  3. [OpenOCD Mailing List <openocd-devel@lists.sourceforge.net>])
  4. AC_CONFIG_SRCDIR([src/openocd.c])
  5. AC_CONFIG_AUX_DIR([build-aux])
  6. m4_include([config_subdir.m4])dnl
  7. # check for makeinfo before calling AM_INIT_AUTOMAKE
  8. AC_CHECK_PROG([MAKEINFO], [makeinfo], [makeinfo])
  9. AS_IF([test "x$MAKEINFO" = "x"], [
  10. MAKEINFO='echo makeinfo missing; true'
  11. AC_MSG_WARN([Info documentation will not be built.])
  12. ])
  13. AC_SUBST([MAKEINFO])
  14. AM_INIT_AUTOMAKE([-Wall -Wno-portability dist-bzip2 dist-zip subdir-objects])
  15. AC_CONFIG_HEADERS([config.h])
  16. AC_LANG([C])
  17. AC_PROG_CC
  18. # autoconf 2.70 obsoletes AC_PROG_CC_C99 and includes it in AC_PROG_CC
  19. m4_version_prereq([2.70],[],[AC_PROG_CC_C99])
  20. AM_PROG_CC_C_O
  21. AC_PROG_RANLIB
  22. PKG_PROG_PKG_CONFIG([0.23])
  23. dnl disable checks for C++, Fortran and GNU Java Compiler
  24. m4_defun([_LT_AC_LANG_CXX_CONFIG], [:])
  25. m4_defun([_LT_AC_LANG_F77_CONFIG], [:])
  26. m4_defun([_LT_AC_LANG_GCJ_CONFIG], [:])
  27. AC_DISABLE_SHARED
  28. LT_INIT
  29. AC_SUBST([LIBTOOL_DEPS])
  30. dnl configure checks required for Jim files (these are obsolete w/ C99)
  31. AC_C_CONST
  32. AC_TYPE_LONG_LONG_INT
  33. AC_SEARCH_LIBS([ioperm], [ioperm])
  34. AC_SEARCH_LIBS([dlopen], [dl])
  35. AC_SEARCH_LIBS([openpty], [util])
  36. AC_CHECK_HEADERS([sys/socket.h])
  37. AC_CHECK_HEADERS([elf.h])
  38. AC_EGREP_HEADER(Elf64_Ehdr, [elf.h], [
  39. AC_DEFINE([HAVE_ELF64], [1], [Define to 1 if the system has the type `Elf64_Ehdr'.])
  40. ])
  41. AC_CHECK_HEADERS([dirent.h])
  42. AC_CHECK_HEADERS([fcntl.h])
  43. AC_CHECK_HEADERS([malloc.h])
  44. AC_CHECK_HEADERS([netdb.h])
  45. AC_CHECK_HEADERS([poll.h])
  46. AC_CHECK_HEADERS([pthread.h])
  47. AC_CHECK_HEADERS([strings.h])
  48. AC_CHECK_HEADERS([sys/ioctl.h])
  49. AC_CHECK_HEADERS([sys/param.h])
  50. AC_CHECK_HEADERS([sys/select.h])
  51. AC_CHECK_HEADERS([sys/stat.h])
  52. AC_CHECK_HEADERS([sys/sysctl.h])
  53. AC_CHECK_HEADERS([sys/time.h])
  54. AC_CHECK_HEADERS([sys/types.h])
  55. AC_CHECK_HEADERS([unistd.h])
  56. AC_CHECK_HEADERS([arpa/inet.h ifaddrs.h netinet/in.h netinet/tcp.h net/if.h], [], [], [dnl
  57. #include <stdio.h>
  58. #ifdef STDC_HEADERS
  59. # include <stdlib.h>
  60. # include <stddef.h>
  61. #else
  62. # ifdef HAVE_STDLIB_H
  63. # include <stdlib.h>
  64. # endif
  65. #endif
  66. #ifdef HAVE_SYS_SOCKET_H
  67. # include <sys/socket.h>
  68. #endif
  69. ])
  70. AC_HEADER_ASSERT
  71. AC_HEADER_STDBOOL
  72. AC_C_BIGENDIAN
  73. AC_CHECK_FUNCS([strndup])
  74. AC_CHECK_FUNCS([strnlen])
  75. AC_CHECK_FUNCS([gettimeofday])
  76. AC_CHECK_FUNCS([usleep])
  77. AC_CHECK_FUNCS([vasprintf])
  78. AC_CHECK_FUNCS([realpath])
  79. # guess-rev.sh only exists in the repository, not in the released archives
  80. AC_MSG_CHECKING([whether to build a release])
  81. AS_IF([test -x "$srcdir/guess-rev.sh"], [
  82. build_release=no
  83. ], [
  84. build_release=yes
  85. ])
  86. AC_MSG_RESULT([$build_release])
  87. # Adapter drivers
  88. # 1st column -- configure option
  89. # 2nd column -- description
  90. # 3rd column -- symbol used for both config.h and automake
  91. m4_define([ADAPTER_ARG], [m4_argn([1], $1)])
  92. m4_define([ADAPTER_DESC], [m4_argn([2], $1)])
  93. m4_define([ADAPTER_SYM], [m4_argn([3], $1)])
  94. m4_define([ADAPTER_VAR], [enable_[]ADAPTER_ARG($1)])
  95. m4_define([ADAPTER_OPT], [m4_translit(ADAPTER_ARG($1), [_], [-])])
  96. m4_define([USB1_ADAPTERS],
  97. [[[ftdi], [MPSSE mode of FTDI based devices], [FTDI]],
  98. [[stlink], [ST-Link Programmer], [HLADAPTER_STLINK]],
  99. [[ti_icdi], [TI ICDI JTAG Programmer], [HLADAPTER_ICDI]],
  100. [[ulink], [Keil ULINK JTAG Programmer], [ULINK]],
  101. [[usb_blaster_2], [Altera USB-Blaster II Compatible], [USB_BLASTER_2]],
  102. [[ft232r], [Bitbang mode of FT232R based devices], [FT232R]],
  103. [[vsllink], [Versaloon-Link JTAG Programmer], [VSLLINK]],
  104. [[xds110], [TI XDS110 Debug Probe], [XDS110]],
  105. [[cmsis_dap_v2], [CMSIS-DAP v2 Compliant Debugger], [CMSIS_DAP_USB]],
  106. [[osbdm], [OSBDM (JTAG only) Programmer], [OSBDM]],
  107. [[opendous], [eStick/opendous JTAG Programmer], [OPENDOUS]],
  108. [[armjtagew], [Olimex ARM-JTAG-EW Programmer], [ARMJTAGEW]],
  109. [[rlink], [Raisonance RLink JTAG Programmer], [RLINK]],
  110. [[usbprog], [USBProg JTAG Programmer], [USBPROG]],
  111. [[aice], [Andes JTAG Programmer], [AICE]]])
  112. m4_define([HIDAPI_ADAPTERS],
  113. [[[cmsis_dap], [CMSIS-DAP Compliant Debugger], [CMSIS_DAP_HID]],
  114. [[nulink], [Nu-Link Programmer], [HLADAPTER_NULINK]]])
  115. m4_define([HIDAPI_USB1_ADAPTERS],
  116. [[[kitprog], [Cypress KitProg Programmer], [KITPROG]]])
  117. m4_define([LIBFTDI_ADAPTERS],
  118. [[[usb_blaster], [Altera USB-Blaster Compatible], [USB_BLASTER]],
  119. [[presto], [ASIX Presto Adapter], [PRESTO]]])
  120. m4_define([LIBFTDI_USB1_ADAPTERS],
  121. [[[openjtag], [OpenJTAG Adapter], [OPENJTAG]]])
  122. m4_define([LIBGPIOD_ADAPTERS],
  123. [[[linuxgpiod], [Linux GPIO bitbang through libgpiod], [LINUXGPIOD]]])
  124. m4_define([LIBJAYLINK_ADAPTERS],
  125. [[[jlink], [SEGGER J-Link Programmer], [JLINK]]])
  126. m4_define([PCIE_ADAPTERS],
  127. [[[xlnx_pcie_xvc], [Xilinx XVC/PCIe], [XLNX_PCIE_XVC]]])
  128. m4_define([SERIAL_PORT_ADAPTERS],
  129. [[[buspirate], [Bus Pirate], [BUS_PIRATE]]])
  130. m4_define([OPTIONAL_LIBRARIES],
  131. [[[capstone], [Use Capstone disassembly framework], []]])
  132. AC_ARG_ENABLE([doxygen-html],
  133. AS_HELP_STRING([--disable-doxygen-html],
  134. [Disable building Doxygen manual as HTML.]),
  135. [doxygen_as_html=$enableval], [doxygen_as_html=yes])
  136. AC_SUBST([doxygen_as_html])
  137. AC_MSG_CHECKING([whether to build Doxygen as HTML])
  138. AC_MSG_RESULT([$doxygen_as_html])
  139. AC_ARG_ENABLE([doxygen-pdf],
  140. AS_HELP_STRING([--enable-doxygen-pdf],
  141. [Enable building Doxygen manual as PDF.]),
  142. [doxygen_as_pdf=$enableval], [doxygen_as_pdf=no])
  143. AC_SUBST([doxygen_as_pdf])
  144. AC_MSG_CHECKING([whether to build Doxygen as PDF])
  145. AC_MSG_RESULT([$doxygen_as_pdf])
  146. AC_ARG_ENABLE([gccwarnings],
  147. AS_HELP_STRING([--disable-gccwarnings], [Disable compiler warnings]),
  148. [gcc_warnings=$enableval], [gcc_warnings=yes])
  149. AC_ARG_ENABLE([wextra],
  150. AS_HELP_STRING([--disable-wextra], [Disable extra compiler warnings]),
  151. [gcc_wextra=$enableval], [gcc_wextra=$gcc_warnings])
  152. AC_ARG_ENABLE([werror],
  153. AS_HELP_STRING([--disable-werror], [Do not treat warnings as errors]),
  154. [gcc_werror=$enableval], [gcc_werror=$gcc_warnings])
  155. # set default verbose options, overridden by following options
  156. debug_usb_io=no
  157. debug_usb_comms=no
  158. AC_ARG_ENABLE([verbose],
  159. AS_HELP_STRING([--enable-verbose],
  160. [Enable verbose JTAG I/O messages (for debugging).]),
  161. [
  162. debug_usb_io=$enableval
  163. debug_usb_comms=$enableval
  164. ], [])
  165. AC_ARG_ENABLE([verbose_usb_io],
  166. AS_HELP_STRING([--enable-verbose-usb-io],
  167. [Enable verbose USB I/O messages (for debugging)]),
  168. [debug_usb_io=$enableval], [])
  169. AC_ARG_ENABLE([verbose_usb_comms],
  170. AS_HELP_STRING([--enable-verbose-usb-comms],
  171. [Enable verbose USB communication messages (for debugging)]),
  172. [debug_usb_comms=$enableval], [])
  173. AC_MSG_CHECKING([whether to enable verbose USB I/O messages]);
  174. AC_MSG_RESULT([$debug_usb_io])
  175. AS_IF([test "x$debug_usb_io" = "xyes"], [
  176. AC_DEFINE([_DEBUG_USB_IO_],[1], [Print verbose USB I/O messages])
  177. ])
  178. AC_MSG_CHECKING([whether to enable verbose USB communication messages]);
  179. AC_MSG_RESULT([$debug_usb_comms])
  180. AS_IF([test "x$debug_usb_comms" = "xyes"], [
  181. AC_DEFINE([_DEBUG_USB_COMMS_],[1], [Print verbose USB communication messages])
  182. ])
  183. debug_malloc=no
  184. AC_ARG_ENABLE([malloc_logging],
  185. AS_HELP_STRING([--enable-malloc-logging],
  186. [Include free space in logging messages (requires malloc.h).]),
  187. [debug_malloc=$enableval], [])
  188. AC_MSG_CHECKING([whether to enable malloc free space logging]);
  189. AC_MSG_RESULT([$debug_malloc])
  190. AS_IF([test "x$debug_malloc" = "xyes"], [
  191. AC_DEFINE([_DEBUG_FREE_SPACE_],[1], [Include malloc free space in logging])
  192. ])
  193. AC_ARG_ENABLE([dummy],
  194. AS_HELP_STRING([--enable-dummy], [Enable building the dummy port driver]),
  195. [build_dummy=$enableval], [build_dummy=no])
  196. AC_ARG_ENABLE([rshim],
  197. AS_HELP_STRING([--enable-rshim], [Enable building the rshim driver]),
  198. [build_rshim=$enableval], [build_rshim=no])
  199. m4_define([AC_ARG_ADAPTERS], [
  200. m4_foreach([adapter], [$1],
  201. [AC_ARG_ENABLE(ADAPTER_OPT([adapter]),
  202. AS_HELP_STRING([--enable-ADAPTER_OPT([adapter])],
  203. [Enable building support for the ]ADAPTER_DESC([adapter])[ (default is $2)]),
  204. [], [ADAPTER_VAR([adapter])=$2])
  205. ])
  206. ])
  207. AC_ARG_ADAPTERS([
  208. USB1_ADAPTERS,
  209. HIDAPI_ADAPTERS,
  210. HIDAPI_USB1_ADAPTERS,
  211. LIBFTDI_ADAPTERS,
  212. LIBFTDI_USB1_ADAPTERS
  213. LIBGPIOD_ADAPTERS,
  214. SERIAL_PORT_ADAPTERS,
  215. LIBJAYLINK_ADAPTERS
  216. ],[auto])
  217. AC_ARG_ENABLE([parport],
  218. AS_HELP_STRING([--enable-parport], [Enable building the pc parallel port driver]),
  219. [build_parport=$enableval], [build_parport=no])
  220. AC_ARG_ENABLE([parport_ppdev],
  221. AS_HELP_STRING([--disable-parport-ppdev],
  222. [Disable use of ppdev (/dev/parportN) for parport (for x86 only)]),
  223. [parport_use_ppdev=$enableval], [parport_use_ppdev=yes])
  224. AC_ARG_ENABLE([parport_giveio],
  225. AS_HELP_STRING([--enable-parport-giveio],
  226. [Enable use of giveio for parport (for CygWin only)]),
  227. [parport_use_giveio=$enableval], [parport_use_giveio=])
  228. AC_ARG_ENABLE([jtag_vpi],
  229. AS_HELP_STRING([--enable-jtag_vpi], [Enable building support for JTAG VPI]),
  230. [build_jtag_vpi=$enableval], [build_jtag_vpi=no])
  231. AC_ARG_ENABLE([jtag_dpi],
  232. AS_HELP_STRING([--enable-jtag_dpi], [Enable building support for JTAG DPI]),
  233. [build_jtag_dpi=$enableval], [build_jtag_dpi=no])
  234. AC_ARG_ENABLE([amtjtagaccel],
  235. AS_HELP_STRING([--enable-amtjtagaccel], [Enable building the Amontec JTAG-Accelerator driver]),
  236. [build_amtjtagaccel=$enableval], [build_amtjtagaccel=no])
  237. AS_CASE(["${host_cpu}"],
  238. [arm*|aarch64], [
  239. AC_ARG_ENABLE([bcm2835gpio],
  240. AS_HELP_STRING([--enable-bcm2835gpio], [Enable building support for bitbanging on BCM2835 (as found in Raspberry Pi)]),
  241. [build_bcm2835gpio=$enableval], [build_bcm2835gpio=no])
  242. AC_ARG_ENABLE([imx_gpio],
  243. AS_HELP_STRING([--enable-imx_gpio], [Enable building support for bitbanging on NXP IMX processors]),
  244. [build_imx_gpio=$enableval], [build_imx_gpio=no])
  245. ],
  246. [
  247. build_bcm2835gpio=no
  248. build_imx_gpio=no
  249. ])
  250. AS_CASE(["${host_cpu}"],
  251. [arm*], [
  252. AC_ARG_ENABLE([ep93xx],
  253. AS_HELP_STRING([--enable-ep93xx], [Enable building support for EP93xx based SBCs]),
  254. [build_ep93xx=$enableval], [build_ep93xx=no])
  255. AC_ARG_ENABLE([at91rm9200],
  256. AS_HELP_STRING([--enable-at91rm9200], [Enable building support for AT91RM9200 based SBCs]),
  257. [build_at91rm9200=$enableval], [build_at91rm9200=no])
  258. ],
  259. [
  260. build_ep93xx=no
  261. build_at91rm9200=no
  262. ])
  263. AC_ARG_ENABLE([gw16012],
  264. AS_HELP_STRING([--enable-gw16012], [Enable building support for the Gateworks GW16012 JTAG Programmer]),
  265. [build_gw16012=$enableval], [build_gw16012=no])
  266. AC_ARG_ENABLE([sysfsgpio],
  267. AS_HELP_STRING([--enable-sysfsgpio], [Enable building support for programming driven via sysfs gpios.]),
  268. [build_sysfsgpio=$enableval], [build_sysfsgpio=no])
  269. AC_ARG_ENABLE([xlnx_pcie_xvc],
  270. AS_HELP_STRING([--enable-xlnx-pcie-xvc], [Enable building support for Xilinx XVC/PCIe.]),
  271. [build_xlnx_pcie_xvc=$enableval], [build_xlnx_pcie_xvc=no])
  272. AS_CASE([$host_os],
  273. [linux*], [],
  274. [
  275. AS_IF([test "x$build_sysfsgpio" = "xyes"], [
  276. AC_MSG_ERROR([sysfsgpio is only available on linux])
  277. ])
  278. AS_IF([test "x$enable_linuxgpiod" = "xyes"], [
  279. AC_MSG_ERROR([linuxgpiod is only available on linux])
  280. ])
  281. AS_IF([test "x$build_xlnx_pcie_xvc" = "xyes"], [
  282. AC_MSG_ERROR([xlnx_pcie_xvc is only available on linux])
  283. ])
  284. AS_CASE([$host_os], [freebsd*], [],
  285. [
  286. AS_IF([test "x$build_rshim" = "xyes"], [
  287. AC_MSG_ERROR([build_rshim is only available on linux or freebsd])
  288. ])
  289. ])
  290. ])
  291. AC_ARG_ENABLE([internal-jimtcl],
  292. AS_HELP_STRING([--disable-internal-jimtcl], [Disable building internal jimtcl]),
  293. [use_internal_jimtcl=$enableval], [use_internal_jimtcl=yes])
  294. AC_ARG_ENABLE([internal-libjaylink],
  295. AS_HELP_STRING([--disable-internal-libjaylink],
  296. [Disable building internal libjaylink]),
  297. [use_internal_libjaylink=$enableval], [use_internal_libjaylink=yes])
  298. AC_ARG_ENABLE([remote-bitbang],
  299. AS_HELP_STRING([--enable-remote-bitbang], [Enable building support for the Remote Bitbang jtag driver]),
  300. [build_remote_bitbang=$enableval], [build_remote_bitbang=no])
  301. AS_CASE(["${host_cpu}"],
  302. [i?86|x86*], [],
  303. [
  304. AS_IF([test "x$parport_use_ppdev" = "xno"], [
  305. AC_MSG_WARN([--disable-parport-ppdev is not supported by the host CPU])
  306. ])
  307. parport_use_ppdev=yes
  308. ])
  309. AS_CASE([$host],
  310. [*-cygwin*], [
  311. is_win32=yes
  312. parport_use_ppdev=no
  313. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[return __MINGW32__;]])],
  314. [is_mingw=yes],[is_mingw=no])
  315. AS_IF([test "x$is_mingw" = "xyes"], [
  316. AS_IF([test "x$parport_use_giveio" = "xno"], [
  317. AC_MSG_WARN([--disable-parport-giveio is not supported by MinGW32 hosts])
  318. ])
  319. parport_use_giveio=yes
  320. is_cygwin=no
  321. ], [
  322. is_cygwin=yes
  323. # sys/io.h needed under cygwin for parport access
  324. AS_IF([test "x$build_parport" = "xyes"], [
  325. AC_CHECK_HEADERS([sys/io.h],[],AC_MSG_ERROR([Please install the cygwin ioperm package]))
  326. ])
  327. ])
  328. ],
  329. [*-mingw* | *-msys*], [
  330. is_mingw=yes
  331. is_win32=yes
  332. parport_use_ppdev=no
  333. AS_IF([test "x$parport_use_giveio" = "xno"], [
  334. AC_MSG_WARN([--disable-parport-giveio is not supported by MinGW32 hosts])
  335. ])
  336. parport_use_giveio=yes
  337. AS_IF([test "x$enable_buspirate" = "xyes"], [
  338. AC_MSG_ERROR([buspirate currently not supported by MinGW32 hosts])
  339. ])
  340. # In case enable_buspirate=auto, make sure it will not be built.
  341. enable_buspirate=no
  342. AC_SUBST([HOST_CPPFLAGS], [-D__USE_MINGW_ANSI_STDIO])
  343. ],
  344. [*darwin*], [
  345. is_darwin=yes
  346. AS_IF([test "x$parport_use_giveio" = "xyes"], [
  347. AC_MSG_WARN([--enable-parport-giveio cannot be used by Darwin hosts])
  348. ])
  349. parport_use_giveio=no
  350. ],
  351. [
  352. AS_IF([test "x$parport_use_giveio" = "xyes"], [
  353. AC_MSG_WARN([--enable-parport-giveio cannot be used by ]$host[ hosts])
  354. ])
  355. parport_use_giveio=no
  356. ])
  357. AS_IF([test "x$is_cygwin" = "xyes"], [
  358. AC_DEFINE([IS_CYGWIN], [1], [1 if building for Cygwin.])
  359. ], [
  360. AC_DEFINE([IS_CYGWIN], [0], [0 if not building for Cygwin.])
  361. ])
  362. AS_IF([test "x$is_mingw" = "xyes"], [
  363. AC_DEFINE([IS_MINGW], [1], [1 if building for Mingw.])
  364. ], [
  365. AC_DEFINE([IS_MINGW], [0], [0 if not building for Mingw.])
  366. ])
  367. AS_IF([test "x$is_win32" = "xyes"], [
  368. AC_DEFINE([IS_WIN32], [1], [1 if building for Win32.])
  369. ], [
  370. AC_DEFINE([IS_WIN32], [0], [0 if not building for Win32.])
  371. ])
  372. AS_IF([test "x$is_darwin" = "xyes"], [
  373. AC_DEFINE([IS_DARWIN], [1], [1 if building for Darwin.])
  374. ], [
  375. AC_DEFINE([IS_DARWIN], [0], [0 if not building for Darwin.])
  376. ])
  377. AS_IF([test "x$build_parport" = "xyes"], [
  378. build_bitbang=yes
  379. AC_DEFINE([BUILD_PARPORT], [1], [1 if you want parport.])
  380. ], [
  381. AC_DEFINE([BUILD_PARPORT], [0], [0 if you don't want parport.])
  382. ])
  383. AS_IF([test "x$build_rshim" = "xyes"], [
  384. AC_DEFINE([BUILD_RSHIM], [1], [1 if you want to debug BlueField SoC via rshim.])
  385. ], [
  386. AC_DEFINE([BUILD_RSHIM], [0], [0 if you don't want to debug BlueField SoC via rshim.])
  387. ])
  388. AS_IF([test "x$build_dummy" = "xyes"], [
  389. build_bitbang=yes
  390. AC_DEFINE([BUILD_DUMMY], [1], [1 if you want dummy driver.])
  391. ], [
  392. AC_DEFINE([BUILD_DUMMY], [0], [0 if you don't want dummy driver.])
  393. ])
  394. AS_IF([test "x$build_ep93xx" = "xyes"], [
  395. build_bitbang=yes
  396. AC_DEFINE([BUILD_EP93XX], [1], [1 if you want ep93xx.])
  397. ], [
  398. AC_DEFINE([BUILD_EP93XX], [0], [0 if you don't want ep93xx.])
  399. ])
  400. AS_IF([test "x$build_at91rm9200" = "xyes"], [
  401. build_bitbang=yes
  402. AC_DEFINE([BUILD_AT91RM9200], [1], [1 if you want at91rm9200.])
  403. ], [
  404. AC_DEFINE([BUILD_AT91RM9200], [0], [0 if you don't want at91rm9200.])
  405. ])
  406. AS_IF([test "x$build_bcm2835gpio" = "xyes"], [
  407. build_bitbang=yes
  408. AC_DEFINE([BUILD_BCM2835GPIO], [1], [1 if you want bcm2835gpio.])
  409. ], [
  410. AC_DEFINE([BUILD_BCM2835GPIO], [0], [0 if you don't want bcm2835gpio.])
  411. ])
  412. AS_IF([test "x$build_imx_gpio" = "xyes"], [
  413. build_bitbang=yes
  414. AC_DEFINE([BUILD_IMX_GPIO], [1], [1 if you want imx_gpio.])
  415. ], [
  416. AC_DEFINE([BUILD_IMX_GPIO], [0], [0 if you don't want imx_gpio.])
  417. ])
  418. AS_IF([test "x$parport_use_ppdev" = "xyes"], [
  419. AC_DEFINE([PARPORT_USE_PPDEV], [1], [1 if you want parport to use ppdev.])
  420. ], [
  421. AC_DEFINE([PARPORT_USE_PPDEV], [0], [0 if you don't want parport to use ppdev.])
  422. ])
  423. AS_IF([test "x$parport_use_giveio" = "xyes"], [
  424. AC_DEFINE([PARPORT_USE_GIVEIO], [1], [1 if you want parport to use giveio.])
  425. ], [
  426. AC_DEFINE([PARPORT_USE_GIVEIO], [0], [0 if you don't want parport to use giveio.])
  427. ])
  428. AS_IF([test "x$build_jtag_vpi" = "xyes"], [
  429. AC_DEFINE([BUILD_JTAG_VPI], [1], [1 if you want JTAG VPI.])
  430. ], [
  431. AC_DEFINE([BUILD_JTAG_VPI], [0], [0 if you don't want JTAG VPI.])
  432. ])
  433. AS_IF([test "x$build_jtag_dpi" = "xyes"], [
  434. AC_DEFINE([BUILD_JTAG_DPI], [1], [1 if you want JTAG DPI.])
  435. ], [
  436. AC_DEFINE([BUILD_JTAG_DPI], [0], [0 if you don't want JTAG DPI.])
  437. ])
  438. AS_IF([test "x$build_amtjtagaccel" = "xyes"], [
  439. AC_DEFINE([BUILD_AMTJTAGACCEL], [1], [1 if you want the Amontec JTAG-Accelerator driver.])
  440. ], [
  441. AC_DEFINE([BUILD_AMTJTAGACCEL], [0], [0 if you don't want the Amontec JTAG-Accelerator driver.])
  442. ])
  443. AS_IF([test "x$build_gw16012" = "xyes"], [
  444. AC_DEFINE([BUILD_GW16012], [1], [1 if you want the Gateworks GW16012 driver.])
  445. ], [
  446. AC_DEFINE([BUILD_GW16012], [0], [0 if you don't want the Gateworks GW16012 driver.])
  447. ])
  448. AS_IF([test "x$enable_buspirate" != "xno"], [
  449. AC_DEFINE([BUILD_BUSPIRATE], [1], [1 if you want the Buspirate JTAG driver.])
  450. ], [
  451. AC_DEFINE([BUILD_BUSPIRATE], [0], [0 if you don't want the Buspirate JTAG driver.])
  452. ])
  453. AS_IF([test "x$use_internal_jimtcl" = "xyes"], [
  454. AS_IF([test -f "$srcdir/jimtcl/configure.ac"], [
  455. AX_CONFIG_SUBDIR_OPTION([jimtcl], [--disable-install-jim])
  456. ], [
  457. AC_MSG_ERROR([jimtcl not found, run git submodule init and git submodule update.])
  458. ])
  459. ])
  460. AS_IF([test "x$build_remote_bitbang" = "xyes"], [
  461. build_bitbang=yes
  462. AC_DEFINE([BUILD_REMOTE_BITBANG], [1], [1 if you want the Remote Bitbang JTAG driver.])
  463. ], [
  464. AC_DEFINE([BUILD_REMOTE_BITBANG], [0], [0 if you don't want the Remote Bitbang JTAG driver.])
  465. ])
  466. AS_IF([test "x$build_sysfsgpio" = "xyes"], [
  467. build_bitbang=yes
  468. AC_DEFINE([BUILD_SYSFSGPIO], [1], [1 if you want the SysfsGPIO driver.])
  469. ], [
  470. AC_DEFINE([BUILD_SYSFSGPIO], [0], [0 if you don't want SysfsGPIO driver.])
  471. ])
  472. AS_IF([test "x$build_xlnx_pcie_xvc" = "xyes"], [
  473. build_xlnx_pcie_xvc=yes
  474. AC_DEFINE([BUILD_XLNX_PCIE_XVC], [1], [1 if you want the Xilinx XVC/PCIe driver.])
  475. ], [
  476. AC_DEFINE([BUILD_XLNX_PCIE_XVC], [0], [0 if you don't want Xilinx XVC/PCIe driver.])
  477. ])
  478. PKG_CHECK_MODULES([LIBUSB1], [libusb-1.0], [
  479. use_libusb1=yes
  480. AC_DEFINE([HAVE_LIBUSB1], [1], [Define if you have libusb-1.x])
  481. PKG_CHECK_EXISTS([libusb-1.0 >= 1.0.9],
  482. [AC_DEFINE([HAVE_LIBUSB_ERROR_NAME], [1], [Define if your libusb has libusb_error_name()])],
  483. [AC_MSG_WARN([libusb-1.x older than 1.0.9 detected, consider updating])])
  484. LIBUSB1_CFLAGS=`echo $LIBUSB1_CFLAGS | sed 's/-I/-isystem /'`
  485. AC_MSG_NOTICE([libusb-1.0 header bug workaround: LIBUSB1_CFLAGS changed to "$LIBUSB1_CFLAGS"])
  486. PKG_CHECK_EXISTS([libusb-1.0 >= 1.0.16],
  487. [AC_DEFINE([HAVE_LIBUSB_GET_PORT_NUMBERS], [1], [Define if your libusb has libusb_get_port_numbers()])])
  488. ], [
  489. use_libusb1=no
  490. AC_MSG_WARN([libusb-1.x not found, trying legacy libusb-0.1 as a fallback; consider installing libusb-1.x instead])
  491. ])
  492. AC_ARG_WITH([capstone],
  493. AS_HELP_STRING([--with-capstone], [Use Capstone disassembly library (default=auto)])
  494. , [
  495. enable_capstone=$withval
  496. ], [
  497. enable_capstone=auto
  498. ])
  499. AS_IF([test "x$enable_capstone" != xno], [
  500. PKG_CHECK_MODULES([CAPSTONE], [capstone], [
  501. AC_DEFINE([HAVE_CAPSTONE], [1], [1 if you have Capstone disassembly framework.])
  502. ], [
  503. AC_DEFINE([HAVE_CAPSTONE], [0], [0 if you don't have Capstone disassembly framework.])
  504. if test "x$enable_capstone" != xauto; then
  505. AC_MSG_ERROR([--with-capstone was given, but test for Capstone failed])
  506. fi
  507. enable_capstone=no
  508. ])
  509. ])
  510. for hidapi_lib in hidapi hidapi-hidraw hidapi-libusb; do
  511. PKG_CHECK_MODULES([HIDAPI],[$hidapi_lib],[
  512. use_hidapi=yes
  513. break
  514. ],[
  515. use_hidapi=no
  516. ])
  517. done
  518. PKG_CHECK_MODULES([LIBFTDI], [libftdi1], [
  519. use_libftdi=yes
  520. PKG_CHECK_EXISTS([libftdi1 >= 1.5],
  521. [AC_DEFINE([HAVE_LIBFTDI_TCIOFLUSH], [1], [Define if your libftdi has ftdi_tcioflush()])])
  522. ], [
  523. PKG_CHECK_MODULES([LIBFTDI], [libftdi], [use_libftdi=yes], [use_libftdi=no])
  524. ])
  525. PKG_CHECK_MODULES([LIBGPIOD], [libgpiod], [use_libgpiod=yes], [use_libgpiod=no])
  526. PKG_CHECK_MODULES([LIBJAYLINK], [libjaylink >= 0.2],
  527. [use_libjaylink=yes], [use_libjaylink=no])
  528. m4_define([PROCESS_ADAPTERS], [
  529. m4_foreach([adapter], [$1], [
  530. AS_IF([test $2], [
  531. AS_IF([test "x$ADAPTER_VAR([adapter])" != "xno"], [
  532. AC_DEFINE([BUILD_]ADAPTER_SYM([adapter]), [1], [1 if you want the ]ADAPTER_DESC([adapter]).)
  533. ], [
  534. AC_DEFINE([BUILD_]ADAPTER_SYM([adapter]), [0], [0 if you do not want the ]ADAPTER_DESC([adapter]).)
  535. ])
  536. ], [
  537. AS_IF([test "x$ADAPTER_VAR([adapter])" = "xyes"], [
  538. AC_MSG_ERROR([$3 is required for the ADAPTER_DESC([adapter])])
  539. ])
  540. ADAPTER_VAR([adapter])=no
  541. AC_DEFINE([BUILD_]ADAPTER_SYM([adapter]), [0], [0 if you do not want the ]ADAPTER_DESC([adapter]).)
  542. ])
  543. AM_CONDITIONAL(ADAPTER_SYM([adapter]), [test "x$ADAPTER_VAR([adapter])" != "xno"])
  544. ])
  545. ])
  546. PROCESS_ADAPTERS([USB1_ADAPTERS], ["x$use_libusb1" = "xyes"], [libusb-1.x])
  547. PROCESS_ADAPTERS([HIDAPI_ADAPTERS], ["x$use_hidapi" = "xyes"], [hidapi])
  548. PROCESS_ADAPTERS([HIDAPI_USB1_ADAPTERS], ["x$use_hidapi" = "xyes" -a "x$use_libusb1" = "xyes"], [hidapi and libusb-1.x])
  549. PROCESS_ADAPTERS([LIBFTDI_ADAPTERS], ["x$use_libftdi" = "xyes"], [libftdi])
  550. PROCESS_ADAPTERS([LIBFTDI_USB1_ADAPTERS], ["x$use_libftdi" = "xyes" -a "x$use_libusb1" = "xyes"], [libftdi and libusb-1.x])
  551. PROCESS_ADAPTERS([LIBGPIOD_ADAPTERS], ["x$use_libgpiod" = "xyes"], [libgpiod])
  552. PROCESS_ADAPTERS([LIBJAYLINK_ADAPTERS], ["x$use_internal_libjaylink" = "xyes" -o "x$use_libjaylink" = "xyes"], [libjaylink-0.2])
  553. AS_IF([test "x$enable_linuxgpiod" != "xno"], [
  554. build_bitbang=yes
  555. ])
  556. AS_IF([test "x$enable_stlink" != "xno" -o "x$enable_ti_icdi" != "xno" -o "x$enable_nulink" != "xno"], [
  557. AC_DEFINE([BUILD_HLADAPTER], [1], [1 if you want the High Level JTAG driver.])
  558. AM_CONDITIONAL([HLADAPTER], [true])
  559. ], [
  560. AC_DEFINE([BUILD_HLADAPTER], [0], [0 if you want the High Level JTAG driver.])
  561. AM_CONDITIONAL([HLADAPTER], [false])
  562. ])
  563. AM_CONDITIONAL([HLADAPTER_STLINK], [test "x$enable_stlink" != "xno"])
  564. AM_CONDITIONAL([HLADAPTER_ICDI], [test "x$enable_ti_icdi" != "xno"])
  565. AM_CONDITIONAL([HLADAPTER_NULINK], [test "x$enable_nulink" != "xno"])
  566. AS_IF([test "x$enable_jlink" != "xno"], [
  567. AS_IF([test "x$use_internal_libjaylink" = "xyes"], [
  568. AS_IF([test -f "$srcdir/src/jtag/drivers/libjaylink/configure.ac"], [
  569. AX_CONFIG_SUBDIR_OPTION([src/jtag/drivers/libjaylink],
  570. [--enable-subproject-build])
  571. ], [
  572. AC_MSG_ERROR([Internal libjaylink not found, run either 'git submodule init' and 'git submodule update' or disable internal libjaylink with --disable-internal-libjaylink.])
  573. ])
  574. ])
  575. ])
  576. # Presto needs the bitq module
  577. AS_IF([test "x$enable_presto" != "xno"], [
  578. build_bitq=yes
  579. ])
  580. AM_CONDITIONAL([RELEASE], [test "x$build_release" = "xyes"])
  581. AM_CONDITIONAL([PARPORT], [test "x$build_parport" = "xyes"])
  582. AM_CONDITIONAL([DUMMY], [test "x$build_dummy" = "xyes"])
  583. AM_CONDITIONAL([GIVEIO], [test "x$parport_use_giveio" = "xyes"])
  584. AM_CONDITIONAL([EP93XX], [test "x$build_ep93xx" = "xyes"])
  585. AM_CONDITIONAL([AT91RM9200], [test "x$build_at91rm9200" = "xyes"])
  586. AM_CONDITIONAL([BCM2835GPIO], [test "x$build_bcm2835gpio" = "xyes"])
  587. AM_CONDITIONAL([IMX_GPIO], [test "x$build_imx_gpio" = "xyes"])
  588. AM_CONDITIONAL([BITBANG], [test "x$build_bitbang" = "xyes"])
  589. AM_CONDITIONAL([JTAG_VPI], [test "x$build_jtag_vpi" = "xyes" -o "x$build_jtag_vpi" = "xyes"])
  590. AM_CONDITIONAL([JTAG_DPI], [test "x$build_jtag_dpi" = "xyes" -o "x$build_jtag_dpi" = "xyes"])
  591. AM_CONDITIONAL([USB_BLASTER_DRIVER], [test "x$enable_usb_blaster" != "xno" -o "x$enable_usb_blaster_2" != "xno"])
  592. AM_CONDITIONAL([AMTJTAGACCEL], [test "x$build_amtjtagaccel" = "xyes"])
  593. AM_CONDITIONAL([GW16012], [test "x$build_gw16012" = "xyes"])
  594. AM_CONDITIONAL([REMOTE_BITBANG], [test "x$build_remote_bitbang" = "xyes"])
  595. AM_CONDITIONAL([BUSPIRATE], [test "x$enable_buspirate" != "xno"])
  596. AM_CONDITIONAL([SYSFSGPIO], [test "x$build_sysfsgpio" = "xyes"])
  597. AM_CONDITIONAL([XLNX_PCIE_XVC], [test "x$build_xlnx_pcie_xvc" = "xyes"])
  598. AM_CONDITIONAL([USE_LIBUSB1], [test "x$use_libusb1" = "xyes"])
  599. AM_CONDITIONAL([IS_CYGWIN], [test "x$is_cygwin" = "xyes"])
  600. AM_CONDITIONAL([IS_MINGW], [test "x$is_mingw" = "xyes"])
  601. AM_CONDITIONAL([IS_WIN32], [test "x$is_win32" = "xyes"])
  602. AM_CONDITIONAL([IS_DARWIN], [test "x$is_darwin" = "xyes"])
  603. AM_CONDITIONAL([BITQ], [test "x$build_bitq" = "xyes"])
  604. AM_CONDITIONAL([USE_LIBFTDI], [test "x$use_libftdi" = "xyes"])
  605. AM_CONDITIONAL([USE_LIBGPIOD], [test "x$use_libgpiod" = "xyes"])
  606. AM_CONDITIONAL([USE_HIDAPI], [test "x$use_hidapi" = "xyes"])
  607. AM_CONDITIONAL([USE_LIBJAYLINK], [test "x$use_libjaylink" = "xyes"])
  608. AM_CONDITIONAL([RSHIM], [test "x$build_rshim" = "xyes"])
  609. AM_CONDITIONAL([HAVE_CAPSTONE], [test "x$enable_capstone" != "xno"])
  610. AM_CONDITIONAL([INTERNAL_JIMTCL], [test "x$use_internal_jimtcl" = "xyes"])
  611. AM_CONDITIONAL([INTERNAL_LIBJAYLINK], [test "x$use_internal_libjaylink" = "xyes"])
  612. # Look for environ alternatives. Possibility #1: is environ in unistd.h or stdlib.h?
  613. AC_MSG_CHECKING([for environ in unistd.h and stdlib.h])
  614. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  615. #define _GNU_SOURCE
  616. #include <unistd.h>
  617. #include <stdlib.h>
  618. ]], [[char **ep = environ;]]
  619. )], [
  620. AC_MSG_RESULT([yes])
  621. has_environ=yes
  622. ], [
  623. AC_MSG_RESULT([no])
  624. # Possibility #2: can environ be found in an available library?
  625. AC_MSG_CHECKING([for extern environ])
  626. AC_LINK_IFELSE([AC_LANG_PROGRAM([[
  627. extern char **environ;
  628. ]], [[char **ep = environ;]]
  629. )], [
  630. AC_DEFINE(NEED_ENVIRON_EXTERN, [1], [Must declare 'environ' to use it.])
  631. has_environ=yes
  632. ], [
  633. has_environ=no
  634. ])
  635. AC_MSG_RESULT([${has_environ}])
  636. ])
  637. AS_IF([test "x${has_environ}" != "xyes" ], [
  638. AC_MSG_FAILURE([Could not find 'environ' in unistd.h or available libraries.])
  639. ])
  640. AC_DEFINE([_GNU_SOURCE],[1],[Use GNU C library extensions (e.g. stdndup).])
  641. # set default gcc warnings
  642. GCC_WARNINGS="-Wall -Wstrict-prototypes -Wformat-security -Wshadow"
  643. AS_IF([test "x${gcc_wextra}" = "xyes"], [
  644. GCC_WARNINGS="${GCC_WARNINGS} -Wextra -Wno-unused-parameter"
  645. GCC_WARNINGS="${GCC_WARNINGS} -Wbad-function-cast"
  646. GCC_WARNINGS="${GCC_WARNINGS} -Wcast-align"
  647. GCC_WARNINGS="${GCC_WARNINGS} -Wredundant-decls"
  648. GCC_WARNINGS="${GCC_WARNINGS} -Wpointer-arith"
  649. GCC_WARNINGS="${GCC_WARNINGS} -Wundef"
  650. GCC_WARNINGS="${GCC_WARNINGS} -Wno-error=deprecated-declarations"
  651. ])
  652. AS_IF([test "x${gcc_werror}" = "xyes"], [
  653. GCC_WARNINGS="${GCC_WARNINGS} -Werror"
  654. ])
  655. # override default gcc cflags
  656. AS_IF([test "x$gcc_warnings" = "xyes"], [
  657. AC_SUBST([GCC_WARNINGS], [$GCC_WARNINGS])
  658. ])
  659. AC_SUBST(EXTRA_DIST_NEWS, ["$(echo $srcdir/NEWS-*)"])
  660. AC_CONFIG_FILES([
  661. Makefile
  662. ])
  663. AC_OUTPUT
  664. echo
  665. echo
  666. echo OpenOCD configuration summary
  667. echo --------------------------------------------------
  668. m4_foreach([adapter], [USB1_ADAPTERS,
  669. HIDAPI_ADAPTERS, HIDAPI_USB1_ADAPTERS, LIBFTDI_ADAPTERS,
  670. LIBFTDI_USB1_ADAPTERS,
  671. LIBGPIOD_ADAPTERS,
  672. LIBJAYLINK_ADAPTERS, PCIE_ADAPTERS, SERIAL_PORT_ADAPTERS,
  673. OPTIONAL_LIBRARIES],
  674. [s=m4_format(["%-40s"], ADAPTER_DESC([adapter]))
  675. AS_CASE([$ADAPTER_VAR([adapter])],
  676. [auto], [
  677. echo "$s"yes '(auto)'
  678. ],
  679. [yes], [
  680. echo "$s"yes
  681. ],
  682. [no], [
  683. echo "$s"no
  684. ])
  685. ])
  686. echo