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.

837 lines
28KB

  1. AC_PREREQ(2.64)
  2. AC_INIT([openocd], [0.10.0+dev],
  3. [OpenOCD Mailing List <openocd-devel@lists.sourceforge.net>])
  4. AC_CONFIG_SRCDIR([src/openocd.c])
  5. m4_include([config_subdir.m4])dnl
  6. # check for makeinfo before calling AM_INIT_AUTOMAKE
  7. AC_CHECK_PROG([MAKEINFO], [makeinfo], [makeinfo])
  8. AS_IF([test "x$MAKEINFO" = "x"], [
  9. MAKEINFO='echo makeinfo missing; true'
  10. AC_MSG_WARN([Info documentation will not be built.])
  11. ])
  12. AC_SUBST([MAKEINFO])
  13. AM_INIT_AUTOMAKE([-Wall -Wno-portability dist-bzip2 dist-zip subdir-objects])
  14. AC_CONFIG_HEADERS([config.h])
  15. AH_BOTTOM([
  16. #include <helper/system.h>
  17. #include <helper/types.h>
  18. #include <helper/replacements.h>
  19. ])
  20. AC_LANG_C
  21. AC_PROG_CC
  22. AC_PROG_CC_C99
  23. AM_PROG_CC_C_O
  24. AC_PROG_RANLIB
  25. PKG_PROG_PKG_CONFIG([0.23])
  26. dnl disable checks for C++, Fortran and GNU Java Compiler
  27. m4_defun([_LT_AC_LANG_CXX_CONFIG], [:])
  28. m4_defun([_LT_AC_LANG_F77_CONFIG], [:])
  29. m4_defun([_LT_AC_LANG_GCJ_CONFIG], [:])
  30. AC_DISABLE_SHARED
  31. AC_PROG_LIBTOOL
  32. AC_SUBST([LIBTOOL_DEPS])
  33. dnl configure checks required for Jim files (these are obsolete w/ C99)
  34. AC_C_CONST
  35. AC_TYPE_LONG_LONG_INT
  36. AC_SEARCH_LIBS([ioperm], [ioperm])
  37. AC_SEARCH_LIBS([dlopen], [dl])
  38. AC_CHECK_HEADERS([sys/socket.h])
  39. AC_CHECK_HEADERS([elf.h])
  40. AC_CHECK_HEADERS([dirent.h])
  41. AC_CHECK_HEADERS([fcntl.h])
  42. AC_CHECK_HEADERS([malloc.h])
  43. AC_CHECK_HEADERS([netdb.h])
  44. AC_CHECK_HEADERS([poll.h])
  45. AC_CHECK_HEADERS([pthread.h])
  46. AC_CHECK_HEADERS([strings.h])
  47. AC_CHECK_HEADERS([sys/ioctl.h])
  48. AC_CHECK_HEADERS([sys/param.h])
  49. AC_CHECK_HEADERS([sys/select.h])
  50. AC_CHECK_HEADERS([sys/stat.h])
  51. AC_CHECK_HEADERS([sys/sysctl.h])
  52. AC_CHECK_HEADERS([sys/time.h])
  53. AC_CHECK_HEADERS([sys/types.h])
  54. AC_CHECK_HEADERS([unistd.h])
  55. AC_CHECK_HEADERS([arpa/inet.h ifaddrs.h netinet/in.h netinet/tcp.h net/if.h], [], [], [dnl
  56. #include <stdio.h>
  57. #ifdef STDC_HEADERS
  58. # include <stdlib.h>
  59. # include <stddef.h>
  60. #else
  61. # ifdef HAVE_STDLIB_H
  62. # include <stdlib.h>
  63. # endif
  64. #endif
  65. #ifdef HAVE_SYS_SOCKET_H
  66. # include <sys/socket.h>
  67. #endif
  68. ])
  69. AC_HEADER_ASSERT
  70. AC_HEADER_STDBOOL
  71. AC_HEADER_TIME
  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. m4_define([USB_ADAPTERS],
  106. [[[osbdm], [OSBDM (JTAG only) Programmer], [OSBDM]],
  107. [[opendous], [eStick/opendous JTAG Programmer], [OPENDOUS]],
  108. [[aice], [Andes JTAG Programmer], [AICE]]])
  109. m4_define([USB0_ADAPTERS],
  110. [[[usbprog], [USBProg JTAG Programmer], [USBPROG]],
  111. [[rlink], [Raisonance RLink JTAG Programmer], [RLINK]],
  112. [[armjtagew], [Olimex ARM-JTAG-EW Programmer], [ARMJTAGEW]]])
  113. m4_define([HIDAPI_ADAPTERS],
  114. [[[cmsis_dap], [CMSIS-DAP Compliant Debugger], [CMSIS_DAP]]])
  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. [[openjtag], [OpenJTAG Adapter], [OPENJTAG]]])
  121. m4_define([LIBJAYLINK_ADAPTERS],
  122. [[[jlink], [SEGGER J-Link Programmer], [JLINK]]])
  123. m4_define([PCIE_ADAPTERS],
  124. [[[xlnx_pcie_xvc], [Xilinx XVC/PCIe], [XLNX_PCIE_XVC]]])
  125. AC_ARG_ENABLE([doxygen-html],
  126. AS_HELP_STRING([--disable-doxygen-html],
  127. [Disable building Doxygen manual as HTML.]),
  128. [doxygen_as_html=$enableval], [doxygen_as_html=yes])
  129. AC_SUBST([doxygen_as_html])
  130. AC_MSG_CHECKING([whether to build Doxygen as HTML])
  131. AC_MSG_RESULT([$doxygen_as_html])
  132. AC_ARG_ENABLE([doxygen-pdf],
  133. AS_HELP_STRING([--enable-doxygen-pdf],
  134. [Enable building Doxygen manual as PDF.]),
  135. [doxygen_as_pdf=$enableval], [doxygen_as_pdf=no])
  136. AC_SUBST([doxygen_as_pdf])
  137. AC_MSG_CHECKING([whether to build Doxygen as PDF])
  138. AC_MSG_RESULT([$doxygen_as_pdf])
  139. AC_ARG_ENABLE([gccwarnings],
  140. AS_HELP_STRING([--disable-gccwarnings], [Disable compiler warnings]),
  141. [gcc_warnings=$enableval], [gcc_warnings=yes])
  142. AC_ARG_ENABLE([wextra],
  143. AS_HELP_STRING([--disable-wextra], [Disable extra compiler warnings]),
  144. [gcc_wextra=$enableval], [gcc_wextra=$gcc_warnings])
  145. AC_ARG_ENABLE([werror],
  146. AS_HELP_STRING([--disable-werror], [Do not treat warnings as errors]),
  147. [gcc_werror=$enableval], [gcc_werror=$gcc_warnings])
  148. # set default verbose options, overridden by following options
  149. debug_usb_io=no
  150. debug_usb_comms=no
  151. AC_ARG_ENABLE([verbose],
  152. AS_HELP_STRING([--enable-verbose],
  153. [Enable verbose JTAG I/O messages (for debugging).]),
  154. [
  155. debug_usb_io=$enableval
  156. debug_usb_comms=$enableval
  157. ], [])
  158. AC_ARG_ENABLE([verbose_usb_io],
  159. AS_HELP_STRING([--enable-verbose-usb-io],
  160. [Enable verbose USB I/O messages (for debugging)]),
  161. [debug_usb_io=$enableval], [])
  162. AC_ARG_ENABLE([verbose_usb_comms],
  163. AS_HELP_STRING([--enable-verbose-usb-comms],
  164. [Enable verbose USB communication messages (for debugging)]),
  165. [debug_usb_comms=$enableval], [])
  166. AC_MSG_CHECKING([whether to enable verbose USB I/O messages]);
  167. AC_MSG_RESULT([$debug_usb_io])
  168. AS_IF([test "x$debug_usb_io" = "xyes"], [
  169. AC_DEFINE([_DEBUG_USB_IO_],[1], [Print verbose USB I/O messages])
  170. ])
  171. AC_MSG_CHECKING([whether to enable verbose USB communication messages]);
  172. AC_MSG_RESULT([$debug_usb_comms])
  173. AS_IF([test "x$debug_usb_comms" = "xyes"], [
  174. AC_DEFINE([_DEBUG_USB_COMMS_],[1], [Print verbose USB communication messages])
  175. ])
  176. debug_malloc=no
  177. AC_ARG_ENABLE([malloc_logging],
  178. AS_HELP_STRING([--enable-malloc-logging],
  179. [Include free space in logging messages (requires malloc.h).]),
  180. [debug_malloc=$enableval], [])
  181. AC_MSG_CHECKING([whether to enable malloc free space logging]);
  182. AC_MSG_RESULT([$debug_malloc])
  183. AS_IF([test "x$debug_malloc" = "xyes"], [
  184. AC_DEFINE([_DEBUG_FREE_SPACE_],[1], [Include malloc free space in logging])
  185. ])
  186. AC_ARG_ENABLE([dummy],
  187. AS_HELP_STRING([--enable-dummy], [Enable building the dummy port driver]),
  188. [build_dummy=$enableval], [build_dummy=no])
  189. m4_define([AC_ARG_ADAPTERS], [
  190. m4_foreach([adapter], [$1],
  191. [AC_ARG_ENABLE(ADAPTER_OPT([adapter]),
  192. AS_HELP_STRING([--enable-ADAPTER_OPT([adapter])],
  193. [Enable building support for the ]ADAPTER_DESC([adapter])[ (default is $2)]),
  194. [], [ADAPTER_VAR([adapter])=$2])
  195. ])
  196. ])
  197. AC_ARG_ADAPTERS([
  198. USB1_ADAPTERS,
  199. USB_ADAPTERS,
  200. USB0_ADAPTERS,
  201. HIDAPI_ADAPTERS,
  202. HIDAPI_USB1_ADAPTERS,
  203. LIBFTDI_ADAPTERS,
  204. LIBJAYLINK_ADAPTERS
  205. ],[auto])
  206. AC_ARG_ENABLE([parport],
  207. AS_HELP_STRING([--enable-parport], [Enable building the pc parallel port driver]),
  208. [build_parport=$enableval], [build_parport=no])
  209. AC_ARG_ENABLE([parport_ppdev],
  210. AS_HELP_STRING([--disable-parport-ppdev],
  211. [Disable use of ppdev (/dev/parportN) for parport (for x86 only)]),
  212. [parport_use_ppdev=$enableval], [parport_use_ppdev=yes])
  213. AC_ARG_ENABLE([parport_giveio],
  214. AS_HELP_STRING([--enable-parport-giveio],
  215. [Enable use of giveio for parport (for CygWin only)]),
  216. [parport_use_giveio=$enableval], [parport_use_giveio=])
  217. AC_ARG_ENABLE([jtag_vpi],
  218. AS_HELP_STRING([--enable-jtag_vpi], [Enable building support for JTAG VPI]),
  219. [build_jtag_vpi=$enableval], [build_jtag_vpi=no])
  220. AC_ARG_ENABLE([amtjtagaccel],
  221. AS_HELP_STRING([--enable-amtjtagaccel], [Enable building the Amontec JTAG-Accelerator driver]),
  222. [build_amtjtagaccel=$enableval], [build_amtjtagaccel=no])
  223. AC_ARG_ENABLE([zy1000_master],
  224. AS_HELP_STRING([--enable-zy1000-master], [Use ZY1000 JTAG master registers]),
  225. [build_zy1000_master=$enableval], [build_zy1000_master=no])
  226. AC_ARG_ENABLE([zy1000],
  227. AS_HELP_STRING([--enable-zy1000], [Enable ZY1000 interface]),
  228. [build_zy1000=$enableval], [build_zy1000=no])
  229. AC_ARG_ENABLE([ioutil],
  230. AS_HELP_STRING([--enable-ioutil], [Enable ioutil functions - useful for standalone OpenOCD implementations]),
  231. [build_ioutil=$enableval], [build_ioutil=no])
  232. AS_CASE(["${host_cpu}"],
  233. [arm*], [
  234. AC_ARG_ENABLE([ep93xx],
  235. AS_HELP_STRING([--enable-ep93xx], [Enable building support for EP93xx based SBCs]),
  236. [build_ep93xx=$enableval], [build_ep93xx=no])
  237. AC_ARG_ENABLE([at91rm9200],
  238. AS_HELP_STRING([--enable-at91rm9200], [Enable building support for AT91RM9200 based SBCs]),
  239. [build_at91rm9200=$enableval], [build_at91rm9200=no])
  240. AC_ARG_ENABLE([bcm2835gpio],
  241. AS_HELP_STRING([--enable-bcm2835gpio], [Enable building support for bitbanging on BCM2835 (as found in Raspberry Pi)]),
  242. [build_bcm2835gpio=$enableval], [build_bcm2835gpio=no])
  243. AC_ARG_ENABLE([imx_gpio],
  244. AS_HELP_STRING([--enable-imx_gpio], [Enable building support for bitbanging on NXP IMX processors]),
  245. [build_imx_gpio=$enableval], [build_imx_gpio=no])
  246. ],
  247. [
  248. build_ep93xx=no
  249. build_at91rm9200=no
  250. build_bcm2835gpio=no
  251. build_imx_gpio=no
  252. ])
  253. AC_ARG_ENABLE([gw16012],
  254. AS_HELP_STRING([--enable-gw16012], [Enable building support for the Gateworks GW16012 JTAG Programmer]),
  255. [build_gw16012=$enableval], [build_gw16012=no])
  256. AC_ARG_ENABLE([oocd_trace],
  257. AS_HELP_STRING([--enable-oocd_trace],
  258. [Enable building support for some prototype OpenOCD+trace ETM capture hardware]),
  259. [build_oocd_trace=$enableval], [build_oocd_trace=no])
  260. AC_ARG_ENABLE([buspirate],
  261. AS_HELP_STRING([--enable-buspirate], [Enable building support for the Buspirate]),
  262. [build_buspirate=$enableval], [build_buspirate=no])
  263. AC_ARG_ENABLE([sysfsgpio],
  264. AS_HELP_STRING([--enable-sysfsgpio], [Enable building support for programming driven via sysfs gpios.]),
  265. [build_sysfsgpio=$enableval], [build_sysfsgpio=no])
  266. AC_ARG_ENABLE([xlnx_pcie_xvc],
  267. AS_HELP_STRING([--enable-xlnx-pcie-xvc], [Enable building support for Xilinx XVC/PCIe.]),
  268. [build_xlnx_pcie_xvc=$enableval], [build_xlnx_pcie_xvc=no])
  269. AS_CASE([$host_os],
  270. [linux*], [],
  271. [
  272. AS_IF([test "x$build_sysfsgpio" = "xyes"], [
  273. AC_MSG_ERROR([sysfsgpio is only available on linux])
  274. ])
  275. AS_IF([test "x$build_xlnx_pcie_xvc" = "xyes"], [
  276. AC_MSG_ERROR([xlnx_pcie_xvc is only available on linux])
  277. ])
  278. ])
  279. AC_ARG_ENABLE([minidriver_dummy],
  280. AS_HELP_STRING([--enable-minidriver-dummy], [Enable the dummy minidriver.]),
  281. [build_minidriver_dummy=$enableval], [build_minidriver_dummy=no])
  282. AC_ARG_ENABLE([internal-jimtcl],
  283. AS_HELP_STRING([--disable-internal-jimtcl], [Disable building internal jimtcl]),
  284. [use_internal_jimtcl=$enableval], [use_internal_jimtcl=yes])
  285. AC_ARG_ENABLE([internal-libjaylink],
  286. AS_HELP_STRING([--disable-internal-libjaylink],
  287. [Disable building internal libjaylink]),
  288. [use_internal_libjaylink=$enableval], [use_internal_libjaylink=yes])
  289. AC_ARG_ENABLE([target64],
  290. AS_HELP_STRING([--disable-target64], [Disable 64-bit target address]),
  291. [build_target64=$enableval], [build_target64=yes])
  292. build_minidriver=no
  293. AC_MSG_CHECKING([whether to enable ZY1000 minidriver])
  294. AS_IF([test "x$build_zy1000" = "xyes"], [
  295. AS_IF([test "x$build_minidriver" = "xyes"], [
  296. AC_MSG_ERROR([Multiple minidriver options have been enabled.])
  297. ])
  298. AC_DEFINE([HAVE_JTAG_MINIDRIVER_H], [1],
  299. [Define to 1 if you have the <jtag_minidriver.h> header file.])
  300. build_minidriver=yes
  301. ])
  302. AC_MSG_RESULT([$build_zy1000])
  303. AC_ARG_ENABLE([remote-bitbang],
  304. AS_HELP_STRING([--enable-remote-bitbang], [Enable building support for the Remote Bitbang jtag driver]),
  305. [build_remote_bitbang=$enableval], [build_remote_bitbang=no])
  306. AC_MSG_CHECKING([whether to enable dummy minidriver])
  307. AS_IF([test "x$build_minidriver_dummy" = "xyes"], [
  308. AS_IF([test "x$build_minidriver" = "xyes"], [
  309. AC_MSG_ERROR([Multiple minidriver options have been enabled.])
  310. ])
  311. build_minidriver=yes
  312. AC_DEFINE([BUILD_MINIDRIVER_DUMMY], [1], [Use the dummy minidriver.])
  313. AC_DEFINE([HAVE_JTAG_MINIDRIVER_H], [1],
  314. [Define to 1 if you have the <jtag_minidriver.h> header file.])
  315. ])
  316. AC_MSG_RESULT([$build_minidriver_dummy])
  317. AC_MSG_CHECKING([whether standard drivers can be built])
  318. AS_IF([test "x$build_minidriver" = "xyes"], [
  319. AC_MSG_RESULT([no])
  320. AC_MSG_WARN([Using the minidriver disables all other drivers.])
  321. sleep 2
  322. ], [
  323. AC_MSG_RESULT([yes])
  324. ])
  325. AS_CASE(["${host_cpu}"],
  326. [i?86|x86*], [],
  327. [
  328. AS_IF([test "x$parport_use_ppdev" = "xno"], [
  329. AC_MSG_WARN([--disable-parport-ppdev is not supported by the host CPU])
  330. ])
  331. parport_use_ppdev=yes
  332. ])
  333. AS_CASE([$host],
  334. [*-cygwin*], [
  335. is_win32=yes
  336. parport_use_ppdev=no
  337. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[return __MINGW32__;]])],
  338. [is_mingw=yes],[is_mingw=no])
  339. AS_IF([test "x$is_mingw" = "xyes"], [
  340. AS_IF([test "x$parport_use_giveio" = "xno"], [
  341. AC_MSG_WARN([--disable-parport-giveio is not supported by MinGW32 hosts])
  342. ])
  343. parport_use_giveio=yes
  344. is_cygwin=no
  345. ], [
  346. is_cygwin=yes
  347. # sys/io.h needed under cygwin for parport access
  348. AS_IF([test "x$build_parport" = "xyes"], [
  349. AC_CHECK_HEADERS([sys/io.h],[],AC_MSG_ERROR([Please install the cygwin ioperm package]))
  350. ])
  351. ])
  352. ],
  353. [*-mingw* | *-msys*], [
  354. is_mingw=yes
  355. is_win32=yes
  356. parport_use_ppdev=no
  357. AS_IF([test "x$parport_use_giveio" = "xno"], [
  358. AC_MSG_WARN([--disable-parport-giveio is not supported by MinGW32 hosts])
  359. ])
  360. parport_use_giveio=yes
  361. AS_IF([test "x$build_buspirate" = "xyes"], [
  362. AC_MSG_ERROR([buspirate currently not supported by MinGW32 hosts])
  363. ])
  364. AC_SUBST([HOST_CPPFLAGS], [-D__USE_MINGW_ANSI_STDIO])
  365. ],
  366. [*darwin*], [
  367. is_darwin=yes
  368. AS_IF([test "x$parport_use_giveio" = "xyes"], [
  369. AC_MSG_WARN([--enable-parport-giveio cannot be used by Darwin hosts])
  370. ])
  371. parport_use_giveio=no
  372. ],
  373. [
  374. AS_IF([test "x$parport_use_giveio" = "xyes"], [
  375. AC_MSG_WARN([--enable-parport-giveio cannot be used by ]$host[ hosts])
  376. ])
  377. parport_use_giveio=no
  378. ])
  379. AS_IF([test "x$is_cygwin" = "xyes"], [
  380. AC_DEFINE([IS_CYGWIN], [1], [1 if building for Cygwin.])
  381. ], [
  382. AC_DEFINE([IS_CYGWIN], [0], [0 if not building for Cygwin.])
  383. ])
  384. AS_IF([test "x$is_mingw" = "xyes"], [
  385. AC_DEFINE([IS_MINGW], [1], [1 if building for Mingw.])
  386. ], [
  387. AC_DEFINE([IS_MINGW], [0], [0 if not building for Mingw.])
  388. ])
  389. AS_IF([test "x$is_win32" = "xyes"], [
  390. AC_DEFINE([IS_WIN32], [1], [1 if building for Win32.])
  391. ], [
  392. AC_DEFINE([IS_WIN32], [0], [0 if not building for Win32.])
  393. ])
  394. AS_IF([test "x$is_darwin" = "xyes"], [
  395. AC_DEFINE([IS_DARWIN], [1], [1 if building for Darwin.])
  396. ], [
  397. AC_DEFINE([IS_DARWIN], [0], [0 if not building for Darwin.])
  398. ])
  399. AS_IF([test "x$build_parport" = "xyes"], [
  400. build_bitbang=yes
  401. AC_DEFINE([BUILD_PARPORT], [1], [1 if you want parport.])
  402. ], [
  403. AC_DEFINE([BUILD_PARPORT], [0], [0 if you don't want parport.])
  404. ])
  405. AS_IF([test "x$build_dummy" = "xyes"], [
  406. build_bitbang=yes
  407. AC_DEFINE([BUILD_DUMMY], [1], [1 if you want dummy driver.])
  408. ], [
  409. AC_DEFINE([BUILD_DUMMY], [0], [0 if you don't want dummy driver.])
  410. ])
  411. AS_IF([test "x$build_ep93xx" = "xyes"], [
  412. build_bitbang=yes
  413. AC_DEFINE([BUILD_EP93XX], [1], [1 if you want ep93xx.])
  414. ], [
  415. AC_DEFINE([BUILD_EP93XX], [0], [0 if you don't want ep93xx.])
  416. ])
  417. AS_IF([test "x$build_zy1000" = "xyes"], [
  418. AC_DEFINE([BUILD_ZY1000], [1], [1 if you want ZY1000.])
  419. ], [
  420. AC_DEFINE([BUILD_ZY1000], [0], [0 if you don't want ZY1000.])
  421. ])
  422. AS_IF([test "x$build_zy1000_master" = "xyes"], [
  423. AC_DEFINE([BUILD_ZY1000_MASTER], [1], [1 if you want ZY1000 JTAG master registers.])
  424. ], [
  425. AC_DEFINE([BUILD_ZY1000_MASTER], [0], [0 if you don't want ZY1000 JTAG master registers.])
  426. ])
  427. AS_IF([test "x$build_at91rm9200" = "xyes"], [
  428. build_bitbang=yes
  429. AC_DEFINE([BUILD_AT91RM9200], [1], [1 if you want at91rm9200.])
  430. ], [
  431. AC_DEFINE([BUILD_AT91RM9200], [0], [0 if you don't want at91rm9200.])
  432. ])
  433. AS_IF([test "x$build_bcm2835gpio" = "xyes"], [
  434. build_bitbang=yes
  435. AC_DEFINE([BUILD_BCM2835GPIO], [1], [1 if you want bcm2835gpio.])
  436. ], [
  437. AC_DEFINE([BUILD_BCM2835GPIO], [0], [0 if you don't want bcm2835gpio.])
  438. ])
  439. AS_IF([test "x$build_imx_gpio" = "xyes"], [
  440. build_bitbang=yes
  441. AC_DEFINE([BUILD_IMX_GPIO], [1], [1 if you want imx_gpio.])
  442. ], [
  443. AC_DEFINE([BUILD_IMX_GPIO], [0], [0 if you don't want imx_gpio.])
  444. ])
  445. AS_IF([test "x$parport_use_ppdev" = "xyes"], [
  446. AC_DEFINE([PARPORT_USE_PPDEV], [1], [1 if you want parport to use ppdev.])
  447. ], [
  448. AC_DEFINE([PARPORT_USE_PPDEV], [0], [0 if you don't want parport to use ppdev.])
  449. ])
  450. AS_IF([test "x$parport_use_giveio" = "xyes"], [
  451. AC_DEFINE([PARPORT_USE_GIVEIO], [1], [1 if you want parport to use giveio.])
  452. ], [
  453. AC_DEFINE([PARPORT_USE_GIVEIO], [0], [0 if you don't want parport to use giveio.])
  454. ])
  455. AS_IF([test "x$build_jtag_vpi" = "xyes"], [
  456. AC_DEFINE([BUILD_JTAG_VPI], [1], [1 if you want JTAG VPI.])
  457. ], [
  458. AC_DEFINE([BUILD_JTAG_VPI], [0], [0 if you don't want JTAG VPI.])
  459. ])
  460. AS_IF([test "x$build_amtjtagaccel" = "xyes"], [
  461. AC_DEFINE([BUILD_AMTJTAGACCEL], [1], [1 if you want the Amontec JTAG-Accelerator driver.])
  462. ], [
  463. AC_DEFINE([BUILD_AMTJTAGACCEL], [0], [0 if you don't want the Amontec JTAG-Accelerator driver.])
  464. ])
  465. AS_IF([test "x$build_gw16012" = "xyes"], [
  466. AC_DEFINE([BUILD_GW16012], [1], [1 if you want the Gateworks GW16012 driver.])
  467. ], [
  468. AC_DEFINE([BUILD_GW16012], [0], [0 if you don't want the Gateworks GW16012 driver.])
  469. ])
  470. AS_IF([test "x$build_oocd_trace" = "xyes"], [
  471. AC_DEFINE([BUILD_OOCD_TRACE], [1], [1 if you want the OpenOCD+trace ETM capture driver.])
  472. ], [
  473. AC_DEFINE([BUILD_OOCD_TRACE], [0], [0 if you don't want the OpenOCD+trace ETM capture driver.])
  474. ])
  475. AS_IF([test "x$build_buspirate" = "xyes"], [
  476. AC_DEFINE([BUILD_BUSPIRATE], [1], [1 if you want the Buspirate JTAG driver.])
  477. ], [
  478. AC_DEFINE([BUILD_BUSPIRATE], [0], [0 if you don't want the Buspirate JTAG driver.])
  479. ])
  480. AS_IF([test "x$use_internal_jimtcl" = "xyes"], [
  481. AS_IF([test -f "$srcdir/jimtcl/configure.ac"], [
  482. AX_CONFIG_SUBDIR_OPTION([jimtcl], [--disable-install-jim])
  483. ], [
  484. AC_MSG_ERROR([jimtcl not found, run git submodule init and git submodule update.])
  485. ])
  486. ])
  487. AS_IF([test "x$build_remote_bitbang" = "xyes"], [
  488. build_bitbang=yes
  489. AC_DEFINE([BUILD_REMOTE_BITBANG], [1], [1 if you want the Remote Bitbang JTAG driver.])
  490. ], [
  491. AC_DEFINE([BUILD_REMOTE_BITBANG], [0], [0 if you don't want the Remote Bitbang JTAG driver.])
  492. ])
  493. AS_IF([test "x$build_sysfsgpio" = "xyes"], [
  494. build_bitbang=yes
  495. AC_DEFINE([BUILD_SYSFSGPIO], [1], [1 if you want the SysfsGPIO driver.])
  496. ], [
  497. AC_DEFINE([BUILD_SYSFSGPIO], [0], [0 if you don't want SysfsGPIO driver.])
  498. ])
  499. AS_IF([test "x$build_xlnx_pcie_xvc" = "xyes"], [
  500. build_xlnx_pcie_xvc=yes
  501. AC_DEFINE([BUILD_XLNX_PCIE_XVC], [1], [1 if you want the Xilinx XVC/PCIe driver.])
  502. ], [
  503. AC_DEFINE([BUILD_XLNX_PCIE_XVC], [0], [0 if you don't want Xilinx XVC/PCIe driver.])
  504. ])
  505. AS_IF([test "x$build_target64" = "xyes"], [
  506. AC_DEFINE([BUILD_TARGET64], [1], [1 if you want 64-bit addresses.])
  507. ], [
  508. AC_DEFINE([BUILD_TARGET64], [0], [0 if you don't want 64-bit addresses.])
  509. ])
  510. PKG_CHECK_MODULES([LIBUSB1], [libusb-1.0], [
  511. use_libusb1=yes
  512. AC_DEFINE([HAVE_LIBUSB1], [1], [Define if you have libusb-1.x])
  513. PKG_CHECK_EXISTS([libusb-1.0 >= 1.0.9],
  514. [AC_DEFINE([HAVE_LIBUSB_ERROR_NAME], [1], [Define if your libusb has libusb_error_name()])],
  515. [AC_MSG_WARN([libusb-1.x older than 1.0.9 detected, consider updating])])
  516. LIBUSB1_CFLAGS=`echo $LIBUSB1_CFLAGS | sed 's/-I/-isystem /'`
  517. AC_MSG_NOTICE([libusb-1.0 header bug workaround: LIBUSB1_CFLAGS changed to "$LIBUSB1_CFLAGS"])
  518. PKG_CHECK_EXISTS([libusb-1.0 >= 1.0.16],
  519. [AC_DEFINE([HAVE_LIBUSB_GET_PORT_NUMBERS], [1], [Define if your libusb has libusb_get_port_numbers()])])
  520. ], [
  521. use_libusb1=no
  522. AC_MSG_WARN([libusb-1.x not found, trying legacy libusb-0.1 as a fallback; consider installing libusb-1.x instead])
  523. ])
  524. PKG_CHECK_MODULES([LIBUSB0], [libusb], [use_libusb0=yes], [use_libusb0=no])
  525. for hidapi_lib in hidapi hidapi-hidraw hidapi-libusb; do
  526. PKG_CHECK_MODULES([HIDAPI],[$hidapi_lib],[
  527. use_hidapi=yes
  528. break
  529. ],[
  530. use_hidapi=no
  531. ])
  532. done
  533. PKG_CHECK_MODULES([LIBFTDI], [libftdi1], [use_libftdi=yes], [
  534. PKG_CHECK_MODULES([LIBFTDI], [libftdi], [use_libftdi=yes], [use_libftdi=no])
  535. ])
  536. PKG_CHECK_MODULES([LIBJAYLINK], [libjaylink >= 0.2],
  537. [use_libjaylink=yes], [use_libjaylink=no])
  538. m4_define([PROCESS_ADAPTERS], [
  539. m4_foreach([adapter], [$1], [
  540. AS_IF([test "x$build_zy1000" = "xyes"], [
  541. ADAPTER_VAR([adapter])=no
  542. ])
  543. AS_IF([test $2], [
  544. AS_IF([test "x$ADAPTER_VAR([adapter])" != "xno"], [
  545. AC_DEFINE([BUILD_]ADAPTER_SYM([adapter]), [1], [1 if you want the ]ADAPTER_DESC([adapter]).)
  546. ], [
  547. AC_DEFINE([BUILD_]ADAPTER_SYM([adapter]), [0], [0 if you do not want the ]ADAPTER_DESC([adapter]).)
  548. ])
  549. ], [
  550. AS_IF([test "x$ADAPTER_VAR([adapter])" = "xyes"], [
  551. AC_MSG_ERROR([$3 is required for the ADAPTER_DESC([adapter])])
  552. ])
  553. ADAPTER_VAR([adapter])=no
  554. ])
  555. AM_CONDITIONAL(ADAPTER_SYM([adapter]), [test "x$ADAPTER_VAR([adapter])" != "xno"])
  556. ])
  557. ])
  558. PROCESS_ADAPTERS([USB1_ADAPTERS], ["x$use_libusb1" = "xyes"], [libusb-1.x])
  559. PROCESS_ADAPTERS([USB_ADAPTERS], ["x$use_libusb1" = "xyes" -o "x$use_libusb0" = "xyes"], [libusb-1.x or libusb-0.1])
  560. PROCESS_ADAPTERS([USB0_ADAPTERS], ["x$use_libusb0" = "xyes"], [libusb-0.1])
  561. PROCESS_ADAPTERS([HIDAPI_ADAPTERS], ["x$use_hidapi" = "xyes"], [hidapi])
  562. PROCESS_ADAPTERS([HIDAPI_USB1_ADAPTERS], ["x$use_hidapi" = "xyes" -a "x$use_libusb1" = "xyes"], [hidapi and libusb-1.x])
  563. PROCESS_ADAPTERS([LIBFTDI_ADAPTERS], ["x$use_libftdi" = "xyes"], [libftdi])
  564. PROCESS_ADAPTERS([LIBJAYLINK_ADAPTERS], ["x$use_internal_libjaylink" = "xyes" -o "x$use_libjaylink" = "xyes"], [libjaylink-0.2])
  565. AS_IF([test "x$build_openjtag" = "xyes"], [
  566. AS_IF([test "x$use_libusb1" != "xyes" -a "x$use_libusb0" != "xyes"], [
  567. AC_MSG_ERROR([libusb-1.x or libusb-0.1 is required for the OpenJTAG Programmer])
  568. build_openjtag=no
  569. ])
  570. ])
  571. AS_IF([test "x$enable_stlink" != "xno" -o "x$enable_ti_icdi" != "xno"], [
  572. AC_DEFINE([BUILD_HLADAPTER], [1], [1 if you want the High Level JTAG driver.])
  573. ], [
  574. AC_DEFINE([BUILD_HLADAPTER], [0], [0 if you want the High Level JTAG driver.])
  575. ])
  576. AM_CONDITIONAL([HLADAPTER], [test "x$enable_stlink" != "xno" -o "x$enable_ti_icdi" != "xno"])
  577. AS_IF([test "x$enable_jlink" != "xno"], [
  578. AS_IF([test "x$use_internal_libjaylink" = "xyes"], [
  579. AS_IF([test -f "$srcdir/src/jtag/drivers/libjaylink/configure.ac"], [
  580. AX_CONFIG_SUBDIR_OPTION([src/jtag/drivers/libjaylink],
  581. [--enable-subproject-build])
  582. ], [
  583. AC_MSG_ERROR([Internal libjaylink not found, run either 'git submodule init' and 'git submodule update' or disable internal libjaylink with --disable-internal-libjaylink.])
  584. ])
  585. ])
  586. ])
  587. # Presto needs the bitq module
  588. AS_IF([test "x$enable_presto" != "xno"], [
  589. build_bitq=yes
  590. ])
  591. AM_CONDITIONAL([RELEASE], [test "x$build_release" = "xyes"])
  592. AM_CONDITIONAL([PARPORT], [test "x$build_parport" = "xyes"])
  593. AM_CONDITIONAL([DUMMY], [test "x$build_dummy" = "xyes"])
  594. AM_CONDITIONAL([GIVEIO], [test "x$parport_use_giveio" = "xyes"])
  595. AM_CONDITIONAL([EP93XX], [test "x$build_ep93xx" = "xyes"])
  596. AM_CONDITIONAL([ZY1000], [test "x$build_zy1000" = "xyes"])
  597. AM_CONDITIONAL([ZY1000_MASTER], [test "x$build_zy1000_master" = "xyes"])
  598. AM_CONDITIONAL([IOUTIL], [test "x$build_ioutil" = "xyes"])
  599. AM_CONDITIONAL([AT91RM9200], [test "x$build_at91rm9200" = "xyes"])
  600. AM_CONDITIONAL([BCM2835GPIO], [test "x$build_bcm2835gpio" = "xyes"])
  601. AM_CONDITIONAL([IMX_GPIO], [test "x$build_imx_gpio" = "xyes"])
  602. AM_CONDITIONAL([BITBANG], [test "x$build_bitbang" = "xyes"])
  603. AM_CONDITIONAL([JTAG_VPI], [test "x$build_jtag_vpi" = "xyes" -o "x$build_jtag_vpi" = "xyes"])
  604. AM_CONDITIONAL([USB_BLASTER_DRIVER], [test "x$enable_usb_blaster" != "xno" -o "x$enable_usb_blaster_2" != "xno"])
  605. AM_CONDITIONAL([AMTJTAGACCEL], [test "x$build_amtjtagaccel" = "xyes"])
  606. AM_CONDITIONAL([GW16012], [test "x$build_gw16012" = "xyes"])
  607. AM_CONDITIONAL([OOCD_TRACE], [test "x$build_oocd_trace" = "xyes"])
  608. AM_CONDITIONAL([REMOTE_BITBANG], [test "x$build_remote_bitbang" = "xyes"])
  609. AM_CONDITIONAL([BUSPIRATE], [test "x$build_buspirate" = "xyes"])
  610. AM_CONDITIONAL([SYSFSGPIO], [test "x$build_sysfsgpio" = "xyes"])
  611. AM_CONDITIONAL([XLNX_PCIE_XVC], [test "x$build_xlnx_pcie_xvc" = "xyes"])
  612. AM_CONDITIONAL([USE_LIBUSB0], [test "x$use_libusb0" = "xyes"])
  613. AM_CONDITIONAL([USE_LIBUSB1], [test "x$use_libusb1" = "xyes"])
  614. AM_CONDITIONAL([IS_CYGWIN], [test "x$is_cygwin" = "xyes"])
  615. AM_CONDITIONAL([IS_MINGW], [test "x$is_mingw" = "xyes"])
  616. AM_CONDITIONAL([IS_WIN32], [test "x$is_win32" = "xyes"])
  617. AM_CONDITIONAL([IS_DARWIN], [test "x$is_darwin" = "xyes"])
  618. AM_CONDITIONAL([BITQ], [test "x$build_bitq" = "xyes"])
  619. AM_CONDITIONAL([USE_LIBFTDI], [test "x$use_libftdi" = "xyes"])
  620. AM_CONDITIONAL([USE_HIDAPI], [test "x$use_hidapi" = "xyes"])
  621. AM_CONDITIONAL([USE_LIBJAYLINK], [test "x$use_libjaylink" = "xyes"])
  622. AM_CONDITIONAL([TARGET64], [test "x$build_target64" = "xyes"])
  623. AM_CONDITIONAL([MINIDRIVER], [test "x$build_minidriver" = "xyes"])
  624. AM_CONDITIONAL([MINIDRIVER_DUMMY], [test "x$build_minidriver_dummy" = "xyes"])
  625. AM_CONDITIONAL([INTERNAL_JIMTCL], [test "x$use_internal_jimtcl" = "xyes"])
  626. AM_CONDITIONAL([INTERNAL_LIBJAYLINK], [test "x$use_internal_libjaylink" = "xyes"])
  627. # Look for environ alternatives. Possibility #1: is environ in unistd.h or stdlib.h?
  628. AC_MSG_CHECKING([for environ in unistd.h and stdlib.h])
  629. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  630. #define _GNU_SOURCE
  631. #include <unistd.h>
  632. #include <stdlib.h>
  633. ]], [[char **ep = environ;]]
  634. )], [
  635. AC_MSG_RESULT([yes])
  636. has_environ=yes
  637. ], [
  638. AC_MSG_RESULT([no])
  639. # Possibility #2: can environ be found in an available library?
  640. AC_MSG_CHECKING([for extern environ])
  641. AC_LINK_IFELSE([AC_LANG_PROGRAM([[
  642. extern char **environ;
  643. ]], [[char **ep = environ;]]
  644. )], [
  645. AC_DEFINE(NEED_ENVIRON_EXTERN, [1], [Must declare 'environ' to use it.])
  646. has_environ=yes
  647. ], [
  648. has_environ=no
  649. ])
  650. AC_MSG_RESULT([${has_environ}])
  651. ])
  652. AS_IF([test "x${has_environ}" != "xyes" ], [
  653. AC_MSG_FAILURE([Could not find 'environ' in unistd.h or available libraries.])
  654. ])
  655. AC_DEFINE([_GNU_SOURCE],[1],[Use GNU C library extensions (e.g. stdndup).])
  656. # set default gcc warnings
  657. GCC_WARNINGS="-Wall -Wstrict-prototypes -Wformat-security -Wshadow"
  658. AS_IF([test "x${gcc_wextra}" = "xyes"], [
  659. GCC_WARNINGS="${GCC_WARNINGS} -Wextra -Wno-unused-parameter"
  660. GCC_WARNINGS="${GCC_WARNINGS} -Wbad-function-cast"
  661. GCC_WARNINGS="${GCC_WARNINGS} -Wcast-align"
  662. GCC_WARNINGS="${GCC_WARNINGS} -Wredundant-decls"
  663. ])
  664. AS_IF([test "x${gcc_werror}" = "xyes"], [
  665. GCC_WARNINGS="${GCC_WARNINGS} -Werror"
  666. ])
  667. # override default gcc cflags
  668. AS_IF([test "x$gcc_warnings" = "xyes"], [
  669. AC_SUBST([GCC_WARNINGS], [$GCC_WARNINGS])
  670. ])
  671. AC_CONFIG_FILES([
  672. Makefile
  673. ])
  674. AC_OUTPUT
  675. echo
  676. echo
  677. echo OpenOCD configuration summary
  678. echo --------------------------------------------------
  679. m4_foreach([adapter], [USB1_ADAPTERS, USB_ADAPTERS, USB0_ADAPTERS,
  680. HIDAPI_ADAPTERS, HIDAPI_USB1_ADAPTERS, LIBFTDI_ADAPTERS,
  681. LIBJAYLINK_ADAPTERS, PCIE_ADAPTERS],
  682. [s=m4_format(["%-40s"], ADAPTER_DESC([adapter]))
  683. AS_CASE([$ADAPTER_VAR([adapter])],
  684. [auto], [
  685. echo "$s"yes '(auto)'
  686. ],
  687. [yes], [
  688. echo "$s"yes
  689. ],
  690. [no], [
  691. echo "$s"no
  692. ])
  693. ])
  694. echo
  695. AS_IF([test "x$build_oocd_trace" = "xyes"], [
  696. echo 'WARNING! Deprecated configure option (--enable-oocd_trace)'
  697. echo 'The oocd_trace driver is deprecated and will be removed in the next release.'
  698. echo 'If you regularly use this driver, please report to the OpenOCD Mailing List.'
  699. echo
  700. ])
  701. AS_IF([test "x$build_zy1000" = "xyes" -o "x$build_zy1000_master" = "xyes"], [
  702. echo 'WARNING! Deprecated configure option (--enable-zy1000, --enable-zy1000-master)'
  703. echo 'Support for the ZY1000 platform is deprecated and will be removed in the next'
  704. echo 'release. If you regularly use this platform, please report to the OpenOCD'
  705. echo 'Mailing List.'
  706. echo
  707. ])
  708. AS_IF([test "x$build_ioutil" = "xyes"], [
  709. echo 'WARNING! Deprecated configure option (--enable-ioutil)'
  710. echo 'Support for the ioutil functions is deprecated and will be removed in the next'
  711. echo 'release. If you regularly depend on this functionality, please report to the'
  712. echo 'OpenOCD Mailing List.'
  713. echo
  714. ])