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 42 KiB

Add FTDI JTAG driver using MPSSE layer Based on ft2232.c but uses the MPSSE layer for low-level access, greatly simplifying the JTAG logic. Remove all libftdi/FTD2XX code and all layout specific code. Layout specifications are instead handled in Tcl. Use a signal abstraction to enable Tcl configuration files to define outputs for one or several FTDI GPIO. These outputs can then be controlled using the ftdi_set_signal command. Special signal names are reserved for nTRST, nSRST and LED (for blink) so that they, if defined, will be used for their customary purpose. Depending on the type of buffer attached to the FTDI GPIO, the outputs have to be controlled differently. In order to support tristateable signals such as nSRST, both a data GPIO and an output-enable GPIO can be specified for each signal. The following output buffer configurations are supported: * Push-pull with one FTDI output as (non-)inverted data line * Open drain with one FTDI output as (non-)inverted output-enable * Tristate with one FTDI output as (non-)inverted data line and another FTDI output as (non-)inverted output-enable * Unbuffered, using the FTDI GPIO as a tristate output directly by switching data and direction as necessary The data and output-enables are specified as 16-bit bitmasks, corresponding to the concatenation of the high and low FTDI GPIO registers. To specify an unbuffered output, use the same bitmask for both data and output-enable. The adapter configuration file must also specify default values for the FTDI data and direction GPIO registers, and the channel being used (if different from 0). Change-Id: I287a41d4c696cf5fc74eb10d5e63578b0dc7f826 Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Reviewed-on: http://openocd.zylin.com/452 Tested-by: jenkins Reviewed-by: Peter Stuge <peter@stuge.se>
12 years ago
Add FTDI JTAG driver using MPSSE layer Based on ft2232.c but uses the MPSSE layer for low-level access, greatly simplifying the JTAG logic. Remove all libftdi/FTD2XX code and all layout specific code. Layout specifications are instead handled in Tcl. Use a signal abstraction to enable Tcl configuration files to define outputs for one or several FTDI GPIO. These outputs can then be controlled using the ftdi_set_signal command. Special signal names are reserved for nTRST, nSRST and LED (for blink) so that they, if defined, will be used for their customary purpose. Depending on the type of buffer attached to the FTDI GPIO, the outputs have to be controlled differently. In order to support tristateable signals such as nSRST, both a data GPIO and an output-enable GPIO can be specified for each signal. The following output buffer configurations are supported: * Push-pull with one FTDI output as (non-)inverted data line * Open drain with one FTDI output as (non-)inverted output-enable * Tristate with one FTDI output as (non-)inverted data line and another FTDI output as (non-)inverted output-enable * Unbuffered, using the FTDI GPIO as a tristate output directly by switching data and direction as necessary The data and output-enables are specified as 16-bit bitmasks, corresponding to the concatenation of the high and low FTDI GPIO registers. To specify an unbuffered output, use the same bitmask for both data and output-enable. The adapter configuration file must also specify default values for the FTDI data and direction GPIO registers, and the channel being used (if different from 0). Change-Id: I287a41d4c696cf5fc74eb10d5e63578b0dc7f826 Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Reviewed-on: http://openocd.zylin.com/452 Tested-by: jenkins Reviewed-by: Peter Stuge <peter@stuge.se>
12 years ago
Add FTDI JTAG driver using MPSSE layer Based on ft2232.c but uses the MPSSE layer for low-level access, greatly simplifying the JTAG logic. Remove all libftdi/FTD2XX code and all layout specific code. Layout specifications are instead handled in Tcl. Use a signal abstraction to enable Tcl configuration files to define outputs for one or several FTDI GPIO. These outputs can then be controlled using the ftdi_set_signal command. Special signal names are reserved for nTRST, nSRST and LED (for blink) so that they, if defined, will be used for their customary purpose. Depending on the type of buffer attached to the FTDI GPIO, the outputs have to be controlled differently. In order to support tristateable signals such as nSRST, both a data GPIO and an output-enable GPIO can be specified for each signal. The following output buffer configurations are supported: * Push-pull with one FTDI output as (non-)inverted data line * Open drain with one FTDI output as (non-)inverted output-enable * Tristate with one FTDI output as (non-)inverted data line and another FTDI output as (non-)inverted output-enable * Unbuffered, using the FTDI GPIO as a tristate output directly by switching data and direction as necessary The data and output-enables are specified as 16-bit bitmasks, corresponding to the concatenation of the high and low FTDI GPIO registers. To specify an unbuffered output, use the same bitmask for both data and output-enable. The adapter configuration file must also specify default values for the FTDI data and direction GPIO registers, and the channel being used (if different from 0). Change-Id: I287a41d4c696cf5fc74eb10d5e63578b0dc7f826 Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Reviewed-on: http://openocd.zylin.com/452 Tested-by: jenkins Reviewed-by: Peter Stuge <peter@stuge.se>
12 years ago
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328
  1. AC_PREREQ(2.60)
  2. AC_INIT([openocd], [0.7.0],
  3. [OpenOCD Mailing List <openocd-devel@lists.sourceforge.net>])
  4. AC_CONFIG_SRCDIR([src/openocd.c])
  5. m4_include([config_subdir.m4])dnl
  6. AM_INIT_AUTOMAKE([-Wall -Wno-portability dist-bzip2 dist-zip])
  7. AM_MAINTAINER_MODE
  8. AC_CONFIG_HEADERS([config.h])
  9. AH_BOTTOM([
  10. #include <helper/system.h>
  11. #include <helper/types.h>
  12. #include <helper/replacements.h>
  13. ])
  14. AC_LANG_C
  15. AC_PROG_CC
  16. AC_PROG_CC_C99
  17. AM_PROG_CC_C_O
  18. AC_PROG_RANLIB
  19. dnl disable checks for C++, Fortran and GNU Java Compiler
  20. m4_defun([_LT_AC_LANG_CXX_CONFIG], [:])
  21. m4_defun([_LT_AC_LANG_F77_CONFIG], [:])
  22. m4_defun([_LT_AC_LANG_GCJ_CONFIG], [:])
  23. AC_DISABLE_SHARED
  24. AC_PROG_LIBTOOL
  25. AC_SUBST([LIBTOOL_DEPS])
  26. dnl configure checks required for Jim files (these are obsolete w/ C99)
  27. AC_C_CONST
  28. AC_TYPE_LONG_LONG_INT
  29. AC_SEARCH_LIBS([ioperm], [ioperm])
  30. AC_SEARCH_LIBS([dlopen], [dl])
  31. AC_CHECK_HEADERS([sys/socket.h])
  32. AC_CHECK_HEADERS([arpa/inet.h], [], [], [dnl
  33. #include <stdio.h>
  34. #ifdef STDC_HEADERS
  35. # include <stdlib.h>
  36. # include <stddef.h>
  37. #else
  38. # ifdef HAVE_STDLIB_H
  39. # include <stdlib.h>
  40. # endif
  41. #endif
  42. #ifdef HAVE_SYS_SOCKET_H
  43. # include <sys/socket.h>
  44. #endif
  45. ])
  46. AC_CHECK_HEADERS([elf.h])
  47. AC_CHECK_HEADERS([dirent.h])
  48. AC_CHECK_HEADERS([fcntl.h])
  49. AC_CHECK_HEADERS([ifaddrs.h], [], [], [dnl
  50. #include <stdio.h>
  51. #ifdef STDC_HEADERS
  52. # include <stdlib.h>
  53. # include <stddef.h>
  54. #else
  55. # ifdef HAVE_STDLIB_H
  56. # include <stdlib.h>
  57. # endif
  58. #endif
  59. #ifdef HAVE_SYS_SOCKET_H
  60. # include <sys/socket.h>
  61. #endif
  62. ])
  63. AC_CHECK_HEADERS([malloc.h])
  64. AC_CHECK_HEADERS([netdb.h])
  65. AC_CHECK_HEADERS([netinet/in.h], [], [], [dnl
  66. #include <stdio.h>
  67. #ifdef STDC_HEADERS
  68. # include <stdlib.h>
  69. # include <stddef.h>
  70. #else
  71. # ifdef HAVE_STDLIB_H
  72. # include <stdlib.h>
  73. # endif
  74. #endif
  75. #ifdef HAVE_SYS_SOCKET_H
  76. # include <sys/socket.h>
  77. #endif
  78. ])
  79. AC_CHECK_HEADERS([netinet/tcp.h], [], [], [dnl
  80. #include <stdio.h>
  81. #ifdef STDC_HEADERS
  82. # include <stdlib.h>
  83. # include <stddef.h>
  84. #else
  85. # ifdef HAVE_STDLIB_H
  86. # include <stdlib.h>
  87. # endif
  88. #endif
  89. #ifdef HAVE_SYS_SOCKET_H
  90. # include <sys/socket.h>
  91. #endif
  92. ])
  93. AC_CHECK_HEADERS([pthread.h])
  94. AC_CHECK_HEADERS([strings.h])
  95. AC_CHECK_HEADERS([sys/ioctl.h])
  96. AC_CHECK_HEADERS([sys/param.h])
  97. AC_CHECK_HEADERS([sys/poll.h])
  98. AC_CHECK_HEADERS([sys/select.h])
  99. AC_CHECK_HEADERS([sys/stat.h])
  100. AC_CHECK_HEADERS([sys/time.h])
  101. AC_CHECK_HEADERS([sys/types.h])
  102. AC_CHECK_HEADERS([unistd.h])
  103. AC_CHECK_HEADERS([net/if.h], [], [], [dnl
  104. #include <stdio.h>
  105. #ifdef STDC_HEADERS
  106. # include <stdlib.h>
  107. # include <stddef.h>
  108. #else
  109. # ifdef HAVE_STDLIB_H
  110. # include <stdlib.h>
  111. # endif
  112. #endif
  113. #ifdef HAVE_SYS_SOCKET_H
  114. # include <sys/socket.h>
  115. #endif
  116. ])
  117. AC_HEADER_ASSERT
  118. AC_HEADER_STDBOOL
  119. AC_HEADER_TIME
  120. AC_C_BIGENDIAN
  121. AC_CHECK_FUNCS([strndup])
  122. AC_CHECK_FUNCS([strnlen])
  123. AC_CHECK_FUNCS([gettimeofday])
  124. AC_CHECK_FUNCS([usleep])
  125. AC_CHECK_FUNCS([vasprintf])
  126. build_bitbang=no
  127. build_bitq=no
  128. is_cygwin=no
  129. is_mingw=no
  130. is_win32=no
  131. is_darwin=no
  132. # guess-rev.sh only exists in the repository, not in the released archives
  133. AC_MSG_CHECKING([whether to build a release])
  134. if test -x $srcdir/guess-rev.sh ; then
  135. build_release=no
  136. else
  137. build_release=yes
  138. fi
  139. AC_MSG_RESULT([$build_release])
  140. # We are not *ALWAYS* being installed in the standard place.
  141. # We may be installed in a "tool-build" specific location.
  142. # Normally with other packages - as part of a tool distro.
  143. # Thus - we should search that 'libdir' also.
  144. #
  145. # And - if we are being installed there - the odds are
  146. # The libraries unique to what we are are there too.
  147. #
  148. # Expand nd deal with NONE - just like configure will do later
  149. OCDprefix=$prefix
  150. OCDxprefix=$exec_prefix
  151. test x"$OCDprefix" = xNONE && OCDprefix=$ac_default_prefix
  152. # Let make expand exec_prefix.
  153. test x"$OCDxprefix" = xNONE && OCDxprefix="$OCDprefix"
  154. # what matters is the "exec-prefix"
  155. if test "$OCDxprefix" != "$ac_default_prefix"
  156. then
  157. # We are installing in a non-standard place
  158. # Nonstandard --prefix and/or --exec-prefix
  159. # We have an override of some sort.
  160. # use build specific install library dir
  161. LDFLAGS="$LDFLAGS -L$OCDxprefix/lib"
  162. # RPATH becomes an issue on Linux only
  163. if test $host_os = linux-gnu || test $host_os = linux ; then
  164. LDFLAGS="$LDFLAGS -Wl,-rpath,$OCDxprefix/lib"
  165. fi
  166. # The "INCDIR" is also usable
  167. CFLAGS="$CFLAGS -I$includedir"
  168. fi
  169. AC_ARG_WITH(ftd2xx,
  170. AS_HELP_STRING([--with-ftd2xx=<PATH>],[This option has been removed.]),
  171. [
  172. # Option Given.
  173. cat << __EOF__
  174. The option: --with-ftd2xx=<PATH> has been removed.
  175. On Linux, the new option is:
  176. --with-ftd2xx-linux-tardir=/path/to/files
  177. Where <path> is the path the the directory where the "tar.gz" file
  178. from FTDICHIP.COM was unpacked, for example:
  179. --with-ftd2xx-linux-tardir=${HOME}/libftd2xx0.4.16
  180. On Cygwin/MingW32, the new option is:
  181. --with-ftd2xx-win32-zipdir=/path/to/files
  182. Where <path> is the path to the directory where the "zip" file from
  183. FTDICHIP.COM was unpacked, for example:
  184. --with-ftd2xx-win32-zipdir=${HOME}/ftd2xx.cdm.files
  185. __EOF__
  186. AC_MSG_ERROR([Sorry Cannot continue])
  187. ], [true])
  188. #========================================
  189. # FTD2XXX support comes in 4 forms.
  190. # (1) win32 - via a zip file
  191. # (2) linux - via a tar file
  192. # (3) linux/cygwin/mingw - via libftdi
  193. # (4) darwin - installed under /usr/local
  194. #
  195. # In case (1) and (2) we need to know where the package was unpacked.
  196. AC_ARG_WITH(ftd2xx-win32-zipdir,
  197. AS_HELP_STRING([--with-ftd2xx-win32-zipdir],[Where (CYGWIN/MINGW) the zip file from ftdichip.com was unpacked (default=search)]),
  198. [
  199. # option present
  200. if test -d $with_ftd2xx_win32_zipdir
  201. then
  202. with_ftd2xx_win32_zipdir=`cd $with_ftd2xx_win32_zipdir && pwd`
  203. AC_MSG_NOTICE([Using: ftdichip.com library: $with_ftd2xx_win32_zipdir])
  204. else
  205. AC_MSG_ERROR([Parameter to --with-ftd2xx-win32-zipdir is not a dir: $with_ftd2xx_win32_zipdir])
  206. fi
  207. ], [true])
  208. AC_ARG_WITH(ftd2xx-linux-tardir,
  209. AS_HELP_STRING([--with-ftd2xx-linux-tardir], [Where (Linux/Unix) the tar file from ftdichip.com was unpacked (default=search)]),
  210. [
  211. # Option present
  212. if test $is_win32 = yes ; then
  213. AC_MSG_ERROR([The option: --with-ftd2xx-linux-tardir is only usable on linux])
  214. fi
  215. if test -d $with_ftd2xx_linux_tardir
  216. then
  217. with_ftd2xx_linux_tardir=`cd $with_ftd2xx_linux_tardir && pwd`
  218. AC_MSG_NOTICE([Using: ftdichip.com library: $with_ftd2xx_linux_tardir])
  219. else
  220. AC_MSG_ERROR([Parameter to --with-ftd2xx-linux-tardir is not a dir: $with_ftd2xx_linux_tardir])
  221. fi
  222. ], [true])
  223. AC_ARG_WITH(ftd2xx-lib,
  224. AS_HELP_STRING([--with-ftd2xx-lib],
  225. [Use static or shared ftd2xx libs (default=static)]),
  226. [
  227. case "$withval" in
  228. static)
  229. with_ftd2xx_lib=$withval
  230. ;;
  231. shared)
  232. with_ftd2xx_lib=$withval
  233. ;;
  234. *)
  235. AC_MSG_ERROR([Option: --with-ftd2xx-lib=static or --with-ftd2xx-lib=shared not, $withval])
  236. ;;
  237. esac
  238. ], [
  239. # Default is static - it is simpler :-(
  240. with_ftd2xx_lib=static
  241. ])
  242. AC_ARG_ENABLE([doxygen-html],
  243. AS_HELP_STRING([--disable-doxygen-html],
  244. [Disable building Doxygen manual as HTML.]),
  245. [doxygen_as_html=$enableval], [doxygen_as_html=yes])
  246. AC_SUBST([doxygen_as_html])
  247. AC_MSG_CHECKING([whether to build Doxygen as HTML])
  248. AC_MSG_RESULT([$doxygen_as_html])
  249. AC_ARG_ENABLE([doxygen-pdf],
  250. AS_HELP_STRING([--enable-doxygen-pdf],
  251. [Enable building Doxygen manual as PDF.]),
  252. [doxygen_as_pdf=$enableval], [doxygen_as_pdf=no])
  253. AC_SUBST([doxygen_as_pdf])
  254. AC_MSG_CHECKING([whether to build Doxygen as PDF])
  255. AC_MSG_RESULT([$doxygen_as_pdf])
  256. AC_ARG_ENABLE([gccwarnings],
  257. AS_HELP_STRING([--disable-gccwarnings], [Disable compiler warnings]),
  258. [gcc_warnings=$enableval], [gcc_warnings=yes])
  259. AC_ARG_ENABLE([wextra],
  260. AS_HELP_STRING([--disable-wextra], [Disable extra compiler warnings]),
  261. [gcc_wextra=$enableval], [gcc_wextra=$gcc_warnings])
  262. AC_ARG_ENABLE([werror],
  263. AS_HELP_STRING([--disable-werror], [Do not treat warnings as errors]),
  264. [gcc_werror=$enableval], [gcc_werror=$gcc_warnings])
  265. # set default verbose options, overridden by following options
  266. debug_jtag_io=no
  267. debug_usb_io=no
  268. debug_usb_comms=no
  269. AC_ARG_ENABLE([verbose],
  270. AS_HELP_STRING([--enable-verbose],
  271. [Enable verbose JTAG I/O messages (for debugging).]),
  272. [
  273. debug_jtag_io=$enableval
  274. debug_usb_io=$enableval
  275. debug_usb_comms=$enableval
  276. ], [])
  277. AC_ARG_ENABLE([verbose_jtag_io],
  278. AS_HELP_STRING([--enable-verbose-jtag-io],
  279. [Enable verbose JTAG I/O messages (for debugging).]),
  280. [debug_jtag_io=$enableval], [])
  281. AC_ARG_ENABLE([verbose_usb_io],
  282. AS_HELP_STRING([--enable-verbose-usb-io],
  283. [Enable verbose USB I/O messages (for debugging)]),
  284. [debug_usb_io=$enableval], [])
  285. AC_ARG_ENABLE([verbose_usb_comms],
  286. AS_HELP_STRING([--enable-verbose-usb-comms],
  287. [Enable verbose USB communication messages (for debugging)]),
  288. [debug_usb_comms=$enableval], [])
  289. AC_MSG_CHECKING([whether to enable verbose JTAG I/O messages]);
  290. AC_MSG_RESULT([$debug_jtag_io])
  291. if test $debug_jtag_io = yes; then
  292. AC_DEFINE([_DEBUG_JTAG_IO_],[1], [Print verbose JTAG I/O messages])
  293. fi
  294. AC_MSG_CHECKING([whether to enable verbose USB I/O messages]);
  295. AC_MSG_RESULT([$debug_usb_io])
  296. if test $debug_usb_io = yes; then
  297. AC_DEFINE([_DEBUG_USB_IO_],[1], [Print verbose USB I/O messages])
  298. fi
  299. AC_MSG_CHECKING([whether to enable verbose USB communication messages]);
  300. AC_MSG_RESULT([$debug_usb_comms])
  301. if test $debug_usb_comms = yes; then
  302. AC_DEFINE([_DEBUG_USB_COMMS_],[1], [Print verbose USB communication messages])
  303. fi
  304. debug_malloc=no
  305. AC_ARG_ENABLE([malloc_logging],
  306. AS_HELP_STRING([--enable-malloc-logging],
  307. [Include free space in logging messages (requires malloc.h).]),
  308. [debug_malloc=$enableval], [])
  309. AC_MSG_CHECKING([whether to enable malloc free space logging]);
  310. AC_MSG_RESULT([$debug_malloc])
  311. if test $debug_malloc = yes; then
  312. AC_DEFINE([_DEBUG_FREE_SPACE_],[1], [Include malloc free space in logging])
  313. fi
  314. AC_ARG_ENABLE([dummy],
  315. AS_HELP_STRING([--enable-dummy], [Enable building the dummy port driver]),
  316. [build_dummy=$enableval], [build_dummy=no])
  317. AC_ARG_ENABLE([parport],
  318. AS_HELP_STRING([--enable-parport], [Enable building the pc parallel port driver]),
  319. [build_parport=$enableval], [build_parport=no])
  320. AC_ARG_ENABLE([parport_ppdev],
  321. AS_HELP_STRING([--disable-parport-ppdev],
  322. [Disable use of ppdev (/dev/parportN) for parport (for x86 only)]),
  323. [parport_use_ppdev=$enableval], [parport_use_ppdev=yes])
  324. AC_ARG_ENABLE([parport_giveio],
  325. AS_HELP_STRING([--enable-parport-giveio],
  326. [Enable use of giveio for parport (for CygWin only)]),
  327. [parport_use_giveio=$enableval], [parport_use_giveio=])
  328. AC_ARG_ENABLE([ft2232_libftdi],
  329. AS_HELP_STRING([--enable-ft2232_libftdi], [Enable building support for FT2232 based devices using the libftdi driver, opensource alternate of FTD2XX]),
  330. [build_ft2232_libftdi=$enableval], [build_ft2232_libftdi=no])
  331. AC_ARG_ENABLE([ft2232_ftd2xx],
  332. AS_HELP_STRING([--enable-ft2232_ftd2xx], [Enable building support for FT2232 based devices using the FTD2XX driver from ftdichip.com]),
  333. [build_ft2232_ftd2xx=$enableval], [build_ft2232_ftd2xx=no])
  334. AC_ARG_ENABLE([ftdi],
  335. AS_HELP_STRING([--enable-ftdi], [Enable building support for the MPSSE mode of FTDI based devices, using libusb-1.0 in asynchronous mode]),
  336. [build_ftdi=$enableval], [build_ftdi=no])
  337. AC_ARG_ENABLE([usb_blaster_libftdi],
  338. AS_HELP_STRING([--enable-usb_blaster_libftdi], [Enable building support for the Altera USB-Blaster using the libftdi driver, opensource alternate of FTD2XX]),
  339. [build_usb_blaster_libftdi=$enableval], [build_usb_blaster_libftdi=no])
  340. AC_ARG_ENABLE([usb_blaster_ftd2xx],
  341. AS_HELP_STRING([--enable-usb_blaster_ftd2xx], [Enable building support for the Altera USB-Blaster using the FTD2XX driver from ftdichip.com]),
  342. [build_usb_blaster_ftd2xx=$enableval], [build_usb_blaster_ftd2xx=no])
  343. AC_ARG_ENABLE([amtjtagaccel],
  344. AS_HELP_STRING([--enable-amtjtagaccel], [Enable building the Amontec JTAG-Accelerator driver]),
  345. [build_amtjtagaccel=$enableval], [build_amtjtagaccel=no])
  346. AC_ARG_ENABLE([zy1000_master],
  347. AS_HELP_STRING([--enable-zy1000-master], [Use ZY1000 JTAG master registers]),
  348. [build_zy1000_master=$enableval], [build_zy1000_master=no])
  349. AC_ARG_ENABLE([zy1000],
  350. AS_HELP_STRING([--enable-zy1000], [Enable ZY1000 interface]),
  351. [build_zy1000=$enableval], [build_zy1000=no])
  352. AC_ARG_ENABLE([ioutil],
  353. AS_HELP_STRING([--enable-ioutil], [Enable ioutil functions - useful for standalone OpenOCD implementations]),
  354. [build_ioutil=$enableval], [build_ioutil=no])
  355. case "${host_cpu}" in
  356. arm*)
  357. AC_ARG_ENABLE([ep93xx],
  358. AS_HELP_STRING([--enable-ep93xx], [Enable building support for EP93xx based SBCs]),
  359. [build_ep93xx=$enableval], [build_ep93xx=no])
  360. AC_ARG_ENABLE([at91rm9200],
  361. AS_HELP_STRING([--enable-at91rm9200], [Enable building support for AT91RM9200 based SBCs]),
  362. [build_at91rm9200=$enableval], [build_at91rm9200=no])
  363. ;;
  364. *)
  365. build_ep93xx=no
  366. build_at91rm9200=no
  367. ;;
  368. esac
  369. AC_ARG_ENABLE([gw16012],
  370. AS_HELP_STRING([--enable-gw16012], [Enable building support for the Gateworks GW16012 JTAG Programmer]),
  371. [build_gw16012=$enableval], [build_gw16012=no])
  372. AC_ARG_ENABLE([presto_libftdi],
  373. AS_HELP_STRING([--enable-presto_libftdi], [Enable building support for ASIX Presto Programmer using the libftdi driver]),
  374. [build_presto_libftdi=$enableval], [build_presto_libftdi=no])
  375. AC_ARG_ENABLE([presto_ftd2xx],
  376. AS_HELP_STRING([--enable-presto_ftd2xx], [Enable building support for ASIX Presto Programmer using the FTD2XX driver]),
  377. [build_presto_ftd2xx=$enableval], [build_presto_ftd2xx=no])
  378. AC_ARG_ENABLE([usbprog],
  379. AS_HELP_STRING([--enable-usbprog], [Enable building support for the usbprog JTAG Programmer]),
  380. [build_usbprog=$enableval], [build_usbprog=no])
  381. AC_ARG_ENABLE([oocd_trace],
  382. AS_HELP_STRING([--enable-oocd_trace],
  383. [Enable building support for some prototype OpenOCD+trace ETM capture hardware]),
  384. [build_oocd_trace=$enableval], [build_oocd_trace=no])
  385. AC_ARG_ENABLE([jlink],
  386. AS_HELP_STRING([--enable-jlink], [Enable building support for the Segger J-Link JTAG Programmer]),
  387. [build_jlink=$enableval], [build_jlink=no])
  388. AC_ARG_ENABLE([vsllink],
  389. AS_HELP_STRING([--enable-vsllink], [Enable building support for the Versaloon-Link JTAG Programmer]),
  390. [build_vsllink=$enableval], [build_vsllink=no])
  391. AC_ARG_ENABLE([rlink],
  392. AS_HELP_STRING([--enable-rlink], [Enable building support for the Raisonance RLink JTAG Programmer]),
  393. [build_rlink=$enableval], [build_rlink=no])
  394. AC_ARG_ENABLE([ulink],
  395. AS_HELP_STRING([--enable-ulink], [Enable building support for the Keil ULINK JTAG Programmer]),
  396. [build_ulink=$enableval], [build_ulink=no])
  397. AC_ARG_ENABLE([arm-jtag-ew],
  398. AS_HELP_STRING([--enable-arm-jtag-ew], [Enable building support for the Olimex ARM-JTAG-EW Programmer]),
  399. [build_armjtagew=$enableval], [build_armjtagew=no])
  400. AC_ARG_ENABLE([buspirate],
  401. AS_HELP_STRING([--enable-buspirate], [Enable building support for the Buspirate]),
  402. [build_buspirate=$enableval], [build_buspirate=no])
  403. AC_ARG_ENABLE([stlink],
  404. AS_HELP_STRING([--enable-stlink], [Enable building support for the ST-Link JTAG Programmer]),
  405. [build_hladapter_stlink=$enableval], [build_hladapter_stlink=no])
  406. AC_ARG_ENABLE([ti-icdi],
  407. AS_HELP_STRING([--enable-ti-icdi], [Enable building support for the TI ICDI JTAG Programmer]),
  408. [build_hladapter_icdi=$enableval], [build_hladapter_icdi=no])
  409. AC_ARG_ENABLE([osbdm],
  410. AS_HELP_STRING([--enable-osbdm], [Enable building support for the OSBDM (JTAG only) Programmer]),
  411. [build_osbdm=$enableval], [build_osbdm=no])
  412. AC_ARG_ENABLE([opendous],
  413. AS_HELP_STRING([--enable-opendous], [Enable building support for the estick/opendous JTAG Programmer]),
  414. [build_opendous=$enableval], [build_opendous=no])
  415. AC_ARG_ENABLE([sysfsgpio],
  416. AS_HELP_STRING([--enable-sysfsgpio], [Enable building support for programming driven via sysfs gpios.]),
  417. [build_sysfsgpio=$enableval], [build_sysfsgpio=no])
  418. AC_ARG_ENABLE([minidriver_dummy],
  419. AS_HELP_STRING([--enable-minidriver-dummy], [Enable the dummy minidriver.]),
  420. [build_minidriver_dummy=$enableval], [build_minidriver_dummy=no])
  421. AC_ARG_ENABLE([internal-jimtcl],
  422. AS_HELP_STRING([--disable-internal-jimtcl], [Disable building internal jimtcl]),
  423. [use_internal_jimtcl=$enableval], [use_internal_jimtcl=yes])
  424. AC_ARG_ENABLE([libusb0],
  425. AS_HELP_STRING([--enable-libusb0], [Use libusb-0.1 library for USB JTAG devices]),
  426. [check_libusb0=$enableval], [check_libusb0=no])
  427. build_minidriver=no
  428. AC_MSG_CHECKING([whether to enable ZY1000 minidriver])
  429. if test $build_zy1000 = yes; then
  430. if test $build_minidriver = yes; then
  431. AC_MSG_ERROR([Multiple minidriver options have been enabled.])
  432. fi
  433. AC_DEFINE([HAVE_JTAG_MINIDRIVER_H], [1],
  434. [Define to 1 if you have the <jtag_minidriver.h> header file.])
  435. build_minidriver=yes
  436. fi
  437. AC_MSG_RESULT([$build_zy1000])
  438. AC_ARG_ENABLE([remote-bitbang],
  439. AS_HELP_STRING([--enable-remote-bitbang], [Enable building support for the Remote Bitbang jtag driver]),
  440. [build_remote_bitbang=$enableval], [build_remote_bitbang=no])
  441. AC_MSG_CHECKING([whether to enable dummy minidriver])
  442. if test $build_minidriver_dummy = yes; then
  443. if test $build_minidriver = yes; then
  444. AC_MSG_ERROR([Multiple minidriver options have been enabled.])
  445. fi
  446. build_minidriver=yes
  447. AC_DEFINE([BUILD_MINIDRIVER_DUMMY], [1], [Use the dummy minidriver.])
  448. AC_DEFINE([HAVE_JTAG_MINIDRIVER_H], [1],
  449. [Define to 1 if you have the <jtag_minidriver.h> header file.])
  450. fi
  451. AC_MSG_RESULT([$build_minidriver_dummy])
  452. AC_MSG_CHECKING([whether standard drivers can be built])
  453. if test "$build_minidriver" = yes; then
  454. AC_MSG_RESULT([no])
  455. AC_MSG_WARN([Using the minidriver disables all other drivers.])
  456. sleep 2
  457. else
  458. AC_MSG_RESULT([yes])
  459. fi
  460. case "${host_cpu}" in
  461. i?86|x86*)
  462. ;;
  463. *)
  464. if test x$parport_use_ppdev = xno; then
  465. AC_MSG_WARN([--disable-parport-ppdev is not supported by the host CPU])
  466. fi
  467. parport_use_ppdev=yes
  468. ;;
  469. esac
  470. case $host in
  471. *-cygwin*)
  472. is_win32=yes
  473. parport_use_ppdev=no
  474. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[return __MINGW32__;]])],
  475. [is_mingw=yes],[is_mingw=no])
  476. if test $is_mingw = yes; then
  477. AC_DEFINE([IS_MINGW], [1], [1 if building for MinGW.])
  478. if test x$parport_use_giveio = xno; then
  479. AC_MSG_WARN([--disable-parport-giveio is not supported by MinGW32 hosts])
  480. fi
  481. parport_use_giveio=yes
  482. is_cygwin=no
  483. else
  484. is_cygwin=yes
  485. AC_DEFINE([IS_CYGWIN], [1], [1 if building for Cygwin.])
  486. # sys/io.h needed under cygwin for parport access
  487. if test $build_parport = yes; then
  488. AC_CHECK_HEADERS([sys/io.h],[],AC_MSG_ERROR([Please install the cygwin ioperm package]))
  489. fi
  490. fi
  491. AC_DEFINE([IS_WIN32], [1], [1 if building for Win32.])
  492. AC_DEFINE([IS_DARWIN], [0], [0 if not building for Darwin.])
  493. ;;
  494. *-mingw*)
  495. is_mingw=yes
  496. is_win32=yes
  497. parport_use_ppdev=no
  498. if test x$parport_use_giveio = xno; then
  499. AC_MSG_WARN([--disable-parport-giveio is not supported by MinGW32 hosts])
  500. fi
  501. parport_use_giveio=yes
  502. if test x$build_buspirate = xyes; then
  503. AC_MSG_ERROR([buspirate currently not supported by MinGW32 hosts])
  504. fi
  505. CFLAGS="$CFLAGS -D__USE_MINGW_ANSI_STDIO"
  506. AC_DEFINE([IS_MINGW], [1], [1 if building for MinGW.])
  507. AC_DEFINE([IS_WIN32], [1], [1 if building for Win32.])
  508. AC_DEFINE([IS_DARWIN], [0], [0 if not building for Darwin.])
  509. ;;
  510. *darwin*)
  511. is_darwin=yes
  512. if test x$parport_use_giveio = xyes; then
  513. AC_MSG_WARN([--enable-parport-giveio cannot be used by Darwin hosts])
  514. fi
  515. parport_use_giveio=no
  516. AC_DEFINE([IS_CYGWIN], [0], [0 if not building for Cygwin.])
  517. AC_DEFINE([IS_WIN32], [0], [0 if not building for Win32.])
  518. AC_DEFINE([IS_DARWIN], [1], [1 if building for Darwin.])
  519. ;;
  520. *)
  521. if test x$parport_use_giveio = xyes; then
  522. AC_MSG_WARN([--enable-parport-giveio cannot be used by ]$host[ hosts])
  523. fi
  524. parport_use_giveio=no
  525. AC_DEFINE([IS_CYGWIN], [0], [0 if not building for Cygwin.])
  526. AC_DEFINE([IS_WIN32], [0], [0 if not building for Win32.])
  527. AC_DEFINE([IS_DARWIN], [0], [0 if not building for Darwin.])
  528. ;;
  529. esac
  530. if test $build_parport = yes; then
  531. build_bitbang=yes
  532. AC_DEFINE([BUILD_PARPORT], [1], [1 if you want parport.])
  533. else
  534. AC_DEFINE([BUILD_PARPORT], [0], [0 if you don't want parport.])
  535. fi
  536. if test $build_dummy = yes; then
  537. build_bitbang=yes
  538. AC_DEFINE([BUILD_DUMMY], [1], [1 if you want dummy driver.])
  539. else
  540. AC_DEFINE([BUILD_DUMMY], [0], [0 if you don't want dummy driver.])
  541. fi
  542. if test $build_ep93xx = yes; then
  543. build_bitbang=yes
  544. AC_DEFINE([BUILD_EP93XX], [1], [1 if you want ep93xx.])
  545. else
  546. AC_DEFINE([BUILD_EP93XX], [0], [0 if you don't want ep93xx.])
  547. fi
  548. if test $build_zy1000 = yes; then
  549. AC_DEFINE([BUILD_ZY1000], [1], [1 if you want ZY1000.])
  550. else
  551. AC_DEFINE([BUILD_ZY1000], [0], [0 if you don't want ZY1000.])
  552. fi
  553. if test $build_zy1000_master = yes; then
  554. AC_DEFINE([BUILD_ZY1000_MASTER], [1], [1 if you want ZY1000 JTAG master registers.])
  555. else
  556. AC_DEFINE([BUILD_ZY1000_MASTER], [0], [0 if you don't want ZY1000 JTAG master registers.])
  557. fi
  558. if test $build_at91rm9200 = yes; then
  559. build_bitbang=yes
  560. AC_DEFINE([BUILD_AT91RM9200], [1], [1 if you want at91rm9200.])
  561. else
  562. AC_DEFINE([BUILD_AT91RM9200], [0], [0 if you don't want at91rm9200.])
  563. fi
  564. if test x$parport_use_ppdev = xyes; then
  565. AC_DEFINE([PARPORT_USE_PPDEV], [1], [1 if you want parport to use ppdev.])
  566. else
  567. AC_DEFINE([PARPORT_USE_PPDEV], [0], [0 if you don't want parport to use ppdev.])
  568. fi
  569. if test x$parport_use_giveio = xyes; then
  570. AC_DEFINE([PARPORT_USE_GIVEIO], [1], [1 if you want parport to use giveio.])
  571. else
  572. AC_DEFINE([PARPORT_USE_GIVEIO], [0], [0 if you don't want parport to use giveio.])
  573. fi
  574. if test $build_bitbang = yes; then
  575. AC_DEFINE([BUILD_BITBANG], [1], [1 if you want a bitbang interface.])
  576. else
  577. AC_DEFINE([BUILD_BITBANG], [0], [0 if you don't want a bitbang interface.])
  578. fi
  579. if test $build_ft2232_libftdi = yes; then
  580. AC_DEFINE([BUILD_FT2232_LIBFTDI], [1], [1 if you want libftdi ft2232.])
  581. else
  582. AC_DEFINE([BUILD_FT2232_LIBFTDI], [0], [0 if you don't want libftdi ft2232.])
  583. fi
  584. if test $build_ft2232_ftd2xx = yes; then
  585. AC_DEFINE([BUILD_FT2232_FTD2XX], [1], [1 if you want ftd2xx ft2232.])
  586. else
  587. AC_DEFINE([BUILD_FT2232_FTD2XX], [0], [0 if you don't want ftd2xx ft2232.])
  588. fi
  589. if test $build_ftdi = yes; then
  590. AC_DEFINE([BUILD_FTDI], [1], [1 if you want ftdi.])
  591. else
  592. AC_DEFINE([BUILD_FTDI], [0], [0 if you don't want ftdi.])
  593. fi
  594. if test $build_usb_blaster_libftdi = yes; then
  595. build_bitbang=yes
  596. AC_DEFINE([BUILD_USB_BLASTER_LIBFTDI], [1], [1 if you want libftdi usb_blaster.])
  597. else
  598. AC_DEFINE([BUILD_USB_BLASTER_LIBFTDI], [0], [0 if you don't want libftdi usb_blaster.])
  599. fi
  600. if test $build_usb_blaster_ftd2xx = yes; then
  601. build_bitbang=yes
  602. AC_DEFINE([BUILD_USB_BLASTER_FTD2XX], [1], [1 if you want ftd2xx usb_blaster.])
  603. else
  604. AC_DEFINE([BUILD_USB_BLASTER_FTD2XX], [0], [0 if you don't want ftd2xx usb_blaster.])
  605. fi
  606. if test $build_amtjtagaccel = yes; then
  607. AC_DEFINE([BUILD_AMTJTAGACCEL], [1], [1 if you want the Amontec JTAG-Accelerator driver.])
  608. else
  609. AC_DEFINE([BUILD_AMTJTAGACCEL], [0], [0 if you don't want the Amontec JTAG-Accelerator driver.])
  610. fi
  611. if test $build_gw16012 = yes; then
  612. AC_DEFINE([BUILD_GW16012], [1], [1 if you want the Gateworks GW16012 driver.])
  613. else
  614. AC_DEFINE([BUILD_GW16012], [0], [0 if you don't want the Gateworks GW16012 driver.])
  615. fi
  616. if test $build_presto_libftdi = yes; then
  617. build_bitq=yes
  618. AC_DEFINE([BUILD_PRESTO_LIBFTDI], [1], [1 if you want the ASIX PRESTO driver using libftdi.])
  619. else
  620. AC_DEFINE([BUILD_PRESTO_LIBFTDI], [0], [0 if you don't want the ASIX PRESTO driver using libftdi.])
  621. fi
  622. if test $build_presto_ftd2xx = yes; then
  623. build_bitq=yes
  624. AC_DEFINE([BUILD_PRESTO_FTD2XX], [1], [1 if you want the ASIX PRESTO driver using FTD2XX.])
  625. else
  626. AC_DEFINE([BUILD_PRESTO_FTD2XX], [0], [0 if you don't want the ASIX PRESTO driver using FTD2XX.])
  627. fi
  628. if test $build_bitq = yes; then
  629. AC_DEFINE([BUILD_BITQ], [1], [1 if you want a bitq interface.])
  630. else
  631. AC_DEFINE([BUILD_BITQ], [0], [0 if you don't want a bitq interface.])
  632. fi
  633. if test $build_usbprog = yes; then
  634. AC_DEFINE([BUILD_USBPROG], [1], [1 if you want the usbprog JTAG driver.])
  635. else
  636. AC_DEFINE([BUILD_USBPROG], [0], [0 if you don't want the usbprog JTAG driver.])
  637. fi
  638. if test $build_oocd_trace = yes; then
  639. AC_DEFINE([BUILD_OOCD_TRACE], [1], [1 if you want the OpenOCD+trace ETM capture driver.])
  640. else
  641. AC_DEFINE([BUILD_OOCD_TRACE], [0], [0 if you don't want the OpenOCD+trace ETM capture driver.])
  642. fi
  643. if test $build_jlink = yes; then
  644. AC_DEFINE([BUILD_JLINK], [1], [1 if you want the J-Link JTAG driver.])
  645. else
  646. AC_DEFINE([BUILD_JLINK], [0], [0 if you don't want the J-Link JTAG driver.])
  647. fi
  648. if test $build_vsllink = yes; then
  649. AC_DEFINE([BUILD_VSLLINK], [1], [1 if you want the Versaloon-Link JTAG driver.])
  650. else
  651. AC_DEFINE([BUILD_VSLLINK], [0], [0 if you don't want the Versaloon-Link JTAG driver.])
  652. fi
  653. if test $build_rlink = yes; then
  654. AC_DEFINE([BUILD_RLINK], [1], [1 if you want the RLink JTAG driver.])
  655. else
  656. AC_DEFINE([BUILD_RLINK], [0], [0 if you don't want the RLink JTAG driver.])
  657. fi
  658. if test $build_ulink = yes; then
  659. AC_DEFINE([BUILD_ULINK], [1], [1 if you want the ULINK JTAG driver.])
  660. else
  661. AC_DEFINE([BUILD_ULINK], [0], [0 if you don't want the ULINK JTAG driver.])
  662. fi
  663. if test $build_armjtagew = yes; then
  664. AC_DEFINE([BUILD_ARMJTAGEW], [1], [1 if you want the ARM-JTAG-EW JTAG driver.])
  665. else
  666. AC_DEFINE([BUILD_ARMJTAGEW], [0], [0 if you don't want the ARM-JTAG-EW JTAG driver.])
  667. fi
  668. if test $build_buspirate = yes; then
  669. AC_DEFINE([BUILD_BUSPIRATE], [1], [1 if you want the Buspirate JTAG driver.])
  670. else
  671. AC_DEFINE([BUILD_BUSPIRATE], [0], [0 if you don't want the Buspirate JTAG driver.])
  672. fi
  673. if test $build_hladapter_stlink = yes -o $build_hladapter_icdi = yes; then
  674. AC_DEFINE([BUILD_HLADAPTER], [1], [1 if you want the High Level JTAG driver.])
  675. else
  676. AC_DEFINE([BUILD_HLADAPTER], [0], [0 if you don't want the High Level JTAG driver.])
  677. fi
  678. if test $build_osbdm = yes; then
  679. AC_DEFINE([BUILD_OSBDM], [1], [1 if you want the OSBDM driver.])
  680. else
  681. AC_DEFINE([BUILD_OSBDM], [0], [0 if you don't want the OSBDM driver.])
  682. fi
  683. if test $build_opendous = yes; then
  684. AC_DEFINE([BUILD_OPENDOUS], [1], [1 if you want the estick/opendous JTAG driver.])
  685. else
  686. AC_DEFINE([BUILD_OPENDOUS], [0], [0 if you don't want the estick/opendous JTAG driver.])
  687. fi
  688. if test "$use_internal_jimtcl" = yes; then
  689. if test -f "$srcdir/jimtcl/configure.ac"; then
  690. AX_CONFIG_SUBDIR_OPTION([jimtcl], [--disable-install-jim])
  691. else
  692. AC_MSG_ERROR([jimtcl not found, run git submodule init and git submodule update.])
  693. fi
  694. fi
  695. if test $build_remote_bitbang = yes; then
  696. build_bitbang=yes
  697. AC_DEFINE([BUILD_REMOTE_BITBANG], [1], [1 if you want the Remote Bitbang JTAG driver.])
  698. else
  699. AC_DEFINE([BUILD_REMOTE_BITBANG], [0], [0 if you don't want the Remote Bitbang JTAG driver.])
  700. fi
  701. if test $build_sysfsgpio = yes; then
  702. build_bitbang=yes
  703. AC_DEFINE([BUILD_SYSFSGPIO], [1], [1 if you want the SysfsGPIO driver.])
  704. else
  705. AC_DEFINE([BUILD_SYSFSGPIO], [0], [0 if you don't want SysfsGPIO driver.])
  706. fi
  707. #-- Deal with MingW/Cygwin FTD2XX issues
  708. if test $is_win32 = yes; then
  709. if test "${with_ftd2xx_linux_tardir+set}" = set
  710. then
  711. AC_MSG_ERROR([The option: with_ftd2xx_linux_tardir is for LINUX only.])
  712. fi
  713. if test $build_ft2232_ftd2xx = yes -o $build_presto_ftd2xx = yes -o $build_usb_blaster_ftd2xx = yes ; then
  714. AC_MSG_CHECKING([for ftd2xx.lib exists (win32)])
  715. # if we are given a zipdir...
  716. if test "${with_ftd2xx_win32_zipdir+set}" = set
  717. then
  718. # Set the CFLAGS for "ftd2xx.h"
  719. f=$with_ftd2xx_win32_zipdir/ftd2xx.h
  720. if test ! -f $f ; then
  721. AC_MSG_ERROR([File: $f cannot be found])
  722. fi
  723. CFLAGS="$CFLAGS -I$with_ftd2xx_win32_zipdir"
  724. # And calculate the LDFLAGS for the machine
  725. case "$host_cpu" in
  726. i?86|x86_32)
  727. LDFLAGS="$LDFLAGS -L$with_ftd2xx_win32_zipdir/i386"
  728. LIBS="$LIBS -lftd2xx"
  729. f=$with_ftd2xx_win32_zipdir/i386/ftd2xx.lib
  730. ;;
  731. amd64|x86_64)
  732. LDFLAGS="$LDFLAGS -L$with_ftd2xx_win32_zipdir/amd64"
  733. LIBS="$LIBS -lftd2xx"
  734. f=$with_ftd2xx_win32_zipdir/amd64/ftd2xx.lib
  735. ;;
  736. *)
  737. AC_MSG_ERROR([Unknown Win32 host cpu: $host_cpu])
  738. ;;
  739. esac
  740. if test ! -f $f ; then
  741. AC_MSG_ERROR([Library: $f not found])
  742. fi
  743. else
  744. LIBS="$LIBS -lftd2xx"
  745. AC_MSG_WARN([ASSUMPTION: The (win32) FTDICHIP.COM files: ftd2xx.h and ftd2xx.lib are in a proper place])
  746. fi
  747. fi
  748. fi # win32
  749. if test $is_darwin = yes ; then
  750. if test "${with_ftd2xx_win32_zipdir+set}" = set
  751. then
  752. AC_MSG_ERROR([The option: --with-ftd2xx-win32-zipdir is for win32 only])
  753. fi
  754. if test "${with_ftd2xx_linux_tardir+set}" = set
  755. then
  756. AC_MSG_ERROR([The option: with_ftd2xx_linux_tardir is for LINUX only.])
  757. fi
  758. if test $build_ft2232_ftd2xx = yes -o $build_presto_ftd2xx = yes -o $build_usb_blaster_ftd2xx = yes ; then
  759. AC_MSG_CHECKING([for libftd2xx.a (darwin)])
  760. if test ! -f /usr/local/include/ftd2xx.h ; then
  761. AC_MSG_ERROR([ftd2xx library from FTDICHIP.com seems to be missing, cannot find: /usr/local/include/ftd2xx.h])
  762. fi
  763. CFLAGS="$CFLAGS -I/usr/local/include"
  764. LDFLAGS="$LDFLAGS -L/usr/local/lib"
  765. LIBS="$LIBS -lftd2xx"
  766. AC_MSG_RESULT([-L/usr/local/lib -lftd2xx])
  767. fi
  768. fi # darwin
  769. if test $is_win32 = no && test $is_darwin = no ; then
  770. if test "${with_ftd2xx_win32_zipdir+set}" = set
  771. then
  772. AC_MSG_ERROR([The option: --with-ftd2xx-win32-zipdir is for win32 only])
  773. fi
  774. if test $build_ft2232_ftd2xx = yes -o $build_presto_ftd2xx = yes -o $build_usb_blaster_ftd2xx = yes ; then
  775. # Must be linux
  776. if test $host_os != linux-gnu && test $host_os != linux ; then
  777. AC_MSG_ERROR([The (linux) ftd2xx library from FTDICHIP.com is linux only. Try --enable-ft2232-libftdi instead])
  778. fi
  779. # Are we given a TAR directory?
  780. if test "${with_ftd2xx_linux_tardir+set}" = set
  781. then
  782. AC_MSG_CHECKING([uninstalled ftd2xx distribution])
  783. # The .H file is simple..
  784. FTD2XX_H=$with_ftd2xx_linux_tardir/ftd2xx.h
  785. if test ! -f "${FTD2XX_H}"; then
  786. AC_MSG_ERROR([Option: --with-ftd2xx-linux-tardir appears wrong, cannot find: ${FTD2XX_H}])
  787. fi
  788. CFLAGS="$CFLAGS -I$with_ftd2xx_linux_tardir"
  789. if test $with_ftd2xx_lib = shared; then
  790. FTD2XX_LDFLAGS="-L$with_ftd2xx_linux_tardir"
  791. FTD2XX_LIB="-lftd2xx"
  792. else
  793. # Test #1 - v1.0.x
  794. case "$host_cpu" in
  795. i?86|x86_32)
  796. dir=build/i386;;
  797. amd64|x86_64)
  798. dir=build/x86_64;;
  799. *)
  800. dir=none;;
  801. esac
  802. if test -f "$with_ftd2xx_linux_tardir/$dir/libftd2xx.a"; then
  803. FTD2XX_LDFLAGS="-L$with_ftd2xx_linux_tardir/$dir"
  804. # Also needs -lrt
  805. FTD2XX_LIB="-lftd2xx -lrt"
  806. else
  807. # Test Number2.
  808. # Grr.. perhaps it exists as a version number?
  809. FTD2XX_LIB="$with_ftd2xx_linux_tardir/static_lib/libftd2xx.a.*.*.*"
  810. count=`ls ${FTD2XX_LIB} | wc -l`
  811. if test $count -gt 1 ; then
  812. AC_MSG_ERROR([Multiple libftd2xx.a files found in: $with_ftd2xx_linux_tardir/static_lib sorry cannot handle this yet])
  813. fi
  814. if test $count -ne 1 ; then
  815. AC_MSG_ERROR([Not found: $f, option: --with-ftd2xx-linux-tardir appears to be wrong])
  816. fi
  817. # Because the "-l" rules do not understand version numbers...
  818. # we will just stuff the absolute path onto the LIBS variable
  819. FTD2XX_LIB="`ls ${FTD2XX_LIB}` -lpthread"
  820. FTD2XX_LDFLAGS=""
  821. fi
  822. fi
  823. LDFLAGS="${LDFLAGS} ${FTD2XX_LDFLAGS}"
  824. LIBS="${FTD2XX_LIB} ${LIBS}"
  825. AC_MSG_RESULT([${FTD2XX_LDFLAGS} ${FTD2XX_LIB}])
  826. else
  827. AC_CHECK_HEADER([ftd2xx.h],[],[
  828. AC_MSG_ERROR([You seem to be missing the FTD2xx driver header file.])
  829. ])
  830. AC_SEARCH_LIBS([FT_GetLibraryVersion],[ftd2xx],,[
  831. AC_MSG_ERROR([You appear to be missing the FTD2xx driver library.])
  832. ],[])
  833. fi
  834. fi
  835. fi # linux
  836. if test $build_ft2232_ftd2xx = yes -o $build_presto_ftd2xx = yes -o $build_usb_blaster_ftd2xx = yes ; then
  837. # Before we go any further - make sure we can *BUILD* and *RUN*
  838. # a simple app with the "ftd2xx.lib" file - in what ever form we where given
  839. # We should be able to compile, link and run this test program now
  840. AC_MSG_CHECKING([whether ftd2xx library works])
  841. #
  842. # Save the LDFLAGS for later..
  843. LDFLAGS_SAVE=$LDFLAGS
  844. CFLAGS_SAVE=$CFLAGS
  845. _LDFLAGS=`eval echo $LDFLAGS`
  846. _CFLAGS=`eval echo $CFLAGS`
  847. LDFLAGS=$_LDFLAGS
  848. CFLAGS=$_CFLAGS
  849. AC_RUN_IFELSE([AC_LANG_PROGRAM([[
  850. #include "confdefs.h"
  851. #if IS_WIN32
  852. #include "windows.h"
  853. #endif
  854. #include <stdio.h>
  855. #include <ftd2xx.h>
  856. ]], [[
  857. DWORD x;
  858. FT_GetLibraryVersion( &x );
  859. ]])], [
  860. AC_MSG_RESULT([Success!])
  861. ], [
  862. AC_MSG_ERROR([Cannot build & run test program using ftd2xx.lib])
  863. ], [
  864. AC_MSG_RESULT([Skipping as we are cross-compiling])
  865. ])
  866. AC_MSG_CHECKING([for ftd2xx highspeed device support])
  867. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  868. #include "confdefs.h"
  869. #if IS_WIN32
  870. #include "windows.h"
  871. #endif
  872. #include <stdio.h>
  873. #include <ftd2xx.h>
  874. DWORD x = FT_DEVICE_4232H;
  875. ]], [])], [
  876. AC_DEFINE([BUILD_FT2232_HIGHSPEED], [1],
  877. [Support FT2232H/FT4232HS with FTD2XX or libftdi.])
  878. build_ft2232_highspeed=yes
  879. ], [
  880. build_ft2232_highspeed=no
  881. ])
  882. AC_MSG_RESULT([$build_ft2232_highspeed])
  883. if test $build_ft2232_highspeed = no; then
  884. AC_MSG_WARN([You need a newer FTD2XX driver (version 2.04.16 or later).])
  885. fi
  886. AC_MSG_CHECKING([for ftd2xx FT232H device support])
  887. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  888. #include "confdefs.h"
  889. #if IS_WIN32
  890. #include "windows.h"
  891. #endif
  892. #include <stdio.h>
  893. #include <ftd2xx.h>
  894. DWORD x = FT_DEVICE_232H;
  895. ]], [])], [
  896. AC_DEFINE([HAS_ENUM_FT232H], [1],
  897. [Support FT232H with FTD2XX or libftdi.])
  898. has_enum_ft232h=yes
  899. ], [
  900. has_enum_ft232h=no
  901. ])
  902. AC_MSG_RESULT([$has_enum_ft232h])
  903. if test $has_enum_ft232h = no; then
  904. AC_MSG_WARN([You need a newer FTD2XX driver (version 2.08.12 or later).])
  905. fi
  906. LDFLAGS=$LDFLAGS_SAVE
  907. CFLAGS=$CFLAGS_SAVE
  908. fi
  909. if test $build_ft2232_libftdi = yes ; then
  910. # We assume: the package is preinstalled in the proper place
  911. # these present as 2 libraries..
  912. LIBS="$LIBS -lftdi -lusb"
  913. #
  914. # Try to build a small program.
  915. AC_MSG_CHECKING([Build & Link with libftdi...])
  916. LDFLAGS_SAVE=$LDFLAGS
  917. CFLAGS_SAVE=$CFLAGS
  918. _LDFLAGS=`eval echo $LDFLAGS`
  919. _CFLAGS=`eval echo $CFLAGS`
  920. LDFLAGS=$_LDFLAGS
  921. CFLAGS=$_CFLAGS
  922. AC_RUN_IFELSE([AC_LANG_PROGRAM([[
  923. #include <stdio.h>
  924. #include <ftdi.h>
  925. ]], [[
  926. struct ftdi_context *p;
  927. p = ftdi_new();
  928. if( p != NULL ){
  929. return 0;
  930. } else {
  931. fprintf( stderr, "calling ftdi_new() failed\n");
  932. return 1;
  933. }
  934. ]])], [
  935. AC_MSG_RESULT([Success])
  936. ], [
  937. AC_MSG_ERROR([Cannot build & run test program using libftdi])
  938. ], [
  939. AC_MSG_RESULT([Skipping as we are cross-compiling])
  940. ])
  941. AC_MSG_CHECKING([for libftdi highspeed device support])
  942. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  943. #include <stdio.h>
  944. #include <ftdi.h>
  945. ]], [[
  946. enum ftdi_chip_type x = TYPE_2232H;
  947. ]])], [
  948. AC_DEFINE([BUILD_FT2232_HIGHSPEED], [1],
  949. [Support FT2232H/FT4232HS with FTD2XX or libftdi.])
  950. build_ft2232_highspeed=yes
  951. ], [
  952. build_ft2232_highspeed=no
  953. ])
  954. AC_MSG_RESULT([$build_ft2232_highspeed])
  955. if test $build_ft2232_highspeed = no; then
  956. AC_MSG_WARN([You need a newer libftdi version (0.16 or later).])
  957. fi
  958. AC_MSG_CHECKING([for libftdi FT232H device support])
  959. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  960. #include <stdio.h>
  961. #include <ftdi.h>
  962. ]], [[
  963. enum ftdi_chip_type x = TYPE_232H;
  964. ]])], [
  965. AC_DEFINE([HAS_ENUM_FT232H], [1],
  966. [Support FT232H with FTD2XX or libftdi.])
  967. has_enum_ft232h=yes
  968. ], [
  969. has_enum_ft232h=no
  970. ])
  971. AC_MSG_RESULT([$has_enum_ft232h])
  972. if test $has_enum_ft232h = no; then
  973. AC_MSG_WARN([You need a newer libftdi version (0.20 or later).])
  974. fi
  975. # Restore the 'unexpanded ldflags'
  976. LDFLAGS=$LDFLAGS_SAVE
  977. CFLAGS=$CFLAGS_SAVE
  978. fi
  979. # check for usb.h when a driver will require it
  980. build_usb=no
  981. if test $build_vsllink = yes -o $build_usbprog = yes -o \
  982. $build_rlink = yes -o $build_ulink = yes -o $build_armjtagew = yes
  983. then
  984. build_usb=yes
  985. fi
  986. # Check for libusb1 ported drivers.
  987. build_usb_ng=no
  988. if test $build_jlink = yes -o $build_hladapter_stlink = yes -o $build_osbdm = yes -o \
  989. $build_opendous = yes -o $build_ftdi = yes -o $build_hladapter_icdi = yes
  990. then
  991. build_usb_ng=yes
  992. fi
  993. # check for libusb library if necessary
  994. use_libusb0=no
  995. use_libusb1=no
  996. if test $build_usb = yes -o $build_usb_ng = yes; then
  997. if test $check_libusb0 = no -a $build_usb_ng = yes; then
  998. AC_CHECK_HEADER([libusb-1.0/libusb.h],
  999. [AC_DEFINE(HAVE_LIBUSB1, 1, [Define if you have libusb-1.0]) check_libusb0=no use_libusb1=yes ],
  1000. [ check_libusb0=yes use_libusb1=no ])
  1001. fi
  1002. if test $check_libusb0 = yes -o $build_usb = yes; then
  1003. AC_CHECK_HEADERS([usb.h], [use_libusb0=yes],
  1004. [AC_MSG_ERROR([libusb or libusb-1.0 are required to build some OpenOCD driver(s)])])
  1005. fi
  1006. fi
  1007. AM_CONDITIONAL([RELEASE], [test $build_release = yes])
  1008. AM_CONDITIONAL([PARPORT], [test $build_parport = yes])
  1009. AM_CONDITIONAL([DUMMY], [test $build_dummy = yes])
  1010. AM_CONDITIONAL([GIVEIO], [test x$parport_use_giveio = xyes])
  1011. AM_CONDITIONAL([EP93XX], [test $build_ep93xx = yes])
  1012. AM_CONDITIONAL([ZY1000], [test $build_zy1000 = yes])
  1013. AM_CONDITIONAL([ZY1000_MASTER], [test $build_zy1000_master = yes])
  1014. AM_CONDITIONAL([IOUTIL], [test $build_ioutil = yes])
  1015. AM_CONDITIONAL([AT91RM9200], [test $build_at91rm9200 = yes])
  1016. AM_CONDITIONAL([BITBANG], [test $build_bitbang = yes])
  1017. AM_CONDITIONAL([FT2232_LIBFTDI], [test $build_ft2232_libftdi = yes])
  1018. AM_CONDITIONAL([FT2232_DRIVER], [test $build_ft2232_ftd2xx = yes -o $build_ft2232_libftdi = yes])
  1019. AM_CONDITIONAL([FTDI_DRIVER], [test $build_ftdi = yes])
  1020. AM_CONDITIONAL([USB_BLASTER_LIBFTDI], [test $build_usb_blaster_libftdi = yes])
  1021. AM_CONDITIONAL([USB_BLASTER_DRIVER], [test $build_usb_blaster_ftd2xx = yes -o $build_usb_blaster_libftdi = yes])
  1022. AM_CONDITIONAL([AMTJTAGACCEL], [test $build_amtjtagaccel = yes])
  1023. AM_CONDITIONAL([GW16012], [test $build_gw16012 = yes])
  1024. AM_CONDITIONAL([PRESTO_LIBFTDI], [test $build_presto_libftdi = yes])
  1025. AM_CONDITIONAL([PRESTO_DRIVER], [test $build_presto_ftd2xx = yes -o $build_presto_libftdi = yes])
  1026. AM_CONDITIONAL([USBPROG], [test $build_usbprog = yes])
  1027. AM_CONDITIONAL([OOCD_TRACE], [test $build_oocd_trace = yes])
  1028. AM_CONDITIONAL([JLINK], [test $build_jlink = yes])
  1029. AM_CONDITIONAL([VSLLINK], [test $build_vsllink = yes])
  1030. AM_CONDITIONAL([RLINK], [test $build_rlink = yes])
  1031. AM_CONDITIONAL([ULINK], [test $build_ulink = yes])
  1032. AM_CONDITIONAL([ARMJTAGEW], [test $build_armjtagew = yes])
  1033. AM_CONDITIONAL([REMOTE_BITBANG], [test $build_remote_bitbang = yes])
  1034. AM_CONDITIONAL([BUSPIRATE], [test $build_buspirate = yes])
  1035. AM_CONDITIONAL([HLADAPTER], [test $build_hladapter_stlink = yes -o $build_hladapter_icdi = yes])
  1036. AM_CONDITIONAL([OSBDM], [test $build_osbdm = yes])
  1037. AM_CONDITIONAL([OPENDOUS], [test $build_opendous = yes])
  1038. AM_CONDITIONAL([SYSFSGPIO], [test $build_sysfsgpio = yes])
  1039. AM_CONDITIONAL([USB], [test $build_usb = yes])
  1040. AM_CONDITIONAL([USB_NG], [test $build_usb_ng = yes])
  1041. AM_CONDITIONAL([USE_LIBUSB0], [test $use_libusb0 = yes])
  1042. AM_CONDITIONAL([USE_LIBUSB1], [test $use_libusb1 = yes])
  1043. AM_CONDITIONAL([IS_CYGWIN], [test $is_cygwin = yes])
  1044. AM_CONDITIONAL([IS_MINGW], [test $is_mingw = ye]s)
  1045. AM_CONDITIONAL([IS_WIN32], [test $is_win32 = ye]s)
  1046. AM_CONDITIONAL([IS_DARWIN], [test $is_darwin = ye]s)
  1047. AM_CONDITIONAL([BITQ], [test $build_bitq = yes])
  1048. AM_CONDITIONAL([MINIDRIVER], [test $build_minidriver = ye]s)
  1049. AM_CONDITIONAL([MINIDRIVER_DUMMY], [test $build_minidriver_dummy = yes])
  1050. AM_CONDITIONAL([INTERNAL_JIMTCL], [test $use_internal_jimtcl = yes])
  1051. # Look for environ alternatives. Possibility #1: is environ in unistd.h or stdlib.h?
  1052. AC_MSG_CHECKING([for environ in unistd.h and stdlib.h])
  1053. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  1054. #define _GNU_SOURCE
  1055. #include <unistd.h>
  1056. #include <stdlib.h>
  1057. ]], [[char **ep = environ;]]
  1058. )], [
  1059. AC_MSG_RESULT([yes])
  1060. has_environ=yes
  1061. ], [
  1062. AC_MSG_RESULT([no])
  1063. # Possibility #2: can environ be found in an available library?
  1064. AC_MSG_CHECKING([for extern environ])
  1065. AC_LINK_IFELSE([AC_LANG_PROGRAM([[
  1066. extern char **environ;
  1067. ]], [[char **ep = environ;]]
  1068. )], [
  1069. AC_DEFINE(NEED_ENVIRON_EXTERN, [1], [Must declare 'environ' to use it.])
  1070. has_environ=yes
  1071. ], [
  1072. has_environ=no
  1073. ])
  1074. AC_MSG_RESULT([${has_environ}])
  1075. ])
  1076. if test "${has_environ}" != "yes" ; then
  1077. AC_MSG_FAILURE([Could not find 'environ' in unistd.h or available libraries.])
  1078. fi
  1079. AC_DEFINE([_GNU_SOURCE],[1],[Use GNU C library extensions (e.g. stdndup).])
  1080. # set default gcc warnings
  1081. GCC_WARNINGS="-Wall -Wstrict-prototypes -Wformat-security -Wshadow"
  1082. if test "${gcc_wextra}" = yes; then
  1083. GCC_WARNINGS="${GCC_WARNINGS} -Wextra -Wno-unused-parameter"
  1084. GCC_WARNINGS="${GCC_WARNINGS} -Wbad-function-cast"
  1085. GCC_WARNINGS="${GCC_WARNINGS} -Wcast-align"
  1086. GCC_WARNINGS="${GCC_WARNINGS} -Wredundant-decls"
  1087. fi
  1088. if test "${gcc_werror}" = yes; then
  1089. GCC_WARNINGS="${GCC_WARNINGS} -Werror"
  1090. fi
  1091. # overide default gcc cflags
  1092. if test $gcc_warnings = yes; then
  1093. CFLAGS="$CFLAGS $GCC_WARNINGS"
  1094. fi
  1095. # Setup for compiling build tools
  1096. AC_MSG_CHECKING([for a C compiler for build tools])
  1097. if test $cross_compiling = yes; then
  1098. AC_CHECK_PROGS(CC_FOR_BUILD, gcc cc)
  1099. CFLAGS_FOR_BUILD="-g -O2 $GCC_WARNINGS"
  1100. else
  1101. CC_FOR_BUILD=$CC
  1102. CFLAGS_FOR_BUILD=$CFLAGS
  1103. fi
  1104. AC_MSG_RESULT([$CC_FOR_BUILD])
  1105. AC_SUBST([CC_FOR_BUILD])
  1106. AC_SUBST([CFLAGS_FOR_BUILD])
  1107. AC_MSG_CHECKING([for suffix of executable build tools])
  1108. if test $cross_compiling = yes; then
  1109. cat >conftest.c <<\_______EOF
  1110. int main ()
  1111. {
  1112. exit (0);
  1113. }
  1114. _______EOF
  1115. for i in .exe ""; do
  1116. compile="$CC_FOR_BUILD conftest.c -o conftest$i"
  1117. if AC_TRY_EVAL(compile); then
  1118. if (./conftest) 2>&AC_FD_CC; then
  1119. EXEEXT_FOR_BUILD=$i
  1120. break
  1121. fi
  1122. fi
  1123. done
  1124. rm -f conftest*
  1125. if test "${EXEEXT_FOR_BUILD+set}" != set; then
  1126. AC_MSG_ERROR([Cannot determine suffix of executable build tools])
  1127. fi
  1128. else
  1129. EXEEXT_FOR_BUILD=$EXEEXT
  1130. fi
  1131. AC_MSG_RESULT([$EXEEXT_FOR_BUILD])
  1132. AC_SUBST([EXEEXT_FOR_BUILD])
  1133. AC_CONFIG_FILES([
  1134. Makefile
  1135. src/Makefile
  1136. src/helper/Makefile
  1137. src/jtag/Makefile
  1138. src/jtag/drivers/Makefile
  1139. src/jtag/hla/Makefile
  1140. src/transport/Makefile
  1141. src/xsvf/Makefile
  1142. src/svf/Makefile
  1143. src/target/Makefile
  1144. src/rtos/Makefile
  1145. src/server/Makefile
  1146. src/flash/Makefile
  1147. src/flash/nor/Makefile
  1148. src/flash/nand/Makefile
  1149. src/pld/Makefile
  1150. doc/Makefile
  1151. ])
  1152. AC_OUTPUT