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.
 
 
 
 
 
 

1366 lines
44 KiB

  1. AC_PREREQ(2.60)
  2. AC_INIT([openocd], [0.8.0-dev],
  3. [OpenOCD Mailing List <openocd-devel@lists.sourceforge.net>])
  4. AC_CONFIG_SRCDIR([src/openocd.c])
  5. m4_include([config_subdir.m4])dnl
  6. AM_INIT_AUTOMAKE([-Wall -Wno-portability dist-bzip2 dist-zip subdir-objects])
  7. AC_CONFIG_HEADERS([config.h])
  8. AH_BOTTOM([
  9. #include <helper/system.h>
  10. #include <helper/types.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. # guess-rev.sh only exists in the repository, not in the released archives
  132. AC_MSG_CHECKING([whether to build a release])
  133. if test -x $srcdir/guess-rev.sh ; then
  134. build_release=no
  135. else
  136. build_release=yes
  137. fi
  138. AC_MSG_RESULT([$build_release])
  139. AC_ARG_WITH(ftd2xx,
  140. AS_HELP_STRING([--with-ftd2xx=<PATH>],[This option has been removed.]),
  141. [
  142. # Option Given.
  143. cat << __EOF__
  144. The option: --with-ftd2xx=<PATH> has been removed.
  145. On Linux, the new option is:
  146. --with-ftd2xx-linux-tardir=/path/to/files
  147. Where <path> is the path the the directory where the "tar.gz" file
  148. from FTDICHIP.COM was unpacked, for example:
  149. --with-ftd2xx-linux-tardir=${HOME}/libftd2xx0.4.16
  150. On Cygwin/MingW32, the new option is:
  151. --with-ftd2xx-win32-zipdir=/path/to/files
  152. Where <path> is the path to the directory where the "zip" file from
  153. FTDICHIP.COM was unpacked, for example:
  154. --with-ftd2xx-win32-zipdir=${HOME}/ftd2xx.cdm.files
  155. __EOF__
  156. AC_MSG_ERROR([Sorry Cannot continue])
  157. ], [true])
  158. #========================================
  159. # FTD2XXX support comes in 4 forms.
  160. # (1) win32 - via a zip file
  161. # (2) linux - via a tar file
  162. # (3) linux/cygwin/mingw - via libftdi
  163. # (4) darwin - installed under /usr/local
  164. #
  165. # In case (1) and (2) we need to know where the package was unpacked.
  166. AC_ARG_WITH(ftd2xx-win32-zipdir,
  167. AS_HELP_STRING([--with-ftd2xx-win32-zipdir],[Where (CYGWIN/MINGW) the zip file from ftdichip.com was unpacked (default=search)]),
  168. [
  169. # option present
  170. if test -d $with_ftd2xx_win32_zipdir
  171. then
  172. with_ftd2xx_win32_zipdir=`cd $with_ftd2xx_win32_zipdir && pwd`
  173. AC_MSG_NOTICE([Using: ftdichip.com library: $with_ftd2xx_win32_zipdir])
  174. else
  175. AC_MSG_ERROR([Parameter to --with-ftd2xx-win32-zipdir is not a dir: $with_ftd2xx_win32_zipdir])
  176. fi
  177. ], [true])
  178. AC_ARG_WITH(ftd2xx-linux-tardir,
  179. AS_HELP_STRING([--with-ftd2xx-linux-tardir], [Where (Linux/Unix) the tar file from ftdichip.com was unpacked (default=search)]),
  180. [
  181. # Option present
  182. if test $is_win32 = yes ; then
  183. AC_MSG_ERROR([The option: --with-ftd2xx-linux-tardir is only usable on linux])
  184. fi
  185. if test -d $with_ftd2xx_linux_tardir
  186. then
  187. with_ftd2xx_linux_tardir=`cd $with_ftd2xx_linux_tardir && pwd`
  188. AC_MSG_NOTICE([Using: ftdichip.com library: $with_ftd2xx_linux_tardir])
  189. else
  190. AC_MSG_ERROR([Parameter to --with-ftd2xx-linux-tardir is not a dir: $with_ftd2xx_linux_tardir])
  191. fi
  192. ], [true])
  193. AC_ARG_WITH(ftd2xx-lib,
  194. AS_HELP_STRING([--with-ftd2xx-lib],
  195. [Use static or shared ftd2xx libs (default=static)]),
  196. [
  197. case "$withval" in
  198. static)
  199. with_ftd2xx_lib=$withval
  200. ;;
  201. shared)
  202. with_ftd2xx_lib=$withval
  203. ;;
  204. *)
  205. AC_MSG_ERROR([Option: --with-ftd2xx-lib=static or --with-ftd2xx-lib=shared not, $withval])
  206. ;;
  207. esac
  208. ], [
  209. # Default is static - it is simpler :-(
  210. with_ftd2xx_lib=static
  211. ])
  212. AC_ARG_ENABLE([doxygen-html],
  213. AS_HELP_STRING([--disable-doxygen-html],
  214. [Disable building Doxygen manual as HTML.]),
  215. [doxygen_as_html=$enableval], [doxygen_as_html=yes])
  216. AC_SUBST([doxygen_as_html])
  217. AC_MSG_CHECKING([whether to build Doxygen as HTML])
  218. AC_MSG_RESULT([$doxygen_as_html])
  219. AC_ARG_ENABLE([doxygen-pdf],
  220. AS_HELP_STRING([--enable-doxygen-pdf],
  221. [Enable building Doxygen manual as PDF.]),
  222. [doxygen_as_pdf=$enableval], [doxygen_as_pdf=no])
  223. AC_SUBST([doxygen_as_pdf])
  224. AC_MSG_CHECKING([whether to build Doxygen as PDF])
  225. AC_MSG_RESULT([$doxygen_as_pdf])
  226. AC_ARG_ENABLE([gccwarnings],
  227. AS_HELP_STRING([--disable-gccwarnings], [Disable compiler warnings]),
  228. [gcc_warnings=$enableval], [gcc_warnings=yes])
  229. AC_ARG_ENABLE([wextra],
  230. AS_HELP_STRING([--disable-wextra], [Disable extra compiler warnings]),
  231. [gcc_wextra=$enableval], [gcc_wextra=$gcc_warnings])
  232. AC_ARG_ENABLE([werror],
  233. AS_HELP_STRING([--disable-werror], [Do not treat warnings as errors]),
  234. [gcc_werror=$enableval], [gcc_werror=$gcc_warnings])
  235. # set default verbose options, overridden by following options
  236. debug_jtag_io=no
  237. debug_usb_io=no
  238. debug_usb_comms=no
  239. AC_ARG_ENABLE([verbose],
  240. AS_HELP_STRING([--enable-verbose],
  241. [Enable verbose JTAG I/O messages (for debugging).]),
  242. [
  243. debug_jtag_io=$enableval
  244. debug_usb_io=$enableval
  245. debug_usb_comms=$enableval
  246. ], [])
  247. AC_ARG_ENABLE([verbose_jtag_io],
  248. AS_HELP_STRING([--enable-verbose-jtag-io],
  249. [Enable verbose JTAG I/O messages (for debugging).]),
  250. [debug_jtag_io=$enableval], [])
  251. AC_ARG_ENABLE([verbose_usb_io],
  252. AS_HELP_STRING([--enable-verbose-usb-io],
  253. [Enable verbose USB I/O messages (for debugging)]),
  254. [debug_usb_io=$enableval], [])
  255. AC_ARG_ENABLE([verbose_usb_comms],
  256. AS_HELP_STRING([--enable-verbose-usb-comms],
  257. [Enable verbose USB communication messages (for debugging)]),
  258. [debug_usb_comms=$enableval], [])
  259. AC_MSG_CHECKING([whether to enable verbose JTAG I/O messages]);
  260. AC_MSG_RESULT([$debug_jtag_io])
  261. if test $debug_jtag_io = yes; then
  262. AC_DEFINE([_DEBUG_JTAG_IO_],[1], [Print verbose JTAG I/O messages])
  263. fi
  264. AC_MSG_CHECKING([whether to enable verbose USB I/O messages]);
  265. AC_MSG_RESULT([$debug_usb_io])
  266. if test $debug_usb_io = yes; then
  267. AC_DEFINE([_DEBUG_USB_IO_],[1], [Print verbose USB I/O messages])
  268. fi
  269. AC_MSG_CHECKING([whether to enable verbose USB communication messages]);
  270. AC_MSG_RESULT([$debug_usb_comms])
  271. if test $debug_usb_comms = yes; then
  272. AC_DEFINE([_DEBUG_USB_COMMS_],[1], [Print verbose USB communication messages])
  273. fi
  274. debug_malloc=no
  275. AC_ARG_ENABLE([malloc_logging],
  276. AS_HELP_STRING([--enable-malloc-logging],
  277. [Include free space in logging messages (requires malloc.h).]),
  278. [debug_malloc=$enableval], [])
  279. AC_MSG_CHECKING([whether to enable malloc free space logging]);
  280. AC_MSG_RESULT([$debug_malloc])
  281. if test $debug_malloc = yes; then
  282. AC_DEFINE([_DEBUG_FREE_SPACE_],[1], [Include malloc free space in logging])
  283. fi
  284. AC_ARG_ENABLE([dummy],
  285. AS_HELP_STRING([--enable-dummy], [Enable building the dummy port driver]),
  286. [build_dummy=$enableval], [build_dummy=no])
  287. AC_ARG_ENABLE([parport],
  288. AS_HELP_STRING([--enable-parport], [Enable building the pc parallel port driver]),
  289. [build_parport=$enableval], [build_parport=no])
  290. AC_ARG_ENABLE([parport_ppdev],
  291. AS_HELP_STRING([--disable-parport-ppdev],
  292. [Disable use of ppdev (/dev/parportN) for parport (for x86 only)]),
  293. [parport_use_ppdev=$enableval], [parport_use_ppdev=yes])
  294. AC_ARG_ENABLE([parport_giveio],
  295. AS_HELP_STRING([--enable-parport-giveio],
  296. [Enable use of giveio for parport (for CygWin only)]),
  297. [parport_use_giveio=$enableval], [parport_use_giveio=])
  298. AC_ARG_ENABLE([ft2232_libftdi],
  299. AS_HELP_STRING([--enable-ft2232_libftdi], [Enable building support for FT2232 based devices using the libftdi driver, opensource alternate of FTD2XX]),
  300. [build_ft2232_libftdi=$enableval], [build_ft2232_libftdi=no])
  301. AC_ARG_ENABLE([ft2232_ftd2xx],
  302. AS_HELP_STRING([--enable-ft2232_ftd2xx], [Enable building support for FT2232 based devices using the FTD2XX driver from ftdichip.com]),
  303. [build_ft2232_ftd2xx=$enableval], [build_ft2232_ftd2xx=no])
  304. AC_ARG_ENABLE([ftdi],
  305. AS_HELP_STRING([--enable-ftdi], [Enable building support for the MPSSE mode of FTDI based devices, using libusb-1.0 in asynchronous mode]),
  306. [build_ftdi=$enableval], [build_ftdi=no])
  307. AC_ARG_ENABLE([jtag_vpi],
  308. AS_HELP_STRING([--enable-jtag_vpi], [Enable building support for JTAG VPI]),
  309. [build_jtag_vpi=$enableval], [build_jtag_vpi=no])
  310. AC_ARG_ENABLE([usb_blaster_libftdi],
  311. AS_HELP_STRING([--enable-usb_blaster_libftdi], [Enable building support for the Altera USB-Blaster using the libftdi driver, opensource alternate of FTD2XX]),
  312. [build_usb_blaster_libftdi=$enableval], [build_usb_blaster_libftdi=no])
  313. AC_ARG_ENABLE([usb_blaster_ftd2xx],
  314. AS_HELP_STRING([--enable-usb_blaster_ftd2xx], [Enable building support for the Altera USB-Blaster using the FTD2XX driver from ftdichip.com]),
  315. [build_usb_blaster_ftd2xx=$enableval], [build_usb_blaster_ftd2xx=no])
  316. AC_ARG_ENABLE([amtjtagaccel],
  317. AS_HELP_STRING([--enable-amtjtagaccel], [Enable building the Amontec JTAG-Accelerator driver]),
  318. [build_amtjtagaccel=$enableval], [build_amtjtagaccel=no])
  319. AC_ARG_ENABLE([zy1000_master],
  320. AS_HELP_STRING([--enable-zy1000-master], [Use ZY1000 JTAG master registers]),
  321. [build_zy1000_master=$enableval], [build_zy1000_master=no])
  322. AC_ARG_ENABLE([zy1000],
  323. AS_HELP_STRING([--enable-zy1000], [Enable ZY1000 interface]),
  324. [build_zy1000=$enableval], [build_zy1000=no])
  325. AC_ARG_ENABLE([ioutil],
  326. AS_HELP_STRING([--enable-ioutil], [Enable ioutil functions - useful for standalone OpenOCD implementations]),
  327. [build_ioutil=$enableval], [build_ioutil=no])
  328. case "${host_cpu}" in
  329. arm*)
  330. AC_ARG_ENABLE([ep93xx],
  331. AS_HELP_STRING([--enable-ep93xx], [Enable building support for EP93xx based SBCs]),
  332. [build_ep93xx=$enableval], [build_ep93xx=no])
  333. AC_ARG_ENABLE([at91rm9200],
  334. AS_HELP_STRING([--enable-at91rm9200], [Enable building support for AT91RM9200 based SBCs]),
  335. [build_at91rm9200=$enableval], [build_at91rm9200=no])
  336. AC_ARG_ENABLE([bcm2835gpio],
  337. AS_HELP_STRING([--enable-bcm2835gpio], [Enable building support for bitbanging on BCM2835 (as found in Raspberry Pi)]),
  338. [build_bcm2835gpio=$enableval], [build_bcm2835gpio=no])
  339. ;;
  340. *)
  341. build_ep93xx=no
  342. build_at91rm9200=no
  343. build_bcm2835gpio=no
  344. ;;
  345. esac
  346. AC_ARG_ENABLE([gw16012],
  347. AS_HELP_STRING([--enable-gw16012], [Enable building support for the Gateworks GW16012 JTAG Programmer]),
  348. [build_gw16012=$enableval], [build_gw16012=no])
  349. AC_ARG_ENABLE([presto_libftdi],
  350. AS_HELP_STRING([--enable-presto_libftdi], [Enable building support for ASIX Presto Programmer using the libftdi driver]),
  351. [build_presto_libftdi=$enableval], [build_presto_libftdi=no])
  352. AC_ARG_ENABLE([presto_ftd2xx],
  353. AS_HELP_STRING([--enable-presto_ftd2xx], [Enable building support for ASIX Presto Programmer using the FTD2XX driver]),
  354. [build_presto_ftd2xx=$enableval], [build_presto_ftd2xx=no])
  355. AC_ARG_ENABLE([usbprog],
  356. AS_HELP_STRING([--enable-usbprog], [Enable building support for the usbprog JTAG Programmer]),
  357. [build_usbprog=$enableval], [build_usbprog=no])
  358. AC_ARG_ENABLE([openjtag_ftd2xx],
  359. AS_HELP_STRING([--enable-openjtag_ftd2xx], [Enable building support for the OpenJTAG Programmer with ftd2xx driver]),
  360. [build_openjtag_ftd2xx=$enableval], [build_openjtag_ftd2xx=no])
  361. AC_ARG_ENABLE([openjtag_ftdi],
  362. AS_HELP_STRING([--enable-openjtag_ftdi], [Enable building support for the OpenJTAG Programmer with ftdi driver]),
  363. [build_openjtag_ftdi=$enableval], [build_openjtag_ftdi=no])
  364. AC_ARG_ENABLE([oocd_trace],
  365. AS_HELP_STRING([--enable-oocd_trace],
  366. [Enable building support for some prototype OpenOCD+trace ETM capture hardware]),
  367. [build_oocd_trace=$enableval], [build_oocd_trace=no])
  368. AC_ARG_ENABLE([jlink],
  369. AS_HELP_STRING([--enable-jlink], [Enable building support for the Segger J-Link JTAG Programmer]),
  370. [build_jlink=$enableval], [build_jlink=no])
  371. AC_ARG_ENABLE([vsllink],
  372. AS_HELP_STRING([--enable-vsllink], [Enable building support for the Versaloon-Link JTAG Programmer]),
  373. [build_vsllink=$enableval], [build_vsllink=no])
  374. AC_ARG_ENABLE([rlink],
  375. AS_HELP_STRING([--enable-rlink], [Enable building support for the Raisonance RLink JTAG Programmer]),
  376. [build_rlink=$enableval], [build_rlink=no])
  377. AC_ARG_ENABLE([ulink],
  378. AS_HELP_STRING([--enable-ulink], [Enable building support for the Keil ULINK JTAG Programmer]),
  379. [build_ulink=$enableval], [build_ulink=no])
  380. AC_ARG_ENABLE([arm-jtag-ew],
  381. AS_HELP_STRING([--enable-arm-jtag-ew], [Enable building support for the Olimex ARM-JTAG-EW Programmer]),
  382. [build_armjtagew=$enableval], [build_armjtagew=no])
  383. AC_ARG_ENABLE([buspirate],
  384. AS_HELP_STRING([--enable-buspirate], [Enable building support for the Buspirate]),
  385. [build_buspirate=$enableval], [build_buspirate=no])
  386. AC_ARG_ENABLE([stlink],
  387. AS_HELP_STRING([--enable-stlink], [Enable building support for the ST-Link JTAG Programmer]),
  388. [build_hladapter_stlink=$enableval], [build_hladapter_stlink=no])
  389. AC_ARG_ENABLE([ti-icdi],
  390. AS_HELP_STRING([--enable-ti-icdi], [Enable building support for the TI ICDI JTAG Programmer]),
  391. [build_hladapter_icdi=$enableval], [build_hladapter_icdi=no])
  392. AC_ARG_ENABLE([osbdm],
  393. AS_HELP_STRING([--enable-osbdm], [Enable building support for the OSBDM (JTAG only) Programmer]),
  394. [build_osbdm=$enableval], [build_osbdm=no])
  395. AC_ARG_ENABLE([opendous],
  396. AS_HELP_STRING([--enable-opendous], [Enable building support for the estick/opendous JTAG Programmer]),
  397. [build_opendous=$enableval], [build_opendous=no])
  398. AC_ARG_ENABLE([sysfsgpio],
  399. AS_HELP_STRING([--enable-sysfsgpio], [Enable building support for programming driven via sysfs gpios.]),
  400. [build_sysfsgpio=$enableval], [build_sysfsgpio=no])
  401. AC_ARG_ENABLE([minidriver_dummy],
  402. AS_HELP_STRING([--enable-minidriver-dummy], [Enable the dummy minidriver.]),
  403. [build_minidriver_dummy=$enableval], [build_minidriver_dummy=no])
  404. AC_ARG_ENABLE([internal-jimtcl],
  405. AS_HELP_STRING([--disable-internal-jimtcl], [Disable building internal jimtcl]),
  406. [use_internal_jimtcl=$enableval], [use_internal_jimtcl=yes])
  407. AC_ARG_ENABLE([aice],
  408. AS_HELP_STRING([--enable-aice], [Enable building support for the Andes JTAG Programmer]),
  409. [build_aice=$enableval], [build_aice=no])
  410. build_minidriver=no
  411. AC_MSG_CHECKING([whether to enable ZY1000 minidriver])
  412. if test $build_zy1000 = yes; then
  413. if test $build_minidriver = yes; then
  414. AC_MSG_ERROR([Multiple minidriver options have been enabled.])
  415. fi
  416. AC_DEFINE([HAVE_JTAG_MINIDRIVER_H], [1],
  417. [Define to 1 if you have the <jtag_minidriver.h> header file.])
  418. build_minidriver=yes
  419. fi
  420. AC_MSG_RESULT([$build_zy1000])
  421. AC_ARG_ENABLE([remote-bitbang],
  422. AS_HELP_STRING([--enable-remote-bitbang], [Enable building support for the Remote Bitbang jtag driver]),
  423. [build_remote_bitbang=$enableval], [build_remote_bitbang=no])
  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. if test x$build_buspirate = xyes; then
  486. AC_MSG_ERROR([buspirate currently not supported by MinGW32 hosts])
  487. fi
  488. CFLAGS="$CFLAGS -D__USE_MINGW_ANSI_STDIO"
  489. AC_DEFINE([IS_MINGW], [1], [1 if building for MinGW.])
  490. AC_DEFINE([IS_WIN32], [1], [1 if building for Win32.])
  491. AC_DEFINE([IS_DARWIN], [0], [0 if not building for Darwin.])
  492. ;;
  493. *darwin*)
  494. is_darwin=yes
  495. if test x$parport_use_giveio = xyes; then
  496. AC_MSG_WARN([--enable-parport-giveio cannot be used by Darwin hosts])
  497. fi
  498. parport_use_giveio=no
  499. AC_DEFINE([IS_CYGWIN], [0], [0 if not building for Cygwin.])
  500. AC_DEFINE([IS_WIN32], [0], [0 if not building for Win32.])
  501. AC_DEFINE([IS_DARWIN], [1], [1 if building for Darwin.])
  502. ;;
  503. *)
  504. if test x$parport_use_giveio = xyes; then
  505. AC_MSG_WARN([--enable-parport-giveio cannot be used by ]$host[ hosts])
  506. fi
  507. parport_use_giveio=no
  508. AC_DEFINE([IS_CYGWIN], [0], [0 if not building for Cygwin.])
  509. AC_DEFINE([IS_WIN32], [0], [0 if not building for Win32.])
  510. AC_DEFINE([IS_DARWIN], [0], [0 if not building for Darwin.])
  511. ;;
  512. esac
  513. if test $build_parport = yes; then
  514. build_bitbang=yes
  515. AC_DEFINE([BUILD_PARPORT], [1], [1 if you want parport.])
  516. else
  517. AC_DEFINE([BUILD_PARPORT], [0], [0 if you don't want parport.])
  518. fi
  519. if test $build_dummy = yes; then
  520. build_bitbang=yes
  521. AC_DEFINE([BUILD_DUMMY], [1], [1 if you want dummy driver.])
  522. else
  523. AC_DEFINE([BUILD_DUMMY], [0], [0 if you don't want dummy driver.])
  524. fi
  525. if test $build_ep93xx = yes; then
  526. build_bitbang=yes
  527. AC_DEFINE([BUILD_EP93XX], [1], [1 if you want ep93xx.])
  528. else
  529. AC_DEFINE([BUILD_EP93XX], [0], [0 if you don't want ep93xx.])
  530. fi
  531. if test $build_zy1000 = yes; then
  532. AC_DEFINE([BUILD_ZY1000], [1], [1 if you want ZY1000.])
  533. else
  534. AC_DEFINE([BUILD_ZY1000], [0], [0 if you don't want ZY1000.])
  535. fi
  536. if test $build_zy1000_master = yes; then
  537. AC_DEFINE([BUILD_ZY1000_MASTER], [1], [1 if you want ZY1000 JTAG master registers.])
  538. else
  539. AC_DEFINE([BUILD_ZY1000_MASTER], [0], [0 if you don't want ZY1000 JTAG master registers.])
  540. fi
  541. if test $build_at91rm9200 = yes; then
  542. build_bitbang=yes
  543. AC_DEFINE([BUILD_AT91RM9200], [1], [1 if you want at91rm9200.])
  544. else
  545. AC_DEFINE([BUILD_AT91RM9200], [0], [0 if you don't want at91rm9200.])
  546. fi
  547. if test $build_bcm2835gpio = yes; then
  548. build_bitbang=yes
  549. AC_DEFINE([BUILD_BCM2835GPIO], [1], [1 if you want bcm2835gpio.])
  550. else
  551. AC_DEFINE([BUILD_BCM2835GPIO], [0], [0 if you don't want bcm2835gpio.])
  552. fi
  553. if test x$parport_use_ppdev = xyes; then
  554. AC_DEFINE([PARPORT_USE_PPDEV], [1], [1 if you want parport to use ppdev.])
  555. else
  556. AC_DEFINE([PARPORT_USE_PPDEV], [0], [0 if you don't want parport to use ppdev.])
  557. fi
  558. if test x$parport_use_giveio = xyes; then
  559. AC_DEFINE([PARPORT_USE_GIVEIO], [1], [1 if you want parport to use giveio.])
  560. else
  561. AC_DEFINE([PARPORT_USE_GIVEIO], [0], [0 if you don't want parport to use giveio.])
  562. fi
  563. if test $build_bitbang = yes; then
  564. AC_DEFINE([BUILD_BITBANG], [1], [1 if you want a bitbang interface.])
  565. else
  566. AC_DEFINE([BUILD_BITBANG], [0], [0 if you don't want a bitbang interface.])
  567. fi
  568. if test $build_ft2232_libftdi = yes; then
  569. AC_DEFINE([BUILD_FT2232_LIBFTDI], [1], [1 if you want libftdi ft2232.])
  570. else
  571. AC_DEFINE([BUILD_FT2232_LIBFTDI], [0], [0 if you don't want libftdi ft2232.])
  572. fi
  573. if test $build_ft2232_ftd2xx = yes; then
  574. AC_DEFINE([BUILD_FT2232_FTD2XX], [1], [1 if you want ftd2xx ft2232.])
  575. else
  576. AC_DEFINE([BUILD_FT2232_FTD2XX], [0], [0 if you don't want ftd2xx ft2232.])
  577. fi
  578. if test $build_ftdi = yes; then
  579. AC_DEFINE([BUILD_FTDI], [1], [1 if you want ftdi.])
  580. else
  581. AC_DEFINE([BUILD_FTDI], [0], [0 if you don't want ftdi.])
  582. fi
  583. if test $build_usb_blaster_libftdi = yes; then
  584. AC_DEFINE([BUILD_USB_BLASTER_LIBFTDI], [1], [1 if you want libftdi usb_blaster.])
  585. else
  586. AC_DEFINE([BUILD_USB_BLASTER_LIBFTDI], [0], [0 if you don't want libftdi usb_blaster.])
  587. fi
  588. if test $build_jtag_vpi = yes; then
  589. AC_DEFINE([BUILD_JTAG_VPI], [1], [1 if you want JTAG VPI.])
  590. else
  591. AC_DEFINE([BUILD_JTAG_VPI], [0], [0 if you don't want JTAG VPI.])
  592. fi
  593. if test $build_usb_blaster_ftd2xx = yes; then
  594. AC_DEFINE([BUILD_USB_BLASTER_FTD2XX], [1], [1 if you want ftd2xx usb_blaster.])
  595. else
  596. AC_DEFINE([BUILD_USB_BLASTER_FTD2XX], [0], [0 if you don't want ftd2xx usb_blaster.])
  597. fi
  598. if test $build_amtjtagaccel = yes; then
  599. AC_DEFINE([BUILD_AMTJTAGACCEL], [1], [1 if you want the Amontec JTAG-Accelerator driver.])
  600. else
  601. AC_DEFINE([BUILD_AMTJTAGACCEL], [0], [0 if you don't want the Amontec JTAG-Accelerator driver.])
  602. fi
  603. if test $build_gw16012 = yes; then
  604. AC_DEFINE([BUILD_GW16012], [1], [1 if you want the Gateworks GW16012 driver.])
  605. else
  606. AC_DEFINE([BUILD_GW16012], [0], [0 if you don't want the Gateworks GW16012 driver.])
  607. fi
  608. if test $build_presto_libftdi = yes; then
  609. build_bitq=yes
  610. AC_DEFINE([BUILD_PRESTO_LIBFTDI], [1], [1 if you want the ASIX PRESTO driver using libftdi.])
  611. else
  612. AC_DEFINE([BUILD_PRESTO_LIBFTDI], [0], [0 if you don't want the ASIX PRESTO driver using libftdi.])
  613. fi
  614. if test $build_presto_ftd2xx = yes; then
  615. build_bitq=yes
  616. AC_DEFINE([BUILD_PRESTO_FTD2XX], [1], [1 if you want the ASIX PRESTO driver using FTD2XX.])
  617. else
  618. AC_DEFINE([BUILD_PRESTO_FTD2XX], [0], [0 if you don't want the ASIX PRESTO driver using FTD2XX.])
  619. fi
  620. if test $build_bitq = yes; then
  621. AC_DEFINE([BUILD_BITQ], [1], [1 if you want a bitq interface.])
  622. else
  623. AC_DEFINE([BUILD_BITQ], [0], [0 if you don't want a bitq interface.])
  624. fi
  625. if test $build_usbprog = yes; then
  626. AC_DEFINE([BUILD_USBPROG], [1], [1 if you want the usbprog JTAG driver.])
  627. else
  628. AC_DEFINE([BUILD_USBPROG], [0], [0 if you don't want the usbprog JTAG driver.])
  629. fi
  630. AC_DEFINE([BUILD_OPENJTAG], [0], [0 if you don't want the OpenJTAG driver.])
  631. AC_DEFINE([BUILD_OPENJTAG_FTD2XX], [0], [0 if you don't want the OpenJTAG driver with FTD2XX driver.])
  632. AC_DEFINE([BUILD_OPENJTAG_LIBFTDI], [0], [0 if you don't want to build OpenJTAG driver with libftdi.])
  633. if test $build_openjtag_ftd2xx = yes; then
  634. AC_DEFINE([BUILD_OPENJTAG], [1], [1 if you want the OpenJTAG driver.])
  635. AC_DEFINE([BUILD_OPENJTAG_FTD2XX], [1], [1 if you want the OpenJTAG driver with FTD2XX driver.])
  636. fi
  637. if test $build_openjtag_ftdi = yes; then
  638. AC_DEFINE([BUILD_OPENJTAG], [1], [1 if you want the OpenJTAG drvier.])
  639. AC_DEFINE([BUILD_OPENJTAG_LIBFTDI], [1], [1 if you want to build OpenJTAG with FTDI driver.])
  640. fi
  641. if test $build_oocd_trace = yes; then
  642. AC_DEFINE([BUILD_OOCD_TRACE], [1], [1 if you want the OpenOCD+trace ETM capture driver.])
  643. else
  644. AC_DEFINE([BUILD_OOCD_TRACE], [0], [0 if you don't want the OpenOCD+trace ETM capture driver.])
  645. fi
  646. if test $build_jlink = yes; then
  647. AC_DEFINE([BUILD_JLINK], [1], [1 if you want the J-Link JTAG driver.])
  648. else
  649. AC_DEFINE([BUILD_JLINK], [0], [0 if you don't want the J-Link JTAG driver.])
  650. fi
  651. if test $build_aice = yes; then
  652. AC_DEFINE([BUILD_AICE], [1], [1 if you want the AICE JTAG driver.])
  653. else
  654. AC_DEFINE([BUILD_AICE], [0], [0 if you don't want the AICE JTAG driver.])
  655. fi
  656. if test $build_vsllink = yes; then
  657. AC_DEFINE([BUILD_VSLLINK], [1], [1 if you want the Versaloon-Link JTAG driver.])
  658. else
  659. AC_DEFINE([BUILD_VSLLINK], [0], [0 if you don't want the Versaloon-Link JTAG driver.])
  660. fi
  661. if test $build_rlink = yes; then
  662. AC_DEFINE([BUILD_RLINK], [1], [1 if you want the RLink JTAG driver.])
  663. else
  664. AC_DEFINE([BUILD_RLINK], [0], [0 if you don't want the RLink JTAG driver.])
  665. fi
  666. if test $build_ulink = yes; then
  667. AC_DEFINE([BUILD_ULINK], [1], [1 if you want the ULINK JTAG driver.])
  668. else
  669. AC_DEFINE([BUILD_ULINK], [0], [0 if you don't want the ULINK JTAG driver.])
  670. fi
  671. if test $build_armjtagew = yes; then
  672. AC_DEFINE([BUILD_ARMJTAGEW], [1], [1 if you want the ARM-JTAG-EW JTAG driver.])
  673. else
  674. AC_DEFINE([BUILD_ARMJTAGEW], [0], [0 if you don't want the ARM-JTAG-EW JTAG driver.])
  675. fi
  676. if test $build_buspirate = yes; then
  677. AC_DEFINE([BUILD_BUSPIRATE], [1], [1 if you want the Buspirate JTAG driver.])
  678. else
  679. AC_DEFINE([BUILD_BUSPIRATE], [0], [0 if you don't want the Buspirate JTAG driver.])
  680. fi
  681. if test $build_hladapter_stlink = yes -o $build_hladapter_icdi = yes; then
  682. AC_DEFINE([BUILD_HLADAPTER], [1], [1 if you want the High Level JTAG driver.])
  683. else
  684. AC_DEFINE([BUILD_HLADAPTER], [0], [0 if you don't want the High Level JTAG driver.])
  685. fi
  686. if test $build_osbdm = yes; then
  687. AC_DEFINE([BUILD_OSBDM], [1], [1 if you want the OSBDM driver.])
  688. else
  689. AC_DEFINE([BUILD_OSBDM], [0], [0 if you don't want the OSBDM driver.])
  690. fi
  691. if test $build_opendous = yes; then
  692. AC_DEFINE([BUILD_OPENDOUS], [1], [1 if you want the estick/opendous JTAG driver.])
  693. else
  694. AC_DEFINE([BUILD_OPENDOUS], [0], [0 if you don't want the estick/opendous JTAG driver.])
  695. fi
  696. if test "$use_internal_jimtcl" = yes; then
  697. if test -f "$srcdir/jimtcl/configure.ac"; then
  698. AX_CONFIG_SUBDIR_OPTION([jimtcl], [--disable-install-jim])
  699. else
  700. AC_MSG_ERROR([jimtcl not found, run git submodule init and git submodule update.])
  701. fi
  702. fi
  703. if test $build_remote_bitbang = yes; then
  704. build_bitbang=yes
  705. AC_DEFINE([BUILD_REMOTE_BITBANG], [1], [1 if you want the Remote Bitbang JTAG driver.])
  706. else
  707. AC_DEFINE([BUILD_REMOTE_BITBANG], [0], [0 if you don't want the Remote Bitbang JTAG driver.])
  708. fi
  709. if test $build_sysfsgpio = yes; then
  710. build_bitbang=yes
  711. AC_DEFINE([BUILD_SYSFSGPIO], [1], [1 if you want the SysfsGPIO driver.])
  712. else
  713. AC_DEFINE([BUILD_SYSFSGPIO], [0], [0 if you don't want SysfsGPIO driver.])
  714. fi
  715. #-- Deal with MingW/Cygwin FTD2XX issues
  716. if test $is_win32 = yes; then
  717. if test "${with_ftd2xx_linux_tardir+set}" = set
  718. then
  719. AC_MSG_ERROR([The option: with_ftd2xx_linux_tardir is for LINUX only.])
  720. fi
  721. if test $build_ft2232_ftd2xx = yes -o $build_presto_ftd2xx = yes -o $build_usb_blaster_ftd2xx = yes -o $build_openjtag_ftd2xx = yes; then
  722. AC_MSG_CHECKING([for ftd2xx.lib exists (win32)])
  723. # if we are given a zipdir...
  724. if test "${with_ftd2xx_win32_zipdir+set}" = set
  725. then
  726. # Set the CFLAGS for "ftd2xx.h"
  727. f=$with_ftd2xx_win32_zipdir/ftd2xx.h
  728. if test ! -f $f ; then
  729. AC_MSG_ERROR([File: $f cannot be found])
  730. fi
  731. CFLAGS="$CFLAGS -I$with_ftd2xx_win32_zipdir"
  732. # And calculate the LDFLAGS for the machine
  733. case "$host_cpu" in
  734. i?86|x86_32)
  735. LDFLAGS="$LDFLAGS -L$with_ftd2xx_win32_zipdir/i386"
  736. LIBS="$LIBS -lftd2xx"
  737. f=$with_ftd2xx_win32_zipdir/i386/ftd2xx.lib
  738. ;;
  739. amd64|x86_64)
  740. LDFLAGS="$LDFLAGS -L$with_ftd2xx_win32_zipdir/amd64"
  741. LIBS="$LIBS -lftd2xx"
  742. f=$with_ftd2xx_win32_zipdir/amd64/ftd2xx.lib
  743. ;;
  744. *)
  745. AC_MSG_ERROR([Unknown Win32 host cpu: $host_cpu])
  746. ;;
  747. esac
  748. if test ! -f $f ; then
  749. AC_MSG_ERROR([Library: $f not found])
  750. fi
  751. else
  752. LIBS="$LIBS -lftd2xx"
  753. AC_MSG_WARN([ASSUMPTION: The (win32) FTDICHIP.COM files: ftd2xx.h and ftd2xx.lib are in a proper place])
  754. fi
  755. fi
  756. fi # win32
  757. if test $is_darwin = yes ; then
  758. if test "${with_ftd2xx_win32_zipdir+set}" = set
  759. then
  760. AC_MSG_ERROR([The option: --with-ftd2xx-win32-zipdir is for win32 only])
  761. fi
  762. if test "${with_ftd2xx_linux_tardir+set}" = set
  763. then
  764. AC_MSG_ERROR([The option: with_ftd2xx_linux_tardir is for LINUX only.])
  765. fi
  766. if test $build_ft2232_ftd2xx = yes -o $build_presto_ftd2xx = yes -o $build_usb_blaster_ftd2xx = yes ; then
  767. AC_MSG_CHECKING([for libftd2xx.a (darwin)])
  768. if test ! -f /usr/local/include/ftd2xx.h ; then
  769. AC_MSG_ERROR([ftd2xx library from FTDICHIP.com seems to be missing, cannot find: /usr/local/include/ftd2xx.h])
  770. fi
  771. CFLAGS="$CFLAGS -I/usr/local/include"
  772. LDFLAGS="$LDFLAGS -L/usr/local/lib"
  773. LIBS="$LIBS -lftd2xx"
  774. AC_MSG_RESULT([-L/usr/local/lib -lftd2xx])
  775. fi
  776. fi # darwin
  777. if test $is_win32 = no && test $is_darwin = no ; then
  778. if test "${with_ftd2xx_win32_zipdir+set}" = set
  779. then
  780. AC_MSG_ERROR([The option: --with-ftd2xx-win32-zipdir is for win32 only])
  781. fi
  782. if test $build_ft2232_ftd2xx = yes -o $build_presto_ftd2xx = yes -o $build_usb_blaster_ftd2xx = yes -o $build_openjtag_ftd2xx = yes; then
  783. # Must be linux
  784. if test $host_os != linux-gnu && test $host_os != linux ; then
  785. AC_MSG_ERROR([The (linux) ftd2xx library from FTDICHIP.com is linux only. Try --enable-ft2232-libftdi instead])
  786. fi
  787. # Are we given a TAR directory?
  788. if test "${with_ftd2xx_linux_tardir+set}" = set
  789. then
  790. AC_MSG_CHECKING([uninstalled ftd2xx distribution])
  791. # The .H file is simple..
  792. FTD2XX_H=$with_ftd2xx_linux_tardir/ftd2xx.h
  793. if test ! -f "${FTD2XX_H}"; then
  794. AC_MSG_ERROR([Option: --with-ftd2xx-linux-tardir appears wrong, cannot find: ${FTD2XX_H}])
  795. fi
  796. CFLAGS="$CFLAGS -I$with_ftd2xx_linux_tardir"
  797. if test $with_ftd2xx_lib = shared; then
  798. FTD2XX_LDFLAGS="-L$with_ftd2xx_linux_tardir"
  799. FTD2XX_LIB="-lftd2xx"
  800. else
  801. # Test #1 - v1.0.x
  802. case "$host_cpu" in
  803. i?86|x86_32)
  804. dir=build/i386;;
  805. amd64|x86_64)
  806. dir=build/x86_64;;
  807. *)
  808. dir=none;;
  809. esac
  810. if test -f "$with_ftd2xx_linux_tardir/$dir/libftd2xx.a"; then
  811. FTD2XX_LDFLAGS="-L$with_ftd2xx_linux_tardir/$dir"
  812. # Also needs -lrt
  813. FTD2XX_LIB="-lftd2xx -lrt"
  814. else
  815. # Test Number2.
  816. # Grr.. perhaps it exists as a version number?
  817. FTD2XX_LIB="$with_ftd2xx_linux_tardir/static_lib/libftd2xx.a.*.*.*"
  818. count=`ls ${FTD2XX_LIB} | wc -l`
  819. if test $count -gt 1 ; then
  820. AC_MSG_ERROR([Multiple libftd2xx.a files found in: $with_ftd2xx_linux_tardir/static_lib sorry cannot handle this yet])
  821. fi
  822. if test $count -ne 1 ; then
  823. AC_MSG_ERROR([Not found: $f, option: --with-ftd2xx-linux-tardir appears to be wrong])
  824. fi
  825. # Because the "-l" rules do not understand version numbers...
  826. # we will just stuff the absolute path onto the LIBS variable
  827. FTD2XX_LIB="`ls ${FTD2XX_LIB}` -lpthread"
  828. FTD2XX_LDFLAGS=""
  829. fi
  830. fi
  831. LDFLAGS="${LDFLAGS} ${FTD2XX_LDFLAGS}"
  832. LIBS="${FTD2XX_LIB} ${LIBS}"
  833. AC_MSG_RESULT([${FTD2XX_LDFLAGS} ${FTD2XX_LIB}])
  834. else
  835. AC_CHECK_HEADER([ftd2xx.h],[],[
  836. AC_MSG_ERROR([You seem to be missing the FTD2xx driver header file.])
  837. ])
  838. AC_SEARCH_LIBS([FT_GetLibraryVersion],[ftd2xx],,[
  839. AC_MSG_ERROR([You appear to be missing the FTD2xx driver library.])
  840. ],[])
  841. fi
  842. fi
  843. fi # linux
  844. if test $build_ft2232_ftd2xx = yes -o $build_presto_ftd2xx = yes -o $build_usb_blaster_ftd2xx = yes ; then
  845. # Before we go any further - make sure we can *BUILD* and *RUN*
  846. # a simple app with the "ftd2xx.lib" file - in what ever form we where given
  847. # We should be able to compile, link and run this test program now
  848. AC_MSG_CHECKING([whether ftd2xx library works])
  849. #
  850. # Save the LDFLAGS for later..
  851. LDFLAGS_SAVE=$LDFLAGS
  852. CFLAGS_SAVE=$CFLAGS
  853. _LDFLAGS=`eval echo $LDFLAGS`
  854. _CFLAGS=`eval echo $CFLAGS`
  855. LDFLAGS=$_LDFLAGS
  856. CFLAGS=$_CFLAGS
  857. AC_RUN_IFELSE([AC_LANG_PROGRAM([[
  858. #include "confdefs.h"
  859. #if IS_WIN32
  860. #include "windows.h"
  861. #endif
  862. #include <stdio.h>
  863. #include <ftd2xx.h>
  864. ]], [[
  865. DWORD x;
  866. FT_GetLibraryVersion( &x );
  867. ]])], [
  868. AC_MSG_RESULT([Success!])
  869. ], [
  870. AC_MSG_ERROR([Cannot build & run test program using ftd2xx.lib])
  871. ], [
  872. AC_MSG_RESULT([Skipping as we are cross-compiling])
  873. ])
  874. AC_MSG_CHECKING([for ftd2xx highspeed device support])
  875. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  876. #include "confdefs.h"
  877. #if IS_WIN32
  878. #include "windows.h"
  879. #endif
  880. #include <stdio.h>
  881. #include <ftd2xx.h>
  882. DWORD x = FT_DEVICE_4232H;
  883. ]], [])], [
  884. AC_DEFINE([BUILD_FT2232_HIGHSPEED], [1],
  885. [Support FT2232H/FT4232HS with FTD2XX or libftdi.])
  886. build_ft2232_highspeed=yes
  887. ], [
  888. build_ft2232_highspeed=no
  889. ])
  890. AC_MSG_RESULT([$build_ft2232_highspeed])
  891. if test $build_ft2232_highspeed = no; then
  892. AC_MSG_WARN([You need a newer FTD2XX driver (version 2.04.16 or later).])
  893. fi
  894. AC_MSG_CHECKING([for ftd2xx FT232H device support])
  895. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  896. #include "confdefs.h"
  897. #if IS_WIN32
  898. #include "windows.h"
  899. #endif
  900. #include <stdio.h>
  901. #include <ftd2xx.h>
  902. DWORD x = FT_DEVICE_232H;
  903. ]], [])], [
  904. AC_DEFINE([HAS_ENUM_FT232H], [1],
  905. [Support FT232H with FTD2XX or libftdi.])
  906. has_enum_ft232h=yes
  907. ], [
  908. has_enum_ft232h=no
  909. ])
  910. AC_MSG_RESULT([$has_enum_ft232h])
  911. if test $has_enum_ft232h = no; then
  912. AC_MSG_WARN([You need a newer FTD2XX driver (version 2.08.12 or later).])
  913. fi
  914. LDFLAGS=$LDFLAGS_SAVE
  915. CFLAGS=$CFLAGS_SAVE
  916. fi
  917. if test $build_ft2232_libftdi = yes -o $build_usb_blaster_libftdi = yes -o \
  918. $build_openjtag_ftdi = yes; then
  919. # We assume: the package is preinstalled in the proper place
  920. # these present as 2 libraries..
  921. LIBS="$LIBS -lftdi -lusb"
  922. #
  923. # Try to build a small program.
  924. AC_MSG_CHECKING([Build & Link with libftdi...])
  925. LDFLAGS_SAVE=$LDFLAGS
  926. CFLAGS_SAVE=$CFLAGS
  927. _LDFLAGS=`eval echo $LDFLAGS`
  928. _CFLAGS=`eval echo $CFLAGS`
  929. LDFLAGS=$_LDFLAGS
  930. CFLAGS=$_CFLAGS
  931. AC_RUN_IFELSE([AC_LANG_PROGRAM([[
  932. #include <stdio.h>
  933. #include <ftdi.h>
  934. ]], [[
  935. struct ftdi_context *p;
  936. p = ftdi_new();
  937. if( p != NULL ){
  938. return 0;
  939. } else {
  940. fprintf( stderr, "calling ftdi_new() failed\n");
  941. return 1;
  942. }
  943. ]])], [
  944. AC_MSG_RESULT([Success])
  945. ], [
  946. AC_MSG_ERROR([Cannot build & run test program using libftdi])
  947. ], [
  948. AC_MSG_RESULT([Skipping as we are cross-compiling, trying build only])
  949. AC_SEARCH_LIBS([ftdi_new], [], [], [AC_MSG_ERROR([Cannot link with libftdi])])
  950. ])
  951. AC_MSG_CHECKING([for libftdi highspeed device support])
  952. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  953. #include <stdio.h>
  954. #include <ftdi.h>
  955. ]], [[
  956. enum ftdi_chip_type x = TYPE_2232H;
  957. ]])], [
  958. AC_DEFINE([BUILD_FT2232_HIGHSPEED], [1],
  959. [Support FT2232H/FT4232HS with FTD2XX or libftdi.])
  960. build_ft2232_highspeed=yes
  961. ], [
  962. build_ft2232_highspeed=no
  963. ])
  964. AC_MSG_RESULT([$build_ft2232_highspeed])
  965. if test $build_ft2232_highspeed = no; then
  966. AC_MSG_WARN([You need a newer libftdi version (0.16 or later).])
  967. fi
  968. AC_MSG_CHECKING([for libftdi FT232H device support])
  969. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  970. #include <stdio.h>
  971. #include <ftdi.h>
  972. ]], [[
  973. enum ftdi_chip_type x = TYPE_232H;
  974. ]])], [
  975. AC_DEFINE([HAS_ENUM_FT232H], [1],
  976. [Support FT232H with FTD2XX or libftdi.])
  977. has_enum_ft232h=yes
  978. ], [
  979. has_enum_ft232h=no
  980. ])
  981. AC_MSG_RESULT([$has_enum_ft232h])
  982. if test $has_enum_ft232h = no; then
  983. AC_MSG_WARN([You need a newer libftdi version (0.20 or later).])
  984. fi
  985. # Restore the 'unexpanded ldflags'
  986. LDFLAGS=$LDFLAGS_SAVE
  987. CFLAGS=$CFLAGS_SAVE
  988. fi
  989. # check if some driver requires libusb-0.1
  990. need_usb0=no
  991. if test $build_vsllink = yes -o $build_usbprog = yes -o \
  992. $build_rlink = yes -o $build_armjtagew = yes; then
  993. need_usb0=yes
  994. fi
  995. # check if some driver can work with either libusb version
  996. need_usb=no
  997. if test $build_jlink = yes -o $build_osbdm = yes -o $build_opendous = yes -o \
  998. $build_aice = yes; then
  999. need_usb=yes
  1000. fi
  1001. # check if some driver requires libusb-1.x
  1002. need_usb_ng=no
  1003. if test $build_ftdi = yes -o $build_hladapter_icdi = yes -o \
  1004. $build_hladapter_stlink = yes -o $build_ulink = yes; then
  1005. need_usb_ng=yes
  1006. fi
  1007. # check for libusb library if necessary
  1008. use_libusb1=no
  1009. if test $need_usb = yes -o $need_usb_ng = yes; then
  1010. AC_CHECK_HEADER([libusb-1.0/libusb.h], [
  1011. AC_DEFINE([HAVE_LIBUSB1], [1], [Define if you have libusb-1.x])
  1012. use_libusb1=yes
  1013. AC_SEARCH_LIBS([libusb_error_name], [usb-1.0],
  1014. [AC_DEFINE([HAVE_LIBUSB_ERROR_NAME], [1], [Define if your libusb has libusb_error_name()])],
  1015. [AC_MSG_WARN([libusb-1.x older than 1.0.9 detected, consider updating])])
  1016. ], [
  1017. if test $need_usb_ng = yes; then
  1018. AC_MSG_ERROR([libusb-1.x is required for some driver(s) you've selected])
  1019. else
  1020. AC_MSG_WARN([Trying legacy libusb-0.1 as a fallback, consider installing libusb-1 instead])
  1021. need_usb0=yes
  1022. fi
  1023. ])
  1024. fi
  1025. use_libusb0=no
  1026. if test $need_usb0 = yes; then
  1027. AC_CHECK_HEADERS([usb.h], [
  1028. use_libusb0=yes
  1029. ], [
  1030. AC_MSG_ERROR([libusb-0.1 is required to build some OpenOCD driver(s)])
  1031. ])
  1032. fi
  1033. AM_CONDITIONAL([RELEASE], [test $build_release = yes])
  1034. AM_CONDITIONAL([PARPORT], [test $build_parport = yes])
  1035. AM_CONDITIONAL([DUMMY], [test $build_dummy = yes])
  1036. AM_CONDITIONAL([GIVEIO], [test x$parport_use_giveio = xyes])
  1037. AM_CONDITIONAL([EP93XX], [test $build_ep93xx = yes])
  1038. AM_CONDITIONAL([ZY1000], [test $build_zy1000 = yes])
  1039. AM_CONDITIONAL([ZY1000_MASTER], [test $build_zy1000_master = yes])
  1040. AM_CONDITIONAL([IOUTIL], [test $build_ioutil = yes])
  1041. AM_CONDITIONAL([AT91RM9200], [test $build_at91rm9200 = yes])
  1042. AM_CONDITIONAL([BCM2835GPIO], [test $build_bcm2835gpio = yes])
  1043. AM_CONDITIONAL([BITBANG], [test $build_bitbang = yes])
  1044. AM_CONDITIONAL([FT2232_LIBFTDI], [test $build_ft2232_libftdi = yes])
  1045. AM_CONDITIONAL([FT2232_DRIVER], [test $build_ft2232_ftd2xx = yes -o $build_ft2232_libftdi = yes])
  1046. AM_CONDITIONAL([FTDI_DRIVER], [test $build_ftdi = yes])
  1047. AM_CONDITIONAL([USB_BLASTER_LIBFTDI], [test $build_usb_blaster_libftdi = yes])
  1048. AM_CONDITIONAL([USB_BLASTER_FTD2XX], [test $build_usb_blaster_ftd2xx = yes])
  1049. AM_CONDITIONAL([JTAG_VPI], [test $build_jtag_vpi = yes -o $build_jtag_vpi = yes])
  1050. AM_CONDITIONAL([USB_BLASTER_DRIVER], [test $build_usb_blaster_ftd2xx = yes -o $build_usb_blaster_libftdi = yes])
  1051. AM_CONDITIONAL([AMTJTAGACCEL], [test $build_amtjtagaccel = yes])
  1052. AM_CONDITIONAL([GW16012], [test $build_gw16012 = yes])
  1053. AM_CONDITIONAL([PRESTO_LIBFTDI], [test $build_presto_libftdi = yes])
  1054. AM_CONDITIONAL([PRESTO_DRIVER], [test $build_presto_ftd2xx = yes -o $build_presto_libftdi = yes])
  1055. AM_CONDITIONAL([USBPROG], [test $build_usbprog = yes])
  1056. AM_CONDITIONAL([OPENJTAG], [test $build_openjtag_ftd2xx = yes -o $build_openjtag_ftdi = yes])
  1057. AM_CONDITIONAL([OOCD_TRACE], [test $build_oocd_trace = yes])
  1058. AM_CONDITIONAL([JLINK], [test $build_jlink = yes])
  1059. AM_CONDITIONAL([AICE], [test $build_aice = yes])
  1060. AM_CONDITIONAL([VSLLINK], [test $build_vsllink = yes])
  1061. AM_CONDITIONAL([RLINK], [test $build_rlink = yes])
  1062. AM_CONDITIONAL([ULINK], [test $build_ulink = yes])
  1063. AM_CONDITIONAL([ARMJTAGEW], [test $build_armjtagew = yes])
  1064. AM_CONDITIONAL([REMOTE_BITBANG], [test $build_remote_bitbang = yes])
  1065. AM_CONDITIONAL([BUSPIRATE], [test $build_buspirate = yes])
  1066. AM_CONDITIONAL([HLADAPTER], [test $build_hladapter_stlink = yes -o $build_hladapter_icdi = yes])
  1067. AM_CONDITIONAL([OSBDM], [test $build_osbdm = yes])
  1068. AM_CONDITIONAL([OPENDOUS], [test $build_opendous = yes])
  1069. AM_CONDITIONAL([SYSFSGPIO], [test $build_sysfsgpio = yes])
  1070. AM_CONDITIONAL([USE_LIBUSB0], [test $use_libusb0 = yes])
  1071. AM_CONDITIONAL([USE_LIBUSB1], [test $use_libusb1 = yes])
  1072. AM_CONDITIONAL([IS_CYGWIN], [test $is_cygwin = yes])
  1073. AM_CONDITIONAL([IS_MINGW], [test $is_mingw = yes])
  1074. AM_CONDITIONAL([IS_WIN32], [test $is_win32 = yes])
  1075. AM_CONDITIONAL([IS_DARWIN], [test $is_darwin = yes])
  1076. AM_CONDITIONAL([BITQ], [test $build_bitq = yes])
  1077. AM_CONDITIONAL([MINIDRIVER], [test $build_minidriver = yes])
  1078. AM_CONDITIONAL([MINIDRIVER_DUMMY], [test $build_minidriver_dummy = yes])
  1079. AM_CONDITIONAL([INTERNAL_JIMTCL], [test $use_internal_jimtcl = yes])
  1080. # Look for environ alternatives. Possibility #1: is environ in unistd.h or stdlib.h?
  1081. AC_MSG_CHECKING([for environ in unistd.h and stdlib.h])
  1082. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  1083. #define _GNU_SOURCE
  1084. #include <unistd.h>
  1085. #include <stdlib.h>
  1086. ]], [[char **ep = environ;]]
  1087. )], [
  1088. AC_MSG_RESULT([yes])
  1089. has_environ=yes
  1090. ], [
  1091. AC_MSG_RESULT([no])
  1092. # Possibility #2: can environ be found in an available library?
  1093. AC_MSG_CHECKING([for extern environ])
  1094. AC_LINK_IFELSE([AC_LANG_PROGRAM([[
  1095. extern char **environ;
  1096. ]], [[char **ep = environ;]]
  1097. )], [
  1098. AC_DEFINE(NEED_ENVIRON_EXTERN, [1], [Must declare 'environ' to use it.])
  1099. has_environ=yes
  1100. ], [
  1101. has_environ=no
  1102. ])
  1103. AC_MSG_RESULT([${has_environ}])
  1104. ])
  1105. if test "${has_environ}" != "yes" ; then
  1106. AC_MSG_FAILURE([Could not find 'environ' in unistd.h or available libraries.])
  1107. fi
  1108. AC_DEFINE([_GNU_SOURCE],[1],[Use GNU C library extensions (e.g. stdndup).])
  1109. # set default gcc warnings
  1110. GCC_WARNINGS="-Wall -Wstrict-prototypes -Wformat-security -Wshadow"
  1111. if test "${gcc_wextra}" = yes; then
  1112. GCC_WARNINGS="${GCC_WARNINGS} -Wextra -Wno-unused-parameter"
  1113. GCC_WARNINGS="${GCC_WARNINGS} -Wbad-function-cast"
  1114. GCC_WARNINGS="${GCC_WARNINGS} -Wcast-align"
  1115. GCC_WARNINGS="${GCC_WARNINGS} -Wredundant-decls"
  1116. fi
  1117. if test "${gcc_werror}" = yes; then
  1118. GCC_WARNINGS="${GCC_WARNINGS} -Werror"
  1119. fi
  1120. # overide default gcc cflags
  1121. if test $gcc_warnings = yes; then
  1122. CFLAGS="$CFLAGS $GCC_WARNINGS"
  1123. fi
  1124. # Setup for compiling build tools
  1125. AC_MSG_CHECKING([for a C compiler for build tools])
  1126. if test $cross_compiling = yes; then
  1127. AC_CHECK_PROGS(CC_FOR_BUILD, gcc cc)
  1128. CFLAGS_FOR_BUILD="-g -O2 $GCC_WARNINGS"
  1129. else
  1130. CC_FOR_BUILD=$CC
  1131. CFLAGS_FOR_BUILD=$CFLAGS
  1132. fi
  1133. AC_MSG_RESULT([$CC_FOR_BUILD])
  1134. AC_SUBST([CC_FOR_BUILD])
  1135. AC_SUBST([CFLAGS_FOR_BUILD])
  1136. AC_MSG_CHECKING([for suffix of executable build tools])
  1137. if test $cross_compiling = yes; then
  1138. cat >conftest.c <<\_______EOF
  1139. int main ()
  1140. {
  1141. exit (0);
  1142. }
  1143. _______EOF
  1144. for i in .exe ""; do
  1145. compile="$CC_FOR_BUILD conftest.c -o conftest$i"
  1146. if AC_TRY_EVAL(compile); then
  1147. if (./conftest) 2>&AC_FD_CC; then
  1148. EXEEXT_FOR_BUILD=$i
  1149. break
  1150. fi
  1151. fi
  1152. done
  1153. rm -f conftest*
  1154. if test "${EXEEXT_FOR_BUILD+set}" != set; then
  1155. AC_MSG_ERROR([Cannot determine suffix of executable build tools])
  1156. fi
  1157. else
  1158. EXEEXT_FOR_BUILD=$EXEEXT
  1159. fi
  1160. AC_MSG_RESULT([$EXEEXT_FOR_BUILD])
  1161. AC_SUBST([EXEEXT_FOR_BUILD])
  1162. AC_CONFIG_FILES([
  1163. Makefile
  1164. src/Makefile
  1165. src/helper/Makefile
  1166. src/jtag/Makefile
  1167. src/jtag/drivers/Makefile
  1168. src/jtag/drivers/usb_blaster/Makefile
  1169. src/jtag/hla/Makefile
  1170. src/jtag/aice/Makefile
  1171. src/transport/Makefile
  1172. src/xsvf/Makefile
  1173. src/svf/Makefile
  1174. src/target/Makefile
  1175. src/rtos/Makefile
  1176. src/server/Makefile
  1177. src/flash/Makefile
  1178. src/flash/nor/Makefile
  1179. src/flash/nand/Makefile
  1180. src/pld/Makefile
  1181. doc/Makefile
  1182. ])
  1183. AC_OUTPUT