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.
 
 
 
 
 
 

1314 lines
41 KiB

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