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.
 
 
 
 
 
 

798 lines
26 KiB

  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([.])
  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. AH_BOTTOM([
  17. #include <helper/system.h>
  18. #include <helper/types.h>
  19. #include <helper/replacements.h>
  20. ])
  21. AC_LANG([C])
  22. AC_PROG_CC
  23. # autoconf 2.70 obsoletes AC_PROG_CC_C99 and includes it in AC_PROG_CC
  24. m4_version_prereq([2.70],[],[AC_PROG_CC_C99])
  25. AM_PROG_CC_C_O
  26. AC_PROG_RANLIB
  27. PKG_PROG_PKG_CONFIG([0.23])
  28. dnl disable checks for C++, Fortran and GNU Java Compiler
  29. m4_defun([_LT_AC_LANG_CXX_CONFIG], [:])
  30. m4_defun([_LT_AC_LANG_F77_CONFIG], [:])
  31. m4_defun([_LT_AC_LANG_GCJ_CONFIG], [:])
  32. AC_DISABLE_SHARED
  33. LT_INIT
  34. AC_SUBST([LIBTOOL_DEPS])
  35. dnl configure checks required for Jim files (these are obsolete w/ C99)
  36. AC_C_CONST
  37. AC_TYPE_LONG_LONG_INT
  38. AC_SEARCH_LIBS([ioperm], [ioperm])
  39. AC_SEARCH_LIBS([dlopen], [dl])
  40. AC_SEARCH_LIBS([openpty], [util])
  41. AC_CHECK_HEADERS([sys/socket.h])
  42. AC_CHECK_HEADERS([elf.h])
  43. AC_CHECK_HEADERS([dirent.h])
  44. AC_CHECK_HEADERS([fcntl.h])
  45. AC_CHECK_HEADERS([malloc.h])
  46. AC_CHECK_HEADERS([netdb.h])
  47. AC_CHECK_HEADERS([poll.h])
  48. AC_CHECK_HEADERS([pthread.h])
  49. AC_CHECK_HEADERS([strings.h])
  50. AC_CHECK_HEADERS([sys/ioctl.h])
  51. AC_CHECK_HEADERS([sys/param.h])
  52. AC_CHECK_HEADERS([sys/select.h])
  53. AC_CHECK_HEADERS([sys/stat.h])
  54. AC_CHECK_HEADERS([sys/sysctl.h])
  55. AC_CHECK_HEADERS([sys/time.h])
  56. AC_CHECK_HEADERS([sys/types.h])
  57. AC_CHECK_HEADERS([unistd.h])
  58. AC_CHECK_HEADERS([arpa/inet.h ifaddrs.h netinet/in.h netinet/tcp.h net/if.h], [], [], [dnl
  59. #include <stdio.h>
  60. #ifdef STDC_HEADERS
  61. # include <stdlib.h>
  62. # include <stddef.h>
  63. #else
  64. # ifdef HAVE_STDLIB_H
  65. # include <stdlib.h>
  66. # endif
  67. #endif
  68. #ifdef HAVE_SYS_SOCKET_H
  69. # include <sys/socket.h>
  70. #endif
  71. ])
  72. AC_HEADER_ASSERT
  73. AC_HEADER_STDBOOL
  74. AC_C_BIGENDIAN
  75. AC_CHECK_FUNCS([strndup])
  76. AC_CHECK_FUNCS([strnlen])
  77. AC_CHECK_FUNCS([gettimeofday])
  78. AC_CHECK_FUNCS([usleep])
  79. AC_CHECK_FUNCS([vasprintf])
  80. AC_CHECK_FUNCS([realpath])
  81. # guess-rev.sh only exists in the repository, not in the released archives
  82. AC_MSG_CHECKING([whether to build a release])
  83. AS_IF([test -x "$srcdir/guess-rev.sh"], [
  84. build_release=no
  85. ], [
  86. build_release=yes
  87. ])
  88. AC_MSG_RESULT([$build_release])
  89. # Adapter drivers
  90. # 1st column -- configure option
  91. # 2nd column -- description
  92. # 3rd column -- symbol used for both config.h and automake
  93. m4_define([ADAPTER_ARG], [m4_argn([1], $1)])
  94. m4_define([ADAPTER_DESC], [m4_argn([2], $1)])
  95. m4_define([ADAPTER_SYM], [m4_argn([3], $1)])
  96. m4_define([ADAPTER_VAR], [enable_[]ADAPTER_ARG($1)])
  97. m4_define([ADAPTER_OPT], [m4_translit(ADAPTER_ARG($1), [_], [-])])
  98. m4_define([USB1_ADAPTERS],
  99. [[[ftdi], [MPSSE mode of FTDI based devices], [FTDI]],
  100. [[stlink], [ST-Link Programmer], [HLADAPTER_STLINK]],
  101. [[ti_icdi], [TI ICDI JTAG Programmer], [HLADAPTER_ICDI]],
  102. [[ulink], [Keil ULINK JTAG Programmer], [ULINK]],
  103. [[usb_blaster_2], [Altera USB-Blaster II Compatible], [USB_BLASTER_2]],
  104. [[ft232r], [Bitbang mode of FT232R based devices], [FT232R]],
  105. [[vsllink], [Versaloon-Link JTAG Programmer], [VSLLINK]],
  106. [[xds110], [TI XDS110 Debug Probe], [XDS110]],
  107. [[cmsis_dap_v2], [CMSIS-DAP v2 Compliant Debugger], [CMSIS_DAP_USB]],
  108. [[osbdm], [OSBDM (JTAG only) Programmer], [OSBDM]],
  109. [[opendous], [eStick/opendous JTAG Programmer], [OPENDOUS]],
  110. [[armjtagew], [Olimex ARM-JTAG-EW Programmer], [ARMJTAGEW]],
  111. [[rlink], [Raisonance RLink JTAG Programmer], [RLINK]],
  112. [[usbprog], [USBProg JTAG Programmer], [USBPROG]],
  113. [[aice], [Andes JTAG Programmer], [AICE]]])
  114. m4_define([HIDAPI_ADAPTERS],
  115. [[[cmsis_dap], [CMSIS-DAP Compliant Debugger], [CMSIS_DAP_HID]],
  116. [[nulink], [Nu-Link Programmer], [HLADAPTER_NULINK]]])
  117. m4_define([HIDAPI_USB1_ADAPTERS],
  118. [[[kitprog], [Cypress KitProg Programmer], [KITPROG]]])
  119. m4_define([LIBFTDI_ADAPTERS],
  120. [[[usb_blaster], [Altera USB-Blaster Compatible], [USB_BLASTER]],
  121. [[presto], [ASIX Presto Adapter], [PRESTO]]])
  122. m4_define([LIBFTDI_USB1_ADAPTERS],
  123. [[[openjtag], [OpenJTAG Adapter], [OPENJTAG]]])
  124. m4_define([LIBGPIOD_ADAPTERS],
  125. [[[linuxgpiod], [Linux GPIO bitbang through libgpiod], [LINUXGPIOD]]])
  126. m4_define([LIBJAYLINK_ADAPTERS],
  127. [[[jlink], [SEGGER J-Link Programmer], [JLINK]]])
  128. m4_define([PCIE_ADAPTERS],
  129. [[[xlnx_pcie_xvc], [Xilinx XVC/PCIe], [XLNX_PCIE_XVC]]])
  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. LIBJAYLINK_ADAPTERS
  215. ],[auto])
  216. AC_ARG_ENABLE([parport],
  217. AS_HELP_STRING([--enable-parport], [Enable building the pc parallel port driver]),
  218. [build_parport=$enableval], [build_parport=no])
  219. AC_ARG_ENABLE([parport_ppdev],
  220. AS_HELP_STRING([--disable-parport-ppdev],
  221. [Disable use of ppdev (/dev/parportN) for parport (for x86 only)]),
  222. [parport_use_ppdev=$enableval], [parport_use_ppdev=yes])
  223. AC_ARG_ENABLE([parport_giveio],
  224. AS_HELP_STRING([--enable-parport-giveio],
  225. [Enable use of giveio for parport (for CygWin only)]),
  226. [parport_use_giveio=$enableval], [parport_use_giveio=])
  227. AC_ARG_ENABLE([jtag_vpi],
  228. AS_HELP_STRING([--enable-jtag_vpi], [Enable building support for JTAG VPI]),
  229. [build_jtag_vpi=$enableval], [build_jtag_vpi=no])
  230. AC_ARG_ENABLE([jtag_dpi],
  231. AS_HELP_STRING([--enable-jtag_dpi], [Enable building support for JTAG DPI]),
  232. [build_jtag_dpi=$enableval], [build_jtag_dpi=no])
  233. AC_ARG_ENABLE([amtjtagaccel],
  234. AS_HELP_STRING([--enable-amtjtagaccel], [Enable building the Amontec JTAG-Accelerator driver]),
  235. [build_amtjtagaccel=$enableval], [build_amtjtagaccel=no])
  236. AS_CASE(["${host_cpu}"],
  237. [arm*|aarch64], [
  238. AC_ARG_ENABLE([bcm2835gpio],
  239. AS_HELP_STRING([--enable-bcm2835gpio], [Enable building support for bitbanging on BCM2835 (as found in Raspberry Pi)]),
  240. [build_bcm2835gpio=$enableval], [build_bcm2835gpio=no])
  241. AC_ARG_ENABLE([imx_gpio],
  242. AS_HELP_STRING([--enable-imx_gpio], [Enable building support for bitbanging on NXP IMX processors]),
  243. [build_imx_gpio=$enableval], [build_imx_gpio=no])
  244. ],
  245. [
  246. build_bcm2835gpio=no
  247. build_imx_gpio=no
  248. ])
  249. AS_CASE(["${host_cpu}"],
  250. [arm*], [
  251. AC_ARG_ENABLE([ep93xx],
  252. AS_HELP_STRING([--enable-ep93xx], [Enable building support for EP93xx based SBCs]),
  253. [build_ep93xx=$enableval], [build_ep93xx=no])
  254. AC_ARG_ENABLE([at91rm9200],
  255. AS_HELP_STRING([--enable-at91rm9200], [Enable building support for AT91RM9200 based SBCs]),
  256. [build_at91rm9200=$enableval], [build_at91rm9200=no])
  257. ],
  258. [
  259. build_ep93xx=no
  260. build_at91rm9200=no
  261. ])
  262. AC_ARG_ENABLE([gw16012],
  263. AS_HELP_STRING([--enable-gw16012], [Enable building support for the Gateworks GW16012 JTAG Programmer]),
  264. [build_gw16012=$enableval], [build_gw16012=no])
  265. AC_ARG_ENABLE([buspirate],
  266. AS_HELP_STRING([--enable-buspirate], [Enable building support for the Buspirate]),
  267. [build_buspirate=$enableval], [build_buspirate=no])
  268. AC_ARG_ENABLE([sysfsgpio],
  269. AS_HELP_STRING([--enable-sysfsgpio], [Enable building support for programming driven via sysfs gpios.]),
  270. [build_sysfsgpio=$enableval], [build_sysfsgpio=no])
  271. AC_ARG_ENABLE([xlnx_pcie_xvc],
  272. AS_HELP_STRING([--enable-xlnx-pcie-xvc], [Enable building support for Xilinx XVC/PCIe.]),
  273. [build_xlnx_pcie_xvc=$enableval], [build_xlnx_pcie_xvc=no])
  274. AS_CASE([$host_os],
  275. [linux*], [],
  276. [
  277. AS_IF([test "x$build_sysfsgpio" = "xyes"], [
  278. AC_MSG_ERROR([sysfsgpio is only available on linux])
  279. ])
  280. AS_IF([test "x$enable_linuxgpiod" = "xyes"], [
  281. AC_MSG_ERROR([linuxgpiod is only available on linux])
  282. ])
  283. AS_IF([test "x$build_xlnx_pcie_xvc" = "xyes"], [
  284. AC_MSG_ERROR([xlnx_pcie_xvc is only available on linux])
  285. ])
  286. AS_CASE([$host_os], [freebsd*], [],
  287. [
  288. AS_IF([test "x$build_rshim" = "xyes"], [
  289. AC_MSG_ERROR([build_rshim is only available on linux or freebsd])
  290. ])
  291. ])
  292. ])
  293. AC_ARG_ENABLE([internal-jimtcl],
  294. AS_HELP_STRING([--disable-internal-jimtcl], [Disable building internal jimtcl]),
  295. [use_internal_jimtcl=$enableval], [use_internal_jimtcl=yes])
  296. AC_ARG_ENABLE([internal-libjaylink],
  297. AS_HELP_STRING([--disable-internal-libjaylink],
  298. [Disable building internal libjaylink]),
  299. [use_internal_libjaylink=$enableval], [use_internal_libjaylink=yes])
  300. AC_ARG_ENABLE([remote-bitbang],
  301. AS_HELP_STRING([--enable-remote-bitbang], [Enable building support for the Remote Bitbang jtag driver]),
  302. [build_remote_bitbang=$enableval], [build_remote_bitbang=no])
  303. AS_CASE(["${host_cpu}"],
  304. [i?86|x86*], [],
  305. [
  306. AS_IF([test "x$parport_use_ppdev" = "xno"], [
  307. AC_MSG_WARN([--disable-parport-ppdev is not supported by the host CPU])
  308. ])
  309. parport_use_ppdev=yes
  310. ])
  311. AS_CASE([$host],
  312. [*-cygwin*], [
  313. is_win32=yes
  314. parport_use_ppdev=no
  315. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[return __MINGW32__;]])],
  316. [is_mingw=yes],[is_mingw=no])
  317. AS_IF([test "x$is_mingw" = "xyes"], [
  318. AS_IF([test "x$parport_use_giveio" = "xno"], [
  319. AC_MSG_WARN([--disable-parport-giveio is not supported by MinGW32 hosts])
  320. ])
  321. parport_use_giveio=yes
  322. is_cygwin=no
  323. ], [
  324. is_cygwin=yes
  325. # sys/io.h needed under cygwin for parport access
  326. AS_IF([test "x$build_parport" = "xyes"], [
  327. AC_CHECK_HEADERS([sys/io.h],[],AC_MSG_ERROR([Please install the cygwin ioperm package]))
  328. ])
  329. ])
  330. ],
  331. [*-mingw* | *-msys*], [
  332. is_mingw=yes
  333. is_win32=yes
  334. parport_use_ppdev=no
  335. AS_IF([test "x$parport_use_giveio" = "xno"], [
  336. AC_MSG_WARN([--disable-parport-giveio is not supported by MinGW32 hosts])
  337. ])
  338. parport_use_giveio=yes
  339. AS_IF([test "x$build_buspirate" = "xyes"], [
  340. AC_MSG_ERROR([buspirate currently not supported by MinGW32 hosts])
  341. ])
  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$build_buspirate" = "xyes"], [
  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. ])
  542. AM_CONDITIONAL(ADAPTER_SYM([adapter]), [test "x$ADAPTER_VAR([adapter])" != "xno"])
  543. ])
  544. ])
  545. PROCESS_ADAPTERS([USB1_ADAPTERS], ["x$use_libusb1" = "xyes"], [libusb-1.x])
  546. PROCESS_ADAPTERS([HIDAPI_ADAPTERS], ["x$use_hidapi" = "xyes"], [hidapi])
  547. PROCESS_ADAPTERS([HIDAPI_USB1_ADAPTERS], ["x$use_hidapi" = "xyes" -a "x$use_libusb1" = "xyes"], [hidapi and libusb-1.x])
  548. PROCESS_ADAPTERS([LIBFTDI_ADAPTERS], ["x$use_libftdi" = "xyes"], [libftdi])
  549. PROCESS_ADAPTERS([LIBFTDI_USB1_ADAPTERS], ["x$use_libftdi" = "xyes" -a "x$use_libusb1" = "xyes"], [libftdi and libusb-1.x])
  550. PROCESS_ADAPTERS([LIBGPIOD_ADAPTERS], ["x$use_libgpiod" = "xyes"], [libgpiod])
  551. PROCESS_ADAPTERS([LIBJAYLINK_ADAPTERS], ["x$use_internal_libjaylink" = "xyes" -o "x$use_libjaylink" = "xyes"], [libjaylink-0.2])
  552. AS_IF([test "x$enable_linuxgpiod" != "xno"], [
  553. build_bitbang=yes
  554. ])
  555. AS_IF([test "x$enable_stlink" != "xno" -o "x$enable_ti_icdi" != "xno" -o "x$enable_nulink" != "xno"], [
  556. AC_DEFINE([BUILD_HLADAPTER], [1], [1 if you want the High Level JTAG driver.])
  557. AM_CONDITIONAL([HLADAPTER], [true])
  558. ], [
  559. AC_DEFINE([BUILD_HLADAPTER], [0], [0 if you want the High Level JTAG driver.])
  560. AM_CONDITIONAL([HLADAPTER], [false])
  561. ])
  562. AM_CONDITIONAL([HLADAPTER_STLINK], [test "x$enable_stlink" != "xno"])
  563. AM_CONDITIONAL([HLADAPTER_ICDI], [test "x$enable_ti_icdi" != "xno"])
  564. AM_CONDITIONAL([HLADAPTER_NULINK], [test "x$enable_nulink" != "xno"])
  565. AS_IF([test "x$enable_jlink" != "xno"], [
  566. AS_IF([test "x$use_internal_libjaylink" = "xyes"], [
  567. AS_IF([test -f "$srcdir/src/jtag/drivers/libjaylink/configure.ac"], [
  568. AX_CONFIG_SUBDIR_OPTION([src/jtag/drivers/libjaylink],
  569. [--enable-subproject-build])
  570. ], [
  571. AC_MSG_ERROR([Internal libjaylink not found, run either 'git submodule init' and 'git submodule update' or disable internal libjaylink with --disable-internal-libjaylink.])
  572. ])
  573. ])
  574. ])
  575. # Presto needs the bitq module
  576. AS_IF([test "x$enable_presto" != "xno"], [
  577. build_bitq=yes
  578. ])
  579. AM_CONDITIONAL([RELEASE], [test "x$build_release" = "xyes"])
  580. AM_CONDITIONAL([PARPORT], [test "x$build_parport" = "xyes"])
  581. AM_CONDITIONAL([DUMMY], [test "x$build_dummy" = "xyes"])
  582. AM_CONDITIONAL([GIVEIO], [test "x$parport_use_giveio" = "xyes"])
  583. AM_CONDITIONAL([EP93XX], [test "x$build_ep93xx" = "xyes"])
  584. AM_CONDITIONAL([AT91RM9200], [test "x$build_at91rm9200" = "xyes"])
  585. AM_CONDITIONAL([BCM2835GPIO], [test "x$build_bcm2835gpio" = "xyes"])
  586. AM_CONDITIONAL([IMX_GPIO], [test "x$build_imx_gpio" = "xyes"])
  587. AM_CONDITIONAL([BITBANG], [test "x$build_bitbang" = "xyes"])
  588. AM_CONDITIONAL([JTAG_VPI], [test "x$build_jtag_vpi" = "xyes" -o "x$build_jtag_vpi" = "xyes"])
  589. AM_CONDITIONAL([JTAG_DPI], [test "x$build_jtag_dpi" = "xyes" -o "x$build_jtag_dpi" = "xyes"])
  590. AM_CONDITIONAL([USB_BLASTER_DRIVER], [test "x$enable_usb_blaster" != "xno" -o "x$enable_usb_blaster_2" != "xno"])
  591. AM_CONDITIONAL([AMTJTAGACCEL], [test "x$build_amtjtagaccel" = "xyes"])
  592. AM_CONDITIONAL([GW16012], [test "x$build_gw16012" = "xyes"])
  593. AM_CONDITIONAL([REMOTE_BITBANG], [test "x$build_remote_bitbang" = "xyes"])
  594. AM_CONDITIONAL([BUSPIRATE], [test "x$build_buspirate" = "xyes"])
  595. AM_CONDITIONAL([SYSFSGPIO], [test "x$build_sysfsgpio" = "xyes"])
  596. AM_CONDITIONAL([XLNX_PCIE_XVC], [test "x$build_xlnx_pcie_xvc" = "xyes"])
  597. AM_CONDITIONAL([USE_LIBUSB1], [test "x$use_libusb1" = "xyes"])
  598. AM_CONDITIONAL([IS_CYGWIN], [test "x$is_cygwin" = "xyes"])
  599. AM_CONDITIONAL([IS_MINGW], [test "x$is_mingw" = "xyes"])
  600. AM_CONDITIONAL([IS_WIN32], [test "x$is_win32" = "xyes"])
  601. AM_CONDITIONAL([IS_DARWIN], [test "x$is_darwin" = "xyes"])
  602. AM_CONDITIONAL([BITQ], [test "x$build_bitq" = "xyes"])
  603. AM_CONDITIONAL([USE_LIBFTDI], [test "x$use_libftdi" = "xyes"])
  604. AM_CONDITIONAL([USE_LIBGPIOD], [test "x$use_libgpiod" = "xyes"])
  605. AM_CONDITIONAL([USE_HIDAPI], [test "x$use_hidapi" = "xyes"])
  606. AM_CONDITIONAL([USE_LIBJAYLINK], [test "x$use_libjaylink" = "xyes"])
  607. AM_CONDITIONAL([RSHIM], [test "x$build_rshim" = "xyes"])
  608. AM_CONDITIONAL([HAVE_CAPSTONE], [test "x$enable_capstone" != "xno"])
  609. AM_CONDITIONAL([INTERNAL_JIMTCL], [test "x$use_internal_jimtcl" = "xyes"])
  610. AM_CONDITIONAL([INTERNAL_LIBJAYLINK], [test "x$use_internal_libjaylink" = "xyes"])
  611. # Look for environ alternatives. Possibility #1: is environ in unistd.h or stdlib.h?
  612. AC_MSG_CHECKING([for environ in unistd.h and stdlib.h])
  613. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  614. #define _GNU_SOURCE
  615. #include <unistd.h>
  616. #include <stdlib.h>
  617. ]], [[char **ep = environ;]]
  618. )], [
  619. AC_MSG_RESULT([yes])
  620. has_environ=yes
  621. ], [
  622. AC_MSG_RESULT([no])
  623. # Possibility #2: can environ be found in an available library?
  624. AC_MSG_CHECKING([for extern environ])
  625. AC_LINK_IFELSE([AC_LANG_PROGRAM([[
  626. extern char **environ;
  627. ]], [[char **ep = environ;]]
  628. )], [
  629. AC_DEFINE(NEED_ENVIRON_EXTERN, [1], [Must declare 'environ' to use it.])
  630. has_environ=yes
  631. ], [
  632. has_environ=no
  633. ])
  634. AC_MSG_RESULT([${has_environ}])
  635. ])
  636. AS_IF([test "x${has_environ}" != "xyes" ], [
  637. AC_MSG_FAILURE([Could not find 'environ' in unistd.h or available libraries.])
  638. ])
  639. AC_DEFINE([_GNU_SOURCE],[1],[Use GNU C library extensions (e.g. stdndup).])
  640. # set default gcc warnings
  641. GCC_WARNINGS="-Wall -Wstrict-prototypes -Wformat-security -Wshadow"
  642. AS_IF([test "x${gcc_wextra}" = "xyes"], [
  643. GCC_WARNINGS="${GCC_WARNINGS} -Wextra -Wno-unused-parameter"
  644. GCC_WARNINGS="${GCC_WARNINGS} -Wbad-function-cast"
  645. GCC_WARNINGS="${GCC_WARNINGS} -Wcast-align"
  646. GCC_WARNINGS="${GCC_WARNINGS} -Wredundant-decls"
  647. GCC_WARNINGS="${GCC_WARNINGS} -Wpointer-arith"
  648. ])
  649. AS_IF([test "x${gcc_werror}" = "xyes"], [
  650. GCC_WARNINGS="${GCC_WARNINGS} -Werror"
  651. ])
  652. # override default gcc cflags
  653. AS_IF([test "x$gcc_warnings" = "xyes"], [
  654. AC_SUBST([GCC_WARNINGS], [$GCC_WARNINGS])
  655. ])
  656. AC_SUBST(EXTRA_DIST_NEWS, ["$(echo $srcdir/NEWS-*)"])
  657. AC_CONFIG_FILES([
  658. Makefile
  659. ])
  660. AC_OUTPUT
  661. echo
  662. echo
  663. echo OpenOCD configuration summary
  664. echo --------------------------------------------------
  665. m4_foreach([adapter], [USB1_ADAPTERS,
  666. HIDAPI_ADAPTERS, HIDAPI_USB1_ADAPTERS, LIBFTDI_ADAPTERS,
  667. LIBFTDI_USB1_ADAPTERS,
  668. LIBGPIOD_ADAPTERS,
  669. LIBJAYLINK_ADAPTERS, PCIE_ADAPTERS,
  670. OPTIONAL_LIBRARIES],
  671. [s=m4_format(["%-40s"], ADAPTER_DESC([adapter]))
  672. AS_CASE([$ADAPTER_VAR([adapter])],
  673. [auto], [
  674. echo "$s"yes '(auto)'
  675. ],
  676. [yes], [
  677. echo "$s"yes
  678. ],
  679. [no], [
  680. echo "$s"no
  681. ])
  682. ])
  683. echo