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.in 36 KiB

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