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.
 
 
 
 
 
 

1247 lines
39 KiB

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