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.
 
 
 
 
 
 

1196 lines
36 KiB

  1. AC_PREREQ(2.60)
  2. AC_INIT([openocd], [0.6.0-dev],
  3. [OpenOCD Mailing List <openocd-development@lists.berlios.de>])
  4. AC_CONFIG_SRCDIR([src/openocd.c])
  5. m4_include(config_subdir.m4)dnl
  6. AM_INIT_AUTOMAKE([-Wall -Wno-portability dist-bzip2 dist-zip])
  7. AM_MAINTAINER_MODE
  8. AM_CONFIG_HEADER(config.h)
  9. AH_BOTTOM([
  10. #include <helper/system.h>
  11. #include <helper/replacements.h>
  12. ])
  13. AC_LANG_C
  14. AC_PROG_CC
  15. AC_PROG_CC_C99
  16. AM_PROG_CC_C_O
  17. AC_PROG_RANLIB
  18. dnl disable checks for C++, Fortran and GNU Java Compiler
  19. m4_defun([_LT_AC_LANG_CXX_CONFIG], [:])
  20. m4_defun([_LT_AC_LANG_F77_CONFIG], [:])
  21. m4_defun([_LT_AC_LANG_GCJ_CONFIG], [:])
  22. AC_DISABLE_SHARED
  23. AC_PROG_LIBTOOL
  24. AC_SUBST(LIBTOOL_DEPS)
  25. dnl configure checks required for Jim files (these are obsolete w/ C99)
  26. AC_C_CONST
  27. AC_TYPE_LONG_LONG_INT
  28. AC_SEARCH_LIBS([ioperm], [ioperm])
  29. AC_SEARCH_LIBS([dlopen], [dl])
  30. AC_CHECK_HEADERS(sys/socket.h)
  31. AC_CHECK_HEADERS(arpa/inet.h, [], [], [dnl
  32. #include <stdio.h>
  33. #ifdef STDC_HEADERS
  34. # include <stdlib.h>
  35. # include <stddef.h>
  36. #else
  37. # ifdef HAVE_STDLIB_H
  38. # include <stdlib.h>
  39. # endif
  40. #endif
  41. #ifdef HAVE_SYS_SOCKET_H
  42. # include <sys/socket.h>
  43. #endif
  44. ])
  45. AC_CHECK_HEADERS(elf.h)
  46. AC_CHECK_HEADERS(dirent.h)
  47. AC_CHECK_HEADERS(fcntl.h)
  48. AC_CHECK_HEADERS(ifaddrs.h, [], [], [dnl
  49. #include <stdio.h>
  50. #ifdef STDC_HEADERS
  51. # include <stdlib.h>
  52. # include <stddef.h>
  53. #else
  54. # ifdef HAVE_STDLIB_H
  55. # include <stdlib.h>
  56. # endif
  57. #endif
  58. #ifdef HAVE_SYS_SOCKET_H
  59. # include <sys/socket.h>
  60. #endif
  61. ])
  62. AC_CHECK_HEADERS(malloc.h)
  63. AC_CHECK_HEADERS(netdb.h)
  64. AC_CHECK_HEADERS([netinet/in.h], [], [], [dnl
  65. #include <stdio.h>
  66. #ifdef STDC_HEADERS
  67. # include <stdlib.h>
  68. # include <stddef.h>
  69. #else
  70. # ifdef HAVE_STDLIB_H
  71. # include <stdlib.h>
  72. # endif
  73. #endif
  74. #ifdef HAVE_SYS_SOCKET_H
  75. # include <sys/socket.h>
  76. #endif
  77. ])
  78. AC_CHECK_HEADERS(netinet/tcp.h, [], [], [dnl
  79. #include <stdio.h>
  80. #ifdef STDC_HEADERS
  81. # include <stdlib.h>
  82. # include <stddef.h>
  83. #else
  84. # ifdef HAVE_STDLIB_H
  85. # include <stdlib.h>
  86. # endif
  87. #endif
  88. #ifdef HAVE_SYS_SOCKET_H
  89. # include <sys/socket.h>
  90. #endif
  91. ])
  92. AC_CHECK_HEADERS(pthread.h)
  93. AC_CHECK_HEADERS(strings.h)
  94. AC_CHECK_HEADERS(sys/ioctl.h)
  95. AC_CHECK_HEADERS(sys/param.h)
  96. AC_CHECK_HEADERS(sys/poll.h)
  97. AC_CHECK_HEADERS(sys/select.h)
  98. AC_CHECK_HEADERS(sys/stat.h)
  99. AC_CHECK_HEADERS(sys/time.h)
  100. AC_CHECK_HEADERS(sys/types.h)
  101. AC_CHECK_HEADERS(unistd.h)
  102. AC_CHECK_HEADERS([net/if.h], [], [], [dnl
  103. #include <stdio.h>
  104. #ifdef STDC_HEADERS
  105. # include <stdlib.h>
  106. # include <stddef.h>
  107. #else
  108. # ifdef HAVE_STDLIB_H
  109. # include <stdlib.h>
  110. # endif
  111. #endif
  112. #ifdef HAVE_SYS_SOCKET_H
  113. # include <sys/socket.h>
  114. #endif
  115. ])
  116. AC_HEADER_ASSERT
  117. AC_HEADER_STDBOOL
  118. AC_HEADER_TIME
  119. AC_C_BIGENDIAN
  120. AC_CHECK_FUNCS(strndup)
  121. AC_CHECK_FUNCS(strnlen)
  122. AC_CHECK_FUNCS(gettimeofday)
  123. AC_CHECK_FUNCS(usleep)
  124. AC_CHECK_FUNCS(vasprintf)
  125. build_bitbang=no
  126. build_bitq=no
  127. is_cygwin=no
  128. is_mingw=no
  129. is_win32=no
  130. is_darwin=no
  131. # 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 -f $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(ecosboard,
  343. AS_HELP_STRING([--enable-ecosboard], [Enable building support for eCos based JTAG debugger]),
  344. [build_ecosboard=$enableval], [build_ecosboard=no])
  345. AC_ARG_ENABLE(zy1000_master,
  346. AS_HELP_STRING([--enable-zy1000-master], [Use ZY1000 JTAG master registers]),
  347. [build_zy1000_master=$enableval], [build_zy1000_master=no])
  348. AC_ARG_ENABLE(zy1000,
  349. AS_HELP_STRING([--enable-zy1000], [Enable ZY1000 interface]),
  350. [build_zy1000=$enableval], [build_zy1000=no])
  351. AC_ARG_ENABLE(ioutil,
  352. AS_HELP_STRING([--enable-ioutil], [Enable ioutil functions - useful for standalone OpenOCD implementations]),
  353. [build_ioutil=$enableval], [build_ioutil=no])
  354. case "${host_cpu}" in
  355. arm*)
  356. AC_ARG_ENABLE(ep93xx,
  357. AS_HELP_STRING([--enable-ep93xx], [Enable building support for EP93xx based SBCs]),
  358. [build_ep93xx=$enableval], [build_ep93xx=no])
  359. AC_ARG_ENABLE(at91rm9200,
  360. AS_HELP_STRING([--enable-at91rm9200], [Enable building support for AT91RM9200 based SBCs]),
  361. [build_at91rm9200=$enableval], [build_at91rm9200=no])
  362. ;;
  363. *)
  364. build_ep93xx=no
  365. build_at91rm9200=no
  366. ;;
  367. esac
  368. AC_ARG_ENABLE(gw16012,
  369. AS_HELP_STRING([--enable-gw16012], [Enable building support for the Gateworks GW16012 JTAG Programmer]),
  370. [build_gw16012=$enableval], [build_gw16012=no])
  371. AC_ARG_ENABLE(presto_libftdi,
  372. AS_HELP_STRING([--enable-presto_libftdi], [Enable building support for ASIX Presto Programmer using the libftdi driver]),
  373. [build_presto_libftdi=$enableval], [build_presto_libftdi=no])
  374. AC_ARG_ENABLE(presto_ftd2xx,
  375. AS_HELP_STRING([--enable-presto_ftd2xx], [Enable building support for ASIX Presto Programmer using the FTD2XX driver]),
  376. [build_presto_ftd2xx=$enableval], [build_presto_ftd2xx=no])
  377. AC_ARG_ENABLE(usbprog,
  378. AS_HELP_STRING([--enable-usbprog], [Enable building support for the usbprog JTAG Programmer]),
  379. [build_usbprog=$enableval], [build_usbprog=no])
  380. AC_ARG_ENABLE(oocd_trace,
  381. AS_HELP_STRING([--enable-oocd_trace],
  382. [Enable building support for some prototype OpenOCD+trace ETM capture hardware]),
  383. [build_oocd_trace=$enableval], [build_oocd_trace=no])
  384. AC_ARG_ENABLE(jlink,
  385. AS_HELP_STRING([--enable-jlink], [Enable building support for the Segger J-Link JTAG Programmer]),
  386. [build_jlink=$enableval], [build_jlink=no])
  387. AC_ARG_ENABLE(vsllink,
  388. AS_HELP_STRING([--enable-vsllink], [Enable building support for the Versaloon-Link JTAG Programmer]),
  389. [build_vsllink=$enableval], [build_vsllink=no])
  390. AC_ARG_ENABLE(rlink,
  391. AS_HELP_STRING([--enable-rlink], [Enable building support for the Raisonance RLink JTAG Programmer]),
  392. [build_rlink=$enableval], [build_rlink=no])
  393. AC_ARG_ENABLE(ulink,
  394. AS_HELP_STRING([--enable-ulink], [Enable building support for the Keil ULINK JTAG Programmer]),
  395. [build_ulink=$enableval], [build_ulink=no])
  396. AC_ARG_ENABLE(arm-jtag-ew,
  397. AS_HELP_STRING([--enable-arm-jtag-ew], [Enable building support for the Olimex ARM-JTAG-EW Programmer]),
  398. [build_armjtagew=$enableval], [build_armjtagew=no])
  399. AC_ARG_ENABLE(buspirate,
  400. AS_HELP_STRING([--enable-buspirate], [Enable building support for the Buspirate]),
  401. [build_buspirate=$enableval], [build_buspirate=no])
  402. AC_ARG_ENABLE(minidriver_dummy,
  403. AS_HELP_STRING([--enable-minidriver-dummy], [Enable the dummy minidriver.]),
  404. [build_minidriver_dummy=$enableval], [build_minidriver_dummy=no])
  405. AC_ARG_ENABLE(internal-jimtcl,
  406. AS_HELP_STRING([--disable-internal-jimtcl], [Disable building internal jimtcl]),
  407. [use_internal_jimtcl=$enableval], [use_internal_jimtcl=yes])
  408. build_minidriver=no
  409. AC_MSG_CHECKING([whether to enable ZY1000 minidriver])
  410. if test $build_zy1000 = yes; then
  411. if test $build_minidriver = yes; then
  412. AC_MSG_ERROR([Multiple minidriver options have been enabled.])
  413. fi
  414. AC_DEFINE(HAVE_JTAG_MINIDRIVER_H, 1,
  415. [Define to 1 if you have the <jtag_minidriver.h> header file.])
  416. build_minidriver=yes
  417. fi
  418. AC_MSG_RESULT($build_zy1000)
  419. AC_MSG_CHECKING([whether to enable dummy minidriver])
  420. if test $build_minidriver_dummy = yes; then
  421. if test $build_minidriver = yes; then
  422. AC_MSG_ERROR([Multiple minidriver options have been enabled.])
  423. fi
  424. build_minidriver=yes
  425. AC_DEFINE(BUILD_MINIDRIVER_DUMMY, 1, [Use the dummy minidriver.])
  426. AC_DEFINE(HAVE_JTAG_MINIDRIVER_H, 1,
  427. [Define to 1 if you have the <jtag_minidriver.h> header file.])
  428. fi
  429. AC_MSG_RESULT($build_minidriver_dummy)
  430. AC_MSG_CHECKING([whether standard drivers can be built])
  431. if test "$build_minidriver" = yes; then
  432. AC_MSG_RESULT([no])
  433. AC_MSG_WARN([Using the minidriver disables all other drivers.])
  434. sleep 2
  435. else
  436. AC_MSG_RESULT([yes])
  437. fi
  438. case "${host_cpu}" in
  439. i?86|x86*)
  440. ;;
  441. *)
  442. if test x$parport_use_ppdev = xno; then
  443. AC_MSG_WARN([--disable-parport-ppdev is not supported by the host CPU])
  444. fi
  445. parport_use_ppdev=yes
  446. ;;
  447. esac
  448. case $host in
  449. *-cygwin*)
  450. is_win32=yes
  451. parport_use_ppdev=no
  452. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[return __MINGW32__;]])],
  453. [is_mingw=yes],[is_mingw=no])
  454. if test $is_mingw = yes; then
  455. AC_DEFINE(IS_MINGW, 1, [1 if building for MinGW.])
  456. if test x$parport_use_giveio = xno; then
  457. AC_MSG_WARN([--disable-parport-giveio is not supported by MinGW32 hosts])
  458. fi
  459. parport_use_giveio=yes
  460. is_cygwin=no
  461. else
  462. is_cygwin=yes
  463. AC_DEFINE(IS_CYGWIN, 1, [1 if building for Cygwin.])
  464. # sys/io.h needed under cygwin for parport access
  465. if test $build_parport = yes; then
  466. AC_CHECK_HEADERS(sys/io.h,[],AC_MSG_ERROR([Please install the cygwin ioperm package]))
  467. fi
  468. fi
  469. AC_DEFINE(IS_WIN32, 1, [1 if building for Win32.])
  470. AC_DEFINE(IS_DARWIN, 0, [0 if not building for Darwin.])
  471. ;;
  472. *-mingw*)
  473. is_mingw=yes
  474. is_win32=yes
  475. parport_use_ppdev=no
  476. if test x$parport_use_giveio = xno; then
  477. AC_MSG_WARN([--disable-parport-giveio is not supported by MinGW32 hosts])
  478. fi
  479. parport_use_giveio=yes
  480. CFLAGS="$CFLAGS -D__USE_MINGW_ANSI_STDIO"
  481. AC_DEFINE(IS_MINGW, 1, [1 if building for MinGW.])
  482. AC_DEFINE(IS_WIN32, 1, [1 if building for Win32.])
  483. AC_DEFINE(IS_DARWIN, 0, [0 if not building for Darwin.])
  484. ;;
  485. *darwin*)
  486. is_darwin=yes
  487. if test x$parport_use_giveio = xyes; then
  488. AC_MSG_WARN([--enable-parport-giveio cannot be used by Darwin hosts])
  489. fi
  490. parport_use_giveio=no
  491. AC_DEFINE(IS_CYGWIN, 0, [0 if not building for Cygwin.])
  492. AC_DEFINE(IS_WIN32, 0, [0 if not building for Win32.])
  493. AC_DEFINE(IS_DARWIN, 1, [1 if building for Darwin.])
  494. ;;
  495. *)
  496. if test x$parport_use_giveio = xyes; then
  497. AC_MSG_WARN([--enable-parport-giveio cannot be used by ]$host[ hosts])
  498. fi
  499. parport_use_giveio=no
  500. AC_DEFINE(IS_CYGWIN, 0, [0 if not building for Cygwin.])
  501. AC_DEFINE(IS_WIN32, 0, [0 if not building for Win32.])
  502. AC_DEFINE(IS_DARWIN, 0, [0 if not building for Darwin.])
  503. ;;
  504. esac
  505. if test $build_parport = yes; then
  506. build_bitbang=yes
  507. AC_DEFINE(BUILD_PARPORT, 1, [1 if you want parport.])
  508. else
  509. AC_DEFINE(BUILD_PARPORT, 0, [0 if you don't want parport.])
  510. fi
  511. if test $build_dummy = yes; then
  512. build_bitbang=yes
  513. AC_DEFINE(BUILD_DUMMY, 1, [1 if you want dummy driver.])
  514. else
  515. AC_DEFINE(BUILD_DUMMY, 0, [0 if you don't want dummy driver.])
  516. fi
  517. if test $build_ep93xx = yes; then
  518. build_bitbang=yes
  519. AC_DEFINE(BUILD_EP93XX, 1, [1 if you want ep93xx.])
  520. else
  521. AC_DEFINE(BUILD_EP93XX, 0, [0 if you don't want ep93xx.])
  522. fi
  523. if test $build_ecosboard = yes; then
  524. AC_DEFINE(BUILD_ECOSBOARD, 1, [1 if you want eCosBoard.])
  525. else
  526. AC_DEFINE(BUILD_ECOSBOARD, 0, [0 if you don't want eCosBoard.])
  527. fi
  528. if test $build_zy1000 = yes; then
  529. AC_DEFINE(BUILD_ZY1000, 1, [1 if you want ZY1000.])
  530. else
  531. AC_DEFINE(BUILD_ZY1000, 0, [0 if you don't want ZY1000.])
  532. fi
  533. if test $build_zy1000_master = yes; then
  534. AC_DEFINE(BUILD_ZY1000_MASTER, 1, [1 if you want ZY1000 JTAG master registers.])
  535. else
  536. AC_DEFINE(BUILD_ZY1000_MASTER, 0, [0 if you don't want ZY1000 JTAG master registers.])
  537. fi
  538. if test $build_at91rm9200 = yes; then
  539. build_bitbang=yes
  540. AC_DEFINE(BUILD_AT91RM9200, 1, [1 if you want at91rm9200.])
  541. else
  542. AC_DEFINE(BUILD_AT91RM9200, 0, [0 if you don't want at91rm9200.])
  543. fi
  544. if test x$parport_use_ppdev = xyes; then
  545. AC_DEFINE(PARPORT_USE_PPDEV, 1, [1 if you want parport to use ppdev.])
  546. else
  547. AC_DEFINE(PARPORT_USE_PPDEV, 0, [0 if you don't want parport to use ppdev.])
  548. fi
  549. if test x$parport_use_giveio = xyes; then
  550. AC_DEFINE(PARPORT_USE_GIVEIO, 1, [1 if you want parport to use giveio.])
  551. else
  552. AC_DEFINE(PARPORT_USE_GIVEIO, 0, [0 if you don't want parport to use giveio.])
  553. fi
  554. if test $build_bitbang = yes; then
  555. AC_DEFINE(BUILD_BITBANG, 1, [1 if you want a bitbang interface.])
  556. else
  557. AC_DEFINE(BUILD_BITBANG, 0, [0 if you don't want a bitbang interface.])
  558. fi
  559. if test $build_ft2232_libftdi = yes; then
  560. AC_DEFINE(BUILD_FT2232_LIBFTDI, 1, [1 if you want libftdi ft2232.])
  561. else
  562. AC_DEFINE(BUILD_FT2232_LIBFTDI, 0, [0 if you don't want libftdi ft2232.])
  563. fi
  564. if test $build_ft2232_ftd2xx = yes; then
  565. AC_DEFINE(BUILD_FT2232_FTD2XX, 1, [1 if you want ftd2xx ft2232.])
  566. else
  567. AC_DEFINE(BUILD_FT2232_FTD2XX, 0, [0 if you don't want ftd2xx ft2232.])
  568. fi
  569. if test $build_usb_blaster_libftdi = yes; then
  570. build_bitbang=yes
  571. AC_DEFINE(BUILD_USB_BLASTER_LIBFTDI, 1, [1 if you want libftdi usb_blaster.])
  572. else
  573. AC_DEFINE(BUILD_USB_BLASTER_LIBFTDI, 0, [0 if you don't want libftdi usb_blaster.])
  574. fi
  575. if test $build_usb_blaster_ftd2xx = yes; then
  576. build_bitbang=yes
  577. AC_DEFINE(BUILD_USB_BLASTER_FTD2XX, 1, [1 if you want ftd2xx usb_blaster.])
  578. else
  579. AC_DEFINE(BUILD_USB_BLASTER_FTD2XX, 0, [0 if you don't want ftd2xx usb_blaster.])
  580. fi
  581. if test $build_amtjtagaccel = yes; then
  582. AC_DEFINE(BUILD_AMTJTAGACCEL, 1, [1 if you want the Amontec JTAG-Accelerator driver.])
  583. else
  584. AC_DEFINE(BUILD_AMTJTAGACCEL, 0, [0 if you don't want the Amontec JTAG-Accelerator driver.])
  585. fi
  586. if test $build_gw16012 = yes; then
  587. AC_DEFINE(BUILD_GW16012, 1, [1 if you want the Gateworks GW16012 driver.])
  588. else
  589. AC_DEFINE(BUILD_GW16012, 0, [0 if you don't want the Gateworks GW16012 driver.])
  590. fi
  591. if test $build_presto_libftdi = yes; then
  592. build_bitq=yes
  593. AC_DEFINE(BUILD_PRESTO_LIBFTDI, 1, [1 if you want the ASIX PRESTO driver using libftdi.])
  594. else
  595. AC_DEFINE(BUILD_PRESTO_LIBFTDI, 0, [0 if you don't want the ASIX PRESTO driver using libftdi.])
  596. fi
  597. if test $build_presto_ftd2xx = yes; then
  598. build_bitq=yes
  599. AC_DEFINE(BUILD_PRESTO_FTD2XX, 1, [1 if you want the ASIX PRESTO driver using FTD2XX.])
  600. else
  601. AC_DEFINE(BUILD_PRESTO_FTD2XX, 0, [0 if you don't want the ASIX PRESTO driver using FTD2XX.])
  602. fi
  603. if test $build_bitq = yes; then
  604. AC_DEFINE(BUILD_BITQ, 1, [1 if you want a bitq interface.])
  605. else
  606. AC_DEFINE(BUILD_BITQ, 0, [0 if you don't want a bitq interface.])
  607. fi
  608. if test $build_usbprog = yes; then
  609. AC_DEFINE(BUILD_USBPROG, 1, [1 if you want the usbprog JTAG driver.])
  610. else
  611. AC_DEFINE(BUILD_USBPROG, 0, [0 if you don't want the usbprog JTAG driver.])
  612. fi
  613. if test $build_oocd_trace = yes; then
  614. AC_DEFINE(BUILD_OOCD_TRACE, 1, [1 if you want the OpenOCD+trace ETM capture driver.])
  615. else
  616. AC_DEFINE(BUILD_OOCD_TRACE, 0, [0 if you don't want the OpenOCD+trace ETM capture driver.])
  617. fi
  618. if test $build_jlink = yes; then
  619. AC_DEFINE(BUILD_JLINK, 1, [1 if you want the J-Link JTAG driver.])
  620. else
  621. AC_DEFINE(BUILD_JLINK, 0, [0 if you don't want the J-Link JTAG driver.])
  622. fi
  623. if test $build_vsllink = yes; then
  624. AC_DEFINE(BUILD_VSLLINK, 1, [1 if you want the Versaloon-Link JTAG driver.])
  625. else
  626. AC_DEFINE(BUILD_VSLLINK, 0, [0 if you don't want the Versaloon-Link JTAG driver.])
  627. fi
  628. if test $build_rlink = yes; then
  629. AC_DEFINE(BUILD_RLINK, 1, [1 if you want the RLink JTAG driver.])
  630. else
  631. AC_DEFINE(BUILD_RLINK, 0, [0 if you don't want the RLink JTAG driver.])
  632. fi
  633. if test $build_ulink = yes; then
  634. AC_DEFINE(BUILD_ULINK, 1, [1 if you want the ULINK JTAG driver.])
  635. else
  636. AC_DEFINE(BUILD_ULINK, 0, [0 if you don't want the ULINK JTAG driver.])
  637. fi
  638. if test $build_armjtagew = yes; then
  639. AC_DEFINE(BUILD_ARMJTAGEW, 1, [1 if you want the ARM-JTAG-EW JTAG driver.])
  640. else
  641. AC_DEFINE(BUILD_ARMJTAGEW, 0, [0 if you don't want the ARM-JTAG-EW JTAG driver.])
  642. fi
  643. if test $build_buspirate = yes; then
  644. AC_DEFINE(BUILD_BUSPIRATE, 1, [1 if you want the Buspirate JTAG driver.])
  645. else
  646. AC_DEFINE(BUILD_BUSPIRATE, 0, [0 if you don't want the Buspirate JTAG driver.])
  647. fi
  648. if test "$use_internal_jimtcl" = yes; then
  649. if test -f "$srcdir/jimtcl/configure.ac"; then
  650. AX_CONFIG_SUBDIR_OPTION([jimtcl], [--with-jim-ext=nvp --disable-lineedit --disable-install-jim])
  651. else
  652. AC_MSG_ERROR([jimtcl not found, run git submodule init and git submodule update.])
  653. fi
  654. fi
  655. #-- Deal with MingW/Cygwin FTD2XX issues
  656. if test $is_win32 = yes; then
  657. if test "${with_ftd2xx_linux_tardir+set}" = set
  658. then
  659. AC_MSG_ERROR([The option: with_ftd2xx_linux_tardir is for LINUX only.])
  660. fi
  661. if test $build_ft2232_ftd2xx = yes -o $build_presto_ftd2xx = yes -o $build_usb_blaster_ftd2xx = yes ; then
  662. AC_MSG_CHECKING([for ftd2xx.lib exists (win32)])
  663. # if we are given a zipdir...
  664. if test "${with_ftd2xx_win32_zipdir+set}" = set
  665. then
  666. # Set the CFLAGS for "ftd2xx.h"
  667. f=$with_ftd2xx_win32_zipdir/ftd2xx.h
  668. if test ! -f $f ; then
  669. AC_MSG_ERROR([File: $f cannot be found])
  670. fi
  671. CFLAGS="$CFLAGS -I$with_ftd2xx_win32_zipdir"
  672. # And calculate the LDFLAGS for the machine
  673. case "$host_cpu" in
  674. i?86|x86_32)
  675. LDFLAGS="$LDFLAGS -L$with_ftd2xx_win32_zipdir/i386"
  676. LIBS="$LIBS -lftd2xx"
  677. f=$with_ftd2xx_win32_zipdir/i386/ftd2xx.lib
  678. ;;
  679. amd64|x86_64)
  680. LDFLAGS="$LDFLAGS -L$with_ftd2xx_win32_zipdir/amd64"
  681. LIBS="$LIBS -lftd2xx"
  682. f=$with_ftd2xx_win32_zipdir/amd64/ftd2xx.lib
  683. ;;
  684. *)
  685. AC_MSG_ERROR([Unknown Win32 host cpu: $host_cpu])
  686. ;;
  687. esac
  688. if test ! -f $f ; then
  689. AC_MSG_ERROR([Library: $f not found])
  690. fi
  691. else
  692. LIBS="$LIBS -lftd2xx"
  693. AC_MSG_WARN([ASSUMPTION: The (win32) FTDICHIP.COM files: ftd2xx.h and ftd2xx.lib are in a proper place])
  694. fi
  695. fi
  696. fi # win32
  697. if test $is_darwin = yes ; then
  698. if test "${with_ftd2xx_win32_zipdir+set}" = set
  699. then
  700. AC_MSG_ERROR([The option: --with-ftd2xx-win32-zipdir is for win32 only])
  701. fi
  702. if test "${with_ftd2xx_linux_tardir+set}" = set
  703. then
  704. AC_MSG_ERROR([The option: with_ftd2xx_linux_tardir is for LINUX only.])
  705. fi
  706. if test $build_ft2232_ftd2xx = yes -o $build_presto_ftd2xx = yes ; then
  707. AC_MSG_CHECKING([for libftd2xx.a (darwin)])
  708. if test ! -f /usr/local/include/ftd2xx.h ; then
  709. AC_MSG_ERROR([ftd2xx library from FTDICHIP.com seems to be missing, cannot find: /usr/local/include/ftd2xx.h])
  710. fi
  711. CFLAGS="$CFLAGS -I/usr/local/include"
  712. LDFLAGS="$LDFLAGS -L/usr/local/lib"
  713. LIBS="$LIBS -lftd2xx"
  714. AC_MSG_RESULT([-L/usr/local/lib -lftd2xx])
  715. fi
  716. fi # darwin
  717. if test $is_win32 = no && test $is_darwin = no ; then
  718. if test "${with_ftd2xx_win32_zipdir+set}" = set
  719. then
  720. AC_MSG_ERROR([The option: --with-ftd2xx-win32-zipdir is for win32 only])
  721. fi
  722. if test $build_ft2232_ftd2xx = yes -o $build_presto_ftd2xx = yes ; then
  723. # Must be linux
  724. if test $host_os != linux-gnu && test $host_os != linux ; then
  725. AC_MSG_ERROR([The (linux) ftd2xx library from FTDICHIP.com is linux only. Try --enable-ft2232-libftdi instead])
  726. fi
  727. # Are we given a TAR directory?
  728. if test "${with_ftd2xx_linux_tardir+set}" = set
  729. then
  730. AC_MSG_CHECKING([uninstalled ftd2xx distribution])
  731. # The .H file is simple..
  732. FTD2XX_H=$with_ftd2xx_linux_tardir/ftd2xx.h
  733. if test ! -f "${FTD2XX_H}"; then
  734. AC_MSG_ERROR([Option: --with-ftd2xx-linux-tardir appears wrong, cannot find: ${FTD2XX_H}])
  735. fi
  736. CFLAGS="$CFLAGS -I$with_ftd2xx_linux_tardir"
  737. if test $with_ftd2xx_lib = shared; then
  738. FTD2XX_LDFLAGS="-L$with_ftd2xx_linux_tardir"
  739. FTD2XX_LIB="-lftd2xx"
  740. else
  741. # Test #1 - v1.0.x
  742. case "$host_cpu" in
  743. i?86|x86_32)
  744. dir=build/i386;;
  745. amd64|x86_64)
  746. dir=build/x86_64;;
  747. *)
  748. dir=none;;
  749. esac
  750. if test -f "$with_ftd2xx_linux_tardir/$dir/libftd2xx.a"; then
  751. FTD2XX_LDFLAGS="-L$with_ftd2xx_linux_tardir/$dir"
  752. # Also needs -lrt
  753. FTD2XX_LIB="-lftd2xx -lrt"
  754. else
  755. # Test Number2.
  756. # Grr.. perhaps it exists as a version number?
  757. FTD2XX_LIB="$with_ftd2xx_linux_tardir/static_lib/libftd2xx.a.*.*.*"
  758. count=`ls ${FTD2XX_LIB} | wc -l`
  759. if test $count -gt 1 ; then
  760. AC_MSG_ERROR([Multiple libftd2xx.a files found in: $with_ftd2xx_linux_tardir/static_lib sorry cannot handle this yet])
  761. fi
  762. if test $count -ne 1 ; then
  763. AC_MSG_ERROR([Not found: $f, option: --with-ftd2xx-linux-tardir appears to be wrong])
  764. fi
  765. # Because the "-l" rules do not understand version numbers...
  766. # we will just stuff the absolute path onto the LIBS variable
  767. FTD2XX_LIB="`ls ${FTD2XX_LIB}` -lpthread"
  768. FTD2XX_LDFLAGS=""
  769. fi
  770. fi
  771. LDFLAGS="${LDFLAGS} ${FTD2XX_LDFLAGS}"
  772. LIBS="${LIBS} ${FTD2XX_LIB}"
  773. AC_MSG_RESULT([${FTD2XX_LDFLAGS} ${FTD2XX_LIB}])
  774. else
  775. AC_CHECK_HEADER([ftd2xx.h],[],[
  776. AC_MSG_ERROR([You seem to be missing the FTD2xx driver header file.])
  777. ])
  778. AC_SEARCH_LIBS([FT_GetLibraryVersion],[ftd2xx],,[
  779. AC_MSG_ERROR([You appear to be missing the FTD2xx driver library.])
  780. ],[])
  781. fi
  782. fi
  783. fi # linux
  784. if test $build_ft2232_ftd2xx = yes -o $build_presto_ftd2xx = yes; then
  785. # Before we go any further - make sure we can *BUILD* and *RUN*
  786. # a simple app with the "ftd2xx.lib" file - in what ever form we where given
  787. # We should be able to compile, link and run this test program now
  788. AC_MSG_CHECKING([whether ftd2xx library works])
  789. #
  790. # Save the LDFLAGS for later..
  791. LDFLAGS_SAVE=$LDFLAGS
  792. CFLAGS_SAVE=$CFLAGS
  793. _LDFLAGS=`eval echo $LDFLAGS`
  794. _CFLAGS=`eval echo $CFLAGS`
  795. LDFLAGS=$_LDFLAGS
  796. CFLAGS=$_CFLAGS
  797. AC_RUN_IFELSE([AC_LANG_PROGRAM([[
  798. #include "confdefs.h"
  799. #if IS_WIN32
  800. #include "windows.h"
  801. #endif
  802. #include <stdio.h>
  803. #include <ftd2xx.h>
  804. ]], [[
  805. DWORD x;
  806. FT_GetLibraryVersion( &x );
  807. ]])], [
  808. AC_MSG_RESULT([Success!])
  809. ], [
  810. AC_MSG_ERROR([Cannot build & run test program using ftd2xx.lib])
  811. ], [
  812. AC_MSG_RESULT([Skipping as we are cross-compiling])
  813. ])
  814. AC_MSG_CHECKING([for ftd2xx highspeed device support])
  815. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  816. #include "confdefs.h"
  817. #if IS_WIN32
  818. #include "windows.h"
  819. #endif
  820. #include <stdio.h>
  821. #include <ftd2xx.h>
  822. DWORD x = FT_DEVICE_4232H;
  823. ]], [])], [
  824. AC_DEFINE(BUILD_FT2232_HIGHSPEED, [1],
  825. [Support FT2232H/FT4232HS with FTD2XX or libftdi.])
  826. build_ft2232_highspeed=yes
  827. ], [
  828. build_ft2232_highspeed=no
  829. ])
  830. AC_MSG_RESULT([$build_ft2232_highspeed])
  831. if test $build_ft2232_highspeed = no; then
  832. AC_MSG_WARN([You need a newer FTD2XX driver (version 2.04.16 or later).])
  833. fi
  834. LDFLAGS=$LDFLAGS_SAVE
  835. CFLAGS=$CFLAGS_SAVE
  836. fi
  837. if test $build_ft2232_libftdi = yes ; then
  838. # We assume: the package is preinstalled in the proper place
  839. # these present as 2 libraries..
  840. LIBS="$LIBS -lftdi -lusb"
  841. #
  842. # Try to build a small program.
  843. AC_MSG_CHECKING([Build & Link with libftdi...])
  844. LDFLAGS_SAVE=$LDFLAGS
  845. CFLAGS_SAVE=$CFLAGS
  846. _LDFLAGS=`eval echo $LDFLAGS`
  847. _CFLAGS=`eval echo $CFLAGS`
  848. LDFLAGS=$_LDFLAGS
  849. CFLAGS=$_CFLAGS
  850. AC_RUN_IFELSE([AC_LANG_PROGRAM([[
  851. #include <stdio.h>
  852. #include <ftdi.h>
  853. ]], [[
  854. struct ftdi_context *p;
  855. p = ftdi_new();
  856. if( p != NULL ){
  857. return 0;
  858. } else {
  859. fprintf( stderr, "calling ftdi_new() failed\n");
  860. return 1;
  861. }
  862. ]])], [
  863. AC_MSG_RESULT([Success])
  864. ], [
  865. AC_MSG_ERROR([Cannot build & run test program using libftdi])
  866. ], [
  867. AC_MSG_RESULT([Skipping as we are cross-compiling])
  868. ])
  869. AC_MSG_CHECKING([for libftdi highspeed device support])
  870. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  871. #include <stdio.h>
  872. #include <ftdi.h>
  873. ]], [[
  874. enum ftdi_chip_type x = TYPE_2232H;
  875. ]])], [
  876. AC_DEFINE(BUILD_FT2232_HIGHSPEED, [1],
  877. [Support FT2232H/FT4232HS with FTD2XX or libftdi.])
  878. build_ft2232_highspeed=yes
  879. ], [
  880. build_ft2232_highspeed=no
  881. ])
  882. AC_MSG_RESULT([$build_ft2232_highspeed])
  883. if test $build_ft2232_highspeed = no; then
  884. AC_MSG_WARN([You need a newer libftdi version (0.16 or later).])
  885. fi
  886. # Restore the 'unexpanded ldflags'
  887. LDFLAGS=$LDFLAGS_SAVE
  888. CFLAGS=$CFLAGS_SAVE
  889. fi
  890. # check for usb.h when a driver will require it
  891. build_usb=no
  892. if test $build_jlink = yes -o $build_vsllink = yes -o $build_usbprog = yes -o \
  893. $build_rlink = yes -o $build_ulink = yes -o $build_armjtagew = yes
  894. then
  895. AC_CHECK_HEADERS([usb.h],[],
  896. [AC_MSG_ERROR([usb.h is required to build some OpenOCD driver(s)])])
  897. build_usb=yes
  898. fi
  899. AM_CONDITIONAL(RELEASE, test $build_release = yes)
  900. AM_CONDITIONAL(PARPORT, test $build_parport = yes)
  901. AM_CONDITIONAL(DUMMY, test $build_dummy = yes)
  902. AM_CONDITIONAL(GIVEIO, test x$parport_use_giveio = xyes)
  903. AM_CONDITIONAL(EP93XX, test $build_ep93xx = yes)
  904. AM_CONDITIONAL(ECOSBOARD, test $build_ecosboard = yes)
  905. AM_CONDITIONAL(ZY1000, test $build_zy1000 = yes)
  906. AM_CONDITIONAL(ZY1000_MASTER, test $build_zy1000_master = yes)
  907. AM_CONDITIONAL(IOUTIL, test $build_ioutil = yes)
  908. AM_CONDITIONAL(AT91RM9200, test $build_at91rm9200 = yes)
  909. AM_CONDITIONAL(BITBANG, test $build_bitbang = yes)
  910. AM_CONDITIONAL(FT2232_LIBFTDI, test $build_ft2232_libftdi = yes)
  911. AM_CONDITIONAL(FT2232_DRIVER, test $build_ft2232_ftd2xx = yes -o $build_ft2232_libftdi = yes)
  912. AM_CONDITIONAL(USB_BLASTER_LIBFTDI, test $build_usb_blaster_libftdi = yes)
  913. AM_CONDITIONAL(USB_BLASTER_DRIVER, test $build_usb_blaster_ftd2xx = yes -o $build_usb_blaster_libftdi = yes)
  914. AM_CONDITIONAL(AMTJTAGACCEL, test $build_amtjtagaccel = yes)
  915. AM_CONDITIONAL(GW16012, test $build_gw16012 = yes)
  916. AM_CONDITIONAL(PRESTO_LIBFTDI, test $build_presto_libftdi = yes)
  917. AM_CONDITIONAL(PRESTO_DRIVER, test $build_presto_ftd2xx = yes -o $build_presto_libftdi = yes)
  918. AM_CONDITIONAL(USBPROG, test $build_usbprog = yes)
  919. AM_CONDITIONAL(OOCD_TRACE, test $build_oocd_trace = yes)
  920. AM_CONDITIONAL(JLINK, test $build_jlink = yes)
  921. AM_CONDITIONAL(VSLLINK, test $build_vsllink = yes)
  922. AM_CONDITIONAL(RLINK, test $build_rlink = yes)
  923. AM_CONDITIONAL(ULINK, test $build_ulink = yes)
  924. AM_CONDITIONAL(ARMJTAGEW, test $build_armjtagew = yes)
  925. AM_CONDITIONAL(BUSPIRATE, test $build_buspirate = yes)
  926. AM_CONDITIONAL(USB, test $build_usb = yes)
  927. AM_CONDITIONAL(IS_CYGWIN, test $is_cygwin = yes)
  928. AM_CONDITIONAL(IS_MINGW, test $is_mingw = yes)
  929. AM_CONDITIONAL(IS_WIN32, test $is_win32 = yes)
  930. AM_CONDITIONAL(IS_DARWIN, test $is_darwin = yes)
  931. AM_CONDITIONAL(BITQ, test $build_bitq = yes)
  932. AM_CONDITIONAL(MINIDRIVER, test $build_minidriver = yes)
  933. AM_CONDITIONAL(MINIDRIVER_DUMMY, test $build_minidriver_dummy = yes)
  934. AM_CONDITIONAL(INTERNAL_JIMTCL, test $use_internal_jimtcl = yes)
  935. # Look for environ alternatives. Possibility #1: is environ in unistd.h or stdlib.h?
  936. AC_MSG_CHECKING([for environ in unistd.h and stdlib.h])
  937. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  938. #define _GNU_SOURCE
  939. #include <unistd.h>
  940. #include <stdlib.h>
  941. ]], [[char **ep = environ;]]
  942. )], [
  943. AC_MSG_RESULT([yes])
  944. has_environ=yes
  945. ], [
  946. AC_MSG_RESULT([no])
  947. # Possibility #2: can environ be found in an available library?
  948. AC_MSG_CHECKING([for extern environ])
  949. AC_LINK_IFELSE([AC_LANG_PROGRAM([[
  950. extern char **environ;
  951. ]], [[char **ep = environ;]]
  952. )], [
  953. AC_DEFINE(NEED_ENVIRON_EXTERN, [1], [Must declare 'environ' to use it.])
  954. has_environ=yes
  955. ], [
  956. has_environ=no
  957. ])
  958. AC_MSG_RESULT([${has_environ}])
  959. ])
  960. if test "${has_environ}" != "yes" ; then
  961. AC_MSG_FAILURE([Could not find 'environ' in unistd.h or available libraries.])
  962. fi
  963. AC_DEFINE([_GNU_SOURCE],[1],[Use GNU C library extensions (e.g. stdndup).])
  964. # set default gcc warnings
  965. GCC_WARNINGS="-Wall -Wstrict-prototypes -Wformat-security -Wshadow"
  966. if test "${gcc_wextra}" = yes; then
  967. GCC_WARNINGS="${GCC_WARNINGS} -Wextra -Wno-unused-parameter"
  968. GCC_WARNINGS="${GCC_WARNINGS} -Wbad-function-cast"
  969. GCC_WARNINGS="${GCC_WARNINGS} -Wcast-align"
  970. GCC_WARNINGS="${GCC_WARNINGS} -Wredundant-decls"
  971. fi
  972. if test "${gcc_werror}" = yes; then
  973. GCC_WARNINGS="${GCC_WARNINGS} -Werror"
  974. fi
  975. # overide default gcc cflags
  976. if test $gcc_warnings = yes; then
  977. CFLAGS="$CFLAGS $GCC_WARNINGS"
  978. fi
  979. # Setup for compiling build tools
  980. AC_MSG_CHECKING([for a C compiler for build tools])
  981. if test $cross_compiling = yes; then
  982. AC_CHECK_PROGS(CC_FOR_BUILD, gcc cc)
  983. CFLAGS_FOR_BUILD="-g -O2 $GCC_WARNINGS"
  984. else
  985. CC_FOR_BUILD=$CC
  986. CFLAGS_FOR_BUILD=$CFLAGS
  987. fi
  988. AC_MSG_RESULT([$CC_FOR_BUILD])
  989. AC_SUBST(CC_FOR_BUILD)
  990. AC_SUBST(CFLAGS_FOR_BUILD)
  991. AC_MSG_CHECKING([for suffix of executable build tools])
  992. if test $cross_compiling = yes; then
  993. cat >conftest.c <<\_______EOF
  994. int main ()
  995. {
  996. exit (0);
  997. }
  998. _______EOF
  999. for i in .exe ""; do
  1000. compile="$CC_FOR_BUILD conftest.c -o conftest$i"
  1001. if AC_TRY_EVAL(compile); then
  1002. if (./conftest) 2>&AC_FD_CC; then
  1003. EXEEXT_FOR_BUILD=$i
  1004. break
  1005. fi
  1006. fi
  1007. done
  1008. rm -f conftest*
  1009. if test "${EXEEXT_FOR_BUILD+set}" != set; then
  1010. AC_MSG_ERROR([Cannot determine suffix of executable build tools])
  1011. fi
  1012. else
  1013. EXEEXT_FOR_BUILD=$EXEEXT
  1014. fi
  1015. AC_MSG_RESULT([$EXEEXT_FOR_BUILD])
  1016. AC_SUBST(EXEEXT_FOR_BUILD)
  1017. AC_OUTPUT(dnl
  1018. Makefile dnl
  1019. src/Makefile dnl
  1020. src/helper/Makefile dnl
  1021. src/jtag/Makefile dnl
  1022. src/jtag/drivers/Makefile dnl
  1023. src/transport/Makefile dnl
  1024. src/xsvf/Makefile dnl
  1025. src/svf/Makefile dnl
  1026. src/target/Makefile dnl
  1027. src/rtos/Makefile dnl
  1028. src/server/Makefile dnl
  1029. src/flash/Makefile dnl
  1030. src/flash/nor/Makefile dnl
  1031. src/flash/nand/Makefile dnl
  1032. src/pld/Makefile dnl
  1033. doc/Makefile dnl
  1034. )